@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 +12 -0
- package/dist/components/ZlSearch/index.vue.mjs +69 -59
- package/dist/locales/en.mjs +1 -0
- package/dist/locales/zh-cn.mjs +1 -0
- package/package.json +6 -6
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
|
|
2
|
-
import { useZlT as
|
|
3
|
-
import { isArray as
|
|
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
|
|
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" },
|
|
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:
|
|
35
|
+
const { t: r } = ie(), m = S, B = G, T = u(
|
|
36
36
|
() => Object.keys(ae()).filter((e) => e !== "label" && e !== "actions")
|
|
37
|
-
),
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
54
|
+
const { toLabel: i, toParams: a, visible: z, ...ee } = l;
|
|
55
55
|
e.push(ee);
|
|
56
56
|
}
|
|
57
57
|
return e;
|
|
58
|
-
}), Q = k(
|
|
59
|
-
const
|
|
60
|
-
return
|
|
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](
|
|
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(() =>
|
|
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(
|
|
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
|
|
71
|
+
return ne(e) ? e.join(", ") : ce(e) ? e.label : e;
|
|
72
72
|
}
|
|
73
73
|
async function x() {
|
|
74
|
-
|
|
74
|
+
n.value && (n.value = !1), B("search", j.value);
|
|
75
75
|
}
|
|
76
76
|
async function _() {
|
|
77
77
|
try {
|
|
78
|
-
await (
|
|
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 =
|
|
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
|
|
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
|
-
),
|
|
100
|
-
const
|
|
101
|
-
return
|
|
102
|
-
v.value.length ? (
|
|
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:
|
|
106
|
+
ref: y,
|
|
107
107
|
class: "zl-search-form",
|
|
108
|
-
model:
|
|
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((
|
|
126
|
-
$(e.$slots, a, N(O(
|
|
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(
|
|
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
|
-
|
|
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:
|
|
141
|
-
"aria-label":
|
|
142
|
-
"aria-expanded":
|
|
143
|
-
onClick: l[0] || (l[0] = (a) =>
|
|
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(
|
|
155
|
+
t(i, {
|
|
151
156
|
type: "primary",
|
|
152
157
|
onClick: _
|
|
153
158
|
}, {
|
|
154
159
|
default: o(() => [
|
|
155
|
-
p(h(
|
|
160
|
+
p(h(s(r)("zl.search.search", "查询")), 1)
|
|
156
161
|
]),
|
|
157
162
|
_: 1
|
|
158
163
|
})
|
|
159
164
|
])
|
|
160
165
|
]),
|
|
161
|
-
U.value ? (
|
|
162
|
-
g("div", pe, h(
|
|
163
|
-
F.value.length === 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(
|
|
170
|
+
p(h(s(r)("zl.search.all", "全部")), 1)
|
|
166
171
|
]),
|
|
167
172
|
_: 1
|
|
168
173
|
})) : b("", !0),
|
|
169
|
-
(
|
|
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: (
|
|
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
|
-
|
|
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:
|
|
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((
|
|
211
|
-
$(e.$slots, a, N(O(
|
|
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(
|
|
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(
|
|
231
|
+
}, 8, ["title", "aria-label"]),
|
|
232
|
+
t(i, {
|
|
223
233
|
class: "zl-search-form-actions__toggle",
|
|
224
|
-
title:
|
|
225
|
-
"aria-label":
|
|
226
|
-
"aria-expanded":
|
|
227
|
-
onClick: l[1] || (l[1] = (a) =>
|
|
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(
|
|
244
|
+
t(i, {
|
|
235
245
|
type: "primary",
|
|
236
246
|
onClick: _
|
|
237
247
|
}, {
|
|
238
248
|
default: o(() => [
|
|
239
|
-
p(h(
|
|
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 ? (
|
|
259
|
+
e.$slots.actions ? (c(), f("div", ze, [
|
|
250
260
|
$(e.$slots, "actions")
|
|
251
261
|
])) : b("", !0)
|
|
252
262
|
]);
|
package/dist/locales/en.mjs
CHANGED
|
@@ -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",
|
package/dist/locales/zh-cn.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zl-ui-kit/components",
|
|
3
|
-
"version": "0.7.
|
|
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.
|
|
43
|
-
"@zl-ui-kit/icons": "0.7.
|
|
44
|
-
"@zl-ui-kit/composables": "0.7.
|
|
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.
|
|
103
|
+
"@zl-ui-kit/theme": "0.7.2",
|
|
104
|
+
"@jichuang/vite-config": "1.0.0"
|
|
105
105
|
},
|
|
106
106
|
"repository": {
|
|
107
107
|
"type": "git",
|