@formio/js 5.1.0-dev.6152.95f2394 → 5.1.0-dev.6155.76252ef

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.
Files changed (43) hide show
  1. package/dist/formio.builder.css +1 -0
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.form.css +1 -0
  4. package/dist/formio.form.js +9 -9
  5. package/dist/formio.form.min.css +1 -1
  6. package/dist/formio.form.min.js +1 -1
  7. package/dist/formio.full.css +1 -0
  8. package/dist/formio.full.js +11 -11
  9. package/dist/formio.full.min.css +1 -1
  10. package/dist/formio.full.min.js +1 -1
  11. package/dist/formio.js +4 -4
  12. package/dist/formio.min.js +1 -1
  13. package/dist/formio.utils.js +5 -5
  14. package/dist/formio.utils.min.js +1 -1
  15. package/lib/cjs/PDFBuilder.d.ts +1 -0
  16. package/lib/cjs/PDFBuilder.js +8 -8
  17. package/lib/cjs/WebformBuilder.d.ts +1 -1
  18. package/lib/cjs/WebformBuilder.js +36 -11
  19. package/lib/cjs/components/button/Button.d.ts +1 -1
  20. package/lib/cjs/components/button/Button.js +4 -4
  21. package/lib/cjs/components/radio/Radio.d.ts +8 -0
  22. package/lib/cjs/components/radio/Radio.js +15 -5
  23. package/lib/cjs/components/select/Select.d.ts +1 -0
  24. package/lib/cjs/components/select/Select.js +18 -2
  25. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  26. package/lib/cjs/translations/en.d.ts +1 -0
  27. package/lib/cjs/translations/en.js +1 -1
  28. package/lib/cjs/utils/utils.js +14 -3
  29. package/lib/mjs/PDFBuilder.d.ts +1 -0
  30. package/lib/mjs/PDFBuilder.js +8 -8
  31. package/lib/mjs/WebformBuilder.d.ts +1 -1
  32. package/lib/mjs/WebformBuilder.js +36 -12
  33. package/lib/mjs/components/button/Button.d.ts +1 -1
  34. package/lib/mjs/components/button/Button.js +1 -1
  35. package/lib/mjs/components/radio/Radio.d.ts +8 -0
  36. package/lib/mjs/components/radio/Radio.js +15 -5
  37. package/lib/mjs/components/select/Select.d.ts +1 -0
  38. package/lib/mjs/components/select/Select.js +18 -2
  39. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  40. package/lib/mjs/translations/en.d.ts +1 -0
  41. package/lib/mjs/translations/en.js +1 -0
  42. package/lib/mjs/utils/utils.js +14 -2
  43. package/package.json +2 -2
@@ -359,6 +359,18 @@ export default class SelectComponent extends ListComponent {
359
359
  this.downloadedResources.serverCount = this.downloadedResources.length;
360
360
  this.serverCount = this.downloadedResources.length;
361
361
  }
362
+ shouldResetChoicesItems(items) {
363
+ if (this.choices._store.choices.length !== items.length) {
364
+ return true;
365
+ }
366
+ for (let item of items) {
367
+ const choicesItem = this.choices._store.choices.find((i) => i.label === item.label);
368
+ if (!choicesItem) {
369
+ return true;
370
+ }
371
+ }
372
+ return false;
373
+ }
362
374
  /* eslint-disable max-statements */
363
375
  setItems(items, fromSearch) {
364
376
  this.selectItems = items;
@@ -444,7 +456,7 @@ export default class SelectComponent extends ListComponent {
444
456
  this.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, _.get(item, this.component.idPath, String(index)));
445
457
  });
446
458
  if (this.choices) {
447
- this.choices.setChoices(this.selectOptions, 'value', 'label', true);
459
+ this.choices.setChoices(this.selectOptions, 'value', 'label', true, true, !fromSearch && this.shouldResetChoicesItems(this.selectOptions));
448
460
  }
449
461
  else if (this.loading) {
450
462
  // Re-attach select input.
@@ -935,8 +947,9 @@ export default class SelectComponent extends ListComponent {
935
947
  });
936
948
  }
937
949
  // Add value options.
950
+ const value = this.undoValueTyping(this.dataValue);
938
951
  this.addValueOptions();
939
- this.setChoicesValue(this.dataValue);
952
+ this.setChoicesValue(value);
940
953
  if (this.isSelectResource && this.refs.addResource) {
941
954
  this.addEventListener(this.refs.addResource, 'click', (event) => {
942
955
  event.preventDefault();
@@ -1312,6 +1325,9 @@ export default class SelectComponent extends ListComponent {
1312
1325
  this.lazyLoadInit = true;
1313
1326
  const searchProperty = this.component.searchField || this.component.valueProperty;
1314
1327
  this.triggerUpdate(_.get(value.data || value, searchProperty, value), true);
1328
+ this.itemsLoaded.then(() => {
1329
+ this.setChoicesValue(value, hasPreviousValue, flags);
1330
+ });
1315
1331
  return changed;
1316
1332
  }
1317
1333
  // Add the value options.
@@ -8,6 +8,12 @@ export default class SelectBoxesComponent extends RadioComponent {
8
8
  * @returns {boolean} - If the value is empty.
9
9
  */
10
10
  isEmpty(value?: any): boolean;
11
+ /**
12
+ * Normalize values coming into updateValue.
13
+ * @param {any} value - The value to normalize.
14
+ * @returns {*} - The normalized value
15
+ */
16
+ normalizeValue(value: any): any;
11
17
  setInputsDisabled(value: any, onlyUnchecked: any): void;
12
18
  checkComponentValidity(data: any, dirty: any, rowData: any, options: any, errors?: any[]): boolean;
13
19
  }
@@ -70,6 +70,7 @@ declare const _default: {
70
70
  reCaptchaTokenValidationError: string;
71
71
  reCaptchaTokenNotSpecifiedError: string;
72
72
  apiKey: string;
73
+ apiKeyNotValid: string;
73
74
  typeRemaining: string;
74
75
  typeCount: string;
75
76
  requiredDayField: string;
@@ -72,6 +72,7 @@ export default {
72
72
  reCaptchaTokenValidationError: 'ReCAPTCHA: Token validation error',
73
73
  reCaptchaTokenNotSpecifiedError: 'ReCAPTCHA: Token is not specified in submission',
74
74
  apiKey: 'API Key is not unique: {{key}}',
75
+ apiKeyNotValid: 'API Key is not valid: {{key}}',
75
76
  typeRemaining: '{{ remaining }} {{ type }} remaining.',
76
77
  typeCount: '{{ count }} {{ type }}',
77
78
  requiredDayField: '{{ field }} is required',
@@ -1,3 +1,4 @@
1
+ /* global jQuery */
1
2
  import _ from 'lodash';
2
3
  import moment from 'moment-timezone/moment-timezone';
3
4
  import jtz from 'jstimezonedetect';
@@ -198,7 +199,15 @@ export function checkSimpleConditional(component, condition, row, data, instance
198
199
  return true;
199
200
  }
200
201
  const splittedConditionPath = conditionComponentPath.split('.');
201
- const conditionalPaths = instance?.parent?.type === 'datagrid' || instance?.parent?.type === 'editgrid' ? [] : getConditionalPathsRecursive(splittedConditionPath, data);
202
+ const checkParentTypeInTree = (instance, componentType) => {
203
+ if (!instance?.parent) {
204
+ return false;
205
+ }
206
+ return instance?.parent.type === componentType || checkParentTypeInTree(instance.parent, componentType);
207
+ };
208
+ const conditionalPaths = checkParentTypeInTree(instance, 'datagrid') || checkParentTypeInTree(instance, 'editgrid')
209
+ ? []
210
+ : getConditionalPathsRecursive(splittedConditionPath, data);
202
211
  if (conditionalPaths.length > 0) {
203
212
  return conditionalPaths.map((path) => {
204
213
  const value = getComponentActualValue(path, data, row);
@@ -312,7 +321,7 @@ function getRow(component, row, instance, conditional) {
312
321
  }
313
322
  const dataParent = getDataParentComponent(instance);
314
323
  if (dataParent) {
315
- const parentPath = dataParent.paths?.localDataPath;
324
+ const parentPath = dataParent.paths?.localPath;
316
325
  const isTriggerCondtionComponentPath = condition.when || !condition.conditions
317
326
  ? condition.when?.startsWith(dataParent.paths?.localPath)
318
327
  : _.some(condition.conditions, cond => cond.component.startsWith(dataParent.paths?.localPath));
@@ -1005,6 +1014,9 @@ export function bootstrapVersion(options) {
1005
1014
  if (options.bootstrap) {
1006
1015
  return options.bootstrap;
1007
1016
  }
1017
+ if ((typeof jQuery === 'function') && (typeof jQuery().collapse === 'function')) {
1018
+ return parseInt(jQuery.fn.collapse.Constructor.VERSION.split('.')[0], 10);
1019
+ }
1008
1020
  if (window.bootstrap && window.bootstrap.Collapse) {
1009
1021
  return parseInt(window.bootstrap.Collapse.VERSION.split('.')[0], 10);
1010
1022
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6152.95f2394",
3
+ "version": "5.1.0-dev.6155.76252ef",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -81,7 +81,7 @@
81
81
  "homepage": "https://github.com/formio/formio.js#readme",
82
82
  "dependencies": {
83
83
  "@formio/bootstrap": "v3.0.0-dev.121.085d187",
84
- "@formio/core": "2.4.0-dev.245.326cac7",
84
+ "@formio/core": "v2.4.0-dev.255.7fab6ff",
85
85
  "@formio/text-mask-addons": "3.8.0-formio.4",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",