sprintify-ui 0.4.6 → 0.4.8
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 +2636 -2490
- package/dist/types/src/components/BaseBelongsTo.vue.d.ts +5 -15
- package/dist/types/src/components/BaseBelongsToFetch.vue.d.ts +216 -0
- package/dist/types/src/components/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/BaseBelongsTo.stories.js +13 -19
- package/src/components/BaseBelongsTo.vue +13 -49
- package/src/components/BaseBelongsToFetch.stories.js +223 -0
- package/src/components/BaseBelongsToFetch.vue +193 -0
- package/src/components/index.ts +2 -0
|
@@ -5,13 +5,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
5
5
|
default: undefined;
|
|
6
6
|
type: PropType<string | number | null | undefined>;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
options: {
|
|
9
9
|
required: true;
|
|
10
|
-
type:
|
|
11
|
-
};
|
|
12
|
-
showRouteUrl: {
|
|
13
|
-
default: undefined;
|
|
14
|
-
type: PropType<((id: string | number) => string) | undefined>;
|
|
10
|
+
type: PropType<Option[]>;
|
|
15
11
|
};
|
|
16
12
|
primaryKey: {
|
|
17
13
|
default: string;
|
|
@@ -88,13 +84,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
88
84
|
default: undefined;
|
|
89
85
|
type: PropType<string | number | null | undefined>;
|
|
90
86
|
};
|
|
91
|
-
|
|
87
|
+
options: {
|
|
92
88
|
required: true;
|
|
93
|
-
type:
|
|
94
|
-
};
|
|
95
|
-
showRouteUrl: {
|
|
96
|
-
default: undefined;
|
|
97
|
-
type: PropType<((id: string | number) => string) | undefined>;
|
|
89
|
+
type: PropType<Option[]>;
|
|
98
90
|
};
|
|
99
91
|
primaryKey: {
|
|
100
92
|
default: string;
|
|
@@ -177,7 +169,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
177
169
|
visibleFocus: boolean;
|
|
178
170
|
showEmptyOption: boolean;
|
|
179
171
|
emptyOptionLabel: string;
|
|
180
|
-
showRouteUrl: ((id: string | number) => string) | undefined;
|
|
181
172
|
primaryKey: string;
|
|
182
173
|
currentModel: Option | null;
|
|
183
174
|
}, {}>, {
|
|
@@ -192,7 +183,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
192
183
|
active: boolean;
|
|
193
184
|
}): any;
|
|
194
185
|
empty?(_: {
|
|
195
|
-
firstSearch: boolean;
|
|
196
186
|
focus: () => void;
|
|
197
187
|
blur: () => void;
|
|
198
188
|
open: () => void;
|
|
@@ -200,11 +190,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
200
190
|
keywords: import("vue").ComputedRef<string>;
|
|
201
191
|
}): any;
|
|
202
192
|
footer?(_: {
|
|
203
|
-
keywords: string;
|
|
204
193
|
focus: () => void;
|
|
205
194
|
blur: () => void;
|
|
206
195
|
open: () => void;
|
|
207
196
|
close: () => void;
|
|
197
|
+
keywords: import("vue").ComputedRef<string>;
|
|
208
198
|
options: import("@/types").NormalizedOption[];
|
|
209
199
|
}): any;
|
|
210
200
|
}>;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { Option, SelectConfiguration } from '@/types';
|
|
3
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
4
|
+
modelValue: {
|
|
5
|
+
default: undefined;
|
|
6
|
+
type: PropType<string | number | null | undefined>;
|
|
7
|
+
};
|
|
8
|
+
url: {
|
|
9
|
+
required: true;
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
};
|
|
12
|
+
showRouteUrl: {
|
|
13
|
+
default: undefined;
|
|
14
|
+
type: PropType<((id: string | number) => string) | undefined>;
|
|
15
|
+
};
|
|
16
|
+
primaryKey: {
|
|
17
|
+
default: string;
|
|
18
|
+
type: StringConstructor;
|
|
19
|
+
};
|
|
20
|
+
field: {
|
|
21
|
+
required: true;
|
|
22
|
+
type: StringConstructor;
|
|
23
|
+
};
|
|
24
|
+
required: {
|
|
25
|
+
default: boolean;
|
|
26
|
+
type: BooleanConstructor;
|
|
27
|
+
};
|
|
28
|
+
disabled: {
|
|
29
|
+
default: boolean;
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
};
|
|
32
|
+
name: {
|
|
33
|
+
default: undefined;
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
};
|
|
36
|
+
placeholder: {
|
|
37
|
+
default: undefined;
|
|
38
|
+
type: StringConstructor;
|
|
39
|
+
};
|
|
40
|
+
currentModel: {
|
|
41
|
+
default: null;
|
|
42
|
+
type: PropType<Option | null>;
|
|
43
|
+
};
|
|
44
|
+
hasError: {
|
|
45
|
+
default: boolean;
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
};
|
|
48
|
+
inline: {
|
|
49
|
+
default: boolean;
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
};
|
|
52
|
+
size: {
|
|
53
|
+
default: string;
|
|
54
|
+
type: PropType<"base" | "xs" | "sm">;
|
|
55
|
+
};
|
|
56
|
+
dropdownShow: {
|
|
57
|
+
default: string;
|
|
58
|
+
type: PropType<"focus" | "always">;
|
|
59
|
+
};
|
|
60
|
+
showModelValue: {
|
|
61
|
+
default: boolean;
|
|
62
|
+
type: BooleanConstructor;
|
|
63
|
+
};
|
|
64
|
+
visibleFocus: {
|
|
65
|
+
default: boolean;
|
|
66
|
+
type: BooleanConstructor;
|
|
67
|
+
};
|
|
68
|
+
showEmptyOption: {
|
|
69
|
+
default: boolean;
|
|
70
|
+
type: BooleanConstructor;
|
|
71
|
+
};
|
|
72
|
+
emptyOptionLabel: {
|
|
73
|
+
default: undefined;
|
|
74
|
+
type: StringConstructor;
|
|
75
|
+
};
|
|
76
|
+
select: {
|
|
77
|
+
default: undefined;
|
|
78
|
+
type: PropType<SelectConfiguration | undefined>;
|
|
79
|
+
};
|
|
80
|
+
}, {
|
|
81
|
+
focus: () => void | undefined;
|
|
82
|
+
blur: () => void | undefined;
|
|
83
|
+
open: () => void | undefined;
|
|
84
|
+
close: () => void | undefined;
|
|
85
|
+
setKeywords: (input: string) => void | undefined;
|
|
86
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
87
|
+
modelValue: {
|
|
88
|
+
default: undefined;
|
|
89
|
+
type: PropType<string | number | null | undefined>;
|
|
90
|
+
};
|
|
91
|
+
url: {
|
|
92
|
+
required: true;
|
|
93
|
+
type: StringConstructor;
|
|
94
|
+
};
|
|
95
|
+
showRouteUrl: {
|
|
96
|
+
default: undefined;
|
|
97
|
+
type: PropType<((id: string | number) => string) | undefined>;
|
|
98
|
+
};
|
|
99
|
+
primaryKey: {
|
|
100
|
+
default: string;
|
|
101
|
+
type: StringConstructor;
|
|
102
|
+
};
|
|
103
|
+
field: {
|
|
104
|
+
required: true;
|
|
105
|
+
type: StringConstructor;
|
|
106
|
+
};
|
|
107
|
+
required: {
|
|
108
|
+
default: boolean;
|
|
109
|
+
type: BooleanConstructor;
|
|
110
|
+
};
|
|
111
|
+
disabled: {
|
|
112
|
+
default: boolean;
|
|
113
|
+
type: BooleanConstructor;
|
|
114
|
+
};
|
|
115
|
+
name: {
|
|
116
|
+
default: undefined;
|
|
117
|
+
type: StringConstructor;
|
|
118
|
+
};
|
|
119
|
+
placeholder: {
|
|
120
|
+
default: undefined;
|
|
121
|
+
type: StringConstructor;
|
|
122
|
+
};
|
|
123
|
+
currentModel: {
|
|
124
|
+
default: null;
|
|
125
|
+
type: PropType<Option | null>;
|
|
126
|
+
};
|
|
127
|
+
hasError: {
|
|
128
|
+
default: boolean;
|
|
129
|
+
type: BooleanConstructor;
|
|
130
|
+
};
|
|
131
|
+
inline: {
|
|
132
|
+
default: boolean;
|
|
133
|
+
type: BooleanConstructor;
|
|
134
|
+
};
|
|
135
|
+
size: {
|
|
136
|
+
default: string;
|
|
137
|
+
type: PropType<"base" | "xs" | "sm">;
|
|
138
|
+
};
|
|
139
|
+
dropdownShow: {
|
|
140
|
+
default: string;
|
|
141
|
+
type: PropType<"focus" | "always">;
|
|
142
|
+
};
|
|
143
|
+
showModelValue: {
|
|
144
|
+
default: boolean;
|
|
145
|
+
type: BooleanConstructor;
|
|
146
|
+
};
|
|
147
|
+
visibleFocus: {
|
|
148
|
+
default: boolean;
|
|
149
|
+
type: BooleanConstructor;
|
|
150
|
+
};
|
|
151
|
+
showEmptyOption: {
|
|
152
|
+
default: boolean;
|
|
153
|
+
type: BooleanConstructor;
|
|
154
|
+
};
|
|
155
|
+
emptyOptionLabel: {
|
|
156
|
+
default: undefined;
|
|
157
|
+
type: StringConstructor;
|
|
158
|
+
};
|
|
159
|
+
select: {
|
|
160
|
+
default: undefined;
|
|
161
|
+
type: PropType<SelectConfiguration | undefined>;
|
|
162
|
+
};
|
|
163
|
+
}>> & {
|
|
164
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
165
|
+
}, {
|
|
166
|
+
select: SelectConfiguration | undefined;
|
|
167
|
+
placeholder: string;
|
|
168
|
+
name: string;
|
|
169
|
+
disabled: boolean;
|
|
170
|
+
required: boolean;
|
|
171
|
+
inline: boolean;
|
|
172
|
+
modelValue: string | number | null | undefined;
|
|
173
|
+
hasError: boolean;
|
|
174
|
+
size: "base" | "xs" | "sm";
|
|
175
|
+
dropdownShow: "focus" | "always";
|
|
176
|
+
showModelValue: boolean;
|
|
177
|
+
visibleFocus: boolean;
|
|
178
|
+
showEmptyOption: boolean;
|
|
179
|
+
emptyOptionLabel: string;
|
|
180
|
+
primaryKey: string;
|
|
181
|
+
currentModel: Option | null;
|
|
182
|
+
showRouteUrl: ((id: string | number) => string) | undefined;
|
|
183
|
+
}, {}>, {
|
|
184
|
+
option?(_: {
|
|
185
|
+
focus: () => void;
|
|
186
|
+
blur: () => void;
|
|
187
|
+
open: () => void;
|
|
188
|
+
close: () => void;
|
|
189
|
+
keywords: import("vue").ComputedRef<string>;
|
|
190
|
+
option: Option;
|
|
191
|
+
selected: boolean;
|
|
192
|
+
active: boolean;
|
|
193
|
+
}): any;
|
|
194
|
+
empty?(_: {
|
|
195
|
+
firstSearch: boolean;
|
|
196
|
+
focus: () => void;
|
|
197
|
+
blur: () => void;
|
|
198
|
+
open: () => void;
|
|
199
|
+
close: () => void;
|
|
200
|
+
keywords: import("vue").ComputedRef<string>;
|
|
201
|
+
}): any;
|
|
202
|
+
footer?(_: {
|
|
203
|
+
keywords: string;
|
|
204
|
+
focus: () => void;
|
|
205
|
+
blur: () => void;
|
|
206
|
+
open: () => void;
|
|
207
|
+
close: () => void;
|
|
208
|
+
options: import("@/types").NormalizedOption[];
|
|
209
|
+
}): any;
|
|
210
|
+
}>;
|
|
211
|
+
export default _default;
|
|
212
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
213
|
+
new (): {
|
|
214
|
+
$slots: S;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
@@ -10,6 +10,7 @@ import BaseAvatar from './BaseAvatar.vue';
|
|
|
10
10
|
import BaseAvatarGroup from './BaseAvatarGroup.vue';
|
|
11
11
|
import BaseBadge from './BaseBadge.vue';
|
|
12
12
|
import BaseBelongsTo from './BaseBelongsTo.vue';
|
|
13
|
+
import BaseBelongsToFetch from './BaseBelongsToFetch.vue';
|
|
13
14
|
import BaseBoolean from './BaseBoolean.vue';
|
|
14
15
|
import BaseBreadcrumbs from './BaseBreadcrumbs.vue';
|
|
15
16
|
import BaseButton from './BaseButton.vue';
|
|
@@ -94,4 +95,4 @@ import BaseLayoutStacked from './BaseLayoutStacked.vue';
|
|
|
94
95
|
import BaseLayoutStackedConfigurable from './BaseLayoutStackedConfigurable.vue';
|
|
95
96
|
import BaseLayoutSidebar from './BaseLayoutSidebar.vue';
|
|
96
97
|
import BaseLayoutSidebarConfigurable from './BaseLayoutSidebarConfigurable.vue';
|
|
97
|
-
export { BaseActionItem, BaseAddressForm, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseAvatarGroup, BaseBadge, BaseBelongsTo, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseButtonGroup, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClickOutside, BaseClipboard, BaseCalendar, BaseColor, BaseContainer, BaseCounter, BaseCropper, BaseCropperModal, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseDisplayRelativeTime, BaseDropdown, BaseDropdownAutocomplete, BaseEmptyState, BaseField, BaseFieldI18n, BaseFilePicker, BaseFilePickerCrop, BaseFileUploader, BaseForm, BaseGantt, BaseHasMany, BaseHeader, BaseIcon, BaseIconPicker, BaseInput, BaseInputLabel, BaseInputPercent, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BaseNavbarSideItem, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseRadioGroup, BaseReadMore, BaseRichText, BaseSelect, BaseShortcut, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseStatistic, BaseStepper, BaseStepperItem, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseTimeline, BaseTimelineItem, BaseUniqueCode, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
|
98
|
+
export { BaseActionItem, BaseAddressForm, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseAvatarGroup, BaseBadge, BaseBelongsTo, BaseBelongsToFetch, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseButtonGroup, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClickOutside, BaseClipboard, BaseCalendar, BaseColor, BaseContainer, BaseCounter, BaseCropper, BaseCropperModal, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseDisplayRelativeTime, BaseDropdown, BaseDropdownAutocomplete, BaseEmptyState, BaseField, BaseFieldI18n, BaseFilePicker, BaseFilePickerCrop, BaseFileUploader, BaseForm, BaseGantt, BaseHasMany, BaseHeader, BaseIcon, BaseIconPicker, BaseInput, BaseInputLabel, BaseInputPercent, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BaseNavbarSideItem, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseRadioGroup, BaseReadMore, BaseRichText, BaseSelect, BaseShortcut, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseStatistic, BaseStepper, BaseStepperItem, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseTimeline, BaseTimelineItem, BaseUniqueCode, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
package/package.json
CHANGED
|
@@ -17,8 +17,9 @@ export default {
|
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
args: {
|
|
20
|
-
|
|
21
|
-
field: '
|
|
20
|
+
options: options,
|
|
21
|
+
field: 'label',
|
|
22
|
+
primaryKey: 'value',
|
|
22
23
|
},
|
|
23
24
|
decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
|
|
24
25
|
};
|
|
@@ -104,8 +105,8 @@ export const SlotOption = (args) => {
|
|
|
104
105
|
'bg-blue-600 text-white hover:bg-blue-700': active && selected,
|
|
105
106
|
}"
|
|
106
107
|
>
|
|
107
|
-
<p class="text-sm font-medium">{{ option.
|
|
108
|
-
<p class="opacity-60 text-xs">{{ option.
|
|
108
|
+
<p class="text-sm font-medium">{{ option.label }}</p>
|
|
109
|
+
<p class="opacity-60 text-xs">{{ option.type }}</p>
|
|
109
110
|
</div>
|
|
110
111
|
</template>
|
|
111
112
|
</BaseBelongsTo>
|
|
@@ -153,10 +154,7 @@ export const SlotEmpty = (args) => {
|
|
|
153
154
|
v-bind="args"
|
|
154
155
|
>
|
|
155
156
|
<template #empty="props">
|
|
156
|
-
<div>
|
|
157
|
-
<div v-if="props.firstSearch" class="text-center py-10 p-6">🤓🤓🤓</div>
|
|
158
|
-
<div v-else class="text-center p-6">Start your search... 🔎</div>
|
|
159
|
-
</div>
|
|
157
|
+
<div class="text-center p-6 py-10 flex items-center justify-center">🤓🤓🤓</div>
|
|
160
158
|
</template>
|
|
161
159
|
</BaseBelongsTo>
|
|
162
160
|
`,
|
|
@@ -173,8 +171,8 @@ export const WithSelect = (args) => {
|
|
|
173
171
|
const select = {
|
|
174
172
|
options: [
|
|
175
173
|
{ label: 'All', value: 'all' },
|
|
176
|
-
{ label: '
|
|
177
|
-
{ label: '
|
|
174
|
+
{ label: 'Sith', value: 'sith' },
|
|
175
|
+
{ label: 'Jedi', value: 'jedi' },
|
|
178
176
|
],
|
|
179
177
|
labelKey: 'label',
|
|
180
178
|
valueKey: 'value',
|
|
@@ -183,24 +181,20 @@ export const WithSelect = (args) => {
|
|
|
183
181
|
},
|
|
184
182
|
};
|
|
185
183
|
|
|
186
|
-
const
|
|
184
|
+
const options2 = computed(() => {
|
|
187
185
|
if (selected.value == 'all' || !selected.value) {
|
|
188
|
-
return
|
|
186
|
+
return options;
|
|
189
187
|
}
|
|
190
|
-
return (
|
|
191
|
-
'https://effettandem.com/api/content/articles' +
|
|
192
|
-
'?type=' +
|
|
193
|
-
selected.value
|
|
194
|
-
);
|
|
188
|
+
return options.filter((option) => option.type === selected.value);
|
|
195
189
|
});
|
|
196
190
|
|
|
197
|
-
return { args, value,
|
|
191
|
+
return { args, value, options2, selected, select };
|
|
198
192
|
},
|
|
199
193
|
template: `
|
|
200
194
|
<BaseBelongsTo
|
|
201
195
|
v-model="value"
|
|
202
196
|
v-bind="args"
|
|
203
|
-
:
|
|
197
|
+
:options="options2"
|
|
204
198
|
:select="select"
|
|
205
199
|
>
|
|
206
200
|
</BaseBelongsTo>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
ref="
|
|
2
|
+
<BaseAutocomplete
|
|
3
|
+
ref="autocomplete"
|
|
4
4
|
:model-value="model"
|
|
5
|
-
:
|
|
5
|
+
:options="options"
|
|
6
6
|
:disabled="disabled"
|
|
7
7
|
:name="name"
|
|
8
8
|
:placeholder="placeholder"
|
|
@@ -38,14 +38,12 @@
|
|
|
38
38
|
v-bind="footerProps"
|
|
39
39
|
/>
|
|
40
40
|
</template>
|
|
41
|
-
</
|
|
41
|
+
</BaseAutocomplete>
|
|
42
42
|
</template>
|
|
43
43
|
|
|
44
44
|
<script lang="ts" setup>
|
|
45
45
|
import { PropType } from 'vue';
|
|
46
|
-
import
|
|
47
|
-
import { config } from '@/index';
|
|
48
|
-
import BaseAutocompleteFetch from './BaseAutocompleteFetch.vue';
|
|
46
|
+
import BaseAutocomplete from './BaseAutocomplete.vue';
|
|
49
47
|
import { Option, SelectConfiguration } from '@/types';
|
|
50
48
|
|
|
51
49
|
const props = defineProps({
|
|
@@ -55,13 +53,9 @@ const props = defineProps({
|
|
|
55
53
|
string | number | null | undefined
|
|
56
54
|
>,
|
|
57
55
|
},
|
|
58
|
-
|
|
56
|
+
options: {
|
|
59
57
|
required: true,
|
|
60
|
-
type:
|
|
61
|
-
},
|
|
62
|
-
showRouteUrl: {
|
|
63
|
-
default: undefined,
|
|
64
|
-
type: Function as PropType<((id: string | number) => string) | undefined>,
|
|
58
|
+
type: Array as PropType<Option[]>,
|
|
65
59
|
},
|
|
66
60
|
primaryKey: {
|
|
67
61
|
default: 'id',
|
|
@@ -129,13 +123,9 @@ const props = defineProps({
|
|
|
129
123
|
},
|
|
130
124
|
});
|
|
131
125
|
|
|
132
|
-
const http = config.http;
|
|
133
|
-
|
|
134
126
|
const emit = defineEmits(['update:modelValue']);
|
|
135
127
|
|
|
136
|
-
const
|
|
137
|
-
typeof BaseAutocompleteFetch
|
|
138
|
-
> | null>(null);
|
|
128
|
+
const autocomplete = ref<InstanceType<typeof BaseAutocomplete> | null>(null);
|
|
139
129
|
|
|
140
130
|
const model = ref(props.currentModel);
|
|
141
131
|
|
|
@@ -147,32 +137,6 @@ watch(
|
|
|
147
137
|
{ deep: true }
|
|
148
138
|
);
|
|
149
139
|
|
|
150
|
-
watch(
|
|
151
|
-
() => props.modelValue,
|
|
152
|
-
(newValue, oldValue) => {
|
|
153
|
-
if (!props.modelValue) {
|
|
154
|
-
model.value = null;
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (newValue == oldValue) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (props.showRouteUrl == null) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
http
|
|
167
|
-
.get(props.showRouteUrl(props.modelValue))
|
|
168
|
-
.then((response: AxiosResponse) => {
|
|
169
|
-
model.value = response.data.data;
|
|
170
|
-
})
|
|
171
|
-
.catch((e: Error) => e);
|
|
172
|
-
},
|
|
173
|
-
{ immediate: true }
|
|
174
|
-
);
|
|
175
|
-
|
|
176
140
|
function onUpdate(newModel: Option | null) {
|
|
177
141
|
if (!newModel) {
|
|
178
142
|
model.value = null;
|
|
@@ -184,10 +148,10 @@ function onUpdate(newModel: Option | null) {
|
|
|
184
148
|
}
|
|
185
149
|
|
|
186
150
|
defineExpose({
|
|
187
|
-
focus: () =>
|
|
188
|
-
blur: () =>
|
|
189
|
-
open: () =>
|
|
190
|
-
close: () =>
|
|
191
|
-
setKeywords: (input: string) =>
|
|
151
|
+
focus: () => autocomplete.value?.focus(),
|
|
152
|
+
blur: () => autocomplete.value?.blur(),
|
|
153
|
+
open: () => autocomplete.value?.open(),
|
|
154
|
+
close: () => autocomplete.value?.close(),
|
|
155
|
+
setKeywords: (input: string) => autocomplete.value?.setKeywords(input),
|
|
192
156
|
});
|
|
193
157
|
</script>
|