neo.mjs 5.17.0 → 5.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/apps/ServiceWorker.mjs
CHANGED
@@ -140,6 +140,21 @@ class MainContainer extends ConfigurationViewport {
|
|
140
140
|
xls : 1,
|
141
141
|
pdf : 1
|
142
142
|
}
|
143
|
+
}, {
|
144
|
+
module : FileUploadField,
|
145
|
+
id : 'my-failing-document-status-test',
|
146
|
+
uploadUrl : 'http://127.0.0.1:3000/file-upload-test',
|
147
|
+
documentStatusUrl : 'http://127.0.0.1:3000/document-status-fails?documentId={documentId}',
|
148
|
+
documentDeleteUrl : 'http://127.0.0.1:3000/document-delete?documentId={documentId}',
|
149
|
+
downloadUrl : 'http://127.0.0.1:3000/getDocument?documentId={documentId}',
|
150
|
+
width : 350,
|
151
|
+
maxSize : '10mb',
|
152
|
+
types : {
|
153
|
+
png : 1,
|
154
|
+
jpg : 1,
|
155
|
+
xls : 1,
|
156
|
+
pdf : 1
|
157
|
+
}
|
143
158
|
}]
|
144
159
|
});
|
145
160
|
}
|
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -245,12 +245,12 @@ const DefaultConfig = {
|
|
245
245
|
useVdomWorker: true,
|
246
246
|
/**
|
247
247
|
* buildScripts/injectPackageVersion.mjs will update this value
|
248
|
-
* @default '5.17.
|
248
|
+
* @default '5.17.1'
|
249
249
|
* @memberOf! module:Neo
|
250
250
|
* @name config.version
|
251
251
|
* @type String
|
252
252
|
*/
|
253
|
-
version: '5.17.
|
253
|
+
version: '5.17.1'
|
254
254
|
};
|
255
255
|
|
256
256
|
Object.assign(DefaultConfig, {
|
@@ -134,7 +134,7 @@ class FileUpload extends Base {
|
|
134
134
|
* An Object containing a default set of headers to be passed to the server on every HTTP request.
|
135
135
|
* @member {Object} headers
|
136
136
|
*/
|
137
|
-
|
137
|
+
headers_ : {},
|
138
138
|
|
139
139
|
/**
|
140
140
|
* An Object which allows the status text returned from the {@link #property-documentStatusUrl} to be
|
@@ -217,7 +217,7 @@ class FileUpload extends Base {
|
|
217
217
|
*
|
218
218
|
* @member {String} downloadUrl
|
219
219
|
*/
|
220
|
-
|
220
|
+
downloadUrl_ : null,
|
221
221
|
|
222
222
|
/**
|
223
223
|
* The URL of the file status reporting service.
|
@@ -246,7 +246,7 @@ class FileUpload extends Base {
|
|
246
246
|
*
|
247
247
|
* @member {String} documentStatusUrl
|
248
248
|
*/
|
249
|
-
|
249
|
+
documentStatusUrl_ : null,
|
250
250
|
|
251
251
|
/**
|
252
252
|
* The polling interval *in milliseconds* to wait between asking the server how the document scan
|
@@ -279,7 +279,7 @@ class FileUpload extends Base {
|
|
279
279
|
*
|
280
280
|
* @member {String} documentDeleteUrl
|
281
281
|
*/
|
282
|
-
|
282
|
+
documentDeleteUrl_ : null,
|
283
283
|
|
284
284
|
/**
|
285
285
|
* @member {String} state_=null
|
@@ -589,17 +589,12 @@ class FileUpload extends Base {
|
|
589
589
|
me.state = 'ready';
|
590
590
|
break;
|
591
591
|
default:
|
592
|
-
const { fileName, size } = serverJson;
|
593
|
-
|
594
|
-
if (fileName) {
|
595
|
-
me.vdom.cn[1].cn[0].innerHTML = fileName;
|
596
|
-
me.fileSize = me.formatSize(size);
|
597
|
-
}
|
598
592
|
me.state = status;
|
599
593
|
}
|
600
594
|
}
|
601
595
|
else {
|
602
|
-
me.error = `${documentStatusError}: ${statusResponse.statusText}`;
|
596
|
+
me.error = `${me.documentStatusError}: ${statusResponse.statusText || `Server error ${statusResponse.status}`}`;
|
597
|
+
me.state = 'deleted';
|
603
598
|
}
|
604
599
|
}
|
605
600
|
}
|
@@ -659,7 +654,7 @@ class FileUpload extends Base {
|
|
659
654
|
break;
|
660
655
|
case 'not-downloadable':
|
661
656
|
status.innerHTML = me.preExistingDocument ?
|
662
|
-
me.fileSize : `${successfullyUploaded} \u2022 ${me.fileSize}`;
|
657
|
+
me.fileSize : `${me.successfullyUploaded} \u2022 ${me.fileSize}`;
|
663
658
|
break;
|
664
659
|
case 'deleted':
|
665
660
|
status.innerHTML = me.fileWasDeleted;
|
@@ -694,18 +689,24 @@ class FileUpload extends Base {
|
|
694
689
|
}
|
695
690
|
|
696
691
|
beforeGetDocumentStatusUrl(documentStatusUrl) {
|
692
|
+
const me = this;
|
693
|
+
|
697
694
|
return typeof documentStatusUrl === 'function'? documentStatusUrl.call(me, me) : me.createUrl(documentStatusUrl, {
|
698
695
|
[me.documentIdParameter] : me.documentId
|
699
696
|
});
|
700
697
|
}
|
701
698
|
|
702
699
|
beforeGetDocumentDeleteUrl(documentDeleteUrl) {
|
700
|
+
const me = this;
|
701
|
+
|
703
702
|
return typeof documentDeleteUrl === 'function'? documentDeleteUrl.call(me, me) : me.createUrl(documentDeleteUrl, {
|
704
703
|
[me.documentIdParameter] : me.documentId
|
705
704
|
});
|
706
705
|
}
|
707
706
|
|
708
707
|
beforeGetDownloadUrl(downloadUrl) {
|
708
|
+
const me = this;
|
709
|
+
|
709
710
|
return typeof downloadUrl === 'function'? downloadUrl.call(me, me) : me.createUrl(downloadUrl, {
|
710
711
|
[me.documentIdParameter] : me.documentId
|
711
712
|
});
|
@@ -758,7 +759,9 @@ class FileUpload extends Base {
|
|
758
759
|
* @returns {Boolean}
|
759
760
|
*/
|
760
761
|
validate() {
|
761
|
-
const
|
762
|
+
const
|
763
|
+
{ cls } = this,
|
764
|
+
isValid = this.isValid();
|
762
765
|
|
763
766
|
NeoArray.toggle(cls, 'neo-invalid', !isValid);
|
764
767
|
this.cls = cls;
|
@@ -766,13 +769,13 @@ class FileUpload extends Base {
|
|
766
769
|
return isValid;
|
767
770
|
}
|
768
771
|
|
769
|
-
|
772
|
+
isValid() {
|
770
773
|
const me = this;
|
771
774
|
|
772
|
-
return !me.error &&
|
773
|
-
((me.state === '
|
774
|
-
|
775
|
-
|
775
|
+
return !me.error && !(me.state === 'ready' && me.required) ||
|
776
|
+
( (me.state === 'downloadable') ||
|
777
|
+
(me.state === 'not-downloadable')
|
778
|
+
);
|
776
779
|
}
|
777
780
|
}
|
778
781
|
|