slim-select 2.6.0 → 2.7.1

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 (45) hide show
  1. package/dist/render.d.ts +1 -1
  2. package/dist/settings.d.ts +1 -0
  3. package/dist/slimselect.cjs.js +43 -9
  4. package/dist/slimselect.css +1 -1
  5. package/dist/slimselect.css.map +1 -1
  6. package/dist/slimselect.es.js +43 -9
  7. package/dist/slimselect.global.js +43 -9
  8. package/dist/slimselect.js +43 -9
  9. package/dist/slimselect.min.js +1 -1
  10. package/dist/slimselect.umd.js +43 -9
  11. package/dist/slimselect.umd.min.js +1 -1
  12. package/dist/store.d.ts +2 -1
  13. package/index.html +4 -0
  14. package/package.json +50 -26
  15. package/src/react/.eslintignore +2 -0
  16. package/src/react/.eslintrc.cjs +24 -0
  17. package/src/react/index.html +14 -0
  18. package/src/react/jestconfig.json +11 -0
  19. package/src/react/package.json +32 -0
  20. package/src/react/src/frameworkpage.tsx +133 -0
  21. package/src/react/src/index.ts +3 -0
  22. package/src/react/src/slimselect.tsx +148 -0
  23. package/src/react/tests/slimselect.test.tsx +52 -0
  24. package/src/react/tsconfig.json +37 -0
  25. package/src/react/tsconfig.node.json +10 -0
  26. package/src/react/vite.config.ts +55 -0
  27. package/src/slim-select/index.test.ts +2 -2
  28. package/src/slim-select/render.ts +39 -9
  29. package/src/slim-select/select.ts +3 -2
  30. package/src/slim-select/settings.ts +2 -0
  31. package/src/slim-select/slimselect.scss +3 -2
  32. package/src/slim-select/store.ts +20 -3
  33. package/src/vue/dist/slim-select/helpers.d.ts +5 -5
  34. package/src/vue/dist/slim-select/index.d.ts +46 -46
  35. package/src/vue/dist/slim-select/render.d.ts +120 -120
  36. package/src/vue/dist/slim-select/select.d.ts +28 -28
  37. package/src/vue/dist/slim-select/settings.d.ts +33 -32
  38. package/src/vue/dist/slim-select/store.d.ts +80 -79
  39. package/src/vue/dist/slimselectvue.es.js +1940 -1911
  40. package/src/vue/dist/slimselectvue.global.js +1940 -1911
  41. package/src/vue/dist/slimselectvue.ssr.js +1940 -1911
  42. package/src/vue/dist/vue/hello.d.ts +2 -2
  43. package/src/vue/dist/vue/slimselect.vue.d.ts +324 -317
  44. package/src/vue/slimselect.vue +2 -7
  45. package/tsconfig.json +1 -1
