@zl-ui-kit/components 0.7.1 → 0.7.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/README.md CHANGED
@@ -852,6 +852,18 @@ const items: FormItem[] = [
852
852
  展开全量表单浮层(`position: absolute` + 上滑 `--28px` 淡入,不改变页面高度),再点收起;查询/重置后自动收起。
853
853
  `showLabels` 不显式传时,仅在发生溢出时展示「筛选条件」标签行。
854
854
 
855
+ **图标按钮的移入提示**:重置、展开、收起都是纯图标按钮,鼠标移入给出文字提示(原生 `title`,
856
+ 同时带 `aria-label` 供读屏)。文案走 i18n,随 `setLocale` 切换、也可被消费方覆盖:
857
+
858
+ | 按钮 | key | 中文 | English |
859
+ | ---- | -------------------- | ---- | -------- |
860
+ | 重置 | `zl.search.reset` | 重置 | Reset |
861
+ | 展开 | `zl.search.expand` | 展开 | Expand |
862
+ | 收起 | `zl.search.collapse` | 收起 | Collapse |
863
+
864
+ > 浮层里的重置按钮与单行内的按钮共用 `zl-search-form-actions__reset` class,展开/收起为
865
+ > `zl-search-form-actions__toggle`,需要自定义样式或做 e2e 断言时可直接用这两个 class 定位。
866
+
855
867
  ### ZlDrawer / ZlPopconfirm / ZlSwitch
856
868
 
857
869
  - `ZlDrawer`:自绘 footer(okLoading/hideCancel/readonly 语义保持),`loading`→`v-loading`。
@@ -1,6 +1,6 @@
1
- import { defineComponent as le, computed as u, useSlots as ae, ref as k, watch as te, nextTick as w, resolveComponent as oe, openBlock as n, createElementBlock as f, createElementVNode as g, createVNode as t, withModifiers as M, createSlots as R, withCtx as o, createTextVNode as p, toDisplayString as h, renderList as V, renderSlot as $, normalizeProps as N, guardReactiveProps as O, unref as i, createBlock as E, createCommentVNode as b, Fragment as se, Transition as re } from "vue";
2
- import { useZlT as ne } from "@zl-ui-kit/composables";
3
- import { isArray as ie, isPlainObject as ce } from "@zl-ui-kit/utils";
1
+ import { defineComponent as le, computed as u, useSlots as ae, ref as k, watch as te, nextTick as w, resolveComponent as oe, openBlock as c, createElementBlock as f, createElementVNode as g, createVNode as t, withModifiers as M, createSlots as R, withCtx as o, createTextVNode as p, toDisplayString as h, renderList as V, renderSlot as $, normalizeProps as N, guardReactiveProps as O, unref as s, createBlock as E, createCommentVNode as b, Fragment as se, Transition as re } from "vue";
2
+ import { useZlT as ie } from "@zl-ui-kit/composables";
3
+ import { isArray as ne, isPlainObject as ce } from "@zl-ui-kit/utils";
4
4
  import I from "../ZlAutoTooltip/index.vue.mjs";
5
5
  import A from "../ZlForm/index.vue.mjs";
6
6
  import '../ZlTag/index.css';import '../ZlForm/index.css';/* empty css */
@@ -8,7 +8,7 @@ import C from "../ZlIcon/index.vue.mjs";
8
8
  import q from "../ZlTag/index.vue.mjs";
9
9
  /* empty css */
10
10
  import { useSearchFormOverflow as ue } from "./useSearchFormOverflow.mjs";
11
- const de = { class: "zl-search" }, me = {
11
+ const me = { class: "zl-search" }, de = {
12
12
  key: 0,
13
13
  class: "zl-search-search"
14
14
  }, fe = { class: "zl-search-search-single" }, he = { class: "zl-search-form-actions" }, ve = {
@@ -17,7 +17,7 @@ const de = { class: "zl-search" }, me = {
17
17
  }, pe = { class: "zl-search-label__summary" }, be = {
18
18
  key: 0,
19
19
  class: "zl-search-search-multiple"
20
- }, _e = { class: "zl-search-form-actions" }, ye = {
20
+ }, _e = { class: "zl-search-form-actions" }, ze = {
21
21
  key: 1,
22
22
  class: "zl-search__actions"
23
23
  }, $e = /* @__PURE__ */ le({
@@ -32,56 +32,56 @@ const de = { class: "zl-search" }, me = {
32
32
  },
33
33
  emits: ["search", "reset"],
34
34
  setup(S, { expose: D, emit: G }) {
35
- const { t: c } = ne(), d = S, B = G, T = u(
35
+ const { t: r } = ie(), m = S, B = G, T = u(
36
36
  () => Object.keys(ae()).filter((e) => e !== "label" && e !== "actions")
37
- ), z = k(null), L = k(null), r = k(!1), { lastVisibleIndex: Z, measure: H } = ue(z), J = u(() => {
37
+ ), y = k(null), L = k(null), n = k(!1), { lastVisibleIndex: Z, measure: H } = ue(y), J = u(() => {
38
38
  const e = {};
39
- for (const l of d.items)
39
+ for (const l of m.items)
40
40
  e[l.model] = typeof l.toLabel == "function" ? l.toLabel : X;
41
41
  return e;
42
42
  }), K = u(() => {
43
43
  const e = {};
44
- for (const l of d.items)
44
+ for (const l of m.items)
45
45
  typeof l.toParams == "function" && (e[l.model] = l.toParams);
46
46
  return e;
47
47
  }), v = u(() => {
48
48
  const e = [];
49
- for (const l of d.items) {
49
+ for (const l of m.items) {
50
50
  if (!l.model)
51
51
  throw new Error("[ZlSearch]: form item's model is required!");
52
52
  if (!W(l))
53
53
  continue;
54
- const { toLabel: s, toParams: a, visible: y, ...ee } = l;
54
+ const { toLabel: i, toParams: a, visible: z, ...ee } = l;
55
55
  e.push(ee);
56
56
  }
57
57
  return e;
58
- }), Q = k(d.model ?? {}), m = u(() => d.model ?? Q.value), j = u(() => v.value.reduce((e, l) => {
59
- const s = K.value[l.model];
60
- return s ? Object.assign(e, s(m.value[l.model], e)) : { ...e, [l.model]: m.value[l.model] };
58
+ }), Q = k(m.model ?? {}), d = u(() => m.model ?? Q.value), j = u(() => v.value.reduce((e, l) => {
59
+ const i = K.value[l.model];
60
+ return i ? Object.assign(e, i(d.value[l.model], e)) : { ...e, [l.model]: d.value[l.model] };
61
61
  }, {})), F = u(() => v.value.map((e) => ({
62
- labelValue: J.value[e.model](m.value[e.model]),
62
+ labelValue: J.value[e.model](d.value[e.model]),
63
63
  model: e.model,
64
64
  label: e.label
65
- })).filter((e) => e.labelValue)), U = u(() => d.showLabels ?? Z.value !== null);
65
+ })).filter((e) => e.labelValue)), U = u(() => m.showLabels ?? Z.value !== null);
66
66
  function W(e) {
67
67
  const l = e.visible;
68
- return l === void 0 ? !0 : l === !1 || typeof l == "function" && !l(m.value, e) ? !1 : !!l;
68
+ return l === void 0 ? !0 : l === !1 || typeof l == "function" && !l(d.value, e) ? !1 : !!l;
69
69
  }
70
70
  function X(e) {
71
- return ie(e) ? e.join(", ") : ce(e) ? e.label : e;
71
+ return ne(e) ? e.join(", ") : ce(e) ? e.label : e;
72
72
  }
73
73
  async function x() {
74
- r.value && (r.value = !1), B("search", j.value);
74
+ n.value && (n.value = !1), B("search", j.value);
75
75
  }
76
76
  async function _() {
77
77
  try {
78
- await (r.value ? L.value : z.value)?.validate(), x();
78
+ await (n.value ? L.value : y.value)?.validate(), x();
79
79
  } catch {
80
80
  }
81
81
  }
82
82
  async function P() {
83
83
  try {
84
- const e = r.value ? L.value : z.value;
84
+ const e = n.value ? L.value : y.value;
85
85
  e?.resetFields(), await w(), await e?.validate().catch(() => {
86
86
  }), B("reset"), await w(), x();
87
87
  } catch (e) {
@@ -89,23 +89,23 @@ const de = { class: "zl-search" }, me = {
89
89
  }
90
90
  }
91
91
  function Y(e) {
92
- delete m.value[e.model];
92
+ delete d.value[e.model];
93
93
  }
94
94
  return te(
95
95
  () => v.value.map((e) => e.model).join(","),
96
96
  async () => {
97
97
  await w(), H();
98
98
  }
99
- ), d.immediate && (async () => (await w(), _()))(), D({ params: j, search: x, reset: P }), (e, l) => {
100
- const s = oe("el-button");
101
- return n(), f("div", de, [
102
- v.value.length ? (n(), f("div", me, [
99
+ ), m.immediate && (async () => (await w(), _()))(), D({ params: j, search: x, reset: P }), (e, l) => {
100
+ const i = oe("el-button");
101
+ return c(), f("div", me, [
102
+ v.value.length ? (c(), f("div", de, [
103
103
  g("div", fe, [
104
104
  t(A, {
105
105
  ref_key: "formRef",
106
- ref: z,
106
+ ref: y,
107
107
  class: "zl-search-form",
108
- model: m.value,
108
+ model: d.value,
109
109
  items: v.value,
110
110
  disabled: S.disabled,
111
111
  onSubmit: M(_, ["prevent"])
@@ -122,51 +122,56 @@ const de = { class: "zl-search" }, me = {
122
122
  }, [
123
123
  V(T.value, (a) => ({
124
124
  name: a,
125
- fn: o((y) => [
126
- $(e.$slots, a, N(O(y)))
125
+ fn: o((z) => [
126
+ $(e.$slots, a, N(O(z)))
127
127
  ])
128
128
  }))
129
129
  ]), 1032, ["model", "items", "disabled"]),
130
130
  g("div", he, [
131
- t(s, { onClick: P }, {
131
+ t(i, {
132
+ class: "zl-search-form-actions__reset",
133
+ title: s(r)("zl.search.reset", "重置"),
134
+ "aria-label": s(r)("zl.search.reset", "重置"),
135
+ onClick: P
136
+ }, {
132
137
  icon: o(() => [
133
138
  t(C, { icon: "zl:brush-color" })
134
139
  ]),
135
140
  _: 1
136
- }),
137
- i(Z) !== null ? (n(), E(s, {
141
+ }, 8, ["title", "aria-label"]),
142
+ s(Z) !== null ? (c(), E(i, {
138
143
  key: 0,
139
144
  class: "zl-search-form-actions__toggle",
140
- title: i(c)("zl.search.expand", "展开"),
141
- "aria-label": i(c)("zl.search.expand", "展开"),
142
- "aria-expanded": r.value,
143
- onClick: l[0] || (l[0] = (a) => r.value = !0)
145
+ title: s(r)("zl.search.expand", "展开"),
146
+ "aria-label": s(r)("zl.search.expand", "展开"),
147
+ "aria-expanded": n.value,
148
+ onClick: l[0] || (l[0] = (a) => n.value = !0)
144
149
  }, {
145
150
  icon: o(() => [
146
151
  t(C, { icon: "zl:filter-color" })
147
152
  ]),
148
153
  _: 1
149
154
  }, 8, ["title", "aria-label", "aria-expanded"])) : b("", !0),
150
- t(s, {
155
+ t(i, {
151
156
  type: "primary",
152
157
  onClick: _
153
158
  }, {
154
159
  default: o(() => [
155
- p(h(i(c)("zl.search.search", "查询")), 1)
160
+ p(h(s(r)("zl.search.search", "查询")), 1)
156
161
  ]),
157
162
  _: 1
158
163
  })
159
164
  ])
160
165
  ]),
161
- U.value ? (n(), f("div", ve, [
162
- g("div", pe, h(i(c)("zl.search.filterConditions", "筛选条件")), 1),
163
- F.value.length === 0 ? (n(), E(q, { key: 0 }, {
166
+ U.value ? (c(), f("div", ve, [
167
+ g("div", pe, h(s(r)("zl.search.filterConditions", "筛选条件")), 1),
168
+ F.value.length === 0 ? (c(), E(q, { key: 0 }, {
164
169
  default: o(() => [
165
- p(h(i(c)("zl.search.all", "全部")), 1)
170
+ p(h(s(r)("zl.search.all", "全部")), 1)
166
171
  ]),
167
172
  _: 1
168
173
  })) : b("", !0),
169
- (n(!0), f(se, null, V(F.value, (a) => (n(), f("div", {
174
+ (c(!0), f(se, null, V(F.value, (a) => (c(), f("div", {
170
175
  key: a.model,
171
176
  class: "zl-search-label-item"
172
177
  }, [
@@ -174,7 +179,7 @@ const de = { class: "zl-search" }, me = {
174
179
  closable: "",
175
180
  fill: "",
176
181
  color: "primary",
177
- onClose: (y) => Y(a)
182
+ onClose: (z) => Y(a)
178
183
  }, {
179
184
  default: o(() => [
180
185
  p(h(a.labelValue), 1)
@@ -185,12 +190,12 @@ const de = { class: "zl-search" }, me = {
185
190
  ])) : b("", !0),
186
191
  t(re, { name: "zl-search-fade-slide" }, {
187
192
  default: o(() => [
188
- r.value ? (n(), f("div", be, [
193
+ n.value ? (c(), f("div", be, [
189
194
  t(A, {
190
195
  ref_key: "multipleFormRef",
191
196
  ref: L,
192
197
  class: "zl-search-form",
193
- model: m.value,
198
+ model: d.value,
194
199
  items: v.value,
195
200
  disabled: S.disabled,
196
201
  onSubmit: M(_, ["prevent"])
@@ -207,36 +212,41 @@ const de = { class: "zl-search" }, me = {
207
212
  }, [
208
213
  V(T.value, (a) => ({
209
214
  name: a,
210
- fn: o((y) => [
211
- $(e.$slots, a, N(O(y)))
215
+ fn: o((z) => [
216
+ $(e.$slots, a, N(O(z)))
212
217
  ])
213
218
  }))
214
219
  ]), 1032, ["model", "items", "disabled"]),
215
220
  g("div", _e, [
216
- t(s, { onClick: P }, {
221
+ t(i, {
222
+ class: "zl-search-form-actions__reset",
223
+ title: s(r)("zl.search.reset", "重置"),
224
+ "aria-label": s(r)("zl.search.reset", "重置"),
225
+ onClick: P
226
+ }, {
217
227
  icon: o(() => [
218
228
  t(C, { icon: "zl:brush-color" })
219
229
  ]),
220
230
  _: 1
221
- }),
222
- t(s, {
231
+ }, 8, ["title", "aria-label"]),
232
+ t(i, {
223
233
  class: "zl-search-form-actions__toggle",
224
- title: i(c)("zl.search.collapse", "收起"),
225
- "aria-label": i(c)("zl.search.collapse", "收起"),
226
- "aria-expanded": r.value,
227
- onClick: l[1] || (l[1] = (a) => r.value = !1)
234
+ title: s(r)("zl.search.collapse", "收起"),
235
+ "aria-label": s(r)("zl.search.collapse", "收起"),
236
+ "aria-expanded": n.value,
237
+ onClick: l[1] || (l[1] = (a) => n.value = !1)
228
238
  }, {
229
239
  icon: o(() => [
230
240
  t(C, { icon: "zl:filter-color" })
231
241
  ]),
232
242
  _: 1
233
243
  }, 8, ["title", "aria-label", "aria-expanded"]),
234
- t(s, {
244
+ t(i, {
235
245
  type: "primary",
236
246
  onClick: _
237
247
  }, {
238
248
  default: o(() => [
239
- p(h(i(c)("zl.search.search", "查询")), 1)
249
+ p(h(s(r)("zl.search.search", "查询")), 1)
240
250
  ]),
241
251
  _: 1
242
252
  })
@@ -246,7 +256,7 @@ const de = { class: "zl-search" }, me = {
246
256
  _: 3
247
257
  })
248
258
  ])) : b("", !0),
249
- e.$slots.actions ? (n(), f("div", ye, [
259
+ e.$slots.actions ? (c(), f("div", ze, [
250
260
  $(e.$slots, "actions")
251
261
  ])) : b("", !0)
252
262
  ]);
@@ -12,6 +12,7 @@ const e = {
12
12
  "zl.upload.maxSize": "File size must not exceed {maxSize}MB",
13
13
  "zl.upload.nameSpace": "File name must not contain spaces",
14
14
  "zl.search.search": "Search",
15
+ "zl.search.reset": "Reset",
15
16
  "zl.search.filterConditions": "Filters",
16
17
  "zl.search.all": "All",
17
18
  "zl.search.expand": "Expand",
@@ -12,6 +12,7 @@ const l = {
12
12
  "zl.upload.maxSize": "大小不超过{maxSize}MB",
13
13
  "zl.upload.nameSpace": "文件名中不得包含空格",
14
14
  "zl.search.search": "查询",
15
+ "zl.search.reset": "重置",
15
16
  "zl.search.filterConditions": "筛选条件",
16
17
  "zl.search.all": "全部",
17
18
  "zl.search.expand": "展开",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zl-ui-kit/components",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "description": "ZL UI 业务组件库(Element Plus 体系,Zl 前缀)——首批:Icon/AutoTooltip/Tag/CornerTag/Text/Title/Copy/Empty/Pagination/DictTag",
6
6
  "license": "MIT",
@@ -39,9 +39,9 @@
39
39
  "file-type": "^20.4.1",
40
40
  "dt-sql-parser": "^4.3.1",
41
41
  "sql-formatter": "^15.4.2",
42
- "@zl-ui-kit/utils": "0.7.1",
43
- "@zl-ui-kit/icons": "0.7.1",
44
- "@zl-ui-kit/composables": "0.7.1"
42
+ "@zl-ui-kit/utils": "0.7.2",
43
+ "@zl-ui-kit/icons": "0.7.2",
44
+ "@zl-ui-kit/composables": "0.7.2"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@vueuse/core": "^12.3.0",
@@ -99,9 +99,9 @@
99
99
  "@vue-office/pptx": "1.0.1",
100
100
  "echarts": "^5.6.0",
101
101
  "@jichuang/eslint-config": "1.0.0",
102
- "@jichuang/vite-config": "1.0.0",
103
102
  "@jichuang/tsconfig": "1.0.0",
104
- "@zl-ui-kit/theme": "0.7.1"
103
+ "@zl-ui-kit/theme": "0.7.2",
104
+ "@jichuang/vite-config": "1.0.0"
105
105
  },
106
106
  "repository": {
107
107
  "type": "git",