@deot/vc-components 1.0.10 → 1.0.12
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/dist/index.cjs +3184 -289
- package/dist/index.d.ts +509 -10
- package/dist/index.iife.js +21201 -352
- package/dist/index.js +3185 -292
- package/dist/index.style.css +1 -1
- package/dist/index.umd.cjs +21201 -352
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { reactive, defineComponent, createVNode, ref, watch, getCurrentInstance, computed, TransitionGroup, Transition as Transition$1, h, inject, onMounted, provide, shallowRef, onUnmounted, withDirectives, vShow, createApp, onBeforeUnmount, Fragment as Fragment$1, Teleport, withModifiers, nextTick, isVNode, onBeforeMount, mergeProps, createTextVNode, toRaw, onUpdated } from 'vue';
|
|
2
|
-
import { debounce, isEqualWith, pick, startCase, throttle, cloneDeep, kebabCase } from 'lodash-es';
|
|
2
|
+
import { debounce, isEqualWith, pick, startCase, throttle, cloneDeep, max, merge as merge$1, isEmpty as isEmpty$1, kebabCase } from 'lodash-es';
|
|
3
3
|
import { Resize } from '@deot/helper-resize';
|
|
4
4
|
import { Utils as Utils$1, IS_SERVER as IS_SERVER$1 } from '@deot/vc-shared';
|
|
5
5
|
import * as Utils from '@deot/helper-utils';
|
|
6
|
-
import { getUid, preZero, raf, getPropByPath, throttle as throttle$1 } from '@deot/helper-utils';
|
|
6
|
+
import { getUid, preZero, raf, getPropByPath, throttle as throttle$1, hasOwn } from '@deot/helper-utils';
|
|
7
7
|
import * as $ from '@deot/helper-dom';
|
|
8
|
-
import { composedPath, scrollIntoView, prefixStyle, getStyle } from '@deot/helper-dom';
|
|
8
|
+
import { composedPath, scrollIntoView, prefixStyle, removeClass, addClass, hasClass, getStyle } from '@deot/helper-dom';
|
|
9
9
|
import { useAttrs, useScrollbar, getInstance } from '@deot/vc-hooks';
|
|
10
10
|
import { Wheel } from '@deot/helper-wheel';
|
|
11
11
|
import { Validator } from '@deot/helper-validator';
|
|
@@ -13,6 +13,8 @@ import { Storage } from '@deot/helper-cache';
|
|
|
13
13
|
import * as Load from '@deot/helper-load';
|
|
14
14
|
import { style } from '@deot/helper-load';
|
|
15
15
|
import { Interrupter } from '@deot/helper-scheduler';
|
|
16
|
+
import { concat, merge, debounce as debounce$1 } from 'lodash';
|
|
17
|
+
import { compose } from '@deot/helper-fp';
|
|
16
18
|
|
|
17
19
|
class VcError {
|
|
18
20
|
message;
|
|
@@ -67,9 +69,9 @@ const props$1q = {
|
|
|
67
69
|
|
|
68
70
|
/** @jsxImportSource vue */
|
|
69
71
|
|
|
70
|
-
const COMPONENT_NAME$
|
|
72
|
+
const COMPONENT_NAME$1$ = 'vc-action-sheet';
|
|
71
73
|
const ActionSheet = /* @__PURE__ */ defineComponent({
|
|
72
|
-
name: COMPONENT_NAME$
|
|
74
|
+
name: COMPONENT_NAME$1$,
|
|
73
75
|
props: props$1q,
|
|
74
76
|
setup(props, {
|
|
75
77
|
slots
|
|
@@ -256,9 +258,9 @@ const IconManager = new Manager();
|
|
|
256
258
|
|
|
257
259
|
/** @jsxImportSource vue */
|
|
258
260
|
|
|
259
|
-
const COMPONENT_NAME$
|
|
261
|
+
const COMPONENT_NAME$1_ = 'vc-icon';
|
|
260
262
|
const Icon = /* @__PURE__ */ defineComponent({
|
|
261
|
-
name: COMPONENT_NAME$
|
|
263
|
+
name: COMPONENT_NAME$1_,
|
|
262
264
|
props: props$1o,
|
|
263
265
|
setup(props) {
|
|
264
266
|
const viewBox = ref('0 0 1024 1024');
|
|
@@ -457,9 +459,9 @@ const useTransition = () => {
|
|
|
457
459
|
};
|
|
458
460
|
};
|
|
459
461
|
|
|
460
|
-
const COMPONENT_NAME$
|
|
462
|
+
const COMPONENT_NAME$1Z = "vc-transition";
|
|
461
463
|
const Transition = defineComponent({
|
|
462
|
-
name: COMPONENT_NAME$
|
|
464
|
+
name: COMPONENT_NAME$1Z,
|
|
463
465
|
props: props$1n,
|
|
464
466
|
// 当不声明emits的情况下,事件存在于attrs中
|
|
465
467
|
inheritAttrs: false,
|
|
@@ -480,9 +482,9 @@ const Transition = defineComponent({
|
|
|
480
482
|
}
|
|
481
483
|
});
|
|
482
484
|
|
|
483
|
-
const COMPONENT_NAME$
|
|
485
|
+
const COMPONENT_NAME$1Y = "vc-transition-collapse";
|
|
484
486
|
const TransitionCollapse = defineComponent({
|
|
485
|
-
name: COMPONENT_NAME$
|
|
487
|
+
name: COMPONENT_NAME$1Y,
|
|
486
488
|
props: props$1n,
|
|
487
489
|
// 当不声明emits的情况下,事件存在于attrs中
|
|
488
490
|
inheritAttrs: false,
|
|
@@ -601,9 +603,9 @@ const TransitionCollapse = defineComponent({
|
|
|
601
603
|
}
|
|
602
604
|
});
|
|
603
605
|
|
|
604
|
-
const COMPONENT_NAME$
|
|
606
|
+
const COMPONENT_NAME$1X = "vc-transition-fade";
|
|
605
607
|
const TransitionFade = defineComponent({
|
|
606
|
-
name: COMPONENT_NAME$
|
|
608
|
+
name: COMPONENT_NAME$1X,
|
|
607
609
|
props: {
|
|
608
610
|
...props$1n,
|
|
609
611
|
// inheritAttrs必须是false
|
|
@@ -638,9 +640,9 @@ const TransitionFade = defineComponent({
|
|
|
638
640
|
}
|
|
639
641
|
});
|
|
640
642
|
|
|
641
|
-
const COMPONENT_NAME$
|
|
643
|
+
const COMPONENT_NAME$1W = "vc-transition-scale";
|
|
642
644
|
const TransitionScale = defineComponent({
|
|
643
|
-
name: COMPONENT_NAME$
|
|
645
|
+
name: COMPONENT_NAME$1W,
|
|
644
646
|
props: {
|
|
645
647
|
...props$1n,
|
|
646
648
|
mode: {
|
|
@@ -680,9 +682,9 @@ const TransitionScale = defineComponent({
|
|
|
680
682
|
}
|
|
681
683
|
});
|
|
682
684
|
|
|
683
|
-
const COMPONENT_NAME$
|
|
685
|
+
const COMPONENT_NAME$1V = "vc-transition-slide";
|
|
684
686
|
const TransitionSlide = defineComponent({
|
|
685
|
-
name: COMPONENT_NAME$
|
|
687
|
+
name: COMPONENT_NAME$1V,
|
|
686
688
|
props: {
|
|
687
689
|
...props$1n,
|
|
688
690
|
mode: {
|
|
@@ -722,9 +724,9 @@ const TransitionSlide = defineComponent({
|
|
|
722
724
|
}
|
|
723
725
|
});
|
|
724
726
|
|
|
725
|
-
const COMPONENT_NAME$
|
|
727
|
+
const COMPONENT_NAME$1U = "vc-transition-zoom";
|
|
726
728
|
const TransitionZoom = defineComponent({
|
|
727
|
-
name: COMPONENT_NAME$
|
|
729
|
+
name: COMPONENT_NAME$1U,
|
|
728
730
|
props: {
|
|
729
731
|
...props$1n,
|
|
730
732
|
mode: {
|
|
@@ -766,7 +768,7 @@ const TransitionZoom = defineComponent({
|
|
|
766
768
|
|
|
767
769
|
/** @jsxImportSource vue */
|
|
768
770
|
|
|
769
|
-
const COMPONENT_NAME$
|
|
771
|
+
const COMPONENT_NAME$1T = 'vc-alert';
|
|
770
772
|
|
|
771
773
|
// [color, borderColor, backgroundColor], -> CSS
|
|
772
774
|
const THEME_MAP = {
|
|
@@ -776,7 +778,7 @@ const THEME_MAP = {
|
|
|
776
778
|
warning: ['#ffbf00', '#ffe58f', '#fffbe6']
|
|
777
779
|
};
|
|
778
780
|
const Alert = /* @__PURE__ */ defineComponent({
|
|
779
|
-
name: COMPONENT_NAME$
|
|
781
|
+
name: COMPONENT_NAME$1T,
|
|
780
782
|
props: props$1p,
|
|
781
783
|
setup(props, {
|
|
782
784
|
slots,
|
|
@@ -875,9 +877,9 @@ const props$1m = {
|
|
|
875
877
|
|
|
876
878
|
/** @jsxImportSource vue */
|
|
877
879
|
|
|
878
|
-
const COMPONENT_NAME$
|
|
880
|
+
const COMPONENT_NAME$1S = 'vc-artboard';
|
|
879
881
|
const Artboard = /* @__PURE__ */ defineComponent({
|
|
880
|
-
name: COMPONENT_NAME$
|
|
882
|
+
name: COMPONENT_NAME$1S,
|
|
881
883
|
props: props$1m,
|
|
882
884
|
setup(props, {
|
|
883
885
|
slots
|
|
@@ -916,9 +918,9 @@ const props$1l = {
|
|
|
916
918
|
|
|
917
919
|
/** @jsxImportSource vue */
|
|
918
920
|
|
|
919
|
-
const COMPONENT_NAME$
|
|
921
|
+
const COMPONENT_NAME$1R = 'vc-spin';
|
|
920
922
|
const Spin = /* @__PURE__ */ defineComponent({
|
|
921
|
-
name: COMPONENT_NAME$
|
|
923
|
+
name: COMPONENT_NAME$1R,
|
|
922
924
|
props: props$1l,
|
|
923
925
|
setup(props, {
|
|
924
926
|
slots
|
|
@@ -969,9 +971,9 @@ const props$1k = {
|
|
|
969
971
|
exclude: RegExp
|
|
970
972
|
};
|
|
971
973
|
|
|
972
|
-
const COMPONENT_NAME$
|
|
974
|
+
const COMPONENT_NAME$1Q = "vc-debounce";
|
|
973
975
|
const Debounce = defineComponent({
|
|
974
|
-
name: COMPONENT_NAME$
|
|
976
|
+
name: COMPONENT_NAME$1Q,
|
|
975
977
|
props: props$1k,
|
|
976
978
|
/**
|
|
977
979
|
* 不声明emits使得事件被透传放入attrs中, 这样可以让所有的事件透传
|
|
@@ -1043,9 +1045,9 @@ const props$1j = {
|
|
|
1043
1045
|
|
|
1044
1046
|
/** @jsxImportSource vue */
|
|
1045
1047
|
|
|
1046
|
-
const COMPONENT_NAME$
|
|
1048
|
+
const COMPONENT_NAME$1P = 'vc-button';
|
|
1047
1049
|
const Button = /* @__PURE__ */ defineComponent({
|
|
1048
|
-
name: COMPONENT_NAME$
|
|
1050
|
+
name: COMPONENT_NAME$1P,
|
|
1049
1051
|
emits: ['click'],
|
|
1050
1052
|
props: props$1j,
|
|
1051
1053
|
setup(props, {
|
|
@@ -1125,9 +1127,9 @@ const props$1i = {
|
|
|
1125
1127
|
|
|
1126
1128
|
/** @jsxImportSource vue */
|
|
1127
1129
|
|
|
1128
|
-
const COMPONENT_NAME$
|
|
1130
|
+
const COMPONENT_NAME$1O = 'vc-button-group';
|
|
1129
1131
|
const ButtonGroup = /* @__PURE__ */ defineComponent({
|
|
1130
|
-
name: COMPONENT_NAME$
|
|
1132
|
+
name: COMPONENT_NAME$1O,
|
|
1131
1133
|
props: props$1i,
|
|
1132
1134
|
setup(props, {
|
|
1133
1135
|
slots
|
|
@@ -1161,9 +1163,9 @@ const props$1h = {
|
|
|
1161
1163
|
|
|
1162
1164
|
/** @jsxImportSource vue */
|
|
1163
1165
|
|
|
1164
|
-
const COMPONENT_NAME$
|
|
1166
|
+
const COMPONENT_NAME$1N = 'vc-calendar';
|
|
1165
1167
|
const Calendar = /* @__PURE__ */ defineComponent({
|
|
1166
|
-
name: COMPONENT_NAME$
|
|
1168
|
+
name: COMPONENT_NAME$1N,
|
|
1167
1169
|
props: props$1h,
|
|
1168
1170
|
setup(props, {
|
|
1169
1171
|
slots
|
|
@@ -1201,9 +1203,9 @@ const props$1g = {
|
|
|
1201
1203
|
|
|
1202
1204
|
/** @jsxImportSource vue */
|
|
1203
1205
|
|
|
1204
|
-
const COMPONENT_NAME$
|
|
1206
|
+
const COMPONENT_NAME$1M = 'vc-card';
|
|
1205
1207
|
const Card = /* @__PURE__ */ defineComponent({
|
|
1206
|
-
name: COMPONENT_NAME$
|
|
1208
|
+
name: COMPONENT_NAME$1M,
|
|
1207
1209
|
props: props$1g,
|
|
1208
1210
|
setup(props, {
|
|
1209
1211
|
slots
|
|
@@ -1239,9 +1241,9 @@ const props$1f = {
|
|
|
1239
1241
|
|
|
1240
1242
|
/** @jsxImportSource vue */
|
|
1241
1243
|
|
|
1242
|
-
const COMPONENT_NAME$
|
|
1244
|
+
const COMPONENT_NAME$1L = 'vc-carousel';
|
|
1243
1245
|
const Carousel = /* @__PURE__ */ defineComponent({
|
|
1244
|
-
name: COMPONENT_NAME$
|
|
1246
|
+
name: COMPONENT_NAME$1L,
|
|
1245
1247
|
props: props$1f,
|
|
1246
1248
|
setup(props, {
|
|
1247
1249
|
slots
|
|
@@ -1265,9 +1267,9 @@ const props$1e = {
|
|
|
1265
1267
|
|
|
1266
1268
|
/** @jsxImportSource vue */
|
|
1267
1269
|
|
|
1268
|
-
const COMPONENT_NAME$
|
|
1270
|
+
const COMPONENT_NAME$1K = 'vc-cascader';
|
|
1269
1271
|
const Cascader = /* @__PURE__ */ defineComponent({
|
|
1270
|
-
name: COMPONENT_NAME$
|
|
1272
|
+
name: COMPONENT_NAME$1K,
|
|
1271
1273
|
props: props$1e,
|
|
1272
1274
|
setup(props, {
|
|
1273
1275
|
slots
|
|
@@ -1336,9 +1338,9 @@ const props$1d = {
|
|
|
1336
1338
|
|
|
1337
1339
|
/** @jsxImportSource vue */
|
|
1338
1340
|
|
|
1339
|
-
const COMPONENT_NAME$
|
|
1341
|
+
const COMPONENT_NAME$1J = 'vc-chart';
|
|
1340
1342
|
const Chart = /* @__PURE__ */ defineComponent({
|
|
1341
|
-
name: COMPONENT_NAME$
|
|
1343
|
+
name: COMPONENT_NAME$1J,
|
|
1342
1344
|
props: props$1d,
|
|
1343
1345
|
emits: [...EVENTS, 'ready'],
|
|
1344
1346
|
setup(props, {
|
|
@@ -1569,9 +1571,9 @@ const useCheckbox = () => {
|
|
|
1569
1571
|
|
|
1570
1572
|
/** @jsxImportSource vue */
|
|
1571
1573
|
|
|
1572
|
-
const COMPONENT_NAME$
|
|
1574
|
+
const COMPONENT_NAME$1I = 'vc-checkbox';
|
|
1573
1575
|
const Checkbox = /* @__PURE__ */ defineComponent({
|
|
1574
|
-
name: COMPONENT_NAME$
|
|
1576
|
+
name: COMPONENT_NAME$1I,
|
|
1575
1577
|
props: props$1c,
|
|
1576
1578
|
emits: ['update:modelValue', 'change'],
|
|
1577
1579
|
setup(props, {
|
|
@@ -1658,9 +1660,9 @@ const useCheckboxGroup = () => {
|
|
|
1658
1660
|
|
|
1659
1661
|
/** @jsxImportSource vue */
|
|
1660
1662
|
|
|
1661
|
-
const COMPONENT_NAME$
|
|
1663
|
+
const COMPONENT_NAME$1H = 'vc-checkbox-group';
|
|
1662
1664
|
const CheckboxGroup = /* @__PURE__ */ defineComponent({
|
|
1663
|
-
name: COMPONENT_NAME$
|
|
1665
|
+
name: COMPONENT_NAME$1H,
|
|
1664
1666
|
props: props$1b,
|
|
1665
1667
|
emits: ['update:modelValue', 'change'],
|
|
1666
1668
|
setup(props, {
|
|
@@ -1678,9 +1680,9 @@ const CheckboxGroup = /* @__PURE__ */ defineComponent({
|
|
|
1678
1680
|
|
|
1679
1681
|
/** @jsxImportSource vue */
|
|
1680
1682
|
|
|
1681
|
-
const COMPONENT_NAME$
|
|
1683
|
+
const COMPONENT_NAME$1G = 'vcm-checkbox';
|
|
1682
1684
|
const MCheckbox = /* @__PURE__ */ defineComponent({
|
|
1683
|
-
name: COMPONENT_NAME$
|
|
1685
|
+
name: COMPONENT_NAME$1G,
|
|
1684
1686
|
props: props$1c,
|
|
1685
1687
|
emits: ['update:modelValue', 'change'],
|
|
1686
1688
|
setup(props, {
|
|
@@ -1720,9 +1722,9 @@ const MCheckbox = /* @__PURE__ */ defineComponent({
|
|
|
1720
1722
|
|
|
1721
1723
|
/** @jsxImportSource vue */
|
|
1722
1724
|
|
|
1723
|
-
const COMPONENT_NAME$
|
|
1725
|
+
const COMPONENT_NAME$1F = 'vcm-checkbox-group';
|
|
1724
1726
|
const MCheckboxGroup = /* @__PURE__ */ defineComponent({
|
|
1725
|
-
name: COMPONENT_NAME$
|
|
1727
|
+
name: COMPONENT_NAME$1F,
|
|
1726
1728
|
props: props$1b,
|
|
1727
1729
|
emits: ['update:modelValue', 'change'],
|
|
1728
1730
|
setup(props, {
|
|
@@ -1781,9 +1783,9 @@ const props$19 = {
|
|
|
1781
1783
|
}
|
|
1782
1784
|
};
|
|
1783
1785
|
|
|
1784
|
-
const COMPONENT_NAME$
|
|
1786
|
+
const COMPONENT_NAME$1E = "vc-customer";
|
|
1785
1787
|
const Customer = defineComponent({
|
|
1786
|
-
name: COMPONENT_NAME$
|
|
1788
|
+
name: COMPONENT_NAME$1E,
|
|
1787
1789
|
props: props$19,
|
|
1788
1790
|
setup(props, context) {
|
|
1789
1791
|
return () => h(() => {
|
|
@@ -1794,9 +1796,9 @@ const Customer = defineComponent({
|
|
|
1794
1796
|
|
|
1795
1797
|
/** @jsxImportSource vue */
|
|
1796
1798
|
|
|
1797
|
-
const COMPONENT_NAME$
|
|
1799
|
+
const COMPONENT_NAME$1D = 'vc-message';
|
|
1798
1800
|
const MessageView = /* @__PURE__ */ defineComponent({
|
|
1799
|
-
name: COMPONENT_NAME$
|
|
1801
|
+
name: COMPONENT_NAME$1D,
|
|
1800
1802
|
emits: ['before-close', 'close', 'portal-fulfilled'],
|
|
1801
1803
|
props: props$1a,
|
|
1802
1804
|
setup(props, {
|
|
@@ -1943,7 +1945,7 @@ class PortalLeaf {
|
|
|
1943
1945
|
}
|
|
1944
1946
|
}
|
|
1945
1947
|
|
|
1946
|
-
const COMPONENT_NAME$
|
|
1948
|
+
const COMPONENT_NAME$1C = "vc-portal";
|
|
1947
1949
|
class Portal {
|
|
1948
1950
|
/**
|
|
1949
1951
|
* 清理Portals类型组件
|
|
@@ -1995,7 +1997,7 @@ class Portal {
|
|
|
1995
1997
|
this.wrapper = wrapper;
|
|
1996
1998
|
this.globalOptions = {
|
|
1997
1999
|
...options,
|
|
1998
|
-
name: options?.name || wrapper.name || Utils.getUid(COMPONENT_NAME$
|
|
2000
|
+
name: options?.name || wrapper.name || Utils.getUid(COMPONENT_NAME$1C)
|
|
1999
2001
|
};
|
|
2000
2002
|
}
|
|
2001
2003
|
popup(propsData, options) {
|
|
@@ -2094,7 +2096,7 @@ class Portal {
|
|
|
2094
2096
|
...rest
|
|
2095
2097
|
} = options;
|
|
2096
2098
|
let useAllNodes = fragment;
|
|
2097
|
-
const name = multiple ? `${name$}__${Utils.getUid(COMPONENT_NAME$
|
|
2099
|
+
const name = multiple ? `${name$}__${Utils.getUid(COMPONENT_NAME$1C)}` : name$;
|
|
2098
2100
|
const container = document.createElement(tag);
|
|
2099
2101
|
const root = typeof el === "object" ? el : document.querySelector(el || "body");
|
|
2100
2102
|
!alive && Portal.leafs.get(name)?.destroy();
|
|
@@ -2128,7 +2130,7 @@ class Portal {
|
|
|
2128
2130
|
} else {
|
|
2129
2131
|
const wrapper = this.wrapper;
|
|
2130
2132
|
const app = createApp({
|
|
2131
|
-
name: COMPONENT_NAME$
|
|
2133
|
+
name: COMPONENT_NAME$1C,
|
|
2132
2134
|
parent,
|
|
2133
2135
|
setup() {
|
|
2134
2136
|
if (alive) {
|
|
@@ -2240,13 +2242,13 @@ const props$18 = {
|
|
|
2240
2242
|
}
|
|
2241
2243
|
};
|
|
2242
2244
|
|
|
2243
|
-
const COMPONENT_NAME$
|
|
2245
|
+
const COMPONENT_NAME$1B = 'vc-portal-view';
|
|
2244
2246
|
|
|
2245
2247
|
/**
|
|
2246
2248
|
* 写法不同,但与vue@2.x 保持一致
|
|
2247
2249
|
*/
|
|
2248
2250
|
const PortalView = /* @__PURE__ */ defineComponent({
|
|
2249
|
-
name: COMPONENT_NAME$
|
|
2251
|
+
name: COMPONENT_NAME$1B,
|
|
2250
2252
|
props: props$18,
|
|
2251
2253
|
setup(props, {
|
|
2252
2254
|
slots
|
|
@@ -2417,9 +2419,9 @@ const useClipboard = (done) => {
|
|
|
2417
2419
|
return () => h(props.tag, { onClick: handleClick, class: "vc-clipboard" }, slots?.default?.());
|
|
2418
2420
|
};
|
|
2419
2421
|
|
|
2420
|
-
const COMPONENT_NAME$
|
|
2422
|
+
const COMPONENT_NAME$1A = "vc-clipboard";
|
|
2421
2423
|
const Clipboard$1 = defineComponent({
|
|
2422
|
-
name: COMPONENT_NAME$
|
|
2424
|
+
name: COMPONENT_NAME$1A,
|
|
2423
2425
|
props: props$17,
|
|
2424
2426
|
setup() {
|
|
2425
2427
|
return useClipboard((content) => Message.success({ content }));
|
|
@@ -2459,9 +2461,9 @@ const MTransitionZoom = TransitionZoom;
|
|
|
2459
2461
|
|
|
2460
2462
|
/** @jsxImportSource vue */
|
|
2461
2463
|
|
|
2462
|
-
const COMPONENT_NAME$
|
|
2464
|
+
const COMPONENT_NAME$1z = 'vcm-toast';
|
|
2463
2465
|
const MToastView = /* @__PURE__ */ defineComponent({
|
|
2464
|
-
name: COMPONENT_NAME$
|
|
2466
|
+
name: COMPONENT_NAME$1z,
|
|
2465
2467
|
emits: ['close', 'portal-fulfilled'],
|
|
2466
2468
|
props: props$16,
|
|
2467
2469
|
setup(props, {
|
|
@@ -2563,9 +2565,9 @@ const warning$2 = create$3({ mode: "warning" });
|
|
|
2563
2565
|
const error$2 = create$3({ mode: "error" });
|
|
2564
2566
|
const MToast = Object.assign(MToastView, { destroy: destroy$4, info: info$2, success: success$2, loading, warning: warning$2, error: error$2 });
|
|
2565
2567
|
|
|
2566
|
-
const COMPONENT_NAME$
|
|
2568
|
+
const COMPONENT_NAME$1y = "vcm-clipboard";
|
|
2567
2569
|
const MClipboard$1 = defineComponent({
|
|
2568
|
-
name: COMPONENT_NAME$
|
|
2570
|
+
name: COMPONENT_NAME$1y,
|
|
2569
2571
|
props: props$17,
|
|
2570
2572
|
setup() {
|
|
2571
2573
|
return useClipboard((content) => MToast.info({ content }));
|
|
@@ -2597,9 +2599,9 @@ const props$15 = {
|
|
|
2597
2599
|
}
|
|
2598
2600
|
};
|
|
2599
2601
|
|
|
2600
|
-
const COMPONENT_NAME$
|
|
2602
|
+
const COMPONENT_NAME$1x = "vc-collapse";
|
|
2601
2603
|
const Collapse = defineComponent({
|
|
2602
|
-
name: COMPONENT_NAME$
|
|
2604
|
+
name: COMPONENT_NAME$1x,
|
|
2603
2605
|
props: props$15,
|
|
2604
2606
|
emits: ["update:moodelValue", "change"],
|
|
2605
2607
|
setup(props, { slots, emit }) {
|
|
@@ -2716,9 +2718,9 @@ const props$13 = {
|
|
|
2716
2718
|
function _isSlot$3(s) {
|
|
2717
2719
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2718
2720
|
}
|
|
2719
|
-
const COMPONENT_NAME$
|
|
2720
|
-
const Expand = /* @__PURE__ */ defineComponent({
|
|
2721
|
-
name: COMPONENT_NAME$
|
|
2721
|
+
const COMPONENT_NAME$1w = 'vc-expand';
|
|
2722
|
+
const Expand$1 = /* @__PURE__ */ defineComponent({
|
|
2723
|
+
name: COMPONENT_NAME$1w,
|
|
2722
2724
|
props: props$13,
|
|
2723
2725
|
setup(props, {
|
|
2724
2726
|
slots
|
|
@@ -2748,9 +2750,9 @@ const Expand = /* @__PURE__ */ defineComponent({
|
|
|
2748
2750
|
|
|
2749
2751
|
/** @jsxImportSource vue */
|
|
2750
2752
|
|
|
2751
|
-
const COMPONENT_NAME$
|
|
2753
|
+
const COMPONENT_NAME$1v = 'vc-collapse-item';
|
|
2752
2754
|
const CollapseItem = /* @__PURE__ */ defineComponent({
|
|
2753
|
-
name: COMPONENT_NAME$
|
|
2755
|
+
name: COMPONENT_NAME$1v,
|
|
2754
2756
|
props: props$14,
|
|
2755
2757
|
setup(props, {
|
|
2756
2758
|
slots,
|
|
@@ -2797,7 +2799,7 @@ const CollapseItem = /* @__PURE__ */ defineComponent({
|
|
|
2797
2799
|
"onClick": handleToggle
|
|
2798
2800
|
}, [slots.default?.(), slots.icon?.({
|
|
2799
2801
|
visible: isActive.value
|
|
2800
|
-
})]), createVNode(Expand, {
|
|
2802
|
+
})]), createVNode(Expand$1, {
|
|
2801
2803
|
"modelValue": isActive.value,
|
|
2802
2804
|
"alive": alive.value,
|
|
2803
2805
|
"onChange": v => isActive.value = v
|
|
@@ -2825,9 +2827,9 @@ const props$12 = {
|
|
|
2825
2827
|
|
|
2826
2828
|
/** @jsxImportSource vue */
|
|
2827
2829
|
|
|
2828
|
-
const COMPONENT_NAME$
|
|
2830
|
+
const COMPONENT_NAME$1u = 'vc-color-picker';
|
|
2829
2831
|
const ColorPicker = /* @__PURE__ */ defineComponent({
|
|
2830
|
-
name: COMPONENT_NAME$
|
|
2832
|
+
name: COMPONENT_NAME$1u,
|
|
2831
2833
|
props: props$12,
|
|
2832
2834
|
setup(props, {
|
|
2833
2835
|
slots
|
|
@@ -2851,9 +2853,9 @@ const props$11 = {
|
|
|
2851
2853
|
|
|
2852
2854
|
/** @jsxImportSource vue */
|
|
2853
2855
|
|
|
2854
|
-
const COMPONENT_NAME$
|
|
2856
|
+
const COMPONENT_NAME$1t = 'vc-countdown';
|
|
2855
2857
|
const Countdown = /* @__PURE__ */ defineComponent({
|
|
2856
|
-
name: COMPONENT_NAME$
|
|
2858
|
+
name: COMPONENT_NAME$1t,
|
|
2857
2859
|
props: props$11,
|
|
2858
2860
|
setup(props, {
|
|
2859
2861
|
slots
|
|
@@ -3302,9 +3304,9 @@ const useNativeEmitter = (input, expose) => {
|
|
|
3302
3304
|
|
|
3303
3305
|
/** @jsxImportSource vue */
|
|
3304
3306
|
|
|
3305
|
-
const COMPONENT_NAME$
|
|
3307
|
+
const COMPONENT_NAME$1s = 'vc-input';
|
|
3306
3308
|
const Input = /* @__PURE__ */ defineComponent({
|
|
3307
|
-
name: COMPONENT_NAME$
|
|
3309
|
+
name: COMPONENT_NAME$1s,
|
|
3308
3310
|
inheritAttrs: false,
|
|
3309
3311
|
props: {
|
|
3310
3312
|
...props$$,
|
|
@@ -3638,9 +3640,9 @@ const useInputNumber = () => {
|
|
|
3638
3640
|
|
|
3639
3641
|
/** @jsxImportSource vue */
|
|
3640
3642
|
|
|
3641
|
-
const COMPONENT_NAME$
|
|
3643
|
+
const COMPONENT_NAME$1r = 'vc-input-number';
|
|
3642
3644
|
const InputNumber = /* @__PURE__ */ defineComponent({
|
|
3643
|
-
name: COMPONENT_NAME$
|
|
3645
|
+
name: COMPONENT_NAME$1r,
|
|
3644
3646
|
props: props$X,
|
|
3645
3647
|
inheritAttrs: false,
|
|
3646
3648
|
setup(props, {
|
|
@@ -3704,9 +3706,9 @@ const props$W = {
|
|
|
3704
3706
|
|
|
3705
3707
|
/** @jsxImportSource vue */
|
|
3706
3708
|
|
|
3707
|
-
const COMPONENT_NAME$
|
|
3709
|
+
const COMPONENT_NAME$1q = 'vc-input-search';
|
|
3708
3710
|
const InputSearch = /* @__PURE__ */ defineComponent({
|
|
3709
|
-
name: COMPONENT_NAME$
|
|
3711
|
+
name: COMPONENT_NAME$1q,
|
|
3710
3712
|
props: props$W,
|
|
3711
3713
|
inheritAttrs: false,
|
|
3712
3714
|
setup(props, {
|
|
@@ -3997,9 +3999,9 @@ const usePos = () => {
|
|
|
3997
3999
|
function _isSlot$2(s) {
|
|
3998
4000
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
3999
4001
|
}
|
|
4000
|
-
const COMPONENT_NAME$
|
|
4002
|
+
const COMPONENT_NAME$1p = 'vc-popover-wrapper';
|
|
4001
4003
|
const PopoverWrapper = /* @__PURE__ */ defineComponent({
|
|
4002
|
-
name: COMPONENT_NAME$
|
|
4004
|
+
name: COMPONENT_NAME$1p,
|
|
4003
4005
|
props: props$_,
|
|
4004
4006
|
emits: ['portal-fulfilled', 'close'],
|
|
4005
4007
|
setup(props, {
|
|
@@ -4251,9 +4253,9 @@ const PopoverPortal = new Portal(PopoverWrapper);
|
|
|
4251
4253
|
|
|
4252
4254
|
/** @jsxImportSource vue */
|
|
4253
4255
|
|
|
4254
|
-
const COMPONENT_NAME$
|
|
4256
|
+
const COMPONENT_NAME$1o = 'vc-popover';
|
|
4255
4257
|
const Popover$1 = /* @__PURE__ */ defineComponent({
|
|
4256
|
-
name: COMPONENT_NAME$
|
|
4258
|
+
name: COMPONENT_NAME$1o,
|
|
4257
4259
|
props: props$Z,
|
|
4258
4260
|
emits: ['update:modelValue', 'visible-change', 'ready', 'close'],
|
|
4259
4261
|
setup(props, {
|
|
@@ -5128,9 +5130,8 @@ const useBase = () => {
|
|
|
5128
5130
|
|
|
5129
5131
|
/** @jsxImportSource vue */
|
|
5130
5132
|
|
|
5131
|
-
const
|
|
5132
|
-
|
|
5133
|
-
name: COMPONENT_NAME$1l,
|
|
5133
|
+
const createPicker = (name, pickerProps, usePicker) => /* @__PURE__ */ defineComponent({
|
|
5134
|
+
name,
|
|
5134
5135
|
props: Object.assign(props$Y, pickerProps),
|
|
5135
5136
|
inheritAttrs: false,
|
|
5136
5137
|
emits: ['update:modelValue', 'change', 'clear', 'error', 'close', 'input', 'ready', 'visible-change', 'ok'],
|
|
@@ -5355,9 +5356,9 @@ const getTimeType = type => {
|
|
|
5355
5356
|
}
|
|
5356
5357
|
return view;
|
|
5357
5358
|
};
|
|
5358
|
-
const COMPONENT_NAME$
|
|
5359
|
+
const COMPONENT_NAME$1n = 'vc-date-confirm';
|
|
5359
5360
|
const Confirm = /* @__PURE__ */ defineComponent({
|
|
5360
|
-
name: COMPONENT_NAME$
|
|
5361
|
+
name: COMPONENT_NAME$1n,
|
|
5361
5362
|
props: {
|
|
5362
5363
|
showTime: {
|
|
5363
5364
|
type: Boolean,
|
|
@@ -5421,9 +5422,9 @@ const Confirm = /* @__PURE__ */ defineComponent({
|
|
|
5421
5422
|
|
|
5422
5423
|
/** @jsxImportSource vue */
|
|
5423
5424
|
|
|
5424
|
-
const COMPONENT_NAME$
|
|
5425
|
+
const COMPONENT_NAME$1m = 'vc-date-header';
|
|
5425
5426
|
const DateHeader = /* @__PURE__ */ defineComponent({
|
|
5426
|
-
name: COMPONENT_NAME$
|
|
5427
|
+
name: COMPONENT_NAME$1m,
|
|
5427
5428
|
props: {
|
|
5428
5429
|
panelDate: Date,
|
|
5429
5430
|
showNext: {
|
|
@@ -5507,9 +5508,9 @@ const DateHeader = /* @__PURE__ */ defineComponent({
|
|
|
5507
5508
|
|
|
5508
5509
|
/** @jsxImportSource vue */
|
|
5509
5510
|
|
|
5510
|
-
const COMPONENT_NAME$
|
|
5511
|
+
const COMPONENT_NAME$1l = 'vc-date-table';
|
|
5511
5512
|
const DateTable = /* @__PURE__ */ defineComponent({
|
|
5512
|
-
name: COMPONENT_NAME$
|
|
5513
|
+
name: COMPONENT_NAME$1l,
|
|
5513
5514
|
props: {
|
|
5514
5515
|
value: Array,
|
|
5515
5516
|
firstDayOfWeek: {
|
|
@@ -5718,9 +5719,9 @@ const DateTable = /* @__PURE__ */ defineComponent({
|
|
|
5718
5719
|
|
|
5719
5720
|
/** @jsxImportSource vue */
|
|
5720
5721
|
|
|
5721
|
-
const COMPONENT_NAME$
|
|
5722
|
+
const COMPONENT_NAME$1k = 'vc-month-table';
|
|
5722
5723
|
const MonthTable = /* @__PURE__ */ defineComponent({
|
|
5723
|
-
name: COMPONENT_NAME$
|
|
5724
|
+
name: COMPONENT_NAME$1k,
|
|
5724
5725
|
props: {
|
|
5725
5726
|
value: Array,
|
|
5726
5727
|
panelDate: Date,
|
|
@@ -5852,7 +5853,7 @@ const MonthTable = /* @__PURE__ */ defineComponent({
|
|
|
5852
5853
|
|
|
5853
5854
|
/** @jsxImportSource vue */
|
|
5854
5855
|
|
|
5855
|
-
const COMPONENT_NAME$
|
|
5856
|
+
const COMPONENT_NAME$1j = 'vc-quarter-table';
|
|
5856
5857
|
|
|
5857
5858
|
/**
|
|
5858
5859
|
* 获取季度对应的月份范围
|
|
@@ -5886,7 +5887,7 @@ const getQuarterRangeByMonth = value => {
|
|
|
5886
5887
|
}
|
|
5887
5888
|
};
|
|
5888
5889
|
const QuarterTable = /* @__PURE__ */ defineComponent({
|
|
5889
|
-
name: COMPONENT_NAME$
|
|
5890
|
+
name: COMPONENT_NAME$1j,
|
|
5890
5891
|
props: {
|
|
5891
5892
|
value: Array,
|
|
5892
5893
|
panelDate: Date,
|
|
@@ -6009,9 +6010,9 @@ const QuarterTable = /* @__PURE__ */ defineComponent({
|
|
|
6009
6010
|
|
|
6010
6011
|
/** @jsxImportSource vue */
|
|
6011
6012
|
|
|
6012
|
-
const COMPONENT_NAME$
|
|
6013
|
+
const COMPONENT_NAME$1i = 'vc-shortcuts-select';
|
|
6013
6014
|
const ShortcutsSelect = /* @__PURE__ */ defineComponent({
|
|
6014
|
-
name: COMPONENT_NAME$
|
|
6015
|
+
name: COMPONENT_NAME$1i,
|
|
6015
6016
|
props: {
|
|
6016
6017
|
panelDate: Date,
|
|
6017
6018
|
config: Array,
|
|
@@ -6051,9 +6052,9 @@ const ShortcutsSelect = /* @__PURE__ */ defineComponent({
|
|
|
6051
6052
|
|
|
6052
6053
|
/** @jsxImportSource vue */
|
|
6053
6054
|
|
|
6054
|
-
const COMPONENT_NAME$
|
|
6055
|
+
const COMPONENT_NAME$1h = 'vc-time-select';
|
|
6055
6056
|
const TimeSelect = /* @__PURE__ */ defineComponent({
|
|
6056
|
-
name: COMPONENT_NAME$
|
|
6057
|
+
name: COMPONENT_NAME$1h,
|
|
6057
6058
|
props: {
|
|
6058
6059
|
hours: {
|
|
6059
6060
|
type: [Number, String],
|
|
@@ -6332,9 +6333,9 @@ const TimeSelect = /* @__PURE__ */ defineComponent({
|
|
|
6332
6333
|
|
|
6333
6334
|
/** @jsxImportSource vue */
|
|
6334
6335
|
|
|
6335
|
-
const COMPONENT_NAME$
|
|
6336
|
+
const COMPONENT_NAME$1g = 'vc-year-table';
|
|
6336
6337
|
const YearTable = /* @__PURE__ */ defineComponent({
|
|
6337
|
-
name: COMPONENT_NAME$
|
|
6338
|
+
name: COMPONENT_NAME$1g,
|
|
6338
6339
|
props: {
|
|
6339
6340
|
value: Array,
|
|
6340
6341
|
panelDate: Date,
|
|
@@ -6457,9 +6458,9 @@ const getDateIsInRange = (value, type, leftPanelDate, rightPanelDate) => {
|
|
|
6457
6458
|
}
|
|
6458
6459
|
return true;
|
|
6459
6460
|
};
|
|
6460
|
-
const COMPONENT_NAME$
|
|
6461
|
+
const COMPONENT_NAME$1f = 'vc-date-range-panel';
|
|
6461
6462
|
const DateRangePanel = /* @__PURE__ */ defineComponent({
|
|
6462
|
-
name: COMPONENT_NAME$
|
|
6463
|
+
name: COMPONENT_NAME$1f,
|
|
6463
6464
|
props: {
|
|
6464
6465
|
...props$V,
|
|
6465
6466
|
confirm: {
|
|
@@ -6838,9 +6839,9 @@ const DateRangePanel = /* @__PURE__ */ defineComponent({
|
|
|
6838
6839
|
|
|
6839
6840
|
/** @jsxImportSource vue */
|
|
6840
6841
|
|
|
6841
|
-
const COMPONENT_NAME$
|
|
6842
|
+
const COMPONENT_NAME$1e = 'vc-date-panel';
|
|
6842
6843
|
const DatePanel = /* @__PURE__ */ defineComponent({
|
|
6843
|
-
name: COMPONENT_NAME$
|
|
6844
|
+
name: COMPONENT_NAME$1e,
|
|
6844
6845
|
props: {
|
|
6845
6846
|
...props$V,
|
|
6846
6847
|
type: String,
|
|
@@ -7048,9 +7049,9 @@ const isEqualYear$1 = value => {
|
|
|
7048
7049
|
const endYear = value[1].getFullYear();
|
|
7049
7050
|
return startYear === endYear;
|
|
7050
7051
|
};
|
|
7051
|
-
const COMPONENT_NAME$
|
|
7052
|
+
const COMPONENT_NAME$1d = 'vc-monthrange-panel';
|
|
7052
7053
|
const MonthRangePanel = /* @__PURE__ */ defineComponent({
|
|
7053
|
-
name: COMPONENT_NAME$
|
|
7054
|
+
name: COMPONENT_NAME$1d,
|
|
7054
7055
|
props: {
|
|
7055
7056
|
...props$V,
|
|
7056
7057
|
confirm: {
|
|
@@ -7225,9 +7226,9 @@ const isEqualYear = value => {
|
|
|
7225
7226
|
const endYear = value[1].getFullYear();
|
|
7226
7227
|
return startYear === endYear;
|
|
7227
7228
|
};
|
|
7228
|
-
const COMPONENT_NAME$
|
|
7229
|
+
const COMPONENT_NAME$1c = 'vc-quarterrange-panel';
|
|
7229
7230
|
const QuarterRangePanel = /* @__PURE__ */ defineComponent({
|
|
7230
|
-
name: COMPONENT_NAME$
|
|
7231
|
+
name: COMPONENT_NAME$1c,
|
|
7231
7232
|
props: {
|
|
7232
7233
|
...props$V,
|
|
7233
7234
|
confirm: {
|
|
@@ -7466,9 +7467,9 @@ const getComparedDate = (leftDate, rightDate) => {
|
|
|
7466
7467
|
seconds
|
|
7467
7468
|
};
|
|
7468
7469
|
};
|
|
7469
|
-
const COMPONENT_NAME$
|
|
7470
|
+
const COMPONENT_NAME$1b = 'vc-timerange-panel';
|
|
7470
7471
|
const TimeRangePanel = /* @__PURE__ */ defineComponent({
|
|
7471
|
-
name: COMPONENT_NAME$
|
|
7472
|
+
name: COMPONENT_NAME$1b,
|
|
7472
7473
|
props: props$U,
|
|
7473
7474
|
emits: ['pick', 'clear', 'ok'],
|
|
7474
7475
|
setup(props, {
|
|
@@ -7567,9 +7568,9 @@ const TimeRangePanel = /* @__PURE__ */ defineComponent({
|
|
|
7567
7568
|
|
|
7568
7569
|
/** @jsxImportSource vue */
|
|
7569
7570
|
|
|
7570
|
-
const COMPONENT_NAME$
|
|
7571
|
+
const COMPONENT_NAME$1a = 'vc-time-panel';
|
|
7571
7572
|
const TimePanel = /* @__PURE__ */ defineComponent({
|
|
7572
|
-
name: COMPONENT_NAME$
|
|
7573
|
+
name: COMPONENT_NAME$1a,
|
|
7573
7574
|
props: props$U,
|
|
7574
7575
|
emits: ['pick', 'clear', 'ok'],
|
|
7575
7576
|
setup(props, {
|
|
@@ -7624,6 +7625,7 @@ const TimePanel = /* @__PURE__ */ defineComponent({
|
|
|
7624
7625
|
|
|
7625
7626
|
/** @jsxImportSource vue */
|
|
7626
7627
|
|
|
7628
|
+
const COMPONENT_NAME$19 = 'vc-date-picker';
|
|
7627
7629
|
const getPanel$1 = type => {
|
|
7628
7630
|
if (['daterange', 'datetimerange'].includes(type)) {
|
|
7629
7631
|
return DateRangePanel;
|
|
@@ -7634,7 +7636,7 @@ const getPanel$1 = type => {
|
|
|
7634
7636
|
}
|
|
7635
7637
|
return DatePanel;
|
|
7636
7638
|
};
|
|
7637
|
-
const DatePicker = createPicker(props$10, () => {
|
|
7639
|
+
const DatePicker = createPicker(COMPONENT_NAME$19, props$10, () => {
|
|
7638
7640
|
const props = getCurrentInstance().props;
|
|
7639
7641
|
const icon = ref('date');
|
|
7640
7642
|
const panel = shallowRef({});
|
|
@@ -7667,9 +7669,9 @@ const props$T = {
|
|
|
7667
7669
|
|
|
7668
7670
|
/** @jsxImportSource vue */
|
|
7669
7671
|
|
|
7670
|
-
const COMPONENT_NAME$
|
|
7672
|
+
const COMPONENT_NAME$18 = 'vc-divider';
|
|
7671
7673
|
const Divider = /* @__PURE__ */ defineComponent({
|
|
7672
|
-
name: COMPONENT_NAME$
|
|
7674
|
+
name: COMPONENT_NAME$18,
|
|
7673
7675
|
props: props$T,
|
|
7674
7676
|
setup(props, {
|
|
7675
7677
|
slots
|
|
@@ -7824,7 +7826,7 @@ const props$Q = {
|
|
|
7824
7826
|
|
|
7825
7827
|
/** @jsxImportSource vue */
|
|
7826
7828
|
|
|
7827
|
-
const COMPONENT_NAME$
|
|
7829
|
+
const COMPONENT_NAME$17 = 'vc-scroller-track';
|
|
7828
7830
|
const BAR_MAP = {
|
|
7829
7831
|
vertical: {
|
|
7830
7832
|
scroll: 'scrollTop',
|
|
@@ -7844,12 +7846,14 @@ const BAR_MAP = {
|
|
|
7844
7846
|
}
|
|
7845
7847
|
};
|
|
7846
7848
|
const Track = /* @__PURE__ */ defineComponent({
|
|
7847
|
-
name: COMPONENT_NAME$
|
|
7849
|
+
name: COMPONENT_NAME$17,
|
|
7848
7850
|
props: props$S,
|
|
7849
7851
|
emits: ['change'],
|
|
7852
|
+
inheritAttrs: false,
|
|
7850
7853
|
setup(props, {
|
|
7851
7854
|
emit,
|
|
7852
|
-
expose
|
|
7855
|
+
expose,
|
|
7856
|
+
attrs
|
|
7853
7857
|
}) {
|
|
7854
7858
|
const instance = getCurrentInstance();
|
|
7855
7859
|
const track = ref();
|
|
@@ -7982,6 +7986,7 @@ const Track = /* @__PURE__ */ defineComponent({
|
|
|
7982
7986
|
isVisible.value = cursorDown.value;
|
|
7983
7987
|
};
|
|
7984
7988
|
const refreshThumb = () => raf(() => {
|
|
7989
|
+
if (!thumb.value) return;
|
|
7985
7990
|
thumb.value.style[$.prefixStyle('transform').camel] = `translate${barOptions.value.axis}(${thumbMove.value}px)`;
|
|
7986
7991
|
});
|
|
7987
7992
|
const refreshThrottleThumb = throttle(refreshThumb, 10);
|
|
@@ -8016,6 +8021,7 @@ const Track = /* @__PURE__ */ defineComponent({
|
|
|
8016
8021
|
default: () => [withDirectives(createVNode("div", {
|
|
8017
8022
|
"ref": track,
|
|
8018
8023
|
"class": ['is-' + barOptions.value.key, 'vc-scroller-track'],
|
|
8024
|
+
"style": attrs.style,
|
|
8019
8025
|
"onMousedown": handleClickTrack
|
|
8020
8026
|
}, [createVNode("div", {
|
|
8021
8027
|
"ref": thumb,
|
|
@@ -8030,9 +8036,9 @@ const Track = /* @__PURE__ */ defineComponent({
|
|
|
8030
8036
|
|
|
8031
8037
|
/** @jsxImportSource vue */
|
|
8032
8038
|
|
|
8033
|
-
const COMPONENT_NAME$
|
|
8039
|
+
const COMPONENT_NAME$16 = 'vc-scroller-bar';
|
|
8034
8040
|
const Bar = /* @__PURE__ */ defineComponent({
|
|
8035
|
-
name: COMPONENT_NAME$
|
|
8041
|
+
name: COMPONENT_NAME$16,
|
|
8036
8042
|
props: props$R,
|
|
8037
8043
|
emits: ['change'],
|
|
8038
8044
|
setup(props, {
|
|
@@ -8247,7 +8253,7 @@ const useScroller = (expose) => {
|
|
|
8247
8253
|
|
|
8248
8254
|
/** @jsxImportSource vue */
|
|
8249
8255
|
|
|
8250
|
-
const COMPONENT_NAME$
|
|
8256
|
+
const COMPONENT_NAME$15 = 'vc-scroller';
|
|
8251
8257
|
|
|
8252
8258
|
/**
|
|
8253
8259
|
* 作为备选方案,目前推荐使用ScrollerWheel
|
|
@@ -8258,7 +8264,7 @@ const COMPONENT_NAME$13 = 'vc-scroller';
|
|
|
8258
8264
|
* 2. 增加了一层嵌套
|
|
8259
8265
|
*/
|
|
8260
8266
|
const Scroller = /* @__PURE__ */ defineComponent({
|
|
8261
|
-
name: COMPONENT_NAME$
|
|
8267
|
+
name: COMPONENT_NAME$15,
|
|
8262
8268
|
props: props$Q,
|
|
8263
8269
|
emits: ['scroll'],
|
|
8264
8270
|
setup(props, {
|
|
@@ -8319,7 +8325,7 @@ const Scroller = /* @__PURE__ */ defineComponent({
|
|
|
8319
8325
|
|
|
8320
8326
|
/** @jsxImportSource vue */
|
|
8321
8327
|
|
|
8322
|
-
const COMPONENT_NAME$
|
|
8328
|
+
const COMPONENT_NAME$14 = 'vc-scroller-wheel';
|
|
8323
8329
|
|
|
8324
8330
|
/**
|
|
8325
8331
|
* 为减少一层嵌套,为去除滚动bar的抖动,使用wheel模拟
|
|
@@ -8341,8 +8347,13 @@ const COMPONENT_NAME$12 = 'vc-scroller-wheel';
|
|
|
8341
8347
|
* 设置scrollTop不会reflow和repaint,不需要考虑transfrom来改变content(transform也只在draw完成)
|
|
8342
8348
|
*/
|
|
8343
8349
|
const ScrollerWheel = /* @__PURE__ */ defineComponent({
|
|
8344
|
-
name: COMPONENT_NAME$
|
|
8345
|
-
props: props$Q,
|
|
8350
|
+
name: COMPONENT_NAME$14,
|
|
8351
|
+
props: Object.assign(props$Q, {
|
|
8352
|
+
stopPropagation: {
|
|
8353
|
+
type: Boolean,
|
|
8354
|
+
default: true
|
|
8355
|
+
}
|
|
8356
|
+
}),
|
|
8346
8357
|
emits: ['scroll'],
|
|
8347
8358
|
setup(props, {
|
|
8348
8359
|
slots,
|
|
@@ -8402,7 +8413,10 @@ const ScrollerWheel = /* @__PURE__ */ defineComponent({
|
|
|
8402
8413
|
onMounted(() => {
|
|
8403
8414
|
wheel = new Wheel(wrapper.value, {
|
|
8404
8415
|
shouldWheelX,
|
|
8405
|
-
shouldWheelY
|
|
8416
|
+
shouldWheelY,
|
|
8417
|
+
stopPropagation: () => {
|
|
8418
|
+
return props.stopPropagation;
|
|
8419
|
+
}
|
|
8406
8420
|
});
|
|
8407
8421
|
wheel.on(handleWheel);
|
|
8408
8422
|
});
|
|
@@ -8512,9 +8526,9 @@ const props$P = {
|
|
|
8512
8526
|
|
|
8513
8527
|
/** @jsxImportSource vue */
|
|
8514
8528
|
|
|
8515
|
-
const COMPONENT_NAME$
|
|
8529
|
+
const COMPONENT_NAME$13 = 'vc-drawer';
|
|
8516
8530
|
const DrawerView = /* @__PURE__ */ defineComponent({
|
|
8517
|
-
name: COMPONENT_NAME$
|
|
8531
|
+
name: COMPONENT_NAME$13,
|
|
8518
8532
|
props: props$P,
|
|
8519
8533
|
emits: ['close', 'update:modelValue', 'visible-change'],
|
|
8520
8534
|
setup(props, {
|
|
@@ -8687,9 +8701,9 @@ const props$O = {
|
|
|
8687
8701
|
|
|
8688
8702
|
/** @jsxImportSource vue */
|
|
8689
8703
|
|
|
8690
|
-
const COMPONENT_NAME$
|
|
8704
|
+
const COMPONENT_NAME$12 = 'vc-dropdown';
|
|
8691
8705
|
const Dropdown = /* @__PURE__ */ defineComponent({
|
|
8692
|
-
name: COMPONENT_NAME$
|
|
8706
|
+
name: COMPONENT_NAME$12,
|
|
8693
8707
|
props: props$O,
|
|
8694
8708
|
setup(props, {
|
|
8695
8709
|
slots
|
|
@@ -8713,9 +8727,9 @@ const props$N = {
|
|
|
8713
8727
|
|
|
8714
8728
|
/** @jsxImportSource vue */
|
|
8715
8729
|
|
|
8716
|
-
const COMPONENT_NAME
|
|
8730
|
+
const COMPONENT_NAME$11 = 'vc-editor';
|
|
8717
8731
|
const Editor = /* @__PURE__ */ defineComponent({
|
|
8718
|
-
name: COMPONENT_NAME
|
|
8732
|
+
name: COMPONENT_NAME$11,
|
|
8719
8733
|
props: props$N,
|
|
8720
8734
|
setup(props, {
|
|
8721
8735
|
slots
|
|
@@ -8730,7 +8744,7 @@ const Editor = /* @__PURE__ */ defineComponent({
|
|
|
8730
8744
|
|
|
8731
8745
|
const MEditor = Editor;
|
|
8732
8746
|
|
|
8733
|
-
const MExpand = Expand;
|
|
8747
|
+
const MExpand = Expand$1;
|
|
8734
8748
|
|
|
8735
8749
|
const props$M = {
|
|
8736
8750
|
tag: {
|
|
@@ -8859,9 +8873,9 @@ const useForm = (expose, options = {}) => {
|
|
|
8859
8873
|
});
|
|
8860
8874
|
};
|
|
8861
8875
|
|
|
8862
|
-
const COMPONENT_NAME$
|
|
8876
|
+
const COMPONENT_NAME$10 = "vc-form";
|
|
8863
8877
|
const Form = defineComponent({
|
|
8864
|
-
name: COMPONENT_NAME$
|
|
8878
|
+
name: COMPONENT_NAME$10,
|
|
8865
8879
|
props: props$M,
|
|
8866
8880
|
setup(props, { slots, expose }) {
|
|
8867
8881
|
useForm(expose);
|
|
@@ -9181,9 +9195,9 @@ const useFormItem = (expose) => {
|
|
|
9181
9195
|
|
|
9182
9196
|
/** @jsxImportSource vue */
|
|
9183
9197
|
|
|
9184
|
-
const COMPONENT_NAME
|
|
9198
|
+
const COMPONENT_NAME$$ = 'vc-form-item';
|
|
9185
9199
|
const FormItem = /* @__PURE__ */ defineComponent({
|
|
9186
|
-
name: COMPONENT_NAME
|
|
9200
|
+
name: COMPONENT_NAME$$,
|
|
9187
9201
|
props: props$L,
|
|
9188
9202
|
setup(props, {
|
|
9189
9203
|
slots,
|
|
@@ -9248,9 +9262,9 @@ const props$K = {
|
|
|
9248
9262
|
}
|
|
9249
9263
|
};
|
|
9250
9264
|
|
|
9251
|
-
const COMPONENT_NAME$
|
|
9265
|
+
const COMPONENT_NAME$_ = "vcm-form";
|
|
9252
9266
|
const MForm = defineComponent({
|
|
9253
|
-
name: COMPONENT_NAME$
|
|
9267
|
+
name: COMPONENT_NAME$_,
|
|
9254
9268
|
props: props$K,
|
|
9255
9269
|
setup(props, { slots, expose }) {
|
|
9256
9270
|
useForm(expose, {
|
|
@@ -9281,9 +9295,9 @@ const props$J = {
|
|
|
9281
9295
|
|
|
9282
9296
|
/** @jsxImportSource vue */
|
|
9283
9297
|
|
|
9284
|
-
const COMPONENT_NAME$
|
|
9298
|
+
const COMPONENT_NAME$Z = 'vcm-form-item';
|
|
9285
9299
|
const MFormItem = /* @__PURE__ */ defineComponent({
|
|
9286
|
-
name: COMPONENT_NAME$
|
|
9300
|
+
name: COMPONENT_NAME$Z,
|
|
9287
9301
|
props: props$J,
|
|
9288
9302
|
setup(props, {
|
|
9289
9303
|
slots,
|
|
@@ -9337,9 +9351,9 @@ const MFormItem = /* @__PURE__ */ defineComponent({
|
|
|
9337
9351
|
}
|
|
9338
9352
|
});
|
|
9339
9353
|
|
|
9340
|
-
const COMPONENT_NAME$
|
|
9354
|
+
const COMPONENT_NAME$Y = "vc-fragment";
|
|
9341
9355
|
const Fragment = defineComponent({
|
|
9342
|
-
name: COMPONENT_NAME$
|
|
9356
|
+
name: COMPONENT_NAME$Y,
|
|
9343
9357
|
setup(_, { slots }) {
|
|
9344
9358
|
return () => h(Fragment$1, slots.default?.());
|
|
9345
9359
|
}
|
|
@@ -9356,9 +9370,9 @@ const props$I = {
|
|
|
9356
9370
|
|
|
9357
9371
|
/** @jsxImportSource vue */
|
|
9358
9372
|
|
|
9359
|
-
const COMPONENT_NAME$
|
|
9373
|
+
const COMPONENT_NAME$X = 'vc-html-to-image';
|
|
9360
9374
|
const HTMLToImage = /* @__PURE__ */ defineComponent({
|
|
9361
|
-
name: COMPONENT_NAME$
|
|
9375
|
+
name: COMPONENT_NAME$X,
|
|
9362
9376
|
props: props$I,
|
|
9363
9377
|
setup(props, {
|
|
9364
9378
|
slots
|
|
@@ -9434,7 +9448,7 @@ const IMGStore$1 = new IMGStore();
|
|
|
9434
9448
|
|
|
9435
9449
|
/** @jsxImportSource vue */
|
|
9436
9450
|
|
|
9437
|
-
const COMPONENT_NAME$
|
|
9451
|
+
const COMPONENT_NAME$W = 'vc-image';
|
|
9438
9452
|
let isSupportObjectFit = false;
|
|
9439
9453
|
window.addEventListener('DOMContentLoaded', () => {
|
|
9440
9454
|
isSupportObjectFit = !IS_SERVER$1 && document.documentElement.style.objectFit !== undefined;
|
|
@@ -9447,7 +9461,7 @@ const ObjectFit = {
|
|
|
9447
9461
|
SCALE_DOWN: 'scale-down'
|
|
9448
9462
|
};
|
|
9449
9463
|
const Image = /* @__PURE__ */ defineComponent({
|
|
9450
|
-
name: COMPONENT_NAME$
|
|
9464
|
+
name: COMPONENT_NAME$W,
|
|
9451
9465
|
inheritAttrs: false,
|
|
9452
9466
|
props: props$H,
|
|
9453
9467
|
setup(props, {
|
|
@@ -9652,9 +9666,9 @@ const props$G = {
|
|
|
9652
9666
|
|
|
9653
9667
|
/** @jsxImportSource vue */
|
|
9654
9668
|
|
|
9655
|
-
const COMPONENT_NAME$
|
|
9669
|
+
const COMPONENT_NAME$V = 'vc-image-crop';
|
|
9656
9670
|
const ImageCrop = /* @__PURE__ */ defineComponent({
|
|
9657
|
-
name: COMPONENT_NAME$
|
|
9671
|
+
name: COMPONENT_NAME$V,
|
|
9658
9672
|
props: props$G,
|
|
9659
9673
|
setup(props, {
|
|
9660
9674
|
slots
|
|
@@ -9678,9 +9692,9 @@ const props$F = {
|
|
|
9678
9692
|
|
|
9679
9693
|
/** @jsxImportSource vue */
|
|
9680
9694
|
|
|
9681
|
-
const COMPONENT_NAME$
|
|
9695
|
+
const COMPONENT_NAME$U = 'vc-image-preview';
|
|
9682
9696
|
const ImagePreview = /* @__PURE__ */ defineComponent({
|
|
9683
|
-
name: COMPONENT_NAME$
|
|
9697
|
+
name: COMPONENT_NAME$U,
|
|
9684
9698
|
props: props$F,
|
|
9685
9699
|
setup(props, {
|
|
9686
9700
|
slots
|
|
@@ -9704,9 +9718,9 @@ const props$E = {
|
|
|
9704
9718
|
|
|
9705
9719
|
/** @jsxImportSource vue */
|
|
9706
9720
|
|
|
9707
|
-
const COMPONENT_NAME$
|
|
9721
|
+
const COMPONENT_NAME$T = 'vc-image-processing';
|
|
9708
9722
|
const ImageProcessing = /* @__PURE__ */ defineComponent({
|
|
9709
|
-
name: COMPONENT_NAME$
|
|
9723
|
+
name: COMPONENT_NAME$T,
|
|
9710
9724
|
props: props$E,
|
|
9711
9725
|
setup(props, {
|
|
9712
9726
|
slots
|
|
@@ -9723,9 +9737,9 @@ const MImageProcessing = ImageProcessing;
|
|
|
9723
9737
|
|
|
9724
9738
|
/** @jsxImportSource vue */
|
|
9725
9739
|
|
|
9726
|
-
const COMPONENT_NAME$
|
|
9740
|
+
const COMPONENT_NAME$S = 'vcm-input';
|
|
9727
9741
|
const MInput = /* @__PURE__ */ defineComponent({
|
|
9728
|
-
name: COMPONENT_NAME$
|
|
9742
|
+
name: COMPONENT_NAME$S,
|
|
9729
9743
|
inheritAttrs: false,
|
|
9730
9744
|
props: {
|
|
9731
9745
|
...props$$,
|
|
@@ -9814,9 +9828,9 @@ const MInput = /* @__PURE__ */ defineComponent({
|
|
|
9814
9828
|
|
|
9815
9829
|
/** @jsxImportSource vue */
|
|
9816
9830
|
|
|
9817
|
-
const COMPONENT_NAME$
|
|
9831
|
+
const COMPONENT_NAME$R = 'vcm-input-number';
|
|
9818
9832
|
const MInputNumber = /* @__PURE__ */ defineComponent({
|
|
9819
|
-
name: COMPONENT_NAME$
|
|
9833
|
+
name: COMPONENT_NAME$R,
|
|
9820
9834
|
props: props$X,
|
|
9821
9835
|
inheritAttrs: false,
|
|
9822
9836
|
setup(props, {
|
|
@@ -9865,9 +9879,9 @@ const MInputNumber = /* @__PURE__ */ defineComponent({
|
|
|
9865
9879
|
|
|
9866
9880
|
/** @jsxImportSource vue */
|
|
9867
9881
|
|
|
9868
|
-
const COMPONENT_NAME$
|
|
9882
|
+
const COMPONENT_NAME$Q = 'vcm-input-search';
|
|
9869
9883
|
const MInputSearch = /* @__PURE__ */ defineComponent({
|
|
9870
|
-
name: COMPONENT_NAME$
|
|
9884
|
+
name: COMPONENT_NAME$Q,
|
|
9871
9885
|
props: {
|
|
9872
9886
|
...props$W,
|
|
9873
9887
|
cancelText: {
|
|
@@ -9944,9 +9958,9 @@ const props$D = {
|
|
|
9944
9958
|
}
|
|
9945
9959
|
};
|
|
9946
9960
|
|
|
9947
|
-
const COMPONENT_NAME$
|
|
9961
|
+
const COMPONENT_NAME$P = "vcm-list";
|
|
9948
9962
|
const MList = defineComponent({
|
|
9949
|
-
name: COMPONENT_NAME$
|
|
9963
|
+
name: COMPONENT_NAME$P,
|
|
9950
9964
|
props: props$D,
|
|
9951
9965
|
setup(props, { slots }) {
|
|
9952
9966
|
provide("vc-list", { props });
|
|
@@ -10001,10 +10015,10 @@ const props$C = {
|
|
|
10001
10015
|
|
|
10002
10016
|
/** @jsxImportSource vue */
|
|
10003
10017
|
|
|
10004
|
-
const COMPONENT_NAME$
|
|
10018
|
+
const COMPONENT_NAME$O = 'vcm-list-item';
|
|
10005
10019
|
const HTTP_REGEX = /[a-zA-z]+:\/\/[^\s]*/;
|
|
10006
10020
|
const MListItem = /* @__PURE__ */ defineComponent({
|
|
10007
|
-
name: COMPONENT_NAME$
|
|
10021
|
+
name: COMPONENT_NAME$O,
|
|
10008
10022
|
props: props$C,
|
|
10009
10023
|
emits: ['click'],
|
|
10010
10024
|
setup(props, {
|
|
@@ -10098,11 +10112,11 @@ const props$B = {
|
|
|
10098
10112
|
|
|
10099
10113
|
/** @jsxImportSource vue */
|
|
10100
10114
|
|
|
10101
|
-
const COMPONENT_NAME$
|
|
10115
|
+
const COMPONENT_NAME$N = 'vc-marquee';
|
|
10102
10116
|
const ANIMATION = prefixStyle('animation').camel;
|
|
10103
10117
|
const TRANSFORM_KEBAB = prefixStyle('transform').kebab;
|
|
10104
10118
|
const Marquee = /* @__PURE__ */ defineComponent({
|
|
10105
|
-
name: COMPONENT_NAME$
|
|
10119
|
+
name: COMPONENT_NAME$N,
|
|
10106
10120
|
props: props$B,
|
|
10107
10121
|
setup(props, {
|
|
10108
10122
|
slots
|
|
@@ -10166,9 +10180,9 @@ const props$A = {
|
|
|
10166
10180
|
}
|
|
10167
10181
|
};
|
|
10168
10182
|
|
|
10169
|
-
const COMPONENT_NAME$
|
|
10183
|
+
const COMPONENT_NAME$M = "vc-resizer";
|
|
10170
10184
|
const Resizer = defineComponent({
|
|
10171
|
-
name: COMPONENT_NAME$
|
|
10185
|
+
name: COMPONENT_NAME$M,
|
|
10172
10186
|
props: props$A,
|
|
10173
10187
|
emit: ["resize", "change"],
|
|
10174
10188
|
setup(props, { emit, slots, expose }) {
|
|
@@ -10311,10 +10325,10 @@ const props$z = {
|
|
|
10311
10325
|
|
|
10312
10326
|
/** @jsxImportSource vue */
|
|
10313
10327
|
|
|
10314
|
-
const COMPONENT_NAME$
|
|
10328
|
+
const COMPONENT_NAME$L = 'vc-modal';
|
|
10315
10329
|
let zIndexNumber = 1002;
|
|
10316
10330
|
const ModalView = /* @__PURE__ */ defineComponent({
|
|
10317
|
-
name: COMPONENT_NAME$
|
|
10331
|
+
name: COMPONENT_NAME$L,
|
|
10318
10332
|
emits: ['update:modelValue', 'close', 'portal-fulfilled', 'visible-change', 'ok', 'cancel'],
|
|
10319
10333
|
props: props$z,
|
|
10320
10334
|
setup(props, {
|
|
@@ -10740,9 +10754,9 @@ const props$y = {
|
|
|
10740
10754
|
|
|
10741
10755
|
/** @jsxImportSource vue */
|
|
10742
10756
|
|
|
10743
|
-
const COMPONENT_NAME$
|
|
10757
|
+
const COMPONENT_NAME$K = 'vc-modal';
|
|
10744
10758
|
const MModalView = /* @__PURE__ */ defineComponent({
|
|
10745
|
-
name: COMPONENT_NAME$
|
|
10759
|
+
name: COMPONENT_NAME$K,
|
|
10746
10760
|
emits: ['update:modelValue', 'portal-fulfilled', 'close', 'ok', 'cancel'],
|
|
10747
10761
|
props: props$y,
|
|
10748
10762
|
setup(props, {
|
|
@@ -10954,9 +10968,9 @@ const props$x = {
|
|
|
10954
10968
|
|
|
10955
10969
|
/** @jsxImportSource vue */
|
|
10956
10970
|
|
|
10957
|
-
const COMPONENT_NAME$
|
|
10971
|
+
const COMPONENT_NAME$J = 'vc-notice';
|
|
10958
10972
|
const NoticeView = /* @__PURE__ */ defineComponent({
|
|
10959
|
-
name: COMPONENT_NAME$
|
|
10973
|
+
name: COMPONENT_NAME$J,
|
|
10960
10974
|
props: props$x,
|
|
10961
10975
|
emits: ['portal-fulfilled', 'close', 'before-close'],
|
|
10962
10976
|
setup(props, {
|
|
@@ -11129,9 +11143,9 @@ const props$w = {
|
|
|
11129
11143
|
|
|
11130
11144
|
/** @jsxImportSource vue */
|
|
11131
11145
|
|
|
11132
|
-
const COMPONENT_NAME$
|
|
11146
|
+
const COMPONENT_NAME$I = 'vc-option';
|
|
11133
11147
|
const Option$1 = /* @__PURE__ */ defineComponent({
|
|
11134
|
-
name: COMPONENT_NAME$
|
|
11148
|
+
name: COMPONENT_NAME$I,
|
|
11135
11149
|
props: props$w,
|
|
11136
11150
|
setup(props, {
|
|
11137
11151
|
slots
|
|
@@ -11198,12 +11212,12 @@ const getLabel = (data, v) => {
|
|
|
11198
11212
|
const { label = "" } = data.find((i) => i.value == v) || {};
|
|
11199
11213
|
return label;
|
|
11200
11214
|
};
|
|
11201
|
-
const flattenData = (data, options = {}) => {
|
|
11215
|
+
const flattenData$1 = (data, options = {}) => {
|
|
11202
11216
|
let result = [];
|
|
11203
11217
|
data.forEach((item) => {
|
|
11204
11218
|
if (item.children) {
|
|
11205
11219
|
const { children, ...rest } = item;
|
|
11206
|
-
const items = flattenData(children, options);
|
|
11220
|
+
const items = flattenData$1(children, options);
|
|
11207
11221
|
result = result.concat(
|
|
11208
11222
|
options.parent ? [options.cascader ? item : rest].concat(items) : items
|
|
11209
11223
|
);
|
|
@@ -11244,9 +11258,9 @@ const props$u = {
|
|
|
11244
11258
|
|
|
11245
11259
|
/** @jsxImportSource vue */
|
|
11246
11260
|
|
|
11247
|
-
const COMPONENT_NAME$
|
|
11261
|
+
const COMPONENT_NAME$H = 'vc-tag';
|
|
11248
11262
|
const Tag = /* @__PURE__ */ defineComponent({
|
|
11249
|
-
name: COMPONENT_NAME$
|
|
11263
|
+
name: COMPONENT_NAME$H,
|
|
11250
11264
|
props: props$u,
|
|
11251
11265
|
emits: ['close', 'change'],
|
|
11252
11266
|
setup(props, {
|
|
@@ -11315,9 +11329,9 @@ const props$t = {
|
|
|
11315
11329
|
|
|
11316
11330
|
/** @jsxImportSource vue */
|
|
11317
11331
|
|
|
11318
|
-
const COMPONENT_NAME$
|
|
11332
|
+
const COMPONENT_NAME$G = 'vc-select-option';
|
|
11319
11333
|
const Option = /* @__PURE__ */ defineComponent({
|
|
11320
|
-
name: COMPONENT_NAME$
|
|
11334
|
+
name: COMPONENT_NAME$G,
|
|
11321
11335
|
props: props$t,
|
|
11322
11336
|
setup(props, {
|
|
11323
11337
|
slots
|
|
@@ -11390,9 +11404,9 @@ const props$s = {
|
|
|
11390
11404
|
|
|
11391
11405
|
/** @jsxImportSource vue */
|
|
11392
11406
|
|
|
11393
|
-
const COMPONENT_NAME$
|
|
11407
|
+
const COMPONENT_NAME$F = 'vc-select-option-group';
|
|
11394
11408
|
const OptionGroup = /* @__PURE__ */ defineComponent({
|
|
11395
|
-
name: COMPONENT_NAME$
|
|
11409
|
+
name: COMPONENT_NAME$F,
|
|
11396
11410
|
props: props$s,
|
|
11397
11411
|
setup(props, {
|
|
11398
11412
|
slots
|
|
@@ -11490,9 +11504,9 @@ const props$r = {
|
|
|
11490
11504
|
function _isSlot$1(s) {
|
|
11491
11505
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
11492
11506
|
}
|
|
11493
|
-
const COMPONENT_NAME$
|
|
11507
|
+
const COMPONENT_NAME$E = 'vc-select';
|
|
11494
11508
|
const Select = /* @__PURE__ */ defineComponent({
|
|
11495
|
-
name: COMPONENT_NAME$
|
|
11509
|
+
name: COMPONENT_NAME$E,
|
|
11496
11510
|
props: props$r,
|
|
11497
11511
|
emits: ['ready', 'close', 'visible-change', 'clear', 'change', 'update:modelValue'],
|
|
11498
11512
|
setup(props, {
|
|
@@ -11513,7 +11527,7 @@ const Select = /* @__PURE__ */ defineComponent({
|
|
|
11513
11527
|
const searchRegex = ref(new RegExp(''));
|
|
11514
11528
|
const currentValue = ref([]);
|
|
11515
11529
|
const source = computed(() => {
|
|
11516
|
-
return flattenData(props.data, {
|
|
11530
|
+
return flattenData$1(props.data, {
|
|
11517
11531
|
parent: true,
|
|
11518
11532
|
cascader: true
|
|
11519
11533
|
});
|
|
@@ -11736,9 +11750,9 @@ const Select = /* @__PURE__ */ defineComponent({
|
|
|
11736
11750
|
|
|
11737
11751
|
/** @jsxImportSource vue */
|
|
11738
11752
|
|
|
11739
|
-
const COMPONENT_NAME$
|
|
11753
|
+
const COMPONENT_NAME$D = 'vc-pagination';
|
|
11740
11754
|
const Pagination = /* @__PURE__ */ defineComponent({
|
|
11741
|
-
name: COMPONENT_NAME$
|
|
11755
|
+
name: COMPONENT_NAME$D,
|
|
11742
11756
|
props: props$v,
|
|
11743
11757
|
emits: ['update:current', 'change', 'page-size-change'],
|
|
11744
11758
|
setup(props, {
|
|
@@ -11936,9 +11950,9 @@ const props$q = {
|
|
|
11936
11950
|
|
|
11937
11951
|
/** @jsxImportSource vue */
|
|
11938
11952
|
|
|
11939
|
-
const COMPONENT_NAME$
|
|
11953
|
+
const COMPONENT_NAME$C = 'vc-picker';
|
|
11940
11954
|
const Picker = /* @__PURE__ */ defineComponent({
|
|
11941
|
-
name: COMPONENT_NAME$
|
|
11955
|
+
name: COMPONENT_NAME$C,
|
|
11942
11956
|
props: props$q,
|
|
11943
11957
|
setup(props, {
|
|
11944
11958
|
slots
|
|
@@ -11962,9 +11976,9 @@ const props$p = {
|
|
|
11962
11976
|
|
|
11963
11977
|
/** @jsxImportSource vue */
|
|
11964
11978
|
|
|
11965
|
-
const COMPONENT_NAME$
|
|
11979
|
+
const COMPONENT_NAME$B = 'vc-popconfirm';
|
|
11966
11980
|
const Popconfirm = /* @__PURE__ */ defineComponent({
|
|
11967
|
-
name: COMPONENT_NAME$
|
|
11981
|
+
name: COMPONENT_NAME$B,
|
|
11968
11982
|
props: props$p,
|
|
11969
11983
|
setup(props, {
|
|
11970
11984
|
slots
|
|
@@ -11990,9 +12004,9 @@ const props$o = {
|
|
|
11990
12004
|
|
|
11991
12005
|
/** @jsxImportSource vue */
|
|
11992
12006
|
|
|
11993
|
-
const COMPONENT_NAME$
|
|
12007
|
+
const COMPONENT_NAME$A = 'vc-popup';
|
|
11994
12008
|
const Popup = /* @__PURE__ */ defineComponent({
|
|
11995
|
-
name: COMPONENT_NAME$
|
|
12009
|
+
name: COMPONENT_NAME$A,
|
|
11996
12010
|
props: props$o,
|
|
11997
12011
|
setup(props, {
|
|
11998
12012
|
slots
|
|
@@ -12019,9 +12033,9 @@ const props$n = {
|
|
|
12019
12033
|
|
|
12020
12034
|
/** @jsxImportSource vue */
|
|
12021
12035
|
|
|
12022
|
-
const COMPONENT_NAME$
|
|
12036
|
+
const COMPONENT_NAME$z = 'vc-print';
|
|
12023
12037
|
const Print = /* @__PURE__ */ defineComponent({
|
|
12024
|
-
name: COMPONENT_NAME$
|
|
12038
|
+
name: COMPONENT_NAME$z,
|
|
12025
12039
|
props: props$n,
|
|
12026
12040
|
setup(props, {
|
|
12027
12041
|
expose,
|
|
@@ -12117,9 +12131,9 @@ const props$m = {
|
|
|
12117
12131
|
|
|
12118
12132
|
/** @jsxImportSource vue */
|
|
12119
12133
|
|
|
12120
|
-
const COMPONENT_NAME$
|
|
12134
|
+
const COMPONENT_NAME$y = 'vc-progress-circle';
|
|
12121
12135
|
const Circle = /* @__PURE__ */ defineComponent({
|
|
12122
|
-
name: COMPONENT_NAME$
|
|
12136
|
+
name: COMPONENT_NAME$y,
|
|
12123
12137
|
props: props$m,
|
|
12124
12138
|
setup(props, {
|
|
12125
12139
|
slots
|
|
@@ -12176,9 +12190,9 @@ const Circle = /* @__PURE__ */ defineComponent({
|
|
|
12176
12190
|
|
|
12177
12191
|
/** @jsxImportSource vue */
|
|
12178
12192
|
|
|
12179
|
-
const COMPONENT_NAME$
|
|
12193
|
+
const COMPONENT_NAME$x = 'vc-progress-line';
|
|
12180
12194
|
const Line = /* @__PURE__ */ defineComponent({
|
|
12181
|
-
name: COMPONENT_NAME$
|
|
12195
|
+
name: COMPONENT_NAME$x,
|
|
12182
12196
|
props: props$m,
|
|
12183
12197
|
setup(props) {
|
|
12184
12198
|
const colorStyle = computed(() => {
|
|
@@ -12222,9 +12236,9 @@ const Line = /* @__PURE__ */ defineComponent({
|
|
|
12222
12236
|
function _isSlot(s) {
|
|
12223
12237
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
12224
12238
|
}
|
|
12225
|
-
const COMPONENT_NAME$
|
|
12239
|
+
const COMPONENT_NAME$w = 'vc-progress';
|
|
12226
12240
|
const Progress = /* @__PURE__ */ defineComponent({
|
|
12227
|
-
name: COMPONENT_NAME$
|
|
12241
|
+
name: COMPONENT_NAME$w,
|
|
12228
12242
|
props: props$m,
|
|
12229
12243
|
setup(props, {
|
|
12230
12244
|
slots
|
|
@@ -12376,9 +12390,9 @@ const useRadio = () => {
|
|
|
12376
12390
|
|
|
12377
12391
|
/** @jsxImportSource vue */
|
|
12378
12392
|
|
|
12379
|
-
const COMPONENT_NAME$
|
|
12393
|
+
const COMPONENT_NAME$v = 'vc-radio';
|
|
12380
12394
|
const Radio = /* @__PURE__ */ defineComponent({
|
|
12381
|
-
name: COMPONENT_NAME$
|
|
12395
|
+
name: COMPONENT_NAME$v,
|
|
12382
12396
|
props: props$l,
|
|
12383
12397
|
emits: ['update:modelValue', 'change'],
|
|
12384
12398
|
setup(props, {
|
|
@@ -12489,9 +12503,9 @@ const useRadioGroup = () => {
|
|
|
12489
12503
|
|
|
12490
12504
|
/** @jsxImportSource vue */
|
|
12491
12505
|
|
|
12492
|
-
const COMPONENT_NAME$
|
|
12506
|
+
const COMPONENT_NAME$u = 'vc-radio-group';
|
|
12493
12507
|
const RadioGroup = /* @__PURE__ */ defineComponent({
|
|
12494
|
-
name: COMPONENT_NAME$
|
|
12508
|
+
name: COMPONENT_NAME$u,
|
|
12495
12509
|
props: props$k,
|
|
12496
12510
|
emits: ['update:modelValue', 'change'],
|
|
12497
12511
|
setup(props, {
|
|
@@ -12513,9 +12527,9 @@ const RadioGroup = /* @__PURE__ */ defineComponent({
|
|
|
12513
12527
|
|
|
12514
12528
|
/** @jsxImportSource vue */
|
|
12515
12529
|
|
|
12516
|
-
const COMPONENT_NAME$
|
|
12530
|
+
const COMPONENT_NAME$t = 'vcm-radio';
|
|
12517
12531
|
const MRadio = /* @__PURE__ */ defineComponent({
|
|
12518
|
-
name: COMPONENT_NAME$
|
|
12532
|
+
name: COMPONENT_NAME$t,
|
|
12519
12533
|
props: props$l,
|
|
12520
12534
|
emits: ['update:modelValue', 'change'],
|
|
12521
12535
|
setup(props, {
|
|
@@ -12556,9 +12570,9 @@ const MRadio = /* @__PURE__ */ defineComponent({
|
|
|
12556
12570
|
|
|
12557
12571
|
/** @jsxImportSource vue */
|
|
12558
12572
|
|
|
12559
|
-
const COMPONENT_NAME$
|
|
12573
|
+
const COMPONENT_NAME$s = 'vcm-radio-group';
|
|
12560
12574
|
const MRadioGroup = /* @__PURE__ */ defineComponent({
|
|
12561
|
-
name: COMPONENT_NAME$
|
|
12575
|
+
name: COMPONENT_NAME$s,
|
|
12562
12576
|
props: props$k,
|
|
12563
12577
|
emits: ['update:modelValue', 'change'],
|
|
12564
12578
|
setup(props, {
|
|
@@ -12587,9 +12601,9 @@ const props$j = {
|
|
|
12587
12601
|
|
|
12588
12602
|
/** @jsxImportSource vue */
|
|
12589
12603
|
|
|
12590
|
-
const COMPONENT_NAME$
|
|
12604
|
+
const COMPONENT_NAME$r = 'vc-rate';
|
|
12591
12605
|
const Rate = /* @__PURE__ */ defineComponent({
|
|
12592
|
-
name: COMPONENT_NAME$
|
|
12606
|
+
name: COMPONENT_NAME$r,
|
|
12593
12607
|
props: props$j,
|
|
12594
12608
|
setup(props, {
|
|
12595
12609
|
slots
|
|
@@ -12657,9 +12671,9 @@ const props$i = {
|
|
|
12657
12671
|
|
|
12658
12672
|
/** @jsxImportSource vue */
|
|
12659
12673
|
|
|
12660
|
-
const COMPONENT_NAME$
|
|
12674
|
+
const COMPONENT_NAME$q = 'vc-recycle-list-scroll-state';
|
|
12661
12675
|
const ScrollState = /* @__PURE__ */ defineComponent({
|
|
12662
|
-
name: COMPONENT_NAME$
|
|
12676
|
+
name: COMPONENT_NAME$q,
|
|
12663
12677
|
setup(_, {
|
|
12664
12678
|
slots
|
|
12665
12679
|
}) {
|
|
@@ -12789,12 +12803,12 @@ const useDirectionKeys = () => {
|
|
|
12789
12803
|
|
|
12790
12804
|
/** @jsxImportSource vue */
|
|
12791
12805
|
|
|
12792
|
-
const COMPONENT_NAME$
|
|
12806
|
+
const COMPONENT_NAME$p = 'vc-recycle-list-container';
|
|
12793
12807
|
|
|
12794
12808
|
// TODO: 抽离
|
|
12795
12809
|
const transformKey = $.prefixStyle('transform').camel;
|
|
12796
12810
|
const Container = /* @__PURE__ */ defineComponent({
|
|
12797
|
-
name: COMPONENT_NAME$
|
|
12811
|
+
name: COMPONENT_NAME$p,
|
|
12798
12812
|
props: props$h,
|
|
12799
12813
|
emits: ['refresh'],
|
|
12800
12814
|
setup(props, {
|
|
@@ -12892,9 +12906,9 @@ const Container = /* @__PURE__ */ defineComponent({
|
|
|
12892
12906
|
|
|
12893
12907
|
/** @jsxImportSource vue */
|
|
12894
12908
|
|
|
12895
|
-
const COMPONENT_NAME$
|
|
12909
|
+
const COMPONENT_NAME$o = 'vc-recycle-list-item';
|
|
12896
12910
|
const Item = /* @__PURE__ */ defineComponent({
|
|
12897
|
-
name: COMPONENT_NAME$
|
|
12911
|
+
name: COMPONENT_NAME$o,
|
|
12898
12912
|
props: {
|
|
12899
12913
|
vertical: {
|
|
12900
12914
|
type: Boolean,
|
|
@@ -12937,11 +12951,11 @@ const Item = /* @__PURE__ */ defineComponent({
|
|
|
12937
12951
|
|
|
12938
12952
|
/** @jsxImportSource vue */
|
|
12939
12953
|
|
|
12940
|
-
const COMPONENT_NAME$
|
|
12954
|
+
const COMPONENT_NAME$n = 'vc-recycle-list';
|
|
12941
12955
|
const RecycleList = /* @__PURE__ */ defineComponent({
|
|
12942
|
-
name: COMPONENT_NAME$
|
|
12956
|
+
name: COMPONENT_NAME$n,
|
|
12943
12957
|
props: props$i,
|
|
12944
|
-
emits: ['scroll'],
|
|
12958
|
+
emits: ['scroll', 'row-resize'],
|
|
12945
12959
|
setup(props, {
|
|
12946
12960
|
slots,
|
|
12947
12961
|
expose,
|
|
@@ -13040,7 +13054,7 @@ const RecycleList = /* @__PURE__ */ defineComponent({
|
|
|
13040
13054
|
const isLoading = computed(() => {
|
|
13041
13055
|
return loadings.value.length;
|
|
13042
13056
|
});
|
|
13043
|
-
const scrollTo = options => {
|
|
13057
|
+
const scrollTo = (options, force) => {
|
|
13044
13058
|
let options$ = {
|
|
13045
13059
|
x: 0,
|
|
13046
13060
|
y: 0
|
|
@@ -13051,10 +13065,9 @@ const RecycleList = /* @__PURE__ */ defineComponent({
|
|
|
13051
13065
|
options$ = Object.assign(options$, options);
|
|
13052
13066
|
}
|
|
13053
13067
|
const el = wrapper.value;
|
|
13054
|
-
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
y !== options$.y && (el.scrollTop = options$.y);
|
|
13068
|
+
(force || el.scrollLeft !== options$.x) && (el.scrollLeft = options$.x);
|
|
13069
|
+
(force || el.scrollLeft !== options$.y) && (el.scrollTop = options$.y);
|
|
13070
|
+
scroller.value.scrollTo(options);
|
|
13058
13071
|
};
|
|
13059
13072
|
const scrollToIndex = (index, offset = 0) => {
|
|
13060
13073
|
const item = rebuildData.value[index];
|
|
@@ -13087,12 +13100,21 @@ const RecycleList = /* @__PURE__ */ defineComponent({
|
|
|
13087
13100
|
const current = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[index]] : rebuildData.value[index];
|
|
13088
13101
|
if (!current) return; // 受到`removeUnusedPlaceholders`影响,无效的会被回收
|
|
13089
13102
|
|
|
13103
|
+
const oldSize = current.size;
|
|
13090
13104
|
const dom = preloads.value[index] || curloads.value[props.inverted ? index : index - firstItemIndex.value];
|
|
13091
13105
|
if (dom) {
|
|
13092
13106
|
current.size = dom[K.offsetSize] || placeholderSize.value;
|
|
13093
13107
|
} else if (current) {
|
|
13094
13108
|
current.size = placeholderSize.value;
|
|
13095
13109
|
}
|
|
13110
|
+
|
|
13111
|
+
// 这样的考虑欠佳,待优化
|
|
13112
|
+
if (oldSize !== current.size) {
|
|
13113
|
+
emit('row-resize', {
|
|
13114
|
+
index: current.id,
|
|
13115
|
+
size: current.size
|
|
13116
|
+
});
|
|
13117
|
+
}
|
|
13096
13118
|
};
|
|
13097
13119
|
const refreshItemPosition = () => {
|
|
13098
13120
|
const sizes = Array.from({
|
|
@@ -13125,6 +13147,7 @@ const RecycleList = /* @__PURE__ */ defineComponent({
|
|
|
13125
13147
|
|
|
13126
13148
|
// 设置data首个元素的在originalData索引值
|
|
13127
13149
|
const setFirstItemIndex = () => {
|
|
13150
|
+
if (!wrapper.value) return;
|
|
13128
13151
|
const position = wrapper.value[K.scrollAxis];
|
|
13129
13152
|
let item;
|
|
13130
13153
|
for (let i = 0; i < rebuildData.value.length; i++) {
|
|
@@ -13305,6 +13328,7 @@ const RecycleList = /* @__PURE__ */ defineComponent({
|
|
|
13305
13328
|
|
|
13306
13329
|
// 图片撑开时,会影响布局, 节流结束后调用
|
|
13307
13330
|
const handleResize = throttle$1(async () => {
|
|
13331
|
+
if (!wrapper.value) return;
|
|
13308
13332
|
const isNeedRefreshLayout = rebuildData.value.some(i => !i.isPlaceholder);
|
|
13309
13333
|
if (isNeedRefreshLayout) {
|
|
13310
13334
|
const oldFirstItemIndex = firstItemIndex.value;
|
|
@@ -13499,9 +13523,9 @@ const props$g = {
|
|
|
13499
13523
|
|
|
13500
13524
|
/** @jsxImportSource vue */
|
|
13501
13525
|
|
|
13502
|
-
const COMPONENT_NAME$
|
|
13526
|
+
const COMPONENT_NAME$m = 'vc-slider';
|
|
13503
13527
|
const Slider = /* @__PURE__ */ defineComponent({
|
|
13504
|
-
name: COMPONENT_NAME$
|
|
13528
|
+
name: COMPONENT_NAME$m,
|
|
13505
13529
|
props: props$g,
|
|
13506
13530
|
setup(props, {
|
|
13507
13531
|
slots
|
|
@@ -13525,9 +13549,9 @@ const props$f = {
|
|
|
13525
13549
|
|
|
13526
13550
|
/** @jsxImportSource vue */
|
|
13527
13551
|
|
|
13528
|
-
const COMPONENT_NAME$
|
|
13552
|
+
const COMPONENT_NAME$l = 'vc-sort-list';
|
|
13529
13553
|
const SortList = /* @__PURE__ */ defineComponent({
|
|
13530
|
-
name: COMPONENT_NAME$
|
|
13554
|
+
name: COMPONENT_NAME$l,
|
|
13531
13555
|
props: props$f,
|
|
13532
13556
|
setup(props, {
|
|
13533
13557
|
slots
|
|
@@ -13551,9 +13575,9 @@ const props$e = {
|
|
|
13551
13575
|
|
|
13552
13576
|
/** @jsxImportSource vue */
|
|
13553
13577
|
|
|
13554
|
-
const COMPONENT_NAME$
|
|
13578
|
+
const COMPONENT_NAME$k = 'vc-steps';
|
|
13555
13579
|
const Steps = /* @__PURE__ */ defineComponent({
|
|
13556
|
-
name: COMPONENT_NAME$
|
|
13580
|
+
name: COMPONENT_NAME$k,
|
|
13557
13581
|
props: props$e,
|
|
13558
13582
|
setup(props, {
|
|
13559
13583
|
slots
|
|
@@ -13666,9 +13690,9 @@ const useSwitch = (expose) => {
|
|
|
13666
13690
|
|
|
13667
13691
|
/** @jsxImportSource vue */
|
|
13668
13692
|
|
|
13669
|
-
const COMPONENT_NAME$
|
|
13693
|
+
const COMPONENT_NAME$j = 'vc-switch';
|
|
13670
13694
|
const Switch = /* @__PURE__ */ defineComponent({
|
|
13671
|
-
name: COMPONENT_NAME$
|
|
13695
|
+
name: COMPONENT_NAME$j,
|
|
13672
13696
|
props: props$d,
|
|
13673
13697
|
// click -> onClick要被拦截,此处不能放置
|
|
13674
13698
|
emits: ['update:modelValue', 'change', 'click'],
|
|
@@ -13705,9 +13729,9 @@ const Switch = /* @__PURE__ */ defineComponent({
|
|
|
13705
13729
|
|
|
13706
13730
|
/** @jsxImportSource vue */
|
|
13707
13731
|
|
|
13708
|
-
const COMPONENT_NAME$
|
|
13732
|
+
const COMPONENT_NAME$i = 'vcm-switch';
|
|
13709
13733
|
const MSwitch = /* @__PURE__ */ defineComponent({
|
|
13710
|
-
name: COMPONENT_NAME$
|
|
13734
|
+
name: COMPONENT_NAME$i,
|
|
13711
13735
|
props: props$d,
|
|
13712
13736
|
// click -> onClick要被拦截,此处不能放置
|
|
13713
13737
|
emits: ['update:modelValue', 'change', 'click'],
|
|
@@ -13742,37 +13766,2905 @@ const MSwitch = /* @__PURE__ */ defineComponent({
|
|
|
13742
13766
|
}
|
|
13743
13767
|
});
|
|
13744
13768
|
|
|
13745
|
-
const
|
|
13746
|
-
|
|
13747
|
-
|
|
13748
|
-
|
|
13769
|
+
const parseHeight = (v) => {
|
|
13770
|
+
if (typeof v === "number") {
|
|
13771
|
+
return v;
|
|
13772
|
+
}
|
|
13773
|
+
if (v && typeof v === "string") {
|
|
13774
|
+
if (/^\d+(?:px)?/.test(v)) {
|
|
13775
|
+
return parseInt(v, 10);
|
|
13776
|
+
}
|
|
13777
|
+
throw new VcError("table", "Invalid Height");
|
|
13749
13778
|
}
|
|
13779
|
+
return null;
|
|
13750
13780
|
};
|
|
13751
|
-
|
|
13752
|
-
|
|
13753
|
-
|
|
13754
|
-
|
|
13755
|
-
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
13761
|
-
return () => {
|
|
13762
|
-
return createVNode("div", {
|
|
13763
|
-
"class": "vc-table"
|
|
13764
|
-
}, [slots?.default?.()]);
|
|
13765
|
-
};
|
|
13781
|
+
const parseWidth = (v) => {
|
|
13782
|
+
if (typeof v === "number") {
|
|
13783
|
+
return v;
|
|
13784
|
+
}
|
|
13785
|
+
let v1;
|
|
13786
|
+
if (typeof v !== "undefined") {
|
|
13787
|
+
v1 = parseInt(v, 10);
|
|
13788
|
+
if (isNaN(v1)) {
|
|
13789
|
+
v1 = null;
|
|
13790
|
+
}
|
|
13766
13791
|
}
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
const
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13792
|
+
return v1;
|
|
13793
|
+
};
|
|
13794
|
+
const parseMinWidth = (v) => {
|
|
13795
|
+
if (typeof v === "number") {
|
|
13796
|
+
return v;
|
|
13797
|
+
}
|
|
13798
|
+
let v1;
|
|
13799
|
+
if (typeof v !== "undefined") {
|
|
13800
|
+
v1 = parseWidth(v);
|
|
13801
|
+
if (isNaN(v1)) {
|
|
13802
|
+
v = 80;
|
|
13803
|
+
}
|
|
13804
|
+
}
|
|
13805
|
+
return v1;
|
|
13806
|
+
};
|
|
13807
|
+
const getRowValue = (row, primaryKey) => {
|
|
13808
|
+
if (row.__KEY__) return row.__KEY__;
|
|
13809
|
+
if (!row) throw new VcError("table", "row is required when get row identity");
|
|
13810
|
+
if (typeof primaryKey === "string") {
|
|
13811
|
+
if (!primaryKey.includes(".")) {
|
|
13812
|
+
return row[primaryKey];
|
|
13813
|
+
}
|
|
13814
|
+
const key = primaryKey.split(".");
|
|
13815
|
+
let current = row;
|
|
13816
|
+
for (let i = 0; i < key.length; i++) {
|
|
13817
|
+
current = current[key[i]];
|
|
13818
|
+
}
|
|
13819
|
+
return current;
|
|
13820
|
+
} else if (typeof primaryKey === "function") {
|
|
13821
|
+
return primaryKey.call(null, row);
|
|
13822
|
+
}
|
|
13823
|
+
};
|
|
13824
|
+
const getValuesMap = (array = [], primaryKey) => {
|
|
13825
|
+
const arrayMap = {};
|
|
13826
|
+
array.forEach((row, index) => {
|
|
13827
|
+
arrayMap[getRowValue(row, primaryKey)] = { row, index };
|
|
13828
|
+
});
|
|
13829
|
+
return arrayMap;
|
|
13830
|
+
};
|
|
13831
|
+
const getColumnById = (columns, columnId) => {
|
|
13832
|
+
let column = null;
|
|
13833
|
+
columns.forEach((item) => {
|
|
13834
|
+
if (item.id === columnId) {
|
|
13835
|
+
column = item;
|
|
13836
|
+
}
|
|
13837
|
+
});
|
|
13838
|
+
return column;
|
|
13839
|
+
};
|
|
13840
|
+
const getColumnByCell = (columns, cell) => {
|
|
13841
|
+
const matches = (cell.className || "").match(/vc-table_[^\s]+/gm);
|
|
13842
|
+
if (matches) {
|
|
13843
|
+
return getColumnById(columns, matches[0]);
|
|
13844
|
+
}
|
|
13845
|
+
return null;
|
|
13846
|
+
};
|
|
13847
|
+
const getCell = (e) => {
|
|
13848
|
+
let cell = e.target;
|
|
13849
|
+
while (cell && cell.tagName.toUpperCase() !== "HTML") {
|
|
13850
|
+
if (cell.classList.contains("vc-table__td")) {
|
|
13851
|
+
return cell;
|
|
13852
|
+
}
|
|
13853
|
+
cell = cell.parentNode;
|
|
13854
|
+
}
|
|
13855
|
+
return null;
|
|
13856
|
+
};
|
|
13857
|
+
|
|
13858
|
+
const getAllColumns = (columns) => {
|
|
13859
|
+
const result = [];
|
|
13860
|
+
columns.forEach((column) => {
|
|
13861
|
+
if (column.children) {
|
|
13862
|
+
result.push(column);
|
|
13863
|
+
result.push(...getAllColumns(column.children));
|
|
13864
|
+
} else {
|
|
13865
|
+
result.push(column);
|
|
13866
|
+
}
|
|
13867
|
+
});
|
|
13868
|
+
return result;
|
|
13869
|
+
};
|
|
13870
|
+
const columnsToRowsEffect = (v) => {
|
|
13871
|
+
let maxLevel = 1;
|
|
13872
|
+
const traverse = (column, parent) => {
|
|
13873
|
+
if (parent) {
|
|
13874
|
+
column.level = parent.level + 1;
|
|
13875
|
+
if (maxLevel < column.level) {
|
|
13876
|
+
maxLevel = column.level;
|
|
13877
|
+
}
|
|
13878
|
+
}
|
|
13879
|
+
if (column.children) {
|
|
13880
|
+
let colSpan = 0;
|
|
13881
|
+
column.children.forEach((subColumn) => {
|
|
13882
|
+
traverse(subColumn, column);
|
|
13883
|
+
colSpan += subColumn.colSpan;
|
|
13884
|
+
});
|
|
13885
|
+
column.colSpan = colSpan;
|
|
13886
|
+
} else {
|
|
13887
|
+
column.colSpan = 1;
|
|
13888
|
+
}
|
|
13889
|
+
};
|
|
13890
|
+
v.forEach((column) => {
|
|
13891
|
+
column.level = 1;
|
|
13892
|
+
traverse(column);
|
|
13893
|
+
});
|
|
13894
|
+
const rows = [];
|
|
13895
|
+
for (let i = 0; i < maxLevel; i++) {
|
|
13896
|
+
rows.push([]);
|
|
13897
|
+
}
|
|
13898
|
+
const allColumns = getAllColumns(v);
|
|
13899
|
+
allColumns.forEach((column) => {
|
|
13900
|
+
if (!column.children) {
|
|
13901
|
+
column.rowSpan = maxLevel - column.level + 1;
|
|
13902
|
+
} else {
|
|
13903
|
+
column.rowSpan = 1;
|
|
13904
|
+
}
|
|
13905
|
+
rows[column.level - 1].push(column);
|
|
13906
|
+
});
|
|
13907
|
+
return rows;
|
|
13908
|
+
};
|
|
13909
|
+
const flattenData = (data, opts = {}) => {
|
|
13910
|
+
const result = [];
|
|
13911
|
+
data.forEach((item) => {
|
|
13912
|
+
if (item.children) {
|
|
13913
|
+
const { children, ...rest } = item;
|
|
13914
|
+
opts.parent ? result.push(...[opts.cascader ? item : rest, ...flattenData(children, opts)]) : result.push(...flattenData(children));
|
|
13915
|
+
} else {
|
|
13916
|
+
result.push(item);
|
|
13917
|
+
}
|
|
13918
|
+
});
|
|
13919
|
+
return result;
|
|
13920
|
+
};
|
|
13921
|
+
const walkTreeNode = (root, cb, opts = {}) => {
|
|
13922
|
+
const {
|
|
13923
|
+
childrenKey = "children",
|
|
13924
|
+
lazyKey = "hasChildren",
|
|
13925
|
+
level: baseLevel = 0
|
|
13926
|
+
} = opts;
|
|
13927
|
+
const isNil = (array) => !(Array.isArray(array) && array.length);
|
|
13928
|
+
function _walker(parent, children, level) {
|
|
13929
|
+
cb(parent, children, level);
|
|
13930
|
+
children.forEach((item) => {
|
|
13931
|
+
if (item[lazyKey]) {
|
|
13932
|
+
cb(item, null, level + 1);
|
|
13933
|
+
return;
|
|
13934
|
+
}
|
|
13935
|
+
const $children = item[childrenKey];
|
|
13936
|
+
if (!isNil($children)) {
|
|
13937
|
+
_walker(item, $children, level + 1);
|
|
13938
|
+
}
|
|
13939
|
+
});
|
|
13940
|
+
}
|
|
13941
|
+
root.forEach((item) => {
|
|
13942
|
+
if (item[lazyKey]) {
|
|
13943
|
+
cb(item, null, baseLevel);
|
|
13944
|
+
return;
|
|
13945
|
+
}
|
|
13946
|
+
const children = item[childrenKey];
|
|
13947
|
+
if (!isNil(children)) {
|
|
13948
|
+
_walker(item, children, baseLevel);
|
|
13949
|
+
}
|
|
13950
|
+
});
|
|
13951
|
+
};
|
|
13952
|
+
|
|
13953
|
+
class BaseWatcher {
|
|
13954
|
+
states = reactive({
|
|
13955
|
+
// 渲染的数据来源,是对 table 中的 data 过滤排序后的结果
|
|
13956
|
+
_data: [],
|
|
13957
|
+
data: [],
|
|
13958
|
+
list: [],
|
|
13959
|
+
// 表头数据
|
|
13960
|
+
headerRows: [],
|
|
13961
|
+
// 列 动态收集vc-table-column中的columnConfig
|
|
13962
|
+
_columns: [],
|
|
13963
|
+
originColumns: [],
|
|
13964
|
+
notFixedColumns: [],
|
|
13965
|
+
leftFixedColumns: [],
|
|
13966
|
+
rightFixedColumns: [],
|
|
13967
|
+
// 选择
|
|
13968
|
+
isAllSelected: false,
|
|
13969
|
+
selection: [],
|
|
13970
|
+
reserveSelection: false,
|
|
13971
|
+
selectable: null,
|
|
13972
|
+
hoverRowIndex: null,
|
|
13973
|
+
// Current
|
|
13974
|
+
currentRow: null,
|
|
13975
|
+
// Expand
|
|
13976
|
+
defaultExpandAll: false,
|
|
13977
|
+
expandRows: [],
|
|
13978
|
+
// Tree
|
|
13979
|
+
treeExpandRowValue: [],
|
|
13980
|
+
treeData: {},
|
|
13981
|
+
// item的状态,比如loading, loaded
|
|
13982
|
+
treeLazy: false,
|
|
13983
|
+
treelazyNodeMap: {},
|
|
13984
|
+
// 源数据
|
|
13985
|
+
treeLazyData: [],
|
|
13986
|
+
// 源数据展开
|
|
13987
|
+
treeLazyColumnIdentifier: "hasChildren",
|
|
13988
|
+
treeChildrenColumnName: "children",
|
|
13989
|
+
// compputeds
|
|
13990
|
+
isComplex: computed(() => this.states.leftFixedColumns.length > 0 || this.states.rightFixedColumns.length > 0),
|
|
13991
|
+
isGroup: computed(() => this.states.columns.length > this.states.originColumns.length),
|
|
13992
|
+
columns: computed(() => concat(this.states.leftFixedLeafColumns, this.states.leafColumns, this.states.rightFixedLeafColumns)),
|
|
13993
|
+
leafColumns: computed(() => flattenData(this.states.notFixedColumns)),
|
|
13994
|
+
leftFixedLeafColumns: computed(() => flattenData(this.states.leftFixedColumns)),
|
|
13995
|
+
rightFixedLeafColumns: computed(() => flattenData(this.states.rightFixedColumns)),
|
|
13996
|
+
leafColumnsLength: computed(() => this.states.leafColumns.length),
|
|
13997
|
+
leftFixedLeafColumnsLength: computed(() => this.states.leftFixedLeafColumns.length),
|
|
13998
|
+
rightFixedLeafColumnsLength: computed(() => this.states.rightFixedLeafColumns.length)
|
|
13999
|
+
});
|
|
14000
|
+
}
|
|
14001
|
+
|
|
14002
|
+
class Expand {
|
|
14003
|
+
store;
|
|
14004
|
+
constructor(store) {
|
|
14005
|
+
this.store = store;
|
|
14006
|
+
}
|
|
14007
|
+
update() {
|
|
14008
|
+
const store = this.store;
|
|
14009
|
+
const { primaryKey, defaultExpandAll } = this.store.table.props;
|
|
14010
|
+
const { data = [], expandRows } = store.states;
|
|
14011
|
+
if (defaultExpandAll) {
|
|
14012
|
+
store.states.expandRows = data.slice();
|
|
14013
|
+
} else if (primaryKey) {
|
|
14014
|
+
const expandRowsMap = getValuesMap(expandRows, primaryKey);
|
|
14015
|
+
store.states.expandRows = data.reduce((prev, row) => {
|
|
14016
|
+
const rowId = getRowValue(row, primaryKey);
|
|
14017
|
+
const rowInfo = expandRowsMap[rowId];
|
|
14018
|
+
if (rowInfo) {
|
|
14019
|
+
prev.push(row);
|
|
14020
|
+
}
|
|
14021
|
+
return prev;
|
|
14022
|
+
}, []);
|
|
14023
|
+
} else {
|
|
14024
|
+
store.states.expandRows = [];
|
|
14025
|
+
}
|
|
14026
|
+
}
|
|
14027
|
+
toggle(row, expanded) {
|
|
14028
|
+
const store = this.store;
|
|
14029
|
+
const { expandRows } = store.states;
|
|
14030
|
+
const changed = store.toggleRowStatus(expandRows, row, expanded);
|
|
14031
|
+
if (changed) {
|
|
14032
|
+
store.table.emit("expand-change", row, expandRows.slice());
|
|
14033
|
+
store.scheduleLayout();
|
|
14034
|
+
}
|
|
14035
|
+
}
|
|
14036
|
+
reset(ids) {
|
|
14037
|
+
const store = this.store;
|
|
14038
|
+
store.checkPrimaryKey();
|
|
14039
|
+
const { primaryKey } = store.table.props;
|
|
14040
|
+
const { data } = store.states;
|
|
14041
|
+
const keysMap = getValuesMap(data, primaryKey);
|
|
14042
|
+
store.states.expandRows = ids.reduce((prev, cur) => {
|
|
14043
|
+
const info = keysMap[cur];
|
|
14044
|
+
if (info) {
|
|
14045
|
+
prev.push(info.row);
|
|
14046
|
+
}
|
|
14047
|
+
return prev;
|
|
14048
|
+
}, []);
|
|
14049
|
+
}
|
|
14050
|
+
isExpanded(row) {
|
|
14051
|
+
const { primaryKey } = this.store.table.props;
|
|
14052
|
+
const { expandRows = [] } = this.store.states;
|
|
14053
|
+
if (primaryKey) {
|
|
14054
|
+
const expandMap = getValuesMap(expandRows, primaryKey);
|
|
14055
|
+
return !!expandMap[getRowValue(row, primaryKey)];
|
|
14056
|
+
}
|
|
14057
|
+
return expandRows.indexOf(row) !== -1;
|
|
14058
|
+
}
|
|
14059
|
+
}
|
|
14060
|
+
|
|
14061
|
+
class Current {
|
|
14062
|
+
store;
|
|
14063
|
+
constructor(store) {
|
|
14064
|
+
this.store = store;
|
|
14065
|
+
}
|
|
14066
|
+
reset(id) {
|
|
14067
|
+
const store = this.store;
|
|
14068
|
+
const { primaryKey } = store.table.props;
|
|
14069
|
+
store.checkPrimaryKey();
|
|
14070
|
+
const { data = [] } = store.states;
|
|
14071
|
+
const currentRow = data.find((item) => getRowValue(item, primaryKey) === id);
|
|
14072
|
+
store.states.currentRow = currentRow || null;
|
|
14073
|
+
}
|
|
14074
|
+
update() {
|
|
14075
|
+
const store = this.store;
|
|
14076
|
+
const { primaryKey } = store.table.props;
|
|
14077
|
+
const { data = [], currentRow } = store.states;
|
|
14078
|
+
const oldCurrentRow = currentRow;
|
|
14079
|
+
if (oldCurrentRow && !data.includes(oldCurrentRow)) {
|
|
14080
|
+
let newCurrentRow = null;
|
|
14081
|
+
if (primaryKey) {
|
|
14082
|
+
newCurrentRow = data.find((item) => {
|
|
14083
|
+
return getRowValue(item, primaryKey) === getRowValue(oldCurrentRow, primaryKey);
|
|
14084
|
+
});
|
|
14085
|
+
}
|
|
14086
|
+
store.states.currentRow = newCurrentRow;
|
|
14087
|
+
if (newCurrentRow !== oldCurrentRow) {
|
|
14088
|
+
store.table.emit("current-change", null, oldCurrentRow);
|
|
14089
|
+
}
|
|
14090
|
+
}
|
|
14091
|
+
}
|
|
14092
|
+
}
|
|
14093
|
+
|
|
14094
|
+
let Tree$1 = class Tree {
|
|
14095
|
+
store;
|
|
14096
|
+
/**
|
|
14097
|
+
* 解决问题嵌入型的数据,watch 无法是检测到变化
|
|
14098
|
+
* TODO: 是否会造成性能问题?同base-watcher flattenData
|
|
14099
|
+
* { id: { level, children } }
|
|
14100
|
+
*/
|
|
14101
|
+
normalizedData = computed(() => {
|
|
14102
|
+
const { primaryKey } = this.store.table.props;
|
|
14103
|
+
if (!primaryKey) return {};
|
|
14104
|
+
return this.normalize(this.store.states.data || []);
|
|
14105
|
+
});
|
|
14106
|
+
/**
|
|
14107
|
+
* 针对懒加载的情形,不处理嵌套数据
|
|
14108
|
+
* { id: { children } }
|
|
14109
|
+
*/
|
|
14110
|
+
normalizedLazyNode = computed(() => {
|
|
14111
|
+
const { primaryKey } = this.store.table.props;
|
|
14112
|
+
const { treelazyNodeMap, treeLazyColumnIdentifier, treeChildrenColumnName } = this.store.states;
|
|
14113
|
+
const keys = Object.keys(treelazyNodeMap);
|
|
14114
|
+
const res = {};
|
|
14115
|
+
if (!keys.length) return res;
|
|
14116
|
+
keys.forEach((key) => {
|
|
14117
|
+
if (treelazyNodeMap[key].length) {
|
|
14118
|
+
const item = { children: [] };
|
|
14119
|
+
treelazyNodeMap[key].forEach((row) => {
|
|
14120
|
+
const id = getRowValue(row, primaryKey);
|
|
14121
|
+
item.children.push(id);
|
|
14122
|
+
const hasChildren = row[treeLazyColumnIdentifier] || row[treeChildrenColumnName] && row[treeChildrenColumnName].length === 0;
|
|
14123
|
+
if (hasChildren && !res[id]) {
|
|
14124
|
+
res[id] = { children: [] };
|
|
14125
|
+
}
|
|
14126
|
+
});
|
|
14127
|
+
res[key] = item;
|
|
14128
|
+
}
|
|
14129
|
+
});
|
|
14130
|
+
return res;
|
|
14131
|
+
});
|
|
14132
|
+
constructor(store) {
|
|
14133
|
+
this.store = store;
|
|
14134
|
+
watch(
|
|
14135
|
+
() => [this.normalizedData.value, this.normalizedLazyNode.value],
|
|
14136
|
+
() => this.update()
|
|
14137
|
+
);
|
|
14138
|
+
}
|
|
14139
|
+
normalize(data) {
|
|
14140
|
+
const { primaryKey } = this.store.table.props;
|
|
14141
|
+
const { treeChildrenColumnName, treeLazyColumnIdentifier, treeLazy } = this.store.states;
|
|
14142
|
+
const res = {};
|
|
14143
|
+
walkTreeNode(
|
|
14144
|
+
data,
|
|
14145
|
+
(parent, children, level) => {
|
|
14146
|
+
const parentId = getRowValue(parent, primaryKey);
|
|
14147
|
+
if (Array.isArray(children)) {
|
|
14148
|
+
res[parentId] = {
|
|
14149
|
+
children: children.map((row) => getRowValue(row, primaryKey)),
|
|
14150
|
+
level
|
|
14151
|
+
};
|
|
14152
|
+
} else if (treeLazy) {
|
|
14153
|
+
res[parentId] = {
|
|
14154
|
+
children: [],
|
|
14155
|
+
lazy: true,
|
|
14156
|
+
level
|
|
14157
|
+
};
|
|
14158
|
+
}
|
|
14159
|
+
},
|
|
14160
|
+
{
|
|
14161
|
+
childrenKey: treeChildrenColumnName,
|
|
14162
|
+
lazyKey: treeLazyColumnIdentifier
|
|
14163
|
+
}
|
|
14164
|
+
);
|
|
14165
|
+
return res;
|
|
14166
|
+
}
|
|
14167
|
+
// 获取当前展开最大的level
|
|
14168
|
+
getMaxLevel() {
|
|
14169
|
+
const { primaryKey } = this.store.table.props;
|
|
14170
|
+
const { data, treeData } = this.store.states;
|
|
14171
|
+
const levels = data.map((item) => {
|
|
14172
|
+
const traverse = (source) => {
|
|
14173
|
+
if (!source) return 0;
|
|
14174
|
+
if (source.expanded && source.children.length > 0) {
|
|
14175
|
+
return max([source.level, ...source.children.map((key) => traverse(treeData[key]))]);
|
|
14176
|
+
} else {
|
|
14177
|
+
return source.level;
|
|
14178
|
+
}
|
|
14179
|
+
};
|
|
14180
|
+
const id = getRowValue(item, primaryKey);
|
|
14181
|
+
return traverse(treeData[id]);
|
|
14182
|
+
});
|
|
14183
|
+
return max(levels) || 0;
|
|
14184
|
+
}
|
|
14185
|
+
update() {
|
|
14186
|
+
const nested = this.normalizedData.value;
|
|
14187
|
+
const normalizedLazyNode = this.normalizedLazyNode.value;
|
|
14188
|
+
const keys = Object.keys(nested);
|
|
14189
|
+
const newTreeData = {};
|
|
14190
|
+
if (keys.length) {
|
|
14191
|
+
const { defaultExpandAll } = this.store.table.props;
|
|
14192
|
+
const { treeData: oldTreeData, treeExpandRowValue, treeLazy } = this.store.states;
|
|
14193
|
+
const rootLazyRowValue = [];
|
|
14194
|
+
const getExpanded = (oldValue, key) => {
|
|
14195
|
+
const included = defaultExpandAll || treeExpandRowValue && treeExpandRowValue.indexOf(key) !== -1;
|
|
14196
|
+
return !!(oldValue && oldValue.expanded || included);
|
|
14197
|
+
};
|
|
14198
|
+
keys.forEach((key) => {
|
|
14199
|
+
const oldValue = oldTreeData[key];
|
|
14200
|
+
const newValue = { ...nested[key] };
|
|
14201
|
+
newValue.expanded = getExpanded(oldValue, key);
|
|
14202
|
+
if (newValue.lazy) {
|
|
14203
|
+
const { loaded = false, loading = false } = oldValue || {};
|
|
14204
|
+
newValue.loaded = !!loaded;
|
|
14205
|
+
newValue.loading = !!loading;
|
|
14206
|
+
rootLazyRowValue.push(key);
|
|
14207
|
+
}
|
|
14208
|
+
newTreeData[key] = newValue;
|
|
14209
|
+
});
|
|
14210
|
+
const lazyKeys = Object.keys(normalizedLazyNode);
|
|
14211
|
+
if (treeLazy && lazyKeys.length && rootLazyRowValue.length) {
|
|
14212
|
+
lazyKeys.forEach((key) => {
|
|
14213
|
+
const oldValue = oldTreeData[key];
|
|
14214
|
+
const lazyNodeChildren = normalizedLazyNode[key].children;
|
|
14215
|
+
if (rootLazyRowValue.includes(key)) {
|
|
14216
|
+
if (newTreeData[key].children.length !== 0) {
|
|
14217
|
+
throw new VcError("table", "children需要为空数组");
|
|
14218
|
+
}
|
|
14219
|
+
newTreeData[key].children = lazyNodeChildren;
|
|
14220
|
+
} else {
|
|
14221
|
+
const { loaded = false, loading = false } = oldValue || {};
|
|
14222
|
+
newTreeData[key] = reactive({
|
|
14223
|
+
lazy: true,
|
|
14224
|
+
loaded: !!loaded,
|
|
14225
|
+
loading: !!loading,
|
|
14226
|
+
expanded: getExpanded(oldValue, key),
|
|
14227
|
+
children: lazyNodeChildren,
|
|
14228
|
+
level: ""
|
|
14229
|
+
});
|
|
14230
|
+
}
|
|
14231
|
+
});
|
|
14232
|
+
}
|
|
14233
|
+
}
|
|
14234
|
+
this.store.states.treeData = newTreeData;
|
|
14235
|
+
this.store.updateTableScrollY();
|
|
14236
|
+
}
|
|
14237
|
+
expand(ids) {
|
|
14238
|
+
this.store.states.treeExpandRowValue = ids;
|
|
14239
|
+
this.update();
|
|
14240
|
+
}
|
|
14241
|
+
toggle(row, expanded) {
|
|
14242
|
+
this.store.checkPrimaryKey();
|
|
14243
|
+
const { primaryKey } = this.store.table.props;
|
|
14244
|
+
const { treeData } = this.store.states;
|
|
14245
|
+
const id = getRowValue(row, primaryKey);
|
|
14246
|
+
const data = id && treeData[id];
|
|
14247
|
+
if (id && data && "expanded" in data) {
|
|
14248
|
+
const oldExpanded = data.expanded;
|
|
14249
|
+
expanded = typeof expanded === "undefined" ? !data.expanded : expanded;
|
|
14250
|
+
this.store.states.treeData[id].expanded = expanded;
|
|
14251
|
+
if (oldExpanded !== expanded) {
|
|
14252
|
+
this.store.table.emit("expand-change", row, expanded, this.getMaxLevel());
|
|
14253
|
+
}
|
|
14254
|
+
this.store.updateTableScrollY();
|
|
14255
|
+
}
|
|
14256
|
+
}
|
|
14257
|
+
loadOrToggle(row) {
|
|
14258
|
+
this.store.checkPrimaryKey();
|
|
14259
|
+
const { primaryKey } = this.store.table.props;
|
|
14260
|
+
const { treeLazy, treeData } = this.store.states;
|
|
14261
|
+
const id = getRowValue(row, primaryKey);
|
|
14262
|
+
const data = treeData[id];
|
|
14263
|
+
if (treeLazy && data && "loaded" in data && !data.loaded) {
|
|
14264
|
+
this.loadData(row, id, data);
|
|
14265
|
+
} else {
|
|
14266
|
+
this.toggle(row);
|
|
14267
|
+
}
|
|
14268
|
+
}
|
|
14269
|
+
loadData(row, key, treeNode) {
|
|
14270
|
+
this.store.checkPrimaryKey();
|
|
14271
|
+
const { table } = this.store;
|
|
14272
|
+
const { primaryKey } = table.props;
|
|
14273
|
+
const { treelazyNodeMap, treeData, treeChildrenColumnName, treeLazyColumnIdentifier } = this.store.states;
|
|
14274
|
+
if (table.props.loadExpand && !treeData[key].loaded) {
|
|
14275
|
+
this.store.states.treeData[key].loading = true;
|
|
14276
|
+
const promise = table.props.loadExpand(row, treeNode);
|
|
14277
|
+
const fn = (data) => {
|
|
14278
|
+
if (!Array.isArray(data)) {
|
|
14279
|
+
throw new VcError("table", "data必须是数组");
|
|
14280
|
+
}
|
|
14281
|
+
this.store.states.treeData[key].loading = false;
|
|
14282
|
+
this.store.states.treeData[key].loaded = true;
|
|
14283
|
+
this.store.states.treeData[key].expanded = true;
|
|
14284
|
+
walkTreeNode(
|
|
14285
|
+
data,
|
|
14286
|
+
(parent, _, level) => {
|
|
14287
|
+
const id = getRowValue(parent, primaryKey);
|
|
14288
|
+
Object.defineProperty(parent, "__KEY__", {
|
|
14289
|
+
value: `${level}__${id}`,
|
|
14290
|
+
writable: false
|
|
14291
|
+
});
|
|
14292
|
+
},
|
|
14293
|
+
{
|
|
14294
|
+
childrenKey: treeChildrenColumnName,
|
|
14295
|
+
lazyKey: treeLazyColumnIdentifier,
|
|
14296
|
+
level: treeNode.level
|
|
14297
|
+
}
|
|
14298
|
+
);
|
|
14299
|
+
if (data.length) {
|
|
14300
|
+
this.store.states.treelazyNodeMap[key] = data;
|
|
14301
|
+
if (table.props.expandSelectable) {
|
|
14302
|
+
this.store.states.treeLazyData = Object.keys(treelazyNodeMap).reduce((pre, cur) => {
|
|
14303
|
+
return pre.concat(treelazyNodeMap[cur]);
|
|
14304
|
+
}, []);
|
|
14305
|
+
}
|
|
14306
|
+
}
|
|
14307
|
+
if (this.store.isSelected(row)) {
|
|
14308
|
+
data.forEach((i) => {
|
|
14309
|
+
this.store.toggleRowSelection(i);
|
|
14310
|
+
});
|
|
14311
|
+
}
|
|
14312
|
+
this.store.updateAllSelected();
|
|
14313
|
+
nextTick(() => {
|
|
14314
|
+
table.emit("expand-change", row, true, this.getMaxLevel());
|
|
14315
|
+
});
|
|
14316
|
+
};
|
|
14317
|
+
if (promise && promise.then) {
|
|
14318
|
+
promise.then((data) => fn(data)).catch((e) => {
|
|
14319
|
+
throw new VcError("table", e);
|
|
14320
|
+
});
|
|
14321
|
+
} else if (Array.isArray(promise)) {
|
|
14322
|
+
fn(promise);
|
|
14323
|
+
}
|
|
14324
|
+
}
|
|
14325
|
+
}
|
|
14326
|
+
};
|
|
14327
|
+
|
|
14328
|
+
class Layout {
|
|
14329
|
+
table;
|
|
14330
|
+
store;
|
|
14331
|
+
states = reactive({
|
|
14332
|
+
height: null,
|
|
14333
|
+
scrollX: false,
|
|
14334
|
+
scrollY: false,
|
|
14335
|
+
bodyWidth: null,
|
|
14336
|
+
leftFixedWidth: null,
|
|
14337
|
+
rightFixedWidth: null,
|
|
14338
|
+
tableHeight: null,
|
|
14339
|
+
headerHeight: 44,
|
|
14340
|
+
// Table Header Height
|
|
14341
|
+
appendHeight: 0,
|
|
14342
|
+
// Append Slot Height
|
|
14343
|
+
footerHeight: 44,
|
|
14344
|
+
// Table Footer Height
|
|
14345
|
+
bodyHeight: null
|
|
14346
|
+
// Table Height - Table Header Height
|
|
14347
|
+
});
|
|
14348
|
+
constructor(store) {
|
|
14349
|
+
this.store = store;
|
|
14350
|
+
this.table = store.table;
|
|
14351
|
+
if (!this.table) {
|
|
14352
|
+
throw new VcError("table", "Table Layout 必须包含table实例");
|
|
14353
|
+
}
|
|
14354
|
+
if (!this.store) {
|
|
14355
|
+
throw new VcError("table", "Table Layout 必须包含store实例");
|
|
14356
|
+
}
|
|
14357
|
+
}
|
|
14358
|
+
updateScrollY() {
|
|
14359
|
+
const { height, bodyHeight } = this.states;
|
|
14360
|
+
if (height === null || bodyHeight === null) return;
|
|
14361
|
+
const bodyYWrapper = this.table.exposed.bodyYWrapper.value;
|
|
14362
|
+
if (this.table.vnode.el && bodyYWrapper) {
|
|
14363
|
+
this.states.scrollY = bodyYWrapper.offsetHeight > bodyHeight;
|
|
14364
|
+
}
|
|
14365
|
+
}
|
|
14366
|
+
setHeight(value, prop = "height") {
|
|
14367
|
+
if (IS_SERVER$1) return;
|
|
14368
|
+
const el = this.table.vnode.el;
|
|
14369
|
+
value = parseHeight(value);
|
|
14370
|
+
this.states.height = value;
|
|
14371
|
+
if (!el && (value || value === 0)) return nextTick(() => this.setHeight(value, prop));
|
|
14372
|
+
if (value) {
|
|
14373
|
+
el.style[prop] = `${value}px`;
|
|
14374
|
+
this.updateElsHeight();
|
|
14375
|
+
}
|
|
14376
|
+
}
|
|
14377
|
+
setMaxHeight(value) {
|
|
14378
|
+
this.setHeight(value, "max-height");
|
|
14379
|
+
}
|
|
14380
|
+
updateElsHeight() {
|
|
14381
|
+
if (!this.table.exposed.isReady.value) return nextTick(() => this.updateElsHeight());
|
|
14382
|
+
const table = this.table.exposed;
|
|
14383
|
+
const headerWrapper = table.headerWrapper.value;
|
|
14384
|
+
const appendWrapper = table.appendWrapper.value;
|
|
14385
|
+
const footerWrapper = table.footerWrapper.value;
|
|
14386
|
+
const { showHeader } = this.table.props;
|
|
14387
|
+
this.states.appendHeight = appendWrapper ? appendWrapper.offsetHeight : 0;
|
|
14388
|
+
if (showHeader && !headerWrapper) return;
|
|
14389
|
+
const headerHeight = !showHeader ? 0 : headerWrapper.offsetHeight;
|
|
14390
|
+
this.states.headerHeight = headerHeight;
|
|
14391
|
+
if (showHeader && headerWrapper.offsetWidth > 0 && (this.store.states.columns || []).length > 0 && headerHeight < 2) {
|
|
14392
|
+
return nextTick(() => this.updateElsHeight());
|
|
14393
|
+
}
|
|
14394
|
+
const tableHeight = this.table.vnode.el.clientHeight;
|
|
14395
|
+
this.states.tableHeight = tableHeight;
|
|
14396
|
+
const footerHeight = footerWrapper ? footerWrapper.offsetHeight : 0;
|
|
14397
|
+
this.states.footerHeight = footerHeight;
|
|
14398
|
+
if (this.states.height !== null) {
|
|
14399
|
+
this.states.bodyHeight = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
|
|
14400
|
+
}
|
|
14401
|
+
this.updateScrollY();
|
|
14402
|
+
}
|
|
14403
|
+
updateColumnsWidth() {
|
|
14404
|
+
if (IS_SERVER$1) return;
|
|
14405
|
+
const bodyWidth = this.table.vnode.el.clientWidth;
|
|
14406
|
+
let bodyMinWidth = 0;
|
|
14407
|
+
const flattenColumns = this.store.states.columns;
|
|
14408
|
+
const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
|
|
14409
|
+
const { fit } = this.table.props;
|
|
14410
|
+
if (flexColumns.length > 0 && fit) {
|
|
14411
|
+
flattenColumns.forEach((column) => {
|
|
14412
|
+
bodyMinWidth += column.width || column.minWidth || 80;
|
|
14413
|
+
});
|
|
14414
|
+
if (bodyMinWidth <= bodyWidth) {
|
|
14415
|
+
this.states.scrollX = false;
|
|
14416
|
+
const totalFlexWidth = bodyWidth - bodyMinWidth;
|
|
14417
|
+
if (flexColumns.length === 1) {
|
|
14418
|
+
flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth;
|
|
14419
|
+
} else {
|
|
14420
|
+
const allColumnsWidth = flexColumns.reduce((prev, column) => prev + (column.minWidth || 80), 0);
|
|
14421
|
+
const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
|
|
14422
|
+
let noneFirstWidth = 0;
|
|
14423
|
+
flexColumns.forEach((column, index) => {
|
|
14424
|
+
if (index === 0) return;
|
|
14425
|
+
const flexWidth = Math.floor((column.minWidth || 80) * flexWidthPerPixel);
|
|
14426
|
+
noneFirstWidth += flexWidth;
|
|
14427
|
+
column.realWidth = (column.minWidth || 80) + flexWidth;
|
|
14428
|
+
});
|
|
14429
|
+
flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
|
|
14430
|
+
}
|
|
14431
|
+
} else {
|
|
14432
|
+
this.states.scrollX = true;
|
|
14433
|
+
flexColumns.forEach((column) => {
|
|
14434
|
+
column.realWidth = column.width || column.minWidth;
|
|
14435
|
+
});
|
|
14436
|
+
}
|
|
14437
|
+
this.states.bodyWidth = Math.max(bodyMinWidth, bodyWidth);
|
|
14438
|
+
this.table.exposed.resizeState.value.width = this.states.bodyWidth;
|
|
14439
|
+
} else {
|
|
14440
|
+
flattenColumns.forEach((column) => {
|
|
14441
|
+
if (!column.width && !column.minWidth) {
|
|
14442
|
+
column.realWidth = 80;
|
|
14443
|
+
} else {
|
|
14444
|
+
column.realWidth = column.width || column.minWidth;
|
|
14445
|
+
}
|
|
14446
|
+
bodyMinWidth += column.realWidth;
|
|
14447
|
+
});
|
|
14448
|
+
this.states.scrollX = bodyMinWidth > bodyWidth;
|
|
14449
|
+
this.states.bodyWidth = bodyMinWidth;
|
|
14450
|
+
}
|
|
14451
|
+
const leftFixedColumns = this.store.states.leftFixedColumns;
|
|
14452
|
+
if (leftFixedColumns.length > 0) {
|
|
14453
|
+
let leftFixedWidth = 0;
|
|
14454
|
+
leftFixedColumns.forEach(function(column) {
|
|
14455
|
+
leftFixedWidth += column.realWidth || column.width;
|
|
14456
|
+
});
|
|
14457
|
+
this.states.leftFixedWidth = leftFixedWidth;
|
|
14458
|
+
}
|
|
14459
|
+
const rightFixedColumns = this.store.states.rightFixedColumns;
|
|
14460
|
+
if (rightFixedColumns.length > 0) {
|
|
14461
|
+
let rightFixedWidth = 0;
|
|
14462
|
+
rightFixedColumns.forEach(function(column) {
|
|
14463
|
+
rightFixedWidth += column.realWidth || column.width;
|
|
14464
|
+
});
|
|
14465
|
+
this.states.rightFixedWidth = rightFixedWidth;
|
|
14466
|
+
}
|
|
14467
|
+
}
|
|
14468
|
+
}
|
|
14469
|
+
|
|
14470
|
+
class Store extends BaseWatcher {
|
|
14471
|
+
table;
|
|
14472
|
+
current;
|
|
14473
|
+
expand;
|
|
14474
|
+
tree;
|
|
14475
|
+
layout;
|
|
14476
|
+
flatData = computed(() => {
|
|
14477
|
+
if (this.table.props.expandSelectable) {
|
|
14478
|
+
return concat(
|
|
14479
|
+
flattenData(this.states.data, { parent: true, cascader: true }),
|
|
14480
|
+
this.states.treeLazyData
|
|
14481
|
+
);
|
|
14482
|
+
} else {
|
|
14483
|
+
return this.states.data;
|
|
14484
|
+
}
|
|
14485
|
+
});
|
|
14486
|
+
constructor(options) {
|
|
14487
|
+
super();
|
|
14488
|
+
if (!options.table) {
|
|
14489
|
+
throw new VcError("table", "table必传");
|
|
14490
|
+
}
|
|
14491
|
+
this.table = options.table;
|
|
14492
|
+
this.current = new Current(this);
|
|
14493
|
+
this.expand = new Expand(this);
|
|
14494
|
+
this.tree = new Tree$1(this);
|
|
14495
|
+
this.layout = new Layout(this);
|
|
14496
|
+
const { props } = options.table;
|
|
14497
|
+
merge(this.states, {
|
|
14498
|
+
treeLazy: props.lazy || false,
|
|
14499
|
+
treeLazyColumnIdentifier: props.treeMap.hasChildren || "hasChildren",
|
|
14500
|
+
treeChildrenColumnName: props.treeMap.children || "children"
|
|
14501
|
+
});
|
|
14502
|
+
}
|
|
14503
|
+
setData(data) {
|
|
14504
|
+
const dataInstanceChanged = this.states._data !== data;
|
|
14505
|
+
this.states._data = data;
|
|
14506
|
+
this.states.data = data;
|
|
14507
|
+
this.states.list = data.reduce((pre, row, index) => {
|
|
14508
|
+
pre.push({
|
|
14509
|
+
rows: [
|
|
14510
|
+
{
|
|
14511
|
+
index,
|
|
14512
|
+
data: row,
|
|
14513
|
+
height: "",
|
|
14514
|
+
heightMap: {
|
|
14515
|
+
left: "",
|
|
14516
|
+
main: "",
|
|
14517
|
+
right: ""
|
|
14518
|
+
}
|
|
14519
|
+
}
|
|
14520
|
+
],
|
|
14521
|
+
expand: false
|
|
14522
|
+
});
|
|
14523
|
+
return pre;
|
|
14524
|
+
}, []);
|
|
14525
|
+
this.current.update();
|
|
14526
|
+
this.expand.update();
|
|
14527
|
+
if (!this.states.reserveSelection) {
|
|
14528
|
+
if (dataInstanceChanged) {
|
|
14529
|
+
this.clearSelection();
|
|
14530
|
+
} else {
|
|
14531
|
+
this.cleanSelection();
|
|
14532
|
+
}
|
|
14533
|
+
} else {
|
|
14534
|
+
this.checkPrimaryKey();
|
|
14535
|
+
this.updateSelectionByRowKey();
|
|
14536
|
+
}
|
|
14537
|
+
this.updateAllSelected();
|
|
14538
|
+
this.updateTableScrollY();
|
|
14539
|
+
}
|
|
14540
|
+
rowSelectedChanged(row) {
|
|
14541
|
+
this.toggleRowSelection(row);
|
|
14542
|
+
this.updateAllSelected();
|
|
14543
|
+
}
|
|
14544
|
+
// TODO: 合并的多行管理
|
|
14545
|
+
setHoverRow(index) {
|
|
14546
|
+
this.states.hoverRowIndex = index;
|
|
14547
|
+
}
|
|
14548
|
+
setCurrentRow(row) {
|
|
14549
|
+
const oldCurrentRow = this.states.currentRow;
|
|
14550
|
+
this.states.currentRow = row;
|
|
14551
|
+
if (oldCurrentRow !== row) {
|
|
14552
|
+
this.table.emit("current-change", row, oldCurrentRow);
|
|
14553
|
+
}
|
|
14554
|
+
}
|
|
14555
|
+
/**
|
|
14556
|
+
* 检查 primaryKey 是否存在
|
|
14557
|
+
*/
|
|
14558
|
+
checkPrimaryKey() {
|
|
14559
|
+
const { primaryKey } = this.table.props;
|
|
14560
|
+
}
|
|
14561
|
+
/**
|
|
14562
|
+
* states
|
|
14563
|
+
* -> _columns
|
|
14564
|
+
* -> selectable
|
|
14565
|
+
* -> reserveSelection
|
|
14566
|
+
* @param column ~
|
|
14567
|
+
* @param index ~
|
|
14568
|
+
* @param parent ~
|
|
14569
|
+
*/
|
|
14570
|
+
insertColumn(column, index, parent) {
|
|
14571
|
+
let array = this.states._columns;
|
|
14572
|
+
if (parent) {
|
|
14573
|
+
array = parent.children;
|
|
14574
|
+
if (!array) {
|
|
14575
|
+
array = [];
|
|
14576
|
+
parent.children = array;
|
|
14577
|
+
}
|
|
14578
|
+
}
|
|
14579
|
+
if (typeof index !== "undefined") {
|
|
14580
|
+
array.splice(index, 0, column);
|
|
14581
|
+
} else {
|
|
14582
|
+
array.push(column);
|
|
14583
|
+
}
|
|
14584
|
+
if (column.type === "selection") {
|
|
14585
|
+
this.states.selectable = column.selectable;
|
|
14586
|
+
this.states.reserveSelection = column.reserveSelection;
|
|
14587
|
+
}
|
|
14588
|
+
if (this.table.exposed.isReady.value) {
|
|
14589
|
+
this.updateColumns();
|
|
14590
|
+
this.scheduleLayout();
|
|
14591
|
+
}
|
|
14592
|
+
}
|
|
14593
|
+
removeColumn(column, parent) {
|
|
14594
|
+
let array = this.states._columns;
|
|
14595
|
+
if (parent) {
|
|
14596
|
+
array = parent.children || [];
|
|
14597
|
+
}
|
|
14598
|
+
if (array) {
|
|
14599
|
+
array.splice(array.indexOf(column), 1);
|
|
14600
|
+
}
|
|
14601
|
+
if (this.table.exposed.isReady.value) {
|
|
14602
|
+
this.updateColumns();
|
|
14603
|
+
this.scheduleLayout();
|
|
14604
|
+
}
|
|
14605
|
+
}
|
|
14606
|
+
/**
|
|
14607
|
+
* 更新列
|
|
14608
|
+
* leftFixedColumns: 左fixed
|
|
14609
|
+
* rightFixedColumns: 右fixed
|
|
14610
|
+
* originColumns: 中(包括左右)
|
|
14611
|
+
* columns: 展开以上
|
|
14612
|
+
* leafColumnsLength
|
|
14613
|
+
* leftFixedLeafColumnsLength
|
|
14614
|
+
* rightFixedLeafColumnsLength
|
|
14615
|
+
* isComplex: 是否包含固定列
|
|
14616
|
+
*/
|
|
14617
|
+
updateColumns() {
|
|
14618
|
+
const { states } = this;
|
|
14619
|
+
const _columns = states._columns || [];
|
|
14620
|
+
const leftFixedColumns = _columns.filter((column) => column.fixed === true || column.fixed === "left");
|
|
14621
|
+
const rightFixedColumns = _columns.filter((column) => column.fixed === "right");
|
|
14622
|
+
if (leftFixedColumns.length > 0 && _columns[0] && _columns[0].type === "selection" && !_columns[0].fixed) {
|
|
14623
|
+
_columns[0].fixed = true;
|
|
14624
|
+
leftFixedColumns.unshift(_columns[0]);
|
|
14625
|
+
}
|
|
14626
|
+
const notFixedColumns = _columns.filter((column) => !column.fixed);
|
|
14627
|
+
const originColumns = concat(leftFixedColumns, notFixedColumns, rightFixedColumns);
|
|
14628
|
+
const headerRows = columnsToRowsEffect(originColumns);
|
|
14629
|
+
states.leftFixedColumns = leftFixedColumns;
|
|
14630
|
+
states.notFixedColumns = notFixedColumns;
|
|
14631
|
+
states.rightFixedColumns = rightFixedColumns;
|
|
14632
|
+
states.originColumns = originColumns;
|
|
14633
|
+
states.headerRows = headerRows;
|
|
14634
|
+
}
|
|
14635
|
+
// 选择
|
|
14636
|
+
isSelected(row) {
|
|
14637
|
+
const { selection = [] } = this.states;
|
|
14638
|
+
return selection.includes(row);
|
|
14639
|
+
}
|
|
14640
|
+
/**
|
|
14641
|
+
* 清除选择
|
|
14642
|
+
*/
|
|
14643
|
+
clearSelection() {
|
|
14644
|
+
this.states.isAllSelected = false;
|
|
14645
|
+
const oldSelection = this.states.selection;
|
|
14646
|
+
if (this.states.selection.length) {
|
|
14647
|
+
this.states.selection = [];
|
|
14648
|
+
}
|
|
14649
|
+
if (oldSelection.length > 0) {
|
|
14650
|
+
this.table.emit("selection-change", []);
|
|
14651
|
+
}
|
|
14652
|
+
}
|
|
14653
|
+
/**
|
|
14654
|
+
* 清理选择
|
|
14655
|
+
*/
|
|
14656
|
+
cleanSelection() {
|
|
14657
|
+
const { primaryKey } = this.table.props;
|
|
14658
|
+
const { selection = [] } = this.states;
|
|
14659
|
+
let deleted;
|
|
14660
|
+
if (primaryKey) {
|
|
14661
|
+
deleted = [];
|
|
14662
|
+
const selectedMap = getValuesMap(selection, primaryKey);
|
|
14663
|
+
const dataMap = getValuesMap(selection, primaryKey);
|
|
14664
|
+
for (const key in selectedMap) {
|
|
14665
|
+
if (hasOwn(selectedMap, key) && !dataMap[key]) {
|
|
14666
|
+
deleted.push(selectedMap[key].row);
|
|
14667
|
+
}
|
|
14668
|
+
}
|
|
14669
|
+
} else {
|
|
14670
|
+
deleted = selection.filter((item) => {
|
|
14671
|
+
return !this.flatData.value.includes(item);
|
|
14672
|
+
});
|
|
14673
|
+
}
|
|
14674
|
+
deleted.forEach((deletedItem) => {
|
|
14675
|
+
selection.splice(selection.indexOf(deletedItem), 1);
|
|
14676
|
+
});
|
|
14677
|
+
if (deleted.length) {
|
|
14678
|
+
const newSelection = selection.filter((item) => !deleted.includes(item));
|
|
14679
|
+
this.states.selection = newSelection;
|
|
14680
|
+
this.table.emit("selection-change", newSelection.slice());
|
|
14681
|
+
}
|
|
14682
|
+
}
|
|
14683
|
+
/**
|
|
14684
|
+
* 存在副作用
|
|
14685
|
+
* 对statusArr做添加和删除的操作
|
|
14686
|
+
* 如 this.states.selection
|
|
14687
|
+
* @param statusArr ~
|
|
14688
|
+
* @param row ~
|
|
14689
|
+
* @param newVal ~
|
|
14690
|
+
* @returns ~
|
|
14691
|
+
*/
|
|
14692
|
+
toggleRowStatus(statusArr, row, newVal) {
|
|
14693
|
+
let changed = false;
|
|
14694
|
+
const index = statusArr.indexOf(row);
|
|
14695
|
+
const included = index !== -1;
|
|
14696
|
+
const addRow = () => {
|
|
14697
|
+
statusArr.push(row);
|
|
14698
|
+
changed = true;
|
|
14699
|
+
};
|
|
14700
|
+
const removeRow = () => {
|
|
14701
|
+
statusArr.splice(index, 1);
|
|
14702
|
+
changed = true;
|
|
14703
|
+
};
|
|
14704
|
+
if (typeof newVal === "boolean") {
|
|
14705
|
+
if (newVal && !included) {
|
|
14706
|
+
addRow();
|
|
14707
|
+
} else if (!newVal && included) {
|
|
14708
|
+
removeRow();
|
|
14709
|
+
}
|
|
14710
|
+
} else {
|
|
14711
|
+
included ? removeRow() : addRow();
|
|
14712
|
+
}
|
|
14713
|
+
return changed;
|
|
14714
|
+
}
|
|
14715
|
+
toggleRowSelection(row, selected, emitChange = true) {
|
|
14716
|
+
const { selection } = this.states;
|
|
14717
|
+
const changed = this.toggleRowStatus(selection, row, selected);
|
|
14718
|
+
if (changed) {
|
|
14719
|
+
const newSelection = (this.states.selection || []).slice();
|
|
14720
|
+
if (emitChange) {
|
|
14721
|
+
this.table.emit("select", newSelection, row);
|
|
14722
|
+
}
|
|
14723
|
+
this.table.emit("selection-change", newSelection);
|
|
14724
|
+
}
|
|
14725
|
+
}
|
|
14726
|
+
toggleAllSelection = debounce$1(() => {
|
|
14727
|
+
const { indeterminate } = this.table.props;
|
|
14728
|
+
const { selection, isAllSelected, selectable } = this.states;
|
|
14729
|
+
const value = indeterminate ? !isAllSelected : !(isAllSelected || selection.length);
|
|
14730
|
+
this.states.isAllSelected = value;
|
|
14731
|
+
let selectionChanged = false;
|
|
14732
|
+
this.flatData.value.forEach((row, index) => {
|
|
14733
|
+
if (selectable) {
|
|
14734
|
+
if (selectable.call(null, row, index) && this.toggleRowStatus(selection, row, value)) {
|
|
14735
|
+
selectionChanged = true;
|
|
14736
|
+
}
|
|
14737
|
+
} else if (this.toggleRowStatus(selection, row, value)) {
|
|
14738
|
+
selectionChanged = true;
|
|
14739
|
+
}
|
|
14740
|
+
});
|
|
14741
|
+
if (selectionChanged) {
|
|
14742
|
+
this.table.emit("selection-change", selection ? selection.slice() : []);
|
|
14743
|
+
}
|
|
14744
|
+
this.table.emit("select-all", selection);
|
|
14745
|
+
}, 10);
|
|
14746
|
+
// 展开行与 TreeTable 都要使用
|
|
14747
|
+
toggleRowExpansionAdapter(row, expanded) {
|
|
14748
|
+
const { columns } = this.states;
|
|
14749
|
+
const hasExpandColumn = columns.some(({ type }) => type === "expand");
|
|
14750
|
+
if (hasExpandColumn) {
|
|
14751
|
+
this.expand.toggle(row, expanded);
|
|
14752
|
+
} else {
|
|
14753
|
+
this.tree.toggle(row, expanded);
|
|
14754
|
+
}
|
|
14755
|
+
}
|
|
14756
|
+
// 适配层,expand-primary-keys 在 Expand 与 TreeTable 中都有使用
|
|
14757
|
+
// 这里会触发额外的计算,但为了兼容性,暂时这么做
|
|
14758
|
+
setExpandRowValueAdapter(val) {
|
|
14759
|
+
this.expand.reset(val);
|
|
14760
|
+
this.tree.expand(val);
|
|
14761
|
+
}
|
|
14762
|
+
updateSelectionByRowKey() {
|
|
14763
|
+
const { primaryKey } = this.table.props;
|
|
14764
|
+
const { selection } = this.states;
|
|
14765
|
+
const selectedMap = getValuesMap(selection, primaryKey);
|
|
14766
|
+
this.states.selection = this.flatData.value.reduce((prev, row) => {
|
|
14767
|
+
const rowId = getRowValue(row, primaryKey);
|
|
14768
|
+
const rowInfo = selectedMap[rowId];
|
|
14769
|
+
if (rowInfo) {
|
|
14770
|
+
prev.push(row);
|
|
14771
|
+
}
|
|
14772
|
+
return prev;
|
|
14773
|
+
}, []);
|
|
14774
|
+
}
|
|
14775
|
+
updateAllSelected() {
|
|
14776
|
+
const { selectable, data = [] } = this.states;
|
|
14777
|
+
if (data.length === 0) {
|
|
14778
|
+
this.states.isAllSelected = false;
|
|
14779
|
+
return;
|
|
14780
|
+
}
|
|
14781
|
+
let isAllSelected = true;
|
|
14782
|
+
let selectedCount = 0;
|
|
14783
|
+
const temp = this.flatData.value;
|
|
14784
|
+
for (let i = 0, j = temp.length; i < j; i++) {
|
|
14785
|
+
const row = temp[i];
|
|
14786
|
+
const isRowSelectable = selectable && selectable.call(null, row, i);
|
|
14787
|
+
if (!this.isSelected(row)) {
|
|
14788
|
+
if (!selectable || isRowSelectable) {
|
|
14789
|
+
isAllSelected = false;
|
|
14790
|
+
break;
|
|
14791
|
+
}
|
|
14792
|
+
} else {
|
|
14793
|
+
selectedCount++;
|
|
14794
|
+
}
|
|
14795
|
+
}
|
|
14796
|
+
if (selectedCount === 0) isAllSelected = false;
|
|
14797
|
+
this.states.isAllSelected = isAllSelected;
|
|
14798
|
+
}
|
|
14799
|
+
updateTableScrollY() {
|
|
14800
|
+
nextTick(() => this.table.exposed.updateScrollY());
|
|
14801
|
+
}
|
|
14802
|
+
// 更新 DOM
|
|
14803
|
+
scheduleLayout(needUpdateColumns) {
|
|
14804
|
+
if (needUpdateColumns) {
|
|
14805
|
+
this.updateColumns();
|
|
14806
|
+
}
|
|
14807
|
+
this.table.exposed.debouncedUpdateLayout();
|
|
14808
|
+
}
|
|
14809
|
+
}
|
|
14810
|
+
|
|
14811
|
+
const useStates = (mapper, $store) => {
|
|
14812
|
+
const instance = getCurrentInstance();
|
|
14813
|
+
const store = $store || instance.proxy?.store;
|
|
14814
|
+
const states = reactive({});
|
|
14815
|
+
Object.keys(mapper).forEach((key) => {
|
|
14816
|
+
const value = mapper[key];
|
|
14817
|
+
if (typeof value === "string") {
|
|
14818
|
+
states[key] = computed(() => {
|
|
14819
|
+
return store.states[value];
|
|
14820
|
+
});
|
|
14821
|
+
} else if (typeof value === "function") {
|
|
14822
|
+
states[key] = computed(() => {
|
|
14823
|
+
return value(store.states);
|
|
14824
|
+
});
|
|
14825
|
+
} else {
|
|
14826
|
+
console.error("invalid value type");
|
|
14827
|
+
}
|
|
14828
|
+
});
|
|
14829
|
+
return states;
|
|
14830
|
+
};
|
|
14831
|
+
|
|
14832
|
+
/** @jsxImportSource vue */
|
|
14833
|
+
|
|
14834
|
+
const COMPONENT_NAME$h = 'vc-table-normal-list';
|
|
14835
|
+
const NormalList = /* @__PURE__ */ defineComponent({
|
|
14836
|
+
name: COMPONENT_NAME$h,
|
|
14837
|
+
props: {
|
|
14838
|
+
data: Array,
|
|
14839
|
+
default: () => []
|
|
14840
|
+
},
|
|
14841
|
+
emits: ['row-resize'],
|
|
14842
|
+
setup(props, {
|
|
14843
|
+
emit,
|
|
14844
|
+
slots
|
|
14845
|
+
}) {
|
|
14846
|
+
const handleResize = (size, index) => {
|
|
14847
|
+
emit('row-resize', {
|
|
14848
|
+
index,
|
|
14849
|
+
size
|
|
14850
|
+
});
|
|
14851
|
+
};
|
|
14852
|
+
return () => {
|
|
14853
|
+
return props.data.map((row, index) => {
|
|
14854
|
+
return createVNode(Item, {
|
|
14855
|
+
"vertical": false,
|
|
14856
|
+
"onChange": e => handleResize(e, index)
|
|
14857
|
+
}, {
|
|
14858
|
+
default: () => [slots.default?.({
|
|
14859
|
+
row,
|
|
14860
|
+
index
|
|
14861
|
+
})]
|
|
14862
|
+
});
|
|
14863
|
+
});
|
|
14864
|
+
};
|
|
14865
|
+
}
|
|
14866
|
+
});
|
|
14867
|
+
|
|
14868
|
+
const TableBody = /* @__PURE__ */ defineComponent({
|
|
14869
|
+
name: 'vc-table-body',
|
|
14870
|
+
props: {
|
|
14871
|
+
store: Object,
|
|
14872
|
+
fixed: String,
|
|
14873
|
+
heightStyle: [Object, Array, String]
|
|
14874
|
+
},
|
|
14875
|
+
emits: ['scroll'],
|
|
14876
|
+
setup(props, {
|
|
14877
|
+
emit,
|
|
14878
|
+
expose
|
|
14879
|
+
}) {
|
|
14880
|
+
const instance = getCurrentInstance();
|
|
14881
|
+
const table = getInstance('table', 'tableId');
|
|
14882
|
+
const states = useStates({
|
|
14883
|
+
data: 'data',
|
|
14884
|
+
list: 'list',
|
|
14885
|
+
columns: 'columns',
|
|
14886
|
+
leftFixedLeafCount: 'leftFixedLeafColumnsLength',
|
|
14887
|
+
rightFixedLeafCount: 'rightFixedLeafColumnsLength',
|
|
14888
|
+
columnsCount: states$ => states$.columns.length,
|
|
14889
|
+
leftFixedCount: states$ => states$.leftFixedColumns.length,
|
|
14890
|
+
rightFixedCount: states$ => states$.rightFixedColumns.length,
|
|
14891
|
+
hasExpandColumn: states$ => states$.columns.some(({
|
|
14892
|
+
type
|
|
14893
|
+
}) => type === 'expand'),
|
|
14894
|
+
firstDefaultColumnIndex: states$ => states$.columns.findIndex(({
|
|
14895
|
+
type
|
|
14896
|
+
}) => type === 'default')
|
|
14897
|
+
});
|
|
14898
|
+
const wrapper = ref();
|
|
14899
|
+
watch(() => props.store.states.hoverRowIndex, (v, oldV) => {
|
|
14900
|
+
if (!props.store.states.isComplex || IS_SERVER$1) return;
|
|
14901
|
+
raf(() => {
|
|
14902
|
+
const rows = instance.vnode.el.querySelectorAll('.vc-table__row');
|
|
14903
|
+
const oldRow = rows[oldV];
|
|
14904
|
+
const newRow = rows[v];
|
|
14905
|
+
oldRow && removeClass(oldRow, 'hover-row');
|
|
14906
|
+
newRow && addClass(newRow, 'hover-row');
|
|
14907
|
+
});
|
|
14908
|
+
});
|
|
14909
|
+
const getValueOfRow = (row, index) => {
|
|
14910
|
+
const {
|
|
14911
|
+
primaryKey
|
|
14912
|
+
} = table.props;
|
|
14913
|
+
if (primaryKey) {
|
|
14914
|
+
return getRowValue(row, primaryKey);
|
|
14915
|
+
}
|
|
14916
|
+
return index;
|
|
14917
|
+
};
|
|
14918
|
+
const isColumnHidden = index => {
|
|
14919
|
+
if (props.fixed === 'left') {
|
|
14920
|
+
return index >= states.leftFixedLeafCount;
|
|
14921
|
+
} else if (props.fixed === 'right') {
|
|
14922
|
+
return index < states.columnsCount - states.rightFixedLeafCount;
|
|
14923
|
+
} else {
|
|
14924
|
+
return index < states.leftFixedLeafCount || index >= states.columnsCount - states.rightFixedLeafCount;
|
|
14925
|
+
}
|
|
14926
|
+
};
|
|
14927
|
+
const columnsHidden = computed(() => {
|
|
14928
|
+
return states.columns.map((_, index) => isColumnHidden(index));
|
|
14929
|
+
});
|
|
14930
|
+
const getRowStyle = (row, rowIndex) => {
|
|
14931
|
+
const {
|
|
14932
|
+
rowStyle
|
|
14933
|
+
} = table.props;
|
|
14934
|
+
if (typeof rowStyle === 'function') {
|
|
14935
|
+
return rowStyle.call(null, {
|
|
14936
|
+
row,
|
|
14937
|
+
rowIndex
|
|
14938
|
+
});
|
|
14939
|
+
}
|
|
14940
|
+
return rowStyle || null;
|
|
14941
|
+
};
|
|
14942
|
+
const getRowClass = (row, rowIndex) => {
|
|
14943
|
+
const classes = ['vc-table__row'];
|
|
14944
|
+
if (table.props.highlight && row === props.store.states.currentRow) {
|
|
14945
|
+
classes.push('current-row');
|
|
14946
|
+
}
|
|
14947
|
+
if (table.props.stripe && rowIndex % 2 === 1) {
|
|
14948
|
+
classes.push('vc-table__row--striped');
|
|
14949
|
+
}
|
|
14950
|
+
const rowClass = table.props.rowClass;
|
|
14951
|
+
if (typeof rowClass === 'string') {
|
|
14952
|
+
classes.push(rowClass);
|
|
14953
|
+
} else if (typeof rowClass === 'function') {
|
|
14954
|
+
classes.push(rowClass.call(null, {
|
|
14955
|
+
row,
|
|
14956
|
+
rowIndex
|
|
14957
|
+
}));
|
|
14958
|
+
}
|
|
14959
|
+
if (props.store.states.expandRows.indexOf(row) > -1) {
|
|
14960
|
+
classes.push('expanded');
|
|
14961
|
+
}
|
|
14962
|
+
return classes;
|
|
14963
|
+
};
|
|
14964
|
+
const getCellStyle = (rowIndex, columnIndex, row, column) => {
|
|
14965
|
+
const {
|
|
14966
|
+
cellStyle
|
|
14967
|
+
} = table.props;
|
|
14968
|
+
if (typeof cellStyle === 'function') {
|
|
14969
|
+
return cellStyle.call(null, {
|
|
14970
|
+
rowIndex,
|
|
14971
|
+
columnIndex,
|
|
14972
|
+
row,
|
|
14973
|
+
column
|
|
14974
|
+
});
|
|
14975
|
+
}
|
|
14976
|
+
return cellStyle;
|
|
14977
|
+
};
|
|
14978
|
+
const getCellClass = (rowIndex, columnIndex, row, column) => {
|
|
14979
|
+
const classes = [column.realAlign, column.className];
|
|
14980
|
+
if (isColumnHidden(columnIndex)) {
|
|
14981
|
+
classes.push('is-hidden');
|
|
14982
|
+
}
|
|
14983
|
+
const cellClass = table.props.cellClass;
|
|
14984
|
+
if (typeof cellClass === 'string') {
|
|
14985
|
+
classes.push(cellClass);
|
|
14986
|
+
} else if (typeof cellClass === 'function') {
|
|
14987
|
+
classes.push(cellClass.call(null, {
|
|
14988
|
+
rowIndex,
|
|
14989
|
+
columnIndex,
|
|
14990
|
+
row,
|
|
14991
|
+
column
|
|
14992
|
+
}));
|
|
14993
|
+
}
|
|
14994
|
+
return classes.join(' ');
|
|
14995
|
+
};
|
|
14996
|
+
const handleCellMouseEnter = (e, row) => {
|
|
14997
|
+
const cell = getCell(e);
|
|
14998
|
+
if (cell) {
|
|
14999
|
+
const column = getColumnByCell(states.columns, cell);
|
|
15000
|
+
const hoverState = {
|
|
15001
|
+
cell,
|
|
15002
|
+
column,
|
|
15003
|
+
row
|
|
15004
|
+
};
|
|
15005
|
+
table.exposed.hoverState.value = hoverState;
|
|
15006
|
+
table.emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, e);
|
|
15007
|
+
}
|
|
15008
|
+
|
|
15009
|
+
// 判断是否text-overflow, 如果是就显示tooltip
|
|
15010
|
+
const cellChild = e.target.querySelector('.vc-table__cell');
|
|
15011
|
+
if (!(hasClass(cellChild, 'vc-popover') && cellChild.childNodes.length)) {
|
|
15012
|
+
return;
|
|
15013
|
+
}
|
|
15014
|
+
// 使用范围宽度而不是滚动宽度来确定文本是否溢出,以解决潜在的FireFox bug
|
|
15015
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1074543#c3
|
|
15016
|
+
const range = document.createRange();
|
|
15017
|
+
range.setStart(cellChild, 0);
|
|
15018
|
+
range.setEnd(cellChild, cellChild.childNodes.length);
|
|
15019
|
+
const rangeWidth = range.getBoundingClientRect().width;
|
|
15020
|
+
const padding = (parseInt(cellChild.style.paddingLeft, 10) || 0) + (parseInt(cellChild.style.paddingRight, 10) || 0);
|
|
15021
|
+
if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
|
|
15022
|
+
Popover.open({
|
|
15023
|
+
el: document.body,
|
|
15024
|
+
name: 'vc-table-popover',
|
|
15025
|
+
// 确保不重复创建
|
|
15026
|
+
triggerEl: cell,
|
|
15027
|
+
hover: true,
|
|
15028
|
+
theme: 'dark',
|
|
15029
|
+
placement: 'top',
|
|
15030
|
+
content: cell.innerText || cell.textContent,
|
|
15031
|
+
alone: true
|
|
15032
|
+
});
|
|
15033
|
+
}
|
|
15034
|
+
};
|
|
15035
|
+
const handleCellMouseLeave = e => {
|
|
15036
|
+
const cell = getCell(e);
|
|
15037
|
+
if (!cell) return;
|
|
15038
|
+
const oldHoverState = table.exposed.hoverState.value || {};
|
|
15039
|
+
table.emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, e);
|
|
15040
|
+
};
|
|
15041
|
+
const handleMouseEnter = debounce(index => {
|
|
15042
|
+
props.store.setHoverRow(index);
|
|
15043
|
+
}, 30);
|
|
15044
|
+
const handleMouseLeave = debounce(() => {
|
|
15045
|
+
props.store.setHoverRow(null);
|
|
15046
|
+
}, 30);
|
|
15047
|
+
const handleEvent = (e, row, name) => {
|
|
15048
|
+
const cell = getCell(e);
|
|
15049
|
+
let column;
|
|
15050
|
+
if (cell) {
|
|
15051
|
+
column = getColumnByCell(states.columns, cell);
|
|
15052
|
+
if (column) {
|
|
15053
|
+
table.emit(`cell-${name}`, row, column, cell, e);
|
|
15054
|
+
}
|
|
15055
|
+
}
|
|
15056
|
+
table.emit(`row-${name}`, row, column, e);
|
|
15057
|
+
};
|
|
15058
|
+
const handleContextMenu = (e, row) => {
|
|
15059
|
+
handleEvent(e, row, 'contextmenu');
|
|
15060
|
+
};
|
|
15061
|
+
const handleDoubleClick = (e, row) => {
|
|
15062
|
+
handleEvent(e, row, 'dblclick');
|
|
15063
|
+
};
|
|
15064
|
+
const handleClick = (e, row) => {
|
|
15065
|
+
props.store.setCurrentRow(row);
|
|
15066
|
+
handleEvent(e, row, 'click');
|
|
15067
|
+
};
|
|
15068
|
+
const renderRow = (rowData, rowIndex) => {
|
|
15069
|
+
const {
|
|
15070
|
+
data: row
|
|
15071
|
+
} = rowData;
|
|
15072
|
+
const {
|
|
15073
|
+
columns
|
|
15074
|
+
} = states;
|
|
15075
|
+
const key = getValueOfRow(row, rowIndex);
|
|
15076
|
+
return createVNode("div", {
|
|
15077
|
+
"key": key,
|
|
15078
|
+
"class": [getRowClass(row, rowIndex), 'vc-table__tr'],
|
|
15079
|
+
"style": getRowStyle(row, rowIndex),
|
|
15080
|
+
"onDblclick": e => handleDoubleClick(e, row),
|
|
15081
|
+
"onClick": e => handleClick(e, row),
|
|
15082
|
+
"onContextmenu": e => handleContextMenu(e, row),
|
|
15083
|
+
"onMouseenter": () => handleMouseEnter(rowIndex),
|
|
15084
|
+
"onMouseleave": () => handleMouseLeave()
|
|
15085
|
+
}, [columns.map((column, columnIndex) => {
|
|
15086
|
+
const {
|
|
15087
|
+
realWidth,
|
|
15088
|
+
renderCell
|
|
15089
|
+
} = column;
|
|
15090
|
+
const sizeStyle = {
|
|
15091
|
+
width: `${realWidth}px`,
|
|
15092
|
+
height: `${rowData.height ? `${rowData.height}px` : 'auto'}`
|
|
15093
|
+
};
|
|
15094
|
+
if (columnsHidden.value[columnIndex]) {
|
|
15095
|
+
return createVNode("div", {
|
|
15096
|
+
"style": [sizeStyle]
|
|
15097
|
+
}, null);
|
|
15098
|
+
}
|
|
15099
|
+
return createVNode("div", {
|
|
15100
|
+
"style": [getCellStyle(rowIndex, columnIndex, row, column), sizeStyle],
|
|
15101
|
+
"class": [getCellClass(rowIndex, columnIndex, row, column), 'vc-table__td'],
|
|
15102
|
+
"onMouseenter": e => handleCellMouseEnter(e, row),
|
|
15103
|
+
"onMouseleave": e => handleCellMouseLeave(e)
|
|
15104
|
+
}, [renderCell({
|
|
15105
|
+
row,
|
|
15106
|
+
column,
|
|
15107
|
+
rowIndex,
|
|
15108
|
+
columnIndex,
|
|
15109
|
+
store: props.store
|
|
15110
|
+
})]);
|
|
15111
|
+
})]);
|
|
15112
|
+
};
|
|
15113
|
+
const renderMergeRow = (mergeData, mergeIndex) => {
|
|
15114
|
+
const {
|
|
15115
|
+
rows
|
|
15116
|
+
} = mergeData;
|
|
15117
|
+
return createVNode("div", {
|
|
15118
|
+
"class": "vc-table__merge-row",
|
|
15119
|
+
"key": mergeIndex
|
|
15120
|
+
}, [rows.map(row => {
|
|
15121
|
+
return renderRow(row, row.index);
|
|
15122
|
+
})]);
|
|
15123
|
+
};
|
|
15124
|
+
const handleMergeRowResize = v => {
|
|
15125
|
+
states.list[v.index].rows.forEach(row => {
|
|
15126
|
+
row.heightMap[props.fixed || 'main'] = v.size;
|
|
15127
|
+
const heights = [row.heightMap.main];
|
|
15128
|
+
if (states.leftFixedCount) {
|
|
15129
|
+
heights.push(row.heightMap.left);
|
|
15130
|
+
}
|
|
15131
|
+
if (states.rightFixedCount) {
|
|
15132
|
+
heights.push(row.heightMap.right);
|
|
15133
|
+
}
|
|
15134
|
+
if (heights.every(i => !!i)) {
|
|
15135
|
+
row.height = Math.max(row.heightMap.left, row.heightMap.main, row.heightMap.right) || '';
|
|
15136
|
+
}
|
|
15137
|
+
});
|
|
15138
|
+
};
|
|
15139
|
+
expose({
|
|
15140
|
+
wrapper,
|
|
15141
|
+
getRootElement: () => instance.vnode.el
|
|
15142
|
+
});
|
|
15143
|
+
const layout = table.exposed.layout;
|
|
15144
|
+
return () => {
|
|
15145
|
+
return createVNode("div", {
|
|
15146
|
+
"class": "vc-table__body"
|
|
15147
|
+
}, [table.props.height ? createVNode(RecycleList, {
|
|
15148
|
+
"ref": wrapper,
|
|
15149
|
+
"data": states.list,
|
|
15150
|
+
"disabled": true,
|
|
15151
|
+
"class": "vc-table__tbody",
|
|
15152
|
+
"scrollerOptions": {
|
|
15153
|
+
barTo: `.${table.exposed.tableId}`,
|
|
15154
|
+
native: false,
|
|
15155
|
+
always: false,
|
|
15156
|
+
showBar: !props.fixed,
|
|
15157
|
+
stopPropagation: !props.fixed,
|
|
15158
|
+
trackOffsetY: [layout.states.headerHeight, 0, -layout.states.headerHeight - layout.states.footerHeight + 2,
|
|
15159
|
+
// 2为上下border的高度
|
|
15160
|
+
0]
|
|
15161
|
+
},
|
|
15162
|
+
"pageSize": table.props.rows,
|
|
15163
|
+
"onScroll": e => emit('scroll', e),
|
|
15164
|
+
"onRowResize": handleMergeRowResize,
|
|
15165
|
+
"style": props.heightStyle
|
|
15166
|
+
}, {
|
|
15167
|
+
default: ({
|
|
15168
|
+
row,
|
|
15169
|
+
index
|
|
15170
|
+
}) => renderMergeRow(row, index)
|
|
15171
|
+
}) : createVNode(NormalList, {
|
|
15172
|
+
"data": states.list,
|
|
15173
|
+
"onRowResize": handleMergeRowResize
|
|
15174
|
+
}, {
|
|
15175
|
+
default: ({
|
|
15176
|
+
row,
|
|
15177
|
+
index
|
|
15178
|
+
}) => renderMergeRow(row, index)
|
|
15179
|
+
})]);
|
|
15180
|
+
};
|
|
15181
|
+
}
|
|
15182
|
+
});
|
|
15183
|
+
|
|
15184
|
+
// import TableSort from './table-sort';
|
|
15185
|
+
// import TableFilter from './table-filter';
|
|
15186
|
+
|
|
15187
|
+
const TableSort = 'div';
|
|
15188
|
+
const TableFilter = 'div';
|
|
15189
|
+
const TableHeader = /* @__PURE__ */ defineComponent({
|
|
15190
|
+
name: 'vc-table-header',
|
|
15191
|
+
props: {
|
|
15192
|
+
fixed: [Boolean, String],
|
|
15193
|
+
store: {
|
|
15194
|
+
type: Object,
|
|
15195
|
+
required: true
|
|
15196
|
+
},
|
|
15197
|
+
border: Boolean,
|
|
15198
|
+
// 排序全部交给外部处理,内部不处理数据,只做交互
|
|
15199
|
+
defaultSort: {
|
|
15200
|
+
type: Object,
|
|
15201
|
+
default: () => ({})
|
|
15202
|
+
}
|
|
15203
|
+
},
|
|
15204
|
+
setup(props) {
|
|
15205
|
+
const table = getInstance('table', 'tableId');
|
|
15206
|
+
const instance = getCurrentInstance();
|
|
15207
|
+
const draggingColumn = ref(null);
|
|
15208
|
+
const dragging = ref(false);
|
|
15209
|
+
const dragState = ref({});
|
|
15210
|
+
const states = useStates({
|
|
15211
|
+
columns: 'columns',
|
|
15212
|
+
isAllSelected: 'isAllSelected',
|
|
15213
|
+
leftFixedLeafCount: 'leftFixedLeafColumnsLength',
|
|
15214
|
+
rightFixedLeafCount: 'rightFixedLeafColumnsLength',
|
|
15215
|
+
isGroup: 'isGroup',
|
|
15216
|
+
headerRows: 'headerRows',
|
|
15217
|
+
columnsCount: $states => $states.columns.length,
|
|
15218
|
+
leftFixedCount: $states => $states.leftFixedColumns.length,
|
|
15219
|
+
rightFixedCount: $states => $states.rightFixedColumns.length
|
|
15220
|
+
});
|
|
15221
|
+
const isColumnHidden = index => {
|
|
15222
|
+
let start = 0;
|
|
15223
|
+
for (let i = 0; i < index; i++) {
|
|
15224
|
+
start += states.columns[i].colSpan;
|
|
15225
|
+
}
|
|
15226
|
+
const after = start + states.columns[index].colSpan - 1;
|
|
15227
|
+
if (props.fixed === true || props.fixed === 'left') {
|
|
15228
|
+
return after >= states.leftFixedLeafCount;
|
|
15229
|
+
} else if (props.fixed === 'right') {
|
|
15230
|
+
return start < states.columnsCount - states.rightFixedLeafCount;
|
|
15231
|
+
} else {
|
|
15232
|
+
return after < states.leftFixedLeafCount || start >= states.columnsCount - states.rightFixedLeafCount;
|
|
15233
|
+
}
|
|
15234
|
+
};
|
|
15235
|
+
const columnsHidden = computed(() => {
|
|
15236
|
+
return states.columns.map((_, index) => isColumnHidden(index));
|
|
15237
|
+
});
|
|
15238
|
+
const getHeaderRowStyle = rowIndex => {
|
|
15239
|
+
const {
|
|
15240
|
+
headerRowStyle
|
|
15241
|
+
} = table.props;
|
|
15242
|
+
if (typeof headerRowStyle === 'function') {
|
|
15243
|
+
return headerRowStyle.call(null, {
|
|
15244
|
+
rowIndex
|
|
15245
|
+
});
|
|
15246
|
+
}
|
|
15247
|
+
return headerRowStyle;
|
|
15248
|
+
};
|
|
15249
|
+
const getHeaderRowClass = rowIndex => {
|
|
15250
|
+
const classes = [];
|
|
15251
|
+
const {
|
|
15252
|
+
headerRowClass
|
|
15253
|
+
} = table.props;
|
|
15254
|
+
if (typeof headerRowClass === 'string') {
|
|
15255
|
+
classes.push(headerRowClass);
|
|
15256
|
+
} else if (typeof headerRowClass === 'function') {
|
|
15257
|
+
classes.push(headerRowClass.call(null, {
|
|
15258
|
+
rowIndex
|
|
15259
|
+
}));
|
|
15260
|
+
}
|
|
15261
|
+
return classes.join(' ');
|
|
15262
|
+
};
|
|
15263
|
+
const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
|
|
15264
|
+
const {
|
|
15265
|
+
headerCellStyle
|
|
15266
|
+
} = table.props;
|
|
15267
|
+
if (typeof headerCellStyle === 'function') {
|
|
15268
|
+
return headerCellStyle.call(null, {
|
|
15269
|
+
rowIndex,
|
|
15270
|
+
columnIndex,
|
|
15271
|
+
row,
|
|
15272
|
+
column
|
|
15273
|
+
});
|
|
15274
|
+
}
|
|
15275
|
+
return headerCellStyle;
|
|
15276
|
+
};
|
|
15277
|
+
const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
|
|
15278
|
+
const classes = [column.id, column.order, column.realHeaderAlign, column.className, column.labelClass];
|
|
15279
|
+
if (rowIndex === 0 && columnsHidden.value[columnIndex]) {
|
|
15280
|
+
classes.push('is-hidden');
|
|
15281
|
+
}
|
|
15282
|
+
if (!column.children) {
|
|
15283
|
+
classes.push('is-leaf');
|
|
15284
|
+
}
|
|
15285
|
+
const {
|
|
15286
|
+
headerCellClass
|
|
15287
|
+
} = table.props;
|
|
15288
|
+
if (typeof headerCellClass === 'string') {
|
|
15289
|
+
classes.push(headerCellClass);
|
|
15290
|
+
} else if (typeof headerCellClass === 'function') {
|
|
15291
|
+
classes.push(headerCellClass.call(null, {
|
|
15292
|
+
rowIndex,
|
|
15293
|
+
columnIndex,
|
|
15294
|
+
row,
|
|
15295
|
+
column
|
|
15296
|
+
}));
|
|
15297
|
+
}
|
|
15298
|
+
return classes.join(' ');
|
|
15299
|
+
};
|
|
15300
|
+
const handleHeaderClick = (e, column) => {
|
|
15301
|
+
table.emit('header-click', column, e);
|
|
15302
|
+
};
|
|
15303
|
+
const handleHeaderContextMenu = (e, column) => {
|
|
15304
|
+
table.emit('header-contextmenu', column, e);
|
|
15305
|
+
};
|
|
15306
|
+
const handleMouseDown = (e, column) => {
|
|
15307
|
+
if (IS_SERVER$1) return;
|
|
15308
|
+
if (column.children && column.children.length > 0) return;
|
|
15309
|
+
/* istanbul ignore if */
|
|
15310
|
+
if (draggingColumn.value && props.border) {
|
|
15311
|
+
dragging.value = true;
|
|
15312
|
+
table.exposed.resizeProxyVisible.value = true;
|
|
15313
|
+
const tableEl = table.vnode.el;
|
|
15314
|
+
const tableLeft = tableEl.getBoundingClientRect().left;
|
|
15315
|
+
const columnEl = instance.vnode.el.querySelector(`.vc-table__th.${column.id}`);
|
|
15316
|
+
const columnRect = columnEl.getBoundingClientRect();
|
|
15317
|
+
const minLeft = columnRect.left - tableLeft + 30;
|
|
15318
|
+
addClass(columnEl, 'noclick');
|
|
15319
|
+
dragState.value = {
|
|
15320
|
+
startMouseLeft: e.clientX,
|
|
15321
|
+
startLeft: columnRect.right - tableLeft,
|
|
15322
|
+
startColumnLeft: columnRect.left - tableLeft,
|
|
15323
|
+
tableLeft
|
|
15324
|
+
};
|
|
15325
|
+
const resizeProxy = table.exposed.resizeProxy.value;
|
|
15326
|
+
resizeProxy.style.left = dragState.value.startLeft + 'px';
|
|
15327
|
+
document.onselectstart = () => false;
|
|
15328
|
+
document.ondragstart = () => false;
|
|
15329
|
+
const handleMouseMove = $e => {
|
|
15330
|
+
const deltaLeft = $e.clientX - dragState.value.startMouseLeft;
|
|
15331
|
+
const proxyLeft = dragState.value.startLeft + deltaLeft;
|
|
15332
|
+
resizeProxy.style.left = Math.max(minLeft, proxyLeft) + 'px';
|
|
15333
|
+
};
|
|
15334
|
+
const handleMouseUp = () => {
|
|
15335
|
+
if (dragging.value) {
|
|
15336
|
+
const {
|
|
15337
|
+
startColumnLeft,
|
|
15338
|
+
startLeft
|
|
15339
|
+
} = dragState.value;
|
|
15340
|
+
const finalLeft = parseInt(resizeProxy.style.left, 10);
|
|
15341
|
+
const columnWidth = finalLeft - startColumnLeft;
|
|
15342
|
+
column.width = columnWidth;
|
|
15343
|
+
column.realWidth = column.width;
|
|
15344
|
+
table.$emit('header-dragend', column.width, startLeft - startColumnLeft, column, event);
|
|
15345
|
+
props.store.scheduleLayout();
|
|
15346
|
+
document.body.style.cursor = '';
|
|
15347
|
+
dragging.value = false;
|
|
15348
|
+
draggingColumn.value = null;
|
|
15349
|
+
dragState.value = {};
|
|
15350
|
+
table.resizeProxyVisible = false;
|
|
15351
|
+
}
|
|
15352
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
15353
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
15354
|
+
document.onselectstart = null;
|
|
15355
|
+
document.ondragstart = null;
|
|
15356
|
+
setTimeout(function () {
|
|
15357
|
+
removeClass(columnEl, 'noclick');
|
|
15358
|
+
}, 0);
|
|
15359
|
+
};
|
|
15360
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
15361
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
15362
|
+
}
|
|
15363
|
+
};
|
|
15364
|
+
const handleMouseMove = (event, column) => {
|
|
15365
|
+
if (column.children && column.children.length > 0) return;
|
|
15366
|
+
let target = event.target;
|
|
15367
|
+
while (target && !target.classList?.contains?.('vc-table__th')) {
|
|
15368
|
+
target = target.parentNode;
|
|
15369
|
+
}
|
|
15370
|
+
if (!column || !column.resizable) return;
|
|
15371
|
+
if (!dragging.value && props.border) {
|
|
15372
|
+
const rect = target.getBoundingClientRect();
|
|
15373
|
+
const bodyStyle = document.body.style;
|
|
15374
|
+
if (rect.width > 12 && rect.right - event.pageX < 8) {
|
|
15375
|
+
bodyStyle.cursor = 'col-resize';
|
|
15376
|
+
if (hasClass(target, 'is-sortable')) {
|
|
15377
|
+
target.style.cursor = 'col-resize';
|
|
15378
|
+
}
|
|
15379
|
+
draggingColumn.value = column;
|
|
15380
|
+
} else if (!dragging.value) {
|
|
15381
|
+
bodyStyle.cursor = '';
|
|
15382
|
+
if (hasClass(target, 'is-sortable')) {
|
|
15383
|
+
target.style.cursor = 'pointer';
|
|
15384
|
+
}
|
|
15385
|
+
draggingColumn.value = null;
|
|
15386
|
+
}
|
|
15387
|
+
}
|
|
15388
|
+
};
|
|
15389
|
+
const handleMouseOut = () => {
|
|
15390
|
+
if (IS_SERVER$1) return;
|
|
15391
|
+
document.body.style.cursor = '';
|
|
15392
|
+
};
|
|
15393
|
+
const handleSort = (prop, order) => {
|
|
15394
|
+
table.emit('sort-change', {
|
|
15395
|
+
prop,
|
|
15396
|
+
order
|
|
15397
|
+
});
|
|
15398
|
+
};
|
|
15399
|
+
const handleFilter = (column, value) => {
|
|
15400
|
+
const {
|
|
15401
|
+
filter
|
|
15402
|
+
} = column;
|
|
15403
|
+
filter && filter(value);
|
|
15404
|
+
};
|
|
15405
|
+
const handleCellMouseEnter = (e, column) => {
|
|
15406
|
+
Popover.open({
|
|
15407
|
+
el: document.body,
|
|
15408
|
+
name: 'vc-table-header-popover',
|
|
15409
|
+
// 确保不重复创建
|
|
15410
|
+
triggerEl: e.currentTarget,
|
|
15411
|
+
hover: true,
|
|
15412
|
+
theme: 'dark',
|
|
15413
|
+
placement: 'top',
|
|
15414
|
+
content: column.tooltip,
|
|
15415
|
+
alone: true
|
|
15416
|
+
});
|
|
15417
|
+
};
|
|
15418
|
+
return () => {
|
|
15419
|
+
return createVNode("div", {
|
|
15420
|
+
"class": "vc-table__header"
|
|
15421
|
+
}, [createVNode("div", {
|
|
15422
|
+
"class": [{
|
|
15423
|
+
'is-group': states.isGroup
|
|
15424
|
+
}, 'vc-table__thead']
|
|
15425
|
+
}, [
|
|
15426
|
+
// renderList
|
|
15427
|
+
states.headerRows.map((columns, rowIndex) => createVNode("div", {
|
|
15428
|
+
"style": getHeaderRowStyle(rowIndex),
|
|
15429
|
+
"class": [getHeaderRowClass(rowIndex), 'vc-table__tr']
|
|
15430
|
+
}, [columns.map((column, columnIndex) => createVNode("div", {
|
|
15431
|
+
"onMousemove": e => handleMouseMove(e, column),
|
|
15432
|
+
"onMouseout": handleMouseOut,
|
|
15433
|
+
"onMousedown": e => handleMouseDown(e, column),
|
|
15434
|
+
"onClick": e => handleHeaderClick(e, column),
|
|
15435
|
+
"onContextmenu": e => handleHeaderContextMenu(e, column),
|
|
15436
|
+
"style": [getHeaderCellStyle(rowIndex, columnIndex, columns, column), {
|
|
15437
|
+
width: `${column.realWidth}px`
|
|
15438
|
+
}],
|
|
15439
|
+
"class": [getHeaderCellClass(rowIndex, columnIndex, columns, column), 'vc-table__th'],
|
|
15440
|
+
"key": column.id
|
|
15441
|
+
}, [createVNode("div", {
|
|
15442
|
+
"class": ['vc-table__cell',
|
|
15443
|
+
// {
|
|
15444
|
+
// "highlight": column.filteredValue && column.filteredValue.length > 0
|
|
15445
|
+
// },
|
|
15446
|
+
column.labelClass]
|
|
15447
|
+
}, [column.renderHeader ? column.renderHeader({
|
|
15448
|
+
column,
|
|
15449
|
+
columnIndex,
|
|
15450
|
+
store: props.store
|
|
15451
|
+
}) : column.label, column.tooltip ? createVNode(Icon, {
|
|
15452
|
+
"type": "o-info",
|
|
15453
|
+
"onMouseenter": e => handleCellMouseEnter(e, column)
|
|
15454
|
+
}, null) : null, column.sortable ? createVNode(TableSort, {
|
|
15455
|
+
"order": column.prop === props.defaultSort.prop ? props.defaultSort.order : '',
|
|
15456
|
+
"onClick": order => handleSort(column.prop, order)
|
|
15457
|
+
}, null) : null, column.filters ? createVNode(TableFilter, {
|
|
15458
|
+
"data": column.filters,
|
|
15459
|
+
"value": column.filteredValue,
|
|
15460
|
+
"icon": column.filterIcon,
|
|
15461
|
+
"portalClass": column.filterPopupClass,
|
|
15462
|
+
"multiple": column.filterMultiple,
|
|
15463
|
+
"onChange": v => handleFilter(column, v)
|
|
15464
|
+
}, null) : null])]))]))])]);
|
|
15465
|
+
};
|
|
15466
|
+
}
|
|
15467
|
+
});
|
|
15468
|
+
|
|
15469
|
+
const TableFooter = /* @__PURE__ */ defineComponent({
|
|
15470
|
+
name: 'vc-table-footer',
|
|
15471
|
+
props: {
|
|
15472
|
+
fixed: [String, Boolean],
|
|
15473
|
+
store: {
|
|
15474
|
+
type: Object,
|
|
15475
|
+
required: true
|
|
15476
|
+
},
|
|
15477
|
+
getSummary: Function,
|
|
15478
|
+
sumText: String,
|
|
15479
|
+
border: Boolean
|
|
15480
|
+
},
|
|
15481
|
+
setup(props) {
|
|
15482
|
+
const states = useStates({
|
|
15483
|
+
data: 'data',
|
|
15484
|
+
columns: 'columns',
|
|
15485
|
+
isAllSelected: 'isAllSelected',
|
|
15486
|
+
leftFixedLeafCount: 'leftFixedLeafColumnsLength',
|
|
15487
|
+
rightFixedLeafCount: 'rightFixedLeafColumnsLength',
|
|
15488
|
+
columnsCount: $states => $states.columns.length,
|
|
15489
|
+
leftFixedCount: $states => $states.leftFixedColumns.length,
|
|
15490
|
+
rightFixedCount: $states => $states.rightFixedColumns.length
|
|
15491
|
+
});
|
|
15492
|
+
const isColumnHidden = (column, index) => {
|
|
15493
|
+
if (props.fixed === true || props.fixed === 'left') {
|
|
15494
|
+
return index >= states.leftFixedLeafCount;
|
|
15495
|
+
} else if (props.fixed === 'right') {
|
|
15496
|
+
let before = 0;
|
|
15497
|
+
for (let i = 0; i < index; i++) {
|
|
15498
|
+
before += states.columns[i].colSpan;
|
|
15499
|
+
}
|
|
15500
|
+
return before < states.columnsCount - states.rightFixedLeafCount;
|
|
15501
|
+
} else if (!props.fixed && column.fixed) {
|
|
15502
|
+
return true;
|
|
15503
|
+
} else {
|
|
15504
|
+
return index < states.leftFixedCount || index >= states.columnsCount - states.rightFixedCount;
|
|
15505
|
+
}
|
|
15506
|
+
};
|
|
15507
|
+
const columnsHidden = computed(() => states.columns.map(isColumnHidden));
|
|
15508
|
+
const getRowClasses = (column, columnIndex) => {
|
|
15509
|
+
const classes = [column.realAlign, column.labelClass];
|
|
15510
|
+
if (column.className) {
|
|
15511
|
+
classes.push(column.className);
|
|
15512
|
+
}
|
|
15513
|
+
if (columnsHidden.value[columnIndex]) {
|
|
15514
|
+
classes.push('is-hidden');
|
|
15515
|
+
}
|
|
15516
|
+
if (!column.children) {
|
|
15517
|
+
classes.push('is-leaf');
|
|
15518
|
+
}
|
|
15519
|
+
return classes;
|
|
15520
|
+
};
|
|
15521
|
+
const sums = computed(() => {
|
|
15522
|
+
let v = [];
|
|
15523
|
+
if (props.getSummary) {
|
|
15524
|
+
v = props.getSummary({
|
|
15525
|
+
columns: states.columns,
|
|
15526
|
+
data: states.data
|
|
15527
|
+
});
|
|
15528
|
+
} else {
|
|
15529
|
+
states.columns.forEach((column, index) => {
|
|
15530
|
+
if (index === 0) {
|
|
15531
|
+
v[index] = props.sumText;
|
|
15532
|
+
return;
|
|
15533
|
+
}
|
|
15534
|
+
const values = states.data.map(item => Number(item[column.prop]));
|
|
15535
|
+
const precisions = [];
|
|
15536
|
+
let notNumber = true;
|
|
15537
|
+
values.forEach(value => {
|
|
15538
|
+
if (!isNaN(value)) {
|
|
15539
|
+
notNumber = false;
|
|
15540
|
+
const decimal = ('' + value).split('.')[1];
|
|
15541
|
+
precisions.push(decimal ? decimal.length : 0);
|
|
15542
|
+
}
|
|
15543
|
+
});
|
|
15544
|
+
const precision = Math.max.apply(null, precisions);
|
|
15545
|
+
if (!notNumber) {
|
|
15546
|
+
v[index] = values.reduce((prev, curr) => {
|
|
15547
|
+
const value = Number(curr);
|
|
15548
|
+
if (!isNaN(value)) {
|
|
15549
|
+
return parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
|
|
15550
|
+
} else {
|
|
15551
|
+
return prev;
|
|
15552
|
+
}
|
|
15553
|
+
}, 0);
|
|
15554
|
+
} else {
|
|
15555
|
+
v[index] = '';
|
|
15556
|
+
}
|
|
15557
|
+
});
|
|
15558
|
+
}
|
|
15559
|
+
return v;
|
|
15560
|
+
});
|
|
15561
|
+
return () => {
|
|
15562
|
+
return createVNode("div", {
|
|
15563
|
+
"class": "vc-table__footer",
|
|
15564
|
+
"cellspacing": "0",
|
|
15565
|
+
"cellpadding": "0",
|
|
15566
|
+
"border": "0"
|
|
15567
|
+
}, [createVNode("div", {
|
|
15568
|
+
"class": "vc-table__tbody"
|
|
15569
|
+
}, [createVNode("div", {
|
|
15570
|
+
"class": "vc-table__tr"
|
|
15571
|
+
}, [states.columns.map((column, columnIndex) => createVNode("div", {
|
|
15572
|
+
"key": columnIndex,
|
|
15573
|
+
"class": [getRowClasses(column, columnIndex), 'vc-table__td'],
|
|
15574
|
+
"style": [{
|
|
15575
|
+
width: `${column.realWidth}px`
|
|
15576
|
+
}]
|
|
15577
|
+
}, [createVNode("div", {
|
|
15578
|
+
"class": ['vc-table__cell', column.labelClass]
|
|
15579
|
+
}, [sums.value[columnIndex]])]))])])]);
|
|
15580
|
+
};
|
|
15581
|
+
}
|
|
15582
|
+
});
|
|
15583
|
+
|
|
15584
|
+
const props$c = {
|
|
15585
|
+
data: {
|
|
15586
|
+
type: Array,
|
|
15587
|
+
default: () => []
|
|
15588
|
+
},
|
|
15589
|
+
width: [String, Number],
|
|
15590
|
+
height: [String, Number],
|
|
15591
|
+
maxHeight: [String, Number],
|
|
15592
|
+
// 列的宽度是否自撑开
|
|
15593
|
+
fit: {
|
|
15594
|
+
type: Boolean,
|
|
15595
|
+
default: true
|
|
15596
|
+
},
|
|
15597
|
+
// 是否为斑马纹 table
|
|
15598
|
+
stripe: Boolean,
|
|
15599
|
+
// 是否带有纵向边框
|
|
15600
|
+
border: Boolean,
|
|
15601
|
+
// 非常影响表格虚拟滚动的性能,按容器的高度手动优化该值
|
|
15602
|
+
// 后续考虑移除,动态计算
|
|
15603
|
+
rows: {
|
|
15604
|
+
type: Number,
|
|
15605
|
+
default: 10
|
|
15606
|
+
},
|
|
15607
|
+
primaryKey: [String, Function],
|
|
15608
|
+
// 是否显示表头
|
|
15609
|
+
showHeader: {
|
|
15610
|
+
type: Boolean,
|
|
15611
|
+
default: true
|
|
15612
|
+
},
|
|
15613
|
+
showSummary: Boolean,
|
|
15614
|
+
sumText: String,
|
|
15615
|
+
getSummary: Function,
|
|
15616
|
+
rowClass: [String, Function],
|
|
15617
|
+
rowStyle: [Object, Function],
|
|
15618
|
+
cellClass: [String, Function],
|
|
15619
|
+
cellStyle: [Object, Function],
|
|
15620
|
+
headerRowClass: [String, Function],
|
|
15621
|
+
headerRowStyle: [Object, Function],
|
|
15622
|
+
headerCellClass: [String, Function],
|
|
15623
|
+
headerCellStyle: [Object, Function],
|
|
15624
|
+
// 当前对应的currentRow是否可高亮
|
|
15625
|
+
highlight: Boolean,
|
|
15626
|
+
// TODO: 支持数组
|
|
15627
|
+
currentRowValue: [String, Number],
|
|
15628
|
+
emptyText: [String, Function],
|
|
15629
|
+
expandRowValue: Array,
|
|
15630
|
+
defaultExpandAll: Boolean,
|
|
15631
|
+
/**
|
|
15632
|
+
* 在多选表格中,当仅有部分行被选中时,点击表头的多选框时的行为。
|
|
15633
|
+
* 若为 true,则选中所有行;若为 false,则取消选择所有行
|
|
15634
|
+
*/
|
|
15635
|
+
indeterminate: {
|
|
15636
|
+
type: Boolean,
|
|
15637
|
+
default: true
|
|
15638
|
+
},
|
|
15639
|
+
lazy: Boolean,
|
|
15640
|
+
// 展示树形数据时,树节点的缩进
|
|
15641
|
+
indent: {
|
|
15642
|
+
type: Number,
|
|
15643
|
+
default: 16
|
|
15644
|
+
},
|
|
15645
|
+
treeMap: {
|
|
15646
|
+
type: Object,
|
|
15647
|
+
default: () => {
|
|
15648
|
+
return {
|
|
15649
|
+
hasChildren: "hasChildren",
|
|
15650
|
+
children: "children"
|
|
15651
|
+
};
|
|
15652
|
+
}
|
|
15653
|
+
},
|
|
15654
|
+
// 树形表格子集是否需要显示选择按钮
|
|
15655
|
+
expandSelectable: {
|
|
15656
|
+
type: Boolean,
|
|
15657
|
+
default: true
|
|
15658
|
+
},
|
|
15659
|
+
loadExpand: Function,
|
|
15660
|
+
getSpan: Function,
|
|
15661
|
+
placeholder: {
|
|
15662
|
+
type: [String, Function],
|
|
15663
|
+
default: "--"
|
|
15664
|
+
},
|
|
15665
|
+
/**
|
|
15666
|
+
* 排序全部交给外部处理,内部不处理数据,只做交互
|
|
15667
|
+
* 列与列之间互斥
|
|
15668
|
+
*/
|
|
15669
|
+
defaultSort: {
|
|
15670
|
+
type: Object,
|
|
15671
|
+
default: () => ({})
|
|
15672
|
+
}
|
|
15673
|
+
};
|
|
15674
|
+
|
|
15675
|
+
/** @jsxImportSource vue */
|
|
15676
|
+
|
|
15677
|
+
const COMPONENT_NAME$g = 'vc-table';
|
|
15678
|
+
const Table = /* @__PURE__ */ defineComponent({
|
|
15679
|
+
name: COMPONENT_NAME$g,
|
|
15680
|
+
props: props$c,
|
|
15681
|
+
emits: ['select', 'select-all', 'selection-change', 'cell-mouse-enter', 'cell-mouse-leave', 'cell-click', 'cell-dblclick', 'row-click', 'row-contextmenu', 'row-dblclick', 'header-click', 'header-contextmenu', 'current-change', 'header-dragend ', 'expand-change', 'sort-change'],
|
|
15682
|
+
setup(props, {
|
|
15683
|
+
slots,
|
|
15684
|
+
expose
|
|
15685
|
+
}) {
|
|
15686
|
+
const instance = getCurrentInstance();
|
|
15687
|
+
const store = new Store({
|
|
15688
|
+
table: instance
|
|
15689
|
+
});
|
|
15690
|
+
const {
|
|
15691
|
+
layout
|
|
15692
|
+
} = store;
|
|
15693
|
+
|
|
15694
|
+
// 由table-column控制
|
|
15695
|
+
const renderExpanded = ref(null);
|
|
15696
|
+
const resizeProxyVisible = ref(false);
|
|
15697
|
+
const resizeState = ref({
|
|
15698
|
+
width: null,
|
|
15699
|
+
height: null
|
|
15700
|
+
});
|
|
15701
|
+
|
|
15702
|
+
// refs
|
|
15703
|
+
const hiddenColumns = ref(null);
|
|
15704
|
+
const headerWrapper = ref(null);
|
|
15705
|
+
const tableHeader = ref(null);
|
|
15706
|
+
const scroller = ref(null);
|
|
15707
|
+
const body = ref();
|
|
15708
|
+
const emptyBlock = ref(null);
|
|
15709
|
+
const appendWrapper = ref(null);
|
|
15710
|
+
const footerWrapper = ref(null);
|
|
15711
|
+
const leftFixedWrapper = ref(null);
|
|
15712
|
+
const leftFixedHeaderWrapper = ref(null);
|
|
15713
|
+
const leftFixedTableHeader = ref(null);
|
|
15714
|
+
const leftFixedBodyWrapper = ref(null);
|
|
15715
|
+
const leftFixedBody = ref(null);
|
|
15716
|
+
const leftFixedFooterWrapper = ref(null);
|
|
15717
|
+
const rightFixedWrapper = ref(null);
|
|
15718
|
+
const rightFixedHeaderWrapper = ref(null);
|
|
15719
|
+
const rightFixedTableHeader = ref(null);
|
|
15720
|
+
const rightFixedBodyWrapper = ref(null);
|
|
15721
|
+
const rightFixedBody = ref(null);
|
|
15722
|
+
const rightFixedFooterWrapper = ref(null);
|
|
15723
|
+
const resizeProxy = ref(null);
|
|
15724
|
+
const scrollPosition = ref('left');
|
|
15725
|
+
const hoverState = ref(null);
|
|
15726
|
+
const isReady = ref(false);
|
|
15727
|
+
const states = useStates({
|
|
15728
|
+
columns: 'columns',
|
|
15729
|
+
leftFixedColumns: 'leftFixedColumns',
|
|
15730
|
+
rightFixedColumns: 'rightFixedColumns',
|
|
15731
|
+
isGroup: 'isGroup'
|
|
15732
|
+
}, store);
|
|
15733
|
+
const classes = computed(() => {
|
|
15734
|
+
return {
|
|
15735
|
+
'vc-table--fit': props.fit,
|
|
15736
|
+
'vc-table--striped': props.stripe,
|
|
15737
|
+
'vc-table--border': props.border || states.isGroup,
|
|
15738
|
+
'vc-table--group': states.isGroup,
|
|
15739
|
+
'vc-table--fluid-height': props.maxHeight,
|
|
15740
|
+
'vc-table--scrollable-x': layout.states.scrollX,
|
|
15741
|
+
'vc-table--scrollable-y': layout.states.scrollY,
|
|
15742
|
+
'vc-table--enable-row-hover': !store.states.isComplex,
|
|
15743
|
+
'vc-table--enable-row-transition': (store.states.data || []).length !== 0 && (store.states.data || []).length < 100
|
|
15744
|
+
};
|
|
15745
|
+
});
|
|
15746
|
+
const bodyXWrapper = computed(() => {
|
|
15747
|
+
return scroller.value?.wrapper;
|
|
15748
|
+
});
|
|
15749
|
+
const bodyYWrapper = computed(() => {
|
|
15750
|
+
return !props.height ? bodyXWrapper.value : body.value.getRootElement().querySelector('.vc-scroller__wrapper');
|
|
15751
|
+
});
|
|
15752
|
+
const shouldUpdateHeight = computed(() => {
|
|
15753
|
+
return props.height || props.maxHeight || states.leftFixedColumns.length > 0 || states.rightFixedColumns.length > 0;
|
|
15754
|
+
});
|
|
15755
|
+
const bodyWidthStyle = computed(() => {
|
|
15756
|
+
const {
|
|
15757
|
+
bodyWidth: $bodyWidth
|
|
15758
|
+
} = layout.states;
|
|
15759
|
+
return {
|
|
15760
|
+
width: $bodyWidth ? $bodyWidth + 'px' : ''
|
|
15761
|
+
};
|
|
15762
|
+
});
|
|
15763
|
+
const bodyHeightStyle = computed(() => {
|
|
15764
|
+
const {
|
|
15765
|
+
headerHeight,
|
|
15766
|
+
bodyHeight: $bodyHeight,
|
|
15767
|
+
footerHeight
|
|
15768
|
+
} = layout.states;
|
|
15769
|
+
if (props.height) {
|
|
15770
|
+
return {
|
|
15771
|
+
height: $bodyHeight ? $bodyHeight + 'px' : ''
|
|
15772
|
+
};
|
|
15773
|
+
} else if (props.maxHeight) {
|
|
15774
|
+
const maxHeight = parseHeight(props.maxHeight);
|
|
15775
|
+
if (maxHeight) {
|
|
15776
|
+
return {
|
|
15777
|
+
'max-height': maxHeight - (footerHeight || 0) - (props.showHeader ? headerHeight || 0 : 0) + 'px'
|
|
15778
|
+
};
|
|
15779
|
+
}
|
|
15780
|
+
}
|
|
15781
|
+
return {};
|
|
15782
|
+
});
|
|
15783
|
+
const fixedHeightStyle = computed(() => {
|
|
15784
|
+
if (props.maxHeight) {
|
|
15785
|
+
if (props.showSummary) {
|
|
15786
|
+
return {
|
|
15787
|
+
bottom: 0
|
|
15788
|
+
};
|
|
15789
|
+
}
|
|
15790
|
+
return {
|
|
15791
|
+
bottom: layout.states.scrollX && props.data.length ? 0 : ''
|
|
15792
|
+
};
|
|
15793
|
+
} else {
|
|
15794
|
+
if (props.showSummary) {
|
|
15795
|
+
return {
|
|
15796
|
+
height: layout.states.tableHeight ? layout.states.tableHeight + 'px' : ''
|
|
15797
|
+
};
|
|
15798
|
+
}
|
|
15799
|
+
return {
|
|
15800
|
+
height: layout.states.viewportHeight ? layout.states.viewportHeight + 'px' : ''
|
|
15801
|
+
};
|
|
15802
|
+
}
|
|
15803
|
+
});
|
|
15804
|
+
let isUnMount = false;
|
|
15805
|
+
const updateScrollY = () => {
|
|
15806
|
+
if (isUnMount) return;
|
|
15807
|
+
layout.updateScrollY();
|
|
15808
|
+
layout.updateColumnsWidth();
|
|
15809
|
+
};
|
|
15810
|
+
|
|
15811
|
+
/**
|
|
15812
|
+
* 对 Table 进行重新布局。
|
|
15813
|
+
* 当 Table 或其祖先元素由隐藏切换为显示时,可能需要调用此方法
|
|
15814
|
+
*/
|
|
15815
|
+
const refreshLayout = () => {
|
|
15816
|
+
if (isUnMount) return;
|
|
15817
|
+
layout.updateColumnsWidth();
|
|
15818
|
+
if (shouldUpdateHeight.value) {
|
|
15819
|
+
layout.updateElsHeight();
|
|
15820
|
+
}
|
|
15821
|
+
scroller.value?.refresh?.();
|
|
15822
|
+
};
|
|
15823
|
+
// 用于多选表格,切换所有行的选中状态
|
|
15824
|
+
const toggleAllSelection = () => {
|
|
15825
|
+
store.toggleAllSelection();
|
|
15826
|
+
};
|
|
15827
|
+
|
|
15828
|
+
// 用于单选表格,设定某一行为选中行,如果调用时不加参数,则会取消目前高亮行的选中状态。
|
|
15829
|
+
const setCurrentRow = row => {
|
|
15830
|
+
store.setCurrentRow(row);
|
|
15831
|
+
};
|
|
15832
|
+
|
|
15833
|
+
// 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中)
|
|
15834
|
+
const toggleRowSelection = (row, selected, emitChange) => {
|
|
15835
|
+
store.toggleRowSelection(row, selected, emitChange);
|
|
15836
|
+
store.updateAllSelected();
|
|
15837
|
+
};
|
|
15838
|
+
|
|
15839
|
+
// 用于可展开表格与树形表格,切换某一行的展开状态;如果使用了第二个参数,则是设置这一行展开与否(expanded 为 true 则展开)
|
|
15840
|
+
const toggleRowExpansion = (row, expanded) => {
|
|
15841
|
+
store.toggleRowExpansionAdapter(row, expanded);
|
|
15842
|
+
};
|
|
15843
|
+
|
|
15844
|
+
// 用于多选表格,清空用户的选择
|
|
15845
|
+
const clearSelection = () => {
|
|
15846
|
+
store.clearSelection();
|
|
15847
|
+
};
|
|
15848
|
+
|
|
15849
|
+
// 同步滚动
|
|
15850
|
+
const handleScollX = throttle(() => {
|
|
15851
|
+
if (!bodyXWrapper.value) return;
|
|
15852
|
+
const {
|
|
15853
|
+
scrollLeft,
|
|
15854
|
+
offsetWidth,
|
|
15855
|
+
scrollWidth
|
|
15856
|
+
} = bodyXWrapper.value;
|
|
15857
|
+
if (headerWrapper.value) headerWrapper.value.scrollLeft = scrollLeft;
|
|
15858
|
+
if (footerWrapper.value) footerWrapper.value.scrollLeft = scrollLeft;
|
|
15859
|
+
const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
|
|
15860
|
+
if (scrollLeft >= maxScrollLeftPosition) {
|
|
15861
|
+
scrollPosition.value = 'right';
|
|
15862
|
+
} else if (scrollLeft === 0) {
|
|
15863
|
+
scrollPosition.value = 'left';
|
|
15864
|
+
} else {
|
|
15865
|
+
scrollPosition.value = 'middle';
|
|
15866
|
+
}
|
|
15867
|
+
if (!props.height) {
|
|
15868
|
+
leftFixedBody.value.getRootElement().scrollTop = bodyXWrapper.value.scrollTop;
|
|
15869
|
+
rightFixedBody.value.getRootElement().scrollTop = bodyXWrapper.value.scrollTop;
|
|
15870
|
+
}
|
|
15871
|
+
}, 20);
|
|
15872
|
+
const handleScollY = e => {
|
|
15873
|
+
const v = {
|
|
15874
|
+
x: e.target.scrollLeft,
|
|
15875
|
+
y: e.target.scrollTop
|
|
15876
|
+
};
|
|
15877
|
+
rightFixedBody.value?.wrapper.scrollTo(v, true);
|
|
15878
|
+
leftFixedBody.value?.wrapper.scrollTo(v, true);
|
|
15879
|
+
};
|
|
15880
|
+
const handleResize = () => {
|
|
15881
|
+
if (!isReady.value) return;
|
|
15882
|
+
let shouldUpdateLayout = false;
|
|
15883
|
+
const el = instance.vnode.el;
|
|
15884
|
+
const {
|
|
15885
|
+
width: oldWidth,
|
|
15886
|
+
height: oldHeight
|
|
15887
|
+
} = resizeState.value;
|
|
15888
|
+
const width = el.offsetWidth;
|
|
15889
|
+
if (oldWidth !== width) {
|
|
15890
|
+
shouldUpdateLayout = true;
|
|
15891
|
+
}
|
|
15892
|
+
const height = el.offsetHeight;
|
|
15893
|
+
if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
|
|
15894
|
+
shouldUpdateLayout = true;
|
|
15895
|
+
}
|
|
15896
|
+
if (shouldUpdateLayout) {
|
|
15897
|
+
resizeState.value = {
|
|
15898
|
+
width,
|
|
15899
|
+
height
|
|
15900
|
+
};
|
|
15901
|
+
refreshLayout();
|
|
15902
|
+
}
|
|
15903
|
+
};
|
|
15904
|
+
const handleMouseLeave = () => {
|
|
15905
|
+
store.setHoverRow(null);
|
|
15906
|
+
if (hoverState.value) hoverState.value = null;
|
|
15907
|
+
};
|
|
15908
|
+
const handleMousewheel = (deltaX, deltaY) => {
|
|
15909
|
+
const {
|
|
15910
|
+
scrollWidth: contentW,
|
|
15911
|
+
clientWidth: wrapperW,
|
|
15912
|
+
scrollLeft: scrollX
|
|
15913
|
+
} = bodyXWrapper.value;
|
|
15914
|
+
const {
|
|
15915
|
+
scrollHeight: contentH,
|
|
15916
|
+
clientHeight: wrapperH,
|
|
15917
|
+
scrollTop: scrollY
|
|
15918
|
+
} = bodyYWrapper.value;
|
|
15919
|
+
if (Math.abs(deltaY) > Math.abs(deltaX) && contentH > wrapperH) {
|
|
15920
|
+
// 虚拟滚动
|
|
15921
|
+
if (props.height) {
|
|
15922
|
+
body.value.wrapper?.scrollTo({
|
|
15923
|
+
y: scrollY + deltaY
|
|
15924
|
+
});
|
|
15925
|
+
} else {
|
|
15926
|
+
scroller.value.scrollTo({
|
|
15927
|
+
y: scrollY + deltaY
|
|
15928
|
+
});
|
|
15929
|
+
}
|
|
15930
|
+
} else if (deltaX && contentW > wrapperW) {
|
|
15931
|
+
scroller.value.scrollTo({
|
|
15932
|
+
x: scrollX + deltaX
|
|
15933
|
+
});
|
|
15934
|
+
}
|
|
15935
|
+
};
|
|
15936
|
+
let wheels = [];
|
|
15937
|
+
const bindEvents = () => {
|
|
15938
|
+
if (props.fit) {
|
|
15939
|
+
Resize.on(instance.vnode.el, handleResize);
|
|
15940
|
+
}
|
|
15941
|
+
nextTick(() => {
|
|
15942
|
+
wheels = [headerWrapper, footerWrapper, leftFixedWrapper, rightFixedWrapper].map(wrapper => {
|
|
15943
|
+
if (!wrapper.value) return;
|
|
15944
|
+
const wheel = new Wheel(wrapper.value, {
|
|
15945
|
+
shouldWheelX: delta => {
|
|
15946
|
+
const {
|
|
15947
|
+
scrollWidth: contentW,
|
|
15948
|
+
clientWidth: wrapperW,
|
|
15949
|
+
scrollLeft: scrollX
|
|
15950
|
+
} = bodyXWrapper.value;
|
|
15951
|
+
if (wrapperW === contentW) {
|
|
15952
|
+
return false;
|
|
15953
|
+
}
|
|
15954
|
+
delta = Math.round(delta);
|
|
15955
|
+
if (delta === 0) {
|
|
15956
|
+
return false;
|
|
15957
|
+
}
|
|
15958
|
+
return delta < 0 && scrollX > 0 || delta >= 0 && scrollX < contentW - wrapperW;
|
|
15959
|
+
},
|
|
15960
|
+
shouldWheelY: delta => {
|
|
15961
|
+
const {
|
|
15962
|
+
scrollHeight: contentH,
|
|
15963
|
+
clientHeight: wrapperH,
|
|
15964
|
+
scrollTop: scrollY
|
|
15965
|
+
} = bodyYWrapper.value;
|
|
15966
|
+
if (wrapperH === contentH) {
|
|
15967
|
+
return false;
|
|
15968
|
+
}
|
|
15969
|
+
delta = Math.round(delta);
|
|
15970
|
+
if (delta === 0) {
|
|
15971
|
+
return false;
|
|
15972
|
+
}
|
|
15973
|
+
return delta < 0 && scrollY > 0 || delta >= 0 && scrollY < contentH - wrapperH;
|
|
15974
|
+
}
|
|
15975
|
+
});
|
|
15976
|
+
wheel.on(handleMousewheel);
|
|
15977
|
+
return wheel;
|
|
15978
|
+
});
|
|
15979
|
+
});
|
|
15980
|
+
};
|
|
15981
|
+
const unbindEvents = () => {
|
|
15982
|
+
if (props.fit) {
|
|
15983
|
+
Resize.off(instance.vnode.el, handleResize);
|
|
15984
|
+
}
|
|
15985
|
+
wheels.forEach(wheel => wheel && wheel.off(handleMousewheel));
|
|
15986
|
+
};
|
|
15987
|
+
const debouncedUpdateLayout = debounce(() => refreshLayout(), 50);
|
|
15988
|
+
watch(() => props.height, v => {
|
|
15989
|
+
layout.setHeight(v);
|
|
15990
|
+
}, {
|
|
15991
|
+
immediate: true
|
|
15992
|
+
});
|
|
15993
|
+
watch(() => props.maxHeight, v => {
|
|
15994
|
+
layout.setMaxHeight(v);
|
|
15995
|
+
}, {
|
|
15996
|
+
immediate: true
|
|
15997
|
+
});
|
|
15998
|
+
watch(() => props.currentRowValue, v => {
|
|
15999
|
+
if (!props.primaryKey) return;
|
|
16000
|
+
store.current.reset(v);
|
|
16001
|
+
}, {
|
|
16002
|
+
immediate: true
|
|
16003
|
+
});
|
|
16004
|
+
watch(() => props.data, v => {
|
|
16005
|
+
store.setData(v);
|
|
16006
|
+
isReady.value && nextTick(refreshLayout);
|
|
16007
|
+
}, {
|
|
16008
|
+
immediate: true
|
|
16009
|
+
});
|
|
16010
|
+
watch(() => props.expandRowValue, v => {
|
|
16011
|
+
if (v) {
|
|
16012
|
+
store.setExpandRowValueAdapter(v);
|
|
16013
|
+
}
|
|
16014
|
+
}, {
|
|
16015
|
+
immediate: true
|
|
16016
|
+
});
|
|
16017
|
+
|
|
16018
|
+
// 直接修改className(不使用render函数), 解决临界值设置修改className时的顿挫
|
|
16019
|
+
watch(() => scrollPosition.value, v => {
|
|
16020
|
+
raf(() => {
|
|
16021
|
+
const className = `is-scrolling-${layout.states.scrollX ? v : 'none'}`;
|
|
16022
|
+
const el = bodyXWrapper.value;
|
|
16023
|
+
el && el.classList.replace(el.classList.item(el.classList.length - 1), className);
|
|
16024
|
+
});
|
|
16025
|
+
}, {
|
|
16026
|
+
immediate: true
|
|
16027
|
+
});
|
|
16028
|
+
const tableId = getUid('table');
|
|
16029
|
+
onMounted(() => {
|
|
16030
|
+
bindEvents();
|
|
16031
|
+
store.updateColumns();
|
|
16032
|
+
refreshLayout();
|
|
16033
|
+
resizeState.value = {
|
|
16034
|
+
width: instance.vnode.el.offsetWidth,
|
|
16035
|
+
height: instance.vnode.el.offsetHeight
|
|
16036
|
+
};
|
|
16037
|
+
isReady.value = true;
|
|
16038
|
+
});
|
|
16039
|
+
onUnmounted(() => {
|
|
16040
|
+
isUnMount = true;
|
|
16041
|
+
unbindEvents();
|
|
16042
|
+
});
|
|
16043
|
+
expose({
|
|
16044
|
+
bodyXWrapper,
|
|
16045
|
+
bodyYWrapper,
|
|
16046
|
+
tableId,
|
|
16047
|
+
store,
|
|
16048
|
+
layout,
|
|
16049
|
+
updateScrollY,
|
|
16050
|
+
refreshLayout,
|
|
16051
|
+
toggleAllSelection,
|
|
16052
|
+
setCurrentRow,
|
|
16053
|
+
toggleRowSelection,
|
|
16054
|
+
toggleRowExpansion,
|
|
16055
|
+
clearSelection,
|
|
16056
|
+
scroller,
|
|
16057
|
+
headerWrapper,
|
|
16058
|
+
appendWrapper,
|
|
16059
|
+
footerWrapper,
|
|
16060
|
+
resizeState,
|
|
16061
|
+
debouncedUpdateLayout,
|
|
16062
|
+
isReady,
|
|
16063
|
+
hoverState,
|
|
16064
|
+
renderExpanded,
|
|
16065
|
+
hiddenColumns
|
|
16066
|
+
});
|
|
16067
|
+
return () => {
|
|
16068
|
+
return createVNode("div", {
|
|
16069
|
+
"class": [classes.value, tableId, 'vc-table'],
|
|
16070
|
+
"onMouseleave": handleMouseLeave
|
|
16071
|
+
}, [createVNode("div", {
|
|
16072
|
+
"ref": hiddenColumns,
|
|
16073
|
+
"class": "vc-table__hidden"
|
|
16074
|
+
}, [slots.default?.()]), props.showHeader && createVNode("div", {
|
|
16075
|
+
"ref": headerWrapper,
|
|
16076
|
+
"class": "vc-table__header-wrapper"
|
|
16077
|
+
}, [createVNode(TableHeader, {
|
|
16078
|
+
"ref": tableHeader,
|
|
16079
|
+
"store": store,
|
|
16080
|
+
"border": props.border,
|
|
16081
|
+
"default-sort": props.defaultSort,
|
|
16082
|
+
"style": bodyWidthStyle.value
|
|
16083
|
+
}, null)]), states.columns.length > 0 && createVNode(ScrollerWheel, {
|
|
16084
|
+
"ref": scroller,
|
|
16085
|
+
"class": ['vc-table__body-wrapper is-scrolling-none'],
|
|
16086
|
+
"barTo": `.${tableId}`,
|
|
16087
|
+
"native": false,
|
|
16088
|
+
"always": false,
|
|
16089
|
+
"track-offset-y": [layout.states.headerHeight, 0, -layout.states.headerHeight - layout.states.footerHeight, 0],
|
|
16090
|
+
"style": [bodyHeightStyle.value],
|
|
16091
|
+
"onScroll": handleScollX
|
|
16092
|
+
}, {
|
|
16093
|
+
default: () => [createVNode(TableBody, {
|
|
16094
|
+
"ref": body,
|
|
16095
|
+
"store": store,
|
|
16096
|
+
"style": [bodyWidthStyle.value],
|
|
16097
|
+
"height-style": [bodyHeightStyle.value],
|
|
16098
|
+
"onScroll": handleScollY
|
|
16099
|
+
}, null), props.data.length === 0 && createVNode("div", {
|
|
16100
|
+
"ref": emptyBlock,
|
|
16101
|
+
"style": bodyWidthStyle.value,
|
|
16102
|
+
"class": "vc-table__empty-block"
|
|
16103
|
+
}, [createVNode("span", {
|
|
16104
|
+
"class": "vc-table__empty-text"
|
|
16105
|
+
}, [slots.empty ? slots.empty() : props.emptyText || '暂无数据'])]), slots.append && createVNode("div", {
|
|
16106
|
+
"ref": appendWrapper,
|
|
16107
|
+
"class": "vc-table__append-wrapper"
|
|
16108
|
+
}, [slots.append()])]
|
|
16109
|
+
}), props.showSummary && withDirectives(createVNode("div", {
|
|
16110
|
+
"ref": footerWrapper,
|
|
16111
|
+
"class": "vc-table__footer-wrapper"
|
|
16112
|
+
}, [createVNode(TableFooter, {
|
|
16113
|
+
"store": store,
|
|
16114
|
+
"border": props.border,
|
|
16115
|
+
"sum-text": props.sumText || '合计',
|
|
16116
|
+
"get-summary": props.getSummary,
|
|
16117
|
+
"style": bodyWidthStyle.value
|
|
16118
|
+
}, null)]), [[vShow, props.data && props.data.length > 0]]), states.leftFixedColumns.length > 0 && states.columns.length > 0 && createVNode("div", {
|
|
16119
|
+
"ref": leftFixedWrapper,
|
|
16120
|
+
"style": [{
|
|
16121
|
+
width: layout.states.leftFixedWidth ? layout.states.leftFixedWidth + 'px' : ''
|
|
16122
|
+
}, fixedHeightStyle.value],
|
|
16123
|
+
"class": "vc-table__fixed"
|
|
16124
|
+
}, [props.showHeader && createVNode("div", {
|
|
16125
|
+
"ref": leftFixedHeaderWrapper,
|
|
16126
|
+
"class": "vc-table__fixed-header-wrapper"
|
|
16127
|
+
}, [createVNode(TableHeader, {
|
|
16128
|
+
"ref": leftFixedTableHeader,
|
|
16129
|
+
"store": store,
|
|
16130
|
+
"border": props.border,
|
|
16131
|
+
"default-sort": props.defaultSort,
|
|
16132
|
+
"style": bodyWidthStyle.value,
|
|
16133
|
+
"fixed": "left"
|
|
16134
|
+
}, null)]), createVNode("div", {
|
|
16135
|
+
"ref": leftFixedBodyWrapper,
|
|
16136
|
+
"style": [{
|
|
16137
|
+
top: layout.states.headerHeight + 'px'
|
|
16138
|
+
}],
|
|
16139
|
+
"class": "vc-table__fixed-body-wrapper"
|
|
16140
|
+
}, [createVNode(TableBody, {
|
|
16141
|
+
"ref": leftFixedBody,
|
|
16142
|
+
"store": store,
|
|
16143
|
+
"style": [bodyWidthStyle.value, bodyHeightStyle.value],
|
|
16144
|
+
"fixed": "left"
|
|
16145
|
+
}, null), slots.append && createVNode("div", {
|
|
16146
|
+
"style": [{
|
|
16147
|
+
height: layout.states.appendHeight + 'px'
|
|
16148
|
+
}],
|
|
16149
|
+
"class": "vc-table__append-gutter"
|
|
16150
|
+
}, [slots.append()])]), props.showSummary && withDirectives(createVNode("div", {
|
|
16151
|
+
"ref": leftFixedFooterWrapper,
|
|
16152
|
+
"class": "vc-table__fixed-footer-wrapper"
|
|
16153
|
+
}, [createVNode(TableFooter, {
|
|
16154
|
+
"store": store,
|
|
16155
|
+
"border": props.border,
|
|
16156
|
+
"sum-text": props.sumText || '合计',
|
|
16157
|
+
"get-summary": props.getSummary,
|
|
16158
|
+
"style": bodyWidthStyle.value,
|
|
16159
|
+
"fixed": "left"
|
|
16160
|
+
}, null)]), [[vShow, props.data && props.data.length > 0]])]), states.rightFixedColumns.length > 0 && createVNode("div", {
|
|
16161
|
+
"ref": rightFixedWrapper,
|
|
16162
|
+
"style": [{
|
|
16163
|
+
width: layout.states.rightFixedWidth ? layout.states.rightFixedWidth + 'px' : ''
|
|
16164
|
+
}, fixedHeightStyle.value],
|
|
16165
|
+
"class": "vc-table__fixed-right"
|
|
16166
|
+
}, [props.showHeader && createVNode("div", {
|
|
16167
|
+
"ref": rightFixedHeaderWrapper,
|
|
16168
|
+
"class": "vc-table__fixed-header-wrapper"
|
|
16169
|
+
}, [createVNode(TableHeader, {
|
|
16170
|
+
"ref": rightFixedTableHeader,
|
|
16171
|
+
"store": store,
|
|
16172
|
+
"border": props.border,
|
|
16173
|
+
"default-sort": props.defaultSort,
|
|
16174
|
+
"style": bodyWidthStyle.value,
|
|
16175
|
+
"fixed": "right"
|
|
16176
|
+
}, null)]), createVNode("div", {
|
|
16177
|
+
"ref": rightFixedBodyWrapper,
|
|
16178
|
+
"style": [{
|
|
16179
|
+
top: layout.states.headerHeight + 'px'
|
|
16180
|
+
}],
|
|
16181
|
+
"class": "vc-table__fixed-body-wrapper"
|
|
16182
|
+
}, [createVNode(TableBody, {
|
|
16183
|
+
"ref": rightFixedBody,
|
|
16184
|
+
"store": store,
|
|
16185
|
+
"style": [bodyWidthStyle.value, bodyHeightStyle.value],
|
|
16186
|
+
"fixed": "right"
|
|
16187
|
+
}, null), slots.append && createVNode("div", {
|
|
16188
|
+
"style": [{
|
|
16189
|
+
height: layout.states.appendHeight + 'px'
|
|
16190
|
+
}],
|
|
16191
|
+
"class": "vc-table__append-gutter"
|
|
16192
|
+
}, [slots.append()])]), props.showSummary && withDirectives(createVNode("div", {
|
|
16193
|
+
"ref": rightFixedFooterWrapper,
|
|
16194
|
+
"class": "vc-table__fixed-footer-wrapper"
|
|
16195
|
+
}, [createVNode(TableFooter, {
|
|
16196
|
+
"store": store,
|
|
16197
|
+
"border": props.border,
|
|
16198
|
+
"sum-text": props.sumText || '合计',
|
|
16199
|
+
"get-summary": props.getSummary,
|
|
16200
|
+
"style": bodyWidthStyle.value,
|
|
16201
|
+
"fixed": "right"
|
|
16202
|
+
}, null)]), [[vShow, props.data && props.data.length > 0]])]), withDirectives(createVNode("div", {
|
|
16203
|
+
"ref": resizeProxy,
|
|
16204
|
+
"class": "vc-table__column-resize-proxy"
|
|
16205
|
+
}, null), [[vShow, resizeProxyVisible.value]])]);
|
|
16206
|
+
};
|
|
16207
|
+
}
|
|
16208
|
+
});
|
|
16209
|
+
|
|
16210
|
+
const cellStarts = {
|
|
16211
|
+
default: {
|
|
16212
|
+
order: ''
|
|
16213
|
+
},
|
|
16214
|
+
selection: {
|
|
16215
|
+
width: 60,
|
|
16216
|
+
minWidth: 60,
|
|
16217
|
+
order: '',
|
|
16218
|
+
className: 'vc-table-column--selection'
|
|
16219
|
+
},
|
|
16220
|
+
expand: {
|
|
16221
|
+
width: 60,
|
|
16222
|
+
minWidth: 60,
|
|
16223
|
+
order: ''
|
|
16224
|
+
},
|
|
16225
|
+
index: {
|
|
16226
|
+
width: 60,
|
|
16227
|
+
minWidth: 60,
|
|
16228
|
+
order: ''
|
|
16229
|
+
}
|
|
16230
|
+
};
|
|
16231
|
+
|
|
16232
|
+
// 这些选项不应该被覆盖
|
|
16233
|
+
const cellForced = {
|
|
16234
|
+
selection: {
|
|
16235
|
+
renderHeader({
|
|
16236
|
+
store
|
|
16237
|
+
}) {
|
|
16238
|
+
return createVNode(Checkbox, {
|
|
16239
|
+
"modelValue": store.states.isAllSelected,
|
|
16240
|
+
"disabled": store.states.data && store.states.data.length === 0,
|
|
16241
|
+
"indeterminate": store.states.selection.length > 0 && !store.states.isAllSelected,
|
|
16242
|
+
"onClick": e => {
|
|
16243
|
+
e.stopPropagation();
|
|
16244
|
+
store.toggleAllSelection();
|
|
16245
|
+
}
|
|
16246
|
+
}, null);
|
|
16247
|
+
},
|
|
16248
|
+
renderCell({
|
|
16249
|
+
row,
|
|
16250
|
+
column,
|
|
16251
|
+
store,
|
|
16252
|
+
rowIndex,
|
|
16253
|
+
level
|
|
16254
|
+
}) {
|
|
16255
|
+
return withDirectives(createVNode(Checkbox, {
|
|
16256
|
+
"modelValue": store.isSelected(row),
|
|
16257
|
+
"disabled": column.selectable ? !column.selectable.call(null, row, rowIndex) : false,
|
|
16258
|
+
"onChange": () => store.rowSelectedChanged(row),
|
|
16259
|
+
"onClick": e => e.stopPropagation()
|
|
16260
|
+
}, null), [[vShow, store.table.props.expandSelectable || level === 0]]);
|
|
16261
|
+
},
|
|
16262
|
+
sortable: false,
|
|
16263
|
+
resizable: false
|
|
16264
|
+
},
|
|
16265
|
+
index: {
|
|
16266
|
+
renderHeader(h, {
|
|
16267
|
+
column
|
|
16268
|
+
}) {
|
|
16269
|
+
return column.label || '#';
|
|
16270
|
+
},
|
|
16271
|
+
renderCell({
|
|
16272
|
+
rowIndex,
|
|
16273
|
+
column
|
|
16274
|
+
}) {
|
|
16275
|
+
let i = rowIndex + 1;
|
|
16276
|
+
const index = column.index;
|
|
16277
|
+
if (typeof index === 'number') {
|
|
16278
|
+
i = rowIndex + index;
|
|
16279
|
+
} else if (typeof index === 'function') {
|
|
16280
|
+
i = index(rowIndex);
|
|
16281
|
+
}
|
|
16282
|
+
return createVNode("div", null, [i]);
|
|
16283
|
+
},
|
|
16284
|
+
sortable: false
|
|
16285
|
+
},
|
|
16286
|
+
expand: {
|
|
16287
|
+
renderHeader({
|
|
16288
|
+
column
|
|
16289
|
+
}) {
|
|
16290
|
+
return column.label || '';
|
|
16291
|
+
},
|
|
16292
|
+
renderCell({
|
|
16293
|
+
row,
|
|
16294
|
+
store
|
|
16295
|
+
}) {
|
|
16296
|
+
const classes = ['vc-table__expand-icon'];
|
|
16297
|
+
if (store.states.expandRows.includes(row)) {
|
|
16298
|
+
classes.push('is-expand');
|
|
16299
|
+
}
|
|
16300
|
+
const handleClick = e => {
|
|
16301
|
+
e.stopPropagation();
|
|
16302
|
+
store.expand.toggle(row);
|
|
16303
|
+
};
|
|
16304
|
+
return createVNode("div", {
|
|
16305
|
+
"class": classes,
|
|
16306
|
+
"onClick": handleClick
|
|
16307
|
+
}, [createVNode(Icon, {
|
|
16308
|
+
"type": "triangle-up"
|
|
16309
|
+
}, null)]);
|
|
16310
|
+
},
|
|
16311
|
+
sortable: false,
|
|
16312
|
+
resizable: false,
|
|
16313
|
+
className: 'vc-table__expand-column'
|
|
16314
|
+
}
|
|
16315
|
+
};
|
|
16316
|
+
|
|
16317
|
+
// Cell默认渲染value 或 formatter
|
|
16318
|
+
const defaultRenderCell = ({
|
|
16319
|
+
row,
|
|
16320
|
+
column = {},
|
|
16321
|
+
rowIndex
|
|
16322
|
+
}) => {
|
|
16323
|
+
const {
|
|
16324
|
+
prop,
|
|
16325
|
+
formatter
|
|
16326
|
+
} = column;
|
|
16327
|
+
let value;
|
|
16328
|
+
if (prop) {
|
|
16329
|
+
value = getPropByPath(row, prop).v;
|
|
16330
|
+
}
|
|
16331
|
+
if (formatter) {
|
|
16332
|
+
return column.formatter({
|
|
16333
|
+
row,
|
|
16334
|
+
column,
|
|
16335
|
+
value,
|
|
16336
|
+
rowIndex
|
|
16337
|
+
});
|
|
16338
|
+
}
|
|
16339
|
+
return value;
|
|
16340
|
+
};
|
|
16341
|
+
|
|
16342
|
+
// Cell渲染前缀,如loading, expand
|
|
16343
|
+
const treeCellPrefix = ({
|
|
16344
|
+
row,
|
|
16345
|
+
treeNode,
|
|
16346
|
+
store
|
|
16347
|
+
}) => {
|
|
16348
|
+
if (!treeNode) return null;
|
|
16349
|
+
const ele = [];
|
|
16350
|
+
const handleClick = e => {
|
|
16351
|
+
e.stopPropagation();
|
|
16352
|
+
store.tree.loadOrToggle(row);
|
|
16353
|
+
};
|
|
16354
|
+
if (treeNode.indent) {
|
|
16355
|
+
ele.push(createVNode("span", {
|
|
16356
|
+
"class": "vc-table__indent",
|
|
16357
|
+
"style": {
|
|
16358
|
+
'padding-left': treeNode.indent + 'px'
|
|
16359
|
+
}
|
|
16360
|
+
}, null));
|
|
16361
|
+
}
|
|
16362
|
+
if (typeof treeNode.expanded === 'boolean' && !treeNode.noLazyChildren) {
|
|
16363
|
+
const expandClasses = {
|
|
16364
|
+
'vc-table__expand-icon': true,
|
|
16365
|
+
'is-expand': treeNode.expanded
|
|
16366
|
+
};
|
|
16367
|
+
ele.push(createVNode("span", {
|
|
16368
|
+
"class": expandClasses,
|
|
16369
|
+
"onClick": handleClick
|
|
16370
|
+
}, [treeNode.loading ? createVNode(Spin, {
|
|
16371
|
+
"size": 12
|
|
16372
|
+
}, null) : createVNode(Icon, {
|
|
16373
|
+
"type": "triangle-up"
|
|
16374
|
+
}, null)]));
|
|
16375
|
+
} else {
|
|
16376
|
+
ele.push(createVNode("span", {
|
|
16377
|
+
"class": "vc-table__placeholder"
|
|
16378
|
+
}, null));
|
|
16379
|
+
}
|
|
16380
|
+
return ele;
|
|
16381
|
+
};
|
|
16382
|
+
|
|
16383
|
+
const TableColumn = /* @__PURE__ */ defineComponent({
|
|
16384
|
+
name: 'vc-table-column',
|
|
16385
|
+
props: {
|
|
16386
|
+
type: {
|
|
16387
|
+
type: String,
|
|
16388
|
+
default: 'default'
|
|
16389
|
+
},
|
|
16390
|
+
label: String,
|
|
16391
|
+
customClass: String,
|
|
16392
|
+
labelClass: String,
|
|
16393
|
+
prop: String,
|
|
16394
|
+
width: Number,
|
|
16395
|
+
minWidth: Number,
|
|
16396
|
+
renderHeader: Function,
|
|
16397
|
+
resizable: {
|
|
16398
|
+
type: Boolean,
|
|
16399
|
+
default: true
|
|
16400
|
+
},
|
|
16401
|
+
columnKey: String,
|
|
16402
|
+
align: String,
|
|
16403
|
+
headerAlign: String,
|
|
16404
|
+
showPopover: Boolean,
|
|
16405
|
+
fixed: [Boolean, String],
|
|
16406
|
+
formatter: Function,
|
|
16407
|
+
selectable: Function,
|
|
16408
|
+
reserveSelection: Boolean,
|
|
16409
|
+
index: [Number, Function],
|
|
16410
|
+
// 头部是否展示排序
|
|
16411
|
+
sortable: Boolean,
|
|
16412
|
+
// 数据过滤的选项
|
|
16413
|
+
filters: Array,
|
|
16414
|
+
// 是否支持多选
|
|
16415
|
+
filterMultiple: {
|
|
16416
|
+
type: Boolean,
|
|
16417
|
+
default: true
|
|
16418
|
+
},
|
|
16419
|
+
filterIcon: String,
|
|
16420
|
+
// 选中的数据过滤项
|
|
16421
|
+
filteredValue: Array,
|
|
16422
|
+
// 筛选弹层的样式
|
|
16423
|
+
filterPopupClass: String,
|
|
16424
|
+
// 筛选的方法
|
|
16425
|
+
filter: Function,
|
|
16426
|
+
tooltip: [String, Function]
|
|
16427
|
+
},
|
|
16428
|
+
setup(props, {
|
|
16429
|
+
slots,
|
|
16430
|
+
expose
|
|
16431
|
+
}) {
|
|
16432
|
+
const instance = getCurrentInstance();
|
|
16433
|
+
const table = getInstance('table', 'tableId');
|
|
16434
|
+
const parent = getInstance('table-column', 'columnId') || table;
|
|
16435
|
+
const isSubColumn = table !== parent; // 用于多久表头
|
|
16436
|
+
|
|
16437
|
+
const columnId = ref((parent.exposed.tableId || parent.exposed.columnId) + getUid('column'));
|
|
16438
|
+
const realWidth = computed(() => {
|
|
16439
|
+
return parseWidth(props.width);
|
|
16440
|
+
});
|
|
16441
|
+
const realMinWidth = computed(() => {
|
|
16442
|
+
return parseMinWidth(props.minWidth);
|
|
16443
|
+
});
|
|
16444
|
+
const realAlign = computed(() => {
|
|
16445
|
+
return props.align ? 'is-' + props.align : null;
|
|
16446
|
+
});
|
|
16447
|
+
const realHeaderAlign = computed(() => {
|
|
16448
|
+
return props.headerAlign ? 'is-' + props.headerAlign : realAlign.value;
|
|
16449
|
+
});
|
|
16450
|
+
const columnConfig = reactive({});
|
|
16451
|
+
/**
|
|
16452
|
+
* 获取当前值情况,this[key]
|
|
16453
|
+
* @param args ~
|
|
16454
|
+
* @returns ~
|
|
16455
|
+
*/
|
|
16456
|
+
const getPropsData = (...args) => {
|
|
16457
|
+
const result = args.reduce((prev, cur) => {
|
|
16458
|
+
if (Array.isArray(cur)) {
|
|
16459
|
+
cur.forEach(key => {
|
|
16460
|
+
prev[key] = props[key];
|
|
16461
|
+
});
|
|
16462
|
+
}
|
|
16463
|
+
return prev;
|
|
16464
|
+
}, {});
|
|
16465
|
+
return result;
|
|
16466
|
+
};
|
|
16467
|
+
/**
|
|
16468
|
+
* compose 1
|
|
16469
|
+
* 对于特定类型的 column,某些属性不允许设置
|
|
16470
|
+
* 如 type: selection | index | expand
|
|
16471
|
+
* @param column ~
|
|
16472
|
+
* @returns ~
|
|
16473
|
+
*/
|
|
16474
|
+
const setColumnForcedProps = column => {
|
|
16475
|
+
const type = column.type;
|
|
16476
|
+
const source = cellForced[type] || {};
|
|
16477
|
+
Object.keys(source).forEach(prop => {
|
|
16478
|
+
const value = source[prop];
|
|
16479
|
+
if (value !== undefined) {
|
|
16480
|
+
column[prop] = prop === 'customClass' ? `${column[prop]} ${value}` : value;
|
|
16481
|
+
}
|
|
16482
|
+
});
|
|
16483
|
+
return column;
|
|
16484
|
+
};
|
|
16485
|
+
|
|
16486
|
+
/**
|
|
16487
|
+
* compose 2
|
|
16488
|
+
* column
|
|
16489
|
+
* -> width
|
|
16490
|
+
* -> minWidth
|
|
16491
|
+
* @param column ~
|
|
16492
|
+
* @returns ~
|
|
16493
|
+
*/
|
|
16494
|
+
const setColumnWidth = column => {
|
|
16495
|
+
if (realWidth.value) {
|
|
16496
|
+
column.width = realWidth.value;
|
|
16497
|
+
}
|
|
16498
|
+
if (realMinWidth.value) {
|
|
16499
|
+
column.minWidth = realMinWidth.value;
|
|
16500
|
+
}
|
|
16501
|
+
if (!column.minWidth) {
|
|
16502
|
+
column.minWidth = 80;
|
|
16503
|
+
}
|
|
16504
|
+
column.realWidth = column.width === undefined ? column.minWidth : column.width;
|
|
16505
|
+
return column;
|
|
16506
|
+
};
|
|
16507
|
+
|
|
16508
|
+
/**
|
|
16509
|
+
* compose 3
|
|
16510
|
+
* column
|
|
16511
|
+
* -> renderHeader: 渲染头部
|
|
16512
|
+
* -> renderCell: 渲染单元格
|
|
16513
|
+
* owner
|
|
16514
|
+
* -> renderExpanded: 展开
|
|
16515
|
+
* @param column ~
|
|
16516
|
+
* @returns ~
|
|
16517
|
+
*/
|
|
16518
|
+
const setColumnRenders = column => {
|
|
16519
|
+
const specialTypes = Object.keys(cellForced);
|
|
16520
|
+
// renderHeader 属性不推荐使用。
|
|
16521
|
+
if (props.renderHeader) {
|
|
16522
|
+
column.renderHeader = props.renderHeader;
|
|
16523
|
+
} else if (specialTypes.indexOf(column.type) === -1) {
|
|
16524
|
+
column.renderHeader = data => {
|
|
16525
|
+
const renderHeader = slots.header;
|
|
16526
|
+
return renderHeader ? renderHeader(data) : data?.column?.label;
|
|
16527
|
+
};
|
|
16528
|
+
}
|
|
16529
|
+
let originRenderCell = column.renderCell;
|
|
16530
|
+
// TODO: 这里的实现调整
|
|
16531
|
+
if (column.type === 'expand') {
|
|
16532
|
+
// 对于展开行,renderCell 不允许配置的。在上一步中已经设置过,这里需要简单封装一下。
|
|
16533
|
+
column.renderCell = data => createVNode("div", {
|
|
16534
|
+
"class": "vc-table__cell"
|
|
16535
|
+
}, [originRenderCell(data)]);
|
|
16536
|
+
table.exposed.renderExpanded.value = data => {
|
|
16537
|
+
return slots.default ? slots.default(data) : slots.default;
|
|
16538
|
+
};
|
|
16539
|
+
} else {
|
|
16540
|
+
originRenderCell = originRenderCell || defaultRenderCell;
|
|
16541
|
+
// 对 renderCell 进行包装
|
|
16542
|
+
column.renderCell = data => {
|
|
16543
|
+
let children = null;
|
|
16544
|
+
if (slots.default) {
|
|
16545
|
+
children = slots?.default?.(data);
|
|
16546
|
+
} else {
|
|
16547
|
+
children = originRenderCell(data);
|
|
16548
|
+
}
|
|
16549
|
+
let prefix = treeCellPrefix(data);
|
|
16550
|
+
const $props = {
|
|
16551
|
+
class: 'vc-table__cell',
|
|
16552
|
+
style: {}
|
|
16553
|
+
};
|
|
16554
|
+
// 存在树形数组,且当前行无箭头图标且处于当前展开列,表格对齐
|
|
16555
|
+
if (!isEmpty$1(table.exposed.store.states.treeData) && !prefix && data.isExpandColumn) {
|
|
16556
|
+
prefix = createVNode("span", {
|
|
16557
|
+
"class": "vc-table-un-expand__indent"
|
|
16558
|
+
}, null);
|
|
16559
|
+
}
|
|
16560
|
+
if (data.column.showPopover) {
|
|
16561
|
+
$props.class += ' vc-popover';
|
|
16562
|
+
$props.style = {
|
|
16563
|
+
width: (data.column.realWidth || data.column.width) - 1 + 'px'
|
|
16564
|
+
};
|
|
16565
|
+
}
|
|
16566
|
+
const {
|
|
16567
|
+
placeholder
|
|
16568
|
+
} = table.props;
|
|
16569
|
+
const contentPlaceholder = typeof placeholder === 'function' ? placeholder() : placeholder;
|
|
16570
|
+
return createVNode("div", $props, [prefix, children === undefined || children === '' || children === null ? contentPlaceholder : children]);
|
|
16571
|
+
};
|
|
16572
|
+
}
|
|
16573
|
+
return column;
|
|
16574
|
+
};
|
|
16575
|
+
const registerColumn = () => {
|
|
16576
|
+
const defaults = {
|
|
16577
|
+
...cellStarts[props.type],
|
|
16578
|
+
id: columnId.value,
|
|
16579
|
+
realAlign,
|
|
16580
|
+
realHeaderAlign
|
|
16581
|
+
};
|
|
16582
|
+
let column = merge$1(defaults, getPropsData(Object.keys(props)));
|
|
16583
|
+
|
|
16584
|
+
// minWidth/realWidth/renderHeader
|
|
16585
|
+
column = compose(setColumnRenders, setColumnWidth, setColumnForcedProps)(column);
|
|
16586
|
+
for (const key in column) {
|
|
16587
|
+
if (hasOwn(column, key)) {
|
|
16588
|
+
columnConfig[key] = column[key];
|
|
16589
|
+
}
|
|
16590
|
+
}
|
|
16591
|
+
};
|
|
16592
|
+
const registerWatchers = () => {
|
|
16593
|
+
// 赋值
|
|
16594
|
+
Object.keys(props).forEach(k => watch(() => props[k], v => columnConfig[k] = v));
|
|
16595
|
+
|
|
16596
|
+
// 影响布局
|
|
16597
|
+
watch(() => props.fixed, () => {
|
|
16598
|
+
table.exposed.store.scheduleLayout(true);
|
|
16599
|
+
});
|
|
16600
|
+
watch(() => realWidth.value, v => {
|
|
16601
|
+
columnConfig['width'] = v;
|
|
16602
|
+
columnConfig['realWidth'] = v;
|
|
16603
|
+
table.exposed.store.scheduleLayout(false);
|
|
16604
|
+
});
|
|
16605
|
+
watch(() => realMinWidth.value, () => {
|
|
16606
|
+
table.exposed.store.scheduleLayout(false);
|
|
16607
|
+
});
|
|
16608
|
+
};
|
|
16609
|
+
onBeforeMount(() => {
|
|
16610
|
+
registerColumn();
|
|
16611
|
+
registerWatchers();
|
|
16612
|
+
});
|
|
16613
|
+
onMounted(() => {
|
|
16614
|
+
const children = isSubColumn ? parent.vnode.el.children : parent.exposed.hiddenColumns.value.children;
|
|
16615
|
+
|
|
16616
|
+
// DOM上
|
|
16617
|
+
const columnIndex = [...children].indexOf(instance.vnode.el);
|
|
16618
|
+
table.exposed.store.insertColumn(columnConfig, columnIndex, isSubColumn && parent.exposed.columnConfig);
|
|
16619
|
+
});
|
|
16620
|
+
onUnmounted(() => {
|
|
16621
|
+
if (!instance.parent) return;
|
|
16622
|
+
table.exposed.store.removeColumn(columnConfig, isSubColumn && parent.exposed.columnConfig);
|
|
16623
|
+
});
|
|
16624
|
+
expose({
|
|
16625
|
+
columnId,
|
|
16626
|
+
columnConfig
|
|
16627
|
+
});
|
|
16628
|
+
|
|
16629
|
+
/**
|
|
16630
|
+
* 可以计算 columnIndex(外层需要标签元素), 即h('div')
|
|
16631
|
+
* this.$slots?.default?.() 用于多级表头
|
|
16632
|
+
* @returns ~
|
|
16633
|
+
*/
|
|
16634
|
+
return () => {
|
|
16635
|
+
let children = [];
|
|
16636
|
+
try {
|
|
16637
|
+
const renderDefault = slots?.default?.({
|
|
16638
|
+
row: {},
|
|
16639
|
+
column: {},
|
|
16640
|
+
columnIndex: -1,
|
|
16641
|
+
rowIndex: -1
|
|
16642
|
+
});
|
|
16643
|
+
if (renderDefault instanceof Array) {
|
|
16644
|
+
for (const childNode of renderDefault) {
|
|
16645
|
+
if (/^vcm?-table-column$/.test(childNode.type?.name)) {
|
|
16646
|
+
children.push(childNode);
|
|
16647
|
+
} else if (childNode.type === Fragment$1 && childNode.children instanceof Array) {
|
|
16648
|
+
renderDefault.push(...childNode.children);
|
|
16649
|
+
}
|
|
16650
|
+
}
|
|
16651
|
+
}
|
|
16652
|
+
} catch {
|
|
16653
|
+
children = [];
|
|
16654
|
+
}
|
|
16655
|
+
return h('div', children);
|
|
16656
|
+
};
|
|
16657
|
+
}
|
|
16658
|
+
});
|
|
16659
|
+
|
|
16660
|
+
const MTable = Table;
|
|
16661
|
+
const MTableColumn = TableColumn;
|
|
16662
|
+
|
|
16663
|
+
const props$b = {
|
|
16664
|
+
type: {
|
|
16665
|
+
type: String,
|
|
16666
|
+
validator: (v) => /^(line|card)$/.test(v),
|
|
16667
|
+
default: "line"
|
|
13776
16668
|
},
|
|
13777
16669
|
modelValue: {
|
|
13778
16670
|
type: [String, Number]
|
|
@@ -13923,9 +16815,9 @@ const useTabs = (options = {}) => {
|
|
|
13923
16815
|
|
|
13924
16816
|
/** @jsxImportSource vue */
|
|
13925
16817
|
|
|
13926
|
-
const COMPONENT_NAME$
|
|
16818
|
+
const COMPONENT_NAME$f = 'vc-tabs';
|
|
13927
16819
|
const Tabs = /* @__PURE__ */ defineComponent({
|
|
13928
|
-
name: COMPONENT_NAME$
|
|
16820
|
+
name: COMPONENT_NAME$f,
|
|
13929
16821
|
props: props$b,
|
|
13930
16822
|
emits: ['update:modelValue', 'change', 'click'],
|
|
13931
16823
|
setup(props, {
|
|
@@ -14173,9 +17065,9 @@ const useTabsPane = () => {
|
|
|
14173
17065
|
|
|
14174
17066
|
/** @jsxImportSource vue */
|
|
14175
17067
|
|
|
14176
|
-
const COMPONENT_NAME$
|
|
17068
|
+
const COMPONENT_NAME$e = 'vc-tabs-pane';
|
|
14177
17069
|
const TabsPane = /* @__PURE__ */ defineComponent({
|
|
14178
|
-
name: COMPONENT_NAME$
|
|
17070
|
+
name: COMPONENT_NAME$e,
|
|
14179
17071
|
props: props$a,
|
|
14180
17072
|
setup(_, {
|
|
14181
17073
|
slots
|
|
@@ -14230,9 +17122,9 @@ const props$9 = {
|
|
|
14230
17122
|
|
|
14231
17123
|
/** @jsxImportSource vue */
|
|
14232
17124
|
|
|
14233
|
-
const COMPONENT_NAME$
|
|
17125
|
+
const COMPONENT_NAME$d = 'vcm-tabs';
|
|
14234
17126
|
const MTabs = /* @__PURE__ */ defineComponent({
|
|
14235
|
-
name: COMPONENT_NAME$
|
|
17127
|
+
name: COMPONENT_NAME$d,
|
|
14236
17128
|
props: props$9,
|
|
14237
17129
|
emits: ['update:modelValue', 'change', 'click'],
|
|
14238
17130
|
setup(props, {
|
|
@@ -14497,9 +17389,9 @@ const MTabs = /* @__PURE__ */ defineComponent({
|
|
|
14497
17389
|
|
|
14498
17390
|
/** @jsxImportSource vue */
|
|
14499
17391
|
|
|
14500
|
-
const COMPONENT_NAME$
|
|
17392
|
+
const COMPONENT_NAME$c = 'vcm-tabs-pane';
|
|
14501
17393
|
const MTabsPane = /* @__PURE__ */ defineComponent({
|
|
14502
|
-
name: COMPONENT_NAME$
|
|
17394
|
+
name: COMPONENT_NAME$c,
|
|
14503
17395
|
props: props$a,
|
|
14504
17396
|
setup(_, {
|
|
14505
17397
|
slots
|
|
@@ -14623,9 +17515,9 @@ const getFitIndex = (options = {}) => {
|
|
|
14623
17515
|
|
|
14624
17516
|
/** @jsxImportSource vue */
|
|
14625
17517
|
|
|
14626
|
-
const COMPONENT_NAME$
|
|
17518
|
+
const COMPONENT_NAME$b = 'vc-text';
|
|
14627
17519
|
const Text = /* @__PURE__ */ defineComponent({
|
|
14628
|
-
name: COMPONENT_NAME$
|
|
17520
|
+
name: COMPONENT_NAME$b,
|
|
14629
17521
|
props: props$8,
|
|
14630
17522
|
setup(props, {
|
|
14631
17523
|
emit
|
|
@@ -14718,9 +17610,9 @@ const props$7 = {
|
|
|
14718
17610
|
|
|
14719
17611
|
/** @jsxImportSource vue */
|
|
14720
17612
|
|
|
14721
|
-
const COMPONENT_NAME$
|
|
17613
|
+
const COMPONENT_NAME$a = 'vc-textarea';
|
|
14722
17614
|
const Textarea = /* @__PURE__ */ defineComponent({
|
|
14723
|
-
name: COMPONENT_NAME$
|
|
17615
|
+
name: COMPONENT_NAME$a,
|
|
14724
17616
|
props: props$7,
|
|
14725
17617
|
setup(props, {
|
|
14726
17618
|
slots
|
|
@@ -14778,9 +17670,9 @@ const props$6 = {
|
|
|
14778
17670
|
}
|
|
14779
17671
|
};
|
|
14780
17672
|
|
|
14781
|
-
const COMPONENT_NAME$
|
|
17673
|
+
const COMPONENT_NAME$9 = "vc-theme";
|
|
14782
17674
|
const Theme = defineComponent({
|
|
14783
|
-
name: COMPONENT_NAME$
|
|
17675
|
+
name: COMPONENT_NAME$9,
|
|
14784
17676
|
props: props$6,
|
|
14785
17677
|
setup(props, { slots }) {
|
|
14786
17678
|
const themeId = Utils.getUid("vc-theme");
|
|
@@ -14866,9 +17758,9 @@ const Theme = defineComponent({
|
|
|
14866
17758
|
}
|
|
14867
17759
|
});
|
|
14868
17760
|
|
|
14869
|
-
const COMPONENT_NAME$
|
|
17761
|
+
const COMPONENT_NAME$8 = "vc-theme-view";
|
|
14870
17762
|
const ThemeView = defineComponent({
|
|
14871
|
-
name: COMPONENT_NAME$
|
|
17763
|
+
name: COMPONENT_NAME$8,
|
|
14872
17764
|
props: props$6,
|
|
14873
17765
|
setup(props, { slots }) {
|
|
14874
17766
|
return () => {
|
|
@@ -14884,9 +17776,9 @@ const ThemeView = defineComponent({
|
|
|
14884
17776
|
}
|
|
14885
17777
|
});
|
|
14886
17778
|
|
|
14887
|
-
const COMPONENT_NAME$
|
|
17779
|
+
const COMPONENT_NAME$7 = "vc-theme-text";
|
|
14888
17780
|
const ThemeText = defineComponent({
|
|
14889
|
-
name: COMPONENT_NAME$
|
|
17781
|
+
name: COMPONENT_NAME$7,
|
|
14890
17782
|
props: props$6,
|
|
14891
17783
|
setup(props, { slots }) {
|
|
14892
17784
|
return () => {
|
|
@@ -14902,9 +17794,9 @@ const ThemeText = defineComponent({
|
|
|
14902
17794
|
}
|
|
14903
17795
|
});
|
|
14904
17796
|
|
|
14905
|
-
const COMPONENT_NAME$
|
|
17797
|
+
const COMPONENT_NAME$6 = "vc-theme-image";
|
|
14906
17798
|
const ThemeImage = defineComponent({
|
|
14907
|
-
name: COMPONENT_NAME$
|
|
17799
|
+
name: COMPONENT_NAME$6,
|
|
14908
17800
|
props: props$6,
|
|
14909
17801
|
setup(props, { slots }) {
|
|
14910
17802
|
return () => {
|
|
@@ -14952,11 +17844,12 @@ const props$5 = {
|
|
|
14952
17844
|
|
|
14953
17845
|
/** @jsxImportSource vue */
|
|
14954
17846
|
|
|
17847
|
+
const COMPONENT_NAME$5 = 'vc-time-picker';
|
|
14955
17848
|
const getPanel = type => {
|
|
14956
17849
|
const isRange = type === 'timerange';
|
|
14957
17850
|
return isRange ? TimeRangePanel : TimePanel;
|
|
14958
17851
|
};
|
|
14959
|
-
const TimePicker = createPicker(props$5, () => {
|
|
17852
|
+
const TimePicker = createPicker(COMPONENT_NAME$5, props$5, () => {
|
|
14960
17853
|
const props = getCurrentInstance().props;
|
|
14961
17854
|
const icon = ref('icon');
|
|
14962
17855
|
const panel = shallowRef({});
|
|
@@ -15478,4 +18371,4 @@ const UploadPicker = /* @__PURE__ */ defineComponent({
|
|
|
15478
18371
|
|
|
15479
18372
|
const MUploadPicker = UploadPicker;
|
|
15480
18373
|
|
|
15481
|
-
export { ActionSheet, Alert, Artboard, Button, ButtonGroup, Calendar, Card, Carousel, Cascader, Chart, Checkbox, CheckboxGroup, Clipboard, Collapse, CollapseItem, ColorPicker, Countdown, Customer, DatePicker, Debounce, Divider, Drawer, DrawerView, Dropdown, Editor, Expand, Form, FormItem, Fragment, HTMLToImage, Icon, IconManager, Image, ImageCrop, ImagePreview, ImageProcessing, Input, InputNumber, InputSearch, MList as List, MListItem as ListItem, MActionSheet, MAlert, MArtboard, MButton, MButtonGroup, MCalendar, MCard, MCarousel, MCascader, MChart, MCheckbox, MCheckboxGroup, MClipboard, MCollapse, MCollapseItem, MColorPicker, MCountdown, MCustomer, MDatePicker, Debounce as MDebounce, MDivider, MDrawer, MDrawerView, MDropdown, MEditor, MExpand, MForm, MFormItem, MFragment, MHTMLToImage, MIcon, MImage, MImageCrop, MImagePreview, MImageProcessing, MInput, MInputNumber, MInputSearch, MList, MListItem, MMarquee, MMessage, modal as MModal, MModalView, MNotice, MOption, MPagination, MPicker, MPopconfirm, MPopover, MPopup, MPortal, MPrint, MProgress, MRadio, MRadioGroup, MRate, MRecycleList, MResizer, MScroller, MSelect, MSlider, MSortList, MSpin, MSteps, MSwitch, MTable, MTabs, MTabsPane, MTag, MText, MTextarea, MTimePicker, MTimeline, MToast, MToastView, MTouch, MTransition, MTransitionCollapse, MTransitionFade, MTransitionScale, MTransitionSlide, MTransitionZoom, MTree, MUpload, MUploadPicker, Marquee, Message, MessageView, Modal, ModalView, Notice, NoticeView, Option$1 as Option, Pagination, Picker, Popconfirm, Popover, Popup, Portal, PortalView, Print, Progress, Radio, RadioGroup, Rate, RecycleList, Resizer, Scroller, ScrollerWheel, Select, Slider, SortList, Spin, Steps, Switch, Table, Tabs, TabsPane, Tag, Text, Textarea, Theme, ThemeImage, ThemeText, ThemeView, TimePicker, Timeline, Toast, ToastView, Touch, Transition, TransitionCollapse, TransitionFade, TransitionScale, TransitionSlide, TransitionZoom, Tree, Upload, UploadPicker, VcError, VcInstance };
|
|
18374
|
+
export { ActionSheet, Alert, Artboard, Button, ButtonGroup, Calendar, Card, Carousel, Cascader, Chart, Checkbox, CheckboxGroup, Clipboard, Collapse, CollapseItem, ColorPicker, Countdown, Customer, DatePicker, Debounce, Divider, Drawer, DrawerView, Dropdown, Editor, Expand$1 as Expand, Form, FormItem, Fragment, HTMLToImage, Icon, IconManager, Image, ImageCrop, ImagePreview, ImageProcessing, Input, InputNumber, InputSearch, MList as List, MListItem as ListItem, MActionSheet, MAlert, MArtboard, MButton, MButtonGroup, MCalendar, MCard, MCarousel, MCascader, MChart, MCheckbox, MCheckboxGroup, MClipboard, MCollapse, MCollapseItem, MColorPicker, MCountdown, MCustomer, MDatePicker, Debounce as MDebounce, MDivider, MDrawer, MDrawerView, MDropdown, MEditor, MExpand, MForm, MFormItem, MFragment, MHTMLToImage, MIcon, MImage, MImageCrop, MImagePreview, MImageProcessing, MInput, MInputNumber, MInputSearch, MList, MListItem, MMarquee, MMessage, modal as MModal, MModalView, MNotice, MOption, MPagination, MPicker, MPopconfirm, MPopover, MPopup, MPortal, MPrint, MProgress, MRadio, MRadioGroup, MRate, MRecycleList, MResizer, MScroller, MSelect, MSlider, MSortList, MSpin, MSteps, MSwitch, MTable, MTableColumn, MTabs, MTabsPane, MTag, MText, MTextarea, MTimePicker, MTimeline, MToast, MToastView, MTouch, MTransition, MTransitionCollapse, MTransitionFade, MTransitionScale, MTransitionSlide, MTransitionZoom, MTree, MUpload, MUploadPicker, Marquee, Message, MessageView, Modal, ModalView, Notice, NoticeView, Option$1 as Option, Pagination, Picker, Popconfirm, Popover, Popup, Portal, PortalView, Print, Progress, Radio, RadioGroup, Rate, RecycleList, Resizer, Scroller, ScrollerWheel, Select, Slider, SortList, Spin, Steps, Switch, Table, TableColumn, Tabs, TabsPane, Tag, Text, Textarea, Theme, ThemeImage, ThemeText, ThemeView, TimePicker, Timeline, Toast, ToastView, Touch, Transition, TransitionCollapse, TransitionFade, TransitionScale, TransitionSlide, TransitionZoom, Tree, Upload, UploadPicker, VcError, VcInstance };
|