@formio/js 5.0.0-dev.5614.ea3660d → 5.0.0-dev.5620.dedc19b

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 (87) hide show
  1. package/Changelog.md +4 -2
  2. package/dist/formio.form.js +31 -21
  3. package/dist/formio.form.min.js +1 -1
  4. package/dist/formio.form.min.js.LICENSE.txt +2 -0
  5. package/dist/formio.full.js +34 -24
  6. package/dist/formio.full.min.js +1 -1
  7. package/dist/formio.full.min.js.LICENSE.txt +2 -0
  8. package/dist/formio.utils.js +13 -3
  9. package/dist/formio.utils.min.js +1 -1
  10. package/dist/formio.utils.min.js.LICENSE.txt +2 -0
  11. package/lib/cjs/Element.d.ts +2 -1
  12. package/lib/cjs/Element.js +17 -8
  13. package/lib/cjs/Form.js +15 -1
  14. package/lib/cjs/PDF.js +8 -1
  15. package/lib/cjs/PDFBuilder.js +3 -3
  16. package/lib/cjs/Webform.d.ts +0 -1
  17. package/lib/cjs/Webform.js +17 -12
  18. package/lib/cjs/WebformBuilder.d.ts +0 -1
  19. package/lib/cjs/WebformBuilder.js +4 -4
  20. package/lib/cjs/Wizard.js +1 -1
  21. package/lib/cjs/addons/FormioAddon.d.ts +1 -0
  22. package/lib/cjs/components/_classes/component/Component.d.ts +2 -1
  23. package/lib/cjs/components/_classes/component/Component.js +46 -8
  24. package/lib/cjs/components/_classes/input/Input.js +16 -1
  25. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -2
  26. package/lib/cjs/components/_classes/nested/NestedComponent.js +8 -7
  27. package/lib/cjs/components/columns/Columns.js +2 -2
  28. package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -1
  29. package/lib/cjs/components/editgrid/EditGrid.js +21 -7
  30. package/lib/cjs/components/file/File.d.ts +1 -0
  31. package/lib/cjs/components/file/File.js +2 -2
  32. package/lib/cjs/components/form/Form.js +3 -3
  33. package/lib/cjs/components/radio/Radio.d.ts +1 -1
  34. package/lib/cjs/components/radio/Radio.js +5 -3
  35. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +5 -0
  36. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +3 -0
  37. package/lib/cjs/components/select/Select.js +10 -3
  38. package/lib/cjs/components/select/fixtures/comp23.d.ts +47 -0
  39. package/lib/cjs/components/select/fixtures/comp23.js +40 -0
  40. package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
  41. package/lib/cjs/components/select/fixtures/index.js +3 -1
  42. package/lib/cjs/components/selectboxes/SelectBoxes.js +4 -1
  43. package/lib/cjs/components/table/Table.d.ts +0 -1
  44. package/lib/cjs/components/table/Table.js +1 -1
  45. package/lib/cjs/components/tags/Tags.js +4 -2
  46. package/lib/cjs/utils/utils.d.ts +7 -1
  47. package/lib/cjs/utils/utils.js +29 -3
  48. package/lib/cjs/widgets/CalendarWidget.js +2 -2
  49. package/lib/mjs/Element.d.ts +2 -1
  50. package/lib/mjs/Element.js +17 -8
  51. package/lib/mjs/Form.js +15 -1
  52. package/lib/mjs/PDF.js +8 -1
  53. package/lib/mjs/PDFBuilder.js +3 -3
  54. package/lib/mjs/Webform.d.ts +0 -1
  55. package/lib/mjs/Webform.js +17 -12
  56. package/lib/mjs/WebformBuilder.d.ts +0 -1
  57. package/lib/mjs/WebformBuilder.js +4 -4
  58. package/lib/mjs/Wizard.js +1 -1
  59. package/lib/mjs/addons/FormioAddon.d.ts +1 -0
  60. package/lib/mjs/components/_classes/component/Component.d.ts +2 -1
  61. package/lib/mjs/components/_classes/component/Component.js +47 -9
  62. package/lib/mjs/components/_classes/input/Input.js +16 -1
  63. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -2
  64. package/lib/mjs/components/_classes/nested/NestedComponent.js +8 -7
  65. package/lib/mjs/components/columns/Columns.js +2 -2
  66. package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -1
  67. package/lib/mjs/components/editgrid/EditGrid.js +20 -7
  68. package/lib/mjs/components/file/File.d.ts +1 -0
  69. package/lib/mjs/components/file/File.js +2 -2
  70. package/lib/mjs/components/form/Form.js +3 -3
  71. package/lib/mjs/components/radio/Radio.d.ts +1 -1
  72. package/lib/mjs/components/radio/Radio.js +5 -3
  73. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +5 -0
  74. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +3 -0
  75. package/lib/mjs/components/select/Select.js +10 -3
  76. package/lib/mjs/components/select/fixtures/comp23.d.ts +47 -0
  77. package/lib/mjs/components/select/fixtures/comp23.js +38 -0
  78. package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
  79. package/lib/mjs/components/select/fixtures/index.js +2 -1
  80. package/lib/mjs/components/selectboxes/SelectBoxes.js +4 -1
  81. package/lib/mjs/components/table/Table.d.ts +0 -1
  82. package/lib/mjs/components/table/Table.js +1 -1
  83. package/lib/mjs/components/tags/Tags.js +4 -2
  84. package/lib/mjs/utils/utils.d.ts +7 -1
  85. package/lib/mjs/utils/utils.js +15 -1
  86. package/lib/mjs/widgets/CalendarWidget.js +2 -2
  87. package/package.json +2 -2
