@dazhicheng/ui 1.6.8 → 1.6.10

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 +1,11 @@
1
+ import { PanelSelectSeparator } from './types';
1
2
  export declare const ALL = "all";
3
+ /** 默认识别英文逗号、中文逗号、半角空格与全角空格。 */
4
+ export declare const DEFAULT_PANEL_SELECT_SEPARATORS: string[];
5
+ /**
6
+ * 按面板选择器配置的分隔符、换行和 Tab 拆分文本。
7
+ * @param text 待拆分的原始文本
8
+ * @param separator 单个或多个自定义分隔符
9
+ * @returns 去除首尾空白和空项后的文本片段
10
+ */
11
+ export declare function splitPanelSelectText(text: string, separator?: PanelSelectSeparator): string[];
@@ -1,4 +1,25 @@
1
- const l = "all";
1
+ import "axios";
2
+ import "element-plus";
3
+ import { isArray as n } from "../../../packages/utils/src/is.js";
4
+ import "vue";
5
+ import "dayjs";
6
+ import "numeral";
7
+ import "xe-utils";
8
+ import "dayjs/plugin/utc";
9
+ import "dayjs/plugin/timezone";
10
+ import "../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
11
+ import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
12
+ import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
13
+ import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
14
+ import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
+ import "lodash-es";
16
+ const d = "all", l = [",", ",", " ", " "];
17
+ function B(i, o) {
18
+ const r = n(o) ? o.filter(Boolean) : o ? [o] : [], p = [...r.length ? r : l].sort((t, m) => m.length - t.length).map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")), e = new RegExp([...p, "\\r?\\n", "\\t"].join("|"), "g");
19
+ return i.split(e).map((t) => t.trim()).filter(Boolean);
20
+ }
2
21
  export {
3
- l as ALL
22
+ d as ALL,
23
+ l as DEFAULT_PANEL_SELECT_SEPARATORS,
24
+ B as splitPanelSelectText
4
25
  };
@@ -3,6 +3,7 @@ import { PanelSelectValue, PanelMiddleProps } from '../types';
3
3
  declare function scrollToGroup(groupValue: PanelSelectValue): Promise<void>;
