@formio/js 5.0.0-dev.5588.0f690c8 → 5.0.0-dev.5592.bb7e96a
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 +65 -43
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +68 -46
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- 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 +16 -7
- 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/editForm/Select.edit.data.js +16 -2
- package/lib/cjs/components/select/fixtures/comp22.js +1 -1
- package/lib/cjs/components/select/fixtures/comp23.d.ts +58 -0
- package/lib/cjs/components/select/fixtures/comp23.js +49 -0
- package/lib/cjs/components/select/fixtures/comp24.d.ts +47 -0
- package/lib/cjs/components/select/fixtures/comp24.js +40 -0
- package/lib/cjs/components/select/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/select/fixtures/index.js +5 -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 +16 -7
- 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/editForm/Select.edit.data.js +16 -2
- package/lib/mjs/components/select/fixtures/comp22.js +1 -1
- package/lib/mjs/components/select/fixtures/comp23.d.ts +58 -0
- package/lib/mjs/components/select/fixtures/comp23.js +47 -0
- package/lib/mjs/components/select/fixtures/comp24.d.ts +47 -0
- package/lib/mjs/components/select/fixtures/comp24.js +38 -0
- package/lib/mjs/components/select/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/select/fixtures/index.js +3 -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
|
@@ -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
|
@@ -291,12 +291,19 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
291
291
|
// Set language after everything is established.
|
|
292
292
|
this.language = this.i18next.language;
|
|
293
293
|
// See if we need to restore the draft from a user.
|
|
294
|
-
if (this.options.saveDraft
|
|
294
|
+
if (this.options.saveDraft) {
|
|
295
295
|
this.formReady.then(() => {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
296
|
+
if (!this.options.skipDraftRestore) {
|
|
297
|
+
const user = Formio_1.Formio.getUser();
|
|
298
|
+
// Only restore a draft if the submission isn't explicitly set.
|
|
299
|
+
if (user && !this.submissionSet) {
|
|
300
|
+
this.restoreDraft(user._id);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
// Enable drafts
|
|
305
|
+
this.draftEnabled = true;
|
|
306
|
+
this.savingDraft = false;
|
|
300
307
|
}
|
|
301
308
|
});
|
|
302
309
|
}
|
|
@@ -750,7 +757,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
750
757
|
}
|
|
751
758
|
const draft = (0, utils_1.fastCloneDeep)(this.submission);
|
|
752
759
|
draft.state = 'draft';
|
|
753
|
-
if (!this.savingDraft) {
|
|
760
|
+
if (!this.savingDraft && !this.submitting) {
|
|
754
761
|
this.emit('saveDraftBegin');
|
|
755
762
|
this.savingDraft = true;
|
|
756
763
|
this.formio.saveSubmission(draft).then((sub) => {
|
|
@@ -823,7 +830,9 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
823
830
|
};
|
|
824
831
|
}
|
|
825
832
|
// Metadata needs to be available before setValue
|
|
826
|
-
this._submission.metadata = submission.metadata
|
|
833
|
+
this._submission.metadata = submission.metadata
|
|
834
|
+
? lodash_1.default.cloneDeep(submission.metadata)
|
|
835
|
+
: {};
|
|
827
836
|
this.editing = !!submission._id;
|
|
828
837
|
// Set the timezone in the options if available.
|
|
829
838
|
if (!this.options.submissionTimezone &&
|
|
@@ -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) {
|
|
@@ -179,15 +179,8 @@ class CheckBoxComponent extends Field_1.default {
|
|
|
179
179
|
return value;
|
|
180
180
|
}
|
|
181
181
|
setValue(value, flags = {}) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const changed = this.updateValue(value, flags);
|
|
185
|
-
if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {
|
|
186
|
-
this.redraw();
|
|
187
|
-
}
|
|
188
|
-
return changed;
|
|
189
|
-
}
|
|
190
|
-
return false;
|
|
182
|
+
this.setCheckedState(value);
|
|
183
|
+
return super.setValue(value, flags);
|
|
191
184
|
}
|
|
192
185
|
getValueAsString(value) {
|
|
193
186
|
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,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
title: '7595',
|
|
5
|
+
name: '7595',
|
|
6
|
+
path: '7595',
|
|
7
|
+
type: 'form',
|
|
8
|
+
display: 'form',
|
|
9
|
+
components: [
|
|
10
|
+
{
|
|
11
|
+
label: 'Checkbox',
|
|
12
|
+
tableView: false,
|
|
13
|
+
validateWhenHidden: false,
|
|
14
|
+
key: 'checkboxBefore',
|
|
15
|
+
conditional: {
|
|
16
|
+
show: true,
|
|
17
|
+
conjunction: 'all',
|
|
18
|
+
conditions: [
|
|
19
|
+
{
|
|
20
|
+
component: 'textField',
|
|
21
|
+
operator: 'isNotEmpty'
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
type: 'checkbox',
|
|
26
|
+
input: true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: 'Text Field',
|
|
30
|
+
applyMaskOn: 'change',
|
|
31
|
+
tableView: true,
|
|
32
|
+
key: 'textField',
|
|
33
|
+
type: 'textfield',
|
|
34
|
+
input: true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: 'Checkbox',
|
|
38
|
+
tableView: false,
|
|
39
|
+
validateWhenHidden: false,
|
|
40
|
+
key: 'checkboxAfter',
|
|
41
|
+
conditional: {
|
|
42
|
+
show: true,
|
|
43
|
+
conjunction: 'all',
|
|
44
|
+
conditions: [
|
|
45
|
+
{
|
|
46
|
+
component: 'textField',
|
|
47
|
+
operator: 'isNotEmpty'
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
type: 'checkbox',
|
|
52
|
+
input: true
|
|
53
|
+
},
|
|
54
|
+
]
|
|
55
|
+
};
|
|
@@ -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,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.customDefaultComponent = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
6
|
+
exports.customDefaultComponent = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
|
8
8
|
exports.comp1 = comp1_1.default;
|
|
9
9
|
const customDefaultComponent_1 = __importDefault(require("./customDefaultComponent"));
|
|
@@ -14,3 +14,5 @@ const comp3_1 = __importDefault(require("./comp3"));
|
|
|
14
14
|
exports.comp3 = comp3_1.default;
|
|
15
15
|
const comp4_1 = __importDefault(require("./comp4"));
|
|
16
16
|
exports.comp4 = comp4_1.default;
|
|
17
|
+
const comp5_1 = __importDefault(require("./comp5"));
|
|
18
|
+
exports.comp5 = comp5_1.default;
|
|
@@ -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;
|
|
@@ -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 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
226
226
|
}
|
|
227
227
|
return false;
|
|
228
228
|
}
|
|
229
|
-
getValueAsString(value) {
|
|
229
|
+
getValueAsString(value, options = {}) {
|
|
230
230
|
if (lodash_1.default.isObject(value)) {
|
|
231
231
|
value = JSON.stringify(value);
|
|
232
232
|
}
|
|
233
233
|
else if (!lodash_1.default.isString(value)) {
|
|
234
234
|
value = lodash_1.default.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 = lodash_1.default.find(values, (v) => v.value === value);
|
|
240
242
|
if (!value) {
|
|
241
243
|
return lodash_1.default.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;
|
|
@@ -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) {
|
|
@@ -1470,6 +1471,10 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1470
1471
|
asString(value, options = {}) {
|
|
1471
1472
|
var _a;
|
|
1472
1473
|
value = value !== null && value !== void 0 ? value : this.getValue();
|
|
1474
|
+
if (options.modalPreview && this.selectData) {
|
|
1475
|
+
const { label } = this.selectValueAndLabel(value);
|
|
1476
|
+
return label;
|
|
1477
|
+
}
|
|
1473
1478
|
//need to convert values to strings to be able to compare values with available options that are strings
|
|
1474
1479
|
const convertToString = (data, valueProperty) => {
|
|
1475
1480
|
if (valueProperty) {
|
|
@@ -5,15 +5,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const utils_1 = require("../../../utils/utils");
|
|
8
|
-
const
|
|
8
|
+
const calculateSingleSelectData = (context, defaultValue) => {
|
|
9
9
|
const { instance, data } = context;
|
|
10
|
-
const rawDefaultValue = instance.downloadedResources.find(resource => lodash_1.default.get(resource, data.valueProperty) ===
|
|
10
|
+
const rawDefaultValue = instance.downloadedResources.find(resource => lodash_1.default.get(resource, data.valueProperty) === defaultValue);
|
|
11
11
|
const options = { data: {}, noeval: true };
|
|
12
12
|
instance.interpolate(data.template, {
|
|
13
13
|
item: rawDefaultValue,
|
|
14
14
|
}, options);
|
|
15
15
|
return options.data.item;
|
|
16
16
|
};
|
|
17
|
+
const calculateSelectData = (context) => {
|
|
18
|
+
const { instance } = context;
|
|
19
|
+
const defaultValue = instance.getValue();
|
|
20
|
+
if (instance.component.multiple) {
|
|
21
|
+
const multiSelectData = {};
|
|
22
|
+
(defaultValue !== null && defaultValue !== void 0 ? defaultValue : []).forEach((defaultValueItem) => {
|
|
23
|
+
multiSelectData[defaultValueItem] = calculateSingleSelectData(context, defaultValueItem);
|
|
24
|
+
});
|
|
25
|
+
return multiSelectData;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return calculateSingleSelectData(context, defaultValue);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
17
31
|
const setSelectData = (context) => {
|
|
18
32
|
// Wait before downloadedResources will be set
|
|
19
33
|
setTimeout(() => {
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
url: string;
|
|
14
|
+
headers: {
|
|
15
|
+
key: string;
|
|
16
|
+
value: string;
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
19
|
+
multiple: boolean;
|
|
20
|
+
valueProperty: string;
|
|
21
|
+
validateWhenHidden: boolean;
|
|
22
|
+
key: string;
|
|
23
|
+
type: string;
|
|
24
|
+
input: boolean;
|
|
25
|
+
defaultValue: string[];
|
|
26
|
+
selectValues: string;
|
|
27
|
+
disableLimit: boolean;
|
|
28
|
+
noRefreshOnScroll: boolean;
|
|
29
|
+
selectData: {
|
|
30
|
+
value1: {
|
|
31
|
+
label: string;
|
|
32
|
+
};
|
|
33
|
+
value3: {
|
|
34
|
+
label: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
disableOnInvalid?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
type: string;
|
|
40
|
+
label: string;
|
|
41
|
+
key: string;
|
|
42
|
+
disableOnInvalid: boolean;
|
|
43
|
+
input: boolean;
|
|
44
|
+
tableView: boolean;
|
|
45
|
+
widget?: undefined;
|
|
46
|
+
dataSrc?: undefined;
|
|
47
|
+
data?: undefined;
|
|
48
|
+
multiple?: undefined;
|
|
49
|
+
valueProperty?: undefined;
|
|
50
|
+
validateWhenHidden?: undefined;
|
|
51
|
+
defaultValue?: undefined;
|
|
52
|
+
selectValues?: undefined;
|
|
53
|
+
disableLimit?: undefined;
|
|
54
|
+
noRefreshOnScroll?: undefined;
|
|
55
|
+
selectData?: undefined;
|
|
56
|
+
})[];
|
|
57
|
+
}
|
|
58
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
title: 'FIO-8281',
|
|
5
|
+
name: 'fio8281',
|
|
6
|
+
path: 'fio8281',
|
|
7
|
+
type: 'form',
|
|
8
|
+
display: 'form',
|
|
9
|
+
components: [{
|
|
10
|
+
label: 'Select',
|
|
11
|
+
widget: 'choicesjs',
|
|
12
|
+
tableView: true,
|
|
13
|
+
dataSrc: 'url',
|
|
14
|
+
data: {
|
|
15
|
+
url: 'https://fake_url.com',
|
|
16
|
+
headers: [
|
|
17
|
+
{
|
|
18
|
+
key: '',
|
|
19
|
+
value: ''
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
multiple: true,
|
|
24
|
+
valueProperty: 'value',
|
|
25
|
+
validateWhenHidden: false,
|
|
26
|
+
key: 'select',
|
|
27
|
+
type: 'select',
|
|
28
|
+
input: true,
|
|
29
|
+
defaultValue: ['value1', 'value3'],
|
|
30
|
+
selectValues: 'data',
|
|
31
|
+
disableLimit: false,
|
|
32
|
+
noRefreshOnScroll: false,
|
|
33
|
+
selectData: {
|
|
34
|
+
value1: {
|
|
35
|
+
label: 'Label 1',
|
|
36
|
+
},
|
|
37
|
+
value3: {
|
|
38
|
+
label: 'Label 3',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}, {
|
|
42
|
+
type: 'button',
|
|
43
|
+
label: 'Submit',
|
|
44
|
+
key: 'submit',
|
|
45
|
+
disableOnInvalid: true,
|
|
46
|
+
input: true,
|
|
47
|
+
tableView: false,
|
|
48
|
+
}]
|
|
49
|
+
};
|