@@ -6,7 +6,7 @@ export interface Callbacks {
6
6
  open: () => void
7
7
  close: () => void
8
8
  addable?: (value: string) => Promise<OptionOptional | string> | OptionOptional | string | false | undefined | null
9
- setSelected: (value: string[], runAfterChange: boolean) => void
9
+ setSelected: (value: string | string[], runAfterChange: boolean) => void
10
10
  addOption: (option: Option) => void
11
11
  search: (search: string) => void
12
12
  beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void
@@ -230,7 +230,10 @@ export default class Render {
230
230
 
231
231
  // Add id to data-id
232
232
  main.dataset.id = this.settings.id
233
- main.id = this.settings.id
233
+ // main.id = this.settings.id+'-main' // Remove for now as it is not needed
234
+
235
+ // Add label
236
+ main.setAttribute('aria-label', this.settings.ariaLabel)
234
237
 
235
238
  // Set tabable to allow tabbing to the element
236
239
  main.tabIndex = 0
@@ -238,7 +241,7 @@ export default class Render {
238
241
  // Deal with keyboard events on the main div
239
242
  // This is to allow for normal selecting
240
243
  // when you may not have a search bar
241
- main.onkeydown = (e: KeyboardEvent) => {
244
+ main.onkeydown = (e: KeyboardEvent): boolean => {
242
245
  // Convert above if else statemets to switch
243
246
  switch (e.key) {
244
247
  case 'ArrowUp':
@@ -261,10 +264,12 @@ export default class Render {
261
264
  this.callbacks.close()
262
265
  return false
263
266
  }
267
+
268
+ return false
264
269
  }
265
270
 
266
271
  // Add onclick for main div
267
- main.onclick = (e: Event) => {
272
+ main.onclick = (e: Event): void => {
268
273
  // Dont do anything if disabled
269
274
  if (this.settings.disabled) {
270
275
  return
@@ -314,7 +319,11 @@ export default class Render {
314
319
  this.callbacks.setSelected([], false)
315
320
  this.updateDeselectAll()
316
321
  } else {
317
- this.callbacks.setSelected([''], false)
322
+ // Get first option and set it as selected
323
+ const firstOption = this.store.getFirstOption()
324
+ const value = firstOption ? firstOption.value : ''
325
+
326
+ this.callbacks.setSelected(value, false)
318
327
  }
319
328
 
320
329
  // Check if we need to close the dropdown
@@ -324,7 +333,7 @@ export default class Render {
324
333
 
325
334
  // Run afterChange callback
326
335
  if (this.callbacks.afterChange) {
327
- this.callbacks.afterChange(after)
336
+ this.callbacks.afterChange(this.store.getSelectedOptions())
328
337
  }
329
338
  }
330
339
  }
@@ -624,7 +633,7 @@ export default class Render {
624
633
 
625
634
  // Add id to data-id
626
635
  main.dataset.id = this.settings.id
627
- main.id = this.settings.id
636
+ // main.id = this.settings.id + '-content' // Remove for now as it is not needed
628
637
 
629
638
  // Add search
630
639
  const search = this.searchDiv()
@@ -696,7 +705,7 @@ export default class Render {
696
705
  }, 100)
697
706
 
698
707
  // Deal with keyboard events on search input field
699
- input.onkeydown = (e: KeyboardEvent) => {
708
+ input.onkeydown = (e: KeyboardEvent): boolean => {
700
709
  // Convert above if else statemets to switch
701
710
  switch (e.key) {
702
711
  case 'ArrowUp':
@@ -727,6 +736,8 @@ export default class Render {
727
736
  }
728
737
  return true
729
738
  }
739
+
740
+ return true // Allow normal typing
730
741
  }
731
742
 
732
743
  main.appendChild(input)
@@ -867,15 +878,34 @@ export default class Render {
867
878
 
868
879
  // If length is 1, highlight it
869
880
  if (options.length === 1) {
870
- // Check if option doesnt already has highlighted class
881
+ // Check if option doesnt already have highlighted class
871
882
  if (!options[0].classList.contains(this.classes.highlighted)) {
872
883
  options[0].classList.add(this.classes.highlighted)
873
884
  return
874
885
  }
875
886
  }
876
887
 
888
+ // Loop through options and see if there are no highlighted ones
889
+ let highlighted = false
890
+ for (const o of options) {
891
+ if (o.classList.contains(this.classes.highlighted)) {
892
+ highlighted = true
893
+ }
894
+ }
895
+
896
+ // If no highlighted, see if any are selected and if so highlight selected first one
897
+ if (!highlighted) {
898
+ for (const o of options) {
899
+ if (o.classList.contains(this.classes.selected)) {
900
+ o.classList.add(this.classes.highlighted)
901
+ break
902
+ }
903
+ }
904
+ }
905
+
877
906
  // Loop through options and find the highlighted one
878
907
  for (let i = 0; i < options.length; i++) {
908
+ // Found highlighted option
879
909
  if (options[i].classList.contains(this.classes.highlighted)) {
880
910
  const prevOption = options[i]
881
911
  // Remove highlighted class from current one
@@ -17,8 +17,9 @@ export default class Select {
17
17
  constructor(select: HTMLSelectElement) {
18
18
  this.select = select
19
19
 
20
+ this.valueChange = this.valueChange.bind(this)
20
21
  // Add change event listener
21
- this.select.addEventListener('change', this.valueChange.bind(this), {
22
+ this.select.addEventListener('change', this.valueChange, {
22
23
  // allow bubbling of event
23
24
  passive: true,
24
25
  })
@@ -361,7 +362,7 @@ export default class Select {
361
362
  this.changeListen(false)
362
363
 
363
364
  // Remove event change listener
364
- this.select.removeEventListener('change', this.valueChange.bind(this))
365
+ this.select.removeEventListener('change', this.valueChange)
365
366
 
366
367
  // Disconnect observer and null
367
368
  if (this.observer) {
@@ -17,6 +17,7 @@ export default class Settings {
17
17
  public disabled: boolean
18
18
  public alwaysOpen: boolean
19
19
  public showSearch: boolean
20
+ public ariaLabel: string
20
21
  public searchPlaceholder: string
21
22
  public searchText: string
22
23
  public searchingText: string
@@ -47,6 +48,7 @@ export default class Settings {
47
48
  this.disabled = settings.disabled !== undefined ? settings.disabled : false
48
49
  this.alwaysOpen = settings.alwaysOpen !== undefined ? settings.alwaysOpen : false
49
50
  this.showSearch = settings.showSearch !== undefined ? settings.showSearch : true
51
+ this.ariaLabel = settings.ariaLabel || 'Combobox'
50
52
  this.searchPlaceholder = settings.searchPlaceholder || 'Search'
51
53
  this.searchText = settings.searchText || 'No Results'
52
54
  this.searchingText = settings.searchingText || 'Searching...'
@@ -9,6 +9,7 @@
9
9
  --ss-highlight-color: #fffb8c;
10
10
  --ss-success-color: #00b755;
11
11
  --ss-error-color: #dc3545;
12
+ --ss-focus-color: #5897fb;
12
13
 
13
14
  // Heights
14
15
  --ss-main-height: 30px;
@@ -71,7 +72,7 @@
71
72
  overflow: hidden;
72
73
 
73
74
  &:focus {
74
- box-shadow: 0 0 5px var(--ss-primary-color);
75
+ box-shadow: 0 0 5px var(--ss-focus-color);
75
76
  }
76
77
 
77
78
  &.ss-disabled {
@@ -303,7 +304,7 @@
303
304
  }
304
305
 
305
306
  &:focus {
306
- box-shadow: 0 0 5px var(--ss-primary-color);
307
+ box-shadow: 0 0 5px var(--ss-focus-color);
307
308
  }
308
309
  }
309
310
 
@@ -284,6 +284,26 @@ export default class Store {
284
284
  return options.length ? options[0] : null
285
285
  }
286
286
 
287
+ public getSelectType(): string {
288
+ return this.selectType
289
+ }
290
+
291
+ public getFirstOption(): Option | null {
292
+ let option: Option | null = null
293
+ for (let dataObj of this.data) {
294
+ if (dataObj instanceof Optgroup) {
295
+ option = dataObj.options[0]
296
+ } else if (dataObj instanceof Option) {
297
+ option = dataObj
298
+ }
299
+
300
+ if (option) {
301
+ break
302
+ }
303
+ }
304
+ return option
305
+ }
306
+
287
307
  // Take in search string and return filtered list of values
288
308
  public search(search: string, searchFilter: (opt: Option, search: string) => boolean): DataArray {
289
309
  search = search.trim()
@@ -342,7 +362,4 @@ export default class Store {
342
362
  return dataSearch
343
363
  }
344
364
 
345
- public getSelectType(): string {
346
- return this.selectType
347
- }
348
365
  }
@@ -1,5 +1,5 @@
1
- export declare function generateID(): string;
2
- export declare function hasClassInTree(element: HTMLElement, className: string): any;
3
- export declare function debounce<T extends (...args: any[]) => void>(func: T, wait?: number, immediate?: boolean): () => void;
4
- export declare function isEqual(a: any, b: any): boolean;
5
- export declare function kebabCase(str: string): string;
1
+ export declare function generateID(): string;
2
+ export declare function hasClassInTree(element: HTMLElement, className: string): any;
3
+ export declare function debounce<T extends (...args: any[]) => void>(func: T, wait?: number, immediate?: boolean): () => void;
4
+ export declare function isEqual(a: any, b: any): boolean;
5
+ export declare function kebabCase(str: string): string;
@@ -1,46 +1,46 @@
1
- import Settings, { SettingsPartial } from './settings';
2
- import Render from './render';
3
- import Select from './select';
4
- import Store, { DataArray, DataArrayPartial, Option, OptionOptional } from './store';
5
- export interface Config {
6
- select: string | Element;
7
- data?: DataArrayPartial;
8
- settings?: SettingsPartial;
9
- events?: Events;
10
- }
11
- export interface Events {
12
- search?: (searchValue: string, currentData: DataArray) => Promise<DataArrayPartial> | DataArrayPartial;
13
- searchFilter?: (option: Option, search: string) => boolean;
14
- addable?: (value: string) => Promise<OptionOptional | string> | OptionOptional | string | false | null | undefined;
15
- beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void;
16
- afterChange?: (newVal: Option[]) => void;
17
- beforeOpen?: () => void;
18
- afterOpen?: () => void;
19
- beforeClose?: () => void;
20
- afterClose?: () => void;
21
- error?: (err: Error) => void;
22
- }
23
- export default class SlimSelect {
24
- selectEl: HTMLSelectElement;
25
- settings: Settings;
26
- select: Select;
27
- store: Store;
28
- render: Render;
29
- events: Events;
30
- constructor(config: Config);
31
- enable(): void;
32
- disable(): void;
33
- getData(): DataArray;
34
- setData(data: DataArrayPartial): void;
35
- getSelected(): string[];
36
- setSelected(value: string | string[], runAfterChange?: boolean): void;
37
- addOption(option: OptionOptional): void;
38
- open(): void;
39
- close(eventType?: string | null): void;
40
- search(value: string): void;
41
- destroy(): void;
42
- private windowResize;
43
- private windowScroll;
44
- private documentClick;
45
- private windowVisibilityChange;
46
- }
1
+ import Settings, { SettingsPartial } from './settings';
2
+ import Render from './render';
3
+ import Select from './select';
4
+ import Store, { DataArray, DataArrayPartial, Option, OptionOptional } from './store';
5
+ export interface Config {
6
+ select: string | Element;
7
+ data?: DataArrayPartial;
8
+ settings?: SettingsPartial;
9
+ events?: Events;
10
+ }
11
+ export interface Events {
12
+ search?: (searchValue: string, currentData: DataArray) => Promise<DataArrayPartial> | DataArrayPartial;
13
+ searchFilter?: (option: Option, search: string) => boolean;
14
+ addable?: (value: string) => Promise<OptionOptional | string> | OptionOptional | string | false | null | undefined;
15
+ beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void;
16
+ afterChange?: (newVal: Option[]) => void;
17
+ beforeOpen?: () => void;
18
+ afterOpen?: () => void;
19
+ beforeClose?: () => void;
20
+ afterClose?: () => void;
21
+ error?: (err: Error) => void;
22
+ }
23
+ export default class SlimSelect {
24
+ selectEl: HTMLSelectElement;
25
+ settings: Settings;
26
+ select: Select;
27
+ store: Store;
28
+ render: Render;
29
+ events: Events;
30
+ constructor(config: Config);
31
+ enable(): void;
32
+ disable(): void;
33
+ getData(): DataArray;
34
+ setData(data: DataArrayPartial): void;
35
+ getSelected(): string[];
36
+ setSelected(value: string | string[], runAfterChange?: boolean): void;
37
+ addOption(option: OptionOptional): void;
38
+ open(): void;
39
+ close(eventType?: string | null): void;
40
+ search(value: string): void;
41
+ destroy(): void;
42
+ private windowResize;
43
+ private windowScroll;
44
+ private documentClick;
45
+ private windowVisibilityChange;
46
+ }
@@ -1,120 +1,120 @@
1
- import Settings from './settings';
2
- import Store, { DataArray, Option, OptionOptional } from './store';
3
- export interface Callbacks {
4
- open: () => void;
5
- close: () => void;
6
- addable?: (value: string) => Promise<OptionOptional | string> | OptionOptional | string | false | undefined | null;
7
- setSelected: (value: string[], runAfterChange: boolean) => void;
8
- addOption: (option: Option) => void;
9
- search: (search: string) => void;
10
- beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void;
11
- afterChange?: (newVal: Option[]) => void;
12
- }
13
- export interface Main {
14
- main: HTMLDivElement;
15
- values: HTMLDivElement;
16
- deselect: {
17
- main: HTMLDivElement;
18
- svg: SVGSVGElement;
19
- path: SVGPathElement;
20
- };
21
- arrow: {
22
- main: SVGSVGElement;
23
- path: SVGPathElement;
24
- };
25
- }
26
- export interface Content {
27
- main: HTMLDivElement;
28
- search: Search;
29
- list: HTMLDivElement;
30
- }
31
- export interface Search {
32
- main: HTMLDivElement;
33
- input: HTMLInputElement;
34
- addable?: {
35
- main: HTMLDivElement;
36
- svg: SVGSVGElement;
37
- path: SVGPathElement;
38
- };
39
- }
40
- export default class Render {
41
- settings: Settings;
42
- store: Store;
43
- callbacks: Callbacks;
44
- main: Main;
45
- content: Content;
46
- classes: {
47
- main: string;
48
- placeholder: string;
49
- values: string;
50
- single: string;
51
- max: string;
52
- value: string;
53
- valueText: string;
54
- valueDelete: string;
55
- valueOut: string;
56
- deselect: string;
57
- deselectPath: string;
58
- arrow: string;
59
- arrowClose: string;
60
- arrowOpen: string;
61
- content: string;
62
- openAbove: string;
63
- openBelow: string;
64
- search: string;
65
- searchHighlighter: string;
66
- searching: string;
67
- addable: string;
68
- addablePath: string;
69
- list: string;
70
- optgroup: string;
71
- optgroupLabel: string;
72
- optgroupLabelText: string;
73
- optgroupActions: string;
74
- optgroupSelectAll: string;
75
- optgroupSelectAllBox: string;
76
- optgroupSelectAllCheck: string;
77
- optgroupClosable: string;
78
- option: string;
79
- optionDelete: string;
80
- highlighted: string;
81
- open: string;
82
- close: string;
83
- selected: string;
84
- error: string;
85
- disabled: string;
86
- hide: string;
87
- };
88
- constructor(settings: Required<Settings>, store: Store, callbacks: Callbacks);
89
- enable(): void;
90
- disable(): void;
91
- open(): void;
92
- close(): void;
93
- updateClassStyles(): void;
94
- updateAriaAttributes(): void;
95
- mainDiv(): Main;
96
- mainFocus(eventType: string | null): void;
97
- placeholder(): HTMLDivElement;
98
- renderValues(): void;
99
- private renderSingleValue;
100
- private renderMultipleValues;
101
- multipleValue(option: Option): HTMLDivElement;
102
- contentDiv(): Content;
103
- moveContent(): void;
104
- searchDiv(): Search;
105
- searchFocus(): void;
106
- getOptions(notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean): HTMLDivElement[];
107
- highlight(dir: 'up' | 'down'): void;
108
- listDiv(): HTMLDivElement;
109
- renderError(error: string): void;
110
- renderSearching(): void;
111
- renderOptions(data: DataArray): void;
112
- option(option: Option): HTMLDivElement;
113
- destroy(): void;
114
- private highlightText;
115
- moveContentAbove(): void;
116
- moveContentBelow(): void;
117
- ensureElementInView(container: HTMLElement, element: HTMLElement): void;
118
- putContent(): 'up' | 'down';
119
- updateDeselectAll(): void;
120
- }
1
+ import Settings from './settings';
2
+ import Store, { DataArray, Option, OptionOptional } from './store';
3
+ export interface Callbacks {
4
+ open: () => void;
5
+ close: () => void;
6
+ addable?: (value: string) => Promise<OptionOptional | string> | OptionOptional | string | false | undefined | null;
7
+ setSelected: (value: string | string[], runAfterChange: boolean) => void;
8
+ addOption: (option: Option) => void;
9
+ search: (search: string) => void;
10
+ beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void;
11
+ afterChange?: (newVal: Option[]) => void;
12
+ }
13
+ export interface Main {
14
+ main: HTMLDivElement;
15
+ values: HTMLDivElement;
16
+ deselect: {
17
+ main: HTMLDivElement;
18
+ svg: SVGSVGElement;
19
+ path: SVGPathElement;
20
+ };
21
+ arrow: {
22
+ main: SVGSVGElement;
23
+ path: SVGPathElement;
24
+ };
25
+ }
26
+ export interface Content {
27
+ main: HTMLDivElement;
28
+ search: Search;
29
+ list: HTMLDivElement;
30
+ }
31
+ export interface Search {
32
+ main: HTMLDivElement;
33
+ input: HTMLInputElement;
34
+ addable?: {
35
+ main: HTMLDivElement;
36
+ svg: SVGSVGElement;
37
+ path: SVGPathElement;
38
+ };
39
+ }
40
+ export default class Render {
41
+ settings: Settings;
42
+ store: Store;
43
+ callbacks: Callbacks;
44
+ main: Main;
45
+ content: Content;
46
+ classes: {
47
+ main: string;
48
+ placeholder: string;
49
+ values: string;
50
+ single: string;
51
+ max: string;
52
+ value: string;
53
+ valueText: string;
54
+ valueDelete: string;
55
+ valueOut: string;
56
+ deselect: string;
57
+ deselectPath: string;
58
+ arrow: string;
59
+ arrowClose: string;
60
+ arrowOpen: string;
61
+ content: string;
62
+ openAbove: string;
63
+ openBelow: string;
64
+ search: string;
65
+ searchHighlighter: string;
66
+ searching: string;
67
+ addable: string;
68
+ addablePath: string;
69
+ list: string;
70
+ optgroup: string;
71
+ optgroupLabel: string;
72
+ optgroupLabelText: string;
73
+ optgroupActions: string;
74
+ optgroupSelectAll: string;
75
+ optgroupSelectAllBox: string;
76
+ optgroupSelectAllCheck: string;
77
+ optgroupClosable: string;
78
+ option: string;
79
+ optionDelete: string;
80
+ highlighted: string;
81
+ open: string;
82
+ close: string;
83
+ selected: string;
84
+ error: string;
85
+ disabled: string;
86
+ hide: string;
87
+ };
88
+ constructor(settings: Required<Settings>, store: Store, callbacks: Callbacks);
89
+ enable(): void;
90
+ disable(): void;
91
+ open(): void;
92
+ close(): void;
93
+ updateClassStyles(): void;
94
+ updateAriaAttributes(): void;
95
+ mainDiv(): Main;
96
+ mainFocus(eventType: string | null): void;
97
+ placeholder(): HTMLDivElement;
98
+ renderValues(): void;
99
+ private renderSingleValue;
100
+ private renderMultipleValues;
101
+ multipleValue(option: Option): HTMLDivElement;
102
+ contentDiv(): Content;
103
+ moveContent(): void;
104
+ searchDiv(): Search;
105
+ searchFocus(): void;
106
+ getOptions(notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean): HTMLDivElement[];
107
+ highlight(dir: 'up' | 'down'): void;
108
+ listDiv(): HTMLDivElement;
109
+ renderError(error: string): void;
110
+ renderSearching(): void;
111
+ renderOptions(data: DataArray): void;
112
+ option(option: Option): HTMLDivElement;
113
+ destroy(): void;
114
+ private highlightText;
115
+ moveContentAbove(): void;
116
+ moveContentBelow(): void;
117
+ ensureElementInView(container: HTMLElement, element: HTMLElement): void;
118
+ putContent(): 'up' | 'down';
119
+ updateDeselectAll(): void;
120
+ }
@@ -1,28 +1,28 @@
1
- import { DataArray, DataArrayPartial, Optgroup, OptgroupOptional, Option } from './store';
2
- export default class Select {
3
- select: HTMLSelectElement;
4
- onValueChange?: (value: string[]) => void;
5
- onClassChange?: (classes: string[]) => void;
6
- onDisabledChange?: (disabled: boolean) => void;
7
- onOptionsChange?: (data: DataArrayPartial) => void;
8
- listen: boolean;
9
- private observer;
10
- constructor(select: HTMLSelectElement);
11
- enable(): void;
12
- disable(): void;
13
- hideUI(): void;
14
- showUI(): void;
15
- changeListen(listen: boolean): void;
16
- valueChange(ev: Event): boolean;
17
- private observeCall;
18
- getData(): DataArrayPartial;
19
- getDataFromOptgroup(optgroup: HTMLOptGroupElement): OptgroupOptional;
20
- getDataFromOption(option: HTMLOptionElement): Option;
21
- getSelectedValues(): string[];
22
- setSelected(value: string[]): void;
23
- updateSelect(id?: string, style?: string, classes?: string[]): void;
24
- updateOptions(data: DataArray): void;
25
- createOptgroup(optgroup: Optgroup): HTMLOptGroupElement;
26
- createOption(info: Option): HTMLOptionElement;
27
- destroy(): void;
28
- }
1
+ import { DataArray, DataArrayPartial, Optgroup, OptgroupOptional, Option } from './store';
2
+ export default class Select {
3
+ select: HTMLSelectElement;
4
+ onValueChange?: (value: string[]) => void;
5
+ onClassChange?: (classes: string[]) => void;
6
+ onDisabledChange?: (disabled: boolean) => void;
7
+ onOptionsChange?: (data: DataArrayPartial) => void;
8
+ listen: boolean;
9
+ private observer;
10
+ constructor(select: HTMLSelectElement);
11
+ enable(): void;
12
+ disable(): void;
13
+ hideUI(): void;
14
+ showUI(): void;
15
+ changeListen(listen: boolean): void;
16
+ valueChange(ev: Event): boolean;
17
+ private observeCall;
18
+ getData(): DataArrayPartial;
19
+ getDataFromOptgroup(optgroup: HTMLOptGroupElement): OptgroupOptional;
20
+ getDataFromOption(option: HTMLOptionElement): Option;
21
+ getSelectedValues(): string[];
22
+ setSelected(value: string[]): void;
23
+ updateSelect(id?: string, style?: string, classes?: string[]): void;
24
+ updateOptions(data: DataArray): void;
25
+ createOptgroup(optgroup: Optgroup): HTMLOptGroupElement;
26
+ createOption(info: Option): HTMLOptionElement;
27
+ destroy(): void;
28
+ }