@weitutech/by-components-v3 1.1.0 → 1.1.2
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/CHANGELOG.MD +8 -0
- package/dist/by-component-v3.mjs +42 -32
- package/dist/by-component-v3.umd.js +1 -1
- package/dist/types/src/config.d.ts +66 -0
- package/package.json +3 -2
package/CHANGELOG.MD
ADDED
package/dist/by-component-v3.mjs
CHANGED
|
@@ -36838,7 +36838,7 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
36838
36838
|
border: true,
|
|
36839
36839
|
// 'visible' 值在 v4 版本中已经不再支持 (true:显示省略号; false:不显示省略号,自动撑高)
|
|
36840
36840
|
showOverflow: !props.autoHeight,
|
|
36841
|
-
showHeaderOverflow: props.autoHeight ?
|
|
36841
|
+
// showHeaderOverflow: props.autoHeight ? 'tooltip' : true,//表头不加,要换行显示
|
|
36842
36842
|
height: 710,
|
|
36843
36843
|
align: "center",
|
|
36844
36844
|
copyFields: [],
|
|
@@ -36876,6 +36876,7 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
36876
36876
|
console.log(listeners.value, "listeners");
|
|
36877
36877
|
});
|
|
36878
36878
|
const CustomColumnRef = ref();
|
|
36879
|
+
const vxeGridRef = ref();
|
|
36879
36880
|
const getColumnsData = (columns) => {
|
|
36880
36881
|
if (!props.name) {
|
|
36881
36882
|
return columns;
|
|
@@ -36884,31 +36885,24 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
36884
36885
|
if (!cacheColumns) {
|
|
36885
36886
|
return columns;
|
|
36886
36887
|
}
|
|
36887
|
-
const
|
|
36888
|
-
|
|
36889
|
-
|
|
36890
|
-
|
|
36888
|
+
const processColumnWidth = (columns2, cacheColumns2) => {
|
|
36889
|
+
return columns2.map((column) => {
|
|
36890
|
+
if (column.children) {
|
|
36891
|
+
const cacheColumn2 = cacheColumns2.find((col) => col.field === column.field);
|
|
36892
|
+
return {
|
|
36893
|
+
...column,
|
|
36894
|
+
width: (cacheColumn2 == null ? void 0 : cacheColumn2.width) || column.width,
|
|
36895
|
+
children: processColumnWidth(column.children, (cacheColumn2 == null ? void 0 : cacheColumn2.children) || [])
|
|
36896
|
+
};
|
|
36897
|
+
}
|
|
36898
|
+
const cacheColumn = cacheColumns2.find((col) => col.field === column.field);
|
|
36899
|
+
return {
|
|
36900
|
+
...column,
|
|
36901
|
+
width: (cacheColumn == null ? void 0 : cacheColumn.width) || column.width
|
|
36902
|
+
};
|
|
36891
36903
|
});
|
|
36892
|
-
}
|
|
36893
|
-
return columns;
|
|
36894
|
-
};
|
|
36895
|
-
const compareColumnsAndCols = (columns, cacheColumns) => {
|
|
36896
|
-
if (!cacheColumns || !props.name) {
|
|
36897
|
-
return void 0;
|
|
36898
|
-
}
|
|
36899
|
-
console.log(columns, "columns");
|
|
36900
|
-
columns.forEach((item) => {
|
|
36901
|
-
if (item && item.field && !cacheColumns.some((col) => col && col.field === item.field)) {
|
|
36902
|
-
cacheColumns.push({
|
|
36903
|
-
field: item.field,
|
|
36904
|
-
width: item.width
|
|
36905
|
-
});
|
|
36906
|
-
}
|
|
36907
|
-
});
|
|
36908
|
-
const newCacheColumns = cacheColumns.filter((item) => item && item.field && columns.some((col) => col && col.field === item.field));
|
|
36909
|
-
console.log("newCacheColumns=====:", newCacheColumns);
|
|
36910
|
-
localStorage.setItem(props.name, JSON.stringify(newCacheColumns));
|
|
36911
|
-
return newCacheColumns;
|
|
36904
|
+
};
|
|
36905
|
+
return processColumnWidth(columns, cacheColumns);
|
|
36912
36906
|
};
|
|
36913
36907
|
const handlePagerChange = (context) => {
|
|
36914
36908
|
emit("pageChange", context);
|
|
@@ -36937,10 +36931,22 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
36937
36931
|
if (!props.name) return;
|
|
36938
36932
|
const collectColumn = context.$table.getTableColumn().collectColumn;
|
|
36939
36933
|
console.log(collectColumn, "collectColumn");
|
|
36940
|
-
const
|
|
36941
|
-
field
|
|
36942
|
-
|
|
36943
|
-
|
|
36934
|
+
const processColumns = (columns) => {
|
|
36935
|
+
return columns.filter((col) => col.field || col.children).map((col) => {
|
|
36936
|
+
if (col.children) {
|
|
36937
|
+
return {
|
|
36938
|
+
field: col.field,
|
|
36939
|
+
width: col.renderWidth,
|
|
36940
|
+
children: processColumns(col.children)
|
|
36941
|
+
};
|
|
36942
|
+
}
|
|
36943
|
+
return {
|
|
36944
|
+
field: col.field,
|
|
36945
|
+
width: col.renderWidth
|
|
36946
|
+
};
|
|
36947
|
+
});
|
|
36948
|
+
};
|
|
36949
|
+
const clos = processColumns(collectColumn);
|
|
36944
36950
|
localStorage.setItem(props.name, JSON.stringify(clos));
|
|
36945
36951
|
};
|
|
36946
36952
|
const handleOpenCustomColumn = () => {
|
|
@@ -36991,11 +36997,13 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
36991
36997
|
}
|
|
36992
36998
|
}
|
|
36993
36999
|
}
|
|
36994
|
-
|
|
37000
|
+
const newColumns = getColumnsData(result);
|
|
37001
|
+
emit("setColumns", newColumns);
|
|
36995
37002
|
};
|
|
36996
37003
|
expose({
|
|
36997
37004
|
CustomColumnRef,
|
|
36998
|
-
handleOpenCustomColumn
|
|
37005
|
+
handleOpenCustomColumn,
|
|
37006
|
+
vxeGridRef
|
|
36999
37007
|
});
|
|
37000
37008
|
return () => {
|
|
37001
37009
|
var _a2, _b, _c, _d, _e2, _f;
|
|
@@ -37035,7 +37043,9 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
37035
37043
|
});
|
|
37036
37044
|
return createVNode("div", {
|
|
37037
37045
|
"class": "VxeGridWrap"
|
|
37038
|
-
}, [createVNode(VxeGrid, mergeProps(
|
|
37046
|
+
}, [createVNode(VxeGrid, mergeProps({
|
|
37047
|
+
"ref": vxeGridRef
|
|
37048
|
+
}, defaultOptions.value, listeners.value, {
|
|
37039
37049
|
"onCellClick": handleCellClick,
|
|
37040
37050
|
"onResizableChange": handleResizableChange
|
|
37041
37051
|
}), {
|