@aplus-frontend/ui 7.19.0-beta.2 → 7.19.0

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,6 +1,6 @@
1
- import { defineComponent as fe, ref as v, computed as U, watch as k, toRef as de, useSlots as ge, createVNode as l, cloneVNode as ve, unref as e, createElementBlock as E, openBlock as T, Fragment as ye, createBlock as K, createCommentVNode as j, resolveDynamicComponent as B, withCtx as s, withDirectives as Se, createElementVNode as m, normalizeClass as u, toDisplayString as y, createTextVNode as _, isRef as he, vShow as Te } from "vue";
1
+ import { defineComponent as fe, ref as g, computed as U, watch as z, toRef as de, useSlots as ve, createVNode as l, cloneVNode as ge, unref as e, createElementBlock as E, openBlock as T, Fragment as ye, createBlock as B, createCommentVNode as j, resolveDynamicComponent as N, withCtx as s, withDirectives as Se, createElementVNode as m, normalizeClass as u, toDisplayString as y, createTextVNode as x, isRef as he, vShow as Te } from "vue";
2
2
  import { SettingOutlined as Ce, SaveOutlined as be } from "@ant-design/icons-vue";
3
- import { Button as F, Modal as ke, Divider as N, RadioGroup as _e, RadioButton as M, Flex as ze, Space as q, Popover as xe } from "@aplus-frontend/antdv";
3
+ import { Button as F, Modal as ke, Divider as $, RadioGroup as _e, RadioButton as M, Flex as ze, Space as q, Popover as xe } from "@aplus-frontend/antdv";
4
4
  import "../../../../ap-button/index.mjs";
5
5
  import { randomStr as Ae } from "../../../../utils/index.mjs";
6
6
  import "../../../../config-provider/index.mjs";
@@ -14,7 +14,7 @@ import "../sorter/index.vue.mjs";
14
14
  import "../template/edit-form.vue.mjs";
15
15
  import "../template/index.vue.mjs";
16
16
  import "../tree-select/index.vue.mjs";
17
- import Re, { customCloneColumnStates as $, isEqualColumnStateIgnoreLabel as Ve } from "../utils.mjs";
17
+ import Re, { customCloneColumnStates as I, isEqualColumnStateIgnoreLabel as Ve } from "../utils.mjs";
18
18
  import { useLocale as De } from "../../../../config-provider/hooks/use-locale.mjs";
19
19
  import { useNamespace as G } from "../../../../config-provider/hooks/use-namespace.mjs";
20
20
  import Le from "../template/index.vue2.mjs";
@@ -41,26 +41,27 @@ const je = {
41
41
  columnsBackup: J,
42
42
  updateSize: Q,
43
43
  updateColumns: W
44
- } = Ke(), f = v(), z = U(() => c.config.persistenceKey), C = v(!1), {
44
+ } = Ke(), f = g(), C = U(() => c.config.persistenceKey), b = g(!1), {
45
45
  basicTemplate: X,
46
46
  customizeTemplateList: S,
47
47
  addTemplate: Y,
48
- deleteTemplate: I,
48
+ deleteTemplate: R,
49
49
  updateTemplate: Z
50
- } = Ne(c.config, z, pe), {
50
+ } = Ne(c.config, C, pe), {
51
51
  columnState: p,
52
- setColumnState: R,
52
+ setColumnState: V,
53
53
  isAllSelected: ee,
54
54
  toggleSelectAll: te
55
- } = Be([]), V = U(() => `${z.value}__active_key`);
55
+ } = Be([]), k = U(() => C.value && `${C.value}__active_key`);
56
56
  function D(a) {
57
- localStorage.setItem(V.value, a);
57
+ k.value && localStorage.setItem(k.value, a);
58
58
  }
