@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
package/lib/mjs/Embed.js
CHANGED
@@ -67,7 +67,7 @@ class Formio {
|
|
67
67
|
}, 100);
|
68
68
|
});
|
69
69
|
}
|
70
|
-
static async addStyles(href
|
70
|
+
static async addStyles(href) {
|
71
71
|
if (!href) {
|
72
72
|
return;
|
73
73
|
}
|
@@ -76,14 +76,6 @@ class Formio {
|
|
76
76
|
return;
|
77
77
|
}
|
78
78
|
Formio.debug('Adding Styles', href);
|
79
|
-
const link = Formio.createElement('link', {
|
80
|
-
rel: 'stylesheet',
|
81
|
-
href
|
82
|
-
});
|
83
|
-
if (addGlobally) {
|
84
|
-
// Add globally as well.
|
85
|
-
document.head.appendChild(link);
|
86
|
-
}
|
87
79
|
Formio.wrapper.appendChild(Formio.createElement('link', {
|
88
80
|
rel: 'stylesheet',
|
89
81
|
href
|
@@ -117,37 +109,12 @@ class Formio {
|
|
117
109
|
}
|
118
110
|
}
|
119
111
|
}
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
}
|
124
|
-
Formio.FormioClass.license = true;
|
125
|
-
return Formio.FormioClass.createForm(Formio.element, form, {
|
126
|
-
...options,
|
127
|
-
...{ noLoader: true }
|
128
|
-
}).then((instance) => {
|
129
|
-
Formio.debug('Form created', instance);
|
130
|
-
// Remove the loader.
|
131
|
-
Formio.debug('Removing loader');
|
132
|
-
Formio.wrapper.removeChild(Formio.loader);
|
133
|
-
// Set the default submission data.
|
134
|
-
if (Formio.config.submission) {
|
135
|
-
Formio.debug('Setting submission', Formio.config.submission);
|
136
|
-
instance.submission = Formio.config.submission;
|
137
|
-
}
|
138
|
-
// Allow them to provide additional configs.
|
139
|
-
Formio.debug('Triggering embed event');
|
140
|
-
Formio.FormioClass.events.emit('formEmbedded', instance);
|
141
|
-
// Trigger the after handler.
|
142
|
-
if (Formio.config.after) {
|
143
|
-
Formio.debug('Calling ready callback');
|
144
|
-
Formio.config.after(instance, Formio.config);
|
145
|
-
}
|
146
|
-
return instance;
|
147
|
-
});
|
112
|
+
// Return the full script if the builder is being used.
|
113
|
+
static formioScript(script, builder) {
|
114
|
+
return builder ? script.replace('formio.form', 'formio.full') : script;
|
148
115
|
}
|
149
116
|
// eslint-disable-next-line max-statements
|
150
|
-
static async
|
117
|
+
static async init(element, builder = false) {
|
151
118
|
Formio.element = element;
|
152
119
|
Formio.cdn = new CDN(Formio.config.cdn);
|
153
120
|
Formio.config.libs = Formio.config.libs || {
|
@@ -188,7 +155,7 @@ class Formio {
|
|
188
155
|
}]
|
189
156
|
}]);
|
190
157
|
Formio.wrapper.appendChild(Formio.loader);
|
191
|
-
Formio.FormioClass = await Formio.addScript(Formio.config.script || `${Formio.cdn.js}/formio.form.min.js`, 'Formio');
|
158
|
+
Formio.FormioClass = await Formio.addScript(Formio.formioScript(Formio.config.script || `${Formio.cdn.js}/formio.form.min.js`, builder), 'Formio');
|
192
159
|
Formio.FormioClass.setBaseUrl(Formio.baseUrl || Formio.config.base);
|
193
160
|
Formio.FormioClass.setProjectUrl(Formio.projectUrl || Formio.config.project);
|
194
161
|
Formio.FormioClass.language = Formio.language;
|
@@ -206,7 +173,7 @@ class Formio {
|
|
206
173
|
await Formio.addStyles(Formio.config.libs[Formio.config.template].css);
|
207
174
|
await Formio.addScript(Formio.config.libs[Formio.config.template].js);
|
208
175
|
if (Formio.config.libs[Formio.config.template].fa) {
|
209
|
-
await Formio.addStyles(Formio.config.libs.fontawesome.css
|
176
|
+
await Formio.addStyles(Formio.config.libs.fontawesome.css);
|
210
177
|
}
|
211
178
|
}
|
212
179
|
if (Formio.cdn[Formio.config.template]) {
|
@@ -222,7 +189,7 @@ class Formio {
|
|
222
189
|
}
|
223
190
|
// Default bootstrap + fontawesome.
|
224
191
|
else if (Formio.config.includeLibs) {
|
225
|
-
await Formio.addStyles(Formio.config.libs.fontawesome.css
|
192
|
+
await Formio.addStyles(Formio.config.libs.fontawesome.css);
|
226
193
|
await Formio.addStyles(Formio.config.libs.bootstrap.css);
|
227
194
|
}
|
228
195
|
if (Formio.config.premium) {
|
@@ -230,8 +197,52 @@ class Formio {
|
|
230
197
|
Formio.debug('Using premium');
|
231
198
|
Formio.FormioClass.use(await Formio.addScript(Formio.config.premium.js, 'premium'));
|
232
199
|
}
|
233
|
-
await Formio.addStyles(Formio.config.style || `${Formio.cdn.js}/formio.form.min.css
|
234
|
-
|
200
|
+
await Formio.addStyles(Formio.formioScript(Formio.config.style || `${Formio.cdn.js}/formio.form.min.css`, builder));
|
201
|
+
if (Formio.config.before) {
|
202
|
+
await Formio.config.before(Formio.FormioClass, Formio.element, Formio.config);
|
203
|
+
}
|
204
|
+
Formio.FormioClass.license = true;
|
205
|
+
}
|
206
|
+
static async createForm(element, form, options) {
|
207
|
+
await Formio.init(element);
|
208
|
+
return Formio.FormioClass.createForm(Formio.element, form, {
|
209
|
+
...options,
|
210
|
+
...{ noLoader: true }
|
211
|
+
}).then((instance) => {
|
212
|
+
Formio.debug('Form created', instance);
|
213
|
+
// Remove the loader.
|
214
|
+
Formio.debug('Removing loader');
|
215
|
+
Formio.wrapper.removeChild(Formio.loader);
|
216
|
+
// Set the default submission data.
|
217
|
+
if (Formio.config.submission) {
|
218
|
+
Formio.debug('Setting submission', Formio.config.submission);
|
219
|
+
instance.submission = Formio.config.submission;
|
220
|
+
}
|
221
|
+
// Allow them to provide additional configs.
|
222
|
+
Formio.debug('Triggering embed event');
|
223
|
+
Formio.FormioClass.events.emit('formEmbedded', instance);
|
224
|
+
// Trigger the after handler.
|
225
|
+
if (Formio.config.after) {
|
226
|
+
Formio.debug('Calling ready callback');
|
227
|
+
Formio.config.after(instance, Formio.config);
|
228
|
+
}
|
229
|
+
return instance;
|
230
|
+
});
|
231
|
+
}
|
232
|
+
static async builder(element, form, options) {
|
233
|
+
await Formio.init(element, true);
|
234
|
+
return Formio.FormioClass.builder(Formio.element, form, options).then((instance) => {
|
235
|
+
Formio.debug('Builder created', instance);
|
236
|
+
Formio.debug('Removing loader');
|
237
|
+
Formio.wrapper.removeChild(Formio.loader);
|
238
|
+
Formio.debug('Triggering embed event');
|
239
|
+
Formio.FormioClass.events.emit('builderEmbedded', instance);
|
240
|
+
if (Formio.config.after) {
|
241
|
+
Formio.debug('Calling ready callback');
|
242
|
+
Formio.config.after(instance, Formio.config);
|
243
|
+
}
|
244
|
+
return instance;
|
245
|
+
});
|
235
246
|
}
|
236
247
|
}
|
237
248
|
export { Formio };
|
@@ -1028,7 +1028,7 @@ export default class WebformBuilder extends Component {
|
|
1028
1028
|
return false;
|
1029
1029
|
});
|
1030
1030
|
});
|
1031
|
-
if (tabIndex !== -1 && index !== -1 && changed && changed.value) {
|
1031
|
+
if (tabIndex !== -1 && index !== -1 && changed && !_.isNil(changed.value)) {
|
1032
1032
|
const sibling = parentComponent.tabs[tabIndex][index + 1];
|
1033
1033
|
parentComponent.removeComponent(defaultValueComponent);
|
1034
1034
|
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;
|
@@ -78,7 +78,7 @@ export default class ListComponent extends Field {
|
|
78
78
|
setItems() { }
|
79
79
|
updateCustomItems() { }
|
80
80
|
loadItems() { }
|
81
|
-
getOptionTemplate(data, value) {
|
81
|
+
getOptionTemplate(data, value, index) {
|
82
82
|
if (!this.component.template) {
|
83
83
|
return data.label;
|
84
84
|
}
|
@@ -94,13 +94,16 @@ export default class ListComponent extends Field {
|
|
94
94
|
// If the value is not an object, then we need to save the template data off for when it is selected.
|
95
95
|
this.templateData[templateValue] = options.data.item;
|
96
96
|
}
|
97
|
+
if (_.isNumber(index)) {
|
98
|
+
this.templateData[index] = options.data.item;
|
99
|
+
}
|
97
100
|
return template;
|
98
101
|
}
|
99
|
-
itemTemplate(data, value) {
|
102
|
+
itemTemplate(data, value, index) {
|
100
103
|
if (_.isEmpty(data)) {
|
101
104
|
return '';
|
102
105
|
}
|
103
|
-
const template = this.sanitize(this.getOptionTemplate(data, value), this.shouldSanitizeValue);
|
106
|
+
const template = this.sanitize(this.getOptionTemplate(data, value, index), this.shouldSanitizeValue);
|
104
107
|
if (template) {
|
105
108
|
const label = template.replace(/<\/?[^>]+(>|$)/g, '');
|
106
109
|
if (!label)
|
@@ -150,7 +150,12 @@ export default class RadioComponent extends ListComponent {
|
|
150
150
|
if (!_.isString(this.dataValue)) {
|
151
151
|
dataValue = _.toString(this.dataValue);
|
152
152
|
}
|
153
|
-
|
153
|
+
if (this.isSelectURL && _.isObject(this.loadedOptions[index].value)) {
|
154
|
+
input.checked = _.isEqual(this.loadedOptions[index].value, this.dataValue);
|
155
|
+
}
|
156
|
+
else {
|
157
|
+
input.checked = (dataValue === input.value && (input.value || this.component.dataSrc !== 'url'));
|
158
|
+
}
|
154
159
|
this.addEventListener(input, 'keyup', (event) => {
|
155
160
|
if (event.key === ' ' && dataValue === input.value) {
|
156
161
|
event.preventDefault();
|
@@ -180,9 +185,11 @@ export default class RadioComponent extends ListComponent {
|
|
180
185
|
return this.dataValue;
|
181
186
|
}
|
182
187
|
let value = this.dataValue;
|
183
|
-
this.refs.input.forEach((input) => {
|
188
|
+
this.refs.input.forEach((input, index) => {
|
184
189
|
if (input.checked) {
|
185
|
-
value =
|
190
|
+
value = (this.isSelectURL && _.isObject(this.loadedOptions[index].value)) ?
|
191
|
+
this.loadedOptions[index].value :
|
192
|
+
input.value;
|
186
193
|
}
|
187
194
|
});
|
188
195
|
return value;
|
@@ -204,7 +211,10 @@ export default class RadioComponent extends ListComponent {
|
|
204
211
|
return false;
|
205
212
|
}
|
206
213
|
getValueAsString(value) {
|
207
|
-
if (
|
214
|
+
if (_.isObject(value)) {
|
215
|
+
value = JSON.stringify(value);
|
216
|
+
}
|
217
|
+
else if (!_.isString(value)) {
|
208
218
|
value = _.toString(value);
|
209
219
|
}
|
210
220
|
if (this.component.dataSrc !== 'values') {
|
@@ -226,7 +236,7 @@ export default class RadioComponent extends ListComponent {
|
|
226
236
|
if (this.optionsLoaded) {
|
227
237
|
return;
|
228
238
|
}
|
229
|
-
if (!this.shouldLoad) {
|
239
|
+
if (!this.shouldLoad && this.listData) {
|
230
240
|
this.loadItemsFromMetadata();
|
231
241
|
return;
|
232
242
|
}
|
@@ -257,7 +267,7 @@ export default class RadioComponent extends ListComponent {
|
|
257
267
|
this.loadedOptions[i] = {
|
258
268
|
label: this.itemTemplate(item)
|
259
269
|
};
|
260
|
-
if (_.isEqual(item, this.selectData)) {
|
270
|
+
if (_.isEqual(item, this.selectData || _.pick(this.dataValue, _.keys(item)))) {
|
261
271
|
this.loadedOptions[i].value = this.dataValue;
|
262
272
|
}
|
263
273
|
});
|
@@ -268,13 +278,13 @@ export default class RadioComponent extends ListComponent {
|
|
268
278
|
const listData = [];
|
269
279
|
items?.forEach((item, i) => {
|
270
280
|
this.loadedOptions[i] = {
|
271
|
-
value: item[this.component.valueProperty],
|
272
|
-
label: this.itemTemplate(item, item[this.component.valueProperty])
|
281
|
+
value: this.component.valueProperty ? item[this.component.valueProperty] : item,
|
282
|
+
label: this.component.valueProperty ? this.itemTemplate(item, item[this.component.valueProperty]) : this.itemTemplate(item, item, i)
|
273
283
|
};
|
274
|
-
listData.push(this.templateData[item[this.component.valueProperty]]);
|
275
|
-
if (_.isUndefined(item[this.component.valueProperty]) ||
|
276
|
-
_.isObject(item[this.component.valueProperty]) ||
|
277
|
-
(!this.isRadio && _.isBoolean(item[this.component.valueProperty]))) {
|
284
|
+
listData.push(this.templateData[this.component.valueProperty ? item[this.component.valueProperty] : i]);
|
285
|
+
if ((this.component.valueProperty || !this.isRadio) && (_.isUndefined(item[this.component.valueProperty]) ||
|
286
|
+
(!this.isRadio && _.isObject(item[this.component.valueProperty])) ||
|
287
|
+
(!this.isRadio && _.isBoolean(item[this.component.valueProperty])))) {
|
278
288
|
this.loadedOptions[i].invalid = true;
|
279
289
|
}
|
280
290
|
});
|
@@ -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;
|
@@ -429,7 +429,7 @@ export default class SelectComponent extends ListComponent {
|
|
429
429
|
const searching = fromSearch && this.choices?.input?.isFocussed;
|
430
430
|
if (!searching) {
|
431
431
|
// If a value is provided, then select it.
|
432
|
-
if (!this.isEmpty()) {
|
432
|
+
if (!this.isEmpty() || this.isRemoveButtonPressed) {
|
433
433
|
this.setValue(this.dataValue, {
|
434
434
|
noUpdateEvent: true
|
435
435
|
});
|
@@ -843,6 +843,11 @@ export default class SelectComponent extends ListComponent {
|
|
843
843
|
this.scrollList = this.choices.choiceList.element;
|
844
844
|
this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
|
845
845
|
}
|
846
|
+
if (choicesOptions.removeItemButton) {
|
847
|
+
this.addEventListener(input, 'removeItem', () => {
|
848
|
+
this.isRemoveButtonPressed = true;
|
849
|
+
});
|
850
|
+
}
|
846
851
|
}
|
847
852
|
this.focusableElement.setAttribute('tabIndex', tabIndex);
|
848
853
|
// If a search field is provided, then add an event listener to update items on search.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
-
import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
2
|
+
import { componentValueTypes, getComponentSavedTypes, boolValue } from '../../utils/utils';
|
3
3
|
import RadioComponent from '../radio/Radio';
|
4
4
|
export default class SelectBoxesComponent extends RadioComponent {
|
5
5
|
static schema(...extend) {
|
@@ -243,4 +243,13 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
243
243
|
}
|
244
244
|
return super.checkComponentValidity(data, dirty, rowData, options);
|
245
245
|
}
|
246
|
+
validateValueAvailability(setting, value) {
|
247
|
+
if (!boolValue(setting) || !value) {
|
248
|
+
return true;
|
249
|
+
}
|
250
|
+
const values = this.component.values;
|
251
|
+
const availableValueKeys = (values || []).map(({ value: optionValue }) => optionValue);
|
252
|
+
const valueKeys = Object.keys(value);
|
253
|
+
return valueKeys.every((key) => availableValueKeys.includes(key));
|
254
|
+
}
|
246
255
|
}
|
@@ -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,29 @@
|
|
1
|
+
export default {
|
2
|
+
label: 'Select Boxes',
|
3
|
+
optionsLabelPosition: 'right',
|
4
|
+
tableView: false,
|
5
|
+
values: [
|
6
|
+
{
|
7
|
+
label: 'a',
|
8
|
+
value: 'a',
|
9
|
+
shortcut: '',
|
10
|
+
},
|
11
|
+
{
|
12
|
+
label: 'b',
|
13
|
+
value: 'b',
|
14
|
+
shortcut: '',
|
15
|
+
},
|
16
|
+
{
|
17
|
+
label: 'c',
|
18
|
+
value: 'c',
|
19
|
+
shortcut: '',
|
20
|
+
},
|
21
|
+
],
|
22
|
+
validate: {
|
23
|
+
onlyAvailableItems: true,
|
24
|
+
},
|
25
|
+
key: 'selectBoxes',
|
26
|
+
type: 'selectboxes',
|
27
|
+
input: true,
|
28
|
+
inputType: 'checkbox',
|
29
|
+
};
|
@@ -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';
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import SignaturePad from 'signature_pad';
|
2
|
-
import _ResizeObserver from 'resize-observer-polyfill';
|
3
2
|
import Input from '../_classes/input/Input';
|
4
3
|
import _ from 'lodash';
|
5
4
|
import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
@@ -199,7 +198,7 @@ export default class SignatureComponent extends Input {
|
|
199
198
|
this.refs.padBody.style.maxWidth = '100%';
|
200
199
|
}
|
201
200
|
if (!this.builderMode && !this.options.preview) {
|
202
|
-
this.observer = new
|
201
|
+
this.observer = new ResizeObserver(() => {
|
203
202
|
this.checkSize();
|
204
203
|
});
|
205
204
|
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;
|
@@ -44,6 +44,25 @@ class ChoicesWrapper extends Choices {
|
|
44
44
|
this.isDirectionUsing = false;
|
45
45
|
this.shouldOpenDropDown = true;
|
46
46
|
}
|
47
|
+
_onTouchEnd(event) {
|
48
|
+
var target = (event || event.touches[0]).target;
|
49
|
+
var touchWasWithinContainer = this._wasTap && this.containerOuter.element.contains(target);
|
50
|
+
if (touchWasWithinContainer) {
|
51
|
+
var containerWasExactTarget = target === this.containerOuter.element || target === this.containerInner.element;
|
52
|
+
if (containerWasExactTarget) {
|
53
|
+
if (this._isTextElement) {
|
54
|
+
this.input.focus();
|
55
|
+
}
|
56
|
+
else if (this._isSelectMultipleElement) {
|
57
|
+
this.input.focus();
|
58
|
+
this.showDropdown();
|
59
|
+
}
|
60
|
+
}
|
61
|
+
// Prevents focus event firing
|
62
|
+
event.stopPropagation();
|
63
|
+
}
|
64
|
+
this._wasTap = true;
|
65
|
+
}
|
47
66
|
_handleButtonAction(activeItems, element) {
|
48
67
|
if (!this._isSelectOneElement) {
|
49
68
|
return super._handleButtonAction(activeItems, element);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.0.0-rc.
|
3
|
+
"version": "5.0.0-rc.24",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"module": "lib/mjs/index.js",
|
@@ -106,7 +106,6 @@
|
|
106
106
|
"moment": "^2.29.4",
|
107
107
|
"moment-timezone": "^0.5.43",
|
108
108
|
"quill": "^2.0.0-dev.3",
|
109
|
-
"resize-observer-polyfill": "^1.5.1",
|
110
109
|
"signature_pad": "^4.1.4",
|
111
110
|
"string-hash": "^1.1.3",
|
112
111
|
"tippy.js": "^6.3.7",
|
@@ -116,7 +115,7 @@
|
|
116
115
|
"devDependencies": {
|
117
116
|
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
118
117
|
"@typescript-eslint/parser": "^5.60.1",
|
119
|
-
"ace-builds": "
|
118
|
+
"ace-builds": "1.23.4",
|
120
119
|
"async-limiter": "^2.0.0",
|
121
120
|
"bootstrap-icons": "^1.10.5",
|
122
121
|
"bootswatch": "^5.3.0",
|