sprintify-ui 0.0.32 → 0.0.33
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/sprintify-ui.es.js +3519 -3386
- package/dist/types/src/components/BaseAutocomplete.vue.d.ts +9 -9
- package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +9 -9
- package/dist/types/src/components/BaseBelongsTo.vue.d.ts +10 -10
- package/dist/types/src/components/BaseButtonGroup.vue.d.ts +8 -8
- package/dist/types/src/components/BaseFilePicker.vue.d.ts +1 -1
- package/dist/types/src/components/BaseFileUploader.vue.d.ts +4 -4
- package/dist/types/src/components/BaseHasMany.vue.d.ts +0 -1
- package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +0 -1
- package/dist/types/src/components/BaseTagAutocompleteFetch.vue.d.ts +0 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/composables/hasOptions.d.ts +7 -0
- package/dist/types/src/types/types.d.ts +0 -2
- package/package.json +1 -1
- package/src/components/BaseAutocomplete.vue +29 -40
- package/src/components/BaseAutocompleteFetch.vue +2 -2
- package/src/components/BaseBelongsTo.vue +3 -3
- package/src/components/BaseButtonGroup.stories.js +2 -2
- package/src/components/BaseButtonGroup.vue +9 -51
- package/src/components/BaseTagAutocomplete.stories.js +4 -6
- package/src/components/BaseTagAutocomplete.vue +35 -53
- package/src/components/index.ts +2 -0
- package/src/composables/hasOptions.ts +68 -0
- package/src/types/types.ts +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
-
import { NormalizedOption, Option
|
|
2
|
+
import { NormalizedOption, Option } from '@/types/types';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
new (...args: any[]): {
|
|
5
5
|
$: import("vue").ComponentInternalInstance;
|
|
@@ -7,7 +7,7 @@ declare const _default: {
|
|
|
7
7
|
$props: Partial<{
|
|
8
8
|
filter: (option: NormalizedOption) => boolean;
|
|
9
9
|
required: boolean;
|
|
10
|
-
modelValue:
|
|
10
|
+
modelValue: Option | null | undefined;
|
|
11
11
|
inputClass: string;
|
|
12
12
|
placeholder: string;
|
|
13
13
|
loading: boolean;
|
|
@@ -15,7 +15,7 @@ declare const _default: {
|
|
|
15
15
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
modelValue: {
|
|
17
17
|
default: undefined;
|
|
18
|
-
type: PropType<
|
|
18
|
+
type: PropType<Option | null | undefined>;
|
|
19
19
|
};
|
|
20
20
|
options: {
|
|
21
21
|
required: true;
|
|
@@ -76,7 +76,7 @@ declare const _default: {
|
|
|
76
76
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
77
77
|
modelValue: {
|
|
78
78
|
default: undefined;
|
|
79
|
-
type: PropType<
|
|
79
|
+
type: PropType<Option | null | undefined>;
|
|
80
80
|
};
|
|
81
81
|
options: {
|
|
82
82
|
required: true;
|
|
@@ -123,7 +123,7 @@ declare const _default: {
|
|
|
123
123
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clear" | "update:modelValue" | "typing" | "focus" | "scrollBottom")[], string, {
|
|
124
124
|
filter: (option: NormalizedOption) => boolean;
|
|
125
125
|
required: boolean;
|
|
126
|
-
modelValue:
|
|
126
|
+
modelValue: Option | null | undefined;
|
|
127
127
|
inputClass: string;
|
|
128
128
|
placeholder: string;
|
|
129
129
|
loading: boolean;
|
|
@@ -151,7 +151,7 @@ declare const _default: {
|
|
|
151
151
|
} & Readonly<import("vue").ExtractPropTypes<{
|
|
152
152
|
modelValue: {
|
|
153
153
|
default: undefined;
|
|
154
|
-
type: PropType<
|
|
154
|
+
type: PropType<Option | null | undefined>;
|
|
155
155
|
};
|
|
156
156
|
options: {
|
|
157
157
|
required: true;
|
|
@@ -202,7 +202,7 @@ declare const _default: {
|
|
|
202
202
|
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
203
203
|
modelValue: {
|
|
204
204
|
default: undefined;
|
|
205
|
-
type: PropType<
|
|
205
|
+
type: PropType<Option | null | undefined>;
|
|
206
206
|
};
|
|
207
207
|
options: {
|
|
208
208
|
required: true;
|
|
@@ -249,7 +249,7 @@ declare const _default: {
|
|
|
249
249
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clear" | "update:modelValue" | "typing" | "focus" | "scrollBottom")[], "clear" | "update:modelValue" | "typing" | "focus" | "scrollBottom", {
|
|
250
250
|
filter: (option: NormalizedOption) => boolean;
|
|
251
251
|
required: boolean;
|
|
252
|
-
modelValue:
|
|
252
|
+
modelValue: Option | null | undefined;
|
|
253
253
|
inputClass: string;
|
|
254
254
|
placeholder: string;
|
|
255
255
|
loading: boolean;
|
|
@@ -259,7 +259,7 @@ declare const _default: {
|
|
|
259
259
|
empty: (_: {}) => any;
|
|
260
260
|
option: (_: {
|
|
261
261
|
option: Option;
|
|
262
|
-
selected: boolean
|
|
262
|
+
selected: boolean;
|
|
263
263
|
active: boolean;
|
|
264
264
|
}) => any;
|
|
265
265
|
footer: (_: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
-
import { Option
|
|
2
|
+
import { Option } from '@/types/types';
|
|
3
3
|
import { RouteLocationRaw } from 'vue-router';
|
|
4
4
|
declare const _default: {
|
|
5
5
|
new (...args: any[]): {
|
|
@@ -7,7 +7,7 @@ declare const _default: {
|
|
|
7
7
|
$data: {};
|
|
8
8
|
$props: Partial<{
|
|
9
9
|
required: boolean;
|
|
10
|
-
modelValue:
|
|
10
|
+
modelValue: Option | null | undefined;
|
|
11
11
|
inputClass: string;
|
|
12
12
|
placeholder: string;
|
|
13
13
|
disabled: boolean;
|
|
@@ -16,7 +16,7 @@ declare const _default: {
|
|
|
16
16
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
17
17
|
modelValue: {
|
|
18
18
|
default: undefined;
|
|
19
|
-
type: PropType<
|
|
19
|
+
type: PropType<Option | null | undefined>;
|
|
20
20
|
};
|
|
21
21
|
url: {
|
|
22
22
|
required: true;
|
|
@@ -77,7 +77,7 @@ declare const _default: {
|
|
|
77
77
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
78
78
|
modelValue: {
|
|
79
79
|
default: undefined;
|
|
80
|
-
type: PropType<
|
|
80
|
+
type: PropType<Option | null | undefined>;
|
|
81
81
|
};
|
|
82
82
|
url: {
|
|
83
83
|
required: true;
|
|
@@ -123,7 +123,7 @@ declare const _default: {
|
|
|
123
123
|
onScrollBottom?: ((...args: any[]) => any) | undefined;
|
|
124
124
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clear" | "update:modelValue" | "typing" | "focus" | "scrollBottom")[], string, {
|
|
125
125
|
required: boolean;
|
|
126
|
-
modelValue:
|
|
126
|
+
modelValue: Option | null | undefined;
|
|
127
127
|
inputClass: string;
|
|
128
128
|
placeholder: string;
|
|
129
129
|
disabled: boolean;
|
|
@@ -152,7 +152,7 @@ declare const _default: {
|
|
|
152
152
|
} & Readonly<import("vue").ExtractPropTypes<{
|
|
153
153
|
modelValue: {
|
|
154
154
|
default: undefined;
|
|
155
|
-
type: PropType<
|
|
155
|
+
type: PropType<Option | null | undefined>;
|
|
156
156
|
};
|
|
157
157
|
url: {
|
|
158
158
|
required: true;
|
|
@@ -203,7 +203,7 @@ declare const _default: {
|
|
|
203
203
|
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
204
204
|
modelValue: {
|
|
205
205
|
default: undefined;
|
|
206
|
-
type: PropType<
|
|
206
|
+
type: PropType<Option | null | undefined>;
|
|
207
207
|
};
|
|
208
208
|
url: {
|
|
209
209
|
required: true;
|
|
@@ -249,7 +249,7 @@ declare const _default: {
|
|
|
249
249
|
onScrollBottom?: ((...args: any[]) => any) | undefined;
|
|
250
250
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clear" | "update:modelValue" | "typing" | "focus" | "scrollBottom")[], "clear" | "update:modelValue" | "typing" | "focus" | "scrollBottom", {
|
|
251
251
|
required: boolean;
|
|
252
|
-
modelValue:
|
|
252
|
+
modelValue: Option | null | undefined;
|
|
253
253
|
inputClass: string;
|
|
254
254
|
placeholder: string;
|
|
255
255
|
disabled: boolean;
|
|
@@ -259,7 +259,7 @@ declare const _default: {
|
|
|
259
259
|
$slots: {
|
|
260
260
|
option: (_: {
|
|
261
261
|
option: Option;
|
|
262
|
-
selected: boolean
|
|
262
|
+
selected: boolean;
|
|
263
263
|
active: boolean;
|
|
264
264
|
}) => any;
|
|
265
265
|
footer: (_: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Selection } from '@/types/types';
|
|
2
1
|
import { PropType } from 'vue';
|
|
3
2
|
import { RouteLocationRaw } from 'vue-router';
|
|
3
|
+
import { Option } from '@/types/types';
|
|
4
4
|
declare const _default: {
|
|
5
5
|
new (...args: any[]): {
|
|
6
6
|
$: import("vue").ComponentInternalInstance;
|
|
@@ -14,7 +14,7 @@ declare const _default: {
|
|
|
14
14
|
createNewUrl: RouteLocationRaw;
|
|
15
15
|
showRouteUrl: ((id: string | number) => string) | undefined;
|
|
16
16
|
foreignKey: string;
|
|
17
|
-
currentModel:
|
|
17
|
+
currentModel: Option | null;
|
|
18
18
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
19
19
|
modelValue: {
|
|
20
20
|
default: undefined;
|
|
@@ -54,7 +54,7 @@ declare const _default: {
|
|
|
54
54
|
};
|
|
55
55
|
currentModel: {
|
|
56
56
|
default: null;
|
|
57
|
-
type: PropType<
|
|
57
|
+
type: PropType<Option | null>;
|
|
58
58
|
};
|
|
59
59
|
createNewUrl: {
|
|
60
60
|
default: string;
|
|
@@ -115,7 +115,7 @@ declare const _default: {
|
|
|
115
115
|
};
|
|
116
116
|
currentModel: {
|
|
117
117
|
default: null;
|
|
118
|
-
type: PropType<
|
|
118
|
+
type: PropType<Option | null>;
|
|
119
119
|
};
|
|
120
120
|
createNewUrl: {
|
|
121
121
|
default: string;
|
|
@@ -132,7 +132,7 @@ declare const _default: {
|
|
|
132
132
|
createNewUrl: RouteLocationRaw;
|
|
133
133
|
showRouteUrl: ((id: string | number) => string) | undefined;
|
|
134
134
|
foreignKey: string;
|
|
135
|
-
currentModel:
|
|
135
|
+
currentModel: Option | null;
|
|
136
136
|
}, {}, string> & {
|
|
137
137
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
138
138
|
created?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -192,7 +192,7 @@ declare const _default: {
|
|
|
192
192
|
};
|
|
193
193
|
currentModel: {
|
|
194
194
|
default: null;
|
|
195
|
-
type: PropType<
|
|
195
|
+
type: PropType<Option | null>;
|
|
196
196
|
};
|
|
197
197
|
createNewUrl: {
|
|
198
198
|
default: string;
|
|
@@ -243,7 +243,7 @@ declare const _default: {
|
|
|
243
243
|
};
|
|
244
244
|
currentModel: {
|
|
245
245
|
default: null;
|
|
246
|
-
type: PropType<
|
|
246
|
+
type: PropType<Option | null>;
|
|
247
247
|
};
|
|
248
248
|
createNewUrl: {
|
|
249
249
|
default: string;
|
|
@@ -260,12 +260,12 @@ declare const _default: {
|
|
|
260
260
|
createNewUrl: RouteLocationRaw;
|
|
261
261
|
showRouteUrl: ((id: string | number) => string) | undefined;
|
|
262
262
|
foreignKey: string;
|
|
263
|
-
currentModel:
|
|
263
|
+
currentModel: Option | null;
|
|
264
264
|
}, {}, string> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
265
265
|
$slots: {
|
|
266
266
|
option: (_: {
|
|
267
|
-
option:
|
|
268
|
-
selected: boolean
|
|
267
|
+
option: Option;
|
|
268
|
+
selected: boolean;
|
|
269
269
|
active: boolean;
|
|
270
270
|
}) => any;
|
|
271
271
|
empty: (_: {
|
|
@@ -8,12 +8,12 @@ declare const _default: {
|
|
|
8
8
|
required: boolean;
|
|
9
9
|
modelValue: Option | Option[] | undefined;
|
|
10
10
|
disabled: boolean;
|
|
11
|
-
multiple: boolean;
|
|
12
|
-
buttonClass: string;
|
|
13
11
|
buttonType: "button" | "submit";
|
|
12
|
+
buttonClass: string;
|
|
14
13
|
buttonActiveClass: string;
|
|
15
14
|
buttonInactiveClass: string;
|
|
16
15
|
spacing: string;
|
|
16
|
+
multiple: boolean;
|
|
17
17
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
18
18
|
modelValue: {
|
|
19
19
|
default: undefined;
|
|
@@ -65,7 +65,7 @@ declare const _default: {
|
|
|
65
65
|
};
|
|
66
66
|
}>> & {
|
|
67
67
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
68
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "required" | "modelValue" | "disabled" | "
|
|
68
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "required" | "modelValue" | "disabled" | "buttonType" | "buttonClass" | "buttonActiveClass" | "buttonInactiveClass" | "spacing" | "multiple">;
|
|
69
69
|
$attrs: {
|
|
70
70
|
[x: string]: unknown;
|
|
71
71
|
};
|
|
@@ -134,12 +134,12 @@ declare const _default: {
|
|
|
134
134
|
required: boolean;
|
|
135
135
|
modelValue: Option | Option[] | undefined;
|
|
136
136
|
disabled: boolean;
|
|
137
|
-
multiple: boolean;
|
|
138
|
-
buttonClass: string;
|
|
139
137
|
buttonType: "button" | "submit";
|
|
138
|
+
buttonClass: string;
|
|
140
139
|
buttonActiveClass: string;
|
|
141
140
|
buttonInactiveClass: string;
|
|
142
141
|
spacing: string;
|
|
142
|
+
multiple: boolean;
|
|
143
143
|
}, {}, string> & {
|
|
144
144
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
145
145
|
created?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -270,16 +270,16 @@ declare const _default: {
|
|
|
270
270
|
required: boolean;
|
|
271
271
|
modelValue: Option | Option[] | undefined;
|
|
272
272
|
disabled: boolean;
|
|
273
|
-
multiple: boolean;
|
|
274
|
-
buttonClass: string;
|
|
275
273
|
buttonType: "button" | "submit";
|
|
274
|
+
buttonClass: string;
|
|
276
275
|
buttonActiveClass: string;
|
|
277
276
|
buttonInactiveClass: string;
|
|
278
277
|
spacing: string;
|
|
278
|
+
multiple: boolean;
|
|
279
279
|
}, {}, string> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
280
280
|
$slots: {
|
|
281
281
|
option: (_: {
|
|
282
|
-
|
|
282
|
+
selected: boolean;
|
|
283
283
|
onSelect: (option: NormalizedOption) => void;
|
|
284
284
|
option: NormalizedOption;
|
|
285
285
|
}) => any;
|
|
@@ -7,8 +7,8 @@ declare const _default: {
|
|
|
7
7
|
loading: boolean;
|
|
8
8
|
disabled: boolean;
|
|
9
9
|
url: string;
|
|
10
|
-
accept: string;
|
|
11
10
|
buttonClass: string;
|
|
11
|
+
accept: string;
|
|
12
12
|
beforeUpload: () => boolean;
|
|
13
13
|
maxSize: number;
|
|
14
14
|
acceptedExtensions: string[];
|
|
@@ -50,7 +50,7 @@ declare const _default: {
|
|
|
50
50
|
"onUpload:success"?: ((...args: any[]) => any) | undefined;
|
|
51
51
|
"onUpload:fail"?: ((...args: any[]) => any) | undefined;
|
|
52
52
|
"onUpload:end"?: ((...args: any[]) => any) | undefined;
|
|
53
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "loading" | "disabled" | "url" | "
|
|
53
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "loading" | "disabled" | "url" | "buttonClass" | "accept" | "beforeUpload" | "maxSize" | "acceptedExtensions">;
|
|
54
54
|
$attrs: {
|
|
55
55
|
[x: string]: unknown;
|
|
56
56
|
};
|
|
@@ -106,8 +106,8 @@ declare const _default: {
|
|
|
106
106
|
loading: boolean;
|
|
107
107
|
disabled: boolean;
|
|
108
108
|
url: string;
|
|
109
|
-
accept: string;
|
|
110
109
|
buttonClass: string;
|
|
110
|
+
accept: string;
|
|
111
111
|
beforeUpload: () => boolean;
|
|
112
112
|
maxSize: number;
|
|
113
113
|
acceptedExtensions: string[];
|
|
@@ -215,8 +215,8 @@ declare const _default: {
|
|
|
215
215
|
loading: boolean;
|
|
216
216
|
disabled: boolean;
|
|
217
217
|
url: string;
|
|
218
|
-
accept: string;
|
|
219
218
|
buttonClass: string;
|
|
219
|
+
accept: string;
|
|
220
220
|
beforeUpload: () => boolean;
|
|
221
221
|
maxSize: number;
|
|
222
222
|
acceptedExtensions: string[];
|
|
@@ -11,6 +11,7 @@ import BaseBelongsTo from './BaseBelongsTo.vue';
|
|
|
11
11
|
import BaseBoolean from './BaseBoolean.vue';
|
|
12
12
|
import BaseBreadcrumbs from './BaseBreadcrumbs.vue';
|
|
13
13
|
import BaseButton from './BaseButton.vue';
|
|
14
|
+
import BaseButtonGroup from './BaseButtonGroup.vue';
|
|
14
15
|
import BaseCard from './BaseCard.vue';
|
|
15
16
|
import BaseCardRow from './BaseCardRow.vue';
|
|
16
17
|
import BaseCharacterCounter from './BaseCharacterCounter.vue';
|
|
@@ -64,4 +65,4 @@ import BaseLayoutStacked from './BaseLayoutStacked.vue';
|
|
|
64
65
|
import BaseLayoutStackedConfigurable from './BaseLayoutStackedConfigurable.vue';
|
|
65
66
|
import BaseLayoutSidebar from './BaseLayoutSidebar.vue';
|
|
66
67
|
import BaseLayoutSidebarConfigurable from './BaseLayoutSidebarConfigurable.vue';
|
|
67
|
-
export { BaseActionItem, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseBadge, BaseBelongsTo, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClipboard, BaseContainer, BaseCounter, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseFilePicker, BaseFileUploader, BaseHasMany, BaseIcon, BaseInput, BaseInputLabel, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseReadMore, BaseSelect, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
|
68
|
+
export { BaseActionItem, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseBadge, BaseBelongsTo, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseButtonGroup, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClipboard, BaseContainer, BaseCounter, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseFilePicker, BaseFileUploader, BaseHasMany, BaseIcon, BaseInput, BaseInputLabel, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseReadMore, BaseSelect, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { NormalizedOption, Option } from '@/types/types';
|
|
3
|
+
export declare function useHasOptions(modelValue: Ref<Option[] | Option | null | undefined>, options: Ref<Option[]>, labelKey: Ref<string>, valueKey: Ref<string>, multiple?: Ref<boolean>): {
|
|
4
|
+
normalizedOptions: import("vue").ComputedRef<NormalizedOption[]>;
|
|
5
|
+
normalizedModelValue: import("vue").ComputedRef<NormalizedOption | NormalizedOption[] | null>;
|
|
6
|
+
isSelected: (option: NormalizedOption) => boolean;
|
|
7
|
+
};
|
|
@@ -14,13 +14,11 @@ export interface DataTableQuery extends Record<string, any> {
|
|
|
14
14
|
}
|
|
15
15
|
export type OptionValue = string | number;
|
|
16
16
|
export type Option = Record<string, any>;
|
|
17
|
-
export type Selection = Option | null | undefined;
|
|
18
17
|
export type NormalizedOption = {
|
|
19
18
|
option: Option;
|
|
20
19
|
value: OptionValue;
|
|
21
20
|
label: string;
|
|
22
21
|
};
|
|
23
|
-
export type NormalizedSelection = NormalizedOption | null | undefined;
|
|
24
22
|
export type MediaLibraryPayload = {
|
|
25
23
|
to_remove: string[];
|
|
26
24
|
to_add: UploadedFile[];
|
package/package.json
CHANGED
|
@@ -78,10 +78,7 @@
|
|
|
78
78
|
<slot
|
|
79
79
|
name="option"
|
|
80
80
|
:option="option.option"
|
|
81
|
-
:selected="
|
|
82
|
-
normalizedModelValue &&
|
|
83
|
-
normalizedModelValue.value == option.value
|
|
84
|
-
"
|
|
81
|
+
:selected="isSelected(option)"
|
|
85
82
|
:active="optionActive && optionActive.value == option.value"
|
|
86
83
|
>
|
|
87
84
|
<div
|
|
@@ -125,20 +122,16 @@
|
|
|
125
122
|
|
|
126
123
|
<script lang="ts" setup>
|
|
127
124
|
import { get } from 'lodash';
|
|
128
|
-
import { PropType, Ref } from 'vue';
|
|
129
|
-
import {
|
|
130
|
-
NormalizedOption,
|
|
131
|
-
Option,
|
|
132
|
-
Selection,
|
|
133
|
-
NormalizedSelection,
|
|
134
|
-
} from '@/types/types';
|
|
125
|
+
import { PropType, Ref, ComputedRef } from 'vue';
|
|
126
|
+
import { NormalizedOption, Option } from '@/types/types';
|
|
135
127
|
import { useInfiniteScroll, useMutationObserver } from '@vueuse/core';
|
|
136
128
|
import BaseSkeleton from './BaseSkeleton.vue';
|
|
129
|
+
import { useHasOptions } from '@/composables/hasOptions';
|
|
137
130
|
|
|
138
131
|
const props = defineProps({
|
|
139
132
|
modelValue: {
|
|
140
133
|
default: undefined,
|
|
141
|
-
type: [Object, null] as PropType<
|
|
134
|
+
type: [Object, null] as PropType<Option | null | undefined>,
|
|
142
135
|
},
|
|
143
136
|
options: {
|
|
144
137
|
required: true,
|
|
@@ -193,6 +186,19 @@ const selectionIndex = ref(0);
|
|
|
193
186
|
const inputElement = ref(null) as Ref<HTMLInputElement | null>;
|
|
194
187
|
const dropdown = ref(null) as Ref<HTMLElement | null>;
|
|
195
188
|
|
|
189
|
+
const hasOptions = useHasOptions(
|
|
190
|
+
computed(() => props.modelValue),
|
|
191
|
+
computed(() => props.options),
|
|
192
|
+
computed(() => props.labelKey),
|
|
193
|
+
computed(() => props.valueKey),
|
|
194
|
+
computed(() => false)
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
const isSelected = hasOptions.isSelected;
|
|
198
|
+
const normalizedOptions = hasOptions.normalizedOptions;
|
|
199
|
+
const normalizedModelValue =
|
|
200
|
+
hasOptions.normalizedModelValue as ComputedRef<NormalizedOption | null>;
|
|
201
|
+
|
|
196
202
|
onMounted(() => {
|
|
197
203
|
useInfiniteScroll(
|
|
198
204
|
dropdown.value,
|
|
@@ -211,17 +217,7 @@ const optionActive = computed(() => {
|
|
|
211
217
|
);
|
|
212
218
|
});
|
|
213
219
|
|
|
214
|
-
|
|
215
|
-
if (!props.modelValue) {
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
return {
|
|
219
|
-
label: props.modelValue[props.labelKey] as string,
|
|
220
|
-
value: props.modelValue[props.valueKey] as string | number,
|
|
221
|
-
option: props.modelValue,
|
|
222
|
-
};
|
|
223
|
-
});
|
|
224
|
-
|
|
220
|
+
// Update the keywords when the model value changes
|
|
225
221
|
watch(
|
|
226
222
|
() => normalizedModelValue.value,
|
|
227
223
|
() => {
|
|
@@ -234,16 +230,6 @@ watch(
|
|
|
234
230
|
{ immediate: true }
|
|
235
231
|
);
|
|
236
232
|
|
|
237
|
-
const normalizedOptions = computed(() => {
|
|
238
|
-
return props.options.map((option) => {
|
|
239
|
-
return {
|
|
240
|
-
label: option[props.labelKey] as string,
|
|
241
|
-
value: option[props.valueKey] as string | number,
|
|
242
|
-
option: option,
|
|
243
|
-
} as NormalizedOption;
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
|
|
247
233
|
const filteredNormalizedOptions = computed((): NormalizedOption[] => {
|
|
248
234
|
return normalizedOptions.value.filter((option) => {
|
|
249
235
|
if (props.filter !== undefined) {
|
|
@@ -276,6 +262,8 @@ const onTextFocus = () => {
|
|
|
276
262
|
emit('focus');
|
|
277
263
|
};
|
|
278
264
|
|
|
265
|
+
// If keywords is changed but no new selection was made,
|
|
266
|
+
// update keywords to original value
|
|
279
267
|
const onTextBlur = () => {
|
|
280
268
|
timerId.value = setTimeout(() => {
|
|
281
269
|
showDropdown.value = false;
|
|
@@ -305,7 +293,7 @@ const onTextKeydown = (event: KeyboardEvent) => {
|
|
|
305
293
|
}
|
|
306
294
|
|
|
307
295
|
if (key === 'ArrowDown') {
|
|
308
|
-
if (selectionIndex.value <
|
|
296
|
+
if (selectionIndex.value < filteredNormalizedOptions.value.length - 1) {
|
|
309
297
|
selectionIndex.value++;
|
|
310
298
|
} else {
|
|
311
299
|
selectionIndex.value = 0;
|
|
@@ -317,7 +305,10 @@ const onTextKeydown = (event: KeyboardEvent) => {
|
|
|
317
305
|
if (selectionIndex.value > 0) {
|
|
318
306
|
selectionIndex.value--;
|
|
319
307
|
} else {
|
|
320
|
-
selectionIndex.value = Math.max(
|
|
308
|
+
selectionIndex.value = Math.max(
|
|
309
|
+
0,
|
|
310
|
+
filteredNormalizedOptions.value.length - 1
|
|
311
|
+
);
|
|
321
312
|
}
|
|
322
313
|
return;
|
|
323
314
|
}
|
|
@@ -333,9 +324,7 @@ const onTextKeydown = (event: KeyboardEvent) => {
|
|
|
333
324
|
|
|
334
325
|
const optionClass = (option: NormalizedOption) => {
|
|
335
326
|
const active = optionActive.value && optionActive.value.value == option.value;
|
|
336
|
-
const selected =
|
|
337
|
-
normalizedModelValue.value &&
|
|
338
|
-
normalizedModelValue.value.value == option.value;
|
|
327
|
+
const selected = isSelected(option);
|
|
339
328
|
|
|
340
329
|
if (selected) {
|
|
341
330
|
if (active) {
|
|
@@ -359,12 +348,12 @@ const clear = () => {
|
|
|
359
348
|
inputElement.value?.focus();
|
|
360
349
|
};
|
|
361
350
|
|
|
362
|
-
const onSelect = (normalizedModelValue:
|
|
351
|
+
const onSelect = (normalizedModelValue: Option | null | undefined) => {
|
|
363
352
|
update(normalizedModelValue);
|
|
364
353
|
inputElement.value?.blur();
|
|
365
354
|
};
|
|
366
355
|
|
|
367
|
-
const update = (normalizedSelection:
|
|
356
|
+
const update = (normalizedSelection: Option | null | undefined) => {
|
|
368
357
|
const selection = normalizedSelection ? normalizedSelection.option : null;
|
|
369
358
|
if (normalizedSelection) {
|
|
370
359
|
setKeywordsWithoutEvent(normalizedSelection.label);
|
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
import { config } from '../';
|
|
62
62
|
import { debounce } from 'lodash';
|
|
63
63
|
import { PropType, Ref } from 'vue';
|
|
64
|
-
import { Option
|
|
64
|
+
import { Option } from '@/types/types';
|
|
65
65
|
import { RouteLocationRaw } from 'vue-router';
|
|
66
66
|
import BaseAutocomplete from './BaseAutocomplete.vue';
|
|
67
67
|
|
|
68
68
|
const props = defineProps({
|
|
69
69
|
modelValue: {
|
|
70
70
|
default: undefined,
|
|
71
|
-
type: [Object, null] as PropType<
|
|
71
|
+
type: [Object, null] as PropType<Option | null | undefined>,
|
|
72
72
|
},
|
|
73
73
|
url: {
|
|
74
74
|
required: true,
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script lang="ts" setup>
|
|
27
|
-
import { Selection } from '@/types/types';
|
|
28
27
|
import { PropType } from 'vue';
|
|
29
28
|
import { RouteLocationRaw } from 'vue-router';
|
|
30
29
|
import { AxiosResponse } from 'axios';
|
|
31
30
|
import { config } from '@/index';
|
|
32
31
|
import BaseAutocompleteFetch from './BaseAutocompleteFetch.vue';
|
|
32
|
+
import { Option } from '@/types/types';
|
|
33
33
|
|
|
34
34
|
const props = defineProps({
|
|
35
35
|
modelValue: {
|
|
@@ -72,7 +72,7 @@ const props = defineProps({
|
|
|
72
72
|
},
|
|
73
73
|
currentModel: {
|
|
74
74
|
default: null,
|
|
75
|
-
type: [Object, null] as PropType<
|
|
75
|
+
type: [Object, null] as PropType<Option | null>,
|
|
76
76
|
},
|
|
77
77
|
createNewUrl: {
|
|
78
78
|
default: '',
|
|
@@ -120,7 +120,7 @@ watch(
|
|
|
120
120
|
{ immediate: true }
|
|
121
121
|
);
|
|
122
122
|
|
|
123
|
-
function onUpdate(newModel:
|
|
123
|
+
function onUpdate(newModel: Option | null) {
|
|
124
124
|
if (!newModel) {
|
|
125
125
|
model.value = null;
|
|
126
126
|
emit('update:modelValue', null);
|
|
@@ -71,10 +71,10 @@ export const SlotOption = (args) => ({
|
|
|
71
71
|
v-model="value"
|
|
72
72
|
:options="options"
|
|
73
73
|
>
|
|
74
|
-
<template #option="{ option,
|
|
74
|
+
<template #option="{ option, selected, onSelect }">
|
|
75
75
|
<button
|
|
76
76
|
class="btn btn-xs flex items-center space-x-1 font-semibold"
|
|
77
|
-
:class="[
|
|
77
|
+
:class="[selected ? 'btn-black' : '']"
|
|
78
78
|
type="button"
|
|
79
79
|
@click="onSelect(option)"
|
|
80
80
|
>
|