sprintify-ui 0.10.47 → 0.10.49
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.
|
@@ -3,17 +3,18 @@ type __VLS_Props = {
|
|
|
3
3
|
itemKey: string;
|
|
4
4
|
handle?: string;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
has?: string;
|
|
6
7
|
};
|
|
7
8
|
declare const elementsRef: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
|
|
8
9
|
declare function getKey(element: any): any;
|
|
9
10
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
10
|
-
declare var
|
|
11
|
+
declare var __VLS_7: {
|
|
11
12
|
key: any;
|
|
12
13
|
element: any;
|
|
13
14
|
index: number;
|
|
14
15
|
};
|
|
15
16
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
16
|
-
item?: (props: typeof
|
|
17
|
+
item?: (props: typeof __VLS_7) => any;
|
|
17
18
|
}>;
|
|
18
19
|
declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
|
|
19
20
|
elementsRef: typeof elementsRef;
|
|
@@ -24,6 +25,7 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
|
|
|
24
25
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
25
26
|
}>, {
|
|
26
27
|
disabled: boolean;
|
|
28
|
+
has: string;
|
|
27
29
|
itemKey: string;
|
|
28
30
|
handle: string;
|
|
29
31
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -33,6 +35,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
|
|
|
33
35
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
34
36
|
}>, {
|
|
35
37
|
disabled: boolean;
|
|
38
|
+
has: string;
|
|
36
39
|
itemKey: string;
|
|
37
40
|
handle: string;
|
|
38
41
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
package/package.json
CHANGED
|
@@ -49,7 +49,7 @@ import { config } from '@/index';
|
|
|
49
49
|
import BaseAutocompleteFetch from './BaseAutocompleteFetch.vue';
|
|
50
50
|
import { RawOption, SelectConfiguration } from '@/types';
|
|
51
51
|
import { Size } from '@/utils/sizes';
|
|
52
|
-
import { debounce, isObject } from 'lodash';
|
|
52
|
+
import { debounce, isObject, uniqueId } from 'lodash';
|
|
53
53
|
|
|
54
54
|
const props = withDefaults(
|
|
55
55
|
defineProps<{
|
|
@@ -107,19 +107,20 @@ const autocompleteFetch = ref<InstanceType<
|
|
|
107
107
|
> | null>(null);
|
|
108
108
|
|
|
109
109
|
const model = ref<RawOption | null>(null);
|
|
110
|
-
|
|
110
|
+
|
|
111
|
+
const ensureModelIsFilledWithRouteDebounced = debounce(ensureModelIsFilledWithRoute, 50);
|
|
111
112
|
|
|
112
113
|
watch(
|
|
113
114
|
() => props.currentModel,
|
|
114
|
-
|
|
115
|
+
ensureModelIsFilled,
|
|
115
116
|
);
|
|
116
117
|
|
|
117
118
|
watch(
|
|
118
119
|
() => props.modelValue,
|
|
119
|
-
|
|
120
|
+
ensureModelIsFilled,
|
|
120
121
|
);
|
|
121
122
|
|
|
122
|
-
|
|
123
|
+
ensureModelIsFilled();
|
|
123
124
|
|
|
124
125
|
function onUpdate(newModel: RawOption | null) {
|
|
125
126
|
if (!newModel) {
|
|
@@ -157,10 +158,33 @@ function ensureModelIsFilled() {
|
|
|
157
158
|
return;
|
|
158
159
|
}
|
|
159
160
|
|
|
161
|
+
ensureModelIsFilledWithRouteDebounced();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
let ensureModelIsFilledWithRouteLastId = null as string | number | null;
|
|
166
|
+
|
|
167
|
+
function ensureModelIsFilledWithRoute() {
|
|
168
|
+
if (props.modelValue == null) {
|
|
169
|
+
model.value = null;
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (props.showRouteUrl == null) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const ensureModelIsFilledWithRouteCurrentId = uniqueId();
|
|
178
|
+
ensureModelIsFilledWithRouteLastId = ensureModelIsFilledWithRouteCurrentId;
|
|
179
|
+
|
|
160
180
|
http
|
|
161
181
|
.get(props.showRouteUrl(props.modelValue))
|
|
162
182
|
.then((response: AxiosResponse) => {
|
|
163
183
|
|
|
184
|
+
if (ensureModelIsFilledWithRouteLastId !== ensureModelIsFilledWithRouteCurrentId) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
164
188
|
const data = response.data as Record<string, unknown>;
|
|
165
189
|
|
|
166
190
|
if (!isObject(data)) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<component
|
|
3
|
+
:is="has"
|
|
4
|
+
ref="elementsRef"
|
|
5
|
+
>
|
|
3
6
|
<slot
|
|
4
7
|
v-for="(element, index) in modelValue"
|
|
5
8
|
:key="getKey(element)"
|
|
@@ -7,7 +10,7 @@
|
|
|
7
10
|
:element="element"
|
|
8
11
|
:index="index"
|
|
9
12
|
/>
|
|
10
|
-
</
|
|
13
|
+
</component>
|
|
11
14
|
</template>
|
|
12
15
|
|
|
13
16
|
<script lang="ts" setup>
|
|
@@ -19,10 +22,12 @@ const props = withDefaults(defineProps<{
|
|
|
19
22
|
itemKey: string;
|
|
20
23
|
handle?: string;
|
|
21
24
|
disabled?: boolean;
|
|
25
|
+
has?: string
|
|
22
26
|
}>(), {
|
|
23
27
|
itemKey: 'id',
|
|
24
28
|
handle: '.handle',
|
|
25
29
|
disabled: false,
|
|
30
|
+
has: 'div', // Default to a div if not specified
|
|
26
31
|
});
|
|
27
32
|
|
|
28
33
|
const emit = defineEmits(['update:modelValue']);
|