@formio/js 5.0.0-dev.5586.9e84922 → 5.0.0-dev.5589.fd575d0
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/Changelog.md +8 -0
- package/dist/formio.form.js +18 -8
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +20 -10
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.utils.js +13 -3
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -0
- package/lib/cjs/Webform.js +1 -1
- package/lib/cjs/WebformBuilder.js +1 -6
- package/lib/cjs/components/_classes/component/Component.d.ts +5 -3
- package/lib/cjs/components/_classes/component/Component.js +3 -4
- package/lib/cjs/components/form/Form.js +5 -1
- package/lib/cjs/components/form/fixtures/comp7.d.ts +36 -0
- package/lib/cjs/components/form/fixtures/comp7.js +37 -0
- package/lib/cjs/components/form/fixtures/comp8.d.ts +26 -0
- package/lib/cjs/components/form/fixtures/comp8.js +29 -0
- package/lib/cjs/components/form/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/form/fixtures/index.js +5 -1
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +5 -0
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +3 -0
- package/lib/cjs/components/select/Select.js +2 -1
- package/lib/cjs/components/select/fixtures/comp23.d.ts +47 -0
- package/lib/cjs/components/select/fixtures/comp23.js +40 -0
- package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/select/fixtures/index.js +3 -1
- package/lib/cjs/translations/en.d.ts +1 -0
- package/lib/cjs/translations/en.js +1 -0
- package/lib/cjs/utils/utils.d.ts +6 -0
- package/lib/cjs/utils/utils.js +16 -2
- package/lib/mjs/Webform.js +1 -1
- package/lib/mjs/WebformBuilder.js +1 -5
- package/lib/mjs/components/_classes/component/Component.d.ts +5 -3
- package/lib/mjs/components/_classes/component/Component.js +4 -5
- package/lib/mjs/components/form/Form.js +5 -1
- package/lib/mjs/components/form/fixtures/comp7.d.ts +36 -0
- package/lib/mjs/components/form/fixtures/comp7.js +35 -0
- package/lib/mjs/components/form/fixtures/comp8.d.ts +26 -0
- package/lib/mjs/components/form/fixtures/comp8.js +27 -0
- package/lib/mjs/components/form/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/form/fixtures/index.js +3 -1
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +5 -0
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +3 -0
- package/lib/mjs/components/select/Select.js +2 -1
- package/lib/mjs/components/select/fixtures/comp23.d.ts +47 -0
- package/lib/mjs/components/select/fixtures/comp23.js +38 -0
- package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/select/fixtures/index.js +2 -1
- package/lib/mjs/translations/en.d.ts +1 -0
- package/lib/mjs/translations/en.js +1 -0
- package/lib/mjs/utils/utils.d.ts +6 -0
- package/lib/mjs/utils/utils.js +13 -0
- package/package.json +3 -3
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
/*! @license DOMPurify 3.1.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.0/LICENSE */
|
|
14
14
|
|
|
15
|
+
/*! @license DOMPurify 3.1.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.4/LICENSE */
|
|
16
|
+
|
|
15
17
|
/*! formiojs v5.0.0-rc.43 | https://unpkg.com/formiojs@5.0.0-rc.43/LICENSE.txt */
|
|
16
18
|
|
|
17
19
|
/**
|
package/lib/cjs/Webform.js
CHANGED
|
@@ -757,7 +757,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
757
757
|
}
|
|
758
758
|
const draft = (0, utils_1.fastCloneDeep)(this.submission);
|
|
759
759
|
draft.state = 'draft';
|
|
760
|
-
if (!this.savingDraft) {
|
|
760
|
+
if (!this.savingDraft && !this.submitting) {
|
|
761
761
|
this.emit('saveDraftBegin');
|
|
762
762
|
this.savingDraft = true;
|
|
763
763
|
this.formio.saveSubmission(draft).then((sub) => {
|
|
@@ -1119,16 +1119,11 @@ class WebformBuilder extends Component_1.default {
|
|
|
1119
1119
|
const repeatablePaths = this.findRepeatablePaths();
|
|
1120
1120
|
let hasInvalidComponents = false;
|
|
1121
1121
|
this.webform.everyComponent((comp) => {
|
|
1122
|
-
var _a;
|
|
1123
1122
|
const path = comp.path;
|
|
1124
|
-
const errors = comp.visibleErrors || [];
|
|
1125
1123
|
if (repeatablePaths.includes(path)) {
|
|
1126
|
-
comp.setCustomValidity(
|
|
1124
|
+
comp.setCustomValidity(this.t('apiKey', { key: comp.key }));
|
|
1127
1125
|
hasInvalidComponents = true;
|
|
1128
1126
|
}
|
|
1129
|
-
else if (errors.length && ((_a = errors[0].message) === null || _a === void 0 ? void 0 : _a.startsWith('API Key is not unique'))) {
|
|
1130
|
-
comp.setCustomValidity('');
|
|
1131
|
-
}
|
|
1132
1127
|
});
|
|
1133
1128
|
this.emit('builderFormValidityChange', hasInvalidComponents);
|
|
1134
1129
|
}
|
|
@@ -492,10 +492,12 @@ declare class Component extends Element {
|
|
|
492
492
|
/**
|
|
493
493
|
* Add a new input error to this element.
|
|
494
494
|
*
|
|
495
|
-
* @param message
|
|
496
|
-
* @param dirty
|
|
495
|
+
* @param {{level: string, message: string}[]} messages
|
|
497
496
|
*/
|
|
498
|
-
addMessages(messages:
|
|
497
|
+
addMessages(messages: {
|
|
498
|
+
level: string;
|
|
499
|
+
message: string;
|
|
500
|
+
}[]): void;
|
|
499
501
|
setErrorClasses(elements: any, dirty: any, hasErrors: any, hasMessages: any, element?: any): void;
|
|
500
502
|
setElementInvalid(element: any, invalid: any): void;
|
|
501
503
|
clearOnHide(): void;
|
|
@@ -1831,8 +1831,7 @@ class Component extends Element_1.default {
|
|
|
1831
1831
|
/**
|
|
1832
1832
|
* Add a new input error to this element.
|
|
1833
1833
|
*
|
|
1834
|
-
* @param message
|
|
1835
|
-
* @param dirty
|
|
1834
|
+
* @param {{level: string, message: string}[]} messages
|
|
1836
1835
|
*/
|
|
1837
1836
|
addMessages(messages) {
|
|
1838
1837
|
if (!messages) {
|
|
@@ -3257,7 +3256,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3257
3256
|
}.bind(Component.externalLibraries[name]);
|
|
3258
3257
|
}
|
|
3259
3258
|
// See if the plugin already exists.
|
|
3260
|
-
const plugin =
|
|
3259
|
+
const plugin = (0, utils_1.getScriptPlugin)(property);
|
|
3261
3260
|
if (plugin) {
|
|
3262
3261
|
Component.externalLibraries[name].resolve(plugin);
|
|
3263
3262
|
}
|
|
@@ -3300,7 +3299,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3300
3299
|
// if no callback is provided, then check periodically for the script.
|
|
3301
3300
|
if (polling) {
|
|
3302
3301
|
setTimeout(function checkLibrary() {
|
|
3303
|
-
const plugin =
|
|
3302
|
+
const plugin = (0, utils_1.getScriptPlugin)(property);
|
|
3304
3303
|
if (plugin) {
|
|
3305
3304
|
Component.externalLibraries[name].resolve(plugin);
|
|
3306
3305
|
}
|
|
@@ -206,6 +206,9 @@ class FormComponent extends Component_1.default {
|
|
|
206
206
|
if (this.options.saveDraftThrottle) {
|
|
207
207
|
options.saveDraftThrottle = this.options.saveDraftThrottle;
|
|
208
208
|
}
|
|
209
|
+
if (this.options.skipDraftRestore) {
|
|
210
|
+
options.skipDraftRestore = this.options.skipDraftRestore;
|
|
211
|
+
}
|
|
209
212
|
return options;
|
|
210
213
|
}
|
|
211
214
|
/* eslint-enable max-statements */
|
|
@@ -577,8 +580,9 @@ class FormComponent extends Component_1.default {
|
|
|
577
580
|
this.subForm.triggerSaveDraft.cancel();
|
|
578
581
|
}
|
|
579
582
|
const isAlreadySubmitted = submission && submission._id && submission.form;
|
|
583
|
+
const isDraftSubmission = this.options.saveDraft && submission.state === 'draft';
|
|
580
584
|
// This submission has already been submitted, so just return the reference data.
|
|
581
|
-
if (isAlreadySubmitted && !((_c = this.subForm) === null || _c === void 0 ? void 0 : _c.wizard)) {
|
|
585
|
+
if (isAlreadySubmitted && !((_c = this.subForm) === null || _c === void 0 ? void 0 : _c.wizard) && !isDraftSubmission) {
|
|
582
586
|
this.dataValue = submission;
|
|
583
587
|
return Promise.resolve(this.dataValue);
|
|
584
588
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let _id: string;
|
|
3
|
+
let title: string;
|
|
4
|
+
let name: string;
|
|
5
|
+
let path: string;
|
|
6
|
+
let type: string;
|
|
7
|
+
let display: string;
|
|
8
|
+
let components: ({
|
|
9
|
+
label: string;
|
|
10
|
+
tableView: boolean;
|
|
11
|
+
key: string;
|
|
12
|
+
type: string;
|
|
13
|
+
input: boolean;
|
|
14
|
+
src?: undefined;
|
|
15
|
+
disableOnInvalid?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
label: string;
|
|
18
|
+
tableView: boolean;
|
|
19
|
+
src: string;
|
|
20
|
+
key: string;
|
|
21
|
+
type: string;
|
|
22
|
+
input: boolean;
|
|
23
|
+
disableOnInvalid?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
type: string;
|
|
26
|
+
label: string;
|
|
27
|
+
key: string;
|
|
28
|
+
disableOnInvalid: boolean;
|
|
29
|
+
input: boolean;
|
|
30
|
+
tableView: boolean;
|
|
31
|
+
src?: undefined;
|
|
32
|
+
})[];
|
|
33
|
+
let project: string;
|
|
34
|
+
let machineName: string;
|
|
35
|
+
}
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
_id: '66051dae494c977c47028fac',
|
|
5
|
+
title: 'test draft parent',
|
|
6
|
+
name: 'testDraftParent',
|
|
7
|
+
path: 'testdraftparent',
|
|
8
|
+
type: 'form',
|
|
9
|
+
display: 'form',
|
|
10
|
+
components: [
|
|
11
|
+
{
|
|
12
|
+
label: 'Parent Form Field',
|
|
13
|
+
tableView: true,
|
|
14
|
+
key: 'parent',
|
|
15
|
+
type: 'textfield',
|
|
16
|
+
input: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: 'Form',
|
|
20
|
+
tableView: true,
|
|
21
|
+
src: 'http://localhost:3000/idwqwhclwioyqbw/testdraftnested',
|
|
22
|
+
key: 'form',
|
|
23
|
+
type: 'form',
|
|
24
|
+
input: true,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'button',
|
|
28
|
+
label: 'Submit',
|
|
29
|
+
key: 'submit',
|
|
30
|
+
disableOnInvalid: true,
|
|
31
|
+
input: true,
|
|
32
|
+
tableView: false,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
project: '63cead09be0090345b109e22',
|
|
36
|
+
machineName: 'idwqwhclwioyqbw:testdraftparent'
|
|
37
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let _id: string;
|
|
3
|
+
let title: string;
|
|
4
|
+
let name: string;
|
|
5
|
+
let path: string;
|
|
6
|
+
let type: string;
|
|
7
|
+
let display: string;
|
|
8
|
+
let components: ({
|
|
9
|
+
label: string;
|
|
10
|
+
tableView: boolean;
|
|
11
|
+
key: string;
|
|
12
|
+
type: string;
|
|
13
|
+
input: boolean;
|
|
14
|
+
disableOnInvalid?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
type: string;
|
|
17
|
+
label: string;
|
|
18
|
+
key: string;
|
|
19
|
+
disableOnInvalid: boolean;
|
|
20
|
+
input: boolean;
|
|
21
|
+
tableView: boolean;
|
|
22
|
+
})[];
|
|
23
|
+
let project: string;
|
|
24
|
+
let machineName: string;
|
|
25
|
+
}
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
_id: '63e4deda12b88c4f05c125cf',
|
|
5
|
+
title: 'test draft nested',
|
|
6
|
+
name: 'testDraftNested',
|
|
7
|
+
path: 'testdraftnested',
|
|
8
|
+
type: 'form',
|
|
9
|
+
display: 'form',
|
|
10
|
+
components: [
|
|
11
|
+
{
|
|
12
|
+
label: 'Nested Form Field',
|
|
13
|
+
tableView: true,
|
|
14
|
+
key: 'nested',
|
|
15
|
+
type: 'textfield',
|
|
16
|
+
input: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'button',
|
|
20
|
+
label: 'Submit',
|
|
21
|
+
key: 'submit',
|
|
22
|
+
disableOnInvalid: true,
|
|
23
|
+
input: true,
|
|
24
|
+
tableView: false,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
project: '63cead09be0090345b109e22',
|
|
28
|
+
machineName: 'idwqwhclwioyqbw:testdraftparent'
|
|
29
|
+
};
|
|
@@ -5,4 +5,6 @@ import comp3 from './comp3';
|
|
|
5
5
|
import comp4 from './comp4';
|
|
6
6
|
import comp5 from './comp5';
|
|
7
7
|
import comp6 from './comp6';
|
|
8
|
-
|
|
8
|
+
import comp7 from './comp7';
|
|
9
|
+
import comp8 from './comp8';
|
|
10
|
+
export { formModalEdit, comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = exports.formModalEdit = void 0;
|
|
6
|
+
exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = exports.formModalEdit = void 0;
|
|
7
7
|
const formModalEdit_1 = __importDefault(require("./formModalEdit"));
|
|
8
8
|
exports.formModalEdit = formModalEdit_1.default;
|
|
9
9
|
const comp1_1 = __importDefault(require("./comp1"));
|
|
@@ -18,3 +18,7 @@ const comp5_1 = __importDefault(require("./comp5"));
|
|
|
18
18
|
exports.comp5 = comp5_1.default;
|
|
19
19
|
const comp6_1 = __importDefault(require("./comp6"));
|
|
20
20
|
exports.comp6 = comp6_1.default;
|
|
21
|
+
const comp7_1 = __importDefault(require("./comp7"));
|
|
22
|
+
exports.comp7 = comp7_1.default;
|
|
23
|
+
const comp8_1 = __importDefault(require("./comp8"));
|
|
24
|
+
exports.comp8 = comp8_1.default;
|
|
@@ -7,6 +7,9 @@ declare const _default: ({
|
|
|
7
7
|
label: string;
|
|
8
8
|
value: string;
|
|
9
9
|
}[];
|
|
10
|
+
validate: {
|
|
11
|
+
required: boolean;
|
|
12
|
+
};
|
|
10
13
|
weight: number;
|
|
11
14
|
input?: undefined;
|
|
12
15
|
dataSrc?: undefined;
|
|
@@ -28,6 +31,7 @@ declare const _default: ({
|
|
|
28
31
|
custom(context: any): any[];
|
|
29
32
|
};
|
|
30
33
|
values?: undefined;
|
|
34
|
+
validate?: undefined;
|
|
31
35
|
ignore?: undefined;
|
|
32
36
|
} | {
|
|
33
37
|
key: string;
|
|
@@ -36,6 +40,7 @@ declare const _default: ({
|
|
|
36
40
|
tooltip?: undefined;
|
|
37
41
|
type?: undefined;
|
|
38
42
|
values?: undefined;
|
|
43
|
+
validate?: undefined;
|
|
39
44
|
weight?: undefined;
|
|
40
45
|
input?: undefined;
|
|
41
46
|
dataSrc?: undefined;
|
|
@@ -228,9 +228,10 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
228
228
|
}
|
|
229
229
|
selectValueAndLabel(data) {
|
|
230
230
|
const value = this.getOptionValue((this.isEntireObjectDisplay() && !this.itemValue(data)) ? data : this.itemValue(data));
|
|
231
|
+
const readOnlyResourceLabelData = this.options.readOnly && (this.component.dataSrc === 'resource' || this.component.dataSrc === 'url') && this.selectData;
|
|
231
232
|
return {
|
|
232
233
|
value,
|
|
233
|
-
label: this.itemTemplate((this.isEntireObjectDisplay() && !lodash_1.default.isObject(data.data)) ? { data: data } : data, value)
|
|
234
|
+
label: this.itemTemplate((this.isEntireObjectDisplay() && !lodash_1.default.isObject(data.data)) ? { data: data } : readOnlyResourceLabelData || data, value)
|
|
234
235
|
};
|
|
235
236
|
}
|
|
236
237
|
itemTemplate(data, value) {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let title: string;
|
|
3
|
+
let name: string;
|
|
4
|
+
let path: string;
|
|
5
|
+
let type: string;
|
|
6
|
+
let display: string;
|
|
7
|
+
let components: ({
|
|
8
|
+
label: string;
|
|
9
|
+
widget: string;
|
|
10
|
+
tableView: boolean;
|
|
11
|
+
dataSrc: string;
|
|
12
|
+
data: {
|
|
13
|
+
resource: string;
|
|
14
|
+
};
|
|
15
|
+
template: string;
|
|
16
|
+
validate: {
|
|
17
|
+
select: boolean;
|
|
18
|
+
};
|
|
19
|
+
key: string;
|
|
20
|
+
type: string;
|
|
21
|
+
searchField: string;
|
|
22
|
+
input: boolean;
|
|
23
|
+
noRefreshOnScroll: boolean;
|
|
24
|
+
addResource: boolean;
|
|
25
|
+
reference: boolean;
|
|
26
|
+
valueProperty: string;
|
|
27
|
+
disableOnInvalid?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
type: string;
|
|
30
|
+
label: string;
|
|
31
|
+
key: string;
|
|
32
|
+
disableOnInvalid: boolean;
|
|
33
|
+
input: boolean;
|
|
34
|
+
tableView: boolean;
|
|
35
|
+
widget?: undefined;
|
|
36
|
+
dataSrc?: undefined;
|
|
37
|
+
data?: undefined;
|
|
38
|
+
template?: undefined;
|
|
39
|
+
validate?: undefined;
|
|
40
|
+
searchField?: undefined;
|
|
41
|
+
noRefreshOnScroll?: undefined;
|
|
42
|
+
addResource?: undefined;
|
|
43
|
+
reference?: undefined;
|
|
44
|
+
valueProperty?: undefined;
|
|
45
|
+
})[];
|
|
46
|
+
}
|
|
47
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
title: 'FIO-8234',
|
|
5
|
+
name: 'fio8234',
|
|
6
|
+
path: 'fio8234',
|
|
7
|
+
type: 'form',
|
|
8
|
+
display: 'form',
|
|
9
|
+
components: [
|
|
10
|
+
{
|
|
11
|
+
label: 'Select',
|
|
12
|
+
widget: 'choicesjs',
|
|
13
|
+
tableView: true,
|
|
14
|
+
dataSrc: 'resource',
|
|
15
|
+
data: {
|
|
16
|
+
resource: '665446284c9b0163c3e0c7e6',
|
|
17
|
+
},
|
|
18
|
+
template: '<span>{{ item.data.textField1 }}</span>',
|
|
19
|
+
validate: {
|
|
20
|
+
select: false,
|
|
21
|
+
},
|
|
22
|
+
key: 'select',
|
|
23
|
+
type: 'select',
|
|
24
|
+
searchField: 'data.textField2__regex',
|
|
25
|
+
input: true,
|
|
26
|
+
noRefreshOnScroll: false,
|
|
27
|
+
addResource: false,
|
|
28
|
+
reference: false,
|
|
29
|
+
valueProperty: 'data.textField2',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'button',
|
|
33
|
+
label: 'Submit',
|
|
34
|
+
key: 'submit',
|
|
35
|
+
disableOnInvalid: true,
|
|
36
|
+
input: true,
|
|
37
|
+
tableView: false,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
};
|
|
@@ -19,5 +19,6 @@ import comp19 from './comp19';
|
|
|
19
19
|
import comp20 from './comp20';
|
|
20
20
|
import comp21 from './comp21';
|
|
21
21
|
import comp22 from './comp22';
|
|
22
|
-
|
|
22
|
+
import comp23 from './comp23';
|
|
23
|
+
export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23 };
|
|
23
24
|
export { multiSelect, multiSelectOptions } from "./comp3";
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.comp22 = exports.comp21 = exports.comp20 = exports.comp19 = exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp2 = exports.comp1 = exports.multiSelectOptions = exports.multiSelect = void 0;
|
|
6
|
+
exports.comp23 = exports.comp22 = exports.comp21 = exports.comp20 = exports.comp19 = exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp2 = exports.comp1 = exports.multiSelectOptions = exports.multiSelect = void 0;
|
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
|
8
8
|
exports.comp1 = comp1_1.default;
|
|
9
9
|
const comp2_1 = __importDefault(require("./comp2"));
|
|
@@ -49,3 +49,5 @@ const comp21_1 = __importDefault(require("./comp21"));
|
|
|
49
49
|
exports.comp21 = comp21_1.default;
|
|
50
50
|
const comp22_1 = __importDefault(require("./comp22"));
|
|
51
51
|
exports.comp22 = comp22_1.default;
|
|
52
|
+
const comp23_1 = __importDefault(require("./comp23"));
|
|
53
|
+
exports.comp23 = comp23_1.default;
|
|
@@ -73,4 +73,5 @@ exports.default = {
|
|
|
73
73
|
submitButtonAriaLabel: 'Submit Form button. Click to submit the form',
|
|
74
74
|
reCaptchaTokenValidationError: 'ReCAPTCHA: Token validation error',
|
|
75
75
|
reCaptchaTokenNotSpecifiedError: 'ReCAPTCHA: Token is not specified in submission',
|
|
76
|
+
apiKey: 'API Key is not unique: {{key}}'
|
|
76
77
|
};
|
package/lib/cjs/utils/utils.d.ts
CHANGED
|
@@ -27,6 +27,12 @@ export function getElementRect(element: any): {
|
|
|
27
27
|
width: string;
|
|
28
28
|
height: string;
|
|
29
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Get non HTMLElement property in the window object
|
|
32
|
+
* @param {String} property
|
|
33
|
+
* @return {any || undefined}
|
|
34
|
+
*/
|
|
35
|
+
export function getScriptPlugin(property: string): any;
|
|
30
36
|
/**
|
|
31
37
|
* Determines the boolean value of a setting.
|
|
32
38
|
*
|
package/lib/cjs/utils/utils.js
CHANGED
|
@@ -30,8 +30,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
30
30
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.
|
|
34
|
-
exports.isSelectResourceWithObjectValue = exports.getItemTemplateKeys = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = void 0;
|
|
33
|
+
exports.withSwitch = exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getScriptPlugin = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
|
|
34
|
+
exports.isSelectResourceWithObjectValue = exports.getItemTemplateKeys = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = void 0;
|
|
35
35
|
const lodash_1 = __importDefault(require("lodash"));
|
|
36
36
|
exports._ = lodash_1.default;
|
|
37
37
|
const fetch_ponyfill_1 = __importDefault(require("fetch-ponyfill"));
|
|
@@ -172,6 +172,20 @@ function getElementRect(element) {
|
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
exports.getElementRect = getElementRect;
|
|
175
|
+
/**
|
|
176
|
+
* Get non HTMLElement property in the window object
|
|
177
|
+
* @param {String} property
|
|
178
|
+
* @return {any || undefined}
|
|
179
|
+
*/
|
|
180
|
+
function getScriptPlugin(property) {
|
|
181
|
+
const obj = window[property];
|
|
182
|
+
if (typeof HTMLElement === 'object' ? obj instanceof HTMLElement : //DOM2
|
|
183
|
+
obj && typeof obj === 'object' && true && obj.nodeType === 1 && typeof obj.nodeName === 'string') {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
return obj;
|
|
187
|
+
}
|
|
188
|
+
exports.getScriptPlugin = getScriptPlugin;
|
|
175
189
|
/**
|
|
176
190
|
* Determines the boolean value of a setting.
|
|
177
191
|
*
|
package/lib/mjs/Webform.js
CHANGED
|
@@ -761,7 +761,7 @@ export default class Webform extends NestedDataComponent {
|
|
|
761
761
|
}
|
|
762
762
|
const draft = fastCloneDeep(this.submission);
|
|
763
763
|
draft.state = 'draft';
|
|
764
|
-
if (!this.savingDraft) {
|
|
764
|
+
if (!this.savingDraft && !this.submitting) {
|
|
765
765
|
this.emit('saveDraftBegin');
|
|
766
766
|
this.savingDraft = true;
|
|
767
767
|
this.formio.saveSubmission(draft).then((sub) => {
|
|
@@ -1104,14 +1104,10 @@ export default class WebformBuilder extends Component {
|
|
|
1104
1104
|
let hasInvalidComponents = false;
|
|
1105
1105
|
this.webform.everyComponent((comp) => {
|
|
1106
1106
|
const path = comp.path;
|
|
1107
|
-
const errors = comp.visibleErrors || [];
|
|
1108
1107
|
if (repeatablePaths.includes(path)) {
|
|
1109
|
-
comp.setCustomValidity(
|
|
1108
|
+
comp.setCustomValidity(this.t('apiKey', { key: comp.key }));
|
|
1110
1109
|
hasInvalidComponents = true;
|
|
1111
1110
|
}
|
|
1112
|
-
else if (errors.length && errors[0].message?.startsWith('API Key is not unique')) {
|
|
1113
|
-
comp.setCustomValidity('');
|
|
1114
|
-
}
|
|
1115
1111
|
});
|
|
1116
1112
|
this.emit('builderFormValidityChange', hasInvalidComponents);
|
|
1117
1113
|
}
|
|
@@ -492,10 +492,12 @@ declare class Component extends Element {
|
|
|
492
492
|
/**
|
|
493
493
|
* Add a new input error to this element.
|
|
494
494
|
*
|
|
495
|
-
* @param message
|
|
496
|
-
* @param dirty
|
|
495
|
+
* @param {{level: string, message: string}[]} messages
|
|
497
496
|
*/
|
|
498
|
-
addMessages(messages:
|
|
497
|
+
addMessages(messages: {
|
|
498
|
+
level: string;
|
|
499
|
+
message: string;
|
|
500
|
+
}[]): void;
|
|
499
501
|
setErrorClasses(elements: any, dirty: any, hasErrors: any, hasMessages: any, element?: any): void;
|
|
500
502
|
setElementInvalid(element: any, invalid: any): void;
|
|
501
503
|
clearOnHide(): void;
|
|
@@ -6,7 +6,7 @@ import isMobile from 'ismobilejs';
|
|
|
6
6
|
import { processOne, processOneSync, validateProcessInfo } from '@formio/core/process';
|
|
7
7
|
import { Formio } from '../../../Formio';
|
|
8
8
|
import * as FormioUtils from '../../../utils/utils';
|
|
9
|
-
import { fastCloneDeep, boolValue, getComponentPath, isInsideScopingComponent, currentTimezone } from '../../../utils/utils';
|
|
9
|
+
import { fastCloneDeep, boolValue, getComponentPath, isInsideScopingComponent, currentTimezone, getScriptPlugin } from '../../../utils/utils';
|
|
10
10
|
import Element from '../../../Element';
|
|
11
11
|
import ComponentModal from '../componentModal/ComponentModal';
|
|
12
12
|
import Widgets from '../../../widgets';
|
|
@@ -1795,8 +1795,7 @@ export default class Component extends Element {
|
|
|
1795
1795
|
/**
|
|
1796
1796
|
* Add a new input error to this element.
|
|
1797
1797
|
*
|
|
1798
|
-
* @param message
|
|
1799
|
-
* @param dirty
|
|
1798
|
+
* @param {{level: string, message: string}[]} messages
|
|
1800
1799
|
*/
|
|
1801
1800
|
addMessages(messages) {
|
|
1802
1801
|
if (!messages) {
|
|
@@ -3220,7 +3219,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3220
3219
|
}.bind(Component.externalLibraries[name]);
|
|
3221
3220
|
}
|
|
3222
3221
|
// See if the plugin already exists.
|
|
3223
|
-
const plugin =
|
|
3222
|
+
const plugin = getScriptPlugin(property);
|
|
3224
3223
|
if (plugin) {
|
|
3225
3224
|
Component.externalLibraries[name].resolve(plugin);
|
|
3226
3225
|
}
|
|
@@ -3263,7 +3262,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3263
3262
|
// if no callback is provided, then check periodically for the script.
|
|
3264
3263
|
if (polling) {
|
|
3265
3264
|
setTimeout(function checkLibrary() {
|
|
3266
|
-
const plugin =
|
|
3265
|
+
const plugin = getScriptPlugin(property);
|
|
3267
3266
|
if (plugin) {
|
|
3268
3267
|
Component.externalLibraries[name].resolve(plugin);
|
|
3269
3268
|
}
|
|
@@ -200,6 +200,9 @@ export default class FormComponent extends Component {
|
|
|
200
200
|
if (this.options.saveDraftThrottle) {
|
|
201
201
|
options.saveDraftThrottle = this.options.saveDraftThrottle;
|
|
202
202
|
}
|
|
203
|
+
if (this.options.skipDraftRestore) {
|
|
204
|
+
options.skipDraftRestore = this.options.skipDraftRestore;
|
|
205
|
+
}
|
|
203
206
|
return options;
|
|
204
207
|
}
|
|
205
208
|
/* eslint-enable max-statements */
|
|
@@ -570,8 +573,9 @@ export default class FormComponent extends Component {
|
|
|
570
573
|
this.subForm.triggerSaveDraft.cancel();
|
|
571
574
|
}
|
|
572
575
|
const isAlreadySubmitted = submission && submission._id && submission.form;
|
|
576
|
+
const isDraftSubmission = this.options.saveDraft && submission.state === 'draft';
|
|
573
577
|
// This submission has already been submitted, so just return the reference data.
|
|
574
|
-
if (isAlreadySubmitted && !this.subForm?.wizard) {
|
|
578
|
+
if (isAlreadySubmitted && !this.subForm?.wizard && !isDraftSubmission) {
|
|
575
579
|
this.dataValue = submission;
|
|
576
580
|
return Promise.resolve(this.dataValue);
|
|
577
581
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let _id: string;
|
|
3
|
+
let title: string;
|
|
4
|
+
let name: string;
|
|
5
|
+
let path: string;
|
|
6
|
+
let type: string;
|
|
7
|
+
let display: string;
|
|
8
|
+
let components: ({
|
|
9
|
+
label: string;
|
|
10
|
+
tableView: boolean;
|
|
11
|
+
key: string;
|
|
12
|
+
type: string;
|
|
13
|
+
input: boolean;
|
|
14
|
+
src?: undefined;
|
|
15
|
+
disableOnInvalid?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
label: string;
|
|
18
|
+
tableView: boolean;
|
|
19
|
+
src: string;
|
|
20
|
+
key: string;
|
|
21
|
+
type: string;
|
|
22
|
+
input: boolean;
|
|
23
|
+
disableOnInvalid?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
type: string;
|
|
26
|
+
label: string;
|
|
27
|
+
key: string;
|
|
28
|
+
disableOnInvalid: boolean;
|
|
29
|
+
input: boolean;
|
|
30
|
+
tableView: boolean;
|
|
31
|
+
src?: undefined;
|
|
32
|
+
})[];
|
|
33
|
+
let project: string;
|
|
34
|
+
let machineName: string;
|
|
35
|
+
}
|
|
36
|
+
export default _default;
|