@formio/js 5.0.0-dev.5664.1af299f → 5.0.0-dev.5664.50b8944
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 -2
- package/dist/formio.form.js +14 -14
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +14 -14
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +1 -1
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/Formio.js +1 -0
- package/lib/cjs/Webform.d.ts +7 -0
- package/lib/cjs/Webform.js +18 -5
- package/lib/cjs/components/_classes/component/Component.d.ts +13 -0
- package/lib/cjs/components/_classes/component/Component.js +27 -13
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
- package/lib/cjs/components/_classes/component/fixtures/comp7.d.ts +84 -0
- package/lib/cjs/components/_classes/component/fixtures/comp7.js +86 -0
- package/lib/cjs/components/_classes/component/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/_classes/component/fixtures/index.js +3 -1
- package/lib/cjs/components/_classes/input/Input.js +23 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +8 -1
- package/lib/cjs/components/datagrid/DataGrid.js +3 -0
- package/lib/cjs/components/datagrid/fixtures/comp9.d.ts +41 -0
- package/lib/cjs/components/datagrid/fixtures/comp9.js +44 -0
- package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
- package/lib/cjs/components/editgrid/EditGrid.js +2 -2
- package/lib/cjs/components/form/Form.d.ts +7 -0
- package/lib/cjs/components/form/Form.js +10 -1
- package/lib/cjs/components/number/Number.js +1 -1
- package/lib/cjs/components/number/fixtures/comp8.d.ts +32 -0
- package/lib/cjs/components/number/fixtures/comp8.js +28 -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/phonenumber/fixtures/comp2.d.ts +16 -0
- package/lib/cjs/components/phonenumber/fixtures/comp2.js +25 -0
- package/lib/cjs/components/phonenumber/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/phonenumber/fixtures/index.js +3 -1
- package/lib/cjs/components/select/Select.js +1 -2
- package/lib/cjs/components/signature/Signature.d.ts +0 -1
- package/lib/cjs/components/signature/Signature.js +1 -1
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +5 -0
- package/lib/cjs/providers/address/GoogleAddressProvider.js +23 -1
- package/lib/cjs/utils/utils.js +0 -4
- package/lib/mjs/Formio.js +1 -0
- package/lib/mjs/Webform.d.ts +7 -0
- package/lib/mjs/Webform.js +18 -5
- package/lib/mjs/components/_classes/component/Component.d.ts +13 -0
- package/lib/mjs/components/_classes/component/Component.js +35 -13
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
- package/lib/mjs/components/_classes/component/fixtures/comp7.d.ts +84 -0
- package/lib/mjs/components/_classes/component/fixtures/comp7.js +84 -0
- package/lib/mjs/components/_classes/component/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/_classes/component/fixtures/index.js +2 -1
- package/lib/mjs/components/_classes/input/Input.js +22 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +8 -1
- package/lib/mjs/components/datagrid/DataGrid.js +3 -0
- package/lib/mjs/components/datagrid/fixtures/comp9.d.ts +41 -0
- package/lib/mjs/components/datagrid/fixtures/comp9.js +42 -0
- package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
- package/lib/mjs/components/editgrid/EditGrid.js +2 -2
- package/lib/mjs/components/form/Form.d.ts +7 -0
- package/lib/mjs/components/form/Form.js +10 -1
- package/lib/mjs/components/number/Number.js +1 -1
- package/lib/mjs/components/number/fixtures/comp8.d.ts +32 -0
- package/lib/mjs/components/number/fixtures/comp8.js +26 -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/phonenumber/fixtures/comp2.d.ts +16 -0
- package/lib/mjs/components/phonenumber/fixtures/comp2.js +23 -0
- package/lib/mjs/components/phonenumber/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/phonenumber/fixtures/index.js +2 -1
- package/lib/mjs/components/select/Select.js +1 -2
- package/lib/mjs/components/signature/Signature.d.ts +0 -1
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +5 -0
- package/lib/mjs/providers/address/GoogleAddressProvider.js +22 -1
- package/lib/mjs/utils/utils.js +0 -4
- package/package.json +1 -2
|
@@ -233,7 +233,28 @@ export default class Input extends Multivalue {
|
|
|
233
233
|
if (key === 13) {
|
|
234
234
|
event.preventDefault();
|
|
235
235
|
event.stopPropagation();
|
|
236
|
-
|
|
236
|
+
let submitButton = null;
|
|
237
|
+
if (this.root?.everyComponent) {
|
|
238
|
+
this.root.everyComponent((component) => {
|
|
239
|
+
if (component?.component.type === 'button' &&
|
|
240
|
+
component?.component.action === 'submit') {
|
|
241
|
+
submitButton = component;
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
const options = {};
|
|
247
|
+
if (submitButton) {
|
|
248
|
+
options.instance = submitButton;
|
|
249
|
+
options.component = submitButton.component;
|
|
250
|
+
options.noValidate = this.component.state === 'draft';
|
|
251
|
+
options.state = this.component.state || 'submitted';
|
|
252
|
+
submitButton.loading = true;
|
|
253
|
+
this.emit('submitButton', options);
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
this.emit('submitButton', options);
|
|
257
|
+
}
|
|
237
258
|
}
|
|
238
259
|
});
|
|
239
260
|
}
|
|
@@ -44,7 +44,7 @@ export default class Multivalue extends Field {
|
|
|
44
44
|
attachMultiMask(index: number): boolean;
|
|
45
45
|
/**
|
|
46
46
|
* @param {any} input - The input element on which the mask is to be applied.
|
|
47
|
-
* @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
|
|
47
|
+
* @param {string} mask - The mask pattern to apply to the input element. Exit early and remove previous mask if no mask.
|
|
48
48
|
*/
|
|
49
49
|
updateMask(input: any, mask: string): void;
|
|
50
50
|
/**
|
|
@@ -232,10 +232,17 @@ export default class Multivalue extends Field {
|
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
234
234
|
* @param {any} input - The input element on which the mask is to be applied.
|
|
235
|
-
* @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
|
|
235
|
+
* @param {string} mask - The mask pattern to apply to the input element. Exit early and remove previous mask if no mask.
|
|
236
236
|
*/
|
|
237
237
|
updateMask(input, mask) {
|
|
238
238
|
if (!mask) {
|
|
239
|
+
if (input.mask) {
|
|
240
|
+
input.mask.destroy();
|
|
241
|
+
}
|
|
242
|
+
if (!this.component.placeholder) {
|
|
243
|
+
input.removeAttribute('placeholder');
|
|
244
|
+
}
|
|
245
|
+
input.value = '';
|
|
239
246
|
return;
|
|
240
247
|
}
|
|
241
248
|
this.setInputMask(input, mask, !this.component.placeholder);
|
|
@@ -363,6 +363,9 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
363
363
|
this.reorderValues(dataValue, oldPosition, newPosition, movedBelow);
|
|
364
364
|
//reorder select data
|
|
365
365
|
this.reorderValues(_.get(this.root, `submission.metadata.selectData.${this.path}`, []), oldPosition, newPosition, movedBelow);
|
|
366
|
+
// When components are reordered we need to set the dataGrid and form pristine properties to false
|
|
367
|
+
this.root.pristine = false;
|
|
368
|
+
this.pristine = false;
|
|
366
369
|
//need to re-build rows to re-calculate indexes and other indexed fields for component instance (like rows for ex.)
|
|
367
370
|
this.setValue(dataValue, { isReordered: true });
|
|
368
371
|
this.rebuild();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let components: {
|
|
3
|
+
label: string;
|
|
4
|
+
reorder: boolean;
|
|
5
|
+
addAnotherPosition: string;
|
|
6
|
+
layoutFixed: boolean;
|
|
7
|
+
enableRowGroups: boolean;
|
|
8
|
+
initEmpty: boolean;
|
|
9
|
+
tableView: boolean;
|
|
10
|
+
defaultValue: {}[];
|
|
11
|
+
key: string;
|
|
12
|
+
type: string;
|
|
13
|
+
input: boolean;
|
|
14
|
+
components: ({
|
|
15
|
+
label: string;
|
|
16
|
+
applyMaskOn: string;
|
|
17
|
+
tableView: boolean;
|
|
18
|
+
key: string;
|
|
19
|
+
type: string;
|
|
20
|
+
input: boolean;
|
|
21
|
+
mask?: undefined;
|
|
22
|
+
delimiter?: undefined;
|
|
23
|
+
requireDecimal?: undefined;
|
|
24
|
+
inputFormat?: undefined;
|
|
25
|
+
truncateMultipleSpaces?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
label: string;
|
|
28
|
+
applyMaskOn: string;
|
|
29
|
+
mask: boolean;
|
|
30
|
+
tableView: boolean;
|
|
31
|
+
delimiter: boolean;
|
|
32
|
+
requireDecimal: boolean;
|
|
33
|
+
inputFormat: string;
|
|
34
|
+
truncateMultipleSpaces: boolean;
|
|
35
|
+
key: string;
|
|
36
|
+
type: string;
|
|
37
|
+
input: boolean;
|
|
38
|
+
})[];
|
|
39
|
+
}[];
|
|
40
|
+
}
|
|
41
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"label": "Data Grid",
|
|
5
|
+
"reorder": true,
|
|
6
|
+
"addAnotherPosition": "bottom",
|
|
7
|
+
"layoutFixed": false,
|
|
8
|
+
"enableRowGroups": false,
|
|
9
|
+
"initEmpty": false,
|
|
10
|
+
"tableView": false,
|
|
11
|
+
"defaultValue": [
|
|
12
|
+
{}
|
|
13
|
+
],
|
|
14
|
+
"key": "dataGrid",
|
|
15
|
+
"type": "datagrid",
|
|
16
|
+
"input": true,
|
|
17
|
+
"components": [
|
|
18
|
+
{
|
|
19
|
+
"label": "Text Field",
|
|
20
|
+
"applyMaskOn": "change",
|
|
21
|
+
"tableView": true,
|
|
22
|
+
"key": "textField",
|
|
23
|
+
"type": "textfield",
|
|
24
|
+
"input": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"label": "Number",
|
|
28
|
+
"applyMaskOn": "change",
|
|
29
|
+
"mask": false,
|
|
30
|
+
"tableView": false,
|
|
31
|
+
"delimiter": false,
|
|
32
|
+
"requireDecimal": false,
|
|
33
|
+
"inputFormat": "plain",
|
|
34
|
+
"truncateMultipleSpaces": false,
|
|
35
|
+
"key": "number",
|
|
36
|
+
"type": "number",
|
|
37
|
+
"input": true
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
};
|
|
@@ -6,6 +6,7 @@ import comp5 from './comp5';
|
|
|
6
6
|
import comp6 from './comp6';
|
|
7
7
|
import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
|
9
|
+
import comp9 from './comp9';
|
|
9
10
|
import withCollapsibleRowGroups from './comp-with-collapsible-groups';
|
|
10
11
|
import withConditionalFieldsAndValidations from './comp-with-conditional-components-and-validations';
|
|
11
12
|
import withDefValue from './comp-with-def-value';
|
|
@@ -16,4 +17,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
|
16
17
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
17
18
|
import withCheckboxes from './comp-with-checkboxes';
|
|
18
19
|
import withReorder from './comp-with-reorder';
|
|
19
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
20
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
@@ -6,6 +6,7 @@ import comp5 from './comp5';
|
|
|
6
6
|
import comp6 from './comp6';
|
|
7
7
|
import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
|
9
|
+
import comp9 from './comp9';
|
|
9
10
|
import withDefValue from './comp-with-def-value';
|
|
10
11
|
import withRowGroupsAndDefValue from './comp-row-groups-with-def-value';
|
|
11
12
|
import modalWithRequiredFields from './comp-modal-with-required-fields';
|
|
@@ -16,4 +17,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
|
16
17
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
17
18
|
import withCheckboxes from './comp-with-checkboxes';
|
|
18
19
|
import withReorder from './comp-with-reorder';
|
|
19
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
20
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
@@ -83,7 +83,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
83
83
|
{% if (!instance.options.readOnly && !instance.disabled) { %}
|
|
84
84
|
<div class="col-sm-2">
|
|
85
85
|
<div class="btn-group pull-right">
|
|
86
|
-
<button class="btn btn-default btn-light btn-sm editRow"><i class="{{ iconClass('
|
|
86
|
+
<button class="btn btn-default btn-light btn-sm editRow"><i class="{{ iconClass('edit') }}"></i></button>
|
|
87
87
|
{% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}
|
|
88
88
|
<button class="btn btn-danger btn-sm removeRow"><i class="{{ iconClass('trash') }}"></i></button>
|
|
89
89
|
{% } %}
|
|
@@ -104,7 +104,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
104
104
|
{% if (!instance.options.readOnly && !instance.disabled) { %}
|
|
105
105
|
<td class="editgrid-table-column">
|
|
106
106
|
<div class="btn-group">
|
|
107
|
-
<button class="btn btn-default btn-light btn-sm editRow" aria-label="{{ t('Edit row') }}"><i class="{{ iconClass('
|
|
107
|
+
<button class="btn btn-default btn-light btn-sm editRow" aria-label="{{ t('Edit row') }}"><i class="{{ iconClass('edit') }}"></i></button>
|
|
108
108
|
{% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}
|
|
109
109
|
<button class="btn btn-danger btn-sm removeRow" aria-label="{{ t('Remove row') }}"><i class="{{ iconClass('trash') }}"></i></button>
|
|
110
110
|
{% } %}
|
|
@@ -90,6 +90,13 @@ export default class FormComponent extends Component {
|
|
|
90
90
|
isHidden(): boolean;
|
|
91
91
|
setValue(submission: any, flags?: {}): boolean;
|
|
92
92
|
setSubFormValue(submission: any, flags: any): void;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the subform value
|
|
95
|
+
* @param {object|null|undefined} submission - The submission to set.
|
|
96
|
+
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
|
|
97
|
+
* @returns {void}
|
|
98
|
+
*/
|
|
99
|
+
onSetSubFormValue(submission: object | null | undefined, flags: object | null | undefined): void;
|
|
93
100
|
areAllComponentsEmpty(data: any): boolean;
|
|
94
101
|
updateSubFormVisibility(): void;
|
|
95
102
|
/**
|
|
@@ -639,9 +639,18 @@ export default class FormComponent extends Component {
|
|
|
639
639
|
});
|
|
640
640
|
}
|
|
641
641
|
else {
|
|
642
|
-
this.
|
|
642
|
+
this.onSetSubFormValue(submission, flags);
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
|
+
/**
|
|
646
|
+
* Sets the subform value
|
|
647
|
+
* @param {object|null|undefined} submission - The submission to set.
|
|
648
|
+
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
|
|
649
|
+
* @returns {void}
|
|
650
|
+
*/
|
|
651
|
+
onSetSubFormValue(submission, flags) {
|
|
652
|
+
this.subForm.setValue(submission, flags);
|
|
653
|
+
}
|
|
645
654
|
isEmpty(value = this.dataValue) {
|
|
646
655
|
return value === null || _.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value?.data) && !value?._id);
|
|
647
656
|
}
|
|
@@ -46,7 +46,7 @@ export default class NumberComponent extends Input {
|
|
|
46
46
|
constructor(...args) {
|
|
47
47
|
super(...args);
|
|
48
48
|
const separators = getNumberSeparators(this.options.language || navigator.language);
|
|
49
|
-
this.decimalSeparator = this.options.decimalSeparator = this.options.decimalSeparator
|
|
49
|
+
this.decimalSeparator = this.options.decimalSeparator = this.component.decimalSymbol || this.options.decimalSeparator
|
|
50
50
|
|| this.options.properties?.decimalSeparator
|
|
51
51
|
|| separators.decimalSeparator;
|
|
52
52
|
if (this.component.delimiter) {
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
key: string;
|
|
12
|
+
type: string;
|
|
13
|
+
input: boolean;
|
|
14
|
+
decimalSymbol: string;
|
|
15
|
+
disableOnInvalid?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
type: string;
|
|
18
|
+
label: string;
|
|
19
|
+
key: string;
|
|
20
|
+
disableOnInvalid: boolean;
|
|
21
|
+
input: boolean;
|
|
22
|
+
tableView: boolean;
|
|
23
|
+
applyMaskOn?: undefined;
|
|
24
|
+
mask?: undefined;
|
|
25
|
+
delimiter?: undefined;
|
|
26
|
+
requireDecimal?: undefined;
|
|
27
|
+
inputFormat?: undefined;
|
|
28
|
+
truncateMultipleSpaces?: undefined;
|
|
29
|
+
decimalSymbol?: undefined;
|
|
30
|
+
})[];
|
|
31
|
+
}
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
"key": "number",
|
|
13
|
+
"type": "number",
|
|
14
|
+
"input": true,
|
|
15
|
+
"decimalSymbol": "-"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"type": "button",
|
|
19
|
+
"label": "Submit",
|
|
20
|
+
"key": "submit",
|
|
21
|
+
"disableOnInvalid": true,
|
|
22
|
+
"input": true,
|
|
23
|
+
"tableView": false
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
};
|
|
@@ -5,4 +5,5 @@ import comp4 from './comp4';
|
|
|
5
5
|
import comp5 from './comp5';
|
|
6
6
|
import comp6 from './comp6';
|
|
7
7
|
import comp7 from './comp7';
|
|
8
|
-
|
|
8
|
+
import comp8 from './comp8';
|
|
9
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
|
|
@@ -5,4 +5,5 @@ import comp4 from './comp4';
|
|
|
5
5
|
import comp5 from './comp5';
|
|
6
6
|
import comp6 from './comp6';
|
|
7
7
|
import comp7 from './comp7';
|
|
8
|
-
|
|
8
|
+
import comp8 from './comp8';
|
|
9
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let components: {
|
|
3
|
+
label: string;
|
|
4
|
+
applyMaskOn: string;
|
|
5
|
+
allowMultipleMasks: boolean;
|
|
6
|
+
tableView: boolean;
|
|
7
|
+
key: string;
|
|
8
|
+
type: string;
|
|
9
|
+
inputMasks: {
|
|
10
|
+
label: string;
|
|
11
|
+
mask: string;
|
|
12
|
+
}[];
|
|
13
|
+
input: boolean;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
components: [
|
|
3
|
+
{
|
|
4
|
+
"label": "Phone Number",
|
|
5
|
+
"applyMaskOn": "change",
|
|
6
|
+
"allowMultipleMasks": true,
|
|
7
|
+
"tableView": true,
|
|
8
|
+
"key": "phoneNumber",
|
|
9
|
+
"type": "phoneNumber",
|
|
10
|
+
"inputMasks": [
|
|
11
|
+
{
|
|
12
|
+
"label": "Canada",
|
|
13
|
+
"mask": "(999) 999-9999"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"label": "Other",
|
|
17
|
+
"mask": ""
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"input": true
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { Formio } from '../../Formio';
|
|
3
3
|
import ListComponent from '../_classes/list/ListComponent';
|
|
4
|
-
import Input from '../_classes/input/Input';
|
|
5
4
|
import Form from '../../Form';
|
|
6
5
|
import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes, isSelectResourceWithObjectValue, removeHTML } from '../../utils/utils';
|
|
7
6
|
import Choices from '../../utils/ChoicesWrapper';
|
|
@@ -863,7 +862,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
863
862
|
this.choices.containerOuter.element.setAttribute('tabIndex', '-1');
|
|
864
863
|
this.addEventListener(this.choices.containerOuter.element, 'focus', () => this.focusableElement.focus());
|
|
865
864
|
}
|
|
866
|
-
|
|
865
|
+
this.addFocusBlurEvents(this.choices.input.element);
|
|
867
866
|
if (this.itemsFromUrl && !this.component.noRefreshOnScroll) {
|
|
868
867
|
this.scrollList = this.choices.choiceList.element;
|
|
869
868
|
this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
|
|
@@ -22,7 +22,6 @@ export default class SignatureComponent extends Input {
|
|
|
22
22
|
showCanvas(show: any): void;
|
|
23
23
|
onDisabled(): void;
|
|
24
24
|
checkSize(force: any, scale: any): void;
|
|
25
|
-
getModalPreviewTemplate(): any;
|
|
26
25
|
signaturePad: SignaturePad | null | undefined;
|
|
27
26
|
observer: any;
|
|
28
27
|
getValueAsString(value: any): "" | "Yes" | "No";
|
|
@@ -169,7 +169,7 @@ export default class SignatureComponent extends Input {
|
|
|
169
169
|
return false;
|
|
170
170
|
}
|
|
171
171
|
getModalPreviewTemplate() {
|
|
172
|
-
return this.
|
|
172
|
+
return this.renderModalPreview({
|
|
173
173
|
previewText: this.dataValue ?
|
|
174
174
|
`<img src=${this.dataValue} ${this._referenceAttributeName}='openModal' style="width: 100%;height: 100%;" />` :
|
|
175
175
|
this.t('Click to Sign')
|
|
@@ -82,6 +82,11 @@ export class GoogleAddressProvider extends AddressProvider {
|
|
|
82
82
|
search(): Promise<void>;
|
|
83
83
|
makeRequest(): Promise<void>;
|
|
84
84
|
getDisplayValue(address: any): any;
|
|
85
|
+
/**
|
|
86
|
+
* Tries to remove the library if api key for loaded script is different.
|
|
87
|
+
* @param {ProviderOptions} options - The options for the provider.
|
|
88
|
+
*/
|
|
89
|
+
tryRemoveLibrary(options?: ProviderOptions): void;
|
|
85
90
|
}
|
|
86
91
|
export type AutocompleteOptions = {
|
|
87
92
|
/**
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { Formio } from '../../Formio';
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
import { AddressProvider } from './AddressProvider';
|
|
5
|
+
const GOOGLE_MAPS_BASE_URL = 'https://maps.googleapis.com';
|
|
6
|
+
const GOOGLE_MAPS_JS_URL = `${GOOGLE_MAPS_BASE_URL}/maps/api/js`;
|
|
7
|
+
const GOOGLE_MAPS_JS_WITH_PARAMS_URL = `${GOOGLE_MAPS_JS_URL}?v=quarterly&libraries=places&loading=async&callback=googleMapsCallback`;
|
|
5
8
|
/**
|
|
6
9
|
* @typedef {object} AutocompleteOptions
|
|
7
10
|
* @property {string[]} fields - The fields to include in the autocomplete response.
|
|
@@ -48,10 +51,11 @@ export class GoogleAddressProvider extends AddressProvider {
|
|
|
48
51
|
constructor(options = {}) {
|
|
49
52
|
super(options);
|
|
50
53
|
this.setAutocompleteOptions();
|
|
51
|
-
let src =
|
|
54
|
+
let src = GOOGLE_MAPS_JS_WITH_PARAMS_URL;
|
|
52
55
|
if (options.params?.key) {
|
|
53
56
|
src += `&key=${options.params.key}`;
|
|
54
57
|
}
|
|
58
|
+
this.tryRemoveLibrary(options);
|
|
55
59
|
Formio.requireLibrary(this.getLibraryName(), 'google.maps.places', src);
|
|
56
60
|
}
|
|
57
61
|
/**
|
|
@@ -178,4 +182,21 @@ export class GoogleAddressProvider extends AddressProvider {
|
|
|
178
182
|
: this.alternativeDisplayValueProperty;
|
|
179
183
|
return _.get(address, displayedProperty, '');
|
|
180
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Tries to remove the library if api key for loaded script is different.
|
|
187
|
+
* @param {ProviderOptions} options - The options for the provider.
|
|
188
|
+
*/
|
|
189
|
+
tryRemoveLibrary(options = {}) {
|
|
190
|
+
if (!Formio.libraries[this.getLibraryName()]) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const existingScript = document.querySelector(`script[src^="${GOOGLE_MAPS_JS_URL}"]`);
|
|
194
|
+
if (existingScript && options.params?.key && !existingScript.attributes.src.value.endsWith(options.params.key)) {
|
|
195
|
+
const googleMapsScripts = document.querySelectorAll(`script[src^="${GOOGLE_MAPS_BASE_URL}"]`) ?? [];
|
|
196
|
+
googleMapsScripts.forEach(script => script.parentNode.removeChild(script));
|
|
197
|
+
delete Formio.libraries[this.getLibraryName()];
|
|
198
|
+
delete global?.google?.maps;
|
|
199
|
+
delete global[`${this.getLibraryName()}Callback`];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
181
202
|
}
|
package/lib/mjs/utils/utils.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* global jQuery */
|
|
2
2
|
import _ from 'lodash';
|
|
3
|
-
import fetchPonyfill from 'fetch-ponyfill';
|
|
4
3
|
import jsonLogic from 'json-logic-js';
|
|
5
4
|
import moment from 'moment-timezone/moment-timezone';
|
|
6
5
|
import jtz from 'jstimezonedetect';
|
|
@@ -10,9 +9,6 @@ import { getValue } from './formUtils';
|
|
|
10
9
|
import { Evaluator } from './Evaluator';
|
|
11
10
|
import ConditionOperators from './conditionOperators';
|
|
12
11
|
const interpolate = Evaluator.interpolate;
|
|
13
|
-
const { fetch } = fetchPonyfill({
|
|
14
|
-
Promise: Promise
|
|
15
|
-
});
|
|
16
12
|
export * from './formUtils';
|
|
17
13
|
// Configure JsonLogic
|
|
18
14
|
lodashOperators.forEach((name) => jsonLogic.add_operation(`_${name}`, _[name]));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formio/js",
|
|
3
|
-
"version": "5.0.0-dev.5664.
|
|
3
|
+
"version": "5.0.0-dev.5664.50b8944",
|
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -99,7 +99,6 @@
|
|
|
99
99
|
"eventemitter3": "^5.0.1",
|
|
100
100
|
"fast-deep-equal": "^3.1.3",
|
|
101
101
|
"fast-json-patch": "^3.1.1",
|
|
102
|
-
"fetch-ponyfill": "^7.1.0",
|
|
103
102
|
"idb": "^7.1.1",
|
|
104
103
|
"inputmask": "^5.0.8",
|
|
105
104
|
"ismobilejs": "^1.1.1",
|