slim-select 2.7.0 → 2.8.0
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.
- package/dist/index.d.ts +1 -1
- package/dist/settings.d.ts +1 -0
- package/dist/slimselect.cjs.js +54 -47
- package/dist/slimselect.es.js +54 -47
- package/dist/slimselect.global.js +54 -47
- package/dist/slimselect.js +54 -47
- package/dist/slimselect.min.js +1 -1
- package/dist/slimselect.umd.js +54 -47
- package/dist/slimselect.umd.min.js +1 -1
- package/package.json +30 -31
- package/src/slim-select/index.ts +11 -8
- package/src/slim-select/render.ts +11 -4
- package/src/slim-select/settings.ts +2 -0
- package/src/vue/dist/slim-select/helpers.d.ts +5 -5
- package/src/vue/dist/slim-select/index.d.ts +46 -46
- package/src/vue/dist/slim-select/render.d.ts +120 -120
- package/src/vue/dist/slim-select/select.d.ts +28 -28
- package/src/vue/dist/slim-select/settings.d.ts +34 -33
- package/src/vue/dist/slim-select/store.d.ts +80 -80
- package/src/vue/dist/slimselectvue.es.js +1947 -1940
- package/src/vue/dist/slimselectvue.global.js +1947 -1940
- package/src/vue/dist/slimselectvue.ssr.js +1947 -1940
- package/src/vue/dist/vue/hello.d.ts +2 -2
- package/src/vue/dist/vue/slimselect.vue.d.ts +326 -324
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slim-select",
|
|
3
3
|
"description": "Slim advanced select dropdown",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.8.0",
|
|
5
5
|
"author": "Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",
|
|
6
6
|
"homepage": "https://slimselectjs.com",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/brianvoe/slim-select/issues"
|
|
10
10
|
},
|
|
11
|
-
"type": "module",
|
|
12
11
|
"main": "dist/slimselect.umd.js",
|
|
13
12
|
"browser": "dist/slimselect.umd.js",
|
|
14
13
|
"module": "dist/slimselect.es.js",
|
|
@@ -59,49 +58,49 @@
|
|
|
59
58
|
"@rollup/plugin-babel": "^6.0.4",
|
|
60
59
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
61
60
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
61
|
+
"@rollup/plugin-replace": "^5.0.2",
|
|
62
62
|
"@rollup/plugin-terser": "^0.4.4",
|
|
63
63
|
"@rollup/plugin-typescript": "^11.1.5",
|
|
64
64
|
"@slim-select/vue": "workspace:src/vue",
|
|
65
|
+
"@testing-library/jest-dom": "^6.1.5",
|
|
66
|
+
"@testing-library/react": "^14.0.0",
|
|
67
|
+
"@testing-library/user-event": "^14.4.3",
|
|
65
68
|
"@types/downloadjs": "^1.4.6",
|
|
66
|
-
"@
|
|
69
|
+
"@types/jest": "^29.5.11",
|
|
70
|
+
"@types/react": "^18.2.45",
|
|
71
|
+
"@types/react-dom": "^18.2.18",
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^6.15.0",
|
|
73
|
+
"@typescript-eslint/parser": "^6.15.0",
|
|
74
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
75
|
+
"@vitejs/plugin-vue": "^4.5.2",
|
|
67
76
|
"clipboard": "^2.0.11",
|
|
68
77
|
"downloadjs": "^1.4.7",
|
|
78
|
+
"eslint": "^8.56.0",
|
|
79
|
+
"eslint-config-prettier": "^9.1.0",
|
|
80
|
+
"eslint-plugin-prettier": "^5.1.1",
|
|
81
|
+
"eslint-plugin-react": "^7.32.2",
|
|
82
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
83
|
+
"eslint-plugin-react-refresh": "^0.4.5",
|
|
84
|
+
"identity-obj-proxy": "^3.0.0",
|
|
69
85
|
"jest": "^29.7.0",
|
|
86
|
+
"jest-canvas-mock": "^2.5.0",
|
|
70
87
|
"jest-environment-jsdom": "^29.7.0",
|
|
71
|
-
"prettier": "^3.1.
|
|
88
|
+
"prettier": "^3.1.1",
|
|
72
89
|
"prismjs": "^1.29.0",
|
|
73
90
|
"rimraf": "^5.0.5",
|
|
74
|
-
"rollup": "^4.
|
|
91
|
+
"rollup": "^4.9.1",
|
|
92
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
75
93
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
76
94
|
"rollup-plugin-vue": "^6.0.0",
|
|
77
95
|
"sass": "^1.59.2",
|
|
78
96
|
"ts-jest": "^29.0.5",
|
|
79
97
|
"tslib": "^2.5.0",
|
|
80
|
-
"typescript": "^
|
|
81
|
-
"vite": "^
|
|
82
|
-
"
|
|
98
|
+
"typescript": "^5.3.3",
|
|
99
|
+
"vite": "^5.0.10",
|
|
100
|
+
"vite-plugin-dts": "^3.6.4",
|
|
101
|
+
"vue": "^3.3.13",
|
|
83
102
|
"vue-router": "^4.1.6",
|
|
84
|
-
"vue-tsc": "^1.
|
|
85
|
-
"vuex": "^4.0.2"
|
|
86
|
-
"@rollup/plugin-replace": "^5.0.2",
|
|
87
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
88
|
-
"@testing-library/react": "^14.0.0",
|
|
89
|
-
"@testing-library/user-event": "^14.4.3",
|
|
90
|
-
"@types/jest": "^29.5.1",
|
|
91
|
-
"@types/react": "^18.0.28",
|
|
92
|
-
"@types/react-dom": "^18.0.11",
|
|
93
|
-
"@typescript-eslint/eslint-plugin": "^5.59.2",
|
|
94
|
-
"@typescript-eslint/parser": "^5.59.2",
|
|
95
|
-
"@vitejs/plugin-react": "^4.0.0",
|
|
96
|
-
"eslint": "^8.39.0",
|
|
97
|
-
"eslint-config-prettier": "^8.8.0",
|
|
98
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
99
|
-
"eslint-plugin-react": "^7.32.2",
|
|
100
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
101
|
-
"eslint-plugin-react-refresh": "^0.3.4",
|
|
102
|
-
"identity-obj-proxy": "^3.0.0",
|
|
103
|
-
"jest-canvas-mock": "^2.5.0",
|
|
104
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
105
|
-
"vite-plugin-dts": "^2.3.0"
|
|
103
|
+
"vue-tsc": "^1.8.26",
|
|
104
|
+
"vuex": "^4.0.2"
|
|
106
105
|
}
|
|
107
|
-
}
|
|
106
|
+
}
|
package/src/slim-select/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { debounce, hasClassInTree, isEqual } from './helpers'
|
|
2
2
|
import Render from './render'
|
|
3
3
|
import Select from './select'
|
|
4
|
+
import Settings, { SettingsPartial } from './settings'
|
|
4
5
|
import Store, { DataArray, DataArrayPartial, Option, OptionOptional } from './store'
|
|
5
|
-
import { debounce, hasClassInTree, isEqual } from './helpers'
|
|
6
6
|
|
|
7
7
|
export interface Config {
|
|
8
8
|
select: string | Element
|
|
@@ -136,8 +136,8 @@ export default class SlimSelect {
|
|
|
136
136
|
this.select.updateOptions(this.store.getData())
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
// Set render
|
|
140
|
-
const
|
|
139
|
+
// Set render renderCallbacks
|
|
140
|
+
const renderCallbacks = {
|
|
141
141
|
open: this.open.bind(this),
|
|
142
142
|
close: this.close.bind(this),
|
|
143
143
|
addable: this.events.addable ? this.events.addable : undefined,
|
|
@@ -149,7 +149,7 @@ export default class SlimSelect {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
// Setup render class
|
|
152
|
-
this.render = new Render(this.settings, this.store,
|
|
152
|
+
this.render = new Render(this.settings, this.store, renderCallbacks)
|
|
153
153
|
this.render.renderValues()
|
|
154
154
|
this.render.renderOptions(this.store.getData())
|
|
155
155
|
|
|
@@ -168,9 +168,6 @@ export default class SlimSelect {
|
|
|
168
168
|
this.selectEl.parentNode.insertBefore(this.render.main.main, this.selectEl.nextSibling)
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
// Add onclick listener to document to closeContent if clicked outside
|
|
172
|
-
document.addEventListener('click', this.documentClick)
|
|
173
|
-
|
|
174
171
|
// Add window resize listener to moveContent if window size changes
|
|
175
172
|
window.addEventListener('resize', this.windowResize, false)
|
|
176
173
|
|
|
@@ -336,6 +333,9 @@ export default class SlimSelect {
|
|
|
336
333
|
if (this.settings.isOpen) {
|
|
337
334
|
this.settings.isFullOpen = true
|
|
338
335
|
}
|
|
336
|
+
|
|
337
|
+
// Add onclick listener to document to closeContent if clicked outside
|
|
338
|
+
document.addEventListener('click', this.documentClick)
|
|
339
339
|
}, this.settings.timeoutDelay)
|
|
340
340
|
|
|
341
341
|
// Start an interval to check if main has moved
|
|
@@ -380,6 +380,9 @@ export default class SlimSelect {
|
|
|
380
380
|
if (this.events.afterClose) {
|
|
381
381
|
this.events.afterClose()
|
|
382
382
|
}
|
|
383
|
+
|
|
384
|
+
// Add onclick listener to document to closeContent if clicked outside
|
|
385
|
+
document.removeEventListener('click', this.documentClick)
|
|
383
386
|
}, this.settings.timeoutDelay)
|
|
384
387
|
|
|
385
388
|
if (this.settings.intervalMove) {
|
|
@@ -529,13 +529,20 @@ export default class Render {
|
|
|
529
529
|
|
|
530
530
|
// If shouldAdd, insertAdjacentElement it to the values container in the order of the selectedOptions
|
|
531
531
|
if (shouldAdd) {
|
|
532
|
-
|
|
532
|
+
// If keepOrder is true, we will just append it to the end
|
|
533
|
+
if (this.settings.keepOrder) {
|
|
533
534
|
this.main.values.appendChild(this.multipleValue(selectedOptions[d]))
|
|
534
|
-
} else if (d === 0) {
|
|
535
|
-
this.main.values.insertBefore(this.multipleValue(selectedOptions[d]), currentNodes[d])
|
|
536
535
|
} else {
|
|
537
|
-
|
|
536
|
+
// else we will insert it in the order of the selectedOptions
|
|
537
|
+
if (currentNodes.length === 0) {
|
|
538
|
+
this.main.values.appendChild(this.multipleValue(selectedOptions[d]))
|
|
539
|
+
} else if (d === 0) {
|
|
540
|
+
this.main.values.insertBefore(this.multipleValue(selectedOptions[d]), currentNodes[d])
|
|
541
|
+
} else {
|
|
542
|
+
currentNodes[d - 1].insertAdjacentElement('afterend', this.multipleValue(selectedOptions[d]))
|
|
543
|
+
}
|
|
538
544
|
}
|
|
545
|
+
|
|
539
546
|
}
|
|
540
547
|
}
|
|
541
548
|
this.updateDeselectAll()
|
|
@@ -29,6 +29,7 @@ export default class Settings {
|
|
|
29
29
|
public placeholderText: string
|
|
30
30
|
public allowDeselect: boolean
|
|
31
31
|
public hideSelected: boolean
|
|
32
|
+
public keepOrder: boolean
|
|
32
33
|
public showOptionTooltips: boolean
|
|
33
34
|
public minSelected: number
|
|
34
35
|
public maxSelected: number
|
|
@@ -60,6 +61,7 @@ export default class Settings {
|
|
|
60
61
|
this.placeholderText = settings.placeholderText !== undefined ? settings.placeholderText : 'Select Value'
|
|
61
62
|
this.allowDeselect = settings.allowDeselect !== undefined ? settings.allowDeselect : false
|
|
62
63
|
this.hideSelected = settings.hideSelected !== undefined ? settings.hideSelected : false
|
|
64
|
+
this.keepOrder = settings.keepOrder !== undefined ? settings.keepOrder : false
|
|
63
65
|
this.showOptionTooltips = settings.showOptionTooltips !== undefined ? settings.showOptionTooltips : false
|
|
64
66
|
this.minSelected = settings.minSelected || 0
|
|
65
67
|
this.maxSelected = settings.maxSelected || 1000
|
|
@@ -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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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 Render from './render';
|
|
2
|
+
import Select from './select';
|
|
3
|
+
import Settings, { SettingsPartial } from './settings';
|
|
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 | 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
|
+
}
|