selectic 3.1.3 → 3.1.4

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.
@@ -2566,42 +2566,6 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
2566
2566
  }
2567
2567
  return '';
2568
2568
  }
2569
- get onKeyDown() {
2570
- return (evt) => {
2571
- const key = evt.key;
2572
- if (key === 'Escape') {
2573
- this.store.commit('isOpen', false);
2574
- }
2575
- else if (key === 'Enter') {
2576
- const index = this.store.state.activeItemIdx;
2577
- if (index !== -1) {
2578
- const item = this.store.state.filteredOptions[index];
2579
- if (!item.disabled && !item.isGroup) {
2580
- this.store.selectItem(item.id);
2581
- }
2582
- }
2583
- evt.stopPropagation();
2584
- evt.preventDefault();
2585
- }
2586
- else if (key === 'ArrowUp') {
2587
- const index = this.store.state.activeItemIdx;
2588
- if (index > 0) {
2589
- this.store.commit('activeItemIdx', index - 1);
2590
- }
2591
- evt.stopPropagation();
2592
- evt.preventDefault();
2593
- }
2594
- else if (key === 'ArrowDown') {
2595
- const index = this.store.state.activeItemIdx;
2596
- const max = this.store.state.totalFilteredOptions - 1;
2597
- if (index < max) {
2598
- this.store.commit('activeItemIdx', index + 1);
2599
- }
2600
- evt.stopPropagation();
2601
- evt.preventDefault();
2602
- }
2603
- };
2604
- }
2605
2569
  get bestPosition() {
2606
2570
  const windowHeight = window.innerHeight;
2607
2571
  const isFullyEstimated = this.isFullyEstimated;
@@ -2717,6 +2681,40 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
2717
2681
  clickHeaderGroup() {
2718
2682
  this.store.selectGroup(this.topGroupId, !this.topGroupSelected);
2719
2683
  }
2684
+ onKeyDown(evt) {
2685
+ const key = evt.key;
2686
+ if (key === 'Escape') {
2687
+ this.store.commit('isOpen', false);
2688
+ }
2689
+ else if (key === 'Enter') {
2690
+ const index = this.store.state.activeItemIdx;
2691
+ if (index !== -1) {
2692
+ const item = this.store.state.filteredOptions[index];
2693
+ if (!item.disabled && !item.isGroup) {
2694
+ this.store.selectItem(item.id);
2695
+ }
2696
+ }
2697
+ evt.stopPropagation();
2698
+ evt.preventDefault();
2699
+ }
2700
+ else if (key === 'ArrowUp') {
2701
+ const index = this.store.state.activeItemIdx;
2702
+ if (index > 0) {
2703
+ this.store.commit('activeItemIdx', index - 1);
2704
+ }
2705
+ evt.stopPropagation();
2706
+ evt.preventDefault();
2707
+ }
2708
+ else if (key === 'ArrowDown') {
2709
+ const index = this.store.state.activeItemIdx;
2710
+ const max = this.store.state.totalFilteredOptions - 1;
2711
+ if (index < max) {
2712
+ this.store.commit('activeItemIdx', index + 1);
2713
+ }
2714
+ evt.stopPropagation();
2715
+ evt.preventDefault();
2716
+ }
2717
+ }
2720
2718
  /* }}} */
2721
2719
  /* {{{ Life cycles */
2722
2720
  mounted() {
@@ -2562,42 +2562,6 @@ let ExtendedList = class ExtendedList extends Vue {
2562
2562
  }
2563
2563
  return '';
2564
2564
  }
2565
- get onKeyDown() {
2566
- return (evt) => {
2567
- const key = evt.key;
2568
- if (key === 'Escape') {
2569
- this.store.commit('isOpen', false);
2570
- }
2571
- else if (key === 'Enter') {
2572
- const index = this.store.state.activeItemIdx;
2573
- if (index !== -1) {
2574
- const item = this.store.state.filteredOptions[index];
2575
- if (!item.disabled && !item.isGroup) {
2576
- this.store.selectItem(item.id);
2577
- }
2578
- }
2579
- evt.stopPropagation();
2580
- evt.preventDefault();
2581
- }
2582
- else if (key === 'ArrowUp') {
2583
- const index = this.store.state.activeItemIdx;
2584
- if (index > 0) {
2585
- this.store.commit('activeItemIdx', index - 1);
2586
- }
2587
- evt.stopPropagation();
2588
- evt.preventDefault();
2589
- }
2590
- else if (key === 'ArrowDown') {
2591
- const index = this.store.state.activeItemIdx;
2592
- const max = this.store.state.totalFilteredOptions - 1;
2593
- if (index < max) {
2594
- this.store.commit('activeItemIdx', index + 1);
2595
- }
2596
- evt.stopPropagation();
2597
- evt.preventDefault();
2598
- }
2599
- };
2600
- }
2601
2565
  get bestPosition() {
2602
2566
  const windowHeight = window.innerHeight;
2603
2567
  const isFullyEstimated = this.isFullyEstimated;
@@ -2713,6 +2677,40 @@ let ExtendedList = class ExtendedList extends Vue {
2713
2677
  clickHeaderGroup() {
2714
2678
  this.store.selectGroup(this.topGroupId, !this.topGroupSelected);
2715
2679
  }
2680
+ onKeyDown(evt) {
2681
+ const key = evt.key;
2682
+ if (key === 'Escape') {
2683
+ this.store.commit('isOpen', false);
2684
+ }
2685
+ else if (key === 'Enter') {
2686
+ const index = this.store.state.activeItemIdx;
2687
+ if (index !== -1) {
2688
+ const item = this.store.state.filteredOptions[index];
2689
+ if (!item.disabled && !item.isGroup) {
2690
+ this.store.selectItem(item.id);
2691
+ }
2692
+ }
2693
+ evt.stopPropagation();
2694
+ evt.preventDefault();
2695
+ }
2696
+ else if (key === 'ArrowUp') {
2697
+ const index = this.store.state.activeItemIdx;
2698
+ if (index > 0) {
2699
+ this.store.commit('activeItemIdx', index - 1);
2700
+ }
2701
+ evt.stopPropagation();
2702
+ evt.preventDefault();
2703
+ }
2704
+ else if (key === 'ArrowDown') {
2705
+ const index = this.store.state.activeItemIdx;
2706
+ const max = this.store.state.totalFilteredOptions - 1;
2707
+ if (index < max) {
2708
+ this.store.commit('activeItemIdx', index + 1);
2709
+ }
2710
+ evt.stopPropagation();
2711
+ evt.preventDefault();
2712
+ }
2713
+ }
2716
2714
  /* }}} */
2717
2715
  /* {{{ Life cycles */
2718
2716
  mounted() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "selectic",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "Smart Select for VueJS 3.x",
5
5
  "main": "dist/selectic.common.js",
6
6
  "module": "dist/selectic.esm.js",
@@ -97,48 +97,6 @@ export default class ExtendedList extends Vue<Props> {
97
97
  return '';
98
98
  }
99
99
 
100
- get onKeyDown() {
101
- return (evt: KeyboardEvent) => {
102
- const key = evt.key;
103
-
104
- if (key === 'Escape') {
105
- this.store.commit('isOpen', false);
106
- } else
107
- if (key === 'Enter') {
108
- const index = this.store.state.activeItemIdx;
109
-
110
- if (index !== -1) {
111
- const item = this.store.state.filteredOptions[index];
112
-
113
- if (!item.disabled && !item.isGroup) {
114
- this.store.selectItem(item.id);
115
- }
116
- }
117
- evt.stopPropagation();
118
- evt.preventDefault();
119
- } else
120
- if (key === 'ArrowUp') {
121
- const index = this.store.state.activeItemIdx;
122
-
123
- if (index > 0) {
124
- this.store.commit('activeItemIdx', index - 1);
125
- }
126
- evt.stopPropagation();
127
- evt.preventDefault();
128
- } else
129
- if (key === 'ArrowDown') {
130
- const index = this.store.state.activeItemIdx;
131
- const max = this.store.state.totalFilteredOptions - 1;
132
-
133
- if (index < max) {
134
- this.store.commit('activeItemIdx', index + 1);
135
- }
136
- evt.stopPropagation();
137
- evt.preventDefault();
138
- }
139
- };
140
- }
141
-
142
100
  get bestPosition(): 'top' | 'bottom' {
143
101
  const windowHeight = window.innerHeight;
144
102
  const isFullyEstimated = this.isFullyEstimated;
@@ -288,6 +246,46 @@ export default class ExtendedList extends Vue<Props> {
288
246
  this.store.selectGroup(this.topGroupId, !this.topGroupSelected);
289
247
  }
290
248
 
249
+ private onKeyDown(evt: KeyboardEvent) {
250
+ const key = evt.key;
251
+
252
+ if (key === 'Escape') {
253
+ this.store.commit('isOpen', false);
254
+ } else
255
+ if (key === 'Enter') {
256
+ const index = this.store.state.activeItemIdx;
257
+
258
+ if (index !== -1) {
259
+ const item = this.store.state.filteredOptions[index];
260
+
261
+ if (!item.disabled && !item.isGroup) {
262
+ this.store.selectItem(item.id);
263
+ }
264
+ }
265
+ evt.stopPropagation();
266
+ evt.preventDefault();
267
+ } else
268
+ if (key === 'ArrowUp') {
269
+ const index = this.store.state.activeItemIdx;
270
+
271
+ if (index > 0) {
272
+ this.store.commit('activeItemIdx', index - 1);
273
+ }
274
+ evt.stopPropagation();
275
+ evt.preventDefault();
276
+ } else
277
+ if (key === 'ArrowDown') {
278
+ const index = this.store.state.activeItemIdx;
279
+ const max = this.store.state.totalFilteredOptions - 1;
280
+
281
+ if (index < max) {
282
+ this.store.commit('activeItemIdx', index + 1);
283
+ }
284
+ evt.stopPropagation();
285
+ evt.preventDefault();
286
+ }
287
+ }
288
+
291
289
  /* }}} */
292
290
  /* {{{ Life cycles */
293
291
 
@@ -26,7 +26,6 @@ export default class ExtendedList extends Vue<Props> {
26
26
  get searching(): boolean;
27
27
  get errorMessage(): string;
28
28
  get infoMessage(): string;
29
- get onKeyDown(): (evt: KeyboardEvent) => void;
30
29
  get bestPosition(): 'top' | 'bottom';
31
30
  get position(): 'top' | 'bottom';
32
31
  get horizontalStyle(): string;
@@ -39,6 +38,7 @@ export default class ExtendedList extends Vue<Props> {
39
38
  private getGroup;
40
39
  private computeListSize;
41
40
  private clickHeaderGroup;
41
+ private onKeyDown;
42
42
  mounted(): void;
43
43
  unmounted(): void;
44
44
  render(): h.JSX.Element;