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

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 (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 +17 -17
  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 +17 -17
  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 +3 -3
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +6 -6
  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
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES = exports.uniqueName = exports.guid = exports.flattenComponents = exports.findComponents = void 0;
3
+ exports.getItemTemplateKeys = exports.compareSelectResourceWithObjectTypeValues = exports.isSelectResourceWithObjectValue = exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES = exports.uniqueName = exports.guid = exports.flattenComponents = exports.findComponents = void 0;
4
4
  const core_1 = require("@formio/core");
5
- 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 } = core_1.Utils;
5
+ 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 } = core_1.Utils;
6
6
  exports.flattenComponents = flattenComponents;
7
7
  exports.guid = guid;
8
8
  exports.uniqueName = uniqueName;
@@ -39,6 +39,9 @@ exports.applyFormChanges = applyFormChanges;
39
39
  exports.findComponent = findComponent;
40
40
  exports.getEmptyValue = getEmptyValue;
41
41
  exports.isComponentDataEmpty = isComponentDataEmpty;
42
+ exports.isSelectResourceWithObjectValue = isSelectResourceWithObjectValue;
43
+ exports.compareSelectResourceWithObjectTypeValues = compareSelectResourceWithObjectTypeValues;
44
+ exports.getItemTemplateKeys = getItemTemplateKeys;
42
45
  /**
43
46
  * Deprecated version of findComponents. Renamed to searchComponents.
44
47
  * @param {import('@formio/core').Component[]} components - The components to find components within.
@@ -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.
@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.removeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getScriptPlugin = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
22
- exports.isSelectResourceWithObjectValue = exports.getItemTemplateKeys = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = void 0;
22
+ exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = void 0;
23
23
  const lodash_1 = __importDefault(require("lodash"));
24
24
  exports._ = lodash_1.default;
25
25
  const json_logic_js_1 = __importDefault(require("json-logic-js"));
@@ -1681,35 +1681,3 @@ const interpolateErrors = (component, errors, interpolateFn) => {
1681
1681
  });
1682
1682
  };
1683
1683
  exports.interpolateErrors = interpolateErrors;
1684
- /**
1685
- * Returns the template keys inside the template code.
1686
- * @param {string} template - The template to get the keys from.
1687
- * @returns {Array<string>} - The keys inside the template.
1688
- */
1689
- function getItemTemplateKeys(template) {
1690
- const templateKeys = [];
1691
- if (!template) {
1692
- return templateKeys;
1693
- }
1694
- const keys = template.match(/({{\s*(.*?)\s*}})/g);
1695
- if (keys) {
1696
- keys.forEach((key) => {
1697
- const propKey = key.match(/{{\s*item\.(.*?)\s*}}/);
1698
- if (propKey && propKey.length > 1) {
1699
- templateKeys.push(propKey[1]);
1700
- }
1701
- });
1702
- }
1703
- return templateKeys;
1704
- }
1705
- exports.getItemTemplateKeys = getItemTemplateKeys;
1706
- /**
1707
- * Returns if the component is a select resource with an object for its value.
1708
- * @param {import('@formio/core').Component} comp - The component to check.
1709
- * @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
1710
- */
1711
- function isSelectResourceWithObjectValue(comp = {}) {
1712
- const { reference, dataSrc, valueProperty } = comp;
1713
- return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));
1714
- }
1715
- exports.isSelectResourceWithObjectValue = isSelectResourceWithObjectValue;
package/lib/mjs/Wizard.js CHANGED
@@ -903,7 +903,7 @@ export default class Wizard extends Webform {
903
903
  const components = !currentPageOnly || this.isLastPage()
904
904
  ? this.getComponents()
905
905
  : this.currentPage.components;
906
- return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, childErrors) && check, true);
906
+ return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
907
907
  }
