selectic 3.0.21 → 3.1.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/selectic.common.js +545 -67
- package/dist/selectic.esm.js +546 -69
- package/doc/changeIcons.md +118 -0
- package/doc/changeText.md +1 -1
- package/doc/domProperties.md +57 -19
- package/doc/extendedProperties.md +83 -72
- package/doc/main.md +2 -0
- package/doc/params.md +177 -112
- package/doc/properties.md +42 -0
- package/package.json +4 -4
- package/src/ExtendedList.tsx +53 -6
- package/src/Filter.tsx +11 -9
- package/src/Icon.tsx +199 -0
- package/src/List.tsx +12 -6
- package/src/MainInput.tsx +15 -11
- package/src/Store.tsx +290 -123
- package/src/css/selectic.css +24 -0
- package/src/icons/caret-down.tsx +21 -0
- package/src/icons/caret-up.tsx +21 -0
- package/src/icons/check.tsx +23 -0
- package/src/icons/question.tsx +21 -0
- package/src/icons/search.tsx +21 -0
- package/src/icons/spinner.tsx +21 -0
- package/src/icons/strikeThrough.tsx +21 -0
- package/src/icons/times.tsx +21 -0
- package/src/index.tsx +78 -37
- package/test/Store/Store_computed.spec.js +84 -0
- package/test/Store/changeIcons.spec.js +154 -0
- package/test/Store/selectGroup.spec.js +389 -0
- package/test/Store/selectItem.spec.js +100 -46
- package/test/helper.js +38 -34
- package/types/ExtendedList.d.ts +7 -2
- package/types/Icon.d.ts +25 -0
- package/types/Store.d.ts +142 -5
- package/types/icons/caret-down.d.ts +6 -0
- package/types/icons/caret-up.d.ts +6 -0
- package/types/icons/check.d.ts +6 -0
- package/types/icons/question.d.ts +6 -0
- package/types/icons/search.d.ts +6 -0
- package/types/icons/spinner.d.ts +6 -0
- package/types/icons/strikeThrough.d.ts +6 -0
- package/types/icons/times.d.ts +6 -0
- package/types/index.d.ts +74 -1
package/types/Store.d.ts
CHANGED
|
@@ -36,92 +36,218 @@ export declare type FetchCallback = (_search: string, _offsetItem: number, _page
|
|
|
36
36
|
}>;
|
|
37
37
|
export declare type GetCallback = (_ids: OptionId[]) => Promise<OptionValue[]>;
|
|
38
38
|
export declare type FormatCallback = (_option: OptionItem) => OptionItem;
|
|
39
|
-
export declare type SelectionOverflow =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export declare type
|
|
39
|
+
export declare type SelectionOverflow =
|
|
40
|
+
/** Items are reduced in width and an ellipsis is displayed in their name. */
|
|
41
|
+
'collapsed' | 'multiline';
|
|
42
|
+
export declare type ListPosition =
|
|
43
|
+
/** Display the list at bottom */
|
|
44
|
+
'bottom'
|
|
45
|
+
/** Display the list at bottom */
|
|
46
|
+
| 'top'
|
|
47
|
+
/** Display the list at bottom but if there is not enough space, display it at top */
|
|
48
|
+
| 'auto';
|
|
49
|
+
export declare type HideFilter =
|
|
50
|
+
/** Display or hide the filter panel */
|
|
51
|
+
boolean
|
|
52
|
+
/** The handler to open the filter panel is hidden only if there is less
|
|
53
|
+
* than 10 options */
|
|
54
|
+
| 'auto'
|
|
55
|
+
/** The panel filter is always open */
|
|
56
|
+
| 'open';
|
|
57
|
+
export declare type SelectAllOption =
|
|
58
|
+
/** Display the "select all" only when data are all fetched or allowRevert */
|
|
59
|
+
'auto'
|
|
60
|
+
/** Always display the "select all" in mulitple mode. */
|
|
61
|
+
| 'visible';
|
|
43
62
|
export interface SelecticStoreStateParams {
|
|
63
|
+
/** Equivalent of <select>'s "multiple" attribute */
|
|
44
64
|
multiple?: boolean;
|
|
65
|
+
/** Equivalent of <input>'s "placeholder" attribute */
|
|
45
66
|
placeholder?: string;
|
|
67
|
+
/** Hide filter component when enabled */
|
|
46
68
|
hideFilter?: HideFilter;
|
|
69
|
+
/** Allow to reverse selection.
|
|
70
|
+
* If true, parent should support the selectionIsExcluded property.
|
|
71
|
+
* If false, the action is never available.
|
|
72
|
+
* If undefined, the action is available only when it is not needed to
|
|
73
|
+
* change selectionIsExcluded property.
|
|
74
|
+
*/
|
|
47
75
|
allowRevert?: boolean;
|
|
76
|
+
/** Force the availability of the "select all" even if all data is not fetched yet. */
|
|
48
77
|
forceSelectAll?: SelectAllOption;
|
|
78
|
+
/** Allow user to clear current selection */
|
|
49
79
|
allowClearSelection?: boolean;
|
|
80
|
+
/** Number of items to retrieve in fetch request (it is possible
|
|
81
|
+
* to fetch more items at once if several pages are requested) */
|
|
50
82
|
pageSize?: number;
|
|
83
|
+
/** Select the first available option */
|
|
51
84
|
autoSelect?: boolean;
|
|
85
|
+
/** Disable the select if only one option is given and must be selected. */
|
|
52
86
|
autoDisabled?: boolean;
|
|
87
|
+
/** Accept only values which are in options */
|
|
53
88
|
strictValue?: boolean;
|
|
89
|
+
/** Define how the component should behave when selected items are too
|
|
90
|
+
* large for the container.
|
|
91
|
+
* collapsed (default): Items are reduced in width and an ellipsis
|
|
92
|
+
* is displayed in their name.
|
|
93
|
+
* multiline: The container extends in height in order to display all
|
|
94
|
+
* items.
|
|
95
|
+
*/
|
|
54
96
|
selectionOverflow?: SelectionOverflow;
|
|
97
|
+
/** Called when item is displayed in the list. */
|
|
55
98
|
formatOption?: FormatCallback;
|
|
99
|
+
/** Called when item is displayed in the selection area. */
|
|
56
100
|
formatSelection?: FormatCallback;
|
|
101
|
+
/** Described behavior when options from several sources are set (static, dynamic, slots)
|
|
102
|
+
* It describe what to do (sort or force)
|
|
103
|
+
* and the order (O → static options, D → dynamic options, E → slot elements)
|
|
104
|
+
* Example: "sort-ODE"
|
|
105
|
+
*/
|
|
57
106
|
optionBehavior?: string;
|
|
107
|
+
/** Indicate where the list should be deployed */
|
|
58
108
|
listPosition?: ListPosition;
|
|
109
|
+
/** If true, the component is open at start */
|
|
59
110
|
isOpen?: boolean;
|
|
111
|
+
/** Avoid selecting all items when clicking on group's header */
|
|
112
|
+
disableGroupSelection?: boolean;
|
|
60
113
|
}
|
|
61
114
|
export interface Props {
|
|
115
|
+
/** Selected value */
|
|
62
116
|
value?: SelectedValue | null;
|
|
117
|
+
/** If true, the value represents the ones we don't want to select */
|
|
63
118
|
selectionIsExcluded?: boolean;
|
|
119
|
+
/** Equivalent of "disabled" Select's attribute */
|
|
64
120
|
disabled?: boolean;
|
|
121
|
+
/** List of options to display */
|
|
65
122
|
options?: OptionProp[] | null;
|
|
123
|
+
/** List of options to display from child elements */
|
|
66
124
|
childOptions?: OptionValue[];
|
|
125
|
+
/** Define groups which will be used by items */
|
|
67
126
|
groups?: GroupValue[];
|
|
127
|
+
/** Overwrite default texts */
|
|
68
128
|
texts?: PartialMessages | null;
|
|
129
|
+
/** Overwrite default icons */
|
|
130
|
+
icons?: PartialIcons | null;
|
|
131
|
+
/** Overwrite default icon family */
|
|
132
|
+
iconFamily?: IconFamily | null;
|
|
133
|
+
/** Keep this component open if another Selectic component opens */
|
|
69
134
|
keepOpenWithOtherSelectic?: boolean;
|
|
135
|
+
/** Selectic configuration */
|
|
70
136
|
params?: SelecticStoreStateParams;
|
|
137
|
+
/** Method to call to fetch extra data */
|
|
71
138
|
fetchCallback?: FetchCallback | null;
|
|
139
|
+
/** Method to call to get specific item */
|
|
72
140
|
getItemsCallback?: GetCallback | null;
|
|
73
141
|
}
|
|
74
142
|
declare type InternalProps = MandateProps<Props>;
|
|
75
143
|
export interface Data {
|
|
144
|
+
/** Number of items displayed in a page (before scrolling) */
|
|
76
145
|
itemsPerPage: number;
|
|
77
146
|
labels: Messages;
|
|
147
|
+
icons: PartialIcons;
|
|
148
|
+
iconFamily: IconFamily;
|
|
149
|
+
/** used to avoid checking and updating table while doing batch stuff */
|
|
78
150
|
doNotUpdate: boolean;
|
|
79
151
|
cacheItem: Map<OptionId, OptionValue>;
|
|
80
152
|
activeOrder: OptionBehaviorOrder;
|
|
81
153
|
dynOffset: number;
|
|
82
154
|
}
|
|
83
155
|
export interface SelecticStoreState {
|
|
156
|
+
/** The current selected values */
|
|
84
157
|
internalValue: SelectedValue;
|
|
158
|
+
/** If true, user wants to choose the opposite selection */
|
|
85
159
|
selectionIsExcluded: boolean;
|
|
160
|
+
/** If true, several value can be selected */
|
|
86
161
|
multiple: boolean;
|
|
162
|
+
/** If true, no change can be done by user */
|
|
87
163
|
disabled: boolean;
|
|
164
|
+
/** Define the default text to display when there is no selection */
|
|
88
165
|
placeholder: string;
|
|
166
|
+
/** If true, filters and controls are hidden */
|
|
89
167
|
hideFilter: boolean;
|
|
168
|
+
/** If true, the filter panel is always open */
|
|
90
169
|
keepFilterOpen: boolean;
|
|
170
|
+
/** Allow to reverse selection.
|
|
171
|
+
* If true, parent should support the selectionIsExcluded property.
|
|
172
|
+
* If false, the action is never available.
|
|
173
|
+
* If undefined, the action is available only when it is not needed to
|
|
174
|
+
* change selectionIsExcluded property.
|
|
175
|
+
*/
|
|
91
176
|
allowRevert?: boolean;
|
|
177
|
+
/** If true, user can clear current selection
|
|
178
|
+
* (if false, it is still possible to clear it programmatically) */
|
|
92
179
|
allowClearSelection: boolean;
|
|
180
|
+
/** If false, do not select the first available option even if value is mandatory */
|
|
93
181
|
autoSelect: boolean;
|
|
182
|
+
/** If true, Selectic is disabled if there is only one mandatory option. */
|
|
94
183
|
autoDisabled: boolean;
|
|
184
|
+
/** If true, only values which are in options are accepted. */
|
|
95
185
|
strictValue: boolean;
|
|
186
|
+
/** Define how to behave when selected items are too large for container. */
|
|
96
187
|
selectionOverflow: SelectionOverflow;
|
|
188
|
+
/** If true, the list is displayed */
|
|
97
189
|
isOpen: boolean;
|
|
190
|
+
/** Text entered by user to look for options */
|
|
98
191
|
searchText: string;
|
|
192
|
+
/** Contains all known options */
|
|
99
193
|
allOptions: OptionValue[];
|
|
194
|
+
/** Contains all fetched dynamic options */
|
|
100
195
|
dynOptions: OptionValue[];
|
|
196
|
+
/** Contains options which should be displayed */
|
|
101
197
|
filteredOptions: OptionItem[];
|
|
198
|
+
/** Contains options which are selected */
|
|
102
199
|
selectedOptions: OptionItem | OptionItem[] | null;
|
|
200
|
+
/** The total number of all options (static + dynamic + elements) without any filter */
|
|
103
201
|
totalAllOptions: number;
|
|
202
|
+
/** The total number of options which can be fetched (without any filter) */
|
|
104
203
|
totalDynOptions: number;
|
|
204
|
+
/** The total number of options which should be displayed (filter is applied) */
|
|
105
205
|
totalFilteredOptions: number;
|
|
206
|
+
/** Description of groups (optGroup) */
|
|
106
207
|
groups: Map<OptionId, string>;
|
|
208
|
+
/** Starting index of options which are displayed */
|
|
107
209
|
offsetItem: number;
|
|
210
|
+
/** Index of active item */
|
|
108
211
|
activeItemIdx: number;
|
|
212
|
+
/** Number of items to fetch per page */
|
|
109
213
|
pageSize: number;
|
|
214
|
+
/** Called when item is displayed in the list. */
|
|
110
215
|
formatOption?: FormatCallback;
|
|
216
|
+
/** Called when item is displayed in the selection area. */
|
|
111
217
|
formatSelection?: FormatCallback;
|
|
218
|
+
/** Operation to apply when there are several sources */
|
|
112
219
|
optionBehaviorOperation: OptionBehaviorOperation;
|
|
220
|
+
/** Order of sources options */
|
|
113
221
|
optionBehaviorOrder: OptionBehaviorOrder[];
|
|
222
|
+
/** Indicate where the list should be deployed */
|
|
114
223
|
listPosition: ListPosition;
|
|
224
|
+
/** If true, the "select All" is still available even if all data are not fetched yet. */
|
|
115
225
|
forceSelectAll: SelectAllOption;
|
|
226
|
+
/** Avoid selecting all items when clicking on group's header */
|
|
227
|
+
disableGroupSelection: boolean;
|
|
228
|
+
/** Inner status which should be modified only by store */
|
|
116
229
|
status: {
|
|
230
|
+
/** If true, a search is currently done */
|
|
117
231
|
searching: boolean;
|
|
232
|
+
/** If not empty, an error happens */
|
|
118
233
|
errorMessage: string;
|
|
234
|
+
/** If true it means that all options are selected */
|
|
119
235
|
areAllSelected: boolean;
|
|
236
|
+
/** If true, a change has been done by user */
|
|
120
237
|
hasChanged: boolean;
|
|
238
|
+
/** If true, it means the current change has been done automatically by Selectic */
|
|
121
239
|
automaticChange: boolean;
|
|
240
|
+
/** If true, it means the current close has been done automatically by Selectic */
|
|
122
241
|
automaticClose: boolean;
|
|
123
242
|
};
|
|
124
243
|
}
|
|
244
|
+
export declare type IconFamily = '' | 'selectic' | 'font-awesome-4' | 'font-awesome-5' | 'font-awesome-6' | 'raw' | `prefix:${string}`;
|
|
245
|
+
export declare type IconKey = 'caret-down' | 'caret-up' | 'check' | 'search' | 'spinner' | 'strikethrough' | 'times' | 'question' | 'spin';
|
|
246
|
+
export declare type IconValue = `selectic:${IconKey}${'' | ':spin'}` | `raw:${string}` | `current:${IconKey}${'' | ':spin'}` | string;
|
|
247
|
+
export declare type Icons = Record<IconKey, IconValue>;
|
|
248
|
+
export declare type PartialIcons = {
|
|
249
|
+
[K in IconKey]?: Icons[K];
|
|
250
|
+
};
|
|
125
251
|
interface Messages {
|
|
126
252
|
noFetchMethod: string;
|
|
127
253
|
searchPlaceholder: string;
|
|
@@ -145,6 +271,7 @@ export declare type PartialMessages = {
|
|
|
145
271
|
[K in keyof Messages]?: Messages[K];
|
|
146
272
|
};
|
|
147
273
|
export declare function changeTexts(texts: PartialMessages): void;
|
|
274
|
+
export declare function changeIcons(newIcons: PartialIcons, newFamilyIcon?: IconFamily): void;
|
|
148
275
|
export default class SelecticStore {
|
|
149
276
|
props: InternalProps;
|
|
150
277
|
state: SelecticStoreState;
|
|
@@ -152,7 +279,10 @@ export default class SelecticStore {
|
|
|
152
279
|
private requestId;
|
|
153
280
|
private cacheRequest;
|
|
154
281
|
private closeSelectic;
|
|
282
|
+
/** Number of item to pre-display */
|
|
155
283
|
marginSize: ComputedRef<number>;
|
|
284
|
+
/** If true, it is possible to click on group to select all items inside */
|
|
285
|
+
allowGroupSelection: ComputedRef<boolean>;
|
|
156
286
|
isPartial: ComputedRef<boolean>;
|
|
157
287
|
hasAllItems: ComputedRef<boolean>;
|
|
158
288
|
hasFetchedAllItems: ComputedRef<boolean>;
|
|
@@ -165,13 +295,15 @@ export default class SelecticStore {
|
|
|
165
295
|
setAutomaticClose(): void;
|
|
166
296
|
getItem(id: OptionId): OptionValue;
|
|
167
297
|
getItems(ids: OptionId[]): Promise<OptionItem[]>;
|
|
168
|
-
|
|
298
|
+
selectGroup(id: OptionId, itemsSelected: boolean): void;
|
|
299
|
+
selectItem(id: OptionId, selected?: boolean, keepOpen?: boolean): boolean;
|
|
169
300
|
toggleSelectAll(): void;
|
|
170
301
|
resetChange(): void;
|
|
171
302
|
resetErrorMessage(): void;
|
|
172
303
|
clearCache(forceReset?: boolean): void;
|
|
173
304
|
changeGroups(groups: GroupValue[]): void;
|
|
174
305
|
changeTexts(texts: PartialMessages): void;
|
|
306
|
+
changeIcons(icons: PartialIcons | null, family?: IconFamily | null): void;
|
|
175
307
|
private hasValue;
|
|
176
308
|
private getValue;
|
|
177
309
|
private convertTypeValue;
|
|
@@ -179,6 +311,7 @@ export default class SelecticStore {
|
|
|
179
311
|
private assertCorrectValue;
|
|
180
312
|
private updateFilteredOptions;
|
|
181
313
|
private addGroups;
|
|
314
|
+
/** This method is for the computed property listOptions */
|
|
182
315
|
private getListOptions;
|
|
183
316
|
private getElementOptions;
|
|
184
317
|
private buildAllOptions;
|
|
@@ -196,5 +329,9 @@ export default class SelecticStore {
|
|
|
196
329
|
private checkAutoSelect;
|
|
197
330
|
private checkAutoDisabled;
|
|
198
331
|
private checkHideFilter;
|
|
332
|
+
/** update group item, to mark them as selected if needed */
|
|
333
|
+
private updateGroupSelection;
|
|
334
|
+
/** assign new value to the filteredOptions and apply change depending on it */
|
|
335
|
+
private setFilteredOptions;
|
|
199
336
|
}
|
|
200
337
|
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vue, h } from 'vtyx';
|
|
2
2
|
import './css/selectic.css';
|
|
3
|
-
import { OptionProp, OptionId, StrictOptionId, GroupValue, SelectedValue, FetchCallback, GetCallback, PartialMessages, OptionValue, OptionItem, FormatCallback, SelectionOverflow, ListPosition, HideFilter, SelectAllOption } from './Store';
|
|
3
|
+
import { OptionProp, OptionId, StrictOptionId, GroupValue, SelectedValue, FetchCallback, GetCallback, PartialMessages, OptionValue, OptionItem, FormatCallback, SelectionOverflow, ListPosition, HideFilter, SelectAllOption, PartialIcons, IconFamily } from './Store';
|
|
4
4
|
import MainInput from './MainInput';
|
|
5
5
|
import ExtendedList from './ExtendedList';
|
|
6
6
|
export { GroupValue, OptionValue, OptionItem, OptionProp, OptionId, StrictOptionId, SelectedValue, PartialMessages, GetCallback, FetchCallback, FormatCallback, SelectionOverflow, ListPosition, HideFilter, };
|
|
@@ -14,47 +14,109 @@ export interface EventChangeOptions extends EventOptions {
|
|
|
14
14
|
isExcluded: boolean;
|
|
15
15
|
}
|
|
16
16
|
export interface ParamProps {
|
|
17
|
+
/** Method to call to fetch extra data */
|
|
17
18
|
fetchCallback?: FetchCallback;
|
|
19
|
+
/** Method to call to get specific items */
|
|
18
20
|
getItemsCallback?: GetCallback;
|
|
21
|
+
/** Number of elements to fetch.
|
|
22
|
+
* When scrolled too fast, a greater number of elements
|
|
23
|
+
* are going to be requested.
|
|
24
|
+
*/
|
|
19
25
|
pageSize?: number;
|
|
26
|
+
/** Hide the search control */
|
|
20
27
|
hideFilter?: HideFilter;
|
|
28
|
+
/** Allow to reverse selection.
|
|
29
|
+
* If true, parent should support the selectionIsExcluded property.
|
|
30
|
+
* If false, the action is never available.
|
|
31
|
+
* If undefined, the action is available only when it is not needed to
|
|
32
|
+
* change selectionIsExcluded property.
|
|
33
|
+
*/
|
|
21
34
|
allowRevert?: boolean;
|
|
35
|
+
/** If true, the "select All" is still available even if all data are not fetched yet. */
|
|
22
36
|
forceSelectAll?: SelectAllOption;
|
|
37
|
+
/** Allow user to clear the current selection */
|
|
23
38
|
allowClearSelection?: boolean;
|
|
39
|
+
/** If false, avoid selecting the first available option. */
|
|
24
40
|
autoSelect?: boolean;
|
|
41
|
+
/** Disable the select if no or only one option is given and must be selected. */
|
|
25
42
|
autoDisabled?: boolean;
|
|
43
|
+
/** If true, value can be only in existing options. */
|
|
26
44
|
strictValue?: boolean;
|
|
45
|
+
/** Define how to behave when selected items are too large for container.
|
|
46
|
+
* collapsed (default): Items are reduced in width and an ellipsis
|
|
47
|
+
* is displayed in their name.
|
|
48
|
+
* multiline: The container extends in height in order to display all
|
|
49
|
+
* items.
|
|
50
|
+
*/
|
|
27
51
|
selectionOverflow?: SelectionOverflow;
|
|
52
|
+
/** In single mode, if no selection, this value is returned (default=null). */
|
|
28
53
|
emptyValue?: SelectedValue;
|
|
54
|
+
/** Called when item is displayed in the list. */
|
|
29
55
|
formatOption?: FormatCallback;
|
|
56
|
+
/** Called when item is displayed in the selection area. */
|
|
30
57
|
formatSelection?: FormatCallback;
|
|
58
|
+
/** Define where the list should be displayed.
|
|
59
|
+
* With 'auto' it is displayed by default at bottom, but it can be at
|
|
60
|
+
* top if there is not enough space below. */
|
|
31
61
|
listPosition?: ListPosition;
|
|
62
|
+
/** Described behavior when options from several sources are set (static, dynamic, slots)
|
|
63
|
+
* It describe what to do (sort or force)
|
|
64
|
+
* and the order (O → static options, D → dynamic options, E → slot elements)
|
|
65
|
+
* Example: "sort-ODE"
|
|
66
|
+
*/
|
|
32
67
|
optionBehavior?: string;
|
|
68
|
+
/** Keep this component open if another Selectic component opens */
|
|
33
69
|
keepOpenWithOtherSelectic?: boolean;
|
|
70
|
+
/** Avoid click on group name to select all items in this group. */
|
|
71
|
+
disableGroupSelection?: boolean;
|
|
34
72
|
}
|
|
35
73
|
export declare type OnCallback = (event: string, ...args: any[]) => void;
|
|
36
74
|
export declare type GetMethodsCallback = (methods: {
|
|
37
75
|
clearCache: Selectic['clearCache'];
|
|
38
76
|
changeTexts: Selectic['changeTexts'];
|
|
77
|
+
changeIcons: Selectic['changeIcons'];
|
|
39
78
|
getValue: Selectic['getValue'];
|
|
40
79
|
getSelectedItems: Selectic['getSelectedItems'];
|
|
41
80
|
isEmpty: Selectic['isEmpty'];
|
|
42
81
|
toggleOpen: Selectic['toggleOpen'];
|
|
43
82
|
}) => void;
|
|
44
83
|
export interface Props {
|
|
84
|
+
/** Selectic's initial value */
|
|
45
85
|
value?: SelectedValue;
|
|
86
|
+
/** If true, the effective selection is the opposite */
|
|
46
87
|
selectionIsExcluded?: boolean;
|
|
88
|
+
/** List of options to display */
|
|
47
89
|
options?: OptionProp[];
|
|
90
|
+
/** Define groups of items (similar to optGroup) */
|
|
48
91
|
groups?: GroupValue[];
|
|
92
|
+
/** Equivalent of <select>'s "multiple" attribute */
|
|
49
93
|
multiple?: boolean;
|
|
94
|
+
/** Equivalent of <select>'s "disabled" attribute */
|
|
50
95
|
disabled?: boolean;
|
|
96
|
+
/** Equivalent of <input>'s "placeholder" attribute */
|
|
51
97
|
placeholder?: string;
|
|
98
|
+
/** id of the HTML element */
|
|
52
99
|
id?: string;
|
|
100
|
+
/** CSS class of the HTML element */
|
|
53
101
|
className?: string;
|
|
102
|
+
/** title on the HTML element */
|
|
54
103
|
title?: string;
|
|
104
|
+
/** Replace the default texts used in Selectic */
|
|
55
105
|
texts?: PartialMessages;
|
|
106
|
+
/** Replace the default icons used in Selectic */
|
|
107
|
+
icons?: PartialIcons;
|
|
108
|
+
/** Replace the default icon family used in Selectic */
|
|
109
|
+
iconFamily?: IconFamily;
|
|
110
|
+
/** If enabled, it resets the dynamic cache when selectic opens */
|
|
56
111
|
noCache?: Boolean;
|
|
112
|
+
/** If true, the component opens (at start or if it is closed).
|
|
113
|
+
* If false, the components closes (if it is opened). */
|
|
57
114
|
open?: Boolean;
|
|
115
|
+
/** Props which is not expected to change during the life time of the
|
|
116
|
+
* component.
|
|
117
|
+
* These parameters modify the component behavior but are not official
|
|
118
|
+
* attributes of select.
|
|
119
|
+
*/
|
|
58
120
|
params?: ParamProps;
|
|
59
121
|
/** _on is used mainly for tests.
|
|
60
122
|
* Its purpose is to propagate $emit event mainly
|
|
@@ -67,6 +129,7 @@ export interface Props {
|
|
|
67
129
|
_getMethods?: GetMethodsCallback;
|
|
68
130
|
}
|
|
69
131
|
export declare function changeTexts(texts: PartialMessages): void;
|
|
132
|
+
export declare function changeIcons(icons: PartialIcons, iconFamily?: IconFamily): void;
|
|
70
133
|
export default class Selectic extends Vue<Props> {
|
|
71
134
|
$refs: {
|
|
72
135
|
mainInput: MainInput;
|
|
@@ -83,6 +146,8 @@ export default class Selectic extends Vue<Props> {
|
|
|
83
146
|
className: string;
|
|
84
147
|
title?: string;
|
|
85
148
|
texts?: PartialMessages;
|
|
149
|
+
icons?: PartialIcons;
|
|
150
|
+
iconFamily?: IconFamily;
|
|
86
151
|
noCache: boolean;
|
|
87
152
|
open?: boolean;
|
|
88
153
|
params: ParamProps;
|
|
@@ -110,10 +175,17 @@ export default class Selectic extends Vue<Props> {
|
|
|
110
175
|
})[];
|
|
111
176
|
get hasGivenValue(): boolean;
|
|
112
177
|
get defaultValue(): string | number | StrictOptionId[] | null;
|
|
178
|
+
/** Reset the inner cache (mainly for dynamic mode if context has changed) */
|
|
113
179
|
clearCache(forceReset?: boolean): void;
|
|
180
|
+
/** Allow to change all text of the component */
|
|
114
181
|
changeTexts(texts: PartialMessages): void;
|
|
182
|
+
/** Allow to change all icons of the component */
|
|
183
|
+
changeIcons(icons: PartialIcons, iconFamily?: IconFamily): void;
|
|
184
|
+
/** Return the current selection */
|
|
115
185
|
getValue(): SelectedValue;
|
|
186
|
+
/** Return the current selection in Item format */
|
|
116
187
|
getSelectedItems(): OptionValue | OptionValue[];
|
|
188
|
+
/** Check if there are Options available in the components */
|
|
117
189
|
isEmpty(): boolean;
|
|
118
190
|
toggleOpen(open?: boolean): boolean;
|
|
119
191
|
private computeWidth;
|
|
@@ -125,6 +197,7 @@ export default class Selectic extends Vue<Props> {
|
|
|
125
197
|
onExcludedChange(): void;
|
|
126
198
|
onOptionsChange(): void;
|
|
127
199
|
onTextsChange(): void;
|
|
200
|
+
onIconsChange(): void;
|
|
128
201
|
onDisabledChange(): void;
|
|
129
202
|
onGroupsChanged(): void;
|
|
130
203
|
onPlaceholderChanged(): void;
|