11import { DynamicValue , ListValue , ObjectItem } from "mendix" ;
2- import { FileUploaderContainerProps , MaxFilePerUploadTypeEnum , UploadModeEnum } from "../../typings/FileUploaderProps" ;
2+ import { FileUploaderContainerProps , UploadModeEnum } from "../../typings/FileUploaderProps" ;
33import { action , computed , makeObservable , observable } from "mobx" ;
44import { Big } from "big.js" ;
55import { getImageUploaderFormats , parseAllowedFormats } from "../utils/parseAllowedFormats" ;
@@ -27,9 +27,7 @@ export class FileUploaderStore {
2727 _maxFileSizeMiB = 0 ;
2828 _maxFileSize = 0 ;
2929 _ds ?: ListValue ;
30- _maxFilesPerUpload : number ;
31- _maxFilePerUploadType : MaxFilePerUploadTypeEnum ;
32- _maxFilesPerUploadExpression : DynamicValue < Big > ;
30+ _maxFilesPerUpload : DynamicValue < Big > ;
3331
3432 errorMessage ?: string = undefined ;
3533
@@ -40,8 +38,6 @@ export class FileUploaderStore {
4038 this . _maxFileSizeMiB = props . maxFileSize ;
4139 this . _maxFileSize = this . _maxFileSizeMiB * 1024 * 1024 ;
4240 this . _maxFilesPerUpload = props . maxFilesPerUpload ;
43- this . _maxFilePerUploadType = props . maxFilePerUploadType ;
44- this . _maxFilesPerUploadExpression = props . maxFilesPerUploadExpression ;
4541 this . _uploadMode = props . uploadMode ;
4642
4743 this . objectCreationHelper = new ObjectCreationHelper ( this . _widgetName , props . objectCreationTimeout ) ;
@@ -103,8 +99,6 @@ export class FileUploaderStore {
10399
104100 // Update max files properties
105101 this . _maxFilesPerUpload = props . maxFilesPerUpload ;
106- this . _maxFilePerUploadType = props . maxFilePerUploadType ;
107- this . _maxFilesPerUploadExpression = props . maxFilesPerUploadExpression ;
108102
109103 this . translations . updateProps ( props ) ;
110104 this . updateProcessor . processUpdate ( this . _ds ) ;
@@ -125,23 +119,20 @@ export class FileUploaderStore {
125119 . join ( ", " ) ;
126120 }
127121
128- get maxFilesPerUpload ( ) : number | undefined {
129- if ( this . _maxFilePerUploadType === "expression" ) {
130- const expressionValue = this . _maxFilesPerUploadExpression . value ;
131- if ( expressionValue && ! isNaN ( Number ( expressionValue ) ) ) {
132- return Number ( expressionValue ) ;
133- }
134- // Fallback to default if expression is invalid
135- return undefined ;
122+ get maxFilesPerUpload ( ) : number {
123+ const expressionValue = this . _maxFilesPerUpload . value ;
124+ if ( expressionValue && ! isNaN ( Number ( expressionValue ) ) ) {
125+ return Number ( expressionValue ) ;
136126 }
137- return this . _maxFilesPerUpload ;
127+ // Fallback to unlimited
128+ return 0 ;
138129 }
139130
140131 get isFileUploadLimitReached ( ) : boolean {
141132 const activeFiles = this . files . filter (
142133 file => file . fileStatus !== "missing" && file . fileStatus !== "removedFile"
143134 ) ;
144- if ( ! this . maxFilesPerUpload || this . maxFilesPerUpload === 0 ) {
135+ if ( this . maxFilesPerUpload === 0 ) {
145136 return false ;
146137 }
147138 return activeFiles . length >= this . maxFilesPerUpload ;
0 commit comments