@lemonadejs/dropdown 3.0.4 → 3.0.9
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 +57 -155
- package/dist/index.js +629 -332
- package/dist/react.js +36 -36
- package/dist/style.css +242 -178
- package/dist/vue.js +45 -45
- package/package.json +22 -23
package/dist/index.d.ts
CHANGED
|
@@ -1,156 +1,58 @@
|
|
|
1
|
-
interface DropdownItem {
|
|
2
|
-
/** Value of the selected item. */
|
|
3
|
-
value?: string | number;
|
|
4
|
-
/** Description of the item */
|
|
5
|
-
text?: string;
|
|
6
|
-
/** Icon of the item */
|
|
7
|
-
image?: string;
|
|
8
|
-
/** Name of the group where the item belongs to */
|
|
9
|
-
group?: string;
|
|
10
|
-
/** Keywords to help finding one item */
|
|
11
|
-
synonym?: string[];
|
|
12
|
-
/** Item is disabled */
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
/** Color for the item */
|
|
15
|
-
color?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface DropdownOptions {
|
|
19
|
-
/** Preloaded data items for the dropdown */
|
|
20
|
-
data?: DropdownItem[];
|
|
21
|
-
/** Format type of the data, typically { id: name } or { value: text } */
|
|
22
|
-
format?: number;
|
|
23
|
-
/** Indicates if multiple item selection is allowed */
|
|
24
|
-
multiple?: boolean;
|
|
25
|
-
/** Enables the autocomplete feature for user input */
|
|
26
|
-
autocomplete?: boolean;
|
|
27
|
-
/** Rendering style of the dropdown: 'default', 'picker',
|
|
28
|
-
type?: 'default' | 'picker' | 'searchbar',
|
|
29
|
-
/** Defines the dropdown's width */
|
|
30
|
-
width?: number;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
/** Event handler for
|
|
42
|
-
|
|
43
|
-
/** Event handler for when
|
|
44
|
-
|
|
45
|
-
/** Event handler for
|
|
46
|
-
|
|
47
|
-
/** Event handler for
|
|
48
|
-
|
|
49
|
-
/** Event handler for
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
onbeforesearch?: (obj: Dropdown, ajaxRequest: object) => boolean | null;
|
|
59
|
-
/** Event handler for processing search results */
|
|
60
|
-
onsearch?: (obj: Dropdown, result: object) => void;
|
|
61
|
-
/** Toggles the sorting of dropdown elements */
|
|
62
|
-
sortResults?: boolean;
|
|
63
|
-
/** Indicates if the dropdown should automatically receive focus upon creation */
|
|
64
|
-
autofocus?: boolean;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface ItemContainer {
|
|
68
|
-
/** Data for the item */
|
|
69
|
-
data: DropdownItem;
|
|
70
|
-
/** HTML container for the element */
|
|
71
|
-
element: HTMLElement;
|
|
72
|
-
/** HTML container for the group */
|
|
73
|
-
group: HTMLElement;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** Toast Plugin */
|
|
77
|
-
export type Dropdown = (el: HTMLElement, options: DropdownOptions) => {
|
|
78
|
-
/** Add a new item to the dropdown */
|
|
79
|
-
add: (title: string, id: string|number) => DropdownItem;
|
|
80
|
-
/** Append new data to the dropdown */
|
|
81
|
-
appendData: (data: DropdownItem[]) => void
|
|
82
|
-
/** Close the dropdown picker */
|
|
83
|
-
closeItem: (ignoreEvents?: boolean) => void
|
|
84
|
-
/** Current selectIndex */
|
|
85
|
-
currentIndex: number;
|
|
86
|
-
/** Find the items with the keyword */
|
|
87
|
-
find: (str: string) => void;
|
|
88
|
-
/** Select the first item */
|
|
89
|
-
first: () => void;
|
|
90
|
-
/** Get all data */
|
|
91
|
-
getData: () => DropdownItem[];
|
|
92
|
-
/** Get the index position of a item by its value */
|
|
93
|
-
getPosition: (value: string) => number | boolean;
|
|
94
|
-
/** Get the text from the selected options */
|
|
95
|
-
getText: (asArray?: boolean) => string | string[];
|
|
96
|
-
/** Get the URL source for the data if defined */
|
|
97
|
-
getUrl: () => string;
|
|
98
|
-
/** Get the value from the selected options */
|
|
99
|
-
getValue: (asArray?: boolean) => string | string[];
|
|
100
|
-
/** DOM Elements for the groups */
|
|
101
|
-
groups: HTMLElement[];
|
|
102
|
-
/** DOM Element for the header */
|
|
103
|
-
header: HTMLElement;
|
|
104
|
-
/** Items */
|
|
105
|
-
items: ItemContainer[];
|
|
106
|
-
/** Move index to the last element in the dropdown */
|
|
107
|
-
last: () => void;
|
|
108
|
-
/** Internal lazy loading method */
|
|
109
|
-
loadDown: () => void;
|
|
110
|
-
/** Internal lazy loading method */
|
|
111
|
-
loadFirst: () => void;
|
|
112
|
-
/** Internal lazy loading method */
|
|
113
|
-
loadLast: () => void;
|
|
114
|
-
/** Internal lazy loading method */
|
|
115
|
-
loadUp: () => void;
|
|
116
|
-
/** Move index to the next element in the dropdown */
|
|
117
|
-
next: () => void;
|
|
118
|
-
/** Open the dropdown */
|
|
119
|
-
open: () => void;
|
|
120
|
-
/** Dropdown configuration */
|
|
121
|
-
options: DropdownOptions;
|
|
122
|
-
/** Move index to the previous element in the dropdown */
|
|
123
|
-
prev: () => void;
|
|
124
|
-
/** Reset the value of the dropdown */
|
|
125
|
-
reset: () => void;
|
|
126
|
-
/** Alias for setCursor */
|
|
127
|
-
resetCursor: (index: number, setPosition?: boolean) => void
|
|
128
|
-
/** Set the value to null */
|
|
129
|
-
resetSelected: () => void;
|
|
130
|
-
/** Array of results when filtering */
|
|
131
|
-
results: DropdownItem[];
|
|
132
|
-
/** Search term */
|
|
133
|
-
search: string;
|
|
134
|
-
/** Select an index */
|
|
135
|
-
selectIndex: (index: number, force?: boolean) => void
|
|
136
|
-
/** Select an item */
|
|
137
|
-
selectItem: (item: DropdownItem) => void;
|
|
138
|
-
/** Set the cursor to a specified element index */
|
|
139
|
-
setCursor: (index: number, setPosition?: boolean) => void
|
|
140
|
-
/** Set new data for the dropdown */
|
|
141
|
-
setData: (items: DropdownItem[]) => void;
|
|
142
|
-
/** Set the id or value for one item */
|
|
143
|
-
setId: (item: number|DropdownItem, newId: number) => void;
|
|
144
|
-
/** Change the dropdown options */
|
|
145
|
-
setOptions: (newOptions: DropdownOptions, reset?: boolean) => void;
|
|
146
|
-
/** Change the dropdown data from a URL */
|
|
147
|
-
setUrl: (newUrl: string, callback?: Function) => void;
|
|
148
|
-
/** Set the value for a dropdown */
|
|
149
|
-
setValue: (newValue: string | string[]) => void;
|
|
150
|
-
/** Internal type */
|
|
151
|
-
type: 'dropdown';
|
|
152
|
-
/** Alias for setCursor */
|
|
153
|
-
updateCursor: (index: number, setPosition?: boolean) => void;
|
|
154
|
-
/** Current internal value */
|
|
155
|
-
value: Record<number, string>;
|
|
1
|
+
interface DropdownItem {
|
|
2
|
+
/** Value of the selected item. */
|
|
3
|
+
value?: string | number;
|
|
4
|
+
/** Description of the item */
|
|
5
|
+
text?: string;
|
|
6
|
+
/** Icon of the item */
|
|
7
|
+
image?: string;
|
|
8
|
+
/** Name of the group where the item belongs to */
|
|
9
|
+
group?: string;
|
|
10
|
+
/** Keywords to help finding one item */
|
|
11
|
+
synonym?: string[];
|
|
12
|
+
/** Item is disabled */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Color for the item */
|
|
15
|
+
color?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface DropdownOptions {
|
|
19
|
+
/** Preloaded data items for the dropdown */
|
|
20
|
+
data?: DropdownItem[];
|
|
21
|
+
/** Format type of the data, typically { id: name } or { value: text } */
|
|
22
|
+
format?: number;
|
|
23
|
+
/** Indicates if multiple item selection is allowed */
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
/** Enables the autocomplete feature for user input */
|
|
26
|
+
autocomplete?: boolean;
|
|
27
|
+
/** Rendering style of the dropdown: 'default', 'picker', 'searchbar' or inline */
|
|
28
|
+
type?: 'default' | 'picker' | 'searchbar' | 'inline',
|
|
29
|
+
/** Defines the dropdown's width */
|
|
30
|
+
width?: number;
|
|
31
|
+
/** The initial value of the dropdown */
|
|
32
|
+
value?: string | string[] | number | number[];
|
|
33
|
+
/** Placeholder text for the dropdown */
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
/** Event handler for value changes */
|
|
36
|
+
onchange?: (el: HTMLElement, obj: Dropdown, oldValue: string, newValue: string) => void;
|
|
37
|
+
/** Event handler for when the dropdown is ready */
|
|
38
|
+
onload?: (el: HTMLElement, obj: Dropdown, data: any, val: any) => void;
|
|
39
|
+
/** Event handler for when the dropdown opens */
|
|
40
|
+
onopen?: (el: HTMLElement) => void;
|
|
41
|
+
/** Event handler for when the dropdown closes */
|
|
42
|
+
onclose?: (el: HTMLElement) => void;
|
|
43
|
+
/** Event handler for when a new option is added to the dropdown */
|
|
44
|
+
oninsert?: (obj: Dropdown, item: DropdownItem, newItem: DropdownItem) => void;
|
|
45
|
+
/** Event handler for just before a new option is added to the dropdown */
|
|
46
|
+
onbeforeinsert?: (obj: Dropdown, item: DropdownItem) => void;
|
|
47
|
+
/** Event handler for before a search on autocomplete is performed */
|
|
48
|
+
onbeforesearch?: (obj: Dropdown, ajaxRequest: object) => boolean | null;
|
|
49
|
+
/** Event handler for processing search results */
|
|
50
|
+
onsearch?: (obj: Dropdown, result: object) => void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type Dropdown = (el: HTMLElement, options: DropdownOptions) => {
|
|
54
|
+
/** Internal type */
|
|
55
|
+
type: 'dropdown';
|
|
56
|
+
/** Current internal value */
|
|
57
|
+
value: Record<number, string>;
|
|
156
58
|
}
|