@formio/js 5.0.0-dev.5719.d2d4a61 → 5.0.0-dev.5720.4409b3f
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 +15 -0
- package/dist/formio.form.js +11 -11
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +12 -12
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/Form.d.ts +2 -2
- package/lib/cjs/Form.js +9 -3
- package/lib/cjs/Webform.js +1 -2
- package/lib/cjs/WebformBuilder.js +11 -2
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -1
- package/lib/cjs/components/currency/Currency.d.ts +1 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -1
- package/lib/cjs/components/datagrid/DataGrid.js +0 -8
- package/lib/cjs/components/datamap/DataMap.js +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +1 -5
- package/lib/cjs/components/number/Number.d.ts +7 -1
- package/lib/cjs/components/number/Number.js +11 -0
- package/lib/cjs/components/number/fixtures/comp10.d.ts +18 -0
- package/lib/cjs/components/number/fixtures/comp10.js +21 -0
- package/lib/cjs/components/number/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/number/fixtures/index.js +3 -1
- package/lib/cjs/components/panel/Panel.d.ts +1 -0
- package/lib/cjs/components/panel/Panel.js +1 -0
- package/lib/cjs/components/radio/Radio.js +17 -6
- package/lib/cjs/components/radio/fixtures/comp12.d.ts +29 -0
- package/lib/cjs/components/radio/fixtures/comp12.js +36 -0
- package/lib/cjs/components/radio/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/radio/fixtures/index.js +3 -1
- package/lib/cjs/components/select/Select.d.ts +38 -0
- package/lib/cjs/components/select/Select.js +12 -2
- package/lib/cjs/components/select/fixtures/comp25.d.ts +44 -0
- package/lib/cjs/components/select/fixtures/comp25.js +59 -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/time/Time.d.ts +2 -2
- package/lib/cjs/components/time/Time.js +3 -2
- package/lib/cjs/components/time/fixtures/comp4.d.ts +166 -0
- package/lib/cjs/components/time/fixtures/comp4.js +171 -0
- package/lib/cjs/components/time/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/time/fixtures/index.js +3 -1
- package/lib/mjs/Form.d.ts +2 -2
- package/lib/mjs/Form.js +9 -3
- package/lib/mjs/Webform.js +1 -2
- package/lib/mjs/WebformBuilder.js +10 -2
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -1
- package/lib/mjs/components/currency/Currency.d.ts +1 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -1
- package/lib/mjs/components/datagrid/DataGrid.js +0 -8
- package/lib/mjs/components/datamap/DataMap.js +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +1 -5
- package/lib/mjs/components/number/Number.d.ts +7 -1
- package/lib/mjs/components/number/Number.js +11 -0
- package/lib/mjs/components/number/fixtures/comp10.d.ts +18 -0
- package/lib/mjs/components/number/fixtures/comp10.js +19 -0
- package/lib/mjs/components/number/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/number/fixtures/index.js +2 -1
- package/lib/mjs/components/panel/Panel.d.ts +1 -0
- package/lib/mjs/components/panel/Panel.js +1 -0
- package/lib/mjs/components/radio/Radio.js +17 -6
- package/lib/mjs/components/radio/fixtures/comp12.d.ts +29 -0
- package/lib/mjs/components/radio/fixtures/comp12.js +34 -0
- package/lib/mjs/components/radio/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/radio/fixtures/index.js +2 -1
- package/lib/mjs/components/select/Select.d.ts +38 -0
- package/lib/mjs/components/select/Select.js +15 -3
- package/lib/mjs/components/select/fixtures/comp25.d.ts +44 -0
- package/lib/mjs/components/select/fixtures/comp25.js +57 -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/time/Time.d.ts +2 -2
- package/lib/mjs/components/time/Time.js +3 -2
- package/lib/mjs/components/time/fixtures/comp4.d.ts +166 -0
- package/lib/mjs/components/time/fixtures/comp4.js +169 -0
- package/lib/mjs/components/time/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/time/fixtures/index.js +2 -1
- package/package.json +1 -1
package/lib/cjs/Form.d.ts
CHANGED
|
@@ -398,10 +398,10 @@ export default class Form extends Element {
|
|
|
398
398
|
getFormInitOptions(url: string, form: import('@formio/core').Form): object;
|
|
399
399
|
/**
|
|
400
400
|
* Sets the form to the JSON schema of a form.
|
|
401
|
-
* @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
|
|
401
|
+
* @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
|
|
402
402
|
* @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
|
|
403
403
|
*/
|
|
404
|
-
setForm(formParam: import('@formio/core').Form): Promise<Webform | Wizard | PDF>;
|
|
404
|
+
setForm(formParam: import('@formio/core').Form | string): Promise<Webform | Wizard | PDF>;
|
|
405
405
|
_form: any;
|
|
406
406
|
getSubmission(formio: any, opts: any): any;
|
|
407
407
|
/**
|
package/lib/cjs/Form.js
CHANGED
|
@@ -195,7 +195,7 @@ class Form extends Element_1.default {
|
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
197
197
|
* Sets the form to the JSON schema of a form.
|
|
198
|
-
* @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
|
|
198
|
+
* @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
|
|
199
199
|
* @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
|
|
200
200
|
*/
|
|
201
201
|
setForm(formParam) {
|
|
@@ -222,8 +222,14 @@ class Form extends Element_1.default {
|
|
|
222
222
|
}
|
|
223
223
|
this.loading = false;
|
|
224
224
|
this.instance = this.instance || this.create(form.display);
|
|
225
|
-
|
|
226
|
-
this.instance.setUrl
|
|
225
|
+
// If we're in builder mode, instance.setUrl is not a function, so just manually set the URL.
|
|
226
|
+
if (this.instance.setUrl) {
|
|
227
|
+
const options = this.getFormInitOptions(formParam, form);
|
|
228
|
+
this.instance.setUrl(formParam, options);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
this.instance.url = formParam;
|
|
232
|
+
}
|
|
227
233
|
this.instance.nosubmit = false;
|
|
228
234
|
this._form = this.instance.form = form;
|
|
229
235
|
if (submission) {
|
package/lib/cjs/Webform.js
CHANGED
|
@@ -826,7 +826,6 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
826
826
|
if (!submission || !submission.data) {
|
|
827
827
|
submission = {
|
|
828
828
|
data: {},
|
|
829
|
-
metadata: submission.metadata,
|
|
830
829
|
};
|
|
831
830
|
}
|
|
832
831
|
// Metadata needs to be available before setValue
|
|
@@ -1130,7 +1129,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
1130
1129
|
});
|
|
1131
1130
|
const displayedErrors = [];
|
|
1132
1131
|
if (errors.length) {
|
|
1133
|
-
errors = lodash_1.default.uniqBy(errors, (error) => error.message);
|
|
1132
|
+
errors = lodash_1.default.uniqBy(errors, (error) => { var _a, _b; return [error.message, (_a = error.component) === null || _a === void 0 ? void 0 : _a.id, (_b = error.context) === null || _b === void 0 ? void 0 : _b.path].join(); });
|
|
1134
1133
|
const createListItem = (message, index) => {
|
|
1135
1134
|
var _a, _b, _c;
|
|
1136
1135
|
const err = errors[index];
|
|
@@ -908,7 +908,11 @@ class WebformBuilder extends Component_1.default {
|
|
|
908
908
|
if (form && form.properties) {
|
|
909
909
|
this.options.properties = form.properties;
|
|
910
910
|
}
|
|
911
|
-
|
|
911
|
+
let keyboardActionsEnabled = lodash_1.default.get(this.options, 'keyboardBuilder', false) || ((_a = this.options.properties) === null || _a === void 0 ? void 0 : _a.keyboardBuilder);
|
|
912
|
+
if (typeof keyboardActionsEnabled === 'string') {
|
|
913
|
+
keyboardActionsEnabled = keyboardActionsEnabled === 'true';
|
|
914
|
+
}
|
|
915
|
+
this.keyboardActionsEnabled = keyboardActionsEnabled;
|
|
912
916
|
const isShowSubmitButton = !this.options.noDefaultSubmitButton
|
|
913
917
|
&& (!form.components.length || !form.components.find(comp => comp.key === 'submit'));
|
|
914
918
|
// Ensure there is at least a submit button.
|
|
@@ -1060,7 +1064,10 @@ class WebformBuilder extends Component_1.default {
|
|
|
1060
1064
|
'calculateValue',
|
|
1061
1065
|
'conditional',
|
|
1062
1066
|
'customConditional',
|
|
1063
|
-
'id'
|
|
1067
|
+
'id',
|
|
1068
|
+
'fields.day.required',
|
|
1069
|
+
'fields.month.required',
|
|
1070
|
+
'fields.year.required',
|
|
1064
1071
|
]));
|
|
1065
1072
|
const parentComponent = defaultValueComponent.parent;
|
|
1066
1073
|
let tabIndex = -1;
|
|
@@ -1236,6 +1243,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1236
1243
|
const previewButtons = this.componentEdit.querySelectorAll(`[${this._referenceAttributeName}="previewButton"]`);
|
|
1237
1244
|
previewButtons.forEach((previewButton) => {
|
|
1238
1245
|
this.editForm.addEventListener(previewButton, 'click', (event) => {
|
|
1246
|
+
var _a;
|
|
1239
1247
|
event.preventDefault();
|
|
1240
1248
|
this.showPreview = !this.showPreview;
|
|
1241
1249
|
this.editForm.detach();
|
|
@@ -1247,6 +1255,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1247
1255
|
helplinks: this.helplinks,
|
|
1248
1256
|
}));
|
|
1249
1257
|
this.editForm.attach(this.componentEdit.querySelector(`[${this._referenceAttributeName}="editForm"]`));
|
|
1258
|
+
this.updateComponent((_a = this.editForm.submission.data) !== null && _a !== void 0 ? _a : component);
|
|
1250
1259
|
this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
|
|
1251
1260
|
});
|
|
1252
1261
|
});
|
|
@@ -211,11 +211,12 @@ export default class NestedComponent extends Field {
|
|
|
211
211
|
calculateValue(data: any, flags: any, row: any): any;
|
|
212
212
|
isLastPage(): boolean;
|
|
213
213
|
isValid(data: any, dirty: any): any;
|
|
214
|
-
validationProcessor({ scope, data, row, instance }: {
|
|
214
|
+
validationProcessor({ scope, data, row, instance, component }: {
|
|
215
215
|
scope: any;
|
|
216
216
|
data: any;
|
|
217
217
|
row: any;
|
|
218
218
|
instance: any;
|
|
219
|
+
component: any;
|
|
219
220
|
}, flags: any): void;
|
|
220
221
|
/**
|
|
221
222
|
* Perform a validation on all child components of this nested component.
|
|
@@ -497,6 +497,7 @@ class NestedComponent extends Field_1.default {
|
|
|
497
497
|
header: 'single',
|
|
498
498
|
collapsed: this.collapsed,
|
|
499
499
|
[this.nestedKey]: 'single',
|
|
500
|
+
messageContainer: 'single-scope',
|
|
500
501
|
});
|
|
501
502
|
let childPromise = Promise.resolve();
|
|
502
503
|
if (this.refs[this.nestedKey]) {
|
|
@@ -681,8 +682,11 @@ class NestedComponent extends Field_1.default {
|
|
|
681
682
|
isValid(data, dirty) {
|
|
682
683
|
return this.getComponents().reduce((valid, comp) => comp.isValid(data, dirty) && valid, super.isValid(data, dirty));
|
|
683
684
|
}
|
|
684
|
-
validationProcessor({ scope, data, row, instance }, flags) {
|
|
685
|
+
validationProcessor({ scope, data, row, instance, component }, flags) {
|
|
685
686
|
const { dirty } = flags;
|
|
687
|
+
if (this.root.hasExtraPages && this.page !== this.root.page) {
|
|
688
|
+
instance = this.getComponentById(component.id);
|
|
689
|
+
}
|
|
686
690
|
if (!instance) {
|
|
687
691
|
return;
|
|
688
692
|
}
|
|
@@ -2,6 +2,7 @@ export default class CurrencyComponent extends NumberComponent {
|
|
|
2
2
|
constructor(component: any, options: any, data: any);
|
|
3
3
|
currencyPrefix: any;
|
|
4
4
|
currencySuffix: any;
|
|
5
|
+
parseNumber(value: any): number;
|
|
5
6
|
parseValue(value: any): string | null;
|
|
6
7
|
addZerosAndFormatValue(value: any): any;
|
|
7
8
|
stripPrefixSuffix(value: any): any;
|
|
@@ -263,13 +263,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
263
263
|
return hasHeader || ((col.label || col.title) && !col.hideLabel);
|
|
264
264
|
}, false);
|
|
265
265
|
}
|
|
266
|
-
loadRefs(element, refs) {
|
|
267
|
-
super.loadRefs(element, refs);
|
|
268
|
-
if (refs['messageContainer'] === 'single') {
|
|
269
|
-
const container = lodash_1.default.last(element.querySelectorAll(`[${this._referenceAttributeName}=messageContainer]`));
|
|
270
|
-
this.refs['messageContainer'] = container || this.refs['messageContainer'];
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
266
|
attach(element) {
|
|
274
267
|
this.loadRefs(element, {
|
|
275
268
|
[`${this.datagridKey}-row`]: 'multiple',
|
|
@@ -278,7 +271,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
278
271
|
[`${this.datagridKey}-removeRow`]: 'multiple',
|
|
279
272
|
[`${this.datagridKey}-group-header`]: 'multiple',
|
|
280
273
|
[this.datagridKey]: 'multiple',
|
|
281
|
-
'messageContainer': 'single'
|
|
282
274
|
});
|
|
283
275
|
if (this.allowReorder) {
|
|
284
276
|
this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
|
|
@@ -241,7 +241,7 @@ class DataMapComponent extends DataGrid_1.default {
|
|
|
241
241
|
delete dataValue[key];
|
|
242
242
|
const comp = components[this.valueKey];
|
|
243
243
|
comp.component.key = newKey;
|
|
244
|
-
comp.path = Components_1.default.
|
|
244
|
+
comp.path = Components_1.default.getComponentPath(comp);
|
|
245
245
|
key = newKey;
|
|
246
246
|
});
|
|
247
247
|
const valueComponent = lodash_1.default.clone(this.component.valueComponent);
|
|
@@ -490,11 +490,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
490
490
|
else {
|
|
491
491
|
this.removeClass(this.refs.component, `formio-component-${this.component.type}-row-open`);
|
|
492
492
|
}
|
|
493
|
-
|
|
494
|
-
this.loadRefs(element, {
|
|
495
|
-
messageContainer: 'single-scope',
|
|
496
|
-
});
|
|
497
|
-
return superAttach;
|
|
493
|
+
return super.attach(element);
|
|
498
494
|
}
|
|
499
495
|
flattenRowDataValue(dataValue) {
|
|
500
496
|
const flattened = {};
|
|
@@ -27,7 +27,13 @@ export default class NumberComponent extends Input {
|
|
|
27
27
|
*/
|
|
28
28
|
createNumberMask(): any;
|
|
29
29
|
isDecimalAllowed(): any;
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* parses a numeric string by removing the delimiters and replacing the decimal separator back to '.' so that it can
|
|
32
|
+
* be processed by either parseInt or parseFloat
|
|
33
|
+
* @param {string} value the value to be parsed
|
|
34
|
+
* @returns {number} a parsed number
|
|
35
|
+
*/
|
|
36
|
+
parseNumber(value: string): number;
|
|
31
37
|
setInputMask(input: any): void;
|
|
32
38
|
getValueAt(index: any): number | null;
|
|
33
39
|
setValueAt(index: any, value: any, flags?: {}): void;
|
|
@@ -91,6 +91,11 @@ class NumberComponent extends Input_1.default {
|
|
|
91
91
|
}
|
|
92
92
|
get defaultValue() {
|
|
93
93
|
let defaultValue = super.defaultValue;
|
|
94
|
+
if (typeof defaultValue === 'string') {
|
|
95
|
+
// Default value may be a string or have custom thousands separators or decimal symbols, so we need to call
|
|
96
|
+
// parseNumber on it
|
|
97
|
+
defaultValue = this.parseNumber(defaultValue);
|
|
98
|
+
}
|
|
94
99
|
if (!defaultValue && this.component.defaultValue === 0) {
|
|
95
100
|
defaultValue = this.component.defaultValue;
|
|
96
101
|
}
|
|
@@ -102,6 +107,12 @@ class NumberComponent extends Input_1.default {
|
|
|
102
107
|
isDecimalAllowed() {
|
|
103
108
|
return lodash_1.default.get(this.component, 'allowDecimal', !(this.component.validate && this.component.validate.integer));
|
|
104
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* parses a numeric string by removing the delimiters and replacing the decimal separator back to '.' so that it can
|
|
112
|
+
* be processed by either parseInt or parseFloat
|
|
113
|
+
* @param {string} value the value to be parsed
|
|
114
|
+
* @returns {number} a parsed number
|
|
115
|
+
*/
|
|
105
116
|
parseNumber(value) {
|
|
106
117
|
// Remove delimiters and convert decimal separator to dot.
|
|
107
118
|
value = value.split(this.delimiter).join('').replace(this.decimalSeparator, '.');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let components: {
|
|
3
|
+
label: string;
|
|
4
|
+
applyMaskOn: string;
|
|
5
|
+
mask: boolean;
|
|
6
|
+
tableView: boolean;
|
|
7
|
+
delimiter: boolean;
|
|
8
|
+
requireDecimal: boolean;
|
|
9
|
+
inputFormat: string;
|
|
10
|
+
truncateMultipleSpaces: boolean;
|
|
11
|
+
validateWhenHidden: boolean;
|
|
12
|
+
key: string;
|
|
13
|
+
type: string;
|
|
14
|
+
input: boolean;
|
|
15
|
+
defaultValue: string;
|
|
16
|
+
}[];
|
|
17
|
+
}
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
components: [
|
|
5
|
+
{
|
|
6
|
+
"label": "Number",
|
|
7
|
+
"applyMaskOn": "change",
|
|
8
|
+
"mask": false,
|
|
9
|
+
"tableView": false,
|
|
10
|
+
"delimiter": false,
|
|
11
|
+
"requireDecimal": false,
|
|
12
|
+
"inputFormat": "plain",
|
|
13
|
+
"truncateMultipleSpaces": false,
|
|
14
|
+
"validateWhenHidden": false,
|
|
15
|
+
"key": "number",
|
|
16
|
+
"type": "number",
|
|
17
|
+
"input": true,
|
|
18
|
+
"defaultValue": "123.23"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
};
|
|
@@ -7,4 +7,5 @@ import comp6 from './comp6';
|
|
|
7
7
|
import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
|
9
9
|
import comp9 from './comp9';
|
|
10
|
-
|
|
10
|
+
import comp10 from './comp10';
|
|
11
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10 };
|
|
@@ -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.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
6
|
+
exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = 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 comp2_1 = __importDefault(require("./comp2"));
|
|
@@ -22,3 +22,5 @@ const comp8_1 = __importDefault(require("./comp8"));
|
|
|
22
22
|
exports.comp8 = comp8_1.default;
|
|
23
23
|
const comp9_1 = __importDefault(require("./comp9"));
|
|
24
24
|
exports.comp9 = comp9_1.default;
|
|
25
|
+
const comp10_1 = __importDefault(require("./comp10"));
|
|
26
|
+
exports.comp10 = comp10_1.default;
|
|
@@ -264,6 +264,16 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
264
264
|
if (method.toUpperCase() === 'GET') {
|
|
265
265
|
body = null;
|
|
266
266
|
}
|
|
267
|
+
const limit = this.component.limit || 100;
|
|
268
|
+
const skip = this.isScrollLoading ? this.selectOptions.length : 0;
|
|
269
|
+
// Allow for url interpolation.
|
|
270
|
+
url = this.sanitize(this.interpolate(url, {
|
|
271
|
+
formioBase: Formio_1.Formio.getBaseUrl(),
|
|
272
|
+
search,
|
|
273
|
+
limit,
|
|
274
|
+
skip,
|
|
275
|
+
page: Math.abs(Math.floor(skip / limit))
|
|
276
|
+
}), this.shouldSanitizeValue);
|
|
267
277
|
// Set ignoreCache if it is
|
|
268
278
|
options.ignoreCache = this.component.ignoreCache;
|
|
269
279
|
// Make the request.
|
|
@@ -295,14 +305,15 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
295
305
|
setItems(items) {
|
|
296
306
|
const listData = [];
|
|
297
307
|
items === null || items === void 0 ? void 0 : items.forEach((item, i) => {
|
|
308
|
+
const valueAtProperty = lodash_1.default.get(item, this.component.valueProperty);
|
|
298
309
|
this.loadedOptions[i] = {
|
|
299
|
-
value: this.component.valueProperty ?
|
|
300
|
-
label: this.component.valueProperty ? this.itemTemplate(item,
|
|
310
|
+
value: this.component.valueProperty ? valueAtProperty : item,
|
|
311
|
+
label: this.component.valueProperty ? this.itemTemplate(item, valueAtProperty) : this.itemTemplate(item, item, i)
|
|
301
312
|
};
|
|
302
|
-
listData.push(this.templateData[this.component.valueProperty ?
|
|
303
|
-
if ((this.component.valueProperty || !this.isRadio) && (lodash_1.default.isUndefined(
|
|
304
|
-
(!this.isRadio && lodash_1.default.isObject(
|
|
305
|
-
(!this.isRadio && lodash_1.default.isBoolean(
|
|
313
|
+
listData.push(this.templateData[this.component.valueProperty ? valueAtProperty : i]);
|
|
314
|
+
if ((this.component.valueProperty || !this.isRadio) && (lodash_1.default.isUndefined(valueAtProperty) ||
|
|
315
|
+
(!this.isRadio && lodash_1.default.isObject(valueAtProperty)) ||
|
|
316
|
+
(!this.isRadio && lodash_1.default.isBoolean(valueAtProperty)))) {
|
|
306
317
|
this.loadedOptions[i].invalid = true;
|
|
307
318
|
}
|
|
308
319
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let components: {
|
|
3
|
+
label: string;
|
|
4
|
+
optionsLabelPosition: string;
|
|
5
|
+
tableView: boolean;
|
|
6
|
+
dataSrc: string;
|
|
7
|
+
values: {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
shortcut: string;
|
|
11
|
+
}[];
|
|
12
|
+
valueProperty: string;
|
|
13
|
+
validateWhenHidden: boolean;
|
|
14
|
+
key: string;
|
|
15
|
+
type: string;
|
|
16
|
+
data: {
|
|
17
|
+
url: string;
|
|
18
|
+
headers: {
|
|
19
|
+
key: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
template: string;
|
|
24
|
+
authenticate: boolean;
|
|
25
|
+
input: boolean;
|
|
26
|
+
inputType: string;
|
|
27
|
+
}[];
|
|
28
|
+
}
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
components: [
|
|
5
|
+
{
|
|
6
|
+
"label": "Select Boxes",
|
|
7
|
+
"optionsLabelPosition": "right",
|
|
8
|
+
"tableView": false,
|
|
9
|
+
"dataSrc": "url",
|
|
10
|
+
"values": [
|
|
11
|
+
{
|
|
12
|
+
"label": "",
|
|
13
|
+
"value": "",
|
|
14
|
+
"shortcut": ""
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"valueProperty": "data.name",
|
|
18
|
+
"validateWhenHidden": false,
|
|
19
|
+
"key": "selectBoxes",
|
|
20
|
+
"type": "selectboxes",
|
|
21
|
+
"data": {
|
|
22
|
+
"url": "https://remote-dev.form.io/projectId/name/submission",
|
|
23
|
+
"headers": [
|
|
24
|
+
{
|
|
25
|
+
"key": "",
|
|
26
|
+
"value": ""
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"template": "<span>{{ item.data.name }}</span>",
|
|
31
|
+
"authenticate": true,
|
|
32
|
+
"input": true,
|
|
33
|
+
"inputType": "checkbox"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
};
|
|
@@ -9,4 +9,5 @@ import comp8 from './comp8';
|
|
|
9
9
|
import comp9 from './comp9';
|
|
10
10
|
import comp10 from './comp10';
|
|
11
11
|
import comp11 from './comp11';
|
|
12
|
-
|
|
12
|
+
import comp12 from './comp12';
|
|
13
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12 };
|
|
@@ -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.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
6
|
+
exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = 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 comp2_1 = __importDefault(require("./comp2"));
|
|
@@ -26,3 +26,5 @@ const comp10_1 = __importDefault(require("./comp10"));
|
|
|
26
26
|
exports.comp10 = comp10_1.default;
|
|
27
27
|
const comp11_1 = __importDefault(require("./comp11"));
|
|
28
28
|
exports.comp11 = comp11_1.default;
|
|
29
|
+
const comp12_1 = __importDefault(require("./comp12"));
|
|
30
|
+
exports.comp12 = comp12_1.default;
|
|
@@ -9,9 +9,47 @@ export default class SelectComponent extends ListComponent {
|
|
|
9
9
|
};
|
|
10
10
|
static get serverConditionSettings(): {
|
|
11
11
|
valueComponent(classComp: any): any;
|
|
12
|
+
dataTypeOperators: {
|
|
13
|
+
number: string[];
|
|
14
|
+
};
|
|
15
|
+
dataTypeValueComponents: {
|
|
16
|
+
number: {
|
|
17
|
+
lessThan: () => {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
greaterThan: () => {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
lessThanOrEqual: () => {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
greaterThanOrEqual: () => {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
12
31
|
};
|
|
13
32
|
static get conditionOperatorsSettings(): {
|
|
14
33
|
valueComponent(classComp: any): any;
|
|
34
|
+
dataTypeOperators: {
|
|
35
|
+
number: string[];
|
|
36
|
+
};
|
|
37
|
+
dataTypeValueComponents: {
|
|
38
|
+
number: {
|
|
39
|
+
lessThan: () => {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
greaterThan: () => {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
lessThanOrEqual: () => {
|
|
46
|
+
type: string;
|
|
47
|
+
};
|
|
48
|
+
greaterThanOrEqual: () => {
|
|
49
|
+
type: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
15
53
|
};
|
|
16
54
|
static savedValueTypes(schema: any): any[];
|
|
17
55
|
templateData: {} | undefined;
|
|
@@ -62,6 +62,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
62
62
|
return SelectComponent.conditionOperatorsSettings;
|
|
63
63
|
}
|
|
64
64
|
static get conditionOperatorsSettings() {
|
|
65
|
+
const numberType = () => ({ type: 'number' });
|
|
65
66
|
return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {
|
|
66
67
|
const valueComp = Object.assign(Object.assign({}, classComp), { type: 'select' });
|
|
67
68
|
if ((0, utils_1.isSelectResourceWithObjectValue)(classComp)) {
|
|
@@ -76,6 +77,15 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
76
77
|
`;
|
|
77
78
|
}
|
|
78
79
|
return valueComp;
|
|
80
|
+
}, dataTypeOperators: {
|
|
81
|
+
number: ['lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'],
|
|
82
|
+
}, dataTypeValueComponents: {
|
|
83
|
+
number: {
|
|
84
|
+
lessThan: numberType,
|
|
85
|
+
greaterThan: numberType,
|
|
86
|
+
lessThanOrEqual: numberType,
|
|
87
|
+
greaterThanOrEqual: numberType,
|
|
88
|
+
},
|
|
79
89
|
} });
|
|
80
90
|
}
|
|
81
91
|
static savedValueTypes(schema) {
|
|
@@ -526,13 +536,13 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
526
536
|
skip,
|
|
527
537
|
};
|
|
528
538
|
// Allow for url interpolation.
|
|
529
|
-
url = this.interpolate(url, {
|
|
539
|
+
url = this.sanitize(this.interpolate(url, {
|
|
530
540
|
formioBase: Formio_1.Formio.getBaseUrl(),
|
|
531
541
|
search,
|
|
532
542
|
limit,
|
|
533
543
|
skip,
|
|
534
544
|
page: Math.abs(Math.floor(skip / limit))
|
|
535
|
-
});
|
|
545
|
+
}), this.shouldSanitizeValue);
|
|
536
546
|
// Add search capability.
|
|
537
547
|
if (this.component.searchField && search) {
|
|
538
548
|
const searchValue = Array.isArray(search)
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
data: {
|
|
12
|
+
values: {
|
|
13
|
+
label: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
dataType: string;
|
|
18
|
+
key: string;
|
|
19
|
+
type: string;
|
|
20
|
+
input: boolean;
|
|
21
|
+
applyMaskOn?: undefined;
|
|
22
|
+
conditional?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
label: string;
|
|
25
|
+
applyMaskOn: string;
|
|
26
|
+
tableView: boolean;
|
|
27
|
+
key: string;
|
|
28
|
+
type: string;
|
|
29
|
+
input: boolean;
|
|
30
|
+
conditional: {
|
|
31
|
+
show: boolean;
|
|
32
|
+
conjunction: string;
|
|
33
|
+
conditions: {
|
|
34
|
+
component: string;
|
|
35
|
+
operator: string;
|
|
36
|
+
value: number;
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
widget?: undefined;
|
|
40
|
+
data?: undefined;
|
|
41
|
+
dataType?: undefined;
|
|
42
|
+
})[];
|
|
43
|
+
}
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
title: 'FIO-8072',
|
|
5
|
+
name: 'fio8072',
|
|
6
|
+
path: 'fio8072',
|
|
7
|
+
type: 'form',
|
|
8
|
+
display: 'form',
|
|
9
|
+
components: [
|
|
10
|
+
{
|
|
11
|
+
label: 'Select',
|
|
12
|
+
widget: 'choicesjs',
|
|
13
|
+
tableView: true,
|
|
14
|
+
data: {
|
|
15
|
+
values: [
|
|
16
|
+
{
|
|
17
|
+
label: 'A',
|
|
18
|
+
value: '1',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: 'B',
|
|
22
|
+
value: '2',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: 'C',
|
|
26
|
+
value: '10',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: 'D',
|
|
30
|
+
value: '1d',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
dataType: 'number',
|
|
35
|
+
key: 'select',
|
|
36
|
+
type: 'select',
|
|
37
|
+
input: true,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'Text Field',
|
|
41
|
+
applyMaskOn: 'change',
|
|
42
|
+
tableView: true,
|
|
43
|
+
key: 'textField',
|
|
44
|
+
type: 'textfield',
|
|
45
|
+
input: true,
|
|
46
|
+
conditional: {
|
|
47
|
+
show: true,
|
|
48
|
+
conjunction: 'all',
|
|
49
|
+
conditions: [
|
|
50
|
+
{
|
|
51
|
+
component: 'select',
|
|
52
|
+
operator: 'lessThan',
|
|
53
|
+
value: 5,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|