@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 Z, useAttrs as ee, ref as C, inject as _, computed as p, unref as n, toRaw as M, h as te, onMounted as oe, nextTick as re, createElementBlock as a, openBlock as i, normalizeClass as k, createVNode as I, createBlock as m, createCommentVNode as c, withCtx as f, Fragment as b, renderList as F, renderSlot as ne, withDirectives as R, mergeProps as le, normalizeStyle as W, toDisplayString as P, createElementVNode as ie, withModifiers as se, createSlots as ae, createTextVNode as de } from "vue";
2
- import { propTypes as g } from "../../../../packages/hooks/src/propTypes.js";
3
- import { useDesign as ue } from "../../../../packages/hooks/src/useDesign.js";
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 pe, ElSpace as ce, ElPopover as fe } from "element-plus";
6
- import { isBoolean as me, isFunction as be, isArray as ve, isObject as ge } from "../../../../packages/utils/src/is.js";
7
- import { generateTestId as z, toKebabCase as D } from "../../../../packages/utils/src/testid-helper.js";
8
- import { calcWordsWidth as ye } from "../../../../packages/utils/src/tool.js";
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 T } from "../../../tt-button/index.js";
16
- import { TtIcon as B } from "../../../tt-icon/index.js";
17
- import j from "../../../../directives/disabled-tip/index.js";
18
- import we from "../../../../assets/svg/action_more.svg.js";
19
- import { ROW_INDEX_KEY as he } from "./RowContext.js";
20
- const xe = { key: 1 }, Ce = ["onClick"], Oe = /* @__PURE__ */ Z({
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: g.bool.def(!1),
42
+ stopButtonPropagation: y.bool.def(!1),
43
43
  /** 显示buttton的个数 默认是2 */
44
- showBtnNums: g.number.def(3),
44
+ showBtnNums: y.number.def(3),
45
45
  /** 弹出框的宽度 */
46
- popoverWidth: g.number.def(27),
46
+ popoverWidth: y.number.def(27),
47
47
  /** 是否自动换行 */
48
- wrap: g.bool.def(!0)
48
+ wrap: y.bool.def(!0)
49
49
  },
50
- setup(A) {
51
- const l = A, y = ee(), { prefixCls: E } = ue("table-action"), v = C(!1), V = _(
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
- ), O = _(he, void 0), K = p(() => {
55
- if (l.rowIndex !== void 0 && l.rowIndex !== null)
56
- return l.rowIndex;
57
- const t = n(O);
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 (l.slotContext && l.slotContext.$rowIndex !== void 0)
61
- return l.slotContext.$rowIndex;
62
- if (y.$rowIndex !== void 0 && y.$rowIndex !== null)
63
- return y.$rowIndex;
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 w(t) {
66
- const o = n(V), e = K.value;
67
- return e != null ? z(o, "action", `row${e}`, D(t)) : z(o, "action", D(t));
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 S(t) {
69
+ function F(t) {
70
70
  const o = t.ifShow;
71
71
  let e = !0;
72
- return me(o) && (e = o), be(o) && (e = o(t)), e;
72
+ return ge(o) && (e = o), ye(o) && (e = o(t)), e;
73
73
  }
74
- const U = p(() => (M(l.actions) || []).filter((t) => S(t)).slice(0, l.showBtnNums)), h = p(() => (M(l.actions) || []).filter((t) => S(t)).slice(l.showBtnNums)), q = p(() => n(h).length > 0), G = p(() => "left flex items-center"), H = p(() => {
75
- const t = document.getElementsByTagName("body")[0], o = window.getComputedStyle(t).fontFamily, e = h.value.map((s) => ye(s.label, "12px", o) + 22), r = Math.max(...e);
76
- return r > l.popoverWidth ? r : l.popoverWidth;
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 $(t, o) {
78
+ function N(t, o) {
79
79
  const e = t;
80
- return ve(e) && e.length > 0 ? e.some((r) => !!(r != null && r.condition)) : ge(e) ? !!e.condition : !!o;
80
+ return xe(e) && e.length > 0 ? e.some((n) => !!(n != null && n.condition)) : he(e) ? !!e.condition : !!o;
81
81
  }
82
- function L(t) {
83
- if (!l.stopButtonPropagation) return;
84
- t.composedPath().find((r) => {
82
+ function J(t) {
83
+ if (!i.stopButtonPropagation) return;
84
+ t.composedPath().find((n) => {
85
85
  var s;
86
- return ((s = r.tagName) == null ? void 0 : s.toUpperCase()) === "BUTTON";
86
+ return ((s = n.tagName) == null ? void 0 : s.toUpperCase()) === "BUTTON";
87
87
  }) && t.stopPropagation();
88
88
  }
89
- const X = te(pe, {
89
+ const Q = re(me, {
90
90
  direction: "vertical",
91
91
  style: { fontSize: "12px", margin: "0 6px" }
92
92
  });
93
- function Y(t) {
94
- v.value = !0, x.value = t.target && t.target.getBoundingClientRect();
93
+ function Z(t) {
94
+ g.value = !0, C.value = t.target && t.target.getBoundingClientRect();
95
95
  }
96
- const x = C({
96
+ const C = I({
97
97
  top: 0,
98
98
  left: 0,
99
99
  bottom: 0,
100
100
  right: 0
101
101
  });
102
- function J() {
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 r = e.closest(".vxe-table");
106
- if (!r) return;
107
- const s = e.getBoundingClientRect(), d = Math.round(s.top), u = o.get(r) || /* @__PURE__ */ new Map(), N = u.get(d) || [];
108
- N.push(e), u.set(d, N), o.set(r, u);
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((r) => {
111
- const s = r.sort((d, u) => u.getBoundingClientRect().left - d.getBoundingClientRect().left)[0];
112
- r.forEach((d) => {
113
- d.querySelectorAll("[data-table-action-button]").forEach((u) => {
114
- u.tabIndex = d === s ? 0 : -1;
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
- oe(() => {
121
- re(() => {
122
- window.setTimeout(J, 80);
123
+ ie(() => {
124
+ le(() => {
125
+ window.setTimeout(ee, 80);
123
126
  });
124
127
  });
125
- const Q = C({
128
+ const te = I({
126
129
  getBoundingClientRect() {
127
- return x.value;
130
+ return C.value;
128
131
  }
129
132
  });
130
- return (t, o) => (i(), a("div", {
131
- class: k([n(E), G.value]),
133
+ return (t, o) => (l(), u("div", {
134
+ class: B([r($), X.value]),
132
135
  tabindex: "-1",
133
- onClick: L
136
+ onClick: J
134
137
  }, [
135
- I(n(ce), {
138
+ T(r(be), {
136
139
  size: 0,
137
- spacer: n(X),
138
- wrap: A.wrap
140
+ spacer: r(Q),
141
+ wrap: S.wrap
139
142
  }, {
140
- default: f(() => [
141
- (i(!0), a(b, null, F(U.value, (e, r) => (i(), a(b, {
142
- key: `${r}-${e.label}`
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 ? ne(t.$slots, e.slot, le({
147
+ e.slot ? se(t.$slots, e.slot, ae({
145
148
  key: 0,
146
149
  ref_for: !0
147
- }, e)) : R((i(), m(n(T), {
150
+ }, e)) : z((l(), b(r(A), {
148
151
  key: 1,
149
152
  link: "",
150
153
  type: e.type || "primary",
151
- disabled: $(e.disabledTip, e.disabled),
152
- style: W({ color: e.color, visibility: e.isTextHide ? "hidden" : "visible" }),
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": r,
157
+ "data-index": n,
155
158
  "data-table-action-button": "",
156
- "data-testid": w(e.label || ""),
159
+ "data-testid": h(e.label || ""),
157
160
  onClick: e.onClick
158
161
  }, {
159
- default: f(() => [
160
- e.iconFont ? (i(), a(b, { key: 0 }, [
161
- e.iconFont ? (i(), m(n(B), {
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: k({ "mr-1": !!e.label })
165
- }, null, 8, ["icon-font", "class"])) : c("", !0)
166
- ], 64)) : c("", !0),
167
- e.label ? (i(), a("span", xe, P(e.label), 1)) : c("", !0)
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
- [n(j), e.disabledTip]
174
+ [r(K), e.disabledTip]
172
175
  ])
173
176
  ], 64))), 128)),
174
- q.value ? (i(), m(n(T), {
177
+ H.value ? (l(), b(r(A), {
175
178
  key: 0,
176
179
  link: "",
177
180
  type: "primary",
178
- "data-testid": w("more")
181
+ "data-testid": h("more")
179
182
  }, {
180
- default: f(() => [
181
- ie("span", {
182
- onMouseover: se(Y, ["stop"]),
183
- onMouseleave: o[0] || (o[0] = (e) => v.value = !1)
183
+ default: m(() => [
184
+ de("span", {
185
+ onMouseover: ue(Z, ["stop"]),
186
+ onMouseleave: o[0] || (o[0] = (e) => g.value = !1)
184
187
  }, [
185
- I(n(B), {
186
- icon: n(we),
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"])) : c("", !0)
196
+ }, 8, ["data-testid"])) : f("", !0)
194
197
  ]),
195
198
  _: 3
196
199
  }, 8, ["spacer", "wrap"]),
197
- x.value.left ? (i(), m(n(fe), {
200
+ C.value.left ? (l(), b(r(ve), {
198
201
  key: 0,
199
- visible: v.value,
200
- "onUpdate:visible": o[1] || (o[1] = (e) => v.value = 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: H.value,
206
+ width: Y.value,
204
207
  offset: 8,
205
208
  "hide-after": 0,
206
- "virtual-ref": Q.value,
209
+ "virtual-ref": te.value,
207
210
  "virtual-triggering": "",
208
- "popper-class": `${n(E)}-popover-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: f(() => [
215
- (i(!0), a(b, null, F(h.value, (e, r) => (i(), a("div", {
216
- key: `${r}-${e.label}`,
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
- R((i(), m(n(T), {
225
+ z((l(), b(r(A), {
223
226
  link: "",
224
- disabled: $(e.disabledTip, e.disabled),
227
+ disabled: N(e.disabledTip, e.disabled),
225
228
  type: e.type || "primary",
226
- style: W({ color: e.color }),
227
- "data-testid": w(e.label || "")
228
- }, ae({
229
- default: f(() => [
230
- e.label ? (i(), a(b, { key: 0 }, [
231
- de(P(e.label), 1)
232
- ], 64)) : c("", !0)
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: f(() => [
239
- I(n(B), {
241
+ fn: m(() => [
242
+ T(r(E), {
240
243
  "icon-font": e.iconFont,
241
- class: k({ "mr-1": !!e.label })
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
- [n(j), e.disabledTip]
250
+ [r(K), e.disabledTip]
248
251
  ])
249
- ], 8, Ce))), 128))
252
+ ], 8, Be))), 128))
250
253
  ]),
251
254
  _: 1
252
- }, 8, ["visible", "width", "virtual-ref", "popper-class"])) : c("", !0)
255
+ }, 8, ["visible", "width", "virtual-ref", "popper-class"])) : f("", !0)
253
256
  ], 2));
254
257
  }
255
258
  });
256
259
  export {
257
- Oe as default
260
+ Ue as default
258
261
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.5.230",
3
+ "version": "1.5.231",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",