@formio/js 5.3.0 → 5.4.0-api98.1
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/dist/formio.builder.css +16 -5
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.css +1 -1
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.css +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.css +16 -5
- package/dist/formio.form.js +3234 -3226
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -3
- package/dist/formio.full.css +16 -5
- package/dist/formio.full.js +3961 -3933
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -3
- package/dist/formio.js +1485 -1487
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +1402 -1415
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -3
- package/lib/cjs/Embed.js +35 -1
- package/lib/cjs/Form.d.ts +3 -1
- package/lib/cjs/Form.js +2 -2
- package/lib/cjs/FormBuilder.d.ts +2 -2
- package/lib/cjs/FormBuilder.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDF.js +11 -1
- package/lib/cjs/Webform.d.ts +2 -1
- package/lib/cjs/Webform.js +77 -2
- package/lib/cjs/WebformBuilder.js +15 -0
- package/lib/cjs/Wizard.d.ts +1 -0
- package/lib/cjs/Wizard.js +11 -0
- package/lib/cjs/components/_classes/component/Component.d.ts +14 -3
- package/lib/cjs/components/_classes/component/Component.js +91 -24
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -0
- package/lib/cjs/components/_classes/input/Input.js +17 -2
- package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -0
- package/lib/cjs/components/address/Address.js +18 -1
- package/lib/cjs/components/datagrid/DataGrid.js +14 -3
- package/lib/cjs/components/datamap/DataMap.d.ts +4 -0
- package/lib/cjs/components/datamap/DataMap.js +6 -5
- package/lib/cjs/components/fieldset/Fieldset.d.ts +1 -0
- package/lib/cjs/components/fieldset/Fieldset.js +8 -0
- package/lib/cjs/components/file/File.d.ts +3 -1
- package/lib/cjs/components/file/File.js +62 -17
- package/lib/cjs/components/form/Form.js +2 -1
- package/lib/cjs/components/select/Select.js +14 -9
- package/lib/cjs/components/table/editForm/Table.edit.display.d.ts +27 -0
- package/lib/cjs/components/table/editForm/Table.edit.display.js +10 -0
- package/lib/cjs/components/tags/Tags.js +2 -1
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/templates/index.d.ts +3 -0
- package/lib/cjs/translations/en.d.ts +2 -0
- package/lib/cjs/translations/en.js +2 -0
- package/lib/cjs/utils/conditionOperators/IsEqualTo.d.ts +1 -3
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +6 -12
- package/lib/cjs/utils/conditionOperators/index.d.ts +2 -1
- package/lib/cjs/utils/i18n.d.ts +1 -0
- package/lib/cjs/utils/i18n.js +2 -0
- package/lib/cjs/utils/index.d.ts +2 -1
- package/lib/cjs/utils/utils.d.ts +9 -0
- package/lib/cjs/utils/utils.js +132 -2
- package/lib/cjs/widgets/CalendarWidget.js +2 -1
- package/lib/mjs/Embed.js +35 -1
- package/lib/mjs/Form.d.ts +3 -1
- package/lib/mjs/Form.js +2 -2
- package/lib/mjs/FormBuilder.d.ts +2 -2
- package/lib/mjs/FormBuilder.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDF.js +11 -1
- package/lib/mjs/Webform.d.ts +2 -1
- package/lib/mjs/Webform.js +76 -2
- package/lib/mjs/WebformBuilder.js +15 -0
- package/lib/mjs/Wizard.d.ts +1 -0
- package/lib/mjs/Wizard.js +12 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +14 -3
- package/lib/mjs/components/_classes/component/Component.js +87 -24
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -0
- package/lib/mjs/components/_classes/input/Input.js +16 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -0
- package/lib/mjs/components/address/Address.js +16 -1
- package/lib/mjs/components/datagrid/DataGrid.js +12 -2
- package/lib/mjs/components/datamap/DataMap.d.ts +4 -0
- package/lib/mjs/components/datamap/DataMap.js +6 -5
- package/lib/mjs/components/fieldset/Fieldset.d.ts +1 -0
- package/lib/mjs/components/fieldset/Fieldset.js +8 -0
- package/lib/mjs/components/file/File.d.ts +3 -1
- package/lib/mjs/components/file/File.js +60 -15
- package/lib/mjs/components/form/Form.js +2 -1
- package/lib/mjs/components/select/Select.js +12 -9
- package/lib/mjs/components/table/editForm/Table.edit.display.d.ts +27 -0
- package/lib/mjs/components/table/editForm/Table.edit.display.js +10 -0
- package/lib/mjs/components/tags/Tags.js +1 -1
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/templates/index.d.ts +3 -0
- package/lib/mjs/translations/en.d.ts +2 -0
- package/lib/mjs/translations/en.js +2 -0
- package/lib/mjs/utils/conditionOperators/IsEqualTo.d.ts +1 -3
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +6 -11
- package/lib/mjs/utils/conditionOperators/index.d.ts +2 -1
- package/lib/mjs/utils/i18n.d.ts +1 -0
- package/lib/mjs/utils/i18n.js +2 -0
- package/lib/mjs/utils/index.d.ts +2 -1
- package/lib/mjs/utils/utils.d.ts +9 -0
- package/lib/mjs/utils/utils.js +130 -1
- package/lib/mjs/widgets/CalendarWidget.js +1 -1
- package/package.json +5 -4
|
@@ -82,6 +82,7 @@ declare const _default: ({
|
|
|
82
82
|
inline?: undefined;
|
|
83
83
|
defaultValue?: undefined;
|
|
84
84
|
values?: undefined;
|
|
85
|
+
customConditional?: undefined;
|
|
85
86
|
logic?: undefined;
|
|
86
87
|
dataSrc?: undefined;
|
|
87
88
|
valueProperty?: undefined;
|
|
@@ -101,6 +102,7 @@ declare const _default: ({
|
|
|
101
102
|
inline?: undefined;
|
|
102
103
|
defaultValue?: undefined;
|
|
103
104
|
values?: undefined;
|
|
105
|
+
customConditional?: undefined;
|
|
104
106
|
logic?: undefined;
|
|
105
107
|
dataSrc?: undefined;
|
|
106
108
|
valueProperty?: undefined;
|
|
@@ -126,6 +128,7 @@ declare const _default: ({
|
|
|
126
128
|
value: string;
|
|
127
129
|
})[];
|
|
128
130
|
placeholder?: undefined;
|
|
131
|
+
customConditional?: undefined;
|
|
129
132
|
logic?: undefined;
|
|
130
133
|
dataSrc?: undefined;
|
|
131
134
|
valueProperty?: undefined;
|
|
@@ -141,6 +144,7 @@ declare const _default: ({
|
|
|
141
144
|
tooltip: string;
|
|
142
145
|
key: string;
|
|
143
146
|
input: boolean;
|
|
147
|
+
customConditional: string;
|
|
144
148
|
logic: ({
|
|
145
149
|
name: string;
|
|
146
150
|
trigger: {
|
|
@@ -211,6 +215,7 @@ declare const _default: ({
|
|
|
211
215
|
inline?: undefined;
|
|
212
216
|
defaultValue?: undefined;
|
|
213
217
|
values?: undefined;
|
|
218
|
+
customConditional?: undefined;
|
|
214
219
|
logic?: undefined;
|
|
215
220
|
as?: undefined;
|
|
216
221
|
editor?: undefined;
|
|
@@ -226,6 +231,7 @@ declare const _default: ({
|
|
|
226
231
|
placeholder?: undefined;
|
|
227
232
|
inline?: undefined;
|
|
228
233
|
values?: undefined;
|
|
234
|
+
customConditional?: undefined;
|
|
229
235
|
logic?: undefined;
|
|
230
236
|
dataSrc?: undefined;
|
|
231
237
|
valueProperty?: undefined;
|
|
@@ -248,6 +254,7 @@ declare const _default: ({
|
|
|
248
254
|
placeholder?: undefined;
|
|
249
255
|
inline?: undefined;
|
|
250
256
|
values?: undefined;
|
|
257
|
+
customConditional?: undefined;
|
|
251
258
|
logic?: undefined;
|
|
252
259
|
dataSrc?: undefined;
|
|
253
260
|
valueProperty?: undefined;
|
|
@@ -20,6 +20,7 @@ class Input extends Multivalue_1.default {
|
|
|
20
20
|
}, ...extend);
|
|
21
21
|
}
|
|
22
22
|
get inputInfo() {
|
|
23
|
+
var _a;
|
|
23
24
|
const attr = {
|
|
24
25
|
name: this.options.name,
|
|
25
26
|
type: this.component.inputType || 'text',
|
|
@@ -34,7 +35,7 @@ class Input extends Multivalue_1.default {
|
|
|
34
35
|
if (this.component.inputMode) {
|
|
35
36
|
attr.inputmode = this.component.inputMode;
|
|
36
37
|
}
|
|
37
|
-
if (this.component.placeholder) {
|
|
38
|
+
if (this.component.placeholder && !((_a = this.options) === null || _a === void 0 ? void 0 : _a.readOnly)) {
|
|
38
39
|
attr.placeholder = this.getFormattedAttribute(this.component.placeholder);
|
|
39
40
|
}
|
|
40
41
|
if (this.component.tabindex) {
|
|
@@ -166,6 +167,9 @@ class Input extends Multivalue_1.default {
|
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
169
|
updateValueAt(value, flags, index) {
|
|
170
|
+
if (flags.modified) {
|
|
171
|
+
(0, index_1.announceScreenReaderMessage)(this, value, index);
|
|
172
|
+
}
|
|
169
173
|
flags = flags || {};
|
|
170
174
|
if (lodash_1.default.get(this.component, 'showWordCount', false)) {
|
|
171
175
|
if (this.refs.wordcount && this.refs.wordcount[index]) {
|
|
@@ -190,7 +194,7 @@ class Input extends Multivalue_1.default {
|
|
|
190
194
|
updateValue(value, flags, index) {
|
|
191
195
|
flags = flags || {};
|
|
192
196
|
const changed = super.updateValue(value, flags);
|
|
193
|
-
this.triggerUpdateValueAt(this.dataValue, flags, index);
|
|
197
|
+
this.triggerUpdateValueAt(this.dataValue, Object.assign({}, flags), index);
|
|
194
198
|
return changed;
|
|
195
199
|
}
|
|
196
200
|
parseValue(value) {
|
|
@@ -201,6 +205,7 @@ class Input extends Multivalue_1.default {
|
|
|
201
205
|
}
|
|
202
206
|
attach(element) {
|
|
203
207
|
this.loadRefs(element, {
|
|
208
|
+
announceMessage: 'multiple',
|
|
204
209
|
charcount: 'multiple',
|
|
205
210
|
wordcount: 'multiple',
|
|
206
211
|
prefix: 'multiple',
|
|
@@ -244,6 +249,16 @@ class Input extends Multivalue_1.default {
|
|
|
244
249
|
}
|
|
245
250
|
});
|
|
246
251
|
}
|
|
252
|
+
this.on('focus', (comp) => {
|
|
253
|
+
(0, index_1.announceScreenReaderMessage)(comp, comp.dataValue, 0, true);
|
|
254
|
+
});
|
|
255
|
+
this.on('blur', (comp) => {
|
|
256
|
+
var _a, _b;
|
|
257
|
+
const el = (_b = (_a = comp.refs) === null || _a === void 0 ? void 0 : _a["announceMessage"]) === null || _b === void 0 ? void 0 : _b[0];
|
|
258
|
+
if (el) {
|
|
259
|
+
el.textContent = "";
|
|
260
|
+
}
|
|
261
|
+
});
|
|
247
262
|
return promise;
|
|
248
263
|
}
|
|
249
264
|
/**
|
|
@@ -835,6 +835,11 @@ class NestedComponent extends Field_1.default {
|
|
|
835
835
|
else if (value && component.hasValue(value)) {
|
|
836
836
|
return component.setValue(lodash_1.default.get(value, component.key), flags);
|
|
837
837
|
}
|
|
838
|
+
// if no value is provided and noDefault flag, set empty value
|
|
839
|
+
else if (flags.noDefault && component.allowData) {
|
|
840
|
+
flags.resetValue = true;
|
|
841
|
+
return component.setValue(component.emptyValue, flags);
|
|
842
|
+
}
|
|
838
843
|
else if ((!this.rootPristine || component.visible) &&
|
|
839
844
|
(flags.resetValue || component.shouldAddDefaultValue)) {
|
|
840
845
|
flags.noValidate = !flags.dirty;
|
|
@@ -310,6 +310,7 @@ class AddressComponent extends Container_1.default {
|
|
|
310
310
|
return this.refs ? this.refs[AddressComponent.removeRowButtonRef] || null : null;
|
|
311
311
|
}
|
|
312
312
|
get searchInputAttributes() {
|
|
313
|
+
var _a;
|
|
313
314
|
const attr = {
|
|
314
315
|
name: this.options.name,
|
|
315
316
|
type: 'text',
|
|
@@ -317,7 +318,7 @@ class AddressComponent extends Container_1.default {
|
|
|
317
318
|
lang: this.options.language,
|
|
318
319
|
tabindex: this.component.tabindex || 0,
|
|
319
320
|
};
|
|
320
|
-
if (this.component.placeholder) {
|
|
321
|
+
if (this.component.placeholder && !((_a = this.options) === null || _a === void 0 ? void 0 : _a.readOnly)) {
|
|
321
322
|
((attr.placeholder = this.t(this.component.placeholder)), { _userInput: true });
|
|
322
323
|
}
|
|
323
324
|
if (this.disabled) {
|
|
@@ -402,6 +403,7 @@ class AddressComponent extends Container_1.default {
|
|
|
402
403
|
super.redraw();
|
|
403
404
|
}
|
|
404
405
|
attach(element) {
|
|
406
|
+
var _a;
|
|
405
407
|
const result = (this.builderMode || this.manualMode ? super.attach : Field_1.default.prototype.attach).call(this, element);
|
|
406
408
|
if (!this.builderMode) {
|
|
407
409
|
if (!this.provider && this.component.provider) {
|
|
@@ -417,6 +419,20 @@ class AddressComponent extends Container_1.default {
|
|
|
417
419
|
[AddressComponent.removeValueIconRef]: 'multiple',
|
|
418
420
|
[AddressComponent.searchInputRef]: 'multiple',
|
|
419
421
|
});
|
|
422
|
+
// We define a container for rendering autocomplete.
|
|
423
|
+
// If isInShadowDOM=true then we render it in shadow dom otherwise in the document body.
|
|
424
|
+
const isInShadowDOM = typeof ShadowRoot !== 'undefined' && ((_a = this.element) === null || _a === void 0 ? void 0 : _a.getRootNode()) instanceof ShadowRoot;
|
|
425
|
+
let container;
|
|
426
|
+
if (isInShadowDOM) {
|
|
427
|
+
const shadowRoot = this.element.getRootNode();
|
|
428
|
+
container = document.createElement('div');
|
|
429
|
+
const target = shadowRoot.querySelector('.formio-form-wrapper');
|
|
430
|
+
target.appendChild(container);
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
container = document.createElement('div');
|
|
434
|
+
document.body.appendChild(container);
|
|
435
|
+
}
|
|
420
436
|
this.searchInput.forEach((element, index) => {
|
|
421
437
|
if (!this.builderMode && element && this.provider) {
|
|
422
438
|
if (this.component.provider === 'google') {
|
|
@@ -425,6 +441,7 @@ class AddressComponent extends Container_1.default {
|
|
|
425
441
|
else {
|
|
426
442
|
(0, autocompleter_1.default)({
|
|
427
443
|
input: element,
|
|
444
|
+
container,
|
|
428
445
|
debounceWaitMs: 300,
|
|
429
446
|
fetch: (text, update) => {
|
|
430
447
|
const query = text;
|
|
@@ -113,6 +113,17 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
113
113
|
for (let dIndex = defaultValue.length; dIndex < this.minLength; dIndex++) {
|
|
114
114
|
defaultValue.push({});
|
|
115
115
|
}
|
|
116
|
+
if (this.component.customDefaultValue) {
|
|
117
|
+
return defaultValue;
|
|
118
|
+
}
|
|
119
|
+
if (defaultValue.length === 1 && this.columns) {
|
|
120
|
+
(0, utils_1.eachComponent)(this.components, (comp, path) => {
|
|
121
|
+
var _a;
|
|
122
|
+
if (((_a = comp.component) === null || _a === void 0 ? void 0 : _a.input) && comp.defaultValue) {
|
|
123
|
+
lodash_1.default.set(defaultValue[0], path, comp.defaultValue);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
116
127
|
return defaultValue;
|
|
117
128
|
}
|
|
118
129
|
set disabled(disabled) {
|
|
@@ -437,7 +448,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
437
448
|
});
|
|
438
449
|
(0, utils_1.screenReaderSpeech)('Row has been added');
|
|
439
450
|
this.checkConditions();
|
|
440
|
-
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this, { modified: true });
|
|
451
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this, { modified: true, noPristineChangeOnModified: true });
|
|
441
452
|
this.redraw().then(() => {
|
|
442
453
|
this.focusOnNewRowElement(this.rows[index]);
|
|
443
454
|
});
|
|
@@ -525,7 +536,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
525
536
|
options.row = `${rowIndex}-${colIndex}`;
|
|
526
537
|
options.rowIndex = rowIndex;
|
|
527
538
|
options.onChange = (flags, changed, modified) => {
|
|
528
|
-
var _a, _b, _c, _d
|
|
539
|
+
var _a, _b, _c, _d;
|
|
529
540
|
if (changed.component.type === 'form') {
|
|
530
541
|
const formComp = (0, utils_1.getComponent)(this.component.components, changed.component.key);
|
|
531
542
|
lodash_1.default.set(formComp, 'components', changed.component.components);
|
|
@@ -535,7 +546,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
535
546
|
(_d = (_c = changed.instance.root).triggerChange) === null || _d === void 0 ? void 0 : _d.call(_c, flags, changed, modified);
|
|
536
547
|
}
|
|
537
548
|
else {
|
|
538
|
-
|
|
549
|
+
this.triggerRootChange(flags, changed, modified);
|
|
539
550
|
}
|
|
540
551
|
};
|
|
541
552
|
let columnComponent;
|
|
@@ -15,6 +15,10 @@ export default class DataMapComponent extends DataGridComponent {
|
|
|
15
15
|
disableBuilderActions: boolean;
|
|
16
16
|
};
|
|
17
17
|
get valueKey(): any;
|
|
18
|
+
get iteratableRows(): {
|
|
19
|
+
components: any;
|
|
20
|
+
data: any;
|
|
21
|
+
}[][];
|
|
18
22
|
hasHeader(): boolean;
|
|
19
23
|
getRowKey(rowIndex: any): string;
|
|
20
24
|
get defaultRowKey(): string;
|
|
@@ -123,14 +123,15 @@ class DataMapComponent extends DataGrid_1.default {
|
|
|
123
123
|
}
|
|
124
124
|
get iteratableRows() {
|
|
125
125
|
return this.rows.map((row) => {
|
|
126
|
-
return {
|
|
127
|
-
components: row,
|
|
128
|
-
data:
|
|
129
|
-
};
|
|
126
|
+
return Object.keys(row).map((key) => ({
|
|
127
|
+
components: row[key],
|
|
128
|
+
data: row[key].dataValue,
|
|
129
|
+
}));
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
componentContext(component) {
|
|
133
|
-
return this.iteratableRows[component.row].
|
|
133
|
+
return this.iteratableRows[component.row].find((comp) => comp.components.key === component.key)
|
|
134
|
+
.data;
|
|
134
135
|
}
|
|
135
136
|
hasHeader() {
|
|
136
137
|
return true;
|
|
@@ -10,6 +10,7 @@ export default class FieldsetComponent extends NestedComponent {
|
|
|
10
10
|
};
|
|
11
11
|
static savedValueTypes(): never[];
|
|
12
12
|
constructor(...args: any[]);
|
|
13
|
+
attach(element: any): Promise<void>;
|
|
13
14
|
noField: boolean;
|
|
14
15
|
}
|
|
15
16
|
import NestedComponent from '../_classes/nested/NestedComponent';
|
|
@@ -12,6 +12,7 @@ class FieldsetComponent extends NestedComponent_1.default {
|
|
|
12
12
|
type: 'fieldset',
|
|
13
13
|
legend: '',
|
|
14
14
|
components: [],
|
|
15
|
+
clearOnHide: false,
|
|
15
16
|
input: false,
|
|
16
17
|
persistent: false,
|
|
17
18
|
}, ...extend);
|
|
@@ -39,6 +40,13 @@ class FieldsetComponent extends NestedComponent_1.default {
|
|
|
39
40
|
get templateName() {
|
|
40
41
|
return 'fieldset';
|
|
41
42
|
}
|
|
43
|
+
attach(element) {
|
|
44
|
+
return super.attach(element).then(() => {
|
|
45
|
+
if (this.component.legend && this.refs.header) {
|
|
46
|
+
this.refs.header.setAttribute('id', `l-${this.id}-legend`);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
42
50
|
constructor(...args) {
|
|
43
51
|
super(...args);
|
|
44
52
|
this.noField = true;
|
|
@@ -30,6 +30,8 @@ export default class FileComponent extends Field {
|
|
|
30
30
|
} | undefined;
|
|
31
31
|
isSyncing: boolean | undefined;
|
|
32
32
|
abortUploads: any[] | undefined;
|
|
33
|
+
pendingfiles: any;
|
|
34
|
+
resolvedFiles: any[] | undefined;
|
|
33
35
|
get dataReady(): Promise<any>;
|
|
34
36
|
loadImage(fileInfo: any): any;
|
|
35
37
|
get emptyValue(): never[];
|
|
@@ -147,7 +149,7 @@ export default class FileComponent extends Field {
|
|
|
147
149
|
getMultipartOptions(fileToSync: any): any;
|
|
148
150
|
uploadFile(fileToSync: any): Promise<any>;
|
|
149
151
|
upload(): Promise<void | {
|
|
150
|
-
fileToSync:
|
|
152
|
+
fileToSync: any;
|
|
151
153
|
fileInfo: any;
|
|
152
154
|
}[]>;
|
|
153
155
|
syncFiles(): Promise<void>;
|
|
@@ -107,6 +107,8 @@ class FileComponent extends Field_1.default {
|
|
|
107
107
|
};
|
|
108
108
|
this.isSyncing = false;
|
|
109
109
|
this.abortUploads = [];
|
|
110
|
+
this.pendingfiles = [];
|
|
111
|
+
this.resolvedFiles = [];
|
|
110
112
|
}
|
|
111
113
|
get dataReady() {
|
|
112
114
|
return this.filesReady || Promise.resolve();
|
|
@@ -700,22 +702,42 @@ class FileComponent extends Field_1.default {
|
|
|
700
702
|
};
|
|
701
703
|
}
|
|
702
704
|
// Check file minimum size
|
|
703
|
-
if (this.component.fileMinSize
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
705
|
+
if (this.component.fileMinSize) {
|
|
706
|
+
const interpolatedMinSize = this.interpolate(this.component.fileMinSize, this.evalContext());
|
|
707
|
+
// This case is when the user entered fileMinSize expression, but did not enter or made a typo when
|
|
708
|
+
// setting the fileMinSize variable in the config of the project
|
|
709
|
+
if (!interpolatedMinSize) {
|
|
710
|
+
return {
|
|
711
|
+
status: 'error',
|
|
712
|
+
message: 'Please, check the entered parameters',
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
if (!this.validateMinSize(file, interpolatedMinSize)) {
|
|
716
|
+
return {
|
|
717
|
+
status: 'error',
|
|
718
|
+
message: this.t('fileTooSmall', {
|
|
719
|
+
size: interpolatedMinSize,
|
|
720
|
+
}),
|
|
721
|
+
};
|
|
722
|
+
}
|
|
710
723
|
}
|
|
711
724
|
// Check file maximum size
|
|
712
|
-
if (this.component.fileMaxSize
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
725
|
+
if (this.component.fileMaxSize) {
|
|
726
|
+
const interpolatedMaxSize = this.interpolate(this.component.fileMaxSize, this.evalContext());
|
|
727
|
+
if (!interpolatedMaxSize) {
|
|
728
|
+
return {
|
|
729
|
+
status: 'error',
|
|
730
|
+
message: 'Please, check the entered parameters',
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
if (!this.validateMaxSize(file, interpolatedMaxSize)) {
|
|
734
|
+
return {
|
|
735
|
+
status: 'error',
|
|
736
|
+
message: this.t('fileTooBig', {
|
|
737
|
+
size: interpolatedMaxSize,
|
|
738
|
+
}),
|
|
739
|
+
};
|
|
740
|
+
}
|
|
719
741
|
}
|
|
720
742
|
return {};
|
|
721
743
|
}
|
|
@@ -972,7 +994,23 @@ class FileComponent extends Field_1.default {
|
|
|
972
994
|
fileInfo,
|
|
973
995
|
};
|
|
974
996
|
}
|
|
975
|
-
|
|
997
|
+
if (fileToSync.status === "success") {
|
|
998
|
+
const uploadedFile = this.resolvedFiles.find(x => x.fileToSync.originalName === fileToSync.originalName);
|
|
999
|
+
return {
|
|
1000
|
+
fileToSync: uploadedFile.fileToSync,
|
|
1001
|
+
fileInfo: uploadedFile.fileInfo,
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
const pendingFile = this.pendingfiles.find(x => x.name === fileToSync.name);
|
|
1005
|
+
if (pendingFile) {
|
|
1006
|
+
fileInfo = yield pendingFile.fileInfoProm;
|
|
1007
|
+
}
|
|
1008
|
+
else {
|
|
1009
|
+
const promInfo = this.uploadFile(fileToSync);
|
|
1010
|
+
this.pendingfiles.push({ name: fileToSync.name, fileInfoProm: promInfo });
|
|
1011
|
+
fileInfo = yield promInfo;
|
|
1012
|
+
}
|
|
1013
|
+
this.pendingfiles = this.pendingfiles.filter(x => x.name !== fileToSync.name);
|
|
976
1014
|
fileToSync.status = 'success';
|
|
977
1015
|
fileToSync.message = this.t('Succefully uploaded');
|
|
978
1016
|
fileInfo.originalName = fileToSync.originalName;
|
|
@@ -997,6 +1035,10 @@ class FileComponent extends Field_1.default {
|
|
|
997
1035
|
finally {
|
|
998
1036
|
delete fileToSync.progress;
|
|
999
1037
|
this.redraw();
|
|
1038
|
+
const fileExists = this.resolvedFiles.find(x => x.fileInfo.originalName === fileToSync.originalName);
|
|
1039
|
+
if (!fileExists) {
|
|
1040
|
+
this.resolvedFiles.push({ fileToSync, fileInfo });
|
|
1041
|
+
}
|
|
1000
1042
|
}
|
|
1001
1043
|
return {
|
|
1002
1044
|
fileToSync,
|
|
@@ -1006,7 +1048,7 @@ class FileComponent extends Field_1.default {
|
|
|
1006
1048
|
});
|
|
1007
1049
|
}
|
|
1008
1050
|
syncFiles() {
|
|
1009
|
-
var _a;
|
|
1051
|
+
var _a, _b, _c;
|
|
1010
1052
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1011
1053
|
this.isSyncing = true;
|
|
1012
1054
|
this.fileDropHidden = true;
|
|
@@ -1016,6 +1058,9 @@ class FileComponent extends Field_1.default {
|
|
|
1016
1058
|
this.delete(),
|
|
1017
1059
|
this.upload(),
|
|
1018
1060
|
]);
|
|
1061
|
+
if (filesToUpload.length !== ((_b = (_a = this.filesToSync) === null || _a === void 0 ? void 0 : _a.filesToUpload) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1019
1064
|
this.filesToSync.filesToDelete = filesToDelete
|
|
1020
1065
|
.filter((file) => { var _a; return ((_a = file.fileToSync) === null || _a === void 0 ? void 0 : _a.status) === 'error'; })
|
|
1021
1066
|
.map((file) => file.fileToSync);
|
|
@@ -1029,7 +1074,7 @@ class FileComponent extends Field_1.default {
|
|
|
1029
1074
|
.filter((file) => { var _a; return ((_a = file.fileToSync) === null || _a === void 0 ? void 0 : _a.status) === 'success'; })
|
|
1030
1075
|
.map((file) => file.fileInfo);
|
|
1031
1076
|
this.dataValue.push(...data);
|
|
1032
|
-
(
|
|
1077
|
+
(_c = this.triggerChange) === null || _c === void 0 ? void 0 : _c.call(this, {
|
|
1033
1078
|
modified: true,
|
|
1034
1079
|
});
|
|
1035
1080
|
return Promise.resolve();
|
|
@@ -564,7 +564,8 @@ class FormComponent extends Component_1.default {
|
|
|
564
564
|
get shouldSubmit() {
|
|
565
565
|
return (this.subFormReady &&
|
|
566
566
|
(!this.component.hasOwnProperty('reference') || this.component.reference) &&
|
|
567
|
-
!this.shouldConditionallyClear()
|
|
567
|
+
!this.shouldConditionallyClear() &&
|
|
568
|
+
!(this.component.hidden && this.component.clearOnHide));
|
|
568
569
|
}
|
|
569
570
|
/**
|
|
570
571
|
* Returns the data for the subform.
|
|
@@ -276,9 +276,9 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
276
276
|
// Inside DataTable component won't have dataValue set
|
|
277
277
|
const shouldUseSelectData = (this.component.multiple && lodash_1.default.isArray(this.dataValue)
|
|
278
278
|
? this.dataValue.find((val) => this.normalizeSingleValue(value) === val)
|
|
279
|
-
: this.dataValue === this.normalizeSingleValue(value)) || this.inDataTable;
|
|
279
|
+
: this.dataValue === this.normalizeSingleValue(value)) || (this.inDataTable && !this.element);
|
|
280
280
|
if (shouldUseSelectData) {
|
|
281
|
-
const selectData = this.selectData;
|
|
281
|
+
const selectData = (this.inDataTable && !this.element) ? this.component.selectData : this.selectData;
|
|
282
282
|
if (selectData) {
|
|
283
283
|
const templateValue = this.component.reference && (value === null || value === void 0 ? void 0 : value._id) ? value._id.toString() : value;
|
|
284
284
|
if (!this.templateData || !this.templateData[templateValue]) {
|
|
@@ -519,7 +519,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
519
519
|
noUpdateEvent: true,
|
|
520
520
|
});
|
|
521
521
|
}
|
|
522
|
-
else if (this.shouldAddDefaultValue && !this.options.readOnly) {
|
|
522
|
+
else if (this.shouldAddDefaultValue && !this.options.readOnly && this.root && !this.root.submissionSet) {
|
|
523
523
|
// If a default value is provided then select it.
|
|
524
524
|
const defaultValue = this.defaultValue;
|
|
525
525
|
if (!this.isEmpty(defaultValue)) {
|
|
@@ -766,7 +766,8 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
768
|
addPlaceholder() {
|
|
769
|
-
|
|
769
|
+
var _a;
|
|
770
|
+
if (!this.component.placeholder || ((_a = this.options) === null || _a === void 0 ? void 0 : _a.readOnly)) {
|
|
770
771
|
return;
|
|
771
772
|
}
|
|
772
773
|
this.addOption('', this.component.placeholder, { placeholder: true });
|
|
@@ -830,10 +831,12 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
830
831
|
: element;
|
|
831
832
|
}
|
|
832
833
|
choicesOptions() {
|
|
834
|
+
var _a;
|
|
833
835
|
const useSearch = this.component.hasOwnProperty('searchEnabled')
|
|
834
836
|
? this.component.searchEnabled
|
|
835
837
|
: true;
|
|
836
|
-
const
|
|
838
|
+
const hasPlaceholder = !!this.component.placeholder && !((_a = this.options) === null || _a === void 0 ? void 0 : _a.readOnly);
|
|
839
|
+
const placeholderValue = hasPlaceholder ? this.t(this.component.placeholder, { _userInput: true }) : null;
|
|
837
840
|
let customOptions = this.component.customOptions || {};
|
|
838
841
|
if (typeof customOptions == 'string') {
|
|
839
842
|
try {
|
|
@@ -857,7 +860,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
857
860
|
'formio-choices',
|
|
858
861
|
],
|
|
859
862
|
containerInner: this.transform('class', 'form-control ui fluid selection dropdown').split(' '),
|
|
860
|
-
}, addItemText: false, allowHTML: true, placeholder:
|
|
863
|
+
}, addItemText: false, allowHTML: true, placeholder: hasPlaceholder, placeholderValue: placeholderValue, noResultsText: this.t('No results found'), noChoicesText: this.t('No choices to choose from'), searchPlaceholderValue: this.t('Type to search'), shouldSort: false, position: this.component.dropdown || 'auto', searchEnabled: useSearch, searchChoices: !this.component.searchField, searchFields: lodash_1.default.get(this, 'component.searchFields', [
|
|
861
864
|
'label',
|
|
862
865
|
]), shadowRoot: this.root ? this.root.shadowRoot : null, fuseOptions: this.component.useExactSearch
|
|
863
866
|
? Object.assign({ tokenize: true, matchAllTokens: true }, commonFuseOptions) : Object.assign({}, lodash_1.default.get(this, 'component.fuseOptions', {}), Object.assign({ include: 'score', threshold: lodash_1.default.get(this, 'component.selectThreshold', 0.3) }, commonFuseOptions)), valueComparer: lodash_1.default.isEqual, resetScrollPosition: false, duplicateItemsAllowed: false }, customOptions);
|
|
@@ -1296,7 +1299,8 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1296
1299
|
}
|
|
1297
1300
|
setMetadata(value, flags = {}) {
|
|
1298
1301
|
var _a, _b;
|
|
1299
|
-
if (lodash_1.default.isNil(value)
|
|
1302
|
+
if (lodash_1.default.isNil(value) ||
|
|
1303
|
+
(this.inDataTable && this.component.dataSrc === 'values')) {
|
|
1300
1304
|
return;
|
|
1301
1305
|
}
|
|
1302
1306
|
const valueIsObject = lodash_1.default.isObject(value);
|
|
@@ -1306,7 +1310,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1306
1310
|
}
|
|
1307
1311
|
// Check to see if we need to save off the template data into our metadata.
|
|
1308
1312
|
const templateValue = this.component.reference && (value === null || value === void 0 ? void 0 : value._id) ? value._id.toString() : value;
|
|
1309
|
-
const shouldSaveData = (!valueIsObject || this.component.reference) && !this.inDataTable;
|
|
1313
|
+
const shouldSaveData = (!valueIsObject || this.component.reference) && !(this.inDataTable && this.row === '');
|
|
1310
1314
|
if (!lodash_1.default.isNil(templateValue) &&
|
|
1311
1315
|
shouldSaveData &&
|
|
1312
1316
|
this.templateData &&
|
|
@@ -1592,7 +1596,8 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1592
1596
|
asString(value, options = {}) {
|
|
1593
1597
|
var _a;
|
|
1594
1598
|
value = value !== null && value !== void 0 ? value : this.getValue();
|
|
1595
|
-
if (options.modalPreview ||
|
|
1599
|
+
if (options.modalPreview ||
|
|
1600
|
+
((this.inDataTable || this.inEditGrid) && !['values', 'custom'].includes(this.component.dataSrc))) {
|
|
1596
1601
|
if (this.inDataTable) {
|
|
1597
1602
|
value = this.undoValueTyping(value);
|
|
1598
1603
|
}
|
|
@@ -10,6 +10,8 @@ declare const _default: ({
|
|
|
10
10
|
validate?: undefined;
|
|
11
11
|
autofocus?: undefined;
|
|
12
12
|
overrideEditForm?: undefined;
|
|
13
|
+
multiple?: undefined;
|
|
14
|
+
customConditional?: undefined;
|
|
13
15
|
dataSrc?: undefined;
|
|
14
16
|
data?: undefined;
|
|
15
17
|
defaultValue?: undefined;
|
|
@@ -27,6 +29,8 @@ declare const _default: ({
|
|
|
27
29
|
autofocus: boolean;
|
|
28
30
|
overrideEditForm: boolean;
|
|
29
31
|
ignore?: undefined;
|
|
32
|
+
multiple?: undefined;
|
|
33
|
+
customConditional?: undefined;
|
|
30
34
|
dataSrc?: undefined;
|
|
31
35
|
data?: undefined;
|
|
32
36
|
defaultValue?: undefined;
|
|
@@ -42,6 +46,25 @@ declare const _default: ({
|
|
|
42
46
|
validate?: undefined;
|
|
43
47
|
autofocus?: undefined;
|
|
44
48
|
overrideEditForm?: undefined;
|
|
49
|
+
multiple?: undefined;
|
|
50
|
+
customConditional?: undefined;
|
|
51
|
+
dataSrc?: undefined;
|
|
52
|
+
data?: undefined;
|
|
53
|
+
defaultValue?: undefined;
|
|
54
|
+
} | {
|
|
55
|
+
label: string;
|
|
56
|
+
multiple: boolean;
|
|
57
|
+
key: string;
|
|
58
|
+
type: string;
|
|
59
|
+
input: boolean;
|
|
60
|
+
tooltip: string;
|
|
61
|
+
customConditional: string;
|
|
62
|
+
weight: number;
|
|
63
|
+
ignore?: undefined;
|
|
64
|
+
placeholder?: undefined;
|
|
65
|
+
validate?: undefined;
|
|
66
|
+
autofocus?: undefined;
|
|
67
|
+
overrideEditForm?: undefined;
|
|
45
68
|
dataSrc?: undefined;
|
|
46
69
|
data?: undefined;
|
|
47
70
|
defaultValue?: undefined;
|
|
@@ -57,6 +80,8 @@ declare const _default: ({
|
|
|
57
80
|
validate?: undefined;
|
|
58
81
|
autofocus?: undefined;
|
|
59
82
|
overrideEditForm?: undefined;
|
|
83
|
+
multiple?: undefined;
|
|
84
|
+
customConditional?: undefined;
|
|
60
85
|
dataSrc?: undefined;
|
|
61
86
|
data?: undefined;
|
|
62
87
|
defaultValue?: undefined;
|
|
@@ -80,5 +105,7 @@ declare const _default: ({
|
|
|
80
105
|
validate?: undefined;
|
|
81
106
|
autofocus?: undefined;
|
|
82
107
|
overrideEditForm?: undefined;
|
|
108
|
+
multiple?: undefined;
|
|
109
|
+
customConditional?: undefined;
|
|
83
110
|
})[];
|
|
84
111
|
export default _default;
|
|
@@ -69,6 +69,16 @@ exports.default = [
|
|
|
69
69
|
placeholder: 'Number of Columns',
|
|
70
70
|
tooltip: 'Enter the number or columns that should be displayed by this table.',
|
|
71
71
|
},
|
|
72
|
+
{
|
|
73
|
+
label: "Column Headers",
|
|
74
|
+
multiple: true,
|
|
75
|
+
key: "header",
|
|
76
|
+
type: "textfield",
|
|
77
|
+
input: true,
|
|
78
|
+
tooltip: 'Enter header names for the columns',
|
|
79
|
+
customConditional: "if(instance && instance.dataValue && Array.isArray(instance.dataValue)) {\r\n const isAllowToAddHeader = instance.dataValue.length < data.numCols;\r\n const addBtn = _.get(instance, 'refs.addButton[0]', null);\r\n if(addBtn) {\r\n isAllowToAddHeader? addBtn.removeAttribute('disabled'): addBtn.setAttribute('disabled', 'disabled');\r\n }\r\n} ",
|
|
80
|
+
weight: 3,
|
|
81
|
+
},
|
|
72
82
|
{
|
|
73
83
|
type: 'checkbox',
|
|
74
84
|
label: 'Clone Row Components',
|
|
@@ -63,6 +63,7 @@ class TagsComponent extends Input_1.default {
|
|
|
63
63
|
return this.component.delimeter || ',';
|
|
64
64
|
}
|
|
65
65
|
attachElement(element, index) {
|
|
66
|
+
var _a;
|
|
66
67
|
super.attachElement(element, index);
|
|
67
68
|
if (!element) {
|
|
68
69
|
return;
|
|
@@ -76,7 +77,7 @@ class TagsComponent extends Input_1.default {
|
|
|
76
77
|
if (!choices_js_1.default) {
|
|
77
78
|
return;
|
|
78
79
|
}
|
|
79
|
-
const hasPlaceholder = !!this.component.placeholder;
|
|
80
|
+
const hasPlaceholder = !!this.component.placeholder && !((_a = this.options) === null || _a === void 0 ? void 0 : _a.readOnly);
|
|
80
81
|
this.choices = new choices_js_1.default(element, {
|
|
81
82
|
delimiter: this.delimiter,
|
|
82
83
|
editItems: true,
|
package/lib/cjs/package.json
CHANGED