@formio/js 5.0.0-rc.46 → 5.0.0-rc.48
Sign up to get free protection for your applications and to get access to all the features.
- 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 +11 -11
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +11 -11
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +2 -2
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Webform.d.ts +11 -1
- package/lib/cjs/Webform.js +3 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +4 -4
- package/lib/cjs/components/_classes/component/Component.js +5 -7
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +5 -6
- package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -5
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -1
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
- package/lib/cjs/components/day/Day.d.ts +1 -0
- package/lib/cjs/components/html/HTML.js +2 -2
- package/lib/cjs/components/select/Select.d.ts +4 -1
- package/lib/cjs/components/select/Select.js +57 -34
- package/lib/cjs/components/select/fixtures/comp22.d.ts +51 -0
- package/lib/cjs/components/select/fixtures/comp22.js +43 -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/utils/Evaluator.d.ts +1 -3
- package/lib/cjs/utils/Evaluator.js +1 -5
- package/lib/mjs/Webform.d.ts +11 -1
- package/lib/mjs/Webform.js +3 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +4 -4
- package/lib/mjs/components/_classes/component/Component.js +5 -7
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +5 -6
- package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -5
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -1
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
- package/lib/mjs/components/day/Day.d.ts +1 -0
- package/lib/mjs/components/html/HTML.js +2 -2
- package/lib/mjs/components/select/Select.d.ts +4 -1
- package/lib/mjs/components/select/Select.js +56 -33
- package/lib/mjs/components/select/fixtures/comp22.d.ts +51 -0
- package/lib/mjs/components/select/fixtures/comp22.js +41 -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/utils/Evaluator.d.ts +1 -3
- package/lib/mjs/utils/Evaluator.js +1 -5
- package/package.json +2 -2
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
/*! @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 */
|
22
22
|
|
23
|
-
/*! formiojs v5.0.0-rc.
|
23
|
+
/*! formiojs v5.0.0-rc.48 | https://unpkg.com/formiojs@5.0.0-rc.48/LICENSE.txt */
|
24
24
|
|
25
25
|
/**
|
26
26
|
* @license
|
package/lib/cjs/Webform.d.ts
CHANGED
@@ -79,6 +79,8 @@
|
|
79
79
|
* @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
|
80
80
|
* @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
|
81
81
|
* @property {boolean} [showCheckboxBackground] - Show the checkbox background.
|
82
|
+
* @property {boolean} [inputsOnly] - Only show inputs in the form and no labels.
|
83
|
+
* @property {boolean} [building] - If we are in the process of building the form.
|
82
84
|
* @property {number} [zoom] - The zoom for PDF forms.
|
83
85
|
*/
|
84
86
|
/**
|
@@ -469,7 +471,7 @@ declare class Webform extends NestedDataComponent {
|
|
469
471
|
*
|
470
472
|
* @returns {Promise} - A promise when the form is done submitting.
|
471
473
|
*/
|
472
|
-
submit(before
|
474
|
+
submit(before?: boolean, options?: {}): Promise<any>;
|
473
475
|
submitUrl(URL: any, headers: any): void;
|
474
476
|
triggerRecaptcha(): void;
|
475
477
|
_nosubmit: any;
|
@@ -685,6 +687,14 @@ export type FormOptions = {
|
|
685
687
|
* - Show the checkbox background.
|
686
688
|
*/
|
687
689
|
showCheckboxBackground?: boolean | undefined;
|
690
|
+
/**
|
691
|
+
* - Only show inputs in the form and no labels.
|
692
|
+
*/
|
693
|
+
inputsOnly?: boolean | undefined;
|
694
|
+
/**
|
695
|
+
* - If we are in the process of building the form.
|
696
|
+
*/
|
697
|
+
building?: boolean | undefined;
|
688
698
|
/**
|
689
699
|
* - The zoom for PDF forms.
|
690
700
|
*/
|
package/lib/cjs/Webform.js
CHANGED
@@ -121,6 +121,8 @@ function getOptions(options) {
|
|
121
121
|
* @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
|
122
122
|
* @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
|
123
123
|
* @property {boolean} [showCheckboxBackground] - Show the checkbox background.
|
124
|
+
* @property {boolean} [inputsOnly] - Only show inputs in the form and no labels.
|
125
|
+
* @property {boolean} [building] - If we are in the process of building the form.
|
124
126
|
* @property {number} [zoom] - The zoom for PDF forms.
|
125
127
|
*/
|
126
128
|
/**
|
@@ -1438,7 +1440,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
1438
1440
|
*
|
1439
1441
|
* @returns {Promise} - A promise when the form is done submitting.
|
1440
1442
|
*/
|
1441
|
-
submit(before, options = {}) {
|
1443
|
+
submit(before = null, options = {}) {
|
1442
1444
|
this.submissionInProcess = true;
|
1443
1445
|
if (!before) {
|
1444
1446
|
return this.beforeSubmit(options).then(() => this.executeSubmit(options));
|
@@ -275,14 +275,14 @@ declare class Component extends Element {
|
|
275
275
|
getFormattedAttribute(attr: any): any;
|
276
276
|
getFormattedTooltip(tooltipValue: any): any;
|
277
277
|
isHtmlRenderMode(): boolean;
|
278
|
-
renderTemplate(name: any, data
|
278
|
+
renderTemplate(name: any, data?: {}, modeOption?: string): any;
|
279
279
|
/**
|
280
280
|
* Sanitize an html string.
|
281
281
|
*
|
282
282
|
* @param string
|
283
283
|
* @returns {*}
|
284
284
|
*/
|
285
|
-
sanitize(dirty: any, forceSanitize
|
285
|
+
sanitize(dirty: any, forceSanitize?: boolean, options?: {}): any;
|
286
286
|
/**
|
287
287
|
* Render a template string into html.
|
288
288
|
*
|
@@ -761,7 +761,7 @@ declare class Component extends Element {
|
|
761
761
|
* @param {*} silentCheck
|
762
762
|
* @returns
|
763
763
|
*/
|
764
|
-
checkValidity(data
|
764
|
+
checkValidity(data?: any, dirty?: any, row?: any, silentCheck?: any, errors?: any[]): boolean;
|
765
765
|
checkAsyncValidity(data: any, dirty: any, row: any, silentCheck: any, errors?: any[]): boolean;
|
766
766
|
/**
|
767
767
|
* Check the conditions, calculations, and validity of a single component and triggers an update if
|
@@ -828,7 +828,7 @@ declare class Component extends Element {
|
|
828
828
|
};
|
829
829
|
autofocus(): void;
|
830
830
|
scrollIntoView(element?: any): void;
|
831
|
-
focus(index
|
831
|
+
focus(index?: number): void;
|
832
832
|
/**
|
833
833
|
* Get `Formio` instance for working with files
|
834
834
|
*/
|
@@ -853,7 +853,7 @@ class Component extends Element_1.default {
|
|
853
853
|
isHtmlRenderMode() {
|
854
854
|
return this.options.renderMode === 'html';
|
855
855
|
}
|
856
|
-
renderTemplate(name, data = {}, modeOption) {
|
856
|
+
renderTemplate(name, data = {}, modeOption = '') {
|
857
857
|
// Need to make this fall back to form if renderMode is not found similar to how we search templates.
|
858
858
|
const mode = modeOption || this.options.renderMode || 'form';
|
859
859
|
data.component = this.component;
|
@@ -897,7 +897,7 @@ class Component extends Element_1.default {
|
|
897
897
|
* @param string
|
898
898
|
* @returns {*}
|
899
899
|
*/
|
900
|
-
sanitize(dirty, forceSanitize, options) {
|
900
|
+
sanitize(dirty, forceSanitize = false, options = {}) {
|
901
901
|
var _a;
|
902
902
|
if (!this.shouldSanitizeValue && !forceSanitize) {
|
903
903
|
return dirty;
|
@@ -2783,7 +2783,7 @@ class Component extends Element_1.default {
|
|
2783
2783
|
* @param {*} silentCheck
|
2784
2784
|
* @returns
|
2785
2785
|
*/
|
2786
|
-
checkValidity(data, dirty, row, silentCheck, errors = []) {
|
2786
|
+
checkValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
2787
2787
|
data = data || this.rootValue;
|
2788
2788
|
row = row || this.data;
|
2789
2789
|
console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
@@ -3190,15 +3190,13 @@ class Component extends Element_1.default {
|
|
3190
3190
|
const { left, top } = element.getBoundingClientRect();
|
3191
3191
|
window.scrollTo(left + window.scrollX, top + window.scrollY);
|
3192
3192
|
}
|
3193
|
-
focus(index) {
|
3193
|
+
focus(index = (this.refs.input.length - 1)) {
|
3194
3194
|
var _a, _b;
|
3195
3195
|
if ('beforeFocus' in this.parent) {
|
3196
3196
|
this.parent.beforeFocus(this);
|
3197
3197
|
}
|
3198
3198
|
if ((_a = this.refs.input) === null || _a === void 0 ? void 0 : _a.length) {
|
3199
|
-
const focusingInput =
|
3200
|
-
? this.refs.input[index]
|
3201
|
-
: this.refs.input[this.refs.input.length - 1];
|
3199
|
+
const focusingInput = this.refs.input[index];
|
3202
3200
|
if (((_b = this.component.widget) === null || _b === void 0 ? void 0 : _b.type) === 'calendar') {
|
3203
3201
|
const sibling = focusingInput.nextSibling;
|
3204
3202
|
if (sibling) {
|
@@ -17,7 +17,7 @@ export default class NestedComponent extends Field {
|
|
17
17
|
*
|
18
18
|
* @param {function} fn - Called for every component.
|
19
19
|
*/
|
20
|
-
everyComponent(fn: Function, options
|
20
|
+
everyComponent(fn: Function, options?: {}): void;
|
21
21
|
hasComponent(component: any): boolean;
|
22
22
|
flattenComponents(): {};
|
23
23
|
/**
|
@@ -43,7 +43,7 @@ export default class NestedComponent extends Field {
|
|
43
43
|
* @param {function} fn - Called with the component once it is retrieved.
|
44
44
|
* @return {Object} - The component retrieved.
|
45
45
|
*/
|
46
|
-
getComponentById(id: string, fn
|
46
|
+
getComponentById(id: string, fn?: Function): Object;
|
47
47
|
/**
|
48
48
|
* Create a new component and add it to the components array.
|
49
49
|
*
|
@@ -70,7 +70,7 @@ export default class NestedComponent extends Field {
|
|
70
70
|
* @param {HTMLElement} before - A DOM element to insert this element before.
|
71
71
|
* @return {Component} - The created component instance.
|
72
72
|
*/
|
73
|
-
addComponent(component: Object, data
|
73
|
+
addComponent(component: Object, data?: Object, before?: HTMLElement, noAdd?: boolean): Component;
|
74
74
|
beforeFocus(): void;
|
75
75
|
renderComponents(components: any): any;
|
76
76
|
attach(element: any): Promise<[void, void]>;
|
@@ -90,7 +90,7 @@ export default class NestedComponent extends Field {
|
|
90
90
|
* @param {function} fn - Called once the component is removed.
|
91
91
|
* @return {null}
|
92
92
|
*/
|
93
|
-
removeComponentByKey(key: string, fn
|
93
|
+
removeComponentByKey(key: string, fn?: Function): null;
|
94
94
|
/**
|
95
95
|
* Removes a component provided the Id of the component.
|
96
96
|
*
|
@@ -98,7 +98,7 @@ export default class NestedComponent extends Field {
|
|
98
98
|
* @param {function} fn - Called when the component is removed.
|
99
99
|
* @return {null}
|
100
100
|
*/
|
101
|
-
removeComponentById(id: string, fn
|
101
|
+
removeComponentById(id: string, fn?: Function): null;
|
102
102
|
updateValue(value: any, flags?: {}): any;
|
103
103
|
shouldSkipValidation(data: any, row: any, flags: any): boolean;
|
104
104
|
checkData(data: any, flags: any, row: any, components: any): true | undefined;
|
@@ -136,7 +136,6 @@ export default class NestedComponent extends Field {
|
|
136
136
|
*/
|
137
137
|
validate(data: any, flags?: any): any;
|
138
138
|
checkComponentValidity(data: any, dirty: any, row: any, flags?: {}, allErrors?: any[]): boolean;
|
139
|
-
checkValidity(data: any, dirty: any, row: any, silentCheck: any, childErrors?: any[]): boolean;
|
140
139
|
checkAsyncValidity(data: any, dirty: any, row: any, silentCheck: any): Promise<any>;
|
141
140
|
setPristine(pristine: any): void;
|
142
141
|
get isPristine(): any;
|
@@ -142,7 +142,7 @@ class NestedComponent extends Field_1.default {
|
|
142
142
|
*
|
143
143
|
* @param {function} fn - Called for every component.
|
144
144
|
*/
|
145
|
-
everyComponent(fn, options) {
|
145
|
+
everyComponent(fn, options = {}) {
|
146
146
|
const components = this.getComponents();
|
147
147
|
lodash_1.default.each(components, (component, index) => {
|
148
148
|
if (fn(component, components, index) === false) {
|
@@ -244,7 +244,7 @@ class NestedComponent extends Field_1.default {
|
|
244
244
|
* @param {function} fn - Called with the component once it is retrieved.
|
245
245
|
* @return {Object} - The component retrieved.
|
246
246
|
*/
|
247
|
-
getComponentById(id, fn) {
|
247
|
+
getComponentById(id, fn = null) {
|
248
248
|
let comp = null;
|
249
249
|
this.everyComponent((component, components) => {
|
250
250
|
if (component.id === id) {
|
@@ -347,7 +347,7 @@ class NestedComponent extends Field_1.default {
|
|
347
347
|
* @param {HTMLElement} before - A DOM element to insert this element before.
|
348
348
|
* @return {Component} - The created component instance.
|
349
349
|
*/
|
350
|
-
addComponent(component, data, before, noAdd) {
|
350
|
+
addComponent(component, data = null, before = null, noAdd = false) {
|
351
351
|
data = data || this.data;
|
352
352
|
this.components = this.components || [];
|
353
353
|
component = this.hook('addComponent', component, data, before, noAdd);
|
@@ -456,7 +456,7 @@ class NestedComponent extends Field_1.default {
|
|
456
456
|
* @param {function} fn - Called once the component is removed.
|
457
457
|
* @return {null}
|
458
458
|
*/
|
459
|
-
removeComponentByKey(key, fn) {
|
459
|
+
removeComponentByKey(key, fn = null) {
|
460
460
|
const comp = this.getComponent(key, (component, components) => {
|
461
461
|
this.removeComponent(component, components);
|
462
462
|
if (fn) {
|
@@ -477,7 +477,7 @@ class NestedComponent extends Field_1.default {
|
|
477
477
|
* @param {function} fn - Called when the component is removed.
|
478
478
|
* @return {null}
|
479
479
|
*/
|
480
|
-
removeComponentById(id, fn) {
|
480
|
+
removeComponentById(id, fn = null) {
|
481
481
|
const comp = this.getComponentById(id, (component, components) => {
|
482
482
|
this.removeComponent(component, components);
|
483
483
|
if (fn) {
|
@@ -11,7 +11,7 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
11
11
|
processRow(method: any, data: any, opts: any, row: any, components: any, silentCheck: any): any;
|
12
12
|
hasAddButton(): any;
|
13
13
|
getComponent(path: any, fn: any, originalPath: any): any;
|
14
|
-
everyComponent(fn: any, rowIndex: any, options
|
14
|
+
everyComponent(fn: any, rowIndex: any, options?: {}): void;
|
15
15
|
getComponents(rowIndex: any): any;
|
16
16
|
}
|
17
17
|
import NestedDataComponent from '../nesteddata/NestedDataComponent';
|
@@ -129,7 +129,7 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
|
|
129
129
|
}
|
130
130
|
return result;
|
131
131
|
}
|
132
|
-
everyComponent(fn, rowIndex, options) {
|
132
|
+
everyComponent(fn, rowIndex, options = {}) {
|
133
133
|
if (lodash_1.default.isObject(rowIndex)) {
|
134
134
|
options = rowIndex;
|
135
135
|
rowIndex = null;
|
@@ -5,7 +5,7 @@ export default class NestedDataComponent extends NestedComponent {
|
|
5
5
|
get emptyValue(): {};
|
6
6
|
getValueAsString(value: any, options: any): string;
|
7
7
|
getDataValueAsTable(value: any, options: any): string;
|
8
|
-
everyComponent(fn: any, options
|
8
|
+
everyComponent(fn: any, options?: {}): void;
|
9
9
|
updateValue(value: any, flags?: {}): boolean;
|
10
10
|
setValue(value: any, flags?: {}): boolean;
|
11
11
|
}
|
@@ -85,7 +85,7 @@ class NestedDataComponent extends NestedComponent_1.default {
|
|
85
85
|
`);
|
86
86
|
return result;
|
87
87
|
}
|
88
|
-
everyComponent(fn, options) {
|
88
|
+
everyComponent(fn, options = {}) {
|
89
89
|
if (options === null || options === void 0 ? void 0 : options.email) {
|
90
90
|
if (options.fromRoot) {
|
91
91
|
delete options.fromRoot;
|
@@ -92,8 +92,8 @@ class HTMLComponent extends Component_1.default {
|
|
92
92
|
attach(element) {
|
93
93
|
this.loadRefs(element, { html: 'single' });
|
94
94
|
this.dataReady.then(() => {
|
95
|
-
if (this.
|
96
|
-
this.setContent(this.
|
95
|
+
if (this.refs.html) {
|
96
|
+
this.setContent(this.refs.html, this.content);
|
97
97
|
}
|
98
98
|
});
|
99
99
|
return super.attach(element);
|
@@ -59,6 +59,7 @@ export default class SelectComponent extends ListComponent {
|
|
59
59
|
get itemsFromUrl(): boolean;
|
60
60
|
get isInfiniteScrollProvided(): boolean;
|
61
61
|
get shouldInitialLoad(): any;
|
62
|
+
get selectMetadata(): any;
|
62
63
|
isEntireObjectDisplay(): boolean;
|
63
64
|
selectValueAndLabel(data: any): {
|
64
65
|
value: any;
|
@@ -119,7 +120,9 @@ export default class SelectComponent extends ListComponent {
|
|
119
120
|
* @param {Array} items
|
120
121
|
*/
|
121
122
|
addCurrentChoices(values: any, items: any[], keyValue: any): any;
|
122
|
-
normalizeSingleValue(value: any
|
123
|
+
normalizeSingleValue(value: any): any;
|
124
|
+
setMetadata(value: any): any;
|
125
|
+
updateValue(value: any, flags: any): boolean;
|
123
126
|
setValue(value: any, flags?: {}): boolean;
|
124
127
|
lazyLoadInit: boolean | undefined;
|
125
128
|
isInitApiCallNeeded(hasValue: any): any;
|
@@ -217,8 +217,11 @@ class SelectComponent extends ListComponent_1.default {
|
|
217
217
|
}
|
218
218
|
return super.shouldLoad;
|
219
219
|
}
|
220
|
+
get selectMetadata() {
|
221
|
+
return super.selectData;
|
222
|
+
}
|
220
223
|
get selectData() {
|
221
|
-
return this.component.selectData ||
|
224
|
+
return this.component.selectData || this.selectMetadata;
|
222
225
|
}
|
223
226
|
isEntireObjectDisplay() {
|
224
227
|
return this.component.dataSrc === 'resource' && this.valueProperty === 'data';
|
@@ -1136,8 +1139,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1136
1139
|
this.triggerUpdate();
|
1137
1140
|
return done;
|
1138
1141
|
}
|
1139
|
-
normalizeSingleValue(value
|
1140
|
-
var _a;
|
1142
|
+
normalizeSingleValue(value) {
|
1141
1143
|
if (lodash_1.default.isNil(value)) {
|
1142
1144
|
return;
|
1143
1145
|
}
|
@@ -1146,33 +1148,6 @@ class SelectComponent extends ListComponent_1.default {
|
|
1146
1148
|
if (valueIsObject && Object.keys(value).length === 0) {
|
1147
1149
|
return value;
|
1148
1150
|
}
|
1149
|
-
// Check to see if we need to save off the template data into our metadata.
|
1150
|
-
if (retainObject) {
|
1151
|
-
const templateValue = this.component.reference && (value === null || value === void 0 ? void 0 : value._id) ? value._id.toString() : value;
|
1152
|
-
const shouldSaveData = !valueIsObject || this.component.reference;
|
1153
|
-
if (templateValue && shouldSaveData && (this.templateData && this.templateData[templateValue]) && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submission)) {
|
1154
|
-
const submission = this.root.submission;
|
1155
|
-
if (!submission.metadata) {
|
1156
|
-
submission.metadata = {};
|
1157
|
-
}
|
1158
|
-
if (!submission.metadata.selectData) {
|
1159
|
-
submission.metadata.selectData = {};
|
1160
|
-
}
|
1161
|
-
let templateData = this.templateData[templateValue];
|
1162
|
-
if (this.component.multiple) {
|
1163
|
-
templateData = {};
|
1164
|
-
const dataValue = this.dataValue;
|
1165
|
-
if (dataValue && lodash_1.default.isArray(dataValue) && dataValue.length) {
|
1166
|
-
dataValue.forEach((dataValueItem) => {
|
1167
|
-
const dataValueItemValue = this.component.reference ? dataValueItem._id.toString() : dataValueItem;
|
1168
|
-
templateData[dataValueItemValue] = this.templateData[dataValueItemValue];
|
1169
|
-
});
|
1170
|
-
}
|
1171
|
-
templateData[value] = this.templateData[value];
|
1172
|
-
}
|
1173
|
-
lodash_1.default.set(submission.metadata.selectData, this.path, templateData);
|
1174
|
-
}
|
1175
|
-
}
|
1176
1151
|
const dataType = this.component.dataType || 'auto';
|
1177
1152
|
const normalize = {
|
1178
1153
|
value,
|
@@ -1225,16 +1200,64 @@ class SelectComponent extends ListComponent_1.default {
|
|
1225
1200
|
*/
|
1226
1201
|
normalizeValue(value) {
|
1227
1202
|
if (this.component.multiple && Array.isArray(value)) {
|
1228
|
-
return value.map((singleValue) => this.normalizeSingleValue(singleValue
|
1203
|
+
return value.map((singleValue) => this.normalizeSingleValue(singleValue));
|
1204
|
+
}
|
1205
|
+
return super.normalizeValue(this.normalizeSingleValue(value));
|
1206
|
+
}
|
1207
|
+
setMetadata(value) {
|
1208
|
+
var _a;
|
1209
|
+
if (lodash_1.default.isNil(value)) {
|
1210
|
+
return;
|
1211
|
+
}
|
1212
|
+
const valueIsObject = lodash_1.default.isObject(value);
|
1213
|
+
//check if value equals to default emptyValue
|
1214
|
+
if (valueIsObject && Object.keys(value).length === 0) {
|
1215
|
+
return value;
|
1216
|
+
}
|
1217
|
+
// Check to see if we need to save off the template data into our metadata.
|
1218
|
+
const templateValue = this.component.reference && (value === null || value === void 0 ? void 0 : value._id) ? value._id.toString() : value;
|
1219
|
+
const shouldSaveData = !valueIsObject || this.component.reference;
|
1220
|
+
if (templateValue && shouldSaveData && this.templateData && this.templateData[templateValue] && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submission)) {
|
1221
|
+
const submission = this.root.submission;
|
1222
|
+
if (!submission.metadata) {
|
1223
|
+
submission.metadata = {};
|
1224
|
+
}
|
1225
|
+
if (!submission.metadata.selectData) {
|
1226
|
+
submission.metadata.selectData = {};
|
1227
|
+
}
|
1228
|
+
let templateData = this.templateData[templateValue];
|
1229
|
+
if (this.component.multiple) {
|
1230
|
+
templateData = {};
|
1231
|
+
const dataValue = this.dataValue;
|
1232
|
+
if (dataValue && lodash_1.default.isArray(dataValue) && dataValue.length) {
|
1233
|
+
dataValue.forEach((dataValueItem) => {
|
1234
|
+
const dataValueItemValue = this.component.reference ? dataValueItem._id.toString() : dataValueItem;
|
1235
|
+
templateData[dataValueItemValue] = this.templateData[dataValueItemValue];
|
1236
|
+
});
|
1237
|
+
}
|
1238
|
+
templateData[value] = this.templateData[value];
|
1239
|
+
}
|
1240
|
+
lodash_1.default.set(submission.metadata.selectData, this.path, templateData);
|
1229
1241
|
}
|
1230
|
-
|
1242
|
+
}
|
1243
|
+
updateValue(value, flags) {
|
1244
|
+
const changed = super.updateValue(value, flags);
|
1245
|
+
if (changed || !this.selectMetadata) {
|
1246
|
+
if (this.component.multiple && Array.isArray(this.dataValue)) {
|
1247
|
+
this.dataValue.forEach(singleValue => this.setMetadata(singleValue));
|
1248
|
+
}
|
1249
|
+
else {
|
1250
|
+
this.setMetadata(this.dataValue);
|
1251
|
+
}
|
1252
|
+
}
|
1253
|
+
return changed;
|
1231
1254
|
}
|
1232
1255
|
setValue(value, flags = {}) {
|
1233
1256
|
const previousValue = this.dataValue;
|
1257
|
+
const changed = this.updateValue(value, flags);
|
1234
1258
|
if (this.component.widget === 'html5' && (lodash_1.default.isEqual(value, previousValue) || lodash_1.default.isEqual(previousValue, {}) && lodash_1.default.isEqual(flags, {})) && !flags.fromSubmission) {
|
1235
1259
|
return false;
|
1236
1260
|
}
|
1237
|
-
const changed = this.updateValue(value, flags);
|
1238
1261
|
value = this.dataValue;
|
1239
1262
|
const hasPreviousValue = !this.isEmpty(previousValue);
|
1240
1263
|
const hasValue = !this.isEmpty(value);
|
@@ -1349,7 +1372,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1349
1372
|
if (values) {
|
1350
1373
|
if (lodash_1.default.isObject(value)) {
|
1351
1374
|
const compareComplexValues = (optionValue) => {
|
1352
|
-
const normalizedOptionValue = this.normalizeSingleValue(optionValue
|
1375
|
+
const normalizedOptionValue = this.normalizeSingleValue(optionValue);
|
1353
1376
|
if (!lodash_1.default.isObject(normalizedOptionValue)) {
|
1354
1377
|
return false;
|
1355
1378
|
}
|
@@ -0,0 +1,51 @@
|
|
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
|
+
valueProperty: string;
|
20
|
+
validateWhenHidden: boolean;
|
21
|
+
key: string;
|
22
|
+
type: string;
|
23
|
+
input: boolean;
|
24
|
+
defaultValue: string;
|
25
|
+
selectValues: string;
|
26
|
+
disableLimit: boolean;
|
27
|
+
noRefreshOnScroll: boolean;
|
28
|
+
selectData: {
|
29
|
+
label: string;
|
30
|
+
};
|
31
|
+
disableOnInvalid?: undefined;
|
32
|
+
} | {
|
33
|
+
type: string;
|
34
|
+
label: string;
|
35
|
+
key: string;
|
36
|
+
disableOnInvalid: boolean;
|
37
|
+
input: boolean;
|
38
|
+
tableView: boolean;
|
39
|
+
widget?: undefined;
|
40
|
+
dataSrc?: undefined;
|
41
|
+
data?: undefined;
|
42
|
+
valueProperty?: undefined;
|
43
|
+
validateWhenHidden?: undefined;
|
44
|
+
defaultValue?: undefined;
|
45
|
+
selectValues?: undefined;
|
46
|
+
disableLimit?: undefined;
|
47
|
+
noRefreshOnScroll?: undefined;
|
48
|
+
selectData?: undefined;
|
49
|
+
})[];
|
50
|
+
}
|
51
|
+
export default _default;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
title: 'FIO-8091',
|
5
|
+
name: 'fio8091',
|
6
|
+
path: 'fio8091',
|
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',
|
16
|
+
headers: [
|
17
|
+
{
|
18
|
+
key: '',
|
19
|
+
value: ''
|
20
|
+
},
|
21
|
+
],
|
22
|
+
},
|
23
|
+
valueProperty: 'value',
|
24
|
+
validateWhenHidden: false,
|
25
|
+
key: 'select',
|
26
|
+
type: 'select',
|
27
|
+
input: true,
|
28
|
+
defaultValue: 'value1',
|
29
|
+
selectValues: 'data',
|
30
|
+
disableLimit: false,
|
31
|
+
noRefreshOnScroll: false,
|
32
|
+
selectData: {
|
33
|
+
label: 'Label 1'
|
34
|
+
},
|
35
|
+
}, {
|
36
|
+
type: 'button',
|
37
|
+
label: 'Submit',
|
38
|
+
key: 'submit',
|
39
|
+
disableOnInvalid: true,
|
40
|
+
input: true,
|
41
|
+
tableView: false,
|
42
|
+
}],
|
43
|
+
};
|
@@ -18,5 +18,6 @@ import comp18 from './comp18';
|
|
18
18
|
import comp19 from './comp19';
|
19
19
|
import comp20 from './comp20';
|
20
20
|
import comp21 from './comp21';
|
21
|
-
|
21
|
+
import comp22 from './comp22';
|
22
|
+
export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22 };
|
22
23
|
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.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.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"));
|
@@ -47,3 +47,5 @@ const comp20_1 = __importDefault(require("./comp20"));
|
|
47
47
|
exports.comp20 = comp20_1.default;
|
48
48
|
const comp21_1 = __importDefault(require("./comp21"));
|
49
49
|
exports.comp21 = comp21_1.default;
|
50
|
+
const comp22_1 = __importDefault(require("./comp22"));
|
51
|
+
exports.comp22 = comp22_1.default;
|
@@ -1,10 +1,8 @@
|
|
1
1
|
export class Evaluator {
|
2
2
|
static cache: {};
|
3
3
|
static protectedEval: boolean;
|
4
|
+
static noeval: boolean;
|
4
5
|
static template(template: any, hash: any): any;
|
5
6
|
static interpolate(rawTemplate: any, data: any, _options: any): any;
|
6
7
|
static evaluate(func: any, args: any): any;
|
7
8
|
}
|
8
|
-
export namespace Evaluator {
|
9
|
-
function registerEvaluator(evaluator: any): void;
|
10
|
-
}
|
@@ -60,8 +60,4 @@ class Evaluator extends utils_1.Evaluator {
|
|
60
60
|
exports.Evaluator = Evaluator;
|
61
61
|
Evaluator.cache = {};
|
62
62
|
Evaluator.protectedEval = false;
|
63
|
-
Evaluator.
|
64
|
-
Object.keys(evaluator).forEach((key) => {
|
65
|
-
Evaluator[key] = evaluator[key];
|
66
|
-
});
|
67
|
-
};
|
63
|
+
Evaluator.noeval = false;
|
package/lib/mjs/Webform.d.ts
CHANGED
@@ -79,6 +79,8 @@
|
|
79
79
|
* @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
|
80
80
|
* @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
|
81
81
|
* @property {boolean} [showCheckboxBackground] - Show the checkbox background.
|
82
|
+
* @property {boolean} [inputsOnly] - Only show inputs in the form and no labels.
|
83
|
+
* @property {boolean} [building] - If we are in the process of building the form.
|
82
84
|
* @property {number} [zoom] - The zoom for PDF forms.
|
83
85
|
*/
|
84
86
|
/**
|
@@ -469,7 +471,7 @@ declare class Webform extends NestedDataComponent {
|
|
469
471
|
*
|
470
472
|
* @returns {Promise} - A promise when the form is done submitting.
|
471
473
|
*/
|
472
|
-
submit(before
|
474
|
+
submit(before?: boolean, options?: {}): Promise<any>;
|
473
475
|
submitUrl(URL: any, headers: any): void;
|
474
476
|
triggerRecaptcha(): void;
|
475
477
|
_nosubmit: any;
|
@@ -685,6 +687,14 @@ export type FormOptions = {
|
|
685
687
|
* - Show the checkbox background.
|
686
688
|
*/
|
687
689
|
showCheckboxBackground?: boolean | undefined;
|
690
|
+
/**
|
691
|
+
* - Only show inputs in the form and no labels.
|
692
|
+
*/
|
693
|
+
inputsOnly?: boolean | undefined;
|
694
|
+
/**
|
695
|
+
* - If we are in the process of building the form.
|
696
|
+
*/
|
697
|
+
building?: boolean | undefined;
|
688
698
|
/**
|
689
699
|
* - The zoom for PDF forms.
|
690
700
|
*/
|
package/lib/mjs/Webform.js
CHANGED
@@ -116,6 +116,8 @@ function getOptions(options) {
|
|
116
116
|
* @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
|
117
117
|
* @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
|
118
118
|
* @property {boolean} [showCheckboxBackground] - Show the checkbox background.
|
119
|
+
* @property {boolean} [inputsOnly] - Only show inputs in the form and no labels.
|
120
|
+
* @property {boolean} [building] - If we are in the process of building the form.
|
119
121
|
* @property {number} [zoom] - The zoom for PDF forms.
|
120
122
|
*/
|
121
123
|
/**
|
@@ -1438,7 +1440,7 @@ export default class Webform extends NestedDataComponent {
|
|
1438
1440
|
*
|
1439
1441
|
* @returns {Promise} - A promise when the form is done submitting.
|
1440
1442
|
*/
|
1441
|
-
submit(before, options = {}) {
|
1443
|
+
submit(before = null, options = {}) {
|
1442
1444
|
this.submissionInProcess = true;
|
1443
1445
|
if (!before) {
|
1444
1446
|
return this.beforeSubmit(options).then(() => this.executeSubmit(options));
|