@gmfe/table-x 2.14.30-beta.3 → 2.14.30-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmfe/table-x",
3
- "version": "2.14.30-beta.3",
3
+ "version": "2.14.30-beta.4",
4
4
  "description": "",
5
5
  "author": "liyatang <liyatang@qq.com>",
6
6
  "homepage": "https://github.com/gmfe/gmfe#readme",
@@ -80,13 +80,16 @@ export function rebuildNestedColumnsFromFlat(flatColumns) {
80
80
  }
81
81
  })
82
82
 
83
- // 特殊列(select、diy、expand)必须放在最后
83
+ // 特殊列(select、diy、expand)的处理
84
84
  // 从 flatColumns 中提取特殊列,保持它们在 flatColumns 中的相对顺序
85
85
  const specialCols = flatColumns.filter(col =>
86
86
  specialColumnIds.includes(col.id)
87
87
  )
88
- // 确保特殊列在最后
89
- nested.push(...specialCols)
90
-
91
- return nested
88
+
89
+ // 分离 fixed: 'left' 的特殊列和其他特殊列
90
+ const leftFixedSpecialCols = specialCols.filter(col => col.fixed === 'left')
91
+ const otherSpecialCols = specialCols.filter(col => col.fixed !== 'left')
92
+
93
+ // 按顺序:fixed: 'left' 的特殊列 -> 普通列 -> 其他特殊列
94
+ return [...leftFixedSpecialCols, ...nested, ...otherSpecialCols]
92
95
  }
@@ -51,11 +51,16 @@ export function transformColumnsForTwoLevel(columns) {
51
51
 
52
52
  // 分离普通列和特殊列
53
53
  const normalColumns = []
54
- const specialColumns = []
54
+ const leftFixedSpecialColumns = [] // fixed: 'left' 的特殊列(如 diy)
55
+ const otherSpecialColumns = [] // 其他特殊列(如 select、expand)
55
56
 
56
57
  columns.forEach(column => {
57
58
  if (specialColumnIds.includes(column.id)) {
58
- specialColumns.push(column)
59
+ if (column.fixed === 'left') {
60
+ leftFixedSpecialColumns.push(column)
61
+ } else {
62
+ otherSpecialColumns.push(column)
63
+ }
59
64
  } else {
60
65
  normalColumns.push(column)
61
66
  }
@@ -125,10 +130,21 @@ export function transformColumnsForTwoLevel(columns) {
125
130
  }
126
131
  })
127
132
 
128
- // 最后处理特殊列(select、diy、expand)放在最后
133
+ // 处理 fixed: 'left' 的特殊列(如 diy),放在最前面
134
+ leftFixedSpecialColumns.forEach(column => {
135
+ transformedColumns.unshift(column)
136
+ firstLevelHeaders.unshift({
137
+ ...column,
138
+ hasSubColumns: false,
139
+ subColumnCount: 1,
140
+ isSpecialColumn: true
141
+ })
142
+ })
143
+
144
+ // 最后处理其他特殊列(select、expand)放在最后
129
145
  // 注意:移除特殊列的 fixed 属性,让它们按数组顺序显示在最后(不固定)
130
146
  // 如果用户需要特殊列固定在右边,可以手动设置 fixed: 'right'
131
- specialColumns.forEach(column => {
147
+ otherSpecialColumns.forEach(column => {
132
148
  const { fixed, ...columnWithoutFixed } = column
133
149
  const adjustedColumn = {
134
150
  ...columnWithoutFixed,