-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
663 additions
and
602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
export declare function generateID(): string; | ||
export declare function hasClassInTree(element: HTMLElement, className: string): any; | ||
export declare function debounce<T extends (...args: any[]) => void>(func: T, wait?: number, immediate?: boolean): () => void; | ||
export declare function isEqual(a: any, b: any): boolean; | ||
export declare function kebabCase(str: string): string; | ||
export declare function generateID(): string | ||
export declare function hasClassInTree(element: HTMLElement, className: string): any | ||
export declare function debounce<T extends (...args: any[]) => void>( | ||
func: T, | ||
wait?: number, | ||
immediate?: boolean, | ||
): () => void | ||
export declare function isEqual(a: any, b: any): boolean | ||
export declare function kebabCase(str: string): string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
import Render from './render'; | ||
import Select from './select'; | ||
import Settings, { SettingsPartial } from './settings'; | ||
import Store, { DataArray, DataArrayPartial, Option, OptionOptional } from './store'; | ||
import Render from './render' | ||
import Select from './select' | ||
import Settings, { SettingsPartial } from './settings' | ||
import Store, { DataArray, DataArrayPartial, Option, OptionOptional } from './store' | ||
export interface Config { | ||
select: string | Element; | ||
data?: DataArrayPartial; | ||
settings?: SettingsPartial; | ||
events?: Events; | ||
select: string | Element | ||
data?: DataArrayPartial | ||
settings?: SettingsPartial | ||
events?: Events | ||
} | ||
export interface Events { | ||
search?: (searchValue: string, currentData: DataArray) => Promise<DataArrayPartial> | DataArrayPartial; | ||
searchFilter?: (option: Option, search: string) => boolean; | ||
addable?: (value: string) => Promise<OptionOptional | string> | OptionOptional | string | false | null | undefined; | ||
beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void; | ||
afterChange?: (newVal: Option[]) => void; | ||
beforeOpen?: () => void; | ||
afterOpen?: () => void; | ||
beforeClose?: () => void; | ||
afterClose?: () => void; | ||
error?: (err: Error) => void; | ||
search?: (searchValue: string, currentData: DataArray) => Promise<DataArrayPartial> | DataArrayPartial | ||
searchFilter?: (option: Option, search: string) => boolean | ||
addable?: (value: string) => Promise<OptionOptional | string> | OptionOptional | string | false | null | undefined | ||
beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void | ||
afterChange?: (newVal: Option[]) => void | ||
beforeOpen?: () => void | ||
afterOpen?: () => void | ||
beforeClose?: () => void | ||
afterClose?: () => void | ||
error?: (err: Error) => void | ||
} | ||
export default class SlimSelect { | ||
selectEl: HTMLSelectElement; | ||
settings: Settings; | ||
select: Select; | ||
store: Store; | ||
render: Render; | ||
events: Events; | ||
constructor(config: Config); | ||
enable(): void; | ||
disable(): void; | ||
getData(): DataArray; | ||
setData(data: DataArrayPartial): void; | ||
getSelected(): string[]; | ||
setSelected(id: string | string[], runAfterChange?: boolean): void; | ||
addOption(option: OptionOptional): void; | ||
open(): void; | ||
close(eventType?: string | null): void; | ||
search(value: string): void; | ||
destroy(): void; | ||
private windowResize; | ||
private windowScroll; | ||
private documentClick; | ||
private windowVisibilityChange; | ||
selectEl: HTMLSelectElement | ||
settings: Settings | ||
select: Select | ||
store: Store | ||
render: Render | ||
events: Events | ||
constructor(config: Config) | ||
enable(): void | ||
disable(): void | ||
getData(): DataArray | ||
setData(data: DataArrayPartial): void | ||
getSelected(): string[] | ||
setSelected(id: string | string[], runAfterChange?: boolean): void | ||
addOption(option: OptionOptional): void | ||
open(): void | ||
close(eventType?: string | null): void | ||
search(value: string): void | ||
destroy(): void | ||
private windowResize | ||
private windowScroll | ||
private documentClick | ||
private windowVisibilityChange | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,120 +1,120 @@ | ||
import Settings from './settings'; | ||
import Store, { DataArray, Option, OptionOptional } from './store'; | ||
import Settings from './settings' | ||
import Store, { DataArray, Option, OptionOptional } from './store' | ||
export interface Callbacks { | ||
open: () => void; | ||
close: () => void; | ||
addable?: (value: string) => Promise<OptionOptional | string> | OptionOptional | string | false | undefined | null; | ||
setSelected: (value: string | string[], runAfterChange: boolean) => void; | ||
addOption: (option: Option) => void; | ||
search: (search: string) => void; | ||
beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void; | ||
afterChange?: (newVal: Option[]) => void; | ||
open: () => void | ||
close: () => void | ||
addable?: (value: string) => Promise<OptionOptional | string> | OptionOptional | string | false | undefined | null | ||
setSelected: (value: string | string[], runAfterChange: boolean) => void | ||
addOption: (option: Option) => void | ||
search: (search: string) => void | ||
beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void | ||
afterChange?: (newVal: Option[]) => void | ||
} | ||
export interface Main { | ||
main: HTMLDivElement; | ||
values: HTMLDivElement; | ||
deselect: { | ||
main: HTMLDivElement; | ||
svg: SVGSVGElement; | ||
path: SVGPathElement; | ||
}; | ||
arrow: { | ||
main: SVGSVGElement; | ||
path: SVGPathElement; | ||
}; | ||
main: HTMLDivElement | ||
values: HTMLDivElement | ||
deselect: { | ||
main: HTMLDivElement | ||
svg: SVGSVGElement | ||
path: SVGPathElement | ||
} | ||
arrow: { | ||
main: SVGSVGElement | ||
path: SVGPathElement | ||
} | ||
} | ||
export interface Content { | ||
main: HTMLDivElement; | ||
search: Search; | ||
list: HTMLDivElement; | ||
main: HTMLDivElement | ||
search: Search | ||
list: HTMLDivElement | ||
} | ||
export interface Search { | ||
main: HTMLDivElement; | ||
input: HTMLInputElement; | ||
addable?: { | ||
main: HTMLDivElement; | ||
svg: SVGSVGElement; | ||
path: SVGPathElement; | ||
}; | ||
main: HTMLDivElement | ||
input: HTMLInputElement | ||
addable?: { | ||
main: HTMLDivElement | ||
svg: SVGSVGElement | ||
path: SVGPathElement | ||
} | ||
} | ||
export default class Render { | ||
settings: Settings; | ||
store: Store; | ||
callbacks: Callbacks; | ||
main: Main; | ||
content: Content; | ||
classes: { | ||
main: string; | ||
placeholder: string; | ||
values: string; | ||
single: string; | ||
max: string; | ||
value: string; | ||
valueText: string; | ||
valueDelete: string; | ||
valueOut: string; | ||
deselect: string; | ||
deselectPath: string; | ||
arrow: string; | ||
arrowClose: string; | ||
arrowOpen: string; | ||
content: string; | ||
openAbove: string; | ||
openBelow: string; | ||
search: string; | ||
searchHighlighter: string; | ||
searching: string; | ||
addable: string; | ||
addablePath: string; | ||
list: string; | ||
optgroup: string; | ||
optgroupLabel: string; | ||
optgroupLabelText: string; | ||
optgroupActions: string; | ||
optgroupSelectAll: string; | ||
optgroupSelectAllBox: string; | ||
optgroupSelectAllCheck: string; | ||
optgroupClosable: string; | ||
option: string; | ||
optionDelete: string; | ||
highlighted: string; | ||
open: string; | ||
close: string; | ||
selected: string; | ||
error: string; | ||
disabled: string; | ||
hide: string; | ||
}; | ||
constructor(settings: Required<Settings>, store: Store, callbacks: Callbacks); | ||
enable(): void; | ||
disable(): void; | ||
open(): void; | ||
close(): void; | ||
updateClassStyles(): void; | ||
updateAriaAttributes(): void; | ||
mainDiv(): Main; | ||
mainFocus(eventType: string | null): void; | ||
placeholder(): HTMLDivElement; | ||
renderValues(): void; | ||
private renderSingleValue; | ||
private renderMultipleValues; | ||
multipleValue(option: Option): HTMLDivElement; | ||
contentDiv(): Content; | ||
moveContent(): void; | ||
searchDiv(): Search; | ||
searchFocus(): void; | ||
getOptions(notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean): HTMLDivElement[]; | ||
highlight(dir: 'up' | 'down'): void; | ||
listDiv(): HTMLDivElement; | ||
renderError(error: string): void; | ||
renderSearching(): void; | ||
renderOptions(data: DataArray): void; | ||
option(option: Option): HTMLDivElement; | ||
destroy(): void; | ||
private highlightText; | ||
moveContentAbove(): void; | ||
moveContentBelow(): void; | ||
ensureElementInView(container: HTMLElement, element: HTMLElement): void; | ||
putContent(): 'up' | 'down'; | ||
updateDeselectAll(): void; | ||
settings: Settings | ||
store: Store | ||
callbacks: Callbacks | ||
main: Main | ||
content: Content | ||
classes: { | ||
main: string | ||
placeholder: string | ||
values: string | ||
single: string | ||
max: string | ||
value: string | ||
valueText: string | ||
valueDelete: string | ||
valueOut: string | ||
deselect: string | ||
deselectPath: string | ||
arrow: string | ||
arrowClose: string | ||
arrowOpen: string | ||
content: string | ||
openAbove: string | ||
openBelow: string | ||
search: string | ||
searchHighlighter: string | ||
searching: string | ||
addable: string | ||
addablePath: string | ||
list: string | ||
optgroup: string | ||
optgroupLabel: string | ||
optgroupLabelText: string | ||
optgroupActions: string | ||
optgroupSelectAll: string | ||
optgroupSelectAllBox: string | ||
optgroupSelectAllCheck: string | ||
optgroupClosable: string | ||
option: string | ||
optionDelete: string | ||
highlighted: string | ||
open: string | ||
close: string | ||
selected: string | ||
error: string | ||
disabled: string | ||
hide: string | ||
} | ||
constructor(settings: Required<Settings>, store: Store, callbacks: Callbacks) | ||
enable(): void | ||
disable(): void | ||
open(): void | ||
close(): void | ||
updateClassStyles(): void | ||
updateAriaAttributes(): void | ||
mainDiv(): Main | ||
mainFocus(eventType: string | null): void | ||
placeholder(): HTMLDivElement | ||
renderValues(): void | ||
private renderSingleValue | ||
private renderMultipleValues | ||
multipleValue(option: Option): HTMLDivElement | ||
contentDiv(): Content | ||
moveContent(): void | ||
searchDiv(): Search | ||
searchFocus(): void | ||
getOptions(notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean): HTMLDivElement[] | ||
highlight(dir: 'up' | 'down'): void | ||
listDiv(): HTMLDivElement | ||
renderError(error: string): void | ||
renderSearching(): void | ||
renderOptions(data: DataArray): void | ||
option(option: Option): HTMLDivElement | ||
destroy(): void | ||
private highlightText | ||
moveContentAbove(): void | ||
moveContentBelow(): void | ||
ensureElementInView(container: HTMLElement, element: HTMLElement): void | ||
putContent(): 'up' | 'down' | ||
updateDeselectAll(): void | ||
} |
Oops, something went wrong.