59
- function x() {
60
- return localStorage.getItem(V.value);
59
+ function A() {
60
+ if (k.value)
61
+ return localStorage.getItem(k.value);
61
62
  }
62
- const o = v(c.config.defaultActiveKey ?? x());
63
- k(() => S.value, (a) => {
63
+ const o = g(c.config.defaultActiveKey ?? A());
64
+ z(() => S.value, (a) => {
64
65
  a.length && !o.value && (o.value = a[0]?.key);
65
66
  }, {
66
67
  immediate: !0
@@ -72,27 +73,27 @@ const je = {
72
73
  const {
73
74
  t: r
74
75
  } = De(), {
75
- b: g,
76
- be: b
76
+ b: v,
77
+ be: _
77
78
  } = G("ap-column-setting"), {
78
79
  b: ae
79
- } = G("ap-table"), ne = $e("ap-column-setting"), h = v(!1), L = v(!1), le = ge(), O = we(le.trigger) || l(F, {
80
+ } = G("ap-table"), ne = $e("ap-column-setting"), h = g(!1), L = g(!1), le = ve(), O = we(le.trigger) || l(F, {
80
81
  icon: l(Ce, null, null),
81
82
  class: ae("setting-trigger-button")
82
- }, null), P = O ? ve(O, {
83
+ }, null), P = O ? ge(O, {
83
84
  onClick: () => {
84
85
  h.value = !0;
85
86
  }
86
87
  }) : null;
87
88
  function oe() {
88
- R($(e(X).columnState));
89
+ V(I(e(X).columnState));
89
90
  }
90
- function A(a, t) {
91
+ function w(a, t) {
91
92
  W?.(Re(e(J), a)), Q?.(t);
92
93
  }
93
94
  function ie() {
94
- A(e(p), e(f)), h.value = !1;
95
- const a = $(p.value), t = Z(o.value, {
95
+ w(e(p), e(f)), h.value = !1;
96
+ const a = I(p.value), t = Z(o.value, {
96
97
  columnState: a,
97
98
  size: f.value
98
99
  });
@@ -105,34 +106,33 @@ const je = {
105
106
  columnState: p.value,
106
107
  size: f.value
107
108
  };
108
- Y(n), C.value = !1, o.value = t, c.config.onChange?.(n.columnState, n);
109
+ Y(n), b.value = !1, o.value = t, c.config.onChange?.(n.columnState, n);
109
110
  }
110
111
  function re(a, t) {
111
- console.log(a, t);
112
112
  const n = [...t].find((i) => i?.key === a);
113
- n && (R($(n.columnState)), f.value = n.size);
113
+ n && (V(I(n.columnState)), f.value = n.size);
114
114
  }
115
115
  function ue(a) {
116
116
  if (a !== o.value) {
117
- I(a);
117
+ R(a);
118
118
  return;
119
119
  }
120
120
  const t = S.value, n = t.findIndex((d) => d.key === a), i = t[n + 1]?.key ?? t[n - 1]?.key;
121
- I(a), o.value = i, D(i);
121
+ R(a), o.value = i, D(i);
122
122
  }
123
123
  function ce(a) {
124
124
  if (L.value = a, !a) {
125
- const t = x();
125
+ const t = A();
126
126
  t && t !== o.value && (o.value = t);
127
127
  }
128
128
  }
129
129
  function pe(a) {
130
- const t = x() ?? a[0].key;
130
+ const t = A() ?? a[0].key;
131
131
  o.value = t;
132
132
  const n = [...a].find((i) => i?.key === t);
133
- n && A(n.columnState, n.size);
133
+ n && w(n.columnState, n.size);
134
134
  }
135
- k(
135
+ z(
136
136
  [o, S],
137
137
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
138
138
  ([a, t], [n, i]) => {
@@ -140,7 +140,7 @@ const je = {
140
140
  const d = [...t].find((me) => me.key === a);
141
141
  if (!d)
142
142
  return;
143
- A(d.columnState, d.size);
143
+ w(d.columnState, d.size);
144
144
  }
145
145
  re(a, t);
146
146
  },
@@ -148,19 +148,19 @@ const je = {
148
148
  immediate: !0
149
149
  }
150
150
  );
151
- const w = v(!1);
152
- return k([f, p, h], ([a, t, n]) => {
151
+ const K = g(!1);
152
+ return z([f, p, h], ([a, t, n]) => {
153
153
  if (!n)
154
154
  return;
155
155
  const i = S.value.find((d) => d.key === o.value);
156
- i && (i.size !== a || !Ve(t, i.columnState)) ? w.value = !0 : w.value = !1;
156
+ i && (i.size !== a || !Ve(t, i.columnState)) ? K.value = !0 : K.value = !1;
157
157
  }, {
158
158
  deep: !0
159
- }), k(() => o.value, (a) => {
159
+ }), z(() => o.value, (a) => {
160
160
  c.config.onActiveChange?.(a);
161
161
  }, {
162
162
  immediate: !0
163
- }), (a, t) => (T(), E(ye, null, [e(P) ? (T(), K(B(e(P)), {
163
+ }), (a, t) => (T(), E(ye, null, [e(P) ? (T(), B(N(e(P)), {
164
164
  key: 0
165
165
  })) : j("", !0), l(e(ke), {
166
166
  open: h.value,
@@ -173,7 +173,7 @@ const je = {
173
173
  height: "516px"
174
174
  },
175
175
  "after-open-change": ce,
176
- "wrap-class-name": `${e(g)()} ${e(ne)}`,
176
+ "wrap-class-name": `${e(v)()} ${e(ne)}`,
177
177
  "ok-text": e(r)("ap.apTable.setting.saveAndApply"),
178
178
  "mask-closable": !1,
179
179
  onOk: ie
@@ -187,8 +187,8 @@ const je = {
187
187
  size: 12
188
188
  }, {
189
189
  default: s(() => [l(e(xe), {
190
- open: C.value,
191
- "onUpdate:open": t[3] || (t[3] = (i) => C.value = i),
190
+ open: b.value,
191
+ "onUpdate:open": t[3] || (t[3] = (i) => b.value = i),
192
192
  trigger: "click",
193
193
  arrow: !1,
194
194
  placement: "topLeft",
@@ -196,57 +196,57 @@ const je = {
196
196
  }, {
197
197
  content: s(() => [l(Ee, {
198
198
  onConfirm: se,
199
- onCancel: t[2] || (t[2] = () => C.value = !1)
199
+ onCancel: t[2] || (t[2] = () => b.value = !1)
200
200
  })]),
201
201
  default: s(() => [l(e(Ue), {
202
202
  type: "borderLink",
203
203
  disabled: !a.config.persistenceKey
204
204
  }, {
205
205
  icon: s(() => [l(e(be))]),
206
- default: s(() => [_(y(e(r)("ap.apTable.setting.saveAsTemplate")) + " ", 1)]),
206
+ default: s(() => [x(y(e(r)("ap.apTable.setting.saveAsTemplate")) + " ", 1)]),
207
207
  _: 1
208
208
  }, 8, ["disabled"])]),
209
209
  _: 1
210
- }, 8, ["open"]), w.value ? (T(), E("span", {
210
+ }, 8, ["open"]), K.value ? (T(), E("span", {
211
211
  key: 0,
212
- class: u(e(g)("modify-tip"))
212
+ class: u(e(v)("modify-tip"))
213
213
  }, y(e(r)("ap.apTable.setting.modifyNotification")), 3)) : j("", !0)]),
214
214
  _: 1
215
215
  }), l(e(q), {
216
216
  size: 10
217
217
  }, {
218
- default: s(() => [(T(), K(B(n.cancelBtn))), (T(), K(B(n.okBtn)))]),
218
+ default: s(() => [(T(), B(N(n.cancelBtn))), (T(), B(N(n.okBtn)))]),
219
219
  _: 2
220
220
  }, 1024)]),
221
221
  _: 2
222
222
  }, 1024)]),
223
223
  default: s(() => [Se(m("div", {
224
- class: u(e(g)("wrapper"))
224
+ class: u(e(v)("wrapper"))
225
225
  }, [m("div", {
226
- class: u(e(g)("left"))
226
+ class: u(e(v)("left"))
227
227
  }, [l(Le, {
228
228
  "customize-template-list": e(S),
229
- "persistence-key": z.value
230
- }, null, 8, ["customize-template-list", "persistence-key"])], 2), l(e(N), {
229
+ "persistence-key": C.value
230
+ }, null, 8, ["customize-template-list", "persistence-key"])], 2), l(e($), {
231
231
  type: "vertical",
232
232
  style: {
233
233
  height: "100%",
234
234
  margin: "0px"
235
235
  }
236
236
  }), m("div", {
237
- class: u(e(g)("center"))
237
+ class: u(e(v)("center"))
238
238
  }, [m("div", {
239
- class: u(e(b)("center", "header"))
239
+ class: u(e(_)("center", "header"))
240
240
  }, [m("div", {
241
- class: u(e(b)("center", "tip-wrapper"))
241
+ class: u(e(_)("center", "tip-wrapper"))
242
242
  }, [m("span", {
243
- class: u(e(b)("center", "header-tips"))
243
+ class: u(e(_)("center", "header-tips"))
244
244
  }, y(e(r)("ap.apTable.setting.selectAllTip")), 3), l(e(F), {
245
245
  type: "link",
246
246
  size: "small",
247
247
  onClick: e(te)
248
248
  }, {
249
- default: s(() => [_(y(e(ee) ? e(r)("ap.apTable.setting.unSelectAll") : e(r)("ap.apTable.setting.selectAll")), 1)]),
249
+ default: s(() => [x(y(e(ee) ? e(r)("ap.apTable.setting.unSelectAll") : e(r)("ap.apTable.setting.selectAll")), 1)]),
250
250
  _: 1
251
251
  }, 8, ["onClick"])], 2), l(e(_e), {
252
252
  value: f.value,
@@ -255,31 +255,31 @@ const je = {
255
255
  default: s(() => [l(e(M), {
256
256
  value: "small"
257
257
  }, {
258
- default: s(() => [_(y(e(r)("ap.apTable.setting.sizeSmall")), 1)]),
258
+ default: s(() => [x(y(e(r)("ap.apTable.setting.sizeSmall")), 1)]),
259
259
  _: 1
260
260
  }), l(e(M), {
261
261
  value: "middle"
262
262
  }, {
263
- default: s(() => [_(y(e(r)("ap.apTable.setting.sizeNormal")), 1)]),
263
+ default: s(() => [x(y(e(r)("ap.apTable.setting.sizeNormal")), 1)]),
264
264
  _: 1
265
265
  })]),
266
266
  _: 1
267
- }, 8, ["value"])], 2), m("div", je, [l(e(N), {
267
+ }, 8, ["value"])], 2), m("div", je, [l(e($), {
268
268
  dashed: "",
269
269
  style: {
270
270
  margin: "0px"
271
271
  }
272
272
  })]), l(Oe, {
273
- class: u(e(b)("center", "content")),
273
+ class: u(e(_)("center", "content")),
274
274
  value: e(p)
275
- }, null, 8, ["class", "value"])], 2), l(e(N), {
275
+ }, null, 8, ["class", "value"])], 2), l(e($), {
276
276
  type: "vertical",
277
277
  style: {
278
278
  height: "100%",
279
279
  margin: "0px"
280
280
  }
281
281
  }), m("div", {
282
- class: u(e(g)("right"))
282
+ class: u(e(v)("right"))
283
283
  }, [l(Pe, {
284
284
  value: e(p),
285
285
  "onUpdate:value": t[1] || (t[1] = (n) => he(p) ? p.value = n : null),
@@ -1,8 +1,8 @@
1
1
  import { useToken as G } from "@aplus-frontend/antdv/es/theme/internal";
2
- import { isBoolean as P, isNumber as S, isObject as b, mergeWith as z, omit as R, isString as U } from "lodash-unified";
3
- import { ref as y, watch as d, unref as v } from "vue";
2
+ import { isBoolean as P, isNumber as b, isObject as y, mergeWith as E, omit as R, isString as U } from "lodash-unified";
3
+ import { ref as k, watch as d, unref as v } from "vue";
4
4
  import "../../config-provider/index.mjs";
5
- import { randomStr as E } from "../../utils/index.mjs";
5
+ import { randomStr as N } from "../../utils/index.mjs";
6
6
  import { getColumnStateString as W } from "../components/setting/utils.mjs";
7
7
  import { useInjectApTable as X } from "../context.mjs";
8
8
  import { getTableTitle as q } from "../utils.mjs";
@@ -11,16 +11,16 @@ import { useNamespace as H } from "../../config-provider/hooks/use-namespace.mjs
11
11
  function Q(r, e, o, a) {
12
12
  return a ? a.fixed : e ? e.fixed : o && "fixed" in o ? o.fixed : P(r.fixed) ? r.fixed ? "left" : void 0 : r.fixed;
13
13
  }
14
- const k = Number.MAX_SAFE_INTEGER, A = E();
14
+ const A = Number.MAX_SAFE_INTEGER, I = N();
15
15
  function V(r, e) {
16
- const o = S(r.order) ? r.order : k;
17
- let a = S(e.order) ? e.order : k;
16
+ const o = b(r.order) ? r.order : A;
17
+ let a = b(e.order) ? e.order : A;
18
18
  return r.fixed === "right" && e.fixed !== "right" && (a = o - 1), e.fixed === "left" && r.fixed !== "left" && (a = o - 1), o - a;
19
19
  }
20
20
  function Y(r, e) {
21
21
  e && r.removeItem(e);
22
22
  }
23
- function I(r, e) {
23
+ function z(r, e) {
24
24
  if (!e)
25
25
  return [];
26
26
  const o = r.getItem(e);
@@ -29,29 +29,30 @@ function I(r, e) {
29
29
  const a = JSON.parse(o);
30
30
  return Array.isArray(a) ? a : (Y(r, e), []);
31
31
  }
32
- function N(r, e) {
33
- if (b(r) && b(e))
34
- return z({}, r, e, N);
32
+ function _(r, e) {
33
+ if (y(r) && y(e))
34
+ return E({}, r, e, _);
35
35
  }
36
36
  const ue = (r, e, o) => {
37
- const { columnsBackup: a, size: s } = X(), { t: _ } = D(), { be: L } = H("ap-table"), [Z, O] = G(), c = y(), n = y([]), B = d(
37
+ const { columnsBackup: a, size: s } = X(), { t: L } = D(), { be: O } = H("ap-table"), [Z, B] = G(), m = k(), n = k([]);
38
+ let g;
39
+ g = d(
38
40
  () => a?.value,
39
41
  (t, i) => {
40
- t?.length && !i?.length && (n.value = g(
41
- I(localStorage, v(e))
42
- ), B?.());
42
+ t?.length && !i?.length && (n.value = T(
43
+ z(localStorage, v(e))
44
+ ), g?.());
43
45
  },
44
46
  {
45
47
  immediate: !0
46
48
  }
47
- );
48
- d(
49
+ ), d(
49
50
  [a, s],
50
51
  ([t, i]) => {
51
- t && (c.value = {
52
+ t && (m.value = {
52
53
  label: "basic_template",
53
54
  columnState: f(t),
54
- key: A,
55
+ key: I,
55
56
  size: i
56
57
  });
57
58
  },
@@ -59,18 +60,18 @@ const ue = (r, e, o) => {
59
60
  ), d(
60
61
  () => e.value,
61
62
  (t) => {
62
- const i = g(
63
- I(localStorage, t)
63
+ const i = T(
64
+ z(localStorage, t)
64
65
  );
65
- n.value = i, c.value = {
66
+ n.value = i, m.value = {
66
67
  label: "basic_template",
67
68
  columnState: f(a?.value || []),
68
- key: A,
69
+ key: I,
69
70
  size: s?.value
70
71
  }, o(i ?? []);
71
72
  }
72
73
  );
73
- function g(t) {
74
+ function T(t) {
74
75
  return t.length ? t.map((i) => ({
75
76
  ...i,
76
77
  columnState: f(
@@ -80,29 +81,29 @@ const ue = (r, e, o) => {
80
81
  )
81
82
  })) : [
82
83
  {
83
- label: _("ap.apTable.setting.defaultTemplate"),
84
- key: r.getActiveKey?.("DEFAULT_TEMPLATE") ?? E(),
84
+ label: L("ap.apTable.setting.defaultTemplate"),
85
+ key: r.getActiveKey?.("DEFAULT_TEMPLATE") ?? N(),
85
86
  size: s?.value,
86
87
  columnState: f(a?.value || [])
87
88
  }
88
89
  ];
89
90
  }
90
91
  function f(t, i = {}, l = !0) {
91
- const m = z(
92
+ const c = E(
92
93
  {},
93
94
  l ? r.defaultValue || {} : {},
94
95
  i,
95
- N
96
+ _
96
97
  );
97
- function x(M, j, C) {
98
+ function h(M, j, C) {
98
99
  return M.map((u) => {
99
- const h = j?.[u.key] || {}, p = {
100
+ const S = j?.[u.key] || {}, p = {
100
101
  key: u.key,
101
102
  label: U(u.title) ? q(
102
103
  u,
103
- L("table-header", "title"),
104
+ O("table-header", "title"),
104
105
  void 0,
105
- O.value.colorTextTertiary
106
+ B.value.colorTextTertiary
106
107
  ) : u.title,
107
108
  show: !0,
108
109
  fixed: Q(
@@ -112,18 +113,18 @@ const ue = (r, e, o) => {
112
113
  C
113
114
  ),
114
115
  disabled: !1,
115
- ...R(h, ["children", "fixed"])
116
+ ...R(S, ["children", "fixed"])
116
117
  };
117
- return p.children = u.children?.length ? x(
118
+ return p.children = u.children?.length ? h(
118
119
  u.children,
119
- h.children,
120
+ S.children,
120
121
  p
121
122
  ) : void 0, p;
122
123
  }).sort(V);
123
124
  }
124
- return x(t || [], m);
125
+ return h(t || [], c);
125
126
  }
126
- function T(t) {
127
+ function x(t) {
127
128
  if (v(e)) {
128
129
  const i = t.map((l) => ({
129
130
  ...l,
@@ -143,7 +144,7 @@ const ue = (r, e, o) => {
143
144
  }
144
145
  function J(t, i) {
145
146
  const l = n.value.findIndex(
146
- (m) => m.key === t
147
+ (c) => c.key === t
147
148
  );
148
149
  return n.value[l] = {
149
150
  ...n.value[l],
@@ -153,13 +154,13 @@ const ue = (r, e, o) => {
153
154
  return d(
154
155
  () => n.value,
155
156
  (t) => {
156
- t.length && T(t);
157
+ t.length && x(t);
157
158
  },
158
159
  { deep: !0, immediate: !0 }
159
160
  ), {
160
- basicTemplate: c,
161
+ basicTemplate: m,
161
162
  customizeTemplateList: n,
162
- syncTemplateListToStorage: T,
163
+ syncTemplateListToStorage: x,
163
164
  addTemplate: F,
164
165
  deleteTemplate: w,
165
166
  updateTemplate: J