@web-utils/component 3.8.3 → 4.0.1
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/awesome-button/index.mjs +25 -55
- package/base.css +1 -1
- package/card/index.mjs +13 -13
- package/card/style.css +1 -1
- package/carousel/style.css +1 -1
- package/chat/index.mjs +2 -2
- package/chat/style.css +1 -1
- package/chunks/{ElementForm.8w6UkiuU.mjs → ElementForm.CQ3PN5qj.mjs} +17 -35
- package/chunks/{ElementListeners.DOy8wyD2.mjs → ElementListeners.De_PRuIm.mjs} +56 -95
- package/chunks/{ElementMultiInstance.3Z28ewuh.mjs → ElementMultiInstance.DQo2wuAQ.mjs} +16 -26
- package/chunks/{ElementProperties.B2I48muA.mjs → ElementProperties.CosfDrlW.mjs} +16 -16
- package/chunks/{ElementTaskConfig.MBbkLrth.mjs → ElementTaskConfig.Bko0kgTp.mjs} +104 -113
- package/chunks/{FlowCondition.BfU9kw6h.mjs → FlowCondition.Y6qEYi1T.mjs} +36 -66
- package/chunks/{FormTemp.BSpnNput.mjs → FormTemp.Bu2VCxUh.mjs} +2 -2
- package/chunks/{SignalAndMessage.CH6L7cYu.mjs → SignalAndMessage.Bb5PFX0N.mjs} +11 -22
- package/chunks/{UserTaskListeners.XXe5dC5I.mjs → UserTaskListeners.Bv3BDfEI.mjs} +45 -86
- package/chunks/configComponents.BDhlZU8F.mjs +23 -0
- package/chunks/confirmable-mixin.D9aKzKZ9.mjs +85 -0
- package/chunks/core.DJEgjQW6.mjs +54 -0
- package/chunks/{dataformat.B9UvztrQ.mjs → dataformat.CpqOeGBl.mjs} +2 -2
- package/chunks/{dic.CET0XdKP.mjs → dic.Dkl-leRW.mjs} +43 -43
- package/chunks/dictionary.DqiP9x2m.mjs +25 -0
- package/chunks/{event.BT1F_1vF.mjs → event.9aDS6jcw.mjs} +2 -2
- package/chunks/form-input.B8z37eqj.mjs +31 -0
- package/chunks/form-item.D-H-wCPE.mjs +233 -0
- package/chunks/form-validate.CVarNHKX.mjs +12 -0
- package/chunks/helper.BiMLcEEk.mjs +41 -0
- package/chunks/index.9OxHjTIE.mjs +16 -0
- package/chunks/{index.MAFc4eFi.mjs → index.d3MV3Wq2.mjs} +43 -47
- package/chunks/{init.ofpxEyAI.mjs → init.DAsXSoLW.mjs} +2 -2
- package/chunks/{packages.CWPkeLu9.mjs → packages.ByyangTp.mjs} +3 -3
- package/chunks/sub-table-plus-props.BVsD71hT.mjs +30 -0
- package/chunks/{tab-mixin.CVr9bZtn.mjs → tab-mixin.BNK6dxLN.mjs} +1 -1
- package/chunks/{util.CoahLDYn.mjs → util.DqFv_pWg.mjs} +54 -55
- package/chunks/utilSelf.Csq1766E.mjs +48 -0
- package/color-picker/index.mjs +19 -37
- package/comment/style.css +1 -1
- package/confirm-button/index.mjs +1 -1
- package/confirmable/index.mjs +1 -1
- package/context-menu/style.css +1 -1
- package/count-up/index.mjs +13 -24
- package/custom-scrollbar/index.mjs +1 -2
- package/data-operatext/style.css +1 -1
- package/data-panel/style.css +1 -1
- package/data-pay/style.css +1 -1
- package/data-price/style.css +1 -1
- package/data-rotate/style.css +1 -1
- package/data-table-picker/index.mjs +1 -1
- package/data-tabs/style.css +1 -1
- package/dialog-form/index.mjs +16 -28
- package/dynamic-table/style.css +1 -1
- package/easy-popup/index.mjs +22 -40
- package/easy-popup/style.css +1 -1
- package/editable-tree/index.mjs +203 -250
- package/editable-tree/style.css +1 -1
- package/element-dialog/index.mjs +30 -52
- package/element-dialog/style.css +1 -1
- package/flex-column/index.mjs +13 -25
- package/flex-item/index.mjs +15 -27
- package/flex-row/index.mjs +13 -25
- package/flow/index.mjs +30 -32
- package/flow-designer/index.mjs +344 -375
- package/flow-designer/style.css +1 -1
- package/flow-node/index.mjs +1 -1
- package/flow-viewer/index.mjs +64 -91
- package/form-block/index.mjs +33 -26
- package/form-card/index.mjs +25 -0
- package/form-cascader/index.mjs +70 -67
- package/form-checkbox/index.mjs +71 -0
- package/form-checkbox-group/index.mjs +33 -53
- package/form-date-picker/index.mjs +44 -73
- package/form-holder/index.mjs +60 -64
- package/form-holder/style.css +1 -0
- package/form-input/index.mjs +62 -40
- package/form-input-cron-expression/index.mjs +77 -0
- package/form-input-cron-expression/style.css +1 -0
- package/form-input-email/index.mjs +21 -33
- package/form-input-id-card/index.mjs +25 -38
- package/form-input-number/index.mjs +39 -42
- package/form-input-number/style.css +1 -1
- package/form-input-phone-number/index.mjs +26 -37
- package/form-input-tag/index.mjs +32 -34
- package/form-input-time/index.mjs +22 -37
- package/form-item/index.mjs +109 -101
- package/form-item/style.css +1 -1
- package/form-item-config-provider/index.mjs +18 -10
- package/form-item-group/index.mjs +73 -69
- package/form-item-group/style.css +1 -1
- package/form-radio-group/index.mjs +41 -36
- package/form-radio-group/style.css +1 -1
- package/form-select/index.mjs +142 -75
- package/form-select/style.css +1 -0
- package/form-switch/index.mjs +29 -34
- package/form-table/index.mjs +85 -0
- package/form-table-plus/index.mjs +109 -0
- package/form-textarea/index.mjs +23 -35
- package/form-tree-select/index.mjs +72 -0
- package/form-tree-select/style.css +1 -0
- package/form-tree-select-multiple/index.mjs +78 -0
- package/form-view/index.mjs +43 -77
- package/form-view/style.css +1 -1
- package/fy-array/index.mjs +2 -2
- package/fy-cascader/index.mjs +1 -1
- package/fy-checkbox/index.mjs +1 -1
- package/fy-code/index.mjs +1 -1
- package/fy-curd/index.mjs +12 -17
- package/fy-curd/style.css +1 -1
- package/fy-date/index.mjs +1 -1
- package/fy-draggable/index.mjs +5 -7
- package/fy-draggable/style.css +1 -1
- package/fy-dynamic/index.mjs +14 -16
- package/fy-empty/index.mjs +1 -1
- package/fy-empty/style.css +1 -1
- package/fy-form/index.mjs +117 -136
- package/fy-form/style.css +1 -1
- package/fy-form-design/index.mjs +319 -345
- package/fy-form-design/style.css +1 -1
- package/fy-input/index.mjs +2 -2
- package/fy-input-color/index.mjs +1 -1
- package/fy-input-icon/index.mjs +1 -1
- package/fy-input-map/index.mjs +21 -26
- package/fy-input-map/style.css +1 -1
- package/fy-input-number/index.mjs +1 -1
- package/fy-input-table/index.mjs +10 -12
- package/fy-input-tree/index.mjs +1 -1
- package/fy-radio/index.mjs +1 -1
- package/fy-rate/index.mjs +1 -1
- package/fy-select/index.mjs +4 -4
- package/fy-slider/index.mjs +2 -2
- package/fy-switch/index.mjs +1 -1
- package/fy-tabs/index.mjs +0 -1
- package/fy-time/index.mjs +1 -1
- package/fy-title/index.mjs +1 -1
- package/fy-tree/index.mjs +1 -1
- package/fy-u-editor/index.mjs +77 -103
- package/fy-upload/index.mjs +3 -3
- package/fy-upload/style.css +1 -1
- package/highlight-j-s/index.mjs +1 -1
- package/highlight-j-s/style.css +1 -1
- package/image-cropper/index.mjs +14 -65
- package/image-preview/index.mjs +17 -45
- package/image-preview/style.css +1 -1
- package/image-viewer/style.css +1 -1
- package/index.mjs +666 -496
- package/input-number/index.mjs +64 -9
- package/keyboard/style.css +1 -1
- package/license/index.mjs +1 -1
- package/login/index.mjs +1 -1
- package/monaco-editor/index.mjs +44 -74
- package/name-avatar/style.css +1 -1
- package/package.json +18 -17
- package/page-index/index.mjs +30 -54
- package/page-index-top/index.mjs +25 -47
- package/pageable-table/index.mjs +354 -226
- package/pageable-table/style.css +1 -1
- package/pageable-view/index.mjs +63 -106
- package/photo-swipe/index.mjs +51 -74
- package/picker-table-view/index.mjs +117 -0
- package/present-view/index.mjs +43 -77
- package/present-view/style.css +1 -1
- package/record-video/index.mjs +1 -1
- package/resize-observer/index.mjs +1 -1
- package/resize-observer/style.css +1 -1
- package/search/index.mjs +2 -2
- package/search/style.css +1 -1
- package/search-popover/index.mjs +28 -48
- package/search-popover/style.css +1 -1
- package/sign/index.mjs +2 -2
- package/sign-panel/style.css +1 -1
- package/skeleton-panel/index.mjs +38 -0
- package/skeleton-panel/style.css +1 -0
- package/split-pane/index.mjs +31 -49
- package/split-pane/style.css +1 -1
- package/sub-table/index.mjs +206 -0
- package/sub-table/style.css +1 -0
- package/sub-table-plus/index.mjs +231 -0
- package/sub-table-plus/style.css +1 -0
- package/swiper/index.mjs +18 -38
- package/swiper/style.css +1 -1
- package/tab/index.mjs +1 -1
- package/tab/style.css +1 -1
- package/tab-item/index.mjs +2 -2
- package/table-column/index.mjs +112 -37
- package/table-column/style.css +1 -0
- package/table-view/index.mjs +178 -135
- package/table-view/style.css +1 -1
- package/tabs-view/index.mjs +104 -0
- package/tabs-view/style.css +1 -0
- package/tag-render/index.mjs +13 -24
- package/text-ellipsis/index.mjs +1 -1
- package/toolbar/index.mjs +115 -58
- package/toolbar/style.css +1 -1
- package/toolbar-button/index.mjs +92 -48
- package/verify/index.mjs +1 -1
- package/vue-cron/index.mjs +48 -66
- package/vue-qr-code/index.mjs +14 -32
- package/vue-quill-editor/index.mjs +3 -3
- package/vue-tags-input/index.mjs +1 -1
- package/vue-tree-select/index.mjs +352 -393
- package/vue-tree-select/style.css +1 -1
- package/vue-video-player/index.mjs +36 -67
- package/watermark/index.mjs +21 -31
- package/web-types.json +9240 -3843
- package/x-input-tag/index.mjs +29 -61
- package/chunks/confirmable-mixin.D4LAArE5.mjs +0 -114
- package/chunks/form-input-mixin.BkKiqJhi.mjs +0 -24
- package/chunks/form-item-mixin.CG4ZwzMC.mjs +0 -140
- package/chunks/input-number-mixin.CzjtGf2n.mjs +0 -60
- package/chunks/utilSelf.CRqpl0Cz.mjs +0 -56
- package/toolbar-button/style.css +0 -1
- /package/chunks/{form-pick-mixin.BFTIVn_i.mjs → form-pick.BFTIVn_i.mjs} +0 -0
package/pageable-table/index.mjs
CHANGED
|
@@ -1,51 +1,128 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { copy as T, hasOwn as w } from "@web-utils/core";
|
|
2
|
+
import y from "element-ui/lib/message";
|
|
3
|
+
import { merge as m } from "@web-utils/integrations/lodash";
|
|
4
|
+
import { f as S, g as $, h as _ } from "../chunks/index.d3MV3Wq2.mjs";
|
|
5
|
+
import { t as C, a as x } from "../chunks/core.DJEgjQW6.mjs";
|
|
6
|
+
import { g } from "../chunks/configComponents.BDhlZU8F.mjs";
|
|
7
|
+
import k from "../table-column-filterable/index.mjs";
|
|
8
|
+
import E from "../table-column-filter/index.mjs";
|
|
9
|
+
import { isEqual as R } from "lodash-es";
|
|
10
|
+
import { n as P } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
|
|
11
|
+
function B(t) {
|
|
12
|
+
T(
|
|
13
|
+
t,
|
|
14
|
+
() => y.success({ duration: 1e3, message: "复制成功!", type: "success" }),
|
|
15
|
+
() => y.error({ duration: 1e3, message: "复制失败!", type: "error" })
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
const u = {}, b = {}, h = {}, K = (t, e = !0, { options: s, treeDict: a, idAsValue: l, labelAsValue: i } = {}) => {
|
|
19
|
+
let o = t;
|
|
20
|
+
a && (o = `${t}-${l}-${i}${s ? "-options" : ""}`);
|
|
21
|
+
const n = u[o];
|
|
22
|
+
return e && n ? n : a ? D(t, e, { idAsValue: l, labelAsValue: i }) : L(t, e);
|
|
23
|
+
}, L = (t, e = !0) => {
|
|
24
|
+
if (h[t])
|
|
25
|
+
return h[t];
|
|
26
|
+
const s = new Promise((a, l) => {
|
|
27
|
+
var i, o;
|
|
28
|
+
e && u[t] ? a(u[t]) : ((o = (i = g) == null ? void 0 : i.dict) != null && o.remote && a([]), g.dict.remote(t).then((n) => {
|
|
29
|
+
let r = n.data.data;
|
|
30
|
+
if (e) {
|
|
31
|
+
const p = {};
|
|
32
|
+
r.forEach(({ label: c, value: d }) => {
|
|
33
|
+
p[d] = Object.freeze({ label: c, value: d });
|
|
34
|
+
}), b[t] = p, r = Object.freeze(r), u[t] = r;
|
|
35
|
+
}
|
|
36
|
+
h[t] = null, a(r);
|
|
37
|
+
}).catch((n) => {
|
|
38
|
+
h[t] = null, l(n);
|
|
39
|
+
}));
|
|
40
|
+
});
|
|
41
|
+
return h[t] = s, s;
|
|
42
|
+
}, D = (t, e = !0, { idAsValue: s, labelAsValue: a } = {}) => {
|
|
43
|
+
const l = `${t}-${s}-${a}`;
|
|
44
|
+
if (h[l])
|
|
45
|
+
return h[l];
|
|
46
|
+
const i = new Promise((o, n) => {
|
|
47
|
+
var r, p;
|
|
48
|
+
e && u[l] ? o(u[l]) : ((p = (r = g) == null ? void 0 : r.dict) != null && p.getDictTreeByType && o([]), g.dict.getDictTreeByType(t, { idAsValue: s, labelAsValue: a }).then((c) => {
|
|
49
|
+
const d = c.data.data;
|
|
50
|
+
e && (u[l] = d, u[`${l}-options`] = C(d), b[l] = x(d)), h[l] = null, o(d);
|
|
51
|
+
}).catch((c) => {
|
|
52
|
+
h[l] = null, n(c);
|
|
53
|
+
}));
|
|
54
|
+
});
|
|
55
|
+
return h[l] = i, i;
|
|
56
|
+
}, O = async (t, e, s = !0, { treeDict: a, idAsValue: l, labelAsValue: i } = {}) => {
|
|
57
|
+
let o = t;
|
|
58
|
+
a && (o = `${t}-${l}-${i}`);
|
|
59
|
+
const n = b[o];
|
|
60
|
+
let r;
|
|
61
|
+
if (s && n)
|
|
62
|
+
r = n[e];
|
|
63
|
+
else {
|
|
64
|
+
let p = await K(t, s, { treeDict: a, idAsValue: l, labelAsValue: i });
|
|
65
|
+
if (s)
|
|
66
|
+
r = b[o][e];
|
|
67
|
+
else {
|
|
68
|
+
a && (p = C(p));
|
|
69
|
+
for (let c = 0; c < p.length; c++) {
|
|
70
|
+
const d = p[c];
|
|
71
|
+
if (d.value === e) {
|
|
72
|
+
r = d;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
28
76
|
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
77
|
+
}
|
|
78
|
+
return r;
|
|
79
|
+
}, z = async (t, e, s = !0, { treeDict: a, idAsValue: l, labelAsValue: i } = {}) => {
|
|
80
|
+
var o;
|
|
81
|
+
return ((o = await O(t, e, s, { treeDict: a, idAsValue: l, labelAsValue: i })) == null ? void 0 : o.label) || e || "";
|
|
82
|
+
}, W = {
|
|
83
|
+
props: {
|
|
84
|
+
useVisibilityChange: Boolean
|
|
85
|
+
},
|
|
86
|
+
created() {
|
|
87
|
+
this.useVisibilityChange && document.addEventListener("visibilitychange", this.onPageVisibleChange);
|
|
88
|
+
},
|
|
89
|
+
beforeDestroy() {
|
|
90
|
+
this.useVisibilityChange && document.removeEventListener("visibilitychange", this.onPageVisibleChange);
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
onPageVisibleChange() {
|
|
94
|
+
var t, e;
|
|
95
|
+
document.hidden ? (t = this.onPageHidden) == null || t.call(this) : (e = this.onPageVisible) == null || e.call(this);
|
|
34
96
|
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const o =
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
function A(t, e) {
|
|
100
|
+
const s = t.map((l) => {
|
|
101
|
+
const { hide: i, filterable: o, allowSort: n, sortable: r, fixed: p, ...c } = l;
|
|
102
|
+
return c;
|
|
103
|
+
}), a = e.map((l) => {
|
|
104
|
+
const { hide: i, filterable: o, allowSort: n, sortable: r, fixed: p, ...c } = l;
|
|
105
|
+
return c;
|
|
106
|
+
});
|
|
107
|
+
return R(s, a);
|
|
108
|
+
}
|
|
109
|
+
function F(t) {
|
|
110
|
+
let e = "";
|
|
111
|
+
for (const s in t)
|
|
112
|
+
e += `<TableColumn prop="${s}" label="${s}"/>
|
|
113
|
+
`;
|
|
114
|
+
return e;
|
|
115
|
+
}
|
|
116
|
+
const f = {
|
|
43
117
|
loading: 1,
|
|
44
118
|
error: -1,
|
|
45
119
|
empty: 2,
|
|
46
120
|
success: 0
|
|
47
|
-
},
|
|
121
|
+
}, M = {
|
|
48
122
|
name: "PageableTable",
|
|
123
|
+
components: { TableColumnFilter: E, TableColumnFilterable: k },
|
|
124
|
+
mixins: [W],
|
|
125
|
+
emits: ["page-loaded", "row-dblclick"],
|
|
49
126
|
bus: {
|
|
50
127
|
reloadTableView(t) {
|
|
51
128
|
t === this.viewId && this.getPage();
|
|
@@ -53,37 +130,22 @@ const o = {
|
|
|
53
130
|
},
|
|
54
131
|
inheritAttrs: !1,
|
|
55
132
|
props: {
|
|
56
|
-
|
|
57
|
-
type: String
|
|
58
|
-
|
|
59
|
-
url: {
|
|
60
|
-
type: String
|
|
133
|
+
selectionWidth: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: "45"
|
|
61
136
|
},
|
|
62
|
-
|
|
137
|
+
viewId: String,
|
|
138
|
+
url: String,
|
|
63
139
|
hideOnSinglePage: Boolean,
|
|
64
|
-
api:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
filters: {
|
|
68
|
-
type: Object
|
|
69
|
-
},
|
|
70
|
-
filter: {
|
|
71
|
-
type: Object
|
|
72
|
-
},
|
|
73
|
-
rules: {
|
|
140
|
+
api: Function,
|
|
141
|
+
model: Object,
|
|
142
|
+
ascs: {
|
|
74
143
|
type: Array,
|
|
75
144
|
default: () => []
|
|
76
145
|
},
|
|
77
|
-
model: {
|
|
78
|
-
type: Object
|
|
79
|
-
},
|
|
80
|
-
ascs: {
|
|
81
|
-
type: String,
|
|
82
|
-
default: ""
|
|
83
|
-
},
|
|
84
146
|
descs: {
|
|
85
|
-
type:
|
|
86
|
-
default:
|
|
147
|
+
type: Array,
|
|
148
|
+
default: () => []
|
|
87
149
|
},
|
|
88
150
|
headerBold: Boolean,
|
|
89
151
|
autoHeight: Boolean,
|
|
@@ -111,34 +173,41 @@ const o = {
|
|
|
111
173
|
type: Boolean,
|
|
112
174
|
default: !1
|
|
113
175
|
},
|
|
114
|
-
columns:
|
|
115
|
-
type: Array
|
|
116
|
-
},
|
|
176
|
+
columns: Array,
|
|
117
177
|
pageSize: {
|
|
118
178
|
type: Number,
|
|
119
179
|
default: 25
|
|
120
|
-
}
|
|
180
|
+
},
|
|
181
|
+
dicOptions: {
|
|
182
|
+
type: Array,
|
|
183
|
+
default: () => []
|
|
184
|
+
},
|
|
185
|
+
paging: {
|
|
186
|
+
type: Boolean,
|
|
187
|
+
default: !0
|
|
188
|
+
},
|
|
189
|
+
clickRowSelect: Boolean,
|
|
190
|
+
payloadStyle: String,
|
|
191
|
+
rowKey: {
|
|
192
|
+
type: String,
|
|
193
|
+
default: "id"
|
|
194
|
+
},
|
|
195
|
+
disabledRowKeys: Array,
|
|
196
|
+
selectExport: Boolean
|
|
121
197
|
},
|
|
122
198
|
data() {
|
|
123
|
-
|
|
124
|
-
this.rules && this.rules.length > 0 && (t.rules = this.rules), this.filters && (t = this.filters), this.filter && (t = Object.assign({}, t, this.filter));
|
|
125
|
-
let e = {};
|
|
126
|
-
this.model && (e = S(this.model));
|
|
127
|
-
const a = this.pageSize;
|
|
199
|
+
const t = this.pageSize;
|
|
128
200
|
return {
|
|
129
|
-
TABLE_STATUS: Object.freeze(
|
|
130
|
-
tableStatus:
|
|
201
|
+
TABLE_STATUS: Object.freeze(f),
|
|
202
|
+
tableStatus: f.empty,
|
|
131
203
|
records: [],
|
|
132
204
|
currentRow: null,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
model: e,
|
|
140
|
-
filters: t
|
|
141
|
-
}
|
|
205
|
+
showSettings: !1,
|
|
206
|
+
selectedRows: [],
|
|
207
|
+
page: { total: 0, page: 1, limit: t, ascs: this.ascs, descs: this.descs },
|
|
208
|
+
tableColumns: [],
|
|
209
|
+
expandColumn: null,
|
|
210
|
+
renderKey: 1
|
|
142
211
|
};
|
|
143
212
|
},
|
|
144
213
|
computed: {
|
|
@@ -147,203 +216,262 @@ const o = {
|
|
|
147
216
|
asc: this.page.ascs,
|
|
148
217
|
desc: this.page.descs,
|
|
149
218
|
page: this.page.page,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
} : {
|
|
153
|
-
asc: this.page.ascs,
|
|
154
|
-
desc: this.page.descs,
|
|
155
|
-
page: this.page.page,
|
|
156
|
-
filters: this.page.filters
|
|
157
|
-
};
|
|
158
|
-
},
|
|
159
|
-
method() {
|
|
160
|
-
return this.httpGet ? this.httpGet : this.httpPost;
|
|
219
|
+
limit: this.page.limit,
|
|
220
|
+
model: this.model
|
|
221
|
+
} : { asc: this.page.ascs, desc: this.page.descs, page: this.page.page, limit: this.page.limit };
|
|
161
222
|
},
|
|
162
223
|
indexWidth() {
|
|
163
|
-
|
|
164
|
-
|
|
224
|
+
var e;
|
|
225
|
+
const t = `${(this.page.page - 1) * this.page.limit + (((e = this.records) == null ? void 0 : e.length) ?? 0)}`;
|
|
226
|
+
return t.length > 3 ? 60 + (t.length - 3) * 10 : 60;
|
|
165
227
|
},
|
|
166
228
|
mergeAttrs() {
|
|
167
|
-
return
|
|
229
|
+
return m({}, this.$attrs, { height: this.autoHeight ? null : "auto" });
|
|
168
230
|
},
|
|
169
231
|
headers() {
|
|
170
232
|
var t;
|
|
171
|
-
return ((t = this.columns) == null ? void 0 : t.map(
|
|
233
|
+
return ((t = this.columns) == null ? void 0 : t.map(S)) || [];
|
|
172
234
|
}
|
|
173
235
|
},
|
|
174
236
|
watch: {
|
|
175
237
|
url: { handler: "reload" },
|
|
176
238
|
api: { handler: "reload" },
|
|
177
|
-
"$attrs.data"
|
|
178
|
-
this.getPage();
|
|
179
|
-
},
|
|
180
|
-
model: {
|
|
181
|
-
deep: !0,
|
|
182
|
-
handler(t) {
|
|
183
|
-
this.setModel(t);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
239
|
+
"$attrs.data": "getPage"
|
|
186
240
|
},
|
|
187
241
|
created() {
|
|
188
|
-
this.$watch(() => this.guard, this.getPage, {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
242
|
+
this.$watch(() => this.guard, this.getPage, { deep: !0, immediate: this.immediate }), this.$watch(
|
|
243
|
+
() => ({ columns: this.columns, renderKey: this.renderKey }),
|
|
244
|
+
(t) => {
|
|
245
|
+
const e = [];
|
|
246
|
+
let s = null;
|
|
247
|
+
if (t) {
|
|
248
|
+
const a = this.$slots.default, { columns: l } = t;
|
|
249
|
+
a ? a.forEach((i) => {
|
|
250
|
+
if (!i.isComment && i.data) {
|
|
251
|
+
const { attrs: o, props: n, scopedSlots: r } = i.data;
|
|
252
|
+
i.data.props = i.data.props || {}, i.data.props.type === "expand" ? s = {
|
|
253
|
+
...o,
|
|
254
|
+
...n,
|
|
255
|
+
scopedSlots: r,
|
|
256
|
+
hide: !1,
|
|
257
|
+
filterable: !1,
|
|
258
|
+
allowSort: i.data.props.sortable !== !1,
|
|
259
|
+
sortable: !1,
|
|
260
|
+
fixed: i.data.props.fixed
|
|
261
|
+
} : e.push({
|
|
262
|
+
...o,
|
|
263
|
+
...n,
|
|
264
|
+
scopedSlots: r,
|
|
265
|
+
hide: !1,
|
|
266
|
+
isVNode: !0,
|
|
267
|
+
filterable: !1,
|
|
268
|
+
allowSort: i.data.props.sortable !== !1,
|
|
269
|
+
sortable: !1,
|
|
270
|
+
fixed: i.data.props.fixed
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}) : l && l.forEach((i) => {
|
|
274
|
+
i.type === "expand" ? s = {
|
|
275
|
+
...i,
|
|
276
|
+
props: i,
|
|
277
|
+
hide: !1,
|
|
278
|
+
filterable: !1,
|
|
279
|
+
allowSort: i.sortable !== !1,
|
|
280
|
+
sortable: !1,
|
|
281
|
+
fixed: i.fixed
|
|
282
|
+
} : e.push({
|
|
283
|
+
...i,
|
|
284
|
+
props: i,
|
|
285
|
+
hide: !1,
|
|
286
|
+
filterable: !1,
|
|
287
|
+
allowSort: i.sortable !== !1,
|
|
288
|
+
sortable: !1,
|
|
289
|
+
fixed: i.fixed
|
|
290
|
+
});
|
|
291
|
+
}), this.updateExpandColumn(s), this.updateColumns(e);
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
{ immediate: !0 }
|
|
295
|
+
);
|
|
192
296
|
},
|
|
193
297
|
mounted() {
|
|
194
298
|
this.$refs.table.bodyWrapper.addEventListener("scroll", this.onTableScroll);
|
|
195
299
|
},
|
|
300
|
+
beforeUpdate() {
|
|
301
|
+
this.renderKey++;
|
|
302
|
+
},
|
|
196
303
|
beforeDestroy() {
|
|
197
304
|
this.$refs.table.bodyWrapper.removeEventListener("scroll", this.onTableScroll);
|
|
198
305
|
},
|
|
199
306
|
methods: {
|
|
200
307
|
rowDbClick(...t) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
308
|
+
this.hideTooltip(), this.$emit("row-dblclick", ...t);
|
|
309
|
+
},
|
|
310
|
+
rowClick(t, e, s) {
|
|
311
|
+
if (this.clickRowSelect && this.selectable(t)) {
|
|
312
|
+
const a = this.$refs.table;
|
|
313
|
+
if (this.selectedRows.find((i) => i[this.rowKey] === t[this.rowKey])) {
|
|
314
|
+
a.toggleRowSelection(t, !1);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
a.toggleRowSelection(t);
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
hideTooltip() {
|
|
321
|
+
var e;
|
|
322
|
+
const t = this.$refs.table.$children.find((s) => {
|
|
323
|
+
var a;
|
|
324
|
+
return ((a = s.$options) == null ? void 0 : a.name) === "ElTableBody";
|
|
205
325
|
});
|
|
206
|
-
e
|
|
326
|
+
(e = t == null ? void 0 : t.$refs.tooltip) == null || e.hide();
|
|
207
327
|
},
|
|
208
328
|
updateTableScrollPosition() {
|
|
209
|
-
|
|
210
|
-
this.$refs.table.bodyWrapper && this.scrollTo(this.tableScrollTop, this.tableScrollLeft);
|
|
211
|
-
});
|
|
329
|
+
this.$refs.table.bodyWrapper && this.scrollTo(this.tableScrollTop, this.tableScrollLeft);
|
|
212
330
|
},
|
|
213
|
-
filterTableProperties:
|
|
214
|
-
filterTableEvents:
|
|
215
|
-
filterTableColumnProperties:
|
|
331
|
+
filterTableProperties: _,
|
|
332
|
+
filterTableEvents: $,
|
|
333
|
+
filterTableColumnProperties: S,
|
|
216
334
|
onTableScroll() {
|
|
217
335
|
this.tableScrollTop = this.$refs.table.bodyWrapper.scrollTop, this.tableScrollLeft = this.$refs.table.bodyWrapper.scrollLeft;
|
|
218
336
|
},
|
|
337
|
+
copy: (t) => B(F(t)),
|
|
219
338
|
onSortChange({ prop: t, order: e }) {
|
|
220
|
-
this.page.ascs = e === "ascending" ? t : "", this.page.descs = e === "descending" ? t : "";
|
|
339
|
+
this.payloadStyle !== "body" ? (this.page.ascs = e === "ascending" ? t : "", this.page.descs = e === "descending" ? t : "") : (this.page.ascs = e === "ascending" ? [t] : this.ascs, this.page.descs = e === "descending" ? [t] : this.descs);
|
|
221
340
|
},
|
|
222
341
|
onCurrentChange(t) {
|
|
223
|
-
this.currentRow = t;
|
|
224
|
-
},
|
|
225
|
-
/**
|
|
226
|
-
*
|
|
227
|
-
* @param {FilterRule} rule
|
|
228
|
-
*/
|
|
229
|
-
addRule(t) {
|
|
230
|
-
this.removeRule(t.field), this.page.filters.rules.push(t);
|
|
231
|
-
},
|
|
232
|
-
addRules(t) {
|
|
233
|
-
t.forEach((e) => this.addRule(e));
|
|
234
|
-
},
|
|
235
|
-
setModelField(t, e) {
|
|
236
|
-
this.$set(this.page.model, t, e);
|
|
237
|
-
},
|
|
238
|
-
setModel(t) {
|
|
239
|
-
this.page.page = 1, this.page.model = S(t);
|
|
240
|
-
},
|
|
241
|
-
deleteModelField(t) {
|
|
242
|
-
delete this.page.model[t];
|
|
243
|
-
},
|
|
244
|
-
removeRule(t) {
|
|
245
|
-
const e = this.page.filters.rules, a = e.findIndex((s) => s.field === t);
|
|
246
|
-
a > -1 && e.splice(a, 1);
|
|
247
|
-
},
|
|
248
|
-
addFilter({ field: t, op: e, value: a }) {
|
|
249
|
-
this.page.filters = Object.assign({}, this.page.filters, {
|
|
250
|
-
rules: [
|
|
251
|
-
{
|
|
252
|
-
field: t,
|
|
253
|
-
op: e,
|
|
254
|
-
value: a
|
|
255
|
-
}
|
|
256
|
-
],
|
|
257
|
-
op: "and"
|
|
258
|
-
});
|
|
342
|
+
this.selectable(t) && (this.currentRow = t);
|
|
259
343
|
},
|
|
260
|
-
|
|
261
|
-
this.
|
|
344
|
+
handleSelectionChange(t) {
|
|
345
|
+
this.selectedRows = t;
|
|
262
346
|
},
|
|
263
347
|
clearSelection() {
|
|
264
348
|
this.$refs.table.clearSelection();
|
|
265
349
|
},
|
|
266
|
-
|
|
267
|
-
|
|
350
|
+
getPageQuery() {
|
|
351
|
+
let t;
|
|
352
|
+
return this.payloadStyle !== "body" ? t = { ...this.page, current: this.page.page, size: this.page.limit, ...this.model || {} } : t = { page: { ...this.page, current: this.page.page, size: this.page.limit }, example: this.model || {} }, this.selectExport && (this.rowKey ? t.exportKeys = this.selectedRows.map((e) => e[this.rowKey]) : t.exportKeys = this.selectedRows.map((e) => this.records.indexOf(e))), t;
|
|
268
353
|
},
|
|
269
|
-
getPage() {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
this.tableStatus = o.error, console.error(d);
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
} else {
|
|
288
|
-
this.$notify.warning({
|
|
289
|
-
title: "开发提示!",
|
|
290
|
-
message: "PageableTable 请提供 url(String) 或 api(Function) 属性"
|
|
291
|
-
});
|
|
354
|
+
async getPage(t) {
|
|
355
|
+
var o;
|
|
356
|
+
if (w(this.$attrs, "data") && this.$attrs.data !== !1) {
|
|
357
|
+
this.records = this.$attrs.data, this.page.page = 1, this.page.total = (o = this.records) == null ? void 0 : o.length, this.page.limit = this.page.total;
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
t !== !1 && (this.records = []);
|
|
361
|
+
let e;
|
|
362
|
+
const s = this.getPageQuery();
|
|
363
|
+
if (this.api || this.url) {
|
|
364
|
+
t !== !1 && (this.tableStatus = f.loading);
|
|
365
|
+
try {
|
|
366
|
+
this.api && (e = await this.api(s));
|
|
367
|
+
} catch {
|
|
368
|
+
this.tableStatus = f.error;
|
|
292
369
|
return;
|
|
293
370
|
}
|
|
294
|
-
|
|
295
|
-
this
|
|
296
|
-
|
|
371
|
+
} else {
|
|
372
|
+
this.$notify.warning({
|
|
373
|
+
title: "开发提示!",
|
|
374
|
+
message: "PageableTable 请提供 url(String) 或 api(Function) 属性"
|
|
375
|
+
});
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
const {
|
|
379
|
+
data: { data: a }
|
|
380
|
+
} = e || {}, { total: l, records: i } = a || {};
|
|
381
|
+
this.page.total = Number(l), this.records = await this.mapRow(i), !i || !i.length ? this.tableStatus = f.empty : this.tableStatus = f.success, this.doLayout(), this.$emit("page-loaded", a);
|
|
297
382
|
},
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
383
|
+
doLayout() {
|
|
384
|
+
var t;
|
|
385
|
+
(t = this.$refs.table) == null || t.doLayout();
|
|
386
|
+
},
|
|
387
|
+
async refresh(t) {
|
|
388
|
+
await this.getPage(t);
|
|
302
389
|
},
|
|
303
390
|
reload() {
|
|
304
|
-
|
|
305
|
-
this.page = m(u({}, this.$options.data.call(this).page), {
|
|
306
|
-
total: this.page.total
|
|
307
|
-
});
|
|
308
|
-
});
|
|
391
|
+
this.page = { ...this.$options.data.call(this).page, limit: this.page.limit };
|
|
309
392
|
},
|
|
310
393
|
scrollTo(t, e) {
|
|
311
394
|
t && (this.$refs.table.bodyWrapper.scrollTop = t), e && (this.$refs.table.bodyWrapper.scrollLeft = e);
|
|
395
|
+
},
|
|
396
|
+
toggleRowSelection(t, e) {
|
|
397
|
+
this.$refs.table.toggleRowSelection(t, e);
|
|
398
|
+
},
|
|
399
|
+
mapRow(t) {
|
|
400
|
+
return t.map((e) => (this.dicOptions.forEach(async (s) => {
|
|
401
|
+
var a;
|
|
402
|
+
e[`$${s.prop}`] = e[s.prop], s.dicData ? e[s.prop] = ((a = s.dicData.find((l) => l.value === e[s.prop])) == null ? void 0 : a.label) || e[s.prop] : e[s.prop] = await z(s.dicType, e[s.prop]);
|
|
403
|
+
}), e));
|
|
404
|
+
},
|
|
405
|
+
toggleSettings() {
|
|
406
|
+
this.showSettings = !this.showSettings;
|
|
407
|
+
},
|
|
408
|
+
selectable(t) {
|
|
409
|
+
var e;
|
|
410
|
+
return !(t != null && t.disabled) && !((e = this.disabledRowKeys) != null && e.includes(t == null ? void 0 : t[this.rowKey]));
|
|
411
|
+
},
|
|
412
|
+
updateExpandColumn(t) {
|
|
413
|
+
t && this.expandColumn ? m(this.expandColumn, t) : this.expandColumn = t;
|
|
414
|
+
},
|
|
415
|
+
updateColumns(t) {
|
|
416
|
+
if (!A(this.tableColumns, t)) {
|
|
417
|
+
const e = {};
|
|
418
|
+
this.tableColumns.forEach((s) => {
|
|
419
|
+
e[s.prop] = s;
|
|
420
|
+
}), t.map((s) => {
|
|
421
|
+
const a = e[s.prop];
|
|
422
|
+
if (a) {
|
|
423
|
+
const { hide: l, filterable: i, allowSort: o, sortable: n, fixed: r } = a;
|
|
424
|
+
return m(a, s), a.hide = l, a.filterable = i, a.allowSort = o, a.sortable = n, a.fixed = r, a;
|
|
425
|
+
}
|
|
426
|
+
return s;
|
|
427
|
+
}), this.tableColumns = t;
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
onPageVisible() {
|
|
431
|
+
this.refresh(!1);
|
|
312
432
|
}
|
|
313
433
|
}
|
|
314
434
|
};
|
|
315
|
-
var
|
|
316
|
-
var e = this,
|
|
317
|
-
return
|
|
435
|
+
var j = function() {
|
|
436
|
+
var e = this, s = e._self._c;
|
|
437
|
+
return s("div", { class: ["pageable-table", { "auto-height": e.autoHeight }] }, [s("div", { staticClass: "pageable-table-wrapper" }, [e._t("toolbar", null, { selectedRows: e.selectedRows }), s("ElTable", e._g(e._b({ ref: "table", class: ["flex-item", { "header-bold": e.headerBold }], attrs: { data: e.records, border: e.border, stripe: "", size: "medium" }, on: { "hook:updated": e.updateTableScrollPosition, "sort-change": e.onSortChange, "row-dblclick": e.rowDbClick, "row-click": e.rowClick, "cell-click": e.hideTooltip, "current-change": e.onCurrentChange, "selection-change": e.handleSelectionChange }, scopedSlots: e._u([{ key: "empty", fn: function() {
|
|
318
438
|
return [e._t("empty", function() {
|
|
319
|
-
return [e.tableStatus === e.TABLE_STATUS.loading ? [
|
|
439
|
+
return [e.tableStatus === e.TABLE_STATUS.loading ? [s("span", { staticClass: "pageable-table-loading" }, [s("i", { staticClass: "table-status-icon el-icon-loading" }), e._v(" 加载中... ")])] : e.tableStatus === e.TABLE_STATUS.error ? [s("ElButton", { staticClass: "pageable-table-error", attrs: { icon: "table-status-icon el-icon-error" }, on: { click: e.refresh } }, [e._v("加载失败,点击重试!")])] : s("ElEmpty")];
|
|
320
440
|
})];
|
|
321
441
|
}, proxy: !0 }, { key: "append", fn: function() {
|
|
322
442
|
return [e._t("append")];
|
|
323
|
-
}, proxy: !0 }], null, !0) }, "ElTable", e.filterTableProperties(e.mergeAttrs), !1), e.filterTableEvents(e.$listeners)), [e.multiple && e.selection ?
|
|
324
|
-
return [
|
|
325
|
-
}, proxy: !0 }, { key: "default", fn: function({ row:
|
|
326
|
-
return [
|
|
327
|
-
} }], null, !1,
|
|
328
|
-
return [e._v(" " + e._s((e.page.page - 1) * e.page.limit +
|
|
329
|
-
} }], null, !1, 4238275121) }) : e._e(), e.
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
return [
|
|
334
|
-
} }]) })
|
|
335
|
-
})
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
443
|
+
}, proxy: !0 }], null, !0) }, "ElTable", e.filterTableProperties(e.mergeAttrs), !1), e.filterTableEvents(e.$listeners)), [e.expandColumn ? s("TableColumnFilterable", e._b({}, "TableColumnFilterable", e.expandColumn, !1)) : e._e(), e.multiple && e.selection ? s("TableColumn", { key: "multiple", attrs: { type: "selection", selectable: e.selectable, width: e.selectionWidth, align: "center" } }) : e._e(), !e.multiple && e.selection ? s("TableColumn", { key: "single", attrs: { sortable: !1, type: "single-selection", "class-name": "single-select-column", width: e.selectionWidth, align: "center" }, scopedSlots: e._u([{ key: "header", fn: function() {
|
|
444
|
+
return [s("ElRadio", { attrs: { value: !!e.currentRow, label: !0 } }, [s("span")])];
|
|
445
|
+
}, proxy: !0 }, { key: "default", fn: function({ row: a }) {
|
|
446
|
+
return [s("ElRadio", { attrs: { label: !0, disabled: !e.selectable(a), value: e.currentRow && e.currentRow[e.$attrs["row-key"] || e.rowKey || "id"] === a[e.$attrs["row-key"] || e.rowKey || "id"] } }, [s("span")])];
|
|
447
|
+
} }], null, !1, 1270221895) }) : e._e(), e.index ? s("TableColumn", { key: "order", attrs: { type: "index", label: "序号", width: e.indexWidth, align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ $index: a }) {
|
|
448
|
+
return [e._v(" " + e._s((e.page.page - 1) * e.page.limit + a + 1 || a + 1) + " ")];
|
|
449
|
+
} }], null, !1, 4238275121) }) : e._e(), e.tableColumns ? e._l(e.tableColumns.filter((a) => !a.hide), function(a, l) {
|
|
450
|
+
var i, o;
|
|
451
|
+
return s("TableColumnFilterable", e._b({ key: `${((i = a.props) == null ? void 0 : i.prop) || a.prop}-${l}`, scopedSlots: e._u([e.$scopedSlots[((o = a.props) == null ? void 0 : o.prop) || a.prop] ? { key: "default", fn: function({ row: n }) {
|
|
452
|
+
var r;
|
|
453
|
+
return [e._t(((r = a.props) == null ? void 0 : r.prop) || a.prop, null, { row: n })];
|
|
454
|
+
} } : null], null, !0) }, "TableColumnFilterable", a, !1));
|
|
455
|
+
}) : [s("TableColumn", { attrs: { label: "点击表格行复制模板" }, scopedSlots: e._u([{ key: "default", fn: function({ row: a }) {
|
|
456
|
+
return [s("pre", { staticClass: "pointer", on: { click: function(l) {
|
|
457
|
+
return e.copy(a);
|
|
458
|
+
} } }, [e._v(e._s(JSON.stringify(a, null, " ")))])];
|
|
459
|
+
} }]) })]], 2), e.paging ? s("ElPagination", { staticClass: "flex-not-shrink", attrs: { "current-page": e.page.page, "hide-on-single-page": e.hideOnSinglePage, "page-size": e.page.limit, total: e.page.total, "page-sizes": [10, 25, 50, 100, 500, 1e3, 2e3], background: "", layout: "total, sizes, prev, pager, next, jumper" }, on: { "size-change": (a) => {
|
|
460
|
+
e.page.limit = a;
|
|
461
|
+
}, "current-change": (a) => {
|
|
462
|
+
e.page.page = a;
|
|
463
|
+
} } }) : e._e(), s("TableColumnFilter", { attrs: { visible: e.showSettings, columns: e.tableColumns }, on: { "update:visible": function(a) {
|
|
464
|
+
e.showSettings = a;
|
|
465
|
+
} } })], 2), s("ResizeObserver", { on: { notify: e.doLayout } })], 1);
|
|
466
|
+
}, v = [], U = /* @__PURE__ */ P(
|
|
467
|
+
M,
|
|
468
|
+
j,
|
|
469
|
+
v,
|
|
342
470
|
!1,
|
|
343
471
|
null,
|
|
344
472
|
null
|
|
345
473
|
);
|
|
346
|
-
const
|
|
474
|
+
const Z = U.exports;
|
|
347
475
|
export {
|
|
348
|
-
|
|
476
|
+
Z as default
|
|
349
477
|
};
|