@formio/js 5.1.2-rc.2 → 5.1.2-rc.4
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 +6 -6
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +6 -6
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +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/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/Embed.js +1 -1
- package/lib/mjs/Formio.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 +1 -1
@@ -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.4 | https://unpkg.com/formiojs@5.1.2-rc.4/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
|
|
@@ -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.4 | https://unpkg.com/formiojs@5.1.2-rc.4/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.4';
|
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.4';
|
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) {
|
@@ -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;
|
@@ -899,17 +899,16 @@ class FileComponent extends Field_1.default {
|
|
899
899
|
}
|
900
900
|
uploadFile(fileToSync) {
|
901
901
|
return __awaiter(this, void 0, void 0, function* () {
|
902
|
-
|
902
|
+
return yield this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
|
903
903
|
// Progress callback
|
904
904
|
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
905
|
-
this.emit('fileUploadingStart'
|
905
|
+
this.emit('fileUploadingStart');
|
906
906
|
},
|
907
907
|
// Abort upload callback
|
908
908
|
(abort) => this.abortUploads.push({
|
909
909
|
id: fileToSync.id,
|
910
910
|
abort,
|
911
911
|
}), this.getMultipartOptions(fileToSync));
|
912
|
-
return yield filePromise;
|
913
912
|
});
|
914
913
|
}
|
915
914
|
upload() {
|
@@ -931,7 +930,7 @@ class FileComponent extends Field_1.default {
|
|
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,
|
@@ -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/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.4';
|
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.4';
|
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) {
|
@@ -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;
|
@@ -897,17 +897,16 @@ export default class FileComponent extends Field {
|
|
897
897
|
} : false;
|
898
898
|
}
|
899
899
|
async uploadFile(fileToSync) {
|
900
|
-
|
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 await filePromise;
|
911
910
|
}
|
912
911
|
async upload() {
|
913
912
|
if (!this.filesToSync.filesToUpload.length) {
|
@@ -927,7 +926,7 @@ export default class FileComponent extends Field {
|
|
927
926
|
fileToSync.message = this.t('Succefully uploaded');
|
928
927
|
fileInfo.originalName = fileToSync.originalName;
|
929
928
|
fileInfo.hash = fileToSync.hash;
|
930
|
-
this.emit('fileUploadingEnd'
|
929
|
+
this.emit('fileUploadingEnd');
|
931
930
|
}
|
932
931
|
catch (response) {
|
933
932
|
fileToSync.status = 'error';
|
@@ -937,7 +936,7 @@ export default class FileComponent extends Field {
|
|
937
936
|
: response.type === 'abort'
|
938
937
|
? this.t('Request was aborted')
|
939
938
|
: response.toString();
|
940
|
-
this.emit('fileUploadingEnd'
|
939
|
+
this.emit('fileUploadingEnd');
|
941
940
|
this.emit('fileUploadError', {
|
942
941
|
fileToSync,
|
943
942
|
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
|
}
|