@formio/js 5.0.0-rc.92 → 5.0.0-rc.94

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/dist/formio.embed.js +1 -1
  2. package/dist/formio.embed.min.js +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.js +92 -92
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.full.js +92 -92
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  10. package/dist/formio.js +11 -11
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +69 -69
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  16. package/lib/cjs/Wizard.js +1 -1
  17. package/lib/cjs/components/_classes/component/Component.d.ts +1 -1
  18. package/lib/cjs/components/_classes/component/Component.js +5 -7
  19. package/lib/cjs/components/day/Day.d.ts +1 -1
  20. package/lib/cjs/components/day/Day.js +12 -0
  21. package/lib/cjs/components/day/fixtures/comp5.d.ts +18 -2
  22. package/lib/cjs/components/day/fixtures/comp5.js +6 -0
  23. package/lib/cjs/components/editgrid/EditGrid.d.ts +2 -2
  24. package/lib/cjs/components/editgrid/EditGrid.js +6 -5
  25. package/lib/cjs/components/radio/Radio.d.ts +1 -0
  26. package/lib/cjs/components/radio/Radio.js +13 -4
  27. package/lib/cjs/components/select/Select.js +1 -1
  28. package/lib/cjs/components/select/fixtures/comp25.d.ts +43 -28
  29. package/lib/cjs/components/select/fixtures/comp25.js +56 -49
  30. package/lib/cjs/components/select/fixtures/comp26.d.ts +44 -0
  31. package/lib/cjs/components/select/fixtures/comp26.js +59 -0
  32. package/lib/cjs/components/select/fixtures/index.d.ts +1 -0
  33. package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -2
  34. package/lib/cjs/components/textarea/TextArea.d.ts +4 -4
  35. package/lib/cjs/components/textarea/TextArea.js +4 -4
  36. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +1 -9
  37. package/lib/cjs/utils/formUtils.d.ts +3 -0
  38. package/lib/cjs/utils/formUtils.js +5 -2
  39. package/lib/cjs/utils/utils.d.ts +0 -12
  40. package/lib/cjs/utils/utils.js +1 -33
  41. package/lib/mjs/Wizard.js +1 -1
  42. package/lib/mjs/components/_classes/component/Component.d.ts +1 -1
  43. package/lib/mjs/components/_classes/component/Component.js +5 -7
  44. package/lib/mjs/components/day/Day.d.ts +1 -1
  45. package/lib/mjs/components/day/Day.js +12 -0
  46. package/lib/mjs/components/day/fixtures/comp5.d.ts +18 -2
  47. package/lib/mjs/components/day/fixtures/comp5.js +6 -0
  48. package/lib/mjs/components/editgrid/EditGrid.d.ts +2 -2
  49. package/lib/mjs/components/editgrid/EditGrid.js +6 -5
  50. package/lib/mjs/components/radio/Radio.d.ts +1 -0
  51. package/lib/mjs/components/radio/Radio.js +13 -4
  52. package/lib/mjs/components/select/Select.js +1 -1
  53. package/lib/mjs/components/select/fixtures/comp25.d.ts +43 -28
  54. package/lib/mjs/components/select/fixtures/comp25.js +56 -49
  55. package/lib/mjs/components/select/fixtures/comp26.d.ts +44 -0
  56. package/lib/mjs/components/select/fixtures/comp26.js +57 -0
  57. package/lib/mjs/components/select/fixtures/index.d.ts +1 -0
  58. package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -2
  59. package/lib/mjs/components/textarea/TextArea.d.ts +4 -4
  60. package/lib/mjs/components/textarea/TextArea.js +4 -4
  61. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +2 -10
  62. package/lib/mjs/utils/formUtils.d.ts +3 -0
  63. package/lib/mjs/utils/formUtils.js +2 -2
  64. package/lib/mjs/utils/utils.d.ts +0 -12
  65. package/lib/mjs/utils/utils.js +0 -30
  66. package/package.json +3 -3
