slim-select 2.8.2 → 2.9.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 (69) hide show
  1. package/.prettierignore +1 -0
  2. package/.prettierrc +4 -3
  3. package/README.md +5 -2
  4. package/dist/classes.d.ts +43 -0
  5. package/dist/helpers.d.ts +1 -1
  6. package/dist/index.d.ts +5 -2
  7. package/dist/render.d.ts +4 -44
  8. package/dist/select.d.ts +4 -2
  9. package/dist/settings.d.ts +2 -1
  10. package/dist/slimselect.cjs.js +248 -120
  11. package/dist/slimselect.css +1 -1
  12. package/dist/slimselect.css.map +1 -1
  13. package/dist/slimselect.es.js +248 -120
  14. package/dist/slimselect.global.js +248 -120
  15. package/dist/slimselect.js +248 -120
  16. package/dist/slimselect.min.js +1 -1
  17. package/dist/slimselect.umd.js +248 -120
  18. package/dist/slimselect.umd.min.js +1 -1
  19. package/dist/store.d.ts +4 -2
  20. package/index.html +1 -4
  21. package/jest.config.js +6 -0
  22. package/package.json +31 -40
  23. package/src/slim-select/classes.test.ts +72 -0
  24. package/src/slim-select/classes.ts +109 -0
  25. package/src/slim-select/helpers.test.ts +160 -0
  26. package/src/slim-select/helpers.ts +3 -12
  27. package/src/slim-select/index.test.ts +109 -16
  28. package/src/slim-select/index.ts +41 -12
  29. package/src/slim-select/render.test.ts +1169 -18
  30. package/src/slim-select/render.ts +78 -97
  31. package/src/slim-select/rollup.config.mjs +28 -28
  32. package/src/slim-select/select.test.ts +306 -156
  33. package/src/slim-select/select.ts +70 -21
  34. package/src/slim-select/settings.test.ts +272 -0
  35. package/src/slim-select/settings.ts +5 -1
  36. package/src/slim-select/slimselect.scss +7 -3
  37. package/src/slim-select/store.test.ts +986 -235
  38. package/src/slim-select/store.ts +70 -28
  39. package/src/{vue/slimselect.vue → slim-select/vue.vue} +19 -17
  40. package/tsconfig.json +2 -3
  41. package/{vite.config.ts → vite.config.mts} +11 -4
  42. package/src/react/.eslintignore +0 -2
  43. package/src/react/.eslintrc.cjs +0 -24
  44. package/src/react/index.html +0 -14
  45. package/src/react/jestconfig.json +0 -11
  46. package/src/react/package.json +0 -32
  47. package/src/react/src/frameworkpage.tsx +0 -133
  48. package/src/react/src/index.ts +0 -3
  49. package/src/react/src/slimselect.tsx +0 -148
  50. package/src/react/tests/slimselect.test.tsx +0 -52
  51. package/src/react/tsconfig.json +0 -37
  52. package/src/react/tsconfig.node.json +0 -10
  53. package/src/react/vite.config.ts +0 -55
  54. package/src/vue/README.md +0 -48
  55. package/src/vue/dist/slim-select/helpers.d.ts +0 -5
  56. package/src/vue/dist/slim-select/index.d.ts +0 -46
  57. package/src/vue/dist/slim-select/render.d.ts +0 -120
  58. package/src/vue/dist/slim-select/select.d.ts +0 -28
  59. package/src/vue/dist/slim-select/settings.d.ts +0 -34
  60. package/src/vue/dist/slim-select/store.d.ts +0 -80
  61. package/src/vue/dist/slimselectvue.es.js +0 -1978
  62. package/src/vue/dist/slimselectvue.global.js +0 -1981
  63. package/src/vue/dist/slimselectvue.ssr.js +0 -1980
  64. package/src/vue/dist/vue/hello.d.ts +0 -2
  65. package/src/vue/dist/vue/slimselect.vue.d.ts +0 -326
  66. package/src/vue/hello.ts +0 -5
  67. package/src/vue/package.json +0 -28
  68. package/src/vue/rollup.config.mjs +0 -44
  69. package/src/vue/tsconfig.json +0 -14