4
4
  declare const _default: import('vue').DefineComponent<PanelMiddleProps, {
5
5
  scrollToGroup: typeof scrollToGroup;
6
+ inputFocus: () => void;
6
7
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
7
8
  "update:keyword": (value: string) => any;
8
9
  checkAll: (checked: boolean) => any;
@@ -21,7 +22,7 @@ declare const _default: import('vue').DefineComponent<PanelMiddleProps, {
21
22
  disabled: boolean;
22
23
  scrollToGroupValue: PanelSelectValue;
23
24
  pasteSearch: boolean;
24
- separator: string;
25
+ separator: import('../types').PanelSelectSeparator;
25
26
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
26
27
  searchInputRef: ({
27
28
  $: import('vue').ComponentInternalInstance;
@@ -1,10 +1,11 @@
1
- import { defineComponent as ue, useTemplateRef as de, ref as v, computed as p, watch as I, nextTick as L, createElementBlock as d, openBlock as s, normalizeClass as n, createElementVNode as y, createCommentVNode as O, createVNode as c, createBlock as M, unref as i, withCtx as u, createTextVNode as $, normalizeStyle as A, Fragment as V, renderList as H, toDisplayString as P } from "vue";
2
- import { TtButton as pe } from "../../../tt-button/index.js";
1
+ import { defineComponent as se, useTemplateRef as q, ref as h, computed as v, watch as A, nextTick as U, createElementBlock as p, openBlock as r, normalizeClass as s, createElementVNode as C, createCommentVNode as z, createVNode as c, createBlock as B, unref as n, withCtx as i, createTextVNode as b, normalizeStyle as I, Fragment as M, renderList as P, toDisplayString as H } from "vue";
2
+ import { TtButton as ne } from "../../../tt-button/index.js";
3
3
  import { TtText as _ } from "../../../tt-text/index.js";
4
- import { Search as ce } from "@element-plus/icons-vue";
5
- import { useResizeObserver as fe } from "@vueuse/core";
6
- import { ElInput as ve, ElIcon as he, ElCheckbox as F, ElScrollbar as me } from "element-plus";
7
- const ge = ["data-virtual-index", "data-flash-seed"], Y = 2, _e = /* @__PURE__ */ ue({
4
+ import { Search as ie } from "@element-plus/icons-vue";
5
+ import { useResizeObserver as ue } from "@vueuse/core";
6
+ import { ElInput as de, ElIcon as pe, ElCheckbox as V, ElScrollbar as ce } from "element-plus";
7
+ import { DEFAULT_PANEL_SELECT_SEPARATORS as fe, splitPanelSelectText as ve } from "../common.js";
8
+ const he = ["data-virtual-index", "data-flash-seed"], K = 2, _e = /* @__PURE__ */ se({
8
9
  name: "PanelMiddle",
9
10
  __name: "PanelMiddle",
10
11
  props: {
@@ -15,7 +16,7 @@ const ge = ["data-virtual-index", "data-flash-seed"], Y = 2, _e = /* @__PURE__ *
15
16
  rows: {},
16
17
  optionPerRow: {},
17
18
  rowHeight: {},
18
- selectedValues: {},
19
+ selectedValueSet: {},
19
20
  isAllChecked: { type: Boolean },
20
21
  isIndeterminate: { type: Boolean },
21
22
  allChecked: { type: Boolean },
@@ -23,21 +24,21 @@ const ge = ["data-virtual-index", "data-flash-seed"], Y = 2, _e = /* @__PURE__ *
23
24
  groupIndeterminateMap: {},
24
25
  scrollToGroupValue: { default: void 0 },
25
26
  pasteSearch: { type: Boolean, default: !1 },
26
- separator: { default: "," },
27
+ separator: { default: () => [...fe] },
27
28
  showAll: { type: Boolean },
28
29
  middlePlaceholder: {}
29
30
  },
30
31
  emits: ["update:keyword", "checkAll", "allCheck", "groupCheck", "optionCheck", "optionsCheck"],
31
- setup(W, { expose: j, emit: J }) {
32
- const l = W, f = J, m = de("scrollbarRef"), G = v(), Q = v(), S = v(0), q = v(0), g = v(""), k = v(), D = v(0), R = v(!1);
33
- let T;
34
- const X = p(() => l.rows.length * l.rowHeight), Z = p(() => Math.max(1, Math.ceil(q.value / l.rowHeight))), w = p(() => Math.max(0, Math.floor(S.value / l.rowHeight) - Y)), ee = p(() => Math.min(l.rows.length, w.value + Z.value + Y * 2)), le = p(() => w.value * l.rowHeight), ae = p(() => l.rows.slice(w.value, ee.value)), oe = p(() => {
32
+ setup(O, { expose: Y, emit: W }) {
33
+ const l = O, f = W, m = q("scrollbarRef"), S = q("searchInputRef"), j = h(), T = h(0), E = h(0), g = h(""), k = h(), F = h(0), $ = h(!1);
34
+ let R;
35
+ const J = v(() => l.rows.length * l.rowHeight), Q = v(() => Math.max(1, Math.ceil(E.value / l.rowHeight))), w = v(() => Math.max(0, Math.floor(T.value / l.rowHeight) - K)), X = v(() => Math.min(l.rows.length, w.value + Q.value + K * 2)), Z = v(() => w.value * l.rowHeight), ee = v(() => l.rows.slice(w.value, X.value)), le = v(() => {
35
36
  var e;
36
37
  return ((e = l.rows[0]) == null ? void 0 : e.type) === "group";
37
- }), te = p(() => new Set(l.selectedValues)), re = p(
38
+ }), ae = v(
38
39
  () => l.rows.filter((e) => e.type === "options").flatMap((e) => e.options).filter((e) => !e.disabled)
39
40
  );
40
- I(
41
+ A(
41
42
  () => l.keyword,
42
43
  (e) => {
43
44
  g.value = e;
@@ -47,217 +48,221 @@ const ge = ["data-virtual-index", "data-flash-seed"], Y = 2, _e = /* @__PURE__ *
47
48
  function x() {
48
49
  var a;
49
50
  const e = (a = m.value) == null ? void 0 : a.wrapRef;
50
- e && (Q.value = e, q.value = e.clientHeight, S.value = e.scrollTop);
51
+ e && (j.value = e, E.value = e.clientHeight, T.value = e.scrollTop);
51
52
  }
52
- fe(
53
+ ue(
53
54
  () => {
54
55
  var e;
55
56
  return (e = m.value) == null ? void 0 : e.wrapRef;
56
57
  },
57
58
  () => x()
58
59
  );
59
- function E() {
60
+ function D() {
60
61
  var a;
61
62
  const e = (a = m.value) == null ? void 0 : a.wrapRef;
62
- e && (S.value = e.scrollTop);
63
+ e && (T.value = e.scrollTop);
63
64
  }
64
- function se(e) {
65
- k.value = void 0, D.value += 1, requestAnimationFrame(() => {
66
- k.value = e, T && clearTimeout(T), T = setTimeout(() => {
65
+ function oe(e) {
66
+ k.value = void 0, F.value += 1, requestAnimationFrame(() => {
67
+ k.value = e, R && clearTimeout(R), R = setTimeout(() => {
67
68
  k.value = void 0;
68
69
  }, 1400);
69
70
  });
70
71
  }
71
- async function N(e) {
72
- var h;
73
- await L(), x();
72
+ async function G(e) {
73
+ var u;
74
+ await U(), x();
74
75
  const a = l.rows.findIndex((t) => t.type === "group" && t.group.value === e);
75
76
  if (a < 0) return;
76
77
  const o = a * l.rowHeight;
77
- (h = m.value) == null || h.setScrollTop(o), requestAnimationFrame(() => {
78
- E(), se(e);
78
+ (u = m.value) == null || u.setScrollTop(o), requestAnimationFrame(() => {
79
+ D(), oe(e);
79
80
  });
80
81
  }
81
- function ne(e) {
82
- var K;
82
+ function te(e) {
83
+ var L;
83
84
  if (l.disabled)
84
85
  return;
85
86
  e.preventDefault();
86
- const a = ((K = e.clipboardData) == null ? void 0 : K.getData("text")) || "";
87
- g.value = a.trim(), l.pasteSearch ? f("update:keyword", g.value) : (R.value = !0, requestAnimationFrame(() => {
88
- R.value = !1;
87
+ const a = ((L = e.clipboardData) == null ? void 0 : L.getData("text")) || "";
88
+ g.value = a.trim(), l.pasteSearch ? f("update:keyword", g.value) : ($.value = !0, requestAnimationFrame(() => {
89
+ $.value = !1;
89
90
  }));
90
- const h = (l.separator || ",").replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), t = new RegExp(`${h}|\\r?\\n|\\t`, "g"), C = a.split(t).map((r) => r.trim()).filter(Boolean), b = () => {
91
+ const o = ve(a, l.separator), u = () => {
91
92
  requestAnimationFrame(() => {
92
- var U;
93
- const r = (U = G.value) == null ? void 0 : U.input;
94
- r == null || r.focus(), r == null || r.select();
93
+ var N;
94
+ const d = (N = S.value) == null ? void 0 : N.input;
95
+ d == null || d.focus(), d == null || d.select();
95
96
  });
96
97
  };
97
- if (!C.length) {
98
- b();
98
+ if (!o.length) {
99
+ u();
99
100
  return;
100
101
  }
101
- const z = new Set(C), B = re.value.filter((r) => z.has(r.label) || z.has(String(r.value))).map((r) => r.value);
102
- if (!B.length) {
103
- b();
102
+ const t = new Set(o), y = ae.value.filter((d) => t.has(d.label)).map((d) => d.value);
103
+ if (!y.length) {
104
+ u();
104
105
  return;
105
106
  }
106
107
  if (l.multiple) {
107
- f("optionsCheck", B, !0), b();
108
+ f("optionsCheck", y, !0), u();
108
109
  return;
109
110
  }
110
- f("optionCheck", B.at(-1), !0), b();
111
+ f("optionCheck", y.at(-1), !0), u();
111
112
  }
112
- function ie(e) {
113
- g.value = e, !R.value && f("update:keyword", e);
113
+ function re(e) {
114
+ g.value = e, !$.value && f("update:keyword", e);
114
115
  }
115
- return I(
116
+ return A(
116
117
  () => l.scrollToGroupValue,
117
118
  async (e) => {
118
- e !== void 0 && await N(e);
119
+ e !== void 0 && await G(e);
119
120
  },
120
121
  { flush: "post" }
121
- ), I(
122
+ ), A(
122
123
  () => l.rows.length,
123
124
  async () => {
124
- await L(), x();
125
+ await U(), x();
125
126
  },
126
127
  { immediate: !0 }
127
- ), j({
128
- scrollToGroup: N
129
- }), (e, a) => (s(), d("div", {
130
- class: n(`${e.prefixCls}__list`)
128
+ ), Y({
129
+ scrollToGroup: G,
130
+ inputFocus: () => {
131
+ var e, a;
132
+ (a = (e = S.value) == null ? void 0 : e.focus) == null || a.call(e);
133
+ }
134
+ }), (e, a) => (r(), p("div", {
135
+ class: s(`${e.prefixCls}__list`)
131
136
  }, [
132
- y("div", {
133
- class: n(`${e.prefixCls}__toolbar`)
137
+ C("div", {
138
+ class: s(`${e.prefixCls}__toolbar`)
134
139
  }, [
135
- c(i(ve), {
140
+ c(n(de), {
136
141
  ref_key: "searchInputRef",
137
- ref: G,
142
+ ref: S,
138
143
  "model-value": g.value,
139
- class: n(`${e.prefixCls}__search`),
144
+ class: s(`${e.prefixCls}__search`),
140
145
  placeholder: l.middlePlaceholder,
141
146
  clearable: "",
142
- "onUpdate:modelValue": ie,
143
- onPaste: ne
147
+ "onUpdate:modelValue": re,
148
+ onPaste: te
144
149
  }, {
145
- prefix: u(() => [
146
- c(i(he), null, {
147
- default: u(() => [
148
- c(i(ce))
150
+ prefix: i(() => [
151
+ c(n(pe), null, {
152
+ default: i(() => [
153
+ c(n(ie))
149
154
  ]),
150
155
  _: 1
151
156
  })
152
157
  ]),
153
158
  _: 1
154
159
  }, 8, ["model-value", "class", "placeholder"]),
155
- e.multiple ? (s(), M(i(pe), {
160
+ e.multiple ? (r(), B(n(ne), {
156
161
  key: 0,
157
162
  disabled: e.disabled,
158
163
  plain: "",
159
164
  onClick: a[0] || (a[0] = () => f("checkAll", !0))
160
165
  }, {
161
- default: u(() => [...a[2] || (a[2] = [
162
- y("span", null, "全选", -1)
166
+ default: i(() => [...a[2] || (a[2] = [
167
+ C("span", null, "全选", -1)
163
168
  ])]),
164
169
  _: 1
165
- }, 8, ["disabled"])) : O("", !0)
170
+ }, 8, ["disabled"])) : z("", !0)
166
171
  ], 2),
167
- l.showAll ? (s(), d("div", {
172
+ l.showAll ? (r(), p("div", {
168
173
  key: 0,
169
- class: n([`${e.prefixCls}__panel-head`, oe.value ? "is-standalone" : ""])
174
+ class: s([`${e.prefixCls}__panel-head`, le.value ? "is-standalone" : ""])
170
175
  }, [
171
- c(i(F), {
176
+ c(n(V), {
172
177
  disabled: e.disabled,
173
178
  "model-value": l.allChecked,
174
179
  onChange: a[1] || (a[1] = (o) => f("allCheck", !!o))
175
180
  }, {
176
- default: u(() => [
177
- c(i(_), null, {
178
- default: u(() => [...a[3] || (a[3] = [
179
- $("全部", -1)
181
+ default: i(() => [
182
+ c(n(_), null, {
183
+ default: i(() => [...a[3] || (a[3] = [
184
+ b("全部", -1)
180
185
  ])]),
181
186
  _: 1
182
187
  })
183
188
  ]),
184
189
  _: 1
185
190
  }, 8, ["disabled", "model-value"])
186
- ], 2)) : O("", !0),
187
- y("div", {
188
- class: n(`${e.prefixCls}__checkbox-group`)
191
+ ], 2)) : z("", !0),
192
+ C("div", {
193
+ class: s(`${e.prefixCls}__checkbox-group`)
189
194
  }, [
190
- c(i(me), {
195
+ c(n(ce), {
191
196
  ref_key: "scrollbarRef",
192
197
  ref: m,
193
- class: n(`${e.prefixCls}__middle-scrollbar`),
194
- onScroll: E
198
+ class: s(`${e.prefixCls}__middle-scrollbar`),
199
+ onScroll: D
195
200
  }, {
196
- default: u(() => [
197
- y("div", {
198
- class: n(`${e.prefixCls}__middle-virtual-host`),
199
- style: A({ height: `${X.value}px` })
201
+ default: i(() => [
202
+ C("div", {
203
+ class: s(`${e.prefixCls}__middle-virtual-host`),
204
+ style: I({ height: `${J.value}px` })
200
205
  }, [
201
- y("div", {
202
- style: A({ transform: `translateY(${le.value}px)` })
206
+ C("div", {
207
+ style: I({ transform: `translateY(${Z.value}px)` })
203
208
  }, [
204
- (s(!0), d(V, null, H(ae.value, (o, h) => (s(), d("div", {
209
+ (r(!0), p(M, null, P(ee.value, (o, u) => (r(), p("div", {
205
210
  key: o.key,
206
- style: A({ height: `${e.rowHeight}px` }),
207
- class: n([
211
+ style: I({ height: `${e.rowHeight}px` }),
212
+ class: s([
208
213
  `${e.prefixCls}__middle-row`,
209
214
  o.type === "group" ? `${e.prefixCls}__middle-group` : `${e.prefixCls}__middle-options`,
210
215
  o.type === "options" && o.isLast ? "is-last" : "",
211
- o.type === "options" && w.value + h === 0 && !l.showAll ? "is-first" : "",
216
+ o.type === "options" && w.value + u === 0 && !l.showAll ? "is-first" : "",
212
217
  k.value === o.group.value ? `${e.prefixCls}__group-flash` : ""
213
218
  ]),
214
- "data-virtual-index": w.value + h,
215
- "data-flash-seed": D.value
219
+ "data-virtual-index": w.value + u,
220
+ "data-flash-seed": F.value
216
221
  }, [
217
- o.type === "group" ? (s(), d("div", {
222
+ o.type === "group" ? (r(), p("div", {
218
223
  key: 0,
219
- class: n(`${e.prefixCls}__panel-head`)
224
+ class: s(`${e.prefixCls}__panel-head`)
220
225
  }, [
221
- l.multiple ? (s(), M(i(F), {
226
+ l.multiple ? (r(), B(n(V), {
222
227
  key: 0,
223
228
  "model-value": e.groupCheckedMap[String(o.group.value)],
224
229
  indeterminate: e.groupIndeterminateMap[String(o.group.value)],
225
230
  disabled: e.disabled,
226
231
  onChange: (t) => f("groupCheck", o.group.value, !!t)
227
232
  }, {
228
- default: u(() => [
229
- c(i(_), null, {
230
- default: u(() => [
231
- $(P(o.group.label), 1)
233
+ default: i(() => [
234
+ c(n(_), null, {
235
+ default: i(() => [
236
+ b(H(o.group.label), 1)
232
237
  ]),
233
238
  _: 2
234
239
  }, 1024)
235
240
  ]),
236
241
  _: 2
237
- }, 1032, ["model-value", "indeterminate", "disabled", "onChange"])) : (s(), M(i(_), { key: 1 }, {
238
- default: u(() => [
239
- $(P(o.group.label), 1)
242
+ }, 1032, ["model-value", "indeterminate", "disabled", "onChange"])) : (r(), B(n(_), { key: 1 }, {
243
+ default: i(() => [
244
+ b(H(o.group.label), 1)
240
245
  ]),
241
246
  _: 2
242
247
  }, 1024))
243
- ], 2)) : (s(), d("div", {
248
+ ], 2)) : (r(), p("div", {
244
249
  key: 1,
245
- class: n(`${e.prefixCls}__option-row`)
250
+ class: s(`${e.prefixCls}__option-row`)
246
251
  }, [
247
- (s(!0), d(V, null, H(o.options, (t) => (s(), d("div", {
252
+ (r(!0), p(M, null, P(o.options, (t) => (r(), p("div", {
248
253
  key: t.value,
249
- class: n(`${e.prefixCls}__option-cell`)
254
+ class: s(`${e.prefixCls}__option-cell`)
250
255
  }, [
251
- c(i(F), {
252
- "model-value": te.value.has(t.value),
256
+ c(n(V), {
257
+ "model-value": l.selectedValueSet.has(t.value),
253
258
  disabled: e.disabled || t.disabled,
254
- class: n(`${e.prefixCls}__option`),
255
- onChange: (C) => f("optionCheck", t.value, !!C)
259
+ class: s(`${e.prefixCls}__option`),
260
+ onChange: (y) => f("optionCheck", t.value, !!y)
256
261
  }, {
257
- default: u(() => [
258
- c(i(_), { "tool-tip-line": 2 }, {
259
- default: u(() => [
260
- $(P(t.label), 1)
262
+ default: i(() => [
263
+ c(n(_), { "tool-tip-line": 2 }, {
264
+ default: i(() => [
265
+ b(H(t.label), 1)
261
266
  ]),
262
267
  _: 2
263
268
  }, 1024)
@@ -265,12 +270,12 @@ const ge = ["data-virtual-index", "data-flash-seed"], Y = 2, _e = /* @__PURE__ *
265
270
  _: 2
266
271
  }, 1032, ["model-value", "disabled", "class", "onChange"])
267
272
  ], 2))), 128)),
268
- (s(!0), d(V, null, H(e.optionPerRow - o.options.length, (t) => (s(), d("div", {
273
+ (r(!0), p(M, null, P(e.optionPerRow - o.options.length, (t) => (r(), p("div", {
269
274
  key: `empty-${o.key}-${t}`,
270
- class: n(`${e.prefixCls}__option-cell`)
275
+ class: s(`${e.prefixCls}__option-cell`)
271
276
  }, null, 2))), 128))
272
277
  ], 2))
273
- ], 14, ge))), 128))
278
+ ], 14, he))), 128))
274
279
  ], 4)
275
280
  ], 6)
276
281
  ]),
@@ -31,9 +31,7 @@ export declare function usePanelSelectData(props: PanelContainerProps): {
31
31
  navTreeOptions: import('vue').ComputedRef<PanelTreeNode[]>;
32
32
  navNodes: import('vue').ComputedRef<PanelTreeNode[]>;
33
33
  leafNodes: import('vue').ComputedRef<PanelTreeNode[]>;
34
- filterNodes: <T extends {
35
- label: string;
36
- }>(nodes: T[], keyword: string) => T[];
34
+ filterNodes: (nodes: PanelTreeNode[], keyword: string) => PanelTreeNode[];
37
35
  buildOptionGroups: (nodes: PanelTreeNode[], keyword: string) => OptionGroup[];
38
36
  isFirstLoaded: import('vue').Ref<boolean, boolean>;
39
37
  };