@formio/js 5.1.0-dev.6109.79f22ad → 5.1.0-dev.6113.1a173e6

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.
@@ -118,7 +118,7 @@ class Input extends Multivalue_1.default {
118
118
  }
119
119
  const info = this.inputInfo;
120
120
  info.attr = info.attr || {};
121
- info.attr.value = this.getValueAsString(this.formatValue(this.parseValue(value)))
121
+ info.attr.value = this.getValueAsString(this.formatValue(this.parseValue(this.isMultipleMasksField ? value.value : value)))
122
122
  .replace(/"/g, '"');
123
123
  const valueMask = this.component.inputMask;
124
124
  const displayMask = this.component.displayMask;
@@ -89,7 +89,6 @@ export default class SelectComponent extends ListComponent {
89
89
  disableInfiniteScroll(): void;
90
90
  set serverCount(value: any);
91
91
  get serverCount(): any;
92
- shouldResetChoicesItems(items: any): boolean;
93
92
  setItems(items: any, fromSearch: any): void;
94
93
  selectItems: any;
95
94
  set downloadedResources(value: any);
@@ -355,18 +355,6 @@ class SelectComponent extends ListComponent_1.default {
355
355
  this.downloadedResources.serverCount = this.downloadedResources.length;
356
356
  this.serverCount = this.downloadedResources.length;
357
357
  }
358
- shouldResetChoicesItems(items) {
359
- if (this.choices._store.choices.length !== items.length) {
360
- return true;
361
- }
362
- for (let item of items) {
363
- const choicesItem = this.choices._store.choices.find((i) => i.label === item.label);
364
- if (!choicesItem) {
365
- return true;
366
- }
367
- }
368
- return false;
369
- }
370
358
  /* eslint-disable max-statements */
371
359
  setItems(items, fromSearch) {
372
360
  var _a, _b;
@@ -453,7 +441,7 @@ class SelectComponent extends ListComponent_1.default {
453
441
  this.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, lodash_1.default.get(item, this.component.idPath, String(index)));
454
442
  });
455
443
  if (this.choices) {
456
- this.choices.setChoices(this.selectOptions, 'value', 'label', true, true, !fromSearch && this.shouldResetChoicesItems(this.selectOptions));
444
+ this.choices.setChoices(this.selectOptions, 'value', 'label', true);
457
445
  }
458
446
  else if (this.loading) {
459
447
  // Re-attach select input.
@@ -130,7 +130,12 @@ class TextFieldComponent extends Input_1.default {
130
130
  // If no value is provided, then set the defaultValue.
131
131
  if (!value.value) {
132
132
  const defaultValue = flags.noDefault ? this.emptyValue : this.defaultValue;
133
- value.value = Array.isArray(defaultValue) ? defaultValue[0] : defaultValue;
133
+ if (Array.isArray(defaultValue)) {
134
+ value.value = lodash_1.default.isObject(defaultValue[0]) ? defaultValue[0].value : defaultValue;
135
+ }
136
+ else {
137
+ value.value = lodash_1.default.isObject(defaultValue) ? defaultValue.value : defaultValue;
138
+ }
134
139
  }
135
140
  return value;
136
141
  }
@@ -113,7 +113,7 @@ export default class Input extends Multivalue {
113
113
  }
114
114
  const info = this.inputInfo;
115
115
  info.attr = info.attr || {};
116
- info.attr.value = this.getValueAsString(this.formatValue(this.parseValue(value)))
116
+ info.attr.value = this.getValueAsString(this.formatValue(this.parseValue(this.isMultipleMasksField ? value.value : value)))
117
117
  .replace(/"/g, '"');
118
118
  const valueMask = this.component.inputMask;
119
119
  const displayMask = this.component.displayMask;
@@ -89,7 +89,6 @@ export default class SelectComponent extends ListComponent {
89
89
  disableInfiniteScroll(): void;
90
90
  set serverCount(value: any);
91
91
  get serverCount(): any;
92
- shouldResetChoicesItems(items: any): boolean;
93
92
  setItems(items: any, fromSearch: any): void;
94
93
  selectItems: any;
95
94
  set downloadedResources(value: any);
@@ -359,18 +359,6 @@ 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
- }
374
362
  /* eslint-disable max-statements */
375
363
  setItems(items, fromSearch) {
376
364
  this.selectItems = items;
@@ -456,7 +444,7 @@ export default class SelectComponent extends ListComponent {
456
444
  this.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, _.get(item, this.component.idPath, String(index)));
457
445
  });
458
446
  if (this.choices) {
459
- this.choices.setChoices(this.selectOptions, 'value', 'label', true, true, !fromSearch && this.shouldResetChoicesItems(this.selectOptions));
447
+ this.choices.setChoices(this.selectOptions, 'value', 'label', true);
460
448
  }
461
449
  else if (this.loading) {
462
450
  // Re-attach select input.
@@ -114,7 +114,12 @@ export default class TextFieldComponent extends Input {
114
114
  // If no value is provided, then set the defaultValue.
115
115
  if (!value.value) {
116
116
  const defaultValue = flags.noDefault ? this.emptyValue : this.defaultValue;
117
- value.value = Array.isArray(defaultValue) ? defaultValue[0] : defaultValue;
117
+ if (Array.isArray(defaultValue)) {
118
+ value.value = _.isObject(defaultValue[0]) ? defaultValue[0].value : defaultValue;
119
+ }
120
+ else {
121
+ value.value = _.isObject(defaultValue) ? defaultValue.value : defaultValue;
122
+ }
118
123
  }
119
124
  return value;
120
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6109.79f22ad",
3
+ "version": "5.1.0-dev.6113.1a173e6",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {