@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.
- package/es/components/input/src/input.vue.d.ts +2 -2
- package/es/components/pic/index.d.ts +9 -0
- package/es/components/pic/src/Pic.vue.d.ts +9 -0
- package/es/components/pic/src/pic.d.ts +7 -0
- package/es/components/rate/src/rate.vue.d.ts +46 -10
- package/es/components/scroll/index.d.ts +15 -0
- package/es/components/scroll/src/Scroll.vue.d.ts +9 -0
- package/es/components/scroll/src/scroll.d.ts +7 -0
- package/es/components/select/src/select.d.ts +18 -0
- package/es/components/select/src/select.vue.d.ts +18 -0
- package/es/components/table/src/table-head.vue.d.ts +2 -0
- package/es/components/tip/src/tip.vue.d.ts +2 -2
- package/es/components/upload/src/upload.vue.d.ts +6 -4
- package/es/index.d.mjs.map +1 -1
- package/es/index.mjs +2 -1
- package/es/index.mjs.map +1 -1
- package/es/packages/components/calendar/src/calendar.vue2.mjs +22 -0
- package/es/packages/components/calendar/src/calendar.vue2.mjs.map +1 -1
- package/es/packages/components/cascader/src/cascader-item.vue2.mjs +1 -0
- package/es/packages/components/cascader/src/cascader-item.vue2.mjs.map +1 -1
- package/es/packages/components/cascader/src/cascader.vue2.mjs +1 -0
- package/es/packages/components/cascader/src/cascader.vue2.mjs.map +1 -1
- package/es/packages/components/float/src/Float.vue2.mjs +4 -4
- package/es/packages/components/float/src/Float.vue2.mjs.map +1 -1
- package/es/packages/components/pic/src/Pic.vue2.mjs +18 -2
- package/es/packages/components/pic/src/Pic.vue2.mjs.map +1 -1
- package/es/packages/components/pic/src/pic.mjs +7 -0
- package/es/packages/components/pic/src/pic.mjs.map +1 -1
- package/es/packages/components/rate/src/rate.vue2.mjs +153 -85
- package/es/packages/components/rate/src/rate.vue2.mjs.map +1 -1
- package/es/packages/components/scroll/src/Scroll.vue2.mjs +3 -0
- package/es/packages/components/scroll/src/Scroll.vue2.mjs.map +1 -1
- package/es/packages/components/scroll/src/scroll.mjs +7 -0
- package/es/packages/components/scroll/src/scroll.mjs.map +1 -1
- package/es/packages/components/segment/src/segment.vue.mjs +10 -12
- package/es/packages/components/segment/src/segment.vue.mjs.map +1 -1
- package/es/packages/components/select/src/select.mjs +18 -0
- package/es/packages/components/select/src/select.mjs.map +1 -1
- package/es/packages/components/select/src/select.vue2.mjs +263 -87
- package/es/packages/components/select/src/select.vue2.mjs.map +1 -1
- package/es/packages/components/table/src/table-head.vue2.mjs +101 -45
- package/es/packages/components/table/src/table-head.vue2.mjs.map +1 -1
- package/es/packages/components/table/src/table.vue2.mjs +244 -62
- package/es/packages/components/table/src/table.vue2.mjs.map +1 -1
- package/es/packages/components/tree/src/tree-item.vue2.mjs +2 -1
- package/es/packages/components/tree/src/tree-item.vue2.mjs.map +1 -1
- package/es/packages/components/upload/src/upload.vue2.mjs +203 -153
- package/es/packages/components/upload/src/upload.vue2.mjs.map +1 -1
- package/es/packages/directives/tip/src/tip.mjs +42 -27
- package/es/packages/directives/tip/src/tip.mjs.map +1 -1
- package/es/packages/locale/format.mjs +1 -1
- package/es/packages/locale/format.mjs.map +1 -1
- package/es/ui/index.d.ts +6 -0
- package/lib/components/input/src/input.vue.d.ts +2 -2
- package/lib/components/pic/index.d.ts +9 -0
- package/lib/components/pic/src/Pic.vue.d.ts +9 -0
- package/lib/components/pic/src/pic.d.ts +7 -0
- package/lib/components/rate/src/rate.vue.d.ts +46 -10
- package/lib/components/scroll/index.d.ts +15 -0
- package/lib/components/scroll/src/Scroll.vue.d.ts +9 -0
- package/lib/components/scroll/src/scroll.d.ts +7 -0
- package/lib/components/select/src/select.d.ts +18 -0
- package/lib/components/select/src/select.vue.d.ts +18 -0
- package/lib/components/table/src/table-head.vue.d.ts +2 -0
- package/lib/components/tip/src/tip.vue.d.ts +2 -2
- package/lib/components/upload/src/upload.vue.d.ts +6 -4
- package/lib/index.d.js.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/packages/components/calendar/src/calendar.vue2.js +22 -0
- package/lib/packages/components/calendar/src/calendar.vue2.js.map +1 -1
- package/lib/packages/components/cascader/src/cascader-item.vue2.js +1 -0
- package/lib/packages/components/cascader/src/cascader-item.vue2.js.map +1 -1
- package/lib/packages/components/cascader/src/cascader.vue2.js +1 -0
- package/lib/packages/components/cascader/src/cascader.vue2.js.map +1 -1
- package/lib/packages/components/float/src/Float.vue2.js +4 -4
- package/lib/packages/components/float/src/Float.vue2.js.map +1 -1
- package/lib/packages/components/pic/src/Pic.vue2.js +17 -1
- package/lib/packages/components/pic/src/Pic.vue2.js.map +1 -1
- package/lib/packages/components/pic/src/pic.js +7 -0
- package/lib/packages/components/pic/src/pic.js.map +1 -1
- package/lib/packages/components/rate/src/rate.vue2.js +152 -84
- package/lib/packages/components/rate/src/rate.vue2.js.map +1 -1
- package/lib/packages/components/scroll/src/Scroll.vue2.js +3 -0
- package/lib/packages/components/scroll/src/Scroll.vue2.js.map +1 -1
- package/lib/packages/components/scroll/src/scroll.js +7 -0
- package/lib/packages/components/scroll/src/scroll.js.map +1 -1
- package/lib/packages/components/segment/src/segment.vue.js +10 -12
- package/lib/packages/components/segment/src/segment.vue.js.map +1 -1
- package/lib/packages/components/select/src/select.js +18 -0
- package/lib/packages/components/select/src/select.js.map +1 -1
- package/lib/packages/components/select/src/select.vue2.js +262 -86
- package/lib/packages/components/select/src/select.vue2.js.map +1 -1
- package/lib/packages/components/table/src/table-head.vue2.js +100 -44
- package/lib/packages/components/table/src/table-head.vue2.js.map +1 -1
- package/lib/packages/components/table/src/table.vue2.js +243 -61
- package/lib/packages/components/table/src/table.vue2.js.map +1 -1
- package/lib/packages/components/tree/src/tree-item.vue2.js +2 -1
- package/lib/packages/components/tree/src/tree-item.vue2.js.map +1 -1
- package/lib/packages/components/upload/src/upload.vue2.js +202 -152
- package/lib/packages/components/upload/src/upload.vue2.js.map +1 -1
- package/lib/packages/directives/tip/src/tip.js +41 -26
- package/lib/packages/directives/tip/src/tip.js.map +1 -1
- package/lib/packages/locale/format.js +1 -1
- package/lib/packages/locale/format.js.map +1 -1
- package/lib/ui/index.d.ts +6 -0
- package/package.json +1 -1
- package/theme/base.css +0 -3
- package/theme/components/index.css +445 -255
- package/theme/index.css +445 -255
- package/theme/skin/default.css +445 -255
|
@@ -1,4 +1,4 @@
|
|
|
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';
|
|
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';
|
|
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';
|
|
@@ -50,6 +50,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
50
50
|
const rightTop = ref(null);
|
|
51
51
|
const rightTopTable = ref(null);
|
|
52
52
|
const rightTopHead = ref(null);
|
|
53
|
+
let resizeObserver = null;
|
|
53
54
|
const checkedAll = ref(false);
|
|
54
55
|
const setClass = computed(() => {
|
|
55
56
|
const classes = [];
|
|
@@ -167,10 +168,41 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
167
168
|
}
|
|
168
169
|
}
|
|
169
170
|
}
|
|
171
|
+
function getLeafThMap(trs) {
|
|
172
|
+
var _a;
|
|
173
|
+
const leafCount = leafColumns.value.length;
|
|
174
|
+
const leafThs = new Array(leafCount).fill(null);
|
|
175
|
+
const leafDepths = new Array(leafCount).fill(-1);
|
|
176
|
+
for (let rowIdx = 0; rowIdx < trs.length; rowIdx++) {
|
|
177
|
+
const cells = (_a = trs[rowIdx]) == null ? void 0 : _a.children;
|
|
178
|
+
if (!cells)
|
|
179
|
+
continue;
|
|
180
|
+
let leafIdx = 0;
|
|
181
|
+
for (let colIdx = 0; colIdx < cells.length; colIdx++) {
|
|
182
|
+
while (leafIdx < leafCount && leafDepths[leafIdx] >= rowIdx) {
|
|
183
|
+
leafIdx++;
|
|
184
|
+
}
|
|
185
|
+
const cell = cells[colIdx];
|
|
186
|
+
const colspan = parseInt(cell.getAttribute("colspan") || "1");
|
|
187
|
+
const rowspan = parseInt(cell.getAttribute("rowspan") || "1");
|
|
188
|
+
const depth = rowIdx + rowspan - 1;
|
|
189
|
+
for (let k = 0; k < colspan; k++) {
|
|
190
|
+
const idx = leafIdx + k;
|
|
191
|
+
if (idx < leafCount && depth > leafDepths[idx]) {
|
|
192
|
+
leafDepths[idx] = depth;
|
|
193
|
+
leafThs[idx] = cell;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
leafIdx += colspan;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return leafThs;
|
|
200
|
+
}
|
|
170
201
|
function syncThWidth() {
|
|
171
202
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
172
|
-
if (
|
|
203
|
+
if (leafColumns.value.length > 0 && bodyHead.value && bodyHead.value.row) {
|
|
173
204
|
const trs = bodyHead.value.row.children;
|
|
205
|
+
const leafThMap = getLeafThMap(trs);
|
|
174
206
|
if (Number(props.fixTop) > 0 && topHead.value && topHead.value.row) {
|
|
175
207
|
const topTrs = topHead.value.row.children;
|
|
176
208
|
for (let i = 0; i < topTrs.length; i++) {
|
|
@@ -190,15 +222,25 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
190
222
|
if (Number(props.fixLeft) > 0 && leftHead.value && leftHead.value.row) {
|
|
191
223
|
const leftTrs = leftHead.value.row.children;
|
|
192
224
|
for (let i = 0; i < leftTrs.length; i++) {
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
225
|
+
const leftThs = (_c = leftTrs[i]) == null ? void 0 : _c.children;
|
|
226
|
+
if (leftThs && leftThs.length > 0 && leafThMap) {
|
|
227
|
+
let leafIdx = 0;
|
|
196
228
|
for (let j = 0; j < leftThs.length; j++) {
|
|
197
|
-
const th = ths[j];
|
|
198
229
|
const leftTh = leftThs[j];
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
|
|
230
|
+
if (leftTh) {
|
|
231
|
+
const colspan = parseInt(leftTh.getAttribute("colspan") || "1");
|
|
232
|
+
let totalWidth = 0;
|
|
233
|
+
for (let k = 0; k < colspan; k++) {
|
|
234
|
+
if (leafThMap[leafIdx + k]) {
|
|
235
|
+
totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
leftTh.style.width = totalWidth + "px";
|
|
239
|
+
const mainThs = (_d = trs[i]) == null ? void 0 : _d.children;
|
|
240
|
+
if (mainThs && mainThs[leafIdx]) {
|
|
241
|
+
leftTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
|
|
242
|
+
}
|
|
243
|
+
leafIdx += colspan;
|
|
202
244
|
}
|
|
203
245
|
}
|
|
204
246
|
}
|
|
@@ -206,15 +248,25 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
206
248
|
if (Number(props.fixTop) > 0 && leftTopHead.value && leftTopHead.value.row) {
|
|
207
249
|
const leftTopTrs = leftTopHead.value.row.children;
|
|
208
250
|
for (let i = 0; i < leftTopTrs.length; i++) {
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
251
|
+
const leftTopThs = (_e = leftTopTrs[i]) == null ? void 0 : _e.children;
|
|
252
|
+
if (leftTopThs && leftTopThs.length > 0 && leafThMap) {
|
|
253
|
+
let leafIdx = 0;
|
|
212
254
|
for (let j = 0; j < leftTopThs.length; j++) {
|
|
213
|
-
const th = ths[j];
|
|
214
255
|
const leftTopTh = leftTopThs[j];
|
|
215
|
-
if (
|
|
216
|
-
|
|
217
|
-
|
|
256
|
+
if (leftTopTh) {
|
|
257
|
+
const colspan = parseInt(leftTopTh.getAttribute("colspan") || "1");
|
|
258
|
+
let totalWidth = 0;
|
|
259
|
+
for (let k = 0; k < colspan; k++) {
|
|
260
|
+
if (leafThMap[leafIdx + k]) {
|
|
261
|
+
totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
leftTopTh.style.width = totalWidth + "px";
|
|
265
|
+
const mainThs = (_f = trs[i]) == null ? void 0 : _f.children;
|
|
266
|
+
if (mainThs && mainThs[leafIdx]) {
|
|
267
|
+
leftTopTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
|
|
268
|
+
}
|
|
269
|
+
leafIdx += colspan;
|
|
218
270
|
}
|
|
219
271
|
}
|
|
220
272
|
}
|
|
@@ -223,16 +275,27 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
223
275
|
}
|
|
224
276
|
if (Number(props.fixRight) > 0 && rightHead.value && rightHead.value.row) {
|
|
225
277
|
const rightTrs = rightHead.value.row.children;
|
|
278
|
+
const rightLeafStart = leafColumns.value.length - Number(props.fixRight);
|
|
226
279
|
for (let i = 0; i < rightTrs.length; i++) {
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
for (let j =
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
280
|
+
const rightThs = (_g = rightTrs[i]) == null ? void 0 : _g.children;
|
|
281
|
+
if (rightThs && rightThs.length > 0 && leafThMap) {
|
|
282
|
+
let leafIdx = rightLeafStart;
|
|
283
|
+
for (let j = 0; j < rightThs.length; j++) {
|
|
284
|
+
const rightTh = rightThs[j];
|
|
285
|
+
if (rightTh) {
|
|
286
|
+
const colspan = parseInt(rightTh.getAttribute("colspan") || "1");
|
|
287
|
+
let totalWidth = 0;
|
|
288
|
+
for (let k = 0; k < colspan; k++) {
|
|
289
|
+
if (leafThMap[leafIdx + k]) {
|
|
290
|
+
totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
rightTh.style.width = totalWidth + "px";
|
|
294
|
+
const mainThs = (_h = trs[i]) == null ? void 0 : _h.children;
|
|
295
|
+
if (mainThs && mainThs[leafIdx]) {
|
|
296
|
+
rightTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
|
|
297
|
+
}
|
|
298
|
+
leafIdx += colspan;
|
|
236
299
|
}
|
|
237
300
|
}
|
|
238
301
|
}
|
|
@@ -240,15 +303,25 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
240
303
|
if (Number(props.fixTop) > 0 && rightTopHead.value && rightTopHead.value.row) {
|
|
241
304
|
const rightTopTrs = rightTopHead.value.row.children;
|
|
242
305
|
for (let i = 0; i < rightTopTrs.length; i++) {
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
for (let j =
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
306
|
+
const rightTopThs = (_i = rightTopTrs[i]) == null ? void 0 : _i.children;
|
|
307
|
+
if (rightTopThs && rightTopThs.length > 0 && leafThMap) {
|
|
308
|
+
let leafIdx = rightLeafStart;
|
|
309
|
+
for (let j = 0; j < rightTopThs.length; j++) {
|
|
310
|
+
const rightTopTh = rightTopThs[j];
|
|
311
|
+
if (rightTopTh) {
|
|
312
|
+
const colspan = parseInt(rightTopTh.getAttribute("colspan") || "1");
|
|
313
|
+
let totalWidth = 0;
|
|
314
|
+
for (let k = 0; k < colspan; k++) {
|
|
315
|
+
if (leafThMap[leafIdx + k]) {
|
|
316
|
+
totalWidth += leafThMap[leafIdx + k].getBoundingClientRect().width;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
rightTopTh.style.width = totalWidth + "px";
|
|
320
|
+
const mainThs = (_j = trs[i]) == null ? void 0 : _j.children;
|
|
321
|
+
if (mainThs && mainThs[leafIdx]) {
|
|
322
|
+
rightTopTh.style.height = mainThs[leafIdx].getBoundingClientRect().height + "px";
|
|
323
|
+
}
|
|
324
|
+
leafIdx += colspan;
|
|
252
325
|
}
|
|
253
326
|
}
|
|
254
327
|
}
|
|
@@ -258,7 +331,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
258
331
|
}
|
|
259
332
|
}
|
|
260
333
|
function syncTrHeight() {
|
|
261
|
-
var _a;
|
|
334
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
262
335
|
if (!(props.fixRight || props.fixLeft))
|
|
263
336
|
return;
|
|
264
337
|
if ((_a = bodyBody.value) == null ? void 0 : _a.$el.children.length) {
|
|
@@ -266,9 +339,53 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
266
339
|
const tr = bodyBody.value.$el.children[i];
|
|
267
340
|
if (Number(props.fixRight) > 0 && rightBody.value) {
|
|
268
341
|
rightBody.value.$el.children[i].style.height = tr.getBoundingClientRect().height + "px";
|
|
342
|
+
const rightTr = rightBody.value.$el.children[i];
|
|
343
|
+
const rightTds = rightTr == null ? void 0 : rightTr.children;
|
|
344
|
+
const rightHeadTrs = (_c = (_b = rightHead.value) == null ? void 0 : _b.row) == null ? void 0 : _c.children;
|
|
345
|
+
const rightThs = (_d = rightHeadTrs == null ? void 0 : rightHeadTrs[rightHeadTrs.length - 1]) == null ? void 0 : _d.children;
|
|
346
|
+
if (rightTds && rightThs) {
|
|
347
|
+
for (let j = 0; j < rightTds.length; j++) {
|
|
348
|
+
if (rightThs[j]) {
|
|
349
|
+
const span = rightTds[j].querySelector("span");
|
|
350
|
+
if (span) {
|
|
351
|
+
const thWidth = parseFloat(rightThs[j].style.width) || 0;
|
|
352
|
+
const tdStyle = window.getComputedStyle(rightTds[j]);
|
|
353
|
+
const tdPaddingLeft = parseFloat(tdStyle.paddingLeft) || 0;
|
|
354
|
+
const tdPaddingRight = parseFloat(tdStyle.paddingRight) || 0;
|
|
355
|
+
const spanMaxWidth = Math.max(0, thWidth - tdPaddingLeft - tdPaddingRight);
|
|
356
|
+
span.style.display = "block";
|
|
357
|
+
span.style.maxWidth = spanMaxWidth + "px";
|
|
358
|
+
span.style.overflow = "hidden";
|
|
359
|
+
span.style.textOverflow = "ellipsis";
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
269
364
|
}
|
|
270
365
|
if (Number(props.fixLeft) > 0 && leftBody.value) {
|
|
271
366
|
leftBody.value.$el.children[i].style.height = tr.getBoundingClientRect().height + "px";
|
|
367
|
+
const leftTr = leftBody.value.$el.children[i];
|
|
368
|
+
const leftTds = leftTr == null ? void 0 : leftTr.children;
|
|
369
|
+
const leftHeadTrs = (_f = (_e = leftHead.value) == null ? void 0 : _e.row) == null ? void 0 : _f.children;
|
|
370
|
+
const leftThs = (_g = leftHeadTrs == null ? void 0 : leftHeadTrs[leftHeadTrs.length - 1]) == null ? void 0 : _g.children;
|
|
371
|
+
if (leftTds && leftThs) {
|
|
372
|
+
for (let j = 0; j < leftTds.length; j++) {
|
|
373
|
+
if (leftThs[j]) {
|
|
374
|
+
const span = leftTds[j].querySelector("span");
|
|
375
|
+
if (span) {
|
|
376
|
+
const thWidth = parseFloat(leftThs[j].style.width) || 0;
|
|
377
|
+
const tdStyle = window.getComputedStyle(leftTds[j]);
|
|
378
|
+
const tdPaddingLeft = parseFloat(tdStyle.paddingLeft) || 0;
|
|
379
|
+
const tdPaddingRight = parseFloat(tdStyle.paddingRight) || 0;
|
|
380
|
+
const spanMaxWidth = Math.max(0, thWidth - tdPaddingLeft - tdPaddingRight);
|
|
381
|
+
span.style.display = "block";
|
|
382
|
+
span.style.maxWidth = spanMaxWidth + "px";
|
|
383
|
+
span.style.overflow = "hidden";
|
|
384
|
+
span.style.textOverflow = "ellipsis";
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
272
389
|
}
|
|
273
390
|
}
|
|
274
391
|
}
|
|
@@ -290,6 +407,19 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
290
407
|
}
|
|
291
408
|
onMounted(() => {
|
|
292
409
|
adjust();
|
|
410
|
+
window.addEventListener("resize", setFix);
|
|
411
|
+
if ($el.value) {
|
|
412
|
+
resizeObserver = new ResizeObserver(() => {
|
|
413
|
+
setFix();
|
|
414
|
+
});
|
|
415
|
+
resizeObserver.observe($el.value);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
onBeforeUnmount(() => {
|
|
419
|
+
window.removeEventListener("resize", setFix);
|
|
420
|
+
if (resizeObserver) {
|
|
421
|
+
resizeObserver.disconnect();
|
|
422
|
+
}
|
|
293
423
|
});
|
|
294
424
|
const hasRadio = computed(() => {
|
|
295
425
|
let flag = false;
|
|
@@ -328,6 +458,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
328
458
|
checkedAll.value = isAll;
|
|
329
459
|
}
|
|
330
460
|
function checkedAllChange(isAll) {
|
|
461
|
+
checkedAll.value = isAll;
|
|
331
462
|
if (isAll) {
|
|
332
463
|
let ids = props.data.map((item) => item[props.valueKeys]);
|
|
333
464
|
emit("update:modelValue", ids);
|
|
@@ -344,22 +475,68 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
344
475
|
rightBody.value.checkAll(isAll);
|
|
345
476
|
}
|
|
346
477
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
478
|
+
function getLeafColumns(columns) {
|
|
479
|
+
const result = [];
|
|
480
|
+
for (const col of columns) {
|
|
481
|
+
if (col.children && col.children.length > 0) {
|
|
482
|
+
result.push(...getLeafColumns(col.children));
|
|
483
|
+
} else {
|
|
484
|
+
result.push(col);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
return result;
|
|
488
|
+
}
|
|
489
|
+
function countColumnLeaves(col) {
|
|
490
|
+
if (!col.children || col.children.length === 0)
|
|
491
|
+
return 1;
|
|
492
|
+
return col.children.reduce((sum, child) => sum + countColumnLeaves(child), 0);
|
|
493
|
+
}
|
|
494
|
+
function pruneColumnTree(columns, start, count) {
|
|
495
|
+
const leaves = getLeafColumns(columns);
|
|
496
|
+
const targetLeaves = leaves.slice(start, start + count);
|
|
497
|
+
const targetProps = new Set(targetLeaves.map((l) => l.prop));
|
|
498
|
+
function prune(cols) {
|
|
499
|
+
const result = [];
|
|
500
|
+
for (const col of cols) {
|
|
501
|
+
if (col.children && col.children.length > 0) {
|
|
502
|
+
const prunedChildren = prune(col.children);
|
|
503
|
+
if (prunedChildren.length > 0) {
|
|
504
|
+
result.push({ ...col, children: prunedChildren });
|
|
505
|
+
}
|
|
506
|
+
} else if (targetProps.has(col.prop)) {
|
|
507
|
+
result.push({ ...col });
|
|
358
508
|
}
|
|
359
|
-
}
|
|
509
|
+
}
|
|
510
|
+
return result;
|
|
360
511
|
}
|
|
361
|
-
|
|
362
|
-
|
|
512
|
+
return prune(columns);
|
|
513
|
+
}
|
|
514
|
+
const leafColumns = computed(() => getLeafColumns(props.columns));
|
|
515
|
+
const leftColumns = computed(() => {
|
|
516
|
+
const topCount = Number(props.fixLeft);
|
|
517
|
+
if (topCount <= 0)
|
|
518
|
+
return [];
|
|
519
|
+
let leafCount = 0;
|
|
520
|
+
for (let i = 0; i < topCount && i < props.columns.length; i++) {
|
|
521
|
+
leafCount += countColumnLeaves(props.columns[i]);
|
|
522
|
+
}
|
|
523
|
+
return pruneColumnTree(props.columns, 0, leafCount);
|
|
524
|
+
});
|
|
525
|
+
const leftLeafColumns = computed(() => getLeafColumns(leftColumns.value));
|
|
526
|
+
const rightColumns = computed(() => {
|
|
527
|
+
const topCount = Number(props.fixRight);
|
|
528
|
+
if (topCount <= 0)
|
|
529
|
+
return [];
|
|
530
|
+
let leafCount = 0;
|
|
531
|
+
for (let i = props.columns.length - topCount; i < props.columns.length; i++) {
|
|
532
|
+
leafCount += countColumnLeaves(props.columns[i]);
|
|
533
|
+
}
|
|
534
|
+
const totalLeaves = leafColumns.value.length;
|
|
535
|
+
return pruneColumnTree(props.columns, totalLeaves - leafCount, leafCount);
|
|
536
|
+
});
|
|
537
|
+
const rightLeafColumns = computed(() => getLeafColumns(rightColumns.value));
|
|
538
|
+
const flattenColumns = computed(() => {
|
|
539
|
+
return leafColumns.value;
|
|
363
540
|
});
|
|
364
541
|
function getColWidth(column) {
|
|
365
542
|
if (column.width) {
|
|
@@ -412,7 +589,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
412
589
|
(openBlock(true), createElementBlock(
|
|
413
590
|
Fragment,
|
|
414
591
|
null,
|
|
415
|
-
renderList(
|
|
592
|
+
renderList(leafColumns.value, (item, index) => {
|
|
416
593
|
return openBlock(), createElementBlock(
|
|
417
594
|
"col",
|
|
418
595
|
{
|
|
@@ -443,7 +620,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
443
620
|
type: hasRadio.value ? "radio" : hasCheck.value ? "check" : "",
|
|
444
621
|
data: _ctx.data,
|
|
445
622
|
"checked-all": checkedAll.value,
|
|
446
|
-
"column-data":
|
|
623
|
+
"column-data": leafColumns.value,
|
|
447
624
|
onChange: change
|
|
448
625
|
}, createSlots({
|
|
449
626
|
detail: withCtx((slotProps) => [
|
|
@@ -499,10 +676,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
499
676
|
createVNode(TableHead, {
|
|
500
677
|
ref_key: "topHead",
|
|
501
678
|
ref: topHead,
|
|
679
|
+
"checked-all": checkedAll.value,
|
|
502
680
|
data: _ctx.columns,
|
|
503
681
|
onChange: checkedAllChange,
|
|
504
682
|
onSort: sortChange
|
|
505
|
-
}, null, 8, ["data"])
|
|
683
|
+
}, null, 8, ["checked-all", "data"])
|
|
506
684
|
],
|
|
507
685
|
512
|
|
508
686
|
/* NEED_PATCH */
|
|
@@ -531,15 +709,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
531
709
|
createVNode(TableHead, {
|
|
532
710
|
ref_key: "leftHead",
|
|
533
711
|
ref: leftHead,
|
|
534
|
-
|
|
712
|
+
"checked-all": checkedAll.value,
|
|
713
|
+
data: leftColumns.value,
|
|
535
714
|
onChange: checkedAllChange,
|
|
536
715
|
onSort: sortChange
|
|
537
|
-
}, null, 8, ["data"]),
|
|
716
|
+
}, null, 8, ["checked-all", "data"]),
|
|
538
717
|
createVNode(TableBody, {
|
|
539
718
|
ref_key: "leftBody",
|
|
540
719
|
ref: leftBody,
|
|
541
720
|
data: _ctx.data,
|
|
542
|
-
"column-data":
|
|
721
|
+
"column-data": leftLeafColumns.value,
|
|
543
722
|
onChange: change
|
|
544
723
|
}, createSlots({
|
|
545
724
|
detail: withCtx((slotProps) => [
|
|
@@ -585,10 +764,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
585
764
|
createVNode(TableHead, {
|
|
586
765
|
ref_key: "leftTopHead",
|
|
587
766
|
ref: leftTopHead,
|
|
588
|
-
|
|
767
|
+
"checked-all": checkedAll.value,
|
|
768
|
+
data: leftColumns.value,
|
|
589
769
|
onChange: checkedAllChange,
|
|
590
770
|
onSort: sortChange
|
|
591
|
-
}, null, 8, ["data"])
|
|
771
|
+
}, null, 8, ["checked-all", "data"])
|
|
592
772
|
],
|
|
593
773
|
512
|
|
594
774
|
/* NEED_PATCH */
|
|
@@ -617,15 +797,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
617
797
|
createVNode(TableHead, {
|
|
618
798
|
ref_key: "rightHead",
|
|
619
799
|
ref: rightHead,
|
|
620
|
-
|
|
800
|
+
"checked-all": checkedAll.value,
|
|
801
|
+
data: rightColumns.value,
|
|
621
802
|
onChange: checkedAllChange,
|
|
622
803
|
onSort: sortChange
|
|
623
|
-
}, null, 8, ["data"]),
|
|
804
|
+
}, null, 8, ["checked-all", "data"]),
|
|
624
805
|
createVNode(TableBody, {
|
|
625
806
|
ref_key: "rightBody",
|
|
626
807
|
ref: rightBody,
|
|
627
808
|
data: _ctx.data,
|
|
628
|
-
"column-data":
|
|
809
|
+
"column-data": rightLeafColumns.value,
|
|
629
810
|
onChange: change
|
|
630
811
|
}, createSlots({
|
|
631
812
|
detail: withCtx((slotProps) => [
|
|
@@ -671,10 +852,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
671
852
|
createVNode(TableHead, {
|
|
672
853
|
ref_key: "rightTopHead",
|
|
673
854
|
ref: rightTopHead,
|
|
674
|
-
|
|
855
|
+
"checked-all": checkedAll.value,
|
|
856
|
+
data: rightColumns.value,
|
|
675
857
|
onChange: checkedAllChange,
|
|
676
858
|
onSort: sortChange
|
|
677
|
-
}, null, 8, ["data"])
|
|
859
|
+
}, null, 8, ["checked-all", "data"])
|
|
678
860
|
],
|
|
679
861
|
512
|
|
680
862
|
/* NEED_PATCH */
|