@formio/js 5.1.0-rc.2 → 5.1.0-rc.21
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.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +27 -27
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +30 -30
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +13 -13
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +11 -11
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDFBuilder.js +2 -2
- package/lib/cjs/Webform.d.ts +2 -2
- package/lib/cjs/Webform.js +6 -3
- package/lib/cjs/WebformBuilder.d.ts +1 -0
- package/lib/cjs/WebformBuilder.js +14 -3
- package/lib/cjs/Wizard.js +2 -1
- package/lib/cjs/components/_classes/component/Component.js +8 -2
- package/lib/cjs/components/_classes/field/Field.d.ts +2 -2
- package/lib/cjs/components/_classes/field/Field.js +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/cjs/components/_classes/nested/fixtures/comp4.d.ts +11 -1
- package/lib/cjs/components/_classes/nested/fixtures/comp4.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
- package/lib/cjs/components/address/Address.d.ts +1 -2
- package/lib/cjs/components/address/Address.js +1 -1
- package/lib/cjs/components/address/fixtures/comp5.d.ts +46 -0
- package/lib/cjs/components/address/fixtures/comp5.js +87 -0
- package/lib/cjs/components/address/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/address/fixtures/index.js +3 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/columns/Columns.d.ts +1 -1
- package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/cjs/components/datagrid/DataGrid.js +4 -1
- package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/cjs/components/datetime/DateTime.js +7 -3
- package/lib/cjs/components/datetime/fixtures/index.d.ts +6 -5
- package/lib/cjs/components/datetime/fixtures/index.js +3 -1
- package/lib/cjs/components/datetime/fixtures/requiredFieldLogicComp.d.ts +57 -0
- package/lib/cjs/components/datetime/fixtures/requiredFieldLogicComp.js +64 -0
- package/lib/cjs/components/day/Day.d.ts +1 -1
- package/lib/cjs/components/day/Day.js +2 -18
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +1 -1
- package/lib/cjs/components/editgrid/fixtures/index.js +1 -5
- package/lib/cjs/components/file/File.d.ts +1 -1
- package/lib/cjs/components/form/Form.d.ts +5 -2
- package/lib/cjs/components/form/Form.js +35 -15
- package/lib/cjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/cjs/components/radio/Radio.d.ts +1 -1
- package/lib/cjs/components/select/Select.d.ts +1 -1
- package/lib/cjs/components/selectboxes/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/selectboxes/fixtures/index.js +3 -1
- package/lib/cjs/components/survey/Survey.d.ts +1 -1
- package/lib/cjs/components/table/Table.d.ts +1 -1
- package/lib/cjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/cjs/components/tags/fixtures/index.d.ts +1 -1
- package/lib/cjs/components/tags/fixtures/index.js +1 -5
- package/lib/cjs/components/textfield/TextField.js +3 -0
- package/lib/cjs/components/textfield/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/textfield/fixtures/index.js +3 -1
- package/lib/cjs/components/textfield/fixtures/requiredFieldLogicComp.d.ts +48 -0
- package/lib/cjs/components/textfield/fixtures/requiredFieldLogicComp.js +55 -0
- package/lib/cjs/formio.embed.d.ts +1 -1
- package/lib/cjs/formio.embed.js +3 -0
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +5 -0
- package/lib/cjs/providers/address/GoogleAddressProvider.js +23 -1
- package/lib/cjs/translations/en.js +2 -2
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/utils.d.ts +2 -1
- package/lib/cjs/utils/utils.js +3 -2
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDFBuilder.js +2 -2
- package/lib/mjs/Webform.d.ts +2 -2
- package/lib/mjs/Webform.js +6 -3
- package/lib/mjs/WebformBuilder.d.ts +1 -0
- package/lib/mjs/WebformBuilder.js +13 -2
- package/lib/mjs/Wizard.js +2 -1
- package/lib/mjs/components/_classes/component/Component.js +8 -2
- package/lib/mjs/components/_classes/field/Field.d.ts +2 -2
- package/lib/mjs/components/_classes/field/Field.js +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/mjs/components/_classes/nested/fixtures/comp4.d.ts +11 -1
- package/lib/mjs/components/_classes/nested/fixtures/comp4.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
- package/lib/mjs/components/address/Address.d.ts +1 -2
- package/lib/mjs/components/address/Address.js +1 -1
- package/lib/mjs/components/address/fixtures/comp5.d.ts +46 -0
- package/lib/mjs/components/address/fixtures/comp5.js +85 -0
- package/lib/mjs/components/address/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/address/fixtures/index.js +2 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/columns/Columns.d.ts +1 -1
- package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/mjs/components/datagrid/DataGrid.js +4 -1
- package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/mjs/components/datetime/DateTime.js +8 -4
- package/lib/mjs/components/datetime/fixtures/index.d.ts +6 -5
- package/lib/mjs/components/datetime/fixtures/index.js +2 -1
- package/lib/mjs/components/datetime/fixtures/requiredFieldLogicComp.d.ts +57 -0
- package/lib/mjs/components/datetime/fixtures/requiredFieldLogicComp.js +62 -0
- package/lib/mjs/components/day/Day.d.ts +1 -1
- package/lib/mjs/components/day/Day.js +2 -18
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +1 -1
- package/lib/mjs/components/editgrid/fixtures/index.js +1 -3
- package/lib/mjs/components/file/File.d.ts +1 -1
- package/lib/mjs/components/form/Form.d.ts +5 -2
- package/lib/mjs/components/form/Form.js +34 -15
- package/lib/mjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/mjs/components/radio/Radio.d.ts +1 -1
- package/lib/mjs/components/select/Select.d.ts +1 -1
- package/lib/mjs/components/selectboxes/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/selectboxes/fixtures/index.js +2 -1
- package/lib/mjs/components/survey/Survey.d.ts +1 -1
- package/lib/mjs/components/table/Table.d.ts +1 -1
- package/lib/mjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/mjs/components/tags/fixtures/index.d.ts +1 -1
- package/lib/mjs/components/tags/fixtures/index.js +1 -3
- package/lib/mjs/components/textfield/TextField.js +3 -0
- package/lib/mjs/components/textfield/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/textfield/fixtures/index.js +2 -1
- package/lib/mjs/components/textfield/fixtures/requiredFieldLogicComp.d.ts +48 -0
- package/lib/mjs/components/textfield/fixtures/requiredFieldLogicComp.js +53 -0
- package/lib/mjs/formio.embed.d.ts +1 -1
- package/lib/mjs/formio.embed.js +1 -0
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +5 -0
- package/lib/mjs/providers/address/GoogleAddressProvider.js +22 -1
- package/lib/mjs/translations/en.js +2 -2
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/utils.d.ts +2 -1
- package/lib/mjs/utils/utils.js +3 -2
- package/package.json +4 -4
@@ -8,6 +8,9 @@ exports.GoogleAddressProvider = void 0;
|
|
8
8
|
const Formio_1 = require("../../Formio");
|
9
9
|
const lodash_1 = __importDefault(require("lodash"));
|
10
10
|
const AddressProvider_1 = require("./AddressProvider");
|
11
|
+
const GOOGLE_MAPS_BASE_URL = 'https://maps.googleapis.com';
|
12
|
+
const GOOGLE_MAPS_JS_URL = `${GOOGLE_MAPS_BASE_URL}/maps/api/js`;
|
13
|
+
const GOOGLE_MAPS_JS_WITH_PARAMS_URL = `${GOOGLE_MAPS_JS_URL}?v=quarterly&libraries=places&loading=async&callback=googleMapsCallback`;
|
11
14
|
/**
|
12
15
|
* @typedef {object} AutocompleteOptions
|
13
16
|
* @property {string[]} fields - The fields to include in the autocomplete response.
|
@@ -55,10 +58,11 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
|
|
55
58
|
var _a;
|
56
59
|
super(options);
|
57
60
|
this.setAutocompleteOptions();
|
58
|
-
let src =
|
61
|
+
let src = GOOGLE_MAPS_JS_WITH_PARAMS_URL;
|
59
62
|
if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.key) {
|
60
63
|
src += `&key=${options.params.key}`;
|
61
64
|
}
|
65
|
+
this.tryRemoveLibrary(options);
|
62
66
|
Formio_1.Formio.requireLibrary(this.getLibraryName(), 'google.maps.places', src);
|
63
67
|
}
|
64
68
|
/**
|
@@ -185,5 +189,23 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
|
|
185
189
|
: this.alternativeDisplayValueProperty;
|
186
190
|
return lodash_1.default.get(address, displayedProperty, '');
|
187
191
|
}
|
192
|
+
/**
|
193
|
+
* Tries to remove the library if api key for loaded script is different.
|
194
|
+
* @param {ProviderOptions} options - The options for the provider.
|
195
|
+
*/
|
196
|
+
tryRemoveLibrary(options = {}) {
|
197
|
+
var _a, _b, _c;
|
198
|
+
if (!Formio_1.Formio.libraries[this.getLibraryName()]) {
|
199
|
+
return;
|
200
|
+
}
|
201
|
+
const existingScript = document.querySelector(`script[src^="${GOOGLE_MAPS_JS_URL}"]`);
|
202
|
+
if (existingScript && ((_a = options.params) === null || _a === void 0 ? void 0 : _a.key) && !existingScript.attributes.src.value.endsWith(options.params.key)) {
|
203
|
+
const googleMapsScripts = (_b = document.querySelectorAll(`script[src^="${GOOGLE_MAPS_BASE_URL}"]`)) !== null && _b !== void 0 ? _b : [];
|
204
|
+
googleMapsScripts.forEach(script => script.parentNode.removeChild(script));
|
205
|
+
delete Formio_1.Formio.libraries[this.getLibraryName()];
|
206
|
+
(_c = global === null || global === void 0 ? void 0 : global.google) === null || _c === void 0 ? true : delete _c.maps;
|
207
|
+
delete global[`${this.getLibraryName()}Callback`];
|
208
|
+
}
|
209
|
+
}
|
188
210
|
}
|
189
211
|
exports.GoogleAddressProvider = GoogleAddressProvider;
|
@@ -26,8 +26,8 @@ exports.default = {
|
|
26
26
|
maxWords: '{{field}} must have no more than {{length}} words.',
|
27
27
|
min: '{{field}} cannot be less than {{min}}.',
|
28
28
|
max: '{{field}} cannot be greater than {{max}}.',
|
29
|
-
maxDate: '{{field}} should not contain date after {{
|
30
|
-
minDate: '{{field}} should not contain date before {{
|
29
|
+
maxDate: '{{field}} should not contain date after {{maxDate}}',
|
30
|
+
minDate: '{{field}} should not contain date before {{minDate}}',
|
31
31
|
maxYear: '{{field}} should not contain year greater than {{maxYear}}',
|
32
32
|
minYear: '{{field}} should not contain year less than {{minYear}}',
|
33
33
|
minSelectedCount: 'You must select at least {{minCount}} items',
|
@@ -26,8 +26,8 @@ export const getBestMatch: typeof Utils.getBestMatch;
|
|
26
26
|
export const getComponentFromPath: typeof Utils.getComponentFromPath;
|
27
27
|
export const getComponentValue: typeof Utils.getComponentValue;
|
28
28
|
export const findComponents: typeof Utils.findComponents;
|
29
|
-
export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?:
|
30
|
-
export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?:
|
29
|
+
export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => Promise<void>;
|
30
|
+
export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => void;
|
31
31
|
export const getComponentKey: typeof Utils.getComponentKey;
|
32
32
|
export const getContextualRowPath: typeof Utils.getContextualRowPath;
|
33
33
|
export const getContextualRowData: typeof Utils.getContextualRowData;
|
package/lib/cjs/utils/utils.d.ts
CHANGED
@@ -208,9 +208,10 @@ export function loadZones(url: string, timezone: string): Promise<any> | any;
|
|
208
208
|
* @param {string|Date} value - The value to convert into a moment date.
|
209
209
|
* @param {string} format - The format to convert the date to.
|
210
210
|
* @param {string} timezone - The timezone to convert the date to.
|
211
|
+
* @param {object} options - The options object
|
211
212
|
* @returns {Date} - The moment date object.
|
212
213
|
*/
|
213
|
-
export function momentDate(value: string | Date, format: string, timezone: string): Date;
|
214
|
+
export function momentDate(value: string | Date, format: string, timezone: string, options: object): Date;
|
214
215
|
/**
|
215
216
|
* Format a date provided a value, format, and timezone object.
|
216
217
|
* @param {string} timezonesUrl - The URL to load the timezone data from.
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -687,9 +687,10 @@ exports.loadZones = loadZones;
|
|
687
687
|
* @param {string|Date} value - The value to convert into a moment date.
|
688
688
|
* @param {string} format - The format to convert the date to.
|
689
689
|
* @param {string} timezone - The timezone to convert the date to.
|
690
|
+
* @param {object} options - The options object
|
690
691
|
* @returns {Date} - The moment date object.
|
691
692
|
*/
|
692
|
-
function momentDate(value, format, timezone) {
|
693
|
+
function momentDate(value, format, timezone, options) {
|
693
694
|
const momentDate = (0, moment_timezone_1.default)(value);
|
694
695
|
if (!timezone) {
|
695
696
|
return momentDate;
|
@@ -697,7 +698,7 @@ function momentDate(value, format, timezone) {
|
|
697
698
|
if (timezone === 'UTC') {
|
698
699
|
timezone = 'Etc/UTC';
|
699
700
|
}
|
700
|
-
if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && moment_timezone_1.default.zonesLoaded) {
|
701
|
+
if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && (moment_timezone_1.default.zonesLoaded || (options === null || options === void 0 ? void 0 : options.email))) {
|
701
702
|
return momentDate.tz(timezone);
|
702
703
|
}
|
703
704
|
return momentDate;
|
package/lib/mjs/Embed.js
CHANGED
@@ -14,7 +14,7 @@ export class Formio {
|
|
14
14
|
Formio._formioReady = ready;
|
15
15
|
Formio._formioReadyReject = reject;
|
16
16
|
});
|
17
|
-
static version = '
|
17
|
+
static version = '5.1.0-rc.21';
|
18
18
|
static setLicense(license, norecurse = false) {
|
19
19
|
Formio.license = license;
|
20
20
|
if (!norecurse && Formio.FormioClass) {
|
package/lib/mjs/Formio.js
CHANGED
@@ -4,7 +4,7 @@ import CDN from './CDN';
|
|
4
4
|
import Providers from './providers';
|
5
5
|
FormioCore.cdn = new CDN();
|
6
6
|
FormioCore.Providers = Providers;
|
7
|
-
FormioCore.version = '
|
7
|
+
FormioCore.version = '5.1.0-rc.21';
|
8
8
|
CDN.defaultCDN = FormioCore.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
|
9
9
|
const isNil = (val) => val === null || val === undefined;
|
10
10
|
FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
|
package/lib/mjs/PDFBuilder.js
CHANGED
@@ -294,7 +294,7 @@ export default class PDFBuilder extends WebformBuilder {
|
|
294
294
|
height: schema.height,
|
295
295
|
width: schema.width
|
296
296
|
};
|
297
|
-
if (!this.options.noNewEdit && !component.component.noNewEdit) {
|
297
|
+
if (!this.options.noNewEdit && !component.component.noNewEdit && this.hasEditTabs(component.type)) {
|
298
298
|
this.editComponent(component.component, this.getParentContainer(component), isNew);
|
299
299
|
}
|
300
300
|
this.emit('updateComponent', component.component);
|
@@ -318,7 +318,7 @@ export default class PDFBuilder extends WebformBuilder {
|
|
318
318
|
});
|
319
319
|
this.webform.on('iframe-componentClick', schema => {
|
320
320
|
const component = this.webform.getComponentById(schema.id);
|
321
|
-
if (component) {
|
321
|
+
if (component && this.hasEditTabs(component.type)) {
|
322
322
|
this.editComponent(component.component, this.getParentContainer(component));
|
323
323
|
}
|
324
324
|
}, true);
|
package/lib/mjs/Webform.d.ts
CHANGED
@@ -363,7 +363,7 @@ declare class Webform extends NestedDataComponent {
|
|
363
363
|
executeFormController(): false | undefined;
|
364
364
|
build(element: any): Promise<any>;
|
365
365
|
getClassName(): string;
|
366
|
-
render():
|
366
|
+
render(): string;
|
367
367
|
redraw(): Promise<void> | Promise<boolean>;
|
368
368
|
attach(element: any): Promise<boolean>;
|
369
369
|
hasRequiredFields(): boolean;
|
@@ -452,7 +452,7 @@ declare class Webform extends NestedDataComponent {
|
|
452
452
|
*/
|
453
453
|
submit(before?: boolean, options?: any): Promise<any>;
|
454
454
|
submitUrl(URL: any, headers: any): void;
|
455
|
-
triggerCaptcha(): void;
|
455
|
+
triggerCaptcha(components?: null): void;
|
456
456
|
_nosubmit: any;
|
457
457
|
get conditions(): any;
|
458
458
|
get variables(): any;
|
package/lib/mjs/Webform.js
CHANGED
@@ -1528,17 +1528,20 @@ export default class Webform extends NestedDataComponent {
|
|
1528
1528
|
return console.warn("You should add a URL to this button.");
|
1529
1529
|
}
|
1530
1530
|
}
|
1531
|
-
triggerCaptcha() {
|
1531
|
+
triggerCaptcha(components = null) {
|
1532
1532
|
if (!this || !this.components) {
|
1533
1533
|
return;
|
1534
1534
|
}
|
1535
1535
|
const captchaComponent = [];
|
1536
|
-
this.
|
1536
|
+
eachComponent(components || this.components, (component) => {
|
1537
1537
|
if (/^(re)?captcha$/.test(component.type) && component.component.eventType === 'formLoad') {
|
1538
1538
|
captchaComponent.push(component);
|
1539
1539
|
}
|
1540
|
-
});
|
1540
|
+
}, true);
|
1541
1541
|
if (captchaComponent.length > 0) {
|
1542
|
+
if (captchaComponent[0].component.provider === 'google' && components) {
|
1543
|
+
return;
|
1544
|
+
}
|
1542
1545
|
captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
|
1543
1546
|
}
|
1544
1547
|
}
|
@@ -123,6 +123,7 @@ export default class WebformBuilder extends Component {
|
|
123
123
|
addBuilderGroup(name: any, group: any): void;
|
124
124
|
updateBuilderGroup(name: any, group: any): void;
|
125
125
|
generateKey(info: any): any;
|
126
|
+
hasEditTabs(type: any): boolean;
|
126
127
|
}
|
127
128
|
import Component from './components/_classes/component/Component';
|
128
129
|
import Webform from './Webform';
|
@@ -115,7 +115,9 @@ export default class WebformBuilder extends Component {
|
|
115
115
|
html,
|
116
116
|
disableBuilderActions: self?.component?.disableBuilderActions,
|
117
117
|
childComponent: component,
|
118
|
-
design: self?.options?.design
|
118
|
+
design: self?.options?.design,
|
119
|
+
editJson: self?.options?.editJson,
|
120
|
+
editComponent: this.hasEditTabs(component.type)
|
119
121
|
});
|
120
122
|
};
|
121
123
|
this.options.hooks.renderComponents = (html, { components, self }) => {
|
@@ -852,7 +854,11 @@ export default class WebformBuilder extends Component {
|
|
852
854
|
parent.addChildComponent(info, element, target, source, sibling);
|
853
855
|
}
|
854
856
|
const componentInDataGrid = parent.type === 'datagrid';
|
855
|
-
if (isNew
|
857
|
+
if (isNew
|
858
|
+
&& !this.options.noNewEdit
|
859
|
+
&& !info.noNewEdit
|
860
|
+
&& this.hasEditTabs(info.type)
|
861
|
+
&& !(this.options.design && info.type === 'reviewpage')) {
|
856
862
|
this.editComponent(info, target, isNew, null, null, { inDataGrid: componentInDataGrid });
|
857
863
|
}
|
858
864
|
// Only rebuild the parts needing to be rebuilt.
|
@@ -1630,4 +1636,9 @@ export default class WebformBuilder extends Component {
|
|
1630
1636
|
info.placeholder ||
|
1631
1637
|
info.type);
|
1632
1638
|
}
|
1639
|
+
hasEditTabs(type) {
|
1640
|
+
const editTabs = getComponent(Components.components[type].editForm().components, 'tabs', true).components;
|
1641
|
+
const hiddenEditTabs = _.filter(_.get(this.options, `editForm.${type}`, []), 'ignore');
|
1642
|
+
return _.intersectionBy(editTabs, hiddenEditTabs, 'key').length !== editTabs.length;
|
1643
|
+
}
|
1633
1644
|
}
|
package/lib/mjs/Wizard.js
CHANGED
@@ -594,6 +594,7 @@ export default class Wizard extends Webform {
|
|
594
594
|
}
|
595
595
|
this.redraw().then(() => {
|
596
596
|
this.checkData(this.submission.data);
|
597
|
+
this.triggerCaptcha(this.currentPanel.components);
|
597
598
|
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
598
599
|
if (this.alert) {
|
599
600
|
this.showErrors(errors, true, true);
|
@@ -657,7 +658,7 @@ export default class Wizard extends Webform {
|
|
657
658
|
return this.page - 1;
|
658
659
|
}
|
659
660
|
beforeSubmit() {
|
660
|
-
const pages = this.getPages();
|
661
|
+
const pages = this.getPages({ all: true });
|
661
662
|
return Promise.all(pages.map((page) => {
|
662
663
|
page.options.beforeSubmit = true;
|
663
664
|
return page.beforeSubmit();
|
@@ -1263,7 +1263,7 @@ export default class Component extends Element {
|
|
1263
1263
|
detach() {
|
1264
1264
|
// First iterate through each ref and delete the component so there are no dangling component references.
|
1265
1265
|
_.each(this.refs, (ref) => {
|
1266
|
-
if (
|
1266
|
+
if (ref instanceof NodeList) {
|
1267
1267
|
ref.forEach((elem) => {
|
1268
1268
|
delete elem.component;
|
1269
1269
|
});
|
@@ -1913,15 +1913,21 @@ export default class Component extends Element {
|
|
1913
1913
|
}
|
1914
1914
|
// Check advanced conditions (and cache the result)
|
1915
1915
|
const isConditionallyHidden = this.checkConditionallyHidden(data, row) || this._parentConditionallyHidden;
|
1916
|
+
let shouldClear = false;
|
1916
1917
|
if (isConditionallyHidden !== this._conditionallyHidden) {
|
1917
1918
|
this._conditionallyHidden = isConditionallyHidden;
|
1918
|
-
|
1919
|
+
shouldClear = true;
|
1919
1920
|
}
|
1920
1921
|
// Check visibility
|
1921
1922
|
const visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
|
1922
1923
|
if (this.visible !== visible) {
|
1923
1924
|
this.visible = visible;
|
1924
1925
|
}
|
1926
|
+
// Wait for visibility to update for nested components, so the component state is up-to-date when
|
1927
|
+
// calling clearOnHide
|
1928
|
+
if (shouldClear) {
|
1929
|
+
this.clearOnHide();
|
1930
|
+
}
|
1925
1931
|
return visible;
|
1926
1932
|
}
|
1927
1933
|
/**
|
@@ -1,9 +1,9 @@
|
|
1
1
|
export default class Field extends Component {
|
2
2
|
/**
|
3
3
|
* @param {object} element - The component to create.
|
4
|
-
* @returns {
|
4
|
+
* @returns {string} - The rendered HTML string of a component
|
5
5
|
*/
|
6
|
-
render(element: object):
|
6
|
+
render(element: object): string;
|
7
7
|
/**
|
8
8
|
/* Saves current caret position to restore it after the component is redrawn
|
9
9
|
* @param {HTMLElement} element - The element to save the caret position for.
|
@@ -6,7 +6,7 @@ import Component from '../component/Component';
|
|
6
6
|
export default class Field extends Component {
|
7
7
|
/**
|
8
8
|
* @param {object} element - The component to create.
|
9
|
-
* @returns {
|
9
|
+
* @returns {string} - The rendered HTML string of a component
|
10
10
|
*/
|
11
11
|
render(element) {
|
12
12
|
if (this.noField) {
|
@@ -146,7 +146,7 @@ export default class NestedComponent extends Field {
|
|
146
146
|
*/
|
147
147
|
addComponent(component: import('@formio/core').Component, data?: object, before?: HTMLElement, noAdd?: boolean | undefined): any;
|
148
148
|
beforeFocus(): void;
|
149
|
-
render(children: any):
|
149
|
+
render(children: any): string;
|
150
150
|
renderComponents(components: any): any;
|
151
151
|
attach(element: any): Promise<[void, void]>;
|
152
152
|
/**
|
@@ -1,4 +1,14 @@
|
|
1
1
|
declare namespace _default {
|
2
|
-
let components:
|
2
|
+
let components: {
|
3
|
+
label: string;
|
4
|
+
inputType: string;
|
5
|
+
tableView: boolean;
|
6
|
+
defaultValue: boolean;
|
7
|
+
key: string;
|
8
|
+
type: string;
|
9
|
+
name: string;
|
10
|
+
value: string;
|
11
|
+
input: boolean;
|
12
|
+
}[];
|
3
13
|
}
|
4
14
|
export default _default;
|
@@ -3,6 +3,7 @@ export default class NestedDataComponent extends NestedComponent {
|
|
3
3
|
hasChanged(newValue: any, oldValue: any): boolean;
|
4
4
|
get allowData(): boolean;
|
5
5
|
get emptyValue(): {};
|
6
|
+
get shouldAddDefaultValue(): boolean;
|
6
7
|
componentContext(): any;
|
7
8
|
getValueAsString(value: any, options: any): string;
|
8
9
|
getDataValueAsTable(value: any, options: any): string;
|
@@ -22,6 +22,9 @@ export default class NestedDataComponent extends NestedComponent {
|
|
22
22
|
get emptyValue() {
|
23
23
|
return {};
|
24
24
|
}
|
25
|
+
get shouldAddDefaultValue() {
|
26
|
+
return !this.options.noDefaults || !this.options.server;
|
27
|
+
}
|
25
28
|
componentContext() {
|
26
29
|
return this.dataValue;
|
27
30
|
}
|
@@ -60,7 +60,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
60
60
|
renderElement(value: any): any;
|
61
61
|
renderRow(value: any, index: any): any;
|
62
62
|
renderGrid(): any;
|
63
|
-
render():
|
63
|
+
render(): string;
|
64
64
|
onSelectAddress(address: any, element: any, index: any): void;
|
65
65
|
addRow(): void;
|
66
66
|
attach(element: any): Promise<void>;
|
@@ -71,4 +71,3 @@ export default class AddressComponent extends ContainerComponent {
|
|
71
71
|
getValueAsString(value: any, options: any): any;
|
72
72
|
}
|
73
73
|
import ContainerComponent from '../container/Container';
|
74
|
-
import Field from '../_classes/field/Field';
|
@@ -214,7 +214,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
214
214
|
super.dataValue = value;
|
215
215
|
}
|
216
216
|
get dataValue() {
|
217
|
-
const resultValue = _.get(this._data, this.
|
217
|
+
const resultValue = _.get(this._data, this.path);
|
218
218
|
if (!_.isArray(resultValue) && this.component.multiple) {
|
219
219
|
return [resultValue];
|
220
220
|
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let type: string;
|
3
|
+
let display: string;
|
4
|
+
let title: string;
|
5
|
+
let name: string;
|
6
|
+
let path: string;
|
7
|
+
let components: ({
|
8
|
+
label: string;
|
9
|
+
tableView: boolean;
|
10
|
+
multiple: boolean;
|
11
|
+
provider: string;
|
12
|
+
validateWhenHidden: boolean;
|
13
|
+
key: string;
|
14
|
+
providerOptions: {
|
15
|
+
params: {
|
16
|
+
autocompleteOptions: {};
|
17
|
+
};
|
18
|
+
};
|
19
|
+
type: string;
|
20
|
+
input: boolean;
|
21
|
+
components: {
|
22
|
+
label: string;
|
23
|
+
tableView: boolean;
|
24
|
+
key: string;
|
25
|
+
type: string;
|
26
|
+
input: boolean;
|
27
|
+
customConditional: string;
|
28
|
+
}[];
|
29
|
+
defaultValue: {}[];
|
30
|
+
disableOnInvalid?: undefined;
|
31
|
+
} | {
|
32
|
+
type: string;
|
33
|
+
label: string;
|
34
|
+
key: string;
|
35
|
+
disableOnInvalid: boolean;
|
36
|
+
input: boolean;
|
37
|
+
tableView: boolean;
|
38
|
+
multiple?: undefined;
|
39
|
+
provider?: undefined;
|
40
|
+
validateWhenHidden?: undefined;
|
41
|
+
providerOptions?: undefined;
|
42
|
+
components?: undefined;
|
43
|
+
defaultValue?: undefined;
|
44
|
+
})[];
|
45
|
+
}
|
46
|
+
export default _default;
|
@@ -0,0 +1,85 @@
|
|
1
|
+
export default {
|
2
|
+
type: 'form',
|
3
|
+
display: 'form',
|
4
|
+
title: 'FIO-9527',
|
5
|
+
name: 'fio9527',
|
6
|
+
path: 'fio9527',
|
7
|
+
components: [
|
8
|
+
{
|
9
|
+
label: 'Address',
|
10
|
+
tableView: false,
|
11
|
+
multiple: true,
|
12
|
+
provider: 'nominatim',
|
13
|
+
validateWhenHidden: false,
|
14
|
+
key: 'address',
|
15
|
+
providerOptions: {
|
16
|
+
params: {
|
17
|
+
autocompleteOptions: {}
|
18
|
+
}
|
19
|
+
},
|
20
|
+
type: 'address',
|
21
|
+
input: true,
|
22
|
+
components: [
|
23
|
+
{
|
24
|
+
label: 'Address 1',
|
25
|
+
tableView: false,
|
26
|
+
key: 'address1',
|
27
|
+
type: 'textfield',
|
28
|
+
input: true,
|
29
|
+
customConditional: "show = _.get(instance, 'parent.manualMode', false);"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
label: 'Address 2',
|
33
|
+
tableView: false,
|
34
|
+
key: 'address2',
|
35
|
+
type: 'textfield',
|
36
|
+
input: true,
|
37
|
+
customConditional: "show = _.get(instance, 'parent.manualMode', false);"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
label: 'City',
|
41
|
+
tableView: false,
|
42
|
+
key: 'city',
|
43
|
+
type: 'textfield',
|
44
|
+
input: true,
|
45
|
+
customConditional: "show = _.get(instance, 'parent.manualMode', false);"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
label: 'State',
|
49
|
+
tableView: false,
|
50
|
+
key: 'state',
|
51
|
+
type: 'textfield',
|
52
|
+
input: true,
|
53
|
+
customConditional: "show = _.get(instance, 'parent.manualMode', false);"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
label: 'Country',
|
57
|
+
tableView: false,
|
58
|
+
key: 'country',
|
59
|
+
type: 'textfield',
|
60
|
+
input: true,
|
61
|
+
customConditional: "show = _.get(instance, 'parent.manualMode', false);"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
label: 'Zip Code',
|
65
|
+
tableView: false,
|
66
|
+
key: 'zip',
|
67
|
+
type: 'textfield',
|
68
|
+
input: true,
|
69
|
+
customConditional: "show = _.get(instance, 'parent.manualMode', false);"
|
70
|
+
}
|
71
|
+
],
|
72
|
+
defaultValue: [
|
73
|
+
{}
|
74
|
+
]
|
75
|
+
},
|
76
|
+
{
|
77
|
+
type: 'button',
|
78
|
+
label: 'Submit',
|
79
|
+
key: 'submit',
|
80
|
+
disableOnInvalid: true,
|
81
|
+
input: true,
|
82
|
+
tableView: false
|
83
|
+
}
|
84
|
+
]
|
85
|
+
};
|
@@ -21,7 +21,7 @@ export default class ButtonComponent extends Field {
|
|
21
21
|
get clicked(): any;
|
22
22
|
get defaultValue(): boolean;
|
23
23
|
get oauthConfig(): any;
|
24
|
-
render():
|
24
|
+
render(): string;
|
25
25
|
attachButton(): void;
|
26
26
|
hasError: boolean | undefined;
|
27
27
|
isDisabledOnInvalid: any;
|
@@ -14,7 +14,7 @@ export default class ColumnsComponent extends NestedComponent {
|
|
14
14
|
get columnKey(): string;
|
15
15
|
columns: any[] | undefined;
|
16
16
|
labelIsHidden(): boolean;
|
17
|
-
render():
|
17
|
+
render(): string;
|
18
18
|
justifyColumn(items: any, index: any): boolean;
|
19
19
|
justify(): any;
|
20
20
|
get gridSize(): number;
|
@@ -54,7 +54,7 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
54
54
|
hasTopSubmit(): any;
|
55
55
|
hasBottomSubmit(): any;
|
56
56
|
get canAddColumn(): boolean;
|
57
|
-
render():
|
57
|
+
render(): string;
|
58
58
|
getRows(): {}[];
|
59
59
|
getColumns(): any[];
|
60
60
|
hasHeader(): any;
|
@@ -393,7 +393,7 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
393
393
|
row
|
394
394
|
});
|
395
395
|
this.checkConditions();
|
396
|
-
this.triggerChange();
|
396
|
+
this.triggerChange({ modified: true });
|
397
397
|
this.redraw().then(() => {
|
398
398
|
this.focusOnNewRowElement(this.rows[index]);
|
399
399
|
});
|
@@ -472,6 +472,9 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
472
472
|
options.name += `[${rowIndex}]`;
|
473
473
|
options.row = `${rowIndex}-${colIndex}`;
|
474
474
|
options.rowIndex = rowIndex;
|
475
|
+
options.onChange = (flags, changed, modified) => {
|
476
|
+
this.triggerChange({ modified });
|
477
|
+
};
|
475
478
|
let columnComponent;
|
476
479
|
if (this.builderMode) {
|
477
480
|
col.id = col.id + rowIndex;
|
@@ -20,6 +20,6 @@ export default class DateTimeComponent extends Input {
|
|
20
20
|
get momentFormat(): string;
|
21
21
|
createWrapper(): boolean;
|
22
22
|
checkValidity(data: any, dirty: any, rowData: any): boolean;
|
23
|
-
getValueAsString(value: any): any;
|
23
|
+
getValueAsString(value: any, options: any): any;
|
24
24
|
}
|
25
25
|
import Input from '../_classes/input/Input';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import moment from 'moment';
|
3
3
|
import FormioUtils from '../../utils';
|
4
|
-
import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
4
|
+
import { componentValueTypes, fastCloneDeep, getComponentSavedTypes } from '../../utils/utils';
|
5
5
|
import Input from '../_classes/input/Input';
|
6
6
|
export default class DateTimeComponent extends Input {
|
7
7
|
static schema(...extend) {
|
@@ -127,6 +127,10 @@ export default class DateTimeComponent extends Input {
|
|
127
127
|
maxDate: _.get(this.component, 'datePicker.maxDate'),
|
128
128
|
...customOptions,
|
129
129
|
};
|
130
|
+
// update originalComponent to include widget and other updated settings
|
131
|
+
// it is done here since these settings depend on properties present after the component is initialized
|
132
|
+
// originalComponent is used to restore the component (and widget) after evaluating field logic
|
133
|
+
this.originalComponent = fastCloneDeep(this.component);
|
130
134
|
/* eslint-enable camelcase */
|
131
135
|
}
|
132
136
|
get defaultSchema() {
|
@@ -173,15 +177,15 @@ export default class DateTimeComponent extends Input {
|
|
173
177
|
}
|
174
178
|
return super.checkValidity(data, dirty, rowData);
|
175
179
|
}
|
176
|
-
getValueAsString(value) {
|
180
|
+
getValueAsString(value, options) {
|
177
181
|
let format = FormioUtils.convertFormatToMoment(this.component.format);
|
178
182
|
format += format.match(/z$/) ? '' : ' z';
|
179
183
|
const timezone = this.timezone;
|
180
184
|
if (value && !this.attached && timezone) {
|
181
185
|
if (Array.isArray(value) && this.component.multiple) {
|
182
|
-
return value.map(item => _.trim(FormioUtils.momentDate(item, format, timezone).format(format))).join(', ');
|
186
|
+
return value.map(item => _.trim(FormioUtils.momentDate(item, format, timezone, options).format(format))).join(', ');
|
183
187
|
}
|
184
|
-
return _.trim(FormioUtils.momentDate(value, format, timezone).format(format));
|
188
|
+
return _.trim(FormioUtils.momentDate(value, format, timezone, options).format(format));
|
185
189
|
}
|
186
190
|
if (Array.isArray(value) && this.component.multiple) {
|
187
191
|
return value.map(item => _.trim(moment(item).format(format))).join(', ');
|