@deot/vc-components 1.0.9 → 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 +3270 -312
- package/dist/index.d.ts +549 -14
- package/dist/index.iife.js +21302 -390
- package/dist/index.js +3271 -315
- package/dist/index.style.css +1 -1
- package/dist/index.umd.cjs +21302 -390
- 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
|
|
@@ -3126,6 +3128,10 @@ const props$Y = {
|
|
|
3126
3128
|
changeOnSelect: {
|
|
3127
3129
|
type: Boolean,
|
|
3128
3130
|
default: false
|
|
3131
|
+
},
|
|
3132
|
+
nullValue: {
|
|
3133
|
+
type: [Number, String, Object],
|
|
3134
|
+
default: ""
|
|
3129
3135
|
}
|
|
3130
3136
|
};
|
|
3131
3137
|
|
|
@@ -3320,9 +3326,9 @@ const useNativeEmitter = (input, expose) => {
|
|
|
3320
3326
|
|
|
3321
3327
|
/** @jsxImportSource vue */
|
|
3322
3328
|
|
|
3323
|
-
const COMPONENT_NAME$
|
|
3329
|
+
const COMPONENT_NAME$1s = 'vc-input';
|
|
3324
3330
|
const Input = /* @__PURE__ */ vue.defineComponent({
|
|
3325
|
-
name: COMPONENT_NAME$
|
|
3331
|
+
name: COMPONENT_NAME$1s,
|
|
3326
3332
|
inheritAttrs: false,
|
|
3327
3333
|
props: {
|
|
3328
3334
|
...props$$,
|
|
@@ -3656,9 +3662,9 @@ const useInputNumber = () => {
|
|
|
3656
3662
|
|
|
3657
3663
|
/** @jsxImportSource vue */
|
|
3658
3664
|
|
|
3659
|
-
const COMPONENT_NAME$
|
|
3665
|
+
const COMPONENT_NAME$1r = 'vc-input-number';
|
|
3660
3666
|
const InputNumber = /* @__PURE__ */ vue.defineComponent({
|
|
3661
|
-
name: COMPONENT_NAME$
|
|
3667
|
+
name: COMPONENT_NAME$1r,
|
|
3662
3668
|
props: props$X,
|
|
3663
3669
|
inheritAttrs: false,
|
|
3664
3670
|
setup(props, {
|
|
@@ -3722,9 +3728,9 @@ const props$W = {
|
|
|
3722
3728
|
|
|
3723
3729
|
/** @jsxImportSource vue */
|
|
3724
3730
|
|
|
3725
|
-
const COMPONENT_NAME$
|
|
3731
|
+
const COMPONENT_NAME$1q = 'vc-input-search';
|
|
3726
3732
|
const InputSearch = /* @__PURE__ */ vue.defineComponent({
|
|
3727
|
-
name: COMPONENT_NAME$
|
|
3733
|
+
name: COMPONENT_NAME$1q,
|
|
3728
3734
|
props: props$W,
|
|
3729
3735
|
inheritAttrs: false,
|
|
3730
3736
|
setup(props, {
|
|
@@ -4015,9 +4021,9 @@ const usePos = () => {
|
|
|
4015
4021
|
function _isSlot$2(s) {
|
|
4016
4022
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
4017
4023
|
}
|
|
4018
|
-
const COMPONENT_NAME$
|
|
4024
|
+
const COMPONENT_NAME$1p = 'vc-popover-wrapper';
|
|
4019
4025
|
const PopoverWrapper = /* @__PURE__ */ vue.defineComponent({
|
|
4020
|
-
name: COMPONENT_NAME$
|
|
4026
|
+
name: COMPONENT_NAME$1p,
|
|
4021
4027
|
props: props$_,
|
|
4022
4028
|
emits: ['portal-fulfilled', 'close'],
|
|
4023
4029
|
setup(props, {
|
|
@@ -4269,9 +4275,9 @@ const PopoverPortal = new Portal(PopoverWrapper);
|
|
|
4269
4275
|
|
|
4270
4276
|
/** @jsxImportSource vue */
|
|
4271
4277
|
|
|
4272
|
-
const COMPONENT_NAME$
|
|
4278
|
+
const COMPONENT_NAME$1o = 'vc-popover';
|
|
4273
4279
|
const Popover$1 = /* @__PURE__ */ vue.defineComponent({
|
|
4274
|
-
name: COMPONENT_NAME$
|
|
4280
|
+
name: COMPONENT_NAME$1o,
|
|
4275
4281
|
props: props$Z,
|
|
4276
4282
|
emits: ['update:modelValue', 'visible-change', 'ready', 'close'],
|
|
4277
4283
|
setup(props, {
|
|
@@ -4421,6 +4427,7 @@ const DEFAULT_FORMATS = {
|
|
|
4421
4427
|
datetime: "YYYY-MM-DD HH:mm:ss",
|
|
4422
4428
|
time: "HH:mm:ss",
|
|
4423
4429
|
timerange: "HH:mm:ss",
|
|
4430
|
+
monthrange: "YYYY-MM",
|
|
4424
4431
|
daterange: "YYYY-MM-DD",
|
|
4425
4432
|
datetimerange: "YYYY-MM-DD HH:mm:ss"
|
|
4426
4433
|
};
|
|
@@ -4968,8 +4975,8 @@ const useBase = () => {
|
|
|
4968
4975
|
const props = instance.props;
|
|
4969
4976
|
const isHover = vue.ref(false);
|
|
4970
4977
|
const isActive = vue.ref(false);
|
|
4971
|
-
const currentValue = vue.ref(
|
|
4972
|
-
const focusedDate = vue.ref(
|
|
4978
|
+
const currentValue = vue.ref([]);
|
|
4979
|
+
const focusedDate = vue.ref();
|
|
4973
4980
|
const formItem = vue.inject("vc-form-item", {});
|
|
4974
4981
|
const its = vcHooks.useAttrs({ merge: false });
|
|
4975
4982
|
const formatDateText = (value) => {
|
|
@@ -5034,23 +5041,22 @@ const useBase = () => {
|
|
|
5034
5041
|
};
|
|
5035
5042
|
const parseValue = (val) => {
|
|
5036
5043
|
if (isEmpty(val)) {
|
|
5037
|
-
return
|
|
5044
|
+
return [];
|
|
5038
5045
|
}
|
|
5039
5046
|
return parserDate(val);
|
|
5040
5047
|
};
|
|
5041
|
-
const
|
|
5042
|
-
currentValue.value =
|
|
5048
|
+
const reset = (v) => {
|
|
5049
|
+
currentValue.value = value2Array(v);
|
|
5043
5050
|
};
|
|
5044
5051
|
const sync = (eventName, value) => {
|
|
5045
|
-
const
|
|
5046
|
-
|
|
5047
|
-
emit("input", date);
|
|
5048
|
-
emit("update:modelValue", dateString);
|
|
5052
|
+
const formatValue = formatDate(isRange.value || isQuarter.value ? value : value[0]) || props.nullValue;
|
|
5053
|
+
emit("update:modelValue", formatValue);
|
|
5049
5054
|
eventName = typeof eventName === "string" ? [eventName] : eventName;
|
|
5050
5055
|
eventName.forEach((name) => {
|
|
5051
|
-
emit(name,
|
|
5056
|
+
emit(name, formatValue, reset);
|
|
5052
5057
|
});
|
|
5053
|
-
formItem?.change?.(
|
|
5058
|
+
formItem?.change?.();
|
|
5059
|
+
return formatValue;
|
|
5054
5060
|
};
|
|
5055
5061
|
const executePromise = (promiseFn, cb, param) => {
|
|
5056
5062
|
try {
|
|
@@ -5080,11 +5086,9 @@ const useBase = () => {
|
|
|
5080
5086
|
};
|
|
5081
5087
|
const handleClear = () => {
|
|
5082
5088
|
const clear = () => {
|
|
5083
|
-
const date = isRange.value ? [] : "";
|
|
5084
5089
|
isActive.value = false;
|
|
5085
|
-
currentValue.value =
|
|
5086
|
-
sync("change",
|
|
5087
|
-
emit("clear", date);
|
|
5090
|
+
currentValue.value = [];
|
|
5091
|
+
emit("clear", sync("change", []));
|
|
5088
5092
|
};
|
|
5089
5093
|
executePromise(instance.vnode.props?.onBeforeClear, clear);
|
|
5090
5094
|
};
|
|
@@ -5101,10 +5105,10 @@ const useBase = () => {
|
|
|
5101
5105
|
executePromise(instance.vnode.props?.onBeforeOk, ok, value);
|
|
5102
5106
|
};
|
|
5103
5107
|
const handleClose = () => {
|
|
5104
|
-
const
|
|
5105
|
-
const isSetValueProp =
|
|
5106
|
-
if (!lodashEs.isEqualWith(currentValue.value,
|
|
5107
|
-
currentValue.value = value2Array(
|
|
5108
|
+
const v = parseValue(props.modelValue);
|
|
5109
|
+
const isSetValueProp = props.modelValue;
|
|
5110
|
+
if (!lodashEs.isEqualWith(currentValue.value, v) && isSetValueProp) {
|
|
5111
|
+
currentValue.value = value2Array(v);
|
|
5108
5112
|
}
|
|
5109
5113
|
emit("close");
|
|
5110
5114
|
};
|
|
@@ -5112,7 +5116,7 @@ const useBase = () => {
|
|
|
5112
5116
|
() => props.modelValue,
|
|
5113
5117
|
(v) => {
|
|
5114
5118
|
v = parseValue(v);
|
|
5115
|
-
focusedDate.value = v[0] || props.startDate || /* @__PURE__ */ new Date();
|
|
5119
|
+
focusedDate.value = v?.[0] || props.startDate || /* @__PURE__ */ new Date();
|
|
5116
5120
|
currentValue.value = value2Array(v);
|
|
5117
5121
|
},
|
|
5118
5122
|
{ immediate: true }
|
|
@@ -5148,9 +5152,8 @@ const useBase = () => {
|
|
|
5148
5152
|
|
|
5149
5153
|
/** @jsxImportSource vue */
|
|
5150
5154
|
|
|
5151
|
-
const
|
|
5152
|
-
|
|
5153
|
-
name: COMPONENT_NAME$1l,
|
|
5155
|
+
const createPicker = (name, pickerProps, usePicker) => /* @__PURE__ */ vue.defineComponent({
|
|
5156
|
+
name,
|
|
5154
5157
|
props: Object.assign(props$Y, pickerProps),
|
|
5155
5158
|
inheritAttrs: false,
|
|
5156
5159
|
emits: ['update:modelValue', 'change', 'clear', 'error', 'close', 'input', 'ready', 'visible-change', 'ok'],
|
|
@@ -5206,7 +5209,7 @@ const createPicker = (pickerProps, usePicker) => /* @__PURE__ */ vue.defineCompo
|
|
|
5206
5209
|
"disabled": props.disabled,
|
|
5207
5210
|
"modelValue": visibleValue.value,
|
|
5208
5211
|
"allowDispatch": false,
|
|
5209
|
-
"class": "vc-picker__input",
|
|
5212
|
+
"class": "vc-date-picker__input",
|
|
5210
5213
|
"readonly": true,
|
|
5211
5214
|
"placeholder": props.placeholder || '请选择'
|
|
5212
5215
|
}, {
|
|
@@ -5214,7 +5217,7 @@ const createPicker = (pickerProps, usePicker) => /* @__PURE__ */ vue.defineCompo
|
|
|
5214
5217
|
return vue.createVNode("div", {
|
|
5215
5218
|
"class": [{
|
|
5216
5219
|
'is-clear': showClear
|
|
5217
|
-
}, 'vc-picker__append']
|
|
5220
|
+
}, 'vc-date-picker__append']
|
|
5218
5221
|
}, [vue.createVNode(Icon, {
|
|
5219
5222
|
"type": showClear.value ? 'clear' : icon.value,
|
|
5220
5223
|
"onClick": handleIconClick
|
|
@@ -5375,9 +5378,9 @@ const getTimeType = type => {
|
|
|
5375
5378
|
}
|
|
5376
5379
|
return view;
|
|
5377
5380
|
};
|
|
5378
|
-
const COMPONENT_NAME$
|
|
5381
|
+
const COMPONENT_NAME$1n = 'vc-date-confirm';
|
|
5379
5382
|
const Confirm = /* @__PURE__ */ vue.defineComponent({
|
|
5380
|
-
name: COMPONENT_NAME$
|
|
5383
|
+
name: COMPONENT_NAME$1n,
|
|
5381
5384
|
props: {
|
|
5382
5385
|
showTime: {
|
|
5383
5386
|
type: Boolean,
|
|
@@ -5441,9 +5444,9 @@ const Confirm = /* @__PURE__ */ vue.defineComponent({
|
|
|
5441
5444
|
|
|
5442
5445
|
/** @jsxImportSource vue */
|
|
5443
5446
|
|
|
5444
|
-
const COMPONENT_NAME$
|
|
5447
|
+
const COMPONENT_NAME$1m = 'vc-date-header';
|
|
5445
5448
|
const DateHeader = /* @__PURE__ */ vue.defineComponent({
|
|
5446
|
-
name: COMPONENT_NAME$
|
|
5449
|
+
name: COMPONENT_NAME$1m,
|
|
5447
5450
|
props: {
|
|
5448
5451
|
panelDate: Date,
|
|
5449
5452
|
showNext: {
|
|
@@ -5527,9 +5530,9 @@ const DateHeader = /* @__PURE__ */ vue.defineComponent({
|
|
|
5527
5530
|
|
|
5528
5531
|
/** @jsxImportSource vue */
|
|
5529
5532
|
|
|
5530
|
-
const COMPONENT_NAME$
|
|
5533
|
+
const COMPONENT_NAME$1l = 'vc-date-table';
|
|
5531
5534
|
const DateTable = /* @__PURE__ */ vue.defineComponent({
|
|
5532
|
-
name: COMPONENT_NAME$
|
|
5535
|
+
name: COMPONENT_NAME$1l,
|
|
5533
5536
|
props: {
|
|
5534
5537
|
value: Array,
|
|
5535
5538
|
firstDayOfWeek: {
|
|
@@ -5738,9 +5741,9 @@ const DateTable = /* @__PURE__ */ vue.defineComponent({
|
|
|
5738
5741
|
|
|
5739
5742
|
/** @jsxImportSource vue */
|
|
5740
5743
|
|
|
5741
|
-
const COMPONENT_NAME$
|
|
5744
|
+
const COMPONENT_NAME$1k = 'vc-month-table';
|
|
5742
5745
|
const MonthTable = /* @__PURE__ */ vue.defineComponent({
|
|
5743
|
-
name: COMPONENT_NAME$
|
|
5746
|
+
name: COMPONENT_NAME$1k,
|
|
5744
5747
|
props: {
|
|
5745
5748
|
value: Array,
|
|
5746
5749
|
panelDate: Date,
|
|
@@ -5872,7 +5875,7 @@ const MonthTable = /* @__PURE__ */ vue.defineComponent({
|
|
|
5872
5875
|
|
|
5873
5876
|
/** @jsxImportSource vue */
|
|
5874
5877
|
|
|
5875
|
-
const COMPONENT_NAME$
|
|
5878
|
+
const COMPONENT_NAME$1j = 'vc-quarter-table';
|
|
5876
5879
|
|
|
5877
5880
|
/**
|
|
5878
5881
|
* 获取季度对应的月份范围
|
|
@@ -5906,7 +5909,7 @@ const getQuarterRangeByMonth = value => {
|
|
|
5906
5909
|
}
|
|
5907
5910
|
};
|
|
5908
5911
|
const QuarterTable = /* @__PURE__ */ vue.defineComponent({
|
|
5909
|
-
name: COMPONENT_NAME$
|
|
5912
|
+
name: COMPONENT_NAME$1j,
|
|
5910
5913
|
props: {
|
|
5911
5914
|
value: Array,
|
|
5912
5915
|
panelDate: Date,
|
|
@@ -6029,9 +6032,9 @@ const QuarterTable = /* @__PURE__ */ vue.defineComponent({
|
|
|
6029
6032
|
|
|
6030
6033
|
/** @jsxImportSource vue */
|
|
6031
6034
|
|
|
6032
|
-
const COMPONENT_NAME$
|
|
6035
|
+
const COMPONENT_NAME$1i = 'vc-shortcuts-select';
|
|
6033
6036
|
const ShortcutsSelect = /* @__PURE__ */ vue.defineComponent({
|
|
6034
|
-
name: COMPONENT_NAME$
|
|
6037
|
+
name: COMPONENT_NAME$1i,
|
|
6035
6038
|
props: {
|
|
6036
6039
|
panelDate: Date,
|
|
6037
6040
|
config: Array,
|
|
@@ -6071,9 +6074,9 @@ const ShortcutsSelect = /* @__PURE__ */ vue.defineComponent({
|
|
|
6071
6074
|
|
|
6072
6075
|
/** @jsxImportSource vue */
|
|
6073
6076
|
|
|
6074
|
-
const COMPONENT_NAME$
|
|
6077
|
+
const COMPONENT_NAME$1h = 'vc-time-select';
|
|
6075
6078
|
const TimeSelect = /* @__PURE__ */ vue.defineComponent({
|
|
6076
|
-
name: COMPONENT_NAME$
|
|
6079
|
+
name: COMPONENT_NAME$1h,
|
|
6077
6080
|
props: {
|
|
6078
6081
|
hours: {
|
|
6079
6082
|
type: [Number, String],
|
|
@@ -6352,9 +6355,9 @@ const TimeSelect = /* @__PURE__ */ vue.defineComponent({
|
|
|
6352
6355
|
|
|
6353
6356
|
/** @jsxImportSource vue */
|
|
6354
6357
|
|
|
6355
|
-
const COMPONENT_NAME$
|
|
6358
|
+
const COMPONENT_NAME$1g = 'vc-year-table';
|
|
6356
6359
|
const YearTable = /* @__PURE__ */ vue.defineComponent({
|
|
6357
|
-
name: COMPONENT_NAME$
|
|
6360
|
+
name: COMPONENT_NAME$1g,
|
|
6358
6361
|
props: {
|
|
6359
6362
|
value: Array,
|
|
6360
6363
|
panelDate: Date,
|
|
@@ -6477,9 +6480,9 @@ const getDateIsInRange = (value, type, leftPanelDate, rightPanelDate) => {
|
|
|
6477
6480
|
}
|
|
6478
6481
|
return true;
|
|
6479
6482
|
};
|
|
6480
|
-
const COMPONENT_NAME$
|
|
6483
|
+
const COMPONENT_NAME$1f = 'vc-date-range-panel';
|
|
6481
6484
|
const DateRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
6482
|
-
name: COMPONENT_NAME$
|
|
6485
|
+
name: COMPONENT_NAME$1f,
|
|
6483
6486
|
props: {
|
|
6484
6487
|
...props$V,
|
|
6485
6488
|
confirm: {
|
|
@@ -6858,9 +6861,9 @@ const DateRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
|
6858
6861
|
|
|
6859
6862
|
/** @jsxImportSource vue */
|
|
6860
6863
|
|
|
6861
|
-
const COMPONENT_NAME$
|
|
6864
|
+
const COMPONENT_NAME$1e = 'vc-date-panel';
|
|
6862
6865
|
const DatePanel = /* @__PURE__ */ vue.defineComponent({
|
|
6863
|
-
name: COMPONENT_NAME$
|
|
6866
|
+
name: COMPONENT_NAME$1e,
|
|
6864
6867
|
props: {
|
|
6865
6868
|
...props$V,
|
|
6866
6869
|
type: String,
|
|
@@ -7068,9 +7071,9 @@ const isEqualYear$1 = value => {
|
|
|
7068
7071
|
const endYear = value[1].getFullYear();
|
|
7069
7072
|
return startYear === endYear;
|
|
7070
7073
|
};
|
|
7071
|
-
const COMPONENT_NAME$
|
|
7074
|
+
const COMPONENT_NAME$1d = 'vc-monthrange-panel';
|
|
7072
7075
|
const MonthRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
7073
|
-
name: COMPONENT_NAME$
|
|
7076
|
+
name: COMPONENT_NAME$1d,
|
|
7074
7077
|
props: {
|
|
7075
7078
|
...props$V,
|
|
7076
7079
|
confirm: {
|
|
@@ -7245,9 +7248,9 @@ const isEqualYear = value => {
|
|
|
7245
7248
|
const endYear = value[1].getFullYear();
|
|
7246
7249
|
return startYear === endYear;
|
|
7247
7250
|
};
|
|
7248
|
-
const COMPONENT_NAME$
|
|
7251
|
+
const COMPONENT_NAME$1c = 'vc-quarterrange-panel';
|
|
7249
7252
|
const QuarterRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
7250
|
-
name: COMPONENT_NAME$
|
|
7253
|
+
name: COMPONENT_NAME$1c,
|
|
7251
7254
|
props: {
|
|
7252
7255
|
...props$V,
|
|
7253
7256
|
confirm: {
|
|
@@ -7486,9 +7489,9 @@ const getComparedDate = (leftDate, rightDate) => {
|
|
|
7486
7489
|
seconds
|
|
7487
7490
|
};
|
|
7488
7491
|
};
|
|
7489
|
-
const COMPONENT_NAME$
|
|
7492
|
+
const COMPONENT_NAME$1b = 'vc-timerange-panel';
|
|
7490
7493
|
const TimeRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
7491
|
-
name: COMPONENT_NAME$
|
|
7494
|
+
name: COMPONENT_NAME$1b,
|
|
7492
7495
|
props: props$U,
|
|
7493
7496
|
emits: ['pick', 'clear', 'ok'],
|
|
7494
7497
|
setup(props, {
|
|
@@ -7587,9 +7590,9 @@ const TimeRangePanel = /* @__PURE__ */ vue.defineComponent({
|
|
|
7587
7590
|
|
|
7588
7591
|
/** @jsxImportSource vue */
|
|
7589
7592
|
|
|
7590
|
-
const COMPONENT_NAME$
|
|
7593
|
+
const COMPONENT_NAME$1a = 'vc-time-panel';
|
|
7591
7594
|
const TimePanel = /* @__PURE__ */ vue.defineComponent({
|
|
7592
|
-
name: COMPONENT_NAME$
|
|
7595
|
+
name: COMPONENT_NAME$1a,
|
|
7593
7596
|
props: props$U,
|
|
7594
7597
|
emits: ['pick', 'clear', 'ok'],
|
|
7595
7598
|
setup(props, {
|
|
@@ -7644,6 +7647,7 @@ const TimePanel = /* @__PURE__ */ vue.defineComponent({
|
|
|
7644
7647
|
|
|
7645
7648
|
/** @jsxImportSource vue */
|
|
7646
7649
|
|
|
7650
|
+
const COMPONENT_NAME$19 = 'vc-date-picker';
|
|
7647
7651
|
const getPanel$1 = type => {
|
|
7648
7652
|
if (['daterange', 'datetimerange'].includes(type)) {
|
|
7649
7653
|
return DateRangePanel;
|
|
@@ -7654,7 +7658,7 @@ const getPanel$1 = type => {
|
|
|
7654
7658
|
}
|
|
7655
7659
|
return DatePanel;
|
|
7656
7660
|
};
|
|
7657
|
-
const DatePicker = createPicker(props$10, () => {
|
|
7661
|
+
const DatePicker = createPicker(COMPONENT_NAME$19, props$10, () => {
|
|
7658
7662
|
const props = vue.getCurrentInstance().props;
|
|
7659
7663
|
const icon = vue.ref('date');
|
|
7660
7664
|
const panel = vue.shallowRef({});
|
|
@@ -7687,9 +7691,9 @@ const props$T = {
|
|
|
7687
7691
|
|
|
7688
7692
|
/** @jsxImportSource vue */
|
|
7689
7693
|
|
|
7690
|
-
const COMPONENT_NAME$
|
|
7694
|
+
const COMPONENT_NAME$18 = 'vc-divider';
|
|
7691
7695
|
const Divider = /* @__PURE__ */ vue.defineComponent({
|
|
7692
|
-
name: COMPONENT_NAME$
|
|
7696
|
+
name: COMPONENT_NAME$18,
|
|
7693
7697
|
props: props$T,
|
|
7694
7698
|
setup(props, {
|
|
7695
7699
|
slots
|
|
@@ -7844,7 +7848,7 @@ const props$Q = {
|
|
|
7844
7848
|
|
|
7845
7849
|
/** @jsxImportSource vue */
|
|
7846
7850
|
|
|
7847
|
-
const COMPONENT_NAME$
|
|
7851
|
+
const COMPONENT_NAME$17 = 'vc-scroller-track';
|
|
7848
7852
|
const BAR_MAP = {
|
|
7849
7853
|
vertical: {
|
|
7850
7854
|
scroll: 'scrollTop',
|
|
@@ -7864,12 +7868,14 @@ const BAR_MAP = {
|
|
|
7864
7868
|
}
|
|
7865
7869
|
};
|
|
7866
7870
|
const Track = /* @__PURE__ */ vue.defineComponent({
|
|
7867
|
-
name: COMPONENT_NAME$
|
|
7871
|
+
name: COMPONENT_NAME$17,
|
|
7868
7872
|
props: props$S,
|
|
7869
7873
|
emits: ['change'],
|
|
7874
|
+
inheritAttrs: false,
|
|
7870
7875
|
setup(props, {
|
|
7871
7876
|
emit,
|
|
7872
|
-
expose
|
|
7877
|
+
expose,
|
|
7878
|
+
attrs
|
|
7873
7879
|
}) {
|
|
7874
7880
|
const instance = vue.getCurrentInstance();
|
|
7875
7881
|
const track = vue.ref();
|
|
@@ -8036,6 +8042,7 @@ const Track = /* @__PURE__ */ vue.defineComponent({
|
|
|
8036
8042
|
default: () => [vue.withDirectives(vue.createVNode("div", {
|
|
8037
8043
|
"ref": track,
|
|
8038
8044
|
"class": ['is-' + barOptions.value.key, 'vc-scroller-track'],
|
|
8045
|
+
"style": attrs.style,
|
|
8039
8046
|
"onMousedown": handleClickTrack
|
|
8040
8047
|
}, [vue.createVNode("div", {
|
|
8041
8048
|
"ref": thumb,
|
|
@@ -8050,9 +8057,9 @@ const Track = /* @__PURE__ */ vue.defineComponent({
|
|
|
8050
8057
|
|
|
8051
8058
|
/** @jsxImportSource vue */
|
|
8052
8059
|
|
|
8053
|
-
const COMPONENT_NAME$
|
|
8060
|
+
const COMPONENT_NAME$16 = 'vc-scroller-bar';
|
|
8054
8061
|
const Bar = /* @__PURE__ */ vue.defineComponent({
|
|
8055
|
-
name: COMPONENT_NAME$
|
|
8062
|
+
name: COMPONENT_NAME$16,
|
|
8056
8063
|
props: props$R,
|
|
8057
8064
|
emits: ['change'],
|
|
8058
8065
|
setup(props, {
|
|
@@ -8267,7 +8274,7 @@ const useScroller = (expose) => {
|
|
|
8267
8274
|
|
|
8268
8275
|
/** @jsxImportSource vue */
|
|
8269
8276
|
|
|
8270
|
-
const COMPONENT_NAME$
|
|
8277
|
+
const COMPONENT_NAME$15 = 'vc-scroller';
|
|
8271
8278
|
|
|
8272
8279
|
/**
|
|
8273
8280
|
* 作为备选方案,目前推荐使用ScrollerWheel
|
|
@@ -8278,7 +8285,7 @@ const COMPONENT_NAME$13 = 'vc-scroller';
|
|
|
8278
8285
|
* 2. 增加了一层嵌套
|
|
8279
8286
|
*/
|
|
8280
8287
|
const Scroller = /* @__PURE__ */ vue.defineComponent({
|
|
8281
|
-
name: COMPONENT_NAME$
|
|
8288
|
+
name: COMPONENT_NAME$15,
|
|
8282
8289
|
props: props$Q,
|
|
8283
8290
|
emits: ['scroll'],
|
|
8284
8291
|
setup(props, {
|
|
@@ -8339,7 +8346,7 @@ const Scroller = /* @__PURE__ */ vue.defineComponent({
|
|
|
8339
8346
|
|
|
8340
8347
|
/** @jsxImportSource vue */
|
|
8341
8348
|
|
|
8342
|
-
const COMPONENT_NAME$
|
|
8349
|
+
const COMPONENT_NAME$14 = 'vc-scroller-wheel';
|
|
8343
8350
|
|
|
8344
8351
|
/**
|
|
8345
8352
|
* 为减少一层嵌套,为去除滚动bar的抖动,使用wheel模拟
|
|
@@ -8361,8 +8368,13 @@ const COMPONENT_NAME$12 = 'vc-scroller-wheel';
|
|
|
8361
8368
|
* 设置scrollTop不会reflow和repaint,不需要考虑transfrom来改变content(transform也只在draw完成)
|
|
8362
8369
|
*/
|
|
8363
8370
|
const ScrollerWheel = /* @__PURE__ */ vue.defineComponent({
|
|
8364
|
-
name: COMPONENT_NAME$
|
|
8365
|
-
props: props$Q,
|
|
8371
|
+
name: COMPONENT_NAME$14,
|
|
8372
|
+
props: Object.assign(props$Q, {
|
|
8373
|
+
stopPropagation: {
|
|
8374
|
+
type: Boolean,
|
|
8375
|
+
default: true
|
|
8376
|
+
}
|
|
8377
|
+
}),
|
|
8366
8378
|
emits: ['scroll'],
|
|
8367
8379
|
setup(props, {
|
|
8368
8380
|
slots,
|
|
@@ -8422,7 +8434,10 @@ const ScrollerWheel = /* @__PURE__ */ vue.defineComponent({
|
|
|
8422
8434
|
vue.onMounted(() => {
|
|
8423
8435
|
wheel = new helperWheel.Wheel(wrapper.value, {
|
|
8424
8436
|
shouldWheelX,
|
|
8425
|
-
shouldWheelY
|
|
8437
|
+
shouldWheelY,
|
|
8438
|
+
stopPropagation: () => {
|
|
8439
|
+
return props.stopPropagation;
|
|
8440
|
+
}
|
|
8426
8441
|
});
|
|
8427
8442
|
wheel.on(handleWheel);
|
|
8428
8443
|
});
|
|
@@ -8532,9 +8547,9 @@ const props$P = {
|
|
|
8532
8547
|
|
|
8533
8548
|
/** @jsxImportSource vue */
|
|
8534
8549
|
|
|
8535
|
-
const COMPONENT_NAME$
|
|
8550
|
+
const COMPONENT_NAME$13 = 'vc-drawer';
|
|
8536
8551
|
const DrawerView = /* @__PURE__ */ vue.defineComponent({
|
|
8537
|
-
name: COMPONENT_NAME$
|
|
8552
|
+
name: COMPONENT_NAME$13,
|
|
8538
8553
|
props: props$P,
|
|
8539
8554
|
emits: ['close', 'update:modelValue', 'visible-change'],
|
|
8540
8555
|
setup(props, {
|
|
@@ -8707,9 +8722,9 @@ const props$O = {
|
|
|
8707
8722
|
|
|
8708
8723
|
/** @jsxImportSource vue */
|
|
8709
8724
|
|
|
8710
|
-
const COMPONENT_NAME$
|
|
8725
|
+
const COMPONENT_NAME$12 = 'vc-dropdown';
|
|
8711
8726
|
const Dropdown = /* @__PURE__ */ vue.defineComponent({
|
|
8712
|
-
name: COMPONENT_NAME$
|
|
8727
|
+
name: COMPONENT_NAME$12,
|
|
8713
8728
|
props: props$O,
|
|
8714
8729
|
setup(props, {
|
|
8715
8730
|
slots
|
|
@@ -8733,9 +8748,9 @@ const props$N = {
|
|
|
8733
8748
|
|
|
8734
8749
|
/** @jsxImportSource vue */
|
|
8735
8750
|
|
|
8736
|
-
const COMPONENT_NAME
|
|
8751
|
+
const COMPONENT_NAME$11 = 'vc-editor';
|
|
8737
8752
|
const Editor = /* @__PURE__ */ vue.defineComponent({
|
|
8738
|
-
name: COMPONENT_NAME
|
|
8753
|
+
name: COMPONENT_NAME$11,
|
|
8739
8754
|
props: props$N,
|
|
8740
8755
|
setup(props, {
|
|
8741
8756
|
slots
|
|
@@ -8750,7 +8765,7 @@ const Editor = /* @__PURE__ */ vue.defineComponent({
|
|
|
8750
8765
|
|
|
8751
8766
|
const MEditor = Editor;
|
|
8752
8767
|
|
|
8753
|
-
const MExpand = Expand;
|
|
8768
|
+
const MExpand = Expand$1;
|
|
8754
8769
|
|
|
8755
8770
|
const props$M = {
|
|
8756
8771
|
tag: {
|
|
@@ -8879,9 +8894,9 @@ const useForm = (expose, options = {}) => {
|
|
|
8879
8894
|
});
|
|
8880
8895
|
};
|
|
8881
8896
|
|
|
8882
|
-
const COMPONENT_NAME$
|
|
8897
|
+
const COMPONENT_NAME$10 = "vc-form";
|
|
8883
8898
|
const Form = vue.defineComponent({
|
|
8884
|
-
name: COMPONENT_NAME$
|
|
8899
|
+
name: COMPONENT_NAME$10,
|
|
8885
8900
|
props: props$M,
|
|
8886
8901
|
setup(props, { slots, expose }) {
|
|
8887
8902
|
useForm(expose);
|
|
@@ -9201,9 +9216,9 @@ const useFormItem = (expose) => {
|
|
|
9201
9216
|
|
|
9202
9217
|
/** @jsxImportSource vue */
|
|
9203
9218
|
|
|
9204
|
-
const COMPONENT_NAME
|
|
9219
|
+
const COMPONENT_NAME$$ = 'vc-form-item';
|
|
9205
9220
|
const FormItem = /* @__PURE__ */ vue.defineComponent({
|
|
9206
|
-
name: COMPONENT_NAME
|
|
9221
|
+
name: COMPONENT_NAME$$,
|
|
9207
9222
|
props: props$L,
|
|
9208
9223
|
setup(props, {
|
|
9209
9224
|
slots,
|
|
@@ -9268,9 +9283,9 @@ const props$K = {
|
|
|
9268
9283
|
}
|
|
9269
9284
|
};
|
|
9270
9285
|
|
|
9271
|
-
const COMPONENT_NAME$
|
|
9286
|
+
const COMPONENT_NAME$_ = "vcm-form";
|
|
9272
9287
|
const MForm = vue.defineComponent({
|
|
9273
|
-
name: COMPONENT_NAME$
|
|
9288
|
+
name: COMPONENT_NAME$_,
|
|
9274
9289
|
props: props$K,
|
|
9275
9290
|
setup(props, { slots, expose }) {
|
|
9276
9291
|
useForm(expose, {
|
|
@@ -9301,9 +9316,9 @@ const props$J = {
|
|
|
9301
9316
|
|
|
9302
9317
|
/** @jsxImportSource vue */
|
|
9303
9318
|
|
|
9304
|
-
const COMPONENT_NAME$
|
|
9319
|
+
const COMPONENT_NAME$Z = 'vcm-form-item';
|
|
9305
9320
|
const MFormItem = /* @__PURE__ */ vue.defineComponent({
|
|
9306
|
-
name: COMPONENT_NAME$
|
|
9321
|
+
name: COMPONENT_NAME$Z,
|
|
9307
9322
|
props: props$J,
|
|
9308
9323
|
setup(props, {
|
|
9309
9324
|
slots,
|
|
@@ -9357,9 +9372,9 @@ const MFormItem = /* @__PURE__ */ vue.defineComponent({
|
|
|
9357
9372
|
}
|
|
9358
9373
|
});
|
|
9359
9374
|
|
|
9360
|
-
const COMPONENT_NAME$
|
|
9375
|
+
const COMPONENT_NAME$Y = "vc-fragment";
|
|
9361
9376
|
const Fragment = vue.defineComponent({
|
|
9362
|
-
name: COMPONENT_NAME$
|
|
9377
|
+
name: COMPONENT_NAME$Y,
|
|
9363
9378
|
setup(_, { slots }) {
|
|
9364
9379
|
return () => vue.h(vue.Fragment, slots.default?.());
|
|
9365
9380
|
}
|
|
@@ -9376,9 +9391,9 @@ const props$I = {
|
|
|
9376
9391
|
|
|
9377
9392
|
/** @jsxImportSource vue */
|
|
9378
9393
|
|
|
9379
|
-
const COMPONENT_NAME$
|
|
9394
|
+
const COMPONENT_NAME$X = 'vc-html-to-image';
|
|
9380
9395
|
const HTMLToImage = /* @__PURE__ */ vue.defineComponent({
|
|
9381
|
-
name: COMPONENT_NAME$
|
|
9396
|
+
name: COMPONENT_NAME$X,
|
|
9382
9397
|
props: props$I,
|
|
9383
9398
|
setup(props, {
|
|
9384
9399
|
slots
|
|
@@ -9454,7 +9469,7 @@ const IMGStore$1 = new IMGStore();
|
|
|
9454
9469
|
|
|
9455
9470
|
/** @jsxImportSource vue */
|
|
9456
9471
|
|
|
9457
|
-
const COMPONENT_NAME$
|
|
9472
|
+
const COMPONENT_NAME$W = 'vc-image';
|
|
9458
9473
|
let isSupportObjectFit = false;
|
|
9459
9474
|
window.addEventListener('DOMContentLoaded', () => {
|
|
9460
9475
|
isSupportObjectFit = !vcShared.IS_SERVER && document.documentElement.style.objectFit !== undefined;
|
|
@@ -9467,7 +9482,7 @@ const ObjectFit = {
|
|
|
9467
9482
|
SCALE_DOWN: 'scale-down'
|
|
9468
9483
|
};
|
|
9469
9484
|
const Image = /* @__PURE__ */ vue.defineComponent({
|
|
9470
|
-
name: COMPONENT_NAME$
|
|
9485
|
+
name: COMPONENT_NAME$W,
|
|
9471
9486
|
inheritAttrs: false,
|
|
9472
9487
|
props: props$H,
|
|
9473
9488
|
setup(props, {
|
|
@@ -9672,9 +9687,9 @@ const props$G = {
|
|
|
9672
9687
|
|
|
9673
9688
|
/** @jsxImportSource vue */
|
|
9674
9689
|
|
|
9675
|
-
const COMPONENT_NAME$
|
|
9690
|
+
const COMPONENT_NAME$V = 'vc-image-crop';
|
|
9676
9691
|
const ImageCrop = /* @__PURE__ */ vue.defineComponent({
|
|
9677
|
-
name: COMPONENT_NAME$
|
|
9692
|
+
name: COMPONENT_NAME$V,
|
|
9678
9693
|
props: props$G,
|
|
9679
9694
|
setup(props, {
|
|
9680
9695
|
slots
|
|
@@ -9698,9 +9713,9 @@ const props$F = {
|
|
|
9698
9713
|
|
|
9699
9714
|
/** @jsxImportSource vue */
|
|
9700
9715
|
|
|
9701
|
-
const COMPONENT_NAME$
|
|
9716
|
+
const COMPONENT_NAME$U = 'vc-image-preview';
|
|
9702
9717
|
const ImagePreview = /* @__PURE__ */ vue.defineComponent({
|
|
9703
|
-
name: COMPONENT_NAME$
|
|
9718
|
+
name: COMPONENT_NAME$U,
|
|
9704
9719
|
props: props$F,
|
|
9705
9720
|
setup(props, {
|
|
9706
9721
|
slots
|
|
@@ -9724,9 +9739,9 @@ const props$E = {
|
|
|
9724
9739
|
|
|
9725
9740
|
/** @jsxImportSource vue */
|
|
9726
9741
|
|
|
9727
|
-
const COMPONENT_NAME$
|
|
9742
|
+
const COMPONENT_NAME$T = 'vc-image-processing';
|
|
9728
9743
|
const ImageProcessing = /* @__PURE__ */ vue.defineComponent({
|
|
9729
|
-
name: COMPONENT_NAME$
|
|
9744
|
+
name: COMPONENT_NAME$T,
|
|
9730
9745
|
props: props$E,
|
|
9731
9746
|
setup(props, {
|
|
9732
9747
|
slots
|
|
@@ -9743,9 +9758,9 @@ const MImageProcessing = ImageProcessing;
|
|
|
9743
9758
|
|
|
9744
9759
|
/** @jsxImportSource vue */
|
|
9745
9760
|
|
|
9746
|
-
const COMPONENT_NAME$
|
|
9761
|
+
const COMPONENT_NAME$S = 'vcm-input';
|
|
9747
9762
|
const MInput = /* @__PURE__ */ vue.defineComponent({
|
|
9748
|
-
name: COMPONENT_NAME$
|
|
9763
|
+
name: COMPONENT_NAME$S,
|
|
9749
9764
|
inheritAttrs: false,
|
|
9750
9765
|
props: {
|
|
9751
9766
|
...props$$,
|
|
@@ -9834,9 +9849,9 @@ const MInput = /* @__PURE__ */ vue.defineComponent({
|
|
|
9834
9849
|
|
|
9835
9850
|
/** @jsxImportSource vue */
|
|
9836
9851
|
|
|
9837
|
-
const COMPONENT_NAME$
|
|
9852
|
+
const COMPONENT_NAME$R = 'vcm-input-number';
|
|
9838
9853
|
const MInputNumber = /* @__PURE__ */ vue.defineComponent({
|
|
9839
|
-
name: COMPONENT_NAME$
|
|
9854
|
+
name: COMPONENT_NAME$R,
|
|
9840
9855
|
props: props$X,
|
|
9841
9856
|
inheritAttrs: false,
|
|
9842
9857
|
setup(props, {
|
|
@@ -9885,9 +9900,9 @@ const MInputNumber = /* @__PURE__ */ vue.defineComponent({
|
|
|
9885
9900
|
|
|
9886
9901
|
/** @jsxImportSource vue */
|
|
9887
9902
|
|
|
9888
|
-
const COMPONENT_NAME$
|
|
9903
|
+
const COMPONENT_NAME$Q = 'vcm-input-search';
|
|
9889
9904
|
const MInputSearch = /* @__PURE__ */ vue.defineComponent({
|
|
9890
|
-
name: COMPONENT_NAME$
|
|
9905
|
+
name: COMPONENT_NAME$Q,
|
|
9891
9906
|
props: {
|
|
9892
9907
|
...props$W,
|
|
9893
9908
|
cancelText: {
|
|
@@ -9964,9 +9979,9 @@ const props$D = {
|
|
|
9964
9979
|
}
|
|
9965
9980
|
};
|
|
9966
9981
|
|
|
9967
|
-
const COMPONENT_NAME$
|
|
9982
|
+
const COMPONENT_NAME$P = "vcm-list";
|
|
9968
9983
|
const MList = vue.defineComponent({
|
|
9969
|
-
name: COMPONENT_NAME$
|
|
9984
|
+
name: COMPONENT_NAME$P,
|
|
9970
9985
|
props: props$D,
|
|
9971
9986
|
setup(props, { slots }) {
|
|
9972
9987
|
vue.provide("vc-list", { props });
|
|
@@ -10021,10 +10036,10 @@ const props$C = {
|
|
|
10021
10036
|
|
|
10022
10037
|
/** @jsxImportSource vue */
|
|
10023
10038
|
|
|
10024
|
-
const COMPONENT_NAME$
|
|
10039
|
+
const COMPONENT_NAME$O = 'vcm-list-item';
|
|
10025
10040
|
const HTTP_REGEX = /[a-zA-z]+:\/\/[^\s]*/;
|
|
10026
10041
|
const MListItem = /* @__PURE__ */ vue.defineComponent({
|
|
10027
|
-
name: COMPONENT_NAME$
|
|
10042
|
+
name: COMPONENT_NAME$O,
|
|
10028
10043
|
props: props$C,
|
|
10029
10044
|
emits: ['click'],
|
|
10030
10045
|
setup(props, {
|
|
@@ -10118,11 +10133,11 @@ const props$B = {
|
|
|
10118
10133
|
|
|
10119
10134
|
/** @jsxImportSource vue */
|
|
10120
10135
|
|
|
10121
|
-
const COMPONENT_NAME$
|
|
10136
|
+
const COMPONENT_NAME$N = 'vc-marquee';
|
|
10122
10137
|
const ANIMATION = $.prefixStyle('animation').camel;
|
|
10123
10138
|
const TRANSFORM_KEBAB = $.prefixStyle('transform').kebab;
|
|
10124
10139
|
const Marquee = /* @__PURE__ */ vue.defineComponent({
|
|
10125
|
-
name: COMPONENT_NAME$
|
|
10140
|
+
name: COMPONENT_NAME$N,
|
|
10126
10141
|
props: props$B,
|
|
10127
10142
|
setup(props, {
|
|
10128
10143
|
slots
|
|
@@ -10186,9 +10201,9 @@ const props$A = {
|
|
|
10186
10201
|
}
|
|
10187
10202
|
};
|
|
10188
10203
|
|
|
10189
|
-
const COMPONENT_NAME$
|
|
10204
|
+
const COMPONENT_NAME$M = "vc-resizer";
|
|
10190
10205
|
const Resizer = vue.defineComponent({
|
|
10191
|
-
name: COMPONENT_NAME$
|
|
10206
|
+
name: COMPONENT_NAME$M,
|
|
10192
10207
|
props: props$A,
|
|
10193
10208
|
emit: ["resize", "change"],
|
|
10194
10209
|
setup(props, { emit, slots, expose }) {
|
|
@@ -10331,10 +10346,10 @@ const props$z = {
|
|
|
10331
10346
|
|
|
10332
10347
|
/** @jsxImportSource vue */
|
|
10333
10348
|
|
|
10334
|
-
const COMPONENT_NAME$
|
|
10349
|
+
const COMPONENT_NAME$L = 'vc-modal';
|
|
10335
10350
|
let zIndexNumber = 1002;
|
|
10336
10351
|
const ModalView = /* @__PURE__ */ vue.defineComponent({
|
|
10337
|
-
name: COMPONENT_NAME$
|
|
10352
|
+
name: COMPONENT_NAME$L,
|
|
10338
10353
|
emits: ['update:modelValue', 'close', 'portal-fulfilled', 'visible-change', 'ok', 'cancel'],
|
|
10339
10354
|
props: props$z,
|
|
10340
10355
|
setup(props, {
|
|
@@ -10392,11 +10407,6 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
|
|
|
10392
10407
|
};
|
|
10393
10408
|
});
|
|
10394
10409
|
vcHooks.useScrollbar(isActive);
|
|
10395
|
-
vue.watch(() => props.modelValue, v => {
|
|
10396
|
-
isActive.value = v;
|
|
10397
|
-
}, {
|
|
10398
|
-
immediate: true
|
|
10399
|
-
});
|
|
10400
10410
|
let startX = 0;
|
|
10401
10411
|
let startY = 0;
|
|
10402
10412
|
// Portal调用时,可作为初始值
|
|
@@ -10423,7 +10433,17 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
|
|
|
10423
10433
|
}, 250, {
|
|
10424
10434
|
leading: true
|
|
10425
10435
|
});
|
|
10426
|
-
const
|
|
10436
|
+
const isTransitionEnd = vue.ref(false);
|
|
10437
|
+
const handleBeforeEnter = () => {
|
|
10438
|
+
isTransitionEnd.value = false;
|
|
10439
|
+
};
|
|
10440
|
+
const handleEnter = () => {
|
|
10441
|
+
resetOrigin();
|
|
10442
|
+
};
|
|
10443
|
+
const handleAfterEnter = () => {
|
|
10444
|
+
isTransitionEnd.value = true;
|
|
10445
|
+
resizer.value.refresh();
|
|
10446
|
+
};
|
|
10427
10447
|
/**
|
|
10428
10448
|
* 动画执行后关闭, 关闭事件都会被执行
|
|
10429
10449
|
* visible-change 由移除之后触发
|
|
@@ -10494,11 +10514,15 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
|
|
|
10494
10514
|
* 这里由于scroller的resize时,render会重置height(实际上就是保留height, 无法移除)
|
|
10495
10515
|
* 1. 改用nextTick, 抖动严重
|
|
10496
10516
|
* 2. resizer.value.refresh, 不抖动
|
|
10517
|
+
*
|
|
10518
|
+
* container在最大值时,需要移除,宽度才会缩回去
|
|
10497
10519
|
*/
|
|
10498
10520
|
const handleContentResize = () => {
|
|
10499
|
-
const
|
|
10500
|
-
|
|
10501
|
-
|
|
10521
|
+
const needRefreshScroller = !!scroller.value.wrapper.style.getPropertyValue('height');
|
|
10522
|
+
const needRefreshContainer = !!container.value.style.getPropertyValue('height');
|
|
10523
|
+
needRefreshContainer && container.value.style.removeProperty('height');
|
|
10524
|
+
needRefreshScroller && scroller.value.wrapper.style.removeProperty('height');
|
|
10525
|
+
needRefreshScroller && resizer.value.refresh();
|
|
10502
10526
|
};
|
|
10503
10527
|
const handleClick = e => {
|
|
10504
10528
|
// isActive click先触发,后设置后
|
|
@@ -10563,6 +10587,11 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
|
|
|
10563
10587
|
document.removeEventListener('mousemove', handleMouseMove);
|
|
10564
10588
|
document.removeEventListener('mouseup', handleMouseUp);
|
|
10565
10589
|
});
|
|
10590
|
+
vue.watch(() => props.modelValue, v => {
|
|
10591
|
+
isActive.value = v;
|
|
10592
|
+
}, {
|
|
10593
|
+
immediate: true
|
|
10594
|
+
});
|
|
10566
10595
|
expose({
|
|
10567
10596
|
isActive,
|
|
10568
10597
|
// for portal
|
|
@@ -10591,7 +10620,9 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
|
|
|
10591
10620
|
"onClick": e => handleClose(e, false)
|
|
10592
10621
|
}, [vue.createVNode(TransitionScale, {
|
|
10593
10622
|
"mode": "part",
|
|
10623
|
+
"onBeforeEnter": handleBeforeEnter,
|
|
10594
10624
|
"onEnter": handleEnter,
|
|
10625
|
+
"onAfterEnter": handleAfterEnter,
|
|
10595
10626
|
"onAfterLeave": handleRemove
|
|
10596
10627
|
}, {
|
|
10597
10628
|
default: () => [vue.withDirectives(vue.createVNode("div", {
|
|
@@ -10627,8 +10658,8 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
|
|
|
10627
10658
|
return vue.createVNode(Scroller, {
|
|
10628
10659
|
"ref": scroller,
|
|
10629
10660
|
"native": false,
|
|
10630
|
-
"always":
|
|
10631
|
-
"height": row.height,
|
|
10661
|
+
"always": false,
|
|
10662
|
+
"height": isTransitionEnd.value ? row.height : void 0,
|
|
10632
10663
|
"contentClass": [{
|
|
10633
10664
|
'is-confirm': props.mode
|
|
10634
10665
|
}, props.portalClass, 'vc-modal__content']
|
|
@@ -10744,9 +10775,9 @@ const props$y = {
|
|
|
10744
10775
|
|
|
10745
10776
|
/** @jsxImportSource vue */
|
|
10746
10777
|
|
|
10747
|
-
const COMPONENT_NAME$
|
|
10778
|
+
const COMPONENT_NAME$K = 'vc-modal';
|
|
10748
10779
|
const MModalView = /* @__PURE__ */ vue.defineComponent({
|
|
10749
|
-
name: COMPONENT_NAME$
|
|
10780
|
+
name: COMPONENT_NAME$K,
|
|
10750
10781
|
emits: ['update:modelValue', 'portal-fulfilled', 'close', 'ok', 'cancel'],
|
|
10751
10782
|
props: props$y,
|
|
10752
10783
|
setup(props, {
|
|
@@ -10958,9 +10989,9 @@ const props$x = {
|
|
|
10958
10989
|
|
|
10959
10990
|
/** @jsxImportSource vue */
|
|
10960
10991
|
|
|
10961
|
-
const COMPONENT_NAME$
|
|
10992
|
+
const COMPONENT_NAME$J = 'vc-notice';
|
|
10962
10993
|
const NoticeView = /* @__PURE__ */ vue.defineComponent({
|
|
10963
|
-
name: COMPONENT_NAME$
|
|
10994
|
+
name: COMPONENT_NAME$J,
|
|
10964
10995
|
props: props$x,
|
|
10965
10996
|
emits: ['portal-fulfilled', 'close', 'before-close'],
|
|
10966
10997
|
setup(props, {
|
|
@@ -11133,9 +11164,9 @@ const props$w = {
|
|
|
11133
11164
|
|
|
11134
11165
|
/** @jsxImportSource vue */
|
|
11135
11166
|
|
|
11136
|
-
const COMPONENT_NAME$
|
|
11167
|
+
const COMPONENT_NAME$I = 'vc-option';
|
|
11137
11168
|
const Option$1 = /* @__PURE__ */ vue.defineComponent({
|
|
11138
|
-
name: COMPONENT_NAME$
|
|
11169
|
+
name: COMPONENT_NAME$I,
|
|
11139
11170
|
props: props$w,
|
|
11140
11171
|
setup(props, {
|
|
11141
11172
|
slots
|
|
@@ -11202,12 +11233,12 @@ const getLabel = (data, v) => {
|
|
|
11202
11233
|
const { label = "" } = data.find((i) => i.value == v) || {};
|
|
11203
11234
|
return label;
|
|
11204
11235
|
};
|
|
11205
|
-
const flattenData = (data, options = {}) => {
|
|
11236
|
+
const flattenData$1 = (data, options = {}) => {
|
|
11206
11237
|
let result = [];
|
|
11207
11238
|
data.forEach((item) => {
|
|
11208
11239
|
if (item.children) {
|
|
11209
11240
|
const { children, ...rest } = item;
|
|
11210
|
-
const items = flattenData(children, options);
|
|
11241
|
+
const items = flattenData$1(children, options);
|
|
11211
11242
|
result = result.concat(
|
|
11212
11243
|
options.parent ? [options.cascader ? item : rest].concat(items) : items
|
|
11213
11244
|
);
|
|
@@ -11248,9 +11279,9 @@ const props$u = {
|
|
|
11248
11279
|
|
|
11249
11280
|
/** @jsxImportSource vue */
|
|
11250
11281
|
|
|
11251
|
-
const COMPONENT_NAME$
|
|
11282
|
+
const COMPONENT_NAME$H = 'vc-tag';
|
|
11252
11283
|
const Tag = /* @__PURE__ */ vue.defineComponent({
|
|
11253
|
-
name: COMPONENT_NAME$
|
|
11284
|
+
name: COMPONENT_NAME$H,
|
|
11254
11285
|
props: props$u,
|
|
11255
11286
|
emits: ['close', 'change'],
|
|
11256
11287
|
setup(props, {
|
|
@@ -11319,9 +11350,9 @@ const props$t = {
|
|
|
11319
11350
|
|
|
11320
11351
|
/** @jsxImportSource vue */
|
|
11321
11352
|
|
|
11322
|
-
const COMPONENT_NAME$
|
|
11353
|
+
const COMPONENT_NAME$G = 'vc-select-option';
|
|
11323
11354
|
const Option = /* @__PURE__ */ vue.defineComponent({
|
|
11324
|
-
name: COMPONENT_NAME$
|
|
11355
|
+
name: COMPONENT_NAME$G,
|
|
11325
11356
|
props: props$t,
|
|
11326
11357
|
setup(props, {
|
|
11327
11358
|
slots
|
|
@@ -11394,9 +11425,9 @@ const props$s = {
|
|
|
11394
11425
|
|
|
11395
11426
|
/** @jsxImportSource vue */
|
|
11396
11427
|
|
|
11397
|
-
const COMPONENT_NAME$
|
|
11428
|
+
const COMPONENT_NAME$F = 'vc-select-option-group';
|
|
11398
11429
|
const OptionGroup = /* @__PURE__ */ vue.defineComponent({
|
|
11399
|
-
name: COMPONENT_NAME$
|
|
11430
|
+
name: COMPONENT_NAME$F,
|
|
11400
11431
|
props: props$s,
|
|
11401
11432
|
setup(props, {
|
|
11402
11433
|
slots
|
|
@@ -11494,9 +11525,9 @@ const props$r = {
|
|
|
11494
11525
|
function _isSlot$1(s) {
|
|
11495
11526
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
11496
11527
|
}
|
|
11497
|
-
const COMPONENT_NAME$
|
|
11528
|
+
const COMPONENT_NAME$E = 'vc-select';
|
|
11498
11529
|
const Select = /* @__PURE__ */ vue.defineComponent({
|
|
11499
|
-
name: COMPONENT_NAME$
|
|
11530
|
+
name: COMPONENT_NAME$E,
|
|
11500
11531
|
props: props$r,
|
|
11501
11532
|
emits: ['ready', 'close', 'visible-change', 'clear', 'change', 'update:modelValue'],
|
|
11502
11533
|
setup(props, {
|
|
@@ -11517,7 +11548,7 @@ const Select = /* @__PURE__ */ vue.defineComponent({
|
|
|
11517
11548
|
const searchRegex = vue.ref(new RegExp(''));
|
|
11518
11549
|
const currentValue = vue.ref([]);
|
|
11519
11550
|
const source = vue.computed(() => {
|
|
11520
|
-
return flattenData(props.data, {
|
|
11551
|
+
return flattenData$1(props.data, {
|
|
11521
11552
|
parent: true,
|
|
11522
11553
|
cascader: true
|
|
11523
11554
|
});
|
|
@@ -11740,9 +11771,9 @@ const Select = /* @__PURE__ */ vue.defineComponent({
|
|
|
11740
11771
|
|
|
11741
11772
|
/** @jsxImportSource vue */
|
|
11742
11773
|
|
|
11743
|
-
const COMPONENT_NAME$
|
|
11774
|
+
const COMPONENT_NAME$D = 'vc-pagination';
|
|
11744
11775
|
const Pagination = /* @__PURE__ */ vue.defineComponent({
|
|
11745
|
-
name: COMPONENT_NAME$
|
|
11776
|
+
name: COMPONENT_NAME$D,
|
|
11746
11777
|
props: props$v,
|
|
11747
11778
|
emits: ['update:current', 'change', 'page-size-change'],
|
|
11748
11779
|
setup(props, {
|
|
@@ -11940,9 +11971,9 @@ const props$q = {
|
|
|
11940
11971
|
|
|
11941
11972
|
/** @jsxImportSource vue */
|
|
11942
11973
|
|
|
11943
|
-
const COMPONENT_NAME$
|
|
11974
|
+
const COMPONENT_NAME$C = 'vc-picker';
|
|
11944
11975
|
const Picker = /* @__PURE__ */ vue.defineComponent({
|
|
11945
|
-
name: COMPONENT_NAME$
|
|
11976
|
+
name: COMPONENT_NAME$C,
|
|
11946
11977
|
props: props$q,
|
|
11947
11978
|
setup(props, {
|
|
11948
11979
|
slots
|
|
@@ -11966,9 +11997,9 @@ const props$p = {
|
|
|
11966
11997
|
|
|
11967
11998
|
/** @jsxImportSource vue */
|
|
11968
11999
|
|
|
11969
|
-
const COMPONENT_NAME$
|
|
12000
|
+
const COMPONENT_NAME$B = 'vc-popconfirm';
|
|
11970
12001
|
const Popconfirm = /* @__PURE__ */ vue.defineComponent({
|
|
11971
|
-
name: COMPONENT_NAME$
|
|
12002
|
+
name: COMPONENT_NAME$B,
|
|
11972
12003
|
props: props$p,
|
|
11973
12004
|
setup(props, {
|
|
11974
12005
|
slots
|
|
@@ -11994,9 +12025,9 @@ const props$o = {
|
|
|
11994
12025
|
|
|
11995
12026
|
/** @jsxImportSource vue */
|
|
11996
12027
|
|
|
11997
|
-
const COMPONENT_NAME$
|
|
12028
|
+
const COMPONENT_NAME$A = 'vc-popup';
|
|
11998
12029
|
const Popup = /* @__PURE__ */ vue.defineComponent({
|
|
11999
|
-
name: COMPONENT_NAME$
|
|
12030
|
+
name: COMPONENT_NAME$A,
|
|
12000
12031
|
props: props$o,
|
|
12001
12032
|
setup(props, {
|
|
12002
12033
|
slots
|
|
@@ -12023,9 +12054,9 @@ const props$n = {
|
|
|
12023
12054
|
|
|
12024
12055
|
/** @jsxImportSource vue */
|
|
12025
12056
|
|
|
12026
|
-
const COMPONENT_NAME$
|
|
12057
|
+
const COMPONENT_NAME$z = 'vc-print';
|
|
12027
12058
|
const Print = /* @__PURE__ */ vue.defineComponent({
|
|
12028
|
-
name: COMPONENT_NAME$
|
|
12059
|
+
name: COMPONENT_NAME$z,
|
|
12029
12060
|
props: props$n,
|
|
12030
12061
|
setup(props, {
|
|
12031
12062
|
expose,
|
|
@@ -12121,9 +12152,9 @@ const props$m = {
|
|
|
12121
12152
|
|
|
12122
12153
|
/** @jsxImportSource vue */
|
|
12123
12154
|
|
|
12124
|
-
const COMPONENT_NAME$
|
|
12155
|
+
const COMPONENT_NAME$y = 'vc-progress-circle';
|
|
12125
12156
|
const Circle = /* @__PURE__ */ vue.defineComponent({
|
|
12126
|
-
name: COMPONENT_NAME$
|
|
12157
|
+
name: COMPONENT_NAME$y,
|
|
12127
12158
|
props: props$m,
|
|
12128
12159
|
setup(props, {
|
|
12129
12160
|
slots
|
|
@@ -12173,16 +12204,16 @@ const Circle = /* @__PURE__ */ vue.defineComponent({
|
|
|
12173
12204
|
"fill-opacity": "0"
|
|
12174
12205
|
}, null)]), vue.createVNode("div", {
|
|
12175
12206
|
"class": "vc-progress-circle__inner"
|
|
12176
|
-
}, [slots.default ? slots.default() : vue.createVNode("span", null, [`${props.percent}%`])])])]);
|
|
12207
|
+
}, [slots.default ? slots.default() : props.showText && vue.createVNode("span", null, [`${props.percent}%`])])])]);
|
|
12177
12208
|
};
|
|
12178
12209
|
}
|
|
12179
12210
|
});
|
|
12180
12211
|
|
|
12181
12212
|
/** @jsxImportSource vue */
|
|
12182
12213
|
|
|
12183
|
-
const COMPONENT_NAME$
|
|
12214
|
+
const COMPONENT_NAME$x = 'vc-progress-line';
|
|
12184
12215
|
const Line = /* @__PURE__ */ vue.defineComponent({
|
|
12185
|
-
name: COMPONENT_NAME$
|
|
12216
|
+
name: COMPONENT_NAME$x,
|
|
12186
12217
|
props: props$m,
|
|
12187
12218
|
setup(props) {
|
|
12188
12219
|
const colorStyle = vue.computed(() => {
|
|
@@ -12226,9 +12257,9 @@ const Line = /* @__PURE__ */ vue.defineComponent({
|
|
|
12226
12257
|
function _isSlot(s) {
|
|
12227
12258
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
12228
12259
|
}
|
|
12229
|
-
const COMPONENT_NAME$
|
|
12260
|
+
const COMPONENT_NAME$w = 'vc-progress';
|
|
12230
12261
|
const Progress = /* @__PURE__ */ vue.defineComponent({
|
|
12231
|
-
name: COMPONENT_NAME$
|
|
12262
|
+
name: COMPONENT_NAME$w,
|
|
12232
12263
|
props: props$m,
|
|
12233
12264
|
setup(props, {
|
|
12234
12265
|
slots
|
|
@@ -12380,9 +12411,9 @@ const useRadio = () => {
|
|
|
12380
12411
|
|
|
12381
12412
|
/** @jsxImportSource vue */
|
|
12382
12413
|
|
|
12383
|
-
const COMPONENT_NAME$
|
|
12414
|
+
const COMPONENT_NAME$v = 'vc-radio';
|
|
12384
12415
|
const Radio = /* @__PURE__ */ vue.defineComponent({
|
|
12385
|
-
name: COMPONENT_NAME$
|
|
12416
|
+
name: COMPONENT_NAME$v,
|
|
12386
12417
|
props: props$l,
|
|
12387
12418
|
emits: ['update:modelValue', 'change'],
|
|
12388
12419
|
setup(props, {
|
|
@@ -12493,9 +12524,9 @@ const useRadioGroup = () => {
|
|
|
12493
12524
|
|
|
12494
12525
|
/** @jsxImportSource vue */
|
|
12495
12526
|
|
|
12496
|
-
const COMPONENT_NAME$
|
|
12527
|
+
const COMPONENT_NAME$u = 'vc-radio-group';
|
|
12497
12528
|
const RadioGroup = /* @__PURE__ */ vue.defineComponent({
|
|
12498
|
-
name: COMPONENT_NAME$
|
|
12529
|
+
name: COMPONENT_NAME$u,
|
|
12499
12530
|
props: props$k,
|
|
12500
12531
|
emits: ['update:modelValue', 'change'],
|
|
12501
12532
|
setup(props, {
|
|
@@ -12517,9 +12548,9 @@ const RadioGroup = /* @__PURE__ */ vue.defineComponent({
|
|
|
12517
12548
|
|
|
12518
12549
|
/** @jsxImportSource vue */
|
|
12519
12550
|
|
|
12520
|
-
const COMPONENT_NAME$
|
|
12551
|
+
const COMPONENT_NAME$t = 'vcm-radio';
|
|
12521
12552
|
const MRadio = /* @__PURE__ */ vue.defineComponent({
|
|
12522
|
-
name: COMPONENT_NAME$
|
|
12553
|
+
name: COMPONENT_NAME$t,
|
|
12523
12554
|
props: props$l,
|
|
12524
12555
|
emits: ['update:modelValue', 'change'],
|
|
12525
12556
|
setup(props, {
|
|
@@ -12560,9 +12591,9 @@ const MRadio = /* @__PURE__ */ vue.defineComponent({
|
|
|
12560
12591
|
|
|
12561
12592
|
/** @jsxImportSource vue */
|
|
12562
12593
|
|
|
12563
|
-
const COMPONENT_NAME$
|
|
12594
|
+
const COMPONENT_NAME$s = 'vcm-radio-group';
|
|
12564
12595
|
const MRadioGroup = /* @__PURE__ */ vue.defineComponent({
|
|
12565
|
-
name: COMPONENT_NAME$
|
|
12596
|
+
name: COMPONENT_NAME$s,
|
|
12566
12597
|
props: props$k,
|
|
12567
12598
|
emits: ['update:modelValue', 'change'],
|
|
12568
12599
|
setup(props, {
|
|
@@ -12591,9 +12622,9 @@ const props$j = {
|
|
|
12591
12622
|
|
|
12592
12623
|
/** @jsxImportSource vue */
|
|
12593
12624
|
|
|
12594
|
-
const COMPONENT_NAME$
|
|
12625
|
+
const COMPONENT_NAME$r = 'vc-rate';
|
|
12595
12626
|
const Rate = /* @__PURE__ */ vue.defineComponent({
|
|
12596
|
-
name: COMPONENT_NAME$
|
|
12627
|
+
name: COMPONENT_NAME$r,
|
|
12597
12628
|
props: props$j,
|
|
12598
12629
|
setup(props, {
|
|
12599
12630
|
slots
|
|
@@ -12661,9 +12692,9 @@ const props$i = {
|
|
|
12661
12692
|
|
|
12662
12693
|
/** @jsxImportSource vue */
|
|
12663
12694
|
|
|
12664
|
-
const COMPONENT_NAME$
|
|
12695
|
+
const COMPONENT_NAME$q = 'vc-recycle-list-scroll-state';
|
|
12665
12696
|
const ScrollState = /* @__PURE__ */ vue.defineComponent({
|
|
12666
|
-
name: COMPONENT_NAME$
|
|
12697
|
+
name: COMPONENT_NAME$q,
|
|
12667
12698
|
setup(_, {
|
|
12668
12699
|
slots
|
|
12669
12700
|
}) {
|
|
@@ -12793,12 +12824,12 @@ const useDirectionKeys = () => {
|
|
|
12793
12824
|
|
|
12794
12825
|
/** @jsxImportSource vue */
|
|
12795
12826
|
|
|
12796
|
-
const COMPONENT_NAME$
|
|
12827
|
+
const COMPONENT_NAME$p = 'vc-recycle-list-container';
|
|
12797
12828
|
|
|
12798
12829
|
// TODO: 抽离
|
|
12799
12830
|
const transformKey = $__namespace.prefixStyle('transform').camel;
|
|
12800
12831
|
const Container = /* @__PURE__ */ vue.defineComponent({
|
|
12801
|
-
name: COMPONENT_NAME$
|
|
12832
|
+
name: COMPONENT_NAME$p,
|
|
12802
12833
|
props: props$h,
|
|
12803
12834
|
emits: ['refresh'],
|
|
12804
12835
|
setup(props, {
|
|
@@ -12896,9 +12927,9 @@ const Container = /* @__PURE__ */ vue.defineComponent({
|
|
|
12896
12927
|
|
|
12897
12928
|
/** @jsxImportSource vue */
|
|
12898
12929
|
|
|
12899
|
-
const COMPONENT_NAME$
|
|
12930
|
+
const COMPONENT_NAME$o = 'vc-recycle-list-item';
|
|
12900
12931
|
const Item = /* @__PURE__ */ vue.defineComponent({
|
|
12901
|
-
name: COMPONENT_NAME$
|
|
12932
|
+
name: COMPONENT_NAME$o,
|
|
12902
12933
|
props: {
|
|
12903
12934
|
vertical: {
|
|
12904
12935
|
type: Boolean,
|
|
@@ -12941,11 +12972,11 @@ const Item = /* @__PURE__ */ vue.defineComponent({
|
|
|
12941
12972
|
|
|
12942
12973
|
/** @jsxImportSource vue */
|
|
12943
12974
|
|
|
12944
|
-
const COMPONENT_NAME$
|
|
12975
|
+
const COMPONENT_NAME$n = 'vc-recycle-list';
|
|
12945
12976
|
const RecycleList = /* @__PURE__ */ vue.defineComponent({
|
|
12946
|
-
name: COMPONENT_NAME$
|
|
12977
|
+
name: COMPONENT_NAME$n,
|
|
12947
12978
|
props: props$i,
|
|
12948
|
-
emits: ['scroll'],
|
|
12979
|
+
emits: ['scroll', 'row-resize'],
|
|
12949
12980
|
setup(props, {
|
|
12950
12981
|
slots,
|
|
12951
12982
|
expose,
|
|
@@ -13044,7 +13075,7 @@ const RecycleList = /* @__PURE__ */ vue.defineComponent({
|
|
|
13044
13075
|
const isLoading = vue.computed(() => {
|
|
13045
13076
|
return loadings.value.length;
|
|
13046
13077
|
});
|
|
13047
|
-
const scrollTo = options => {
|
|
13078
|
+
const scrollTo = (options, force) => {
|
|
13048
13079
|
let options$ = {
|
|
13049
13080
|
x: 0,
|
|
13050
13081
|
y: 0
|
|
@@ -13055,10 +13086,9 @@ const RecycleList = /* @__PURE__ */ vue.defineComponent({
|
|
|
13055
13086
|
options$ = Object.assign(options$, options);
|
|
13056
13087
|
}
|
|
13057
13088
|
const el = wrapper.value;
|
|
13058
|
-
|
|
13059
|
-
|
|
13060
|
-
|
|
13061
|
-
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);
|
|
13062
13092
|
};
|
|
13063
13093
|
const scrollToIndex = (index, offset = 0) => {
|
|
13064
13094
|
const item = rebuildData.value[index];
|
|
@@ -13091,12 +13121,21 @@ const RecycleList = /* @__PURE__ */ vue.defineComponent({
|
|
|
13091
13121
|
const current = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[index]] : rebuildData.value[index];
|
|
13092
13122
|
if (!current) return; // 受到`removeUnusedPlaceholders`影响,无效的会被回收
|
|
13093
13123
|
|
|
13124
|
+
const oldSize = current.size;
|
|
13094
13125
|
const dom = preloads.value[index] || curloads.value[props.inverted ? index : index - firstItemIndex.value];
|
|
13095
13126
|
if (dom) {
|
|
13096
13127
|
current.size = dom[K.offsetSize] || placeholderSize.value;
|
|
13097
13128
|
} else if (current) {
|
|
13098
13129
|
current.size = placeholderSize.value;
|
|
13099
13130
|
}
|
|
13131
|
+
|
|
13132
|
+
// 这样的考虑欠佳,待优化
|
|
13133
|
+
if (oldSize !== current.size) {
|
|
13134
|
+
emit('row-resize', {
|
|
13135
|
+
index: current.id,
|
|
13136
|
+
size: current.size
|
|
13137
|
+
});
|
|
13138
|
+
}
|
|
13100
13139
|
};
|
|
13101
13140
|
const refreshItemPosition = () => {
|
|
13102
13141
|
const sizes = Array.from({
|
|
@@ -13503,9 +13542,9 @@ const props$g = {
|
|
|
13503
13542
|
|
|
13504
13543
|
/** @jsxImportSource vue */
|
|
13505
13544
|
|
|
13506
|
-
const COMPONENT_NAME$
|
|
13545
|
+
const COMPONENT_NAME$m = 'vc-slider';
|
|
13507
13546
|
const Slider = /* @__PURE__ */ vue.defineComponent({
|
|
13508
|
-
name: COMPONENT_NAME$
|
|
13547
|
+
name: COMPONENT_NAME$m,
|
|
13509
13548
|
props: props$g,
|
|
13510
13549
|
setup(props, {
|
|
13511
13550
|
slots
|
|
@@ -13529,9 +13568,9 @@ const props$f = {
|
|
|
13529
13568
|
|
|
13530
13569
|
/** @jsxImportSource vue */
|
|
13531
13570
|
|
|
13532
|
-
const COMPONENT_NAME$
|
|
13571
|
+
const COMPONENT_NAME$l = 'vc-sort-list';
|
|
13533
13572
|
const SortList = /* @__PURE__ */ vue.defineComponent({
|
|
13534
|
-
name: COMPONENT_NAME$
|
|
13573
|
+
name: COMPONENT_NAME$l,
|
|
13535
13574
|
props: props$f,
|
|
13536
13575
|
setup(props, {
|
|
13537
13576
|
slots
|
|
@@ -13555,9 +13594,9 @@ const props$e = {
|
|
|
13555
13594
|
|
|
13556
13595
|
/** @jsxImportSource vue */
|
|
13557
13596
|
|
|
13558
|
-
const COMPONENT_NAME$
|
|
13597
|
+
const COMPONENT_NAME$k = 'vc-steps';
|
|
13559
13598
|
const Steps = /* @__PURE__ */ vue.defineComponent({
|
|
13560
|
-
name: COMPONENT_NAME$
|
|
13599
|
+
name: COMPONENT_NAME$k,
|
|
13561
13600
|
props: props$e,
|
|
13562
13601
|
setup(props, {
|
|
13563
13602
|
slots
|
|
@@ -13670,9 +13709,9 @@ const useSwitch = (expose) => {
|
|
|
13670
13709
|
|
|
13671
13710
|
/** @jsxImportSource vue */
|
|
13672
13711
|
|
|
13673
|
-
const COMPONENT_NAME$
|
|
13712
|
+
const COMPONENT_NAME$j = 'vc-switch';
|
|
13674
13713
|
const Switch = /* @__PURE__ */ vue.defineComponent({
|
|
13675
|
-
name: COMPONENT_NAME$
|
|
13714
|
+
name: COMPONENT_NAME$j,
|
|
13676
13715
|
props: props$d,
|
|
13677
13716
|
// click -> onClick要被拦截,此处不能放置
|
|
13678
13717
|
emits: ['update:modelValue', 'change', 'click'],
|
|
@@ -13709,9 +13748,9 @@ const Switch = /* @__PURE__ */ vue.defineComponent({
|
|
|
13709
13748
|
|
|
13710
13749
|
/** @jsxImportSource vue */
|
|
13711
13750
|
|
|
13712
|
-
const COMPONENT_NAME$
|
|
13751
|
+
const COMPONENT_NAME$i = 'vcm-switch';
|
|
13713
13752
|
const MSwitch = /* @__PURE__ */ vue.defineComponent({
|
|
13714
|
-
name: COMPONENT_NAME$
|
|
13753
|
+
name: COMPONENT_NAME$i,
|
|
13715
13754
|
props: props$d,
|
|
13716
13755
|
// click -> onClick要被拦截,此处不能放置
|
|
13717
13756
|
emits: ['update:modelValue', 'change', 'click'],
|
|
@@ -13746,31 +13785,2938 @@ const MSwitch = /* @__PURE__ */ vue.defineComponent({
|
|
|
13746
13785
|
}
|
|
13747
13786
|
});
|
|
13748
13787
|
|
|
13749
|
-
const
|
|
13750
|
-
|
|
13751
|
-
|
|
13752
|
-
|
|
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");
|
|
13797
|
+
}
|
|
13798
|
+
return null;
|
|
13799
|
+
};
|
|
13800
|
+
const parseWidth = (width) => {
|
|
13801
|
+
if (width !== void 0) {
|
|
13802
|
+
width = parseInt(width, 10);
|
|
13803
|
+
if (isNaN(width)) {
|
|
13804
|
+
width = null;
|
|
13805
|
+
}
|
|
13806
|
+
}
|
|
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: ''
|
|
13753
16282
|
}
|
|
13754
16283
|
};
|
|
13755
16284
|
|
|
13756
|
-
|
|
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
|
+
};
|
|
13757
16369
|
|
|
13758
|
-
|
|
13759
|
-
const
|
|
13760
|
-
|
|
13761
|
-
|
|
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
|
+
},
|
|
13762
16481
|
setup(props, {
|
|
13763
|
-
slots
|
|
16482
|
+
slots,
|
|
16483
|
+
expose
|
|
13764
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
|
+
*/
|
|
13765
16693
|
return () => {
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
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);
|
|
13769
16714
|
};
|
|
13770
16715
|
}
|
|
13771
16716
|
});
|
|
13772
16717
|
|
|
13773
16718
|
const MTable = Table;
|
|
16719
|
+
const MTableColumn = TableColumn;
|
|
13774
16720
|
|
|
13775
16721
|
const props$b = {
|
|
13776
16722
|
type: {
|
|
@@ -13927,9 +16873,9 @@ const useTabs = (options = {}) => {
|
|
|
13927
16873
|
|
|
13928
16874
|
/** @jsxImportSource vue */
|
|
13929
16875
|
|
|
13930
|
-
const COMPONENT_NAME$
|
|
16876
|
+
const COMPONENT_NAME$f = 'vc-tabs';
|
|
13931
16877
|
const Tabs = /* @__PURE__ */ vue.defineComponent({
|
|
13932
|
-
name: COMPONENT_NAME$
|
|
16878
|
+
name: COMPONENT_NAME$f,
|
|
13933
16879
|
props: props$b,
|
|
13934
16880
|
emits: ['update:modelValue', 'change', 'click'],
|
|
13935
16881
|
setup(props, {
|
|
@@ -14177,9 +17123,9 @@ const useTabsPane = () => {
|
|
|
14177
17123
|
|
|
14178
17124
|
/** @jsxImportSource vue */
|
|
14179
17125
|
|
|
14180
|
-
const COMPONENT_NAME$
|
|
17126
|
+
const COMPONENT_NAME$e = 'vc-tabs-pane';
|
|
14181
17127
|
const TabsPane = /* @__PURE__ */ vue.defineComponent({
|
|
14182
|
-
name: COMPONENT_NAME$
|
|
17128
|
+
name: COMPONENT_NAME$e,
|
|
14183
17129
|
props: props$a,
|
|
14184
17130
|
setup(_, {
|
|
14185
17131
|
slots
|
|
@@ -14234,9 +17180,9 @@ const props$9 = {
|
|
|
14234
17180
|
|
|
14235
17181
|
/** @jsxImportSource vue */
|
|
14236
17182
|
|
|
14237
|
-
const COMPONENT_NAME$
|
|
17183
|
+
const COMPONENT_NAME$d = 'vcm-tabs';
|
|
14238
17184
|
const MTabs = /* @__PURE__ */ vue.defineComponent({
|
|
14239
|
-
name: COMPONENT_NAME$
|
|
17185
|
+
name: COMPONENT_NAME$d,
|
|
14240
17186
|
props: props$9,
|
|
14241
17187
|
emits: ['update:modelValue', 'change', 'click'],
|
|
14242
17188
|
setup(props, {
|
|
@@ -14501,9 +17447,9 @@ const MTabs = /* @__PURE__ */ vue.defineComponent({
|
|
|
14501
17447
|
|
|
14502
17448
|
/** @jsxImportSource vue */
|
|
14503
17449
|
|
|
14504
|
-
const COMPONENT_NAME$
|
|
17450
|
+
const COMPONENT_NAME$c = 'vcm-tabs-pane';
|
|
14505
17451
|
const MTabsPane = /* @__PURE__ */ vue.defineComponent({
|
|
14506
|
-
name: COMPONENT_NAME$
|
|
17452
|
+
name: COMPONENT_NAME$c,
|
|
14507
17453
|
props: props$a,
|
|
14508
17454
|
setup(_, {
|
|
14509
17455
|
slots
|
|
@@ -14627,9 +17573,9 @@ const getFitIndex = (options = {}) => {
|
|
|
14627
17573
|
|
|
14628
17574
|
/** @jsxImportSource vue */
|
|
14629
17575
|
|
|
14630
|
-
const COMPONENT_NAME$
|
|
17576
|
+
const COMPONENT_NAME$b = 'vc-text';
|
|
14631
17577
|
const Text = /* @__PURE__ */ vue.defineComponent({
|
|
14632
|
-
name: COMPONENT_NAME$
|
|
17578
|
+
name: COMPONENT_NAME$b,
|
|
14633
17579
|
props: props$8,
|
|
14634
17580
|
setup(props, {
|
|
14635
17581
|
emit
|
|
@@ -14722,9 +17668,9 @@ const props$7 = {
|
|
|
14722
17668
|
|
|
14723
17669
|
/** @jsxImportSource vue */
|
|
14724
17670
|
|
|
14725
|
-
const COMPONENT_NAME$
|
|
17671
|
+
const COMPONENT_NAME$a = 'vc-textarea';
|
|
14726
17672
|
const Textarea = /* @__PURE__ */ vue.defineComponent({
|
|
14727
|
-
name: COMPONENT_NAME$
|
|
17673
|
+
name: COMPONENT_NAME$a,
|
|
14728
17674
|
props: props$7,
|
|
14729
17675
|
setup(props, {
|
|
14730
17676
|
slots
|
|
@@ -14782,9 +17728,9 @@ const props$6 = {
|
|
|
14782
17728
|
}
|
|
14783
17729
|
};
|
|
14784
17730
|
|
|
14785
|
-
const COMPONENT_NAME$
|
|
17731
|
+
const COMPONENT_NAME$9 = "vc-theme";
|
|
14786
17732
|
const Theme = vue.defineComponent({
|
|
14787
|
-
name: COMPONENT_NAME$
|
|
17733
|
+
name: COMPONENT_NAME$9,
|
|
14788
17734
|
props: props$6,
|
|
14789
17735
|
setup(props, { slots }) {
|
|
14790
17736
|
const themeId = Utils__namespace.getUid("vc-theme");
|
|
@@ -14870,9 +17816,9 @@ const Theme = vue.defineComponent({
|
|
|
14870
17816
|
}
|
|
14871
17817
|
});
|
|
14872
17818
|
|
|
14873
|
-
const COMPONENT_NAME$
|
|
17819
|
+
const COMPONENT_NAME$8 = "vc-theme-view";
|
|
14874
17820
|
const ThemeView = vue.defineComponent({
|
|
14875
|
-
name: COMPONENT_NAME$
|
|
17821
|
+
name: COMPONENT_NAME$8,
|
|
14876
17822
|
props: props$6,
|
|
14877
17823
|
setup(props, { slots }) {
|
|
14878
17824
|
return () => {
|
|
@@ -14888,9 +17834,9 @@ const ThemeView = vue.defineComponent({
|
|
|
14888
17834
|
}
|
|
14889
17835
|
});
|
|
14890
17836
|
|
|
14891
|
-
const COMPONENT_NAME$
|
|
17837
|
+
const COMPONENT_NAME$7 = "vc-theme-text";
|
|
14892
17838
|
const ThemeText = vue.defineComponent({
|
|
14893
|
-
name: COMPONENT_NAME$
|
|
17839
|
+
name: COMPONENT_NAME$7,
|
|
14894
17840
|
props: props$6,
|
|
14895
17841
|
setup(props, { slots }) {
|
|
14896
17842
|
return () => {
|
|
@@ -14906,9 +17852,9 @@ const ThemeText = vue.defineComponent({
|
|
|
14906
17852
|
}
|
|
14907
17853
|
});
|
|
14908
17854
|
|
|
14909
|
-
const COMPONENT_NAME$
|
|
17855
|
+
const COMPONENT_NAME$6 = "vc-theme-image";
|
|
14910
17856
|
const ThemeImage = vue.defineComponent({
|
|
14911
|
-
name: COMPONENT_NAME$
|
|
17857
|
+
name: COMPONENT_NAME$6,
|
|
14912
17858
|
props: props$6,
|
|
14913
17859
|
setup(props, { slots }) {
|
|
14914
17860
|
return () => {
|
|
@@ -14956,11 +17902,12 @@ const props$5 = {
|
|
|
14956
17902
|
|
|
14957
17903
|
/** @jsxImportSource vue */
|
|
14958
17904
|
|
|
17905
|
+
const COMPONENT_NAME$5 = 'vc-time-picker';
|
|
14959
17906
|
const getPanel = type => {
|
|
14960
17907
|
const isRange = type === 'timerange';
|
|
14961
17908
|
return isRange ? TimeRangePanel : TimePanel;
|
|
14962
17909
|
};
|
|
14963
|
-
const TimePicker = createPicker(props$5, () => {
|
|
17910
|
+
const TimePicker = createPicker(COMPONENT_NAME$5, props$5, () => {
|
|
14964
17911
|
const props = vue.getCurrentInstance().props;
|
|
14965
17912
|
const icon = vue.ref('icon');
|
|
14966
17913
|
const panel = vue.shallowRef({});
|
|
@@ -15239,7 +18186,8 @@ const Upload = vue.defineComponent({
|
|
|
15239
18186
|
const { mode, size } = props;
|
|
15240
18187
|
const onRequest = instance.vnode.props?.onRequest || VcInstance.options.Upload?.onRequest || (() => {
|
|
15241
18188
|
});
|
|
15242
|
-
const onResponse = instance.vnode.props?.onResponse || VcInstance.options.Upload?.onResponse
|
|
18189
|
+
const onResponse = instance.vnode.props?.onResponse || VcInstance.options.Upload?.onResponse || (() => {
|
|
18190
|
+
});
|
|
15243
18191
|
const $mode = mode.replace(/s$/, "");
|
|
15244
18192
|
const onError = async (originalResponse, internalMessage) => {
|
|
15245
18193
|
delete requests[vFile.uploadId];
|
|
@@ -15248,9 +18196,17 @@ const Upload = vue.defineComponent({
|
|
|
15248
18196
|
emitError(originalResponse, internalMessage);
|
|
15249
18197
|
done(vFile);
|
|
15250
18198
|
};
|
|
15251
|
-
const onSuccess = async (
|
|
18199
|
+
const onSuccess = async (request) => {
|
|
15252
18200
|
try {
|
|
15253
|
-
|
|
18201
|
+
let response = await onResponse(request, options) || request;
|
|
18202
|
+
if (response === request) {
|
|
18203
|
+
const text = request.responseType ? request.responseText : request.response;
|
|
18204
|
+
try {
|
|
18205
|
+
response = JSON.parse(text);
|
|
18206
|
+
} catch {
|
|
18207
|
+
response = text;
|
|
18208
|
+
}
|
|
18209
|
+
}
|
|
15254
18210
|
delete requests[vFile.uploadId];
|
|
15255
18211
|
cycle.success++;
|
|
15256
18212
|
cycle.responses = [...cycle.responses, response];
|
|
@@ -15284,7 +18240,7 @@ const Upload = vue.defineComponent({
|
|
|
15284
18240
|
xhr.onreadystatechange = () => {
|
|
15285
18241
|
if (xhr.readyState !== 4 || xhr.status === 0) return;
|
|
15286
18242
|
if (xhr.status >= 200 && xhr.status < 300) {
|
|
15287
|
-
onSuccess(
|
|
18243
|
+
onSuccess(xhr);
|
|
15288
18244
|
} else {
|
|
15289
18245
|
onError({}, `服务异常`);
|
|
15290
18246
|
}
|
|
@@ -15498,7 +18454,7 @@ exports.Drawer = Drawer;
|
|
|
15498
18454
|
exports.DrawerView = DrawerView;
|
|
15499
18455
|
exports.Dropdown = Dropdown;
|
|
15500
18456
|
exports.Editor = Editor;
|
|
15501
|
-
exports.Expand = Expand;
|
|
18457
|
+
exports.Expand = Expand$1;
|
|
15502
18458
|
exports.Form = Form;
|
|
15503
18459
|
exports.FormItem = FormItem;
|
|
15504
18460
|
exports.Fragment = Fragment;
|
|
@@ -15581,6 +18537,7 @@ exports.MSpin = MSpin;
|
|
|
15581
18537
|
exports.MSteps = MSteps;
|
|
15582
18538
|
exports.MSwitch = MSwitch;
|
|
15583
18539
|
exports.MTable = MTable;
|
|
18540
|
+
exports.MTableColumn = MTableColumn;
|
|
15584
18541
|
exports.MTabs = MTabs;
|
|
15585
18542
|
exports.MTabsPane = MTabsPane;
|
|
15586
18543
|
exports.MTag = MTag;
|
|
@@ -15631,6 +18588,7 @@ exports.Spin = Spin;
|
|
|
15631
18588
|
exports.Steps = Steps;
|
|
15632
18589
|
exports.Switch = Switch;
|
|
15633
18590
|
exports.Table = Table;
|
|
18591
|
+
exports.TableColumn = TableColumn;
|
|
15634
18592
|
exports.Tabs = Tabs;
|
|
15635
18593
|
exports.TabsPane = TabsPane;
|
|
15636
18594
|
exports.Tag = Tag;
|