908
908
  get errors() {
909
909
  if (!this.isLastPage()) {
@@ -1067,7 +1067,7 @@ declare class Component extends Element {
1067
1067
  elementInfo(): any;
1068
1068
  autofocus(): void;
1069
1069
  scrollIntoView(element: any, verticalOnly: any): void;
1070
- focus(index?: number): void;
1070
+ focus(index: any): void;
1071
1071
  /**
1072
1072
  * Get `Formio` instance for working with files
1073
1073
  * @returns {import('@formio/core').Formio} - The Formio instance file service.
@@ -2901,14 +2901,12 @@ export default class Component extends Element {
2901
2901
  if (flags.silentCheck) {
2902
2902
  return [];
2903
2903
  }
2904
+ let isDirty = this.dirty || flags.dirty;
2904
2905
  if (this.options.alwaysDirty) {
2905
- flags.dirty = true;
2906
+ isDirty = true;
2906
2907
  }
2907
- if (flags.fromSubmission && this.hasValue(data)) {
2908
- flags.dirty = this.pristine && this.component.protected ? false : true;
2909
- }
2910
- this.setDirty(flags.dirty);
2911
- return this.setComponentValidity(errors, flags.dirty, flags.silentCheck, flags.fromSubmission);
2908
+ this.setDirty(isDirty);
2909
+ return this.setComponentValidity(errors, isDirty, flags.silentCheck, flags.fromSubmission);
2912
2910
  }
2913
2911
  /**
2914
2912
  * Perform a component validation.
@@ -3401,7 +3399,7 @@ export default class Component extends Element {
3401
3399
  const { left, top } = element.getBoundingClientRect();
3402
3400
  window.scrollTo(verticalOnly ? window.scrollX : left + window.scrollX, top + window.scrollY);
3403
3401
  }
3404
- focus(index = (this.refs.input.length - 1)) {
3402
+ focus(index) {
3405
3403
  if ('beforeFocus' in this.parent) {
3406
3404
  this.parent.beforeFocus(this);
3407
3405
  }
@@ -11,6 +11,7 @@ export default class DayComponent extends Field {
11
11
  operators: string[];
12
12
  };
13
13
  static savedValueTypes(schema: any): string[];
14
+ static oldEmptyValue: string;
14
15
  static get serverConditionSettings(): {
15
16
  operators: string[];
16
17
  };
@@ -135,7 +136,6 @@ export default class DayComponent extends Field {
135
136
  * @returns {string|null} - The string value of the date.
136
137
  */
137
138
  getValueAsString(value: any): string | null;
138
- focus(field: any): void;
139
139
  isPartialDay(value: any): boolean;
140
140
  getValidationFormat(): string;
141
141
  }
@@ -49,6 +49,8 @@ export default class DayComponent extends Field {
49
49
  schema = schema || {};
50
50
  return getComponentSavedTypes(schema) || [componentValueTypes.string];
51
51
  }
52
+ // Empty value used before 9.3.x
53
+ static oldEmptyValue = '00/00/0000';
52
54
  constructor(component, options, data) {
53
55
  if (component.maxDate && component.maxDate.indexOf('moment(') === -1) {
54
56
  component.maxDate = moment(component.maxDate, 'YYYY-MM-DD').toISOString();
@@ -102,6 +104,12 @@ export default class DayComponent extends Field {
102
104
  info.changeEvent = 'input';
103
105
  return info;
104
106
  }
107
+ isEmpty(value = this.dataValue) {
108
+ if (value === DayComponent.oldEmptyValue) {
109
+ return true;
110
+ }
111
+ return super.isEmpty(value);
112
+ }
105
113
  inputDefinition(name) {
106
114
  let min, max;
107
115
  if (name === 'day') {
@@ -335,6 +343,10 @@ export default class DayComponent extends Field {
335
343
  }
336
344
  }
337
345
  normalizeValue(value) {
346
+ // Adjust the value from old to new format
347
+ if (value === DayComponent.oldEmptyValue) {
348
+ value = '';
349
+ }
338
350
  if (!value || this.valueMask.test(value)) {
339
351
  return value;
340
352
  }
@@ -1,7 +1,7 @@
1
1
  declare namespace _default {
2
2
  let type: string;
3
3
  let display: string;
4
- let components: {
4
+ let components: ({
5
5
  label: string;
6
6
  hideInputLabels: boolean;
7
7
  inputsLabelPosition: string;
@@ -24,6 +24,22 @@ declare namespace _default {
24
24
  type: string;
25
25
  input: boolean;
26
26
  defaultValue: string;
27
- }[];
27
+ action?: undefined;
28
+ theme?: undefined;
29
+ } | {
30
+ type: string;
31
+ action: string;
32
+ label: string;
33
+ theme: string;
34
+ hideInputLabels?: undefined;
35
+ inputsLabelPosition?: undefined;
36
+ useLocaleSettings?: undefined;
37
+ tableView?: undefined;
38
+ fields?: undefined;
39
+ validateOn?: undefined;
40
+ key?: undefined;
41
+ input?: undefined;
42
+ defaultValue?: undefined;
43
+ })[];
28
44
  }
29
45
  export default _default;
@@ -26,5 +26,11 @@ export default {
26
26
  input: true,
27
27
  defaultValue: '00/00/0000'
28
28
  },
29
+ {
30
+ type: 'button',
31
+ action: 'submit',
32
+ label: 'Submit',
33
+ theme: 'primary'
34
+ }
29
35
  ]
30
36
  };
@@ -89,8 +89,8 @@ export default class EditGridComponent extends NestedArrayComponent {
89
89
  hasOpenRows(): any;
90
90
  getAttachedData(data?: null): any;
91
91
  shouldValidateDraft(editRow: any): any;
92
- shouldValidateRow(editRow: any, dirty: any): any;
93
- validateRow(editRow: any, dirty: any, forceSilentCheck: any): any;
92
+ shouldValidateRow(editRow: any, dirty: any, fromSubmission: any): any;
93
+ validateRow(editRow: any, dirty: any, forceSilentCheck: any, fromSubmission: any): any;
94
94
  showRowErrorAlerts(editRow: any, errors: any): void;
95
95
  /**
96
96
  * @returns {boolean} - Return that this component processes its own validation.
@@ -963,16 +963,17 @@ export default class EditGridComponent extends NestedArrayComponent {
963
963
  !this.hasOpenRows()) ||
964
964
  this.root?.submitted;
965
965
  }
966
- shouldValidateRow(editRow, dirty) {
966
+ shouldValidateRow(editRow, dirty, fromSubmission) {
967
967
  return this.shouldValidateDraft(editRow) ||
968
968
  editRow.state === EditRowState.Saving ||
969
969
  editRow.state === EditRowState.Editing ||
970
970
  editRow.alerts ||
971
+ fromSubmission ||
971
972
  dirty;
972
973
  }
973
- validateRow(editRow, dirty, forceSilentCheck) {
974
+ validateRow(editRow, dirty, forceSilentCheck, fromSubmission) {
974
975
  editRow.errors = [];
975
- if (this.shouldValidateRow(editRow, dirty)) {
976
+ if (this.shouldValidateRow(editRow, dirty, fromSubmission)) {
976
977
  const silentCheck = (this.component.rowDrafts && !this.shouldValidateDraft(editRow)) || forceSilentCheck;
977
978
  const rootValue = fastCloneDeep(this.rootValue);
978
979
  const editGridValue = _.get(rootValue, this.path, []);
@@ -1043,7 +1044,7 @@ export default class EditGridComponent extends NestedArrayComponent {
1043
1044
  return true;
1044
1045
  }
1045
1046
  checkComponentValidity(data, dirty, row, options = {}, errors = []) {
1046
- const { silentCheck } = options;
1047
+ const { silentCheck, fromSubmission } = options;
1047
1048
  const superValid = super.checkComponentValidity(data, dirty, row, options, errors);
1048
1049
  // If super tells us that component invalid and there is no need to update alerts, just return false
1049
1050
  if (!superValid && (!this.alert && !this.hasOpenRows())) {
@@ -1053,7 +1054,7 @@ export default class EditGridComponent extends NestedArrayComponent {
1053
1054
  const allRowErrors = [];
1054
1055
  this.editRows.forEach((editRow, index) => {
1055
1056
  // Trigger all errors on the row.
1056
- const rowErrors = this.validateRow(editRow, dirty, silentCheck);
1057
+ const rowErrors = this.validateRow(editRow, dirty, silentCheck, fromSubmission);
1057
1058
  errors.push(...rowErrors);
1058
1059
  allRowErrors.push(...rowErrors);
1059
1060
  if (this.rowRefs) {
@@ -21,6 +21,7 @@ export default class RadioComponent extends ListComponent {
21
21
  get isRadio(): boolean;
22
22
  get optionSelectedClass(): string;
23
23
  get listData(): any;
24
+ get selectMetadata(): any;
24
25
  templateData: {} | undefined;
25
26
  triggerUpdate: ((...args: any[]) => any) | undefined;
26
27
  itemsLoadedResolve: ((value: any) => void) | undefined;
@@ -109,6 +109,12 @@ export default class RadioComponent extends ListComponent {
109
109
  const listData = _.get(this.root, 'submission.metadata.listData', {});
110
110
  return _.get(listData, this.path);
111
111
  }
112
+ get selectMetadata() {
113
+ return super.selectData;
114
+ }
115
+ get selectData() {
116
+ return this.selectMetadata || this.component.selectData;
117
+ }
112
118
  init() {
113
119
  super.init();
114
120
  this.templateData = {};
@@ -244,12 +250,15 @@ export default class RadioComponent extends ListComponent {
244
250
  else if (!_.isString(value)) {
245
251
  value = _.toString(value);
246
252
  }
247
- const isModalPreviewWithUrlDataSource = options.modalPreview && this.component.dataSrc === 'url';
248
- if (this.component.dataSrc !== 'values' && !isModalPreviewWithUrlDataSource) {
253
+ const shouldUseSelectData = (options.modalPreview || this.inDataTable)
254
+ && this.component.dataSrc === 'url' && (this.loadedOptions.length || this.selectData);
255
+ if (this.component.dataSrc !== 'values' && !shouldUseSelectData) {
249
256
  return value;
250
257
  }
251
- const values = isModalPreviewWithUrlDataSource ? this.loadedOptions : this.component.values;
252
- const option = _.find(values, (v) => v.value === value);
258
+ const values = shouldUseSelectData ? this.loadedOptions : this.component.values;
259
+ const option = !values?.length && shouldUseSelectData ? {
260
+ label: this.itemTemplate(this.selectData),
261
+ } : _.find(values, (v) => v.value === value);
253
262
  if (!value) {
254
263
  return _.get(option, 'label', '');
255
264
  }
@@ -1589,8 +1589,8 @@ export default class SelectComponent extends ListComponent {
1589
1589
  super.detach();
1590
1590
  }
1591
1591
  focus() {
1592
+ super.focus.call(this);
1592
1593
  if (this.focusableElement) {
1593
- super.focus.call(this);
1594
1594
  this.focusableElement.focus();
1595
1595
  }
1596
1596
  }
@@ -1,44 +1,59 @@
1
1
  declare namespace _default {
2
- let title: string;
3
- let name: string;
4
- let path: string;
5
- let type: string;
6
- let display: string;
7
2
  let components: ({
8
3
  label: string;
9
- widget: string;
10
4
  tableView: boolean;
11
- data: {
12
- values: {
13
- label: string;
14
- value: string;
15
- }[];
16
- };
17
- dataType: string;
5
+ modal: boolean;
6
+ rowDrafts: boolean;
18
7
  key: string;
19
8
  type: string;
9
+ displayAsTable: boolean;
20
10
  input: boolean;
21
- applyMaskOn?: undefined;
22
- conditional?: undefined;
11
+ components: ({
12
+ label: string;
13
+ widget: string;
14
+ tableView: boolean;
15
+ data: {
16
+ values: {
17
+ label: string;
18
+ value: string;
19
+ }[];
20
+ };
21
+ validate: {
22
+ required: boolean;
23
+ };
24
+ key: string;
25
+ type: string;
26
+ input: boolean;
27
+ applyMaskOn?: undefined;
28
+ validateWhenHidden?: undefined;
29
+ } | {
30
+ label: string;
31
+ applyMaskOn: string;
32
+ tableView: boolean;
33
+ validate: {
34
+ required: boolean;
35
+ };
36
+ validateWhenHidden: boolean;
37
+ key: string;
38
+ type: string;
39
+ input: boolean;
40
+ widget?: undefined;
41
+ data?: undefined;
42
+ })[];
43
+ showValidations?: undefined;
44
+ saveOnEnter?: undefined;
23
45
  } | {
24
46
  label: string;
25
- applyMaskOn: string;
47
+ showValidations: boolean;
26
48
  tableView: boolean;
27
49
  key: string;
28
50
  type: string;
29
51
  input: boolean;
30
- conditional: {
31
- show: boolean;
32
- conjunction: string;
33
- conditions: {
34
- component: string;
35
- operator: string;
36
- value: number;
37
- }[];
38
- };
39
- widget?: undefined;
40
- data?: undefined;
41
- dataType?: undefined;
52
+ saveOnEnter: boolean;
53
+ modal?: undefined;
54
+ rowDrafts?: undefined;
55
+ displayAsTable?: undefined;
56
+ components?: undefined;
42
57
  })[];
43
58
  }
44
59
  export default _default;
@@ -1,57 +1,64 @@
1
1
  export default {
2
- title: 'FIO-8072',
3
- name: 'fio8072',
4
- path: 'fio8072',
5
- type: 'form',
6
- display: 'form',
7
- components: [
2
+ "components": [
8
3
  {
9
- label: 'Select',
10
- widget: 'choicesjs',
11
- tableView: true,
12
- data: {
13
- values: [
14
- {
15
- label: 'A',
16
- value: '1',
4
+ "label": "Edit Grid",
5
+ "tableView": false,
6
+ "modal": true,
7
+ "rowDrafts": true,
8
+ "key": "editGrid",
9
+ "type": "editgrid",
10
+ "displayAsTable": false,
11
+ "input": true,
12
+ "components": [
13
+ {
14
+ "label": "Select",
15
+ "widget": "choicesjs",
16
+ "tableView": true,
17
+ "data": {
18
+ "values": [
19
+ {
20
+ "label": "a",
21
+ "value": "a"
22
+ },
23
+ {
24
+ "label": "b",
25
+ "value": "b"
26
+ },
27
+ {
28
+ "label": "c",
29
+ "value": "c"
30
+ }
31
+ ]
17
32
  },
18
- {
19
- label: 'B',
20
- value: '2',
33
+ "validate": {
34
+ "required": true
21
35
  },
22
- {
23
- label: 'C',
24
- value: '10',
36
+ "key": "select",
37
+ "type": "select",
38
+ "input": true
39
+ },
40
+ {
41
+ "label": "Text Field",
42
+ "applyMaskOn": "change",
43
+ "tableView": true,
44
+ "validate": {
45
+ "required": true
25
46
  },
26
- {
27
- label: 'D',
28
- value: '1d',
29
- },
30
- ],
31
- },
32
- dataType: 'number',
33
- key: 'select',
34
- type: 'select',
35
- input: true,
47
+ "validateWhenHidden": false,
48
+ "key": "textField",
49
+ "type": "textfield",
50
+ "input": true
51
+ }
52
+ ]
36
53
  },
37
54
  {
38
- label: 'Text Field',
39
- applyMaskOn: 'change',
40
- tableView: true,
41
- key: 'textField',
42
- type: 'textfield',
43
- input: true,
44
- conditional: {
45
- show: true,
46
- conjunction: 'all',
47
- conditions: [
48
- {
49
- component: 'select',
50
- operator: 'lessThan',
51
- value: 5,
52
- },
53
- ],
54
- },
55
- },
56
- ],
55
+ "label": "Submit",
56
+ "showValidations": false,
57
+ "tableView": false,
58
+ "key": "submit",
59
+ "type": "button",
60
+ "input": true,
61
+ "saveOnEnter": false
62
+ }
63
+ ]
57
64
  };
@@ -0,0 +1,44 @@
1
+ declare namespace _default {
2
+ let title: string;
3
+ let name: string;
4
+ let path: string;
5
+ let type: string;
6
+ let display: string;
7
+ let components: ({
8
+ label: string;
9
+ widget: string;
10
+ tableView: boolean;
11
+ data: {
12
+ values: {
13
+ label: string;
14
+ value: string;
15
+ }[];
16
+ };
17
+ dataType: string;
18
+ key: string;
19
+ type: string;
20
+ input: boolean;
21
+ applyMaskOn?: undefined;
22
+ conditional?: undefined;
23
+ } | {
24
+ label: string;
25
+ applyMaskOn: string;
26
+ tableView: boolean;
27
+ key: string;
28
+ type: string;
29
+ input: boolean;
30
+ conditional: {
31
+ show: boolean;
32
+ conjunction: string;
33
+ conditions: {
34
+ component: string;
35
+ operator: string;
36
+ value: number;
37
+ }[];
38
+ };
39
+ widget?: undefined;
40
+ data?: undefined;
41
+ dataType?: undefined;
42
+ })[];
43
+ }
44
+ export default _default;
@@ -0,0 +1,57 @@
1
+ export default {
2
+ title: 'FIO-8072',
3
+ name: 'fio8072',
4
+ path: 'fio8072',
5
+ type: 'form',
6
+ display: 'form',
7
+ components: [
8
+ {
9
+ label: 'Select',
10
+ widget: 'choicesjs',
11
+ tableView: true,
12
+ data: {
13
+ values: [
14
+ {
15
+ label: 'A',
16
+ value: '1',
17
+ },
18
+ {
19
+ label: 'B',
20
+ value: '2',
21
+ },
22
+ {
23
+ label: 'C',
24
+ value: '10',
25
+ },
26
+ {
27
+ label: 'D',
28
+ value: '1d',
29
+ },
30
+ ],
31
+ },
32
+ dataType: 'number',
33
+ key: 'select',
34
+ type: 'select',
35
+ input: true,
36
+ },
37
+ {
38
+ label: 'Text Field',
39
+ applyMaskOn: 'change',
40
+ tableView: true,
41
+ key: 'textField',
42
+ type: 'textfield',
43
+ input: true,
44
+ conditional: {
45
+ show: true,
46
+ conjunction: 'all',
47
+ conditions: [
48
+ {
49
+ component: 'select',
50
+ operator: 'lessThan',
51
+ value: 5,
52
+ },
53
+ ],
54
+ },
55
+ },
56
+ ],
57
+ };
@@ -22,6 +22,7 @@ import comp22 from './comp22';
22
22
  import comp23 from './comp23';
23
23
  import comp24 from './comp24';
24
24
  import comp25 from './comp25';
25
+ import comp26 from './comp26';
25
26
  import comp27 from './comp27';
26
27
  export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25, comp26, comp27 };
27
28
  export { multiSelect, multiSelectOptions } from "./comp3";