@touchvue/ui 1.0.0-beta.54 → 1.0.0-beta.56

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.
Files changed (111) hide show
  1. package/es/components/input/src/input.vue.d.ts +2 -2
  2. package/es/components/pic/index.d.ts +9 -0
  3. package/es/components/pic/src/Pic.vue.d.ts +9 -0
  4. package/es/components/pic/src/pic.d.ts +7 -0
  5. package/es/components/rate/src/rate.vue.d.ts +46 -10
  6. package/es/components/scroll/index.d.ts +15 -0
  7. package/es/components/scroll/src/Scroll.vue.d.ts +9 -0
  8. package/es/components/scroll/src/scroll.d.ts +7 -0
  9. package/es/components/select/src/select.d.ts +18 -0
  10. package/es/components/select/src/select.vue.d.ts +18 -0
  11. package/es/components/table/src/table-head.vue.d.ts +2 -0
  12. package/es/components/tip/src/tip.vue.d.ts +2 -2
  13. package/es/components/upload/src/upload.vue.d.ts +6 -4
  14. package/es/index.d.mjs.map +1 -1
  15. package/es/index.mjs +2 -1
  16. package/es/index.mjs.map +1 -1
  17. package/es/packages/components/calendar/src/calendar.vue2.mjs +22 -0
  18. package/es/packages/components/calendar/src/calendar.vue2.mjs.map +1 -1
  19. package/es/packages/components/cascader/src/cascader-item.vue2.mjs +1 -0
  20. package/es/packages/components/cascader/src/cascader-item.vue2.mjs.map +1 -1
  21. package/es/packages/components/cascader/src/cascader.vue2.mjs +1 -0
  22. package/es/packages/components/cascader/src/cascader.vue2.mjs.map +1 -1
  23. package/es/packages/components/float/src/Float.vue2.mjs +4 -4
  24. package/es/packages/components/float/src/Float.vue2.mjs.map +1 -1
  25. package/es/packages/components/pic/src/Pic.vue2.mjs +18 -2
  26. package/es/packages/components/pic/src/Pic.vue2.mjs.map +1 -1
  27. package/es/packages/components/pic/src/pic.mjs +7 -0
  28. package/es/packages/components/pic/src/pic.mjs.map +1 -1
  29. package/es/packages/components/rate/src/rate.vue2.mjs +153 -85
  30. package/es/packages/components/rate/src/rate.vue2.mjs.map +1 -1
  31. package/es/packages/components/scroll/src/Scroll.vue2.mjs +3 -0
  32. package/es/packages/components/scroll/src/Scroll.vue2.mjs.map +1 -1
  33. package/es/packages/components/scroll/src/scroll.mjs +7 -0
  34. package/es/packages/components/scroll/src/scroll.mjs.map +1 -1
  35. package/es/packages/components/segment/src/segment.vue.mjs +10 -12
  36. package/es/packages/components/segment/src/segment.vue.mjs.map +1 -1
  37. package/es/packages/components/select/src/select.mjs +18 -0
  38. package/es/packages/components/select/src/select.mjs.map +1 -1
  39. package/es/packages/components/select/src/select.vue2.mjs +263 -87
  40. package/es/packages/components/select/src/select.vue2.mjs.map +1 -1
  41. package/es/packages/components/table/src/table-head.vue2.mjs +101 -45
  42. package/es/packages/components/table/src/table-head.vue2.mjs.map +1 -1
  43. package/es/packages/components/table/src/table.vue2.mjs +244 -62
  44. package/es/packages/components/table/src/table.vue2.mjs.map +1 -1
  45. package/es/packages/components/tree/src/tree-item.vue2.mjs +2 -1
  46. package/es/packages/components/tree/src/tree-item.vue2.mjs.map +1 -1
  47. package/es/packages/components/upload/src/upload.vue2.mjs +203 -153
  48. package/es/packages/components/upload/src/upload.vue2.mjs.map +1 -1
  49. package/es/packages/directives/tip/src/tip.mjs +42 -27
  50. package/es/packages/directives/tip/src/tip.mjs.map +1 -1
  51. package/es/packages/locale/format.mjs +1 -1
  52. package/es/packages/locale/format.mjs.map +1 -1
  53. package/es/ui/index.d.ts +6 -0
  54. package/lib/components/input/src/input.vue.d.ts +2 -2
  55. package/lib/components/pic/index.d.ts +9 -0
  56. package/lib/components/pic/src/Pic.vue.d.ts +9 -0
  57. package/lib/components/pic/src/pic.d.ts +7 -0
  58. package/lib/components/rate/src/rate.vue.d.ts +46 -10
  59. package/lib/components/scroll/index.d.ts +15 -0
  60. package/lib/components/scroll/src/Scroll.vue.d.ts +9 -0
  61. package/lib/components/scroll/src/scroll.d.ts +7 -0
  62. package/lib/components/select/src/select.d.ts +18 -0
  63. package/lib/components/select/src/select.vue.d.ts +18 -0
  64. package/lib/components/table/src/table-head.vue.d.ts +2 -0
  65. package/lib/components/tip/src/tip.vue.d.ts +2 -2
  66. package/lib/components/upload/src/upload.vue.d.ts +6 -4
  67. package/lib/index.d.js.map +1 -1
  68. package/lib/index.js +2 -1
  69. package/lib/index.js.map +1 -1
  70. package/lib/packages/components/calendar/src/calendar.vue2.js +22 -0
  71. package/lib/packages/components/calendar/src/calendar.vue2.js.map +1 -1
  72. package/lib/packages/components/cascader/src/cascader-item.vue2.js +1 -0
  73. package/lib/packages/components/cascader/src/cascader-item.vue2.js.map +1 -1
  74. package/lib/packages/components/cascader/src/cascader.vue2.js +1 -0
  75. package/lib/packages/components/cascader/src/cascader.vue2.js.map +1 -1
  76. package/lib/packages/components/float/src/Float.vue2.js +4 -4
  77. package/lib/packages/components/float/src/Float.vue2.js.map +1 -1
  78. package/lib/packages/components/pic/src/Pic.vue2.js +17 -1
  79. package/lib/packages/components/pic/src/Pic.vue2.js.map +1 -1
  80. package/lib/packages/components/pic/src/pic.js +7 -0
  81. package/lib/packages/components/pic/src/pic.js.map +1 -1
  82. package/lib/packages/components/rate/src/rate.vue2.js +152 -84
  83. package/lib/packages/components/rate/src/rate.vue2.js.map +1 -1
  84. package/lib/packages/components/scroll/src/Scroll.vue2.js +3 -0
  85. package/lib/packages/components/scroll/src/Scroll.vue2.js.map +1 -1
  86. package/lib/packages/components/scroll/src/scroll.js +7 -0
  87. package/lib/packages/components/scroll/src/scroll.js.map +1 -1
  88. package/lib/packages/components/segment/src/segment.vue.js +10 -12
  89. package/lib/packages/components/segment/src/segment.vue.js.map +1 -1
  90. package/lib/packages/components/select/src/select.js +18 -0
  91. package/lib/packages/components/select/src/select.js.map +1 -1
  92. package/lib/packages/components/select/src/select.vue2.js +262 -86
  93. package/lib/packages/components/select/src/select.vue2.js.map +1 -1
  94. package/lib/packages/components/table/src/table-head.vue2.js +100 -44
  95. package/lib/packages/components/table/src/table-head.vue2.js.map +1 -1
  96. package/lib/packages/components/table/src/table.vue2.js +243 -61
  97. package/lib/packages/components/table/src/table.vue2.js.map +1 -1
  98. package/lib/packages/components/tree/src/tree-item.vue2.js +2 -1
  99. package/lib/packages/components/tree/src/tree-item.vue2.js.map +1 -1
  100. package/lib/packages/components/upload/src/upload.vue2.js +202 -152
  101. package/lib/packages/components/upload/src/upload.vue2.js.map +1 -1
  102. package/lib/packages/directives/tip/src/tip.js +41 -26
  103. package/lib/packages/directives/tip/src/tip.js.map +1 -1
  104. package/lib/packages/locale/format.js +1 -1
  105. package/lib/packages/locale/format.js.map +1 -1
  106. package/lib/ui/index.d.ts +6 -0
  107. package/package.json +1 -1
  108. package/theme/base.css +0 -3
  109. package/theme/components/index.css +445 -255
  110. package/theme/index.css +445 -255
  111. package/theme/skin/default.css +445 -255