@@ -6,7 +6,7 @@ import isMobile from 'ismobilejs';
6
6
  import { processOne, processOneSync, validateProcessInfo } from '@formio/core/process';
7
7
  import { Formio } from '../../../Formio';
8
8
  import * as FormioUtils from '../../../utils/utils';
9
- import { fastCloneDeep, boolValue, getComponentPath, isInsideScopingComponent, currentTimezone } from '../../../utils/utils';
9
+ import { fastCloneDeep, boolValue, getComponentPath, isInsideScopingComponent, currentTimezone, getScriptPlugin } from '../../../utils/utils';
10
10
  import Element from '../../../Element';
11
11
  import ComponentModal from '../componentModal/ComponentModal';
12
12
  import Widgets from '../../../widgets';
@@ -498,10 +498,30 @@ export default class Component extends Element {
498
498
  }
499
499
  return addon;
500
500
  }
501
- destroy() {
502
- super.destroy();
501
+ teardown() {
502
+ if (this.element) {
503
+ delete this.element.component;
504
+ delete this.element;
505
+ }
506
+ delete this._currentForm;
507
+ delete this.parent;
508
+ delete this.root;
509
+ delete this.triggerChange;
510
+ delete this.triggerRedraw;
511
+ if (this.options) {
512
+ delete this.options.root;
513
+ delete this.options.parent;
514
+ delete this.options.i18next;
515
+ }
516
+ super.teardown();
517
+ }
518
+ destroy(all = false) {
519
+ super.destroy(all);
503
520
  this.detach();
504
521
  this.addons.forEach((addon) => addon.destroy());
522
+ if (all) {
523
+ this.teardown();
524
+ }
505
525
  }
506
526
  get shouldDisabled() {
507
527
  return this.options.readOnly || this.component.disabled || (this.options.hasOwnProperty('disabled') && this.options.disabled[this.key]);
@@ -1052,7 +1072,7 @@ export default class Component extends Element {
1052
1072
  this.setOpenModalElement(openModalTemplate);
1053
1073
  }
1054
1074
  this.attached = true;
1055
- this.element = element;
1075
+ this.setElement(element);
1056
1076
  element.component = this;
1057
1077
  // If this already has an id, get it from the dom. If SSR, it could be different from the initiated id.
1058
1078
  if (this.element.id) {
@@ -1110,6 +1130,17 @@ export default class Component extends Element {
1110
1130
  * Remove all event handlers.
1111
1131
  */
1112
1132
  detach() {
1133
+ // First iterate through each ref and delete the component so there are no dangling component references.
1134
+ _.each(this.refs, (ref) => {
1135
+ if (typeof ref === NodeList) {
1136
+ ref.forEach((elem) => {
1137
+ delete elem.component;
1138
+ });
1139
+ }
1140
+ else if (ref) {
1141
+ delete ref.component;
1142
+ }
1143
+ });
1113
1144
  this.refs = {};
1114
1145
  this.removeEventListeners();
1115
1146
  this.detachLogic();
@@ -1197,10 +1228,17 @@ export default class Component extends Element {
1197
1228
  get viewOnly() {
1198
1229
  return this.options.readOnly && this.options.viewAsHtml;
1199
1230
  }
1231
+ setElement(element) {
1232
+ if (this.element) {
1233
+ delete this.element.component;
1234
+ delete this.element;
1235
+ }
1236
+ this.element = element;
1237
+ }
1200
1238
  createViewOnlyElement() {
1201
- this.element = this.ce('dl', {
1239
+ this.setElement(this.ce('dl', {
1202
1240
  id: this.id
1203
- });
1241
+ }));
1204
1242
  if (this.element) {
1205
1243
  // Ensure you can get the component info from the element.
1206
1244
  this.element.component = this;
@@ -1518,7 +1556,7 @@ export default class Component extends Element {
1518
1556
  const parent = this.element.parentNode;
1519
1557
  const index = Array.prototype.indexOf.call(parent.children, this.element);
1520
1558
  this.element.outerHTML = this.sanitize(this.render());
1521
- this.element = parent.children[index];
1559
+ this.setElement(parent.children[index]);
1522
1560
  return this.attach(this.element);
1523
1561
  }
1524
1562
  rebuild() {
@@ -3182,7 +3220,7 @@ Component.requireLibrary = function (name, property, src, polling) {
3182
3220
  }.bind(Component.externalLibraries[name]);
3183
3221
  }
3184
3222
  // See if the plugin already exists.
3185
- const plugin = _.get(window, property);
3223
+ const plugin = getScriptPlugin(property);
3186
3224
  if (plugin) {
3187
3225
  Component.externalLibraries[name].resolve(plugin);
3188
3226
  }
@@ -3225,7 +3263,7 @@ Component.requireLibrary = function (name, property, src, polling) {
3225
3263
  // if no callback is provided, then check periodically for the script.
3226
3264
  if (polling) {
3227
3265
  setTimeout(function checkLibrary() {
3228
- const plugin = _.get(window, property);
3266
+ const plugin = getScriptPlugin(property);
3229
3267
  if (plugin) {
3230
3268
  Component.externalLibraries[name].resolve(plugin);
3231
3269
  }
@@ -266,8 +266,22 @@ export default class Input extends Multivalue {
266
266
  widget.on('redraw', () => this.redraw(), true);
267
267
  return widget;
268
268
  }
269
+ teardown() {
270
+ if (this.element && this.element.widget) {
271
+ this.element.widget.destroy();
272
+ delete this.element.widget;
273
+ }
274
+ if (this.refs && this.refs.input) {
275
+ for (let i = 0; i <= this.refs.input.length; i++) {
276
+ const widget = this.getWidget(i);
277
+ if (widget) {
278
+ widget.destroy();
279
+ }
280
+ }
281
+ }
282
+ super.teardown();
283
+ }
269
284
  detach() {
270
- super.detach();
271
285
  if (this.refs && this.refs.input) {
272
286
  for (let i = 0; i <= this.refs.input.length; i++) {
273
287
  const widget = this.getWidget(i);
@@ -277,5 +291,6 @@ export default class Input extends Multivalue {
277
291
  }
278
292
  }
279
293
  this.refs.input = [];
294
+ super.detach();
280
295
  }
281
296
  }
@@ -82,7 +82,7 @@ export default class NestedComponent extends Field {
82
82
  * @param {Component} component - The component to remove from the components.
83
83
  * @param {Array<Component>} components - An array of components to remove this component from.
84
84
  */
85
- removeComponent(component: Component, components: Array<Component>): void;
85
+ removeComponent(component: Component, components: Array<Component>, all?: boolean): void;
86
86
  /**
87
87
  * Removes a component provided the API key of that component.
88
88
  *
@@ -140,7 +140,7 @@ export default class NestedComponent extends Field {
140
140
  checkAsyncValidity(data: any, dirty: any, row: any, silentCheck: any): Promise<any>;
141
141
  setPristine(pristine: any): void;
142
142
  get isPristine(): any;
143
- destroyComponents(): void;
143
+ destroyComponents(all?: boolean): void;
144
144
  get visibleErrors(): any;
145
145
  get errors(): any;
146
146
  get dataReady(): Promise<any[]>;
@@ -325,6 +325,7 @@ export default class NestedComponent extends Field {
325
325
  */
326
326
  addComponents(data, options) {
327
327
  data = data || this.data;
328
+ this.components = this.components || [];
328
329
  options = options || this.options;
329
330
  if (options.components) {
330
331
  this.components = options.components;
@@ -436,9 +437,9 @@ export default class NestedComponent extends Field {
436
437
  * @param {Component} component - The component to remove from the components.
437
438
  * @param {Array<Component>} components - An array of components to remove this component from.
438
439
  */
439
- removeComponent(component, components) {
440
+ removeComponent(component, components, all = false) {
440
441
  components = components || this.components;
441
- component.destroy();
442
+ component.destroy(all);
442
443
  _.remove(components, { id: component.id });
443
444
  if (this.componentsMap[component.path]) {
444
445
  delete this.componentsMap[component.path];
@@ -663,13 +664,13 @@ export default class NestedComponent extends Field {
663
664
  });
664
665
  super.clear();
665
666
  }
666
- destroy() {
667
- this.destroyComponents();
668
- super.destroy();
667
+ destroy(all = false) {
668
+ this.destroyComponents(all);
669
+ super.destroy(all);
669
670
  }
670
- destroyComponents() {
671
+ destroyComponents(all = false) {
671
672
  const components = this.getComponents().slice();
672
- components.forEach((comp) => this.removeComponent(comp, this.components));
673
+ components.forEach((comp) => this.removeComponent(comp, this.components, all));
673
674
  this.components = [];
674
675
  }
675
676
  get visibleErrors() {
@@ -145,8 +145,8 @@ export default class ColumnsComponent extends NestedComponent {
145
145
  detach(all) {
146
146
  super.detach(all);
147
147
  }
148
- destroy() {
149
- super.destroy();
148
+ destroy(all = false) {
149
+ super.destroy(all);
150
150
  this.columns = [];
151
151
  }
152
152
  }
@@ -52,7 +52,7 @@ export default class EditGridComponent extends NestedArrayComponent {
52
52
  renderRow(row: any, rowIndex: any): any;
53
53
  eachComponent(fn: any, rowIndex: any): void;
54
54
  flattenComponents(rowIndex: any): {};
55
- destroyComponents(rowIndex: any): void;
55
+ destroyComponents(all?: boolean, rowIndex?: number): void;
56
56
  createRow(dataObj: any, rowIndex: any): {
57
57
  components: any;
58
58
  data: any;
@@ -567,15 +567,19 @@ export default class EditGridComponent extends NestedArrayComponent {
567
567
  return this.builderMode
568
568
  ? super.getComponents()
569
569
  : _.isNumber(rowIndex)
570
- ? (this.editRows[rowIndex].components || [])
570
+ ? (this.editRows[rowIndex]?.components || [])
571
571
  : this.editRows.reduce((result, row) => result.concat(row.components || []), []);
572
572
  }
573
- destroyComponents(rowIndex) {
573
+ destroy(all = false) {
574
+ this.calculatedValue = undefined;
575
+ super.destroy(all);
576
+ }
577
+ destroyComponents(all = false, rowIndex = 0) {
574
578
  if (this.builderMode) {
575
- return super.destroyComponents();
579
+ return super.destroyComponents(all);
576
580
  }
577
581
  const components = this.getComponents(rowIndex).slice();
578
- components.forEach((comp) => this.removeComponent(comp, this.components));
582
+ components.forEach((comp) => this.removeComponent(comp, this.components, all));
579
583
  }
580
584
  createRow(dataObj, rowIndex) {
581
585
  const editRow = {
@@ -748,7 +752,7 @@ export default class EditGridComponent extends NestedArrayComponent {
748
752
  case EditRowState.New: {
749
753
  editRow.state = EditRowState.Removed;
750
754
  this.clearErrors(rowIndex);
751
- this.destroyComponents(rowIndex);
755
+ this.destroyComponents(false, rowIndex);
752
756
  if (this.inlineEditMode) {
753
757
  this.splice(rowIndex);
754
758
  }
@@ -866,7 +870,7 @@ export default class EditGridComponent extends NestedArrayComponent {
866
870
  baseRemoveRow(rowIndex) {
867
871
  const editRow = this.editRows[rowIndex];
868
872
  editRow.state = EditRowState.Removed;
869
- this.destroyComponents(rowIndex);
873
+ this.destroyComponents(false, rowIndex);
870
874
  return editRow;
871
875
  }
872
876
  removeRow(rowIndex, modified) {
@@ -889,6 +893,15 @@ export default class EditGridComponent extends NestedArrayComponent {
889
893
  this.redraw();
890
894
  }
891
895
  createRowComponents(row, rowIndex, recreatePartially) {
896
+ // Iterate through existing components and destroy the ones with the same rowIndex.
897
+ if (this.components) {
898
+ for (let i = 0; i < this.components.length; i++) {
899
+ if (this.components[i].rowIndex === rowIndex) {
900
+ this.components[i].destroy();
901
+ this.components.splice(i, 1);
902
+ }
903
+ }
904
+ }
892
905
  const currentRowComponents = _.get(this.editRows, `[${rowIndex}].components`, null);
893
906
  return this.component.components.map((col, colIndex) => {
894
907
  if (recreatePartially && currentRowComponents && this.variableTypeComponentsIndexes.length) {
@@ -1168,7 +1181,7 @@ export default class EditGridComponent extends NestedArrayComponent {
1168
1181
  });
1169
1182
  }
1170
1183
  emptyRows() {
1171
- this.editRows.forEach((editRow, index) => this.destroyComponents(index));
1184
+ this.editRows.forEach((editRow, index) => this.destroyComponents(false, index));
1172
1185
  this.editRows = [];
1173
1186
  }
1174
1187
  resetValue() {
@@ -167,5 +167,6 @@ export default class FileComponent extends Field {
167
167
  getFile(fileInfo: any): any;
168
168
  focus(): void;
169
169
  beforeSubmit(): Promise<void>;
170
+ destroy(all: any): void;
170
171
  }
171
172
  import Field from '../_classes/field/Field';
@@ -1022,8 +1022,8 @@ export default class FileComponent extends Field {
1022
1022
  return Promise.reject(error.message);
1023
1023
  }
1024
1024
  }
1025
- destroy() {
1025
+ destroy(all) {
1026
1026
  this.stopVideo();
1027
- super.destroy();
1027
+ super.destroy(all);
1028
1028
  }
1029
1029
  }
@@ -329,13 +329,13 @@ export default class FormComponent extends Component {
329
329
  && _.isNumber(this.formObj._vid)
330
330
  && this.formObj._vid !== this.subFormRevision;
331
331
  }
332
- destroy() {
332
+ destroy(all = false) {
333
333
  if (this.subForm) {
334
- this.subForm.destroy();
334
+ this.subForm.destroy(all);
335
335
  this.subForm = null;
336
336
  this.subFormReady = null;
337
337
  }
338
- super.destroy();
338
+ super.destroy(all);
339
339
  }
340
340
  redraw() {
341
341
  if (this.subForm) {
@@ -71,7 +71,7 @@ export default class RadioComponent extends ListComponent {
71
71
  detach(element: any): void;
72
72
  validateValueProperty(): boolean;
73
73
  validateValueAvailability(setting: any, value: any): boolean;
74
- getValueAsString(value: any): any;
74
+ getValueAsString(value: any, options?: {}): any;
75
75
  setValueAt(index: any, value: any): void;
76
76
  loadItems(url: any, search: any, headers: any, options: any, method: any, body: any): void;
77
77
  loadItemsFromMetadata(): void;
@@ -226,17 +226,19 @@ export default class RadioComponent extends ListComponent {
226
226
  }
227
227
  return false;
228
228
  }
229
- getValueAsString(value) {
229
+ getValueAsString(value, options = {}) {
230
230
  if (_.isObject(value)) {
231
231
  value = JSON.stringify(value);
232
232
  }
233
233
  else if (!_.isString(value)) {
234
234
  value = _.toString(value);
235
235
  }
236
- if (this.component.dataSrc !== 'values') {
236
+ const isModalPreviewWithUrlDataSource = options.modalPreview && this.component.dataSrc === 'url';
237
+ if (this.component.dataSrc !== 'values' && !isModalPreviewWithUrlDataSource) {
237
238
  return value;
238
239
  }
239
- const option = _.find(this.component.values, (v) => v.value === value);
240
+ const values = isModalPreviewWithUrlDataSource ? this.loadedOptions : this.component.values;
241
+ const option = _.find(values, (v) => v.value === value);
240
242
  if (!value) {
241
243
  return _.get(option, 'label', '');
242
244
  }
@@ -7,6 +7,9 @@ declare const _default: ({
7
7
  label: string;
8
8
  value: string;
9
9
  }[];
10
+ validate: {
11
+ required: boolean;
12
+ };
10
13
  weight: number;
11
14
  input?: undefined;
12
15
  dataSrc?: undefined;
@@ -28,6 +31,7 @@ declare const _default: ({
28
31
  custom(context: any): any[];
29
32
  };
30
33
  values?: undefined;
34
+ validate?: undefined;
31
35
  ignore?: undefined;
32
36
  } | {
33
37
  key: string;
@@ -36,6 +40,7 @@ declare const _default: ({
36
40
  tooltip?: undefined;
37
41
  type?: undefined;
38
42
  values?: undefined;
43
+ validate?: undefined;
39
44
  weight?: undefined;
40
45
  input?: undefined;
41
46
  dataSrc?: undefined;
@@ -15,6 +15,9 @@ export default [
15
15
  value: 'buttonClick'
16
16
  }
17
17
  ],
18
+ validate: {
19
+ required: true
20
+ },
18
21
  weight: 650
19
22
  },
20
23
  {
@@ -226,9 +226,10 @@ export default class SelectComponent extends ListComponent {
226
226
  }
227
227
  selectValueAndLabel(data) {
228
228
  const value = this.getOptionValue((this.isEntireObjectDisplay() && !this.itemValue(data)) ? data : this.itemValue(data));
229
+ const readOnlyResourceLabelData = this.options.readOnly && (this.component.dataSrc === 'resource' || this.component.dataSrc === 'url') && this.selectData;
229
230
  return {
230
231
  value,
231
- label: this.itemTemplate((this.isEntireObjectDisplay() && !_.isObject(data.data)) ? { data: data } : data, value)
232
+ label: this.itemTemplate((this.isEntireObjectDisplay() && !_.isObject(data.data)) ? { data: data } : readOnlyResourceLabelData || data, value)
232
233
  };
233
234
  }
234
235
  itemTemplate(data, value) {
@@ -840,7 +841,9 @@ export default class SelectComponent extends ListComponent {
840
841
  }
841
842
  const tabIndex = input.tabIndex;
842
843
  this.addPlaceholder();
843
- input.setAttribute('dir', this.i18next.dir());
844
+ if (this.i18next) {
845
+ input.setAttribute('dir', this.i18next.dir());
846
+ }
844
847
  if (this.choices?.containerOuter?.element?.parentNode) {
845
848
  this.choices.destroy();
846
849
  }
@@ -1493,6 +1496,10 @@ export default class SelectComponent extends ListComponent {
1493
1496
  }
1494
1497
  asString(value, options = {}) {
1495
1498
  value = value ?? this.getValue();
1499
+ if (options.modalPreview && this.selectData) {
1500
+ const { label } = this.selectValueAndLabel(value);
1501
+ return label;
1502
+ }
1496
1503
  //need to convert values to strings to be able to compare values with available options that are strings
1497
1504
  const convertToString = (data, valueProperty) => {
1498
1505
  if (valueProperty) {
@@ -1568,7 +1575,6 @@ export default class SelectComponent extends ListComponent {
1568
1575
  : '-';
1569
1576
  }
1570
1577
  detach() {
1571
- super.detach();
1572
1578
  this.off('blur');
1573
1579
  if (this.choices) {
1574
1580
  if (this.choices.containerOuter?.element?.parentNode) {
@@ -1576,6 +1582,7 @@ export default class SelectComponent extends ListComponent {
1576
1582
  }
1577
1583
  this.choices = null;
1578
1584
  }
1585
+ super.detach();
1579
1586
  }
1580
1587
  focus() {
1581
1588
  if (this.focusableElement) {
@@ -0,0 +1,47 @@
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
+ dataSrc: string;
12
+ data: {
13
+ resource: string;
14
+ };
15
+ template: string;
16
+ validate: {
17
+ select: boolean;
18
+ };
19
+ key: string;
20
+ type: string;
21
+ searchField: string;
22
+ input: boolean;
23
+ noRefreshOnScroll: boolean;
24
+ addResource: boolean;
25
+ reference: boolean;
26
+ valueProperty: string;
27
+ disableOnInvalid?: undefined;
28
+ } | {
29
+ type: string;
30
+ label: string;
31
+ key: string;
32
+ disableOnInvalid: boolean;
33
+ input: boolean;
34
+ tableView: boolean;
35
+ widget?: undefined;
36
+ dataSrc?: undefined;
37
+ data?: undefined;
38
+ template?: undefined;
39
+ validate?: undefined;
40
+ searchField?: undefined;
41
+ noRefreshOnScroll?: undefined;
42
+ addResource?: undefined;
43
+ reference?: undefined;
44
+ valueProperty?: undefined;
45
+ })[];
46
+ }
47
+ export default _default;
@@ -0,0 +1,38 @@
1
+ export default {
2
+ title: 'FIO-8234',
3
+ name: 'fio8234',
4
+ path: 'fio8234',
5
+ type: 'form',
6
+ display: 'form',
7
+ components: [
8
+ {
9
+ label: 'Select',
10
+ widget: 'choicesjs',
11
+ tableView: true,
12
+ dataSrc: 'resource',
13
+ data: {
14
+ resource: '665446284c9b0163c3e0c7e6',
15
+ },
16
+ template: '<span>{{ item.data.textField1 }}</span>',
17
+ validate: {
18
+ select: false,
19
+ },
20
+ key: 'select',
21
+ type: 'select',
22
+ searchField: 'data.textField2__regex',
23
+ input: true,
24
+ noRefreshOnScroll: false,
25
+ addResource: false,
26
+ reference: false,
27
+ valueProperty: 'data.textField2',
28
+ },
29
+ {
30
+ type: 'button',
31
+ label: 'Submit',
32
+ key: 'submit',
33
+ disableOnInvalid: true,
34
+ input: true,
35
+ tableView: false,
36
+ },
37
+ ],
38
+ };
@@ -19,5 +19,6 @@ import comp19 from './comp19';
19
19
  import comp20 from './comp20';
20
20
  import comp21 from './comp21';
21
21
  import comp22 from './comp22';
22
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22 };
22
+ import comp23 from './comp23';
23
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23 };
23
24
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -20,4 +20,5 @@ import comp19 from './comp19';
20
20
  import comp20 from './comp20';
21
21
  import comp21 from './comp21';
22
22
  import comp22 from './comp22';
23
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22 };
23
+ import comp23 from './comp23';
24
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23 };
@@ -162,11 +162,14 @@ export default class SelectBoxesComponent extends RadioComponent {
162
162
  }
163
163
  return changed;
164
164
  }
165
- getValueAsString(value) {
165
+ getValueAsString(value, options = {}) {
166
166
  if (!value) {
167
167
  return '';
168
168
  }
169
169
  if (this.isSelectURL) {
170
+ if (options.modalPreview && this.loadedOptions) {
171
+ return this.loadedOptions.filter((option) => value[option.value]).map((option) => option.label).join(', ');
172
+ }
170
173
  return _(value).pickBy((val) => val).keys().join(', ');
171
174
  }
172
175
  return _(this.component.values || [])
@@ -19,6 +19,5 @@ export default class TableComponent extends NestedComponent {
19
19
  noField: boolean;
20
20
  table: any[] | undefined;
21
21
  render(): any;
22
- destroy(all: any): void;
23
22
  }
24
23
  import NestedComponent from '../_classes/nested/NestedComponent';
@@ -162,7 +162,7 @@ export default class TableComponent extends NestedComponent {
162
162
  });
163
163
  return superAttach;
164
164
  }
165
- destroy(all) {
165
+ destroy(all = false) {
166
166
  super.destroy(all);
167
167
  delete this.table;
168
168
  }
@@ -59,7 +59,9 @@ export default class TagsComponent extends Input {
59
59
  if (!element) {
60
60
  return;
61
61
  }
62
- element.setAttribute('dir', this.i18next.dir());
62
+ if (this.i18next) {
63
+ element.setAttribute('dir', this.i18next.dir());
64
+ }
63
65
  if (this.choices) {
64
66
  this.choices.destroy();
65
67
  }
@@ -106,11 +108,11 @@ export default class TagsComponent extends Input {
106
108
  });
107
109
  }
108
110
  detach() {
109
- super.detach();
110
111
  if (this.choices) {
111
112
  this.choices.destroy();
112
113
  this.choices = null;
113
114
  }
115
+ super.detach();
114
116
  }
115
117
  normalizeValue(value) {
116
118
  if (this.component.storeas === 'string' && Array.isArray(value)) {
@@ -27,6 +27,12 @@ export function getElementRect(element: any): {
27
27
  width: string;
28
28
  height: string;
29
29
  };
30
+ /**
31
+ * Get non HTMLElement property in the window object
32
+ * @param {String} property
33
+ * @return {any || undefined}
34
+ */
35
+ export function getScriptPlugin(property: string): any;
30
36
  /**
31
37
  * Determines the boolean value of a setting.
32
38
  *
@@ -374,4 +380,4 @@ import jsonLogic from 'json-logic-js';
374
380
  import ConditionOperators from './conditionOperators';
375
381
  import Evaluator from './Evaluator';
376
382
  export const interpolate: (rawTemplate: any, data: any, _options: any) => any;
377
- export { jsonLogic, moment, ConditionOperators, Evaluator, _ };
383
+ export { jsonLogic, ConditionOperators, Evaluator, _ };
@@ -28,7 +28,8 @@ jsonLogic.add_operation('relativeMinDate', (relativeMinDate) => {
28
28
  jsonLogic.add_operation('relativeMaxDate', (relativeMaxDate) => {
29
29
  return moment().add(relativeMaxDate, 'days').toISOString();
30
30
  });
31
- export { jsonLogic, moment, ConditionOperators };
31
+ export { jsonLogic, ConditionOperators };
32
+ export * as moment from 'moment-timezone/moment-timezone';
32
33
  function setPathToComponentAndPerentSchema(component) {
33
34
  component.path = getComponentPath(component);
34
35
  const dataParent = getDataParentComponent(component);
@@ -130,6 +131,19 @@ export function getElementRect(element) {
130
131
  height: getPropertyValue(style, 'height')
131
132
  };
132
133
  }
134
+ /**
135
+ * Get non HTMLElement property in the window object
136
+ * @param {String} property
137
+ * @return {any || undefined}
138
+ */
139
+ export function getScriptPlugin(property) {
140
+ const obj = window[property];
141
+ if (typeof HTMLElement === 'object' ? obj instanceof HTMLElement : //DOM2
142
+ obj && typeof obj === 'object' && true && obj.nodeType === 1 && typeof obj.nodeName === 'string') {
143
+ return undefined;
144
+ }
145
+ return obj;
146
+ }
133
147
  /**
134
148
  * Determines the boolean value of a setting.
135
149
  *