@formio/js 5.4.0-api98.1 → 5.4.0
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.builder.css +15 -0
- package/dist/formio.builder.min.css +1 -1
- 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.css +15 -0
- package/dist/formio.form.js +917 -897
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -2
- package/dist/formio.full.css +15 -0
- package/dist/formio.full.js +1211 -1191
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -2
- package/dist/formio.js +832 -812
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -2
- package/dist/formio.utils.js +774 -754
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -2
- package/lib/cjs/Element.d.ts +11 -0
- package/lib/cjs/Element.js +24 -0
- package/lib/cjs/Embed.js +23 -2
- package/lib/cjs/Form.d.ts +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDFBuilder.js +6 -1
- package/lib/cjs/Webform.d.ts +1 -1
- package/lib/cjs/Webform.js +9 -6
- package/lib/cjs/WebformBuilder.js +14 -1
- package/lib/cjs/Wizard.js +15 -11
- package/lib/cjs/components/Components.d.ts +3 -0
- package/lib/cjs/components/Components.js +3 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +8 -0
- package/lib/cjs/components/_classes/component/Component.js +121 -42
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/cjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -7
- package/lib/cjs/components/address/Address.js +2 -0
- package/lib/cjs/components/datagrid/DataGrid.js +31 -5
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -4
- package/lib/cjs/components/datamap/DataMap.js +42 -10
- package/lib/cjs/components/datetime/DateTime.js +11 -1
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.d.ts +18 -1
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +3 -0
- package/lib/cjs/components/datetime/editForm/DateTime.edit.time.d.ts +13 -2
- package/lib/cjs/components/datetime/editForm/DateTime.edit.time.js +3 -0
- package/lib/cjs/components/day/Day.d.ts +0 -15
- package/lib/cjs/components/day/Day.js +8 -17
- package/lib/cjs/components/editgrid/EditGrid.js +13 -3
- package/lib/cjs/components/file/File.js +7 -6
- package/lib/cjs/components/form/Form.d.ts +1 -0
- package/lib/cjs/components/form/Form.js +20 -8
- package/lib/cjs/components/number/Number.d.ts +1 -0
- package/lib/cjs/components/number/Number.js +18 -0
- package/lib/cjs/components/select/Select.js +4 -0
- package/lib/cjs/components/signature/Signature.js +5 -5
- package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/cjs/components/textfield/editForm/TextField.edit.display.d.ts +0 -10
- package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +9 -23
- package/lib/cjs/formio.form.js +2 -5
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/providers/storage/azure.js +9 -3
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/index.d.ts +3 -3
- package/lib/cjs/utils/utils.d.ts +1 -1
- package/lib/cjs/utils/utils.js +23 -6
- package/lib/cjs/widgets/CalendarWidget.js +1 -1
- package/lib/mjs/Element.d.ts +11 -0
- package/lib/mjs/Element.js +23 -0
- package/lib/mjs/Embed.js +21 -2
- package/lib/mjs/Form.d.ts +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDFBuilder.js +6 -1
- package/lib/mjs/Webform.d.ts +1 -1
- package/lib/mjs/Webform.js +6 -3
- package/lib/mjs/WebformBuilder.js +13 -1
- package/lib/mjs/Wizard.js +9 -10
- package/lib/mjs/components/Components.d.ts +3 -0
- package/lib/mjs/components/Components.js +3 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +8 -0
- package/lib/mjs/components/_classes/component/Component.js +119 -41
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/mjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -6
- package/lib/mjs/components/address/Address.js +2 -0
- package/lib/mjs/components/datagrid/DataGrid.js +34 -5
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -4
- package/lib/mjs/components/datamap/DataMap.js +41 -10
- package/lib/mjs/components/datetime/DateTime.js +11 -1
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.d.ts +18 -1
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +3 -0
- package/lib/mjs/components/datetime/editForm/DateTime.edit.time.d.ts +13 -2
- package/lib/mjs/components/datetime/editForm/DateTime.edit.time.js +3 -0
- package/lib/mjs/components/day/Day.d.ts +0 -15
- package/lib/mjs/components/day/Day.js +8 -17
- package/lib/mjs/components/editgrid/EditGrid.js +12 -2
- package/lib/mjs/components/file/File.js +7 -6
- package/lib/mjs/components/form/Form.d.ts +1 -0
- package/lib/mjs/components/form/Form.js +18 -6
- package/lib/mjs/components/number/Number.d.ts +1 -0
- package/lib/mjs/components/number/Number.js +17 -0
- package/lib/mjs/components/select/Select.js +4 -0
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/mjs/components/textfield/editForm/TextField.edit.display.d.ts +0 -10
- package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +9 -23
- package/lib/mjs/formio.form.js +4 -7
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/providers/storage/azure.js +9 -3
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/index.d.ts +3 -3
- package/lib/mjs/utils/utils.d.ts +1 -1
- package/lib/mjs/utils/utils.js +22 -6
- package/lib/mjs/widgets/CalendarWidget.js +2 -2
- package/package.json +7 -6
|
@@ -166,25 +166,19 @@ class DayComponent extends Field_1.default {
|
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
get days() {
|
|
169
|
-
|
|
170
|
-
return this._days;
|
|
171
|
-
}
|
|
172
|
-
this._days = [
|
|
169
|
+
const days = [
|
|
173
170
|
{ value: '', label: lodash_1.default.get(this.component, 'fields.day.placeholder', '') },
|
|
174
171
|
];
|
|
175
172
|
for (let x = 1; x <= 31; x++) {
|
|
176
|
-
|
|
173
|
+
days.push({
|
|
177
174
|
value: x,
|
|
178
175
|
label: x.toString(),
|
|
179
176
|
});
|
|
180
177
|
}
|
|
181
|
-
return
|
|
178
|
+
return days;
|
|
182
179
|
}
|
|
183
180
|
get months() {
|
|
184
|
-
|
|
185
|
-
return this._months;
|
|
186
|
-
}
|
|
187
|
-
this._months = [
|
|
181
|
+
const months = [
|
|
188
182
|
{
|
|
189
183
|
value: '',
|
|
190
184
|
label: lodash_1.default.get(this.component, 'fields.month.placeholder') ||
|
|
@@ -203,24 +197,21 @@ class DayComponent extends Field_1.default {
|
|
|
203
197
|
{ value: 11, label: 'November' },
|
|
204
198
|
{ value: 12, label: 'December' },
|
|
205
199
|
];
|
|
206
|
-
return
|
|
200
|
+
return months;
|
|
207
201
|
}
|
|
208
202
|
get years() {
|
|
209
|
-
|
|
210
|
-
return this._years;
|
|
211
|
-
}
|
|
212
|
-
this._years = [
|
|
203
|
+
const years = [
|
|
213
204
|
{ value: '', label: lodash_1.default.get(this.component, 'fields.year.placeholder', '') },
|
|
214
205
|
];
|
|
215
206
|
const minYears = lodash_1.default.get(this.component, 'fields.year.minYear', 1900) || 1900;
|
|
216
207
|
const maxYears = lodash_1.default.get(this.component, 'fields.year.maxYear', 2030) || 2030;
|
|
217
208
|
for (let x = minYears; x <= maxYears; x++) {
|
|
218
|
-
|
|
209
|
+
years.push({
|
|
219
210
|
value: x,
|
|
220
211
|
label: x.toString(),
|
|
221
212
|
});
|
|
222
213
|
}
|
|
223
|
-
return
|
|
214
|
+
return years;
|
|
224
215
|
}
|
|
225
216
|
setErrorClasses(elements, dirty, hasError) {
|
|
226
217
|
super.setErrorClasses(elements, dirty, hasError);
|
|
@@ -545,7 +545,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
545
545
|
getView: (component, data) => {
|
|
546
546
|
var _a, _b;
|
|
547
547
|
const instance = flattenedComponents[component.key];
|
|
548
|
-
const view = instance ? instance.getView(
|
|
548
|
+
const view = instance ? instance.getView(instance.dataValue) : '';
|
|
549
549
|
// If there is an html tag in view, don't allow it to be injected in template
|
|
550
550
|
const htmlTagRegExp = new RegExp('<(.*?)>');
|
|
551
551
|
return typeof view === 'string' &&
|
|
@@ -814,7 +814,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
816
|
saveRow(rowIndex, modified) {
|
|
817
|
-
var _a, _b, _c;
|
|
817
|
+
var _a, _b, _c, _d;
|
|
818
818
|
const editRow = this.editRows[rowIndex];
|
|
819
819
|
if (this.options.readOnly) {
|
|
820
820
|
return;
|
|
@@ -869,7 +869,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
869
869
|
if (this.component.rowDrafts) {
|
|
870
870
|
editRow.components.forEach((comp) => comp.setPristine(this.pristine));
|
|
871
871
|
}
|
|
872
|
-
this.checkValidity(null,
|
|
872
|
+
this.checkValidity(null, !this.component.rowDrafts || ((_d = this.root) === null || _d === void 0 ? void 0 : _d.submitted));
|
|
873
873
|
this.redraw();
|
|
874
874
|
if (editRow.alerts) {
|
|
875
875
|
editRow.alerts = false;
|
|
@@ -960,9 +960,19 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
960
960
|
}
|
|
961
961
|
const column = lodash_1.default.clone(col);
|
|
962
962
|
const options = lodash_1.default.clone(this.options);
|
|
963
|
+
const rootSubmissionTz = lodash_1.default.get(this.root, 'options.submissionTimezone');
|
|
964
|
+
if (rootSubmissionTz && !options.submissionTimezone) {
|
|
965
|
+
options.submissionTimezone = rootSubmissionTz;
|
|
966
|
+
}
|
|
963
967
|
options.name += `[${rowIndex}]`;
|
|
964
968
|
options.row = `${rowIndex}-${colIndex}`;
|
|
965
969
|
options.rowIndex = rowIndex;
|
|
970
|
+
if (this.submissionTimezone) {
|
|
971
|
+
options.submissionTimezone = this.submissionTimezone;
|
|
972
|
+
if (column.type === 'datetime') {
|
|
973
|
+
column.widget = Object.assign(Object.assign({}, column.widget), { submissionTimezone: this.submissionTimezone });
|
|
974
|
+
}
|
|
975
|
+
}
|
|
966
976
|
options.onChange = (flags = {}, changed, modified) => {
|
|
967
977
|
var _a, _b, _c, _d;
|
|
968
978
|
if (((_a = changed.instance.root) === null || _a === void 0 ? void 0 : _a.id) && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.id) !== changed.instance.root.id) {
|
|
@@ -968,16 +968,17 @@ class FileComponent extends Field_1.default {
|
|
|
968
968
|
}
|
|
969
969
|
uploadFile(fileToSync) {
|
|
970
970
|
return __awaiter(this, void 0, void 0, function* () {
|
|
971
|
-
|
|
971
|
+
const filePromise = this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
|
|
972
972
|
// Progress callback
|
|
973
973
|
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
|
974
|
-
this.emit('fileUploadingStart');
|
|
974
|
+
this.emit('fileUploadingStart', filePromise);
|
|
975
975
|
},
|
|
976
976
|
// Abort upload callback
|
|
977
977
|
(abort) => this.abortUploads.push({
|
|
978
978
|
id: fileToSync.id,
|
|
979
979
|
abort,
|
|
980
980
|
}), this.getMultipartOptions(fileToSync));
|
|
981
|
+
return yield filePromise;
|
|
981
982
|
});
|
|
982
983
|
}
|
|
983
984
|
upload() {
|
|
@@ -1015,7 +1016,7 @@ class FileComponent extends Field_1.default {
|
|
|
1015
1016
|
fileToSync.message = this.t('Succefully uploaded');
|
|
1016
1017
|
fileInfo.originalName = fileToSync.originalName;
|
|
1017
1018
|
fileInfo.hash = fileToSync.hash;
|
|
1018
|
-
this.emit('fileUploadingEnd');
|
|
1019
|
+
this.emit('fileUploadingEnd', Promise.resolve(fileInfo));
|
|
1019
1020
|
}
|
|
1020
1021
|
catch (response) {
|
|
1021
1022
|
fileToSync.status = 'error';
|
|
@@ -1026,8 +1027,8 @@ class FileComponent extends Field_1.default {
|
|
|
1026
1027
|
: response.type === 'abort'
|
|
1027
1028
|
? this.t('Request was aborted')
|
|
1028
1029
|
: response.toString();
|
|
1029
|
-
this.emit('fileUploadingEnd');
|
|
1030
|
-
this.emit('fileUploadError', {
|
|
1030
|
+
this.emit('fileUploadingEnd', Promise.reject(response));
|
|
1031
|
+
this.emit(lodash_1.default.get(response, 'type') === 'abort' ? 'fileUploadCanceled' : 'fileUploadError', {
|
|
1031
1032
|
fileToSync,
|
|
1032
1033
|
response,
|
|
1033
1034
|
});
|
|
@@ -1036,7 +1037,7 @@ class FileComponent extends Field_1.default {
|
|
|
1036
1037
|
delete fileToSync.progress;
|
|
1037
1038
|
this.redraw();
|
|
1038
1039
|
const fileExists = this.resolvedFiles.find(x => x.fileInfo.originalName === fileToSync.originalName);
|
|
1039
|
-
if (!fileExists) {
|
|
1040
|
+
if (!fileExists && fileToSync.status !== 'error') {
|
|
1040
1041
|
this.resolvedFiles.push({ fileToSync, fileInfo });
|
|
1041
1042
|
}
|
|
1042
1043
|
}
|
|
@@ -42,6 +42,7 @@ export default class FormComponent extends Component {
|
|
|
42
42
|
everyComponent(...args: any[]): any;
|
|
43
43
|
setSubFormDisabled(subForm: any): void;
|
|
44
44
|
updateSubWizards(subForm: any): void;
|
|
45
|
+
updateTopLevelComponentsMap(): void;
|
|
45
46
|
setComponentsMap(): void;
|
|
46
47
|
/**
|
|
47
48
|
* Create a subform instance.
|
|
@@ -400,13 +400,22 @@ class FormComponent extends Component_1.default {
|
|
|
400
400
|
this.emit('subWizardsUpdated', subForm);
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
+
updateTopLevelComponentsMap() {
|
|
404
|
+
let prevRootId = null;
|
|
405
|
+
let currentRoot = this.root;
|
|
406
|
+
const subFormComponentMap = this.subForm.componentsMap;
|
|
407
|
+
// update components map for all top forms
|
|
408
|
+
while (currentRoot && prevRootId !== currentRoot.id) {
|
|
409
|
+
lodash_1.default.assign(currentRoot.componentsMap, subFormComponentMap);
|
|
410
|
+
prevRootId = currentRoot.id;
|
|
411
|
+
currentRoot = currentRoot.root;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
403
414
|
setComponentsMap() {
|
|
404
415
|
if (!this.subForm) {
|
|
405
416
|
return;
|
|
406
417
|
}
|
|
407
|
-
|
|
408
|
-
const formComponentsMap = this.subForm.componentsMap;
|
|
409
|
-
lodash_1.default.assign(componentsMap, formComponentsMap);
|
|
418
|
+
this.updateTopLevelComponentsMap();
|
|
410
419
|
}
|
|
411
420
|
/**
|
|
412
421
|
* Create a subform instance.
|
|
@@ -431,13 +440,13 @@ class FormComponent extends Component_1.default {
|
|
|
431
440
|
// Render the form.
|
|
432
441
|
return new Form_1.default(form, this.getSubOptions()).ready
|
|
433
442
|
.then((instance) => {
|
|
434
|
-
var _a
|
|
443
|
+
var _a;
|
|
435
444
|
this.subForm = instance;
|
|
436
445
|
this.subForm.currentForm = this;
|
|
437
446
|
this.subForm.parentVisible = this.visible;
|
|
438
447
|
this.setComponentsMap();
|
|
439
|
-
this.component.components =
|
|
440
|
-
this.component.display = (
|
|
448
|
+
this.component.components = this.subForm.components.map((comp) => comp.component);
|
|
449
|
+
this.component.display = (_a = this.subForm._form) === null || _a === void 0 ? void 0 : _a.display;
|
|
441
450
|
this.subForm.on('change', () => {
|
|
442
451
|
var _a;
|
|
443
452
|
if (this.subForm && !this.shouldConditionallyClear()) {
|
|
@@ -562,10 +571,11 @@ class FormComponent extends Component_1.default {
|
|
|
562
571
|
* @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
|
|
563
572
|
*/
|
|
564
573
|
get shouldSubmit() {
|
|
574
|
+
const hiddenByJsonOnly = !this.hasCondition() && this.component.hidden;
|
|
565
575
|
return (this.subFormReady &&
|
|
566
576
|
(!this.component.hasOwnProperty('reference') || this.component.reference) &&
|
|
567
577
|
!this.shouldConditionallyClear() &&
|
|
568
|
-
!(
|
|
578
|
+
!(hiddenByJsonOnly && this.component.clearOnHide));
|
|
569
579
|
}
|
|
570
580
|
/**
|
|
571
581
|
* Returns the data for the subform.
|
|
@@ -776,7 +786,9 @@ class FormComponent extends Component_1.default {
|
|
|
776
786
|
}
|
|
777
787
|
this.updateSubFormVisibility();
|
|
778
788
|
this.clearOnHide();
|
|
779
|
-
|
|
789
|
+
if (!isNestedWizard) {
|
|
790
|
+
this.redraw();
|
|
791
|
+
}
|
|
780
792
|
}
|
|
781
793
|
if (!value && isNestedWizard) {
|
|
782
794
|
(_a = this.root) === null || _a === void 0 ? void 0 : _a.redraw();
|
|
@@ -34,6 +34,7 @@ export default class NumberComponent extends Input {
|
|
|
34
34
|
* @returns {number} a parsed number
|
|
35
35
|
*/
|
|
36
36
|
parseNumber(value: string): number;
|
|
37
|
+
normalizeValue(value: any, flags?: {}, emptyValue?: null): any;
|
|
37
38
|
setInputMask(input: any): void;
|
|
38
39
|
getValueAt(index: any): number | null;
|
|
39
40
|
setValueAt(index: any, value: any, flags?: {}): void;
|
|
@@ -143,6 +143,24 @@ class NumberComponent extends Input_1.default {
|
|
|
143
143
|
return parseFloat(value);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
+
normalizeValue(value, flags = {}, emptyValue = this.emptyValue) {
|
|
147
|
+
var _a;
|
|
148
|
+
if (typeof value === 'string') {
|
|
149
|
+
const result = this.parseNumber(value);
|
|
150
|
+
value = lodash_1.default.isNaN(result) ? this.emptyValue : result;
|
|
151
|
+
}
|
|
152
|
+
if (((_a = this.component) === null || _a === void 0 ? void 0 : _a.multiple) && Array.isArray(value)) {
|
|
153
|
+
const normilizedValues = value.map((val) => {
|
|
154
|
+
if (typeof val === 'string') {
|
|
155
|
+
const result = this.parseNumber(val);
|
|
156
|
+
return lodash_1.default.isNaN(result) ? this.emptyValue : result;
|
|
157
|
+
}
|
|
158
|
+
return val;
|
|
159
|
+
});
|
|
160
|
+
value = normilizedValues;
|
|
161
|
+
}
|
|
162
|
+
return super.normalizeValue(value, flags, emptyValue);
|
|
163
|
+
}
|
|
146
164
|
setInputMask(input) {
|
|
147
165
|
let numberPattern = '[0-9';
|
|
148
166
|
numberPattern += this.decimalSeparator || '';
|
|
@@ -1339,6 +1339,10 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
lodash_1.default.set(submission.metadata.selectData, this.path, templateData);
|
|
1341
1341
|
}
|
|
1342
|
+
else if (!this.templateData[templateValue] &&
|
|
1343
|
+
this.isEmpty(value)) {
|
|
1344
|
+
lodash_1.default.unset(this.root.submission, `metadata.selectData.${this.path}`);
|
|
1345
|
+
}
|
|
1342
1346
|
if (flags.resetValue && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submission) && !this.options.readOnly) {
|
|
1343
1347
|
const submission = this.root.submission;
|
|
1344
1348
|
if (!submission.metadata) {
|
|
@@ -49,7 +49,7 @@ class SignatureComponent extends Input_1.default {
|
|
|
49
49
|
]);
|
|
50
50
|
}
|
|
51
51
|
init() {
|
|
52
|
-
var _a, _b, _c, _d
|
|
52
|
+
var _a, _b, _c, _d;
|
|
53
53
|
super.init();
|
|
54
54
|
this.currentWidth = 0;
|
|
55
55
|
this.scale = 1;
|
|
@@ -60,10 +60,10 @@ class SignatureComponent extends Input_1.default {
|
|
|
60
60
|
this.component.height = '200px';
|
|
61
61
|
}
|
|
62
62
|
if (this.component.keepOverlayRatio &&
|
|
63
|
-
|
|
64
|
-
((
|
|
65
|
-
((
|
|
66
|
-
this.ratio = ((
|
|
63
|
+
this.options.pdf &&
|
|
64
|
+
((_a = this.component.overlay) === null || _a === void 0 ? void 0 : _a.width) &&
|
|
65
|
+
((_b = this.component.overlay) === null || _b === void 0 ? void 0 : _b.height)) {
|
|
66
|
+
this.ratio = ((_c = this.component.overlay) === null || _c === void 0 ? void 0 : _c.width) / ((_d = this.component.overlay) === null || _d === void 0 ? void 0 : _d.height);
|
|
67
67
|
this.component.width = '100%';
|
|
68
68
|
this.component.height = 'auto';
|
|
69
69
|
}
|
|
@@ -7,7 +7,6 @@ declare const _default: ({
|
|
|
7
7
|
placeholder: string;
|
|
8
8
|
weight: number;
|
|
9
9
|
conditional?: undefined;
|
|
10
|
-
customConditional?: undefined;
|
|
11
10
|
ignore?: undefined;
|
|
12
11
|
} | {
|
|
13
12
|
type: string;
|
|
@@ -24,7 +23,6 @@ declare const _default: ({
|
|
|
24
23
|
};
|
|
25
24
|
};
|
|
26
25
|
weight: number;
|
|
27
|
-
customConditional?: undefined;
|
|
28
26
|
ignore?: undefined;
|
|
29
27
|
} | {
|
|
30
28
|
weight: number;
|
|
@@ -32,9 +30,6 @@ declare const _default: ({
|
|
|
32
30
|
label: string;
|
|
33
31
|
tooltip: string;
|
|
34
32
|
key: string;
|
|
35
|
-
customConditional: ({ options }: {
|
|
36
|
-
options: any;
|
|
37
|
-
}) => boolean;
|
|
38
33
|
input: boolean;
|
|
39
34
|
placeholder?: undefined;
|
|
40
35
|
conditional?: undefined;
|
|
@@ -49,6 +44,5 @@ declare const _default: ({
|
|
|
49
44
|
placeholder?: undefined;
|
|
50
45
|
weight?: undefined;
|
|
51
46
|
conditional?: undefined;
|
|
52
|
-
customConditional?: undefined;
|
|
53
47
|
})[];
|
|
54
48
|
export default _default;
|
|
@@ -48,7 +48,6 @@ exports.default = [
|
|
|
48
48
|
label: 'Keep Overlay Aspect Ratio',
|
|
49
49
|
tooltip: 'If checked, the field will have the same aspect ratio as its preview.',
|
|
50
50
|
key: 'keepOverlayRatio',
|
|
51
|
-
customConditional: ({ options }) => { var _a; return ((_a = options === null || options === void 0 ? void 0 : options.editForm) === null || _a === void 0 ? void 0 : _a.display) === 'pdf'; },
|
|
52
51
|
input: true,
|
|
53
52
|
},
|
|
54
53
|
{
|
|
@@ -25,7 +25,6 @@ declare const _default: ({
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
clearOnHide?: undefined;
|
|
28
|
-
customDefaultValue?: undefined;
|
|
29
28
|
rows?: undefined;
|
|
30
29
|
editor?: undefined;
|
|
31
30
|
as?: undefined;
|
|
@@ -40,7 +39,6 @@ declare const _default: ({
|
|
|
40
39
|
label: string;
|
|
41
40
|
clearOnHide: boolean;
|
|
42
41
|
onChange: (context: any) => void;
|
|
43
|
-
customDefaultValue: (value: any, component: any, row: any, data: any, instance: any) => any;
|
|
44
42
|
input: boolean;
|
|
45
43
|
rows: number;
|
|
46
44
|
editor: string;
|
|
@@ -79,7 +77,6 @@ declare const _default: ({
|
|
|
79
77
|
data?: undefined;
|
|
80
78
|
conditional?: undefined;
|
|
81
79
|
clearOnHide?: undefined;
|
|
82
|
-
customDefaultValue?: undefined;
|
|
83
80
|
rows?: undefined;
|
|
84
81
|
editor?: undefined;
|
|
85
82
|
as?: undefined;
|
|
@@ -107,7 +104,6 @@ declare const _default: ({
|
|
|
107
104
|
onChange?: undefined;
|
|
108
105
|
conditional?: undefined;
|
|
109
106
|
clearOnHide?: undefined;
|
|
110
|
-
customDefaultValue?: undefined;
|
|
111
107
|
rows?: undefined;
|
|
112
108
|
editor?: undefined;
|
|
113
109
|
as?: undefined;
|
|
@@ -133,7 +129,6 @@ declare const _default: ({
|
|
|
133
129
|
data?: undefined;
|
|
134
130
|
conditional?: undefined;
|
|
135
131
|
clearOnHide?: undefined;
|
|
136
|
-
customDefaultValue?: undefined;
|
|
137
132
|
rows?: undefined;
|
|
138
133
|
editor?: undefined;
|
|
139
134
|
as?: undefined;
|
|
@@ -154,7 +149,6 @@ declare const _default: ({
|
|
|
154
149
|
data?: undefined;
|
|
155
150
|
conditional?: undefined;
|
|
156
151
|
clearOnHide?: undefined;
|
|
157
|
-
customDefaultValue?: undefined;
|
|
158
152
|
rows?: undefined;
|
|
159
153
|
editor?: undefined;
|
|
160
154
|
as?: undefined;
|
|
@@ -177,7 +171,6 @@ declare const _default: ({
|
|
|
177
171
|
data?: undefined;
|
|
178
172
|
conditional?: undefined;
|
|
179
173
|
clearOnHide?: undefined;
|
|
180
|
-
customDefaultValue?: undefined;
|
|
181
174
|
rows?: undefined;
|
|
182
175
|
editor?: undefined;
|
|
183
176
|
as?: undefined;
|
|
@@ -208,7 +201,6 @@ declare const _default: ({
|
|
|
208
201
|
data?: undefined;
|
|
209
202
|
conditional?: undefined;
|
|
210
203
|
clearOnHide?: undefined;
|
|
211
|
-
customDefaultValue?: undefined;
|
|
212
204
|
rows?: undefined;
|
|
213
205
|
editor?: undefined;
|
|
214
206
|
as?: undefined;
|
|
@@ -228,7 +220,6 @@ declare const _default: ({
|
|
|
228
220
|
data?: undefined;
|
|
229
221
|
conditional?: undefined;
|
|
230
222
|
clearOnHide?: undefined;
|
|
231
|
-
customDefaultValue?: undefined;
|
|
232
223
|
rows?: undefined;
|
|
233
224
|
editor?: undefined;
|
|
234
225
|
as?: undefined;
|
|
@@ -251,7 +242,6 @@ declare const _default: ({
|
|
|
251
242
|
data?: undefined;
|
|
252
243
|
conditional?: undefined;
|
|
253
244
|
clearOnHide?: undefined;
|
|
254
|
-
customDefaultValue?: undefined;
|
|
255
245
|
rows?: undefined;
|
|
256
246
|
editor?: undefined;
|
|
257
247
|
as?: undefined;
|
|
@@ -20,19 +20,19 @@ exports.default = [
|
|
|
20
20
|
defaultValue: 'input',
|
|
21
21
|
calculateValue: (context) => {
|
|
22
22
|
var _a;
|
|
23
|
-
let currentType = context.
|
|
23
|
+
let currentType = context.instance._widgetType;
|
|
24
24
|
if (currentType) {
|
|
25
25
|
return currentType;
|
|
26
26
|
}
|
|
27
27
|
const widget = context.data.widget;
|
|
28
28
|
if (isObject(widget) && widget.type) {
|
|
29
|
-
context.
|
|
29
|
+
context.instance._widgetType = widget.type;
|
|
30
30
|
return widget.type;
|
|
31
31
|
}
|
|
32
32
|
if (typeof widget === 'string') {
|
|
33
33
|
const originalType = (_a = getOriginalWidget(context.instance)) === null || _a === void 0 ? void 0 : _a.type;
|
|
34
34
|
if (originalType) {
|
|
35
|
-
context.
|
|
35
|
+
context.instance._widgetType = originalType;
|
|
36
36
|
return originalType;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -40,11 +40,11 @@ exports.default = [
|
|
|
40
40
|
},
|
|
41
41
|
onChange: (context) => {
|
|
42
42
|
var _a;
|
|
43
|
-
const newType = context.
|
|
43
|
+
const newType = context.instance.dataValue;
|
|
44
44
|
const currentWidget = context.data.widget;
|
|
45
45
|
let oldType;
|
|
46
46
|
if (isObject(currentWidget)) {
|
|
47
|
-
oldType =
|
|
47
|
+
oldType = context.instance._widgetType;
|
|
48
48
|
}
|
|
49
49
|
else if (typeof currentWidget === 'string') {
|
|
50
50
|
oldType = (_a = getOriginalWidget(context.instance)) === null || _a === void 0 ? void 0 : _a.type;
|
|
@@ -55,10 +55,12 @@ exports.default = [
|
|
|
55
55
|
if (newType !== oldType) {
|
|
56
56
|
if (newType === 'input') {
|
|
57
57
|
context.data.widget = { type: 'input' };
|
|
58
|
+
context.instance._widgetType = newType;
|
|
58
59
|
}
|
|
59
|
-
else {
|
|
60
|
+
else if (newType) {
|
|
60
61
|
const defaultSettings = getDefaultWidgetSettings(newType);
|
|
61
62
|
context.data.widget = defaultSettings || { type: newType };
|
|
63
|
+
context.instance._widgetType = newType;
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
else if (!currentWidget) {
|
|
@@ -94,28 +96,12 @@ exports.default = [
|
|
|
94
96
|
return;
|
|
95
97
|
}
|
|
96
98
|
if (isObject(currentWidget)) {
|
|
97
|
-
const currentType = context.
|
|
99
|
+
const currentType = context.instance.root.getComponent('widget.type')._widgetType || currentWidget.type;
|
|
98
100
|
if (currentType && currentWidget.type !== currentType) {
|
|
99
101
|
context.data.widget = Object.assign(Object.assign({}, currentWidget), { type: currentType });
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
},
|
|
103
|
-
customDefaultValue: (value, component, row, data, instance) => {
|
|
104
|
-
if (!data.widget) {
|
|
105
|
-
const originalWidget = getOriginalWidget(instance);
|
|
106
|
-
const widgetType = data['widget.type'] || (originalWidget === null || originalWidget === void 0 ? void 0 : originalWidget.type);
|
|
107
|
-
if (widgetType && widgetType !== 'input') {
|
|
108
|
-
if ((originalWidget === null || originalWidget === void 0 ? void 0 : originalWidget.type) === widgetType && !lodash_1.default.isEmpty(lodash_1.default.omit(originalWidget, 'type'))) {
|
|
109
|
-
return lodash_1.default.omit(originalWidget, 'language');
|
|
110
|
-
}
|
|
111
|
-
const defaultSettings = getDefaultWidgetSettings(widgetType);
|
|
112
|
-
if (defaultSettings) {
|
|
113
|
-
return defaultSettings;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return value;
|
|
118
|
-
},
|
|
119
105
|
input: true,
|
|
120
106
|
rows: 5,
|
|
121
107
|
editor: 'ace',
|
package/lib/cjs/formio.form.js
CHANGED
|
@@ -132,12 +132,9 @@ function registerModule(mod, defaultFn = null, options = {}) {
|
|
|
132
132
|
break;
|
|
133
133
|
default:
|
|
134
134
|
if (defaultFn) {
|
|
135
|
-
|
|
136
|
-
console.warn('Unknown module option', key);
|
|
137
|
-
}
|
|
135
|
+
defaultFn(key, mod);
|
|
138
136
|
break;
|
|
139
137
|
}
|
|
140
|
-
console.log('Unknown module option', key);
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
140
|
}
|
|
@@ -151,7 +148,7 @@ function useModule(defaultFn = null) {
|
|
|
151
148
|
plugins = lodash_1.default.isArray(plugins)
|
|
152
149
|
? plugins
|
|
153
150
|
: [
|
|
154
|
-
plugins
|
|
151
|
+
plugins
|
|
155
152
|
];
|
|
156
153
|
plugins.forEach((plugin) => {
|
|
157
154
|
if (Array.isArray(plugin)) {
|
package/lib/cjs/package.json
CHANGED
|
@@ -35,9 +35,15 @@ function azure(formio) {
|
|
|
35
35
|
downloadFile(file) {
|
|
36
36
|
return formio.makeRequest('file', `${formio.formUrl}/storage/azure?name=${xhr_1.default.trim(file.name)}`, 'GET');
|
|
37
37
|
},
|
|
38
|
-
deleteFile
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
deleteFile(fileInfo, options) {
|
|
39
|
+
const name = xhr_1.default.trim(fileInfo.name);
|
|
40
|
+
const key = xhr_1.default.trim(fileInfo.key);
|
|
41
|
+
return formio.makeRequest('', `${formio.formUrl}/storage/azure?name=${encodeURIComponent(name)}&key=${encodeURIComponent(key)}`, 'delete').then((response) => {
|
|
42
|
+
return {
|
|
43
|
+
success: true,
|
|
44
|
+
key: (response === null || response === void 0 ? void 0 : response.key) || key,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
41
47
|
},
|
|
42
48
|
};
|
|
43
49
|
}
|
|
@@ -26,8 +26,8 @@ export const getBestMatch: typeof Utils.getBestMatch;
|
|
|
26
26
|
export const getComponentFromPath: typeof Utils.getComponentFromPath;
|
|
27
27
|
export const getComponentValue: typeof Utils.getComponentValue;
|
|
28
28
|
export const findComponents: typeof Utils.findComponents;
|
|
29
|
-
export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataAsyncCallback | undefined) => Promise<void>;
|
|
30
|
-
export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataCallback | undefined) => void;
|
|
29
|
+
export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataAsyncCallback | undefined, localRoot?: import("@formio/core").LocalRoot | undefined) => Promise<void>;
|
|
30
|
+
export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataCallback | undefined, localRoot?: import("@formio/core").LocalRoot | undefined) => void;
|
|
31
31
|
export const getComponentKey: typeof Utils.getComponentKey;
|
|
32
32
|
export const getContextualRowPath: any;
|
|
33
33
|
export const getContextualRowData: typeof Utils.getContextualRowData;
|
package/lib/cjs/utils/index.d.ts
CHANGED
|
@@ -37,8 +37,8 @@ declare const FormioUtils: {
|
|
|
37
37
|
getComponentFromPath: typeof import("@formio/core/lib/utils/formUtil").getComponentFromPath;
|
|
38
38
|
getComponentValue: typeof import("@formio/core/lib/utils/formUtil").getComponentValue;
|
|
39
39
|
findComponents: typeof import("@formio/core/lib/utils/formUtil").findComponents;
|
|
40
|
-
eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataAsyncCallback | undefined) => Promise<void>;
|
|
41
|
-
eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataCallback | undefined) => void;
|
|
40
|
+
eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataAsyncCallback | undefined, localRoot?: import("@formio/core").LocalRoot | undefined) => Promise<void>;
|
|
41
|
+
eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataCallback | undefined, localRoot?: import("@formio/core").LocalRoot | undefined) => void;
|
|
42
42
|
getComponentKey: typeof import("@formio/core/lib/utils/formUtil").getComponentKey;
|
|
43
43
|
getContextualRowPath: any;
|
|
44
44
|
getContextualRowData: typeof import("@formio/core/lib/utils/formUtil").getContextualRowData;
|
|
@@ -94,7 +94,7 @@ declare const FormioUtils: {
|
|
|
94
94
|
offsetDate(date: Date, timezone: string): Date;
|
|
95
95
|
zonesLoaded(): boolean;
|
|
96
96
|
shouldLoadZones(timezone: string): boolean;
|
|
97
|
-
loadZones(url: string,
|
|
97
|
+
loadZones(url: string, _timezone: any): any;
|
|
98
98
|
momentDate(value: string | Date, format: string, timezone: string, options: object): Date;
|
|
99
99
|
formatDate(timezonesUrl: string, value: string | Date, format: string, timezone: string, flatPickrInputFormat: string): string;
|
|
100
100
|
formatOffset(timezonesUrl: string, formatFn: Function, date: string | Date, format: string, timezone: string): string;
|
package/lib/cjs/utils/utils.d.ts
CHANGED
|
@@ -202,7 +202,7 @@ export function shouldLoadZones(timezone: string): boolean;
|
|
|
202
202
|
* @param {string} timezone - The timezone to load.
|
|
203
203
|
* @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
|
|
204
204
|
*/
|
|
205
|
-
export function loadZones(url: string,
|
|
205
|
+
export function loadZones(url: string, _timezone: any): Promise<any> | any;
|
|
206
206
|
/**
|
|
207
207
|
* Get the moment date object for translating dates with timezones.
|
|
208
208
|
* @param {string|Date} value - The value to convert into a moment date.
|