sprintify-ui 0.6.70 → 0.6.71
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 +1887 -1888
- package/package.json +1 -1
- package/src/components/BaseHasMany.vue +30 -33
package/package.json
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
</template>
|
|
45
45
|
|
|
46
46
|
<script lang="ts" setup>
|
|
47
|
-
import { isEqual } from 'lodash';
|
|
47
|
+
import { debounce, isEqual } from 'lodash';
|
|
48
48
|
import { Option } from '@/types';
|
|
49
49
|
import { config } from '@/index';
|
|
50
50
|
import { PropType } from 'vue';
|
|
@@ -128,46 +128,43 @@ watch(
|
|
|
128
128
|
|
|
129
129
|
watch(
|
|
130
130
|
() => props.modelValue,
|
|
131
|
-
(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
131
|
+
debounce(() => fetchModels(), 300),
|
|
132
|
+
{ immediate: true }
|
|
133
|
+
);
|
|
136
134
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
function fetchModels() {
|
|
136
|
+
if (props.currentModels !== undefined) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
140
139
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
140
|
+
if (props.showRouteUrl == null) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
145
143
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
if (!props.modelValue) {
|
|
145
|
+
models.value = [];
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
149
148
|
|
|
150
|
-
|
|
149
|
+
// Do not fetch if the modelValue is the same as the local models
|
|
151
150
|
|
|
152
|
-
|
|
151
|
+
const ids = props.modelValue.map((id: number | string) => id.toString());
|
|
153
152
|
|
|
154
|
-
|
|
153
|
+
const localModelIds = models.value.map((m) => m[props.primaryKey]);
|
|
155
154
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
if (isEqual(ids, localModelIds)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
159
158
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
{ immediate: true }
|
|
170
|
-
);
|
|
159
|
+
http
|
|
160
|
+
.get(props.showRouteUrl(ids))
|
|
161
|
+
.then((response: AxiosResponse) => {
|
|
162
|
+
models.value = response.data.data.filter((i: any) => {
|
|
163
|
+
return ids.includes(i[props.primaryKey]);
|
|
164
|
+
});
|
|
165
|
+
})
|
|
166
|
+
.catch((e: Error) => e);
|
|
167
|
+
}
|
|
171
168
|
|
|
172
169
|
function onUpdate(newModels: Option[]) {
|
|
173
170
|
models.value = newModels;
|