selectic 1.3.11 → 3.0.3
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/README.md +6 -5
- package/dist/selectic.common.js +708 -594
- package/dist/selectic.esm.js +670 -557
- package/doc/breakingChanges.md +55 -0
- package/doc/events.md +68 -17
- package/doc/main.md +7 -0
- package/doc/params.md +5 -2
- package/package.json +46 -41
- package/src/ExtendedList.tsx +14 -13
- package/src/Filter.tsx +34 -22
- package/src/List.tsx +14 -13
- package/src/MainInput.tsx +26 -27
- package/src/Store.tsx +446 -291
- package/src/css/selectic.css +6 -0
- package/src/index.tsx +249 -140
- package/test/Selectic/Selectic_props.spec.js +29 -10
- package/test/Store/Store_creation.spec.js +451 -438
- package/test/Store/Store_props.spec.js +119 -159
- package/test/Store/Store_state.spec.js +9 -13
- package/test/Store/changeGroups.spec.js +4 -6
- package/test/Store/changeTexts.spec.js +28 -30
- package/test/Store/clearCache.spec.js +24 -8
- package/test/Store/commit.spec.js +256 -99
- package/test/Store/getItem.spec.js +30 -38
- package/test/Store/getItems.spec.js +33 -43
- package/test/Store/selectItem.spec.js +4 -4
- package/test/Store/toggleSelectAll.spec.js +50 -52
- package/test/helper.js +3 -0
- package/test/tools.js +4 -2
- package/tsconfig.json +5 -0
- package/types/ExtendedList.d.ts +6 -6
- package/types/Filter.d.ts +5 -5
- package/types/List.d.ts +33 -9
- package/types/MainInput.d.ts +5 -5
- package/types/Store.d.ts +176 -42
- package/types/index.d.ts +54 -24
- package/types/OldStore.d.ts +0 -195
package/types/MainInput.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Vue } from 'vtyx';
|
|
1
|
+
import { Vue, h } from 'vtyx';
|
|
2
2
|
import Store, { OptionItem } from './Store';
|
|
3
3
|
export interface Props {
|
|
4
4
|
store: Store;
|
|
5
5
|
id?: string;
|
|
6
6
|
}
|
|
7
|
-
export default class
|
|
7
|
+
export default class MainInput extends Vue<Props> {
|
|
8
8
|
$refs: {
|
|
9
9
|
selectedItems: HTMLDivElement;
|
|
10
10
|
};
|
|
@@ -31,7 +31,7 @@ export default class Selectic extends Vue<Props> {
|
|
|
31
31
|
private selectItem;
|
|
32
32
|
private clearSelection;
|
|
33
33
|
private computeSize;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
onInternalChange(): void;
|
|
35
|
+
updated(): void;
|
|
36
|
+
render(): h.JSX.Element;
|
|
37
37
|
}
|
package/types/Store.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
declare type MandateProps<T extends {}> = {
|
|
3
|
+
[TK in keyof T]-?: T[TK];
|
|
4
|
+
};
|
|
2
5
|
export declare type StrictOptionId = string | number;
|
|
3
6
|
export declare type OptionId = StrictOptionId | null;
|
|
4
7
|
export declare type SelectedValue = OptionId | StrictOptionId[];
|
|
@@ -34,10 +37,11 @@ export declare type GetCallback = (_ids: OptionId[]) => Promise<OptionValue[]>;
|
|
|
34
37
|
export declare type FormatCallback = (_option: OptionItem) => OptionItem;
|
|
35
38
|
export declare type SelectionOverflow = 'collapsed' | 'multiline';
|
|
36
39
|
export declare type ListPosition = 'bottom' | 'top' | 'auto';
|
|
40
|
+
export declare type HideFilter = boolean | 'auto' | 'open';
|
|
37
41
|
export interface SelecticStoreStateParams {
|
|
38
42
|
multiple?: boolean;
|
|
39
43
|
placeholder?: string;
|
|
40
|
-
hideFilter?:
|
|
44
|
+
hideFilter?: HideFilter;
|
|
41
45
|
allowRevert?: boolean;
|
|
42
46
|
allowClearSelection?: boolean;
|
|
43
47
|
pageSize?: number;
|
|
@@ -48,20 +52,30 @@ export interface SelecticStoreStateParams {
|
|
|
48
52
|
formatOption?: FormatCallback;
|
|
49
53
|
formatSelection?: FormatCallback;
|
|
50
54
|
optionBehavior?: string;
|
|
55
|
+
listPosition?: ListPosition;
|
|
51
56
|
isOpen?: boolean;
|
|
52
57
|
}
|
|
53
58
|
export interface Props {
|
|
54
|
-
value?: SelectedValue;
|
|
59
|
+
value?: SelectedValue | null;
|
|
55
60
|
selectionIsExcluded?: boolean;
|
|
56
61
|
disabled?: boolean;
|
|
57
|
-
options?: OptionProp[];
|
|
58
|
-
childOptions?:
|
|
62
|
+
options?: OptionProp[] | null;
|
|
63
|
+
childOptions?: OptionValue[];
|
|
59
64
|
groups?: GroupValue[];
|
|
60
|
-
texts?: PartialMessages;
|
|
65
|
+
texts?: PartialMessages | null;
|
|
61
66
|
keepOpenWithOtherSelectic?: boolean;
|
|
62
67
|
params?: SelecticStoreStateParams;
|
|
63
|
-
fetchCallback?: FetchCallback;
|
|
64
|
-
getItemsCallback?: GetCallback;
|
|
68
|
+
fetchCallback?: FetchCallback | null;
|
|
69
|
+
getItemsCallback?: GetCallback | null;
|
|
70
|
+
}
|
|
71
|
+
declare type InternalProps = MandateProps<Props>;
|
|
72
|
+
export interface Data {
|
|
73
|
+
itemsPerPage: number;
|
|
74
|
+
labels: Messages;
|
|
75
|
+
doNotUpdate: boolean;
|
|
76
|
+
cacheItem: Map<OptionId, OptionValue>;
|
|
77
|
+
activeOrder: OptionBehaviorOrder;
|
|
78
|
+
dynOffset: number;
|
|
65
79
|
}
|
|
66
80
|
export interface SelecticStoreState {
|
|
67
81
|
internalValue: SelectedValue;
|
|
@@ -70,6 +84,7 @@ export interface SelecticStoreState {
|
|
|
70
84
|
disabled: boolean;
|
|
71
85
|
placeholder: string;
|
|
72
86
|
hideFilter: boolean;
|
|
87
|
+
keepFilterOpen: boolean;
|
|
73
88
|
allowRevert?: boolean;
|
|
74
89
|
allowClearSelection: boolean;
|
|
75
90
|
autoSelect: boolean;
|
|
@@ -99,6 +114,8 @@ export interface SelecticStoreState {
|
|
|
99
114
|
errorMessage: string;
|
|
100
115
|
areAllSelected: boolean;
|
|
101
116
|
hasChanged: boolean;
|
|
117
|
+
automaticChange: boolean;
|
|
118
|
+
automaticClose: boolean;
|
|
102
119
|
};
|
|
103
120
|
}
|
|
104
121
|
interface Messages {
|
|
@@ -123,33 +140,158 @@ export declare type PartialMessages = {
|
|
|
123
140
|
[K in keyof Messages]?: Messages[K];
|
|
124
141
|
};
|
|
125
142
|
export declare function changeTexts(texts: PartialMessages): void;
|
|
126
|
-
export default class SelecticStore
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
export default class SelecticStore {
|
|
144
|
+
props: InternalProps;
|
|
145
|
+
state: {
|
|
146
|
+
internalValue: OptionId | StrictOptionId[];
|
|
147
|
+
selectionIsExcluded: boolean;
|
|
148
|
+
multiple: boolean;
|
|
149
|
+
disabled: boolean;
|
|
150
|
+
placeholder: string;
|
|
151
|
+
hideFilter: boolean;
|
|
152
|
+
keepFilterOpen: boolean;
|
|
153
|
+
allowRevert?: boolean | undefined;
|
|
154
|
+
allowClearSelection: boolean;
|
|
155
|
+
autoSelect: boolean;
|
|
156
|
+
autoDisabled: boolean;
|
|
157
|
+
strictValue: boolean;
|
|
158
|
+
selectionOverflow: SelectionOverflow;
|
|
159
|
+
isOpen: boolean;
|
|
160
|
+
searchText: string;
|
|
161
|
+
allOptions: {
|
|
162
|
+
id: OptionId;
|
|
163
|
+
text: string;
|
|
164
|
+
title?: string | undefined;
|
|
165
|
+
disabled?: boolean | undefined;
|
|
166
|
+
group?: StrictOptionId | undefined;
|
|
167
|
+
className?: string | undefined;
|
|
168
|
+
style?: string | undefined;
|
|
169
|
+
icon?: string | undefined;
|
|
170
|
+
options?: any[] | undefined;
|
|
171
|
+
data?: any;
|
|
172
|
+
}[];
|
|
173
|
+
dynOptions: {
|
|
174
|
+
id: OptionId;
|
|
175
|
+
text: string;
|
|
176
|
+
title?: string | undefined;
|
|
177
|
+
disabled?: boolean | undefined;
|
|
178
|
+
group?: StrictOptionId | undefined;
|
|
179
|
+
className?: string | undefined;
|
|
180
|
+
style?: string | undefined;
|
|
181
|
+
icon?: string | undefined;
|
|
182
|
+
options?: any[] | undefined;
|
|
183
|
+
data?: any;
|
|
184
|
+
}[];
|
|
185
|
+
filteredOptions: {
|
|
186
|
+
selected: boolean;
|
|
187
|
+
disabled: boolean;
|
|
188
|
+
isGroup: boolean;
|
|
189
|
+
id: OptionId;
|
|
190
|
+
text: string;
|
|
191
|
+
title?: string | undefined;
|
|
192
|
+
group?: StrictOptionId | undefined;
|
|
193
|
+
className?: string | undefined;
|
|
194
|
+
style?: string | undefined;
|
|
195
|
+
icon?: string | undefined;
|
|
196
|
+
options?: {
|
|
197
|
+
id: OptionId;
|
|
198
|
+
text: string;
|
|
199
|
+
title?: string | undefined;
|
|
200
|
+
disabled?: boolean | undefined;
|
|
201
|
+
group?: StrictOptionId | undefined;
|
|
202
|
+
className?: string | undefined;
|
|
203
|
+
style?: string | undefined;
|
|
204
|
+
icon?: string | undefined;
|
|
205
|
+
options?: any[] | undefined;
|
|
206
|
+
data?: any;
|
|
207
|
+
}[] | undefined;
|
|
208
|
+
data?: any;
|
|
209
|
+
}[];
|
|
210
|
+
selectedOptions: {
|
|
211
|
+
selected: boolean;
|
|
212
|
+
disabled: boolean;
|
|
213
|
+
isGroup: boolean;
|
|
214
|
+
id: OptionId;
|
|
215
|
+
text: string;
|
|
216
|
+
title?: string | undefined;
|
|
217
|
+
group?: StrictOptionId | undefined;
|
|
218
|
+
className?: string | undefined;
|
|
219
|
+
style?: string | undefined;
|
|
220
|
+
icon?: string | undefined;
|
|
221
|
+
options?: {
|
|
222
|
+
id: OptionId;
|
|
223
|
+
text: string;
|
|
224
|
+
title?: string | undefined;
|
|
225
|
+
disabled?: boolean | undefined;
|
|
226
|
+
group?: StrictOptionId | undefined;
|
|
227
|
+
className?: string | undefined;
|
|
228
|
+
style?: string | undefined;
|
|
229
|
+
icon?: string | undefined;
|
|
230
|
+
options?: any[] | undefined;
|
|
231
|
+
data?: any;
|
|
232
|
+
}[] | undefined;
|
|
233
|
+
data?: any;
|
|
234
|
+
} | {
|
|
235
|
+
selected: boolean;
|
|
236
|
+
disabled: boolean;
|
|
237
|
+
isGroup: boolean;
|
|
238
|
+
id: OptionId;
|
|
239
|
+
text: string;
|
|
240
|
+
title?: string | undefined;
|
|
241
|
+
group?: StrictOptionId | undefined;
|
|
242
|
+
className?: string | undefined;
|
|
243
|
+
style?: string | undefined;
|
|
244
|
+
icon?: string | undefined;
|
|
245
|
+
options?: {
|
|
246
|
+
id: OptionId;
|
|
247
|
+
text: string;
|
|
248
|
+
title?: string | undefined;
|
|
249
|
+
disabled?: boolean | undefined;
|
|
250
|
+
group?: StrictOptionId | undefined;
|
|
251
|
+
className?: string | undefined;
|
|
252
|
+
style?: string | undefined;
|
|
253
|
+
icon?: string | undefined;
|
|
254
|
+
options?: any[] | undefined;
|
|
255
|
+
data?: any;
|
|
256
|
+
}[] | undefined;
|
|
257
|
+
data?: any;
|
|
258
|
+
}[] | null;
|
|
259
|
+
totalAllOptions: number;
|
|
260
|
+
totalDynOptions: number;
|
|
261
|
+
totalFilteredOptions: number;
|
|
262
|
+
groups: Map<OptionId, string>;
|
|
263
|
+
offsetItem: number;
|
|
264
|
+
activeItemIdx: number;
|
|
265
|
+
pageSize: number;
|
|
266
|
+
formatOption?: FormatCallback | undefined;
|
|
267
|
+
formatSelection?: FormatCallback | undefined;
|
|
268
|
+
optionBehaviorOperation: OptionBehaviorOperation;
|
|
269
|
+
optionBehaviorOrder: OptionBehaviorOrder[];
|
|
270
|
+
listPosition: ListPosition;
|
|
271
|
+
status: {
|
|
272
|
+
searching: boolean;
|
|
273
|
+
errorMessage: string;
|
|
274
|
+
areAllSelected: boolean;
|
|
275
|
+
hasChanged: boolean;
|
|
276
|
+
automaticChange: boolean;
|
|
277
|
+
automaticClose: boolean;
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
data: Data;
|
|
145
281
|
private requestId;
|
|
146
282
|
private cacheRequest;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
283
|
+
private closeSelectic;
|
|
284
|
+
marginSize: ComputedRef<number>;
|
|
285
|
+
isPartial: ComputedRef<boolean>;
|
|
286
|
+
hasAllItems: ComputedRef<boolean>;
|
|
287
|
+
hasFetchedAllItems: ComputedRef<boolean>;
|
|
288
|
+
private listOptions;
|
|
289
|
+
private elementOptions;
|
|
290
|
+
_uid: number;
|
|
291
|
+
constructor(props?: Props);
|
|
152
292
|
commit<N extends keyof SelecticStoreState, V extends SelecticStoreState[N]>(name: N, value: V): void;
|
|
293
|
+
setAutomaticChange(): void;
|
|
294
|
+
setAutomaticClose(): void;
|
|
153
295
|
getItem(id: OptionId): OptionValue;
|
|
154
296
|
getItems(ids: OptionId[]): Promise<OptionItem[]>;
|
|
155
297
|
selectItem(id: OptionId, selected?: boolean, keepOpen?: boolean): void;
|
|
@@ -161,6 +303,8 @@ export default class SelecticStore extends Vue<Props> {
|
|
|
161
303
|
changeTexts(texts: PartialMessages): void;
|
|
162
304
|
private hasValue;
|
|
163
305
|
private getValue;
|
|
306
|
+
private convertTypeValue;
|
|
307
|
+
private assertValueType;
|
|
164
308
|
private assertCorrectValue;
|
|
165
309
|
private updateFilteredOptions;
|
|
166
310
|
private addGroups;
|
|
@@ -181,15 +325,5 @@ export default class SelecticStore extends Vue<Props> {
|
|
|
181
325
|
private checkAutoSelect;
|
|
182
326
|
private checkAutoDisabled;
|
|
183
327
|
private checkHideFilter;
|
|
184
|
-
protected onOptionsChange(options?: OptionValue[], oldOptions?: OptionValue[]): void;
|
|
185
|
-
protected onChildOptionsChange(childOptions?: OptionValue[], oldChildOptions?: OptionValue[]): void;
|
|
186
|
-
protected onValueChange(): void;
|
|
187
|
-
protected onSelectionExcludedChange(): void;
|
|
188
|
-
protected onDisabledChange(): void;
|
|
189
|
-
protected onFilteredChange(): void;
|
|
190
|
-
protected onInternalValueChange(): void;
|
|
191
|
-
protected onAllOptionChange(): void;
|
|
192
|
-
protected onTotalAllOptionsChange(): void;
|
|
193
|
-
protected created(): void;
|
|
194
328
|
}
|
|
195
329
|
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import { Vue } from 'vtyx';
|
|
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 } from './Store';
|
|
3
|
+
import { OptionProp, OptionId, StrictOptionId, GroupValue, SelectedValue, FetchCallback, GetCallback, PartialMessages, OptionValue, OptionItem, FormatCallback, SelectionOverflow, ListPosition, HideFilter } from './Store';
|
|
4
4
|
import MainInput from './MainInput';
|
|
5
5
|
import ExtendedList from './ExtendedList';
|
|
6
|
-
export { GroupValue, OptionValue, OptionItem, OptionProp, OptionId, StrictOptionId, SelectedValue, PartialMessages, GetCallback, FetchCallback, FormatCallback, SelectionOverflow, ListPosition, };
|
|
6
|
+
export { GroupValue, OptionValue, OptionItem, OptionProp, OptionId, StrictOptionId, SelectedValue, PartialMessages, GetCallback, FetchCallback, FormatCallback, SelectionOverflow, ListPosition, HideFilter, };
|
|
7
|
+
declare type EventType = 'input' | 'change' | 'open' | 'close' | 'focus' | 'blur' | 'item:click';
|
|
8
|
+
export interface EventOptions {
|
|
9
|
+
instance: Selectic;
|
|
10
|
+
eventType: EventType;
|
|
11
|
+
automatic: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface EventChangeOptions extends EventOptions {
|
|
14
|
+
isExcluded: boolean;
|
|
15
|
+
}
|
|
7
16
|
export interface ParamProps {
|
|
8
17
|
fetchCallback?: FetchCallback;
|
|
9
18
|
getItemsCallback?: GetCallback;
|
|
10
19
|
pageSize?: number;
|
|
11
|
-
hideFilter?:
|
|
20
|
+
hideFilter?: HideFilter;
|
|
12
21
|
allowRevert?: boolean;
|
|
13
22
|
allowClearSelection?: boolean;
|
|
14
23
|
autoSelect?: boolean;
|
|
@@ -22,6 +31,15 @@ export interface ParamProps {
|
|
|
22
31
|
optionBehavior?: string;
|
|
23
32
|
keepOpenWithOtherSelectic?: boolean;
|
|
24
33
|
}
|
|
34
|
+
export declare type OnCallback = (event: string, ...args: any[]) => void;
|
|
35
|
+
export declare type GetMethodsCallback = (methods: {
|
|
36
|
+
clearCache: Selectic['clearCache'];
|
|
37
|
+
changeTexts: Selectic['changeTexts'];
|
|
38
|
+
getValue: Selectic['getValue'];
|
|
39
|
+
getSelectedItems: Selectic['getSelectedItems'];
|
|
40
|
+
isEmpty: Selectic['isEmpty'];
|
|
41
|
+
toggleOpen: Selectic['toggleOpen'];
|
|
42
|
+
}) => void;
|
|
25
43
|
export interface Props {
|
|
26
44
|
value?: SelectedValue;
|
|
27
45
|
selectionIsExcluded?: boolean;
|
|
@@ -37,6 +55,15 @@ export interface Props {
|
|
|
37
55
|
noCache?: Boolean;
|
|
38
56
|
open?: Boolean;
|
|
39
57
|
params?: ParamProps;
|
|
58
|
+
/** _on is used mainly for tests.
|
|
59
|
+
* Its purpose is to propagate $emit event mainly
|
|
60
|
+
* for parents which are not in Vue environment.
|
|
61
|
+
*/
|
|
62
|
+
_on?: OnCallback;
|
|
63
|
+
/** _getMethods is used mainly for tests.
|
|
64
|
+
* Its purpose is to provide public methods outside of a Vue environment.
|
|
65
|
+
*/
|
|
66
|
+
_getMethods?: GetMethodsCallback;
|
|
40
67
|
}
|
|
41
68
|
export declare function changeTexts(texts: PartialMessages): void;
|
|
42
69
|
export default class Selectic extends Vue<Props> {
|
|
@@ -58,11 +85,15 @@ export default class Selectic extends Vue<Props> {
|
|
|
58
85
|
noCache: boolean;
|
|
59
86
|
open?: boolean;
|
|
60
87
|
params: ParamProps;
|
|
88
|
+
/** For tests */
|
|
89
|
+
_on?: OnCallback;
|
|
90
|
+
_getMethods?: GetMethodsCallback;
|
|
61
91
|
elementBottom: number;
|
|
62
92
|
elementTop: number;
|
|
63
93
|
elementLeft: number;
|
|
64
94
|
elementRight: number;
|
|
65
95
|
width: number;
|
|
96
|
+
private hasBeenRendered;
|
|
66
97
|
private store;
|
|
67
98
|
private _elementsListeners;
|
|
68
99
|
private _oldValue;
|
|
@@ -70,14 +101,14 @@ export default class Selectic extends Vue<Props> {
|
|
|
70
101
|
get scrollListener(): () => void;
|
|
71
102
|
get outsideListener(): (evt: MouseEvent) => void;
|
|
72
103
|
get windowResize(): (_evt: any) => void;
|
|
73
|
-
get inputValue():
|
|
104
|
+
get inputValue(): StrictOptionId;
|
|
74
105
|
get selecticClass(): (string | {
|
|
75
106
|
disabled: boolean;
|
|
76
107
|
'selectic--overflow-multiline': boolean;
|
|
77
108
|
'selectic--overflow-collapsed': boolean;
|
|
78
109
|
})[];
|
|
79
110
|
get hasGivenValue(): boolean;
|
|
80
|
-
get defaultValue():
|
|
111
|
+
get defaultValue(): string | number | StrictOptionId[] | null;
|
|
81
112
|
clearCache(forceReset?: boolean): void;
|
|
82
113
|
changeTexts(texts: PartialMessages): void;
|
|
83
114
|
getValue(): SelectedValue;
|
|
@@ -89,23 +120,22 @@ export default class Selectic extends Vue<Props> {
|
|
|
89
120
|
private removeListeners;
|
|
90
121
|
private focusToggled;
|
|
91
122
|
private compareValues;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
123
|
+
onValueChange(): void;
|
|
124
|
+
onExcludedChange(): void;
|
|
125
|
+
onOptionsChange(): void;
|
|
126
|
+
onTextsChange(): void;
|
|
127
|
+
onDisabledChange(): void;
|
|
128
|
+
onGroupsChanged(): void;
|
|
129
|
+
onPlaceholderChanged(): void;
|
|
130
|
+
onOpenChanged(): void;
|
|
131
|
+
onFocusChanged(): void;
|
|
132
|
+
onInternalValueChange(): void;
|
|
102
133
|
private checkFocus;
|
|
103
|
-
private
|
|
104
|
-
private
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
protected render(): JSX.Element;
|
|
134
|
+
private _emit;
|
|
135
|
+
private emit;
|
|
136
|
+
created(): void;
|
|
137
|
+
mounted(): void;
|
|
138
|
+
beforeUpdate(): void;
|
|
139
|
+
beforeDestroy(): void;
|
|
140
|
+
render(): h.JSX.Element | undefined;
|
|
111
141
|
}
|
package/types/OldStore.d.ts
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { Vue } from 'vtyx';
|
|
2
|
-
export declare type StrictOptionId = string | number;
|
|
3
|
-
export declare type OptionId = StrictOptionId | null;
|
|
4
|
-
export declare type SelectedValue = OptionId | StrictOptionId[];
|
|
5
|
-
export interface OptionValue {
|
|
6
|
-
id: OptionId;
|
|
7
|
-
text: string;
|
|
8
|
-
title?: string;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
group?: StrictOptionId;
|
|
11
|
-
className?: string;
|
|
12
|
-
style?: string;
|
|
13
|
-
icon?: string;
|
|
14
|
-
options?: OptionValue[];
|
|
15
|
-
data?: any;
|
|
16
|
-
}
|
|
17
|
-
declare type OptionBehaviorOperation = 'sort' | 'force';
|
|
18
|
-
declare type OptionBehaviorOrder = 'O' | 'D' | 'E';
|
|
19
|
-
export interface OptionItem extends OptionValue {
|
|
20
|
-
selected: boolean;
|
|
21
|
-
disabled: boolean;
|
|
22
|
-
isGroup: boolean;
|
|
23
|
-
}
|
|
24
|
-
export declare type OptionProp = OptionValue | string;
|
|
25
|
-
export interface GroupValue {
|
|
26
|
-
id: StrictOptionId;
|
|
27
|
-
text: string;
|
|
28
|
-
}
|
|
29
|
-
export declare type FetchCallback = (_search: string, _offsetItem: number, _pageSize: number) => Promise<{
|
|
30
|
-
total: number;
|
|
31
|
-
result: OptionValue[];
|
|
32
|
-
}>;
|
|
33
|
-
export declare type GetCallback = (_ids: OptionId[]) => Promise<OptionValue[]>;
|
|
34
|
-
export declare type FormatCallback = (_option: OptionItem) => OptionItem;
|
|
35
|
-
export declare type SelectionOverflow = 'collapsed' | 'multiline';
|
|
36
|
-
export declare type ListPosition = 'bottom' | 'top' | 'auto';
|
|
37
|
-
export interface SelecticStoreStateParams {
|
|
38
|
-
multiple?: boolean;
|
|
39
|
-
placeholder?: string;
|
|
40
|
-
hideFilter?: boolean | 'auto';
|
|
41
|
-
allowRevert?: boolean;
|
|
42
|
-
allowClearSelection?: boolean;
|
|
43
|
-
pageSize?: number;
|
|
44
|
-
autoSelect?: boolean;
|
|
45
|
-
autoDisabled?: boolean;
|
|
46
|
-
strictValue?: boolean;
|
|
47
|
-
selectionOverflow?: SelectionOverflow;
|
|
48
|
-
formatOption?: FormatCallback;
|
|
49
|
-
formatSelection?: FormatCallback;
|
|
50
|
-
optionBehavior?: string;
|
|
51
|
-
isOpen?: boolean;
|
|
52
|
-
}
|
|
53
|
-
export interface Props {
|
|
54
|
-
value?: SelectedValue;
|
|
55
|
-
selectionIsExcluded?: boolean;
|
|
56
|
-
disabled?: boolean;
|
|
57
|
-
options?: OptionProp[];
|
|
58
|
-
childOptions?: OptionProp[];
|
|
59
|
-
groups?: GroupValue[];
|
|
60
|
-
texts?: PartialMessages;
|
|
61
|
-
keepOpenWithOtherSelectic?: boolean;
|
|
62
|
-
params?: SelecticStoreStateParams;
|
|
63
|
-
fetchCallback?: FetchCallback;
|
|
64
|
-
getItemsCallback?: GetCallback;
|
|
65
|
-
}
|
|
66
|
-
export interface SelecticStoreState {
|
|
67
|
-
internalValue: SelectedValue;
|
|
68
|
-
selectionIsExcluded: boolean;
|
|
69
|
-
multiple: boolean;
|
|
70
|
-
disabled: boolean;
|
|
71
|
-
placeholder: string;
|
|
72
|
-
hideFilter: boolean;
|
|
73
|
-
allowRevert?: boolean;
|
|
74
|
-
allowClearSelection: boolean;
|
|
75
|
-
autoSelect: boolean;
|
|
76
|
-
autoDisabled: boolean;
|
|
77
|
-
strictValue: boolean;
|
|
78
|
-
selectionOverflow: SelectionOverflow;
|
|
79
|
-
isOpen: boolean;
|
|
80
|
-
searchText: string;
|
|
81
|
-
allOptions: OptionValue[];
|
|
82
|
-
dynOptions: OptionValue[];
|
|
83
|
-
filteredOptions: OptionItem[];
|
|
84
|
-
selectedOptions: OptionItem | OptionItem[] | null;
|
|
85
|
-
totalAllOptions: number;
|
|
86
|
-
totalDynOptions: number;
|
|
87
|
-
totalFilteredOptions: number;
|
|
88
|
-
groups: Map<OptionId, string>;
|
|
89
|
-
offsetItem: number;
|
|
90
|
-
activeItemIdx: number;
|
|
91
|
-
pageSize: number;
|
|
92
|
-
formatOption?: FormatCallback;
|
|
93
|
-
formatSelection?: FormatCallback;
|
|
94
|
-
optionBehaviorOperation: OptionBehaviorOperation;
|
|
95
|
-
optionBehaviorOrder: OptionBehaviorOrder[];
|
|
96
|
-
listPosition: ListPosition;
|
|
97
|
-
status: {
|
|
98
|
-
searching: boolean;
|
|
99
|
-
errorMessage: string;
|
|
100
|
-
areAllSelected: boolean;
|
|
101
|
-
hasChanged: boolean;
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
interface Messages {
|
|
105
|
-
noFetchMethod: string;
|
|
106
|
-
searchPlaceholder: string;
|
|
107
|
-
searching: string;
|
|
108
|
-
cannotSelectAllSearchedItems: string;
|
|
109
|
-
cannotSelectAllRevertItems: string;
|
|
110
|
-
selectAll: string;
|
|
111
|
-
excludeResult: string;
|
|
112
|
-
reverseSelection: string;
|
|
113
|
-
noData: string;
|
|
114
|
-
noResult: string;
|
|
115
|
-
clearSelection: string;
|
|
116
|
-
clearSelections: string;
|
|
117
|
-
wrongFormattedData: string;
|
|
118
|
-
moreSelectedItem: string;
|
|
119
|
-
moreSelectedItems: string;
|
|
120
|
-
unknownPropertyValue: string;
|
|
121
|
-
}
|
|
122
|
-
export declare type PartialMessages = {
|
|
123
|
-
[K in keyof Messages]?: Messages[K];
|
|
124
|
-
};
|
|
125
|
-
export declare function changeTexts(texts: PartialMessages): void;
|
|
126
|
-
export default class SelecticStore extends Vue<Props> {
|
|
127
|
-
value?: SelectedValue;
|
|
128
|
-
selectionIsExcluded: boolean;
|
|
129
|
-
disabled: boolean;
|
|
130
|
-
options?: OptionProp[];
|
|
131
|
-
childOptions?: OptionValue[];
|
|
132
|
-
groups: GroupValue[];
|
|
133
|
-
texts?: PartialMessages;
|
|
134
|
-
private params?;
|
|
135
|
-
private fetchCallback?;
|
|
136
|
-
private getItemsCallback?;
|
|
137
|
-
private keepOpenWithOtherSelectic;
|
|
138
|
-
itemsPerPage: number;
|
|
139
|
-
state: SelecticStoreState;
|
|
140
|
-
labels: Messages;
|
|
141
|
-
private doNotUpdate;
|
|
142
|
-
private cacheItem;
|
|
143
|
-
private activeOrder;
|
|
144
|
-
private dynOffset;
|
|
145
|
-
private requestId;
|
|
146
|
-
private cacheRequest;
|
|
147
|
-
get marginSize(): number;
|
|
148
|
-
get isPartial(): boolean;
|
|
149
|
-
get hasAllItems(): boolean;
|
|
150
|
-
get hasFetchedAllItems(): boolean;
|
|
151
|
-
get closeSelectic(): () => void;
|
|
152
|
-
commit<N extends keyof SelecticStoreState, V extends SelecticStoreState[N]>(name: N, value: V): void;
|
|
153
|
-
getItem(id: OptionId): OptionValue;
|
|
154
|
-
getItems(ids: OptionId[]): Promise<OptionItem[]>;
|
|
155
|
-
selectItem(id: OptionId, selected?: boolean, keepOpen?: boolean): void;
|
|
156
|
-
toggleSelectAll(): void;
|
|
157
|
-
resetChange(): void;
|
|
158
|
-
resetErrorMessage(): void;
|
|
159
|
-
clearCache(forceReset?: boolean): void;
|
|
160
|
-
changeGroups(groups: GroupValue[]): void;
|
|
161
|
-
changeTexts(texts: PartialMessages): void;
|
|
162
|
-
private hasValue;
|
|
163
|
-
private getValue;
|
|
164
|
-
private assertCorrectValue;
|
|
165
|
-
private updateFilteredOptions;
|
|
166
|
-
private addGroups;
|
|
167
|
-
private getListOptions;
|
|
168
|
-
private getElementOptions;
|
|
169
|
-
private buildAllOptions;
|
|
170
|
-
private buildFilteredOptions;
|
|
171
|
-
private buildSelectedOptions;
|
|
172
|
-
private fetchData;
|
|
173
|
-
private filterOptions;
|
|
174
|
-
private addStaticFilteredOptions;
|
|
175
|
-
private buildSelectedItems;
|
|
176
|
-
private hasItemInStore;
|
|
177
|
-
private buildItems;
|
|
178
|
-
private buildGroupItems;
|
|
179
|
-
private buildOptionBehavior;
|
|
180
|
-
private nbGroups;
|
|
181
|
-
private checkAutoSelect;
|
|
182
|
-
private checkAutoDisabled;
|
|
183
|
-
private checkHideFilter;
|
|
184
|
-
onOptionsChange(options?: OptionValue[], oldOptions?: OptionValue[]): void;
|
|
185
|
-
onChildOptionsChange(childOptions?: OptionValue[], oldChildOptions?: OptionValue[]): void;
|
|
186
|
-
onValueChange(): void;
|
|
187
|
-
onSelectionExcludedChange(): void;
|
|
188
|
-
onDisabledChange(): void;
|
|
189
|
-
onFilteredChange(): void;
|
|
190
|
-
onInternalValueChange(): void;
|
|
191
|
-
onAllOptionChange(): void;
|
|
192
|
-
onTotalAllOptionsChange(): void;
|
|
193
|
-
created(): void;
|
|
194
|
-
}
|
|
195
|
-
export {};
|