@@ -54,6 +54,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
54
54
  const rightTop = vue.ref(null);
55
55
  const rightTopTable = vue.ref(null);
56
56
  const rightTopHead = vue.ref(null);
57
+ let resizeObserver = null;
57
58
  const checkedAll = vue.ref(false);
58
59
  const setClass = vue.computed(() => {
59
60
  const classes = [];
@@ -171,10 +172,41 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
171
172
  }
172
173
  }
173
174
  }
175
+ function getLeafThMap(trs) {
176
+ var _a;
177
+ const leafCount = leafColumns.value.length;
178
+ const leafThs = new Array(leafCount).fill(null);
179
+ const leafDepths = new Array(leafCount).fill(-1);
180
+ for (let rowIdx = 0; rowIdx < trs.length; rowIdx++) {
181
+ const cells = (_a = trs[rowIdx]) == null ? void 0 : _a.children;
182
+ if (!cells)
183
+ continue;
184
+ let leafIdx = 0;
185
+ for (let colIdx = 0; colIdx < cells.length; colIdx++) {
186
+ while (leafIdx < leafCount && leafDepths[leafIdx] >= rowIdx) {
187
+ leafIdx++;
188
+ }
189
+ const cell = cells[colIdx];
190
+ const colspan = parseInt(cell.getAttribute("colspan") || "1");
191
+ const rowspan = parseInt(cell.getAttribute("rowspan") || "1");
192
+ const depth = rowIdx + rowspan - 1;
193
+ for (let k = 0; k < colspan; k++) {
194
+ const idx = leafIdx + k;
195
+ if (idx < leafCount && depth > leafDepths[idx]) {
196
+ leafDepths[idx] = depth;
197
+ leafThs[idx] = cell;
198
+ }
199
+ }
200
+ leafIdx += colspan;
201
+ }
202
+ }
203
+ return leafThs;
204
+ }
174
205
  function syncThWidth() {
175
206
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
176
- if (props.columns.length > 0 && bodyHead.value && bodyHead.value.row) {
207
+ if (leafColumns.value.length > 0 && bodyHead.value && bodyHead.value.row) {
177
208
  const trs = bodyHead.value.row.children;
209
+ const leafThMap = getLeafThMap(trs);
178
210
  if (Number(props.fixTop) > 0 && topHead.value && topHead.value.row) {
179
211
  const topTrs = topHead.value.row.children;
180
212
  for (let i = 0; i < topTrs.length; i++) {
@@ -194,15 +226,25 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
194
226
  if (Number(props.fixLeft) > 0 && leftHead.value && leftHead.value.row) {
195
227
  const leftTrs = leftHead.value.row.children;
196
228
  for (let i = 0; i < leftTrs.length; i++) {
197
- const ths = (_c = trs[i]) == null ? void 0 : _c.children;
198
- const leftThs = (_d = leftTrs[i]) == null ? void 0 : _d.children;
199
- if (ths && leftThs && leftThs.length > 0) {
229
+ const leftThs = (_c = leftTrs[i]) == null ? void 0 : _c.children;
230
+ if (leftThs && leftThs.length > 0 && leafThMap) {
231
+ let leafIdx = 0;
200
232
  for (let j = 0; j < leftThs.length; j++) {
201
- const th = ths[j];
202
233
  const leftTh = leftThs[j];
203
- if (th && leftTh) {
204
- leftTh.style.width = th.getBoundingClientRect().width + "px";
205
- leftTh.style.height = th.getBoundingClientRect().height + "px";
234
+ if (leftTh) {
235
+ const colspan = parseInt(leftTh.getAttribute("colspan") || "1");
236
+ let totalWidth = 0;
237
+ for (let k = 0; k < colspan; k++) {
238
+ if (leafThMap[leafIdx + k]) {
239
+ totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
240
+ }
241
+ }
242
+ leftTh.style.width = totalWidth + "px";
243
+ const mainThs = (_d = trs[i]) == null ? void 0 : _d.children;
244
+ if (mainThs && mainThs[leafIdx]) {
245
+ leftTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
246
+ }
247
+ leafIdx += colspan;
206
248
  }
207
249
  }
208
250
  }
@@ -210,15 +252,25 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
210
252
  if (Number(props.fixTop) > 0 && leftTopHead.value && leftTopHead.value.row) {
211
253
  const leftTopTrs = leftTopHead.value.row.children;
212
254
  for (let i = 0; i < leftTopTrs.length; i++) {
213
- const ths = (_e = trs[i]) == null ? void 0 : _e.children;
214
- const leftTopThs = (_f = leftTopTrs[i]) == null ? void 0 : _f.children;
215
- if (ths && leftTopThs && leftTopThs.length > 0) {
255
+ const leftTopThs = (_e = leftTopTrs[i]) == null ? void 0 : _e.children;
256
+ if (leftTopThs && leftTopThs.length > 0 && leafThMap) {
257
+ let leafIdx = 0;
216
258
  for (let j = 0; j < leftTopThs.length; j++) {
217
- const th = ths[j];
218
259
  const leftTopTh = leftTopThs[j];
219
- if (th && leftTopTh) {
220
- leftTopTh.style.width = th.getBoundingClientRect().width + "px";
221
- leftTopTh.style.height = th.getBoundingClientRect().height + "px";
260
+ if (leftTopTh) {
261
+ const colspan = parseInt(leftTopTh.getAttribute("colspan") || "1");
262
+ let totalWidth = 0;
263
+ for (let k = 0; k < colspan; k++) {
264
+ if (leafThMap[leafIdx + k]) {
265
+ totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
266
+ }
267
+ }
268
+ leftTopTh.style.width = totalWidth + "px";
269
+ const mainThs = (_f = trs[i]) == null ? void 0 : _f.children;
270
+ if (mainThs && mainThs[leafIdx]) {
271
+ leftTopTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
272
+ }
273
+ leafIdx += colspan;
222
274
  }
223
275
  }
224
276
  }
@@ -227,16 +279,27 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
227
279
  }
228
280
  if (Number(props.fixRight) > 0 && rightHead.value && rightHead.value.row) {
229
281
  const rightTrs = rightHead.value.row.children;
282
+ const rightLeafStart = leafColumns.value.length - Number(props.fixRight);
230
283
  for (let i = 0; i < rightTrs.length; i++) {
231
- const ths = (_g = trs[i]) == null ? void 0 : _g.children;
232
- const rightThs = (_h = rightTrs[i]) == null ? void 0 : _h.children;
233
- if (ths && rightThs && rightThs.length > 0) {
234
- for (let j = ths.length - rightThs.length; j < ths.length; j++) {
235
- const th = ths[j];
236
- const rightTh = rightThs[j - ths.length + rightThs.length];
237
- if (th && rightTh) {
238
- rightTh.style.width = th.getBoundingClientRect().width + "px";
239
- rightTh.style.height = th.getBoundingClientRect().height + "px";
284
+ const rightThs = (_g = rightTrs[i]) == null ? void 0 : _g.children;
285
+ if (rightThs && rightThs.length > 0 && leafThMap) {
286
+ let leafIdx = rightLeafStart;
287
+ for (let j = 0; j < rightThs.length; j++) {
288
+ const rightTh = rightThs[j];
289
+ if (rightTh) {
290
+ const colspan = parseInt(rightTh.getAttribute("colspan") || "1");
291
+ let totalWidth = 0;
292
+ for (let k = 0; k < colspan; k++) {
293
+ if (leafThMap[leafIdx + k]) {
294
+ totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
295
+ }
296
+ }
297
+ rightTh.style.width = totalWidth + "px";
298
+ const mainThs = (_h = trs[i]) == null ? void 0 : _h.children;
299
+ if (mainThs && mainThs[leafIdx]) {
300
+ rightTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
301
+ }
302
+ leafIdx += colspan;
240
303
  }
241
304
  }
242
305
  }
@@ -244,15 +307,25 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
244
307
  if (Number(props.fixTop) > 0 && rightTopHead.value && rightTopHead.value.row) {
245
308
  const rightTopTrs = rightTopHead.value.row.children;
246
309
  for (let i = 0; i < rightTopTrs.length; i++) {
247
- const ths = (_i = trs[i]) == null ? void 0 : _i.children;
248
- const rightTopThs = (_j = rightTopTrs[i]) == null ? void 0 : _j.children;
249
- if (ths && rightTopThs && rightTopThs.length > 0) {
250
- for (let j = ths.length - rightTopThs.length; j < ths.length; j++) {
251
- const th = ths[j];
252
- const rightTopTh = rightTopThs[j - ths.length + rightTopThs.length];
253
- if (th && rightTopTh) {
254
- rightTopTh.style.width = th.getBoundingClientRect().width + "px";
255
- rightTopTh.style.height = th.getBoundingClientRect().height + "px";
310
+ const rightTopThs = (_i = rightTopTrs[i]) == null ? void 0 : _i.children;
311
+ if (rightTopThs && rightTopThs.length > 0 && leafThMap) {
312
+ let leafIdx = rightLeafStart;
313
+ for (let j = 0; j < rightTopThs.length; j++) {
314
+ const rightTopTh = rightTopThs[j];
315
+ if (rightTopTh) {
316
+ const colspan = parseInt(rightTopTh.getAttribute("colspan") || "1");
317
+ let totalWidth = 0;
318
+ for (let k = 0; k < colspan; k++) {
319
+ if (leafThMap[leafIdx + k]) {
320
+ totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
321
+ }
322
+ }
323
+ rightTopTh.style.width = totalWidth + "px";
324
+ const mainThs = (_j = trs[i]) == null ? void 0 : _j.children;
325
+ if (mainThs && mainThs[leafIdx]) {
326
+ rightTopTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
327
+ }
328
+ leafIdx += colspan;
256
329
  }
257
330
  }
258
331
  }
@@ -262,7 +335,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
262
335
  }
263
336
  }
264
337
  function syncTrHeight() {
265
- var _a;
338
+ var _a, _b, _c, _d, _e, _f, _g;
266
339
  if (!(props.fixRight || props.fixLeft))
267
340
  return;
268
341
  if ((_a = bodyBody.value) == null ? void 0 : _a.$el.children.length) {
@@ -270,9 +343,53 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
270
343
  const tr = bodyBody.value.$el.children[i];
271
344
  if (Number(props.fixRight) > 0 && rightBody.value) {
272
345
  rightBody.value.$el.children[i].style.height = tr.getBoundingClientRect().height + "px";
346
+ const rightTr = rightBody.value.$el.children[i];
347
+ const rightTds = rightTr == null ? void 0 : rightTr.children;
348
+ const rightHeadTrs = (_c = (_b = rightHead.value) == null ? void 0 : _b.row) == null ? void 0 : _c.children;
349
+ const rightThs = (_d = rightHeadTrs == null ? void 0 : rightHeadTrs[rightHeadTrs.length - 1]) == null ? void 0 : _d.children;
350
+ if (rightTds && rightThs) {
351
+ for (let j = 0; j < rightTds.length; j++) {
352
+ if (rightThs[j]) {
353
+ const span = rightTds[j].querySelector("span");
354
+ if (span) {
355
+ const thWidth = parseFloat(rightThs[j].style.width) || 0;
356
+ const tdStyle = window.getComputedStyle(rightTds[j]);
357
+ const tdPaddingLeft = parseFloat(tdStyle.paddingLeft) || 0;
358
+ const tdPaddingRight = parseFloat(tdStyle.paddingRight) || 0;
359
+ const spanMaxWidth = Math.max(0, thWidth - tdPaddingLeft - tdPaddingRight);
360
+ span.style.display = "block";
361
+ span.style.maxWidth = spanMaxWidth + "px";
362
+ span.style.overflow = "hidden";
363
+ span.style.textOverflow = "ellipsis";
364
+ }
365
+ }
366
+ }
367
+ }
273
368
  }
274
369
  if (Number(props.fixLeft) > 0 && leftBody.value) {
275
370
  leftBody.value.$el.children[i].style.height = tr.getBoundingClientRect().height + "px";
371
+ const leftTr = leftBody.value.$el.children[i];
372
+ const leftTds = leftTr == null ? void 0 : leftTr.children;
373
+ const leftHeadTrs = (_f = (_e = leftHead.value) == null ? void 0 : _e.row) == null ? void 0 : _f.children;
374
+ const leftThs = (_g = leftHeadTrs == null ? void 0 : leftHeadTrs[leftHeadTrs.length - 1]) == null ? void 0 : _g.children;
375
+ if (leftTds && leftThs) {
376
+ for (let j = 0; j < leftTds.length; j++) {
377
+ if (leftThs[j]) {
378
+ const span = leftTds[j].querySelector("span");
379
+ if (span) {
380
+ const thWidth = parseFloat(leftThs[j].style.width) || 0;
381
+ const tdStyle = window.getComputedStyle(leftTds[j]);
382
+ const tdPaddingLeft = parseFloat(tdStyle.paddingLeft) || 0;
383
+ const tdPaddingRight = parseFloat(tdStyle.paddingRight) || 0;
384
+ const spanMaxWidth = Math.max(0, thWidth - tdPaddingLeft - tdPaddingRight);
385
+ span.style.display = "block";
386
+ span.style.maxWidth = spanMaxWidth + "px";
387
+ span.style.overflow = "hidden";
388
+ span.style.textOverflow = "ellipsis";
389
+ }
390
+ }
391
+ }
392
+ }
276
393
  }
277
394
  }
278
395
  }
@@ -294,6 +411,19 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
294
411
  }
295
412
  vue.onMounted(() => {
296
413
  adjust();
414
+ window.addEventListener("resize", setFix);
415
+ if ($el.value) {
416
+ resizeObserver = new ResizeObserver(() => {
417
+ setFix();
418
+ });
419
+ resizeObserver.observe($el.value);
420
+ }
421
+ });
422
+ vue.onBeforeUnmount(() => {
423
+ window.removeEventListener("resize", setFix);
424
+ if (resizeObserver) {
425
+ resizeObserver.disconnect();
426
+ }
297
427
  });
298
428
  const hasRadio = vue.computed(() => {
299
429
  let flag = false;
@@ -332,6 +462,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
332
462
  checkedAll.value = isAll;
333
463
  }
334
464
  function checkedAllChange(isAll) {
465
+ checkedAll.value = isAll;
335
466
  if (isAll) {
336
467
  let ids = props.data.map((item) => item[props.valueKeys]);
337
468
  emit("update:modelValue", ids);
@@ -348,22 +479,68 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
348
479
  rightBody.value.checkAll(isAll);
349
480
  }
350
481
  }
351
- const flattenColumns = vue.computed(() => {
352
- let arr = [];
353
- function setArr(data) {
354
- data.map((column) => {
355
- let tempColumn = JSON.parse(JSON.stringify(column));
356
- if (tempColumn.children) {
357
- delete tempColumn.children;
358
- }
359
- arr.push(tempColumn);
360
- if (column.children) {
361
- setArr(column.children);
482
+ function getLeafColumns(columns) {
483
+ const result = [];
484
+ for (const col of columns) {
485
+ if (col.children && col.children.length > 0) {
486
+ result.push(...getLeafColumns(col.children));
487
+ } else {
488
+ result.push(col);
489
+ }
490
+ }
491
+ return result;
492
+ }
493
+ function countColumnLeaves(col) {
494
+ if (!col.children || col.children.length === 0)
495
+ return 1;
496
+ return col.children.reduce((sum, child) => sum + countColumnLeaves(child), 0);
497
+ }
498
+ function pruneColumnTree(columns, start, count) {
499
+ const leaves = getLeafColumns(columns);
500
+ const targetLeaves = leaves.slice(start, start + count);
501
+ const targetProps = new Set(targetLeaves.map((l) => l.prop));
502
+ function prune(cols) {
503
+ const result = [];
504
+ for (const col of cols) {
505
+ if (col.children && col.children.length > 0) {
506
+ const prunedChildren = prune(col.children);
507
+ if (prunedChildren.length > 0) {
508
+ result.push({ ...col, children: prunedChildren });
509
+ }
510
+ } else if (targetProps.has(col.prop)) {
511
+ result.push({ ...col });
362
512
  }
363
- });
513
+ }
514
+ return result;
364
515
  }
365
- setArr(props.columns);
366
- return arr;
516
+ return prune(columns);
517
+ }
518
+ const leafColumns = vue.computed(() => getLeafColumns(props.columns));
519
+ const leftColumns = vue.computed(() => {
520
+ const topCount = Number(props.fixLeft);
521
+ if (topCount <= 0)
522
+ return [];
523
+ let leafCount = 0;
524
+ for (let i = 0; i < topCount && i < props.columns.length; i++) {
525
+ leafCount += countColumnLeaves(props.columns[i]);
526
+ }
527
+ return pruneColumnTree(props.columns, 0, leafCount);
528
+ });
529
+ const leftLeafColumns = vue.computed(() => getLeafColumns(leftColumns.value));
530
+ const rightColumns = vue.computed(() => {
531
+ const topCount = Number(props.fixRight);
532
+ if (topCount <= 0)
533
+ return [];
534
+ let leafCount = 0;
535
+ for (let i = props.columns.length - topCount; i < props.columns.length; i++) {
536
+ leafCount += countColumnLeaves(props.columns[i]);
537
+ }
538
+ const totalLeaves = leafColumns.value.length;
539
+ return pruneColumnTree(props.columns, totalLeaves - leafCount, leafCount);
540
+ });
541
+ const rightLeafColumns = vue.computed(() => getLeafColumns(rightColumns.value));
542
+ const flattenColumns = vue.computed(() => {
543
+ return leafColumns.value;
367
544
  });
368
545
  function getColWidth(column) {
369
546
  if (column.width) {
@@ -416,7 +593,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
416
593
  (vue.openBlock(true), vue.createElementBlock(
417
594
  vue.Fragment,
418
595
  null,
419
- vue.renderList(_ctx.columns, (item, index) => {
596
+ vue.renderList(leafColumns.value, (item, index) => {
420
597
  return vue.openBlock(), vue.createElementBlock(
421
598
  "col",
422
599
  {
@@ -447,7 +624,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
447
624
  type: hasRadio.value ? "radio" : hasCheck.value ? "check" : "",
448
625
  data: _ctx.data,
449
626
  "checked-all": checkedAll.value,
450
- "column-data": _ctx.columns,
627
+ "column-data": leafColumns.value,
451
628
  onChange: change
452
629
  }, vue.createSlots({
453
630
  detail: vue.withCtx((slotProps) => [
@@ -503,10 +680,11 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
503
680
  vue.createVNode(tableHead.default, {
504
681
  ref_key: "topHead",
505
682
  ref: topHead,
683
+ "checked-all": checkedAll.value,
506
684
  data: _ctx.columns,
507
685
  onChange: checkedAllChange,
508
686
  onSort: sortChange
509
- }, null, 8, ["data"])
687
+ }, null, 8, ["checked-all", "data"])
510
688
  ],
511
689
  512
512
690
  /* NEED_PATCH */
@@ -535,15 +713,16 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
535
713
  vue.createVNode(tableHead.default, {
536
714
  ref_key: "leftHead",
537
715
  ref: leftHead,
538
- data: _ctx.columns.slice(0, Number(props.fixLeft)),
716
+ "checked-all": checkedAll.value,
717
+ data: leftColumns.value,
539
718
  onChange: checkedAllChange,
540
719
  onSort: sortChange
541
- }, null, 8, ["data"]),
720
+ }, null, 8, ["checked-all", "data"]),
542
721
  vue.createVNode(tableBody.default, {
543
722
  ref_key: "leftBody",
544
723
  ref: leftBody,
545
724
  data: _ctx.data,
546
- "column-data": _ctx.columns.slice(0, Number(props.fixLeft)),
725
+ "column-data": leftLeafColumns.value,
547
726
  onChange: change
548
727
  }, vue.createSlots({
549
728
  detail: vue.withCtx((slotProps) => [
@@ -589,10 +768,11 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
589
768
  vue.createVNode(tableHead.default, {
590
769
  ref_key: "leftTopHead",
591
770
  ref: leftTopHead,
592
- data: _ctx.columns.slice(0, Number(props.fixLeft)),
771
+ "checked-all": checkedAll.value,
772
+ data: leftColumns.value,
593
773
  onChange: checkedAllChange,
594
774
  onSort: sortChange
595
- }, null, 8, ["data"])
775
+ }, null, 8, ["checked-all", "data"])
596
776
  ],
597
777
  512
598
778
  /* NEED_PATCH */
@@ -621,15 +801,16 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
621
801
  vue.createVNode(tableHead.default, {
622
802
  ref_key: "rightHead",
623
803
  ref: rightHead,
624
- data: _ctx.columns.slice(_ctx.columns.length - Number(props.fixRight), _ctx.columns.length),
804
+ "checked-all": checkedAll.value,
805
+ data: rightColumns.value,
625
806
  onChange: checkedAllChange,
626
807
  onSort: sortChange
627
- }, null, 8, ["data"]),
808
+ }, null, 8, ["checked-all", "data"]),
628
809
  vue.createVNode(tableBody.default, {
629
810
  ref_key: "rightBody",
630
811
  ref: rightBody,
631
812
  data: _ctx.data,
632
- "column-data": _ctx.columns.slice(_ctx.columns.length - Number(_ctx.fixRight), _ctx.columns.length),
813
+ "column-data": rightLeafColumns.value,
633
814
  onChange: change
634
815
  }, vue.createSlots({
635
816
  detail: vue.withCtx((slotProps) => [
@@ -675,10 +856,11 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
675
856
  vue.createVNode(tableHead.default, {
676
857
  ref_key: "rightTopHead",
677
858
  ref: rightTopHead,
678
- data: _ctx.columns.slice(_ctx.columns.length - Number(props.fixRight), _ctx.columns.length),
859
+ "checked-all": checkedAll.value,
860
+ data: rightColumns.value,
679
861
  onChange: checkedAllChange,
680
862
  onSort: sortChange
681
- }, null, 8, ["data"])
863
+ }, null, 8, ["checked-all", "data"])
682
864
  ],
683
865
  512
684
866
  /* NEED_PATCH */