@@ -1,148 +0,0 @@
1
- import React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react'
2
- import { useEffect } from 'react'
3
-
4
- import SlimSelect, { Events, Config } from '../../slim-select'
5
- import { SettingsPartial } from '../../slim-select/settings'
6
- import { DataArrayPartial, Option } from '../../slim-select/store'
7
- import '../../slim-select/slimselect.scss'
8
-
9
- export type SlimSelectProps = {
10
- style?: React.CSSProperties
11
- id?: string | undefined
12
- modelValue?: string | string[] | undefined
13
- multiple?: boolean
14
- data?: DataArrayPartial
15
- settings?: SettingsPartial
16
- events?: Events
17
- children?: React.ReactNode
18
- }
19
- export interface SlimSelectRef {
20
- set: (newValue: string | string[]) => void
21
- // Potentially call other functions on SlimSelect that have not been exposed via Ref yet
22
- getSlimSelectInstance: () => SlimSelect
23
- }
24
-
25
- const SlimSelectComponent = (props: SlimSelectProps, ref: React.Ref<any>): JSX.Element => {
26
- const { id = undefined, modelValue, style = {}, multiple = false, data, settings, events, children } = props
27
-
28
- const slimHTMLElement = useRef(null)
29
- const slimSelect = useRef<SlimSelect>()
30
- const value = useRef<any>()
31
-
32
- useEffect(() => {
33
- const config = {
34
- select: slimHTMLElement.current as unknown as Element,
35
- events: {},
36
- } as Config
37
-
38
- // If data is passed in, use it
39
- if (data) {
40
- config.data = data
41
- }
42
- // If settings are passed in, use it
43
- if (settings) {
44
- config.settings = settings
45
- }
46
- // If events are passed in, use it
47
- if (events) {
48
- config.events = events
49
- }
50
- // Satisfy tsc
51
- if (config.events == undefined) {
52
- config.events = {}
53
- }
54
-
55
- // Wrap config.events.afterChange to run value update
56
- const originalPropAfterChange = config.events.afterChange
57
-
58
- config.events.afterChange = function (newSelectedOption: Option[]): void {
59
- if (Array.isArray(newSelectedOption) && newSelectedOption.length > 0) {
60
- const stringValue = multiple ? newSelectedOption.map((option) => option.value) : newSelectedOption[0].value
61
- if (value.current !== stringValue) {
62
- value.current = stringValue
63
- }
64
- // If they had an original afterChange, run it
65
- if (config.events && originalPropAfterChange && typeof originalPropAfterChange === 'function') {
66
- originalPropAfterChange(newSelectedOption)
67
- }
68
- }
69
- }
70
-
71
- // Initialize SlimSelect
72
- slimSelect.current = new SlimSelect(config)
73
-
74
- // Get SlimSelect selected values
75
- const selected = multiple
76
- ? (slimSelect.current as SlimSelect).getSelected()
77
- : (slimSelect.current as SlimSelect).getSelected()[0]
78
-
79
- // Check if modelValue is the same as the value of the select
80
- if (selected !== modelValue && modelValue) {
81
- // If not, set the value of the select to the modelValue
82
- ;(slimSelect.current as SlimSelect).setSelected(modelValue)
83
- }
84
-
85
- // Destroy SlimSelect on unmount
86
- return () => {
87
- if (slimSelect.current) {
88
- ;(slimSelect.current as SlimSelect)?.destroy()
89
- }
90
- }
91
- }, [modelValue, multiple, data, settings, events, children])
92
-
93
- const getCleanValue = useCallback(
94
- (val: string | string[] | undefined): string | string[] => {
95
- const multi = multiple
96
-
97
- // If its multiple and the modelValue is a string, return an array with the string
98
- if (typeof val === 'string') {
99
- return multi ? [val] : val
100
- }
101
-
102
- // If its not multiple and the modelValue is an array, return the first item
103
- if (Array.isArray(val)) {
104
- return multi ? val : val[0]
105
- }
106
-
107
- return multi ? [] : ''
108
- },
109
- [multiple],
110
- )
111
-
112
- useEffect(() => {
113
- if (modelValue) {
114
- ;(slimSelect.current as SlimSelect)?.setSelected(getCleanValue(modelValue))
115
- }
116
- }, [modelValue, getCleanValue])
117
-
118
- useEffect(() => {
119
- if (data) {
120
- ;(slimSelect.current as SlimSelect)?.setData(data)
121
- }
122
- }, [data])
123
-
124
- useImperativeHandle(
125
- ref,
126
- () => {
127
- return {
128
- set(newValue: string | string[]): void {
129
- ;(slimSelect.current as SlimSelect)?.setSelected(newValue)
130
- },
131
- getSlimSelectInstance(): SlimSelect {
132
- return slimSelect.current as SlimSelect
133
- },
134
- } as SlimSelectRef
135
- },
136
- [],
137
- )
138
-
139
- return (
140
- <>
141
- <select style={style} id={id} data-testid={id} multiple={multiple} ref={slimHTMLElement}>
142
- {children}
143
- </select>
144
- </>
145
- )
146
- }
147
-
148
- export default forwardRef(SlimSelectComponent)
@@ -1,52 +0,0 @@
1
- import React from 'react'
2
-
3
- import { render } from '@testing-library/react'
4
- import userEvent from '@testing-library/user-event'
5
- import '@testing-library/jest-dom/extend-expect'
6
-
7
- import 'jest-canvas-mock'
8
-
9
- import SlimSelectComponent from '../src/slimselect'
10
-
11
- describe('Slim Select', () => {
12
- console.log(React.version)
13
- it('renders successfully', () => {
14
- const { queryByTestId, queryAllByText, getByText } = render(
15
- <SlimSelectComponent id="slimselect" ref={null} multiple={true}>
16
- <option value={'value1'}>Value 1</option>
17
- <option value={'value2'}>Value 2</option>
18
- <option value={'value3'}>Value 3</option>
19
- </SlimSelectComponent>,
20
- )
21
- expect(queryByTestId('slimselect')).not.toEqual(null)
22
- expect(queryByTestId('slimselect')).not.toBeVisible()
23
- expect(getByText('Select Value')).not.toEqual(null)
24
- expect(queryAllByText('Value 1')[1].getAttribute('aria-selected')).toEqual('false')
25
- expect(queryAllByText('Value 2')[1].getAttribute('aria-selected')).toEqual('false')
26
- expect(queryAllByText('Value 3')[1].getAttribute('aria-selected')).toEqual('false')
27
- })
28
- it('can be selected with onchange callback', async () => {
29
- const { queryAllByText } = render(
30
- <SlimSelectComponent id="slimselect" ref={null} multiple={true}>
31
- <option value={'value1'}>Value 1</option>
32
- <option value={'value2'}>Value 2</option>
33
- <option value={'value3'}>Value 3</option>
34
- </SlimSelectComponent>,
35
- )
36
-
37
- // First original html select element gets hidden, after comes slimselect div - that is why array index = 1
38
- const firstSlimOption = queryAllByText('Value 1')[1]
39
- const thirdSlimOpption = queryAllByText('Value 3')[1]
40
-
41
- expect(firstSlimOption).not.toBeUndefined()
42
- expect(thirdSlimOpption).not.toBeUndefined()
43
-
44
- await userEvent.click(firstSlimOption as HTMLElement)
45
- await userEvent.click(thirdSlimOpption as HTMLElement)
46
-
47
- expect(queryAllByText('Select Value')).toHaveLength(0)
48
- expect(queryAllByText('Value 1')[1].getAttribute('aria-selected')).toEqual('true')
49
- expect(queryAllByText('Value 2')[1].getAttribute('aria-selected')).toEqual('false')
50
- expect(queryAllByText('Value 3')[1].getAttribute('aria-selected')).toEqual('true')
51
- })
52
- })
@@ -1,37 +0,0 @@
1
- {
2
- "exclude": ["dist", "node_modules"],
3
- "compilerOptions": {
4
- "target": "ESNext",
5
- "lib": ["DOM", "DOM.Iterable", "ESNext"],
6
- "module": "ESNext",
7
- "skipLibCheck": true,
8
- "importHelpers": true,
9
- "declaration": true,
10
- "sourceMap": true,
11
- //"rootDir": "./src",
12
- "outDir": "./dist",
13
- "esModuleInterop": true,
14
- "forceConsistentCasingInFileNames": true,
15
-
16
- /* Bundler mode */
17
- "moduleResolution": "node",
18
- "allowImportingTsExtensions": true,
19
- "resolveJsonModule": true,
20
- "isolatedModules": true,
21
- "noEmit": true,
22
-
23
- "jsx": "react-jsx",
24
-
25
- /* Linting */
26
- "strict": true,
27
- "noFallthroughCasesInSwitch": true,
28
- "noImplicitReturns": true,
29
- "noUnusedLocals": false,
30
- "noUnusedParameters": false,
31
- "paths": {
32
- "react": ["./node_modules/@types/react"]
33
- }
34
- },
35
- "include": ["./src"],
36
- "references": [{ "path": "./tsconfig.node.json" }]
37
- }
@@ -1,10 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "composite": true,
4
- "skipLibCheck": true,
5
- "module": "ESNext",
6
- "moduleResolution": "bundler",
7
- "allowSyntheticDefaultImports": true
8
- },
9
- "include": ["vite.config.ts"]
10
- }
@@ -1,55 +0,0 @@
1
- import react from '@vitejs/plugin-react'
2
- import { defineConfig } from 'vite'
3
- import { babel } from '@rollup/plugin-babel'
4
- import commonjs from '@rollup/plugin-commonjs'
5
- import peerDepsExternal from 'rollup-plugin-peer-deps-external'
6
- import dts from 'vite-plugin-dts'
7
-
8
- const formatNameMap = {
9
- iife: 'global',
10
- cjs: 'ssr',
11
- es: 'es',
12
- }
13
-
14
- // https://vitejs.dev/config/
15
- export default defineConfig({
16
- plugins: [
17
- react(),
18
- dts({
19
- insertTypesEntry: true,
20
- skipDiagnostics: true,
21
- }),
22
- ],
23
- build: {
24
- target: 'modules',
25
- lib: {
26
- // Could also be a dictionary or array of multiple entry points
27
- entry: 'src/index.ts',
28
- formats: ['es', 'cjs', 'iife'],
29
- name: 'SlimSelectReact',
30
- // the proper extensions will be added
31
- fileName: (format) => `slimselectreact.${formatNameMap[format]}.js`,
32
- },
33
- rollupOptions: {
34
- // make sure to externalize deps that shouldn't be bundled
35
- // into your library
36
- // external: ['react', 'react-dom'],
37
- plugins: [
38
- peerDepsExternal(),
39
- babel({
40
- babelHelpers: 'bundled',
41
- presets: ['@babel/preset-env', '@babel/preset-react'],
42
- exclude: '../../node_modules/',
43
- }),
44
- commonjs(),
45
- ],
46
- output: {
47
- // for externalized deps
48
- globals: {
49
- react: 'React',
50
- 'react-dom': 'ReactDOM',
51
- },
52
- },
53
- },
54
- },
55
- })
package/src/vue/README.md DELETED
@@ -1,48 +0,0 @@
1
- # Slim Select Vue
2
-
3
- ## slimselectjs.com
4
-
5
- Vue integration for the SlimSelect
6
-
7
- See the website for the best details on how to use the vue integration
8
-
9
- [![NPM Downloads](https://img.shields.io/npm/dt/@slim-select/vue)](https://www.npmjs.com/package/@slim-select/vue)
10
-
11
- ## Support
12
-
13
- [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/brianvoe)
14
-
15
- <a href="https://www.buymeacoffee.com/brianvoe" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
16
-
17
- ## Installation
18
-
19
- ```bash
20
- npm install @slim-select/vue
21
- ```
22
-
23
- ## Usage
24
-
25
- ```javascript
26
- import { defineComponent } from 'vue'
27
- import SlimSelect from '@slim-select/vue'
28
-
29
- export default defineComponent({
30
- components: {
31
- SlimSelect,
32
- },
33
- })
34
- ```
35
-
36
- ```html
37
- <SlimSelect>
38
- <option value="1">Option 1</option>
39
- <option value="2">Option 2</option>
40
- <option value="3">Option 3</option>
41
- </SlimSelect>
42
-
43
- <SlimSelect multiple>
44
- <option value="1">Option 1</option>
45
- <option value="2">Option 2</option>
46
- <option value="3">Option 3</option>
47
- </SlimSelect>
48
- ```
@@ -1,5 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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,34 +0,0 @@
1
- /// <reference types="node" />
2
- export type SettingsPartial = Partial<Settings>;
3
- export default class Settings {
4
- id: string;
5
- style: string;
6
- class: string[];
7
- isMultiple: boolean;
8
- isOpen: boolean;
9
- isFullOpen: boolean;
10
- intervalMove: NodeJS.Timeout | null;
11
- disabled: boolean;
12
- alwaysOpen: boolean;
13
- showSearch: boolean;
14
- ariaLabel: string;
15
- searchPlaceholder: string;
16
- searchText: string;
17
- searchingText: string;
18
- searchHighlight: boolean;
19
- closeOnSelect: boolean;
20
- contentLocation: HTMLElement;
21
- contentPosition: 'relative' | 'absolute';
22
- openPosition: 'auto' | 'up' | 'down';
23
- placeholderText: string;
24
- allowDeselect: boolean;
25
- hideSelected: boolean;
26
- keepOrder: boolean;
27
- showOptionTooltips: boolean;
28
- minSelected: number;
29
- maxSelected: number;
30
- timeoutDelay: number;
31
- maxValuesShown: number;
32
- maxValuesMessage: string;
33
- constructor(settings?: SettingsPartial);
34
- }
@@ -1,80 +0,0 @@
1
- export type DataArray = DataObject[];
2
- export type DataObject = Optgroup | Option;
3
- export type DataArrayPartial = DataObjectPartial[];
4
- export type DataObjectPartial = OptgroupOptional | OptionOptional;
5
- type selectType = 'single' | 'multiple';
6
- export interface OptgroupOptional {
7
- id?: string;
8
- label: string;
9
- selectAll?: boolean;
10
- selectAllText?: string;
11
- closable?: 'off' | 'open' | 'close';
12
- options?: OptionOptional[];
13
- }
14
- export declare class Optgroup {
15
- id: string;
16
- label: string;
17
- selectAll: boolean;
18
- selectAllText: string;
19
- closable: 'off' | 'open' | 'close';
20
- options: Option[];
21
- constructor(optgroup: OptgroupOptional);
22
- }
23
- export interface OptionOptional {
24
- id?: string;
25
- value?: string;
26
- text: string;
27
- html?: string;
28
- selected?: boolean;
29
- display?: boolean;
30
- disabled?: boolean;
31
- mandatory?: boolean;
32
- placeholder?: boolean;
33
- class?: string;
34
- style?: string;
35
- data?: {
36
- [key: string]: string;
37
- };
38
- }
39
- export declare class Option {
40
- id: string;
41
- value: string;
42
- text: string;
43
- html: string;
44
- selected: boolean;
45
- display: boolean;
46
- disabled: boolean;
47
- placeholder: boolean;
48
- class: string;
49
- style: string;
50
- data: {
51
- [key: string]: string;
52
- };
53
- mandatory: boolean;
54
- constructor(option: OptionOptional);
55
- }
56
- export default class Store {
57
- private selectType;
58
- private data;
59
- constructor(type: selectType, data: DataArrayPartial);
60
- validateDataArray(data: DataArray | DataArrayPartial): Error | null;
61
- validateOption(option: Option | OptionOptional): Error | null;
62
- partialToFullData(data: DataArrayPartial): DataArray;
63
- setData(data: DataArray | DataArrayPartial): void;
64
- getData(): DataArray;
65
- getDataOptions(): Option[];
66
- addOption(option: OptionOptional): void;
67
- setSelectedBy(selectedType: 'id' | 'value', selectedValues: string[]): void;
68
- getSelected(): string[];
69
- getSelectedOptions(): Option[];
70
- getSelectedIDs(): string[];
71
- getOptgroupByID(id: string): Optgroup | null;
72
- getOptionByID(id: string): Option | null;
73
- getSelectType(): string;
74
- getFirstOption(): Option | null;
75
- search(search: string, searchFilter: (opt: Option, search: string) => boolean): DataArray;
76
- filter(filter: {
77
- (opt: Option): boolean;
78
- } | null, includeOptgroup: boolean): DataArray;
79
- }
80
- export {};