sprintify-ui 0.6.71 → 0.6.73
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/package.json
CHANGED
|
@@ -50,6 +50,7 @@ import { config } from '@/index';
|
|
|
50
50
|
import { PropType } from 'vue';
|
|
51
51
|
import BaseTagAutocompleteFetch from './BaseTagAutocompleteFetch.vue';
|
|
52
52
|
import { AxiosResponse } from 'axios';
|
|
53
|
+
import { getItems } from '@/utils/getApiData';
|
|
53
54
|
|
|
54
55
|
const props = defineProps({
|
|
55
56
|
modelValue: {
|
|
@@ -128,16 +129,17 @@ watch(
|
|
|
128
129
|
|
|
129
130
|
watch(
|
|
130
131
|
() => props.modelValue,
|
|
131
|
-
debounce(() => fetchModels(),
|
|
132
|
+
debounce(() => fetchModels(), 200),
|
|
132
133
|
{ immediate: true }
|
|
133
134
|
);
|
|
134
135
|
|
|
135
136
|
function fetchModels() {
|
|
137
|
+
|
|
136
138
|
if (props.currentModels !== undefined) {
|
|
137
139
|
return;
|
|
138
140
|
}
|
|
139
141
|
|
|
140
|
-
if (props.showRouteUrl ==
|
|
142
|
+
if (props.showRouteUrl == undefined) {
|
|
141
143
|
return;
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -159,7 +161,10 @@ function fetchModels() {
|
|
|
159
161
|
http
|
|
160
162
|
.get(props.showRouteUrl(ids))
|
|
161
163
|
.then((response: AxiosResponse) => {
|
|
162
|
-
|
|
164
|
+
|
|
165
|
+
const items = getItems(response.data);
|
|
166
|
+
|
|
167
|
+
models.value = items.filter((i: any) => {
|
|
163
168
|
return ids.includes(i[props.primaryKey]);
|
|
164
169
|
});
|
|
165
170
|
})
|
|
@@ -6,18 +6,13 @@ import {
|
|
|
6
6
|
PaginationMetadata,
|
|
7
7
|
} from '@/types';
|
|
8
8
|
import { isArray } from 'lodash';
|
|
9
|
+
import { getItems } from '@/utils/getApiData';
|
|
9
10
|
|
|
10
11
|
export function useHasPaginatedData(
|
|
11
12
|
data: Ref<Collection | PaginatedCollection | ResourceCollection | null>
|
|
12
13
|
) {
|
|
13
14
|
const items = computed(() => {
|
|
14
|
-
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
|
-
if (isArray(data.value)) {
|
|
18
|
-
return data.value;
|
|
19
|
-
}
|
|
20
|
-
return data.value.data;
|
|
15
|
+
return getItems(data.value);
|
|
21
16
|
});
|
|
22
17
|
|
|
23
18
|
const paginationMetadata = computed<PaginationMetadata | null>(() => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Collection, PaginatedCollection, ResourceCollection } from "@/types";
|
|
2
|
+
import { isArray } from "lodash";
|
|
3
|
+
|
|
4
|
+
export function getItems(data: Collection | PaginatedCollection | ResourceCollection | null) {
|
|
5
|
+
if (!data) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
if (isArray(data)) {
|
|
9
|
+
return data;
|
|
10
|
+
}
|
|
11
|
+
return data.data;
|
|
12
|
+
}
|