@formio/js 5.0.0-dev.5719.d2d4a61 → 5.0.0-dev.5720.e861c22
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 +6 -0
- package/dist/formio.form.js +7 -7
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +8 -8
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/Webform.js +1 -1
- 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 +4 -1
- package/lib/cjs/components/currency/Currency.d.ts +1 -0
- 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.js +1 -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/Webform.js +1 -1
- 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 +4 -1
- package/lib/mjs/components/currency/Currency.d.ts +1 -0
- 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.js +1 -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
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
"type": "form",
|
|
5
|
+
"display": "wizard",
|
|
6
|
+
"components": [
|
|
7
|
+
{
|
|
8
|
+
"title": "Page 1",
|
|
9
|
+
"breadcrumbClickable": true,
|
|
10
|
+
"buttonSettings": {
|
|
11
|
+
"previous": true,
|
|
12
|
+
"cancel": true,
|
|
13
|
+
"next": true
|
|
14
|
+
},
|
|
15
|
+
"navigateOnEnter": false,
|
|
16
|
+
"saveOnEnter": false,
|
|
17
|
+
"scrollToTop": false,
|
|
18
|
+
"collapsible": false,
|
|
19
|
+
"key": "page1",
|
|
20
|
+
"type": "panel",
|
|
21
|
+
"label": "Page 1",
|
|
22
|
+
"components": [
|
|
23
|
+
{
|
|
24
|
+
"label": "Time",
|
|
25
|
+
"disabled": true,
|
|
26
|
+
"alwaysEnabled": false,
|
|
27
|
+
"tableView": true,
|
|
28
|
+
"defaultValue": "03:03 PM",
|
|
29
|
+
"key": "time1",
|
|
30
|
+
"type": "time",
|
|
31
|
+
"input": true,
|
|
32
|
+
"inputMask": "99:99",
|
|
33
|
+
"hideOnChildrenHidden": false,
|
|
34
|
+
"id": "efw9yyq",
|
|
35
|
+
"placeholder": "",
|
|
36
|
+
"prefix": "",
|
|
37
|
+
"customClass": "",
|
|
38
|
+
"suffix": "",
|
|
39
|
+
"multiple": false,
|
|
40
|
+
"protected": false,
|
|
41
|
+
"unique": false,
|
|
42
|
+
"persistent": true,
|
|
43
|
+
"hidden": false,
|
|
44
|
+
"clearOnHide": true,
|
|
45
|
+
"refreshOn": "",
|
|
46
|
+
"redrawOn": "",
|
|
47
|
+
"modalEdit": false,
|
|
48
|
+
"dataGridLabel": false,
|
|
49
|
+
"labelPosition": "top",
|
|
50
|
+
"description": "",
|
|
51
|
+
"errorLabel": "",
|
|
52
|
+
"tooltip": "",
|
|
53
|
+
"hideLabel": false,
|
|
54
|
+
"tabindex": "",
|
|
55
|
+
"autofocus": false,
|
|
56
|
+
"dbIndex": false,
|
|
57
|
+
"customDefaultValue": "",
|
|
58
|
+
"calculateValue": "",
|
|
59
|
+
"calculateServer": false,
|
|
60
|
+
"widget": {
|
|
61
|
+
"type": "input"
|
|
62
|
+
},
|
|
63
|
+
"attributes": {},
|
|
64
|
+
"validateOn": "change",
|
|
65
|
+
"validate": {
|
|
66
|
+
"required": false,
|
|
67
|
+
"custom": "",
|
|
68
|
+
"customPrivate": false,
|
|
69
|
+
"strictDateValidation": false,
|
|
70
|
+
"multiple": false,
|
|
71
|
+
"unique": false,
|
|
72
|
+
"minLength": "",
|
|
73
|
+
"maxLength": "",
|
|
74
|
+
"pattern": ""
|
|
75
|
+
},
|
|
76
|
+
"conditional": {
|
|
77
|
+
"show": null,
|
|
78
|
+
"when": null,
|
|
79
|
+
"eq": ""
|
|
80
|
+
},
|
|
81
|
+
"overlay": {
|
|
82
|
+
"style": "",
|
|
83
|
+
"left": "",
|
|
84
|
+
"top": "",
|
|
85
|
+
"width": "",
|
|
86
|
+
"height": ""
|
|
87
|
+
},
|
|
88
|
+
"allowCalculateOverride": false,
|
|
89
|
+
"encrypted": false,
|
|
90
|
+
"showCharCount": false,
|
|
91
|
+
"showWordCount": false,
|
|
92
|
+
"properties": {},
|
|
93
|
+
"allowMultipleMasks": false,
|
|
94
|
+
"addons": [],
|
|
95
|
+
"mask": false,
|
|
96
|
+
"inputType": "time",
|
|
97
|
+
"inputFormat": "plain",
|
|
98
|
+
"displayMask": "",
|
|
99
|
+
"spellcheck": true,
|
|
100
|
+
"truncateMultipleSpaces": false,
|
|
101
|
+
"format": "HH:mm",
|
|
102
|
+
"dataFormat": "HH:mm:ss"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"input": false,
|
|
106
|
+
"tableView": false,
|
|
107
|
+
"id": "e7vej1d",
|
|
108
|
+
"placeholder": "",
|
|
109
|
+
"prefix": "",
|
|
110
|
+
"customClass": "",
|
|
111
|
+
"suffix": "",
|
|
112
|
+
"multiple": false,
|
|
113
|
+
"defaultValue": null,
|
|
114
|
+
"protected": false,
|
|
115
|
+
"unique": false,
|
|
116
|
+
"persistent": false,
|
|
117
|
+
"hidden": false,
|
|
118
|
+
"clearOnHide": false,
|
|
119
|
+
"refreshOn": "",
|
|
120
|
+
"redrawOn": "",
|
|
121
|
+
"modalEdit": false,
|
|
122
|
+
"dataGridLabel": false,
|
|
123
|
+
"labelPosition": "top",
|
|
124
|
+
"description": "",
|
|
125
|
+
"errorLabel": "",
|
|
126
|
+
"tooltip": "",
|
|
127
|
+
"hideLabel": false,
|
|
128
|
+
"tabindex": "",
|
|
129
|
+
"disabled": false,
|
|
130
|
+
"autofocus": false,
|
|
131
|
+
"dbIndex": false,
|
|
132
|
+
"customDefaultValue": "",
|
|
133
|
+
"calculateValue": "",
|
|
134
|
+
"calculateServer": false,
|
|
135
|
+
"widget": null,
|
|
136
|
+
"attributes": {},
|
|
137
|
+
"validateOn": "change",
|
|
138
|
+
"validate": {
|
|
139
|
+
"required": false,
|
|
140
|
+
"custom": "",
|
|
141
|
+
"customPrivate": false,
|
|
142
|
+
"strictDateValidation": false,
|
|
143
|
+
"multiple": false,
|
|
144
|
+
"unique": false
|
|
145
|
+
},
|
|
146
|
+
"conditional": {
|
|
147
|
+
"show": null,
|
|
148
|
+
"when": null,
|
|
149
|
+
"eq": ""
|
|
150
|
+
},
|
|
151
|
+
"overlay": {
|
|
152
|
+
"style": "",
|
|
153
|
+
"left": "",
|
|
154
|
+
"top": "",
|
|
155
|
+
"width": "",
|
|
156
|
+
"height": ""
|
|
157
|
+
},
|
|
158
|
+
"allowCalculateOverride": false,
|
|
159
|
+
"encrypted": false,
|
|
160
|
+
"showCharCount": false,
|
|
161
|
+
"showWordCount": false,
|
|
162
|
+
"properties": {},
|
|
163
|
+
"allowMultipleMasks": false,
|
|
164
|
+
"addons": [],
|
|
165
|
+
"tree": false,
|
|
166
|
+
"lazyLoad": false,
|
|
167
|
+
"theme": "default",
|
|
168
|
+
"breadcrumb": "default"
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import comp1 from './comp1';
|
|
2
2
|
import comp2 from './comp2';
|
|
3
3
|
import comp3 from './comp3';
|
|
4
|
+
import comp4 from './comp4';
|
|
4
5
|
import timeForm from './timeForm';
|
|
5
6
|
import timeForm2 from './timeForm2';
|
|
6
|
-
export { comp1, comp2, comp3, timeForm, timeForm2 };
|
|
7
|
+
export { comp1, comp2, comp3, comp4, timeForm, timeForm2 };
|
|
@@ -3,13 +3,15 @@ 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.timeForm2 = exports.timeForm = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
6
|
+
exports.timeForm2 = exports.timeForm = 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"));
|
|
10
10
|
exports.comp2 = comp2_1.default;
|
|
11
11
|
const comp3_1 = __importDefault(require("./comp3"));
|
|
12
12
|
exports.comp3 = comp3_1.default;
|
|
13
|
+
const comp4_1 = __importDefault(require("./comp4"));
|
|
14
|
+
exports.comp4 = comp4_1.default;
|
|
13
15
|
const timeForm_1 = __importDefault(require("./timeForm"));
|
|
14
16
|
exports.timeForm = timeForm_1.default;
|
|
15
17
|
const timeForm2_1 = __importDefault(require("./timeForm2"));
|
package/lib/mjs/Webform.js
CHANGED
|
@@ -1134,7 +1134,7 @@ export default class Webform extends NestedDataComponent {
|
|
|
1134
1134
|
});
|
|
1135
1135
|
const displayedErrors = [];
|
|
1136
1136
|
if (errors.length) {
|
|
1137
|
-
errors = _.uniqBy(errors, (error) => error.message);
|
|
1137
|
+
errors = _.uniqBy(errors, (error) => [error.message, error.component?.id, error.context?.path].join());
|
|
1138
1138
|
const createListItem = (message, index) => {
|
|
1139
1139
|
const err = errors[index];
|
|
1140
1140
|
const messageFromIndex = !_.isUndefined(index) && errors && errors[index];
|
|
@@ -892,7 +892,11 @@ export default class WebformBuilder extends Component {
|
|
|
892
892
|
if (form && form.properties) {
|
|
893
893
|
this.options.properties = form.properties;
|
|
894
894
|
}
|
|
895
|
-
|
|
895
|
+
let keyboardActionsEnabled = _.get(this.options, 'keyboardBuilder', false) || this.options.properties?.keyboardBuilder;
|
|
896
|
+
if (typeof keyboardActionsEnabled === 'string') {
|
|
897
|
+
keyboardActionsEnabled = keyboardActionsEnabled === 'true';
|
|
898
|
+
}
|
|
899
|
+
this.keyboardActionsEnabled = keyboardActionsEnabled;
|
|
896
900
|
const isShowSubmitButton = !this.options.noDefaultSubmitButton
|
|
897
901
|
&& (!form.components.length || !form.components.find(comp => comp.key === 'submit'));
|
|
898
902
|
// Ensure there is at least a submit button.
|
|
@@ -1044,7 +1048,10 @@ export default class WebformBuilder extends Component {
|
|
|
1044
1048
|
'calculateValue',
|
|
1045
1049
|
'conditional',
|
|
1046
1050
|
'customConditional',
|
|
1047
|
-
'id'
|
|
1051
|
+
'id',
|
|
1052
|
+
'fields.day.required',
|
|
1053
|
+
'fields.month.required',
|
|
1054
|
+
'fields.year.required',
|
|
1048
1055
|
]));
|
|
1049
1056
|
const parentComponent = defaultValueComponent.parent;
|
|
1050
1057
|
let tabIndex = -1;
|
|
@@ -1231,6 +1238,7 @@ export default class WebformBuilder extends Component {
|
|
|
1231
1238
|
helplinks: this.helplinks,
|
|
1232
1239
|
}));
|
|
1233
1240
|
this.editForm.attach(this.componentEdit.querySelector(`[${this._referenceAttributeName}="editForm"]`));
|
|
1241
|
+
this.updateComponent(this.editForm.submission.data ?? component);
|
|
1234
1242
|
this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
|
|
1235
1243
|
});
|
|
1236
1244
|
});
|
|
@@ -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.
|
|
@@ -677,8 +677,11 @@ export default class NestedComponent extends Field {
|
|
|
677
677
|
isValid(data, dirty) {
|
|
678
678
|
return this.getComponents().reduce((valid, comp) => comp.isValid(data, dirty) && valid, super.isValid(data, dirty));
|
|
679
679
|
}
|
|
680
|
-
validationProcessor({ scope, data, row, instance }, flags) {
|
|
680
|
+
validationProcessor({ scope, data, row, instance, component }, flags) {
|
|
681
681
|
const { dirty } = flags;
|
|
682
|
+
if (this.root.hasExtraPages && this.page !== this.root.page) {
|
|
683
|
+
instance = this.getComponentById(component.id);
|
|
684
|
+
}
|
|
682
685
|
if (!instance) {
|
|
683
686
|
return;
|
|
684
687
|
}
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -89,6 +89,11 @@ export default class NumberComponent extends Input {
|
|
|
89
89
|
}
|
|
90
90
|
get defaultValue() {
|
|
91
91
|
let defaultValue = super.defaultValue;
|
|
92
|
+
if (typeof defaultValue === 'string') {
|
|
93
|
+
// Default value may be a string or have custom thousands separators or decimal symbols, so we need to call
|
|
94
|
+
// parseNumber on it
|
|
95
|
+
defaultValue = this.parseNumber(defaultValue);
|
|
96
|
+
}
|
|
92
97
|
if (!defaultValue && this.component.defaultValue === 0) {
|
|
93
98
|
defaultValue = this.component.defaultValue;
|
|
94
99
|
}
|
|
@@ -100,6 +105,12 @@ export default class NumberComponent extends Input {
|
|
|
100
105
|
isDecimalAllowed() {
|
|
101
106
|
return _.get(this.component, 'allowDecimal', !(this.component.validate && this.component.validate.integer));
|
|
102
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* parses a numeric string by removing the delimiters and replacing the decimal separator back to '.' so that it can
|
|
110
|
+
* be processed by either parseInt or parseFloat
|
|
111
|
+
* @param {string} value the value to be parsed
|
|
112
|
+
* @returns {number} a parsed number
|
|
113
|
+
*/
|
|
103
114
|
parseNumber(value) {
|
|
104
115
|
// Remove delimiters and convert decimal separator to dot.
|
|
105
116
|
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,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
components: [
|
|
3
|
+
{
|
|
4
|
+
"label": "Number",
|
|
5
|
+
"applyMaskOn": "change",
|
|
6
|
+
"mask": false,
|
|
7
|
+
"tableView": false,
|
|
8
|
+
"delimiter": false,
|
|
9
|
+
"requireDecimal": false,
|
|
10
|
+
"inputFormat": "plain",
|
|
11
|
+
"truncateMultipleSpaces": false,
|
|
12
|
+
"validateWhenHidden": false,
|
|
13
|
+
"key": "number",
|
|
14
|
+
"type": "number",
|
|
15
|
+
"input": true,
|
|
16
|
+
"defaultValue": "123.23"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
};
|
|
@@ -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 };
|
|
@@ -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 };
|
|
@@ -264,6 +264,16 @@ export default class RadioComponent extends ListComponent {
|
|
|
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.interpolate(this.sanitize(url, this.shouldSanitizeValue), {
|
|
271
|
+
formioBase: Formio.getBaseUrl(),
|
|
272
|
+
search,
|
|
273
|
+
limit,
|
|
274
|
+
skip,
|
|
275
|
+
page: Math.abs(Math.floor(skip / limit))
|
|
276
|
+
});
|
|
267
277
|
// Set ignoreCache if it is
|
|
268
278
|
options.ignoreCache = this.component.ignoreCache;
|
|
269
279
|
// Make the request.
|
|
@@ -295,14 +305,15 @@ export default class RadioComponent extends ListComponent {
|
|
|
295
305
|
setItems(items) {
|
|
296
306
|
const listData = [];
|
|
297
307
|
items?.forEach((item, i) => {
|
|
308
|
+
const valueAtProperty = _.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) && (_.isUndefined(
|
|
304
|
-
(!this.isRadio && _.isObject(
|
|
305
|
-
(!this.isRadio && _.isBoolean(
|
|
313
|
+
listData.push(this.templateData[this.component.valueProperty ? valueAtProperty : i]);
|
|
314
|
+
if ((this.component.valueProperty || !this.isRadio) && (_.isUndefined(valueAtProperty) ||
|
|
315
|
+
(!this.isRadio && _.isObject(valueAtProperty)) ||
|
|
316
|
+
(!this.isRadio && _.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,34 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
components: [
|
|
3
|
+
{
|
|
4
|
+
"label": "Select Boxes",
|
|
5
|
+
"optionsLabelPosition": "right",
|
|
6
|
+
"tableView": false,
|
|
7
|
+
"dataSrc": "url",
|
|
8
|
+
"values": [
|
|
9
|
+
{
|
|
10
|
+
"label": "",
|
|
11
|
+
"value": "",
|
|
12
|
+
"shortcut": ""
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"valueProperty": "data.name",
|
|
16
|
+
"validateWhenHidden": false,
|
|
17
|
+
"key": "selectBoxes",
|
|
18
|
+
"type": "selectboxes",
|
|
19
|
+
"data": {
|
|
20
|
+
"url": "https://remote-dev.form.io/projectId/name/submission",
|
|
21
|
+
"headers": [
|
|
22
|
+
{
|
|
23
|
+
"key": "",
|
|
24
|
+
"value": ""
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"template": "<span>{{ item.data.name }}</span>",
|
|
29
|
+
"authenticate": true,
|
|
30
|
+
"input": true,
|
|
31
|
+
"inputType": "checkbox"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
@@ -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 };
|
|
@@ -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 };
|
|
@@ -526,7 +526,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
526
526
|
skip,
|
|
527
527
|
};
|
|
528
528
|
// Allow for url interpolation.
|
|
529
|
-
url = this.interpolate(url, {
|
|
529
|
+
url = this.interpolate(this.sanitize(url, this.shouldSanitizeValue), {
|
|
530
530
|
formioBase: Formio.getBaseUrl(),
|
|
531
531
|
search,
|
|
532
532
|
limit,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export default class TimeComponent extends TextFieldComponent {
|
|
2
|
-
rawData:
|
|
2
|
+
rawData: any;
|
|
3
3
|
get dataFormat(): any;
|
|
4
4
|
get skipMaskValidation(): boolean;
|
|
5
5
|
isNotCompleteInput(value: any): any;
|
|
6
6
|
removeValue(index: any): void;
|
|
7
7
|
resetRawData(index: any): void;
|
|
8
8
|
setRawValue(value: any, index: any): void;
|
|
9
|
-
getRawValue(index: any):
|
|
9
|
+
getRawValue(index: any): any;
|
|
10
10
|
getValueAt(index: any): any;
|
|
11
11
|
setValueAt(index: any, value: any): void;
|
|
12
12
|
getStringAsValue(view: any): any;
|
|
@@ -31,7 +31,8 @@ export default class TimeComponent extends TextFieldComponent {
|
|
|
31
31
|
this.component.inputType = isEdgeBrowser && edgeVersion <= 18
|
|
32
32
|
? 'text'
|
|
33
33
|
: (this.component.inputType || 'time');
|
|
34
|
-
|
|
34
|
+
// If default value is given then the raw data needs to be set
|
|
35
|
+
this.rawData = this.component.multiple ? [] : this.getValueAsString(this.defaultValue) || this.emptyValue;
|
|
35
36
|
}
|
|
36
37
|
static get builderInfo() {
|
|
37
38
|
return {
|
|
@@ -62,7 +63,7 @@ export default class TimeComponent extends TextFieldComponent {
|
|
|
62
63
|
return value;
|
|
63
64
|
}
|
|
64
65
|
get validationValue() {
|
|
65
|
-
if (Array.isArray(this.rawData) && !this.rawData.length || !this.rawData) {
|
|
66
|
+
if ((Array.isArray(this.rawData) && !this.rawData.length) || !this.rawData) {
|
|
66
67
|
return this.dataValue;
|
|
67
68
|
}
|
|
68
69
|
return this.rawData;
|