@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
|
@@ -118,6 +118,7 @@ class TableComponent extends NestedComponent_1.default {
|
|
|
118
118
|
lodash_1.default.each(this.component.rows, (row, rowIndex) => {
|
|
119
119
|
this.table[rowIndex] = [];
|
|
120
120
|
lodash_1.default.each(row, (column, colIndex) => {
|
|
121
|
+
var _a;
|
|
121
122
|
this.table[rowIndex][colIndex] = [];
|
|
122
123
|
if (this.component.cloneRows) {
|
|
123
124
|
if (column.components.length) {
|
|
@@ -125,7 +126,7 @@ class TableComponent extends NestedComponent_1.default {
|
|
|
125
126
|
}
|
|
126
127
|
else if (lastNonEmptyRow[colIndex]) {
|
|
127
128
|
column.components = lodash_1.default.cloneDeep(lastNonEmptyRow[colIndex].components);
|
|
128
|
-
builder_1.default.uniquify(this.root._form.components, column);
|
|
129
|
+
builder_1.default.uniquify((_a = this.root) === null || _a === void 0 ? void 0 : _a._form.components, column);
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
lodash_1.default.each(column.components, (comp) => {
|
|
@@ -115,6 +115,7 @@ class TabsComponent extends NestedComponent_1.default {
|
|
|
115
115
|
* @param {number} index - The index of the tab to set.
|
|
116
116
|
*/
|
|
117
117
|
setTab(index) {
|
|
118
|
+
var _a;
|
|
118
119
|
if (!this.tabs || !this.tabs[index] || !this.refs[this.tabKey] || !this.refs[this.tabKey][index]) {
|
|
119
120
|
return;
|
|
120
121
|
}
|
|
@@ -144,7 +145,7 @@ class TabsComponent extends NestedComponent_1.default {
|
|
|
144
145
|
this.addClass(this.refs[this.tabLinkKey][index], 'formio-tab-link-active');
|
|
145
146
|
}
|
|
146
147
|
this.setValue(this.data);
|
|
147
|
-
this.triggerChange();
|
|
148
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
148
149
|
}
|
|
149
150
|
beforeFocus(component) {
|
|
150
151
|
if ('beforeFocus' in this.parent) {
|
package/lib/cjs/package.json
CHANGED
package/lib/mjs/Element.js
CHANGED
|
@@ -122,7 +122,7 @@ export default class Element {
|
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
const type = `${this.options.namespace}.${event}`;
|
|
125
|
-
this.events
|
|
125
|
+
this.events?.listeners(type).forEach((listener) => {
|
|
126
126
|
// Ensure the listener is for this element
|
|
127
127
|
if (!listener || listener.id !== this.id) {
|
|
128
128
|
return;
|
|
@@ -131,7 +131,7 @@ export default class Element {
|
|
|
131
131
|
if (cb && cb !== listener) {
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
|
-
this.events
|
|
134
|
+
this.events?.off(type, listener);
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
@@ -366,7 +366,7 @@ export default class Element {
|
|
|
366
366
|
inputElement: input,
|
|
367
367
|
mask,
|
|
368
368
|
placeholderChar: this.placeholderChar,
|
|
369
|
-
shadowRoot: this.root ? this.root
|
|
369
|
+
shadowRoot: this.root ? this.root?.shadowRoot : null,
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
catch (e) {
|
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.2.
|
|
17
|
+
static version = '5.2.4';
|
|
18
18
|
static setLicense(license, norecurse = false) {
|
|
19
19
|
Formio.license = license;
|
|
20
20
|
if (!norecurse && Formio.FormioClass) {
|
|
@@ -351,7 +351,7 @@ export class Formio {
|
|
|
351
351
|
if (loader) {
|
|
352
352
|
wrapper.removeChild(loader);
|
|
353
353
|
}
|
|
354
|
-
Formio.FormioClass.events
|
|
354
|
+
Formio.FormioClass.events?.emit(readyEvent, instance);
|
|
355
355
|
if (Formio.config.after) {
|
|
356
356
|
Formio.debug('Calling ready callback');
|
|
357
357
|
Formio.config.after(instance, Formio.config);
|
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.2.
|
|
7
|
+
FormioCore.version = '5.2.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) {
|
package/lib/mjs/Webform.js
CHANGED
|
@@ -718,7 +718,7 @@ export default class Webform extends NestedDataComponent {
|
|
|
718
718
|
*/
|
|
719
719
|
onSetSubmission(submission, flags = {}) {
|
|
720
720
|
this.submissionSet = true;
|
|
721
|
-
this.triggerChange(flags);
|
|
721
|
+
this.triggerChange?.(flags);
|
|
722
722
|
this.emit('beforeSetSubmission', submission);
|
|
723
723
|
this.setValue(submission, flags);
|
|
724
724
|
}
|
|
@@ -1171,7 +1171,7 @@ export default class Webform extends NestedDataComponent {
|
|
|
1171
1171
|
});
|
|
1172
1172
|
}
|
|
1173
1173
|
const errorsList = this.renderTemplate("errorsList", { errors: displayedErrors });
|
|
1174
|
-
this.root
|
|
1174
|
+
this.root?.setAlert("danger", errorsList);
|
|
1175
1175
|
if (triggerEvent) {
|
|
1176
1176
|
this.emit("error", errors);
|
|
1177
1177
|
}
|
|
@@ -301,7 +301,7 @@ export default class WebformBuilder extends Component {
|
|
|
301
301
|
}, true);
|
|
302
302
|
this.groups.resource.subgroups.push(subgroup);
|
|
303
303
|
});
|
|
304
|
-
this.triggerRedraw();
|
|
304
|
+
this.triggerRedraw?.();
|
|
305
305
|
}
|
|
306
306
|
attachTooltip(component, title) {
|
|
307
307
|
return tippy(component, {
|
|
@@ -636,7 +636,7 @@ export default class WebformBuilder extends Component {
|
|
|
636
636
|
});
|
|
637
637
|
this.updateDragAndDrop();
|
|
638
638
|
if (searchValue === '') {
|
|
639
|
-
this.triggerRedraw();
|
|
639
|
+
this.triggerRedraw?.();
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
orderComponents(groupInfo, foundComponents) {
|
|
@@ -1659,7 +1659,7 @@ export default class WebformBuilder extends Component {
|
|
|
1659
1659
|
if (!this.groups[name]) {
|
|
1660
1660
|
this.groups[name] = group;
|
|
1661
1661
|
this.groupOrder.push(name);
|
|
1662
|
-
this.triggerRedraw();
|
|
1662
|
+
this.triggerRedraw?.();
|
|
1663
1663
|
}
|
|
1664
1664
|
else {
|
|
1665
1665
|
this.updateBuilderGroup(name, group);
|
|
@@ -1668,7 +1668,7 @@ export default class WebformBuilder extends Component {
|
|
|
1668
1668
|
updateBuilderGroup(name, group) {
|
|
1669
1669
|
if (this.groups[name]) {
|
|
1670
1670
|
this.groups[name] = group;
|
|
1671
|
-
this.triggerRedraw();
|
|
1671
|
+
this.triggerRedraw?.();
|
|
1672
1672
|
}
|
|
1673
1673
|
}
|
|
1674
1674
|
generateKey(info) {
|
package/lib/mjs/Wizard.js
CHANGED
|
@@ -718,7 +718,7 @@ export default class Wizard extends Webform {
|
|
|
718
718
|
const components = this.currentPage?.components.map((component) => component.component);
|
|
719
719
|
// Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
|
|
720
720
|
if (this.currentPage?.parent) {
|
|
721
|
-
return this.currentPage?.parent.validateComponents(components, this.root
|
|
721
|
+
return this.currentPage?.parent.validateComponents(components, this.root?.data, flags);
|
|
722
722
|
}
|
|
723
723
|
return this.currentPage?.validateComponents(components, this.root ? this.root.data : this.data, flags);
|
|
724
724
|
}
|
|
@@ -1297,7 +1297,7 @@ export default class Component extends Element {
|
|
|
1297
1297
|
const isFocused = this.root?.focusedComponent?.path === this.path;
|
|
1298
1298
|
if (isFocused) {
|
|
1299
1299
|
this.loadRefs(this.element, { input: 'multiple' });
|
|
1300
|
-
this.focus(this.root
|
|
1300
|
+
this.focus(this.root?.currentSelection?.index);
|
|
1301
1301
|
this.restoreCaretPosition();
|
|
1302
1302
|
}
|
|
1303
1303
|
}
|
|
@@ -1315,7 +1315,7 @@ export default class Component extends Element {
|
|
|
1315
1315
|
if (!shortcut) {
|
|
1316
1316
|
shortcut = this.component.shortcut;
|
|
1317
1317
|
}
|
|
1318
|
-
this.root
|
|
1318
|
+
this.root?.addShortcut(element, shortcut);
|
|
1319
1319
|
}
|
|
1320
1320
|
/**
|
|
1321
1321
|
* Removes a keyboard shortcut from this component.
|
|
@@ -1331,7 +1331,7 @@ export default class Component extends Element {
|
|
|
1331
1331
|
if (!shortcut) {
|
|
1332
1332
|
shortcut = this.component.shortcut;
|
|
1333
1333
|
}
|
|
1334
|
-
this.root
|
|
1334
|
+
this.root?.removeShortcut(element, shortcut);
|
|
1335
1335
|
}
|
|
1336
1336
|
/**
|
|
1337
1337
|
* Remove all event handlers.
|
|
@@ -1420,7 +1420,7 @@ export default class Component extends Element {
|
|
|
1420
1420
|
if (this.component.clearOnRefresh) {
|
|
1421
1421
|
this.setValue(null);
|
|
1422
1422
|
}
|
|
1423
|
-
this.triggerRedraw();
|
|
1423
|
+
this.triggerRedraw?.();
|
|
1424
1424
|
}
|
|
1425
1425
|
}
|
|
1426
1426
|
/**
|
|
@@ -2551,7 +2551,7 @@ export default class Component extends Element {
|
|
|
2551
2551
|
if (_.isArray(dataValue) && dataValue.hasOwnProperty(index)) {
|
|
2552
2552
|
dataValue.splice(index, 1);
|
|
2553
2553
|
this.dataValue = dataValue;
|
|
2554
|
-
this.triggerChange(flags);
|
|
2554
|
+
this.triggerChange?.(flags);
|
|
2555
2555
|
}
|
|
2556
2556
|
}
|
|
2557
2557
|
}
|
|
@@ -2837,7 +2837,7 @@ export default class Component extends Element {
|
|
|
2837
2837
|
// Reset the errors when a submission has been made and allow it to revalidate.
|
|
2838
2838
|
this._errors = [];
|
|
2839
2839
|
}
|
|
2840
|
-
this.triggerChange(flags);
|
|
2840
|
+
this.triggerChange?.(flags);
|
|
2841
2841
|
return true;
|
|
2842
2842
|
}
|
|
2843
2843
|
return false;
|
|
@@ -2937,7 +2937,7 @@ export default class Component extends Element {
|
|
|
2937
2937
|
}
|
|
2938
2938
|
this.calculatedValue = fastCloneDeep(calculatedValue);
|
|
2939
2939
|
if (changed) {
|
|
2940
|
-
if (!flags.noPristineChangeOnModified && this.root
|
|
2940
|
+
if (!flags.noPristineChangeOnModified && this.root?.initialized) {
|
|
2941
2941
|
this.pristine = false;
|
|
2942
2942
|
}
|
|
2943
2943
|
flags.triggeredComponentId = this.id;
|
|
@@ -3260,7 +3260,7 @@ export default class Component extends Element {
|
|
|
3260
3260
|
}
|
|
3261
3261
|
addFocusBlurEvents(element) {
|
|
3262
3262
|
this.addEventListener(element, 'focus', () => {
|
|
3263
|
-
if (this.root.focusedComponent !== this) {
|
|
3263
|
+
if (this.root && this.root.focusedComponent !== this) {
|
|
3264
3264
|
if (this.root.pendingBlur) {
|
|
3265
3265
|
this.root.pendingBlur();
|
|
3266
3266
|
}
|
|
@@ -3276,7 +3276,7 @@ export default class Component extends Element {
|
|
|
3276
3276
|
this.root.pendingBlur = FormioUtils.delay(() => {
|
|
3277
3277
|
this.emit('blur', this);
|
|
3278
3278
|
if (this.component.validateOn === 'blur') {
|
|
3279
|
-
this.root.triggerChange({ fromBlur: true }, {
|
|
3279
|
+
this.root.triggerChange?.({ fromBlur: true }, {
|
|
3280
3280
|
instance: this,
|
|
3281
3281
|
component: this.component,
|
|
3282
3282
|
value: this.dataValue,
|
|
@@ -3358,7 +3358,7 @@ export default class Component extends Element {
|
|
|
3358
3358
|
* @returns {boolean|*} - TRUE if the value is hidden.
|
|
3359
3359
|
*/
|
|
3360
3360
|
isValueHidden() {
|
|
3361
|
-
if (this.component.protected && this.root
|
|
3361
|
+
if (this.component.protected && this.root?.editing) {
|
|
3362
3362
|
return false;
|
|
3363
3363
|
}
|
|
3364
3364
|
if (!this.root || !this.root.hasOwnProperty('editing')) {
|
|
@@ -377,7 +377,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
377
377
|
else {
|
|
378
378
|
this.address = address;
|
|
379
379
|
}
|
|
380
|
-
this.triggerChange({
|
|
380
|
+
this.triggerChange?.({
|
|
381
381
|
modified: true,
|
|
382
382
|
});
|
|
383
383
|
if (element) {
|
|
@@ -471,7 +471,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
471
471
|
if (this.manualMode) {
|
|
472
472
|
this.restoreComponentsContext();
|
|
473
473
|
}
|
|
474
|
-
this.triggerChange({
|
|
474
|
+
this.triggerChange?.({
|
|
475
475
|
modified: true,
|
|
476
476
|
});
|
|
477
477
|
}
|
|
@@ -514,7 +514,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
514
514
|
}
|
|
515
515
|
clearAddress(element, index) {
|
|
516
516
|
if (!this.isEmpty()) {
|
|
517
|
-
this.triggerChange();
|
|
517
|
+
this.triggerChange?.();
|
|
518
518
|
}
|
|
519
519
|
if (this.address?.[index]) {
|
|
520
520
|
this.address[index] = this.emptyValue;
|
|
@@ -205,7 +205,7 @@ export default class ButtonComponent extends Field {
|
|
|
205
205
|
}
|
|
206
206
|
}, true);
|
|
207
207
|
if (this.component.saveOnEnter) {
|
|
208
|
-
this.root
|
|
208
|
+
this.root?.addEventListener(this.root.element, 'keyup', (event) => {
|
|
209
209
|
if (event.keyCode === 13) {
|
|
210
210
|
this.onClick.call(this, event);
|
|
211
211
|
}
|
|
@@ -288,7 +288,7 @@ export default class ButtonComponent extends Field {
|
|
|
288
288
|
break;
|
|
289
289
|
case 'event':
|
|
290
290
|
this.emit(this.interpolate(this.component.event), this.data);
|
|
291
|
-
this.events
|
|
291
|
+
this.events?.emit(this.interpolate(this.component.event), this.data);
|
|
292
292
|
this.emit('customEvent', {
|
|
293
293
|
type: this.interpolate(this.component.event),
|
|
294
294
|
component: this.component,
|
|
@@ -311,7 +311,7 @@ export default class ButtonComponent extends Field {
|
|
|
311
311
|
flattened,
|
|
312
312
|
components
|
|
313
313
|
});
|
|
314
|
-
this.triggerChange();
|
|
314
|
+
this.triggerChange?.();
|
|
315
315
|
break;
|
|
316
316
|
}
|
|
317
317
|
case 'url':
|
|
@@ -338,12 +338,12 @@ export default class ButtonComponent extends Field {
|
|
|
338
338
|
}
|
|
339
339
|
// Display Alert if OAuth config is missing
|
|
340
340
|
if (!this.oauthConfig) {
|
|
341
|
-
this.root
|
|
341
|
+
this.root?.setAlert('danger', 'OAuth not configured. You must configure oauth for your project before it will work.');
|
|
342
342
|
break;
|
|
343
343
|
}
|
|
344
344
|
// Display Alert if oAuth has an error is missing
|
|
345
345
|
if (this.oauthConfig.error) {
|
|
346
|
-
this.root
|
|
346
|
+
this.root?.setAlert('danger', `The Following Error Has Occured ${this.oauthConfig.error}`);
|
|
347
347
|
break;
|
|
348
348
|
}
|
|
349
349
|
this.openOauth(this.oauthConfig);
|
|
@@ -351,7 +351,7 @@ export default class ButtonComponent extends Field {
|
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
openOauth(settings) {
|
|
354
|
-
if (!this.root
|
|
354
|
+
if (!this.root?.formio) {
|
|
355
355
|
console.warn('You must attach a Form API url to your form in order to use OAuth buttons.');
|
|
356
356
|
return;
|
|
357
357
|
}
|
|
@@ -395,45 +395,45 @@ export default class ButtonComponent extends Field {
|
|
|
395
395
|
}, {});
|
|
396
396
|
if (params.error) {
|
|
397
397
|
alert(params.error_description || params.error);
|
|
398
|
-
this.root
|
|
398
|
+
this.root?.setAlert('danger', params.error_description || params.error);
|
|
399
399
|
return;
|
|
400
400
|
}
|
|
401
401
|
// TODO: check for error response here
|
|
402
402
|
if (settings.state !== params.state) {
|
|
403
|
-
this.root
|
|
403
|
+
this.root?.setAlert('danger', 'OAuth state does not match. Please try logging in again.');
|
|
404
404
|
return;
|
|
405
405
|
}
|
|
406
406
|
// Depending on where the settings came from, submit to either the submission endpoint (old) or oauth endpoint (new).
|
|
407
407
|
let requestPromise = Promise.resolve();
|
|
408
|
-
if (_.has(this, 'root.form.config.oauth') && this.root
|
|
408
|
+
if (_.has(this, 'root.form.config.oauth') && this.root?.form.config.oauth[this.component.oauthProvider]) {
|
|
409
409
|
params.provider = settings.provider;
|
|
410
410
|
params.redirectURI = originalRedirectUri;
|
|
411
411
|
// Needs for the exclude oAuth Actions that not related to this button
|
|
412
412
|
params.triggeredBy = this.oauthComponentPath;
|
|
413
|
-
requestPromise = this.root
|
|
413
|
+
requestPromise = this.root?.formio.makeRequest('oauth', `${this.root?.formio.projectUrl}/oauth2`, 'POST', params);
|
|
414
414
|
}
|
|
415
415
|
else {
|
|
416
416
|
const submission = { data: {}, oauth: {} };
|
|
417
417
|
submission.oauth[settings.provider] = params;
|
|
418
418
|
submission.oauth[settings.provider].redirectURI = originalRedirectUri;
|
|
419
419
|
if (settings.logoutURI) {
|
|
420
|
-
this.root
|
|
420
|
+
this.root?.formio.oauthLogoutURI(settings.logoutURI);
|
|
421
421
|
}
|
|
422
422
|
// Needs for the exclude oAuth Actions that not related to this button
|
|
423
423
|
submission.oauth[settings.provider].triggeredBy = this.oauthComponentPath;
|
|
424
|
-
requestPromise = this.root
|
|
424
|
+
requestPromise = this.root?.formio.saveSubmission(submission);
|
|
425
425
|
}
|
|
426
426
|
requestPromise.then((result) => {
|
|
427
|
-
this.root
|
|
427
|
+
this.root?.onSubmit(result, true);
|
|
428
428
|
})
|
|
429
429
|
.catch((err) => {
|
|
430
|
-
this.root
|
|
430
|
+
this.root?.onSubmissionError(err);
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
catch (error) {
|
|
435
435
|
if (error.name !== 'SecurityError' && (error.name !== 'Error' || error.message !== 'Permission denied')) {
|
|
436
|
-
this.root
|
|
436
|
+
this.root?.setAlert('danger', error.message || error);
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
439
|
if (!popup || popup.closed || popup.closed === undefined) {
|
|
@@ -393,7 +393,7 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
393
393
|
row
|
|
394
394
|
});
|
|
395
395
|
this.checkConditions();
|
|
396
|
-
this.triggerChange({ modified: true });
|
|
396
|
+
this.triggerChange?.({ modified: true });
|
|
397
397
|
this.redraw().then(() => {
|
|
398
398
|
this.focusOnNewRowElement(this.rows[index]);
|
|
399
399
|
});
|
|
@@ -478,11 +478,11 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
478
478
|
_.set(formComp, 'components', changed.component.components);
|
|
479
479
|
}
|
|
480
480
|
// If we're in a nested form we need to ensure our changes are triggered upstream
|
|
481
|
-
if (changed.instance.root?.id &&
|
|
482
|
-
changed.instance.root.triggerChange(flags, changed, modified);
|
|
481
|
+
if (changed.instance.root?.id && this.root?.id !== changed.instance.root.id) {
|
|
482
|
+
changed.instance.root.triggerChange?.(flags, changed, modified);
|
|
483
483
|
}
|
|
484
484
|
else {
|
|
485
|
-
this.triggerChange({ modified });
|
|
485
|
+
this.triggerChange?.({ modified });
|
|
486
486
|
}
|
|
487
487
|
};
|
|
488
488
|
let columnComponent;
|
|
@@ -261,7 +261,7 @@ export default class DataMapComponent extends DataGridComponent {
|
|
|
261
261
|
const index = this.rows.length;
|
|
262
262
|
this.rows[index] = this.createRowComponents(this.dataValue, index);
|
|
263
263
|
this.redraw();
|
|
264
|
-
this.triggerChange();
|
|
264
|
+
this.triggerChange?.();
|
|
265
265
|
}
|
|
266
266
|
removeRow(index) {
|
|
267
267
|
const keys = Object.keys(this.dataValue);
|
|
@@ -270,7 +270,7 @@ export default class DataMapComponent extends DataGridComponent {
|
|
|
270
270
|
}
|
|
271
271
|
this.rows.splice(index, 1);
|
|
272
272
|
this.redraw();
|
|
273
|
-
this.triggerChange();
|
|
273
|
+
this.triggerChange?.();
|
|
274
274
|
}
|
|
275
275
|
setValue(value, flags = {}) {
|
|
276
276
|
const changed = this.hasChanged(value, this.dataValue);
|
|
@@ -596,7 +596,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
596
596
|
this.emptyRow = fastCloneDeep(editRow.data);
|
|
597
597
|
}
|
|
598
598
|
if (this.inlineEditMode) {
|
|
599
|
-
this.triggerChange();
|
|
599
|
+
this.triggerChange?.();
|
|
600
600
|
}
|
|
601
601
|
this.emit('editGridAddRow', {
|
|
602
602
|
component: this.component,
|
|
@@ -827,7 +827,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
827
827
|
row: editRow.data,
|
|
828
828
|
instance: this
|
|
829
829
|
});
|
|
830
|
-
this.triggerChange({ modified, noPristineChangeOnModified: modified && this.component.rowDrafts, isolateRow: true });
|
|
830
|
+
this.triggerChange?.({ modified, noPristineChangeOnModified: modified && this.component.rowDrafts, isolateRow: true });
|
|
831
831
|
if (this.component.rowDrafts) {
|
|
832
832
|
editRow.components.forEach(comp => comp.setPristine(this.pristine));
|
|
833
833
|
}
|
|
@@ -887,7 +887,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
887
887
|
this.openWhenEmpty();
|
|
888
888
|
this.updateRowsComponents(rowIndex);
|
|
889
889
|
this.updateValue();
|
|
890
|
-
this.triggerChange({ modified, noPristineChangeOnModified: modified && this.component.rowDrafts, isolateRow: true });
|
|
890
|
+
this.triggerChange?.({ modified, noPristineChangeOnModified: modified && this.component.rowDrafts, isolateRow: true });
|
|
891
891
|
this.checkValidity(null, true);
|
|
892
892
|
this.checkData();
|
|
893
893
|
this.redraw();
|
|
@@ -919,7 +919,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
919
919
|
options.rowIndex = rowIndex;
|
|
920
920
|
options.onChange = (flags = {}, changed, modified) => {
|
|
921
921
|
if (changed.instance.root?.id && (this.root?.id !== changed.instance.root.id)) {
|
|
922
|
-
changed.instance.root
|
|
922
|
+
changed.instance.root?.triggerChange?.(flags, changed, modified);
|
|
923
923
|
}
|
|
924
924
|
else if (!this.component.modal) {
|
|
925
925
|
this.triggerRootChange(flags, changed, modified);
|
|
@@ -1097,7 +1097,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
1097
1097
|
if (allRowErrors.length && this.root?.submitted && !message) {
|
|
1098
1098
|
this._errors = this.setCustomValidity(message, dirty);
|
|
1099
1099
|
errors.push(...this._errors);
|
|
1100
|
-
this.root
|
|
1100
|
+
this.root?.showErrors([message]);
|
|
1101
1101
|
}
|
|
1102
1102
|
else {
|
|
1103
1103
|
this._errors = this.setCustomValidity(message, dirty);
|
|
@@ -403,7 +403,7 @@ export default class FileComponent extends Field {
|
|
|
403
403
|
delete fileInfo.message;
|
|
404
404
|
this.filesToSync.filesToDelete.splice(index, 1);
|
|
405
405
|
this.dataValue.push(fileInfo);
|
|
406
|
-
this.triggerChange();
|
|
406
|
+
this.triggerChange?.();
|
|
407
407
|
this.redraw();
|
|
408
408
|
});
|
|
409
409
|
});
|
|
@@ -637,7 +637,7 @@ export default class FileComponent extends Field {
|
|
|
637
637
|
};
|
|
638
638
|
}
|
|
639
639
|
async handleSubmissionRevisions(file) {
|
|
640
|
-
if (this.root
|
|
640
|
+
if (this.root?.form.submissionRevisions !== 'true') {
|
|
641
641
|
return '';
|
|
642
642
|
}
|
|
643
643
|
const bmf = new BMF();
|
|
@@ -719,7 +719,7 @@ export default class FileComponent extends Field {
|
|
|
719
719
|
let groupKey = null;
|
|
720
720
|
let groupPermissions = null;
|
|
721
721
|
//Iterate through form components to find group resource if one exists
|
|
722
|
-
this.root
|
|
722
|
+
this.root?.everyComponent((element) => {
|
|
723
723
|
if (element.component?.submissionAccess || element.component?.defaultPermission) {
|
|
724
724
|
groupPermissions = !element.component.submissionAccess ? [
|
|
725
725
|
{
|
|
@@ -736,12 +736,12 @@ export default class FileComponent extends Field {
|
|
|
736
736
|
}
|
|
737
737
|
async triggerFileProcessor(file) {
|
|
738
738
|
let processedFile = null;
|
|
739
|
-
if (this.root
|
|
739
|
+
if (this.root?.options.fileProcessor) {
|
|
740
740
|
try {
|
|
741
741
|
if (this.refs.fileProcessingLoader) {
|
|
742
742
|
this.refs.fileProcessingLoader.style.display = 'block';
|
|
743
743
|
}
|
|
744
|
-
const fileProcessorHandler = fileProcessor(this.fileService, this.root
|
|
744
|
+
const fileProcessorHandler = fileProcessor(this.fileService, this.root?.options.fileProcessor);
|
|
745
745
|
processedFile = await fileProcessorHandler(file, this.component.properties);
|
|
746
746
|
}
|
|
747
747
|
catch (err) {
|
|
@@ -977,7 +977,7 @@ export default class FileComponent extends Field {
|
|
|
977
977
|
.filter(file => file.fileToSync?.status === 'success')
|
|
978
978
|
.map(file => file.fileInfo);
|
|
979
979
|
this.dataValue.push(...data);
|
|
980
|
-
this.triggerChange();
|
|
980
|
+
this.triggerChange?.();
|
|
981
981
|
return Promise.resolve();
|
|
982
982
|
}
|
|
983
983
|
catch (err) {
|