@formio/js 5.5.1 → 5.6.0
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/README.md +2 -2
- package/dist/formio.builder.css +26 -1
- package/dist/formio.builder.min.css +1 -1
- 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.css +26 -1
- package/dist/formio.form.js +39 -215
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -2
- package/dist/formio.full.css +26 -1
- package/dist/formio.full.js +41 -217
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -2
- package/dist/formio.js +316 -185
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +12 -2
- package/dist/formio.utils.js +15 -15
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -2
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDF.js +5 -0
- package/lib/cjs/Wizard.d.ts +5 -0
- package/lib/cjs/Wizard.js +22 -0
- package/lib/cjs/components/_classes/component/Component.js +2 -1
- package/lib/cjs/components/address/Address.js +5 -2
- package/lib/cjs/components/address/editForm/Address.edit.provider.d.ts +24 -0
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +13 -0
- package/lib/cjs/components/datagrid/DataGrid.js +2 -1
- package/lib/cjs/components/file/File.js +17 -8
- package/lib/cjs/components/file/editForm/File.edit.file.d.ts +44 -0
- package/lib/cjs/components/file/editForm/File.edit.file.js +2 -1
- package/lib/cjs/components/form/Form.d.ts +7 -0
- package/lib/cjs/components/form/Form.js +24 -2
- package/lib/cjs/components/signature/Signature.js +2 -2
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +9 -1
- package/lib/cjs/providers/address/GoogleAddressProvider.js +116 -32
- package/lib/cjs/providers/storage/indexeddb.js +2 -2
- package/lib/cjs/utils/utils.d.ts +2 -5
- package/lib/cjs/utils/utils.js +2 -13
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDF.js +4 -0
- package/lib/mjs/Wizard.d.ts +5 -0
- package/lib/mjs/Wizard.js +22 -0
- package/lib/mjs/components/_classes/component/Component.js +1 -1
- package/lib/mjs/components/address/Address.js +5 -2
- package/lib/mjs/components/address/editForm/Address.edit.provider.d.ts +24 -0
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +13 -0
- package/lib/mjs/components/datagrid/DataGrid.js +2 -1
- package/lib/mjs/components/file/File.js +17 -8
- package/lib/mjs/components/file/editForm/File.edit.file.d.ts +44 -0
- package/lib/mjs/components/file/editForm/File.edit.file.js +2 -1
- package/lib/mjs/components/form/Form.d.ts +7 -0
- package/lib/mjs/components/form/Form.js +24 -2
- package/lib/mjs/components/signature/Signature.js +2 -2
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +9 -1
- package/lib/mjs/providers/address/GoogleAddressProvider.js +94 -32
- package/lib/mjs/providers/storage/indexeddb.js +2 -2
- package/lib/mjs/utils/utils.d.ts +2 -5
- package/lib/mjs/utils/utils.js +3 -12
- package/package.json +7 -8
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
2
22
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
24
|
};
|
|
@@ -11,6 +31,7 @@ const AddressProvider_1 = require("./AddressProvider");
|
|
|
11
31
|
const GOOGLE_MAPS_BASE_URL = 'https://maps.googleapis.com';
|
|
12
32
|
const GOOGLE_MAPS_JS_URL = `${GOOGLE_MAPS_BASE_URL}/maps/api/js`;
|
|
13
33
|
const GOOGLE_MAPS_JS_WITH_PARAMS_URL = `${GOOGLE_MAPS_JS_URL}?v=quarterly&libraries=places&loading=async&callback=googleMapsCallback`;
|
|
34
|
+
const NEW_PLACES_API_VERSION = 'newPlacesApi';
|
|
14
35
|
/**
|
|
15
36
|
* @typedef {object} AutocompleteOptions
|
|
16
37
|
* @property {string[]} fields - The fields to include in the autocomplete response.
|
|
@@ -78,6 +99,19 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
|
|
|
78
99
|
get alternativeDisplayValueProperty() {
|
|
79
100
|
return 'formatted_address';
|
|
80
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* @returns {string} The property to use for display value on places returned by the new Places API.
|
|
104
|
+
*/
|
|
105
|
+
get newApiDisplayValueProperty() {
|
|
106
|
+
return 'formattedAddress';
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @returns {boolean} Whether the provider is configured to use the new Places API.
|
|
110
|
+
*/
|
|
111
|
+
get usesNewPlacesApi() {
|
|
112
|
+
var _a;
|
|
113
|
+
return ((_a = this.options) === null || _a === void 0 ? void 0 : _a.version) === NEW_PLACES_API_VERSION;
|
|
114
|
+
}
|
|
81
115
|
/**
|
|
82
116
|
* @param {AutocompleteOptions} options - The autocomplete options.
|
|
83
117
|
*/
|
|
@@ -95,10 +129,11 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
|
|
|
95
129
|
|
|
96
130
|
*/
|
|
97
131
|
setAutocompleteOptions() {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
132
|
+
// Clone so the stored provider options are never mutated: the required fields
|
|
133
|
+
// differ per Places API version, and stale fields from a previous computation
|
|
134
|
+
// must not leak into the next one (FIO-10428).
|
|
135
|
+
const storedOptions = lodash_1.default.get(this.options, 'autocompleteOptions', {});
|
|
136
|
+
const options = lodash_1.default.isObject(storedOptions) ? lodash_1.default.cloneDeep(storedOptions) : {};
|
|
102
137
|
this.addRequiredProviderOptions(options);
|
|
103
138
|
this.autocompleteOptions = options;
|
|
104
139
|
}
|
|
@@ -138,14 +173,9 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
|
|
|
138
173
|
* @returns {string[]} The required address properties.
|
|
139
174
|
*/
|
|
140
175
|
getRequiredAddressProperties() {
|
|
141
|
-
return
|
|
142
|
-
'
|
|
143
|
-
'formatted_address',
|
|
144
|
-
'geometry',
|
|
145
|
-
'place_id',
|
|
146
|
-
'plus_code',
|
|
147
|
-
'types',
|
|
148
|
-
];
|
|
176
|
+
return this.usesNewPlacesApi
|
|
177
|
+
? ['addressComponents', 'formattedAddress', 'location', 'viewport', 'id', 'plusCode', 'types']
|
|
178
|
+
: ['address_components', 'formatted_address', 'geometry', 'place_id', 'plus_code', 'types'];
|
|
149
179
|
}
|
|
150
180
|
/**
|
|
151
181
|
* Adds the required provider options to the options.
|
|
@@ -174,25 +204,77 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
|
|
|
174
204
|
}
|
|
175
205
|
return filteredPlace;
|
|
176
206
|
}
|
|
177
|
-
attachAutocomplete(elem, index, onSelectAddress) {
|
|
207
|
+
attachAutocomplete(elem, index, onSelectAddress, disable = false) {
|
|
208
|
+
if (disable) {
|
|
209
|
+
return Promise.resolve();
|
|
210
|
+
}
|
|
178
211
|
return Formio_1.Formio.libraryReady(this.getLibraryName()).then(() => {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
212
|
+
this.setAutocompleteOptions();
|
|
213
|
+
if (!this.usesNewPlacesApi) {
|
|
214
|
+
const autocomplete = new google.maps.places.Autocomplete(elem, this.autocompleteOptions);
|
|
215
|
+
const listener = autocomplete.addListener('place_changed', () => {
|
|
216
|
+
const place = this.filterPlace(autocomplete.getPlace());
|
|
217
|
+
place.formattedPlace = lodash_1.default.get(autocomplete, 'gm_accessors_.place.se.formattedPrediction', place[this.alternativeDisplayValueProperty]);
|
|
218
|
+
onSelectAddress(place, elem, index);
|
|
219
|
+
});
|
|
220
|
+
return () => {
|
|
221
|
+
var _a;
|
|
222
|
+
if ((_a = google === null || google === void 0 ? void 0 : google.maps) === null || _a === void 0 ? void 0 : _a.event) {
|
|
223
|
+
google.maps.event.clearInstanceListeners(autocomplete);
|
|
224
|
+
google.maps.event.removeListener(listener);
|
|
225
|
+
}
|
|
226
|
+
document.querySelectorAll('.pac-container').forEach((node) => {
|
|
227
|
+
if (node.parentNode) {
|
|
228
|
+
node.parentNode.removeChild(node);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
const _a = this.autocompleteOptions, { fields, componentRestrictions } = _a, elementOptions = __rest(_a, ["fields", "componentRestrictions"]);
|
|
234
|
+
const country = componentRestrictions === null || componentRestrictions === void 0 ? void 0 : componentRestrictions.country;
|
|
235
|
+
if (country) {
|
|
236
|
+
// The new element spells legacy componentRestrictions.country as includedRegionCodes.
|
|
237
|
+
elementOptions.includedRegionCodes = lodash_1.default.castArray(country);
|
|
238
|
+
}
|
|
239
|
+
elementOptions.noInputIcon = true;
|
|
240
|
+
const autocomplete = new google.maps.places.PlaceAutocompleteElement(elementOptions);
|
|
241
|
+
if (elem === null || elem === void 0 ? void 0 : elem.value) {
|
|
242
|
+
autocomplete.value = elem.value;
|
|
243
|
+
}
|
|
244
|
+
autocomplete.classList.add('form-control');
|
|
245
|
+
// Replace the existing element with the autocomplete element
|
|
246
|
+
elem.parentNode.replaceChildren(autocomplete);
|
|
247
|
+
const handlePlaceSelect = (event) => __awaiter(this, void 0, void 0, function* () {
|
|
248
|
+
var _b, _c;
|
|
249
|
+
let selectedPlace;
|
|
250
|
+
try {
|
|
251
|
+
const place = event.placePrediction.toPlace();
|
|
252
|
+
yield place.fetchFields({
|
|
253
|
+
fields: fields || this.getRequiredAddressProperties(),
|
|
254
|
+
});
|
|
255
|
+
const convertedPlace = {
|
|
256
|
+
addressComponents: place.addressComponents || [],
|
|
257
|
+
formattedAddress: place.formattedAddress || '',
|
|
258
|
+
location: place.location || {},
|
|
259
|
+
viewport: place.viewport || {},
|
|
260
|
+
id: place.id || '',
|
|
261
|
+
plusCode: place.plusCode || {},
|
|
262
|
+
types: place.types || [],
|
|
263
|
+
};
|
|
264
|
+
selectedPlace = this.filterPlace(convertedPlace);
|
|
265
|
+
selectedPlace.formattedPlace = convertedPlace.formattedAddress;
|
|
266
|
+
}
|
|
267
|
+
catch (err) {
|
|
268
|
+
// fetchFields rejections are otherwise swallowed by the Maps event
|
|
269
|
+
// dispatcher; never let a failed details request drop the selection.
|
|
270
|
+
console.warn(`Unable to fetch the selected place's details: ${err}`);
|
|
271
|
+
selectedPlace = { formattedPlace: String((_c = (_b = event.placePrediction) === null || _b === void 0 ? void 0 : _b.text) !== null && _c !== void 0 ? _c : '') };
|
|
272
|
+
}
|
|
273
|
+
onSelectAddress(selectedPlace, elem, index);
|
|
184
274
|
});
|
|
275
|
+
autocomplete.addEventListener('gmp-select', handlePlaceSelect);
|
|
185
276
|
return () => {
|
|
186
|
-
|
|
187
|
-
if ((_a = google === null || google === void 0 ? void 0 : google.maps) === null || _a === void 0 ? void 0 : _a.event) {
|
|
188
|
-
google.maps.event.clearInstanceListeners(autocomplete);
|
|
189
|
-
google.maps.event.removeListener(listener);
|
|
190
|
-
}
|
|
191
|
-
document.querySelectorAll('.pac-container').forEach((node) => {
|
|
192
|
-
if (node.parentNode) {
|
|
193
|
-
node.parentNode.removeChild(node);
|
|
194
|
-
}
|
|
195
|
-
});
|
|
277
|
+
autocomplete.removeEventListener('gmp-select', handlePlaceSelect);
|
|
196
278
|
};
|
|
197
279
|
});
|
|
198
280
|
}
|
|
@@ -203,10 +285,12 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
|
|
|
203
285
|
return Promise.resolve();
|
|
204
286
|
}
|
|
205
287
|
getDisplayValue(address) {
|
|
206
|
-
const displayedProperty =
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
288
|
+
const displayedProperty = [
|
|
289
|
+
this.displayValueProperty,
|
|
290
|
+
this.alternativeDisplayValueProperty,
|
|
291
|
+
this.newApiDisplayValueProperty,
|
|
292
|
+
].find((property) => lodash_1.default.has(address, property));
|
|
293
|
+
return displayedProperty ? lodash_1.default.get(address, displayedProperty, '') : '';
|
|
210
294
|
}
|
|
211
295
|
/**
|
|
212
296
|
* Tries to remove the library if api key for loaded script is different.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const utils_1 = require("../../utils/utils");
|
|
4
4
|
/**
|
|
5
5
|
* indexedDb provider for file storage.
|
|
6
6
|
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
|
@@ -29,7 +29,7 @@ function indexeddb() {
|
|
|
29
29
|
return new Promise((resolve, reject) => {
|
|
30
30
|
reader.onload = () => {
|
|
31
31
|
const blobObject = new Blob([file], { type: file.type });
|
|
32
|
-
const id = (0,
|
|
32
|
+
const id = (0, utils_1.guid)();
|
|
33
33
|
const data = {
|
|
34
34
|
id,
|
|
35
35
|
data: blobObject,
|
package/lib/cjs/utils/utils.d.ts
CHANGED
|
@@ -163,11 +163,6 @@ export function convertStringToHTMLElement(str: string, selector: string): HTMLE
|
|
|
163
163
|
* @returns {string} - A unique filename.
|
|
164
164
|
*/
|
|
165
165
|
export function uniqueName(name: string, template: string, evalContext: object): string;
|
|
166
|
-
/**
|
|
167
|
-
* Returns a GUID
|
|
168
|
-
* @returns {string} - A GUID.
|
|
169
|
-
*/
|
|
170
|
-
export function guid(): string;
|
|
171
166
|
/**
|
|
172
167
|
* Return a translated date setting.
|
|
173
168
|
* @param {string|Date} date - The date to translate.
|
|
@@ -520,6 +515,7 @@ export function announceScreenReaderMessage(component: any, value: any, index?:
|
|
|
520
515
|
* @param {string} text The text to output to screen readers
|
|
521
516
|
*/
|
|
522
517
|
export function screenReaderSpeech(text: string): void;
|
|
518
|
+
export { guid };
|
|
523
519
|
/**
|
|
524
520
|
* Map values through unfold and return first non-nil value.
|
|
525
521
|
* @param {Array<T>} collection - The collection to map through unfold.;
|
|
@@ -536,3 +532,4 @@ export namespace componentValueTypes {
|
|
|
536
532
|
let any: string;
|
|
537
533
|
}
|
|
538
534
|
export function interpolateErrors(component: Component, errors: FieldError[], interpolateFn: Function): [];
|
|
535
|
+
import { guid } from './formUtils';
|
package/lib/cjs/utils/utils.js
CHANGED
|
@@ -10,6 +10,7 @@ const moment_timezone_1 = __importDefault(require("moment-timezone/moment-timezo
|
|
|
10
10
|
const jstimezonedetect_1 = __importDefault(require("jstimezonedetect"));
|
|
11
11
|
const dompurify_1 = __importDefault(require("dompurify"));
|
|
12
12
|
const formUtils_1 = require("./formUtils");
|
|
13
|
+
Object.defineProperty(exports, "guid", { enumerable: true, get: function () { return formUtils_1.guid; } });
|
|
13
14
|
const Evaluator_1 = require("./Evaluator");
|
|
14
15
|
const conditionOperators_1 = __importDefault(require("./conditionOperators"));
|
|
15
16
|
const core_1 = require("@formio/core");
|
|
@@ -551,25 +552,13 @@ function uniqueName(name, template, evalContext) {
|
|
|
551
552
|
fileName = fileName.substr(0, 100);
|
|
552
553
|
evalContext = Object.assign(evalContext || {}, {
|
|
553
554
|
fileName,
|
|
554
|
-
guid: guid(),
|
|
555
|
+
guid: (0, formUtils_1.guid)(),
|
|
555
556
|
});
|
|
556
557
|
//only letters, numbers, dots, dashes, underscores and spaces are allowed. Anything else will be replaced with dash
|
|
557
558
|
const uniqueName = `${Evaluator_1.Evaluator.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\-_ ]/g, '-');
|
|
558
559
|
return uniqueName;
|
|
559
560
|
}
|
|
560
561
|
exports.uniqueName = uniqueName;
|
|
561
|
-
/**
|
|
562
|
-
* Returns a GUID
|
|
563
|
-
* @returns {string} - A GUID.
|
|
564
|
-
*/
|
|
565
|
-
function guid() {
|
|
566
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
567
|
-
const r = (Math.random() * 16) | 0;
|
|
568
|
-
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
569
|
-
return v.toString(16);
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
exports.guid = guid;
|
|
573
562
|
/**
|
|
574
563
|
* Return a translated date setting.
|
|
575
564
|
* @param {string|Date} date - The date to translate.
|
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 = '5.
|
|
17
|
+
static version = '5.6.0';
|
|
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 = '5.
|
|
7
|
+
FormioCore.version = '5.6.0';
|
|
8
8
|
CDN.defaultCDN = FormioCore.version.includes('rc')
|
|
9
9
|
? 'https://cdn.test-form.io'
|
|
10
10
|
: 'https://cdn.form.io';
|
package/lib/mjs/PDF.js
CHANGED
|
@@ -194,6 +194,10 @@ export default class PDF extends Webform {
|
|
|
194
194
|
if (this.builderMode) {
|
|
195
195
|
params.push('builder=1');
|
|
196
196
|
}
|
|
197
|
+
const parentIconset = this.options.iconset || Formio.Templates?.current?.defaultIconset;
|
|
198
|
+
if (parentIconset && parentIconset !== 'bi') {
|
|
199
|
+
params.push(`iconset=${encodeURIComponent(parentIconset)}`);
|
|
200
|
+
}
|
|
197
201
|
if (params.length) {
|
|
198
202
|
iframeSrc += `?${params.join('&')}`;
|
|
199
203
|
}
|
package/lib/mjs/Wizard.d.ts
CHANGED
|
@@ -60,6 +60,11 @@ declare class Wizard extends Webform {
|
|
|
60
60
|
*/
|
|
61
61
|
handleSaveOnEnter(event: KeyboardEvent): void;
|
|
62
62
|
attachNav(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Renders the submission result message under the navigation submit button, mirroring the
|
|
65
|
+
* behavior of the Button components.
|
|
66
|
+
*/
|
|
67
|
+
attachSubmitMessage(): void;
|
|
63
68
|
/**
|
|
64
69
|
* Emits an event indicating that a wizard page has been selected.
|
|
65
70
|
* @param {number} index - Index of the selected wizard page in the `pages` array.
|
package/lib/mjs/Wizard.js
CHANGED
|
@@ -214,6 +214,8 @@ export default class Wizard extends Webform {
|
|
|
214
214
|
[`${this.wizardKey}-previous`]: 'single',
|
|
215
215
|
[`${this.wizardKey}-next`]: 'single',
|
|
216
216
|
[`${this.wizardKey}-submit`]: 'single',
|
|
217
|
+
[`${this.wizardKey}-buttonMessageContainer`]: 'single',
|
|
218
|
+
[`${this.wizardKey}-buttonMessage`]: 'single',
|
|
217
219
|
});
|
|
218
220
|
this.attachNav();
|
|
219
221
|
}
|
|
@@ -250,6 +252,8 @@ export default class Wizard extends Webform {
|
|
|
250
252
|
[`${this.wizardKey}-previous`]: 'single',
|
|
251
253
|
[`${this.wizardKey}-next`]: 'single',
|
|
252
254
|
[`${this.wizardKey}-submit`]: 'single',
|
|
255
|
+
[`${this.wizardKey}-buttonMessageContainer`]: 'single',
|
|
256
|
+
[`${this.wizardKey}-buttonMessage`]: 'single',
|
|
253
257
|
[`${this.wizardKey}-link`]: 'multiple',
|
|
254
258
|
[`${this.wizardKey}-tooltip`]: 'multiple',
|
|
255
259
|
});
|
|
@@ -264,6 +268,7 @@ export default class Wizard extends Webform {
|
|
|
264
268
|
]);
|
|
265
269
|
this.attachNav();
|
|
266
270
|
this.attachHeader();
|
|
271
|
+
this.attachSubmitMessage();
|
|
267
272
|
return promises.then(() => {
|
|
268
273
|
this.emit('render', { component: this.currentPage, page: this.page });
|
|
269
274
|
if (this.component.scrollToTop) {
|
|
@@ -360,6 +365,23 @@ export default class Wizard extends Webform {
|
|
|
360
365
|
});
|
|
361
366
|
});
|
|
362
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Renders the submission result message under the navigation submit button, mirroring the
|
|
370
|
+
* behavior of the Button components.
|
|
371
|
+
*/
|
|
372
|
+
attachSubmitMessage() {
|
|
373
|
+
this.on('submitDone', (message) => {
|
|
374
|
+
const messageContainer = this.refs[`${this.wizardKey}-buttonMessageContainer`];
|
|
375
|
+
const messageElement = this.refs[`${this.wizardKey}-buttonMessage`];
|
|
376
|
+
if (!messageElement) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
const resultMessage = _.isString(message) ? message : this.t('complete');
|
|
380
|
+
this.addClass(messageContainer, 'has-success');
|
|
381
|
+
this.removeClass(messageContainer, 'has-error');
|
|
382
|
+
this.setContent(messageElement, resultMessage);
|
|
383
|
+
}, true);
|
|
384
|
+
}
|
|
363
385
|
/**
|
|
364
386
|
* Emits an event indicating that a wizard page has been selected.
|
|
365
387
|
* @param {number} index - Index of the selected wizard page in the `pages` array.
|
|
@@ -924,7 +924,7 @@ export default class Component extends Element {
|
|
|
924
924
|
return '';
|
|
925
925
|
}
|
|
926
926
|
// Use _userInput: true to ignore translations from defaults
|
|
927
|
-
if (text in enTranslation && params._userInput) {
|
|
927
|
+
if (this.i18next?.language === 'en' && text in enTranslation && params._userInput) {
|
|
928
928
|
return text;
|
|
929
929
|
}
|
|
930
930
|
params.data = params.data || this.rootValue;
|
|
@@ -414,8 +414,12 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
414
414
|
this.searchInput.forEach((element, index) => {
|
|
415
415
|
if (!this.builderMode && element && this.provider) {
|
|
416
416
|
if (this.component.provider === 'google') {
|
|
417
|
+
if (this.component.enableNewPlacesApi) {
|
|
418
|
+
this.provider.options.version = 'newPlacesApi';
|
|
419
|
+
}
|
|
417
420
|
this.googlePlacesCleanups = [];
|
|
418
|
-
this.provider
|
|
421
|
+
this.provider
|
|
422
|
+
.attachAutocomplete(element, index, this.onSelectAddress.bind(this), this.disabled)
|
|
419
423
|
.then((cleanup) => {
|
|
420
424
|
if (typeof cleanup === 'function') {
|
|
421
425
|
this.googlePlacesCleanups.push(cleanup);
|
|
@@ -516,7 +520,6 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
516
520
|
if (this.autocompleterWidget && typeof this.autocompleterWidget.destroy === 'function') {
|
|
517
521
|
this.autocompleterWidget.destroy();
|
|
518
522
|
}
|
|
519
|
-
;
|
|
520
523
|
(this.googlePlacesCleanups || []).forEach((cleanup) => {
|
|
521
524
|
cleanup();
|
|
522
525
|
});
|
|
@@ -118,6 +118,30 @@ declare const _default: ({
|
|
|
118
118
|
validate?: undefined;
|
|
119
119
|
defaultValue?: undefined;
|
|
120
120
|
description?: undefined;
|
|
121
|
+
} | {
|
|
122
|
+
weight: number;
|
|
123
|
+
type: string;
|
|
124
|
+
input: boolean;
|
|
125
|
+
key: string;
|
|
126
|
+
label: string;
|
|
127
|
+
tooltip: string;
|
|
128
|
+
conditional: {
|
|
129
|
+
json: {
|
|
130
|
+
'===': (string | {
|
|
131
|
+
var: string;
|
|
132
|
+
})[];
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
placeholder?: undefined;
|
|
136
|
+
valueProperty?: undefined;
|
|
137
|
+
dataSrc?: undefined;
|
|
138
|
+
data?: undefined;
|
|
139
|
+
validate?: undefined;
|
|
140
|
+
defaultValue?: undefined;
|
|
141
|
+
rows?: undefined;
|
|
142
|
+
editor?: undefined;
|
|
143
|
+
as?: undefined;
|
|
144
|
+
description?: undefined;
|
|
121
145
|
} | {
|
|
122
146
|
type: string;
|
|
123
147
|
input: boolean;
|
|
@@ -136,6 +136,19 @@ export default [
|
|
|
136
136
|
},
|
|
137
137
|
},
|
|
138
138
|
},
|
|
139
|
+
{
|
|
140
|
+
weight: 10,
|
|
141
|
+
type: 'checkbox',
|
|
142
|
+
input: true,
|
|
143
|
+
key: 'enableNewPlacesApi',
|
|
144
|
+
label: 'Places API (New)',
|
|
145
|
+
tooltip: 'Enable the new Google Places API instead of the legacy version.',
|
|
146
|
+
conditional: {
|
|
147
|
+
json: {
|
|
148
|
+
'===': [{ var: 'data.provider' }, 'google'],
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
139
152
|
{
|
|
140
153
|
type: 'textarea',
|
|
141
154
|
input: true,
|
|
@@ -539,10 +539,11 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
|
539
539
|
}, modified);
|
|
540
540
|
this.triggerRootChange(flags, changed, modified);
|
|
541
541
|
}
|
|
542
|
+
const rowData = this.dataValue[rowIndex];
|
|
542
543
|
this.processRow('checkData', null, {
|
|
543
544
|
...flags,
|
|
544
545
|
changed,
|
|
545
|
-
},
|
|
546
|
+
}, rowData, _.toArray(this.rows[rowIndex]));
|
|
546
547
|
};
|
|
547
548
|
let columnComponent;
|
|
548
549
|
if (this.builderMode) {
|
|
@@ -92,6 +92,11 @@ export default class FileComponent extends Field {
|
|
|
92
92
|
this.abortUploads = [];
|
|
93
93
|
this.pendingfiles = [];
|
|
94
94
|
this.resolvedFiles = [];
|
|
95
|
+
const imageSize = Number(this.component.imageSize);
|
|
96
|
+
const isValidImageSize = imageSize > 0;
|
|
97
|
+
if (!isValidImageSize) {
|
|
98
|
+
this.component.imageSize = '200';
|
|
99
|
+
}
|
|
95
100
|
}
|
|
96
101
|
get dataReady() {
|
|
97
102
|
return this.filesReady || Promise.resolve();
|
|
@@ -635,7 +640,7 @@ export default class FileComponent extends Field {
|
|
|
635
640
|
fileKey: this.component.fileKey || 'file',
|
|
636
641
|
storage: this.component.storage,
|
|
637
642
|
options: this.component.storage === 'url'
|
|
638
|
-
?
|
|
643
|
+
? this.component.urlRequestOptions || this.component.options
|
|
639
644
|
: this.component.options,
|
|
640
645
|
file,
|
|
641
646
|
size: file.size,
|
|
@@ -668,7 +673,9 @@ export default class FileComponent extends Field {
|
|
|
668
673
|
return fileWithSameNameUploaded || fileWithSameNameUploading
|
|
669
674
|
? {
|
|
670
675
|
status: 'error',
|
|
671
|
-
message: this.t(fileWithSameNameUploading
|
|
676
|
+
message: this.t(fileWithSameNameUploading
|
|
677
|
+
? 'fileWithDuplicatedNameInProgress'
|
|
678
|
+
: 'fileWithDuplicatedNameLoaded'),
|
|
672
679
|
}
|
|
673
680
|
: {};
|
|
674
681
|
}
|
|
@@ -866,8 +873,8 @@ export default class FileComponent extends Field {
|
|
|
866
873
|
}
|
|
867
874
|
async deleteFile(fileInfo) {
|
|
868
875
|
const options = this.component.storage === 'url'
|
|
869
|
-
?
|
|
870
|
-
:
|
|
876
|
+
? this.component.urlRequestOptions || this.component.options || {}
|
|
877
|
+
: this.component.options || {};
|
|
871
878
|
if (fileInfo &&
|
|
872
879
|
['url', 'indexeddb', 's3', 'azure', 'googledrive'].includes(this.component.storage)) {
|
|
873
880
|
const { fileService } = this;
|
|
@@ -1006,7 +1013,7 @@ export default class FileComponent extends Field {
|
|
|
1006
1013
|
delete fileToSync.progress;
|
|
1007
1014
|
this.redraw();
|
|
1008
1015
|
if (fileInfo) {
|
|
1009
|
-
const fileExists = this.resolvedFiles.find(x => x.fileInfo.originalName === fileToSync.originalName);
|
|
1016
|
+
const fileExists = this.resolvedFiles.find((x) => x.fileInfo.originalName === fileToSync.originalName);
|
|
1010
1017
|
if (!fileExists && fileToSync.status !== 'error') {
|
|
1011
1018
|
this.resolvedFiles.push({ fileToSync, fileInfo });
|
|
1012
1019
|
}
|
|
@@ -1060,8 +1067,8 @@ export default class FileComponent extends Field {
|
|
|
1060
1067
|
}
|
|
1061
1068
|
getFile(fileInfo) {
|
|
1062
1069
|
const options = this.component.storage === 'url'
|
|
1063
|
-
?
|
|
1064
|
-
:
|
|
1070
|
+
? this.component.urlRequestOptions || this.component.options || {}
|
|
1071
|
+
: this.component.options || {};
|
|
1065
1072
|
const { fileService } = this;
|
|
1066
1073
|
if (!fileService) {
|
|
1067
1074
|
return alert(this.t('noFileService'));
|
|
@@ -1101,7 +1108,9 @@ export default class FileComponent extends Field {
|
|
|
1101
1108
|
return Promise.resolve();
|
|
1102
1109
|
}
|
|
1103
1110
|
await this.syncFiles();
|
|
1104
|
-
return this.shouldSyncFiles
|
|
1111
|
+
return this.shouldSyncFiles
|
|
1112
|
+
? Promise.reject(this.t('synchronizationFailed'))
|
|
1113
|
+
: Promise.resolve();
|
|
1105
1114
|
}
|
|
1106
1115
|
catch (error) {
|
|
1107
1116
|
return Promise.reject(error.message);
|