@formio/js 5.1.0-dev.6058.189ce78 → 5.1.0-dev.6059.845a6e3
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 +13 -131
- package/README.md +1 -28
- package/dist/formio.builder.css +17 -19
- 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 +17 -19
- package/dist/formio.form.js +176 -102
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -3
- package/dist/formio.full.css +17 -19
- package/dist/formio.full.js +86 -108
- package/dist/formio.full.min.css +2 -2
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -3
- package/dist/formio.js +10 -10
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +3 -3
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/CDN.d.ts +1 -1
- package/lib/cjs/CDN.js +2 -2
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Form.d.ts +6 -4
- package/lib/cjs/Form.js +8 -16
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDFBuilder.js +4 -4
- package/lib/cjs/Webform.d.ts +13 -16
- package/lib/cjs/Webform.js +148 -162
- package/lib/cjs/WebformBuilder.js +28 -17
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/WizardBuilder.js +2 -15
- package/lib/cjs/components/Components.d.ts +0 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/cjs/components/_classes/component/Component.js +11 -38
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -32
- package/lib/cjs/components/_classes/component/editForm/utils.d.ts +0 -1
- package/lib/cjs/components/_classes/component/editForm/utils.js +0 -3
- package/lib/cjs/components/_classes/input/Input.js +1 -23
- package/lib/cjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +3 -10
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +0 -2
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +31 -52
- package/lib/cjs/components/address/Address.js +1 -1
- package/lib/cjs/components/button/Button.js +6 -6
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +2 -2
- package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -2
- package/lib/cjs/components/datagrid/DataGrid.js +26 -41
- package/lib/cjs/components/day/Day.js +7 -9
- package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +8 -26
- package/lib/cjs/components/file/File.d.ts +1 -1
- package/lib/cjs/components/file/File.js +17 -23
- package/lib/cjs/components/form/Form.d.ts +1 -1
- package/lib/cjs/components/form/Form.js +5 -9
- package/lib/cjs/components/form/editForm/Form.edit.form.js +3 -3
- package/lib/cjs/components/hidden/Hidden.d.ts +1 -0
- package/lib/cjs/components/hidden/Hidden.js +1 -1
- package/lib/cjs/components/number/Number.js +5 -12
- package/lib/cjs/components/radio/Radio.js +0 -10
- package/lib/cjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/cjs/components/select/Select.d.ts +1 -0
- package/lib/cjs/components/select/Select.js +33 -12
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +2 -3
- package/lib/cjs/components/selectboxes/SelectBoxes.js +2 -2
- package/lib/cjs/components/signature/Signature.d.ts +1 -1
- package/lib/cjs/components/signature/Signature.js +3 -5
- package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +6 -0
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +1 -0
- package/lib/cjs/components/survey/Survey.js +2 -2
- package/lib/cjs/components/tags/Tags.d.ts +1 -1
- package/lib/cjs/components/tags/Tags.js +2 -2
- package/lib/cjs/components/textarea/TextArea.js +6 -6
- package/lib/cjs/formio.form.js +0 -5
- package/lib/cjs/providers/storage/googleDrive.js +2 -3
- package/lib/cjs/providers/storage/s3.js +3 -3
- package/lib/cjs/providers/storage/xhr.d.ts +0 -1
- package/lib/cjs/providers/storage/xhr.js +1 -6
- package/lib/cjs/translations/en.d.ts +81 -234
- package/lib/cjs/translations/en.js +81 -8
- package/lib/cjs/utils/ChoicesWrapper.d.ts +25 -4
- package/lib/cjs/utils/ChoicesWrapper.js +124 -47
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/i18n.d.ts +2 -5
- package/lib/cjs/utils/i18n.js +5 -32
- package/lib/cjs/widgets/CalendarWidget.js +27 -27
- package/lib/mjs/CDN.d.ts +1 -1
- package/lib/mjs/CDN.js +2 -2
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Form.d.ts +6 -4
- package/lib/mjs/Form.js +9 -17
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDFBuilder.js +4 -4
- package/lib/mjs/Webform.d.ts +13 -16
- package/lib/mjs/Webform.js +158 -171
- package/lib/mjs/WebformBuilder.js +28 -17
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/WizardBuilder.js +2 -15
- package/lib/mjs/components/Components.d.ts +0 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/mjs/components/_classes/component/Component.js +11 -27
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -32
- package/lib/mjs/components/_classes/component/editForm/utils.d.ts +0 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +0 -3
- package/lib/mjs/components/_classes/input/Input.js +1 -22
- package/lib/mjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +3 -10
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +0 -2
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +31 -53
- package/lib/mjs/components/address/Address.js +1 -1
- package/lib/mjs/components/button/Button.js +6 -6
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.js +2 -2
- package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -2
- package/lib/mjs/components/datagrid/DataGrid.js +26 -41
- package/lib/mjs/components/day/Day.js +7 -9
- package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +7 -25
- package/lib/mjs/components/file/File.d.ts +1 -1
- package/lib/mjs/components/file/File.js +17 -23
- package/lib/mjs/components/form/Form.d.ts +1 -1
- package/lib/mjs/components/form/Form.js +5 -8
- package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -3
- package/lib/mjs/components/hidden/Hidden.d.ts +1 -0
- package/lib/mjs/components/hidden/Hidden.js +1 -1
- package/lib/mjs/components/number/Number.js +5 -12
- package/lib/mjs/components/radio/Radio.js +0 -10
- package/lib/mjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/mjs/components/select/Select.d.ts +1 -0
- package/lib/mjs/components/select/Select.js +34 -14
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +2 -3
- package/lib/mjs/components/selectboxes/SelectBoxes.js +2 -2
- package/lib/mjs/components/signature/Signature.d.ts +1 -1
- package/lib/mjs/components/signature/Signature.js +3 -5
- package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +6 -0
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +1 -0
- package/lib/mjs/components/survey/Survey.js +2 -2
- package/lib/mjs/components/tags/Tags.d.ts +1 -1
- package/lib/mjs/components/tags/Tags.js +2 -2
- package/lib/mjs/components/textarea/TextArea.js +6 -6
- package/lib/mjs/formio.form.js +0 -5
- package/lib/mjs/providers/storage/googleDrive.js +2 -3
- package/lib/mjs/providers/storage/s3.js +3 -3
- package/lib/mjs/providers/storage/xhr.d.ts +0 -1
- package/lib/mjs/providers/storage/xhr.js +1 -6
- package/lib/mjs/translations/en.d.ts +81 -234
- package/lib/mjs/translations/en.js +1 -87
- package/lib/mjs/utils/ChoicesWrapper.d.ts +25 -4
- package/lib/mjs/utils/ChoicesWrapper.js +119 -26
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/i18n.d.ts +2 -5
- package/lib/mjs/utils/i18n.js +5 -32
- package/lib/mjs/widgets/CalendarWidget.js +27 -27
- package/package.json +11 -27
|
@@ -102,8 +102,7 @@ class FormComponent extends Component_1.default {
|
|
|
102
102
|
return this.createSubForm();
|
|
103
103
|
}
|
|
104
104
|
get dataReady() {
|
|
105
|
-
|
|
106
|
-
return ((_a = this.subForm) === null || _a === void 0 ? void 0 : _a.dataReady) || this.subFormReady || Promise.resolve();
|
|
105
|
+
return this.subFormReady || Promise.resolve();
|
|
107
106
|
}
|
|
108
107
|
get defaultValue() {
|
|
109
108
|
// Not not provide a default value unless the subform is ready so that it will initialize correctly.
|
|
@@ -218,7 +217,7 @@ class FormComponent extends Component_1.default {
|
|
|
218
217
|
/* eslint-enable max-statements */
|
|
219
218
|
render() {
|
|
220
219
|
if (this.builderMode) {
|
|
221
|
-
return super.render(this.
|
|
220
|
+
return super.render(this.component.label || 'Nested form');
|
|
222
221
|
}
|
|
223
222
|
const subform = this.subForm ? this.subForm.render() : this.renderTemplate('loading');
|
|
224
223
|
return super.render(subform);
|
|
@@ -231,13 +230,13 @@ class FormComponent extends Component_1.default {
|
|
|
231
230
|
*/
|
|
232
231
|
getValueAsString(value, options) {
|
|
233
232
|
if (!value) {
|
|
234
|
-
return
|
|
233
|
+
return 'No data provided';
|
|
235
234
|
}
|
|
236
235
|
if (!value.data && value._id) {
|
|
237
236
|
return value._id;
|
|
238
237
|
}
|
|
239
238
|
if (!value.data || !Object.keys(value.data).length) {
|
|
240
|
-
return
|
|
239
|
+
return 'No data provided';
|
|
241
240
|
}
|
|
242
241
|
if (options === null || options === void 0 ? void 0 : options.email) {
|
|
243
242
|
let result = (`
|
|
@@ -659,7 +658,7 @@ class FormComponent extends Component_1.default {
|
|
|
659
658
|
: {};
|
|
660
659
|
this.subForm.setUrl(submissionUrl, Object.assign(Object.assign({}, this.options), options));
|
|
661
660
|
this.subForm.loadSubmission().catch((err) => {
|
|
662
|
-
console.error(
|
|
661
|
+
console.error(`Unable to load subform submission ${submission._id}:`, err);
|
|
663
662
|
});
|
|
664
663
|
}
|
|
665
664
|
else {
|
|
@@ -674,9 +673,6 @@ class FormComponent extends Component_1.default {
|
|
|
674
673
|
*/
|
|
675
674
|
onSetSubFormValue(submission, flags) {
|
|
676
675
|
this.subForm.setValue(submission, flags);
|
|
677
|
-
if (flags === null || flags === void 0 ? void 0 : flags.fromSubmission) {
|
|
678
|
-
this.subForm.submissionReadyResolve(submission);
|
|
679
|
-
}
|
|
680
676
|
}
|
|
681
677
|
isEmpty(value = this.dataValue) {
|
|
682
678
|
return value === null || lodash_1.default.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value === null || value === void 0 ? void 0 : value.data) && !(value === null || value === void 0 ? void 0 : value._id));
|
|
@@ -47,7 +47,7 @@ exports.default = [
|
|
|
47
47
|
},
|
|
48
48
|
searchField: 'title__regex',
|
|
49
49
|
template: '<span>{{ item._vid }}</span>',
|
|
50
|
-
valueProperty: '
|
|
50
|
+
valueProperty: '_id',
|
|
51
51
|
authenticate: true,
|
|
52
52
|
label: 'Form Revision',
|
|
53
53
|
key: 'revision',
|
|
@@ -69,7 +69,7 @@ exports.default = [
|
|
|
69
69
|
input: true,
|
|
70
70
|
weight: 20,
|
|
71
71
|
key: 'reference',
|
|
72
|
-
label: '
|
|
73
|
-
tooltip: '
|
|
72
|
+
label: 'Save as reference',
|
|
73
|
+
tooltip: 'Using this option will save this field as a reference and link its value to the value of the origin record.'
|
|
74
74
|
}
|
|
75
75
|
];
|
|
@@ -56,7 +56,7 @@ class NumberComponent extends Input_1.default {
|
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
58
|
if (this.component.thousandsSeparator || ((_c = this.options.properties) === null || _c === void 0 ? void 0 : _c.thousandsSeparator) || this.options.thousandsSeparator) {
|
|
59
|
-
console.warn(
|
|
59
|
+
console.warn('In order for thousands separator to work properly, you must set the delimiter to true in the component json');
|
|
60
60
|
}
|
|
61
61
|
this.delimiter = '';
|
|
62
62
|
}
|
|
@@ -170,21 +170,14 @@ class NumberComponent extends Input_1.default {
|
|
|
170
170
|
if (typeof input === 'string') {
|
|
171
171
|
input = input.split(this.delimiter).join('').replace(this.decimalSeparator, '.');
|
|
172
172
|
}
|
|
173
|
-
let value;
|
|
174
|
-
if (!lodash_1.default.isNaN(
|
|
173
|
+
let value = parseFloat(input);
|
|
174
|
+
if (!lodash_1.default.isNaN(value)) {
|
|
175
175
|
// Format scientific notation
|
|
176
|
-
if (/
|
|
177
|
-
// Convert to exponential notation will depend on the decimal limit set in the component
|
|
178
|
-
// Example: 1.23e-5 will be converted to 1.23e-5 if decimal limit is set to 2
|
|
179
|
-
// Example: 1.23e5 will be converted to 1.23e+5 if decimal limit is set to 2
|
|
180
|
-
// if decimal limit is 3, 1.23e5 will be converted to 1.230e+5
|
|
181
|
-
// if decimal limit is not set, 1.23e5 will be converted to 1.23000000000000000000e+5
|
|
182
|
-
value = parseFloat(input);
|
|
176
|
+
if (/e/i.test(String(value))) {
|
|
183
177
|
value = value.toExponential(this.decimalLimit);
|
|
184
178
|
}
|
|
185
179
|
else {
|
|
186
|
-
value =
|
|
187
|
-
value = !lodash_1.default.isNaN(value) ? String(value).replace('.', this.decimalSeparator) : null;
|
|
180
|
+
value = String(value).replace('.', this.decimalSeparator);
|
|
188
181
|
}
|
|
189
182
|
}
|
|
190
183
|
else {
|
|
@@ -293,16 +293,6 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
293
293
|
if (method.toUpperCase() === 'GET') {
|
|
294
294
|
body = null;
|
|
295
295
|
}
|
|
296
|
-
const limit = this.component.limit || 100;
|
|
297
|
-
const skip = this.isScrollLoading ? this.selectOptions.length : 0;
|
|
298
|
-
// Allow for url interpolation.
|
|
299
|
-
url = this.sanitize(this.interpolate(url, {
|
|
300
|
-
formioBase: Formio_1.Formio.getBaseUrl(),
|
|
301
|
-
search,
|
|
302
|
-
limit,
|
|
303
|
-
skip,
|
|
304
|
-
page: Math.abs(Math.floor(skip / limit))
|
|
305
|
-
}), this.shouldSanitizeValue);
|
|
306
296
|
// Set ignoreCache if it is
|
|
307
297
|
options.ignoreCache = this.component.ignoreCache;
|
|
308
298
|
// Make the request.
|
|
@@ -58,7 +58,7 @@ class ReCaptchaComponent extends Component_1.default {
|
|
|
58
58
|
this.recaptchaApiReady = Formio_1.Formio.requireLibrary('googleRecaptcha', 'grecaptcha', recaptchaApiScriptUrl, true);
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
-
console.warn(
|
|
61
|
+
console.warn('There is no Site Key specified in settings in form JSON');
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -72,7 +72,7 @@ class ReCaptchaComponent extends Component_1.default {
|
|
|
72
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
73
|
const siteKey = (0, get_1.default)(this.root.form, 'settings.recaptcha.siteKey');
|
|
74
74
|
if (!siteKey) {
|
|
75
|
-
console.warn(
|
|
75
|
+
console.warn('There is no Site Key specified in settings in form JSON');
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
if (!this.recaptchaApiReady) {
|
|
@@ -126,6 +126,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
126
126
|
get isLoadingAvailable(): any;
|
|
127
127
|
onScroll(): void;
|
|
128
128
|
attachRefreshOnBlur(): void;
|
|
129
|
+
addPlaceholderItem(placeholderValue: any): void;
|
|
129
130
|
update(): void;
|
|
130
131
|
addCurrentChoices(values: any, items: any, keyValue: any): any;
|
|
131
132
|
getValueAsString(data: any, options: any): any;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const Formio_1 = require("../../Formio");
|
|
8
8
|
const ListComponent_1 = __importDefault(require("../_classes/list/ListComponent"));
|
|
9
|
+
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
|
9
10
|
const Form_1 = __importDefault(require("../../Form"));
|
|
10
11
|
const utils_1 = require("../../utils/utils");
|
|
11
12
|
const ChoicesWrapper_1 = __importDefault(require("../../utils/ChoicesWrapper"));
|
|
@@ -529,13 +530,13 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
529
530
|
skip,
|
|
530
531
|
};
|
|
531
532
|
// Allow for url interpolation.
|
|
532
|
-
url = this.
|
|
533
|
+
url = this.interpolate(url, {
|
|
533
534
|
formioBase: Formio_1.Formio.getBaseUrl(),
|
|
534
535
|
search,
|
|
535
536
|
limit,
|
|
536
537
|
skip,
|
|
537
538
|
page: Math.abs(Math.floor(skip / limit))
|
|
538
|
-
})
|
|
539
|
+
});
|
|
539
540
|
// Add search capability.
|
|
540
541
|
if (this.component.searchField && search) {
|
|
541
542
|
const searchValue = Array.isArray(search)
|
|
@@ -592,7 +593,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
592
593
|
component: this.component,
|
|
593
594
|
message: err.toString(),
|
|
594
595
|
});
|
|
595
|
-
console.warn(
|
|
596
|
+
console.warn(`Unable to load resources for ${this.key}`);
|
|
596
597
|
}
|
|
597
598
|
/**
|
|
598
599
|
* Get the request headers for this select dropdown.
|
|
@@ -726,7 +727,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
726
727
|
}
|
|
727
728
|
}
|
|
728
729
|
else if (this.component.dataSrc === 'url' || this.component.dataSrc === 'resource') {
|
|
729
|
-
this.addOption('',
|
|
730
|
+
this.addOption('', this.t('loading...'));
|
|
730
731
|
}
|
|
731
732
|
}
|
|
732
733
|
get active() {
|
|
@@ -767,10 +768,10 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
767
768
|
distance: 1000,
|
|
768
769
|
};
|
|
769
770
|
return Object.assign({ removeItemButton: this.component.disabled ? false : lodash_1.default.get(this.component, 'removeItemButton', true), itemSelectText: '', classNames: {
|
|
770
|
-
containerOuter:
|
|
771
|
-
containerInner: this.transform('class', 'form-control ui fluid selection dropdown')
|
|
772
|
-
}, addItemText: false, allowHTML: true, placeholder: !!this.component.placeholder, placeholderValue: placeholderValue, noResultsText: this.t('
|
|
773
|
-
? 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
|
|
771
|
+
containerOuter: 'choices form-group formio-choices',
|
|
772
|
+
containerInner: this.transform('class', 'form-control ui fluid selection dropdown')
|
|
773
|
+
}, addItemText: false, allowHTML: true, placeholder: !!this.component.placeholder, 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', ['label']), shadowRoot: this.root ? this.root.shadowRoot : null, fuseOptions: this.component.useExactSearch
|
|
774
|
+
? 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 }, customOptions);
|
|
774
775
|
}
|
|
775
776
|
/* eslint-disable max-statements */
|
|
776
777
|
attach(element) {
|
|
@@ -836,7 +837,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
836
837
|
this.choices.containerOuter.element.setAttribute('tabIndex', '-1');
|
|
837
838
|
this.addEventListener(this.choices.containerOuter.element, 'focus', () => this.focusableElement.focus());
|
|
838
839
|
}
|
|
839
|
-
|
|
840
|
+
Input_1.default.prototype.addFocusBlurEvents.call(this, this.focusableElement);
|
|
840
841
|
if (this.itemsFromUrl && !this.component.noRefreshOnScroll) {
|
|
841
842
|
this.scrollList = this.choices.choiceList.element;
|
|
842
843
|
this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
|
|
@@ -902,6 +903,12 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
902
903
|
this.positionDropdown();
|
|
903
904
|
});
|
|
904
905
|
}
|
|
906
|
+
if (this.choices && choicesOptions.placeholderValue && this.choices._isSelectOneElement) {
|
|
907
|
+
this.addPlaceholderItem(choicesOptions.placeholderValue);
|
|
908
|
+
this.addEventListener(input, 'removeItem', () => {
|
|
909
|
+
this.addPlaceholderItem(choicesOptions.placeholderValue);
|
|
910
|
+
});
|
|
911
|
+
}
|
|
905
912
|
// Add value options.
|
|
906
913
|
this.addValueOptions();
|
|
907
914
|
this.setChoicesValue(this.dataValue);
|
|
@@ -989,6 +996,20 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
989
996
|
});
|
|
990
997
|
}
|
|
991
998
|
}
|
|
999
|
+
addPlaceholderItem(placeholderValue) {
|
|
1000
|
+
const items = this.choices._store.activeItems;
|
|
1001
|
+
if (!items.length) {
|
|
1002
|
+
this.choices._addItem({
|
|
1003
|
+
value: '',
|
|
1004
|
+
label: placeholderValue,
|
|
1005
|
+
choiceId: 0,
|
|
1006
|
+
groupId: -1,
|
|
1007
|
+
customProperties: null,
|
|
1008
|
+
placeholder: true,
|
|
1009
|
+
keyCode: null
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
992
1013
|
/* eslint-enable max-statements */
|
|
993
1014
|
update() {
|
|
994
1015
|
if (this.component.dataSrc === 'custom') {
|
|
@@ -1169,7 +1190,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1169
1190
|
return normalize[dataType]().value;
|
|
1170
1191
|
}
|
|
1171
1192
|
catch (err) {
|
|
1172
|
-
console.warn(
|
|
1193
|
+
console.warn('Failed to normalize value', err);
|
|
1173
1194
|
return value;
|
|
1174
1195
|
}
|
|
1175
1196
|
}
|
|
@@ -1366,7 +1387,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1366
1387
|
return (JSON.stringify(normalizedOptionValue) === JSON.stringify(value));
|
|
1367
1388
|
}
|
|
1368
1389
|
catch (err) {
|
|
1369
|
-
console.warn.error(
|
|
1390
|
+
console.warn.error('Error while comparing items', err);
|
|
1370
1391
|
return false;
|
|
1371
1392
|
}
|
|
1372
1393
|
};
|
|
@@ -1459,7 +1480,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1459
1480
|
asString(value, options = {}) {
|
|
1460
1481
|
var _a;
|
|
1461
1482
|
value = value !== null && value !== void 0 ? value : this.getValue();
|
|
1462
|
-
if (options.modalPreview || this.inDataTable
|
|
1483
|
+
if (options.modalPreview || this.inDataTable) {
|
|
1463
1484
|
if (this.inDataTable) {
|
|
1464
1485
|
value = this.undoValueTyping(value);
|
|
1465
1486
|
}
|
|
@@ -1099,7 +1099,6 @@ declare const _default: ({
|
|
|
1099
1099
|
alwaysEnabled?: undefined;
|
|
1100
1100
|
} | {
|
|
1101
1101
|
key: string;
|
|
1102
|
-
type: string;
|
|
1103
1102
|
conditional: {
|
|
1104
1103
|
json: {
|
|
1105
1104
|
and: ({
|
|
@@ -1150,6 +1149,7 @@ declare const _default: ({
|
|
|
1150
1149
|
};
|
|
1151
1150
|
};
|
|
1152
1151
|
data?: undefined;
|
|
1152
|
+
type?: undefined;
|
|
1153
1153
|
weight?: undefined;
|
|
1154
1154
|
input?: undefined;
|
|
1155
1155
|
label?: undefined;
|
|
@@ -641,8 +641,8 @@ exports.default = [
|
|
|
641
641
|
input: true,
|
|
642
642
|
weight: 25,
|
|
643
643
|
key: 'reference',
|
|
644
|
-
label: '
|
|
645
|
-
tooltip: 'Using this option will
|
|
644
|
+
label: 'Save as reference',
|
|
645
|
+
tooltip: 'Using this option will save this field as a reference and link its value to the value of the origin record.',
|
|
646
646
|
conditional: {
|
|
647
647
|
json: { '===': [{ var: 'data.dataSrc' }, 'resource'] },
|
|
648
648
|
},
|
|
@@ -687,7 +687,6 @@ exports.default = [
|
|
|
687
687
|
},
|
|
688
688
|
{
|
|
689
689
|
key: 'selectData',
|
|
690
|
-
type: 'hidden',
|
|
691
690
|
conditional: {
|
|
692
691
|
json: {
|
|
693
692
|
and: [
|
|
@@ -252,14 +252,14 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
|
252
252
|
this.setInputsDisabled(false);
|
|
253
253
|
}
|
|
254
254
|
if (!isValid && maxCount && count > maxCount) {
|
|
255
|
-
const message = this.t(this.component.maxSelectedCountMessage || '
|
|
255
|
+
const message = this.t(this.component.maxSelectedCountMessage || 'You may only select up to {{maxCount}} items', { maxCount });
|
|
256
256
|
this.errors.push({ message });
|
|
257
257
|
this.setCustomValidity(message, dirty);
|
|
258
258
|
return false;
|
|
259
259
|
}
|
|
260
260
|
else if (!isValid && minCount && count < minCount) {
|
|
261
261
|
this.setInputsDisabled(false);
|
|
262
|
-
const message = this.t(this.component.minSelectedCountMessage || '
|
|
262
|
+
const message = this.t(this.component.minSelectedCountMessage || 'You must select at least {{minCount}} items', { minCount });
|
|
263
263
|
this.errors.push({ message });
|
|
264
264
|
this.setCustomValidity(message, dirty);
|
|
265
265
|
return false;
|
|
@@ -24,7 +24,7 @@ export default class SignatureComponent extends Input {
|
|
|
24
24
|
checkSize(force: any, scale: any): void;
|
|
25
25
|
signaturePad: SignaturePad | null | undefined;
|
|
26
26
|
observer: any;
|
|
27
|
-
getValueAsString(value: any):
|
|
27
|
+
getValueAsString(value: any): "" | "Yes" | "No";
|
|
28
28
|
focus(): void;
|
|
29
29
|
setDataToSigaturePad(): void;
|
|
30
30
|
}
|
|
@@ -159,9 +159,7 @@ class SignatureComponent extends Input_1.default {
|
|
|
159
159
|
if (this.dataValue) {
|
|
160
160
|
this.setDataToSigaturePad();
|
|
161
161
|
}
|
|
162
|
-
|
|
163
|
-
this.showCanvas(true);
|
|
164
|
-
}
|
|
162
|
+
this.showCanvas(true);
|
|
165
163
|
}
|
|
166
164
|
}
|
|
167
165
|
renderElement(value, index) {
|
|
@@ -177,7 +175,7 @@ class SignatureComponent extends Input_1.default {
|
|
|
177
175
|
return this.renderModalPreview({
|
|
178
176
|
previewText: this.dataValue ?
|
|
179
177
|
`<img src=${this.dataValue} ${this._referenceAttributeName}='openModal' style="width: 100%;height: 100%;" />` :
|
|
180
|
-
this.t('
|
|
178
|
+
this.t('Click to Sign')
|
|
181
179
|
});
|
|
182
180
|
}
|
|
183
181
|
attach(element) {
|
|
@@ -245,7 +243,7 @@ class SignatureComponent extends Input_1.default {
|
|
|
245
243
|
if (lodash_1.default.isUndefined(value) && this.inDataTable) {
|
|
246
244
|
return '';
|
|
247
245
|
}
|
|
248
|
-
return
|
|
246
|
+
return value ? 'Yes' : 'No';
|
|
249
247
|
}
|
|
250
248
|
focus() {
|
|
251
249
|
this.refs.padBody.focus();
|
|
@@ -7,6 +7,7 @@ declare const _default: ({
|
|
|
7
7
|
placeholder: string;
|
|
8
8
|
weight: number;
|
|
9
9
|
conditional?: undefined;
|
|
10
|
+
customConditional?: undefined;
|
|
10
11
|
ignore?: undefined;
|
|
11
12
|
} | {
|
|
12
13
|
type: string;
|
|
@@ -23,6 +24,7 @@ declare const _default: ({
|
|
|
23
24
|
};
|
|
24
25
|
};
|
|
25
26
|
weight: number;
|
|
27
|
+
customConditional?: undefined;
|
|
26
28
|
ignore?: undefined;
|
|
27
29
|
} | {
|
|
28
30
|
weight: number;
|
|
@@ -30,6 +32,9 @@ declare const _default: ({
|
|
|
30
32
|
label: string;
|
|
31
33
|
tooltip: string;
|
|
32
34
|
key: string;
|
|
35
|
+
customConditional: ({ options }: {
|
|
36
|
+
options: any;
|
|
37
|
+
}) => boolean;
|
|
33
38
|
input: boolean;
|
|
34
39
|
placeholder?: undefined;
|
|
35
40
|
conditional?: undefined;
|
|
@@ -44,5 +49,6 @@ declare const _default: ({
|
|
|
44
49
|
placeholder?: undefined;
|
|
45
50
|
weight?: undefined;
|
|
46
51
|
conditional?: undefined;
|
|
52
|
+
customConditional?: undefined;
|
|
47
53
|
})[];
|
|
48
54
|
export default _default;
|
|
@@ -39,6 +39,7 @@ exports.default = [
|
|
|
39
39
|
label: 'Keep Overlay Aspect Ratio',
|
|
40
40
|
tooltip: 'If checked, the field will have the same aspect ratio as its preview.',
|
|
41
41
|
key: 'keepOverlayRatio',
|
|
42
|
+
customConditional: ({ options }) => { var _a; return (((_a = options === null || options === void 0 ? void 0 : options.editForm) === null || _a === void 0 ? void 0 : _a.display) === 'pdf'); },
|
|
42
43
|
input: true
|
|
43
44
|
},
|
|
44
45
|
{
|
|
@@ -128,8 +128,8 @@ class SurveyComponent extends Field_1.default {
|
|
|
128
128
|
<table border="1" style="width:100%">
|
|
129
129
|
<thead>
|
|
130
130
|
<tr>
|
|
131
|
-
<th
|
|
132
|
-
<th
|
|
131
|
+
<th>Question</th>
|
|
132
|
+
<th>Value</th>
|
|
133
133
|
</tr>
|
|
134
134
|
</thead>
|
|
135
135
|
<tbody>
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../utils/utils");
|
|
7
7
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
|
8
|
-
const choices_js_1 = __importDefault(require("choices.js"));
|
|
8
|
+
const choices_js_1 = __importDefault(require("@formio/choices.js"));
|
|
9
9
|
class TagsComponent extends Input_1.default {
|
|
10
10
|
static schema(...extend) {
|
|
11
11
|
return Input_1.default.schema({
|
|
@@ -129,7 +129,7 @@ class TagsComponent extends Input_1.default {
|
|
|
129
129
|
const changed = super.setValue(value, flags);
|
|
130
130
|
if (this.choices) {
|
|
131
131
|
let dataValue = this.dataValue;
|
|
132
|
-
this.choices.
|
|
132
|
+
this.choices.removeActiveItems();
|
|
133
133
|
if (dataValue) {
|
|
134
134
|
if (typeof dataValue === 'string') {
|
|
135
135
|
dataValue = dataValue.split(this.delimiter).filter(result => result);
|
|
@@ -136,7 +136,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
|
136
136
|
case 'quill':
|
|
137
137
|
// Normalize the configurations for quill.
|
|
138
138
|
if (settings.hasOwnProperty('toolbarGroups') || settings.hasOwnProperty('toolbar')) {
|
|
139
|
-
console.warn(this.
|
|
139
|
+
console.warn('The WYSIWYG settings are configured for CKEditor. For this renderer, you will need to use configurations for the Quill Editor. See https://quilljs.com/docs/configuration for more information.');
|
|
140
140
|
settings = this.wysiwygDefault.quill;
|
|
141
141
|
}
|
|
142
142
|
// Add the quill editor.
|
|
@@ -208,7 +208,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
|
208
208
|
imageHandler(moduleInstance, range, files) {
|
|
209
209
|
const quillInstance = moduleInstance.quill;
|
|
210
210
|
if (!files || !files.length) {
|
|
211
|
-
console.warn(
|
|
211
|
+
console.warn('No files selected');
|
|
212
212
|
return;
|
|
213
213
|
}
|
|
214
214
|
quillInstance.enable(false);
|
|
@@ -233,7 +233,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
|
233
233
|
alt: JSON.stringify(requestData),
|
|
234
234
|
}), Quill.sources.USER);
|
|
235
235
|
}).catch(error => {
|
|
236
|
-
console.warn(
|
|
236
|
+
console.warn('Quill image upload failed');
|
|
237
237
|
console.warn(error);
|
|
238
238
|
quillInstance.enable(true);
|
|
239
239
|
});
|
|
@@ -530,7 +530,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
|
530
530
|
}
|
|
531
531
|
this.element.scrollIntoView();
|
|
532
532
|
}).catch((err) => {
|
|
533
|
-
console.warn(
|
|
533
|
+
console.warn('An editor did not initialize properly when trying to focus:', err);
|
|
534
534
|
});
|
|
535
535
|
break;
|
|
536
536
|
}
|
|
@@ -539,7 +539,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
|
539
539
|
this.editors[0].focus();
|
|
540
540
|
this.element.scrollIntoView();
|
|
541
541
|
}).catch((err) => {
|
|
542
|
-
console.warn(
|
|
542
|
+
console.warn('An editor did not initialize properly when trying to focus:', err);
|
|
543
543
|
});
|
|
544
544
|
break;
|
|
545
545
|
}
|
|
@@ -547,7 +547,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
|
547
547
|
(_c = this.editorsReady[0]) === null || _c === void 0 ? void 0 : _c.then(() => {
|
|
548
548
|
this.editors[0].focus();
|
|
549
549
|
}).catch((err) => {
|
|
550
|
-
console.warn(
|
|
550
|
+
console.warn('An editor did not initialize properly when trying to focus:', err);
|
|
551
551
|
});
|
|
552
552
|
break;
|
|
553
553
|
}
|
package/lib/cjs/formio.form.js
CHANGED
|
@@ -29,7 +29,6 @@ const EventEmitter_1 = __importDefault(require("./EventEmitter"));
|
|
|
29
29
|
exports.EventEmitter = EventEmitter_1.default;
|
|
30
30
|
const Webform_1 = __importDefault(require("./Webform"));
|
|
31
31
|
exports.Webform = Webform_1.default;
|
|
32
|
-
const i18n_1 = require("./utils/i18n");
|
|
33
32
|
Formio_1.Formio.loadModules = (path = `${Formio_1.Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
|
|
34
33
|
Formio_1.Formio.requireLibrary(name, name, path, true)
|
|
35
34
|
.then((modules) => {
|
|
@@ -74,7 +73,6 @@ function registerModule(mod, defaultFn = null, options = {}) {
|
|
|
74
73
|
case 'templates':
|
|
75
74
|
for (const framework of Object.keys(mod.templates)) {
|
|
76
75
|
Formio_1.Formio.Templates.extendTemplate(framework, mod.templates[framework]);
|
|
77
|
-
Formio_1.Formio.Templates.defaultTemplates = lodash_1.default.defaults(mod.templates[framework], Formio_1.Formio.Templates.defaultTemplates);
|
|
78
76
|
}
|
|
79
77
|
if (mod.templates[current]) {
|
|
80
78
|
Formio_1.Formio.Templates.current = mod.templates[current];
|
|
@@ -102,9 +100,6 @@ function registerModule(mod, defaultFn = null, options = {}) {
|
|
|
102
100
|
case 'evaluator':
|
|
103
101
|
Formio_1.Formio.Evaluator.registerEvaluator(mod.evaluator);
|
|
104
102
|
break;
|
|
105
|
-
case 'translations':
|
|
106
|
-
i18n_1.I18n.setDefaultTranslations(mod.translations);
|
|
107
|
-
break;
|
|
108
103
|
case 'library':
|
|
109
104
|
options.license
|
|
110
105
|
? Formio_1.Formio.Licenses.addLicense(mod.library, options.license)
|
|
@@ -52,11 +52,10 @@ function googledrive(formio) {
|
|
|
52
52
|
xhr.send(fd);
|
|
53
53
|
}));
|
|
54
54
|
},
|
|
55
|
-
downloadFile(file
|
|
55
|
+
downloadFile(file) {
|
|
56
56
|
const token = formio.getToken();
|
|
57
|
-
// Constructed the url with the fileId, fileName, displayImage, imageSize if applicable
|
|
58
57
|
file.url =
|
|
59
|
-
`${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}
|
|
58
|
+
`${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}`;
|
|
60
59
|
return Promise.resolve(file);
|
|
61
60
|
},
|
|
62
61
|
deleteFile: function deleteFile(fileInfo) {
|
|
@@ -115,7 +115,7 @@ function s3(formio) {
|
|
|
115
115
|
const { changeMessage } = multipart;
|
|
116
116
|
changeMessage('Completing AWS S3 multipart upload...');
|
|
117
117
|
const token = formio.getToken();
|
|
118
|
-
const response = yield
|
|
118
|
+
const response = yield fetch(`${formio.formUrl}/storage/s3/multipart/complete`, {
|
|
119
119
|
method: 'POST',
|
|
120
120
|
headers: Object.assign({ 'Content-Type': 'application/json' }, (token ? { 'x-jwt-token': token } : {})),
|
|
121
121
|
body: JSON.stringify({ parts, uploadId: serverResponse.uploadId, key: serverResponse.key })
|
|
@@ -134,7 +134,7 @@ function s3(formio) {
|
|
|
134
134
|
abortMultipartUpload(serverResponse) {
|
|
135
135
|
const { uploadId, key } = serverResponse;
|
|
136
136
|
const token = formio.getToken();
|
|
137
|
-
|
|
137
|
+
fetch(`${formio.formUrl}/storage/s3/multipart/abort`, {
|
|
138
138
|
method: 'POST',
|
|
139
139
|
headers: Object.assign({ 'Content-Type': 'application/json' }, (token ? { 'x-jwt-token': token } : {})),
|
|
140
140
|
body: JSON.stringify({ uploadId, key })
|
|
@@ -148,7 +148,7 @@ function s3(formio) {
|
|
|
148
148
|
const start = i * partSize;
|
|
149
149
|
const end = (i + 1) * partSize;
|
|
150
150
|
const blob = i < urls.length ? file.slice(start, end) : file.slice(start);
|
|
151
|
-
const promise =
|
|
151
|
+
const promise = fetch(urls[i], {
|
|
152
152
|
method: 'PUT',
|
|
153
153
|
headers,
|
|
154
154
|
body: blob,
|
|
@@ -3,7 +3,6 @@ export default XHR;
|
|
|
3
3
|
declare namespace XHR {
|
|
4
4
|
function trim(text: any): any;
|
|
5
5
|
function path(items: any): any;
|
|
6
|
-
function fetch(url: any, options: any): Promise<Response>;
|
|
7
6
|
function upload(formio: any, type: any, xhrCallback: any, file: any, fileName: any, dir: any, progressCallback: any, groupPermissions: any, groupId: any, abortCallback: any, multipartOptions: any): Promise<any>;
|
|
8
7
|
function makeXhrRequest(formio: any, xhrCallback: any, serverResponse: any, progressCallback: any, abortCallback: any): Promise<any>;
|
|
9
8
|
}
|
|
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.setXhrHeaders = void 0;
|
|
16
16
|
const trim_1 = __importDefault(require("lodash/trim"));
|
|
17
|
-
const Formio_1 = require("../../Formio");
|
|
18
17
|
const setXhrHeaders = (formio, xhr) => {
|
|
19
18
|
const { headers } = formio.options;
|
|
20
19
|
if (headers) {
|
|
@@ -37,17 +36,13 @@ const XHR = {
|
|
|
37
36
|
path(items) {
|
|
38
37
|
return items.filter(item => !!item).map(XHR.trim).join('/');
|
|
39
38
|
},
|
|
40
|
-
fetch(url, options) {
|
|
41
|
-
options = Formio_1.Formio.pluginAlter('requestOptions', options, url);
|
|
42
|
-
return fetch(url, options);
|
|
43
|
-
},
|
|
44
39
|
upload(formio, type, xhrCallback, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback, multipartOptions) {
|
|
45
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
41
|
// make request to Form.io server
|
|
47
42
|
const token = formio.getToken();
|
|
48
43
|
let response;
|
|
49
44
|
try {
|
|
50
|
-
response = yield
|
|
45
|
+
response = yield fetch(`${formio.formUrl}/storage/${type}`, {
|
|
51
46
|
method: 'POST',
|
|
52
47
|
headers: Object.assign({ 'Accept': 'application/json', 'Content-Type': 'application/json; charset=UTF-8' }, (token ? { 'x-jwt-token': token } : {})),
|
|
53
48
|
body: JSON.stringify({
|