@dazhicheng/ui 1.5.230 → 1.5.231
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.
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { propTypes as
|
|
3
|
-
import { useDesign as
|
|
1
|
+
import { defineComponent as oe, useAttrs as ne, ref as I, inject as M, computed as p, unref as r, toRaw as W, h as re, onMounted as ie, nextTick as le, createElementBlock as u, openBlock as l, normalizeClass as B, createVNode as T, createBlock as b, createCommentVNode as f, withCtx as m, Fragment as v, renderList as P, renderSlot as se, withDirectives as z, mergeProps as ae, normalizeStyle as D, toDisplayString as j, createElementVNode as de, withModifiers as ue, createSlots as pe, createTextVNode as ce } from "vue";
|
|
2
|
+
import { propTypes as y } from "../../../../packages/hooks/src/propTypes.js";
|
|
3
|
+
import { useDesign as fe } from "../../../../packages/hooks/src/useDesign.js";
|
|
4
4
|
import "axios";
|
|
5
|
-
import { ElDivider as
|
|
6
|
-
import { isBoolean as
|
|
7
|
-
import { generateTestId as
|
|
8
|
-
import { calcWordsWidth as
|
|
5
|
+
import { ElDivider as me, ElSpace as be, ElPopover as ve } from "element-plus";
|
|
6
|
+
import { isBoolean as ge, isFunction as ye, isArray as xe, isObject as he } from "../../../../packages/utils/src/is.js";
|
|
7
|
+
import { generateTestId as V, toKebabCase as O } from "../../../../packages/utils/src/testid-helper.js";
|
|
8
|
+
import { calcWordsWidth as we } from "../../../../packages/utils/src/tool.js";
|
|
9
9
|
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
10
10
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
11
11
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
12
12
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
13
13
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
14
14
|
import "lodash-es";
|
|
15
|
-
import { TtButton as
|
|
16
|
-
import { TtIcon as
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { ROW_INDEX_KEY as
|
|
20
|
-
const
|
|
15
|
+
import { TtButton as A } from "../../../tt-button/index.js";
|
|
16
|
+
import { TtIcon as E } from "../../../tt-icon/index.js";
|
|
17
|
+
import K from "../../../../directives/disabled-tip/index.js";
|
|
18
|
+
import Ce from "../../../../assets/svg/action_more.svg.js";
|
|
19
|
+
import { ROW_INDEX_KEY as ke } from "./RowContext.js";
|
|
20
|
+
const Ie = { key: 1 }, Be = ["onClick"], Ue = /* @__PURE__ */ oe({
|
|
21
21
|
name: "TtTableAction",
|
|
22
22
|
__name: "TableAction",
|
|
23
23
|
props: {
|
|
@@ -39,220 +39,223 @@ const xe = { key: 1 }, Ce = ["onClick"], Oe = /* @__PURE__ */ Z({
|
|
|
39
39
|
/** 是否分割线 */
|
|
40
40
|
// divider: propTypes.bool.def(true),
|
|
41
41
|
/** 是否清除冒泡 */
|
|
42
|
-
stopButtonPropagation:
|
|
42
|
+
stopButtonPropagation: y.bool.def(!1),
|
|
43
43
|
/** 显示buttton的个数 默认是2 */
|
|
44
|
-
showBtnNums:
|
|
44
|
+
showBtnNums: y.number.def(3),
|
|
45
45
|
/** 弹出框的宽度 */
|
|
46
|
-
popoverWidth:
|
|
46
|
+
popoverWidth: y.number.def(27),
|
|
47
47
|
/** 是否自动换行 */
|
|
48
|
-
wrap:
|
|
48
|
+
wrap: y.bool.def(!0)
|
|
49
49
|
},
|
|
50
|
-
setup(
|
|
51
|
-
const
|
|
50
|
+
setup(S) {
|
|
51
|
+
const i = S, x = ne(), { prefixCls: $ } = fe("table-action"), g = I(!1), L = M(
|
|
52
52
|
"tableIdContext",
|
|
53
53
|
p(() => "")
|
|
54
|
-
),
|
|
55
|
-
if (
|
|
56
|
-
return
|
|
57
|
-
const t =
|
|
54
|
+
), U = M(ke, void 0), q = p(() => {
|
|
55
|
+
if (i.rowIndex !== void 0 && i.rowIndex !== null)
|
|
56
|
+
return i.rowIndex;
|
|
57
|
+
const t = r(U);
|
|
58
58
|
if (t != null)
|
|
59
59
|
return t;
|
|
60
|
-
if (
|
|
61
|
-
return
|
|
62
|
-
if (
|
|
63
|
-
return
|
|
60
|
+
if (i.slotContext && i.slotContext.$rowIndex !== void 0)
|
|
61
|
+
return i.slotContext.$rowIndex;
|
|
62
|
+
if (x.$rowIndex !== void 0 && x.$rowIndex !== null)
|
|
63
|
+
return x.$rowIndex;
|
|
64
64
|
});
|
|
65
|
-
function
|
|
66
|
-
const o =
|
|
67
|
-
return e != null ?
|
|
65
|
+
function h(t) {
|
|
66
|
+
const o = r(L), e = q.value;
|
|
67
|
+
return e != null ? V(o, "action", `row${e}`, O(t)) : V(o, "action", O(t));
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function F(t) {
|
|
70
70
|
const o = t.ifShow;
|
|
71
71
|
let e = !0;
|
|
72
|
-
return
|
|
72
|
+
return ge(o) && (e = o), ye(o) && (e = o(t)), e;
|
|
73
73
|
}
|
|
74
|
-
const
|
|
75
|
-
const t = document.getElementsByTagName("body")[0], o = window.getComputedStyle(t).fontFamily, e =
|
|
76
|
-
return
|
|
74
|
+
const G = p(() => (W(i.actions) || []).filter((t) => F(t)).slice(0, i.showBtnNums)), w = p(() => (W(i.actions) || []).filter((t) => F(t)).slice(i.showBtnNums)), H = p(() => r(w).length > 0), X = p(() => "left flex items-center"), Y = p(() => {
|
|
75
|
+
const t = document.getElementsByTagName("body")[0], o = window.getComputedStyle(t).fontFamily, e = w.value.map((s) => we(s.label, "12px", o) + 22), n = Math.max(...e);
|
|
76
|
+
return n > i.popoverWidth ? n : i.popoverWidth;
|
|
77
77
|
});
|
|
78
|
-
function
|
|
78
|
+
function N(t, o) {
|
|
79
79
|
const e = t;
|
|
80
|
-
return
|
|
80
|
+
return xe(e) && e.length > 0 ? e.some((n) => !!(n != null && n.condition)) : he(e) ? !!e.condition : !!o;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
if (!
|
|
84
|
-
t.composedPath().find((
|
|
82
|
+
function J(t) {
|
|
83
|
+
if (!i.stopButtonPropagation) return;
|
|
84
|
+
t.composedPath().find((n) => {
|
|
85
85
|
var s;
|
|
86
|
-
return ((s =
|
|
86
|
+
return ((s = n.tagName) == null ? void 0 : s.toUpperCase()) === "BUTTON";
|
|
87
87
|
}) && t.stopPropagation();
|
|
88
88
|
}
|
|
89
|
-
const
|
|
89
|
+
const Q = re(me, {
|
|
90
90
|
direction: "vertical",
|
|
91
91
|
style: { fontSize: "12px", margin: "0 6px" }
|
|
92
92
|
});
|
|
93
|
-
function
|
|
94
|
-
|
|
93
|
+
function Z(t) {
|
|
94
|
+
g.value = !0, C.value = t.target && t.target.getBoundingClientRect();
|
|
95
95
|
}
|
|
96
|
-
const
|
|
96
|
+
const C = I({
|
|
97
97
|
top: 0,
|
|
98
98
|
left: 0,
|
|
99
99
|
bottom: 0,
|
|
100
100
|
right: 0
|
|
101
101
|
});
|
|
102
|
-
function
|
|
102
|
+
function ee() {
|
|
103
103
|
const t = Array.from(document.querySelectorAll('[class*="table-action"]')), o = /* @__PURE__ */ new Map();
|
|
104
104
|
t.forEach((e) => {
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
107
|
-
const s = e.getBoundingClientRect(),
|
|
108
|
-
|
|
105
|
+
const n = e.closest(".vxe-table");
|
|
106
|
+
if (!n) return;
|
|
107
|
+
const s = e.getBoundingClientRect(), a = Math.round(s.top), d = o.get(n) || /* @__PURE__ */ new Map(), c = d.get(a) || [];
|
|
108
|
+
c.push(e), d.set(a, c), o.set(n, d);
|
|
109
109
|
}), o.forEach((e) => {
|
|
110
|
-
e.forEach((
|
|
111
|
-
const s =
|
|
112
|
-
|
|
113
|
-
d.
|
|
114
|
-
|
|
110
|
+
e.forEach((n) => {
|
|
111
|
+
const s = n.sort((a, d) => {
|
|
112
|
+
const c = a.closest(".vxe-table"), k = d.closest(".vxe-table"), R = c != null && c.classList.contains("is--fixed-right") ? 1 : 0, _ = k != null && k.classList.contains("is--fixed-right") ? 1 : 0;
|
|
113
|
+
return R !== _ ? _ - R : d.getBoundingClientRect().left - a.getBoundingClientRect().left;
|
|
114
|
+
})[0];
|
|
115
|
+
n.forEach((a) => {
|
|
116
|
+
a.querySelectorAll("[data-table-action-button]").forEach((d) => {
|
|
117
|
+
a !== s && (d.style.visibility = "hidden"), d.tabIndex = a === s ? 0 : -1;
|
|
115
118
|
});
|
|
116
119
|
});
|
|
117
120
|
});
|
|
118
121
|
});
|
|
119
122
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
window.setTimeout(
|
|
123
|
+
ie(() => {
|
|
124
|
+
le(() => {
|
|
125
|
+
window.setTimeout(ee, 80);
|
|
123
126
|
});
|
|
124
127
|
});
|
|
125
|
-
const
|
|
128
|
+
const te = I({
|
|
126
129
|
getBoundingClientRect() {
|
|
127
|
-
return
|
|
130
|
+
return C.value;
|
|
128
131
|
}
|
|
129
132
|
});
|
|
130
|
-
return (t, o) => (
|
|
131
|
-
class:
|
|
133
|
+
return (t, o) => (l(), u("div", {
|
|
134
|
+
class: B([r($), X.value]),
|
|
132
135
|
tabindex: "-1",
|
|
133
|
-
onClick:
|
|
136
|
+
onClick: J
|
|
134
137
|
}, [
|
|
135
|
-
|
|
138
|
+
T(r(be), {
|
|
136
139
|
size: 0,
|
|
137
|
-
spacer:
|
|
138
|
-
wrap:
|
|
140
|
+
spacer: r(Q),
|
|
141
|
+
wrap: S.wrap
|
|
139
142
|
}, {
|
|
140
|
-
default:
|
|
141
|
-
(
|
|
142
|
-
key: `${
|
|
143
|
+
default: m(() => [
|
|
144
|
+
(l(!0), u(v, null, P(G.value, (e, n) => (l(), u(v, {
|
|
145
|
+
key: `${n}-${e.label}`
|
|
143
146
|
}, [
|
|
144
|
-
e.slot ?
|
|
147
|
+
e.slot ? se(t.$slots, e.slot, ae({
|
|
145
148
|
key: 0,
|
|
146
149
|
ref_for: !0
|
|
147
|
-
}, e)) :
|
|
150
|
+
}, e)) : z((l(), b(r(A), {
|
|
148
151
|
key: 1,
|
|
149
152
|
link: "",
|
|
150
153
|
type: e.type || "primary",
|
|
151
|
-
disabled:
|
|
152
|
-
style:
|
|
154
|
+
disabled: N(e.disabledTip, e.disabled),
|
|
155
|
+
style: D({ color: e.color, visibility: e.isTextHide ? "hidden" : "visible" }),
|
|
153
156
|
loading: e.loading,
|
|
154
|
-
"data-index":
|
|
157
|
+
"data-index": n,
|
|
155
158
|
"data-table-action-button": "",
|
|
156
|
-
"data-testid":
|
|
159
|
+
"data-testid": h(e.label || ""),
|
|
157
160
|
onClick: e.onClick
|
|
158
161
|
}, {
|
|
159
|
-
default:
|
|
160
|
-
e.iconFont ? (
|
|
161
|
-
e.iconFont ? (
|
|
162
|
+
default: m(() => [
|
|
163
|
+
e.iconFont ? (l(), u(v, { key: 0 }, [
|
|
164
|
+
e.iconFont ? (l(), b(r(E), {
|
|
162
165
|
key: 0,
|
|
163
166
|
"icon-font": e.iconFont,
|
|
164
|
-
class:
|
|
165
|
-
}, null, 8, ["icon-font", "class"])) :
|
|
166
|
-
], 64)) :
|
|
167
|
-
e.label ? (
|
|
167
|
+
class: B({ "mr-1": !!e.label })
|
|
168
|
+
}, null, 8, ["icon-font", "class"])) : f("", !0)
|
|
169
|
+
], 64)) : f("", !0),
|
|
170
|
+
e.label ? (l(), u("span", Ie, j(e.label), 1)) : f("", !0)
|
|
168
171
|
]),
|
|
169
172
|
_: 2
|
|
170
173
|
}, 1032, ["type", "disabled", "style", "loading", "data-index", "data-testid", "onClick"])), [
|
|
171
|
-
[
|
|
174
|
+
[r(K), e.disabledTip]
|
|
172
175
|
])
|
|
173
176
|
], 64))), 128)),
|
|
174
|
-
|
|
177
|
+
H.value ? (l(), b(r(A), {
|
|
175
178
|
key: 0,
|
|
176
179
|
link: "",
|
|
177
180
|
type: "primary",
|
|
178
|
-
"data-testid":
|
|
181
|
+
"data-testid": h("more")
|
|
179
182
|
}, {
|
|
180
|
-
default:
|
|
181
|
-
|
|
182
|
-
onMouseover:
|
|
183
|
-
onMouseleave: o[0] || (o[0] = (e) =>
|
|
183
|
+
default: m(() => [
|
|
184
|
+
de("span", {
|
|
185
|
+
onMouseover: ue(Z, ["stop"]),
|
|
186
|
+
onMouseleave: o[0] || (o[0] = (e) => g.value = !1)
|
|
184
187
|
}, [
|
|
185
|
-
|
|
186
|
-
icon:
|
|
188
|
+
T(r(E), {
|
|
189
|
+
icon: r(Ce),
|
|
187
190
|
"is-custom-svg": "",
|
|
188
191
|
size: 14
|
|
189
192
|
}, null, 8, ["icon"])
|
|
190
193
|
], 32)
|
|
191
194
|
]),
|
|
192
195
|
_: 1
|
|
193
|
-
}, 8, ["data-testid"])) :
|
|
196
|
+
}, 8, ["data-testid"])) : f("", !0)
|
|
194
197
|
]),
|
|
195
198
|
_: 3
|
|
196
199
|
}, 8, ["spacer", "wrap"]),
|
|
197
|
-
|
|
200
|
+
C.value.left ? (l(), b(r(ve), {
|
|
198
201
|
key: 0,
|
|
199
|
-
visible:
|
|
200
|
-
"onUpdate:visible": o[1] || (o[1] = (e) =>
|
|
202
|
+
visible: g.value,
|
|
203
|
+
"onUpdate:visible": o[1] || (o[1] = (e) => g.value = e),
|
|
201
204
|
trigger: "hover",
|
|
202
205
|
placement: "bottom",
|
|
203
|
-
width:
|
|
206
|
+
width: Y.value,
|
|
204
207
|
offset: 8,
|
|
205
208
|
"hide-after": 0,
|
|
206
|
-
"virtual-ref":
|
|
209
|
+
"virtual-ref": te.value,
|
|
207
210
|
"virtual-triggering": "",
|
|
208
|
-
"popper-class": `${
|
|
211
|
+
"popper-class": `${r($)}-popover-class`,
|
|
209
212
|
"popper-style": {
|
|
210
213
|
padding: "6px 0px",
|
|
211
214
|
minWidth: "60px"
|
|
212
215
|
}
|
|
213
216
|
}, {
|
|
214
|
-
default:
|
|
215
|
-
(
|
|
216
|
-
key: `${
|
|
217
|
+
default: m(() => [
|
|
218
|
+
(l(!0), u(v, null, P(w.value, (e, n) => (l(), u("div", {
|
|
219
|
+
key: `${n}-${e.label}`,
|
|
217
220
|
onClick: () => {
|
|
218
221
|
var s;
|
|
219
222
|
!e.disabled && ((s = e.onClick) == null || s.call(e));
|
|
220
223
|
}
|
|
221
224
|
}, [
|
|
222
|
-
|
|
225
|
+
z((l(), b(r(A), {
|
|
223
226
|
link: "",
|
|
224
|
-
disabled:
|
|
227
|
+
disabled: N(e.disabledTip, e.disabled),
|
|
225
228
|
type: e.type || "primary",
|
|
226
|
-
style:
|
|
227
|
-
"data-testid":
|
|
228
|
-
},
|
|
229
|
-
default:
|
|
230
|
-
e.label ? (
|
|
231
|
-
|
|
232
|
-
], 64)) :
|
|
229
|
+
style: D({ color: e.color }),
|
|
230
|
+
"data-testid": h(e.label || "")
|
|
231
|
+
}, pe({
|
|
232
|
+
default: m(() => [
|
|
233
|
+
e.label ? (l(), u(v, { key: 0 }, [
|
|
234
|
+
ce(j(e.label), 1)
|
|
235
|
+
], 64)) : f("", !0)
|
|
233
236
|
]),
|
|
234
237
|
_: 2
|
|
235
238
|
}, [
|
|
236
239
|
e.iconFont ? {
|
|
237
240
|
name: "icon",
|
|
238
|
-
fn:
|
|
239
|
-
|
|
241
|
+
fn: m(() => [
|
|
242
|
+
T(r(E), {
|
|
240
243
|
"icon-font": e.iconFont,
|
|
241
|
-
class:
|
|
244
|
+
class: B({ "mr-1": !!e.label })
|
|
242
245
|
}, null, 8, ["icon-font", "class"])
|
|
243
246
|
]),
|
|
244
247
|
key: "0"
|
|
245
248
|
} : void 0
|
|
246
249
|
]), 1032, ["disabled", "type", "style", "data-testid"])), [
|
|
247
|
-
[
|
|
250
|
+
[r(K), e.disabledTip]
|
|
248
251
|
])
|
|
249
|
-
], 8,
|
|
252
|
+
], 8, Be))), 128))
|
|
250
253
|
]),
|
|
251
254
|
_: 1
|
|
252
|
-
}, 8, ["visible", "width", "virtual-ref", "popper-class"])) :
|
|
255
|
+
}, 8, ["visible", "width", "virtual-ref", "popper-class"])) : f("", !0)
|
|
253
256
|
], 2));
|
|
254
257
|
}
|
|
255
258
|
});
|
|
256
259
|
export {
|
|
257
|
-
|
|
260
|
+
Ue as default
|
|
258
261
|
};
|