@weitutech/by-components-v3 1.1.6 → 1.1.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/by-component-v3.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, onMounted, resolveComponent, openBlock, createElementBlock, createVNode, mergeProps, createElementVNode, Fragment, renderList, normalizeClass, toDisplayString, watch, createTextVNode, useSlots, toRefs, computed, createBlock, unref, createCommentVNode, isVNode, reactive, inject, provide, h as h$1, onUnmounted,
|
|
1
|
+
import { defineComponent, ref, onMounted, resolveComponent, openBlock, createElementBlock, createVNode, mergeProps, createElementVNode, Fragment, renderList, normalizeClass, toDisplayString, watch, createTextVNode, useSlots, toRefs, computed, createBlock, unref, createCommentVNode, nextTick, isVNode, reactive, inject, provide, h as h$1, onUnmounted, onBeforeUnmount, TransitionGroup, Teleport, onActivated, onDeactivated, getCurrentInstance, getCurrentScope, onScopeDispose, readonly, isRef, warn as warn$1, renderSlot, Transition, withCtx, withDirectives, normalizeStyle, vShow, shallowReactive, resolveDynamicComponent, withModifiers, render, createApp } from "vue";
|
|
2
2
|
function cloneDeep(obj) {
|
|
3
3
|
if (obj === null || typeof obj !== "object") {
|
|
4
4
|
return obj;
|
|
@@ -4770,7 +4770,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4770
4770
|
var _a2;
|
|
4771
4771
|
emit("update:modelValue", cloneDeep(initialFormValues.value));
|
|
4772
4772
|
(_a2 = formRef.value) == null ? void 0 : _a2.resetFields();
|
|
4773
|
-
|
|
4773
|
+
nextTick(() => {
|
|
4774
|
+
emit("reset");
|
|
4775
|
+
});
|
|
4774
4776
|
};
|
|
4775
4777
|
__expose({
|
|
4776
4778
|
formRef,
|
|
@@ -4787,7 +4789,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4787
4789
|
};
|
|
4788
4790
|
}
|
|
4789
4791
|
});
|
|
4790
|
-
const ZshForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__scopeId", "data-v-
|
|
4792
|
+
const ZshForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__scopeId", "data-v-a0f0149d"]]);
|
|
4791
4793
|
const _hoisted_1$1 = {
|
|
4792
4794
|
id: "pager",
|
|
4793
4795
|
class: "pager fixed bottom-0 right-0 w-full flex justify-center items-center z-50"
|
|
@@ -36802,14 +36804,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
36802
36804
|
const CustomColumn = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-0dadba78"]]);
|
|
36803
36805
|
const isCachedTableColumns = (name) => {
|
|
36804
36806
|
if (!name) return false;
|
|
36805
|
-
|
|
36806
|
-
if (!cachedData) return false;
|
|
36807
|
-
try {
|
|
36808
|
-
const parsedData = JSON.parse(cachedData);
|
|
36809
|
-
return Array.isArray(parsedData) && parsedData.length > 0;
|
|
36810
|
-
} catch (e) {
|
|
36811
|
-
return false;
|
|
36812
|
-
}
|
|
36807
|
+
return !!localStorage.getItem(name);
|
|
36813
36808
|
};
|
|
36814
36809
|
const removeCachedTableColumns = (name) => {
|
|
36815
36810
|
localStorage.removeItem(name);
|
|
@@ -36890,6 +36885,27 @@ const replaceColumnWidthToColumns = (name, columns) => {
|
|
|
36890
36885
|
};
|
|
36891
36886
|
return processColumnWidth(columns, cacheColumns);
|
|
36892
36887
|
};
|
|
36888
|
+
const rewriteWidthColumns = (fromColumns, toColumns) => {
|
|
36889
|
+
if (!fromColumns || !toColumns) return [];
|
|
36890
|
+
if (!fromColumns || fromColumns.length === 0) return toColumns;
|
|
36891
|
+
const result = [];
|
|
36892
|
+
for (const col of toColumns) {
|
|
36893
|
+
const fromCol = fromColumns.find((from2) => from2.field === col.field);
|
|
36894
|
+
if (col.children) {
|
|
36895
|
+
result.push({
|
|
36896
|
+
...col,
|
|
36897
|
+
...(fromCol == null ? void 0 : fromCol.width) && { width: fromCol.width },
|
|
36898
|
+
children: rewriteWidthColumns((fromCol == null ? void 0 : fromCol.children) || [], col.children)
|
|
36899
|
+
});
|
|
36900
|
+
} else {
|
|
36901
|
+
result.push({
|
|
36902
|
+
...col,
|
|
36903
|
+
...(fromCol == null ? void 0 : fromCol.width) && { width: fromCol.width }
|
|
36904
|
+
});
|
|
36905
|
+
}
|
|
36906
|
+
}
|
|
36907
|
+
return result;
|
|
36908
|
+
};
|
|
36893
36909
|
const events = ["keydown", "current-change", "radio-change", "checkbox-change", "checkbox-all", "checkbox-range-start", "checkbox-range-change", "checkbox-range-end", "cell-dblclick", "cell-menu", "cell-mouseenter", "cell-mouseleave", "cell-delete-value", "header-cell-click", "header-cell-dblclick", "header-cell-menu", "footer-cell-click", "footer-cell-dblclick", "footer-cell-menu", "clear-merge", "sort-change", "clear-sort", "filter-visible", "filter-change", "clear-filter", "toggle-row-expand", "toggle-tree-expand", "menu-click", "cell-selected", "edit-closed", "edit-activated", "edit-disabled", "valid-error", "scroll", "custom", "page-change", "form-submit", "form-submit-invalid", "form-reset", "form-collapse", "proxy-query", "proxy-delete", "proxy-save", "toolbar-button-click", "toolbar-tool-click", "zoom", "cell-click"];
|
|
36894
36910
|
const capitalizeFirstLetter = (str) => {
|
|
36895
36911
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
@@ -36958,17 +36974,19 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
36958
36974
|
}
|
|
36959
36975
|
};
|
|
36960
36976
|
});
|
|
36961
|
-
watch(() => props.gridOptions.columns, (newColumns) => {
|
|
36962
|
-
originColumns.value = deepClone(newColumns);
|
|
36963
|
-
}, {
|
|
36964
|
-
deep: true
|
|
36965
|
-
});
|
|
36966
36977
|
const listeners = ref({});
|
|
36967
36978
|
const CustomColumnRef = ref();
|
|
36968
36979
|
const vxeGridRef = ref();
|
|
36969
36980
|
const showResetCache = ref(false);
|
|
36970
36981
|
const hasCache = ref(false);
|
|
36971
36982
|
const originColumns = ref([]);
|
|
36983
|
+
const tempColumns = ref([]);
|
|
36984
|
+
watch(() => props.gridOptions.columns, (newColumns) => {
|
|
36985
|
+
const result = rewriteWidthColumns(tempColumns.value, newColumns);
|
|
36986
|
+
originColumns.value = result;
|
|
36987
|
+
}, {
|
|
36988
|
+
deep: true
|
|
36989
|
+
});
|
|
36972
36990
|
onMounted(() => {
|
|
36973
36991
|
showResetCache.value = !!props.name;
|
|
36974
36992
|
originColumns.value = deepClone(props.gridOptions.columns);
|
|
@@ -36978,6 +36996,9 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
36978
36996
|
console.log(listeners.value, "listeners");
|
|
36979
36997
|
});
|
|
36980
36998
|
const handlePagerChange = (context) => {
|
|
36999
|
+
if (vxeGridRef.value) {
|
|
37000
|
+
vxeGridRef.value.scrollTo(0, 0);
|
|
37001
|
+
}
|
|
36981
37002
|
emit("pageChange", context);
|
|
36982
37003
|
};
|
|
36983
37004
|
const copy = (text) => {
|
|
@@ -37062,6 +37083,7 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
37062
37083
|
}
|
|
37063
37084
|
}
|
|
37064
37085
|
}
|
|
37086
|
+
tempColumns.value = deepClone(result);
|
|
37065
37087
|
const newColumns = replaceColumnWidthToColumns(props.name, result);
|
|
37066
37088
|
setHasCache();
|
|
37067
37089
|
emit("setColumns", newColumns);
|