@formio/js 5.1.0-dev.6105.96dde7b → 5.1.0-dev.6109.79f22ad

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.
@@ -20,6 +20,8 @@
20
20
 
21
21
  /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
22
22
 
23
+ /*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */
24
+
23
25
  /*! formiojs v5.1.0-dev.2 | https://unpkg.com/formiojs@5.1.0-dev.2/LICENSE.txt */
24
26
 
25
27
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -89,6 +89,7 @@ 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;
92
93
  setItems(items: any, fromSearch: any): void;
93
94
  selectItems: any;
94
95
  set downloadedResources(value: any);
@@ -355,6 +355,18 @@ 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
+ }
358
370
  /* eslint-disable max-statements */
359
371
  setItems(items, fromSearch) {
360
372
  var _a, _b;
@@ -441,7 +453,7 @@ class SelectComponent extends ListComponent_1.default {
441
453
  this.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, lodash_1.default.get(item, this.component.idPath, String(index)));
442
454
  });
443
455
  if (this.choices) {
444
- this.choices.setChoices(this.selectOptions, 'value', 'label', true);
456
+ this.choices.setChoices(this.selectOptions, 'value', 'label', true, true, !fromSearch && this.shouldResetChoicesItems(this.selectOptions));
445
457
  }
446
458
  else if (this.loading) {
447
459
  // Re-attach select input.
@@ -89,6 +89,7 @@ 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;
92
93
  setItems(items: any, fromSearch: any): void;
93
94
  selectItems: any;
94
95
  set downloadedResources(value: any);
@@ -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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6105.96dde7b",
3
+ "version": "5.1.0-dev.6109.79f22ad",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -86,7 +86,7 @@
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",
88
88
  "autocompleter": "^8.0.4",
89
- "bootstrap": "^5.3.3",
89
+ "bootstrap": "^5.3.4",
90
90
  "browser-cookies": "^1.2.0",
91
91
  "browser-md5-file": "^1.1.1",
92
92
  "choices.js": "^11.0.6",
@@ -94,7 +94,7 @@
94
94
  "core-js": "^3.37.1",
95
95
  "dialog-polyfill": "^0.5.6",
96
96
  "dom-autoscroller": "^2.3.4",
97
- "dompurify": "^3.1.6",
97
+ "dompurify": "^3.2.5",
98
98
  "downloadjs": "^1.4.7",
99
99
  "dragula": "^3.7.3",
100
100
  "eventemitter3": "^5.0.1",