@@ -172,8 +172,14 @@ export default class SelectBoxesComponent extends RadioComponent {
172
172
  return '';
173
173
  }
174
174
  if (this.isSelectURL) {
175
- if (options.modalPreview && this.loadedOptions) {
176
- return this.loadedOptions.filter((option) => value[option.value]).map((option) => option.label).join(', ');
175
+ if (options.modalPreview || this.options.readOnly || this.inDataTable) {
176
+ const checkedItems = _.keys(_.pickBy(value, (val) => val));
177
+ if (this.selectData?.length === checkedItems.length) {
178
+ return this.selectData.map(item => this.itemTemplate(item)).join(', ');
179
+ }
180
+ else if (this.loadedOptions?.length) {
181
+ return this.loadedOptions.filter((option) => value[option.value]).map((option) => option.label).join(', ');
182
+ }
177
183
  }
178
184
  return _(value).pickBy((val) => val).keys().join(', ');
179
185
  }
@@ -20,10 +20,10 @@ export default class TextAreaComponent extends TextFieldComponent {
20
20
  setReadOnlyValue(value: any, index: any): void;
21
21
  get isJsonValue(): any;
22
22
  /**
23
- * Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
24
- * @param {*} value - The value to normalize
25
- * @returns {*} - Returns the normalized value
26
- */
23
+ * Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
24
+ * @param {*} value - The value to normalize
25
+ * @returns {*} - Returns the normalized value
26
+ */
27
27
  normalizeValue(value: any): any;
28
28
  normalizeSingleValue(value: any): any;
29
29
  setConvertedValue(value: any, index: any): any;
@@ -305,10 +305,10 @@ export default class TextAreaComponent extends TextFieldComponent {
305
305
  return this.component.as && this.component.as === 'json';
306
306
  }
307
307
  /**
308
- * Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
309
- * @param {*} value - The value to normalize
310
- * @returns {*} - Returns the normalized value
311
- */
308
+ * Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
309
+ * @param {*} value - The value to normalize
310
+ * @returns {*} - Returns the normalized value
311
+ */
312
312
  normalizeValue(value) {
313
313
  if (this.component.multiple && Array.isArray(value)) {
314
314
  return value.map((singleValue) => this.normalizeSingleValue(singleValue));
@@ -1,6 +1,6 @@
1
1
  import ConditionOperator from './ConditionOperator';
2
2
  import _ from 'lodash';
3
- import { getItemTemplateKeys, isSelectResourceWithObjectValue } from '../utils';
3
+ import { compareSelectResourceWithObjectTypeValues, isSelectResourceWithObjectValue } from '../utils';
4
4
  export default class IsEqualTo extends ConditionOperator {
5
5
  static get operatorKey() {
6
6
  return 'isEqual';
@@ -21,15 +21,7 @@ export default class IsEqualTo extends ConditionOperator {
21
21
  if (conditionTriggerComponent
22
22
  && isSelectResourceWithObjectValue(conditionTriggerComponent.component)
23
23
  && conditionTriggerComponent.component?.template) {
24
- if (!value || !_.isPlainObject(value)) {
25
- return false;
26
- }
27
- const { template, valueProperty } = conditionTriggerComponent.component;
28
- if (valueProperty === 'data') {
29
- value = { data: value };
30
- comparedValue = { data: comparedValue };
31
- }
32
- return _.every(getItemTemplateKeys(template) || [], k => _.isEqual(_.get(value, k), _.get(comparedValue, k)));
24
+ return compareSelectResourceWithObjectTypeValues(value, comparedValue, conditionTriggerComponent.component);
33
25
  }
34
26
  }
35
27
  //special check for select boxes
@@ -41,4 +41,7 @@ export const applyFormChanges: typeof Utils.applyFormChanges;
41
41
  export const findComponent: typeof Utils.findComponent;
42
42
  export const getEmptyValue: typeof Utils.getEmptyValue;
43
43
  export const isComponentDataEmpty: typeof Utils.isComponentDataEmpty;
44
+ export const isSelectResourceWithObjectValue: typeof Utils.isSelectResourceWithObjectValue;
45
+ export const compareSelectResourceWithObjectTypeValues: typeof Utils.compareSelectResourceWithObjectTypeValues;
46
+ export const getItemTemplateKeys: typeof Utils.getItemTemplateKeys;
44
47
  import { Utils } from '@formio/core';
@@ -1,5 +1,5 @@
1
1
  import { Utils } from '@formio/core';
2
- const { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty } = Utils;
2
+ const { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty, isSelectResourceWithObjectValue, compareSelectResourceWithObjectTypeValues, getItemTemplateKeys } = Utils;
3
3
  /**
4
4
  * Deprecated version of findComponents. Renamed to searchComponents.
5
5
  * @param {import('@formio/core').Component[]} components - The components to find components within.
@@ -10,4 +10,4 @@ export function findComponents(components, query) {
10
10
  console.warn('formio.js/utils findComponents is deprecated. Use searchComponents instead.');
11
11
  return searchComponents(components, query);
12
12
  }
13
- export { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty };
13
+ export { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty, isSelectResourceWithObjectValue, compareSelectResourceWithObjectTypeValues, getItemTemplateKeys };
@@ -498,18 +498,6 @@ export function getFocusableElements(element: HTMLElement): NodeList<HTMLElement
498
498
  * @returns {Array<string>|null} - The saved types for the component
499
499
  */
500
500
  export function getComponentSavedTypes(fullSchema: import('@formio/core').Component): Array<string> | null;
501
- /**
502
- * Returns the template keys inside the template code.
503
- * @param {string} template - The template to get the keys from.
504
- * @returns {Array<string>} - The keys inside the template.
505
- */
506
- export function getItemTemplateKeys(template: string): Array<string>;
507
- /**
508
- * Returns if the component is a select resource with an object for its value.
509
- * @param {import('@formio/core').Component} comp - The component to check.
510
- * @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
511
- */
512
- export function isSelectResourceWithObjectValue(comp?: import('@formio/core').Component): boolean;
513
501
  export * from "./formUtils";
514
502
  /**
515
503
  * Map values through unfold and return first non-nil value.
@@ -1587,33 +1587,3 @@ export const interpolateErrors = (component, errors, interpolateFn) => {
1587
1587
  return { ...error, message: unescapeHTML(interpolateFn(toInterpolate, context)), context: { ...context } };
1588
1588
  });
1589
1589
  };
1590
- /**
1591
- * Returns the template keys inside the template code.
1592
- * @param {string} template - The template to get the keys from.
1593
- * @returns {Array<string>} - The keys inside the template.
1594
- */
1595
- export function getItemTemplateKeys(template) {
1596
- const templateKeys = [];
1597
- if (!template) {
1598
- return templateKeys;
1599
- }
1600
- const keys = template.match(/({{\s*(.*?)\s*}})/g);
1601
- if (keys) {
1602
- keys.forEach((key) => {
1603
- const propKey = key.match(/{{\s*item\.(.*?)\s*}}/);
1604
- if (propKey && propKey.length > 1) {
1605
- templateKeys.push(propKey[1]);
1606
- }
1607
- });
1608
- }
1609
- return templateKeys;
1610
- }
1611
- /**
1612
- * Returns if the component is a select resource with an object for its value.
1613
- * @param {import('@formio/core').Component} comp - The component to check.
1614
- * @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
1615
- */
1616
- export function isSelectResourceWithObjectValue(comp = {}) {
1617
- const { reference, dataSrc, valueProperty } = comp;
1618
- return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));
1619
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.92",
3
+ "version": "5.0.0-rc.94",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -79,9 +79,9 @@
79
79
  },
80
80
  "homepage": "https://github.com/formio/formio.js#readme",
81
81
  "dependencies": {
82
- "@formio/bootstrap": "3.0.0-rc.39",
82
+ "@formio/bootstrap": "3.0.0-rc.41",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.3.0-rc.13",
84
+ "@formio/core": "2.3.0-rc.16",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.2",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",