@formio/js 5.1.0-dev.5972.fc33c16 → 5.1.0-dev.5976.b0f317d

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 (40) hide show
  1. package/dist/formio.builder.css +26 -24
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.js +1 -1
  4. package/dist/formio.embed.min.js +1 -1
  5. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  6. package/dist/formio.form.css +26 -24
  7. package/dist/formio.form.js +12 -12
  8. package/dist/formio.form.min.css +1 -1
  9. package/dist/formio.form.min.js +1 -1
  10. package/dist/formio.form.min.js.LICENSE.txt +3 -3
  11. package/dist/formio.full.css +26 -24
  12. package/dist/formio.full.js +12 -12
  13. package/dist/formio.full.min.css +2 -2
  14. package/dist/formio.full.min.js +1 -1
  15. package/dist/formio.full.min.js.LICENSE.txt +3 -3
  16. package/dist/formio.js +6 -6
  17. package/dist/formio.min.js +1 -1
  18. package/dist/formio.min.js.LICENSE.txt +1 -1
  19. package/dist/formio.utils.js +4 -4
  20. package/dist/formio.utils.min.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  22. package/lib/cjs/Embed.js +1 -1
  23. package/lib/cjs/Formio.js +1 -1
  24. package/lib/cjs/components/_classes/component/Component.js +1 -1
  25. package/lib/cjs/components/address/Address.js +1 -1
  26. package/lib/cjs/components/select/Select.d.ts +0 -1
  27. package/lib/cjs/components/select/Select.js +2 -22
  28. package/lib/cjs/components/tags/Tags.js +1 -1
  29. package/lib/cjs/utils/ChoicesWrapper.d.ts +3 -24
  30. package/lib/cjs/utils/ChoicesWrapper.js +47 -124
  31. package/lib/mjs/Embed.js +1 -1
  32. package/lib/mjs/Formio.js +1 -1
  33. package/lib/mjs/components/_classes/component/Component.js +1 -1
  34. package/lib/mjs/components/address/Address.js +1 -1
  35. package/lib/mjs/components/select/Select.d.ts +0 -1
  36. package/lib/mjs/components/select/Select.js +2 -22
  37. package/lib/mjs/components/tags/Tags.js +1 -1
  38. package/lib/mjs/utils/ChoicesWrapper.d.ts +3 -24
  39. package/lib/mjs/utils/ChoicesWrapper.js +26 -119
  40. package/package.json +4 -4
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.2.3 | (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.3/LICENSE */
22
22
 
23
- /*! formiojs v5.1.0-dev.1 | https://unpkg.com/formiojs@5.1.0-dev.1/LICENSE.txt */
23
+ /*! formiojs v5.1.0-dev.2 | https://unpkg.com/formiojs@5.1.0-dev.2/LICENSE.txt */
24
24
 
25
25
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
26
26
 
package/lib/cjs/Embed.js CHANGED
@@ -418,7 +418,7 @@ Formio.formioReady = new Promise((ready, reject) => {
418
418
  _a._formioReady = ready;
419
419
  _a._formioReadyReject = reject;
420
420
  });
421
- Formio.version = 'FORMIO_VERSION';
421
+ Formio.version = '5.1.0-dev.2';
422
422
  // Create a report.
423
423
  Formio.Report = {
424
424
  create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
package/lib/cjs/Formio.js CHANGED
@@ -11,7 +11,7 @@ const CDN_1 = __importDefault(require("./CDN"));
11
11
  const providers_1 = __importDefault(require("./providers"));
12
12
  sdk_1.Formio.cdn = new CDN_1.default();
13
13
  sdk_1.Formio.Providers = providers_1.default;
14
- sdk_1.Formio.version = 'FORMIO_VERSION';
14
+ sdk_1.Formio.version = '5.1.0-dev.2';
15
15
  CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
16
16
  const isNil = (val) => val === null || val === undefined;
17
17
  sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
@@ -1296,7 +1296,7 @@ class Component extends Element_1.default {
1296
1296
  detach() {
1297
1297
  // First iterate through each ref and delete the component so there are no dangling component references.
1298
1298
  lodash_1.default.each(this.refs, (ref) => {
1299
- if ((window === null || window === void 0 ? void 0 : window.NodeList) && ref instanceof NodeList) {
1299
+ if (typeof ref === NodeList) {
1300
1300
  ref.forEach((elem) => {
1301
1301
  delete elem.component;
1302
1302
  });
@@ -218,7 +218,7 @@ class AddressComponent extends Container_1.default {
218
218
  super.dataValue = value;
219
219
  }
220
220
  get dataValue() {
221
- const resultValue = lodash_1.default.get(this._data, this.component.path);
221
+ const resultValue = lodash_1.default.get(this._data, this.path);
222
222
  if (!lodash_1.default.isArray(resultValue) && this.component.multiple) {
223
223
  return [resultValue];
224
224
  }
@@ -126,7 +126,6 @@ export default class SelectComponent extends ListComponent {
126
126
  get isLoadingAvailable(): any;
127
127
  onScroll(): void;
128
128
  attachRefreshOnBlur(): void;
129
- addPlaceholderItem(placeholderValue: any): void;
130
129
  update(): void;
131
130
  addCurrentChoices(values: any, items: any, keyValue: any): any;
132
131
  getValueAsString(data: any, options: any): any;
@@ -767,8 +767,8 @@ class SelectComponent extends ListComponent_1.default {
767
767
  distance: 1000,
768
768
  };
769
769
  return Object.assign({ removeItemButton: this.component.disabled ? false : lodash_1.default.get(this.component, 'removeItemButton', true), itemSelectText: '', classNames: {
770
- containerOuter: 'choices form-group formio-choices',
771
- containerInner: this.transform('class', 'form-control ui fluid selection dropdown')
770
+ containerOuter: ['choices', 'form-group', 'formio-choices'],
771
+ containerInner: this.transform('class', 'form-control ui fluid selection dropdown').split(' '),
772
772
  }, addItemText: false, allowHTML: true, placeholder: !!this.component.placeholder, placeholderValue: placeholderValue, noResultsText: this.t('noResultsFound'), noChoicesText: this.t('noChoices'), searchPlaceholderValue: this.t('typeToSearch'), shouldSort: false, position: (this.component.dropdown || 'auto'), searchEnabled: useSearch, searchChoices: !this.component.searchField, searchFields: lodash_1.default.get(this, 'component.searchFields', ['label']), shadowRoot: this.root ? this.root.shadowRoot : null, fuseOptions: this.component.useExactSearch
773
773
  ? Object.assign({ tokenize: true, matchAllTokens: true }, commonFuseOptions) : Object.assign({}, lodash_1.default.get(this, 'component.fuseOptions', {}), Object.assign({ include: 'score', threshold: lodash_1.default.get(this, 'component.selectThreshold', 0.3) }, commonFuseOptions)), valueComparer: lodash_1.default.isEqual, resetScrollPosition: false }, customOptions);
774
774
  }
@@ -902,12 +902,6 @@ class SelectComponent extends ListComponent_1.default {
902
902
  this.positionDropdown();
903
903
  });
904
904
  }
905
- if (this.choices && choicesOptions.placeholderValue && this.choices._isSelectOneElement) {
906
- this.addPlaceholderItem(choicesOptions.placeholderValue);
907
- this.addEventListener(input, 'removeItem', () => {
908
- this.addPlaceholderItem(choicesOptions.placeholderValue);
909
- });
910
- }
911
905
  // Add value options.
912
906
  this.addValueOptions();
913
907
  this.setChoicesValue(this.dataValue);
@@ -995,20 +989,6 @@ class SelectComponent extends ListComponent_1.default {
995
989
  });
996
990
  }
997
991
  }
998
- addPlaceholderItem(placeholderValue) {
999
- const items = this.choices._store.activeItems;
1000
- if (!items.length) {
1001
- this.choices._addItem({
1002
- value: '',
1003
- label: placeholderValue,
1004
- choiceId: 0,
1005
- groupId: -1,
1006
- customProperties: null,
1007
- placeholder: true,
1008
- keyCode: null
1009
- });
1010
- }
1011
- }
1012
992
  /* eslint-enable max-statements */
1013
993
  update() {
1014
994
  if (this.component.dataSrc === 'custom') {
@@ -129,7 +129,7 @@ class TagsComponent extends Input_1.default {
129
129
  const changed = super.setValue(value, flags);
130
130
  if (this.choices) {
131
131
  let dataValue = this.dataValue;
132
- this.choices.removeActiveItems();
132
+ this.choices.clearStore();
133
133
  if (dataValue) {
134
134
  if (typeof dataValue === 'string') {
135
135
  dataValue = dataValue.split(this.delimiter).filter(result => result);
@@ -1,38 +1,17 @@
1
- export namespace KEY_CODES {
2
- let BACK_KEY: number;
3
- let DELETE_KEY: number;
4
- let TAB_KEY: number;
5
- let ENTER_KEY: number;
6
- let A_KEY: number;
7
- let ESC_KEY: number;
8
- let UP_KEY: number;
9
- let DOWN_KEY: number;
10
- let PAGE_UP_KEY: number;
11
- let PAGE_DOWN_KEY: number;
12
- }
13
1
  export default ChoicesWrapper;
14
2
  declare class ChoicesWrapper extends Choices {
15
3
  constructor(...args: any[]);
16
- _onTabKey({ activeItems, hasActiveDropdown }: {
17
- activeItems: any;
18
- hasActiveDropdown: any;
19
- }): void;
4
+ _onTabKey(): void;
20
5
  isDirectionUsing: boolean;
21
6
  shouldOpenDropDown: boolean;
22
7
  _onTouchEnd(event: any): void;
23
- _handleButtonAction(activeItems: any, element: any): void;
24
- _onEnterKey(args: any): void;
8
+ _onEnterKey(...args: any[]): void;
25
9
  _onDirectionKey(...args: any[]): void;
26
10
  timeout: NodeJS.Timeout | undefined;
27
11
  _selectHighlightedChoice(): void;
28
12
  _onKeyDown(event: any): void;
29
- onSelectValue({ event, activeItems, hasActiveDropdown }: {
30
- event: any;
31
- activeItems: any;
32
- hasActiveDropdown: any;
33
- }): void;
13
+ onSelectValue(event: any, hasActiveDropdown: any): void;
34
14
  showDropdown(...args: any[]): void;
35
15
  hideDropdown(...args: any[]): void;
36
- _onBlur(...args: any[]): void;
37
16
  }
38
17
  import Choices from '@formio/choices.js';
@@ -1,48 +1,30 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.KEY_CODES = void 0;
7
- const choices_js_1 = __importDefault(require("@formio/choices.js"));
8
- /**
9
- * TODO: REMOVE THIS ONCE THE PULL REQUEST HAS BEEN RESOLVED.
10
- *
11
- * https://github.com/jshjohnson/Choices/pull/788
12
- *
13
- * This is intentionally not part of the extended class, since other components use Choices and need this fix as well.
14
- * @type {Choices._generatePlaceholderValue}
15
- * @private
16
- */
17
- choices_js_1.default.prototype._generatePlaceholderValue = function () {
18
- if (this._isSelectElement && this.passedElement.placeholderOption) {
19
- const { placeholderOption } = this.passedElement;
20
- return placeholderOption ? placeholderOption.text : false;
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
21
7
  }
22
- const { placeholder, placeholderValue } = this.config;
23
- const { element: { dataset }, } = this.passedElement;
24
- if (placeholder) {
25
- if (placeholderValue) {
26
- return placeholderValue;
27
- }
28
- if (dataset.placeholder) {
29
- return dataset.placeholder;
30
- }
31
- }
32
- return false;
33
- };
34
- exports.KEY_CODES = {
35
- BACK_KEY: 46,
36
- DELETE_KEY: 8,
37
- TAB_KEY: 9,
38
- ENTER_KEY: 13,
39
- A_KEY: 65,
40
- ESC_KEY: 27,
41
- UP_KEY: 38,
42
- DOWN_KEY: 40,
43
- PAGE_UP_KEY: 33,
44
- PAGE_DOWN_KEY: 34,
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
45
24
  };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const choices_js_1 = __importStar(require("@formio/choices.js"));
27
+ const ExtendedKeyCodeMap = Object.assign(Object.assign({}, choices_js_1.KeyCodeMap), { TAB_KEY: 9 });
46
28
  class ChoicesWrapper extends choices_js_1.default {
47
29
  constructor(...args) {
48
30
  super(...args);
@@ -69,24 +51,13 @@ class ChoicesWrapper extends choices_js_1.default {
69
51
  }
70
52
  this._wasTap = true;
71
53
  }
72
- _handleButtonAction(activeItems, element) {
73
- if (!this._isSelectOneElement) {
74
- return super._handleButtonAction(activeItems, element);
75
- }
76
- if (!activeItems ||
77
- !element ||
78
- !this.config.removeItems ||
79
- !this.config.removeItemButton) {
80
- return;
81
- }
82
- super._handleButtonAction(activeItems, element);
83
- }
84
- _onEnterKey(args) {
54
+ _onEnterKey(...args) {
55
+ const [event] = args;
85
56
  // Prevent dropdown form opening when removeItemButton was pressed using 'Enter' on keyboard
86
- if (args.event.target.className === 'choices__button') {
57
+ if (event.target.className === 'choices__button') {
87
58
  this.shouldOpenDropDown = false;
88
59
  }
89
- super._onEnterKey(args);
60
+ super._onEnterKey(...args);
90
61
  }
91
62
  _onDirectionKey(...args) {
92
63
  if (!this._isSelectOneElement) {
@@ -100,17 +71,18 @@ class ChoicesWrapper extends choices_js_1.default {
100
71
  this.isDirectionUsing = false;
101
72
  }, 250);
102
73
  }
103
- _onTabKey({ activeItems, hasActiveDropdown }) {
104
- if (hasActiveDropdown) {
105
- this._selectHighlightedChoice(activeItems);
74
+ _onTabKey() {
75
+ if (this.dropdown.isActive) {
76
+ this._selectHighlightedChoice();
106
77
  }
107
78
  }
108
79
  _selectHighlightedChoice() {
109
- const highlightedChoice = this.dropdown.getChild(`.${this.config.classNames.highlightedState}`);
80
+ const highlightedChoice = this.dropdown.element.querySelector(`.${this.config.classNames.highlightedState}`);
110
81
  if (highlightedChoice) {
111
82
  const id = highlightedChoice.dataset.id;
112
- const choice = id && this._store.getChoiceById(id);
83
+ const choice = id && this._store.getChoiceById(Number(id));
113
84
  this._addItem({
85
+ id: choice.id,
114
86
  value: choice.value,
115
87
  label: choice.label,
116
88
  choiceId: choice.id,
@@ -121,61 +93,16 @@ class ChoicesWrapper extends choices_js_1.default {
121
93
  });
122
94
  this._triggerChange(choice.value);
123
95
  }
124
- event.preventDefault();
125
96
  }
126
97
  _onKeyDown(event) {
127
- if (!this._isSelectOneElement) {
128
- return super._onKeyDown(event);
129
- }
130
- const { target, keyCode, ctrlKey, metaKey } = event;
131
- if (target !== this.input.element &&
132
- !this.containerOuter.element.contains(target)) {
133
- return;
134
- }
135
- const activeItems = this._store.activeItems;
136
- const hasFocusedInput = this.input.isFocussed;
137
- const hasActiveDropdown = this.dropdown.isActive;
138
- const hasItems = this.itemList.hasChildren;
139
- const keyString = String.fromCharCode(keyCode);
140
- const { BACK_KEY, DELETE_KEY, TAB_KEY, ENTER_KEY, A_KEY, ESC_KEY, UP_KEY, DOWN_KEY, PAGE_UP_KEY, PAGE_DOWN_KEY, } = exports.KEY_CODES;
141
- const hasCtrlDownKeyPressed = ctrlKey || metaKey;
142
- // If a user is typing and the dropdown is not active
143
- if (!hasActiveDropdown && !this._isTextElement && /[a-zA-Z0-9-_ ]/.test(keyString)) {
144
- const currentValue = this.input.element.value;
145
- this.input.element.value = currentValue ? `${currentValue}${keyString}` : keyString;
146
- this.showDropdown();
147
- }
148
- // Map keys to key actions
149
- const keyDownActions = {
150
- [A_KEY]: this._onAKey,
151
- [TAB_KEY]: this._onTabKey,
152
- [ENTER_KEY]: this._onEnterKey,
153
- [ESC_KEY]: this._onEscapeKey,
154
- [UP_KEY]: this._onDirectionKey,
155
- [PAGE_UP_KEY]: this._onDirectionKey,
156
- [DOWN_KEY]: this._onDirectionKey,
157
- [PAGE_DOWN_KEY]: this._onDirectionKey,
158
- [DELETE_KEY]: this._onDeleteKey,
159
- [BACK_KEY]: this._onDeleteKey,
160
- };
161
- // If keycode has a function, run it
162
- if (keyDownActions[keyCode]) {
163
- keyDownActions[keyCode]({
164
- event,
165
- target,
166
- keyCode,
167
- metaKey,
168
- activeItems,
169
- hasFocusedInput,
170
- hasActiveDropdown,
171
- hasItems,
172
- hasCtrlDownKeyPressed,
173
- });
174
- }
98
+ const keyCode = event.keyCode;
99
+ return this._isSelectOneElement && keyCode === ExtendedKeyCodeMap.TAB_KEY
100
+ ? this._onTabKey()
101
+ : super._onKeyDown(event);
175
102
  }
176
- onSelectValue({ event, activeItems, hasActiveDropdown }) {
103
+ onSelectValue(event, hasActiveDropdown) {
177
104
  if (hasActiveDropdown) {
178
- this._selectHighlightedChoice(activeItems);
105
+ this._selectHighlightedChoice();
179
106
  }
180
107
  else if (this._isSelectOneElement) {
181
108
  this.showDropdown();
@@ -183,11 +110,13 @@ class ChoicesWrapper extends choices_js_1.default {
183
110
  }
184
111
  }
185
112
  showDropdown(...args) {
186
- if (!this.shouldOpenDropDown) {
187
- this.shouldOpenDropDown = true;
188
- return;
189
- }
190
- super.showDropdown(...args);
113
+ setTimeout(() => {
114
+ if (!this.shouldOpenDropDown) {
115
+ this.shouldOpenDropDown = true;
116
+ return;
117
+ }
118
+ super.showDropdown(...args);
119
+ }, 0);
191
120
  }
192
121
  hideDropdown(...args) {
193
122
  if (this.isDirectionUsing) {
@@ -195,11 +124,5 @@ class ChoicesWrapper extends choices_js_1.default {
195
124
  }
196
125
  super.hideDropdown(...args);
197
126
  }
198
- _onBlur(...args) {
199
- if (this._isScrollingOnIe) {
200
- return;
201
- }
202
- super._onBlur(...args);
203
- }
204
127
  }
205
128
  exports.default = ChoicesWrapper;
package/lib/mjs/Embed.js CHANGED
@@ -14,7 +14,7 @@ export class Formio {
14
14
  Formio._formioReady = ready;
15
15
  Formio._formioReadyReject = reject;
16
16
  });
17
- static version = 'FORMIO_VERSION';
17
+ static version = '5.1.0-dev.2';
18
18
  static setLicense(license, norecurse = false) {
19
19
  Formio.license = license;
20
20
  if (!norecurse && Formio.FormioClass) {
package/lib/mjs/Formio.js CHANGED
@@ -4,7 +4,7 @@ import CDN from './CDN';
4
4
  import Providers from './providers';
5
5
  FormioCore.cdn = new CDN();
6
6
  FormioCore.Providers = Providers;
7
- FormioCore.version = 'FORMIO_VERSION';
7
+ FormioCore.version = '5.1.0-dev.2';
8
8
  CDN.defaultCDN = FormioCore.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
9
9
  const isNil = (val) => val === null || val === undefined;
10
10
  FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
@@ -1264,7 +1264,7 @@ export default class Component extends Element {
1264
1264
  detach() {
1265
1265
  // First iterate through each ref and delete the component so there are no dangling component references.
1266
1266
  _.each(this.refs, (ref) => {
1267
- if (window?.NodeList && ref instanceof NodeList) {
1267
+ if (typeof ref === NodeList) {
1268
1268
  ref.forEach((elem) => {
1269
1269
  delete elem.component;
1270
1270
  });
@@ -214,7 +214,7 @@ export default class AddressComponent extends ContainerComponent {
214
214
  super.dataValue = value;
215
215
  }
216
216
  get dataValue() {
217
- const resultValue = _.get(this._data, this.component.path);
217
+ const resultValue = _.get(this._data, this.path);
218
218
  if (!_.isArray(resultValue) && this.component.multiple) {
219
219
  return [resultValue];
220
220
  }
@@ -126,7 +126,6 @@ export default class SelectComponent extends ListComponent {
126
126
  get isLoadingAvailable(): any;
127
127
  onScroll(): void;
128
128
  attachRefreshOnBlur(): void;
129
- addPlaceholderItem(placeholderValue: any): void;
130
129
  update(): void;
131
130
  addCurrentChoices(values: any, items: any, keyValue: any): any;
132
131
  getValueAsString(data: any, options: any): any;
@@ -772,8 +772,8 @@ export default class SelectComponent extends ListComponent {
772
772
  removeItemButton: this.component.disabled ? false : _.get(this.component, 'removeItemButton', true),
773
773
  itemSelectText: '',
774
774
  classNames: {
775
- containerOuter: 'choices form-group formio-choices',
776
- containerInner: this.transform('class', 'form-control ui fluid selection dropdown')
775
+ containerOuter: ['choices', 'form-group', 'formio-choices'],
776
+ containerInner: this.transform('class', 'form-control ui fluid selection dropdown').split(' '),
777
777
  },
778
778
  addItemText: false,
779
779
  allowHTML: true,
@@ -933,12 +933,6 @@ export default class SelectComponent extends ListComponent {
933
933
  this.positionDropdown();
934
934
  });
935
935
  }
936
- if (this.choices && choicesOptions.placeholderValue && this.choices._isSelectOneElement) {
937
- this.addPlaceholderItem(choicesOptions.placeholderValue);
938
- this.addEventListener(input, 'removeItem', () => {
939
- this.addPlaceholderItem(choicesOptions.placeholderValue);
940
- });
941
- }
942
936
  // Add value options.
943
937
  this.addValueOptions();
944
938
  this.setChoicesValue(this.dataValue);
@@ -1024,20 +1018,6 @@ export default class SelectComponent extends ListComponent {
1024
1018
  });
1025
1019
  }
1026
1020
  }
1027
- addPlaceholderItem(placeholderValue) {
1028
- const items = this.choices._store.activeItems;
1029
- if (!items.length) {
1030
- this.choices._addItem({
1031
- value: '',
1032
- label: placeholderValue,
1033
- choiceId: 0,
1034
- groupId: -1,
1035
- customProperties: null,
1036
- placeholder: true,
1037
- keyCode: null
1038
- });
1039
- }
1040
- }
1041
1021
  /* eslint-enable max-statements */
1042
1022
  update() {
1043
1023
  if (this.component.dataSrc === 'custom') {
@@ -127,7 +127,7 @@ export default class TagsComponent extends Input {
127
127
  const changed = super.setValue(value, flags);
128
128
  if (this.choices) {
129
129
  let dataValue = this.dataValue;
130
- this.choices.removeActiveItems();
130
+ this.choices.clearStore();
131
131
  if (dataValue) {
132
132
  if (typeof dataValue === 'string') {
133
133
  dataValue = dataValue.split(this.delimiter).filter(result => result);
@@ -1,38 +1,17 @@
1
- export namespace KEY_CODES {
2
- let BACK_KEY: number;
3
- let DELETE_KEY: number;
4
- let TAB_KEY: number;
5
- let ENTER_KEY: number;
6
- let A_KEY: number;
7
- let ESC_KEY: number;
8
- let UP_KEY: number;
9
- let DOWN_KEY: number;
10
- let PAGE_UP_KEY: number;
11
- let PAGE_DOWN_KEY: number;
12
- }
13
1
  export default ChoicesWrapper;
14
2
  declare class ChoicesWrapper extends Choices {
15
3
  constructor(...args: any[]);
16
- _onTabKey({ activeItems, hasActiveDropdown }: {
17
- activeItems: any;
18
- hasActiveDropdown: any;
19
- }): void;
4
+ _onTabKey(): void;
20
5
  isDirectionUsing: boolean;
21
6
  shouldOpenDropDown: boolean;
22
7
  _onTouchEnd(event: any): void;
23
- _handleButtonAction(activeItems: any, element: any): void;
24
- _onEnterKey(args: any): void;
8
+ _onEnterKey(...args: any[]): void;
25
9
  _onDirectionKey(...args: any[]): void;
26
10
  timeout: NodeJS.Timeout | undefined;
27
11
  _selectHighlightedChoice(): void;
28
12
  _onKeyDown(event: any): void;
29
- onSelectValue({ event, activeItems, hasActiveDropdown }: {
30
- event: any;
31
- activeItems: any;
32
- hasActiveDropdown: any;
33
- }): void;
13
+ onSelectValue(event: any, hasActiveDropdown: any): void;
34
14
  showDropdown(...args: any[]): void;
35
15
  hideDropdown(...args: any[]): void;
36
- _onBlur(...args: any[]): void;
37
16
  }
38
17
  import Choices from '@formio/choices.js';