knt-shared 1.1.2 → 1.1.3
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/components/Form/types.d.ts +149 -0
- package/dist/components/Form/types.d.ts.map +1 -0
- package/dist/components/Modal/BasicModal.vue.d.ts +1 -1
- package/dist/components/Table/BasicTable.vue.d.ts.map +1 -1
- package/dist/components/Table/types.d.ts +2 -2
- package/dist/components/Table/types.d.ts.map +1 -1
- package/dist/index.cjs.js +16 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +16 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/style.css +10 -8
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1318,6 +1318,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1318
1318
|
pageSizeOptions: [5, 10, 20, 50, 100]
|
|
1319
1319
|
});
|
|
1320
1320
|
const searchParams = ref({});
|
|
1321
|
+
let currentAbortController = null;
|
|
1321
1322
|
const getMergedProps = computed(() => {
|
|
1322
1323
|
return { ...props, ...innerPropsRef.value };
|
|
1323
1324
|
});
|
|
@@ -1637,7 +1638,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1637
1638
|
getSearchConfig.value.onSearch(filteredValues);
|
|
1638
1639
|
}
|
|
1639
1640
|
if (getMergedProps.value.api) {
|
|
1640
|
-
await
|
|
1641
|
+
await fetchData();
|
|
1641
1642
|
}
|
|
1642
1643
|
};
|
|
1643
1644
|
const handleReset = async () => {
|
|
@@ -1707,6 +1708,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1707
1708
|
const fetchData = async () => {
|
|
1708
1709
|
const mergedProps = getMergedProps.value;
|
|
1709
1710
|
if (!mergedProps.api) return;
|
|
1711
|
+
if (currentAbortController) {
|
|
1712
|
+
currentAbortController.abort();
|
|
1713
|
+
}
|
|
1714
|
+
currentAbortController = new AbortController();
|
|
1715
|
+
const signal = currentAbortController.signal;
|
|
1710
1716
|
try {
|
|
1711
1717
|
loadingRef.value = true;
|
|
1712
1718
|
let params = {
|
|
@@ -1719,7 +1725,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1719
1725
|
if (mergedProps.beforeFetch) {
|
|
1720
1726
|
params = mergedProps.beforeFetch(params);
|
|
1721
1727
|
}
|
|
1722
|
-
const result = await mergedProps.api(params);
|
|
1728
|
+
const result = await mergedProps.api(params, signal);
|
|
1723
1729
|
if (!result || typeof result !== "object") {
|
|
1724
1730
|
throw {
|
|
1725
1731
|
code: ERROR_CODES.INVALID_RESPONSE,
|
|
@@ -1756,6 +1762,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1756
1762
|
}
|
|
1757
1763
|
emit("fetch-success", data);
|
|
1758
1764
|
} catch (error) {
|
|
1765
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
1766
|
+
console.log("请求已被取消");
|
|
1767
|
+
return;
|
|
1768
|
+
}
|
|
1759
1769
|
console.error("表格数据加载失败:", error);
|
|
1760
1770
|
let errorMessage = "数据加载失败";
|
|
1761
1771
|
let errorCode = ERROR_CODES.UNKNOWN_ERROR;
|
|
@@ -1794,7 +1804,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1794
1804
|
mergedProps.onFetchError(fetchError);
|
|
1795
1805
|
}
|
|
1796
1806
|
} finally {
|
|
1797
|
-
|
|
1807
|
+
if (!signal.aborted) {
|
|
1808
|
+
loadingRef.value = false;
|
|
1809
|
+
}
|
|
1798
1810
|
}
|
|
1799
1811
|
};
|
|
1800
1812
|
const handleRefresh = debounce(async () => {
|
|
@@ -2317,7 +2329,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
2317
2329
|
}
|
|
2318
2330
|
return target;
|
|
2319
2331
|
};
|
|
2320
|
-
const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
2332
|
+
const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-7382de28"]]);
|
|
2321
2333
|
function useTable(options = {}) {
|
|
2322
2334
|
const tableRef = ref(null);
|
|
2323
2335
|
const formRef = ref(null);
|