@touchvue/ui 1.0.0-beta.59 → 1.0.0-beta.60

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.
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, ref, computed, resolveComponent, resolveDirective, withDirectives, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, createBlock, createCommentVNode, createTextVNode, toDisplayString, renderSlot } from 'vue';
2
- import { getModeClasses } from '../../../hooks/useSetClass.mjs';
3
2
  import { commitTouchReport } from '../../../utils/ratio.mjs';
3
+ import { getModeClasses } from '../../../hooks/useSetClass.mjs';
4
4
 
5
5
  const __default__ = defineComponent({
6
6
  name: "ToButton"
@@ -8,7 +8,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
8
8
  props: {
9
9
  width: { default: "" },
10
10
  flex: { type: Boolean, default: false },
11
- align: { default: "center" }
11
+ align: { default: "" }
12
12
  },
13
13
  setup(__props) {
14
14
  const props = __props;
@@ -1 +1 @@
1
- {"version":3,"file":"grid-item.vue2.mjs","sources":["../../../../../../packages/components/grid/src/grid-item.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as DO_defineComponent } from 'vue';\nexport default /*#__PURE__*/ DO_defineComponent({\n\tname: 'ToGridItem'\n});\n</script>\n<template>\n\t<div :flex=\"flex ? flex : null\" class=\"to-grid-item\" :class=\"setClass\" :style=\"setStyle\">\n\t\t<slot></slot>\n\t</div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\n\n\n\nexport interface Props {\n\twidth?: number | string\n\tflex?: boolean\n\talign?: string\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n\twidth: '',\n\tflex: false,\n\talign: 'center'\n})\n\nconst setClass = computed(() => {\n\tconst arr: string[] = []\n\tif (props.align) arr.push(`align-${props.align}`)\n\treturn arr\n})\n\nconst setStyle = computed(() => {\n\tconst style: Record<string, string> = {}\n\n\tif (props.width) {\n\t\tif (!isNaN(Number(props.width))) {\n\t\t\tstyle.width = `${props.width}em`\n\t\t} else if (props.width === 'full') {\n\t\t\tstyle.width = '100%'\n\t\t} else {\n\t\t\tstyle.width = props.width.toString()\n\t\t}\n\t}\n\n\treturn style\n})\n</script>\n"],"names":["DO_defineComponent","_createElementBlock","flex","_normalizeClass","_renderSlot"],"mappings":";;AAEA,MAAA,cAA6BA,eAAmB,CAAA;AAAA,EAC/C,IAAM,EAAA,YAAA;AACP,CAAC,CAAA,CAAA;;;;;;;;;AAmBD,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAMd,IAAM,MAAA,QAAA,GAAW,SAAS,MAAM;AAC/B,MAAA,MAAM,MAAgB,EAAC,CAAA;AACvB,MAAA,IAAI,KAAM,CAAA,KAAA;AAAO,QAAI,GAAA,CAAA,IAAA,CAAK,CAAS,MAAA,EAAA,KAAA,CAAM,KAAO,CAAA,CAAA,CAAA,CAAA;AAChD,MAAO,OAAA,GAAA,CAAA;AAAA,KACP,CAAA,CAAA;AAED,IAAM,MAAA,QAAA,GAAW,SAAS,MAAM;AAC/B,MAAA,MAAM,QAAgC,EAAC,CAAA;AAEvC,MAAA,IAAI,MAAM,KAAO,EAAA;AAChB,QAAA,IAAI,CAAC,KAAM,CAAA,MAAA,CAAO,KAAM,CAAA,KAAK,CAAC,CAAG,EAAA;AAChC,UAAM,KAAA,CAAA,KAAA,GAAQ,GAAG,KAAM,CAAA,KAAA,CAAA,EAAA,CAAA,CAAA;AAAA,SACxB,MAAA,IAAW,KAAM,CAAA,KAAA,KAAU,MAAQ,EAAA;AAClC,UAAA,KAAA,CAAM,KAAQ,GAAA,MAAA,CAAA;AAAA,SACR,MAAA;AACN,UAAM,KAAA,CAAA,KAAA,GAAQ,KAAM,CAAA,KAAA,CAAM,QAAS,EAAA,CAAA;AAAA,SACpC;AAAA,OACD;AAEA,MAAO,OAAA,KAAA,CAAA;AAAA,KACP,CAAA,CAAA;;wBA1CA,EAAAC,kBAAA,CAEM,KAAA,EAAA;AAAA,QAFA,IAAMC,EAAAA,IAAAA,CAAI,IAAGA,GAAAA,IAAAA,CAAI,IAAA,GAAA,IAAA;AAAA,QAAS,OAAKC,cAAA,CAAA,CAAC,cAAuB,EAAA,QAAA,CAAQ,KAAA,CAAA,CAAA;AAAA,QAAG,KAAA,gBAAO,CAAA,QAAA,CAAQ,KAAA,CAAA;AAAA;QACtFC,UAAA,CAAa,IAAA,CAAA,MAAA,EAAA,SAAA,CAAA;AAAA;;;;;;;"}
1
+ {"version":3,"file":"grid-item.vue2.mjs","sources":["../../../../../../packages/components/grid/src/grid-item.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as DO_defineComponent } from 'vue';\nexport default /*#__PURE__*/ DO_defineComponent({\n\tname: 'ToGridItem'\n});\n</script>\n<template>\n\t<div :flex=\"flex ? flex : null\" class=\"to-grid-item\" :class=\"setClass\" :style=\"setStyle\">\n\t\t<slot></slot>\n\t</div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\n\n\n\nexport interface Props {\n\twidth?: number | string\n\tflex?: boolean\n\talign?: string\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n\twidth: '',\n\tflex: false,\n\talign: ''\n})\n\nconst setClass = computed(() => {\n\tconst arr: string[] = []\n\tif (props.align) arr.push(`align-${props.align}`)\n\treturn arr\n})\n\nconst setStyle = computed(() => {\n\tconst style: Record<string, string> = {}\n\n\tif (props.width) {\n\t\tif (!isNaN(Number(props.width))) {\n\t\t\tstyle.width = `${props.width}em`\n\t\t} else if (props.width === 'full') {\n\t\t\tstyle.width = '100%'\n\t\t} else {\n\t\t\tstyle.width = props.width.toString()\n\t\t}\n\t}\n\n\treturn style\n})\n</script>\n"],"names":["DO_defineComponent","_createElementBlock","flex","_normalizeClass","_renderSlot"],"mappings":";;AAEA,MAAA,cAA6BA,eAAmB,CAAA;AAAA,EAC/C,IAAM,EAAA,YAAA;AACP,CAAC,CAAA,CAAA;;;;;;;;;AAmBD,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAMd,IAAM,MAAA,QAAA,GAAW,SAAS,MAAM;AAC/B,MAAA,MAAM,MAAgB,EAAC,CAAA;AACvB,MAAA,IAAI,KAAM,CAAA,KAAA;AAAO,QAAI,GAAA,CAAA,IAAA,CAAK,CAAS,MAAA,EAAA,KAAA,CAAM,KAAO,CAAA,CAAA,CAAA,CAAA;AAChD,MAAO,OAAA,GAAA,CAAA;AAAA,KACP,CAAA,CAAA;AAED,IAAM,MAAA,QAAA,GAAW,SAAS,MAAM;AAC/B,MAAA,MAAM,QAAgC,EAAC,CAAA;AAEvC,MAAA,IAAI,MAAM,KAAO,EAAA;AAChB,QAAA,IAAI,CAAC,KAAM,CAAA,MAAA,CAAO,KAAM,CAAA,KAAK,CAAC,CAAG,EAAA;AAChC,UAAM,KAAA,CAAA,KAAA,GAAQ,GAAG,KAAM,CAAA,KAAA,CAAA,EAAA,CAAA,CAAA;AAAA,SACxB,MAAA,IAAW,KAAM,CAAA,KAAA,KAAU,MAAQ,EAAA;AAClC,UAAA,KAAA,CAAM,KAAQ,GAAA,MAAA,CAAA;AAAA,SACR,MAAA;AACN,UAAM,KAAA,CAAA,KAAA,GAAQ,KAAM,CAAA,KAAA,CAAM,QAAS,EAAA,CAAA;AAAA,SACpC;AAAA,OACD;AAEA,MAAO,OAAA,KAAA,CAAA;AAAA,KACP,CAAA,CAAA;;wBA1CA,EAAAC,kBAAA,CAEM,KAAA,EAAA;AAAA,QAFA,IAAMC,EAAAA,IAAAA,CAAI,IAAGA,GAAAA,IAAAA,CAAI,IAAA,GAAA,IAAA;AAAA,QAAS,OAAKC,cAAA,CAAA,CAAC,cAAuB,EAAA,QAAA,CAAQ,KAAA,CAAA,CAAA;AAAA,QAAG,KAAA,gBAAO,CAAA,QAAA,CAAQ,KAAA,CAAA;AAAA;QACtFC,UAAA,CAAa,IAAA,CAAA,MAAA,EAAA,SAAA,CAAA;AAAA;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, computed, watch, nextTick, onMounted, onBeforeUnmount, provide, openBlock, createElementBlock, unref, normalizeClass, normalizeStyle, createElementVNode, Fragment, renderList, createVNode, createSlots, withCtx, renderSlot, normalizeProps, guardReactiveProps, toDisplayString, createCommentVNode } from 'vue';
1
+ import { defineComponent, ref, computed, watch, nextTick, onMounted, provide, openBlock, createElementBlock, unref, normalizeClass, normalizeStyle, createElementVNode, Fragment, renderList, createVNode, createSlots, withCtx, renderSlot, normalizeProps, guardReactiveProps, toDisplayString, createCommentVNode } from 'vue';
2
2
  import TableHead from './table-head.vue.mjs';
3
3
  import TableBody from './table-body.vue.mjs';
4
4
  import { langKey, t } from '../../../locale/index.mjs';
@@ -51,7 +51,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
51
51
  const rightTop = ref(null);
52
52
  const rightTopTable = ref(null);
53
53
  const rightTopHead = ref(null);
54
- let resizeObserver = null;
55
54
  const checkedAll = ref(false);
56
55
  const setClass = computed(() => {
57
56
  const classes = [];
@@ -141,10 +140,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
141
140
  function hasVScroll() {
142
141
  return bodyTable.value.offsetHeight > $el.value.offsetHeight;
143
142
  }
144
- function hasHScroll() {
145
- return bodyTable.value.offsetWidth > $el.value.offsetWidth;
146
- }
147
143
  function setFixDiv() {
144
+ const fixedHeight = props.height && $el.value ? $el.value.offsetHeight - getBarWidth() + "px" : "";
148
145
  if (Number(props.fixTop) > 0 && top.value && topTable.value) {
149
146
  if (hasVScroll()) {
150
147
  top.value.style.width = body.value.offsetWidth - getBarWidth() + "px";
@@ -153,14 +150,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
153
150
  bodyTable.value.style.width = bodyTable.value.offsetWidth + "px";
154
151
  }
155
152
  if (Number(props.fixLeft) > 0 && left.value && $el.value) {
156
- if (hasHScroll()) {
157
- left.value.style.height = $el.value.offsetHeight - getBarWidth() + "px";
158
- }
153
+ if (fixedHeight)
154
+ left.value.style.height = fixedHeight;
159
155
  }
160
156
  if (Number(props.fixRight) > 0 && right.value && $el.value) {
161
- if (hasHScroll()) {
162
- right.value.style.height = $el.value.offsetHeight - getBarWidth() + "px";
163
- }
157
+ if (fixedHeight)
158
+ right.value.style.height = fixedHeight;
164
159
  if (hasVScroll()) {
165
160
  right.value.style.right = getBarWidth() + "px";
166
161
  if (Number(props.fixTop) > 0) {
@@ -169,170 +164,76 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
169
164
  }
170
165
  }
171
166
  }
172
- function getLeafThMap(trs) {
167
+ function syncThWidth() {
173
168
  var _a;
174
- const leafCount = leafColumns.value.length;
175
- const leafThs = new Array(leafCount).fill(null);
176
- const leafDepths = new Array(leafCount).fill(-1);
177
- for (let rowIdx = 0; rowIdx < trs.length; rowIdx++) {
178
- const cells = (_a = trs[rowIdx]) == null ? void 0 : _a.children;
179
- if (!cells)
180
- continue;
181
- let leafIdx = 0;
182
- for (let colIdx = 0; colIdx < cells.length; colIdx++) {
183
- while (leafIdx < leafCount && leafDepths[leafIdx] >= rowIdx) {
184
- leafIdx++;
185
- }
186
- const cell = cells[colIdx];
187
- const colspan = parseInt(cell.getAttribute("colspan") || "1");
188
- const rowspan = parseInt(cell.getAttribute("rowspan") || "1");
189
- const depth = rowIdx + rowspan - 1;
190
- for (let k = 0; k < colspan; k++) {
191
- const idx = leafIdx + k;
192
- if (idx < leafCount && depth > leafDepths[idx]) {
193
- leafDepths[idx] = depth;
194
- leafThs[idx] = cell;
195
- }
196
- }
197
- leafIdx += colspan;
198
- }
169
+ if (!leafColumns.value.length || !((_a = bodyHead.value) == null ? void 0 : _a.row))
170
+ return;
171
+ const sourceGrid = getHeaderGrid(bodyHead.value.row);
172
+ const leafRow = sourceGrid[sourceGrid.length - 1];
173
+ const rightLeafStart = leafColumns.value.length - Number(props.fixRight);
174
+ if (Number(props.fixTop) > 0)
175
+ syncHeaderSize(topHead.value, sourceGrid, leafRow, 0);
176
+ if (Number(props.fixLeft) > 0) {
177
+ syncHeaderSize(leftHead.value, sourceGrid, leafRow, 0);
178
+ if (Number(props.fixTop) > 0)
179
+ syncHeaderSize(leftTopHead.value, sourceGrid, leafRow, 0);
180
+ }
181
+ if (Number(props.fixRight) > 0) {
182
+ syncHeaderSize(rightHead.value, sourceGrid, leafRow, rightLeafStart);
183
+ if (Number(props.fixTop) > 0)
184
+ syncHeaderSize(rightTopHead.value, sourceGrid, leafRow, rightLeafStart);
199
185
  }
200
- return leafThs;
201
186
  }
202
- function syncThWidth() {
203
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
204
- if (leafColumns.value.length > 0 && bodyHead.value && bodyHead.value.row) {
205
- const trs = bodyHead.value.row.children;
206
- const leafThMap = getLeafThMap(trs);
207
- if (Number(props.fixTop) > 0 && topHead.value && topHead.value.row) {
208
- const topTrs = topHead.value.row.children;
209
- for (let i = 0; i < topTrs.length; i++) {
210
- const ths = (_a = trs[i]) == null ? void 0 : _a.children;
211
- const topThs = (_b = topTrs[i]) == null ? void 0 : _b.children;
212
- if (ths && topThs) {
213
- for (let j = 0; j < ths.length; j++) {
214
- const th = ths[j];
215
- const topTh = topThs[j];
216
- if (th && topTh) {
217
- topTh.style.width = th.getBoundingClientRect().width + "px";
218
- }
219
- }
220
- }
221
- }
222
- }
223
- if (Number(props.fixLeft) > 0 && leftHead.value && leftHead.value.row) {
224
- const leftTrs = leftHead.value.row.children;
225
- for (let i = 0; i < leftTrs.length; i++) {
226
- const leftThs = (_c = leftTrs[i]) == null ? void 0 : _c.children;
227
- if (leftThs && leftThs.length > 0 && leafThMap) {
228
- let leafIdx = 0;
229
- for (let j = 0; j < leftThs.length; j++) {
230
- const leftTh = leftThs[j];
231
- if (leftTh) {
232
- const colspan = parseInt(leftTh.getAttribute("colspan") || "1");
233
- let totalWidth = 0;
234
- for (let k = 0; k < colspan; k++) {
235
- if (leafThMap[leafIdx + k]) {
236
- totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
237
- }
238
- }
239
- leftTh.style.width = totalWidth + "px";
240
- const mainThs = (_d = trs[i]) == null ? void 0 : _d.children;
241
- if (mainThs && mainThs[leafIdx]) {
242
- leftTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
243
- }
244
- leafIdx += colspan;
245
- }
246
- }
247
- }
248
- }
249
- if (Number(props.fixTop) > 0 && leftTopHead.value && leftTopHead.value.row) {
250
- const leftTopTrs = leftTopHead.value.row.children;
251
- for (let i = 0; i < leftTopTrs.length; i++) {
252
- const leftTopThs = (_e = leftTopTrs[i]) == null ? void 0 : _e.children;
253
- if (leftTopThs && leftTopThs.length > 0 && leafThMap) {
254
- let leafIdx = 0;
255
- for (let j = 0; j < leftTopThs.length; j++) {
256
- const leftTopTh = leftTopThs[j];
257
- if (leftTopTh) {
258
- const colspan = parseInt(leftTopTh.getAttribute("colspan") || "1");
259
- let totalWidth = 0;
260
- for (let k = 0; k < colspan; k++) {
261
- if (leafThMap[leafIdx + k]) {
262
- totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
263
- }
264
- }
265
- leftTopTh.style.width = totalWidth + "px";
266
- const mainThs = (_f = trs[i]) == null ? void 0 : _f.children;
267
- if (mainThs && mainThs[leafIdx]) {
268
- leftTopTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
269
- }
270
- leafIdx += colspan;
271
- }
272
- }
273
- }
187
+ function getHeaderGrid(head) {
188
+ const grid = [];
189
+ const rows = Array.from(head.rows);
190
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
191
+ if (!grid[rowIndex])
192
+ grid[rowIndex] = [];
193
+ let leafIndex = 0;
194
+ for (const th of Array.from(rows[rowIndex].cells)) {
195
+ while (grid[rowIndex][leafIndex])
196
+ leafIndex++;
197
+ const colspan = th.colSpan || 1;
198
+ const rowspan = th.rowSpan || 1;
199
+ for (let rowOffset = 0; rowOffset < rowspan; rowOffset++) {
200
+ if (!grid[rowIndex + rowOffset])
201
+ grid[rowIndex + rowOffset] = [];
202
+ for (let columnOffset = 0; columnOffset < colspan; columnOffset++) {
203
+ grid[rowIndex + rowOffset][leafIndex + columnOffset] = th;
274
204
  }
275
205
  }
206
+ leafIndex += colspan;
276
207
  }
277
- if (Number(props.fixRight) > 0 && rightHead.value && rightHead.value.row) {
278
- const rightTrs = rightHead.value.row.children;
279
- const rightLeafStart = leafColumns.value.length - Number(props.fixRight);
280
- for (let i = 0; i < rightTrs.length; i++) {
281
- const rightThs = (_g = rightTrs[i]) == null ? void 0 : _g.children;
282
- if (rightThs && rightThs.length > 0 && leafThMap) {
283
- let leafIdx = rightLeafStart;
284
- for (let j = 0; j < rightThs.length; j++) {
285
- const rightTh = rightThs[j];
286
- if (rightTh) {
287
- const colspan = parseInt(rightTh.getAttribute("colspan") || "1");
288
- let totalWidth = 0;
289
- for (let k = 0; k < colspan; k++) {
290
- if (leafThMap[leafIdx + k]) {
291
- totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
292
- }
293
- }
294
- rightTh.style.width = totalWidth + "px";
295
- const mainThs = (_h = trs[i]) == null ? void 0 : _h.children;
296
- if (mainThs && mainThs[leafIdx]) {
297
- rightTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
298
- }
299
- leafIdx += colspan;
300
- }
301
- }
302
- }
303
- }
304
- if (Number(props.fixTop) > 0 && rightTopHead.value && rightTopHead.value.row) {
305
- const rightTopTrs = rightTopHead.value.row.children;
306
- for (let i = 0; i < rightTopTrs.length; i++) {
307
- const rightTopThs = (_i = rightTopTrs[i]) == null ? void 0 : _i.children;
308
- if (rightTopThs && rightTopThs.length > 0 && leafThMap) {
309
- let leafIdx = rightLeafStart;
310
- for (let j = 0; j < rightTopThs.length; j++) {
311
- const rightTopTh = rightTopThs[j];
312
- if (rightTopTh) {
313
- const colspan = parseInt(rightTopTh.getAttribute("colspan") || "1");
314
- let totalWidth = 0;
315
- for (let k = 0; k < colspan; k++) {
316
- if (leafThMap[leafIdx + k]) {
317
- totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
318
- }
319
- }
320
- rightTopTh.style.width = totalWidth + "px";
321
- const mainThs = (_j = trs[i]) == null ? void 0 : _j.children;
322
- if (mainThs && mainThs[leafIdx]) {
323
- rightTopTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
324
- }
325
- leafIdx += colspan;
326
- }
327
- }
328
- }
329
- }
208
+ }
209
+ return grid;
210
+ }
211
+ function syncHeaderSize(head, sourceGrid, leafRow, leafStart) {
212
+ var _a, _b;
213
+ if (!(head == null ? void 0 : head.row))
214
+ return;
215
+ const targetGrid = getHeaderGrid(head.row);
216
+ const syncedCells = /* @__PURE__ */ new Set();
217
+ for (let rowIndex = 0; rowIndex < targetGrid.length; rowIndex++) {
218
+ for (let leafIndex = 0; leafIndex < targetGrid[rowIndex].length; leafIndex++) {
219
+ const targetTh = targetGrid[rowIndex][leafIndex];
220
+ if (!targetTh || syncedCells.has(targetTh))
221
+ continue;
222
+ syncedCells.add(targetTh);
223
+ const sourceTh = (_a = sourceGrid[rowIndex]) == null ? void 0 : _a[leafStart + leafIndex];
224
+ if (!sourceTh)
225
+ continue;
226
+ let width = 0;
227
+ for (let offset = 0; offset < targetTh.colSpan; offset++) {
228
+ width += ((_b = leafRow == null ? void 0 : leafRow[leafStart + leafIndex + offset]) == null ? void 0 : _b.getBoundingClientRect().width) || 0;
330
229
  }
230
+ targetTh.style.width = width + "px";
231
+ targetTh.style.height = sourceTh.getBoundingClientRect().height + "px";
331
232
  }
332
233
  }
333
234
  }
334
235
  function syncTrHeight() {
335
- var _a, _b, _c, _d, _e, _f, _g;
236
+ var _a;
336
237
  if (!(props.fixRight || props.fixLeft))
337
238
  return;
338
239
  if ((_a = bodyBody.value) == null ? void 0 : _a.$el.children.length) {
@@ -340,53 +241,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
340
241
  const tr = bodyBody.value.$el.children[i];
341
242
  if (Number(props.fixRight) > 0 && rightBody.value) {
342
243
  rightBody.value.$el.children[i].style.height = tr.getBoundingClientRect().height + "px";
343
- const rightTr = rightBody.value.$el.children[i];
344
- const rightTds = rightTr == null ? void 0 : rightTr.children;
345
- const rightHeadTrs = (_c = (_b = rightHead.value) == null ? void 0 : _b.row) == null ? void 0 : _c.children;
346
- const rightThs = (_d = rightHeadTrs == null ? void 0 : rightHeadTrs[rightHeadTrs.length - 1]) == null ? void 0 : _d.children;
347
- if (rightTds && rightThs) {
348
- for (let j = 0; j < rightTds.length; j++) {
349
- if (rightThs[j]) {
350
- const span = rightTds[j].querySelector("span");
351
- if (span) {
352
- const thWidth = parseFloat(rightThs[j].style.width) || 0;
353
- const tdStyle = window.getComputedStyle(rightTds[j]);
354
- const tdPaddingLeft = parseFloat(tdStyle.paddingLeft) || 0;
355
- const tdPaddingRight = parseFloat(tdStyle.paddingRight) || 0;
356
- const spanMaxWidth = Math.max(0, thWidth - tdPaddingLeft - tdPaddingRight);
357
- span.style.display = "block";
358
- span.style.maxWidth = spanMaxWidth + "px";
359
- span.style.overflow = "hidden";
360
- span.style.textOverflow = "ellipsis";
361
- }
362
- }
363
- }
364
- }
365
244
  }
366
245
  if (Number(props.fixLeft) > 0 && leftBody.value) {
367
246
  leftBody.value.$el.children[i].style.height = tr.getBoundingClientRect().height + "px";
368
- const leftTr = leftBody.value.$el.children[i];
369
- const leftTds = leftTr == null ? void 0 : leftTr.children;
370
- const leftHeadTrs = (_f = (_e = leftHead.value) == null ? void 0 : _e.row) == null ? void 0 : _f.children;
371
- const leftThs = (_g = leftHeadTrs == null ? void 0 : leftHeadTrs[leftHeadTrs.length - 1]) == null ? void 0 : _g.children;
372
- if (leftTds && leftThs) {
373
- for (let j = 0; j < leftTds.length; j++) {
374
- if (leftThs[j]) {
375
- const span = leftTds[j].querySelector("span");
376
- if (span) {
377
- const thWidth = parseFloat(leftThs[j].style.width) || 0;
378
- const tdStyle = window.getComputedStyle(leftTds[j]);
379
- const tdPaddingLeft = parseFloat(tdStyle.paddingLeft) || 0;
380
- const tdPaddingRight = parseFloat(tdStyle.paddingRight) || 0;
381
- const spanMaxWidth = Math.max(0, thWidth - tdPaddingLeft - tdPaddingRight);
382
- span.style.display = "block";
383
- span.style.maxWidth = spanMaxWidth + "px";
384
- span.style.overflow = "hidden";
385
- span.style.textOverflow = "ellipsis";
386
- }
387
- }
388
- }
389
- }
390
247
  }
391
248
  }
392
249
  }
@@ -408,19 +265,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
408
265
  }
409
266
  onMounted(() => {
410
267
  adjust();
411
- window.addEventListener("resize", setFix);
412
- if ($el.value) {
413
- resizeObserver = new ResizeObserver(() => {
414
- setFix();
415
- });
416
- resizeObserver.observe($el.value);
417
- }
418
- });
419
- onBeforeUnmount(() => {
420
- window.removeEventListener("resize", setFix);
421
- if (resizeObserver) {
422
- resizeObserver.disconnect();
423
- }
424
268
  });
425
269
  const hasRadio = computed(() => {
426
270
  let flag = false;
@@ -487,11 +331,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
487
331
  }
488
332
  return result;
489
333
  }
490
- function countColumnLeaves(col) {
491
- if (!col.children || col.children.length === 0)
492
- return 1;
493
- return col.children.reduce((sum, child) => sum + countColumnLeaves(child), 0);
494
- }
495
334
  function pruneColumnTree(columns, start, count) {
496
335
  const leaves = getLeafColumns(columns);
497
336
  const targetLeaves = leaves.slice(start, start + count);
@@ -514,26 +353,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
514
353
  }
515
354
  const leafColumns = computed(() => getLeafColumns(props.columns));
516
355
  const leftColumns = computed(() => {
517
- const topCount = Number(props.fixLeft);
518
- if (topCount <= 0)
356
+ if (Number(props.fixLeft) <= 0)
519
357
  return [];
520
- let leafCount = 0;
521
- for (let i = 0; i < topCount && i < props.columns.length; i++) {
522
- leafCount += countColumnLeaves(props.columns[i]);
523
- }
524
- return pruneColumnTree(props.columns, 0, leafCount);
358
+ return pruneColumnTree(props.columns, 0, Number(props.fixLeft));
525
359
  });
526
360
  const leftLeafColumns = computed(() => getLeafColumns(leftColumns.value));
527
361
  const rightColumns = computed(() => {
528
- const topCount = Number(props.fixRight);
529
- if (topCount <= 0)
362
+ if (Number(props.fixRight) <= 0)
530
363
  return [];
531
- let leafCount = 0;
532
- for (let i = props.columns.length - topCount; i < props.columns.length; i++) {
533
- leafCount += countColumnLeaves(props.columns[i]);
534
- }
535
364
  const totalLeaves = leafColumns.value.length;
536
- return pruneColumnTree(props.columns, totalLeaves - leafCount, leafCount);
365
+ return pruneColumnTree(props.columns, totalLeaves - Number(props.fixRight), Number(props.fixRight));
537
366
  });
538
367
  const rightLeafColumns = computed(() => getLeafColumns(rightColumns.value));
539
368
  const flattenColumns = computed(() => {