@deot/vc-components 1.0.10 → 1.0.11
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 +3221 -290
- package/dist/index.d.ts +509 -10
- package/dist/index.iife.js +21237 -352
- package/dist/index.js +3222 -293
- package/dist/index.style.css +1 -1
- package/dist/index.umd.cjs +21237 -352
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -14,6 +14,8 @@ const helperValidator = require('@deot/helper-validator');
|
|
|
14
14
|
const helperCache = require('@deot/helper-cache');
|
|
15
15
|
const Load = require('@deot/helper-load');
|
|
16
16
|
const helperScheduler = require('@deot/helper-scheduler');
|
|
17
|
+
const lodash = require('lodash');
|
|
18
|
+
const helperFp = require('@deot/helper-fp');
|
|
17
19
|
|
|
18
20
|
function _interopNamespaceDefault(e) {
|
|
19
21
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
@@ -89,9 +91,9 @@ const props$1q = {
|
|
|
89
91
|
|
|
90
92
|
/** @jsxImportSource vue */
|
|
91
93
|
|
|
92
|
-
const COMPONENT_NAME$
|
|
94
|
+
const COMPONENT_NAME$1$ = 'vc-action-sheet';
|
|
93
95
|
const ActionSheet = /* @__PURE__ */ vue.defineComponent({
|
|
94
|
-
name: COMPONENT_NAME$
|
|
96
|
+
name: COMPONENT_NAME$1$,
|
|
95
97
|
props: props$1q,
|
|
96
98
|
setup(props, {
|
|
97
99
|
slots
|
|
@@ -278,9 +280,9 @@ const IconManager = new Manager();
|
|
|
278
280
|
|
|
279
281
|
/** @jsxImportSource vue */
|
|
280
282
|
|
|
281
|
-
const COMPONENT_NAME$
|
|
283
|
+
const COMPONENT_NAME$1_ = 'vc-icon';
|
|
282
284
|
const Icon = /* @__PURE__ */ vue.defineComponent({
|
|
283
|
-
name: COMPONENT_NAME$
|
|
285
|
+
name: COMPONENT_NAME$1_,
|
|
284
286
|
props: props$1o,
|
|
285
287
|
setup(props) {
|
|
286
288
|
const viewBox = vue.ref('0 0 1024 1024');
|
|
@@ -479,9 +481,9 @@ const useTransition = () => {
|
|
|
479
481
|
};
|
|
480
482
|
};
|
|
481
483
|
|
|
482
|
-
const COMPONENT_NAME$
|
|
484
|
+
const COMPONENT_NAME$1Z = "vc-transition";
|
|
483
485
|
const Transition = vue.defineComponent({
|
|
484
|
-
name: COMPONENT_NAME$
|
|
486
|
+
name: COMPONENT_NAME$1Z,
|
|
485
487
|
props: props$1n,
|
|
486
488
|
// 当不声明emits的情况下,事件存在于attrs中
|
|
487
489
|
inheritAttrs: false,
|
|
@@ -502,9 +504,9 @@ const Transition = vue.defineComponent({
|
|
|
502
504
|
}
|
|
503
505
|
});
|
|
504
506
|
|
|
505
|
-
const COMPONENT_NAME$
|
|
507
|
+
const COMPONENT_NAME$1Y = "vc-transition-collapse";
|
|
506
508
|
const TransitionCollapse = vue.defineComponent({
|
|
507
|
-
name: COMPONENT_NAME$
|
|
509
|
+
name: COMPONENT_NAME$1Y,
|
|
508
510
|
props: props$1n,
|
|
509
511
|
// 当不声明emits的情况下,事件存在于attrs中
|
|
510
512
|
inheritAttrs: false,
|
|
@@ -623,9 +625,9 @@ const TransitionCollapse = vue.defineComponent({
|
|
|
623
625
|
}
|
|
624
626
|
});
|
|
625
627
|
|
|
626
|
-
const COMPONENT_NAME$
|
|
628
|
+
const COMPONENT_NAME$1X = "vc-transition-fade";
|
|
627
629
|
const TransitionFade = vue.defineComponent({
|
|
628
|
-
name: COMPONENT_NAME$
|
|
630
|
+
name: COMPONENT_NAME$1X,
|
|
629
631
|
props: {
|
|
630
632
|
...props$1n,
|
|
631
633
|
// inheritAttrs必须是false
|
|
@@ -660,9 +662,9 @@ const TransitionFade = vue.defineComponent({
|
|
|
660
662
|
}
|
|
661
663
|
});
|
|
662
664
|
|
|
663
|
-
const COMPONENT_NAME$
|
|
665
|
+
const COMPONENT_NAME$1W = "vc-transition-scale";
|
|
664
666
|
const TransitionScale = vue.defineComponent({
|
|
665
|
-
name: COMPONENT_NAME$
|
|
667
|
+
name: COMPONENT_NAME$1W,
|
|
666
668
|
props: {
|
|
667
669
|
...props$1n,
|
|
668
670
|
mode: {
|
|
@@ -702,9 +704,9 @@ const TransitionScale = vue.defineComponent({
|
|
|
702
704
|
}
|
|
703
705
|
});
|
|
704
706
|
|
|
705
|
-
const COMPONENT_NAME$
|
|
707
|
+
const COMPONENT_NAME$1V = "vc-transition-slide";
|
|
706
708
|
const TransitionSlide = vue.defineComponent({
|
|
707
|
-
name: COMPONENT_NAME$
|
|
709
|
+
name: COMPONENT_NAME$1V,
|
|
708
710
|
props: {
|
|
709
711
|
...props$1n,
|
|
710
712
|
mode: {
|
|
@@ -744,9 +746,9 @@ const TransitionSlide = vue.defineComponent({
|
|
|
744
746
|
}
|
|
745
747
|
});
|
|
746
748
|
|
|
747
|
-
const COMPONENT_NAME$
|
|
749
|
+
const COMPONENT_NAME$1U = "vc-transition-zoom";
|
|
748
750
|
const TransitionZoom = vue.defineComponent({
|
|
749
|
-
name: COMPONENT_NAME$
|
|
751
|
+
name: COMPONENT_NAME$1U,
|
|
750
752
|
props: {
|
|
751
753
|
...props$1n,
|
|
752
754
|
mode: {
|
|
@@ -788,7 +790,7 @@ const TransitionZoom = vue.defineComponent({
|
|
|
788
790
|
|
|
789
791
|
/** @jsxImportSource vue */
|
|
790
792
|
|
|
791
|
-
const COMPONENT_NAME$
|
|
793
|
+
const COMPONENT_NAME$1T = 'vc-alert';
|
|
792
794
|
|
|
793
795
|
// [color, borderColor, backgroundColor], -> CSS
|
|
794
796
|
const THEME_MAP = {
|
|
@@ -798,7 +800,7 @@ const THEME_MAP = {
|
|
|
798
800
|
warning: ['#ffbf00', '#ffe58f', '#fffbe6']
|
|
799
801
|
};
|
|
800
802
|
const Alert = /* @__PURE__ */ vue.defineComponent({
|
|
801
|
-
name: COMPONENT_NAME$
|
|
803
|
+
name: COMPONENT_NAME$1T,
|
|
802
804
|
props: props$1p,
|
|
803
805
|
setup(props, {
|
|
804
806
|
slots,
|
|
@@ -897,9 +899,9 @@ const props$1m = {
|
|
|
897
899
|
|
|
898
900
|
/** @jsxImportSource vue */
|
|
899
901
|
|
|
900
|
-
const COMPONENT_NAME$
|
|
902
|
+
const COMPONENT_NAME$1S = 'vc-artboard';
|
|
901
903
|
const Artboard = /* @__PURE__ */ vue.defineComponent({
|
|
902
|
-
name: COMPONENT_NAME$
|
|
904
|
+
name: COMPONENT_NAME$1S,
|
|
903
905
|
props: props$1m,
|
|
904
906
|
setup(props, {
|
|
905
907
|
slots
|
|
@@ -938,9 +940,9 @@ const props$1l = {
|
|
|
938
940
|
|
|
939
941
|
/** @jsxImportSource vue */
|
|
940
942
|
|
|
941
|
-
const COMPONENT_NAME$
|
|
943
|
+
const COMPONENT_NAME$1R = 'vc-spin';
|
|
942
944
|
const Spin = /* @__PURE__ */ vue.defineComponent({
|
|
943
|
-
name: COMPONENT_NAME$
|
|
945
|
+
name: COMPONENT_NAME$1R,
|
|
944
946
|
props: props$1l,
|
|
945
947
|
setup(props, {
|
|
946
948
|
slots
|
|
@@ -991,9 +993,9 @@ const props$1k = {
|
|
|
991
993
|
exclude: RegExp
|
|
992
994
|
};
|
|
993
995
|
|
|
994
|
-
const COMPONENT_NAME$
|
|
996
|
+
const COMPONENT_NAME$1Q = "vc-debounce";
|
|
995
997
|
const Debounce = vue.defineComponent({
|
|
996
|
-
name: COMPONENT_NAME$
|
|
998
|
+
name: COMPONENT_NAME$1Q,
|
|
997
999
|
props: props$1k,
|
|
998
1000
|
/**
|
|
999
1001
|
* 不声明emits使得事件被透传放入attrs中, 这样可以让所有的事件透传
|
|
@@ -1065,9 +1067,9 @@ const props$1j = {
|
|
|
1065
1067
|
|
|
1066
1068
|
/** @jsxImportSource vue */
|
|
1067
1069
|
|
|
1068
|
-
const COMPONENT_NAME$
|
|
1070
|
+
const COMPONENT_NAME$1P = 'vc-button';
|
|
1069
1071
|
const Button = /* @__PURE__ */ vue.defineComponent({
|
|
1070
|
-
name: COMPONENT_NAME$
|
|
1072
|
+
name: COMPONENT_NAME$1P,
|
|
1071
1073
|
emits: ['click'],
|
|
1072
1074
|
props: props$1j,
|
|
1073
1075
|
setup(props, {
|
|
@@ -1147,9 +1149,9 @@ const props$1i = {
|
|
|
1147
1149
|
|
|
1148
1150
|
/** @jsxImportSource vue */
|
|
1149
1151
|
|
|
1150
|
-
const COMPONENT_NAME$
|
|
1152
|
+
const COMPONENT_NAME$1O = 'vc-button-group';
|
|
1151
1153
|
const ButtonGroup = /* @__PURE__ */ vue.defineComponent({
|
|
1152
|
-
name: COMPONENT_NAME$
|
|
1154
|
+
name: COMPONENT_NAME$1O,
|
|
1153
1155
|
props: props$1i,
|
|
1154
1156
|
setup(props, {
|
|
1155
1157
|
slots
|
|
@@ -1183,9 +1185,9 @@ const props$1h = {
|
|
|
1183
1185
|
|
|
1184
1186
|
/** @jsxImportSource vue */
|
|
1185
1187
|
|
|
1186
|
-
const COMPONENT_NAME$
|
|
1188
|
+
const COMPONENT_NAME$1N = 'vc-calendar';
|
|
1187
1189
|
const Calendar = /* @__PURE__ */ vue.defineComponent({
|
|
1188
|
-
name: COMPONENT_NAME$
|
|
1190
|
+
name: COMPONENT_NAME$1N,
|
|
1189
1191
|
props: props$1h,
|
|
1190
1192
|
setup(props, {
|
|
1191
1193
|
slots
|
|
@@ -1223,9 +1225,9 @@ const props$1g = {
|
|
|
1223
1225
|
|
|
1224
1226
|
/** @jsxImportSource vue */
|
|
1225
1227
|
|
|
1226
|
-
const COMPONENT_NAME$
|
|
1228
|
+
const COMPONENT_NAME$1M = 'vc-card';
|
|
1227
1229
|
const Card = /* @__PURE__ */ vue.defineComponent({
|
|
1228
|
-
name: COMPONENT_NAME$
|
|
1230
|
+
name: COMPONENT_NAME$1M,
|
|
1229
1231
|
props: props$1g,
|
|
1230
1232
|
setup(props, {
|
|
1231
1233
|
slots
|
|
@@ -1261,9 +1263,9 @@ const props$1f = {
|
|
|
1261
1263
|
|
|
1262
1264
|
/** @jsxImportSource vue */
|
|
1263
1265
|
|
|
1264
|
-
const COMPONENT_NAME$
|
|
1266
|
+
const COMPONENT_NAME$1L = 'vc-carousel';
|
|
1265
1267
|
const Carousel = /* @__PURE__ */ vue.defineComponent({
|
|
1266
|
-
name: COMPONENT_NAME$
|
|
1268
|
+
name: COMPONENT_NAME$1L,
|
|
1267
1269
|
props: props$1f,
|
|
1268
1270
|
setup(props, {
|
|
1269
1271
|
slots
|
|
@@ -1287,9 +1289,9 @@ const props$1e = {
|
|
|
1287
1289
|
|
|
1288
1290
|
/** @jsxImportSource vue */
|
|
1289
1291
|
|
|
1290
|
-
const COMPONENT_NAME$
|
|
1292
|
+
const COMPONENT_NAME$1K = 'vc-cascader';
|
|
1291
1293
|
const Cascader = /* @__PURE__ */ vue.defineComponent({
|
|
1292
|
-
name: COMPONENT_NAME$
|
|
1294
|
+
name: COMPONENT_NAME$1K,
|
|
1293
1295
|
props: props$1e,
|
|
1294
1296
|
setup(props, {
|
|
1295
1297
|
slots
|
|
@@ -1358,9 +1360,9 @@ const props$1d = {
|
|
|
1358
1360
|
|
|
1359
1361
|
/** @jsxImportSource vue */
|
|
1360
1362
|
|
|
1361
|
-
const COMPONENT_NAME$
|
|
1363
|
+
const COMPONENT_NAME$1J = 'vc-chart';
|
|
1362
1364
|
const Chart = /* @__PURE__ */ vue.defineComponent({
|
|
1363
|
-
name: COMPONENT_NAME$
|
|
1365
|
+
name: COMPONENT_NAME$1J,
|
|
1364
1366
|
props: props$1d,
|
|
1365
1367
|
emits: [...EVENTS, 'ready'],
|
|
1366
1368
|
setup(props, {
|
|
@@ -1591,9 +1593,9 @@ const useCheckbox = () => {
|
|
|
1591
1593
|
|
|
1592
1594
|
/** @jsxImportSource vue */
|
|
1593
1595
|
|
|
1594
|
-
const COMPONENT_NAME$
|
|
1596
|
+
const COMPONENT_NAME$1I = 'vc-checkbox';
|
|
1595
1597
|
const Checkbox = /* @__PURE__ */ vue.defineComponent({
|
|
1596
|
-
name: COMPONENT_NAME$
|
|
1598
|
+
name: COMPONENT_NAME$1I,
|
|
1597
1599
|
props: props$1c,
|
|
1598
1600
|
emits: ['update:modelValue', 'change'],
|
|
1599
1601
|
setup(props, {
|
|
@@ -1680,9 +1682,9 @@ const useCheckboxGroup = () => {
|
|
|
1680
1682
|
|
|
1681
1683
|
/** @jsxImportSource vue */
|
|
1682
1684
|
|
|
1683
|
-
const COMPONENT_NAME$
|
|
1685
|
+
const COMPONENT_NAME$1H = 'vc-checkbox-group';
|
|
1684
1686
|
const CheckboxGroup = /* @__PURE__ */ vue.defineComponent({
|
|
1685
|
-
name: COMPONENT_NAME$
|
|
1687
|
+
name: COMPONENT_NAME$1H,
|
|
1686
1688
|
props: props$1b,
|
|
1687
1689
|
emits: ['update:modelValue', 'change'],
|
|
1688
1690
|
setup(props, {
|
|
@@ -1700,9 +1702,9 @@ const CheckboxGroup = /* @__PURE__ */ vue.defineComponent({
|
|
|
1700
1702
|
|
|
1701
1703
|
/** @jsxImportSource vue */
|
|
1702
1704
|
|
|
1703
|
-
const COMPONENT_NAME$
|
|
1705
|
+
const COMPONENT_NAME$1G = 'vcm-checkbox';
|
|
1704
1706
|
const MCheckbox = /* @__PURE__ */ vue.defineComponent({
|
|
1705
|
-
name: COMPONENT_NAME$
|
|
1707
|
+
name: COMPONENT_NAME$1G,
|
|
1706
1708
|
props: props$1c,
|
|
1707
1709
|
emits: ['update:modelValue', 'change'],
|
|
1708
1710
|
setup(props, {
|
|
@@ -1742,9 +1744,9 @@ const MCheckbox = /* @__PURE__ */ vue.defineComponent({
|
|
|
1742
1744
|
|
|
1743
1745
|
/** @jsxImportSource vue */
|
|
1744
1746
|
|
|
1745
|
-
const COMPONENT_NAME$
|
|
1747
|
+
const COMPONENT_NAME$1F = 'vcm-checkbox-group';
|
|
1746
1748
|
const MCheckboxGroup = /* @__PURE__ */ vue.defineComponent({
|
|
1747
|
-
name: COMPONENT_NAME$
|
|
1749
|
+
name: COMPONENT_NAME$1F,
|
|
1748
1750
|
props: props$1b,
|
|
1749
1751
|
emits: ['update:modelValue', 'change'],
|
|
1750
1752
|
setup(props, {
|
|
@@ -1803,9 +1805,9 @@ const props$19 = {
|
|
|
1803
1805
|
}
|
|
1804
1806
|
};
|
|
1805
1807
|
|
|
1806
|
-
const COMPONENT_NAME$
|
|
1808
|
+
const COMPONENT_NAME$1E = "vc-customer";
|
|
1807
1809
|
const Customer = vue.defineComponent({
|
|
1808
|
-
name: COMPONENT_NAME$
|
|
1810
|
+
name: COMPONENT_NAME$1E,
|
|
1809
1811
|
props: props$19,
|
|
1810
1812
|
setup(props, context) {
|
|
1811
1813
|
return () => vue.h(() => {
|
|
@@ -1816,9 +1818,9 @@ const Customer = vue.defineComponent({
|
|
|
1816
1818
|
|
|
1817
1819
|
/** @jsxImportSource vue */
|
|
1818
1820
|
|
|
1819
|
-
const COMPONENT_NAME$
|
|
1821
|
+
const COMPONENT_NAME$1D = 'vc-message';
|
|
1820
1822
|
const MessageView = /* @__PURE__ */ vue.defineComponent({
|
|
1821
|
-
name: COMPONENT_NAME$
|
|
1823
|
+
name: COMPONENT_NAME$1D,
|
|
1822
1824
|
emits: ['before-close', 'close', 'portal-fulfilled'],
|
|
1823
1825
|
props: props$1a,
|
|
1824
1826
|
setup(props, {
|
|
@@ -1965,7 +1967,7 @@ class PortalLeaf {
|
|
|
1965
1967
|
}
|
|
1966
1968
|
}
|
|
1967
1969
|
|
|
1968
|
-
const COMPONENT_NAME$
|
|
1970
|
+
const COMPONENT_NAME$1C = "vc-portal";
|
|
1969
1971
|
class Portal {
|
|
1970
1972
|
/**
|
|
1971
1973
|
* 清理Portals类型组件
|
|
@@ -2017,7 +2019,7 @@ class Portal {
|
|
|
2017
2019
|
this.wrapper = wrapper;
|
|
2018
2020
|
this.globalOptions = {
|
|
2019
2021
|
...options,
|
|
2020
|
-
name: options?.name || wrapper.name || Utils__namespace.getUid(COMPONENT_NAME$
|
|
2022
|
+
name: options?.name || wrapper.name || Utils__namespace.getUid(COMPONENT_NAME$1C)
|
|
2021
2023
|
};
|
|
2022
2024
|
}
|
|
2023
2025
|
popup(propsData, options) {
|
|
@@ -2116,7 +2118,7 @@ class Portal {
|
|
|
2116
2118
|
...rest
|
|
2117
2119
|
} = options;
|
|
2118
2120
|
let useAllNodes = fragment;
|
|
2119
|
-
const name = multiple ? `${name$}__${Utils__namespace.getUid(COMPONENT_NAME$
|
|
2121
|
+
const name = multiple ? `${name$}__${Utils__namespace.getUid(COMPONENT_NAME$1C)}` : name$;
|
|
2120
2122
|
const container = document.createElement(tag);
|
|
2121
2123
|
const root = typeof el === "object" ? el : document.querySelector(el || "body");
|
|
2122
2124
|
!alive && Portal.leafs.get(name)?.destroy();
|
|
@@ -2150,7 +2152,7 @@ class Portal {
|
|
|
2150
2152
|
} else {
|
|
2151
2153
|
const wrapper = this.wrapper;
|
|
2152
2154
|
const app = vue.createApp({
|
|
2153
|
-
name: COMPONENT_NAME$
|
|
2155
|
+
name: COMPONENT_NAME$1C,
|
|
2154
2156
|
parent,
|
|
2155
2157
|
setup() {
|
|
2156
2158
|
if (alive) {
|
|
@@ -2262,13 +2264,13 @@ const props$18 = {
|
|
|
2262
2264
|
}
|
|
2263
2265
|
};
|
|
2264
2266
|
|
|
2265
|
-
const COMPONENT_NAME$
|
|
2267
|
+
const COMPONENT_NAME$1B = 'vc-portal-view';
|
|
2266
2268
|
|
|
2267
2269
|
/**
|
|
2268
2270
|
* 写法不同,但与vue@2.x 保持一致
|
|
2269
2271
|
*/
|
|
2270
2272
|
const PortalView = /* @__PURE__ */ vue.defineComponent({
|
|
2271
|
-
name: COMPONENT_NAME$
|
|
2273
|
+
name: COMPONENT_NAME$1B,
|
|
2272
2274
|
props: props$18,
|
|
2273
2275
|
setup(props, {
|
|
2274
2276
|
slots
|
|
@@ -2439,9 +2441,9 @@ const useClipboard = (done) => {
|
|
|
2439
2441
|
return () => vue.h(props.tag, { onClick: handleClick, class: "vc-clipboard" }, slots?.default?.());
|
|
2440
2442
|
};
|
|
2441
2443
|
|
|
2442
|
-
const COMPONENT_NAME$
|
|
2444
|
+
const COMPONENT_NAME$1A = "vc-clipboard";
|
|
2443
2445
|
const Clipboard$1 = vue.defineComponent({
|
|
2444
|
-
name: COMPONENT_NAME$
|
|
2446
|
+
name: COMPONENT_NAME$1A,
|
|
2445
2447
|
props: props$17,
|
|
2446
2448
|
setup() {
|
|
2447
2449
|
return useClipboard((content) => Message.success({ content }));
|
|
@@ -2481,9 +2483,9 @@ const MTransitionZoom = TransitionZoom;
|
|
|
2481
2483
|
|
|
2482
2484
|
/** @jsxImportSource vue */
|
|
2483
2485
|
|
|
2484
|
-
const COMPONENT_NAME$
|
|
2486
|
+
const COMPONENT_NAME$1z = 'vcm-toast';
|
|
2485
2487
|
const MToastView = /* @__PURE__ */ vue.defineComponent({
|
|
2486
|
-
name: COMPONENT_NAME$
|
|
2488
|
+
name: COMPONENT_NAME$1z,
|
|
2487
2489
|
emits: ['close', 'portal-fulfilled'],
|
|
2488
2490
|
props: props$16,
|
|
2489
2491
|
setup(props, {
|
|
@@ -2585,9 +2587,9 @@ const warning$2 = create$3({ mode: "warning" });
|
|
|
2585
2587
|
const error$2 = create$3({ mode: "error" });
|
|
2586
2588
|
const MToast = Object.assign(MToastView, { destroy: destroy$4, info: info$2, success: success$2, loading, warning: warning$2, error: error$2 });
|
|
2587
2589
|
|
|
2588
|
-
const COMPONENT_NAME$
|
|
2590
|
+
const COMPONENT_NAME$1y = "vcm-clipboard";
|
|
2589
2591
|
const MClipboard$1 = vue.defineComponent({
|
|
2590
|
-
name: COMPONENT_NAME$
|
|
2592
|
+
name: COMPONENT_NAME$1y,
|
|
2591
2593
|
props: props$17,
|
|
2592
2594
|
setup() {
|
|
2593
2595
|
return useClipboard((content) => MToast.info({ content }));
|
|
@@ -2619,9 +2621,9 @@ const props$15 = {
|
|
|
2619
2621
|
}
|
|
2620
2622
|
};
|
|
2621
2623
|
|
|
2622
|
-
const COMPONENT_NAME$
|
|
2624
|
+
const COMPONENT_NAME$1x = "vc-collapse";
|
|
2623
2625
|
const Collapse = vue.defineComponent({
|
|
2624
|
-
name: COMPONENT_NAME$
|
|
2626
|
+
name: COMPONENT_NAME$1x,
|
|
2625
2627
|
props: props$15,
|
|
2626
2628
|
emits: ["update:moodelValue", "change"],
|
|
2627
2629
|
setup(props, { slots, emit }) {
|
|
@@ -2738,9 +2740,9 @@ const props$13 = {
|
|
|
2738
2740
|
function _isSlot$3(s) {
|
|
2739
2741
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
2740
2742
|
}
|
|
2741
|
-
const COMPONENT_NAME$
|
|
2742
|
-
const Expand = /* @__PURE__ */ vue.defineComponent({
|
|
2743
|
-
name: COMPONENT_NAME$
|
|
2743
|
+
const COMPONENT_NAME$1w = 'vc-expand';
|
|
2744
|
+
const Expand$1 = /* @__PURE__ */ vue.defineComponent({
|
|
2745
|
+
name: COMPONENT_NAME$1w,
|
|
2744
2746
|
props: props$13,
|
|
2745
2747
|
setup(props, {
|
|
2746
2748
|
slots
|
|
@@ -2770,9 +2772,9 @@ const Expand = /* @__PURE__ */ vue.defineComponent({
|
|
|
2770
2772
|
|
|
2771
2773
|
/** @jsxImportSource vue */
|
|
2772
2774
|
|
|
2773
|
-
const COMPONENT_NAME$
|
|
2775
|
+
const COMPONENT_NAME$1v = 'vc-collapse-item';
|
|
2774
2776
|
const CollapseItem = /* @__PURE__ */ vue.defineComponent({
|
|
2775
|
-
name: COMPONENT_NAME$
|
|
2777
|
+
name: COMPONENT_NAME$1v,
|
|
2776
2778
|
props: props$14,
|
|
2777
2779
|
setup(props, {
|
|
2778
2780
|
slots,
|
|
@@ -2819,7 +2821,7 @@ const CollapseItem = /* @__PURE__ */ vue.defineComponent({
|
|
|
2819
2821
|
"onClick": handleToggle
|
|
2820
2822
|
}, [slots.default?.(), slots.icon?.({
|
|
2821
2823
|
visible: isActive.value
|
|
2822
|
-
})]), vue.createVNode(Expand, {
|
|
2824
|
+
})]), vue.createVNode(Expand$1, {
|
|
2823
2825
|
"modelValue": isActive.value,
|
|
2824
2826
|
"alive": alive.value,
|
|
2825
2827
|
"onChange": v => isActive.value = v
|
|
@@ -2847,9 +2849,9 @@ const props$12 = {
|
|
|
2847
2849
|
|
|
2848
2850
|
/** @jsxImportSource vue */
|
|
2849
2851
|
|
|
2850
|
-
const COMPONENT_NAME$
|
|
2852
|
+
const COMPONENT_NAME$1u = 'vc-color-picker';
|
|
2851
2853
|
const ColorPicker = /* @__PURE__ */ vue.defineComponent({
|
|
2852
|
-
name: COMPONENT_NAME$
|
|
2854
|
+
name: COMPONENT_NAME$1u,
|
|
2853
2855
|
props: props$12,
|
|
2854
2856
|
setup(props, {
|
|
2855
2857
|
slots
|
|
@@ -2873,9 +2875,9 @@ const props$11 = {
|
|
|
2873
2875
|
|
|
2874
2876
|
/** @jsxImportSource vue */
|
|
2875
2877
|
|
|
2876
|
-
const COMPONENT_NAME$
|
|
2878
|
+
const COMPONENT_NAME$1t = 'vc-countdown';
|
|
2877
2879
|
const Countdown = /* @__PURE__ */ vue.defineComponent({
|
|
2878
|
-
name: COMPONENT_NAME$
|
|
2880
|
+
name: COMPONENT_NAME$1t,
|
|
2879
2881
|
props: props$11,
|
|
2880
2882
|
setup(props, {
|
|
2881
2883
|
slots
|
|
@@ -3324,9 +3326,9 @@ const useNativeEmitter = (input, expose) => {
|
|
|
3324
3326
|
|
|
3325
3327
|
/** @jsxImportSource vue */
|
|
3326
3328
|
|
|
3327
|
-
const COMPONENT_NAME$
|
|
3329
|
+
const COMPONENT_NAME$1s = 'vc-input';
|
|
3328
3330
|
const Input = /* @__PURE__ */ vue.defineComponent({
|
|
3329
|
-
name: COMPONENT_NAME$
|
|
3331
|
+
name: COMPONENT_NAME$1s,
|
|
3330
3332
|
inheritAttrs: false,
|
|
3331
3333
|
props: {
|
|
3332
3334
|
...props$$,
|
|
@@ -3660,9 +3662,9 @@ const useInputNumber = () => {
|
|
|
3660
3662
|
|
|
3661
3663
|
/** @jsxImportSource vue */
|
|
3662
3664
|
|
|
3663
|
-
const COMPONENT_NAME$
|
|
3665
|
+
const COMPONENT_NAME$1r = 'vc-input-number';
|
|
3664
3666
|
const InputNumber = /* @__PURE__ */ vue.defineComponent({
|
|
3665
|
-
name: COMPONENT_NAME$
|
|
3667
|
+
name: COMPONENT_NAME$1r,
|
|
3666
3668
|
props: props$X,
|
|
3667
3669
|
inheritAttrs: false,
|
|
3668
3670
|
setup(props, {
|
|
@@ -3726,9 +3728,9 @@ const props$W = {
|
|
|
3726
3728
|
|
|
3727
3729
|
/** @jsxImportSource vue */
|
|
3728
3730
|
|
|
3729
|
-
const COMPONENT_NAME$
|
|
3731
|
+
const COMPONENT_NAME$1q = 'vc-input-search';
|
|
3730
3732
|
const InputSearch = /* @__PURE__ */ vue.defineComponent({
|
|
3731
|
-
name: COMPONENT_NAME$
|
|
3733
|
+
name: COMPONENT_NAME$1q,
|
|
3732
3734
|
props: props$W,
|
|
3733
3735
|
inheritAttrs: false,
|
|
3734
3736
|
setup(props, {
|
|
@@ -4019,9 +4021,9 @@ const usePos = () => {
|
|
|
4019
4021
|
function _isSlot$2(s) {
|
|
4020
4022
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
4021
4023
|
}
|
|
4022
|
-
const COMPONENT_NAME$
|
|
4024
|
+
const COMPONENT_NAME$1p = 'vc-popover-wrapper';
|
|
4023
4025
|
const PopoverWrapper = /* @__PURE__ */ vue.defineComponent({
|
|
4024
|
-
name: COMPONENT_NAME$
|
|
4026
|
+
name: COMPONENT_NAME$1p,
|
|
4025
4027
|
props: props$_,
|
|
4026
4028
|
emits: ['portal-fulfilled', 'close'],
|
|
4027
4029
|
setup(props, {
|
|
@@ -4273,9 +4275,9 @@ const PopoverPortal = new Portal(PopoverWrapper);
|
|
|
4273
4275
|
|
|
4274
4276
|
/** @jsxImportSource vue */
|
|
4275
4277
|
|
|
4276
|
-
const COMPONENT_NAME$
|
|
4278
|
+
const COMPONENT_NAME$1o = 'vc-popover';
|
|
4277
4279
|
const Popover$1 = /* @__PURE__ */ vue.defineComponent({
|
|
4278
|
-
name: COMPONENT_NAME$
|
|
4280
|
+
name: COMPONENT_NAME$1o,
|
|
4279
4281
|
props: props$Z,
|
|
4280
4282
|
emits: ['update:modelValue', 'visible-change', 'ready', 'close'],
|
|
4281
4283
|
setup(props, {
|
|
@@ -5150,9 +5152,8 @@ const useBase = () => {
|
|
|
5150
5152
|
|
|
5151
5153
|
/** @jsxImportSource vue */
|
|
5152
5154
|
|
|
5153
|
-
const
|
|
5154
|
-
|
|
5155
|
-
name: COMPONENT_NAME$1l,
|
|
5155
|
+
const createPicker = (name, pickerProps, usePicker) => /* @__PURE__ */ vue.defineComponent({
|
|
5156
|
+
name,
|
|
5156
5157
|
props: Object.assign(props$Y, pickerProps),
|
|
5157
5158
|
inheritAttrs: false,
|
|
5158
5159
|
emits: ['update:modelValue', 'change', 'clear', 'error', 'close', 'input', 'ready', 'visible-change', 'ok'],
|
|
@@ -5377,9 +5378,9 @@ const getTimeType = type => {
|
|
|
5377
5378
|
}
|
|
5378
5379
|
return view;
|
|
5379
5380
|
};
|
|
5380
|
-
const COMPONENT_NAME$
|
|
5381
|
+
const COMPONENT_NAME$1n = 'vc-date-confirm';
|
|
5381
5382
|
const Confirm = /* @__PURE__ */ vue.defineComponent({
|
|
5382
|
-
name: COMPONENT_NAME$
|
|
5383
|
+
name: COMPONENT_NAME$1n,
|
|
5383
5384
|
props: {
|
|
5384
5385
|
showTime: {
|
|
5385
5386
|
type: Boolean,
|
|
@@ -5443,9 +5444,9 @@ const Confirm = /* @__PURE__ */ vue.defineComponent({
|
|
|
5443
5444
|
|
|
5444
5445
|
/** @jsxImportSource vue */
|
|
5445
5446
|
|
|
5446
|
-
const COMPONENT_NAME$
|
|
5447
|
+
const COMPONENT_NAME$1m = 'vc-date-header';
|
|
5447
5448
|
const DateHeader = /* @__PURE__ */ vue.defineComponent({
|
|
5448
|
-
name: COMPONENT_NAME$
|
|
5449
|
+
name: COMPONENT_NAME$1m,
|
|
5449
5450
|
props: {
|
|
5450
5451
|
panelDate: Date,
|
|
5451
5452
|
showNext: {
|
|
@@ -5529,9 +5530,9 @@ const DateHeader = /* @__PURE__ */ vue.defineComponent({
|
|
|
5529
5530
|
|
|
5530
5531
|
/** @jsxImportSource vue */
|
|
5531
5532
|
|
|
5532
|
-
const COMPONENT_NAME$
|
|
5533
|
+
const COMPONENT_NAME$1l = 'vc-date-table';
|
|
5533
5534
|
const DateTable = /* @__PURE__ */ vue.defineComponent({
|
|
5534
|
-
name: COMPONENT_NAME$
|
|
5535
|
+
name: COMPONENT_NAME$1l,
|
|
5535
5536
|
props: {
|
|
5536
5537
|
value: Array,
|
|
5537
5538
|
firstDayOfWeek: {
|
|
@@ -5740,9 +5741,9 @@ const DateTable = /* @__PURE__ */ vue.defineComponent({
|
|
|
5740
5741
|
|
|
5741
5742
|
/** @jsxImportSource vue */
|
|
5742
5743
|
|
|
5743
|
-
const COMPONENT_NAME$
|
|
5744
|
+
const COMPONENT_NAME$1k = 'vc-month-table';
|
|
5744
5745
|
const MonthTable = /* @__PURE__ */ vue.defineComponent({
|
|
5745
|
-
name: COMPONENT_NAME$
|
|
5746
|
+
name: COMPONENT_NAME$1k,
|
|
5746
5747
|
props: {
|
|
5747
5748
|
value: Array,
|
|
5748
5749
|
panelDate: Date,
|
|
@@ -5874,7 +5875,7 @@ const MonthTable = /* @__PURE__ */ vue.defineComponent({
|
|
|
5874
5875
|
|
|
5875
5876
|
/** @jsxImportSource vue */
|
|
5876
5877
|
|
|
5877
|
-
const COMPONENT_NAME$
|
|
5878
|
+
const COMPONENT_NAME$1j = 'vc-quarter-table';
|
|
5878
5879
|
|
|
5879
5880
|
/**
|
|
5880
5881
|
* 获取季度对应的月份范围
|
|
@@ -5908,7 +5909,7 @@ const getQuarterRangeByMonth = value => {
|
|
|
5908
5909
|
}
|
|
5909
5910
|
};
|
|
5910
5911
|
const QuarterTable = /* @__PURE__ */ vue.defineComponent({
|
|
5911
|
-
name: COMPONENT_NAME$
|
|
5912
|
+
name: COMPONENT_NAME$1j,
|
|
5912
5913
|
props: {
|
|
5913
5914
|
value: Array,
|
|
5914
5915
|
panelDate: Date,
|
|
@@ -6031,9 +6032,9 @@ const QuarterTable = /* @__PURE__ */ vue.defineComponent({
|
|
|
6031
6032
|
|
|
6032
6033
|
/** @jsxImportSource vue */
|
|
6033
6034
|
|
|
6034
|
-
const COMPONENT_NAME$
|
|
6035
|
+
const COMPONENT_NAME$1i = 'vc-shortcuts-select';
|
|
6035
6036
|
const ShortcutsSelect = /* @__PURE__ */ vue.defineComponent({
|
|
6036
|
-
name: COMPONENT_NAME$
|
|
6037
|
+
name: COMPONENT_NAME$1i,
|
|
6037
6038
|
props: {
|
|
6038
6039
|
panelDate: Date,
|
|
6039
6040
|
config: Array,
|
|
@@ -6073,9 +6074,9 @@ const ShortcutsSelect = /* @__PURE__ */ vue.defineComponent({
|
|
|
6073
6074
|
|
|
6074
6075
|
/** @jsxImportSource vue */
|
|
6075
6076
|
|
|
6076
|
-
const COMPONENT_NAME$
|
|
6077
|
+
const COMPONENT_NAME$1h = 'vc-time-select';
|
|
6077
6078
|
const TimeSelect = /* @__PURE__ */ vue.defineComponent({
|
|
6078
|
-
name: COMPONENT_NAME$
|
|
6079
|
+
name: COMPONENT_NAME$1h,
|
|
6079
6080
|
props: {
|
|
6080
6081
|
hours: {
|
|
6081
6082
|
type: [Number, String],
|
|
@@ -6354,9 +6355,9 @@ const TimeSelect = /* @__PURE__ */ vue.defineComponent({
|
|
|
6354
6355
|
|
|
6355
6356
|
/** @jsxImportSource vue */
|
|
6356
6357
|
|
|
6357
|
-
const COMPONENT_NAME$
|
|
6358
|
+
const COMPONENT_NAME$1g = 'vc-year-table';
|
|
6358
6359
|
const YearTable = /* @__PURE__ */ vue.defineComponent({
|
|
6359
|
-
name: COMPONENT_NAME$
|
|
6360
|
+
name: COMPONENT_NAME$1g,
|
|
6360
6361
|
props: {
|
|
6361
6362
|
value: Array,
|
|
6362
6363
|
panelDate: Date,
|
|
@@ -6479,9 +6480,9 @@ const getDateIsInRange = (value, type, leftPanelDate, rightPanelDate) => {
|
|
|
6479
6480
|
}
|
|
6480
6481
|
return true;
|
|
6481
6482
|
};
|
|
6482
|
-
const COMPONENT_NAME$
|
|
6483
|
+
const COMPONENT_NAME$1f = 'vc-date-range-panel';
|
|
6483
6484
|
const DateRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
6484
|
-
name: COMPONENT_NAME$
|
|
6485
|
+
name: COMPONENT_NAME$1f,
|
|
6485
6486
|
props: {
|
|
6486
6487
|
...props$V,
|
|
6487
6488
|
confirm: {
|
|
@@ -6860,9 +6861,9 @@ const DateRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
|
6860
6861
|
|
|
6861
6862
|
/** @jsxImportSource vue */
|
|
6862
6863
|
|
|
6863
|
-
const COMPONENT_NAME$
|
|
6864
|
+
const COMPONENT_NAME$1e = 'vc-date-panel';
|
|
6864
6865
|
const DatePanel = /* @__PURE__ */ vue.defineComponent({
|
|
6865
|
-
name: COMPONENT_NAME$
|
|
6866
|
+
name: COMPONENT_NAME$1e,
|
|
6866
6867
|
props: {
|
|
6867
6868
|
...props$V,
|
|
6868
6869
|
type: String,
|
|
@@ -7070,9 +7071,9 @@ const isEqualYear$1 = value => {
|
|
|
7070
7071
|
const endYear = value[1].getFullYear();
|
|
7071
7072
|
return startYear === endYear;
|
|
7072
7073
|
};
|
|
7073
|
-
const COMPONENT_NAME$
|
|
7074
|
+
const COMPONENT_NAME$1d = 'vc-monthrange-panel';
|
|
7074
7075
|
const MonthRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
7075
|
-
name: COMPONENT_NAME$
|
|
7076
|
+
name: COMPONENT_NAME$1d,
|
|
7076
7077
|
props: {
|
|
7077
7078
|
...props$V,
|
|
7078
7079
|
confirm: {
|
|
@@ -7247,9 +7248,9 @@ const isEqualYear = value => {
|
|
|
7247
7248
|
const endYear = value[1].getFullYear();
|
|
7248
7249
|
return startYear === endYear;
|
|
7249
7250
|
};
|
|
7250
|
-
const COMPONENT_NAME$
|
|
7251
|
+
const COMPONENT_NAME$1c = 'vc-quarterrange-panel';
|
|
7251
7252
|
const QuarterRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
7252
|
-
name: COMPONENT_NAME$
|
|
7253
|
+
name: COMPONENT_NAME$1c,
|
|
7253
7254
|
props: {
|
|
7254
7255
|
...props$V,
|
|
7255
7256
|
confirm: {
|
|
@@ -7488,9 +7489,9 @@ const getComparedDate = (leftDate, rightDate) => {
|
|
|
7488
7489
|
seconds
|
|
7489
7490
|
};
|
|
7490
7491
|
};
|
|
7491
|
-
const COMPONENT_NAME$
|
|
7492
|
+
const COMPONENT_NAME$1b = 'vc-timerange-panel';
|
|
7492
7493
|
const TimeRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
7493
|
-
name: COMPONENT_NAME$
|
|
7494
|
+
name: COMPONENT_NAME$1b,
|
|
7494
7495
|
props: props$U,
|
|
7495
7496
|
emits: ['pick', 'clear', 'ok'],
|
|
7496
7497
|
setup(props, {
|
|
@@ -7589,9 +7590,9 @@ const TimeRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
|
7589
7590
|
|
|
7590
7591
|
/** @jsxImportSource vue */
|
|
7591
7592
|
|
|
7592
|
-
const COMPONENT_NAME$
|
|
7593
|
+
const COMPONENT_NAME$1a = 'vc-time-panel';
|
|
7593
7594
|
const TimePanel = /* @__PURE__ */ vue.defineComponent({
|
|
7594
|
-
name: COMPONENT_NAME$
|
|
7595
|
+
name: COMPONENT_NAME$1a,
|
|
7595
7596
|
props: props$U,
|
|
7596
7597
|
emits: ['pick', 'clear', 'ok'],
|
|
7597
7598
|
setup(props, {
|
|
@@ -7646,6 +7647,7 @@ const TimePanel = /* @__PURE__ */ vue.defineComponent({
|
|
|
7646
7647
|
|
|
7647
7648
|
/** @jsxImportSource vue */
|
|
7648
7649
|
|
|
7650
|
+
const COMPONENT_NAME$19 = 'vc-date-picker';
|
|
7649
7651
|
const getPanel$1 = type => {
|
|
7650
7652
|
if (['daterange', 'datetimerange'].includes(type)) {
|
|
7651
7653
|
return DateRangePanel;
|
|
@@ -7656,7 +7658,7 @@ const getPanel$1 = type => {
|
|
|
7656
7658
|
}
|
|
7657
7659
|
return DatePanel;
|
|
7658
7660
|
};
|
|
7659
|
-
const DatePicker = createPicker(props$10, () => {
|
|
7661
|
+
const DatePicker = createPicker(COMPONENT_NAME$19, props$10, () => {
|
|
7660
7662
|
const props = vue.getCurrentInstance().props;
|
|
7661
7663
|
const icon = vue.ref('date');
|
|
7662
7664
|
const panel = vue.shallowRef({});
|
|
@@ -7689,9 +7691,9 @@ const props$T = {
|
|
|
7689
7691
|
|
|
7690
7692
|
/** @jsxImportSource vue */
|
|
7691
7693
|
|
|
7692
|
-
const COMPONENT_NAME$
|
|
7694
|
+
const COMPONENT_NAME$18 = 'vc-divider';
|
|
7693
7695
|
const Divider = /* @__PURE__ */ vue.defineComponent({
|
|
7694
|
-
name: COMPONENT_NAME$
|
|
7696
|
+
name: COMPONENT_NAME$18,
|
|
7695
7697
|
props: props$T,
|
|
7696
7698
|
setup(props, {
|
|
7697
7699
|
slots
|
|
@@ -7846,7 +7848,7 @@ const props$Q = {
|
|
|
7846
7848
|
|
|
7847
7849
|
/** @jsxImportSource vue */
|
|
7848
7850
|
|
|
7849
|
-
const COMPONENT_NAME$
|
|
7851
|
+
const COMPONENT_NAME$17 = 'vc-scroller-track';
|
|
7850
7852
|
const BAR_MAP = {
|
|
7851
7853
|
vertical: {
|
|
7852
7854
|
scroll: 'scrollTop',
|
|
@@ -7866,12 +7868,14 @@ const BAR_MAP = {
|
|
|
7866
7868
|
}
|
|
7867
7869
|
};
|
|
7868
7870
|
const Track = /* @__PURE__ */ vue.defineComponent({
|
|
7869
|
-
name: COMPONENT_NAME$
|
|
7871
|
+
name: COMPONENT_NAME$17,
|
|
7870
7872
|
props: props$S,
|
|
7871
7873
|
emits: ['change'],
|
|
7874
|
+
inheritAttrs: false,
|
|
7872
7875
|
setup(props, {
|
|
7873
7876
|
emit,
|
|
7874
|
-
expose
|
|
7877
|
+
expose,
|
|
7878
|
+
attrs
|
|
7875
7879
|
}) {
|
|
7876
7880
|
const instance = vue.getCurrentInstance();
|
|
7877
7881
|
const track = vue.ref();
|
|
@@ -8038,6 +8042,7 @@ const Track = /* @__PURE__ */ vue.defineComponent({
|
|
|
8038
8042
|
default: () => [vue.withDirectives(vue.createVNode("div", {
|
|
8039
8043
|
"ref": track,
|
|
8040
8044
|
"class": ['is-' + barOptions.value.key, 'vc-scroller-track'],
|
|
8045
|
+
"style": attrs.style,
|
|
8041
8046
|
"onMousedown": handleClickTrack
|
|
8042
8047
|
}, [vue.createVNode("div", {
|
|
8043
8048
|
"ref": thumb,
|
|
@@ -8052,9 +8057,9 @@ const Track = /* @__PURE__ */ vue.defineComponent({
|
|
|
8052
8057
|
|
|
8053
8058
|
/** @jsxImportSource vue */
|
|
8054
8059
|
|
|
8055
|
-
const COMPONENT_NAME$
|
|
8060
|
+
const COMPONENT_NAME$16 = 'vc-scroller-bar';
|
|
8056
8061
|
const Bar = /* @__PURE__ */ vue.defineComponent({
|
|
8057
|
-
name: COMPONENT_NAME$
|
|
8062
|
+
name: COMPONENT_NAME$16,
|
|
8058
8063
|
props: props$R,
|
|
8059
8064
|
emits: ['change'],
|
|
8060
8065
|
setup(props, {
|
|
@@ -8269,7 +8274,7 @@ const useScroller = (expose) => {
|
|
|
8269
8274
|
|
|
8270
8275
|
/** @jsxImportSource vue */
|
|
8271
8276
|
|
|
8272
|
-
const COMPONENT_NAME$
|
|
8277
|
+
const COMPONENT_NAME$15 = 'vc-scroller';
|
|
8273
8278
|
|
|
8274
8279
|
/**
|
|
8275
8280
|
* 作为备选方案,目前推荐使用ScrollerWheel
|
|
@@ -8280,7 +8285,7 @@ const COMPONENT_NAME$13 = 'vc-scroller';
|
|
|
8280
8285
|
* 2. 增加了一层嵌套
|
|
8281
8286
|
*/
|
|
8282
8287
|
const Scroller = /* @__PURE__ */ vue.defineComponent({
|
|
8283
|
-
name: COMPONENT_NAME$
|
|
8288
|
+
name: COMPONENT_NAME$15,
|
|
8284
8289
|
props: props$Q,
|
|
8285
8290
|
emits: ['scroll'],
|
|
8286
8291
|
setup(props, {
|
|
@@ -8341,7 +8346,7 @@ const Scroller = /* @__PURE__ */ vue.defineComponent({
|
|
|
8341
8346
|
|
|
8342
8347
|
/** @jsxImportSource vue */
|
|
8343
8348
|
|
|
8344
|
-
const COMPONENT_NAME$
|
|
8349
|
+
const COMPONENT_NAME$14 = 'vc-scroller-wheel';
|
|
8345
8350
|
|
|
8346
8351
|
/**
|
|
8347
8352
|
* 为减少一层嵌套,为去除滚动bar的抖动,使用wheel模拟
|
|
@@ -8363,8 +8368,13 @@ const COMPONENT_NAME$12 = 'vc-scroller-wheel';
|
|
|
8363
8368
|
* 设置scrollTop不会reflow和repaint,不需要考虑transfrom来改变content(transform也只在draw完成)
|
|
8364
8369
|
*/
|
|
8365
8370
|
const ScrollerWheel = /* @__PURE__ */ vue.defineComponent({
|
|
8366
|
-
name: COMPONENT_NAME$
|
|
8367
|
-
props: props$Q,
|
|
8371
|
+
name: COMPONENT_NAME$14,
|
|
8372
|
+
props: Object.assign(props$Q, {
|
|
8373
|
+
stopPropagation: {
|
|
8374
|
+
type: Boolean,
|
|
8375
|
+
default: true
|
|
8376
|
+
}
|
|
8377
|
+
}),
|
|
8368
8378
|
emits: ['scroll'],
|
|
8369
8379
|
setup(props, {
|
|
8370
8380
|
slots,
|
|
@@ -8424,7 +8434,10 @@ const ScrollerWheel = /* @__PURE__ */ vue.defineComponent({
|
|
|
8424
8434
|
vue.onMounted(() => {
|
|
8425
8435
|
wheel = new helperWheel.Wheel(wrapper.value, {
|
|
8426
8436
|
shouldWheelX,
|
|
8427
|
-
shouldWheelY
|
|
8437
|
+
shouldWheelY,
|
|
8438
|
+
stopPropagation: () => {
|
|
8439
|
+
return props.stopPropagation;
|
|
8440
|
+
}
|
|
8428
8441
|
});
|
|
8429
8442
|
wheel.on(handleWheel);
|
|
8430
8443
|
});
|
|
@@ -8534,9 +8547,9 @@ const props$P = {
|
|
|
8534
8547
|
|
|
8535
8548
|
/** @jsxImportSource vue */
|
|
8536
8549
|
|
|
8537
|
-
const COMPONENT_NAME$
|
|
8550
|
+
const COMPONENT_NAME$13 = 'vc-drawer';
|
|
8538
8551
|
const DrawerView = /* @__PURE__ */ vue.defineComponent({
|
|
8539
|
-
name: COMPONENT_NAME$
|
|
8552
|
+
name: COMPONENT_NAME$13,
|
|
8540
8553
|
props: props$P,
|
|
8541
8554
|
emits: ['close', 'update:modelValue', 'visible-change'],
|
|
8542
8555
|
setup(props, {
|
|
@@ -8709,9 +8722,9 @@ const props$O = {
|
|
|
8709
8722
|
|
|
8710
8723
|
/** @jsxImportSource vue */
|
|
8711
8724
|
|
|
8712
|
-
const COMPONENT_NAME$
|
|
8725
|
+
const COMPONENT_NAME$12 = 'vc-dropdown';
|
|
8713
8726
|
const Dropdown = /* @__PURE__ */ vue.defineComponent({
|
|
8714
|
-
name: COMPONENT_NAME$
|
|
8727
|
+
name: COMPONENT_NAME$12,
|
|
8715
8728
|
props: props$O,
|
|
8716
8729
|
setup(props, {
|
|
8717
8730
|
slots
|
|
@@ -8735,9 +8748,9 @@ const props$N = {
|
|
|
8735
8748
|
|
|
8736
8749
|
/** @jsxImportSource vue */
|
|
8737
8750
|
|
|
8738
|
-
const COMPONENT_NAME
|
|
8751
|
+
const COMPONENT_NAME$11 = 'vc-editor';
|
|
8739
8752
|
const Editor = /* @__PURE__ */ vue.defineComponent({
|
|
8740
|
-
name: COMPONENT_NAME
|
|
8753
|
+
name: COMPONENT_NAME$11,
|
|
8741
8754
|
props: props$N,
|
|
8742
8755
|
setup(props, {
|
|
8743
8756
|
slots
|
|
@@ -8752,7 +8765,7 @@ const Editor = /* @__PURE__ */ vue.defineComponent({
|
|
|
8752
8765
|
|
|
8753
8766
|
const MEditor = Editor;
|
|
8754
8767
|
|
|
8755
|
-
const MExpand = Expand;
|
|
8768
|
+
const MExpand = Expand$1;
|
|
8756
8769
|
|
|
8757
8770
|
const props$M = {
|
|
8758
8771
|
tag: {
|
|
@@ -8881,9 +8894,9 @@ const useForm = (expose, options = {}) => {
|
|
|
8881
8894
|
});
|
|
8882
8895
|
};
|
|
8883
8896
|
|
|
8884
|
-
const COMPONENT_NAME$
|
|
8897
|
+
const COMPONENT_NAME$10 = "vc-form";
|
|
8885
8898
|
const Form = vue.defineComponent({
|
|
8886
|
-
name: COMPONENT_NAME$
|
|
8899
|
+
name: COMPONENT_NAME$10,
|
|
8887
8900
|
props: props$M,
|
|
8888
8901
|
setup(props, { slots, expose }) {
|
|
8889
8902
|
useForm(expose);
|
|
@@ -9203,9 +9216,9 @@ const useFormItem = (expose) => {
|
|
|
9203
9216
|
|
|
9204
9217
|
/** @jsxImportSource vue */
|
|
9205
9218
|
|
|
9206
|
-
const COMPONENT_NAME
|
|
9219
|
+
const COMPONENT_NAME$$ = 'vc-form-item';
|
|
9207
9220
|
const FormItem = /* @__PURE__ */ vue.defineComponent({
|
|
9208
|
-
name: COMPONENT_NAME
|
|
9221
|
+
name: COMPONENT_NAME$$,
|
|
9209
9222
|
props: props$L,
|
|
9210
9223
|
setup(props, {
|
|
9211
9224
|
slots,
|
|
@@ -9270,9 +9283,9 @@ const props$K = {
|
|
|
9270
9283
|
}
|
|
9271
9284
|
};
|
|
9272
9285
|
|
|
9273
|
-
const COMPONENT_NAME$
|
|
9286
|
+
const COMPONENT_NAME$_ = "vcm-form";
|
|
9274
9287
|
const MForm = vue.defineComponent({
|
|
9275
|
-
name: COMPONENT_NAME$
|
|
9288
|
+
name: COMPONENT_NAME$_,
|
|
9276
9289
|
props: props$K,
|
|
9277
9290
|
setup(props, { slots, expose }) {
|
|
9278
9291
|
useForm(expose, {
|
|
@@ -9303,9 +9316,9 @@ const props$J = {
|
|
|
9303
9316
|
|
|
9304
9317
|
/** @jsxImportSource vue */
|
|
9305
9318
|
|
|
9306
|
-
const COMPONENT_NAME$
|
|
9319
|
+
const COMPONENT_NAME$Z = 'vcm-form-item';
|
|
9307
9320
|
const MFormItem = /* @__PURE__ */ vue.defineComponent({
|
|
9308
|
-
name: COMPONENT_NAME$
|
|
9321
|
+
name: COMPONENT_NAME$Z,
|
|
9309
9322
|
props: props$J,
|
|
9310
9323
|
setup(props, {
|
|
9311
9324
|
slots,
|
|
@@ -9359,9 +9372,9 @@ const MFormItem = /* @__PURE__ */ vue.defineComponent({
|
|
|
9359
9372
|
}
|
|
9360
9373
|
});
|
|
9361
9374
|
|
|
9362
|
-
const COMPONENT_NAME$
|
|
9375
|
+
const COMPONENT_NAME$Y = "vc-fragment";
|
|
9363
9376
|
const Fragment = vue.defineComponent({
|
|
9364
|
-
name: COMPONENT_NAME$
|
|
9377
|
+
name: COMPONENT_NAME$Y,
|
|
9365
9378
|
setup(_, { slots }) {
|
|
9366
9379
|
return () => vue.h(vue.Fragment, slots.default?.());
|
|
9367
9380
|
}
|
|
@@ -9378,9 +9391,9 @@ const props$I = {
|
|
|
9378
9391
|
|
|
9379
9392
|
/** @jsxImportSource vue */
|
|
9380
9393
|
|
|
9381
|
-
const COMPONENT_NAME$
|
|
9394
|
+
const COMPONENT_NAME$X = 'vc-html-to-image';
|
|
9382
9395
|
const HTMLToImage = /* @__PURE__ */ vue.defineComponent({
|
|
9383
|
-
name: COMPONENT_NAME$
|
|
9396
|
+
name: COMPONENT_NAME$X,
|
|
9384
9397
|
props: props$I,
|
|
9385
9398
|
setup(props, {
|
|
9386
9399
|
slots
|
|
@@ -9456,7 +9469,7 @@ const IMGStore$1 = new IMGStore();
|
|
|
9456
9469
|
|
|
9457
9470
|
/** @jsxImportSource vue */
|
|
9458
9471
|
|
|
9459
|
-
const COMPONENT_NAME$
|
|
9472
|
+
const COMPONENT_NAME$W = 'vc-image';
|
|
9460
9473
|
let isSupportObjectFit = false;
|
|
9461
9474
|
window.addEventListener('DOMContentLoaded', () => {
|
|
9462
9475
|
isSupportObjectFit = !vcShared.IS_SERVER && document.documentElement.style.objectFit !== undefined;
|
|
@@ -9469,7 +9482,7 @@ const ObjectFit = {
|
|
|
9469
9482
|
SCALE_DOWN: 'scale-down'
|
|
9470
9483
|
};
|
|
9471
9484
|
const Image = /* @__PURE__ */ vue.defineComponent({
|
|
9472
|
-
name: COMPONENT_NAME$
|
|
9485
|
+
name: COMPONENT_NAME$W,
|
|
9473
9486
|
inheritAttrs: false,
|
|
9474
9487
|
props: props$H,
|
|
9475
9488
|
setup(props, {
|
|
@@ -9674,9 +9687,9 @@ const props$G = {
|
|
|
9674
9687
|
|
|
9675
9688
|
/** @jsxImportSource vue */
|
|
9676
9689
|
|
|
9677
|
-
const COMPONENT_NAME$
|
|
9690
|
+
const COMPONENT_NAME$V = 'vc-image-crop';
|
|
9678
9691
|
const ImageCrop = /* @__PURE__ */ vue.defineComponent({
|
|
9679
|
-
name: COMPONENT_NAME$
|
|
9692
|
+
name: COMPONENT_NAME$V,
|
|
9680
9693
|
props: props$G,
|
|
9681
9694
|
setup(props, {
|
|
9682
9695
|
slots
|
|
@@ -9700,9 +9713,9 @@ const props$F = {
|
|
|
9700
9713
|
|
|
9701
9714
|
/** @jsxImportSource vue */
|
|
9702
9715
|
|
|
9703
|
-
const COMPONENT_NAME$
|
|
9716
|
+
const COMPONENT_NAME$U = 'vc-image-preview';
|
|
9704
9717
|
const ImagePreview = /* @__PURE__ */ vue.defineComponent({
|
|
9705
|
-
name: COMPONENT_NAME$
|
|
9718
|
+
name: COMPONENT_NAME$U,
|
|
9706
9719
|
props: props$F,
|
|
9707
9720
|
setup(props, {
|
|
9708
9721
|
slots
|
|
@@ -9726,9 +9739,9 @@ const props$E = {
|
|
|
9726
9739
|
|
|
9727
9740
|
/** @jsxImportSource vue */
|
|
9728
9741
|
|
|
9729
|
-
const COMPONENT_NAME$
|
|
9742
|
+
const COMPONENT_NAME$T = 'vc-image-processing';
|
|
9730
9743
|
const ImageProcessing = /* @__PURE__ */ vue.defineComponent({
|
|
9731
|
-
name: COMPONENT_NAME$
|
|
9744
|
+
name: COMPONENT_NAME$T,
|
|
9732
9745
|
props: props$E,
|
|
9733
9746
|
setup(props, {
|
|
9734
9747
|
slots
|
|
@@ -9745,9 +9758,9 @@ const MImageProcessing = ImageProcessing;
|
|
|
9745
9758
|
|
|
9746
9759
|
/** @jsxImportSource vue */
|
|
9747
9760
|
|
|
9748
|
-
const COMPONENT_NAME$
|
|
9761
|
+
const COMPONENT_NAME$S = 'vcm-input';
|
|
9749
9762
|
const MInput = /* @__PURE__ */ vue.defineComponent({
|
|
9750
|
-
name: COMPONENT_NAME$
|
|
9763
|
+
name: COMPONENT_NAME$S,
|
|
9751
9764
|
inheritAttrs: false,
|
|
9752
9765
|
props: {
|
|
9753
9766
|
...props$$,
|
|
@@ -9836,9 +9849,9 @@ const MInput = /* @__PURE__ */ vue.defineComponent({
|
|
|
9836
9849
|
|
|
9837
9850
|
/** @jsxImportSource vue */
|
|
9838
9851
|
|
|
9839
|
-
const COMPONENT_NAME$
|
|
9852
|
+
const COMPONENT_NAME$R = 'vcm-input-number';
|
|
9840
9853
|
const MInputNumber = /* @__PURE__ */ vue.defineComponent({
|
|
9841
|
-
name: COMPONENT_NAME$
|
|
9854
|
+
name: COMPONENT_NAME$R,
|
|
9842
9855
|
props: props$X,
|
|
9843
9856
|
inheritAttrs: false,
|
|
9844
9857
|
setup(props, {
|
|
@@ -9887,9 +9900,9 @@ const MInputNumber = /* @__PURE__ */ vue.defineComponent({
|
|
|
9887
9900
|
|
|
9888
9901
|
/** @jsxImportSource vue */
|
|
9889
9902
|
|
|
9890
|
-
const COMPONENT_NAME$
|
|
9903
|
+
const COMPONENT_NAME$Q = 'vcm-input-search';
|
|
9891
9904
|
const MInputSearch = /* @__PURE__ */ vue.defineComponent({
|
|
9892
|
-
name: COMPONENT_NAME$
|
|
9905
|
+
name: COMPONENT_NAME$Q,
|
|
9893
9906
|
props: {
|
|
9894
9907
|
...props$W,
|
|
9895
9908
|
cancelText: {
|
|
@@ -9966,9 +9979,9 @@ const props$D = {
|
|
|
9966
9979
|
}
|
|
9967
9980
|
};
|
|
9968
9981
|
|
|
9969
|
-
const COMPONENT_NAME$
|
|
9982
|
+
const COMPONENT_NAME$P = "vcm-list";
|
|
9970
9983
|
const MList = vue.defineComponent({
|
|
9971
|
-
name: COMPONENT_NAME$
|
|
9984
|
+
name: COMPONENT_NAME$P,
|
|
9972
9985
|
props: props$D,
|
|
9973
9986
|
setup(props, { slots }) {
|
|
9974
9987
|
vue.provide("vc-list", { props });
|
|
@@ -10023,10 +10036,10 @@ const props$C = {
|
|
|
10023
10036
|
|
|
10024
10037
|
/** @jsxImportSource vue */
|
|
10025
10038
|
|
|
10026
|
-
const COMPONENT_NAME$
|
|
10039
|
+
const COMPONENT_NAME$O = 'vcm-list-item';
|
|
10027
10040
|
const HTTP_REGEX = /[a-zA-z]+:\/\/[^\s]*/;
|
|
10028
10041
|
const MListItem = /* @__PURE__ */ vue.defineComponent({
|
|
10029
|
-
name: COMPONENT_NAME$
|
|
10042
|
+
name: COMPONENT_NAME$O,
|
|
10030
10043
|
props: props$C,
|
|
10031
10044
|
emits: ['click'],
|
|
10032
10045
|
setup(props, {
|
|
@@ -10120,11 +10133,11 @@ const props$B = {
|
|
|
10120
10133
|
|
|
10121
10134
|
/** @jsxImportSource vue */
|
|
10122
10135
|
|
|
10123
|
-
const COMPONENT_NAME$
|
|
10136
|
+
const COMPONENT_NAME$N = 'vc-marquee';
|
|
10124
10137
|
const ANIMATION = $.prefixStyle('animation').camel;
|
|
10125
10138
|
const TRANSFORM_KEBAB = $.prefixStyle('transform').kebab;
|
|
10126
10139
|
const Marquee = /* @__PURE__ */ vue.defineComponent({
|
|
10127
|
-
name: COMPONENT_NAME$
|
|
10140
|
+
name: COMPONENT_NAME$N,
|
|
10128
10141
|
props: props$B,
|
|
10129
10142
|
setup(props, {
|
|
10130
10143
|
slots
|
|
@@ -10188,9 +10201,9 @@ const props$A = {
|
|
|
10188
10201
|
}
|
|
10189
10202
|
};
|
|
10190
10203
|
|
|
10191
|
-
const COMPONENT_NAME$
|
|
10204
|
+
const COMPONENT_NAME$M = "vc-resizer";
|
|
10192
10205
|
const Resizer = vue.defineComponent({
|
|
10193
|
-
name: COMPONENT_NAME$
|
|
10206
|
+
name: COMPONENT_NAME$M,
|
|
10194
10207
|
props: props$A,
|
|
10195
10208
|
emit: ["resize", "change"],
|
|
10196
10209
|
setup(props, { emit, slots, expose }) {
|
|
@@ -10333,10 +10346,10 @@ const props$z = {
|
|
|
10333
10346
|
|
|
10334
10347
|
/** @jsxImportSource vue */
|
|
10335
10348
|
|
|
10336
|
-
const COMPONENT_NAME$
|
|
10349
|
+
const COMPONENT_NAME$L = 'vc-modal';
|
|
10337
10350
|
let zIndexNumber = 1002;
|
|
10338
10351
|
const ModalView = /* @__PURE__ */ vue.defineComponent({
|
|
10339
|
-
name: COMPONENT_NAME$
|
|
10352
|
+
name: COMPONENT_NAME$L,
|
|
10340
10353
|
emits: ['update:modelValue', 'close', 'portal-fulfilled', 'visible-change', 'ok', 'cancel'],
|
|
10341
10354
|
props: props$z,
|
|
10342
10355
|
setup(props, {
|
|
@@ -10762,9 +10775,9 @@ const props$y = {
|
|
|
10762
10775
|
|
|
10763
10776
|
/** @jsxImportSource vue */
|
|
10764
10777
|
|
|
10765
|
-
const COMPONENT_NAME$
|
|
10778
|
+
const COMPONENT_NAME$K = 'vc-modal';
|
|
10766
10779
|
const MModalView = /* @__PURE__ */ vue.defineComponent({
|
|
10767
|
-
name: COMPONENT_NAME$
|
|
10780
|
+
name: COMPONENT_NAME$K,
|
|
10768
10781
|
emits: ['update:modelValue', 'portal-fulfilled', 'close', 'ok', 'cancel'],
|
|
10769
10782
|
props: props$y,
|
|
10770
10783
|
setup(props, {
|
|
@@ -10976,9 +10989,9 @@ const props$x = {
|
|
|
10976
10989
|
|
|
10977
10990
|
/** @jsxImportSource vue */
|
|
10978
10991
|
|
|
10979
|
-
const COMPONENT_NAME$
|
|
10992
|
+
const COMPONENT_NAME$J = 'vc-notice';
|
|
10980
10993
|
const NoticeView = /* @__PURE__ */ vue.defineComponent({
|
|
10981
|
-
name: COMPONENT_NAME$
|
|
10994
|
+
name: COMPONENT_NAME$J,
|
|
10982
10995
|
props: props$x,
|
|
10983
10996
|
emits: ['portal-fulfilled', 'close', 'before-close'],
|
|
10984
10997
|
setup(props, {
|
|
@@ -11151,9 +11164,9 @@ const props$w = {
|
|
|
11151
11164
|
|
|
11152
11165
|
/** @jsxImportSource vue */
|
|
11153
11166
|
|
|
11154
|
-
const COMPONENT_NAME$
|
|
11167
|
+
const COMPONENT_NAME$I = 'vc-option';
|
|
11155
11168
|
const Option$1 = /* @__PURE__ */ vue.defineComponent({
|
|
11156
|
-
name: COMPONENT_NAME$
|
|
11169
|
+
name: COMPONENT_NAME$I,
|
|
11157
11170
|
props: props$w,
|
|
11158
11171
|
setup(props, {
|
|
11159
11172
|
slots
|
|
@@ -11220,12 +11233,12 @@ const getLabel = (data, v) => {
|
|
|
11220
11233
|
const { label = "" } = data.find((i) => i.value == v) || {};
|
|
11221
11234
|
return label;
|
|
11222
11235
|
};
|
|
11223
|
-
const flattenData = (data, options = {}) => {
|
|
11236
|
+
const flattenData$1 = (data, options = {}) => {
|
|
11224
11237
|
let result = [];
|
|
11225
11238
|
data.forEach((item) => {
|
|
11226
11239
|
if (item.children) {
|
|
11227
11240
|
const { children, ...rest } = item;
|
|
11228
|
-
const items = flattenData(children, options);
|
|
11241
|
+
const items = flattenData$1(children, options);
|
|
11229
11242
|
result = result.concat(
|
|
11230
11243
|
options.parent ? [options.cascader ? item : rest].concat(items) : items
|
|
11231
11244
|
);
|
|
@@ -11266,9 +11279,9 @@ const props$u = {
|
|
|
11266
11279
|
|
|
11267
11280
|
/** @jsxImportSource vue */
|
|
11268
11281
|
|
|
11269
|
-
const COMPONENT_NAME$
|
|
11282
|
+
const COMPONENT_NAME$H = 'vc-tag';
|
|
11270
11283
|
const Tag = /* @__PURE__ */ vue.defineComponent({
|
|
11271
|
-
name: COMPONENT_NAME$
|
|
11284
|
+
name: COMPONENT_NAME$H,
|
|
11272
11285
|
props: props$u,
|
|
11273
11286
|
emits: ['close', 'change'],
|
|
11274
11287
|
setup(props, {
|
|
@@ -11337,9 +11350,9 @@ const props$t = {
|
|
|
11337
11350
|
|
|
11338
11351
|
/** @jsxImportSource vue */
|
|
11339
11352
|
|
|
11340
|
-
const COMPONENT_NAME$
|
|
11353
|
+
const COMPONENT_NAME$G = 'vc-select-option';
|
|
11341
11354
|
const Option = /* @__PURE__ */ vue.defineComponent({
|
|
11342
|
-
name: COMPONENT_NAME$
|
|
11355
|
+
name: COMPONENT_NAME$G,
|
|
11343
11356
|
props: props$t,
|
|
11344
11357
|
setup(props, {
|
|
11345
11358
|
slots
|
|
@@ -11412,9 +11425,9 @@ const props$s = {
|
|
|
11412
11425
|
|
|
11413
11426
|
/** @jsxImportSource vue */
|
|
11414
11427
|
|
|
11415
|
-
const COMPONENT_NAME$
|
|
11428
|
+
const COMPONENT_NAME$F = 'vc-select-option-group';
|
|
11416
11429
|
const OptionGroup = /* @__PURE__ */ vue.defineComponent({
|
|
11417
|
-
name: COMPONENT_NAME$
|
|
11430
|
+
name: COMPONENT_NAME$F,
|
|
11418
11431
|
props: props$s,
|
|
11419
11432
|
setup(props, {
|
|
11420
11433
|
slots
|
|
@@ -11512,9 +11525,9 @@ const props$r = {
|
|
|
11512
11525
|
function _isSlot$1(s) {
|
|
11513
11526
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
11514
11527
|
}
|
|
11515
|
-
const COMPONENT_NAME$
|
|
11528
|
+
const COMPONENT_NAME$E = 'vc-select';
|
|
11516
11529
|
const Select = /* @__PURE__ */ vue.defineComponent({
|
|
11517
|
-
name: COMPONENT_NAME$
|
|
11530
|
+
name: COMPONENT_NAME$E,
|
|
11518
11531
|
props: props$r,
|
|
11519
11532
|
emits: ['ready', 'close', 'visible-change', 'clear', 'change', 'update:modelValue'],
|
|
11520
11533
|
setup(props, {
|
|
@@ -11535,7 +11548,7 @@ const Select = /* @__PURE__ */ vue.defineComponent({
|
|
|
11535
11548
|
const searchRegex = vue.ref(new RegExp(''));
|
|
11536
11549
|
const currentValue = vue.ref([]);
|
|
11537
11550
|
const source = vue.computed(() => {
|
|
11538
|
-
return flattenData(props.data, {
|
|
11551
|
+
return flattenData$1(props.data, {
|
|
11539
11552
|
parent: true,
|
|
11540
11553
|
cascader: true
|
|
11541
11554
|
});
|
|
@@ -11758,9 +11771,9 @@ const Select = /* @__PURE__ */ vue.defineComponent({
|
|
|
11758
11771
|
|
|
11759
11772
|
/** @jsxImportSource vue */
|
|
11760
11773
|
|
|
11761
|
-
const COMPONENT_NAME$
|
|
11774
|
+
const COMPONENT_NAME$D = 'vc-pagination';
|
|
11762
11775
|
const Pagination = /* @__PURE__ */ vue.defineComponent({
|
|
11763
|
-
name: COMPONENT_NAME$
|
|
11776
|
+
name: COMPONENT_NAME$D,
|
|
11764
11777
|
props: props$v,
|
|
11765
11778
|
emits: ['update:current', 'change', 'page-size-change'],
|
|
11766
11779
|
setup(props, {
|
|
@@ -11958,9 +11971,9 @@ const props$q = {
|
|
|
11958
11971
|
|
|
11959
11972
|
/** @jsxImportSource vue */
|
|
11960
11973
|
|
|
11961
|
-
const COMPONENT_NAME$
|
|
11974
|
+
const COMPONENT_NAME$C = 'vc-picker';
|
|
11962
11975
|
const Picker = /* @__PURE__ */ vue.defineComponent({
|
|
11963
|
-
name: COMPONENT_NAME$
|
|
11976
|
+
name: COMPONENT_NAME$C,
|
|
11964
11977
|
props: props$q,
|
|
11965
11978
|
setup(props, {
|
|
11966
11979
|
slots
|
|
@@ -11984,9 +11997,9 @@ const props$p = {
|
|
|
11984
11997
|
|
|
11985
11998
|
/** @jsxImportSource vue */
|
|
11986
11999
|
|
|
11987
|
-
const COMPONENT_NAME$
|
|
12000
|
+
const COMPONENT_NAME$B = 'vc-popconfirm';
|
|
11988
12001
|
const Popconfirm = /* @__PURE__ */ vue.defineComponent({
|
|
11989
|
-
name: COMPONENT_NAME$
|
|
12002
|
+
name: COMPONENT_NAME$B,
|
|
11990
12003
|
props: props$p,
|
|
11991
12004
|
setup(props, {
|
|
11992
12005
|
slots
|
|
@@ -12012,9 +12025,9 @@ const props$o = {
|
|
|
12012
12025
|
|
|
12013
12026
|
/** @jsxImportSource vue */
|
|
12014
12027
|
|
|
12015
|
-
const COMPONENT_NAME$
|
|
12028
|
+
const COMPONENT_NAME$A = 'vc-popup';
|
|
12016
12029
|
const Popup = /* @__PURE__ */ vue.defineComponent({
|
|
12017
|
-
name: COMPONENT_NAME$
|
|
12030
|
+
name: COMPONENT_NAME$A,
|
|
12018
12031
|
props: props$o,
|
|
12019
12032
|
setup(props, {
|
|
12020
12033
|
slots
|
|
@@ -12041,9 +12054,9 @@ const props$n = {
|
|
|
12041
12054
|
|
|
12042
12055
|
/** @jsxImportSource vue */
|
|
12043
12056
|
|
|
12044
|
-
const COMPONENT_NAME$
|
|
12057
|
+
const COMPONENT_NAME$z = 'vc-print';
|
|
12045
12058
|
const Print = /* @__PURE__ */ vue.defineComponent({
|
|
12046
|
-
name: COMPONENT_NAME$
|
|
12059
|
+
name: COMPONENT_NAME$z,
|
|
12047
12060
|
props: props$n,
|
|
12048
12061
|
setup(props, {
|
|
12049
12062
|
expose,
|
|
@@ -12139,9 +12152,9 @@ const props$m = {
|
|
|
12139
12152
|
|
|
12140
12153
|
/** @jsxImportSource vue */
|
|
12141
12154
|
|
|
12142
|
-
const COMPONENT_NAME$
|
|
12155
|
+
const COMPONENT_NAME$y = 'vc-progress-circle';
|
|
12143
12156
|
const Circle = /* @__PURE__ */ vue.defineComponent({
|
|
12144
|
-
name: COMPONENT_NAME$
|
|
12157
|
+
name: COMPONENT_NAME$y,
|
|
12145
12158
|
props: props$m,
|
|
12146
12159
|
setup(props, {
|
|
12147
12160
|
slots
|
|
@@ -12198,9 +12211,9 @@ const Circle = /* @__PURE__ */ vue.defineComponent({
|
|
|
12198
12211
|
|
|
12199
12212
|
/** @jsxImportSource vue */
|
|
12200
12213
|
|
|
12201
|
-
const COMPONENT_NAME$
|
|
12214
|
+
const COMPONENT_NAME$x = 'vc-progress-line';
|
|
12202
12215
|
const Line = /* @__PURE__ */ vue.defineComponent({
|
|
12203
|
-
name: COMPONENT_NAME$
|
|
12216
|
+
name: COMPONENT_NAME$x,
|
|
12204
12217
|
props: props$m,
|
|
12205
12218
|
setup(props) {
|
|
12206
12219
|
const colorStyle = vue.computed(() => {
|
|
@@ -12244,9 +12257,9 @@ const Line = /* @__PURE__ */ vue.defineComponent({
|
|
|
12244
12257
|
function _isSlot(s) {
|
|
12245
12258
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
12246
12259
|
}
|
|
12247
|
-
const COMPONENT_NAME$
|
|
12260
|
+
const COMPONENT_NAME$w = 'vc-progress';
|
|
12248
12261
|
const Progress = /* @__PURE__ */ vue.defineComponent({
|
|
12249
|
-
name: COMPONENT_NAME$
|
|
12262
|
+
name: COMPONENT_NAME$w,
|
|
12250
12263
|
props: props$m,
|
|
12251
12264
|
setup(props, {
|
|
12252
12265
|
slots
|
|
@@ -12398,9 +12411,9 @@ const useRadio = () => {
|
|
|
12398
12411
|
|
|
12399
12412
|
/** @jsxImportSource vue */
|
|
12400
12413
|
|
|
12401
|
-
const COMPONENT_NAME$
|
|
12414
|
+
const COMPONENT_NAME$v = 'vc-radio';
|
|
12402
12415
|
const Radio = /* @__PURE__ */ vue.defineComponent({
|
|
12403
|
-
name: COMPONENT_NAME$
|
|
12416
|
+
name: COMPONENT_NAME$v,
|
|
12404
12417
|
props: props$l,
|
|
12405
12418
|
emits: ['update:modelValue', 'change'],
|
|
12406
12419
|
setup(props, {
|
|
@@ -12511,9 +12524,9 @@ const useRadioGroup = () => {
|
|
|
12511
12524
|
|
|
12512
12525
|
/** @jsxImportSource vue */
|
|
12513
12526
|
|
|
12514
|
-
const COMPONENT_NAME$
|
|
12527
|
+
const COMPONENT_NAME$u = 'vc-radio-group';
|
|
12515
12528
|
const RadioGroup = /* @__PURE__ */ vue.defineComponent({
|
|
12516
|
-
name: COMPONENT_NAME$
|
|
12529
|
+
name: COMPONENT_NAME$u,
|
|
12517
12530
|
props: props$k,
|
|
12518
12531
|
emits: ['update:modelValue', 'change'],
|
|
12519
12532
|
setup(props, {
|
|
@@ -12535,9 +12548,9 @@ const RadioGroup = /* @__PURE__ */ vue.defineComponent({
|
|
|
12535
12548
|
|
|
12536
12549
|
/** @jsxImportSource vue */
|
|
12537
12550
|
|
|
12538
|
-
const COMPONENT_NAME$
|
|
12551
|
+
const COMPONENT_NAME$t = 'vcm-radio';
|
|
12539
12552
|
const MRadio = /* @__PURE__ */ vue.defineComponent({
|
|
12540
|
-
name: COMPONENT_NAME$
|
|
12553
|
+
name: COMPONENT_NAME$t,
|
|
12541
12554
|
props: props$l,
|
|
12542
12555
|
emits: ['update:modelValue', 'change'],
|
|
12543
12556
|
setup(props, {
|
|
@@ -12578,9 +12591,9 @@ const MRadio = /* @__PURE__ */ vue.defineComponent({
|
|
|
12578
12591
|
|
|
12579
12592
|
/** @jsxImportSource vue */
|
|
12580
12593
|
|
|
12581
|
-
const COMPONENT_NAME$
|
|
12594
|
+
const COMPONENT_NAME$s = 'vcm-radio-group';
|
|
12582
12595
|
const MRadioGroup = /* @__PURE__ */ vue.defineComponent({
|
|
12583
|
-
name: COMPONENT_NAME$
|
|
12596
|
+
name: COMPONENT_NAME$s,
|
|
12584
12597
|
props: props$k,
|
|
12585
12598
|
emits: ['update:modelValue', 'change'],
|
|
12586
12599
|
setup(props, {
|
|
@@ -12609,9 +12622,9 @@ const props$j = {
|
|
|
12609
12622
|
|
|
12610
12623
|
/** @jsxImportSource vue */
|
|
12611
12624
|
|
|
12612
|
-
const COMPONENT_NAME$
|
|
12625
|
+
const COMPONENT_NAME$r = 'vc-rate';
|
|
12613
12626
|
const Rate = /* @__PURE__ */ vue.defineComponent({
|
|
12614
|
-
name: COMPONENT_NAME$
|
|
12627
|
+
name: COMPONENT_NAME$r,
|
|
12615
12628
|
props: props$j,
|
|
12616
12629
|
setup(props, {
|
|
12617
12630
|
slots
|
|
@@ -12679,9 +12692,9 @@ const props$i = {
|
|
|
12679
12692
|
|
|
12680
12693
|
/** @jsxImportSource vue */
|
|
12681
12694
|
|
|
12682
|
-
const COMPONENT_NAME$
|
|
12695
|
+
const COMPONENT_NAME$q = 'vc-recycle-list-scroll-state';
|
|
12683
12696
|
const ScrollState = /* @__PURE__ */ vue.defineComponent({
|
|
12684
|
-
name: COMPONENT_NAME$
|
|
12697
|
+
name: COMPONENT_NAME$q,
|
|
12685
12698
|
setup(_, {
|
|
12686
12699
|
slots
|
|
12687
12700
|
}) {
|
|
@@ -12811,12 +12824,12 @@ const useDirectionKeys = () => {
|
|
|
12811
12824
|
|
|
12812
12825
|
/** @jsxImportSource vue */
|
|
12813
12826
|
|
|
12814
|
-
const COMPONENT_NAME$
|
|
12827
|
+
const COMPONENT_NAME$p = 'vc-recycle-list-container';
|
|
12815
12828
|
|
|
12816
12829
|
// TODO: 抽离
|
|
12817
12830
|
const transformKey = $__namespace.prefixStyle('transform').camel;
|
|
12818
12831
|
const Container = /* @__PURE__ */ vue.defineComponent({
|
|
12819
|
-
name: COMPONENT_NAME$
|
|
12832
|
+
name: COMPONENT_NAME$p,
|
|
12820
12833
|
props: props$h,
|
|
12821
12834
|
emits: ['refresh'],
|
|
12822
12835
|
setup(props, {
|
|
@@ -12914,9 +12927,9 @@ const Container = /* @__PURE__ */ vue.defineComponent({
|
|
|
12914
12927
|
|
|
12915
12928
|
/** @jsxImportSource vue */
|
|
12916
12929
|
|
|
12917
|
-
const COMPONENT_NAME$
|
|
12930
|
+
const COMPONENT_NAME$o = 'vc-recycle-list-item';
|
|
12918
12931
|
const Item = /* @__PURE__ */ vue.defineComponent({
|
|
12919
|
-
name: COMPONENT_NAME$
|
|
12932
|
+
name: COMPONENT_NAME$o,
|
|
12920
12933
|
props: {
|
|
12921
12934
|
vertical: {
|
|
12922
12935
|
type: Boolean,
|
|
@@ -12959,11 +12972,11 @@ const Item = /* @__PURE__ */ vue.defineComponent({
|
|
|
12959
12972
|
|
|
12960
12973
|
/** @jsxImportSource vue */
|
|
12961
12974
|
|
|
12962
|
-
const COMPONENT_NAME$
|
|
12975
|
+
const COMPONENT_NAME$n = 'vc-recycle-list';
|
|
12963
12976
|
const RecycleList = /* @__PURE__ */ vue.defineComponent({
|
|
12964
|
-
name: COMPONENT_NAME$
|
|
12977
|
+
name: COMPONENT_NAME$n,
|
|
12965
12978
|
props: props$i,
|
|
12966
|
-
emits: ['scroll'],
|
|
12979
|
+
emits: ['scroll', 'row-resize'],
|
|
12967
12980
|
setup(props, {
|
|
12968
12981
|
slots,
|
|
12969
12982
|
expose,
|
|
@@ -13062,7 +13075,7 @@ const RecycleList = /* @__PURE__ */ vue.defineComponent({
|
|
|
13062
13075
|
const isLoading = vue.computed(() => {
|
|
13063
13076
|
return loadings.value.length;
|
|
13064
13077
|
});
|
|
13065
|
-
const scrollTo = options => {
|
|
13078
|
+
const scrollTo = (options, force) => {
|
|
13066
13079
|
let options$ = {
|
|
13067
13080
|
x: 0,
|
|
13068
13081
|
y: 0
|
|
@@ -13073,10 +13086,9 @@ const RecycleList = /* @__PURE__ */ vue.defineComponent({
|
|
|
13073
13086
|
options$ = Object.assign(options$, options);
|
|
13074
13087
|
}
|
|
13075
13088
|
const el = wrapper.value;
|
|
13076
|
-
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
y !== options$.y && (el.scrollTop = options$.y);
|
|
13089
|
+
(force || el.scrollLeft !== options$.x) && (el.scrollLeft = options$.x);
|
|
13090
|
+
(force || el.scrollLeft !== options$.y) && (el.scrollTop = options$.y);
|
|
13091
|
+
scroller.value.scrollTo(options);
|
|
13080
13092
|
};
|
|
13081
13093
|
const scrollToIndex = (index, offset = 0) => {
|
|
13082
13094
|
const item = rebuildData.value[index];
|
|
@@ -13109,12 +13121,21 @@ const RecycleList = /* @__PURE__ */ vue.defineComponent({
|
|
|
13109
13121
|
const current = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[index]] : rebuildData.value[index];
|
|
13110
13122
|
if (!current) return; // 受到`removeUnusedPlaceholders`影响,无效的会被回收
|
|
13111
13123
|
|
|
13124
|
+
const oldSize = current.size;
|
|
13112
13125
|
const dom = preloads.value[index] || curloads.value[props.inverted ? index : index - firstItemIndex.value];
|
|
13113
13126
|
if (dom) {
|
|
13114
13127
|
current.size = dom[K.offsetSize] || placeholderSize.value;
|
|
13115
13128
|
} else if (current) {
|
|
13116
13129
|
current.size = placeholderSize.value;
|
|
13117
13130
|
}
|
|
13131
|
+
|
|
13132
|
+
// 这样的考虑欠佳,待优化
|
|
13133
|
+
if (oldSize !== current.size) {
|
|
13134
|
+
emit('row-resize', {
|
|
13135
|
+
index: current.id,
|
|
13136
|
+
size: current.size
|
|
13137
|
+
});
|
|
13138
|
+
}
|
|
13118
13139
|
};
|
|
13119
13140
|
const refreshItemPosition = () => {
|
|
13120
13141
|
const sizes = Array.from({
|
|
@@ -13521,9 +13542,9 @@ const props$g = {
|
|
|
13521
13542
|
|
|
13522
13543
|
/** @jsxImportSource vue */
|
|
13523
13544
|
|
|
13524
|
-
const COMPONENT_NAME$
|
|
13545
|
+
const COMPONENT_NAME$m = 'vc-slider';
|
|
13525
13546
|
const Slider = /* @__PURE__ */ vue.defineComponent({
|
|
13526
|
-
name: COMPONENT_NAME$
|
|
13547
|
+
name: COMPONENT_NAME$m,
|
|
13527
13548
|
props: props$g,
|
|
13528
13549
|
setup(props, {
|
|
13529
13550
|
slots
|
|
@@ -13547,9 +13568,9 @@ const props$f = {
|
|
|
13547
13568
|
|
|
13548
13569
|
/** @jsxImportSource vue */
|
|
13549
13570
|
|
|
13550
|
-
const COMPONENT_NAME$
|
|
13571
|
+
const COMPONENT_NAME$l = 'vc-sort-list';
|
|
13551
13572
|
const SortList = /* @__PURE__ */ vue.defineComponent({
|
|
13552
|
-
name: COMPONENT_NAME$
|
|
13573
|
+
name: COMPONENT_NAME$l,
|
|
13553
13574
|
props: props$f,
|
|
13554
13575
|
setup(props, {
|
|
13555
13576
|
slots
|
|
@@ -13573,9 +13594,9 @@ const props$e = {
|
|
|
13573
13594
|
|
|
13574
13595
|
/** @jsxImportSource vue */
|
|
13575
13596
|
|
|
13576
|
-
const COMPONENT_NAME$
|
|
13597
|
+
const COMPONENT_NAME$k = 'vc-steps';
|
|
13577
13598
|
const Steps = /* @__PURE__ */ vue.defineComponent({
|
|
13578
|
-
name: COMPONENT_NAME$
|
|
13599
|
+
name: COMPONENT_NAME$k,
|
|
13579
13600
|
props: props$e,
|
|
13580
13601
|
setup(props, {
|
|
13581
13602
|
slots
|
|
@@ -13688,9 +13709,9 @@ const useSwitch = (expose) => {
|
|
|
13688
13709
|
|
|
13689
13710
|
/** @jsxImportSource vue */
|
|
13690
13711
|
|
|
13691
|
-
const COMPONENT_NAME$
|
|
13712
|
+
const COMPONENT_NAME$j = 'vc-switch';
|
|
13692
13713
|
const Switch = /* @__PURE__ */ vue.defineComponent({
|
|
13693
|
-
name: COMPONENT_NAME$
|
|
13714
|
+
name: COMPONENT_NAME$j,
|
|
13694
13715
|
props: props$d,
|
|
13695
13716
|
// click -> onClick要被拦截,此处不能放置
|
|
13696
13717
|
emits: ['update:modelValue', 'change', 'click'],
|
|
@@ -13727,9 +13748,9 @@ const Switch = /* @__PURE__ */ vue.defineComponent({
|
|
|
13727
13748
|
|
|
13728
13749
|
/** @jsxImportSource vue */
|
|
13729
13750
|
|
|
13730
|
-
const COMPONENT_NAME$
|
|
13751
|
+
const COMPONENT_NAME$i = 'vcm-switch';
|
|
13731
13752
|
const MSwitch = /* @__PURE__ */ vue.defineComponent({
|
|
13732
|
-
name: COMPONENT_NAME$
|
|
13753
|
+
name: COMPONENT_NAME$i,
|
|
13733
13754
|
props: props$d,
|
|
13734
13755
|
// click -> onClick要被拦截,此处不能放置
|
|
13735
13756
|
emits: ['update:modelValue', 'change', 'click'],
|
|
@@ -13764,38 +13785,2945 @@ const MSwitch = /* @__PURE__ */ vue.defineComponent({
|
|
|
13764
13785
|
}
|
|
13765
13786
|
});
|
|
13766
13787
|
|
|
13767
|
-
const
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
|
|
13788
|
+
const parseHeight = (height) => {
|
|
13789
|
+
if (typeof height === "number") {
|
|
13790
|
+
return height;
|
|
13791
|
+
}
|
|
13792
|
+
if (height && typeof height === "string") {
|
|
13793
|
+
if (/^\d+(?:px)?/.test(height)) {
|
|
13794
|
+
return parseInt(height, 10);
|
|
13795
|
+
}
|
|
13796
|
+
throw new VcError("table", "Invalid Height");
|
|
13771
13797
|
}
|
|
13798
|
+
return null;
|
|
13772
13799
|
};
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
props: props$c,
|
|
13780
|
-
setup(props, {
|
|
13781
|
-
slots
|
|
13782
|
-
}) {
|
|
13783
|
-
return () => {
|
|
13784
|
-
return vue.createVNode("div", {
|
|
13785
|
-
"class": "vc-table"
|
|
13786
|
-
}, [slots?.default?.()]);
|
|
13787
|
-
};
|
|
13800
|
+
const parseWidth = (width) => {
|
|
13801
|
+
if (width !== void 0) {
|
|
13802
|
+
width = parseInt(width, 10);
|
|
13803
|
+
if (isNaN(width)) {
|
|
13804
|
+
width = null;
|
|
13805
|
+
}
|
|
13788
13806
|
}
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
const
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
|
|
13807
|
+
return width;
|
|
13808
|
+
};
|
|
13809
|
+
const parseMinWidth = (minWidth) => {
|
|
13810
|
+
if (typeof minWidth !== "undefined") {
|
|
13811
|
+
minWidth = parseWidth(minWidth);
|
|
13812
|
+
if (isNaN(minWidth)) {
|
|
13813
|
+
minWidth = 80;
|
|
13814
|
+
}
|
|
13815
|
+
}
|
|
13816
|
+
return minWidth;
|
|
13817
|
+
};
|
|
13818
|
+
const getRowIdentity = (row, rowKey) => {
|
|
13819
|
+
if (row.__KEY__) return row.__KEY__;
|
|
13820
|
+
if (!row) throw new VcError("table", "row is required when get row identity");
|
|
13821
|
+
if (typeof rowKey === "string") {
|
|
13822
|
+
if (!rowKey.includes(".")) {
|
|
13823
|
+
return row[rowKey];
|
|
13824
|
+
}
|
|
13825
|
+
const key = rowKey.split(".");
|
|
13826
|
+
let current = row;
|
|
13827
|
+
for (let i = 0; i < key.length; i++) {
|
|
13828
|
+
current = current[key[i]];
|
|
13829
|
+
}
|
|
13830
|
+
return current;
|
|
13831
|
+
} else if (typeof rowKey === "function") {
|
|
13832
|
+
return rowKey.call(null, row);
|
|
13833
|
+
}
|
|
13834
|
+
};
|
|
13835
|
+
const walkTreeNode = (root, cb, opts = {}) => {
|
|
13836
|
+
const {
|
|
13837
|
+
childrenKey = "children",
|
|
13838
|
+
lazyKey = "hasChildren",
|
|
13839
|
+
level: baseLevel = 0
|
|
13840
|
+
} = opts;
|
|
13841
|
+
const isNil = (array) => !(Array.isArray(array) && array.length);
|
|
13842
|
+
function _walker(parent, children, level) {
|
|
13843
|
+
cb(parent, children, level);
|
|
13844
|
+
children.forEach((item) => {
|
|
13845
|
+
if (item[lazyKey]) {
|
|
13846
|
+
cb(item, null, level + 1);
|
|
13847
|
+
return;
|
|
13848
|
+
}
|
|
13849
|
+
const $children = item[childrenKey];
|
|
13850
|
+
if (!isNil($children)) {
|
|
13851
|
+
_walker(item, $children, level + 1);
|
|
13852
|
+
}
|
|
13853
|
+
});
|
|
13854
|
+
}
|
|
13855
|
+
root.forEach((item) => {
|
|
13856
|
+
if (item[lazyKey]) {
|
|
13857
|
+
cb(item, null, baseLevel);
|
|
13858
|
+
return;
|
|
13859
|
+
}
|
|
13860
|
+
const children = item[childrenKey];
|
|
13861
|
+
if (!isNil(children)) {
|
|
13862
|
+
_walker(item, children, baseLevel);
|
|
13863
|
+
}
|
|
13864
|
+
});
|
|
13865
|
+
};
|
|
13866
|
+
const getKeysMap = (array = [], rowKey) => {
|
|
13867
|
+
const arrayMap = {};
|
|
13868
|
+
array.forEach((row, index) => {
|
|
13869
|
+
arrayMap[getRowIdentity(row, rowKey)] = { row, index };
|
|
13870
|
+
});
|
|
13871
|
+
return arrayMap;
|
|
13872
|
+
};
|
|
13873
|
+
const getColumnById = (columns, columnId) => {
|
|
13874
|
+
let column = null;
|
|
13875
|
+
columns.forEach((item) => {
|
|
13876
|
+
if (item.id === columnId) {
|
|
13877
|
+
column = item;
|
|
13878
|
+
}
|
|
13879
|
+
});
|
|
13880
|
+
return column;
|
|
13881
|
+
};
|
|
13882
|
+
const getColumnByCell = (table, cell) => {
|
|
13883
|
+
const matches = (cell.className || "").match(/vc-table_[^\s]+/gm);
|
|
13884
|
+
if (matches) {
|
|
13885
|
+
return getColumnById(table, matches[0]);
|
|
13886
|
+
}
|
|
13887
|
+
return null;
|
|
13888
|
+
};
|
|
13889
|
+
const getCell = (event) => {
|
|
13890
|
+
let cell = event.target;
|
|
13891
|
+
while (cell && cell.tagName.toUpperCase() !== "HTML") {
|
|
13892
|
+
if (cell.tagName.toUpperCase() === "TD") {
|
|
13893
|
+
return cell;
|
|
13894
|
+
}
|
|
13895
|
+
cell = cell.parentNode;
|
|
13896
|
+
}
|
|
13897
|
+
return null;
|
|
13898
|
+
};
|
|
13899
|
+
const flattenData = (data, opts = {}) => {
|
|
13900
|
+
const result = [];
|
|
13901
|
+
data.forEach((item) => {
|
|
13902
|
+
if (item.children) {
|
|
13903
|
+
const { children, ...rest } = item;
|
|
13904
|
+
opts.parent ? result.push(...[opts.cascader ? item : rest, ...flattenData(children, opts)]) : result.push(...flattenData(children));
|
|
13905
|
+
} else {
|
|
13906
|
+
result.push(item);
|
|
13907
|
+
}
|
|
13908
|
+
});
|
|
13909
|
+
return result;
|
|
13910
|
+
};
|
|
13911
|
+
|
|
13912
|
+
class BaseWatcher {
|
|
13913
|
+
states = vue.reactive({
|
|
13914
|
+
// 渲染的数据来源,是对 table 中的 data 过滤排序后的结果
|
|
13915
|
+
_data: [],
|
|
13916
|
+
data: [],
|
|
13917
|
+
list: [],
|
|
13918
|
+
// 是否包含固定列
|
|
13919
|
+
isComplex: false,
|
|
13920
|
+
// 列
|
|
13921
|
+
_columns: [],
|
|
13922
|
+
// 动态收集vc-table-column中的columnConfig
|
|
13923
|
+
originColumns: [],
|
|
13924
|
+
// leftFixedColumns, notFixedColumns, rightFixedColumns
|
|
13925
|
+
columns: [],
|
|
13926
|
+
// 包括 leftFixedLeafColumns,leafColumns,rightFixedLeafColumns
|
|
13927
|
+
leftFixedColumns: [],
|
|
13928
|
+
rightFixedColumns: [],
|
|
13929
|
+
leafColumns: [],
|
|
13930
|
+
leftFixedLeafColumns: [],
|
|
13931
|
+
rightFixedLeafColumns: [],
|
|
13932
|
+
leafColumnsLength: 0,
|
|
13933
|
+
leftFixedLeafColumnsLength: 0,
|
|
13934
|
+
rightFixedLeafColumnsLength: 0,
|
|
13935
|
+
// 选择
|
|
13936
|
+
isAllSelected: false,
|
|
13937
|
+
selection: [],
|
|
13938
|
+
reserveSelection: false,
|
|
13939
|
+
selectable: null,
|
|
13940
|
+
hoverRowIndex: null,
|
|
13941
|
+
// Current
|
|
13942
|
+
currentRow: null,
|
|
13943
|
+
// Expand
|
|
13944
|
+
defaultExpandAll: false,
|
|
13945
|
+
expandRows: [],
|
|
13946
|
+
// Tree
|
|
13947
|
+
treeExpandRowValue: [],
|
|
13948
|
+
treeData: {},
|
|
13949
|
+
// item的状态,比如loading, loaded
|
|
13950
|
+
treeLazy: false,
|
|
13951
|
+
treelazyNodeMap: {},
|
|
13952
|
+
// 源数据
|
|
13953
|
+
treeLazyData: [],
|
|
13954
|
+
// 源数据展开
|
|
13955
|
+
treeLazyColumnIdentifier: "hasChildren",
|
|
13956
|
+
treeChildrenColumnName: "children"
|
|
13957
|
+
});
|
|
13958
|
+
}
|
|
13959
|
+
|
|
13960
|
+
class Expand {
|
|
13961
|
+
store;
|
|
13962
|
+
constructor(store) {
|
|
13963
|
+
this.store = store;
|
|
13964
|
+
}
|
|
13965
|
+
update() {
|
|
13966
|
+
const store = this.store;
|
|
13967
|
+
const { rowKey, defaultExpandAll } = this.store.table.props;
|
|
13968
|
+
const { data = [], expandRows } = store.states;
|
|
13969
|
+
if (defaultExpandAll) {
|
|
13970
|
+
store.states.expandRows = data.slice();
|
|
13971
|
+
} else if (rowKey) {
|
|
13972
|
+
const expandRowsMap = getKeysMap(expandRows, rowKey);
|
|
13973
|
+
store.states.expandRows = data.reduce((prev, row) => {
|
|
13974
|
+
const rowId = getRowIdentity(row, rowKey);
|
|
13975
|
+
const rowInfo = expandRowsMap[rowId];
|
|
13976
|
+
if (rowInfo) {
|
|
13977
|
+
prev.push(row);
|
|
13978
|
+
}
|
|
13979
|
+
return prev;
|
|
13980
|
+
}, []);
|
|
13981
|
+
} else {
|
|
13982
|
+
store.states.expandRows = [];
|
|
13983
|
+
}
|
|
13984
|
+
}
|
|
13985
|
+
toggle(row, expanded) {
|
|
13986
|
+
const store = this.store;
|
|
13987
|
+
const { expandRows } = store.states;
|
|
13988
|
+
const changed = store.toggleRowStatus(expandRows, row, expanded);
|
|
13989
|
+
if (changed) {
|
|
13990
|
+
store.table.emit("expand-change", row, expandRows.slice());
|
|
13991
|
+
store.scheduleLayout();
|
|
13992
|
+
}
|
|
13993
|
+
}
|
|
13994
|
+
reset(ids) {
|
|
13995
|
+
const store = this.store;
|
|
13996
|
+
store.checkRowKey();
|
|
13997
|
+
const { rowKey } = store.table.props;
|
|
13998
|
+
const { data } = store.states;
|
|
13999
|
+
const keysMap = getKeysMap(data, rowKey);
|
|
14000
|
+
store.states.expandRows = ids.reduce((prev, cur) => {
|
|
14001
|
+
const info = keysMap[cur];
|
|
14002
|
+
if (info) {
|
|
14003
|
+
prev.push(info.row);
|
|
14004
|
+
}
|
|
14005
|
+
return prev;
|
|
14006
|
+
}, []);
|
|
14007
|
+
}
|
|
14008
|
+
isExpanded(row) {
|
|
14009
|
+
const { rowKey } = this.store.table.props;
|
|
14010
|
+
const { expandRows = [] } = this.store.states;
|
|
14011
|
+
if (rowKey) {
|
|
14012
|
+
const expandMap = getKeysMap(expandRows, rowKey);
|
|
14013
|
+
return !!expandMap[getRowIdentity(row, rowKey)];
|
|
14014
|
+
}
|
|
14015
|
+
return expandRows.indexOf(row) !== -1;
|
|
14016
|
+
}
|
|
14017
|
+
}
|
|
14018
|
+
|
|
14019
|
+
class Current {
|
|
14020
|
+
store;
|
|
14021
|
+
constructor(store) {
|
|
14022
|
+
this.store = store;
|
|
14023
|
+
}
|
|
14024
|
+
reset(id) {
|
|
14025
|
+
const store = this.store;
|
|
14026
|
+
const { rowKey } = store.table.props;
|
|
14027
|
+
store.checkRowKey();
|
|
14028
|
+
const { data = [] } = store.states;
|
|
14029
|
+
const currentRow = data.find((item) => getRowIdentity(item, rowKey) === id);
|
|
14030
|
+
store.states.currentRow = currentRow || null;
|
|
14031
|
+
}
|
|
14032
|
+
update() {
|
|
14033
|
+
const store = this.store;
|
|
14034
|
+
const { rowKey } = store.table.props;
|
|
14035
|
+
const { data = [], currentRow } = store.states;
|
|
14036
|
+
const oldCurrentRow = currentRow;
|
|
14037
|
+
if (oldCurrentRow && !data.includes(oldCurrentRow)) {
|
|
14038
|
+
let newCurrentRow = null;
|
|
14039
|
+
if (rowKey) {
|
|
14040
|
+
newCurrentRow = data.find((item) => {
|
|
14041
|
+
return getRowIdentity(item, rowKey) === getRowIdentity(oldCurrentRow, rowKey);
|
|
14042
|
+
});
|
|
14043
|
+
}
|
|
14044
|
+
store.states.currentRow = newCurrentRow;
|
|
14045
|
+
if (newCurrentRow !== oldCurrentRow) {
|
|
14046
|
+
store.table.emit("current-change", null, oldCurrentRow);
|
|
14047
|
+
}
|
|
14048
|
+
}
|
|
14049
|
+
}
|
|
14050
|
+
}
|
|
14051
|
+
|
|
14052
|
+
let Tree$1 = class Tree {
|
|
14053
|
+
store;
|
|
14054
|
+
/**
|
|
14055
|
+
* 解决问题嵌入型的数据,watch 无法是检测到变化
|
|
14056
|
+
* TODO: 是否会造成性能问题?同base-watcher flattenData
|
|
14057
|
+
* { id: { level, children } }
|
|
14058
|
+
*/
|
|
14059
|
+
normalizedData = vue.computed(() => {
|
|
14060
|
+
const { rowKey } = this.store.table.props;
|
|
14061
|
+
if (!rowKey) return {};
|
|
14062
|
+
return this.normalize(this.store.states.data || []);
|
|
14063
|
+
});
|
|
14064
|
+
/**
|
|
14065
|
+
* 针对懒加载的情形,不处理嵌套数据
|
|
14066
|
+
* { id: { children } }
|
|
14067
|
+
*/
|
|
14068
|
+
normalizedLazyNode = vue.computed(() => {
|
|
14069
|
+
const { rowKey } = this.store.table.props;
|
|
14070
|
+
const { treelazyNodeMap, treeLazyColumnIdentifier, treeChildrenColumnName } = this.store.states;
|
|
14071
|
+
const keys = Object.keys(treelazyNodeMap);
|
|
14072
|
+
const res = {};
|
|
14073
|
+
if (!keys.length) return res;
|
|
14074
|
+
keys.forEach((key) => {
|
|
14075
|
+
if (treelazyNodeMap[key].length) {
|
|
14076
|
+
const item = { children: [] };
|
|
14077
|
+
treelazyNodeMap[key].forEach((row) => {
|
|
14078
|
+
const id = getRowIdentity(row, rowKey);
|
|
14079
|
+
item.children.push(id);
|
|
14080
|
+
const hasChildren = row[treeLazyColumnIdentifier] || row[treeChildrenColumnName] && row[treeChildrenColumnName].length === 0;
|
|
14081
|
+
if (hasChildren && !res[id]) {
|
|
14082
|
+
res[id] = { children: [] };
|
|
14083
|
+
}
|
|
14084
|
+
});
|
|
14085
|
+
res[key] = item;
|
|
14086
|
+
}
|
|
14087
|
+
});
|
|
14088
|
+
return res;
|
|
14089
|
+
});
|
|
14090
|
+
constructor(store) {
|
|
14091
|
+
this.store = store;
|
|
14092
|
+
vue.watch(
|
|
14093
|
+
() => [this.normalizedData.value, this.normalizedLazyNode.value],
|
|
14094
|
+
() => this.update()
|
|
14095
|
+
);
|
|
14096
|
+
}
|
|
14097
|
+
normalize(data) {
|
|
14098
|
+
const { rowKey } = this.store.table.props;
|
|
14099
|
+
const { treeChildrenColumnName, treeLazyColumnIdentifier, treeLazy } = this.store.states;
|
|
14100
|
+
const res = {};
|
|
14101
|
+
walkTreeNode(
|
|
14102
|
+
data,
|
|
14103
|
+
(parent, children, level) => {
|
|
14104
|
+
const parentId = getRowIdentity(parent, rowKey);
|
|
14105
|
+
if (Array.isArray(children)) {
|
|
14106
|
+
res[parentId] = {
|
|
14107
|
+
children: children.map((row) => getRowIdentity(row, rowKey)),
|
|
14108
|
+
level
|
|
14109
|
+
};
|
|
14110
|
+
} else if (treeLazy) {
|
|
14111
|
+
res[parentId] = {
|
|
14112
|
+
children: [],
|
|
14113
|
+
lazy: true,
|
|
14114
|
+
level
|
|
14115
|
+
};
|
|
14116
|
+
}
|
|
14117
|
+
},
|
|
14118
|
+
{
|
|
14119
|
+
childrenKey: treeChildrenColumnName,
|
|
14120
|
+
lazyKey: treeLazyColumnIdentifier
|
|
14121
|
+
}
|
|
14122
|
+
);
|
|
14123
|
+
return res;
|
|
14124
|
+
}
|
|
14125
|
+
// 获取当前展开最大的level
|
|
14126
|
+
getMaxLevel() {
|
|
14127
|
+
const { rowKey } = this.store.table.props;
|
|
14128
|
+
const { data, treeData } = this.store.states;
|
|
14129
|
+
const levels = data.map((item) => {
|
|
14130
|
+
const traverse = (source) => {
|
|
14131
|
+
if (!source) return 0;
|
|
14132
|
+
if (source.expanded && source.children.length > 0) {
|
|
14133
|
+
return lodashEs.max([source.level, ...source.children.map((key) => traverse(treeData[key]))]);
|
|
14134
|
+
} else {
|
|
14135
|
+
return source.level;
|
|
14136
|
+
}
|
|
14137
|
+
};
|
|
14138
|
+
const id = getRowIdentity(item, rowKey);
|
|
14139
|
+
return traverse(treeData[id]);
|
|
14140
|
+
});
|
|
14141
|
+
return lodashEs.max(levels) || 0;
|
|
14142
|
+
}
|
|
14143
|
+
update() {
|
|
14144
|
+
const nested = this.normalizedData.value;
|
|
14145
|
+
const normalizedLazyNode = this.normalizedLazyNode.value;
|
|
14146
|
+
const keys = Object.keys(nested);
|
|
14147
|
+
const newTreeData = {};
|
|
14148
|
+
if (keys.length) {
|
|
14149
|
+
const { defaultExpandAll } = this.store.table.props;
|
|
14150
|
+
const { treeData: oldTreeData, treeExpandRowValue, treeLazy } = this.store.states;
|
|
14151
|
+
const rootLazyRowValue = [];
|
|
14152
|
+
const getExpanded = (oldValue, key) => {
|
|
14153
|
+
const included = defaultExpandAll || treeExpandRowValue && treeExpandRowValue.indexOf(key) !== -1;
|
|
14154
|
+
return !!(oldValue && oldValue.expanded || included);
|
|
14155
|
+
};
|
|
14156
|
+
keys.forEach((key) => {
|
|
14157
|
+
const oldValue = oldTreeData[key];
|
|
14158
|
+
const newValue = { ...nested[key] };
|
|
14159
|
+
newValue.expanded = getExpanded(oldValue, key);
|
|
14160
|
+
if (newValue.lazy) {
|
|
14161
|
+
const { loaded = false, loading = false } = oldValue || {};
|
|
14162
|
+
newValue.loaded = !!loaded;
|
|
14163
|
+
newValue.loading = !!loading;
|
|
14164
|
+
rootLazyRowValue.push(key);
|
|
14165
|
+
}
|
|
14166
|
+
newTreeData[key] = newValue;
|
|
14167
|
+
});
|
|
14168
|
+
const lazyKeys = Object.keys(normalizedLazyNode);
|
|
14169
|
+
if (treeLazy && lazyKeys.length && rootLazyRowValue.length) {
|
|
14170
|
+
lazyKeys.forEach((key) => {
|
|
14171
|
+
const oldValue = oldTreeData[key];
|
|
14172
|
+
const lazyNodeChildren = normalizedLazyNode[key].children;
|
|
14173
|
+
if (rootLazyRowValue.includes(key)) {
|
|
14174
|
+
if (newTreeData[key].children.length !== 0) {
|
|
14175
|
+
throw new VcError("table", "children需要为空数组");
|
|
14176
|
+
}
|
|
14177
|
+
newTreeData[key].children = lazyNodeChildren;
|
|
14178
|
+
} else {
|
|
14179
|
+
const { loaded = false, loading = false } = oldValue || {};
|
|
14180
|
+
newTreeData[key] = vue.reactive({
|
|
14181
|
+
lazy: true,
|
|
14182
|
+
loaded: !!loaded,
|
|
14183
|
+
loading: !!loading,
|
|
14184
|
+
expanded: getExpanded(oldValue, key),
|
|
14185
|
+
children: lazyNodeChildren,
|
|
14186
|
+
level: ""
|
|
14187
|
+
});
|
|
14188
|
+
}
|
|
14189
|
+
});
|
|
14190
|
+
}
|
|
14191
|
+
}
|
|
14192
|
+
this.store.states.treeData = newTreeData;
|
|
14193
|
+
this.store.updateTableScrollY();
|
|
14194
|
+
}
|
|
14195
|
+
expand(ids) {
|
|
14196
|
+
this.store.states.treeExpandRowValue = ids;
|
|
14197
|
+
this.update();
|
|
14198
|
+
}
|
|
14199
|
+
toggle(row, expanded) {
|
|
14200
|
+
this.store.checkRowKey();
|
|
14201
|
+
const { rowKey } = this.store.table.props;
|
|
14202
|
+
const { treeData } = this.store.states;
|
|
14203
|
+
const id = getRowIdentity(row, rowKey);
|
|
14204
|
+
const data = id && treeData[id];
|
|
14205
|
+
if (id && data && "expanded" in data) {
|
|
14206
|
+
const oldExpanded = data.expanded;
|
|
14207
|
+
expanded = typeof expanded === "undefined" ? !data.expanded : expanded;
|
|
14208
|
+
this.store.states.treeData[id].expanded = expanded;
|
|
14209
|
+
if (oldExpanded !== expanded) {
|
|
14210
|
+
this.store.table.emit("expand-change", row, expanded, this.getMaxLevel());
|
|
14211
|
+
}
|
|
14212
|
+
this.store.updateTableScrollY();
|
|
14213
|
+
}
|
|
14214
|
+
}
|
|
14215
|
+
loadOrToggle(row) {
|
|
14216
|
+
this.store.checkRowKey();
|
|
14217
|
+
const { rowKey } = this.store.table.props;
|
|
14218
|
+
const { treeLazy, treeData } = this.store.states;
|
|
14219
|
+
const id = getRowIdentity(row, rowKey);
|
|
14220
|
+
const data = treeData[id];
|
|
14221
|
+
if (treeLazy && data && "loaded" in data && !data.loaded) {
|
|
14222
|
+
this.loadData(row, id, data);
|
|
14223
|
+
} else {
|
|
14224
|
+
this.toggle(row);
|
|
14225
|
+
}
|
|
14226
|
+
}
|
|
14227
|
+
loadData(row, key, treeNode) {
|
|
14228
|
+
this.store.checkRowKey();
|
|
14229
|
+
const { table } = this.store;
|
|
14230
|
+
const { rowKey } = table.props;
|
|
14231
|
+
const { treelazyNodeMap, treeData, treeChildrenColumnName, treeLazyColumnIdentifier } = this.store.states;
|
|
14232
|
+
if (table.props.loadExpand && !treeData[key].loaded) {
|
|
14233
|
+
this.store.states.treeData[key].loading = true;
|
|
14234
|
+
const promise = table.props.loadExpand(row, treeNode);
|
|
14235
|
+
const fn = (data) => {
|
|
14236
|
+
if (!Array.isArray(data)) {
|
|
14237
|
+
throw new VcError("table", "data必须是数组");
|
|
14238
|
+
}
|
|
14239
|
+
this.store.states.treeData[key].loading = false;
|
|
14240
|
+
this.store.states.treeData[key].loaded = true;
|
|
14241
|
+
this.store.states.treeData[key].expanded = true;
|
|
14242
|
+
walkTreeNode(
|
|
14243
|
+
data,
|
|
14244
|
+
(parent, _, level) => {
|
|
14245
|
+
const id = getRowIdentity(parent, rowKey);
|
|
14246
|
+
Object.defineProperty(parent, "__KEY__", {
|
|
14247
|
+
value: `${level}__${id}`,
|
|
14248
|
+
writable: false
|
|
14249
|
+
});
|
|
14250
|
+
},
|
|
14251
|
+
{
|
|
14252
|
+
childrenKey: treeChildrenColumnName,
|
|
14253
|
+
lazyKey: treeLazyColumnIdentifier,
|
|
14254
|
+
level: treeNode.level
|
|
14255
|
+
}
|
|
14256
|
+
);
|
|
14257
|
+
if (data.length) {
|
|
14258
|
+
this.store.states.treelazyNodeMap[key] = data;
|
|
14259
|
+
if (table.props.expandSelectable) {
|
|
14260
|
+
this.store.states.treeLazyData = Object.keys(treelazyNodeMap).reduce((pre, cur) => {
|
|
14261
|
+
return pre.concat(treelazyNodeMap[cur]);
|
|
14262
|
+
}, []);
|
|
14263
|
+
}
|
|
14264
|
+
}
|
|
14265
|
+
if (this.store.isSelected(row)) {
|
|
14266
|
+
data.forEach((i) => {
|
|
14267
|
+
this.store.toggleRowSelection(i);
|
|
14268
|
+
});
|
|
14269
|
+
}
|
|
14270
|
+
this.store.updateAllSelected();
|
|
14271
|
+
vue.nextTick(() => {
|
|
14272
|
+
table.emit("expand-change", row, true, this.getMaxLevel());
|
|
14273
|
+
});
|
|
14274
|
+
};
|
|
14275
|
+
if (promise && promise.then) {
|
|
14276
|
+
promise.then((data) => fn(data)).catch((e) => {
|
|
14277
|
+
throw new VcError("table", e);
|
|
14278
|
+
});
|
|
14279
|
+
} else if (Array.isArray(promise)) {
|
|
14280
|
+
fn(promise);
|
|
14281
|
+
}
|
|
14282
|
+
}
|
|
14283
|
+
}
|
|
14284
|
+
};
|
|
14285
|
+
|
|
14286
|
+
class Layout {
|
|
14287
|
+
table;
|
|
14288
|
+
store;
|
|
14289
|
+
states = vue.reactive({
|
|
14290
|
+
height: null,
|
|
14291
|
+
scrollX: false,
|
|
14292
|
+
scrollY: false,
|
|
14293
|
+
bodyWidth: null,
|
|
14294
|
+
leftFixedWidth: null,
|
|
14295
|
+
rightFixedWidth: null,
|
|
14296
|
+
tableHeight: null,
|
|
14297
|
+
headerHeight: 44,
|
|
14298
|
+
// Table Header Height
|
|
14299
|
+
appendHeight: 0,
|
|
14300
|
+
// Append Slot Height
|
|
14301
|
+
footerHeight: 44,
|
|
14302
|
+
// Table Footer Height
|
|
14303
|
+
bodyHeight: null
|
|
14304
|
+
// Table Height - Table Header Height
|
|
14305
|
+
});
|
|
14306
|
+
constructor(store) {
|
|
14307
|
+
this.store = store;
|
|
14308
|
+
this.table = store.table;
|
|
14309
|
+
if (!this.table) {
|
|
14310
|
+
throw new VcError("table", "Table Layout 必须包含table实例");
|
|
14311
|
+
}
|
|
14312
|
+
if (!this.store) {
|
|
14313
|
+
throw new VcError("table", "Table Layout 必须包含store实例");
|
|
14314
|
+
}
|
|
14315
|
+
this.updateScroller = this.updateScroller.bind(this);
|
|
14316
|
+
this.updateColumns = this.updateColumns.bind(this);
|
|
14317
|
+
vue.onMounted(() => {
|
|
14318
|
+
this.updateColumns();
|
|
14319
|
+
this.updateScroller();
|
|
14320
|
+
});
|
|
14321
|
+
let __updated__;
|
|
14322
|
+
vue.onUpdated(() => {
|
|
14323
|
+
if (__updated__) return;
|
|
14324
|
+
this.updateColumns();
|
|
14325
|
+
this.updateScroller();
|
|
14326
|
+
__updated__ = true;
|
|
14327
|
+
});
|
|
14328
|
+
}
|
|
14329
|
+
updateScrollY() {
|
|
14330
|
+
const { height, bodyHeight } = this.states;
|
|
14331
|
+
if (height === null || bodyHeight === null) return;
|
|
14332
|
+
const scroller = this.table.exposed.scroller.value;
|
|
14333
|
+
if (this.table.vnode.el && scroller) {
|
|
14334
|
+
const body = scroller.$el.querySelector(".vc-table__body");
|
|
14335
|
+
this.states.scrollY = body.offsetHeight > bodyHeight;
|
|
14336
|
+
}
|
|
14337
|
+
}
|
|
14338
|
+
setHeight(value, prop = "height") {
|
|
14339
|
+
if (vcShared.IS_SERVER) return;
|
|
14340
|
+
const el = this.table.vnode.el;
|
|
14341
|
+
value = parseHeight(value);
|
|
14342
|
+
this.states.height = value;
|
|
14343
|
+
if (!el && (value || value === 0)) return vue.nextTick(() => this.setHeight(value, prop));
|
|
14344
|
+
if (value) {
|
|
14345
|
+
el.style[prop] = `${value}px`;
|
|
14346
|
+
this.updateElsHeight();
|
|
14347
|
+
}
|
|
14348
|
+
}
|
|
14349
|
+
setMaxHeight(value) {
|
|
14350
|
+
this.setHeight(value, "max-height");
|
|
14351
|
+
}
|
|
14352
|
+
getFlattenColumns() {
|
|
14353
|
+
const flattenColumns = [];
|
|
14354
|
+
const columns = this.store.states.columns;
|
|
14355
|
+
columns.forEach((column) => {
|
|
14356
|
+
if (column.isColumnGroup) {
|
|
14357
|
+
flattenColumns.push(...column.columns);
|
|
14358
|
+
} else {
|
|
14359
|
+
flattenColumns.push(column);
|
|
14360
|
+
}
|
|
14361
|
+
});
|
|
14362
|
+
return flattenColumns;
|
|
14363
|
+
}
|
|
14364
|
+
updateElsHeight() {
|
|
14365
|
+
if (!this.table.exposed.isReady.value) return vue.nextTick(() => this.updateElsHeight());
|
|
14366
|
+
const table = this.table.exposed;
|
|
14367
|
+
const headerWrapper = table.headerWrapper.value;
|
|
14368
|
+
const appendWrapper = table.appendWrapper.value;
|
|
14369
|
+
const footerWrapper = table.footerWrapper.value;
|
|
14370
|
+
const { showHeader } = this.table.props;
|
|
14371
|
+
this.states.appendHeight = appendWrapper ? appendWrapper.offsetHeight : 0;
|
|
14372
|
+
if (showHeader && !headerWrapper) return;
|
|
14373
|
+
const headerHeight = !showHeader ? 0 : headerWrapper.offsetHeight;
|
|
14374
|
+
this.states.headerHeight = headerHeight;
|
|
14375
|
+
if (showHeader && headerWrapper.offsetWidth > 0 && (this.store.states.columns || []).length > 0 && headerHeight < 2) {
|
|
14376
|
+
return vue.nextTick(() => this.updateElsHeight());
|
|
14377
|
+
}
|
|
14378
|
+
const tableHeight = this.table.vnode.el.clientHeight;
|
|
14379
|
+
this.states.tableHeight = tableHeight;
|
|
14380
|
+
const footerHeight = footerWrapper ? footerWrapper.offsetHeight : 0;
|
|
14381
|
+
this.states.footerHeight = footerHeight;
|
|
14382
|
+
if (this.states.height !== null) {
|
|
14383
|
+
this.states.bodyHeight = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
|
|
14384
|
+
}
|
|
14385
|
+
this.updateScrollY();
|
|
14386
|
+
this.updateScroller();
|
|
14387
|
+
}
|
|
14388
|
+
updateColumnsWidth() {
|
|
14389
|
+
if (vcShared.IS_SERVER) return;
|
|
14390
|
+
const bodyWidth = this.table.vnode.el.clientWidth;
|
|
14391
|
+
let bodyMinWidth = 0;
|
|
14392
|
+
const flattenColumns = this.getFlattenColumns();
|
|
14393
|
+
const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
|
|
14394
|
+
const { fit } = this.table.props;
|
|
14395
|
+
if (flexColumns.length > 0 && fit) {
|
|
14396
|
+
flattenColumns.forEach((column) => {
|
|
14397
|
+
bodyMinWidth += column.width || column.minWidth || 80;
|
|
14398
|
+
});
|
|
14399
|
+
if (bodyMinWidth <= bodyWidth) {
|
|
14400
|
+
this.states.scrollX = false;
|
|
14401
|
+
const totalFlexWidth = bodyWidth - bodyMinWidth;
|
|
14402
|
+
if (flexColumns.length === 1) {
|
|
14403
|
+
flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth;
|
|
14404
|
+
} else {
|
|
14405
|
+
const allColumnsWidth = flexColumns.reduce((prev, column) => prev + (column.minWidth || 80), 0);
|
|
14406
|
+
const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
|
|
14407
|
+
let noneFirstWidth = 0;
|
|
14408
|
+
flexColumns.forEach((column, index) => {
|
|
14409
|
+
if (index === 0) return;
|
|
14410
|
+
const flexWidth = Math.floor((column.minWidth || 80) * flexWidthPerPixel);
|
|
14411
|
+
noneFirstWidth += flexWidth;
|
|
14412
|
+
column.realWidth = (column.minWidth || 80) + flexWidth;
|
|
14413
|
+
});
|
|
14414
|
+
flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
|
|
14415
|
+
}
|
|
14416
|
+
} else {
|
|
14417
|
+
this.states.scrollX = true;
|
|
14418
|
+
flexColumns.forEach(function(column) {
|
|
14419
|
+
column.realWidth = column.width || column.minWidth;
|
|
14420
|
+
});
|
|
14421
|
+
}
|
|
14422
|
+
this.states.bodyWidth = Math.max(bodyMinWidth, bodyWidth);
|
|
14423
|
+
this.table.exposed.resizeState.value.width = this.states.bodyWidth;
|
|
14424
|
+
} else {
|
|
14425
|
+
flattenColumns.forEach((column) => {
|
|
14426
|
+
if (!column.width && !column.minWidth) {
|
|
14427
|
+
column.realWidth = 80;
|
|
14428
|
+
} else {
|
|
14429
|
+
column.realWidth = column.width || column.minWidth;
|
|
14430
|
+
}
|
|
14431
|
+
bodyMinWidth += column.realWidth;
|
|
14432
|
+
});
|
|
14433
|
+
this.states.scrollX = bodyMinWidth > bodyWidth;
|
|
14434
|
+
this.states.bodyWidth = bodyMinWidth;
|
|
14435
|
+
}
|
|
14436
|
+
const leftFixedColumns = this.store.states.leftFixedColumns;
|
|
14437
|
+
if (leftFixedColumns.length > 0) {
|
|
14438
|
+
let leftFixedWidth = 0;
|
|
14439
|
+
leftFixedColumns.forEach(function(column) {
|
|
14440
|
+
leftFixedWidth += column.realWidth || column.width;
|
|
14441
|
+
});
|
|
14442
|
+
this.states.leftFixedWidth = leftFixedWidth;
|
|
14443
|
+
}
|
|
14444
|
+
const rightFixedColumns = this.store.states.rightFixedColumns;
|
|
14445
|
+
if (rightFixedColumns.length > 0) {
|
|
14446
|
+
let rightFixedWidth = 0;
|
|
14447
|
+
rightFixedColumns.forEach(function(column) {
|
|
14448
|
+
rightFixedWidth += column.realWidth || column.width;
|
|
14449
|
+
});
|
|
14450
|
+
this.states.rightFixedWidth = rightFixedWidth;
|
|
14451
|
+
}
|
|
14452
|
+
this.updateColumns();
|
|
14453
|
+
}
|
|
14454
|
+
// v2.x中的 notifyObservers
|
|
14455
|
+
updateColumns() {
|
|
14456
|
+
}
|
|
14457
|
+
updateScroller() {
|
|
14458
|
+
}
|
|
14459
|
+
}
|
|
14460
|
+
|
|
14461
|
+
class Store extends BaseWatcher {
|
|
14462
|
+
table;
|
|
14463
|
+
current;
|
|
14464
|
+
expand;
|
|
14465
|
+
tree;
|
|
14466
|
+
layout;
|
|
14467
|
+
flattenData = vue.computed(() => {
|
|
14468
|
+
if (this.table.props.expandSelectable) {
|
|
14469
|
+
return lodash.concat(
|
|
14470
|
+
flattenData(this.states.data, { parent: true, cascader: true }),
|
|
14471
|
+
this.states.treeLazyData
|
|
14472
|
+
);
|
|
14473
|
+
} else {
|
|
14474
|
+
return this.states.data;
|
|
14475
|
+
}
|
|
14476
|
+
});
|
|
14477
|
+
constructor(options) {
|
|
14478
|
+
super();
|
|
14479
|
+
if (!options.table) {
|
|
14480
|
+
throw new VcError("table", "table必传");
|
|
14481
|
+
}
|
|
14482
|
+
this.table = options.table;
|
|
14483
|
+
this.current = new Current(this);
|
|
14484
|
+
this.expand = new Expand(this);
|
|
14485
|
+
this.tree = new Tree$1(this);
|
|
14486
|
+
this.layout = new Layout(this);
|
|
14487
|
+
const { props } = options.table;
|
|
14488
|
+
lodash.merge(this.states, {
|
|
14489
|
+
treeLazy: props.lazy || false,
|
|
14490
|
+
treeLazyColumnIdentifier: props.treeMap.hasChildren || "hasChildren",
|
|
14491
|
+
treeChildrenColumnName: props.treeMap.children || "children"
|
|
14492
|
+
});
|
|
14493
|
+
}
|
|
14494
|
+
setData(data) {
|
|
14495
|
+
const dataInstanceChanged = this.states._data !== data;
|
|
14496
|
+
this.states._data = data;
|
|
14497
|
+
this.states.data = data;
|
|
14498
|
+
this.states.list = data.reduce((pre, row, index) => {
|
|
14499
|
+
pre.push({
|
|
14500
|
+
rows: [
|
|
14501
|
+
{
|
|
14502
|
+
index,
|
|
14503
|
+
data: row,
|
|
14504
|
+
height: "",
|
|
14505
|
+
heightMap: {
|
|
14506
|
+
left: "",
|
|
14507
|
+
main: "",
|
|
14508
|
+
right: ""
|
|
14509
|
+
}
|
|
14510
|
+
}
|
|
14511
|
+
],
|
|
14512
|
+
expand: false
|
|
14513
|
+
});
|
|
14514
|
+
return pre;
|
|
14515
|
+
}, []);
|
|
14516
|
+
this.current.update();
|
|
14517
|
+
this.expand.update();
|
|
14518
|
+
if (!this.states.reserveSelection) {
|
|
14519
|
+
if (dataInstanceChanged) {
|
|
14520
|
+
this.clearSelection();
|
|
14521
|
+
} else {
|
|
14522
|
+
this.cleanSelection();
|
|
14523
|
+
}
|
|
14524
|
+
} else {
|
|
14525
|
+
this.checkRowKey();
|
|
14526
|
+
this.updateSelectionByRowKey();
|
|
14527
|
+
}
|
|
14528
|
+
this.updateAllSelected();
|
|
14529
|
+
this.updateTableScrollY();
|
|
14530
|
+
}
|
|
14531
|
+
rowSelectedChanged(row) {
|
|
14532
|
+
this.toggleRowSelection(row);
|
|
14533
|
+
this.updateAllSelected();
|
|
14534
|
+
}
|
|
14535
|
+
// TODO: 合并的多行管理
|
|
14536
|
+
setHoverRow(index) {
|
|
14537
|
+
this.states.hoverRowIndex = index;
|
|
14538
|
+
}
|
|
14539
|
+
setCurrentRow(row) {
|
|
14540
|
+
const oldCurrentRow = this.states.currentRow;
|
|
14541
|
+
this.states.currentRow = row;
|
|
14542
|
+
if (oldCurrentRow !== row) {
|
|
14543
|
+
this.table.emit("current-change", row, oldCurrentRow);
|
|
14544
|
+
}
|
|
14545
|
+
}
|
|
14546
|
+
/**
|
|
14547
|
+
* 检查 rowKey 是否存在
|
|
14548
|
+
*/
|
|
14549
|
+
checkRowKey() {
|
|
14550
|
+
const { rowKey } = this.table.props;
|
|
14551
|
+
}
|
|
14552
|
+
/**
|
|
14553
|
+
* states
|
|
14554
|
+
* -> _columns
|
|
14555
|
+
* -> selectable
|
|
14556
|
+
* -> reserveSelection
|
|
14557
|
+
* @param column ~
|
|
14558
|
+
* @param index ~
|
|
14559
|
+
* @param parent ~
|
|
14560
|
+
*/
|
|
14561
|
+
insertColumn(column, index, parent) {
|
|
14562
|
+
let array = this.states._columns;
|
|
14563
|
+
if (parent) {
|
|
14564
|
+
array = parent.children;
|
|
14565
|
+
if (!array) {
|
|
14566
|
+
array = [];
|
|
14567
|
+
parent.children = array;
|
|
14568
|
+
}
|
|
14569
|
+
}
|
|
14570
|
+
if (typeof index !== "undefined") {
|
|
14571
|
+
array.splice(index, 0, column);
|
|
14572
|
+
} else {
|
|
14573
|
+
array.push(column);
|
|
14574
|
+
}
|
|
14575
|
+
if (column.type === "selection") {
|
|
14576
|
+
this.states.selectable = column.selectable;
|
|
14577
|
+
this.states.reserveSelection = column.reserveSelection;
|
|
14578
|
+
}
|
|
14579
|
+
if (this.table.exposed.isReady.value) {
|
|
14580
|
+
this.updateColumns();
|
|
14581
|
+
this.scheduleLayout();
|
|
14582
|
+
}
|
|
14583
|
+
}
|
|
14584
|
+
removeColumn(column, parent) {
|
|
14585
|
+
let array = this.states._columns;
|
|
14586
|
+
if (parent) {
|
|
14587
|
+
array = parent.children || [];
|
|
14588
|
+
}
|
|
14589
|
+
if (array) {
|
|
14590
|
+
array.splice(array.indexOf(column), 1);
|
|
14591
|
+
}
|
|
14592
|
+
if (this.table.exposed.isReady.value) {
|
|
14593
|
+
this.updateColumns();
|
|
14594
|
+
this.scheduleLayout();
|
|
14595
|
+
}
|
|
14596
|
+
}
|
|
14597
|
+
/**
|
|
14598
|
+
* 更新列
|
|
14599
|
+
* leftFixedColumns: 左fixed
|
|
14600
|
+
* rightFixedColumns: 右fixed
|
|
14601
|
+
* originColumns: 中(包括左右)
|
|
14602
|
+
* columns: 展开以上
|
|
14603
|
+
* leafColumnsLength
|
|
14604
|
+
* leftFixedLeafColumnsLength
|
|
14605
|
+
* rightFixedLeafColumnsLength
|
|
14606
|
+
* isComplex: 是否包含固定列
|
|
14607
|
+
*/
|
|
14608
|
+
updateColumns() {
|
|
14609
|
+
const { states } = this;
|
|
14610
|
+
const _columns = states._columns || [];
|
|
14611
|
+
states.leftFixedColumns = _columns.filter((column) => column.fixed === true || column.fixed === "left");
|
|
14612
|
+
states.rightFixedColumns = _columns.filter((column) => column.fixed === "right");
|
|
14613
|
+
if (states.leftFixedColumns.length > 0 && _columns[0] && _columns[0].type === "selection" && !_columns[0].fixed) {
|
|
14614
|
+
_columns[0].fixed = true;
|
|
14615
|
+
states.leftFixedColumns.unshift(_columns[0]);
|
|
14616
|
+
}
|
|
14617
|
+
const notFixedColumns = _columns.filter((column) => !column.fixed);
|
|
14618
|
+
states.originColumns = lodash.concat(states.leftFixedColumns, notFixedColumns, states.rightFixedColumns);
|
|
14619
|
+
const leafColumns = flattenData(notFixedColumns);
|
|
14620
|
+
const leftFixedLeafColumns = flattenData(states.leftFixedColumns);
|
|
14621
|
+
const rightFixedLeafColumns = flattenData(states.rightFixedColumns);
|
|
14622
|
+
states.leafColumnsLength = leafColumns.length;
|
|
14623
|
+
states.leftFixedLeafColumnsLength = leftFixedLeafColumns.length;
|
|
14624
|
+
states.rightFixedLeafColumnsLength = rightFixedLeafColumns.length;
|
|
14625
|
+
states.columns = lodash.concat(leftFixedLeafColumns, leafColumns, rightFixedLeafColumns);
|
|
14626
|
+
states.isComplex = states.leftFixedColumns.length > 0 || states.rightFixedColumns.length > 0;
|
|
14627
|
+
}
|
|
14628
|
+
// 选择
|
|
14629
|
+
isSelected(row) {
|
|
14630
|
+
const { selection = [] } = this.states;
|
|
14631
|
+
return selection.includes(row);
|
|
14632
|
+
}
|
|
14633
|
+
/**
|
|
14634
|
+
* 清除选择
|
|
14635
|
+
*/
|
|
14636
|
+
clearSelection() {
|
|
14637
|
+
this.states.isAllSelected = false;
|
|
14638
|
+
const oldSelection = this.states.selection;
|
|
14639
|
+
if (this.states.selection.length) {
|
|
14640
|
+
this.states.selection = [];
|
|
14641
|
+
}
|
|
14642
|
+
if (oldSelection.length > 0) {
|
|
14643
|
+
this.table.emit("selection-change", []);
|
|
14644
|
+
}
|
|
14645
|
+
}
|
|
14646
|
+
/**
|
|
14647
|
+
* 清理选择
|
|
14648
|
+
*/
|
|
14649
|
+
cleanSelection() {
|
|
14650
|
+
const { rowKey } = this.table.props;
|
|
14651
|
+
const { selection = [] } = this.states;
|
|
14652
|
+
let deleted;
|
|
14653
|
+
if (rowKey) {
|
|
14654
|
+
deleted = [];
|
|
14655
|
+
const selectedMap = getKeysMap(selection, rowKey);
|
|
14656
|
+
const dataMap = getKeysMap(selection, rowKey);
|
|
14657
|
+
for (const key in selectedMap) {
|
|
14658
|
+
if (Utils.hasOwn(selectedMap, key) && !dataMap[key]) {
|
|
14659
|
+
deleted.push(selectedMap[key].row);
|
|
14660
|
+
}
|
|
14661
|
+
}
|
|
14662
|
+
} else {
|
|
14663
|
+
deleted = selection.filter((item) => {
|
|
14664
|
+
return !this.flattenData.value.includes(item);
|
|
14665
|
+
});
|
|
14666
|
+
}
|
|
14667
|
+
deleted.forEach((deletedItem) => {
|
|
14668
|
+
selection.splice(selection.indexOf(deletedItem), 1);
|
|
14669
|
+
});
|
|
14670
|
+
if (deleted.length) {
|
|
14671
|
+
const newSelection = selection.filter((item) => !deleted.includes(item));
|
|
14672
|
+
this.states.selection = newSelection;
|
|
14673
|
+
this.table.emit("selection-change", newSelection.slice());
|
|
14674
|
+
}
|
|
14675
|
+
}
|
|
14676
|
+
/**
|
|
14677
|
+
* 存在副作用
|
|
14678
|
+
* 对statusArr做添加和删除的操作
|
|
14679
|
+
* 如 this.states.selection
|
|
14680
|
+
* @param statusArr ~
|
|
14681
|
+
* @param row ~
|
|
14682
|
+
* @param newVal ~
|
|
14683
|
+
* @returns ~
|
|
14684
|
+
*/
|
|
14685
|
+
toggleRowStatus(statusArr, row, newVal) {
|
|
14686
|
+
let changed = false;
|
|
14687
|
+
const index = statusArr.indexOf(row);
|
|
14688
|
+
const included = index !== -1;
|
|
14689
|
+
const addRow = () => {
|
|
14690
|
+
statusArr.push(row);
|
|
14691
|
+
changed = true;
|
|
14692
|
+
};
|
|
14693
|
+
const removeRow = () => {
|
|
14694
|
+
statusArr.splice(index, 1);
|
|
14695
|
+
changed = true;
|
|
14696
|
+
};
|
|
14697
|
+
if (typeof newVal === "boolean") {
|
|
14698
|
+
if (newVal && !included) {
|
|
14699
|
+
addRow();
|
|
14700
|
+
} else if (!newVal && included) {
|
|
14701
|
+
removeRow();
|
|
14702
|
+
}
|
|
14703
|
+
} else {
|
|
14704
|
+
included ? removeRow() : addRow();
|
|
14705
|
+
}
|
|
14706
|
+
return changed;
|
|
14707
|
+
}
|
|
14708
|
+
toggleRowSelection(row, selected, emitChange = true) {
|
|
14709
|
+
const { selection } = this.states;
|
|
14710
|
+
const changed = this.toggleRowStatus(selection, row, selected);
|
|
14711
|
+
if (changed) {
|
|
14712
|
+
const newSelection = (this.states.selection || []).slice();
|
|
14713
|
+
if (emitChange) {
|
|
14714
|
+
this.table.emit("select", newSelection, row);
|
|
14715
|
+
}
|
|
14716
|
+
this.table.emit("selection-change", newSelection);
|
|
14717
|
+
}
|
|
14718
|
+
}
|
|
14719
|
+
toggleAllSelection = lodash.debounce(() => {
|
|
14720
|
+
const { indeterminate } = this.table.props;
|
|
14721
|
+
const { selection, isAllSelected, selectable } = this.states;
|
|
14722
|
+
const value = indeterminate ? !isAllSelected : !(isAllSelected || selection.length);
|
|
14723
|
+
this.states.isAllSelected = value;
|
|
14724
|
+
let selectionChanged = false;
|
|
14725
|
+
this.flattenData.value.forEach((row, index) => {
|
|
14726
|
+
if (selectable) {
|
|
14727
|
+
if (selectable.call(null, row, index) && this.toggleRowStatus(selection, row, value)) {
|
|
14728
|
+
selectionChanged = true;
|
|
14729
|
+
}
|
|
14730
|
+
} else if (this.toggleRowStatus(selection, row, value)) {
|
|
14731
|
+
selectionChanged = true;
|
|
14732
|
+
}
|
|
14733
|
+
});
|
|
14734
|
+
if (selectionChanged) {
|
|
14735
|
+
this.table.emit("selection-change", selection ? selection.slice() : []);
|
|
14736
|
+
}
|
|
14737
|
+
this.table.emit("select-all", selection);
|
|
14738
|
+
}, 10);
|
|
14739
|
+
// 展开行与 TreeTable 都要使用
|
|
14740
|
+
toggleRowExpansionAdapter(row, expanded) {
|
|
14741
|
+
const { columns } = this.states;
|
|
14742
|
+
const hasExpandColumn = columns.some(({ type }) => type === "expand");
|
|
14743
|
+
if (hasExpandColumn) {
|
|
14744
|
+
this.expand.toggle(row, expanded);
|
|
14745
|
+
} else {
|
|
14746
|
+
this.tree.toggle(row, expanded);
|
|
14747
|
+
}
|
|
14748
|
+
}
|
|
14749
|
+
// 适配层,expand-primary-keys 在 Expand 与 TreeTable 中都有使用
|
|
14750
|
+
// 这里会触发额外的计算,但为了兼容性,暂时这么做
|
|
14751
|
+
setExpandRowValueAdapter(val) {
|
|
14752
|
+
this.expand.reset(val);
|
|
14753
|
+
this.tree.expand(val);
|
|
14754
|
+
}
|
|
14755
|
+
updateSelectionByRowKey() {
|
|
14756
|
+
const { rowKey } = this.table.props;
|
|
14757
|
+
const { selection } = this.states;
|
|
14758
|
+
const selectedMap = getKeysMap(selection, rowKey);
|
|
14759
|
+
this.states.selection = this.flattenData.value.reduce((prev, row) => {
|
|
14760
|
+
const rowId = getRowIdentity(row, rowKey);
|
|
14761
|
+
const rowInfo = selectedMap[rowId];
|
|
14762
|
+
if (rowInfo) {
|
|
14763
|
+
prev.push(row);
|
|
14764
|
+
}
|
|
14765
|
+
return prev;
|
|
14766
|
+
}, []);
|
|
14767
|
+
}
|
|
14768
|
+
updateAllSelected() {
|
|
14769
|
+
const { selectable, data = [] } = this.states;
|
|
14770
|
+
if (data.length === 0) {
|
|
14771
|
+
this.states.isAllSelected = false;
|
|
14772
|
+
return;
|
|
14773
|
+
}
|
|
14774
|
+
let isAllSelected = true;
|
|
14775
|
+
let selectedCount = 0;
|
|
14776
|
+
const temp = this.flattenData.value;
|
|
14777
|
+
for (let i = 0, j = temp.length; i < j; i++) {
|
|
14778
|
+
const row = temp[i];
|
|
14779
|
+
const isRowSelectable = selectable && selectable.call(null, row, i);
|
|
14780
|
+
if (!this.isSelected(row)) {
|
|
14781
|
+
if (!selectable || isRowSelectable) {
|
|
14782
|
+
isAllSelected = false;
|
|
14783
|
+
break;
|
|
14784
|
+
}
|
|
14785
|
+
} else {
|
|
14786
|
+
selectedCount++;
|
|
14787
|
+
}
|
|
14788
|
+
}
|
|
14789
|
+
if (selectedCount === 0) isAllSelected = false;
|
|
14790
|
+
this.states.isAllSelected = isAllSelected;
|
|
14791
|
+
}
|
|
14792
|
+
updateTableScrollY() {
|
|
14793
|
+
vue.nextTick(() => this.table.exposed.updateScrollY());
|
|
14794
|
+
}
|
|
14795
|
+
// 更新 DOM
|
|
14796
|
+
scheduleLayout(needUpdateColumns) {
|
|
14797
|
+
if (needUpdateColumns) {
|
|
14798
|
+
this.updateColumns();
|
|
14799
|
+
}
|
|
14800
|
+
this.table.exposed.debouncedUpdateLayout();
|
|
14801
|
+
}
|
|
14802
|
+
}
|
|
14803
|
+
|
|
14804
|
+
const useStates = (mapper, $store) => {
|
|
14805
|
+
const instance = vue.getCurrentInstance();
|
|
14806
|
+
const store = $store || instance.proxy?.store;
|
|
14807
|
+
const states = vue.reactive({});
|
|
14808
|
+
Object.keys(mapper).forEach((key) => {
|
|
14809
|
+
const value = mapper[key];
|
|
14810
|
+
if (typeof value === "string") {
|
|
14811
|
+
states[key] = vue.computed(() => {
|
|
14812
|
+
return store.states[value];
|
|
14813
|
+
});
|
|
14814
|
+
} else if (typeof value === "function") {
|
|
14815
|
+
states[key] = vue.computed(() => {
|
|
14816
|
+
return value(store.states);
|
|
14817
|
+
});
|
|
14818
|
+
} else {
|
|
14819
|
+
console.error("invalid value type");
|
|
14820
|
+
}
|
|
14821
|
+
});
|
|
14822
|
+
return states;
|
|
14823
|
+
};
|
|
14824
|
+
|
|
14825
|
+
/** @jsxImportSource vue */
|
|
14826
|
+
|
|
14827
|
+
const COMPONENT_NAME$h = 'vc-table-normal-list';
|
|
14828
|
+
const NormalList = /* @__PURE__ */ vue.defineComponent({
|
|
14829
|
+
name: COMPONENT_NAME$h,
|
|
14830
|
+
props: {
|
|
14831
|
+
data: Array,
|
|
14832
|
+
default: () => []
|
|
14833
|
+
},
|
|
14834
|
+
emits: ['row-resize'],
|
|
14835
|
+
setup(props, {
|
|
14836
|
+
emit,
|
|
14837
|
+
slots
|
|
14838
|
+
}) {
|
|
14839
|
+
const handleResize = (size, index) => {
|
|
14840
|
+
emit('row-resize', {
|
|
14841
|
+
index,
|
|
14842
|
+
size
|
|
14843
|
+
});
|
|
14844
|
+
};
|
|
14845
|
+
return () => {
|
|
14846
|
+
return props.data.map((row, index) => {
|
|
14847
|
+
return vue.createVNode(Item, {
|
|
14848
|
+
"vertical": false,
|
|
14849
|
+
"onChange": e => handleResize(e, index)
|
|
14850
|
+
}, {
|
|
14851
|
+
default: () => [slots.default?.({
|
|
14852
|
+
row,
|
|
14853
|
+
index
|
|
14854
|
+
})]
|
|
14855
|
+
});
|
|
14856
|
+
});
|
|
14857
|
+
};
|
|
14858
|
+
}
|
|
14859
|
+
});
|
|
14860
|
+
|
|
14861
|
+
const TableBody = /* @__PURE__ */ vue.defineComponent({
|
|
14862
|
+
name: 'vc-table-body',
|
|
14863
|
+
props: {
|
|
14864
|
+
store: Object,
|
|
14865
|
+
fixed: String,
|
|
14866
|
+
heightStyle: [Object, Array, String]
|
|
14867
|
+
},
|
|
14868
|
+
emits: ['scroll'],
|
|
14869
|
+
setup(props, {
|
|
14870
|
+
emit,
|
|
14871
|
+
expose
|
|
14872
|
+
}) {
|
|
14873
|
+
const instance = vue.getCurrentInstance();
|
|
14874
|
+
const table = vcHooks.getInstance('table', 'tableId');
|
|
14875
|
+
const states = useStates({
|
|
14876
|
+
data: 'data',
|
|
14877
|
+
list: 'list',
|
|
14878
|
+
columns: 'columns',
|
|
14879
|
+
leftFixedLeafCount: 'leftFixedLeafColumnsLength',
|
|
14880
|
+
rightFixedLeafCount: 'rightFixedLeafColumnsLength',
|
|
14881
|
+
columnsCount: states$ => states$.columns.length,
|
|
14882
|
+
leftFixedCount: states$ => states$.leftFixedColumns.length,
|
|
14883
|
+
rightFixedCount: states$ => states$.rightFixedColumns.length,
|
|
14884
|
+
hasExpandColumn: states$ => states$.columns.some(({
|
|
14885
|
+
type
|
|
14886
|
+
}) => type === 'expand'),
|
|
14887
|
+
firstDefaultColumnIndex: states$ => states$.columns.findIndex(({
|
|
14888
|
+
type
|
|
14889
|
+
}) => type === 'default')
|
|
14890
|
+
});
|
|
14891
|
+
vue.watch(() => props.store.states.hoverRowIndex, (v, oldV) => {
|
|
14892
|
+
if (!props.store.states.isComplex || vcShared.IS_SERVER) return;
|
|
14893
|
+
Utils.raf(() => {
|
|
14894
|
+
const rows = instance.vnode.el.querySelectorAll('.vc-table__row');
|
|
14895
|
+
const oldRow = rows[oldV];
|
|
14896
|
+
const newRow = rows[v];
|
|
14897
|
+
oldRow && $.removeClass(oldRow, 'hover-row');
|
|
14898
|
+
newRow && $.addClass(newRow, 'hover-row');
|
|
14899
|
+
});
|
|
14900
|
+
});
|
|
14901
|
+
const getKeyOfRow = (row, index) => {
|
|
14902
|
+
const {
|
|
14903
|
+
rowKey
|
|
14904
|
+
} = table.props;
|
|
14905
|
+
if (rowKey) {
|
|
14906
|
+
return getRowIdentity(row, rowKey);
|
|
14907
|
+
}
|
|
14908
|
+
return index;
|
|
14909
|
+
};
|
|
14910
|
+
const isColumnHidden = index => {
|
|
14911
|
+
if (props.fixed === 'left') {
|
|
14912
|
+
return index >= states.leftFixedLeafCount;
|
|
14913
|
+
} else if (props.fixed === 'right') {
|
|
14914
|
+
return index < states.columnsCount - states.rightFixedLeafCount;
|
|
14915
|
+
} else {
|
|
14916
|
+
return index < states.leftFixedLeafCount || index >= states.columnsCount - states.rightFixedLeafCount;
|
|
14917
|
+
}
|
|
14918
|
+
};
|
|
14919
|
+
const columnsHidden = vue.computed(() => {
|
|
14920
|
+
return states.columns.map((_, index) => isColumnHidden(index));
|
|
14921
|
+
});
|
|
14922
|
+
const getRowStyle = (row, rowIndex) => {
|
|
14923
|
+
const {
|
|
14924
|
+
rowStyle
|
|
14925
|
+
} = table.props;
|
|
14926
|
+
if (typeof rowStyle === 'function') {
|
|
14927
|
+
return rowStyle.call(null, {
|
|
14928
|
+
row,
|
|
14929
|
+
rowIndex
|
|
14930
|
+
});
|
|
14931
|
+
}
|
|
14932
|
+
return rowStyle || null;
|
|
14933
|
+
};
|
|
14934
|
+
const getRowClass = (row, rowIndex) => {
|
|
14935
|
+
const classes = ['vc-table__row'];
|
|
14936
|
+
if (table.props.highlight && row === props.store.states.currentRow) {
|
|
14937
|
+
classes.push('current-row');
|
|
14938
|
+
}
|
|
14939
|
+
if (table.props.stripe && rowIndex % 2 === 1) {
|
|
14940
|
+
classes.push('vc-table__row--striped');
|
|
14941
|
+
}
|
|
14942
|
+
const rowClass = table.props.rowClass;
|
|
14943
|
+
if (typeof rowClass === 'string') {
|
|
14944
|
+
classes.push(rowClass);
|
|
14945
|
+
} else if (typeof rowClass === 'function') {
|
|
14946
|
+
classes.push(rowClass.call(null, {
|
|
14947
|
+
row,
|
|
14948
|
+
rowIndex
|
|
14949
|
+
}));
|
|
14950
|
+
}
|
|
14951
|
+
if (props.store.states.expandRows.indexOf(row) > -1) {
|
|
14952
|
+
classes.push('expanded');
|
|
14953
|
+
}
|
|
14954
|
+
return classes;
|
|
14955
|
+
};
|
|
14956
|
+
const getCellStyle = (rowIndex, columnIndex, row, column) => {
|
|
14957
|
+
const {
|
|
14958
|
+
cellStyle
|
|
14959
|
+
} = table.props;
|
|
14960
|
+
if (typeof cellStyle === 'function') {
|
|
14961
|
+
return cellStyle.call(null, {
|
|
14962
|
+
rowIndex,
|
|
14963
|
+
columnIndex,
|
|
14964
|
+
row,
|
|
14965
|
+
column
|
|
14966
|
+
});
|
|
14967
|
+
}
|
|
14968
|
+
return cellStyle;
|
|
14969
|
+
};
|
|
14970
|
+
const getCellClass = (rowIndex, columnIndex, row, column) => {
|
|
14971
|
+
const classes = [column.align, column.className];
|
|
14972
|
+
if (isColumnHidden(columnIndex)) {
|
|
14973
|
+
classes.push('is-hidden');
|
|
14974
|
+
}
|
|
14975
|
+
const cellClass = table.props.cellClass;
|
|
14976
|
+
if (typeof cellClass === 'string') {
|
|
14977
|
+
classes.push(cellClass);
|
|
14978
|
+
} else if (typeof cellClass === 'function') {
|
|
14979
|
+
classes.push(cellClass.call(null, {
|
|
14980
|
+
rowIndex,
|
|
14981
|
+
columnIndex,
|
|
14982
|
+
row,
|
|
14983
|
+
column
|
|
14984
|
+
}));
|
|
14985
|
+
}
|
|
14986
|
+
return classes.join(' ');
|
|
14987
|
+
};
|
|
14988
|
+
const handleCellMouseEnter = (e, row) => {
|
|
14989
|
+
const cell = getCell(e);
|
|
14990
|
+
if (cell) {
|
|
14991
|
+
const column = getColumnByCell(states.columns, cell);
|
|
14992
|
+
const hoverState = {
|
|
14993
|
+
cell,
|
|
14994
|
+
column,
|
|
14995
|
+
row
|
|
14996
|
+
};
|
|
14997
|
+
table.exposed.hoverState.value = hoverState;
|
|
14998
|
+
table.emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, e);
|
|
14999
|
+
}
|
|
15000
|
+
|
|
15001
|
+
// 判断是否text-overflow, 如果是就显示tooltip
|
|
15002
|
+
const cellChild = e.target.querySelector('.vc-table__cell');
|
|
15003
|
+
if (!($.hasClass(cellChild, 'vc-popover') && cellChild.childNodes.length)) {
|
|
15004
|
+
return;
|
|
15005
|
+
}
|
|
15006
|
+
// 使用范围宽度而不是滚动宽度来确定文本是否溢出,以解决潜在的FireFox bug
|
|
15007
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1074543#c3
|
|
15008
|
+
const range = document.createRange();
|
|
15009
|
+
range.setStart(cellChild, 0);
|
|
15010
|
+
range.setEnd(cellChild, cellChild.childNodes.length);
|
|
15011
|
+
const rangeWidth = range.getBoundingClientRect().width;
|
|
15012
|
+
const padding = (parseInt(cellChild.style.paddingLeft, 10) || 0) + (parseInt(cellChild.style.paddingRight, 10) || 0);
|
|
15013
|
+
if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
|
|
15014
|
+
Popover.open({
|
|
15015
|
+
el: document.body,
|
|
15016
|
+
name: 'vc-table-popover',
|
|
15017
|
+
// 确保不重复创建
|
|
15018
|
+
triggerEl: cell,
|
|
15019
|
+
hover: true,
|
|
15020
|
+
theme: 'dark',
|
|
15021
|
+
placement: 'top',
|
|
15022
|
+
content: cell.innerText || cell.textContent,
|
|
15023
|
+
alone: true
|
|
15024
|
+
});
|
|
15025
|
+
}
|
|
15026
|
+
};
|
|
15027
|
+
const handleCellMouseLeave = e => {
|
|
15028
|
+
const cell = getCell(e);
|
|
15029
|
+
if (!cell) return;
|
|
15030
|
+
const oldHoverState = table.exposed.hoverState.value || {};
|
|
15031
|
+
table.emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, event);
|
|
15032
|
+
};
|
|
15033
|
+
const handleMouseEnter = lodashEs.debounce(index => {
|
|
15034
|
+
props.store.setHoverRow(index);
|
|
15035
|
+
}, 30);
|
|
15036
|
+
const handleMouseLeave = lodashEs.debounce(() => {
|
|
15037
|
+
props.store.setHoverRow(null);
|
|
15038
|
+
}, 30);
|
|
15039
|
+
const handleEvent = (e, row, name) => {
|
|
15040
|
+
const cell = getCell(e);
|
|
15041
|
+
let column;
|
|
15042
|
+
if (cell) {
|
|
15043
|
+
column = getColumnByCell(states.columns, cell);
|
|
15044
|
+
if (column) {
|
|
15045
|
+
table.emit(`cell-${name}`, row, column, cell, e);
|
|
15046
|
+
}
|
|
15047
|
+
}
|
|
15048
|
+
table.emit(`row-${name}`, row, column, e);
|
|
15049
|
+
};
|
|
15050
|
+
const handleContextMenu = (e, row) => {
|
|
15051
|
+
handleEvent(e, row, 'contextmenu');
|
|
15052
|
+
};
|
|
15053
|
+
const handleDoubleClick = (e, row) => {
|
|
15054
|
+
handleEvent(e, row, 'dblclick');
|
|
15055
|
+
};
|
|
15056
|
+
const handleClick = (e, row) => {
|
|
15057
|
+
props.store.setCurrentRow(row);
|
|
15058
|
+
handleEvent(e, row, 'click');
|
|
15059
|
+
};
|
|
15060
|
+
const renderRow = (rowData, rowIndex) => {
|
|
15061
|
+
const {
|
|
15062
|
+
data: row
|
|
15063
|
+
} = rowData;
|
|
15064
|
+
const {
|
|
15065
|
+
columns
|
|
15066
|
+
} = states;
|
|
15067
|
+
const key = getKeyOfRow(row, rowIndex);
|
|
15068
|
+
return vue.createVNode("div", {
|
|
15069
|
+
"key": key,
|
|
15070
|
+
"class": [getRowClass(row, rowIndex), 'vc-table__tr'],
|
|
15071
|
+
"style": getRowStyle(row, rowIndex),
|
|
15072
|
+
"onDblclick": e => handleDoubleClick(e, row),
|
|
15073
|
+
"onClick": e => handleClick(e, row),
|
|
15074
|
+
"onContextmenu": e => handleContextMenu(e, row),
|
|
15075
|
+
"onMouseenter": () => handleMouseEnter(rowIndex),
|
|
15076
|
+
"onMouseleave": () => handleMouseLeave()
|
|
15077
|
+
}, [columns.map((column, columnIndex) => {
|
|
15078
|
+
const {
|
|
15079
|
+
realWidth,
|
|
15080
|
+
renderCell
|
|
15081
|
+
} = column;
|
|
15082
|
+
const sizeStyle = {
|
|
15083
|
+
width: `${realWidth}px`,
|
|
15084
|
+
height: `${rowData.height ? `${rowData.height}px` : 'auto'}`
|
|
15085
|
+
};
|
|
15086
|
+
if (columnsHidden.value[columnIndex]) {
|
|
15087
|
+
return vue.createVNode("div", {
|
|
15088
|
+
"style": [sizeStyle]
|
|
15089
|
+
}, null);
|
|
15090
|
+
}
|
|
15091
|
+
return vue.createVNode("div", {
|
|
15092
|
+
"style": [getCellStyle(rowIndex, columnIndex, row, column), sizeStyle],
|
|
15093
|
+
"class": [getCellClass(rowIndex, columnIndex, row, column), 'vc-table__td'],
|
|
15094
|
+
"onMouseenter": e => handleCellMouseEnter(e, row),
|
|
15095
|
+
"onMouseleave": e => handleCellMouseLeave(e)
|
|
15096
|
+
}, [renderCell({
|
|
15097
|
+
row,
|
|
15098
|
+
column,
|
|
15099
|
+
rowIndex,
|
|
15100
|
+
columnIndex,
|
|
15101
|
+
store: props.store
|
|
15102
|
+
})]);
|
|
15103
|
+
})]);
|
|
15104
|
+
};
|
|
15105
|
+
const renderMergeRow = (mergeData, mergeIndex) => {
|
|
15106
|
+
const {
|
|
15107
|
+
rows
|
|
15108
|
+
} = mergeData;
|
|
15109
|
+
return vue.createVNode("div", {
|
|
15110
|
+
"class": "vc-table__merge-row",
|
|
15111
|
+
"key": mergeIndex
|
|
15112
|
+
}, [rows.map(row => {
|
|
15113
|
+
return renderRow(row, row.index);
|
|
15114
|
+
})]);
|
|
15115
|
+
};
|
|
15116
|
+
const handleMergeRowResize = v => {
|
|
15117
|
+
states.list[v.index].rows.forEach(row => {
|
|
15118
|
+
row.heightMap[props.fixed || 'main'] = v.size;
|
|
15119
|
+
const heights = [row.heightMap.main];
|
|
15120
|
+
if (states.leftFixedCount) {
|
|
15121
|
+
heights.push(row.heightMap.left);
|
|
15122
|
+
}
|
|
15123
|
+
if (states.rightFixedCount) {
|
|
15124
|
+
heights.push(row.heightMap.right);
|
|
15125
|
+
}
|
|
15126
|
+
if (heights.every(i => !!i)) {
|
|
15127
|
+
row.height = Math.max(row.heightMap.left, row.heightMap.main, row.heightMap.right) || '';
|
|
15128
|
+
}
|
|
15129
|
+
});
|
|
15130
|
+
};
|
|
15131
|
+
const wrapper = vue.ref();
|
|
15132
|
+
expose({
|
|
15133
|
+
wrapper,
|
|
15134
|
+
getRootElement: () => instance.vnode.el
|
|
15135
|
+
});
|
|
15136
|
+
return () => {
|
|
15137
|
+
const layout = table.exposed.layout;
|
|
15138
|
+
return vue.createVNode("div", {
|
|
15139
|
+
"class": "vc-table__body"
|
|
15140
|
+
}, [table.props.height ? vue.createVNode(RecycleList, {
|
|
15141
|
+
"ref": wrapper,
|
|
15142
|
+
"data": states.list,
|
|
15143
|
+
"disabled": true,
|
|
15144
|
+
"class": "vc-table__tbody",
|
|
15145
|
+
"scrollerOptions": {
|
|
15146
|
+
barTo: `.${table.exposed.tableId}`,
|
|
15147
|
+
native: false,
|
|
15148
|
+
always: false,
|
|
15149
|
+
showBar: !props.fixed,
|
|
15150
|
+
stopPropagation: !props.fixed,
|
|
15151
|
+
trackOffsetY: [layout.states.headerHeight, 0, -layout.states.headerHeight - layout.states.footerHeight + 2,
|
|
15152
|
+
// 2为上下border的高度
|
|
15153
|
+
0]
|
|
15154
|
+
},
|
|
15155
|
+
"pageSize": table.props.rows,
|
|
15156
|
+
"onScroll": e => emit('scroll', e),
|
|
15157
|
+
"onRowResize": handleMergeRowResize,
|
|
15158
|
+
"style": props.heightStyle
|
|
15159
|
+
}, {
|
|
15160
|
+
default: ({
|
|
15161
|
+
row,
|
|
15162
|
+
index
|
|
15163
|
+
}) => renderMergeRow(row, index)
|
|
15164
|
+
}) : vue.createVNode(NormalList, {
|
|
15165
|
+
"data": states.list,
|
|
15166
|
+
"onRowResize": handleMergeRowResize
|
|
15167
|
+
}, {
|
|
15168
|
+
default: ({
|
|
15169
|
+
row,
|
|
15170
|
+
index
|
|
15171
|
+
}) => renderMergeRow(row, index)
|
|
15172
|
+
})]);
|
|
15173
|
+
};
|
|
15174
|
+
}
|
|
15175
|
+
});
|
|
15176
|
+
|
|
15177
|
+
// import TableSort from './table-sort';
|
|
15178
|
+
// import TableFilter from './table-filter';
|
|
15179
|
+
|
|
15180
|
+
const TableSort = 'div';
|
|
15181
|
+
const TableFilter = 'div';
|
|
15182
|
+
const getAllColumns = columns => {
|
|
15183
|
+
const result = [];
|
|
15184
|
+
columns.forEach(column => {
|
|
15185
|
+
if (column.children) {
|
|
15186
|
+
result.push(column);
|
|
15187
|
+
result.push(...getAllColumns(column.children));
|
|
15188
|
+
} else {
|
|
15189
|
+
result.push(column);
|
|
15190
|
+
}
|
|
15191
|
+
});
|
|
15192
|
+
return result;
|
|
15193
|
+
};
|
|
15194
|
+
const convertToRows = originColumns => {
|
|
15195
|
+
let maxLevel = 1;
|
|
15196
|
+
const traverse = (column, parent) => {
|
|
15197
|
+
if (parent) {
|
|
15198
|
+
column.level = parent.level + 1;
|
|
15199
|
+
if (maxLevel < column.level) {
|
|
15200
|
+
maxLevel = column.level;
|
|
15201
|
+
}
|
|
15202
|
+
}
|
|
15203
|
+
if (column.children) {
|
|
15204
|
+
let colSpan = 0;
|
|
15205
|
+
column.children.forEach(subColumn => {
|
|
15206
|
+
traverse(subColumn, column);
|
|
15207
|
+
colSpan += subColumn.colSpan;
|
|
15208
|
+
});
|
|
15209
|
+
column.colSpan = colSpan;
|
|
15210
|
+
} else {
|
|
15211
|
+
column.colSpan = 1;
|
|
15212
|
+
}
|
|
15213
|
+
};
|
|
15214
|
+
originColumns.forEach(column => {
|
|
15215
|
+
column.level = 1;
|
|
15216
|
+
traverse(column);
|
|
15217
|
+
});
|
|
15218
|
+
const rows = [];
|
|
15219
|
+
for (let i = 0; i < maxLevel; i++) {
|
|
15220
|
+
rows.push([]);
|
|
15221
|
+
}
|
|
15222
|
+
const allColumns = getAllColumns(originColumns);
|
|
15223
|
+
allColumns.forEach(column => {
|
|
15224
|
+
if (!column.children) {
|
|
15225
|
+
column.rowSpan = maxLevel - column.level + 1;
|
|
15226
|
+
} else {
|
|
15227
|
+
column.rowSpan = 1;
|
|
15228
|
+
}
|
|
15229
|
+
rows[column.level - 1].push(column);
|
|
15230
|
+
});
|
|
15231
|
+
return rows;
|
|
15232
|
+
};
|
|
15233
|
+
const TableHeader = /* @__PURE__ */ vue.defineComponent({
|
|
15234
|
+
name: 'vc-table-header',
|
|
15235
|
+
props: {
|
|
15236
|
+
fixed: [Boolean, String],
|
|
15237
|
+
store: {
|
|
15238
|
+
type: Object,
|
|
15239
|
+
required: true
|
|
15240
|
+
},
|
|
15241
|
+
border: Boolean,
|
|
15242
|
+
// 排序全部交给外部处理,内部不处理数据,只做交互
|
|
15243
|
+
defaultSort: {
|
|
15244
|
+
type: Object,
|
|
15245
|
+
default: () => ({})
|
|
15246
|
+
}
|
|
15247
|
+
},
|
|
15248
|
+
setup(props) {
|
|
15249
|
+
const table = vcHooks.getInstance('table', 'tableId');
|
|
15250
|
+
const instance = vue.getCurrentInstance();
|
|
15251
|
+
const draggingColumn = vue.ref(null);
|
|
15252
|
+
const dragging = vue.ref(false);
|
|
15253
|
+
const dragState = vue.ref({});
|
|
15254
|
+
const states = useStates({
|
|
15255
|
+
columns: 'columns',
|
|
15256
|
+
isAllSelected: 'isAllSelected',
|
|
15257
|
+
leftFixedLeafCount: 'leftFixedLeafColumnsLength',
|
|
15258
|
+
rightFixedLeafCount: 'rightFixedLeafColumnsLength',
|
|
15259
|
+
columnsCount: $states => $states.columns.length,
|
|
15260
|
+
leftFixedCount: $states => $states.leftFixedColumns.length,
|
|
15261
|
+
rightFixedCount: $states => $states.rightFixedColumns.length
|
|
15262
|
+
});
|
|
15263
|
+
const isCellHidden = (index, columns) => {
|
|
15264
|
+
let start = 0;
|
|
15265
|
+
for (let i = 0; i < index; i++) {
|
|
15266
|
+
start += columns[i].colSpan;
|
|
15267
|
+
}
|
|
15268
|
+
const after = start + columns[index].colSpan - 1;
|
|
15269
|
+
if (props.fixed === true || props.fixed === 'left') {
|
|
15270
|
+
return after >= states.leftFixedLeafCount;
|
|
15271
|
+
} else if (props.fixed === 'right') {
|
|
15272
|
+
return start < states.columnsCount - states.rightFixedLeafCount;
|
|
15273
|
+
} else {
|
|
15274
|
+
return after < states.leftFixedLeafCount || start >= states.columnsCount - states.rightFixedLeafCount;
|
|
15275
|
+
}
|
|
15276
|
+
};
|
|
15277
|
+
const getHeaderRowStyle = rowIndex => {
|
|
15278
|
+
const {
|
|
15279
|
+
headerRowStyle
|
|
15280
|
+
} = table.props;
|
|
15281
|
+
if (typeof headerRowStyle === 'function') {
|
|
15282
|
+
return headerRowStyle.call(null, {
|
|
15283
|
+
rowIndex
|
|
15284
|
+
});
|
|
15285
|
+
}
|
|
15286
|
+
return headerRowStyle;
|
|
15287
|
+
};
|
|
15288
|
+
const getHeaderRowClass = rowIndex => {
|
|
15289
|
+
const classes = [];
|
|
15290
|
+
const {
|
|
15291
|
+
headerRowClass
|
|
15292
|
+
} = table.props;
|
|
15293
|
+
if (typeof headerRowClass === 'string') {
|
|
15294
|
+
classes.push(headerRowClass);
|
|
15295
|
+
} else if (typeof headerRowClass === 'function') {
|
|
15296
|
+
classes.push(headerRowClass.call(null, {
|
|
15297
|
+
rowIndex
|
|
15298
|
+
}));
|
|
15299
|
+
}
|
|
15300
|
+
return classes.join(' ');
|
|
15301
|
+
};
|
|
15302
|
+
const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
|
|
15303
|
+
const {
|
|
15304
|
+
headerCellStyle
|
|
15305
|
+
} = table.props;
|
|
15306
|
+
if (typeof headerCellStyle === 'function') {
|
|
15307
|
+
return headerCellStyle.call(null, {
|
|
15308
|
+
rowIndex,
|
|
15309
|
+
columnIndex,
|
|
15310
|
+
row,
|
|
15311
|
+
column
|
|
15312
|
+
});
|
|
15313
|
+
}
|
|
15314
|
+
return headerCellStyle;
|
|
15315
|
+
};
|
|
15316
|
+
const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
|
|
15317
|
+
const classes = [column.id, column.order, column.headerAlign, column.className, column.labelClass];
|
|
15318
|
+
if (rowIndex === 0 && isCellHidden(columnIndex, row)) {
|
|
15319
|
+
classes.push('is-hidden');
|
|
15320
|
+
}
|
|
15321
|
+
if (!column.children) {
|
|
15322
|
+
classes.push('is-leaf');
|
|
15323
|
+
}
|
|
15324
|
+
const {
|
|
15325
|
+
headerCellClass
|
|
15326
|
+
} = table.props;
|
|
15327
|
+
if (typeof headerCellClass === 'string') {
|
|
15328
|
+
classes.push(headerCellClass);
|
|
15329
|
+
} else if (typeof headerCellClass === 'function') {
|
|
15330
|
+
classes.push(headerCellClass.call(null, {
|
|
15331
|
+
rowIndex,
|
|
15332
|
+
columnIndex,
|
|
15333
|
+
row,
|
|
15334
|
+
column
|
|
15335
|
+
}));
|
|
15336
|
+
}
|
|
15337
|
+
return classes.join(' ');
|
|
15338
|
+
};
|
|
15339
|
+
const handleHeaderClick = (e, column) => {
|
|
15340
|
+
table.emit('header-click', column, e);
|
|
15341
|
+
};
|
|
15342
|
+
const handleHeaderContextMenu = (e, column) => {
|
|
15343
|
+
table.emit('header-contextmenu', column, e);
|
|
15344
|
+
};
|
|
15345
|
+
const handleMouseDown = (e, column) => {
|
|
15346
|
+
if (vcShared.IS_SERVER) return;
|
|
15347
|
+
if (column.children && column.children.length > 0) return;
|
|
15348
|
+
/* istanbul ignore if */
|
|
15349
|
+
if (draggingColumn.value && props.border) {
|
|
15350
|
+
dragging.value = true;
|
|
15351
|
+
table.exposed.resizeProxyVisible.value = true;
|
|
15352
|
+
const tableEl = table.vnode.el;
|
|
15353
|
+
const tableLeft = tableEl.getBoundingClientRect().left;
|
|
15354
|
+
const columnEl = instance.vnode.el.querySelector(`.vc-table__th.${column.id}`);
|
|
15355
|
+
const columnRect = columnEl.getBoundingClientRect();
|
|
15356
|
+
const minLeft = columnRect.left - tableLeft + 30;
|
|
15357
|
+
$.addClass(columnEl, 'noclick');
|
|
15358
|
+
dragState.value = {
|
|
15359
|
+
startMouseLeft: e.clientX,
|
|
15360
|
+
startLeft: columnRect.right - tableLeft,
|
|
15361
|
+
startColumnLeft: columnRect.left - tableLeft,
|
|
15362
|
+
tableLeft
|
|
15363
|
+
};
|
|
15364
|
+
const resizeProxy = table.exposed.resizeProxy.value;
|
|
15365
|
+
resizeProxy.style.left = dragState.value.startLeft + 'px';
|
|
15366
|
+
document.onselectstart = () => false;
|
|
15367
|
+
document.ondragstart = () => false;
|
|
15368
|
+
const handleMouseMove = $e => {
|
|
15369
|
+
const deltaLeft = $e.clientX - dragState.value.startMouseLeft;
|
|
15370
|
+
const proxyLeft = dragState.value.startLeft + deltaLeft;
|
|
15371
|
+
resizeProxy.style.left = Math.max(minLeft, proxyLeft) + 'px';
|
|
15372
|
+
};
|
|
15373
|
+
const handleMouseUp = () => {
|
|
15374
|
+
if (dragging.value) {
|
|
15375
|
+
const {
|
|
15376
|
+
startColumnLeft,
|
|
15377
|
+
startLeft
|
|
15378
|
+
} = dragState.value;
|
|
15379
|
+
const finalLeft = parseInt(resizeProxy.style.left, 10);
|
|
15380
|
+
const columnWidth = finalLeft - startColumnLeft;
|
|
15381
|
+
column.width = columnWidth;
|
|
15382
|
+
column.realWidth = column.width;
|
|
15383
|
+
table.$emit('header-dragend', column.width, startLeft - startColumnLeft, column, event);
|
|
15384
|
+
props.store.scheduleLayout();
|
|
15385
|
+
document.body.style.cursor = '';
|
|
15386
|
+
dragging.value = false;
|
|
15387
|
+
draggingColumn.value = null;
|
|
15388
|
+
dragState.value = {};
|
|
15389
|
+
table.resizeProxyVisible = false;
|
|
15390
|
+
}
|
|
15391
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
15392
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
15393
|
+
document.onselectstart = null;
|
|
15394
|
+
document.ondragstart = null;
|
|
15395
|
+
setTimeout(function () {
|
|
15396
|
+
$.removeClass(columnEl, 'noclick');
|
|
15397
|
+
}, 0);
|
|
15398
|
+
};
|
|
15399
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
15400
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
15401
|
+
}
|
|
15402
|
+
};
|
|
15403
|
+
const handleMouseMove = (event, column) => {
|
|
15404
|
+
if (column.children && column.children.length > 0) return;
|
|
15405
|
+
let target = event.target;
|
|
15406
|
+
while (target && !target.classList?.contains?.('vc-table__th')) {
|
|
15407
|
+
target = target.parentNode;
|
|
15408
|
+
}
|
|
15409
|
+
if (!column || !column.resizable) return;
|
|
15410
|
+
if (!dragging.value && props.border) {
|
|
15411
|
+
const rect = target.getBoundingClientRect();
|
|
15412
|
+
const bodyStyle = document.body.style;
|
|
15413
|
+
if (rect.width > 12 && rect.right - event.pageX < 8) {
|
|
15414
|
+
bodyStyle.cursor = 'col-resize';
|
|
15415
|
+
if ($.hasClass(target, 'is-sortable')) {
|
|
15416
|
+
target.style.cursor = 'col-resize';
|
|
15417
|
+
}
|
|
15418
|
+
draggingColumn.value = column;
|
|
15419
|
+
} else if (!dragging.value) {
|
|
15420
|
+
bodyStyle.cursor = '';
|
|
15421
|
+
if ($.hasClass(target, 'is-sortable')) {
|
|
15422
|
+
target.style.cursor = 'pointer';
|
|
15423
|
+
}
|
|
15424
|
+
draggingColumn.value = null;
|
|
15425
|
+
}
|
|
15426
|
+
}
|
|
15427
|
+
};
|
|
15428
|
+
const handleMouseOut = () => {
|
|
15429
|
+
if (vcShared.IS_SERVER) return;
|
|
15430
|
+
document.body.style.cursor = '';
|
|
15431
|
+
};
|
|
15432
|
+
const handleSort = (prop, order) => {
|
|
15433
|
+
table.emit('sort-change', {
|
|
15434
|
+
prop,
|
|
15435
|
+
order
|
|
15436
|
+
});
|
|
15437
|
+
};
|
|
15438
|
+
const handleFilter = (column, value) => {
|
|
15439
|
+
const {
|
|
15440
|
+
filter
|
|
15441
|
+
} = column;
|
|
15442
|
+
filter && filter(value);
|
|
15443
|
+
};
|
|
15444
|
+
const handleCellMouseEnter = (e, column) => {
|
|
15445
|
+
Popover.open({
|
|
15446
|
+
el: document.body,
|
|
15447
|
+
name: 'vc-table-header-popover',
|
|
15448
|
+
// 确保不重复创建
|
|
15449
|
+
triggerEl: e.currentTarget,
|
|
15450
|
+
hover: true,
|
|
15451
|
+
theme: 'dark',
|
|
15452
|
+
placement: 'top',
|
|
15453
|
+
content: column.tooltip,
|
|
15454
|
+
alone: true
|
|
15455
|
+
});
|
|
15456
|
+
};
|
|
15457
|
+
return () => {
|
|
15458
|
+
const {
|
|
15459
|
+
originColumns
|
|
15460
|
+
} = props.store.states;
|
|
15461
|
+
const columnRows = convertToRows(originColumns);
|
|
15462
|
+
|
|
15463
|
+
// 是否拥有多级表头
|
|
15464
|
+
const isGroup = columnRows.length > 1;
|
|
15465
|
+
if (isGroup) table.exposed.isGroup.value = true;
|
|
15466
|
+
return vue.createVNode("div", {
|
|
15467
|
+
"class": "vc-table__header"
|
|
15468
|
+
}, [vue.createVNode("div", {
|
|
15469
|
+
"class": [{
|
|
15470
|
+
'is-group': isGroup
|
|
15471
|
+
}, 'vc-table__thead']
|
|
15472
|
+
}, [
|
|
15473
|
+
// renderList
|
|
15474
|
+
columnRows.map((columns, rowIndex) => vue.createVNode("div", {
|
|
15475
|
+
"style": getHeaderRowStyle(rowIndex),
|
|
15476
|
+
"class": [getHeaderRowClass(rowIndex), 'vc-table__tr']
|
|
15477
|
+
}, [columns.map((column, cellIndex) => vue.createVNode("div", {
|
|
15478
|
+
"colspan": column.colSpan,
|
|
15479
|
+
"rowspan": column.rowSpan,
|
|
15480
|
+
"onMousemove": $event => handleMouseMove($event, column),
|
|
15481
|
+
"onMouseout": handleMouseOut,
|
|
15482
|
+
"onMousedown": $event => handleMouseDown($event, column),
|
|
15483
|
+
"onClick": $event => handleHeaderClick($event, column),
|
|
15484
|
+
"onContextmenu": $event => handleHeaderContextMenu($event, column),
|
|
15485
|
+
"style": [getHeaderCellStyle(rowIndex, cellIndex, columns, column), {
|
|
15486
|
+
width: `${column.realWidth}px`
|
|
15487
|
+
}],
|
|
15488
|
+
"class": [getHeaderCellClass(rowIndex, cellIndex, columns, column), 'vc-table__th'],
|
|
15489
|
+
"key": column.id
|
|
15490
|
+
}, [vue.createVNode("div", {
|
|
15491
|
+
"class": ['vc-table__cell',
|
|
15492
|
+
// {
|
|
15493
|
+
// "highlight": column.filteredValue && column.filteredValue.length > 0
|
|
15494
|
+
// },
|
|
15495
|
+
column.labelClass]
|
|
15496
|
+
}, [column.renderHeader ? column.renderHeader({
|
|
15497
|
+
column,
|
|
15498
|
+
$index: cellIndex,
|
|
15499
|
+
// index: cellIndex,
|
|
15500
|
+
store: props.store,
|
|
15501
|
+
_self: instance
|
|
15502
|
+
}) : column.label, column.tooltip ? vue.createVNode(Icon, {
|
|
15503
|
+
"type": "o-info",
|
|
15504
|
+
"onMouseenter": e => handleCellMouseEnter(e, column)
|
|
15505
|
+
}, null) : null, column.sortable ? vue.createVNode(TableSort, {
|
|
15506
|
+
"order": column.prop === props.defaultSort.prop ? props.defaultSort.order : '',
|
|
15507
|
+
"onClick": order => handleSort(column.prop, order)
|
|
15508
|
+
}, null) : null, column.filters ? vue.createVNode(TableFilter, {
|
|
15509
|
+
"data": column.filters,
|
|
15510
|
+
"value": column.filteredValue,
|
|
15511
|
+
"icon": column.filterIcon,
|
|
15512
|
+
"portalClass": column.filterPopupClass,
|
|
15513
|
+
"multiple": column.filterMultiple,
|
|
15514
|
+
"onChange": v => handleFilter(column, v)
|
|
15515
|
+
}, null) : null])]))]))])]);
|
|
15516
|
+
};
|
|
15517
|
+
}
|
|
15518
|
+
});
|
|
15519
|
+
|
|
15520
|
+
const TableFooter = /* @__PURE__ */ vue.defineComponent({
|
|
15521
|
+
name: 'vc-table-footer',
|
|
15522
|
+
props: {
|
|
15523
|
+
fixed: [String, Boolean],
|
|
15524
|
+
store: {
|
|
15525
|
+
type: Object,
|
|
15526
|
+
required: true
|
|
15527
|
+
},
|
|
15528
|
+
getSummary: Function,
|
|
15529
|
+
sumText: String,
|
|
15530
|
+
border: Boolean
|
|
15531
|
+
},
|
|
15532
|
+
setup(props) {
|
|
15533
|
+
const states = useStates({
|
|
15534
|
+
data: 'data',
|
|
15535
|
+
columns: 'columns',
|
|
15536
|
+
isAllSelected: 'isAllSelected',
|
|
15537
|
+
leftFixedLeafCount: 'leftFixedLeafColumnsLength',
|
|
15538
|
+
rightFixedLeafCount: 'rightFixedLeafColumnsLength',
|
|
15539
|
+
columnsCount: $states => $states.columns.length,
|
|
15540
|
+
leftFixedCount: $states => $states.leftFixedColumns.length,
|
|
15541
|
+
rightFixedCount: $states => $states.rightFixedColumns.length
|
|
15542
|
+
});
|
|
15543
|
+
const isCellHidden = (index, columns, column) => {
|
|
15544
|
+
if (props.fixed === true || props.fixed === 'left') {
|
|
15545
|
+
return index >= states.leftFixedLeafCount;
|
|
15546
|
+
} else if (props.fixed === 'right') {
|
|
15547
|
+
let before = 0;
|
|
15548
|
+
for (let i = 0; i < index; i++) {
|
|
15549
|
+
before += columns[i].colSpan;
|
|
15550
|
+
}
|
|
15551
|
+
return before < states.columnsCount - states.rightFixedLeafCount;
|
|
15552
|
+
} else if (!props.fixed && column.fixed) {
|
|
15553
|
+
// hide cell when footer instance is not fixed and column is fixed
|
|
15554
|
+
return true;
|
|
15555
|
+
} else {
|
|
15556
|
+
return index < states.leftFixedCount || index >= states.columnsCount - states.rightFixedCount;
|
|
15557
|
+
}
|
|
15558
|
+
};
|
|
15559
|
+
const getRowClasses = (column, cellIndex) => {
|
|
15560
|
+
const classes = [column.id, column.align, column.labelClass];
|
|
15561
|
+
if (column.className) {
|
|
15562
|
+
classes.push(column.className);
|
|
15563
|
+
}
|
|
15564
|
+
if (isCellHidden(cellIndex, states.columns, column)) {
|
|
15565
|
+
classes.push('is-hidden');
|
|
15566
|
+
}
|
|
15567
|
+
if (!column.children) {
|
|
15568
|
+
classes.push('is-leaf');
|
|
15569
|
+
}
|
|
15570
|
+
return classes;
|
|
15571
|
+
};
|
|
15572
|
+
return () => {
|
|
15573
|
+
let sums = [];
|
|
15574
|
+
if (props.getSummary) {
|
|
15575
|
+
sums = props.getSummary({
|
|
15576
|
+
columns: states.columns,
|
|
15577
|
+
data: states.data
|
|
15578
|
+
});
|
|
15579
|
+
} else {
|
|
15580
|
+
states.columns.forEach((column, index) => {
|
|
15581
|
+
if (index === 0) {
|
|
15582
|
+
sums[index] = props.sumText;
|
|
15583
|
+
return;
|
|
15584
|
+
}
|
|
15585
|
+
const values = states.data.map(item => Number(item[column.prop]));
|
|
15586
|
+
const precisions = [];
|
|
15587
|
+
let notNumber = true;
|
|
15588
|
+
values.forEach(value => {
|
|
15589
|
+
if (!isNaN(value)) {
|
|
15590
|
+
notNumber = false;
|
|
15591
|
+
const decimal = ('' + value).split('.')[1];
|
|
15592
|
+
precisions.push(decimal ? decimal.length : 0);
|
|
15593
|
+
}
|
|
15594
|
+
});
|
|
15595
|
+
const precision = Math.max.apply(null, precisions);
|
|
15596
|
+
if (!notNumber) {
|
|
15597
|
+
sums[index] = values.reduce((prev, curr) => {
|
|
15598
|
+
const value = Number(curr);
|
|
15599
|
+
if (!isNaN(value)) {
|
|
15600
|
+
return parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
|
|
15601
|
+
} else {
|
|
15602
|
+
return prev;
|
|
15603
|
+
}
|
|
15604
|
+
}, 0);
|
|
15605
|
+
} else {
|
|
15606
|
+
sums[index] = '';
|
|
15607
|
+
}
|
|
15608
|
+
});
|
|
15609
|
+
}
|
|
15610
|
+
return vue.createVNode("div", {
|
|
15611
|
+
"class": "vc-table__footer",
|
|
15612
|
+
"cellspacing": "0",
|
|
15613
|
+
"cellpadding": "0",
|
|
15614
|
+
"border": "0"
|
|
15615
|
+
}, [vue.createVNode("div", {
|
|
15616
|
+
"class": "vc-table__tbody"
|
|
15617
|
+
}, [vue.createVNode("div", {
|
|
15618
|
+
"class": "vc-table__tr"
|
|
15619
|
+
}, [states.columns.map((column, cellIndex) => vue.createVNode("div", {
|
|
15620
|
+
"key": cellIndex,
|
|
15621
|
+
"colspan": column.colSpan,
|
|
15622
|
+
"rowspan": column.rowSpan,
|
|
15623
|
+
"class": [getRowClasses(column, cellIndex), 'vc-table__td'],
|
|
15624
|
+
"style": [{
|
|
15625
|
+
width: `${column.realWidth}px`
|
|
15626
|
+
}]
|
|
15627
|
+
}, [vue.createVNode("div", {
|
|
15628
|
+
"class": ['vc-table__cell', column.labelClass]
|
|
15629
|
+
}, [sums[cellIndex]])]))])])]);
|
|
15630
|
+
};
|
|
15631
|
+
}
|
|
15632
|
+
});
|
|
15633
|
+
|
|
15634
|
+
const props$c = {
|
|
15635
|
+
data: {
|
|
15636
|
+
type: Array,
|
|
15637
|
+
default: () => []
|
|
15638
|
+
},
|
|
15639
|
+
width: [String, Number],
|
|
15640
|
+
height: [String, Number],
|
|
15641
|
+
maxHeight: [String, Number],
|
|
15642
|
+
// 列的宽度是否自撑开
|
|
15643
|
+
fit: {
|
|
15644
|
+
type: Boolean,
|
|
15645
|
+
default: true
|
|
15646
|
+
},
|
|
15647
|
+
// 是否为斑马纹 table
|
|
15648
|
+
stripe: Boolean,
|
|
15649
|
+
// 是否带有纵向边框
|
|
15650
|
+
border: Boolean,
|
|
15651
|
+
// 非常影响表格虚拟滚动的性能,按容器的高度手动优化该值
|
|
15652
|
+
// 后续考虑移除,动态计算
|
|
15653
|
+
rows: {
|
|
15654
|
+
type: Number,
|
|
15655
|
+
default: 10
|
|
15656
|
+
},
|
|
15657
|
+
rowKey: [String, Function],
|
|
15658
|
+
// 是否显示表头
|
|
15659
|
+
showHeader: {
|
|
15660
|
+
type: Boolean,
|
|
15661
|
+
default: true
|
|
15662
|
+
},
|
|
15663
|
+
showSummary: Boolean,
|
|
15664
|
+
sumText: String,
|
|
15665
|
+
getSummary: Function,
|
|
15666
|
+
rowClass: [String, Function],
|
|
15667
|
+
rowStyle: [Object, Function],
|
|
15668
|
+
cellClass: [String, Function],
|
|
15669
|
+
cellStyle: [Object, Function],
|
|
15670
|
+
headerRowClass: [String, Function],
|
|
15671
|
+
headerRowStyle: [Object, Function],
|
|
15672
|
+
headerCellClass: [String, Function],
|
|
15673
|
+
headerCellStyle: [Object, Function],
|
|
15674
|
+
// 当前对应的currentRow是否可高亮
|
|
15675
|
+
highlight: Boolean,
|
|
15676
|
+
// TODO: 支持数组
|
|
15677
|
+
currentRowValue: [String, Number],
|
|
15678
|
+
emptyText: [String, Function],
|
|
15679
|
+
expandRowValue: Array,
|
|
15680
|
+
defaultExpandAll: Boolean,
|
|
15681
|
+
/**
|
|
15682
|
+
* 在多选表格中,当仅有部分行被选中时,点击表头的多选框时的行为。
|
|
15683
|
+
* 若为 true,则选中所有行;若为 false,则取消选择所有行
|
|
15684
|
+
*/
|
|
15685
|
+
indeterminate: {
|
|
15686
|
+
type: Boolean,
|
|
15687
|
+
default: true
|
|
15688
|
+
},
|
|
15689
|
+
lazy: Boolean,
|
|
15690
|
+
// 展示树形数据时,树节点的缩进
|
|
15691
|
+
indent: {
|
|
15692
|
+
type: Number,
|
|
15693
|
+
default: 16
|
|
15694
|
+
},
|
|
15695
|
+
treeMap: {
|
|
15696
|
+
type: Object,
|
|
15697
|
+
default: () => {
|
|
15698
|
+
return {
|
|
15699
|
+
hasChildren: "hasChildren",
|
|
15700
|
+
children: "children"
|
|
15701
|
+
};
|
|
15702
|
+
}
|
|
15703
|
+
},
|
|
15704
|
+
// 树形表格子集是否需要显示选择按钮
|
|
15705
|
+
expandSelectable: {
|
|
15706
|
+
type: Boolean,
|
|
15707
|
+
default: true
|
|
15708
|
+
},
|
|
15709
|
+
loadExpand: Function,
|
|
15710
|
+
getSpan: Function,
|
|
15711
|
+
placeholder: {
|
|
15712
|
+
type: [String, Function],
|
|
15713
|
+
default: "--"
|
|
15714
|
+
},
|
|
15715
|
+
/**
|
|
15716
|
+
* 排序全部交给外部处理,内部不处理数据,只做交互
|
|
15717
|
+
* 列与列之间互斥
|
|
15718
|
+
*/
|
|
15719
|
+
defaultSort: {
|
|
15720
|
+
type: Object,
|
|
15721
|
+
default: () => ({})
|
|
15722
|
+
}
|
|
15723
|
+
};
|
|
15724
|
+
|
|
15725
|
+
/** @jsxImportSource vue */
|
|
15726
|
+
|
|
15727
|
+
const COMPONENT_NAME$g = 'vc-table';
|
|
15728
|
+
const Table = /* @__PURE__ */ vue.defineComponent({
|
|
15729
|
+
name: COMPONENT_NAME$g,
|
|
15730
|
+
props: props$c,
|
|
15731
|
+
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'],
|
|
15732
|
+
setup(props, {
|
|
15733
|
+
slots,
|
|
15734
|
+
expose
|
|
15735
|
+
}) {
|
|
15736
|
+
const instance = vue.getCurrentInstance();
|
|
15737
|
+
const store = new Store({
|
|
15738
|
+
table: instance
|
|
15739
|
+
});
|
|
15740
|
+
const {
|
|
15741
|
+
layout
|
|
15742
|
+
} = store;
|
|
15743
|
+
|
|
15744
|
+
// 由table-column控制
|
|
15745
|
+
const renderExpanded = vue.ref(null);
|
|
15746
|
+
const resizeProxyVisible = vue.ref(false);
|
|
15747
|
+
const resizeState = vue.ref({
|
|
15748
|
+
width: null,
|
|
15749
|
+
height: null
|
|
15750
|
+
});
|
|
15751
|
+
|
|
15752
|
+
// refs
|
|
15753
|
+
const hiddenColumns = vue.ref(null);
|
|
15754
|
+
const headerWrapper = vue.ref(null);
|
|
15755
|
+
const tableHeader = vue.ref(null);
|
|
15756
|
+
const scroller = vue.ref(null);
|
|
15757
|
+
const body = vue.ref();
|
|
15758
|
+
const emptyBlock = vue.ref(null);
|
|
15759
|
+
const appendWrapper = vue.ref(null);
|
|
15760
|
+
const footerWrapper = vue.ref(null);
|
|
15761
|
+
const leftFixedWrapper = vue.ref(null);
|
|
15762
|
+
const leftFixedHeaderWrapper = vue.ref(null);
|
|
15763
|
+
const leftFixedTableHeader = vue.ref(null);
|
|
15764
|
+
const leftFixedBodyWrapper = vue.ref(null);
|
|
15765
|
+
const leftFixedBody = vue.ref(null);
|
|
15766
|
+
const leftFixedFooterWrapper = vue.ref(null);
|
|
15767
|
+
const rightFixedWrapper = vue.ref(null);
|
|
15768
|
+
const rightFixedHeaderWrapper = vue.ref(null);
|
|
15769
|
+
const rightFixedTableHeader = vue.ref(null);
|
|
15770
|
+
const rightFixedBodyWrapper = vue.ref(null);
|
|
15771
|
+
const rightFixedBody = vue.ref(null);
|
|
15772
|
+
const rightFixedFooterWrapper = vue.ref(null);
|
|
15773
|
+
const resizeProxy = vue.ref(null);
|
|
15774
|
+
|
|
15775
|
+
// 是否拥有多级表头, 由table-header控制
|
|
15776
|
+
const isGroup = vue.ref(false);
|
|
15777
|
+
const scrollPosition = vue.ref('left');
|
|
15778
|
+
const hoverState = vue.ref(null);
|
|
15779
|
+
const isReady = vue.ref(false);
|
|
15780
|
+
const states = useStates({
|
|
15781
|
+
columns: 'columns',
|
|
15782
|
+
leftFixedColumns: 'leftFixedColumns',
|
|
15783
|
+
rightFixedColumns: 'rightFixedColumns'
|
|
15784
|
+
}, store);
|
|
15785
|
+
const classes = vue.computed(() => {
|
|
15786
|
+
return {
|
|
15787
|
+
'vc-table--fit': props.fit,
|
|
15788
|
+
'vc-table--striped': props.stripe,
|
|
15789
|
+
'vc-table--border': props.border || isGroup.value,
|
|
15790
|
+
'vc-table--group': isGroup.value,
|
|
15791
|
+
'vc-table--fluid-height': props.maxHeight,
|
|
15792
|
+
'vc-table--scrollable-x': layout.states.scrollX,
|
|
15793
|
+
'vc-table--scrollable-y': layout.states.scrollY,
|
|
15794
|
+
'vc-table--enable-row-hover': !store.states.isComplex,
|
|
15795
|
+
'vc-table--enable-row-transition': (store.states.data || []).length !== 0 && (store.states.data || []).length < 100
|
|
15796
|
+
};
|
|
15797
|
+
});
|
|
15798
|
+
const bodyXWrapper = vue.computed(() => {
|
|
15799
|
+
return scroller.value?.wrapper;
|
|
15800
|
+
});
|
|
15801
|
+
const bodyYWrapper = vue.computed(() => {
|
|
15802
|
+
return !props.height ? bodyXWrapper.value : body.value.getRootElement().querySelector('.vc-scroller__wrapper');
|
|
15803
|
+
});
|
|
15804
|
+
const shouldUpdateHeight = vue.computed(() => {
|
|
15805
|
+
return props.height || props.maxHeight || states.leftFixedColumns.length > 0 || states.rightFixedColumns.length > 0;
|
|
15806
|
+
});
|
|
15807
|
+
const bodyWidthStyle = vue.computed(() => {
|
|
15808
|
+
const {
|
|
15809
|
+
bodyWidth: $bodyWidth
|
|
15810
|
+
} = layout.states;
|
|
15811
|
+
return {
|
|
15812
|
+
width: $bodyWidth ? $bodyWidth + 'px' : ''
|
|
15813
|
+
};
|
|
15814
|
+
});
|
|
15815
|
+
const bodyHeightStyle = vue.computed(() => {
|
|
15816
|
+
const {
|
|
15817
|
+
headerHeight,
|
|
15818
|
+
bodyHeight: $bodyHeight,
|
|
15819
|
+
footerHeight
|
|
15820
|
+
} = layout.states;
|
|
15821
|
+
if (props.height) {
|
|
15822
|
+
return {
|
|
15823
|
+
height: $bodyHeight ? $bodyHeight + 'px' : ''
|
|
15824
|
+
};
|
|
15825
|
+
} else if (props.maxHeight) {
|
|
15826
|
+
const maxHeight = parseHeight(props.maxHeight);
|
|
15827
|
+
if (maxHeight) {
|
|
15828
|
+
return {
|
|
15829
|
+
'max-height': maxHeight - (footerHeight || 0) - (props.showHeader ? headerHeight || 0 : 0) + 'px'
|
|
15830
|
+
};
|
|
15831
|
+
}
|
|
15832
|
+
}
|
|
15833
|
+
return {};
|
|
15834
|
+
});
|
|
15835
|
+
const fixedHeightStyle = vue.computed(() => {
|
|
15836
|
+
if (props.maxHeight) {
|
|
15837
|
+
if (props.showSummary) {
|
|
15838
|
+
return {
|
|
15839
|
+
bottom: 0
|
|
15840
|
+
};
|
|
15841
|
+
}
|
|
15842
|
+
return {
|
|
15843
|
+
bottom: layout.states.scrollX && props.data.length ? 0 : ''
|
|
15844
|
+
};
|
|
15845
|
+
} else {
|
|
15846
|
+
if (props.showSummary) {
|
|
15847
|
+
return {
|
|
15848
|
+
height: layout.states.tableHeight ? layout.states.tableHeight + 'px' : ''
|
|
15849
|
+
};
|
|
15850
|
+
}
|
|
15851
|
+
return {
|
|
15852
|
+
height: layout.states.viewportHeight ? layout.states.viewportHeight + 'px' : ''
|
|
15853
|
+
};
|
|
15854
|
+
}
|
|
15855
|
+
});
|
|
15856
|
+
let isUnMount = false;
|
|
15857
|
+
const updateScrollY = () => {
|
|
15858
|
+
if (isUnMount) return;
|
|
15859
|
+
layout.updateScrollY();
|
|
15860
|
+
layout.updateColumnsWidth();
|
|
15861
|
+
};
|
|
15862
|
+
|
|
15863
|
+
/**
|
|
15864
|
+
* 对 Table 进行重新布局。
|
|
15865
|
+
* 当 Table 或其祖先元素由隐藏切换为显示时,可能需要调用此方法
|
|
15866
|
+
*/
|
|
15867
|
+
const refreshLayout = () => {
|
|
15868
|
+
if (isUnMount) return;
|
|
15869
|
+
layout.updateColumnsWidth();
|
|
15870
|
+
if (shouldUpdateHeight.value) {
|
|
15871
|
+
layout.updateElsHeight();
|
|
15872
|
+
}
|
|
15873
|
+
scroller.value?.refresh?.();
|
|
15874
|
+
};
|
|
15875
|
+
// 用于多选表格,切换所有行的选中状态
|
|
15876
|
+
const toggleAllSelection = () => {
|
|
15877
|
+
store.toggleAllSelection();
|
|
15878
|
+
};
|
|
15879
|
+
|
|
15880
|
+
// 用于单选表格,设定某一行为选中行,如果调用时不加参数,则会取消目前高亮行的选中状态。
|
|
15881
|
+
const setCurrentRow = row => {
|
|
15882
|
+
store.setCurrentRow(row);
|
|
15883
|
+
};
|
|
15884
|
+
|
|
15885
|
+
// 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中)
|
|
15886
|
+
const toggleRowSelection = (row, selected, emitChange) => {
|
|
15887
|
+
store.toggleRowSelection(row, selected, emitChange);
|
|
15888
|
+
store.updateAllSelected();
|
|
15889
|
+
};
|
|
15890
|
+
|
|
15891
|
+
// 用于可展开表格与树形表格,切换某一行的展开状态;如果使用了第二个参数,则是设置这一行展开与否(expanded 为 true 则展开)
|
|
15892
|
+
const toggleRowExpansion = (row, expanded) => {
|
|
15893
|
+
store.toggleRowExpansionAdapter(row, expanded);
|
|
15894
|
+
};
|
|
15895
|
+
|
|
15896
|
+
// 用于多选表格,清空用户的选择
|
|
15897
|
+
const clearSelection = () => {
|
|
15898
|
+
store.clearSelection();
|
|
15899
|
+
};
|
|
15900
|
+
|
|
15901
|
+
// 同步滚动
|
|
15902
|
+
const handleScollX = lodashEs.throttle(() => {
|
|
15903
|
+
if (!bodyXWrapper.value) return;
|
|
15904
|
+
const {
|
|
15905
|
+
scrollLeft,
|
|
15906
|
+
offsetWidth,
|
|
15907
|
+
scrollWidth
|
|
15908
|
+
} = bodyXWrapper.value;
|
|
15909
|
+
if (headerWrapper.value) headerWrapper.value.scrollLeft = scrollLeft;
|
|
15910
|
+
if (footerWrapper.value) footerWrapper.value.scrollLeft = scrollLeft;
|
|
15911
|
+
const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
|
|
15912
|
+
if (scrollLeft >= maxScrollLeftPosition) {
|
|
15913
|
+
scrollPosition.value = 'right';
|
|
15914
|
+
} else if (scrollLeft === 0) {
|
|
15915
|
+
scrollPosition.value = 'left';
|
|
15916
|
+
} else {
|
|
15917
|
+
scrollPosition.value = 'middle';
|
|
15918
|
+
}
|
|
15919
|
+
if (!props.height) {
|
|
15920
|
+
leftFixedBody.value.getRootElement().scrollTop = bodyXWrapper.value.scrollTop;
|
|
15921
|
+
rightFixedBody.value.getRootElement().scrollTop = bodyXWrapper.value.scrollTop;
|
|
15922
|
+
}
|
|
15923
|
+
}, 20);
|
|
15924
|
+
const handleScollY = e => {
|
|
15925
|
+
const v = {
|
|
15926
|
+
x: e.target.scrollLeft,
|
|
15927
|
+
y: e.target.scrollTop
|
|
15928
|
+
};
|
|
15929
|
+
rightFixedBody.value?.wrapper.scrollTo(v, true);
|
|
15930
|
+
leftFixedBody.value?.wrapper.scrollTo(v, true);
|
|
15931
|
+
};
|
|
15932
|
+
const handleResize = () => {
|
|
15933
|
+
if (!isReady.value) return;
|
|
15934
|
+
let shouldUpdateLayout = false;
|
|
15935
|
+
const el = instance.vnode.el;
|
|
15936
|
+
const {
|
|
15937
|
+
width: oldWidth,
|
|
15938
|
+
height: oldHeight
|
|
15939
|
+
} = resizeState.value;
|
|
15940
|
+
const width = el.offsetWidth;
|
|
15941
|
+
if (oldWidth !== width) {
|
|
15942
|
+
shouldUpdateLayout = true;
|
|
15943
|
+
}
|
|
15944
|
+
const height = el.offsetHeight;
|
|
15945
|
+
if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
|
|
15946
|
+
shouldUpdateLayout = true;
|
|
15947
|
+
}
|
|
15948
|
+
if (shouldUpdateLayout) {
|
|
15949
|
+
resizeState.value = {
|
|
15950
|
+
width,
|
|
15951
|
+
height
|
|
15952
|
+
};
|
|
15953
|
+
refreshLayout();
|
|
15954
|
+
}
|
|
15955
|
+
};
|
|
15956
|
+
const handleMouseLeave = () => {
|
|
15957
|
+
store.setHoverRow(null);
|
|
15958
|
+
if (hoverState.value) hoverState.value = null;
|
|
15959
|
+
};
|
|
15960
|
+
const handleMousewheel = (deltaX, deltaY) => {
|
|
15961
|
+
const {
|
|
15962
|
+
scrollWidth: contentW,
|
|
15963
|
+
clientWidth: wrapperW,
|
|
15964
|
+
scrollLeft: scrollX
|
|
15965
|
+
} = bodyXWrapper.value;
|
|
15966
|
+
const {
|
|
15967
|
+
scrollHeight: contentH,
|
|
15968
|
+
clientHeight: wrapperH,
|
|
15969
|
+
scrollTop: scrollY
|
|
15970
|
+
} = bodyYWrapper.value;
|
|
15971
|
+
if (Math.abs(deltaY) > Math.abs(deltaX) && contentH > wrapperH) {
|
|
15972
|
+
// 虚拟滚动
|
|
15973
|
+
if (props.height) {
|
|
15974
|
+
body.value.wrapper?.scrollTo({
|
|
15975
|
+
y: scrollY + deltaY
|
|
15976
|
+
});
|
|
15977
|
+
} else {
|
|
15978
|
+
scroller.value.scrollTo({
|
|
15979
|
+
y: scrollY + deltaY
|
|
15980
|
+
});
|
|
15981
|
+
}
|
|
15982
|
+
} else if (deltaX && contentW > wrapperW) {
|
|
15983
|
+
scroller.value.scrollTo({
|
|
15984
|
+
x: scrollX + deltaX
|
|
15985
|
+
});
|
|
15986
|
+
}
|
|
15987
|
+
};
|
|
15988
|
+
let wheels = [];
|
|
15989
|
+
const bindEvents = () => {
|
|
15990
|
+
if (props.fit) {
|
|
15991
|
+
helperResize.Resize.on(instance.vnode.el, handleResize);
|
|
15992
|
+
}
|
|
15993
|
+
vue.nextTick(() => {
|
|
15994
|
+
wheels = [headerWrapper, footerWrapper, leftFixedWrapper, rightFixedWrapper].map(wrapper => {
|
|
15995
|
+
if (!wrapper.value) return;
|
|
15996
|
+
const wheel = new helperWheel.Wheel(wrapper.value, {
|
|
15997
|
+
shouldWheelX: delta => {
|
|
15998
|
+
const {
|
|
15999
|
+
scrollWidth: contentW,
|
|
16000
|
+
clientWidth: wrapperW,
|
|
16001
|
+
scrollLeft: scrollX
|
|
16002
|
+
} = bodyXWrapper.value;
|
|
16003
|
+
if (wrapperW === contentW) {
|
|
16004
|
+
return false;
|
|
16005
|
+
}
|
|
16006
|
+
delta = Math.round(delta);
|
|
16007
|
+
if (delta === 0) {
|
|
16008
|
+
return false;
|
|
16009
|
+
}
|
|
16010
|
+
return delta < 0 && scrollX > 0 || delta >= 0 && scrollX < contentW - wrapperW;
|
|
16011
|
+
},
|
|
16012
|
+
shouldWheelY: delta => {
|
|
16013
|
+
const {
|
|
16014
|
+
scrollHeight: contentH,
|
|
16015
|
+
clientHeight: wrapperH,
|
|
16016
|
+
scrollTop: scrollY
|
|
16017
|
+
} = bodyYWrapper.value;
|
|
16018
|
+
if (wrapperH === contentH) {
|
|
16019
|
+
return false;
|
|
16020
|
+
}
|
|
16021
|
+
delta = Math.round(delta);
|
|
16022
|
+
if (delta === 0) {
|
|
16023
|
+
return false;
|
|
16024
|
+
}
|
|
16025
|
+
return delta < 0 && scrollY > 0 || delta >= 0 && scrollY < contentH - wrapperH;
|
|
16026
|
+
}
|
|
16027
|
+
});
|
|
16028
|
+
wheel.on(handleMousewheel);
|
|
16029
|
+
return wheel;
|
|
16030
|
+
});
|
|
16031
|
+
});
|
|
16032
|
+
};
|
|
16033
|
+
const unbindEvents = () => {
|
|
16034
|
+
if (props.fit) {
|
|
16035
|
+
helperResize.Resize.off(instance.vnode.el, handleResize);
|
|
16036
|
+
}
|
|
16037
|
+
wheels.forEach(wheel => wheel && wheel.off(handleMousewheel));
|
|
16038
|
+
};
|
|
16039
|
+
const debouncedUpdateLayout = lodashEs.debounce(() => refreshLayout(), 50);
|
|
16040
|
+
vue.watch(() => props.height, v => {
|
|
16041
|
+
layout.setHeight(v);
|
|
16042
|
+
}, {
|
|
16043
|
+
immediate: true
|
|
16044
|
+
});
|
|
16045
|
+
vue.watch(() => props.maxHeight, v => {
|
|
16046
|
+
layout.setMaxHeight(v);
|
|
16047
|
+
}, {
|
|
16048
|
+
immediate: true
|
|
16049
|
+
});
|
|
16050
|
+
vue.watch(() => props.currentRowValue, v => {
|
|
16051
|
+
if (!props.rowKey) return;
|
|
16052
|
+
store.current.reset(v);
|
|
16053
|
+
}, {
|
|
16054
|
+
immediate: true
|
|
16055
|
+
});
|
|
16056
|
+
vue.watch(() => props.data, v => {
|
|
16057
|
+
store.setData(v);
|
|
16058
|
+
isReady.value && vue.nextTick(refreshLayout);
|
|
16059
|
+
}, {
|
|
16060
|
+
immediate: true
|
|
16061
|
+
});
|
|
16062
|
+
vue.watch(() => props.expandRowValue, v => {
|
|
16063
|
+
if (v) {
|
|
16064
|
+
store.setExpandRowValueAdapter(v);
|
|
16065
|
+
}
|
|
16066
|
+
}, {
|
|
16067
|
+
immediate: true
|
|
16068
|
+
});
|
|
16069
|
+
|
|
16070
|
+
// 直接修改className(不使用render函数), 解决临界值设置修改className时的顿挫
|
|
16071
|
+
vue.watch(() => scrollPosition.value, v => {
|
|
16072
|
+
Utils.raf(() => {
|
|
16073
|
+
const className = `is-scrolling-${layout.states.scrollX ? v : 'none'}`;
|
|
16074
|
+
const el = bodyXWrapper.value;
|
|
16075
|
+
el && el.classList.replace(el.classList.item(el.classList.length - 1), className);
|
|
16076
|
+
});
|
|
16077
|
+
}, {
|
|
16078
|
+
immediate: true
|
|
16079
|
+
});
|
|
16080
|
+
vue.onMounted(() => {
|
|
16081
|
+
bindEvents();
|
|
16082
|
+
store.updateColumns();
|
|
16083
|
+
refreshLayout();
|
|
16084
|
+
resizeState.value = {
|
|
16085
|
+
width: instance.vnode.el.offsetWidth,
|
|
16086
|
+
height: instance.vnode.el.offsetHeight
|
|
16087
|
+
};
|
|
16088
|
+
isReady.value = true;
|
|
16089
|
+
});
|
|
16090
|
+
vue.onBeforeUnmount(() => {
|
|
16091
|
+
isUnMount = true;
|
|
16092
|
+
unbindEvents();
|
|
16093
|
+
});
|
|
16094
|
+
const tableId = Utils.getUid('table');
|
|
16095
|
+
expose({
|
|
16096
|
+
tableId,
|
|
16097
|
+
store,
|
|
16098
|
+
layout,
|
|
16099
|
+
updateScrollY,
|
|
16100
|
+
refreshLayout,
|
|
16101
|
+
toggleAllSelection,
|
|
16102
|
+
setCurrentRow,
|
|
16103
|
+
toggleRowSelection,
|
|
16104
|
+
toggleRowExpansion,
|
|
16105
|
+
clearSelection,
|
|
16106
|
+
scroller,
|
|
16107
|
+
headerWrapper,
|
|
16108
|
+
appendWrapper,
|
|
16109
|
+
footerWrapper,
|
|
16110
|
+
resizeState,
|
|
16111
|
+
debouncedUpdateLayout,
|
|
16112
|
+
isReady,
|
|
16113
|
+
hoverState,
|
|
16114
|
+
renderExpanded,
|
|
16115
|
+
hiddenColumns
|
|
16116
|
+
});
|
|
16117
|
+
return () => {
|
|
16118
|
+
return vue.createVNode("div", {
|
|
16119
|
+
"class": [classes.value, tableId, 'vc-table'],
|
|
16120
|
+
"onMouseleave": handleMouseLeave
|
|
16121
|
+
}, [vue.createVNode("div", {
|
|
16122
|
+
"ref": hiddenColumns,
|
|
16123
|
+
"class": "vc-table__hidden"
|
|
16124
|
+
}, [slots.default?.()]), props.showHeader && vue.createVNode("div", {
|
|
16125
|
+
"ref": headerWrapper,
|
|
16126
|
+
"class": "vc-table__header-wrapper"
|
|
16127
|
+
}, [vue.createVNode(TableHeader, {
|
|
16128
|
+
"ref": tableHeader,
|
|
16129
|
+
"store": store,
|
|
16130
|
+
"border": props.border,
|
|
16131
|
+
"default-sort": props.defaultSort,
|
|
16132
|
+
"style": bodyWidthStyle.value
|
|
16133
|
+
}, null)]), states.columns.length > 0 && vue.createVNode(ScrollerWheel, {
|
|
16134
|
+
"ref": scroller,
|
|
16135
|
+
"class": ['vc-table__body-wrapper is-scrolling-none'],
|
|
16136
|
+
"barTo": `.${tableId}`,
|
|
16137
|
+
"native": false,
|
|
16138
|
+
"always": false,
|
|
16139
|
+
"track-offset-y": [layout.states.headerHeight, 0, -layout.states.headerHeight - layout.states.footerHeight, 0],
|
|
16140
|
+
"style": [bodyHeightStyle.value],
|
|
16141
|
+
"onScroll": handleScollX
|
|
16142
|
+
}, {
|
|
16143
|
+
default: () => [vue.createVNode(TableBody, {
|
|
16144
|
+
"ref": body,
|
|
16145
|
+
"store": store,
|
|
16146
|
+
"style": [bodyWidthStyle.value],
|
|
16147
|
+
"height-style": [bodyHeightStyle.value],
|
|
16148
|
+
"onScroll": handleScollY
|
|
16149
|
+
}, null), props.data.length === 0 && vue.createVNode("div", {
|
|
16150
|
+
"ref": emptyBlock,
|
|
16151
|
+
"style": bodyWidthStyle.value,
|
|
16152
|
+
"class": "vc-table__empty-block"
|
|
16153
|
+
}, [vue.createVNode("span", {
|
|
16154
|
+
"class": "vc-table__empty-text"
|
|
16155
|
+
}, [slots.empty ? slots.empty() : props.emptyText || '暂无数据'])]), slots.append && vue.createVNode("div", {
|
|
16156
|
+
"ref": appendWrapper,
|
|
16157
|
+
"class": "vc-table__append-wrapper"
|
|
16158
|
+
}, [slots.append()])]
|
|
16159
|
+
}), props.showSummary && vue.withDirectives(vue.createVNode("div", {
|
|
16160
|
+
"ref": footerWrapper,
|
|
16161
|
+
"class": "vc-table__footer-wrapper"
|
|
16162
|
+
}, [vue.createVNode(TableFooter, {
|
|
16163
|
+
"store": store,
|
|
16164
|
+
"border": props.border,
|
|
16165
|
+
"sum-text": props.sumText || '合计',
|
|
16166
|
+
"get-summary": props.getSummary,
|
|
16167
|
+
"style": bodyWidthStyle.value
|
|
16168
|
+
}, null)]), [[vue.vShow, props.data && props.data.length > 0]]), states.leftFixedColumns.length > 0 && states.columns.length > 0 && vue.createVNode("div", {
|
|
16169
|
+
"ref": leftFixedWrapper,
|
|
16170
|
+
"style": [{
|
|
16171
|
+
width: layout.states.leftFixedWidth ? layout.states.leftFixedWidth + 'px' : ''
|
|
16172
|
+
}, fixedHeightStyle.value],
|
|
16173
|
+
"class": "vc-table__fixed"
|
|
16174
|
+
}, [props.showHeader && vue.createVNode("div", {
|
|
16175
|
+
"ref": leftFixedHeaderWrapper,
|
|
16176
|
+
"class": "vc-table__fixed-header-wrapper"
|
|
16177
|
+
}, [vue.createVNode(TableHeader, {
|
|
16178
|
+
"ref": leftFixedTableHeader,
|
|
16179
|
+
"store": store,
|
|
16180
|
+
"border": props.border,
|
|
16181
|
+
"default-sort": props.defaultSort,
|
|
16182
|
+
"style": bodyWidthStyle.value,
|
|
16183
|
+
"fixed": "left"
|
|
16184
|
+
}, null)]), vue.createVNode("div", {
|
|
16185
|
+
"ref": leftFixedBodyWrapper,
|
|
16186
|
+
"style": [{
|
|
16187
|
+
top: layout.states.headerHeight + 'px'
|
|
16188
|
+
}],
|
|
16189
|
+
"class": "vc-table__fixed-body-wrapper"
|
|
16190
|
+
}, [vue.createVNode(TableBody, {
|
|
16191
|
+
"ref": leftFixedBody,
|
|
16192
|
+
"store": store,
|
|
16193
|
+
"style": [bodyWidthStyle.value, bodyHeightStyle.value],
|
|
16194
|
+
"fixed": "left"
|
|
16195
|
+
}, null), slots.append && vue.createVNode("div", {
|
|
16196
|
+
"style": [{
|
|
16197
|
+
height: layout.states.appendHeight + 'px'
|
|
16198
|
+
}],
|
|
16199
|
+
"class": "vc-table__append-gutter"
|
|
16200
|
+
}, [slots.append()])]), props.showSummary && vue.withDirectives(vue.createVNode("div", {
|
|
16201
|
+
"ref": leftFixedFooterWrapper,
|
|
16202
|
+
"class": "vc-table__fixed-footer-wrapper"
|
|
16203
|
+
}, [vue.createVNode(TableFooter, {
|
|
16204
|
+
"store": store,
|
|
16205
|
+
"border": props.border,
|
|
16206
|
+
"sum-text": props.sumText || '合计',
|
|
16207
|
+
"get-summary": props.getSummary,
|
|
16208
|
+
"style": bodyWidthStyle.value,
|
|
16209
|
+
"fixed": "left"
|
|
16210
|
+
}, null)]), [[vue.vShow, props.data && props.data.length > 0]])]), states.rightFixedColumns.length > 0 && vue.createVNode("div", {
|
|
16211
|
+
"ref": rightFixedWrapper,
|
|
16212
|
+
"style": [{
|
|
16213
|
+
width: layout.states.rightFixedWidth ? layout.states.rightFixedWidth + 'px' : ''
|
|
16214
|
+
}, fixedHeightStyle.value],
|
|
16215
|
+
"class": "vc-table__fixed-right"
|
|
16216
|
+
}, [props.showHeader && vue.createVNode("div", {
|
|
16217
|
+
"ref": rightFixedHeaderWrapper,
|
|
16218
|
+
"class": "vc-table__fixed-header-wrapper"
|
|
16219
|
+
}, [vue.createVNode(TableHeader, {
|
|
16220
|
+
"ref": rightFixedTableHeader,
|
|
16221
|
+
"store": store,
|
|
16222
|
+
"border": props.border,
|
|
16223
|
+
"default-sort": props.defaultSort,
|
|
16224
|
+
"style": bodyWidthStyle.value,
|
|
16225
|
+
"fixed": "right"
|
|
16226
|
+
}, null)]), vue.createVNode("div", {
|
|
16227
|
+
"ref": rightFixedBodyWrapper,
|
|
16228
|
+
"style": [{
|
|
16229
|
+
top: layout.states.headerHeight + 'px'
|
|
16230
|
+
}],
|
|
16231
|
+
"class": "vc-table__fixed-body-wrapper"
|
|
16232
|
+
}, [vue.createVNode(TableBody, {
|
|
16233
|
+
"ref": rightFixedBody,
|
|
16234
|
+
"store": store,
|
|
16235
|
+
"style": [bodyWidthStyle.value, bodyHeightStyle.value],
|
|
16236
|
+
"fixed": "right"
|
|
16237
|
+
}, null), slots.append && vue.createVNode("div", {
|
|
16238
|
+
"style": [{
|
|
16239
|
+
height: layout.states.appendHeight + 'px'
|
|
16240
|
+
}],
|
|
16241
|
+
"class": "vc-table__append-gutter"
|
|
16242
|
+
}, [slots.append()])]), props.showSummary && vue.withDirectives(vue.createVNode("div", {
|
|
16243
|
+
"ref": rightFixedFooterWrapper,
|
|
16244
|
+
"class": "vc-table__fixed-footer-wrapper"
|
|
16245
|
+
}, [vue.createVNode(TableFooter, {
|
|
16246
|
+
"store": store,
|
|
16247
|
+
"border": props.border,
|
|
16248
|
+
"sum-text": props.sumText || '合计',
|
|
16249
|
+
"get-summary": props.getSummary,
|
|
16250
|
+
"style": bodyWidthStyle.value,
|
|
16251
|
+
"fixed": "right"
|
|
16252
|
+
}, null)]), [[vue.vShow, props.data && props.data.length > 0]])]), vue.withDirectives(vue.createVNode("div", {
|
|
16253
|
+
"ref": resizeProxy,
|
|
16254
|
+
"class": "vc-table__column-resize-proxy"
|
|
16255
|
+
}, null), [[vue.vShow, resizeProxyVisible.value]])]);
|
|
16256
|
+
};
|
|
16257
|
+
}
|
|
16258
|
+
});
|
|
16259
|
+
|
|
16260
|
+
const cellStarts = {
|
|
16261
|
+
default: {
|
|
16262
|
+
order: ''
|
|
16263
|
+
},
|
|
16264
|
+
selection: {
|
|
16265
|
+
width: 48,
|
|
16266
|
+
minWidth: 48,
|
|
16267
|
+
realWidth: 48,
|
|
16268
|
+
order: '',
|
|
16269
|
+
className: 'vc-table-column--selection'
|
|
16270
|
+
},
|
|
16271
|
+
expand: {
|
|
16272
|
+
width: 48,
|
|
16273
|
+
minWidth: 48,
|
|
16274
|
+
realWidth: 48,
|
|
16275
|
+
order: ''
|
|
16276
|
+
},
|
|
16277
|
+
index: {
|
|
16278
|
+
width: 48,
|
|
16279
|
+
minWidth: 48,
|
|
16280
|
+
realWidth: 48,
|
|
16281
|
+
order: ''
|
|
16282
|
+
}
|
|
16283
|
+
};
|
|
16284
|
+
|
|
16285
|
+
// 这些选项不应该被覆盖
|
|
16286
|
+
const cellForced = {
|
|
16287
|
+
selection: {
|
|
16288
|
+
renderHeader({
|
|
16289
|
+
store
|
|
16290
|
+
}) {
|
|
16291
|
+
return vue.createVNode(Checkbox, {
|
|
16292
|
+
"modelValue": store.states.isAllSelected,
|
|
16293
|
+
"disabled": store.states.data && store.states.data.length === 0,
|
|
16294
|
+
"indeterminate": store.states.selection.length > 0 && !store.states.isAllSelected,
|
|
16295
|
+
"onClick": e => {
|
|
16296
|
+
e.stopPropagation();
|
|
16297
|
+
store.toggleAllSelection();
|
|
16298
|
+
}
|
|
16299
|
+
}, null);
|
|
16300
|
+
},
|
|
16301
|
+
renderCell({
|
|
16302
|
+
row,
|
|
16303
|
+
column,
|
|
16304
|
+
store,
|
|
16305
|
+
rowIndex,
|
|
16306
|
+
level
|
|
16307
|
+
}) {
|
|
16308
|
+
return vue.withDirectives(vue.createVNode(Checkbox, {
|
|
16309
|
+
"modelValue": store.isSelected(row),
|
|
16310
|
+
"disabled": column.selectable ? !column.selectable.call(null, row, rowIndex) : false,
|
|
16311
|
+
"onChange": () => store.rowSelectedChanged(row),
|
|
16312
|
+
"onClick": e => e.stopPropagation()
|
|
16313
|
+
}, null), [[vue.vShow, store.table.props.expandSelectable || level === 0]]);
|
|
16314
|
+
},
|
|
16315
|
+
sortable: false,
|
|
16316
|
+
resizable: false
|
|
16317
|
+
},
|
|
16318
|
+
index: {
|
|
16319
|
+
renderHeader(h, {
|
|
16320
|
+
column
|
|
16321
|
+
}) {
|
|
16322
|
+
return column.label || '#';
|
|
16323
|
+
},
|
|
16324
|
+
renderCell({
|
|
16325
|
+
rowIndex,
|
|
16326
|
+
column
|
|
16327
|
+
}) {
|
|
16328
|
+
let i = rowIndex + 1;
|
|
16329
|
+
const index = column.index;
|
|
16330
|
+
if (typeof index === 'number') {
|
|
16331
|
+
i = rowIndex + index;
|
|
16332
|
+
} else if (typeof index === 'function') {
|
|
16333
|
+
i = index(rowIndex);
|
|
16334
|
+
}
|
|
16335
|
+
return vue.createVNode("div", null, [i]);
|
|
16336
|
+
},
|
|
16337
|
+
sortable: false
|
|
16338
|
+
},
|
|
16339
|
+
expand: {
|
|
16340
|
+
renderHeader({
|
|
16341
|
+
column
|
|
16342
|
+
}) {
|
|
16343
|
+
return column.label || '';
|
|
16344
|
+
},
|
|
16345
|
+
renderCell({
|
|
16346
|
+
row,
|
|
16347
|
+
store
|
|
16348
|
+
}) {
|
|
16349
|
+
const classes = ['vc-table__expand-icon'];
|
|
16350
|
+
if (store.states.expandRows.includes(row)) {
|
|
16351
|
+
classes.push('is-expand');
|
|
16352
|
+
}
|
|
16353
|
+
const handleClick = e => {
|
|
16354
|
+
e.stopPropagation();
|
|
16355
|
+
store.expand.toggle(row);
|
|
16356
|
+
};
|
|
16357
|
+
return vue.createVNode("div", {
|
|
16358
|
+
"class": classes,
|
|
16359
|
+
"onClick": handleClick
|
|
16360
|
+
}, [vue.createVNode(Icon, {
|
|
16361
|
+
"type": "triangle-up"
|
|
16362
|
+
}, null)]);
|
|
16363
|
+
},
|
|
16364
|
+
sortable: false,
|
|
16365
|
+
resizable: false,
|
|
16366
|
+
className: 'vc-table__expand-column'
|
|
16367
|
+
}
|
|
16368
|
+
};
|
|
16369
|
+
|
|
16370
|
+
// Cell默认渲染value 或 formatter
|
|
16371
|
+
const defaultRenderCell = ({
|
|
16372
|
+
row,
|
|
16373
|
+
column = {},
|
|
16374
|
+
rowIndex
|
|
16375
|
+
}) => {
|
|
16376
|
+
const {
|
|
16377
|
+
prop,
|
|
16378
|
+
formatter
|
|
16379
|
+
} = column;
|
|
16380
|
+
let value;
|
|
16381
|
+
if (prop) {
|
|
16382
|
+
value = Utils.getPropByPath(row, prop).v;
|
|
16383
|
+
}
|
|
16384
|
+
if (formatter) {
|
|
16385
|
+
return column.formatter({
|
|
16386
|
+
row,
|
|
16387
|
+
column,
|
|
16388
|
+
value,
|
|
16389
|
+
rowIndex
|
|
16390
|
+
});
|
|
16391
|
+
}
|
|
16392
|
+
return value;
|
|
16393
|
+
};
|
|
16394
|
+
|
|
16395
|
+
// Cell渲染前缀,如loading, expand
|
|
16396
|
+
const treeCellPrefix = ({
|
|
16397
|
+
row,
|
|
16398
|
+
treeNode,
|
|
16399
|
+
store
|
|
16400
|
+
}) => {
|
|
16401
|
+
if (!treeNode) return null;
|
|
16402
|
+
const ele = [];
|
|
16403
|
+
const handleClick = e => {
|
|
16404
|
+
e.stopPropagation();
|
|
16405
|
+
store.tree.loadOrToggle(row);
|
|
16406
|
+
};
|
|
16407
|
+
if (treeNode.indent) {
|
|
16408
|
+
ele.push(vue.createVNode("span", {
|
|
16409
|
+
"class": "vc-table__indent",
|
|
16410
|
+
"style": {
|
|
16411
|
+
'padding-left': treeNode.indent + 'px'
|
|
16412
|
+
}
|
|
16413
|
+
}, null));
|
|
16414
|
+
}
|
|
16415
|
+
if (typeof treeNode.expanded === 'boolean' && !treeNode.noLazyChildren) {
|
|
16416
|
+
const expandClasses = {
|
|
16417
|
+
'vc-table__expand-icon': true,
|
|
16418
|
+
'is-expand': treeNode.expanded
|
|
16419
|
+
};
|
|
16420
|
+
ele.push(vue.createVNode("span", {
|
|
16421
|
+
"class": expandClasses,
|
|
16422
|
+
"onClick": handleClick
|
|
16423
|
+
}, [treeNode.loading ? vue.createVNode(Spin, {
|
|
16424
|
+
"size": 12
|
|
16425
|
+
}, null) : vue.createVNode(Icon, {
|
|
16426
|
+
"type": "triangle-up"
|
|
16427
|
+
}, null)]));
|
|
16428
|
+
} else {
|
|
16429
|
+
ele.push(vue.createVNode("span", {
|
|
16430
|
+
"class": "vc-table__placeholder"
|
|
16431
|
+
}, null));
|
|
16432
|
+
}
|
|
16433
|
+
return ele;
|
|
16434
|
+
};
|
|
16435
|
+
|
|
16436
|
+
const TableColumn = /* @__PURE__ */ vue.defineComponent({
|
|
16437
|
+
name: 'vc-table-column',
|
|
16438
|
+
props: {
|
|
16439
|
+
type: {
|
|
16440
|
+
type: String,
|
|
16441
|
+
default: 'default'
|
|
16442
|
+
},
|
|
16443
|
+
label: String,
|
|
16444
|
+
customClass: String,
|
|
16445
|
+
labelClass: String,
|
|
16446
|
+
prop: String,
|
|
16447
|
+
width: [Number, String],
|
|
16448
|
+
minWidth: [Number, String],
|
|
16449
|
+
renderHeader: Function,
|
|
16450
|
+
resizable: {
|
|
16451
|
+
type: Boolean,
|
|
16452
|
+
default: true
|
|
16453
|
+
},
|
|
16454
|
+
columnKey: String,
|
|
16455
|
+
align: String,
|
|
16456
|
+
headerAlign: String,
|
|
16457
|
+
showPopover: Boolean,
|
|
16458
|
+
fixed: [Boolean, String],
|
|
16459
|
+
formatter: Function,
|
|
16460
|
+
selectable: Function,
|
|
16461
|
+
reserveSelection: Boolean,
|
|
16462
|
+
index: [Number, Function],
|
|
16463
|
+
// 头部是否展示排序
|
|
16464
|
+
sortable: Boolean,
|
|
16465
|
+
// 数据过滤的选项
|
|
16466
|
+
filters: Array,
|
|
16467
|
+
// 是否支持多选
|
|
16468
|
+
filterMultiple: {
|
|
16469
|
+
type: Boolean,
|
|
16470
|
+
default: true
|
|
16471
|
+
},
|
|
16472
|
+
filterIcon: String,
|
|
16473
|
+
// 选中的数据过滤项
|
|
16474
|
+
filteredValue: Array,
|
|
16475
|
+
// 筛选弹层的样式
|
|
16476
|
+
filterPopupClass: String,
|
|
16477
|
+
// 筛选的方法
|
|
16478
|
+
filter: Function,
|
|
16479
|
+
tooltip: [String, Function]
|
|
16480
|
+
},
|
|
16481
|
+
setup(props, {
|
|
16482
|
+
slots,
|
|
16483
|
+
expose
|
|
16484
|
+
}) {
|
|
16485
|
+
const instance = vue.getCurrentInstance();
|
|
16486
|
+
const table = vcHooks.getInstance('table', 'tableId');
|
|
16487
|
+
const parent = vcHooks.getInstance('table-column', 'columnId') || table;
|
|
16488
|
+
const isSubColumn = table !== parent; // 用于多久表头
|
|
16489
|
+
|
|
16490
|
+
const columnId = vue.ref((parent.exposed.tableId || parent.exposed.columnId) + Utils.getUid('column'));
|
|
16491
|
+
const realWidth = vue.computed(() => {
|
|
16492
|
+
return parseWidth(props.width);
|
|
16493
|
+
});
|
|
16494
|
+
const realMinWidth = vue.computed(() => {
|
|
16495
|
+
return parseMinWidth(props.minWidth);
|
|
16496
|
+
});
|
|
16497
|
+
const realAlign = vue.computed(() => {
|
|
16498
|
+
return props.align ? 'is-' + props.align : null;
|
|
16499
|
+
});
|
|
16500
|
+
const realHeaderAlign = vue.computed(() => {
|
|
16501
|
+
return props.headerAlign ? 'is-' + props.headerAlign : realAlign.value;
|
|
16502
|
+
});
|
|
16503
|
+
const columnConfig = vue.reactive({});
|
|
16504
|
+
/**
|
|
16505
|
+
* 获取当前值情况,this[key]
|
|
16506
|
+
* @param args ~
|
|
16507
|
+
* @returns ~
|
|
16508
|
+
*/
|
|
16509
|
+
const getPropsData = (...args) => {
|
|
16510
|
+
const result = args.reduce((prev, cur) => {
|
|
16511
|
+
if (Array.isArray(cur)) {
|
|
16512
|
+
cur.forEach(key => {
|
|
16513
|
+
prev[key] = props[key];
|
|
16514
|
+
});
|
|
16515
|
+
}
|
|
16516
|
+
return prev;
|
|
16517
|
+
}, {});
|
|
16518
|
+
return result;
|
|
16519
|
+
};
|
|
16520
|
+
|
|
16521
|
+
/**
|
|
16522
|
+
* compose 1
|
|
16523
|
+
* 对于特定类型的 column,某些属性不允许设置
|
|
16524
|
+
* 如 type: selection | index | expand
|
|
16525
|
+
* @param column ~
|
|
16526
|
+
* @returns ~
|
|
16527
|
+
*/
|
|
16528
|
+
const setColumnForcedProps = column => {
|
|
16529
|
+
const type = column.type;
|
|
16530
|
+
const source = cellForced[type] || {};
|
|
16531
|
+
Object.keys(source).forEach(prop => {
|
|
16532
|
+
const value = source[prop];
|
|
16533
|
+
if (value !== undefined) {
|
|
16534
|
+
column[prop] = prop === 'customClass' ? `${column[prop]} ${value}` : value;
|
|
16535
|
+
}
|
|
16536
|
+
});
|
|
16537
|
+
return column;
|
|
16538
|
+
};
|
|
16539
|
+
|
|
16540
|
+
/**
|
|
16541
|
+
* compose 2
|
|
16542
|
+
* column
|
|
16543
|
+
* -> width
|
|
16544
|
+
* -> minWidth
|
|
16545
|
+
* @param column ~
|
|
16546
|
+
* @returns ~
|
|
16547
|
+
*/
|
|
16548
|
+
const setColumnWidth = column => {
|
|
16549
|
+
if (realWidth.value) {
|
|
16550
|
+
column.width = realWidth.value;
|
|
16551
|
+
}
|
|
16552
|
+
if (realMinWidth.value) {
|
|
16553
|
+
column.minWidth = realMinWidth.value;
|
|
16554
|
+
}
|
|
16555
|
+
if (!column.minWidth) {
|
|
16556
|
+
column.minWidth = 80;
|
|
16557
|
+
}
|
|
16558
|
+
column.realWidth = column.width === undefined ? column.minWidth : column.width;
|
|
16559
|
+
return column;
|
|
16560
|
+
};
|
|
16561
|
+
|
|
16562
|
+
/**
|
|
16563
|
+
* compose 3
|
|
16564
|
+
* column
|
|
16565
|
+
* -> renderHeader: 渲染头部
|
|
16566
|
+
* -> renderCell: 渲染单元格
|
|
16567
|
+
* owner
|
|
16568
|
+
* -> renderExpanded: 展开
|
|
16569
|
+
* @param column ~
|
|
16570
|
+
* @returns ~
|
|
16571
|
+
*/
|
|
16572
|
+
const setColumnRenders = column => {
|
|
16573
|
+
const specialTypes = Object.keys(cellForced);
|
|
16574
|
+
// renderHeader 属性不推荐使用。
|
|
16575
|
+
if (props.renderHeader) {
|
|
16576
|
+
column.renderHeader = props.renderHeader;
|
|
16577
|
+
} else if (specialTypes.indexOf(column.type) === -1) {
|
|
16578
|
+
column.renderHeader = data => {
|
|
16579
|
+
const renderHeader = slots.header;
|
|
16580
|
+
return renderHeader ? renderHeader(data) : data?.column?.label;
|
|
16581
|
+
};
|
|
16582
|
+
}
|
|
16583
|
+
let originRenderCell = column.renderCell;
|
|
16584
|
+
// TODO: 这里的实现调整
|
|
16585
|
+
if (column.type === 'expand') {
|
|
16586
|
+
// 对于展开行,renderCell 不允许配置的。在上一步中已经设置过,这里需要简单封装一下。
|
|
16587
|
+
column.renderCell = data => vue.createVNode("div", {
|
|
16588
|
+
"class": "vc-table__cell"
|
|
16589
|
+
}, [originRenderCell(data)]);
|
|
16590
|
+
table.exposed.renderExpanded.value = data => {
|
|
16591
|
+
return slots.default ? slots.default(data) : slots.default;
|
|
16592
|
+
};
|
|
16593
|
+
} else {
|
|
16594
|
+
originRenderCell = originRenderCell || defaultRenderCell;
|
|
16595
|
+
// 对 renderCell 进行包装
|
|
16596
|
+
column.renderCell = data => {
|
|
16597
|
+
let children = null;
|
|
16598
|
+
if (slots.default) {
|
|
16599
|
+
children = slots?.default?.(data);
|
|
16600
|
+
} else {
|
|
16601
|
+
children = originRenderCell(data);
|
|
16602
|
+
}
|
|
16603
|
+
let prefix = treeCellPrefix(data);
|
|
16604
|
+
const $props = {
|
|
16605
|
+
class: 'vc-table__cell',
|
|
16606
|
+
style: {}
|
|
16607
|
+
};
|
|
16608
|
+
// 存在树形数组,且当前行无箭头图标且处于当前展开列,表格对齐
|
|
16609
|
+
if (!lodashEs.isEmpty(table.exposed.store.states.treeData) && !prefix && data.isExpandColumn) {
|
|
16610
|
+
prefix = vue.createVNode("span", {
|
|
16611
|
+
"class": "vc-table-un-expand__indent"
|
|
16612
|
+
}, null);
|
|
16613
|
+
}
|
|
16614
|
+
if (data.column.showPopover) {
|
|
16615
|
+
$props.class += ' vc-popover';
|
|
16616
|
+
$props.style = {
|
|
16617
|
+
width: (data.column.realWidth || data.column.width) - 1 + 'px'
|
|
16618
|
+
};
|
|
16619
|
+
}
|
|
16620
|
+
const {
|
|
16621
|
+
placeholder
|
|
16622
|
+
} = table.props;
|
|
16623
|
+
const contentPlaceholder = typeof placeholder === 'function' ? placeholder() : placeholder;
|
|
16624
|
+
return vue.createVNode("div", $props, [prefix, children === undefined || children === '' || children === null ? contentPlaceholder : children]);
|
|
16625
|
+
};
|
|
16626
|
+
}
|
|
16627
|
+
return column;
|
|
16628
|
+
};
|
|
16629
|
+
const refreshColumnBasicConfig = () => {
|
|
16630
|
+
const defaults = {
|
|
16631
|
+
...cellStarts[props.type],
|
|
16632
|
+
type: props.type,
|
|
16633
|
+
id: columnId.value,
|
|
16634
|
+
align: realAlign.value,
|
|
16635
|
+
headerAlign: realHeaderAlign.value,
|
|
16636
|
+
prop: props.prop,
|
|
16637
|
+
showPopover: props.showPopover,
|
|
16638
|
+
// index 列
|
|
16639
|
+
index: props.index
|
|
16640
|
+
};
|
|
16641
|
+
const basicProps = ['columnKey', 'label', 'customClass', 'labelClass', 'type', 'renderHeader', 'resizable', 'formatter', 'fixed', 'resizable']; // eslint-disable-line
|
|
16642
|
+
const selectProps = ['selectable', 'reserveSelection'];
|
|
16643
|
+
const sortProps = ['sortable'];
|
|
16644
|
+
const filterProps = ['filters', 'filteredValue', 'filterMultiple', 'filter', 'filterIcon', 'filterPopupClass'];
|
|
16645
|
+
let column = getPropsData(basicProps, selectProps, sortProps, filterProps);
|
|
16646
|
+
column = lodashEs.merge(defaults, column);
|
|
16647
|
+
|
|
16648
|
+
// 注意 compose 中函数执行的顺序是从右到左
|
|
16649
|
+
column = helperFp.compose(setColumnRenders, setColumnWidth, setColumnForcedProps)(column);
|
|
16650
|
+
for (const key in column) {
|
|
16651
|
+
if (Utils.hasOwn(column, key)) {
|
|
16652
|
+
columnConfig[key] = column[key];
|
|
16653
|
+
}
|
|
16654
|
+
}
|
|
16655
|
+
};
|
|
16656
|
+
const registerComplexWatchers = () => {
|
|
16657
|
+
vue.watch(() => props.fixed, () => {
|
|
16658
|
+
table.exposed.store.scheduleLayout(true);
|
|
16659
|
+
});
|
|
16660
|
+
vue.watch(() => realWidth.value, () => {
|
|
16661
|
+
table.exposed.store.scheduleLayout(false);
|
|
16662
|
+
});
|
|
16663
|
+
vue.watch(() => realMinWidth.value, () => {
|
|
16664
|
+
table.exposed.store.scheduleLayout(false);
|
|
16665
|
+
});
|
|
16666
|
+
};
|
|
16667
|
+
vue.onBeforeMount(() => {
|
|
16668
|
+
refreshColumnBasicConfig();
|
|
16669
|
+
registerComplexWatchers();
|
|
16670
|
+
});
|
|
16671
|
+
vue.onUpdated(refreshColumnBasicConfig);
|
|
16672
|
+
vue.onMounted(() => {
|
|
16673
|
+
const children = isSubColumn ? parent.vnode.el.children : parent.exposed.hiddenColumns.value.children;
|
|
16674
|
+
|
|
16675
|
+
// DOM上
|
|
16676
|
+
const columnIndex = [...children].indexOf(instance.vnode.el);
|
|
16677
|
+
table.exposed.store.insertColumn(columnConfig, columnIndex, isSubColumn && parent.exposed.columnConfig);
|
|
16678
|
+
});
|
|
16679
|
+
vue.onUnmounted(() => {
|
|
16680
|
+
if (!instance.parent) return;
|
|
16681
|
+
table.exposed.store.removeColumn(columnConfig, isSubColumn && parent.exposed.columnConfig);
|
|
16682
|
+
});
|
|
16683
|
+
expose({
|
|
16684
|
+
columnId,
|
|
16685
|
+
columnConfig
|
|
16686
|
+
});
|
|
16687
|
+
|
|
16688
|
+
/**
|
|
16689
|
+
* 可以计算 columnIndex(外层需要标签元素), 即h('div')
|
|
16690
|
+
* this.$slots?.default?.() 用于多级表头
|
|
16691
|
+
* @returns ~
|
|
16692
|
+
*/
|
|
16693
|
+
return () => {
|
|
16694
|
+
let children = [];
|
|
16695
|
+
try {
|
|
16696
|
+
const renderDefault = slots?.default?.({
|
|
16697
|
+
row: {},
|
|
16698
|
+
column: {},
|
|
16699
|
+
$index: -1
|
|
16700
|
+
});
|
|
16701
|
+
if (renderDefault instanceof Array) {
|
|
16702
|
+
for (const childNode of renderDefault) {
|
|
16703
|
+
if (/^vcm?-table-column$/.test(childNode.type?.name)) {
|
|
16704
|
+
children.push(childNode);
|
|
16705
|
+
} else if (childNode.type === vue.Fragment && childNode.children instanceof Array) {
|
|
16706
|
+
renderDefault.push(...childNode.children);
|
|
16707
|
+
}
|
|
16708
|
+
}
|
|
16709
|
+
}
|
|
16710
|
+
} catch {
|
|
16711
|
+
children = [];
|
|
16712
|
+
}
|
|
16713
|
+
return vue.h('div', children);
|
|
16714
|
+
};
|
|
16715
|
+
}
|
|
16716
|
+
});
|
|
16717
|
+
|
|
16718
|
+
const MTable = Table;
|
|
16719
|
+
const MTableColumn = TableColumn;
|
|
16720
|
+
|
|
16721
|
+
const props$b = {
|
|
16722
|
+
type: {
|
|
16723
|
+
type: String,
|
|
16724
|
+
validator: (v) => /^(line|card)$/.test(v),
|
|
16725
|
+
default: "line"
|
|
16726
|
+
},
|
|
13799
16727
|
modelValue: {
|
|
13800
16728
|
type: [String, Number]
|
|
13801
16729
|
},
|
|
@@ -13945,9 +16873,9 @@ const useTabs = (options = {}) => {
|
|
|
13945
16873
|
|
|
13946
16874
|
/** @jsxImportSource vue */
|
|
13947
16875
|
|
|
13948
|
-
const COMPONENT_NAME$
|
|
16876
|
+
const COMPONENT_NAME$f = 'vc-tabs';
|
|
13949
16877
|
const Tabs = /* @__PURE__ */ vue.defineComponent({
|
|
13950
|
-
name: COMPONENT_NAME$
|
|
16878
|
+
name: COMPONENT_NAME$f,
|
|
13951
16879
|
props: props$b,
|
|
13952
16880
|
emits: ['update:modelValue', 'change', 'click'],
|
|
13953
16881
|
setup(props, {
|
|
@@ -14195,9 +17123,9 @@ const useTabsPane = () => {
|
|
|
14195
17123
|
|
|
14196
17124
|
/** @jsxImportSource vue */
|
|
14197
17125
|
|
|
14198
|
-
const COMPONENT_NAME$
|
|
17126
|
+
const COMPONENT_NAME$e = 'vc-tabs-pane';
|
|
14199
17127
|
const TabsPane = /* @__PURE__ */ vue.defineComponent({
|
|
14200
|
-
name: COMPONENT_NAME$
|
|
17128
|
+
name: COMPONENT_NAME$e,
|
|
14201
17129
|
props: props$a,
|
|
14202
17130
|
setup(_, {
|
|
14203
17131
|
slots
|
|
@@ -14252,9 +17180,9 @@ const props$9 = {
|
|
|
14252
17180
|
|
|
14253
17181
|
/** @jsxImportSource vue */
|
|
14254
17182
|
|
|
14255
|
-
const COMPONENT_NAME$
|
|
17183
|
+
const COMPONENT_NAME$d = 'vcm-tabs';
|
|
14256
17184
|
const MTabs = /* @__PURE__ */ vue.defineComponent({
|
|
14257
|
-
name: COMPONENT_NAME$
|
|
17185
|
+
name: COMPONENT_NAME$d,
|
|
14258
17186
|
props: props$9,
|
|
14259
17187
|
emits: ['update:modelValue', 'change', 'click'],
|
|
14260
17188
|
setup(props, {
|
|
@@ -14519,9 +17447,9 @@ const MTabs = /* @__PURE__ */ vue.defineComponent({
|
|
|
14519
17447
|
|
|
14520
17448
|
/** @jsxImportSource vue */
|
|
14521
17449
|
|
|
14522
|
-
const COMPONENT_NAME$
|
|
17450
|
+
const COMPONENT_NAME$c = 'vcm-tabs-pane';
|
|
14523
17451
|
const MTabsPane = /* @__PURE__ */ vue.defineComponent({
|
|
14524
|
-
name: COMPONENT_NAME$
|
|
17452
|
+
name: COMPONENT_NAME$c,
|
|
14525
17453
|
props: props$a,
|
|
14526
17454
|
setup(_, {
|
|
14527
17455
|
slots
|
|
@@ -14645,9 +17573,9 @@ const getFitIndex = (options = {}) => {
|
|
|
14645
17573
|
|
|
14646
17574
|
/** @jsxImportSource vue */
|
|
14647
17575
|
|
|
14648
|
-
const COMPONENT_NAME$
|
|
17576
|
+
const COMPONENT_NAME$b = 'vc-text';
|
|
14649
17577
|
const Text = /* @__PURE__ */ vue.defineComponent({
|
|
14650
|
-
name: COMPONENT_NAME$
|
|
17578
|
+
name: COMPONENT_NAME$b,
|
|
14651
17579
|
props: props$8,
|
|
14652
17580
|
setup(props, {
|
|
14653
17581
|
emit
|
|
@@ -14740,9 +17668,9 @@ const props$7 = {
|
|
|
14740
17668
|
|
|
14741
17669
|
/** @jsxImportSource vue */
|
|
14742
17670
|
|
|
14743
|
-
const COMPONENT_NAME$
|
|
17671
|
+
const COMPONENT_NAME$a = 'vc-textarea';
|
|
14744
17672
|
const Textarea = /* @__PURE__ */ vue.defineComponent({
|
|
14745
|
-
name: COMPONENT_NAME$
|
|
17673
|
+
name: COMPONENT_NAME$a,
|
|
14746
17674
|
props: props$7,
|
|
14747
17675
|
setup(props, {
|
|
14748
17676
|
slots
|
|
@@ -14800,9 +17728,9 @@ const props$6 = {
|
|
|
14800
17728
|
}
|
|
14801
17729
|
};
|
|
14802
17730
|
|
|
14803
|
-
const COMPONENT_NAME$
|
|
17731
|
+
const COMPONENT_NAME$9 = "vc-theme";
|
|
14804
17732
|
const Theme = vue.defineComponent({
|
|
14805
|
-
name: COMPONENT_NAME$
|
|
17733
|
+
name: COMPONENT_NAME$9,
|
|
14806
17734
|
props: props$6,
|
|
14807
17735
|
setup(props, { slots }) {
|
|
14808
17736
|
const themeId = Utils__namespace.getUid("vc-theme");
|
|
@@ -14888,9 +17816,9 @@ const Theme = vue.defineComponent({
|
|
|
14888
17816
|
}
|
|
14889
17817
|
});
|
|
14890
17818
|
|
|
14891
|
-
const COMPONENT_NAME$
|
|
17819
|
+
const COMPONENT_NAME$8 = "vc-theme-view";
|
|
14892
17820
|
const ThemeView = vue.defineComponent({
|
|
14893
|
-
name: COMPONENT_NAME$
|
|
17821
|
+
name: COMPONENT_NAME$8,
|
|
14894
17822
|
props: props$6,
|
|
14895
17823
|
setup(props, { slots }) {
|
|
14896
17824
|
return () => {
|
|
@@ -14906,9 +17834,9 @@ const ThemeView = vue.defineComponent({
|
|
|
14906
17834
|
}
|
|
14907
17835
|
});
|
|
14908
17836
|
|
|
14909
|
-
const COMPONENT_NAME$
|
|
17837
|
+
const COMPONENT_NAME$7 = "vc-theme-text";
|
|
14910
17838
|
const ThemeText = vue.defineComponent({
|
|
14911
|
-
name: COMPONENT_NAME$
|
|
17839
|
+
name: COMPONENT_NAME$7,
|
|
14912
17840
|
props: props$6,
|
|
14913
17841
|
setup(props, { slots }) {
|
|
14914
17842
|
return () => {
|
|
@@ -14924,9 +17852,9 @@ const ThemeText = vue.defineComponent({
|
|
|
14924
17852
|
}
|
|
14925
17853
|
});
|
|
14926
17854
|
|
|
14927
|
-
const COMPONENT_NAME$
|
|
17855
|
+
const COMPONENT_NAME$6 = "vc-theme-image";
|
|
14928
17856
|
const ThemeImage = vue.defineComponent({
|
|
14929
|
-
name: COMPONENT_NAME$
|
|
17857
|
+
name: COMPONENT_NAME$6,
|
|
14930
17858
|
props: props$6,
|
|
14931
17859
|
setup(props, { slots }) {
|
|
14932
17860
|
return () => {
|
|
@@ -14974,11 +17902,12 @@ const props$5 = {
|
|
|
14974
17902
|
|
|
14975
17903
|
/** @jsxImportSource vue */
|
|
14976
17904
|
|
|
17905
|
+
const COMPONENT_NAME$5 = 'vc-time-picker';
|
|
14977
17906
|
const getPanel = type => {
|
|
14978
17907
|
const isRange = type === 'timerange';
|
|
14979
17908
|
return isRange ? TimeRangePanel : TimePanel;
|
|
14980
17909
|
};
|
|
14981
|
-
const TimePicker = createPicker(props$5, () => {
|
|
17910
|
+
const TimePicker = createPicker(COMPONENT_NAME$5, props$5, () => {
|
|
14982
17911
|
const props = vue.getCurrentInstance().props;
|
|
14983
17912
|
const icon = vue.ref('icon');
|
|
14984
17913
|
const panel = vue.shallowRef({});
|
|
@@ -15525,7 +18454,7 @@ exports.Drawer = Drawer;
|
|
|
15525
18454
|
exports.DrawerView = DrawerView;
|
|
15526
18455
|
exports.Dropdown = Dropdown;
|
|
15527
18456
|
exports.Editor = Editor;
|
|
15528
|
-
exports.Expand = Expand;
|
|
18457
|
+
exports.Expand = Expand$1;
|
|
15529
18458
|
exports.Form = Form;
|
|
15530
18459
|
exports.FormItem = FormItem;
|
|
15531
18460
|
exports.Fragment = Fragment;
|
|
@@ -15608,6 +18537,7 @@ exports.MSpin = MSpin;
|
|
|
15608
18537
|
exports.MSteps = MSteps;
|
|
15609
18538
|
exports.MSwitch = MSwitch;
|
|
15610
18539
|
exports.MTable = MTable;
|
|
18540
|
+
exports.MTableColumn = MTableColumn;
|
|
15611
18541
|
exports.MTabs = MTabs;
|
|
15612
18542
|
exports.MTabsPane = MTabsPane;
|
|
15613
18543
|
exports.MTag = MTag;
|
|
@@ -15658,6 +18588,7 @@ exports.Spin = Spin;
|
|
|
15658
18588
|
exports.Steps = Steps;
|
|
15659
18589
|
exports.Switch = Switch;
|
|
15660
18590
|
exports.Table = Table;
|
|
18591
|
+
exports.TableColumn = TableColumn;
|
|
15661
18592
|
exports.Tabs = Tabs;
|
|
15662
18593
|
exports.TabsPane = TabsPane;
|
|
15663
18594
|
exports.Tag = Tag;
|