@weitutech/by-components-v3 1.1.1 → 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 ADDED
@@ -0,0 +1,8 @@
1
+ # 1.1.1 (2025-05-20)
2
+
3
+ ### feat
4
+
5
+ - 自定义时间组件,支持绑定开始时间和结束时间
6
+ - 增加table表格列宽缓存功能
7
+ - 增加table表格行高自适应功能
8
+ - 增加form表单按钮区域(重置、搜索按钮)
@@ -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 ? "tooltip" : true,
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,28 +36885,24 @@ const ByTable = /* @__PURE__ */ defineComponent({
36884
36885
  if (!cacheColumns) {
36885
36886
  return columns;
36886
36887
  }
36887
- const cols = compareColumnsAndCols(columns, cacheColumns);
36888
- if (cols && props.name) {
36889
- columns.forEach((item) => {
36890
- item.width = (cols.find((col) => col.field === item.field) || {}).width || item.width || void 0;
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
- columns.forEach((item) => {
36900
- if (item && item.field && !cacheColumns.some((col) => col && col.field === item.field)) {
36901
- cacheColumns.push({
36902
- field: item.field,
36903
- width: item.width
36904
- });
36905
- }
36906
- });
36907
- localStorage.setItem(props.name, JSON.stringify(cacheColumns));
36908
- return cacheColumns;
36904
+ };
36905
+ return processColumnWidth(columns, cacheColumns);
36909
36906
  };
36910
36907
  const handlePagerChange = (context) => {
36911
36908
  emit("pageChange", context);
@@ -36934,10 +36931,22 @@ const ByTable = /* @__PURE__ */ defineComponent({
36934
36931
  if (!props.name) return;
36935
36932
  const collectColumn = context.$table.getTableColumn().collectColumn;
36936
36933
  console.log(collectColumn, "collectColumn");
36937
- const clos = collectColumn.filter((col) => col.field).map((col) => ({
36938
- field: col.field,
36939
- width: col.renderWidth
36940
- }));
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);
36941
36950
  localStorage.setItem(props.name, JSON.stringify(clos));
36942
36951
  };
36943
36952
  const handleOpenCustomColumn = () => {
@@ -36993,7 +37002,8 @@ const ByTable = /* @__PURE__ */ defineComponent({
36993
37002
  };
36994
37003
  expose({
36995
37004
  CustomColumnRef,
36996
- handleOpenCustomColumn
37005
+ handleOpenCustomColumn,
37006
+ vxeGridRef
36997
37007
  });
36998
37008
  return () => {
36999
37009
  var _a2, _b, _c, _d, _e2, _f;
@@ -37033,7 +37043,9 @@ const ByTable = /* @__PURE__ */ defineComponent({
37033
37043
  });
37034
37044
  return createVNode("div", {
37035
37045
  "class": "VxeGridWrap"
37036
- }, [createVNode(VxeGrid, mergeProps(defaultOptions.value, listeners.value, {
37046
+ }, [createVNode(VxeGrid, mergeProps({
37047
+ "ref": vxeGridRef
37048
+ }, defaultOptions.value, listeners.value, {
37037
37049
  "onCellClick": handleCellClick,
37038
37050
  "onResizableChange": handleResizableChange
37039
37051
  }), {