BaseHtmlAttr.js
2 years ago
FileExtensionHtmlAttr.js
2 years ago
MaxFileSizeHtmlAttr.js
2 years ago
MaxFilesHtmlAttr.js
2 years ago
RemainingCalcAttr.js
2 years ago
MaxFileSizeHtmlAttr.js
25 lines
| 1 | import MaxFilesHtmlAttr from './MaxFilesHtmlAttr'; |
| 2 | |
| 3 | function MaxFileSizeHtmlAttr() { |
| 4 | MaxFilesHtmlAttr.call( this ); |
| 5 | |
| 6 | this.attrName = 'max_size'; |
| 7 | |
| 8 | /** |
| 9 | * @param input {FileData|InputData} |
| 10 | */ |
| 11 | this.setInput = function ( input ) { |
| 12 | MaxFilesHtmlAttr.prototype.setInput.call( this, input ); |
| 13 | |
| 14 | const { previewsContainer } = input.callable; |
| 15 | const { max_size = 1 } = JSON.parse( |
| 16 | previewsContainer.dataset.args, |
| 17 | ); |
| 18 | |
| 19 | this.initial = +max_size; |
| 20 | }; |
| 21 | } |
| 22 | |
| 23 | MaxFileSizeHtmlAttr.prototype = Object.create( MaxFilesHtmlAttr.prototype ); |
| 24 | |
| 25 | export default MaxFileSizeHtmlAttr; |