@formio/js 5.1.0-dev.6102.8eddaab → 5.1.0-dev.6102.9a0147c
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/README.md +5 -0
- package/dist/formio.form.js +55 -22
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +55 -22
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.js +48 -26
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +49 -16
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -0
- package/lib/cjs/Wizard.d.ts +1 -2
- package/lib/cjs/Wizard.js +17 -23
- package/lib/cjs/components/_classes/nested/NestedComponent.js +1 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/button/Button.js +6 -10
- package/lib/cjs/components/datagrid/DataGrid.js +4 -0
- package/lib/cjs/components/file/File.js +4 -5
- package/lib/cjs/providers/storage/uploadAdapter.js +2 -2
- package/lib/mjs/Wizard.d.ts +1 -2
- package/lib/mjs/Wizard.js +16 -22
- package/lib/mjs/components/_classes/nested/NestedComponent.js +1 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/button/Button.js +6 -9
- package/lib/mjs/components/datagrid/DataGrid.js +5 -1
- package/lib/mjs/components/file/File.js +4 -5
- package/lib/mjs/providers/storage/uploadAdapter.js +2 -2
- package/package.json +4 -4
@@ -20,6 +20,8 @@
|
|
20
20
|
|
21
21
|
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
|
22
22
|
|
23
|
+
/*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */
|
24
|
+
|
23
25
|
/*! formiojs v5.1.0-dev.2 | https://unpkg.com/formiojs@5.1.0-dev.2/LICENSE.txt */
|
24
26
|
|
25
27
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
package/lib/cjs/Wizard.d.ts
CHANGED
@@ -6,7 +6,6 @@ declare class Wizard extends Webform {
|
|
6
6
|
originalComponents: any[];
|
7
7
|
page: number;
|
8
8
|
currentPanel: any;
|
9
|
-
currentPanels: any[] | null;
|
10
9
|
currentNextPage: number;
|
11
10
|
_seenPages: number[];
|
12
11
|
subWizards: any[];
|
@@ -17,7 +16,7 @@ declare class Wizard extends Webform {
|
|
17
16
|
originalOptions: any;
|
18
17
|
isLastPage(): any;
|
19
18
|
getPages(args?: {}): any[];
|
20
|
-
get
|
19
|
+
get hasSubWizards(): boolean;
|
21
20
|
get localData(): any;
|
22
21
|
get wizardKey(): string;
|
23
22
|
set wizard(form: object);
|
package/lib/cjs/Wizard.js
CHANGED
@@ -34,7 +34,6 @@ class Wizard extends Webform_1.default {
|
|
34
34
|
this.originalComponents = [];
|
35
35
|
this.page = 0;
|
36
36
|
this.currentPanel = null;
|
37
|
-
this.currentPanels = null;
|
38
37
|
this.currentNextPage = 0;
|
39
38
|
this._seenPages = [0];
|
40
39
|
this.subWizards = [];
|
@@ -53,12 +52,12 @@ class Wizard extends Webform_1.default {
|
|
53
52
|
}
|
54
53
|
getPages(args = {}) {
|
55
54
|
const { all = false } = args;
|
56
|
-
const pages = this.
|
55
|
+
const pages = this.hasSubWizards ? this.components : this.pages;
|
57
56
|
const filteredPages = pages
|
58
57
|
.filter(all ? lodash_1.default.identity : (p, index) => this._seenPages.includes(index));
|
59
58
|
return filteredPages;
|
60
59
|
}
|
61
|
-
get
|
60
|
+
get hasSubWizards() {
|
62
61
|
return !lodash_1.default.isEmpty(this.subWizards);
|
63
62
|
}
|
64
63
|
get data() {
|
@@ -187,9 +186,9 @@ class Wizard extends Webform_1.default {
|
|
187
186
|
}
|
188
187
|
render() {
|
189
188
|
const ctx = this.renderContext;
|
190
|
-
if (this.component.
|
191
|
-
ctx.panels.
|
192
|
-
if (panel.
|
189
|
+
if (this.component.id) {
|
190
|
+
ctx.panels.forEach(panel => {
|
191
|
+
if (panel.id === this.component.id) {
|
193
192
|
this.currentPanel = panel;
|
194
193
|
ctx.wizardPageTooltip = this.getFormattedTooltip(panel.tooltip);
|
195
194
|
}
|
@@ -587,7 +586,7 @@ class Wizard extends Webform_1.default {
|
|
587
586
|
this.pageFieldLogic(num);
|
588
587
|
this.getNextPage();
|
589
588
|
let parentNum = num;
|
590
|
-
if (this.
|
589
|
+
if (this.hasSubWizards) {
|
591
590
|
const pageFromPages = this.pages[num];
|
592
591
|
const pageFromComponents = this.components[num];
|
593
592
|
if (!pageFromComponents || (pageFromPages === null || pageFromPages === void 0 ? void 0 : pageFromPages.id) !== pageFromComponents.id) {
|
@@ -873,7 +872,7 @@ class Wizard extends Webform_1.default {
|
|
873
872
|
}
|
874
873
|
}
|
875
874
|
onChange(flags, changed, modified, changes) {
|
876
|
-
var _a
|
875
|
+
var _a;
|
877
876
|
super.onChange(flags, changed, modified, changes);
|
878
877
|
// The onChange loop doesn't need all components for wizards
|
879
878
|
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
@@ -881,23 +880,18 @@ class Wizard extends Webform_1.default {
|
|
881
880
|
this.showErrors(errors, true, true);
|
882
881
|
}
|
883
882
|
// If the pages change, need to redraw the header.
|
884
|
-
|
885
|
-
|
883
|
+
const currentPanels = this.pages;
|
884
|
+
// calling this.establishPages() updates/mutates this.pages to be the current pages
|
885
|
+
this.establishPages();
|
886
|
+
const newPanels = this.pages;
|
886
887
|
const currentNextPage = this.currentNextPage;
|
887
|
-
|
888
|
-
|
889
|
-
this.
|
890
|
-
|
891
|
-
|
892
|
-
else {
|
893
|
-
currentPanels = this.currentPanels || this.pages.map(page => page.component.key);
|
894
|
-
panels = this.establishPages().map(panel => panel.key);
|
895
|
-
this.currentPanels = panels;
|
896
|
-
if (((_a = this.currentPanel) === null || _a === void 0 ? void 0 : _a.key) && ((_b = this.currentPanels) === null || _b === void 0 ? void 0 : _b.length)) {
|
897
|
-
this.setPage(this.currentPanels.findIndex(panel => panel === this.currentPanel.key));
|
898
|
-
}
|
888
|
+
const panelsUpdated = !lodash_1.default.isEqual(newPanels, currentPanels);
|
889
|
+
if (((_a = this.currentPanel) === null || _a === void 0 ? void 0 : _a.id) && this.pages.length && (!this.hasSubWizards || (this.hasSubWizards && panelsUpdated))) {
|
890
|
+
const newIndex = this.pages.findIndex(page => page.id === this.currentPanel.id);
|
891
|
+
if (newIndex !== -1)
|
892
|
+
this.setPage(newIndex);
|
899
893
|
}
|
900
|
-
if (
|
894
|
+
if (panelsUpdated || (flags && flags.fromSubmission)) {
|
901
895
|
this.redrawHeader();
|
902
896
|
}
|
903
897
|
// If the next page changes, then make sure to redraw navigation.
|
@@ -664,7 +664,7 @@ class NestedComponent extends Field_1.default {
|
|
664
664
|
validationProcessor({ scope, data, row, instance, paths }, flags) {
|
665
665
|
var _a;
|
666
666
|
const { dirty } = flags;
|
667
|
-
if (this.root.
|
667
|
+
if (this.root.hasSubWizards && this.page !== this.root.page) {
|
668
668
|
instance = ((_a = this.componentsMap) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(paths.dataPath))
|
669
669
|
? this.componentsMap[paths.dataPath]
|
670
670
|
: this.getComponent(paths.dataPath);
|
@@ -9,7 +9,7 @@ export default class ButtonComponent extends Field {
|
|
9
9
|
};
|
10
10
|
static savedValueTypes(schema: any): any;
|
11
11
|
constructor(component: any, options: any, data: any);
|
12
|
-
filesUploading:
|
12
|
+
filesUploading: number;
|
13
13
|
get inputInfo(): any;
|
14
14
|
get labelInfo(): {
|
15
15
|
hidden: boolean;
|
@@ -39,7 +39,7 @@ class ButtonComponent extends Field_1.default {
|
|
39
39
|
}
|
40
40
|
constructor(component, options, data) {
|
41
41
|
super(component, options, data);
|
42
|
-
this.filesUploading =
|
42
|
+
this.filesUploading = 0;
|
43
43
|
}
|
44
44
|
get defaultSchema() {
|
45
45
|
return ButtonComponent.schema();
|
@@ -147,16 +147,13 @@ class ButtonComponent extends Field_1.default {
|
|
147
147
|
this.addClass(this.refs.buttonMessageContainer, 'has-error');
|
148
148
|
this.setContent(this.refs.buttonMessage, resultMessage);
|
149
149
|
}, true);
|
150
|
-
this.on('fileUploadingStart', (
|
151
|
-
this.filesUploading
|
150
|
+
this.on('fileUploadingStart', () => {
|
151
|
+
this.filesUploading++;
|
152
152
|
this.disabled = true;
|
153
153
|
this.setDisabled(this.refs.button, this.disabled);
|
154
154
|
}, true);
|
155
|
-
this.on('fileUploadingEnd', (
|
156
|
-
|
157
|
-
if (index !== -1) {
|
158
|
-
this.filesUploading.splice(index, 1);
|
159
|
-
}
|
155
|
+
this.on('fileUploadingEnd', () => {
|
156
|
+
this.filesUploading--;
|
160
157
|
this.disabled = this.shouldDisabled ? true : false;
|
161
158
|
this.setDisabled(this.refs.button, this.disabled);
|
162
159
|
}, true);
|
@@ -252,8 +249,7 @@ class ButtonComponent extends Field_1.default {
|
|
252
249
|
}
|
253
250
|
}
|
254
251
|
get shouldDisabled() {
|
255
|
-
|
256
|
-
return super.shouldDisabled || !!((_a = this.filesUploading) === null || _a === void 0 ? void 0 : _a.length) || this.isDisabledOnInvalid;
|
252
|
+
return super.shouldDisabled || this.filesUploading > 0 || this.isDisabledOnInvalid;
|
257
253
|
}
|
258
254
|
attach(element) {
|
259
255
|
this.loadRefs(element, {
|
@@ -492,6 +492,10 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
492
492
|
options.row = `${rowIndex}-${colIndex}`;
|
493
493
|
options.rowIndex = rowIndex;
|
494
494
|
options.onChange = (flags, changed, modified) => {
|
495
|
+
if (changed.component.type === 'form') {
|
496
|
+
const formComp = (0, utils_1.getComponent)(this.component.components, changed.component.key);
|
497
|
+
lodash_1.default.set(formComp, 'components', changed.component.components);
|
498
|
+
}
|
495
499
|
this.triggerChange({ modified });
|
496
500
|
};
|
497
501
|
let columnComponent;
|
@@ -905,17 +905,16 @@ class FileComponent extends Field_1.default {
|
|
905
905
|
}
|
906
906
|
uploadFile(fileToSync) {
|
907
907
|
return __awaiter(this, void 0, void 0, function* () {
|
908
|
-
|
908
|
+
return yield this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
|
909
909
|
// Progress callback
|
910
910
|
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
911
|
-
this.emit('fileUploadingStart'
|
911
|
+
this.emit('fileUploadingStart');
|
912
912
|
},
|
913
913
|
// Abort upload callback
|
914
914
|
(abort) => this.abortUploads.push({
|
915
915
|
id: fileToSync.id,
|
916
916
|
abort,
|
917
917
|
}), this.getMultipartOptions(fileToSync));
|
918
|
-
return yield filePromise;
|
919
918
|
});
|
920
919
|
}
|
921
920
|
upload() {
|
@@ -937,7 +936,7 @@ class FileComponent extends Field_1.default {
|
|
937
936
|
fileToSync.message = this.t('succefullyUploaded');
|
938
937
|
fileInfo.originalName = fileToSync.originalName;
|
939
938
|
fileInfo.hash = fileToSync.hash;
|
940
|
-
this.emit('fileUploadingEnd'
|
939
|
+
this.emit('fileUploadingEnd');
|
941
940
|
}
|
942
941
|
catch (response) {
|
943
942
|
fileToSync.status = 'error';
|
@@ -947,7 +946,7 @@ class FileComponent extends Field_1.default {
|
|
947
946
|
: response.type === 'abort'
|
948
947
|
? this.t('Request was aborted')
|
949
948
|
: response.toString();
|
950
|
-
this.emit('fileUploadingEnd'
|
949
|
+
this.emit('fileUploadingEnd');
|
951
950
|
this.emit('fileUploadError', {
|
952
951
|
fileToSync,
|
953
952
|
response,
|
@@ -27,7 +27,7 @@ class FormioUploadAdapter {
|
|
27
27
|
null,
|
28
28
|
null
|
29
29
|
];
|
30
|
-
|
30
|
+
this.fileService.uploadFile(...uploadParams, () => this.component.emit('fileUploadingStart')).then((result) => {
|
31
31
|
return this.fileService.downloadFile(result);
|
32
32
|
}).then((result) => {
|
33
33
|
return resolve({
|
@@ -37,7 +37,7 @@ class FormioUploadAdapter {
|
|
37
37
|
console.warn('An Error occured while uploading file', err);
|
38
38
|
reject(err);
|
39
39
|
}).finally(() => {
|
40
|
-
this.component.emit('fileUploadingEnd'
|
40
|
+
this.component.emit('fileUploadingEnd');
|
41
41
|
});
|
42
42
|
}));
|
43
43
|
}
|
package/lib/mjs/Wizard.d.ts
CHANGED
@@ -6,7 +6,6 @@ declare class Wizard extends Webform {
|
|
6
6
|
originalComponents: any[];
|
7
7
|
page: number;
|
8
8
|
currentPanel: any;
|
9
|
-
currentPanels: any[] | null;
|
10
9
|
currentNextPage: number;
|
11
10
|
_seenPages: number[];
|
12
11
|
subWizards: any[];
|
@@ -17,7 +16,7 @@ declare class Wizard extends Webform {
|
|
17
16
|
originalOptions: any;
|
18
17
|
isLastPage(): any;
|
19
18
|
getPages(args?: {}): any[];
|
20
|
-
get
|
19
|
+
get hasSubWizards(): boolean;
|
21
20
|
get localData(): any;
|
22
21
|
get wizardKey(): string;
|
23
22
|
set wizard(form: object);
|
package/lib/mjs/Wizard.js
CHANGED
@@ -29,7 +29,6 @@ export default class Wizard extends Webform {
|
|
29
29
|
this.originalComponents = [];
|
30
30
|
this.page = 0;
|
31
31
|
this.currentPanel = null;
|
32
|
-
this.currentPanels = null;
|
33
32
|
this.currentNextPage = 0;
|
34
33
|
this._seenPages = [0];
|
35
34
|
this.subWizards = [];
|
@@ -48,12 +47,12 @@ export default class Wizard extends Webform {
|
|
48
47
|
}
|
49
48
|
getPages(args = {}) {
|
50
49
|
const { all = false } = args;
|
51
|
-
const pages = this.
|
50
|
+
const pages = this.hasSubWizards ? this.components : this.pages;
|
52
51
|
const filteredPages = pages
|
53
52
|
.filter(all ? _.identity : (p, index) => this._seenPages.includes(index));
|
54
53
|
return filteredPages;
|
55
54
|
}
|
56
|
-
get
|
55
|
+
get hasSubWizards() {
|
57
56
|
return !_.isEmpty(this.subWizards);
|
58
57
|
}
|
59
58
|
get data() {
|
@@ -177,9 +176,9 @@ export default class Wizard extends Webform {
|
|
177
176
|
}
|
178
177
|
render() {
|
179
178
|
const ctx = this.renderContext;
|
180
|
-
if (this.component.
|
181
|
-
ctx.panels.
|
182
|
-
if (panel.
|
179
|
+
if (this.component.id) {
|
180
|
+
ctx.panels.forEach(panel => {
|
181
|
+
if (panel.id === this.component.id) {
|
183
182
|
this.currentPanel = panel;
|
184
183
|
ctx.wizardPageTooltip = this.getFormattedTooltip(panel.tooltip);
|
185
184
|
}
|
@@ -580,7 +579,7 @@ export default class Wizard extends Webform {
|
|
580
579
|
this.pageFieldLogic(num);
|
581
580
|
this.getNextPage();
|
582
581
|
let parentNum = num;
|
583
|
-
if (this.
|
582
|
+
if (this.hasSubWizards) {
|
584
583
|
const pageFromPages = this.pages[num];
|
585
584
|
const pageFromComponents = this.components[num];
|
586
585
|
if (!pageFromComponents || pageFromPages?.id !== pageFromComponents.id) {
|
@@ -869,23 +868,18 @@ export default class Wizard extends Webform {
|
|
869
868
|
this.showErrors(errors, true, true);
|
870
869
|
}
|
871
870
|
// If the pages change, need to redraw the header.
|
872
|
-
|
873
|
-
|
871
|
+
const currentPanels = this.pages;
|
872
|
+
// calling this.establishPages() updates/mutates this.pages to be the current pages
|
873
|
+
this.establishPages();
|
874
|
+
const newPanels = this.pages;
|
874
875
|
const currentNextPage = this.currentNextPage;
|
875
|
-
|
876
|
-
|
877
|
-
this.
|
878
|
-
|
879
|
-
|
880
|
-
else {
|
881
|
-
currentPanels = this.currentPanels || this.pages.map(page => page.component.key);
|
882
|
-
panels = this.establishPages().map(panel => panel.key);
|
883
|
-
this.currentPanels = panels;
|
884
|
-
if (this.currentPanel?.key && this.currentPanels?.length) {
|
885
|
-
this.setPage(this.currentPanels.findIndex(panel => panel === this.currentPanel.key));
|
886
|
-
}
|
876
|
+
const panelsUpdated = !_.isEqual(newPanels, currentPanels);
|
877
|
+
if (this.currentPanel?.id && this.pages.length && (!this.hasSubWizards || (this.hasSubWizards && panelsUpdated))) {
|
878
|
+
const newIndex = this.pages.findIndex(page => page.id === this.currentPanel.id);
|
879
|
+
if (newIndex !== -1)
|
880
|
+
this.setPage(newIndex);
|
887
881
|
}
|
888
|
-
if (
|
882
|
+
if (panelsUpdated || (flags && flags.fromSubmission)) {
|
889
883
|
this.redrawHeader();
|
890
884
|
}
|
891
885
|
// If the next page changes, then make sure to redraw navigation.
|
@@ -659,7 +659,7 @@ export default class NestedComponent extends Field {
|
|
659
659
|
}
|
660
660
|
validationProcessor({ scope, data, row, instance, paths }, flags) {
|
661
661
|
const { dirty } = flags;
|
662
|
-
if (this.root.
|
662
|
+
if (this.root.hasSubWizards && this.page !== this.root.page) {
|
663
663
|
instance = this.componentsMap?.hasOwnProperty(paths.dataPath)
|
664
664
|
? this.componentsMap[paths.dataPath]
|
665
665
|
: this.getComponent(paths.dataPath);
|
@@ -9,7 +9,7 @@ export default class ButtonComponent extends Field {
|
|
9
9
|
};
|
10
10
|
static savedValueTypes(schema: any): any;
|
11
11
|
constructor(component: any, options: any, data: any);
|
12
|
-
filesUploading:
|
12
|
+
filesUploading: number;
|
13
13
|
get inputInfo(): any;
|
14
14
|
get labelInfo(): {
|
15
15
|
hidden: boolean;
|
@@ -34,7 +34,7 @@ export default class ButtonComponent extends Field {
|
|
34
34
|
}
|
35
35
|
constructor(component, options, data) {
|
36
36
|
super(component, options, data);
|
37
|
-
this.filesUploading =
|
37
|
+
this.filesUploading = 0;
|
38
38
|
}
|
39
39
|
get defaultSchema() {
|
40
40
|
return ButtonComponent.schema();
|
@@ -142,16 +142,13 @@ export default class ButtonComponent extends Field {
|
|
142
142
|
this.addClass(this.refs.buttonMessageContainer, 'has-error');
|
143
143
|
this.setContent(this.refs.buttonMessage, resultMessage);
|
144
144
|
}, true);
|
145
|
-
this.on('fileUploadingStart', (
|
146
|
-
this.filesUploading
|
145
|
+
this.on('fileUploadingStart', () => {
|
146
|
+
this.filesUploading++;
|
147
147
|
this.disabled = true;
|
148
148
|
this.setDisabled(this.refs.button, this.disabled);
|
149
149
|
}, true);
|
150
|
-
this.on('fileUploadingEnd', (
|
151
|
-
|
152
|
-
if (index !== -1) {
|
153
|
-
this.filesUploading.splice(index, 1);
|
154
|
-
}
|
150
|
+
this.on('fileUploadingEnd', () => {
|
151
|
+
this.filesUploading--;
|
155
152
|
this.disabled = this.shouldDisabled ? true : false;
|
156
153
|
this.setDisabled(this.refs.button, this.disabled);
|
157
154
|
}, true);
|
@@ -247,7 +244,7 @@ export default class ButtonComponent extends Field {
|
|
247
244
|
}
|
248
245
|
}
|
249
246
|
get shouldDisabled() {
|
250
|
-
return super.shouldDisabled ||
|
247
|
+
return super.shouldDisabled || this.filesUploading > 0 || this.isDisabledOnInvalid;
|
251
248
|
}
|
252
249
|
attach(element) {
|
253
250
|
this.loadRefs(element, {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
|
3
|
-
import { fastCloneDeep, getFocusableElements } from '../../utils';
|
3
|
+
import { fastCloneDeep, getFocusableElements, getComponent } from '../../utils';
|
4
4
|
export default class DataGridComponent extends NestedArrayComponent {
|
5
5
|
static schema(...extend) {
|
6
6
|
return NestedArrayComponent.schema({
|
@@ -488,6 +488,10 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
488
488
|
options.row = `${rowIndex}-${colIndex}`;
|
489
489
|
options.rowIndex = rowIndex;
|
490
490
|
options.onChange = (flags, changed, modified) => {
|
491
|
+
if (changed.component.type === 'form') {
|
492
|
+
const formComp = getComponent(this.component.components, changed.component.key);
|
493
|
+
_.set(formComp, 'components', changed.component.components);
|
494
|
+
}
|
491
495
|
this.triggerChange({ modified });
|
492
496
|
};
|
493
497
|
let columnComponent;
|
@@ -903,17 +903,16 @@ export default class FileComponent extends Field {
|
|
903
903
|
} : false;
|
904
904
|
}
|
905
905
|
async uploadFile(fileToSync) {
|
906
|
-
|
906
|
+
return await this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
|
907
907
|
// Progress callback
|
908
908
|
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
909
|
-
this.emit('fileUploadingStart'
|
909
|
+
this.emit('fileUploadingStart');
|
910
910
|
},
|
911
911
|
// Abort upload callback
|
912
912
|
(abort) => this.abortUploads.push({
|
913
913
|
id: fileToSync.id,
|
914
914
|
abort,
|
915
915
|
}), this.getMultipartOptions(fileToSync));
|
916
|
-
return await filePromise;
|
917
916
|
}
|
918
917
|
async upload() {
|
919
918
|
if (!this.filesToSync.filesToUpload.length) {
|
@@ -933,7 +932,7 @@ export default class FileComponent extends Field {
|
|
933
932
|
fileToSync.message = this.t('succefullyUploaded');
|
934
933
|
fileInfo.originalName = fileToSync.originalName;
|
935
934
|
fileInfo.hash = fileToSync.hash;
|
936
|
-
this.emit('fileUploadingEnd'
|
935
|
+
this.emit('fileUploadingEnd');
|
937
936
|
}
|
938
937
|
catch (response) {
|
939
938
|
fileToSync.status = 'error';
|
@@ -943,7 +942,7 @@ export default class FileComponent extends Field {
|
|
943
942
|
: response.type === 'abort'
|
944
943
|
? this.t('Request was aborted')
|
945
944
|
: response.toString();
|
946
|
-
this.emit('fileUploadingEnd'
|
945
|
+
this.emit('fileUploadingEnd');
|
947
946
|
this.emit('fileUploadError', {
|
948
947
|
fileToSync,
|
949
948
|
response,
|
@@ -24,7 +24,7 @@ class FormioUploadAdapter {
|
|
24
24
|
null,
|
25
25
|
null
|
26
26
|
];
|
27
|
-
|
27
|
+
this.fileService.uploadFile(...uploadParams, () => this.component.emit('fileUploadingStart')).then((result) => {
|
28
28
|
return this.fileService.downloadFile(result);
|
29
29
|
}).then((result) => {
|
30
30
|
return resolve({
|
@@ -34,7 +34,7 @@ class FormioUploadAdapter {
|
|
34
34
|
console.warn('An Error occured while uploading file', err);
|
35
35
|
reject(err);
|
36
36
|
}).finally(() => {
|
37
|
-
this.component.emit('fileUploadingEnd'
|
37
|
+
this.component.emit('fileUploadingEnd');
|
38
38
|
});
|
39
39
|
}));
|
40
40
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.1.0-dev.6102.
|
3
|
+
"version": "5.1.0-dev.6102.9a0147c",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -81,12 +81,12 @@
|
|
81
81
|
"homepage": "https://github.com/formio/formio.js#readme",
|
82
82
|
"dependencies": {
|
83
83
|
"@formio/bootstrap": "v3.0.0-dev.121.085d187",
|
84
|
-
"@formio/core": "2.4.0-dev.245.
|
84
|
+
"@formio/core": "2.4.0-dev.245.326cac7",
|
85
85
|
"@formio/text-mask-addons": "3.8.0-formio.4",
|
86
86
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
87
87
|
"abortcontroller-polyfill": "^1.7.5",
|
88
88
|
"autocompleter": "^8.0.4",
|
89
|
-
"bootstrap": "^5.3.
|
89
|
+
"bootstrap": "^5.3.4",
|
90
90
|
"browser-cookies": "^1.2.0",
|
91
91
|
"browser-md5-file": "^1.1.1",
|
92
92
|
"choices.js": "^11.0.6",
|
@@ -94,7 +94,7 @@
|
|
94
94
|
"core-js": "^3.37.1",
|
95
95
|
"dialog-polyfill": "^0.5.6",
|
96
96
|
"dom-autoscroller": "^2.3.4",
|
97
|
-
"dompurify": "^3.
|
97
|
+
"dompurify": "^3.2.5",
|
98
98
|
"downloadjs": "^1.4.7",
|
99
99
|
"dragula": "^3.7.3",
|
100
100
|
"eventemitter3": "^5.0.1",
|