@formio/js 5.0.0-dev.5588.0f690c8 → 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 +10 -0
- package/dist/formio.form.js +20 -10
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +22 -12
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.utils.js +12 -2
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -0
- package/lib/cjs/Webform.js +13 -6
- 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 +1 -2
- package/lib/cjs/components/checkbox/Checkbox.js +2 -9
- package/lib/cjs/components/checkbox/fixtures/comp5.d.ts +34 -0
- package/lib/cjs/components/checkbox/fixtures/comp5.js +55 -0
- package/lib/cjs/components/checkbox/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/checkbox/fixtures/index.js +3 -1
- 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/radio/Radio.d.ts +1 -1
- package/lib/cjs/components/radio/Radio.js +5 -3
- 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 +6 -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/components/selectboxes/SelectBoxes.js +4 -1
- package/lib/cjs/translations/en.d.ts +1 -0
- package/lib/cjs/translations/en.js +1 -0
- package/lib/mjs/Webform.js +13 -6
- 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 +1 -2
- package/lib/mjs/components/checkbox/Checkbox.js +2 -9
- package/lib/mjs/components/checkbox/fixtures/comp5.d.ts +34 -0
- package/lib/mjs/components/checkbox/fixtures/comp5.js +53 -0
- package/lib/mjs/components/checkbox/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/checkbox/fixtures/index.js +2 -1
- 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/radio/Radio.d.ts +1 -1
- package/lib/mjs/components/radio/Radio.js +5 -3
- 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 +6 -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/components/selectboxes/SelectBoxes.js +4 -1
- package/lib/mjs/translations/en.d.ts +1 -0
- package/lib/mjs/translations/en.js +1 -0
- package/package.json +3 -3
package/lib/mjs/Webform.js
CHANGED
|
@@ -263,12 +263,19 @@ export default class Webform extends NestedDataComponent {
|
|
|
263
263
|
// Set language after everything is established.
|
|
264
264
|
this.language = this.i18next.language;
|
|
265
265
|
// See if we need to restore the draft from a user.
|
|
266
|
-
if (this.options.saveDraft
|
|
266
|
+
if (this.options.saveDraft) {
|
|
267
267
|
this.formReady.then(() => {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
if (!this.options.skipDraftRestore) {
|
|
269
|
+
const user = Formio.getUser();
|
|
270
|
+
// Only restore a draft if the submission isn't explicitly set.
|
|
271
|
+
if (user && !this.submissionSet) {
|
|
272
|
+
this.restoreDraft(user._id);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
// Enable drafts
|
|
277
|
+
this.draftEnabled = true;
|
|
278
|
+
this.savingDraft = false;
|
|
272
279
|
}
|
|
273
280
|
});
|
|
274
281
|
}
|
|
@@ -754,7 +761,7 @@ export default class Webform extends NestedDataComponent {
|
|
|
754
761
|
}
|
|
755
762
|
const draft = fastCloneDeep(this.submission);
|
|
756
763
|
draft.state = 'draft';
|
|
757
|
-
if (!this.savingDraft) {
|
|
764
|
+
if (!this.savingDraft && !this.submitting) {
|
|
758
765
|
this.emit('saveDraftBegin');
|
|
759
766
|
this.savingDraft = true;
|
|
760
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;
|
|
@@ -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) {
|
|
@@ -178,15 +178,8 @@ export default class CheckBoxComponent extends Field {
|
|
|
178
178
|
return value;
|
|
179
179
|
}
|
|
180
180
|
setValue(value, flags = {}) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const changed = this.updateValue(value, flags);
|
|
184
|
-
if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {
|
|
185
|
-
this.redraw();
|
|
186
|
-
}
|
|
187
|
-
return changed;
|
|
188
|
-
}
|
|
189
|
-
return false;
|
|
181
|
+
this.setCheckedState(value);
|
|
182
|
+
return super.setValue(value, flags);
|
|
190
183
|
}
|
|
191
184
|
getValueAsString(value) {
|
|
192
185
|
const { name: componentName, value: componentValue } = this.component;
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
tableView: boolean;
|
|
10
|
+
validateWhenHidden: boolean;
|
|
11
|
+
key: string;
|
|
12
|
+
conditional: {
|
|
13
|
+
show: boolean;
|
|
14
|
+
conjunction: string;
|
|
15
|
+
conditions: {
|
|
16
|
+
component: string;
|
|
17
|
+
operator: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
type: string;
|
|
21
|
+
input: boolean;
|
|
22
|
+
applyMaskOn?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
label: string;
|
|
25
|
+
applyMaskOn: string;
|
|
26
|
+
tableView: boolean;
|
|
27
|
+
key: string;
|
|
28
|
+
type: string;
|
|
29
|
+
input: boolean;
|
|
30
|
+
validateWhenHidden?: undefined;
|
|
31
|
+
conditional?: undefined;
|
|
32
|
+
})[];
|
|
33
|
+
}
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: '7595',
|
|
3
|
+
name: '7595',
|
|
4
|
+
path: '7595',
|
|
5
|
+
type: 'form',
|
|
6
|
+
display: 'form',
|
|
7
|
+
components: [
|
|
8
|
+
{
|
|
9
|
+
label: 'Checkbox',
|
|
10
|
+
tableView: false,
|
|
11
|
+
validateWhenHidden: false,
|
|
12
|
+
key: 'checkboxBefore',
|
|
13
|
+
conditional: {
|
|
14
|
+
show: true,
|
|
15
|
+
conjunction: 'all',
|
|
16
|
+
conditions: [
|
|
17
|
+
{
|
|
18
|
+
component: 'textField',
|
|
19
|
+
operator: 'isNotEmpty'
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
type: 'checkbox',
|
|
24
|
+
input: true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: 'Text Field',
|
|
28
|
+
applyMaskOn: 'change',
|
|
29
|
+
tableView: true,
|
|
30
|
+
key: 'textField',
|
|
31
|
+
type: 'textfield',
|
|
32
|
+
input: true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: 'Checkbox',
|
|
36
|
+
tableView: false,
|
|
37
|
+
validateWhenHidden: false,
|
|
38
|
+
key: 'checkboxAfter',
|
|
39
|
+
conditional: {
|
|
40
|
+
show: true,
|
|
41
|
+
conjunction: 'all',
|
|
42
|
+
conditions: [
|
|
43
|
+
{
|
|
44
|
+
component: 'textField',
|
|
45
|
+
operator: 'isNotEmpty'
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
type: 'checkbox',
|
|
50
|
+
input: true
|
|
51
|
+
},
|
|
52
|
+
]
|
|
53
|
+
};
|
|
@@ -2,5 +2,6 @@ import comp1 from './comp1';
|
|
|
2
2
|
import comp2 from './comp2';
|
|
3
3
|
import comp3 from './comp3';
|
|
4
4
|
import comp4 from './comp4';
|
|
5
|
+
import comp5 from './comp5';
|
|
5
6
|
import customDefaultComponent from './customDefaultComponent';
|
|
6
|
-
export { comp1, comp2, comp3, comp4, customDefaultComponent };
|
|
7
|
+
export { comp1, comp2, comp3, comp4, comp5, customDefaultComponent };
|
|
@@ -3,4 +3,5 @@ import customDefaultComponent from './customDefaultComponent';
|
|
|
3
3
|
import comp2 from './comp2';
|
|
4
4
|
import comp3 from './comp3';
|
|
5
5
|
import comp4 from './comp4';
|
|
6
|
-
|
|
6
|
+
import comp5 from './comp5';
|
|
7
|
+
export { comp1, comp2, comp3, comp4, comp5, customDefaultComponent };
|
|
@@ -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;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
_id: '66051dae494c977c47028fac',
|
|
3
|
+
title: 'test draft parent',
|
|
4
|
+
name: 'testDraftParent',
|
|
5
|
+
path: 'testdraftparent',
|
|
6
|
+
type: 'form',
|
|
7
|
+
display: 'form',
|
|
8
|
+
components: [
|
|
9
|
+
{
|
|
10
|
+
label: 'Parent Form Field',
|
|
11
|
+
tableView: true,
|
|
12
|
+
key: 'parent',
|
|
13
|
+
type: 'textfield',
|
|
14
|
+
input: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: 'Form',
|
|
18
|
+
tableView: true,
|
|
19
|
+
src: 'http://localhost:3000/idwqwhclwioyqbw/testdraftnested',
|
|
20
|
+
key: 'form',
|
|
21
|
+
type: 'form',
|
|
22
|
+
input: true,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: 'button',
|
|
26
|
+
label: 'Submit',
|
|
27
|
+
key: 'submit',
|
|
28
|
+
disableOnInvalid: true,
|
|
29
|
+
input: true,
|
|
30
|
+
tableView: false,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
project: '63cead09be0090345b109e22',
|
|
34
|
+
machineName: 'idwqwhclwioyqbw:testdraftparent'
|
|
35
|
+
};
|
|
@@ -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,27 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
_id: '63e4deda12b88c4f05c125cf',
|
|
3
|
+
title: 'test draft nested',
|
|
4
|
+
name: 'testDraftNested',
|
|
5
|
+
path: 'testdraftnested',
|
|
6
|
+
type: 'form',
|
|
7
|
+
display: 'form',
|
|
8
|
+
components: [
|
|
9
|
+
{
|
|
10
|
+
label: 'Nested Form Field',
|
|
11
|
+
tableView: true,
|
|
12
|
+
key: 'nested',
|
|
13
|
+
type: 'textfield',
|
|
14
|
+
input: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: 'button',
|
|
18
|
+
label: 'Submit',
|
|
19
|
+
key: 'submit',
|
|
20
|
+
disableOnInvalid: true,
|
|
21
|
+
input: true,
|
|
22
|
+
tableView: false,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
project: '63cead09be0090345b109e22',
|
|
26
|
+
machineName: 'idwqwhclwioyqbw:testdraftparent'
|
|
27
|
+
};
|
|
@@ -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 };
|
|
@@ -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 };
|
|
@@ -71,7 +71,7 @@ export default class RadioComponent extends ListComponent {
|
|
|
71
71
|
detach(element: any): void;
|
|
72
72
|
validateValueProperty(): boolean;
|
|
73
73
|
validateValueAvailability(setting: any, value: any): boolean;
|
|
74
|
-
getValueAsString(value: any): any;
|
|
74
|
+
getValueAsString(value: any, options?: {}): any;
|
|
75
75
|
setValueAt(index: any, value: any): void;
|
|
76
76
|
loadItems(url: any, search: any, headers: any, options: any, method: any, body: any): void;
|
|
77
77
|
loadItemsFromMetadata(): void;
|
|
@@ -226,17 +226,19 @@ export default class RadioComponent extends ListComponent {
|
|
|
226
226
|
}
|
|
227
227
|
return false;
|
|
228
228
|
}
|
|
229
|
-
getValueAsString(value) {
|
|
229
|
+
getValueAsString(value, options = {}) {
|
|
230
230
|
if (_.isObject(value)) {
|
|
231
231
|
value = JSON.stringify(value);
|
|
232
232
|
}
|
|
233
233
|
else if (!_.isString(value)) {
|
|
234
234
|
value = _.toString(value);
|
|
235
235
|
}
|
|
236
|
-
|
|
236
|
+
const isModalPreviewWithUrlDataSource = options.modalPreview && this.component.dataSrc === 'url';
|
|
237
|
+
if (this.component.dataSrc !== 'values' && !isModalPreviewWithUrlDataSource) {
|
|
237
238
|
return value;
|
|
238
239
|
}
|
|
239
|
-
const
|
|
240
|
+
const values = isModalPreviewWithUrlDataSource ? this.loadedOptions : this.component.values;
|
|
241
|
+
const option = _.find(values, (v) => v.value === value);
|
|
240
242
|
if (!value) {
|
|
241
243
|
return _.get(option, 'label', '');
|
|
242
244
|
}
|
|
@@ -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;
|
|
@@ -226,9 +226,10 @@ export default class SelectComponent extends ListComponent {
|
|
|
226
226
|
}
|
|
227
227
|
selectValueAndLabel(data) {
|
|
228
228
|
const value = this.getOptionValue((this.isEntireObjectDisplay() && !this.itemValue(data)) ? data : this.itemValue(data));
|
|
229
|
+
const readOnlyResourceLabelData = this.options.readOnly && (this.component.dataSrc === 'resource' || this.component.dataSrc === 'url') && this.selectData;
|
|
229
230
|
return {
|
|
230
231
|
value,
|
|
231
|
-
label: this.itemTemplate((this.isEntireObjectDisplay() && !_.isObject(data.data)) ? { data: data } : data, value)
|
|
232
|
+
label: this.itemTemplate((this.isEntireObjectDisplay() && !_.isObject(data.data)) ? { data: data } : readOnlyResourceLabelData || data, value)
|
|
232
233
|
};
|
|
233
234
|
}
|
|
234
235
|
itemTemplate(data, value) {
|
|
@@ -1495,6 +1496,10 @@ export default class SelectComponent extends ListComponent {
|
|
|
1495
1496
|
}
|
|
1496
1497
|
asString(value, options = {}) {
|
|
1497
1498
|
value = value ?? this.getValue();
|
|
1499
|
+
if (options.modalPreview && this.selectData) {
|
|
1500
|
+
const { label } = this.selectValueAndLabel(value);
|
|
1501
|
+
return label;
|
|
1502
|
+
}
|
|
1498
1503
|
//need to convert values to strings to be able to compare values with available options that are strings
|
|
1499
1504
|
const convertToString = (data, valueProperty) => {
|
|
1500
1505
|
if (valueProperty) {
|
|
@@ -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,38 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: 'FIO-8234',
|
|
3
|
+
name: 'fio8234',
|
|
4
|
+
path: 'fio8234',
|
|
5
|
+
type: 'form',
|
|
6
|
+
display: 'form',
|
|
7
|
+
components: [
|
|
8
|
+
{
|
|
9
|
+
label: 'Select',
|
|
10
|
+
widget: 'choicesjs',
|
|
11
|
+
tableView: true,
|
|
12
|
+
dataSrc: 'resource',
|
|
13
|
+
data: {
|
|
14
|
+
resource: '665446284c9b0163c3e0c7e6',
|
|
15
|
+
},
|
|
16
|
+
template: '<span>{{ item.data.textField1 }}</span>',
|
|
17
|
+
validate: {
|
|
18
|
+
select: false,
|
|
19
|
+
},
|
|
20
|
+
key: 'select',
|
|
21
|
+
type: 'select',
|
|
22
|
+
searchField: 'data.textField2__regex',
|
|
23
|
+
input: true,
|
|
24
|
+
noRefreshOnScroll: false,
|
|
25
|
+
addResource: false,
|
|
26
|
+
reference: false,
|
|
27
|
+
valueProperty: 'data.textField2',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'button',
|
|
31
|
+
label: 'Submit',
|
|
32
|
+
key: 'submit',
|
|
33
|
+
disableOnInvalid: true,
|
|
34
|
+
input: true,
|
|
35
|
+
tableView: false,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
@@ -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";
|
|
@@ -20,4 +20,5 @@ import comp19 from './comp19';
|
|
|
20
20
|
import comp20 from './comp20';
|
|
21
21
|
import comp21 from './comp21';
|
|
22
22
|
import comp22 from './comp22';
|
|
23
|
-
|
|
23
|
+
import comp23 from './comp23';
|
|
24
|
+
export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23 };
|
|
@@ -162,11 +162,14 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
|
162
162
|
}
|
|
163
163
|
return changed;
|
|
164
164
|
}
|
|
165
|
-
getValueAsString(value) {
|
|
165
|
+
getValueAsString(value, options = {}) {
|
|
166
166
|
if (!value) {
|
|
167
167
|
return '';
|
|
168
168
|
}
|
|
169
169
|
if (this.isSelectURL) {
|
|
170
|
+
if (options.modalPreview && this.loadedOptions) {
|
|
171
|
+
return this.loadedOptions.filter((option) => value[option.value]).map((option) => option.label).join(', ');
|
|
172
|
+
}
|
|
170
173
|
return _(value).pickBy((val) => val).keys().join(', ');
|
|
171
174
|
}
|
|
172
175
|
return _(this.component.values || [])
|
|
@@ -71,4 +71,5 @@ export default {
|
|
|
71
71
|
submitButtonAriaLabel: 'Submit Form button. Click to submit the form',
|
|
72
72
|
reCaptchaTokenValidationError: 'ReCAPTCHA: Token validation error',
|
|
73
73
|
reCaptchaTokenNotSpecifiedError: 'ReCAPTCHA: Token is not specified in submission',
|
|
74
|
+
apiKey: 'API Key is not unique: {{key}}'
|
|
74
75
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formio/js",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.5589.fd575d0",
|
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"core-js": "^3.37.0",
|
|
90
90
|
"dialog-polyfill": "^0.5.6",
|
|
91
91
|
"dom-autoscroller": "^2.3.4",
|
|
92
|
-
"dompurify": "^3.1.
|
|
92
|
+
"dompurify": "^3.1.1",
|
|
93
93
|
"downloadjs": "^1.4.7",
|
|
94
94
|
"dragula": "^3.7.3",
|
|
95
95
|
"eventemitter3": "^5.0.1",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"lodash": "^4.17.21",
|
|
106
106
|
"moment": "^2.29.4",
|
|
107
107
|
"moment-timezone": "^0.5.44",
|
|
108
|
-
"quill": "^2.0.0
|
|
108
|
+
"quill": "^2.0.0",
|
|
109
109
|
"signature_pad": "^4.2.0",
|
|
110
110
|
"string-hash": "^1.1.3",
|
|
111
111
|
"tippy.js": "^6.3.7",
|