@weitutech/by-components-v3 1.1.19 → 1.1.21

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.
@@ -120294,17 +120294,43 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
120294
120294
  const setDraggableMenu = (arr) => {
120295
120295
  const left = { title: "左固定", field: "left", children: [] };
120296
120296
  const right = { title: "右固定", field: "right", children: [] };
120297
- const filteredArr = arr.filter((item) => {
120298
- if (!item.children && item.fixed === "left") {
120299
- left.children.push(item);
120300
- return false;
120297
+ const filteredArr = arr.reduce((result, item) => {
120298
+ if (!item.children || item.children.length === 0) {
120299
+ if (item.fixed === "left") {
120300
+ left.children.push(item);
120301
+ return result;
120302
+ }
120303
+ if (item.fixed === "right") {
120304
+ right.children.push(item);
120305
+ return result;
120306
+ }
120307
+ result.push(item);
120308
+ return result;
120301
120309
  }
120302
- if (!item.children && item.fixed === "right") {
120303
- right.children.push(item);
120304
- return false;
120310
+ const defaultDirection = item.fixed === "left" || item.fixed === "right" ? item.fixed : "";
120311
+ const remainedChildren = [];
120312
+ item.children.forEach((child) => {
120313
+ const direction2 = child.fixed === "left" || child.fixed === "right" ? child.fixed : defaultDirection;
120314
+ if (direction2 === "left" || direction2 === "right") {
120315
+ const fixedGroup = direction2 === "left" ? left : right;
120316
+ fixedGroup.children.push({
120317
+ ...child,
120318
+ fixed: direction2,
120319
+ parentColTitle: child.parentColTitle || item.title
120320
+ });
120321
+ return;
120322
+ }
120323
+ remainedChildren.push(child);
120324
+ });
120325
+ if (remainedChildren.length > 0) {
120326
+ result.push({
120327
+ ...item,
120328
+ fixed: void 0,
120329
+ children: remainedChildren
120330
+ });
120305
120331
  }
120306
- return true;
120307
- });
120332
+ return result;
120333
+ }, []);
120308
120334
  return [left, right, ...filteredArr];
120309
120335
  };
120310
120336
  if (bePreservedColumn && bePreservedColumn.length > 0) {
@@ -120777,7 +120803,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
120777
120803
  };
120778
120804
  }
120779
120805
  });
120780
- const CustomColumn = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__scopeId", "data-v-9bcdfbf0"]]);
120806
+ const CustomColumn = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__scopeId", "data-v-c41a9a02"]]);
120781
120807
  const isCachedTableColumns = (name) => {
120782
120808
  if (!name) return false;
120783
120809
  return !!localStorage.getItem(name);
@@ -121080,14 +121106,19 @@ const ByTable = /* @__PURE__ */ defineComponent({
121080
121106
  CustomColumnRef.value.dialogVisible = true;
121081
121107
  };
121082
121108
  const changeTableFields = (cols) => {
121109
+ var _a2, _b;
121083
121110
  const noFixedCol = cols.filter((col) => !col.field);
121084
- const result = JSON.parse(JSON.stringify([...cols.filter((col) => col.field === "left")[0].children.map((child) => ({
121111
+ const isVisibleColumn = (col) => col.type === "true" || col.type === true;
121112
+ const leftFixedChildren = (((_a2 = cols.filter((col) => col.field === "left")[0]) == null ? void 0 : _a2.children) || []).filter((child) => isVisibleColumn(child)).map((child) => ({
121085
121113
  ...child,
121086
121114
  fixed: "left"
121087
- })), ...noFixedCol, ...cols.filter((col) => col.field === "right")[0].children.map((child) => ({
121115
+ }));
121116
+ const rightFixedChildren = (((_b = cols.filter((col) => col.field === "right")[0]) == null ? void 0 : _b.children) || []).filter((child) => isVisibleColumn(child)).map((child) => ({
121088
121117
  ...child,
121089
121118
  fixed: "right"
121090
- }))]));
121119
+ }));
121120
+ const visibleNoFixedCols = noFixedCol.filter((col) => isVisibleColumn(col));
121121
+ const result = JSON.parse(JSON.stringify([...leftFixedChildren, ...visibleNoFixedCols, ...rightFixedChildren]));
121091
121122
  const slots2 = props2.gridOptions.customColumnConfig.slots;
121092
121123
  result.forEach((item) => {
121093
121124
  delete item.type;
@@ -121097,7 +121128,7 @@ const ByTable = /* @__PURE__ */ defineComponent({
121097
121128
  };
121098
121129
  }
121099
121130
  if (item.children && item.children.length > 0) {
121100
- item.children = item.children.filter((col) => col.type === "true" || col.type === true);
121131
+ item.children = item.children.filter((col) => isVisibleColumn(col));
121101
121132
  item.children.forEach((child) => {
121102
121133
  if (slots2.includes(child.field)) {
121103
121134
  child.slots = {