@web-utils/component 4.0.0 → 4.0.2
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/style.css +1 -1
- package/carousel/style.css +1 -1
- 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/{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/dictionary.DqiP9x2m.mjs +25 -0
- package/chunks/dictionary.DsN-2ukC.mjs +70 -0
- 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/sub-table-plus-props.BVsD71hT.mjs +30 -0
- package/chunks/{tab-mixin.CVr9bZtn.mjs → tab-mixin.BNK6dxLN.mjs} +1 -1
- 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-designer/index.mjs +343 -374
- package/flow-designer/style.css +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 +54 -40
- 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 +37 -69
- package/form-view/style.css +1 -1
- package/fy-curd/index.mjs +131 -140
- package/fy-curd/style.css +1 -1
- package/fy-draggable/index.mjs +16 -26
- package/fy-draggable/style.css +1 -1
- package/fy-dynamic/index.mjs +48 -57
- package/fy-empty/style.css +1 -1
- package/fy-form/style.css +1 -1
- package/fy-form-design/index.mjs +314 -339
- package/fy-form-design/style.css +1 -1
- package/fy-input-map/index.mjs +40 -50
- package/fy-input-map/style.css +1 -1
- package/fy-input-table/index.mjs +31 -41
- package/fy-u-editor/index.mjs +77 -103
- package/fy-upload/style.css +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/monaco-editor/index.mjs +43 -71
- package/name-avatar/style.css +1 -1
- package/package.json +5 -4
- package/page-index/index.mjs +30 -54
- package/page-index-top/index.mjs +25 -47
- package/pageable-table/index.mjs +385 -218
- package/pageable-table/style.css +1 -1
- package/pageable-view/index.mjs +56 -95
- 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/resize-observer/index.mjs +1 -1
- package/resize-observer/style.css +1 -1
- package/search/style.css +1 -1
- package/search-popover/index.mjs +28 -48
- package/search-popover/style.css +1 -1
- package/sign/index.mjs +1 -1
- 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 +166 -37
- package/table-column/style.css +1 -0
- package/table-view/index.mjs +177 -132
- 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/toolbar/index.mjs +115 -58
- package/toolbar/style.css +1 -1
- package/toolbar-button/index.mjs +92 -48
- package/vue-cron/index.mjs +47 -65
- package/vue-qr-code/index.mjs +14 -32
- package/vue-quill-editor/index.mjs +13 -24
- package/vue-tags-input/index.mjs +10 -21
- package/vue-tree-select/index.mjs +352 -393
- package/vue-tree-select/style.css +1 -1
- package/vue-video-player/index.mjs +34 -63
- package/watermark/index.mjs +21 -31
- package/web-types.json +9240 -3840
- 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,163 @@
|
|
|
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 R, hasOwn as v } from "@web-utils/core";
|
|
2
|
+
import S from "element-ui/lib/message";
|
|
3
|
+
import { merge as f } from "@web-utils/integrations/lodash";
|
|
4
|
+
import { f as _, g as P, h as B } from "../chunks/index.d3MV3Wq2.mjs";
|
|
5
|
+
import { g as A } from "../chunks/dictionary.DsN-2ukC.mjs";
|
|
6
|
+
import { _ as C } from "../chunks/helper.BiMLcEEk.mjs";
|
|
7
|
+
import "vue";
|
|
8
|
+
import { n as b } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
|
|
9
|
+
import { isEqual as K } from "lodash-es";
|
|
10
|
+
function L(t) {
|
|
11
|
+
R(
|
|
12
|
+
t,
|
|
13
|
+
() => S.success({ duration: 1e3, message: "复制成功!", type: "success" }),
|
|
14
|
+
() => S.error({ duration: 1e3, message: "复制失败!", type: "error" })
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
const F = {
|
|
18
|
+
name: "TableColumnFilterable",
|
|
19
|
+
functional: !0,
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param h
|
|
23
|
+
* @param context {FunctionalContext}
|
|
24
|
+
* @returns {JSX.Element}
|
|
25
|
+
*/
|
|
26
|
+
render(t, e) {
|
|
27
|
+
const {
|
|
28
|
+
data: {
|
|
29
|
+
key: s
|
|
30
|
+
},
|
|
31
|
+
props: l,
|
|
32
|
+
parent: {
|
|
33
|
+
records: i
|
|
34
|
+
},
|
|
35
|
+
scopedSlots: a
|
|
36
|
+
} = e, {
|
|
37
|
+
hide: o,
|
|
38
|
+
isVNode: n,
|
|
39
|
+
filterable: r,
|
|
40
|
+
allowSort: g,
|
|
41
|
+
autoUpdate: d,
|
|
42
|
+
scopedSlots: T,
|
|
43
|
+
prop: m,
|
|
44
|
+
...x
|
|
45
|
+
} = l, y = `${s}-${r}${d ? `-${Math.random()}`.replace("0.", "") : ""}`, u = {
|
|
46
|
+
props: {
|
|
47
|
+
prop: m,
|
|
48
|
+
...x
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
if (r) {
|
|
52
|
+
const $ = [...new Set(i.map((c) => c[m]).filter((c) => c))].map((c) => ({
|
|
53
|
+
text: c,
|
|
54
|
+
value: c
|
|
55
|
+
}));
|
|
56
|
+
u.props.filterMethod = (c, w, k) => {
|
|
57
|
+
const E = k.property;
|
|
58
|
+
return w[E] === c;
|
|
59
|
+
}, u.props.filters = $;
|
|
28
60
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
61
|
+
const h = T || a;
|
|
62
|
+
return h != null && h.default ? t("ElTableColumn", C([{}, u, {
|
|
63
|
+
scopedSlots: h,
|
|
64
|
+
key: y
|
|
65
|
+
}])) : t("TableColumn", C([{}, u, {
|
|
66
|
+
key: y
|
|
67
|
+
}]));
|
|
68
|
+
}
|
|
69
|
+
}, z = null, O = null;
|
|
70
|
+
var W = /* @__PURE__ */ b(
|
|
71
|
+
F,
|
|
72
|
+
z,
|
|
73
|
+
O,
|
|
74
|
+
!1,
|
|
75
|
+
null,
|
|
76
|
+
null
|
|
77
|
+
);
|
|
78
|
+
const V = W.exports, D = {
|
|
79
|
+
name: "TableColumnFilter",
|
|
80
|
+
props: {
|
|
81
|
+
columns: {
|
|
82
|
+
type: Array,
|
|
83
|
+
default: () => []
|
|
84
|
+
},
|
|
85
|
+
visible: Boolean
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var M = function() {
|
|
89
|
+
var e = this, s = e._self._c;
|
|
90
|
+
return s("ElDrawer", { staticClass: "table-column-filter", attrs: { visible: e.visible, title: "表格设置", "append-to-body": "" }, on: { "update:visible": (l) => e.$emit("update:visible", l) } }, [s("ElTable", { attrs: { data: e.columns, border: "" } }, [s("ElTableColumn", { attrs: { label: "列名" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
|
|
91
|
+
return [e._v(" " + e._s(l.label) + " ")];
|
|
92
|
+
} }]) }), s("ElTableColumn", { attrs: { label: "隐藏", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
|
|
93
|
+
return [s("ElCheckbox", { model: { value: l.hide, callback: function(i) {
|
|
94
|
+
e.$set(l, "hide", i);
|
|
95
|
+
}, expression: "row.hide" } })];
|
|
96
|
+
} }]) }), s("ElTableColumn", { attrs: { label: "冻结", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
|
|
97
|
+
return [s("ElCheckbox", { model: { value: l.fixed, callback: function(i) {
|
|
98
|
+
e.$set(l, "fixed", i);
|
|
99
|
+
}, expression: "row.fixed" } })];
|
|
100
|
+
} }]) }), s("ElTableColumn", { attrs: { label: "过滤", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
|
|
101
|
+
return [s("ElCheckbox", { model: { value: l.filterable, callback: function(i) {
|
|
102
|
+
e.$set(l, "filterable", i);
|
|
103
|
+
}, expression: "row.filterable" } })];
|
|
104
|
+
} }]) }), s("ElTableColumn", { attrs: { label: "排序", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
|
|
105
|
+
return [s("ElCheckbox", { attrs: { title: l.allowSort ? null : "该列不支持排序!", disabled: !l.allowSort }, model: { value: l.sortable, callback: function(i) {
|
|
106
|
+
e.$set(l, "sortable", i);
|
|
107
|
+
}, expression: "row.sortable" } })];
|
|
108
|
+
} }]) })], 1)], 1);
|
|
109
|
+
}, U = [], N = /* @__PURE__ */ b(
|
|
110
|
+
D,
|
|
111
|
+
M,
|
|
112
|
+
U,
|
|
113
|
+
!1,
|
|
114
|
+
null,
|
|
115
|
+
null
|
|
116
|
+
);
|
|
117
|
+
const H = N.exports, j = {
|
|
118
|
+
props: {
|
|
119
|
+
useVisibilityChange: Boolean
|
|
120
|
+
},
|
|
121
|
+
created() {
|
|
122
|
+
this.useVisibilityChange && document.addEventListener("visibilitychange", this.onPageVisibleChange);
|
|
123
|
+
},
|
|
124
|
+
beforeDestroy() {
|
|
125
|
+
this.useVisibilityChange && document.removeEventListener("visibilitychange", this.onPageVisibleChange);
|
|
126
|
+
},
|
|
127
|
+
methods: {
|
|
128
|
+
onPageVisibleChange() {
|
|
129
|
+
var t, e;
|
|
130
|
+
document.hidden ? (t = this.onPageHidden) == null || t.call(this) : (e = this.onPageVisible) == null || e.call(this);
|
|
34
131
|
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const n =
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
function Q(t, e) {
|
|
135
|
+
const s = t.map((i) => {
|
|
136
|
+
const { hide: a, filterable: o, allowSort: n, sortable: r, fixed: g, ...d } = i;
|
|
137
|
+
return d;
|
|
138
|
+
}), l = e.map((i) => {
|
|
139
|
+
const { hide: a, filterable: o, allowSort: n, sortable: r, fixed: g, ...d } = i;
|
|
140
|
+
return d;
|
|
141
|
+
});
|
|
142
|
+
return K(s, l);
|
|
143
|
+
}
|
|
144
|
+
function q(t) {
|
|
145
|
+
let e = "";
|
|
146
|
+
for (const s in t)
|
|
147
|
+
e += `<TableColumn prop="${s}" label="${s}"/>
|
|
148
|
+
`;
|
|
149
|
+
return e;
|
|
150
|
+
}
|
|
151
|
+
const p = {
|
|
43
152
|
loading: 1,
|
|
44
153
|
error: -1,
|
|
45
154
|
empty: 2,
|
|
46
155
|
success: 0
|
|
47
|
-
},
|
|
156
|
+
}, I = {
|
|
48
157
|
name: "PageableTable",
|
|
158
|
+
components: { TableColumnFilter: H, TableColumnFilterable: V },
|
|
159
|
+
mixins: [j],
|
|
160
|
+
emits: ["page-loaded", "row-dblclick"],
|
|
49
161
|
bus: {
|
|
50
162
|
reloadTableView(t) {
|
|
51
163
|
t === this.viewId && this.getPage();
|
|
@@ -53,37 +165,22 @@ const n = {
|
|
|
53
165
|
},
|
|
54
166
|
inheritAttrs: !1,
|
|
55
167
|
props: {
|
|
56
|
-
|
|
57
|
-
type: String
|
|
58
|
-
|
|
59
|
-
url: {
|
|
60
|
-
type: String
|
|
168
|
+
selectionWidth: {
|
|
169
|
+
type: String,
|
|
170
|
+
default: "45"
|
|
61
171
|
},
|
|
62
|
-
|
|
172
|
+
viewId: String,
|
|
173
|
+
url: String,
|
|
63
174
|
hideOnSinglePage: Boolean,
|
|
64
|
-
api:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
filters: {
|
|
68
|
-
type: Object
|
|
69
|
-
},
|
|
70
|
-
filter: {
|
|
71
|
-
type: Object
|
|
72
|
-
},
|
|
73
|
-
rules: {
|
|
175
|
+
api: Function,
|
|
176
|
+
model: Object,
|
|
177
|
+
ascs: {
|
|
74
178
|
type: Array,
|
|
75
179
|
default: () => []
|
|
76
180
|
},
|
|
77
|
-
model: {
|
|
78
|
-
type: Object
|
|
79
|
-
},
|
|
80
|
-
ascs: {
|
|
81
|
-
type: String,
|
|
82
|
-
default: ""
|
|
83
|
-
},
|
|
84
181
|
descs: {
|
|
85
|
-
type:
|
|
86
|
-
default:
|
|
182
|
+
type: Array,
|
|
183
|
+
default: () => []
|
|
87
184
|
},
|
|
88
185
|
headerBold: Boolean,
|
|
89
186
|
autoHeight: Boolean,
|
|
@@ -111,34 +208,41 @@ const n = {
|
|
|
111
208
|
type: Boolean,
|
|
112
209
|
default: !1
|
|
113
210
|
},
|
|
114
|
-
columns:
|
|
115
|
-
type: Array
|
|
116
|
-
},
|
|
211
|
+
columns: Array,
|
|
117
212
|
pageSize: {
|
|
118
213
|
type: Number,
|
|
119
214
|
default: 25
|
|
120
|
-
}
|
|
215
|
+
},
|
|
216
|
+
dicOptions: {
|
|
217
|
+
type: Array,
|
|
218
|
+
default: () => []
|
|
219
|
+
},
|
|
220
|
+
paging: {
|
|
221
|
+
type: Boolean,
|
|
222
|
+
default: !0
|
|
223
|
+
},
|
|
224
|
+
clickRowSelect: Boolean,
|
|
225
|
+
payloadStyle: String,
|
|
226
|
+
rowKey: {
|
|
227
|
+
type: String,
|
|
228
|
+
default: "id"
|
|
229
|
+
},
|
|
230
|
+
disabledRowKeys: Array,
|
|
231
|
+
selectExport: Boolean
|
|
121
232
|
},
|
|
122
233
|
data() {
|
|
123
|
-
|
|
124
|
-
this.rules && this.rules.length > 0 && (t.rules = this.rules), this.filters && (t = this.filters), this.filter && (t = o(o({}, t), this.filter));
|
|
125
|
-
let e = {};
|
|
126
|
-
this.model && (e = S(this.model));
|
|
127
|
-
const a = this.pageSize;
|
|
234
|
+
const t = this.pageSize;
|
|
128
235
|
return {
|
|
129
|
-
TABLE_STATUS: Object.freeze(
|
|
130
|
-
tableStatus:
|
|
236
|
+
TABLE_STATUS: Object.freeze(p),
|
|
237
|
+
tableStatus: p.empty,
|
|
131
238
|
records: [],
|
|
132
239
|
currentRow: null,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
model: e,
|
|
140
|
-
filters: t
|
|
141
|
-
}
|
|
240
|
+
showSettings: !1,
|
|
241
|
+
selectedRows: [],
|
|
242
|
+
page: { total: 0, page: 1, limit: t, ascs: this.ascs, descs: this.descs },
|
|
243
|
+
tableColumns: [],
|
|
244
|
+
expandColumn: null,
|
|
245
|
+
renderKey: 1
|
|
142
246
|
};
|
|
143
247
|
},
|
|
144
248
|
computed: {
|
|
@@ -147,199 +251,262 @@ const n = {
|
|
|
147
251
|
asc: this.page.ascs,
|
|
148
252
|
desc: this.page.descs,
|
|
149
253
|
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;
|
|
254
|
+
limit: this.page.limit,
|
|
255
|
+
model: this.model
|
|
256
|
+
} : { asc: this.page.ascs, desc: this.page.descs, page: this.page.page, limit: this.page.limit };
|
|
161
257
|
},
|
|
162
258
|
indexWidth() {
|
|
163
|
-
|
|
164
|
-
|
|
259
|
+
var e;
|
|
260
|
+
const t = `${(this.page.page - 1) * this.page.limit + (((e = this.records) == null ? void 0 : e.length) ?? 0)}`;
|
|
261
|
+
return t.length > 3 ? 60 + (t.length - 3) * 10 : 60;
|
|
165
262
|
},
|
|
166
263
|
mergeAttrs() {
|
|
167
|
-
return
|
|
264
|
+
return f({}, this.$attrs, { height: this.autoHeight ? null : "auto" });
|
|
168
265
|
},
|
|
169
266
|
headers() {
|
|
170
267
|
var t;
|
|
171
|
-
return ((t = this.columns) == null ? void 0 : t.map(
|
|
268
|
+
return ((t = this.columns) == null ? void 0 : t.map(_)) || [];
|
|
172
269
|
}
|
|
173
270
|
},
|
|
174
271
|
watch: {
|
|
175
272
|
url: { handler: "reload" },
|
|
176
273
|
api: { handler: "reload" },
|
|
177
|
-
"$attrs.data"
|
|
178
|
-
this.getPage();
|
|
179
|
-
},
|
|
180
|
-
model: {
|
|
181
|
-
deep: !0,
|
|
182
|
-
handler(t) {
|
|
183
|
-
this.setModel(t);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
274
|
+
"$attrs.data": "getPage"
|
|
186
275
|
},
|
|
187
276
|
created() {
|
|
188
|
-
this.$watch(() => this.guard, this.getPage, {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
277
|
+
this.$watch(() => this.guard, this.getPage, { deep: !0, immediate: this.immediate }), this.$watch(
|
|
278
|
+
() => ({ columns: this.columns, renderKey: this.renderKey }),
|
|
279
|
+
(t) => {
|
|
280
|
+
const e = [];
|
|
281
|
+
let s = null;
|
|
282
|
+
if (t) {
|
|
283
|
+
const l = this.$slots.default, { columns: i } = t;
|
|
284
|
+
l ? l.forEach((a) => {
|
|
285
|
+
if (!a.isComment && a.data) {
|
|
286
|
+
const { attrs: o, props: n, scopedSlots: r } = a.data;
|
|
287
|
+
a.data.props = a.data.props || {}, a.data.props.type === "expand" ? s = {
|
|
288
|
+
...o,
|
|
289
|
+
...n,
|
|
290
|
+
scopedSlots: r,
|
|
291
|
+
hide: !1,
|
|
292
|
+
filterable: !1,
|
|
293
|
+
allowSort: a.data.props.sortable !== !1,
|
|
294
|
+
sortable: !1,
|
|
295
|
+
fixed: a.data.props.fixed
|
|
296
|
+
} : e.push({
|
|
297
|
+
...o,
|
|
298
|
+
...n,
|
|
299
|
+
scopedSlots: r,
|
|
300
|
+
hide: !1,
|
|
301
|
+
isVNode: !0,
|
|
302
|
+
filterable: !1,
|
|
303
|
+
allowSort: a.data.props.sortable !== !1,
|
|
304
|
+
sortable: !1,
|
|
305
|
+
fixed: a.data.props.fixed
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}) : i && i.forEach((a) => {
|
|
309
|
+
a.type === "expand" ? s = {
|
|
310
|
+
...a,
|
|
311
|
+
props: a,
|
|
312
|
+
hide: !1,
|
|
313
|
+
filterable: !1,
|
|
314
|
+
allowSort: a.sortable !== !1,
|
|
315
|
+
sortable: !1,
|
|
316
|
+
fixed: a.fixed
|
|
317
|
+
} : e.push({
|
|
318
|
+
...a,
|
|
319
|
+
props: a,
|
|
320
|
+
hide: !1,
|
|
321
|
+
filterable: !1,
|
|
322
|
+
allowSort: a.sortable !== !1,
|
|
323
|
+
sortable: !1,
|
|
324
|
+
fixed: a.fixed
|
|
325
|
+
});
|
|
326
|
+
}), this.updateExpandColumn(s), this.updateColumns(e);
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
{ immediate: !0 }
|
|
330
|
+
);
|
|
192
331
|
},
|
|
193
332
|
mounted() {
|
|
194
333
|
this.$refs.table.bodyWrapper.addEventListener("scroll", this.onTableScroll);
|
|
195
334
|
},
|
|
335
|
+
beforeUpdate() {
|
|
336
|
+
this.renderKey++;
|
|
337
|
+
},
|
|
196
338
|
beforeDestroy() {
|
|
197
339
|
this.$refs.table.bodyWrapper.removeEventListener("scroll", this.onTableScroll);
|
|
198
340
|
},
|
|
199
341
|
methods: {
|
|
200
342
|
rowDbClick(...t) {
|
|
201
|
-
|
|
202
|
-
|
|
343
|
+
this.hideTooltip(), this.$emit("row-dblclick", ...t);
|
|
344
|
+
},
|
|
345
|
+
rowClick(t, e, s) {
|
|
346
|
+
if (this.clickRowSelect && this.selectable(t)) {
|
|
347
|
+
const l = this.$refs.table;
|
|
348
|
+
if (this.selectedRows.find((a) => a[this.rowKey] === t[this.rowKey])) {
|
|
349
|
+
l.toggleRowSelection(t, !1);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
l.toggleRowSelection(t);
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
hideTooltip() {
|
|
356
|
+
var e;
|
|
357
|
+
const t = this.$refs.table.$children.find((s) => {
|
|
203
358
|
var l;
|
|
204
359
|
return ((l = s.$options) == null ? void 0 : l.name) === "ElTableBody";
|
|
205
360
|
});
|
|
206
|
-
e
|
|
361
|
+
(e = t == null ? void 0 : t.$refs.tooltip) == null || e.hide();
|
|
207
362
|
},
|
|
208
363
|
updateTableScrollPosition() {
|
|
209
364
|
this.$refs.table.bodyWrapper && this.scrollTo(this.tableScrollTop, this.tableScrollLeft);
|
|
210
365
|
},
|
|
211
366
|
filterTableProperties: B,
|
|
212
|
-
filterTableEvents:
|
|
213
|
-
filterTableColumnProperties:
|
|
367
|
+
filterTableEvents: P,
|
|
368
|
+
filterTableColumnProperties: _,
|
|
214
369
|
onTableScroll() {
|
|
215
370
|
this.tableScrollTop = this.$refs.table.bodyWrapper.scrollTop, this.tableScrollLeft = this.$refs.table.bodyWrapper.scrollLeft;
|
|
216
371
|
},
|
|
372
|
+
copy: (t) => L(q(t)),
|
|
217
373
|
onSortChange({ prop: t, order: e }) {
|
|
218
|
-
this.page.ascs = e === "ascending" ? t : "", this.page.descs = e === "descending" ? t : "";
|
|
374
|
+
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);
|
|
219
375
|
},
|
|
220
376
|
onCurrentChange(t) {
|
|
221
|
-
this.currentRow = t;
|
|
222
|
-
},
|
|
223
|
-
/**
|
|
224
|
-
*
|
|
225
|
-
* @param {FilterRule} rule
|
|
226
|
-
*/
|
|
227
|
-
addRule(t) {
|
|
228
|
-
this.removeRule(t.field), this.page.filters.rules.push(t);
|
|
229
|
-
},
|
|
230
|
-
addRules(t) {
|
|
231
|
-
t.forEach((e) => this.addRule(e));
|
|
232
|
-
},
|
|
233
|
-
setModelField(t, e) {
|
|
234
|
-
this.$set(this.page.model, t, e);
|
|
235
|
-
},
|
|
236
|
-
setModel(t) {
|
|
237
|
-
this.page.page = 1, this.page.model = S(t);
|
|
238
|
-
},
|
|
239
|
-
deleteModelField(t) {
|
|
240
|
-
delete this.page.model[t];
|
|
241
|
-
},
|
|
242
|
-
removeRule(t) {
|
|
243
|
-
const e = this.page.filters.rules, a = e.findIndex((s) => s.field === t);
|
|
244
|
-
a > -1 && e.splice(a, 1);
|
|
245
|
-
},
|
|
246
|
-
addFilter({ field: t, op: e, value: a }) {
|
|
247
|
-
this.page.filters = c(o({}, this.page.filters), {
|
|
248
|
-
rules: [
|
|
249
|
-
{
|
|
250
|
-
field: t,
|
|
251
|
-
op: e,
|
|
252
|
-
value: a
|
|
253
|
-
}
|
|
254
|
-
],
|
|
255
|
-
op: "and"
|
|
256
|
-
});
|
|
377
|
+
this.selectable(t) && (this.currentRow = t);
|
|
257
378
|
},
|
|
258
|
-
|
|
259
|
-
this.
|
|
379
|
+
handleSelectionChange(t) {
|
|
380
|
+
this.selectedRows = t;
|
|
260
381
|
},
|
|
261
382
|
clearSelection() {
|
|
262
383
|
this.$refs.table.clearSelection();
|
|
263
384
|
},
|
|
264
|
-
|
|
265
|
-
|
|
385
|
+
getPageQuery() {
|
|
386
|
+
let t;
|
|
387
|
+
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;
|
|
266
388
|
},
|
|
267
|
-
getPage() {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
this.tableStatus = n.error, console.error(h);
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
} else {
|
|
286
|
-
this.$notify.warning({
|
|
287
|
-
title: "开发提示!",
|
|
288
|
-
message: "PageableTable 请提供 url(String) 或 api(Function) 属性"
|
|
289
|
-
});
|
|
389
|
+
async getPage(t) {
|
|
390
|
+
var o;
|
|
391
|
+
if (v(this.$attrs, "data") && this.$attrs.data !== !1) {
|
|
392
|
+
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;
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
t !== !1 && (this.records = []);
|
|
396
|
+
let e;
|
|
397
|
+
const s = this.getPageQuery();
|
|
398
|
+
if (this.api || this.url) {
|
|
399
|
+
t !== !1 && (this.tableStatus = p.loading);
|
|
400
|
+
try {
|
|
401
|
+
this.api && (e = await this.api(s));
|
|
402
|
+
} catch {
|
|
403
|
+
this.tableStatus = p.error;
|
|
290
404
|
return;
|
|
291
405
|
}
|
|
292
|
-
|
|
293
|
-
this
|
|
294
|
-
|
|
406
|
+
} else {
|
|
407
|
+
this.$notify.warning({
|
|
408
|
+
title: "开发提示!",
|
|
409
|
+
message: "PageableTable 请提供 url(String) 或 api(Function) 属性"
|
|
410
|
+
});
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const {
|
|
414
|
+
data: { data: l }
|
|
415
|
+
} = e || {}, { total: i, records: a } = l || {};
|
|
416
|
+
this.page.total = Number(i), this.records = await this.mapRow(a), !a || !a.length ? this.tableStatus = p.empty : this.tableStatus = p.success, this.doLayout(), this.$emit("page-loaded", l);
|
|
295
417
|
},
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
418
|
+
doLayout() {
|
|
419
|
+
var t;
|
|
420
|
+
(t = this.$refs.table) == null || t.doLayout();
|
|
421
|
+
},
|
|
422
|
+
async refresh(t) {
|
|
423
|
+
await this.getPage(t);
|
|
300
424
|
},
|
|
301
425
|
reload() {
|
|
302
|
-
this.page =
|
|
303
|
-
total: this.page.total
|
|
304
|
-
});
|
|
426
|
+
this.page = { ...this.$options.data.call(this).page, limit: this.page.limit };
|
|
305
427
|
},
|
|
306
428
|
scrollTo(t, e) {
|
|
307
429
|
t && (this.$refs.table.bodyWrapper.scrollTop = t), e && (this.$refs.table.bodyWrapper.scrollLeft = e);
|
|
430
|
+
},
|
|
431
|
+
toggleRowSelection(t, e) {
|
|
432
|
+
this.$refs.table.toggleRowSelection(t, e);
|
|
433
|
+
},
|
|
434
|
+
mapRow(t) {
|
|
435
|
+
return t.map((e) => (this.dicOptions.forEach(async (s) => {
|
|
436
|
+
var l;
|
|
437
|
+
e[`$${s.prop}`] = e[s.prop], s.dicData ? e[s.prop] = ((l = s.dicData.find((i) => i.value === e[s.prop])) == null ? void 0 : l.label) || e[s.prop] : e[s.prop] = await A(s.dicType, e[s.prop]);
|
|
438
|
+
}), e));
|
|
439
|
+
},
|
|
440
|
+
toggleSettings() {
|
|
441
|
+
this.showSettings = !this.showSettings;
|
|
442
|
+
},
|
|
443
|
+
selectable(t) {
|
|
444
|
+
var e;
|
|
445
|
+
return !(t != null && t.disabled) && !((e = this.disabledRowKeys) != null && e.includes(t == null ? void 0 : t[this.rowKey]));
|
|
446
|
+
},
|
|
447
|
+
updateExpandColumn(t) {
|
|
448
|
+
t && this.expandColumn ? f(this.expandColumn, t) : this.expandColumn = t;
|
|
449
|
+
},
|
|
450
|
+
updateColumns(t) {
|
|
451
|
+
if (!Q(this.tableColumns, t)) {
|
|
452
|
+
const e = {};
|
|
453
|
+
this.tableColumns.forEach((s) => {
|
|
454
|
+
e[s.prop] = s;
|
|
455
|
+
}), t.map((s) => {
|
|
456
|
+
const l = e[s.prop];
|
|
457
|
+
if (l) {
|
|
458
|
+
const { hide: i, filterable: a, allowSort: o, sortable: n, fixed: r } = l;
|
|
459
|
+
return f(l, s), l.hide = i, l.filterable = a, l.allowSort = o, l.sortable = n, l.fixed = r, l;
|
|
460
|
+
}
|
|
461
|
+
return s;
|
|
462
|
+
}), this.tableColumns = t;
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
onPageVisible() {
|
|
466
|
+
this.refresh(!1);
|
|
308
467
|
}
|
|
309
468
|
}
|
|
310
469
|
};
|
|
311
|
-
var
|
|
312
|
-
var e = this,
|
|
313
|
-
return
|
|
470
|
+
var J = function() {
|
|
471
|
+
var e = this, s = e._self._c;
|
|
472
|
+
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() {
|
|
314
473
|
return [e._t("empty", function() {
|
|
315
|
-
return [e.tableStatus === e.TABLE_STATUS.loading ? [
|
|
474
|
+
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")];
|
|
316
475
|
})];
|
|
317
476
|
}, proxy: !0 }, { key: "append", fn: function() {
|
|
318
477
|
return [e._t("append")];
|
|
319
|
-
}, proxy: !0 }], null, !0) }, "ElTable", e.filterTableProperties(e.mergeAttrs), !1), e.filterTableEvents(e.$listeners)), [e.multiple && e.selection ?
|
|
320
|
-
return [
|
|
321
|
-
}, proxy: !0 }, { key: "default", fn: function({ row:
|
|
322
|
-
return [
|
|
323
|
-
} }], null, !1,
|
|
324
|
-
return [e._v(" " + e._s((e.page.page - 1) * e.page.limit +
|
|
325
|
-
} }], null, !1, 4238275121) }) : e._e(), e.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
return [
|
|
330
|
-
} }]) })
|
|
331
|
-
})
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
478
|
+
}, 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() {
|
|
479
|
+
return [s("ElRadio", { attrs: { value: !!e.currentRow, label: !0 } }, [s("span")])];
|
|
480
|
+
}, proxy: !0 }, { key: "default", fn: function({ row: l }) {
|
|
481
|
+
return [s("ElRadio", { attrs: { label: !0, disabled: !e.selectable(l), value: e.currentRow && e.currentRow[e.$attrs["row-key"] || e.rowKey || "id"] === l[e.$attrs["row-key"] || e.rowKey || "id"] } }, [s("span")])];
|
|
482
|
+
} }], 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: l }) {
|
|
483
|
+
return [e._v(" " + e._s((e.page.page - 1) * e.page.limit + l + 1 || l + 1) + " ")];
|
|
484
|
+
} }], null, !1, 4238275121) }) : e._e(), e.tableColumns ? e._l(e.tableColumns.filter((l) => !l.hide), function(l, i) {
|
|
485
|
+
var a, o;
|
|
486
|
+
return s("TableColumnFilterable", e._b({ key: `${((a = l.props) == null ? void 0 : a.prop) || l.prop}-${i}`, scopedSlots: e._u([e.$scopedSlots[((o = l.props) == null ? void 0 : o.prop) || l.prop] ? { key: "default", fn: function({ row: n }) {
|
|
487
|
+
var r;
|
|
488
|
+
return [e._t(((r = l.props) == null ? void 0 : r.prop) || l.prop, null, { row: n })];
|
|
489
|
+
} } : null], null, !0) }, "TableColumnFilterable", l, !1));
|
|
490
|
+
}) : [s("TableColumn", { attrs: { label: "点击表格行复制模板" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
|
|
491
|
+
return [s("pre", { staticClass: "pointer", on: { click: function(i) {
|
|
492
|
+
return e.copy(l);
|
|
493
|
+
} } }, [e._v(e._s(JSON.stringify(l, null, " ")))])];
|
|
494
|
+
} }]) })]], 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": (l) => {
|
|
495
|
+
e.page.limit = l;
|
|
496
|
+
}, "current-change": (l) => {
|
|
497
|
+
e.page.page = l;
|
|
498
|
+
} } }) : e._e(), s("TableColumnFilter", { attrs: { visible: e.showSettings, columns: e.tableColumns }, on: { "update:visible": function(l) {
|
|
499
|
+
e.showSettings = l;
|
|
500
|
+
} } })], 2), s("ResizeObserver", { on: { notify: e.doLayout } })], 1);
|
|
501
|
+
}, X = [], G = /* @__PURE__ */ b(
|
|
502
|
+
I,
|
|
503
|
+
J,
|
|
504
|
+
X,
|
|
338
505
|
!1,
|
|
339
506
|
null,
|
|
340
507
|
null
|
|
341
508
|
);
|
|
342
|
-
const
|
|
509
|
+
const re = G.exports;
|
|
343
510
|
export {
|
|
344
|
-
|
|
511
|
+
re as default
|
|
345
512
|
};
|