@formio/js 5.1.2-rc.3 → 5.1.2-rc.5
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/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +11 -11
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +11 -11
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +4 -4
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +2 -2
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/components/_classes/component/Component.js +4 -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.d.ts +1 -1
- package/lib/cjs/components/file/File.js +15 -16
- package/lib/cjs/components/form/Form.d.ts +1 -0
- package/lib/cjs/components/form/Form.js +13 -1
- package/lib/cjs/providers/storage/uploadAdapter.js +2 -2
- package/lib/cjs/templates/index.d.ts +1 -1
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/components/_classes/component/Component.js +4 -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.d.ts +1 -1
- package/lib/mjs/components/file/File.js +6 -9
- package/lib/mjs/components/form/Form.d.ts +1 -0
- package/lib/mjs/components/form/Form.js +12 -1
- package/lib/mjs/providers/storage/uploadAdapter.js +2 -2
- package/lib/mjs/templates/index.d.ts +1 -1
- package/package.json +3 -3
@@ -20,7 +20,7 @@
|
|
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
|
-
/*! formiojs v5.1.2-rc.
|
23
|
+
/*! formiojs v5.1.2-rc.5 | https://unpkg.com/formiojs@5.1.2-rc.5/LICENSE.txt */
|
24
24
|
|
25
25
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
26
26
|
|
package/lib/cjs/Embed.js
CHANGED
@@ -418,7 +418,7 @@ Formio.formioReady = new Promise((ready, reject) => {
|
|
418
418
|
_a._formioReady = ready;
|
419
419
|
_a._formioReadyReject = reject;
|
420
420
|
});
|
421
|
-
Formio.version = '5.1.2-rc.
|
421
|
+
Formio.version = '5.1.2-rc.5';
|
422
422
|
// Create a report.
|
423
423
|
Formio.Report = {
|
424
424
|
create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
package/lib/cjs/Formio.js
CHANGED
@@ -11,7 +11,7 @@ const CDN_1 = __importDefault(require("./CDN"));
|
|
11
11
|
const providers_1 = __importDefault(require("./providers"));
|
12
12
|
sdk_1.Formio.cdn = new CDN_1.default();
|
13
13
|
sdk_1.Formio.Providers = providers_1.default;
|
14
|
-
sdk_1.Formio.version = '5.1.2-rc.
|
14
|
+
sdk_1.Formio.version = '5.1.2-rc.5';
|
15
15
|
CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
|
16
16
|
const isNil = (val) => val === null || val === undefined;
|
17
17
|
sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
|
@@ -2661,13 +2661,16 @@ class Component extends Element_1.default {
|
|
2661
2661
|
}
|
2662
2662
|
const isArray = Array.isArray(value);
|
2663
2663
|
const valueInput = this.refs.fileLink || this.refs.input;
|
2664
|
+
const isFilelink = !!this.refs.fileLink;
|
2664
2665
|
if (isArray &&
|
2665
2666
|
Array.isArray(this.defaultValue) &&
|
2666
2667
|
this.refs.hasOwnProperty('input') &&
|
2667
2668
|
valueInput &&
|
2668
2669
|
(valueInput.length !== value.length) &&
|
2669
2670
|
this.visible) {
|
2670
|
-
|
2671
|
+
if (isFilelink || valueInput.length) {
|
2672
|
+
this.redraw();
|
2673
|
+
}
|
2671
2674
|
}
|
2672
2675
|
if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {
|
2673
2676
|
this.redraw();
|
@@ -9,7 +9,7 @@ export default class ButtonComponent extends Field {
|
|
9
9
|
};
|
10
10
|
static savedValueTypes(schema: any): string[];
|
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, {
|
@@ -477,6 +477,10 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
477
477
|
options.row = `${rowIndex}-${colIndex}`;
|
478
478
|
options.rowIndex = rowIndex;
|
479
479
|
options.onChange = (flags, changed, modified) => {
|
480
|
+
if (changed.component.type === 'form') {
|
481
|
+
const formComp = (0, utils_1.getComponent)(this.component.components, changed.component.key);
|
482
|
+
lodash_1.default.set(formComp, 'components', changed.component.components);
|
483
|
+
}
|
480
484
|
this.triggerChange({ modified });
|
481
485
|
};
|
482
486
|
let columnComponent;
|
@@ -145,7 +145,7 @@ export default class FileComponent extends Field {
|
|
145
145
|
}[]>;
|
146
146
|
updateProgress(fileInfo: any, progressEvent: any): void;
|
147
147
|
getMultipartOptions(fileToSync: any): any;
|
148
|
-
uploadFile(fileToSync: any): any
|
148
|
+
uploadFile(fileToSync: any): Promise<any>;
|
149
149
|
upload(): Promise<void | {
|
150
150
|
fileToSync: never;
|
151
151
|
fileInfo: any;
|
@@ -898,17 +898,18 @@ class FileComponent extends Field_1.default {
|
|
898
898
|
} }) : false;
|
899
899
|
}
|
900
900
|
uploadFile(fileToSync) {
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
this.
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
901
|
+
return __awaiter(this, void 0, void 0, function* () {
|
902
|
+
return yield this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
|
903
|
+
// Progress callback
|
904
|
+
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
905
|
+
this.emit('fileUploadingStart');
|
906
|
+
},
|
907
|
+
// Abort upload callback
|
908
|
+
(abort) => this.abortUploads.push({
|
909
|
+
id: fileToSync.id,
|
910
|
+
abort,
|
911
|
+
}), this.getMultipartOptions(fileToSync));
|
912
|
+
});
|
912
913
|
}
|
913
914
|
upload() {
|
914
915
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -916,7 +917,6 @@ class FileComponent extends Field_1.default {
|
|
916
917
|
return Promise.resolve();
|
917
918
|
}
|
918
919
|
return yield Promise.all(this.filesToSync.filesToUpload.map((fileToSync) => __awaiter(this, void 0, void 0, function* () {
|
919
|
-
let filePromise = null;
|
920
920
|
let fileInfo = null;
|
921
921
|
try {
|
922
922
|
if (fileToSync.isValidationError) {
|
@@ -925,13 +925,12 @@ class FileComponent extends Field_1.default {
|
|
925
925
|
fileInfo,
|
926
926
|
};
|
927
927
|
}
|
928
|
-
|
929
|
-
fileInfo = yield filePromise;
|
928
|
+
fileInfo = yield this.uploadFile(fileToSync);
|
930
929
|
fileToSync.status = 'success';
|
931
930
|
fileToSync.message = this.t('Succefully uploaded');
|
932
931
|
fileInfo.originalName = fileToSync.originalName;
|
933
932
|
fileInfo.hash = fileToSync.hash;
|
934
|
-
this.emit('fileUploadingEnd'
|
933
|
+
this.emit('fileUploadingEnd');
|
935
934
|
}
|
936
935
|
catch (response) {
|
937
936
|
fileToSync.status = 'error';
|
@@ -941,7 +940,7 @@ class FileComponent extends Field_1.default {
|
|
941
940
|
: response.type === 'abort'
|
942
941
|
? this.t('Request was aborted')
|
943
942
|
: response.toString();
|
944
|
-
this.emit('fileUploadingEnd'
|
943
|
+
this.emit('fileUploadingEnd');
|
945
944
|
this.emit('fileUploadError', {
|
946
945
|
fileToSync,
|
947
946
|
response,
|
@@ -99,6 +99,7 @@ export default class FormComponent extends Component {
|
|
99
99
|
*/
|
100
100
|
onSetSubFormValue(submission: object | null | undefined, flags: object | null | undefined): void;
|
101
101
|
areAllComponentsEmpty(data: any): boolean;
|
102
|
+
conditionallyHidden(): boolean;
|
102
103
|
updateSubFormVisibility(): void;
|
103
104
|
/**
|
104
105
|
* Determines if this form is a Nested Wizard
|
@@ -274,6 +274,9 @@ class FormComponent extends Component_1.default {
|
|
274
274
|
if (this.isSubFormLazyLoad() && !this.hasLoadedForm && !this.subFormLoading) {
|
275
275
|
this.createSubForm(true);
|
276
276
|
}
|
277
|
+
if (!this.subFormReady) {
|
278
|
+
return Promise.resolve();
|
279
|
+
}
|
277
280
|
return this.subFormReady.then(() => {
|
278
281
|
this.empty(element);
|
279
282
|
if (this.options.builder) {
|
@@ -402,13 +405,15 @@ class FormComponent extends Component_1.default {
|
|
402
405
|
}
|
403
406
|
// Render the form.
|
404
407
|
return (new Form_1.default(form, this.getSubOptions())).ready.then((instance) => {
|
408
|
+
var _a, _b;
|
405
409
|
this.subForm = instance;
|
406
410
|
this.subForm.currentForm = this;
|
407
411
|
this.subForm.parentVisible = this.visible;
|
408
412
|
const componentsMap = this.componentsMap;
|
409
413
|
const formComponentsMap = this.subForm.componentsMap;
|
410
414
|
lodash_1.default.assign(componentsMap, formComponentsMap);
|
411
|
-
this.component.components = this.subForm.
|
415
|
+
this.component.components = (_a = this.subForm._form) === null || _a === void 0 ? void 0 : _a.components;
|
416
|
+
this.component.display = (_b = this.subForm._form) === null || _b === void 0 ? void 0 : _b.display;
|
412
417
|
this.subForm.on('change', () => {
|
413
418
|
if (this.subForm) {
|
414
419
|
this.dataValue = this.subForm.getValue();
|
@@ -703,6 +708,13 @@ class FormComponent extends Component_1.default {
|
|
703
708
|
}
|
704
709
|
return errors;
|
705
710
|
}
|
711
|
+
conditionallyHidden() {
|
712
|
+
const conditionallyHidden = super.conditionallyHidden();
|
713
|
+
if (this.subForm) {
|
714
|
+
this.subForm._conditionallyHidden = conditionallyHidden;
|
715
|
+
}
|
716
|
+
return conditionallyHidden;
|
717
|
+
}
|
706
718
|
updateSubFormVisibility() {
|
707
719
|
if (this.subForm) {
|
708
720
|
this.subForm.parentVisible = this.visible;
|
@@ -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
|
}
|
@@ -37,7 +37,7 @@ declare namespace _default {
|
|
37
37
|
};
|
38
38
|
transform(type: any, text: any, instance: any): any;
|
39
39
|
defaultIconset: string;
|
40
|
-
iconClass: (iconset:
|
40
|
+
iconClass: (iconset: "fa" | "bi", name: string, spinning: boolean) => string;
|
41
41
|
cssClasses: {
|
42
42
|
'border-default': string;
|
43
43
|
'formio-tab-panel-active': string;
|
package/lib/mjs/Embed.js
CHANGED
@@ -14,7 +14,7 @@ export class Formio {
|
|
14
14
|
Formio._formioReady = ready;
|
15
15
|
Formio._formioReadyReject = reject;
|
16
16
|
});
|
17
|
-
static version = '5.1.2-rc.
|
17
|
+
static version = '5.1.2-rc.5';
|
18
18
|
static setLicense(license, norecurse = false) {
|
19
19
|
Formio.license = license;
|
20
20
|
if (!norecurse && Formio.FormioClass) {
|
package/lib/mjs/Formio.js
CHANGED
@@ -4,7 +4,7 @@ import CDN from './CDN';
|
|
4
4
|
import Providers from './providers';
|
5
5
|
FormioCore.cdn = new CDN();
|
6
6
|
FormioCore.Providers = Providers;
|
7
|
-
FormioCore.version = '5.1.2-rc.
|
7
|
+
FormioCore.version = '5.1.2-rc.5';
|
8
8
|
CDN.defaultCDN = FormioCore.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
|
9
9
|
const isNil = (val) => val === null || val === undefined;
|
10
10
|
FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
|
@@ -2641,13 +2641,16 @@ export default class Component extends Element {
|
|
2641
2641
|
}
|
2642
2642
|
const isArray = Array.isArray(value);
|
2643
2643
|
const valueInput = this.refs.fileLink || this.refs.input;
|
2644
|
+
const isFilelink = !!this.refs.fileLink;
|
2644
2645
|
if (isArray &&
|
2645
2646
|
Array.isArray(this.defaultValue) &&
|
2646
2647
|
this.refs.hasOwnProperty('input') &&
|
2647
2648
|
valueInput &&
|
2648
2649
|
(valueInput.length !== value.length) &&
|
2649
2650
|
this.visible) {
|
2650
|
-
|
2651
|
+
if (isFilelink || valueInput.length) {
|
2652
|
+
this.redraw();
|
2653
|
+
}
|
2651
2654
|
}
|
2652
2655
|
if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {
|
2653
2656
|
this.redraw();
|
@@ -9,7 +9,7 @@ export default class ButtonComponent extends Field {
|
|
9
9
|
};
|
10
10
|
static savedValueTypes(schema: any): string[];
|
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/utils';
|
3
|
+
import { fastCloneDeep, getFocusableElements, getComponent } from '../../utils/utils';
|
4
4
|
import dragula from 'dragula';
|
5
5
|
export default class DataGridComponent extends NestedArrayComponent {
|
6
6
|
static schema(...extend) {
|
@@ -473,6 +473,10 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
473
473
|
options.row = `${rowIndex}-${colIndex}`;
|
474
474
|
options.rowIndex = rowIndex;
|
475
475
|
options.onChange = (flags, changed, modified) => {
|
476
|
+
if (changed.component.type === 'form') {
|
477
|
+
const formComp = getComponent(this.component.components, changed.component.key);
|
478
|
+
_.set(formComp, 'components', changed.component.components);
|
479
|
+
}
|
476
480
|
this.triggerChange({ modified });
|
477
481
|
};
|
478
482
|
let columnComponent;
|
@@ -145,7 +145,7 @@ export default class FileComponent extends Field {
|
|
145
145
|
}[]>;
|
146
146
|
updateProgress(fileInfo: any, progressEvent: any): void;
|
147
147
|
getMultipartOptions(fileToSync: any): any;
|
148
|
-
uploadFile(fileToSync: any): any
|
148
|
+
uploadFile(fileToSync: any): Promise<any>;
|
149
149
|
upload(): Promise<void | {
|
150
150
|
fileToSync: never;
|
151
151
|
fileInfo: any;
|
@@ -896,25 +896,23 @@ export default class FileComponent extends Field {
|
|
896
896
|
},
|
897
897
|
} : false;
|
898
898
|
}
|
899
|
-
uploadFile(fileToSync) {
|
900
|
-
|
899
|
+
async uploadFile(fileToSync) {
|
900
|
+
return await this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
|
901
901
|
// Progress callback
|
902
902
|
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
903
|
-
this.emit('fileUploadingStart'
|
903
|
+
this.emit('fileUploadingStart');
|
904
904
|
},
|
905
905
|
// Abort upload callback
|
906
906
|
(abort) => this.abortUploads.push({
|
907
907
|
id: fileToSync.id,
|
908
908
|
abort,
|
909
909
|
}), this.getMultipartOptions(fileToSync));
|
910
|
-
return filePromise;
|
911
910
|
}
|
912
911
|
async upload() {
|
913
912
|
if (!this.filesToSync.filesToUpload.length) {
|
914
913
|
return Promise.resolve();
|
915
914
|
}
|
916
915
|
return await Promise.all(this.filesToSync.filesToUpload.map(async (fileToSync) => {
|
917
|
-
let filePromise = null;
|
918
916
|
let fileInfo = null;
|
919
917
|
try {
|
920
918
|
if (fileToSync.isValidationError) {
|
@@ -923,13 +921,12 @@ export default class FileComponent extends Field {
|
|
923
921
|
fileInfo,
|
924
922
|
};
|
925
923
|
}
|
926
|
-
|
927
|
-
fileInfo = await filePromise;
|
924
|
+
fileInfo = await this.uploadFile(fileToSync);
|
928
925
|
fileToSync.status = 'success';
|
929
926
|
fileToSync.message = this.t('Succefully uploaded');
|
930
927
|
fileInfo.originalName = fileToSync.originalName;
|
931
928
|
fileInfo.hash = fileToSync.hash;
|
932
|
-
this.emit('fileUploadingEnd'
|
929
|
+
this.emit('fileUploadingEnd');
|
933
930
|
}
|
934
931
|
catch (response) {
|
935
932
|
fileToSync.status = 'error';
|
@@ -939,7 +936,7 @@ export default class FileComponent extends Field {
|
|
939
936
|
: response.type === 'abort'
|
940
937
|
? this.t('Request was aborted')
|
941
938
|
: response.toString();
|
942
|
-
this.emit('fileUploadingEnd'
|
939
|
+
this.emit('fileUploadingEnd');
|
943
940
|
this.emit('fileUploadError', {
|
944
941
|
fileToSync,
|
945
942
|
response,
|
@@ -99,6 +99,7 @@ export default class FormComponent extends Component {
|
|
99
99
|
*/
|
100
100
|
onSetSubFormValue(submission: object | null | undefined, flags: object | null | undefined): void;
|
101
101
|
areAllComponentsEmpty(data: any): boolean;
|
102
|
+
conditionallyHidden(): boolean;
|
102
103
|
updateSubFormVisibility(): void;
|
103
104
|
/**
|
104
105
|
* Determines if this form is a Nested Wizard
|
@@ -271,6 +271,9 @@ export default class FormComponent extends Component {
|
|
271
271
|
if (this.isSubFormLazyLoad() && !this.hasLoadedForm && !this.subFormLoading) {
|
272
272
|
this.createSubForm(true);
|
273
273
|
}
|
274
|
+
if (!this.subFormReady) {
|
275
|
+
return Promise.resolve();
|
276
|
+
}
|
274
277
|
return this.subFormReady.then(() => {
|
275
278
|
this.empty(element);
|
276
279
|
if (this.options.builder) {
|
@@ -403,7 +406,8 @@ export default class FormComponent extends Component {
|
|
403
406
|
const componentsMap = this.componentsMap;
|
404
407
|
const formComponentsMap = this.subForm.componentsMap;
|
405
408
|
_.assign(componentsMap, formComponentsMap);
|
406
|
-
this.component.components = this.subForm.components
|
409
|
+
this.component.components = this.subForm._form?.components;
|
410
|
+
this.component.display = this.subForm._form?.display;
|
407
411
|
this.subForm.on('change', () => {
|
408
412
|
if (this.subForm) {
|
409
413
|
this.dataValue = this.subForm.getValue();
|
@@ -693,6 +697,13 @@ export default class FormComponent extends Component {
|
|
693
697
|
}
|
694
698
|
return errors;
|
695
699
|
}
|
700
|
+
conditionallyHidden() {
|
701
|
+
const conditionallyHidden = super.conditionallyHidden();
|
702
|
+
if (this.subForm) {
|
703
|
+
this.subForm._conditionallyHidden = conditionallyHidden;
|
704
|
+
}
|
705
|
+
return conditionallyHidden;
|
706
|
+
}
|
696
707
|
updateSubFormVisibility() {
|
697
708
|
if (this.subForm) {
|
698
709
|
this.subForm.parentVisible = this.visible;
|
@@ -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
|
}
|
@@ -37,7 +37,7 @@ declare namespace _default {
|
|
37
37
|
};
|
38
38
|
transform(type: any, text: any, instance: any): any;
|
39
39
|
defaultIconset: string;
|
40
|
-
iconClass: (iconset:
|
40
|
+
iconClass: (iconset: "fa" | "bi", name: string, spinning: boolean) => string;
|
41
41
|
cssClasses: {
|
42
42
|
'border-default': string;
|
43
43
|
'formio-tab-panel-active': string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.1.2-rc.
|
3
|
+
"version": "5.1.2-rc.5",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -79,9 +79,9 @@
|
|
79
79
|
},
|
80
80
|
"homepage": "https://github.com/formio/formio.js#readme",
|
81
81
|
"dependencies": {
|
82
|
-
"@formio/bootstrap": "3.1.1-rc.
|
82
|
+
"@formio/bootstrap": "3.1.1-rc.3",
|
83
83
|
"@formio/choices.js": "^10.2.1",
|
84
|
-
"@formio/core": "2.4.1-rc.
|
84
|
+
"@formio/core": "2.4.1-rc.4",
|
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",
|