@formio/js 5.0.0-rc.23 → 5.0.0-rc.24
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +24 -30
- 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 +7 -18
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +8 -19
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Embed.d.ts +4 -2
- package/lib/cjs/Embed.js +55 -42
- package/lib/cjs/WebformBuilder.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.js +6 -3
- package/lib/cjs/components/radio/Radio.js +22 -12
- package/lib/cjs/components/select/Select.d.ts +2 -0
- package/lib/cjs/components/select/Select.js +6 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -0
- package/lib/cjs/components/selectboxes/fixtures/comp7.d.ts +18 -0
- package/lib/cjs/components/selectboxes/fixtures/comp7.js +31 -0
- 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/signature/Signature.d.ts +1 -2
- package/lib/cjs/components/signature/Signature.js +1 -2
- package/lib/cjs/utils/ChoicesWrapper.d.ts +1 -0
- package/lib/cjs/utils/ChoicesWrapper.js +19 -0
- package/lib/mjs/Embed.d.ts +4 -2
- package/lib/mjs/Embed.js +54 -43
- package/lib/mjs/WebformBuilder.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.js +6 -3
- package/lib/mjs/components/radio/Radio.js +22 -12
- package/lib/mjs/components/select/Select.d.ts +2 -0
- package/lib/mjs/components/select/Select.js +6 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +10 -1
- package/lib/mjs/components/selectboxes/fixtures/comp7.d.ts +18 -0
- package/lib/mjs/components/selectboxes/fixtures/comp7.js +29 -0
- 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/signature/Signature.d.ts +1 -2
- package/lib/mjs/components/signature/Signature.js +1 -2
- package/lib/mjs/utils/ChoicesWrapper.d.ts +1 -0
- package/lib/mjs/utils/ChoicesWrapper.js +19 -0
- package/package.json +2 -3
@@ -1,6 +1,6 @@
|
|
1
1
|
/*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */
|
2
2
|
|
3
|
-
/*! formiojs v5.0.0-rc.
|
3
|
+
/*! formiojs v5.0.0-rc.24 | https://unpkg.com/formiojs@5.0.0-rc.24/LICENSE.txt */
|
4
4
|
|
5
5
|
/**
|
6
6
|
* @license
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
/*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */
|
14
14
|
|
15
|
-
/*! formiojs v5.0.0-rc.
|
15
|
+
/*! formiojs v5.0.0-rc.24 | https://unpkg.com/formiojs@5.0.0-rc.24/LICENSE.txt */
|
16
16
|
|
17
17
|
/**
|
18
18
|
* @license
|
package/lib/cjs/Embed.d.ts
CHANGED
@@ -14,8 +14,10 @@ export class Formio {
|
|
14
14
|
static global(prop: any): any;
|
15
15
|
static createElement(type: any, attrs: any, children: any): any;
|
16
16
|
static addScript(src: any, name: any): Promise<any>;
|
17
|
-
static addStyles(href: any
|
17
|
+
static addStyles(href: any): Promise<void>;
|
18
18
|
static submitDone(instance: any, submission: any): Promise<void>;
|
19
|
-
static
|
19
|
+
static formioScript(script: any, builder: any): any;
|
20
|
+
static init(element: any, builder?: boolean): Promise<void>;
|
20
21
|
static createForm(element: any, form: any, options: any): Promise<any>;
|
22
|
+
static builder(element: any, form: any, options: any): Promise<any>;
|
21
23
|
}
|
package/lib/cjs/Embed.js
CHANGED
@@ -79,7 +79,7 @@ class Formio {
|
|
79
79
|
});
|
80
80
|
});
|
81
81
|
}
|
82
|
-
static addStyles(href
|
82
|
+
static addStyles(href) {
|
83
83
|
return __awaiter(this, void 0, void 0, function* () {
|
84
84
|
if (!href) {
|
85
85
|
return;
|
@@ -89,14 +89,6 @@ class Formio {
|
|
89
89
|
return;
|
90
90
|
}
|
91
91
|
Formio.debug('Adding Styles', href);
|
92
|
-
const link = Formio.createElement('link', {
|
93
|
-
rel: 'stylesheet',
|
94
|
-
href
|
95
|
-
});
|
96
|
-
if (addGlobally) {
|
97
|
-
// Add globally as well.
|
98
|
-
document.head.appendChild(link);
|
99
|
-
}
|
100
92
|
Formio.wrapper.appendChild(Formio.createElement('link', {
|
101
93
|
rel: 'stylesheet',
|
102
94
|
href
|
@@ -133,36 +125,12 @@ class Formio {
|
|
133
125
|
}
|
134
126
|
});
|
135
127
|
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
yield Formio.config.before(Formio.FormioClass, Formio.element, Formio.config);
|
140
|
-
}
|
141
|
-
Formio.FormioClass.license = true;
|
142
|
-
return Formio.FormioClass.createForm(Formio.element, form, Object.assign(Object.assign({}, options), { noLoader: true })).then((instance) => {
|
143
|
-
Formio.debug('Form created', instance);
|
144
|
-
// Remove the loader.
|
145
|
-
Formio.debug('Removing loader');
|
146
|
-
Formio.wrapper.removeChild(Formio.loader);
|
147
|
-
// Set the default submission data.
|
148
|
-
if (Formio.config.submission) {
|
149
|
-
Formio.debug('Setting submission', Formio.config.submission);
|
150
|
-
instance.submission = Formio.config.submission;
|
151
|
-
}
|
152
|
-
// Allow them to provide additional configs.
|
153
|
-
Formio.debug('Triggering embed event');
|
154
|
-
Formio.FormioClass.events.emit('formEmbedded', instance);
|
155
|
-
// Trigger the after handler.
|
156
|
-
if (Formio.config.after) {
|
157
|
-
Formio.debug('Calling ready callback');
|
158
|
-
Formio.config.after(instance, Formio.config);
|
159
|
-
}
|
160
|
-
return instance;
|
161
|
-
});
|
162
|
-
});
|
128
|
+
// Return the full script if the builder is being used.
|
129
|
+
static formioScript(script, builder) {
|
130
|
+
return builder ? script.replace('formio.form', 'formio.full') : script;
|
163
131
|
}
|
164
132
|
// eslint-disable-next-line max-statements
|
165
|
-
static
|
133
|
+
static init(element, builder = false) {
|
166
134
|
return __awaiter(this, void 0, void 0, function* () {
|
167
135
|
Formio.element = element;
|
168
136
|
Formio.cdn = new CDN_js_1.default(Formio.config.cdn);
|
@@ -204,7 +172,7 @@ class Formio {
|
|
204
172
|
}]
|
205
173
|
}]);
|
206
174
|
Formio.wrapper.appendChild(Formio.loader);
|
207
|
-
Formio.FormioClass = yield Formio.addScript(Formio.config.script || `${Formio.cdn.js}/formio.form.min.js`, 'Formio');
|
175
|
+
Formio.FormioClass = yield Formio.addScript(Formio.formioScript(Formio.config.script || `${Formio.cdn.js}/formio.form.min.js`, builder), 'Formio');
|
208
176
|
Formio.FormioClass.setBaseUrl(Formio.baseUrl || Formio.config.base);
|
209
177
|
Formio.FormioClass.setProjectUrl(Formio.projectUrl || Formio.config.project);
|
210
178
|
Formio.FormioClass.language = Formio.language;
|
@@ -222,7 +190,7 @@ class Formio {
|
|
222
190
|
yield Formio.addStyles(Formio.config.libs[Formio.config.template].css);
|
223
191
|
yield Formio.addScript(Formio.config.libs[Formio.config.template].js);
|
224
192
|
if (Formio.config.libs[Formio.config.template].fa) {
|
225
|
-
yield Formio.addStyles(Formio.config.libs.fontawesome.css
|
193
|
+
yield Formio.addStyles(Formio.config.libs.fontawesome.css);
|
226
194
|
}
|
227
195
|
}
|
228
196
|
if (Formio.cdn[Formio.config.template]) {
|
@@ -238,7 +206,7 @@ class Formio {
|
|
238
206
|
}
|
239
207
|
// Default bootstrap + fontawesome.
|
240
208
|
else if (Formio.config.includeLibs) {
|
241
|
-
yield Formio.addStyles(Formio.config.libs.fontawesome.css
|
209
|
+
yield Formio.addStyles(Formio.config.libs.fontawesome.css);
|
242
210
|
yield Formio.addStyles(Formio.config.libs.bootstrap.css);
|
243
211
|
}
|
244
212
|
if (Formio.config.premium) {
|
@@ -246,8 +214,53 @@ class Formio {
|
|
246
214
|
Formio.debug('Using premium');
|
247
215
|
Formio.FormioClass.use(yield Formio.addScript(Formio.config.premium.js, 'premium'));
|
248
216
|
}
|
249
|
-
yield Formio.addStyles(Formio.config.style || `${Formio.cdn.js}/formio.form.min.css
|
250
|
-
|
217
|
+
yield Formio.addStyles(Formio.formioScript(Formio.config.style || `${Formio.cdn.js}/formio.form.min.css`, builder));
|
218
|
+
if (Formio.config.before) {
|
219
|
+
yield Formio.config.before(Formio.FormioClass, Formio.element, Formio.config);
|
220
|
+
}
|
221
|
+
Formio.FormioClass.license = true;
|
222
|
+
});
|
223
|
+
}
|
224
|
+
static createForm(element, form, options) {
|
225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
226
|
+
yield Formio.init(element);
|
227
|
+
return Formio.FormioClass.createForm(Formio.element, form, Object.assign(Object.assign({}, options), { noLoader: true })).then((instance) => {
|
228
|
+
Formio.debug('Form created', instance);
|
229
|
+
// Remove the loader.
|
230
|
+
Formio.debug('Removing loader');
|
231
|
+
Formio.wrapper.removeChild(Formio.loader);
|
232
|
+
// Set the default submission data.
|
233
|
+
if (Formio.config.submission) {
|
234
|
+
Formio.debug('Setting submission', Formio.config.submission);
|
235
|
+
instance.submission = Formio.config.submission;
|
236
|
+
}
|
237
|
+
// Allow them to provide additional configs.
|
238
|
+
Formio.debug('Triggering embed event');
|
239
|
+
Formio.FormioClass.events.emit('formEmbedded', instance);
|
240
|
+
// Trigger the after handler.
|
241
|
+
if (Formio.config.after) {
|
242
|
+
Formio.debug('Calling ready callback');
|
243
|
+
Formio.config.after(instance, Formio.config);
|
244
|
+
}
|
245
|
+
return instance;
|
246
|
+
});
|
247
|
+
});
|
248
|
+
}
|
249
|
+
static builder(element, form, options) {
|
250
|
+
return __awaiter(this, void 0, void 0, function* () {
|
251
|
+
yield Formio.init(element, true);
|
252
|
+
return Formio.FormioClass.builder(Formio.element, form, options).then((instance) => {
|
253
|
+
Formio.debug('Builder created', instance);
|
254
|
+
Formio.debug('Removing loader');
|
255
|
+
Formio.wrapper.removeChild(Formio.loader);
|
256
|
+
Formio.debug('Triggering embed event');
|
257
|
+
Formio.FormioClass.events.emit('builderEmbedded', instance);
|
258
|
+
if (Formio.config.after) {
|
259
|
+
Formio.debug('Calling ready callback');
|
260
|
+
Formio.config.after(instance, Formio.config);
|
261
|
+
}
|
262
|
+
return instance;
|
263
|
+
});
|
251
264
|
});
|
252
265
|
}
|
253
266
|
}
|
@@ -1044,7 +1044,7 @@ class WebformBuilder extends Component_1.default {
|
|
1044
1044
|
return false;
|
1045
1045
|
});
|
1046
1046
|
});
|
1047
|
-
if (tabIndex !== -1 && index !== -1 && changed && changed.value) {
|
1047
|
+
if (tabIndex !== -1 && index !== -1 && changed && !lodash_1.default.isNil(changed.value)) {
|
1048
1048
|
const sibling = parentComponent.tabs[tabIndex][index + 1];
|
1049
1049
|
parentComponent.removeComponent(defaultValueComponent);
|
1050
1050
|
const newComp = parentComponent.addComponent(defaultValueComponent.component, defaultValueComponent.data, sibling);
|
@@ -8,8 +8,8 @@ export default class ListComponent extends Field {
|
|
8
8
|
setItems(): void;
|
9
9
|
updateCustomItems(): void;
|
10
10
|
loadItems(): void;
|
11
|
-
getOptionTemplate(data: any, value: any): any;
|
12
|
-
itemTemplate(data: any, value: any): any;
|
11
|
+
getOptionTemplate(data: any, value: any, index: any): any;
|
12
|
+
itemTemplate(data: any, value: any, index: any): any;
|
13
13
|
handleLoadingError(err: any): void;
|
14
14
|
loading: boolean | undefined;
|
15
15
|
networkError: boolean | undefined;
|
@@ -83,7 +83,7 @@ class ListComponent extends Field_1.default {
|
|
83
83
|
setItems() { }
|
84
84
|
updateCustomItems() { }
|
85
85
|
loadItems() { }
|
86
|
-
getOptionTemplate(data, value) {
|
86
|
+
getOptionTemplate(data, value, index) {
|
87
87
|
if (!this.component.template) {
|
88
88
|
return data.label;
|
89
89
|
}
|
@@ -99,13 +99,16 @@ class ListComponent extends Field_1.default {
|
|
99
99
|
// If the value is not an object, then we need to save the template data off for when it is selected.
|
100
100
|
this.templateData[templateValue] = options.data.item;
|
101
101
|
}
|
102
|
+
if (lodash_1.default.isNumber(index)) {
|
103
|
+
this.templateData[index] = options.data.item;
|
104
|
+
}
|
102
105
|
return template;
|
103
106
|
}
|
104
|
-
itemTemplate(data, value) {
|
107
|
+
itemTemplate(data, value, index) {
|
105
108
|
if (lodash_1.default.isEmpty(data)) {
|
106
109
|
return '';
|
107
110
|
}
|
108
|
-
const template = this.sanitize(this.getOptionTemplate(data, value), this.shouldSanitizeValue);
|
111
|
+
const template = this.sanitize(this.getOptionTemplate(data, value, index), this.shouldSanitizeValue);
|
109
112
|
if (template) {
|
110
113
|
const label = template.replace(/<\/?[^>]+(>|$)/g, '');
|
111
114
|
if (!label)
|
@@ -153,7 +153,12 @@ class RadioComponent extends ListComponent_1.default {
|
|
153
153
|
if (!lodash_1.default.isString(this.dataValue)) {
|
154
154
|
dataValue = lodash_1.default.toString(this.dataValue);
|
155
155
|
}
|
156
|
-
|
156
|
+
if (this.isSelectURL && lodash_1.default.isObject(this.loadedOptions[index].value)) {
|
157
|
+
input.checked = lodash_1.default.isEqual(this.loadedOptions[index].value, this.dataValue);
|
158
|
+
}
|
159
|
+
else {
|
160
|
+
input.checked = (dataValue === input.value && (input.value || this.component.dataSrc !== 'url'));
|
161
|
+
}
|
157
162
|
this.addEventListener(input, 'keyup', (event) => {
|
158
163
|
if (event.key === ' ' && dataValue === input.value) {
|
159
164
|
event.preventDefault();
|
@@ -183,9 +188,11 @@ class RadioComponent extends ListComponent_1.default {
|
|
183
188
|
return this.dataValue;
|
184
189
|
}
|
185
190
|
let value = this.dataValue;
|
186
|
-
this.refs.input.forEach((input) => {
|
191
|
+
this.refs.input.forEach((input, index) => {
|
187
192
|
if (input.checked) {
|
188
|
-
value =
|
193
|
+
value = (this.isSelectURL && lodash_1.default.isObject(this.loadedOptions[index].value)) ?
|
194
|
+
this.loadedOptions[index].value :
|
195
|
+
input.value;
|
189
196
|
}
|
190
197
|
});
|
191
198
|
return value;
|
@@ -207,7 +214,10 @@ class RadioComponent extends ListComponent_1.default {
|
|
207
214
|
return false;
|
208
215
|
}
|
209
216
|
getValueAsString(value) {
|
210
|
-
if (
|
217
|
+
if (lodash_1.default.isObject(value)) {
|
218
|
+
value = JSON.stringify(value);
|
219
|
+
}
|
220
|
+
else if (!lodash_1.default.isString(value)) {
|
211
221
|
value = lodash_1.default.toString(value);
|
212
222
|
}
|
213
223
|
if (this.component.dataSrc !== 'values') {
|
@@ -229,7 +239,7 @@ class RadioComponent extends ListComponent_1.default {
|
|
229
239
|
if (this.optionsLoaded) {
|
230
240
|
return;
|
231
241
|
}
|
232
|
-
if (!this.shouldLoad) {
|
242
|
+
if (!this.shouldLoad && this.listData) {
|
233
243
|
this.loadItemsFromMetadata();
|
234
244
|
return;
|
235
245
|
}
|
@@ -260,7 +270,7 @@ class RadioComponent extends ListComponent_1.default {
|
|
260
270
|
this.loadedOptions[i] = {
|
261
271
|
label: this.itemTemplate(item)
|
262
272
|
};
|
263
|
-
if (lodash_1.default.isEqual(item, this.selectData)) {
|
273
|
+
if (lodash_1.default.isEqual(item, this.selectData || lodash_1.default.pick(this.dataValue, lodash_1.default.keys(item)))) {
|
264
274
|
this.loadedOptions[i].value = this.dataValue;
|
265
275
|
}
|
266
276
|
});
|
@@ -271,13 +281,13 @@ class RadioComponent extends ListComponent_1.default {
|
|
271
281
|
const listData = [];
|
272
282
|
items === null || items === void 0 ? void 0 : items.forEach((item, i) => {
|
273
283
|
this.loadedOptions[i] = {
|
274
|
-
value: item[this.component.valueProperty],
|
275
|
-
label: this.itemTemplate(item, item[this.component.valueProperty])
|
284
|
+
value: this.component.valueProperty ? item[this.component.valueProperty] : item,
|
285
|
+
label: this.component.valueProperty ? this.itemTemplate(item, item[this.component.valueProperty]) : this.itemTemplate(item, item, i)
|
276
286
|
};
|
277
|
-
listData.push(this.templateData[item[this.component.valueProperty]]);
|
278
|
-
if (lodash_1.default.isUndefined(item[this.component.valueProperty]) ||
|
279
|
-
lodash_1.default.isObject(item[this.component.valueProperty]) ||
|
280
|
-
(!this.isRadio && lodash_1.default.isBoolean(item[this.component.valueProperty]))) {
|
287
|
+
listData.push(this.templateData[this.component.valueProperty ? item[this.component.valueProperty] : i]);
|
288
|
+
if ((this.component.valueProperty || !this.isRadio) && (lodash_1.default.isUndefined(item[this.component.valueProperty]) ||
|
289
|
+
(!this.isRadio && lodash_1.default.isObject(item[this.component.valueProperty])) ||
|
290
|
+
(!this.isRadio && lodash_1.default.isBoolean(item[this.component.valueProperty])))) {
|
281
291
|
this.loadedOptions[i].invalid = true;
|
282
292
|
}
|
283
293
|
});
|
@@ -63,6 +63,7 @@ export default class SelectComponent extends ListComponent {
|
|
63
63
|
value: any;
|
64
64
|
label: any;
|
65
65
|
};
|
66
|
+
itemTemplate(data: any, value: any): any;
|
66
67
|
/**
|
67
68
|
* Adds an option to the select dropdown.
|
68
69
|
*
|
@@ -102,6 +103,7 @@ export default class SelectComponent extends ListComponent {
|
|
102
103
|
focusableElement: any;
|
103
104
|
choices: Choices | null | undefined;
|
104
105
|
scrollList: any;
|
106
|
+
isRemoveButtonPressed: boolean | undefined;
|
105
107
|
get isLoadingAvailable(): any;
|
106
108
|
onScroll(): void;
|
107
109
|
attachRefreshOnBlur(): void;
|
@@ -428,7 +428,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
428
428
|
const searching = fromSearch && ((_b = (_a = this.choices) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.isFocussed);
|
429
429
|
if (!searching) {
|
430
430
|
// If a value is provided, then select it.
|
431
|
-
if (!this.isEmpty()) {
|
431
|
+
if (!this.isEmpty() || this.isRemoveButtonPressed) {
|
432
432
|
this.setValue(this.dataValue, {
|
433
433
|
noUpdateEvent: true
|
434
434
|
});
|
@@ -814,6 +814,11 @@ class SelectComponent extends ListComponent_1.default {
|
|
814
814
|
this.scrollList = this.choices.choiceList.element;
|
815
815
|
this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
|
816
816
|
}
|
817
|
+
if (choicesOptions.removeItemButton) {
|
818
|
+
this.addEventListener(input, 'removeItem', () => {
|
819
|
+
this.isRemoveButtonPressed = true;
|
820
|
+
});
|
821
|
+
}
|
817
822
|
}
|
818
823
|
this.focusableElement.setAttribute('tabIndex', tabIndex);
|
819
824
|
// If a search field is provided, then add an event listener to update items on search.
|
@@ -245,5 +245,14 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
245
245
|
}
|
246
246
|
return super.checkComponentValidity(data, dirty, rowData, options);
|
247
247
|
}
|
248
|
+
validateValueAvailability(setting, value) {
|
249
|
+
if (!(0, utils_1.boolValue)(setting) || !value) {
|
250
|
+
return true;
|
251
|
+
}
|
252
|
+
const values = this.component.values;
|
253
|
+
const availableValueKeys = (values || []).map(({ value: optionValue }) => optionValue);
|
254
|
+
const valueKeys = Object.keys(value);
|
255
|
+
return valueKeys.every((key) => availableValueKeys.includes(key));
|
256
|
+
}
|
248
257
|
}
|
249
258
|
exports.default = SelectBoxesComponent;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
const label: string;
|
3
|
+
const optionsLabelPosition: string;
|
4
|
+
const tableView: boolean;
|
5
|
+
const values: {
|
6
|
+
label: string;
|
7
|
+
value: string;
|
8
|
+
shortcut: string;
|
9
|
+
}[];
|
10
|
+
namespace validate {
|
11
|
+
const onlyAvailableItems: boolean;
|
12
|
+
}
|
13
|
+
const key: string;
|
14
|
+
const type: string;
|
15
|
+
const input: boolean;
|
16
|
+
const inputType: string;
|
17
|
+
}
|
18
|
+
export default _default;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
label: 'Select Boxes',
|
5
|
+
optionsLabelPosition: 'right',
|
6
|
+
tableView: false,
|
7
|
+
values: [
|
8
|
+
{
|
9
|
+
label: 'a',
|
10
|
+
value: 'a',
|
11
|
+
shortcut: '',
|
12
|
+
},
|
13
|
+
{
|
14
|
+
label: 'b',
|
15
|
+
value: 'b',
|
16
|
+
shortcut: '',
|
17
|
+
},
|
18
|
+
{
|
19
|
+
label: 'c',
|
20
|
+
value: 'c',
|
21
|
+
shortcut: '',
|
22
|
+
},
|
23
|
+
],
|
24
|
+
validate: {
|
25
|
+
onlyAvailableItems: true,
|
26
|
+
},
|
27
|
+
key: 'selectBoxes',
|
28
|
+
type: 'selectboxes',
|
29
|
+
input: true,
|
30
|
+
inputType: 'checkbox',
|
31
|
+
};
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
6
|
+
exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
8
8
|
exports.comp1 = comp1_1.default;
|
9
9
|
const comp2_1 = __importDefault(require("./comp2"));
|
@@ -16,3 +16,5 @@ const comp5_1 = __importDefault(require("./comp5"));
|
|
16
16
|
exports.comp5 = comp5_1.default;
|
17
17
|
const comp6_1 = __importDefault(require("./comp6"));
|
18
18
|
exports.comp6 = comp6_1.default;
|
19
|
+
const comp7_1 = __importDefault(require("./comp7"));
|
20
|
+
exports.comp7 = comp7_1.default;
|
@@ -37,11 +37,10 @@ export default class SignatureComponent extends Input {
|
|
37
37
|
onDisabled(): void;
|
38
38
|
checkSize(force: any, scale: any): void;
|
39
39
|
signaturePad: SignaturePad | null | undefined;
|
40
|
-
observer:
|
40
|
+
observer: any;
|
41
41
|
getValueAsString(value: any): "" | "Yes" | "No";
|
42
42
|
focus(): void;
|
43
43
|
setDataToSigaturePad(): void;
|
44
44
|
}
|
45
45
|
import Input from '../_classes/input/Input';
|
46
46
|
import SignaturePad from 'signature_pad';
|
47
|
-
import _ResizeObserver from 'resize-observer-polyfill';
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const signature_pad_1 = __importDefault(require("signature_pad"));
|
7
|
-
const resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill"));
|
8
7
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
9
8
|
const lodash_1 = __importDefault(require("lodash"));
|
10
9
|
const utils_1 = require("../../utils/utils");
|
@@ -202,7 +201,7 @@ class SignatureComponent extends Input_1.default {
|
|
202
201
|
this.refs.padBody.style.maxWidth = '100%';
|
203
202
|
}
|
204
203
|
if (!this.builderMode && !this.options.preview) {
|
205
|
-
this.observer = new
|
204
|
+
this.observer = new ResizeObserver(() => {
|
206
205
|
this.checkSize();
|
207
206
|
});
|
208
207
|
this.observer.observe(this.refs.padBody);
|
@@ -19,6 +19,7 @@ declare class ChoicesWrapper extends Choices {
|
|
19
19
|
}): void;
|
20
20
|
isDirectionUsing: boolean;
|
21
21
|
shouldOpenDropDown: boolean;
|
22
|
+
_onTouchEnd(event: any): void;
|
22
23
|
_handleButtonAction(activeItems: any, element: any): void;
|
23
24
|
_onEnterKey(args: any): void;
|
24
25
|
_onDirectionKey(...args: any[]): void;
|
@@ -50,6 +50,25 @@ class ChoicesWrapper extends choices_js_1.default {
|
|
50
50
|
this.isDirectionUsing = false;
|
51
51
|
this.shouldOpenDropDown = true;
|
52
52
|
}
|
53
|
+
_onTouchEnd(event) {
|
54
|
+
var target = (event || event.touches[0]).target;
|
55
|
+
var touchWasWithinContainer = this._wasTap && this.containerOuter.element.contains(target);
|
56
|
+
if (touchWasWithinContainer) {
|
57
|
+
var containerWasExactTarget = target === this.containerOuter.element || target === this.containerInner.element;
|
58
|
+
if (containerWasExactTarget) {
|
59
|
+
if (this._isTextElement) {
|
60
|
+
this.input.focus();
|
61
|
+
}
|
62
|
+
else if (this._isSelectMultipleElement) {
|
63
|
+
this.input.focus();
|
64
|
+
this.showDropdown();
|
65
|
+
}
|
66
|
+
}
|
67
|
+
// Prevents focus event firing
|
68
|
+
event.stopPropagation();
|
69
|
+
}
|
70
|
+
this._wasTap = true;
|
71
|
+
}
|
53
72
|
_handleButtonAction(activeItems, element) {
|
54
73
|
if (!this._isSelectOneElement) {
|
55
74
|
return super._handleButtonAction(activeItems, element);
|
package/lib/mjs/Embed.d.ts
CHANGED
@@ -14,8 +14,10 @@ export class Formio {
|
|
14
14
|
static global(prop: any): any;
|
15
15
|
static createElement(type: any, attrs: any, children: any): any;
|
16
16
|
static addScript(src: any, name: any): Promise<any>;
|
17
|
-
static addStyles(href: any
|
17
|
+
static addStyles(href: any): Promise<void>;
|
18
18
|
static submitDone(instance: any, submission: any): Promise<void>;
|
19
|
-
static
|
19
|
+
static formioScript(script: any, builder: any): any;
|
20
|
+
static init(element: any, builder?: boolean): Promise<void>;
|
20
21
|
static createForm(element: any, form: any, options: any): Promise<any>;
|
22
|
+
static builder(element: any, form: any, options: any): Promise<any>;
|
21
23
|
}
|