@formio/js 5.2.3 → 5.2.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 +22 -22
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +24 -24
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +3 -3
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +1 -1
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Element.js +6 -3
- package/lib/cjs/Embed.js +3 -2
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/Webform.js +4 -2
- package/lib/cjs/WebformBuilder.js +8 -4
- package/lib/cjs/Wizard.js +3 -3
- package/lib/cjs/components/_classes/component/Component.js +19 -11
- package/lib/cjs/components/address/Address.js +7 -5
- package/lib/cjs/components/button/Button.js +21 -15
- package/lib/cjs/components/datagrid/DataGrid.js +6 -5
- package/lib/cjs/components/datamap/DataMap.js +4 -2
- package/lib/cjs/components/day/Day.js +2 -1
- package/lib/cjs/components/editgrid/EditGrid.js +10 -8
- package/lib/cjs/components/file/File.js +11 -6
- package/lib/cjs/components/file/editForm/File.edit.file.d.ts +37 -16
- package/lib/cjs/components/file/editForm/File.edit.file.js +78 -25
- package/lib/cjs/components/form/Form.js +10 -4
- package/lib/cjs/components/radio/Radio.js +6 -3
- package/lib/cjs/components/recaptcha/ReCaptcha.js +5 -3
- package/lib/cjs/components/select/Select.js +12 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +5 -2
- package/lib/cjs/components/signature/Signature.js +2 -1
- package/lib/cjs/components/table/Table.js +2 -1
- package/lib/cjs/components/tabs/Tabs.js +2 -1
- package/lib/cjs/package.json +1 -1
- package/lib/mjs/Element.js +3 -3
- package/lib/mjs/Embed.js +2 -2
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/Webform.js +2 -2
- package/lib/mjs/WebformBuilder.js +4 -4
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/components/_classes/component/Component.js +10 -10
- package/lib/mjs/components/address/Address.js +3 -3
- package/lib/mjs/components/button/Button.js +15 -15
- package/lib/mjs/components/datagrid/DataGrid.js +4 -4
- package/lib/mjs/components/datamap/DataMap.js +2 -2
- package/lib/mjs/components/day/Day.js +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +5 -5
- package/lib/mjs/components/file/File.js +6 -6
- package/lib/mjs/components/file/editForm/File.edit.file.d.ts +37 -16
- package/lib/mjs/components/file/editForm/File.edit.file.js +78 -25
- package/lib/mjs/components/form/Form.js +7 -4
- package/lib/mjs/components/radio/Radio.js +3 -3
- package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -3
- package/lib/mjs/components/select/Select.js +12 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +4 -2
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/components/table/Table.js +1 -1
- package/lib/mjs/components/tabs/Tabs.js +1 -1
- package/lib/mjs/package.json +1 -1
- package/package.json +2 -2
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
/*! @license DOMPurify 3.2.6 | (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.6/LICENSE */
|
|
24
24
|
|
|
25
|
-
/*! formiojs v5.2.
|
|
25
|
+
/*! formiojs v5.2.4 | https://unpkg.com/formiojs@5.2.4/LICENSE.txt */
|
|
26
26
|
|
|
27
27
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
28
28
|
|
package/lib/cjs/Element.js
CHANGED
|
@@ -124,11 +124,13 @@ class Element {
|
|
|
124
124
|
* @param {Function | undefined} cb - The callback handler to handle this event.
|
|
125
125
|
*/
|
|
126
126
|
off(event, cb) {
|
|
127
|
+
var _a;
|
|
127
128
|
if (!this.events) {
|
|
128
129
|
return;
|
|
129
130
|
}
|
|
130
131
|
const type = `${this.options.namespace}.${event}`;
|
|
131
|
-
this.events.listeners(type).forEach((listener) => {
|
|
132
|
+
(_a = this.events) === null || _a === void 0 ? void 0 : _a.listeners(type).forEach((listener) => {
|
|
133
|
+
var _a;
|
|
132
134
|
// Ensure the listener is for this element
|
|
133
135
|
if (!listener || listener.id !== this.id) {
|
|
134
136
|
return;
|
|
@@ -137,7 +139,7 @@ class Element {
|
|
|
137
139
|
if (cb && cb !== listener) {
|
|
138
140
|
return;
|
|
139
141
|
}
|
|
140
|
-
this.events.off(type, listener);
|
|
142
|
+
(_a = this.events) === null || _a === void 0 ? void 0 : _a.off(type, listener);
|
|
141
143
|
});
|
|
142
144
|
}
|
|
143
145
|
/**
|
|
@@ -361,6 +363,7 @@ class Element {
|
|
|
361
363
|
* @param {boolean} usePlaceholder - Set the mask placeholder on the input.
|
|
362
364
|
*/
|
|
363
365
|
setInputMask(input, inputMask, usePlaceholder) {
|
|
366
|
+
var _a;
|
|
364
367
|
if (input && inputMask) {
|
|
365
368
|
const mask = utils_1.default.getInputMask(inputMask, this.placeholderChar);
|
|
366
369
|
this.defaultMask = mask;
|
|
@@ -373,7 +376,7 @@ class Element {
|
|
|
373
376
|
inputElement: input,
|
|
374
377
|
mask,
|
|
375
378
|
placeholderChar: this.placeholderChar,
|
|
376
|
-
shadowRoot: this.root ? this.root.shadowRoot : null
|
|
379
|
+
shadowRoot: this.root ? (_a = this.root) === null || _a === void 0 ? void 0 : _a.shadowRoot : null,
|
|
377
380
|
});
|
|
378
381
|
}
|
|
379
382
|
catch (e) {
|
package/lib/cjs/Embed.js
CHANGED
|
@@ -360,12 +360,13 @@ class Formio {
|
|
|
360
360
|
}
|
|
361
361
|
// Called after an instance has been created.
|
|
362
362
|
static afterCreate(instance, wrapper, readyEvent) {
|
|
363
|
+
var _b;
|
|
363
364
|
return __awaiter(this, void 0, void 0, function* () {
|
|
364
365
|
const loader = wrapper.querySelector('.formio-loader');
|
|
365
366
|
if (loader) {
|
|
366
367
|
wrapper.removeChild(loader);
|
|
367
368
|
}
|
|
368
|
-
_a.FormioClass.events.emit(readyEvent, instance);
|
|
369
|
+
(_b = _a.FormioClass.events) === null || _b === void 0 ? void 0 : _b.emit(readyEvent, instance);
|
|
369
370
|
if (_a.config.after) {
|
|
370
371
|
_a.debug('Calling ready callback');
|
|
371
372
|
_a.config.after(instance, _a.config);
|
|
@@ -418,7 +419,7 @@ Formio.formioReady = new Promise((ready, reject) => {
|
|
|
418
419
|
_a._formioReady = ready;
|
|
419
420
|
_a._formioReadyReject = reject;
|
|
420
421
|
});
|
|
421
|
-
Formio.version = '5.2.
|
|
422
|
+
Formio.version = '5.2.4';
|
|
422
423
|
// Create a report.
|
|
423
424
|
Formio.Report = {
|
|
424
425
|
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.2.
|
|
14
|
+
sdk_1.Formio.version = '5.2.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) {
|
package/lib/cjs/Webform.js
CHANGED
|
@@ -719,8 +719,9 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
719
719
|
* @returns {void}
|
|
720
720
|
*/
|
|
721
721
|
onSetSubmission(submission, flags = {}) {
|
|
722
|
+
var _a;
|
|
722
723
|
this.submissionSet = true;
|
|
723
|
-
this.triggerChange(flags);
|
|
724
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this, flags);
|
|
724
725
|
this.emit('beforeSetSubmission', submission);
|
|
725
726
|
this.setValue(submission, flags);
|
|
726
727
|
}
|
|
@@ -1106,6 +1107,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
1106
1107
|
* @returns {void|Array} - The errors that were set.
|
|
1107
1108
|
*/
|
|
1108
1109
|
showErrors(errors, triggerEvent) {
|
|
1110
|
+
var _a;
|
|
1109
1111
|
this.loading = false;
|
|
1110
1112
|
if (!Array.isArray(errors)) {
|
|
1111
1113
|
errors = [errors];
|
|
@@ -1170,7 +1172,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
1170
1172
|
});
|
|
1171
1173
|
}
|
|
1172
1174
|
const errorsList = this.renderTemplate("errorsList", { errors: displayedErrors });
|
|
1173
|
-
this.root.setAlert("danger", errorsList);
|
|
1175
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.setAlert("danger", errorsList);
|
|
1174
1176
|
if (triggerEvent) {
|
|
1175
1177
|
this.emit("error", errors);
|
|
1176
1178
|
}
|
|
@@ -281,6 +281,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
281
281
|
return true;
|
|
282
282
|
}
|
|
283
283
|
addExistingResourceFields(resources) {
|
|
284
|
+
var _a;
|
|
284
285
|
lodash_1.default.each(resources, (resource, index) => {
|
|
285
286
|
const resourceKey = `resource-${resource.name}`;
|
|
286
287
|
const subgroup = {
|
|
@@ -315,7 +316,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
315
316
|
}, true);
|
|
316
317
|
this.groups.resource.subgroups.push(subgroup);
|
|
317
318
|
});
|
|
318
|
-
this.triggerRedraw();
|
|
319
|
+
(_a = this.triggerRedraw) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
319
320
|
}
|
|
320
321
|
attachTooltip(component, title) {
|
|
321
322
|
return (0, tippy_js_1.default)(component, {
|
|
@@ -589,6 +590,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
589
590
|
});
|
|
590
591
|
}
|
|
591
592
|
searchFields(searchString = '') {
|
|
593
|
+
var _a;
|
|
592
594
|
const searchValue = searchString.toLowerCase();
|
|
593
595
|
const sidebar = this.refs['sidebar'];
|
|
594
596
|
const sidebarGroups = this.refs['sidebar-groups'];
|
|
@@ -650,7 +652,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
650
652
|
});
|
|
651
653
|
this.updateDragAndDrop();
|
|
652
654
|
if (searchValue === '') {
|
|
653
|
-
this.triggerRedraw();
|
|
655
|
+
(_a = this.triggerRedraw) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
654
656
|
}
|
|
655
657
|
}
|
|
656
658
|
orderComponents(groupInfo, foundComponents) {
|
|
@@ -1655,19 +1657,21 @@ class WebformBuilder extends Component_1.default {
|
|
|
1655
1657
|
super.destroy(all);
|
|
1656
1658
|
}
|
|
1657
1659
|
addBuilderGroup(name, group) {
|
|
1660
|
+
var _a;
|
|
1658
1661
|
if (!this.groups[name]) {
|
|
1659
1662
|
this.groups[name] = group;
|
|
1660
1663
|
this.groupOrder.push(name);
|
|
1661
|
-
this.triggerRedraw();
|
|
1664
|
+
(_a = this.triggerRedraw) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1662
1665
|
}
|
|
1663
1666
|
else {
|
|
1664
1667
|
this.updateBuilderGroup(name, group);
|
|
1665
1668
|
}
|
|
1666
1669
|
}
|
|
1667
1670
|
updateBuilderGroup(name, group) {
|
|
1671
|
+
var _a;
|
|
1668
1672
|
if (this.groups[name]) {
|
|
1669
1673
|
this.groups[name] = group;
|
|
1670
|
-
this.triggerRedraw();
|
|
1674
|
+
(_a = this.triggerRedraw) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1671
1675
|
}
|
|
1672
1676
|
}
|
|
1673
1677
|
generateKey(info) {
|
package/lib/cjs/Wizard.js
CHANGED
|
@@ -725,13 +725,13 @@ class Wizard extends Webform_1.default {
|
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
727
|
validateCurrentPage(flags = {}) {
|
|
728
|
-
var _a, _b, _c, _d;
|
|
728
|
+
var _a, _b, _c, _d, _e;
|
|
729
729
|
const components = (_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.components.map((component) => component.component);
|
|
730
730
|
// Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
|
|
731
731
|
if ((_b = this.currentPage) === null || _b === void 0 ? void 0 : _b.parent) {
|
|
732
|
-
return (_c = this.currentPage) === null || _c === void 0 ? void 0 : _c.parent.validateComponents(components, this.root.data, flags);
|
|
732
|
+
return (_c = this.currentPage) === null || _c === void 0 ? void 0 : _c.parent.validateComponents(components, (_d = this.root) === null || _d === void 0 ? void 0 : _d.data, flags);
|
|
733
733
|
}
|
|
734
|
-
return (
|
|
734
|
+
return (_e = this.currentPage) === null || _e === void 0 ? void 0 : _e.validateComponents(components, this.root ? this.root.data : this.data, flags);
|
|
735
735
|
}
|
|
736
736
|
emitPrevPage() {
|
|
737
737
|
this.emit('prevPage', { page: this.page, submission: this.submission });
|
|
@@ -1293,11 +1293,11 @@ class Component extends Element_1.default {
|
|
|
1293
1293
|
* Restors the "focus" on a component after a redraw event has occured.
|
|
1294
1294
|
*/
|
|
1295
1295
|
restoreFocus() {
|
|
1296
|
-
var _a, _b, _c;
|
|
1296
|
+
var _a, _b, _c, _d;
|
|
1297
1297
|
const isFocused = ((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.focusedComponent) === null || _b === void 0 ? void 0 : _b.path) === this.path;
|
|
1298
1298
|
if (isFocused) {
|
|
1299
1299
|
this.loadRefs(this.element, { input: 'multiple' });
|
|
1300
|
-
this.focus((_c = this.root
|
|
1300
|
+
this.focus((_d = (_c = this.root) === null || _c === void 0 ? void 0 : _c.currentSelection) === null || _d === void 0 ? void 0 : _d.index);
|
|
1301
1301
|
this.restoreCaretPosition();
|
|
1302
1302
|
}
|
|
1303
1303
|
}
|
|
@@ -1308,6 +1308,7 @@ class Component extends Element_1.default {
|
|
|
1308
1308
|
* @returns {void}
|
|
1309
1309
|
*/
|
|
1310
1310
|
addShortcut(element, shortcut) {
|
|
1311
|
+
var _a;
|
|
1311
1312
|
// Avoid infinite recursion.
|
|
1312
1313
|
if (!element || !this.root || (this.root === this)) {
|
|
1313
1314
|
return;
|
|
@@ -1315,7 +1316,7 @@ class Component extends Element_1.default {
|
|
|
1315
1316
|
if (!shortcut) {
|
|
1316
1317
|
shortcut = this.component.shortcut;
|
|
1317
1318
|
}
|
|
1318
|
-
this.root.addShortcut(element, shortcut);
|
|
1319
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.addShortcut(element, shortcut);
|
|
1319
1320
|
}
|
|
1320
1321
|
/**
|
|
1321
1322
|
* Removes a keyboard shortcut from this component.
|
|
@@ -1324,6 +1325,7 @@ class Component extends Element_1.default {
|
|
|
1324
1325
|
* @returns {void}
|
|
1325
1326
|
*/
|
|
1326
1327
|
removeShortcut(element, shortcut) {
|
|
1328
|
+
var _a;
|
|
1327
1329
|
// Avoid infinite recursion.
|
|
1328
1330
|
if (!element || (this.root === this)) {
|
|
1329
1331
|
return;
|
|
@@ -1331,7 +1333,7 @@ class Component extends Element_1.default {
|
|
|
1331
1333
|
if (!shortcut) {
|
|
1332
1334
|
shortcut = this.component.shortcut;
|
|
1333
1335
|
}
|
|
1334
|
-
this.root.removeShortcut(element, shortcut);
|
|
1336
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.removeShortcut(element, shortcut);
|
|
1335
1337
|
}
|
|
1336
1338
|
/**
|
|
1337
1339
|
* Remove all event handlers.
|
|
@@ -1410,6 +1412,7 @@ class Component extends Element_1.default {
|
|
|
1410
1412
|
* @returns {void}
|
|
1411
1413
|
*/
|
|
1412
1414
|
refresh(value) {
|
|
1415
|
+
var _a;
|
|
1413
1416
|
if (this.hasOwnProperty('refreshOnValue')) {
|
|
1414
1417
|
this.refreshOnChanged = !lodash_1.default.isEqual(value, this.refreshOnValue);
|
|
1415
1418
|
}
|
|
@@ -1421,7 +1424,7 @@ class Component extends Element_1.default {
|
|
|
1421
1424
|
if (this.component.clearOnRefresh) {
|
|
1422
1425
|
this.setValue(null);
|
|
1423
1426
|
}
|
|
1424
|
-
this.triggerRedraw();
|
|
1427
|
+
(_a = this.triggerRedraw) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1425
1428
|
}
|
|
1426
1429
|
}
|
|
1427
1430
|
/**
|
|
@@ -2543,12 +2546,13 @@ class Component extends Element_1.default {
|
|
|
2543
2546
|
* @param {*} flags - The flags to use when splicing the value.
|
|
2544
2547
|
*/
|
|
2545
2548
|
splice(index, flags = {}) {
|
|
2549
|
+
var _a;
|
|
2546
2550
|
if (this.hasValue()) {
|
|
2547
2551
|
const dataValue = this.dataValue || [];
|
|
2548
2552
|
if (lodash_1.default.isArray(dataValue) && dataValue.hasOwnProperty(index)) {
|
|
2549
2553
|
dataValue.splice(index, 1);
|
|
2550
2554
|
this.dataValue = dataValue;
|
|
2551
|
-
this.triggerChange(flags);
|
|
2555
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this, flags);
|
|
2552
2556
|
}
|
|
2553
2557
|
}
|
|
2554
2558
|
}
|
|
@@ -2829,12 +2833,13 @@ class Component extends Element_1.default {
|
|
|
2829
2833
|
* @returns {boolean} - If the value changed.
|
|
2830
2834
|
*/
|
|
2831
2835
|
updateOnChange(flags = {}, changed = false) {
|
|
2836
|
+
var _a;
|
|
2832
2837
|
if (!flags.noUpdateEvent && changed) {
|
|
2833
2838
|
if (flags.fromSubmission) {
|
|
2834
2839
|
// Reset the errors when a submission has been made and allow it to revalidate.
|
|
2835
2840
|
this._errors = [];
|
|
2836
2841
|
}
|
|
2837
|
-
this.triggerChange(flags);
|
|
2842
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this, flags);
|
|
2838
2843
|
return true;
|
|
2839
2844
|
}
|
|
2840
2845
|
return false;
|
|
@@ -2858,6 +2863,7 @@ class Component extends Element_1.default {
|
|
|
2858
2863
|
}
|
|
2859
2864
|
/* eslint-disable max-statements */
|
|
2860
2865
|
calculateComponentValue(data, flags, row) {
|
|
2866
|
+
var _a;
|
|
2861
2867
|
// Skip value calculation for the component if we don't have entire form data set or in builder mode
|
|
2862
2868
|
if (this.builderMode || lodash_1.default.isUndefined(lodash_1.default.get(this, 'root.data'))) {
|
|
2863
2869
|
return false;
|
|
@@ -2935,7 +2941,7 @@ class Component extends Element_1.default {
|
|
|
2935
2941
|
}
|
|
2936
2942
|
this.calculatedValue = (0, utils_2.fastCloneDeep)(calculatedValue);
|
|
2937
2943
|
if (changed) {
|
|
2938
|
-
if (!flags.noPristineChangeOnModified && this.root.initialized) {
|
|
2944
|
+
if (!flags.noPristineChangeOnModified && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.initialized)) {
|
|
2939
2945
|
this.pristine = false;
|
|
2940
2946
|
}
|
|
2941
2947
|
flags.triggeredComponentId = this.id;
|
|
@@ -3261,7 +3267,7 @@ class Component extends Element_1.default {
|
|
|
3261
3267
|
}
|
|
3262
3268
|
addFocusBlurEvents(element) {
|
|
3263
3269
|
this.addEventListener(element, 'focus', () => {
|
|
3264
|
-
if (this.root.focusedComponent !== this) {
|
|
3270
|
+
if (this.root && this.root.focusedComponent !== this) {
|
|
3265
3271
|
if (this.root.pendingBlur) {
|
|
3266
3272
|
this.root.pendingBlur();
|
|
3267
3273
|
}
|
|
@@ -3275,9 +3281,10 @@ class Component extends Element_1.default {
|
|
|
3275
3281
|
});
|
|
3276
3282
|
this.addEventListener(element, 'blur', () => {
|
|
3277
3283
|
this.root.pendingBlur = utils_1.default.delay(() => {
|
|
3284
|
+
var _a, _b;
|
|
3278
3285
|
this.emit('blur', this);
|
|
3279
3286
|
if (this.component.validateOn === 'blur') {
|
|
3280
|
-
this.root.triggerChange({ fromBlur: true }, {
|
|
3287
|
+
(_b = (_a = this.root).triggerChange) === null || _b === void 0 ? void 0 : _b.call(_a, { fromBlur: true }, {
|
|
3281
3288
|
instance: this,
|
|
3282
3289
|
component: this.component,
|
|
3283
3290
|
value: this.dataValue,
|
|
@@ -3361,7 +3368,8 @@ class Component extends Element_1.default {
|
|
|
3361
3368
|
* @returns {boolean|*} - TRUE if the value is hidden.
|
|
3362
3369
|
*/
|
|
3363
3370
|
isValueHidden() {
|
|
3364
|
-
|
|
3371
|
+
var _a;
|
|
3372
|
+
if (this.component.protected && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.editing)) {
|
|
3365
3373
|
return false;
|
|
3366
3374
|
}
|
|
3367
3375
|
if (!this.root || !this.root.hasOwnProperty('editing')) {
|
|
@@ -374,6 +374,7 @@ class AddressComponent extends Container_1.default {
|
|
|
374
374
|
return super.render(this.renderElement());
|
|
375
375
|
}
|
|
376
376
|
onSelectAddress(address, element, index) {
|
|
377
|
+
var _a;
|
|
377
378
|
if (this.isMultiple) {
|
|
378
379
|
this.address[index] = address;
|
|
379
380
|
this.address = [...this.address];
|
|
@@ -381,7 +382,7 @@ class AddressComponent extends Container_1.default {
|
|
|
381
382
|
else {
|
|
382
383
|
this.address = address;
|
|
383
384
|
}
|
|
384
|
-
this.triggerChange({
|
|
385
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
385
386
|
modified: true,
|
|
386
387
|
});
|
|
387
388
|
if (element) {
|
|
@@ -464,6 +465,7 @@ class AddressComponent extends Container_1.default {
|
|
|
464
465
|
});
|
|
465
466
|
if (this.modeSwitcher) {
|
|
466
467
|
this.addEventListener(this.modeSwitcher, 'change', () => {
|
|
468
|
+
var _a;
|
|
467
469
|
if (!this.modeSwitcher) {
|
|
468
470
|
return;
|
|
469
471
|
}
|
|
@@ -475,7 +477,7 @@ class AddressComponent extends Container_1.default {
|
|
|
475
477
|
if (this.manualMode) {
|
|
476
478
|
this.restoreComponentsContext();
|
|
477
479
|
}
|
|
478
|
-
this.triggerChange({
|
|
480
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
479
481
|
modified: true,
|
|
480
482
|
});
|
|
481
483
|
}
|
|
@@ -518,11 +520,11 @@ class AddressComponent extends Container_1.default {
|
|
|
518
520
|
});
|
|
519
521
|
}
|
|
520
522
|
clearAddress(element, index) {
|
|
521
|
-
var _a;
|
|
523
|
+
var _a, _b;
|
|
522
524
|
if (!this.isEmpty()) {
|
|
523
|
-
this.triggerChange();
|
|
525
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
524
526
|
}
|
|
525
|
-
if ((
|
|
527
|
+
if ((_b = this.address) === null || _b === void 0 ? void 0 : _b[index]) {
|
|
526
528
|
this.address[index] = this.emptyValue;
|
|
527
529
|
}
|
|
528
530
|
else {
|
|
@@ -116,6 +116,7 @@ class ButtonComponent extends Field_1.default {
|
|
|
116
116
|
}));
|
|
117
117
|
}
|
|
118
118
|
attachButton() {
|
|
119
|
+
var _a;
|
|
119
120
|
this.addShortcut(this.refs.button);
|
|
120
121
|
let onChange = null;
|
|
121
122
|
let onError = null;
|
|
@@ -210,7 +211,7 @@ class ButtonComponent extends Field_1.default {
|
|
|
210
211
|
}
|
|
211
212
|
}, true);
|
|
212
213
|
if (this.component.saveOnEnter) {
|
|
213
|
-
this.root.addEventListener(this.root.element, 'keyup', (event) => {
|
|
214
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.addEventListener(this.root.element, 'keyup', (event) => {
|
|
214
215
|
if (event.keyCode === 13) {
|
|
215
216
|
this.onClick.call(this, event);
|
|
216
217
|
}
|
|
@@ -269,6 +270,7 @@ class ButtonComponent extends Field_1.default {
|
|
|
269
270
|
super.detach();
|
|
270
271
|
}
|
|
271
272
|
onClick(event) {
|
|
273
|
+
var _a, _b, _c, _d;
|
|
272
274
|
this.triggerCaptcha();
|
|
273
275
|
// Don't click if disabled or in builder mode.
|
|
274
276
|
if (this.disabled || this.options.attachMode === 'builder') {
|
|
@@ -293,7 +295,7 @@ class ButtonComponent extends Field_1.default {
|
|
|
293
295
|
break;
|
|
294
296
|
case 'event':
|
|
295
297
|
this.emit(this.interpolate(this.component.event), this.data);
|
|
296
|
-
this.events.emit(this.interpolate(this.component.event), this.data);
|
|
298
|
+
(_a = this.events) === null || _a === void 0 ? void 0 : _a.emit(this.interpolate(this.component.event), this.data);
|
|
297
299
|
this.emit('customEvent', {
|
|
298
300
|
type: this.interpolate(this.component.event),
|
|
299
301
|
component: this.component,
|
|
@@ -316,7 +318,7 @@ class ButtonComponent extends Field_1.default {
|
|
|
316
318
|
flattened,
|
|
317
319
|
components
|
|
318
320
|
});
|
|
319
|
-
this.triggerChange();
|
|
321
|
+
(_b = this.triggerChange) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
320
322
|
break;
|
|
321
323
|
}
|
|
322
324
|
case 'url':
|
|
@@ -343,12 +345,12 @@ class ButtonComponent extends Field_1.default {
|
|
|
343
345
|
}
|
|
344
346
|
// Display Alert if OAuth config is missing
|
|
345
347
|
if (!this.oauthConfig) {
|
|
346
|
-
this.root.setAlert('danger', 'OAuth not configured. You must configure oauth for your project before it will work.');
|
|
348
|
+
(_c = this.root) === null || _c === void 0 ? void 0 : _c.setAlert('danger', 'OAuth not configured. You must configure oauth for your project before it will work.');
|
|
347
349
|
break;
|
|
348
350
|
}
|
|
349
351
|
// Display Alert if oAuth has an error is missing
|
|
350
352
|
if (this.oauthConfig.error) {
|
|
351
|
-
this.root.setAlert('danger', `The Following Error Has Occured ${this.oauthConfig.error}`);
|
|
353
|
+
(_d = this.root) === null || _d === void 0 ? void 0 : _d.setAlert('danger', `The Following Error Has Occured ${this.oauthConfig.error}`);
|
|
352
354
|
break;
|
|
353
355
|
}
|
|
354
356
|
this.openOauth(this.oauthConfig);
|
|
@@ -356,7 +358,8 @@ class ButtonComponent extends Field_1.default {
|
|
|
356
358
|
}
|
|
357
359
|
}
|
|
358
360
|
openOauth(settings) {
|
|
359
|
-
|
|
361
|
+
var _a;
|
|
362
|
+
if (!((_a = this.root) === null || _a === void 0 ? void 0 : _a.formio)) {
|
|
360
363
|
console.warn('You must attach a Form API url to your form in order to use OAuth buttons.');
|
|
361
364
|
return;
|
|
362
365
|
}
|
|
@@ -388,6 +391,7 @@ class ButtonComponent extends Field_1.default {
|
|
|
388
391
|
const url = `${settings.authURI}${separator}${params}`;
|
|
389
392
|
const popup = window.open(url, settings.provider, 'width=1020,height=618');
|
|
390
393
|
const interval = setInterval(() => {
|
|
394
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
391
395
|
try {
|
|
392
396
|
const popupHost = popup.location.host;
|
|
393
397
|
const currentHost = window.location.host;
|
|
@@ -400,45 +404,47 @@ class ButtonComponent extends Field_1.default {
|
|
|
400
404
|
}, {});
|
|
401
405
|
if (params.error) {
|
|
402
406
|
alert(params.error_description || params.error);
|
|
403
|
-
this.root.setAlert('danger', params.error_description || params.error);
|
|
407
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.setAlert('danger', params.error_description || params.error);
|
|
404
408
|
return;
|
|
405
409
|
}
|
|
406
410
|
// TODO: check for error response here
|
|
407
411
|
if (settings.state !== params.state) {
|
|
408
|
-
this.root.setAlert('danger', 'OAuth state does not match. Please try logging in again.');
|
|
412
|
+
(_b = this.root) === null || _b === void 0 ? void 0 : _b.setAlert('danger', 'OAuth state does not match. Please try logging in again.');
|
|
409
413
|
return;
|
|
410
414
|
}
|
|
411
415
|
// Depending on where the settings came from, submit to either the submission endpoint (old) or oauth endpoint (new).
|
|
412
416
|
let requestPromise = Promise.resolve();
|
|
413
|
-
if (lodash_1.default.has(this, 'root.form.config.oauth') && this.root.form.config.oauth[this.component.oauthProvider]) {
|
|
417
|
+
if (lodash_1.default.has(this, 'root.form.config.oauth') && ((_c = this.root) === null || _c === void 0 ? void 0 : _c.form.config.oauth[this.component.oauthProvider])) {
|
|
414
418
|
params.provider = settings.provider;
|
|
415
419
|
params.redirectURI = originalRedirectUri;
|
|
416
420
|
// Needs for the exclude oAuth Actions that not related to this button
|
|
417
421
|
params.triggeredBy = this.oauthComponentPath;
|
|
418
|
-
requestPromise = this.root.formio.makeRequest('oauth', `${this.root.formio.projectUrl}/oauth2`, 'POST', params);
|
|
422
|
+
requestPromise = (_d = this.root) === null || _d === void 0 ? void 0 : _d.formio.makeRequest('oauth', `${(_e = this.root) === null || _e === void 0 ? void 0 : _e.formio.projectUrl}/oauth2`, 'POST', params);
|
|
419
423
|
}
|
|
420
424
|
else {
|
|
421
425
|
const submission = { data: {}, oauth: {} };
|
|
422
426
|
submission.oauth[settings.provider] = params;
|
|
423
427
|
submission.oauth[settings.provider].redirectURI = originalRedirectUri;
|
|
424
428
|
if (settings.logoutURI) {
|
|
425
|
-
this.root.formio.oauthLogoutURI(settings.logoutURI);
|
|
429
|
+
(_f = this.root) === null || _f === void 0 ? void 0 : _f.formio.oauthLogoutURI(settings.logoutURI);
|
|
426
430
|
}
|
|
427
431
|
// Needs for the exclude oAuth Actions that not related to this button
|
|
428
432
|
submission.oauth[settings.provider].triggeredBy = this.oauthComponentPath;
|
|
429
|
-
requestPromise = this.root.formio.saveSubmission(submission);
|
|
433
|
+
requestPromise = (_g = this.root) === null || _g === void 0 ? void 0 : _g.formio.saveSubmission(submission);
|
|
430
434
|
}
|
|
431
435
|
requestPromise.then((result) => {
|
|
432
|
-
|
|
436
|
+
var _a;
|
|
437
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.onSubmit(result, true);
|
|
433
438
|
})
|
|
434
439
|
.catch((err) => {
|
|
435
|
-
|
|
440
|
+
var _a;
|
|
441
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.onSubmissionError(err);
|
|
436
442
|
});
|
|
437
443
|
}
|
|
438
444
|
}
|
|
439
445
|
catch (error) {
|
|
440
446
|
if (error.name !== 'SecurityError' && (error.name !== 'Error' || error.message !== 'Permission denied')) {
|
|
441
|
-
this.root.setAlert('danger', error.message || error);
|
|
447
|
+
(_h = this.root) === null || _h === void 0 ? void 0 : _h.setAlert('danger', error.message || error);
|
|
442
448
|
}
|
|
443
449
|
}
|
|
444
450
|
if (!popup || popup.closed || popup.closed === undefined) {
|
|
@@ -375,6 +375,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
375
375
|
});
|
|
376
376
|
}
|
|
377
377
|
addRow() {
|
|
378
|
+
var _a;
|
|
378
379
|
const index = this.rows.length;
|
|
379
380
|
// Handle length mismatch between rows and dataValue
|
|
380
381
|
if (this.dataValue.length === index) {
|
|
@@ -396,7 +397,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
396
397
|
row
|
|
397
398
|
});
|
|
398
399
|
this.checkConditions();
|
|
399
|
-
this.triggerChange({ modified: true });
|
|
400
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this, { modified: true });
|
|
400
401
|
this.redraw().then(() => {
|
|
401
402
|
this.focusOnNewRowElement(this.rows[index]);
|
|
402
403
|
});
|
|
@@ -477,17 +478,17 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
477
478
|
options.row = `${rowIndex}-${colIndex}`;
|
|
478
479
|
options.rowIndex = rowIndex;
|
|
479
480
|
options.onChange = (flags, changed, modified) => {
|
|
480
|
-
var _a, _b;
|
|
481
|
+
var _a, _b, _c, _d, _e;
|
|
481
482
|
if (changed.component.type === 'form') {
|
|
482
483
|
const formComp = (0, utils_1.getComponent)(this.component.components, changed.component.key);
|
|
483
484
|
lodash_1.default.set(formComp, 'components', changed.component.components);
|
|
484
485
|
}
|
|
485
486
|
// If we're in a nested form we need to ensure our changes are triggered upstream
|
|
486
|
-
if (((_a = changed.instance.root) === null || _a === void 0 ? void 0 : _a.id) && ((
|
|
487
|
-
changed.instance.root.triggerChange(flags, changed, modified);
|
|
487
|
+
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) {
|
|
488
|
+
(_d = (_c = changed.instance.root).triggerChange) === null || _d === void 0 ? void 0 : _d.call(_c, flags, changed, modified);
|
|
488
489
|
}
|
|
489
490
|
else {
|
|
490
|
-
this.triggerChange({ modified });
|
|
491
|
+
(_e = this.triggerChange) === null || _e === void 0 ? void 0 : _e.call(this, { modified });
|
|
491
492
|
}
|
|
492
493
|
};
|
|
493
494
|
let columnComponent;
|
|
@@ -263,19 +263,21 @@ class DataMapComponent extends DataGrid_1.default {
|
|
|
263
263
|
this.component.valueComponent = defaultSchema.valueComponent;
|
|
264
264
|
}
|
|
265
265
|
addRow() {
|
|
266
|
+
var _a;
|
|
266
267
|
const index = this.rows.length;
|
|
267
268
|
this.rows[index] = this.createRowComponents(this.dataValue, index);
|
|
268
269
|
this.redraw();
|
|
269
|
-
this.triggerChange();
|
|
270
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
270
271
|
}
|
|
271
272
|
removeRow(index) {
|
|
273
|
+
var _a;
|
|
272
274
|
const keys = Object.keys(this.dataValue);
|
|
273
275
|
if (keys[index]) {
|
|
274
276
|
delete this.dataValue[keys[index]];
|
|
275
277
|
}
|
|
276
278
|
this.rows.splice(index, 1);
|
|
277
279
|
this.redraw();
|
|
278
|
-
this.triggerChange();
|
|
280
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
279
281
|
}
|
|
280
282
|
setValue(value, flags = {}) {
|
|
281
283
|
const changed = this.hasChanged(value, this.dataValue);
|
|
@@ -485,6 +485,7 @@ class DayComponent extends Field_1.default {
|
|
|
485
485
|
* @returns {null|string} - The date string.
|
|
486
486
|
*/
|
|
487
487
|
getDate(value) {
|
|
488
|
+
var _a;
|
|
488
489
|
let defaults = [], day, month, year;
|
|
489
490
|
// Map positions to identifiers to get default values for each part of day
|
|
490
491
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
@@ -523,7 +524,7 @@ class DayComponent extends Field_1.default {
|
|
|
523
524
|
if (!isModalEditClosed) {
|
|
524
525
|
this.dataValue = this.emptyValue;
|
|
525
526
|
if (this.options.building) {
|
|
526
|
-
this.triggerChange();
|
|
527
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
527
528
|
}
|
|
528
529
|
}
|
|
529
530
|
return null;
|