@zl-ui-kit/components 0.5.1 → 0.6.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.
- package/README.md +3009 -148
- package/dist/components/ZlAction/types.d.ts +7 -0
- package/dist/components/ZlAddSub/index.css +1 -1
- package/dist/components/ZlAddSub/index.vue.mjs +1 -1
- package/dist/components/ZlAutoTooltip/index.css +1 -1
- package/dist/components/ZlAutoTooltip/index.vue.mjs +1 -1
- package/dist/components/ZlAutoTooltip/index2.vue.mjs +7 -3
- package/dist/components/ZlAvatar/Group.css +1 -1
- package/dist/components/ZlAvatar/Group.vue.mjs +2 -2
- package/dist/components/ZlAvatar/index.css +1 -1
- package/dist/components/ZlAvatar/index.vue.mjs +2 -2
- package/dist/components/ZlCardPage/index.vue.d.ts +6 -12
- package/dist/components/ZlCardPage/index.vue.mjs +24 -10
- package/dist/components/ZlChart/index.vue.mjs +11 -5
- package/dist/components/ZlCheckAll/index.css +1 -1
- package/dist/components/ZlCheckAll/index.vue.mjs +2 -2
- package/dist/components/ZlCheckboxTag/index.vue.mjs +1 -2
- package/dist/components/ZlCopy/index.css +1 -1
- package/dist/components/ZlCopy/index.vue.mjs +2 -2
- package/dist/components/ZlDictTag/index.vue.mjs +10 -6
- package/dist/components/ZlDynamicComponent/index.vue.mjs +1 -2
- package/dist/components/ZlEditor/ZlSqlEditor.vue.mjs +13 -8
- package/dist/components/ZlEditor/index.vue.mjs +28 -19
- package/dist/components/ZlEmpty/index.css +1 -1
- package/dist/components/ZlEmpty/index.vue.mjs +2 -2
- package/dist/components/ZlFileViewer/index.css +1 -1
- package/dist/components/ZlFileViewer/index.vue.mjs +2 -2
- package/dist/components/ZlForm/index.vue.mjs +15 -12
- package/dist/components/ZlGrid/index.vue.mjs +1 -2
- package/dist/components/ZlGrid/types.d.ts +5 -0
- package/dist/components/ZlHorizontalTable/index.css +1 -1
- package/dist/components/ZlHorizontalTable/index.vue.mjs +1 -1
- package/dist/components/ZlLayoutSwitch/index.css +1 -1
- package/dist/components/ZlLayoutSwitch/index.vue.mjs +2 -2
- package/dist/components/ZlLogin/components/LoginForm.css +1 -1
- package/dist/components/ZlLogin/components/LoginForm.vue.mjs +2 -2
- package/dist/components/ZlLogin/components/LoginForm2.vue.mjs +4 -3
- package/dist/components/ZlLogin/components/SlideChecker.css +1 -1
- package/dist/components/ZlLogin/components/SlideChecker.vue.mjs +2 -2
- package/dist/components/ZlLogin/components/SlideChecker2.vue.mjs +2 -8
- package/dist/components/ZlLogin/index.vue.mjs +2 -3
- package/dist/components/ZlPagination/index.css +1 -1
- package/dist/components/ZlPagination/index.vue.mjs +1 -1
- package/dist/components/ZlPagination/index2.vue.mjs +17 -8
- package/dist/components/ZlPermission/usePermission.mjs +9 -5
- package/dist/components/ZlSearch/index.css +1 -1
- package/dist/components/ZlSearch/index.vue.d.ts +9 -3
- package/dist/components/ZlSearch/index.vue.mjs +129 -114
- package/dist/components/ZlSearch/useSearchFormOverflow.d.ts +17 -0
- package/dist/components/ZlSearch/useSearchFormOverflow.mjs +50 -0
- package/dist/components/ZlSearchTable/index.vue.d.ts +6 -12
- package/dist/components/ZlSearchTable/index.vue.mjs +28 -17
- package/dist/components/ZlSorter/ZlSorterList.css +1 -1
- package/dist/components/ZlSorter/ZlSorterList.vue.mjs +2 -2
- package/dist/components/ZlSorter/index.css +1 -1
- package/dist/components/ZlSorter/index.vue.mjs +2 -2
- package/dist/components/ZlTable/index.vue.mjs +14 -8
- package/dist/components/ZlTable/useTablePagination.mjs +16 -10
- package/dist/components/ZlTabs/index.vue.mjs +21 -10
- package/dist/components/ZlText/index.css +1 -1
- package/dist/components/ZlText/index.vue.mjs +1 -1
- package/dist/components/ZlTitle/index.css +1 -1
- package/dist/components/ZlTitle/index.vue.mjs +2 -2
- package/dist/components/ZlTree/index.vue.mjs +13 -8
- package/dist/components/ZlTreeSelect/index.css +1 -1
- package/dist/components/ZlTreeSelect/index.vue.mjs +1 -1
- package/dist/components/ZlUpload/index.css +1 -1
- package/dist/components/ZlUpload/index.vue.mjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/locales/en.mjs +2 -0
- package/dist/locales/messages.mjs +2 -2
- package/dist/locales/zh-cn.mjs +2 -0
- package/dist/types.d.ts +8 -0
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
.slide-checker[data-v-
|
|
1
|
+
.slide-checker[data-v-7ddcdcbf]{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:32px;background-color:var(--slider-check-bg-color);pointer-events:none;--slider-check-bg-color: var(--zl-fill-3);--slider-check-progress: 0px;--slider-check-success-color: var(--zl-success-6, var(--el-color-success));--slider-check-trigger-border-color: var(--slider-check-bg-color);--slider-check-trigger-color: var(--zl-text-3)}.slide-checker__progress[data-v-7ddcdcbf]{position:absolute;top:0;left:0;width:var(--slider-check-progress);background-color:var(--slider-check-success-color);height:100%;opacity:.2}.slide-checker__trigger[data-v-7ddcdcbf]{position:absolute;left:var(--slider-check-progress);top:0;height:100%;aspect-ratio:1;display:flex;align-items:center;justify-content:center;background:var(--zl-bg-1, #fff);border:1px solid var(--slider-check-trigger-border-color);cursor:grab;pointer-events:auto;color:var(--slider-check-trigger-color)}.slide-checker__text[data-v-7ddcdcbf]{font-size:12px;color:var(--zl-text-3);user-select:none}.slide-checker.is-checked[data-v-7ddcdcbf]{--slider-check-bg-color: var(--slider-check-success-color)}.slide-checker.is-checked .slide-checker__text[data-v-7ddcdcbf]{color:#fff}.slide-checker.is-checked .slide-checker__trigger[data-v-7ddcdcbf]{border-color:transparent;color:var(--slider-check-success-color);pointer-events:none}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import o from "./SlideChecker2.vue.mjs";
|
|
2
2
|
import './SlideChecker.css';/* empty css */
|
|
3
3
|
import r from "../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const
|
|
4
|
+
const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-7ddcdcbf"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
e as default
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=SlideChecker.vue.mjs.map
|
|
@@ -18,14 +18,8 @@ const V = { class: "slide-checker__text" }, R = /* @__PURE__ */ x({
|
|
|
18
18
|
if (e.value)
|
|
19
19
|
return;
|
|
20
20
|
const t = n.currentTarget, s = t.parentElement, f = s.getBoundingClientRect().width, k = t.getBoundingClientRect().width, _ = n.touches?.[0]?.clientX || n.clientX, d = f - k, r = (u) => {
|
|
21
|
-
const E = u.touches?.[0]?.clientX || u.clientX, m = Math.min(
|
|
22
|
-
|
|
23
|
-
Math.max(0, E - _)
|
|
24
|
-
);
|
|
25
|
-
s.style.setProperty(
|
|
26
|
-
"--slider-check-progress",
|
|
27
|
-
`${m}px`
|
|
28
|
-
), m === d && (e.value = !0, B(() => {
|
|
21
|
+
const E = u.touches?.[0]?.clientX || u.clientX, m = Math.min(d, Math.max(0, E - _));
|
|
22
|
+
s.style.setProperty("--slider-check-progress", `${m}px`), m === d && (e.value = !0, B(() => {
|
|
29
23
|
o();
|
|
30
24
|
}));
|
|
31
25
|
};
|
|
@@ -10,8 +10,7 @@ const h = ["src"], x = ["src"], y = { class: "zl-login__slogan" }, k = { class:
|
|
|
10
10
|
},
|
|
11
11
|
setup(l) {
|
|
12
12
|
const { t: d } = b(), g = l, e = c(() => g.config.bg || ""), u = c(() => {
|
|
13
|
-
if (!e.value)
|
|
14
|
-
return !1;
|
|
13
|
+
if (!e.value) return !1;
|
|
15
14
|
const s = ["mp4", "webm"], t = e.value.split(".").pop();
|
|
16
15
|
return s.includes(t);
|
|
17
16
|
});
|
|
@@ -43,7 +42,7 @@ const h = ["src"], x = ["src"], y = { class: "zl-login__slogan" }, k = { class:
|
|
|
43
42
|
}, null, 8, V)
|
|
44
43
|
]),
|
|
45
44
|
o("div", B, [
|
|
46
|
-
t[0] || (t[0] = o("div", { class: "zl-login__title" }, "
|
|
45
|
+
t[0] || (t[0] = o("div", { class: "zl-login__title" }, "Hello!", -1)),
|
|
47
46
|
o("div", E, [
|
|
48
47
|
f(r(v(d)("zl.login.welcome", "欢迎登录")) + " ", 1),
|
|
49
48
|
o("span", null, r(l.config.title), 1)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.zl-pagination[data-v-
|
|
1
|
+
.zl-pagination[data-v-5ba9d585]{padding:6px 16px;background-color:var(--zl-fill-1, #f9fbfd)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index2.vue.mjs";
|
|
2
2
|
import './index.css';/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5ba9d585"]]);
|
|
5
5
|
export {
|
|
6
6
|
m as default
|
|
7
7
|
};
|
|
@@ -5,12 +5,22 @@ const B = /* @__PURE__ */ f({
|
|
|
5
5
|
__name: "index",
|
|
6
6
|
emits: ["change", "page-change", "page-size-change"],
|
|
7
7
|
setup(P, { emit: c }) {
|
|
8
|
-
const t = c, a = z(), n = N(() => a), i = p(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const t = c, a = z(), n = N(() => a), i = p(
|
|
9
|
+
a.pageNum ?? (n.value === !1 ? void 0 : n.value.currentPage) ?? 1
|
|
10
|
+
), u = p(
|
|
11
|
+
a.pageSize ?? (n.value === !1 ? void 0 : n.value.pageSize) ?? 30
|
|
12
|
+
);
|
|
13
|
+
r(
|
|
14
|
+
() => a.pageNum ?? a.currentPage,
|
|
15
|
+
(e) => {
|
|
16
|
+
e != null && (i.value = e);
|
|
17
|
+
}
|
|
18
|
+
), r(
|
|
19
|
+
() => a.pageSize,
|
|
20
|
+
(e) => {
|
|
21
|
+
e != null && (u.value = e);
|
|
22
|
+
}
|
|
23
|
+
);
|
|
14
24
|
function s(e) {
|
|
15
25
|
i.value = e, t("change", { pageNum: e, pageSize: u.value }), t("page-change", e);
|
|
16
26
|
}
|
|
@@ -18,8 +28,7 @@ const B = /* @__PURE__ */ f({
|
|
|
18
28
|
u.value = e, i.value = 1, t("change", { pageNum: 1, pageSize: e }), t("page-size-change", e);
|
|
19
29
|
}
|
|
20
30
|
const o = v(() => {
|
|
21
|
-
if (n.value === !1)
|
|
22
|
-
return !1;
|
|
31
|
+
if (n.value === !1) return !1;
|
|
23
32
|
const { currentPage: e, pageSize: m, ...g } = n.value;
|
|
24
33
|
return g;
|
|
25
34
|
});
|
|
@@ -6,11 +6,15 @@ function y(o) {
|
|
|
6
6
|
if (!s)
|
|
7
7
|
throw new Error("usePermission must be used within a permission provider");
|
|
8
8
|
const e = h({}), r = a(o);
|
|
9
|
-
return f(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
return f(
|
|
10
|
+
s.permissions,
|
|
11
|
+
() => {
|
|
12
|
+
r.forEach((i) => {
|
|
13
|
+
e[i] = s.hasPermission(i);
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
{ immediate: !0 }
|
|
17
|
+
), p(() => Object.values(e).some(Boolean));
|
|
14
18
|
}
|
|
15
19
|
function E(o, s = {}) {
|
|
16
20
|
const { levels: e = 3 } = s, r = Array.from({ length: e }).fill("*");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
@charset "UTF-8";.zl-search{width:100%;border-radius:4px}.zl-search-search{position:relative}.zl-search-search-single{display:flex;align-items:flex-start;gap:16px;background-color:var(--zl-fill-1);padding:10px 16px}.zl-search-search-multiple{position:absolute;z-index:10;background-color:var(--zl-fill-1);width:100%;padding:10px 16px;top:0;display:flex;flex-direction:column;gap:10px;opacity:1;box-shadow:0 4px 10px 0 var(--zl-shadow, rgba(36, 46, 67, .1))}.zl-search-search-multiple .zl-search-form-actions{justify-content:flex-end}.zl-search-form{flex:1;display:grid;grid-template-columns:repeat(auto-fill,minmax(min(240px,100%),1fr));gap:10px 20px}.zl-search-form .el-form-item{min-width:0;margin-bottom:0}.zl-search-form-item-hide{position:absolute;visibility:hidden;pointer-events:none}.zl-search-form-actions{display:flex;gap:10px}.zl-search-label{padding:0 16px 10px;background-color:var(--zl-fill-1);display:flex;align-items:center;font-size:12px;line-height:20px}.zl-search-label__summary{padding-right:16px}.zl-search-label .zl-tag{padding:0 6px;margin-right:4px}.zl-search__actions{padding:10px 16px;display:flex;gap:10px}.zl-search-fade-slide-leave-active,.zl-search-fade-slide-enter-active{transition:all .3s ease-out}.zl-search-fade-slide-enter-from,.zl-search-fade-slide-leave-to{opacity:0;transform:translateY(-28px)}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { nextTick } from 'vue';
|
|
2
2
|
import { SearchItem } from '../../types';
|
|
3
3
|
type __VLS_Props = {
|
|
4
|
+
/** 查询项定义(SearchItem[]),按数组顺序排列 */
|
|
4
5
|
items?: SearchItem[];
|
|
6
|
+
/**
|
|
7
|
+
* 表单数据。传入时组件直接读写该对象(受控);
|
|
8
|
+
* 不传则用内部副本,`params` / 标签行仍可正常工作
|
|
9
|
+
*/
|
|
5
10
|
model?: Record<string, any>;
|
|
11
|
+
/** 挂载后立即执行一次查询(默认 true) */
|
|
6
12
|
immediate?: boolean;
|
|
13
|
+
/** 禁用全部查询项 */
|
|
7
14
|
disabled?: boolean;
|
|
15
|
+
/** 是否展示「筛选条件」标签行;不传时按「是否发生溢出」自动判定 */
|
|
8
16
|
showLabels?: boolean;
|
|
9
|
-
/** 超过该项数显示"多行筛选"按钮(EP 版阈值判断,替代原 overflow 检测) */
|
|
10
|
-
overflowCount?: number;
|
|
11
17
|
};
|
|
12
18
|
declare function search(): Promise<void>;
|
|
13
19
|
declare function reset(): Promise<void>;
|
|
@@ -233,7 +239,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
|
|
|
233
239
|
immediate: boolean;
|
|
234
240
|
disabled: boolean;
|
|
235
241
|
items: SearchItem[];
|
|
236
|
-
|
|
242
|
+
showLabels: boolean;
|
|
237
243
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
238
244
|
formRef: ({
|
|
239
245
|
$: import('vue').ComponentInternalInstance;
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useZlT as
|
|
3
|
-
import { isArray as
|
|
4
|
-
import
|
|
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";
|
|
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 */
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import C from "../ZlIcon/index.vue.mjs";
|
|
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
12
|
key: 0,
|
|
12
13
|
class: "zl-search-search"
|
|
13
|
-
},
|
|
14
|
+
}, fe = { class: "zl-search-search-single" }, he = { class: "zl-search-form-actions" }, ve = {
|
|
14
15
|
key: 0,
|
|
15
16
|
class: "zl-search-label"
|
|
16
|
-
},
|
|
17
|
+
}, pe = { class: "zl-search-label__summary" }, be = {
|
|
17
18
|
key: 0,
|
|
18
19
|
class: "zl-search-search-multiple"
|
|
19
|
-
},
|
|
20
|
+
}, _e = { class: "zl-search-form-actions" }, ye = {
|
|
20
21
|
key: 1,
|
|
21
22
|
class: "zl-search__actions"
|
|
22
|
-
},
|
|
23
|
+
}, $e = /* @__PURE__ */ le({
|
|
23
24
|
name: "ZlSearch",
|
|
24
25
|
__name: "index",
|
|
25
26
|
props: {
|
|
@@ -27,218 +28,232 @@ const ne = { class: "zl-search" }, ie = {
|
|
|
27
28
|
model: {},
|
|
28
29
|
immediate: { type: Boolean, default: !0 },
|
|
29
30
|
disabled: { type: Boolean, default: !1 },
|
|
30
|
-
showLabels: { type: Boolean }
|
|
31
|
-
overflowCount: { default: 4 }
|
|
31
|
+
showLabels: { type: Boolean, default: void 0 }
|
|
32
32
|
},
|
|
33
33
|
emits: ["search", "reset"],
|
|
34
|
-
setup(
|
|
35
|
-
const { t:
|
|
34
|
+
setup(S, { expose: D, emit: G }) {
|
|
35
|
+
const { t: c } = ne(), d = S, B = G, T = u(
|
|
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(() => {
|
|
36
38
|
const e = {};
|
|
37
|
-
for (const l of
|
|
38
|
-
e[l.model] = typeof l.toLabel == "function" ? l.toLabel :
|
|
39
|
+
for (const l of d.items)
|
|
40
|
+
e[l.model] = typeof l.toLabel == "function" ? l.toLabel : X;
|
|
39
41
|
return e;
|
|
40
|
-
}),
|
|
42
|
+
}), K = u(() => {
|
|
41
43
|
const e = {};
|
|
42
|
-
for (const l of
|
|
44
|
+
for (const l of d.items)
|
|
43
45
|
typeof l.toParams == "function" && (e[l.model] = l.toParams);
|
|
44
46
|
return e;
|
|
45
|
-
}),
|
|
47
|
+
}), v = u(() => {
|
|
46
48
|
const e = [];
|
|
47
|
-
for (const l of
|
|
49
|
+
for (const l of d.items) {
|
|
48
50
|
if (!l.model)
|
|
49
51
|
throw new Error("[ZlSearch]: form item's model is required!");
|
|
50
|
-
if (!
|
|
52
|
+
if (!W(l))
|
|
51
53
|
continue;
|
|
52
|
-
const { toLabel: s, toParams:
|
|
53
|
-
e.push(
|
|
54
|
+
const { toLabel: s, toParams: a, visible: y, ...ee } = l;
|
|
55
|
+
e.push(ee);
|
|
54
56
|
}
|
|
55
57
|
return e;
|
|
56
|
-
}),
|
|
57
|
-
const s =
|
|
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];
|
|
58
60
|
return s ? Object.assign(e, s(m.value[l.model], e)) : { ...e, [l.model]: m.value[l.model] };
|
|
59
|
-
}, {})),
|
|
60
|
-
labelValue:
|
|
61
|
+
}, {})), F = u(() => v.value.map((e) => ({
|
|
62
|
+
labelValue: J.value[e.model](m.value[e.model]),
|
|
61
63
|
model: e.model,
|
|
62
64
|
label: e.label
|
|
63
|
-
})).filter((e) => e.labelValue)),
|
|
64
|
-
function
|
|
65
|
+
})).filter((e) => e.labelValue)), U = u(() => d.showLabels ?? Z.value !== null);
|
|
66
|
+
function W(e) {
|
|
65
67
|
const l = e.visible;
|
|
66
68
|
return l === void 0 ? !0 : l === !1 || typeof l == "function" && !l(m.value, e) ? !1 : !!l;
|
|
67
69
|
}
|
|
68
|
-
function
|
|
69
|
-
return
|
|
70
|
+
function X(e) {
|
|
71
|
+
return ie(e) ? e.join(", ") : ce(e) ? e.label : e;
|
|
70
72
|
}
|
|
71
|
-
async function
|
|
72
|
-
|
|
73
|
+
async function x() {
|
|
74
|
+
r.value && (r.value = !1), B("search", j.value);
|
|
73
75
|
}
|
|
74
|
-
async function
|
|
76
|
+
async function _() {
|
|
75
77
|
try {
|
|
76
|
-
await (
|
|
78
|
+
await (r.value ? L.value : z.value)?.validate(), x();
|
|
77
79
|
} catch {
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
async function P() {
|
|
81
83
|
try {
|
|
82
|
-
const e =
|
|
83
|
-
e?.resetFields(), await
|
|
84
|
-
}),
|
|
84
|
+
const e = r.value ? L.value : z.value;
|
|
85
|
+
e?.resetFields(), await w(), await e?.validate().catch(() => {
|
|
86
|
+
}), B("reset"), await w(), x();
|
|
85
87
|
} catch (e) {
|
|
86
88
|
console.error("[ZlSearch] reset validate error", e);
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
|
-
function
|
|
91
|
+
function Y(e) {
|
|
90
92
|
delete m.value[e.model];
|
|
91
93
|
}
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
return te(
|
|
95
|
+
() => v.value.map((e) => e.model).join(","),
|
|
96
|
+
async () => {
|
|
97
|
+
await w(), H();
|
|
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, [
|
|
103
|
+
g("div", fe, [
|
|
97
104
|
t(A, {
|
|
98
105
|
ref_key: "formRef",
|
|
99
|
-
ref:
|
|
106
|
+
ref: z,
|
|
100
107
|
class: "zl-search-form",
|
|
101
108
|
model: m.value,
|
|
102
|
-
items:
|
|
103
|
-
disabled:
|
|
104
|
-
onSubmit:
|
|
105
|
-
},
|
|
106
|
-
label:
|
|
107
|
-
t(
|
|
108
|
-
default:
|
|
109
|
-
|
|
109
|
+
items: v.value,
|
|
110
|
+
disabled: S.disabled,
|
|
111
|
+
onSubmit: M(_, ["prevent"])
|
|
112
|
+
}, R({
|
|
113
|
+
label: o(({ label: a }) => [
|
|
114
|
+
t(I, null, {
|
|
115
|
+
default: o(() => [
|
|
116
|
+
p(h(a), 1)
|
|
110
117
|
]),
|
|
111
118
|
_: 2
|
|
112
119
|
}, 1024)
|
|
113
120
|
]),
|
|
114
121
|
_: 2
|
|
115
122
|
}, [
|
|
116
|
-
V(
|
|
117
|
-
name:
|
|
118
|
-
fn:
|
|
119
|
-
|
|
123
|
+
V(T.value, (a) => ({
|
|
124
|
+
name: a,
|
|
125
|
+
fn: o((y) => [
|
|
126
|
+
$(e.$slots, a, N(O(y)))
|
|
120
127
|
])
|
|
121
128
|
}))
|
|
122
129
|
]), 1032, ["model", "items", "disabled"]),
|
|
123
|
-
|
|
130
|
+
g("div", he, [
|
|
124
131
|
t(s, { onClick: P }, {
|
|
125
|
-
icon:
|
|
126
|
-
t(
|
|
132
|
+
icon: o(() => [
|
|
133
|
+
t(C, { icon: "zl:brush-color" })
|
|
127
134
|
]),
|
|
128
135
|
_: 1
|
|
129
136
|
}),
|
|
130
|
-
|
|
137
|
+
i(Z) !== null ? (n(), E(s, {
|
|
131
138
|
key: 0,
|
|
132
|
-
|
|
139
|
+
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)
|
|
133
144
|
}, {
|
|
134
|
-
icon:
|
|
135
|
-
t(
|
|
145
|
+
icon: o(() => [
|
|
146
|
+
t(C, { icon: "zl:filter-color" })
|
|
136
147
|
]),
|
|
137
148
|
_: 1
|
|
138
|
-
})) :
|
|
149
|
+
}, 8, ["title", "aria-label", "aria-expanded"])) : b("", !0),
|
|
139
150
|
t(s, {
|
|
140
151
|
type: "primary",
|
|
141
|
-
onClick:
|
|
152
|
+
onClick: _
|
|
142
153
|
}, {
|
|
143
|
-
default:
|
|
144
|
-
|
|
154
|
+
default: o(() => [
|
|
155
|
+
p(h(i(c)("zl.search.search", "查询")), 1)
|
|
145
156
|
]),
|
|
146
157
|
_: 1
|
|
147
158
|
})
|
|
148
159
|
])
|
|
149
160
|
]),
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
default:
|
|
154
|
-
|
|
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 }, {
|
|
164
|
+
default: o(() => [
|
|
165
|
+
p(h(i(c)("zl.search.all", "全部")), 1)
|
|
155
166
|
]),
|
|
156
167
|
_: 1
|
|
157
|
-
})) :
|
|
158
|
-
(
|
|
159
|
-
key:
|
|
168
|
+
})) : b("", !0),
|
|
169
|
+
(n(!0), f(se, null, V(F.value, (a) => (n(), f("div", {
|
|
170
|
+
key: a.model,
|
|
160
171
|
class: "zl-search-label-item"
|
|
161
172
|
}, [
|
|
162
|
-
t(
|
|
173
|
+
t(q, {
|
|
163
174
|
closable: "",
|
|
164
175
|
fill: "",
|
|
165
176
|
color: "primary",
|
|
166
|
-
onClose: (
|
|
177
|
+
onClose: (y) => Y(a)
|
|
167
178
|
}, {
|
|
168
|
-
default:
|
|
169
|
-
|
|
179
|
+
default: o(() => [
|
|
180
|
+
p(h(a.labelValue), 1)
|
|
170
181
|
]),
|
|
171
182
|
_: 2
|
|
172
183
|
}, 1032, ["onClose"])
|
|
173
184
|
]))), 128))
|
|
174
|
-
])) :
|
|
175
|
-
t(
|
|
176
|
-
default:
|
|
177
|
-
|
|
185
|
+
])) : b("", !0),
|
|
186
|
+
t(re, { name: "zl-search-fade-slide" }, {
|
|
187
|
+
default: o(() => [
|
|
188
|
+
r.value ? (n(), f("div", be, [
|
|
178
189
|
t(A, {
|
|
179
190
|
ref_key: "multipleFormRef",
|
|
180
|
-
ref:
|
|
191
|
+
ref: L,
|
|
181
192
|
class: "zl-search-form",
|
|
182
193
|
model: m.value,
|
|
183
|
-
items:
|
|
184
|
-
disabled:
|
|
185
|
-
onSubmit:
|
|
186
|
-
},
|
|
187
|
-
label:
|
|
188
|
-
t(
|
|
189
|
-
default:
|
|
190
|
-
|
|
194
|
+
items: v.value,
|
|
195
|
+
disabled: S.disabled,
|
|
196
|
+
onSubmit: M(_, ["prevent"])
|
|
197
|
+
}, R({
|
|
198
|
+
label: o(({ label: a }) => [
|
|
199
|
+
t(I, null, {
|
|
200
|
+
default: o(() => [
|
|
201
|
+
p(h(a), 1)
|
|
191
202
|
]),
|
|
192
203
|
_: 2
|
|
193
204
|
}, 1024)
|
|
194
205
|
]),
|
|
195
206
|
_: 2
|
|
196
207
|
}, [
|
|
197
|
-
V(
|
|
198
|
-
name:
|
|
199
|
-
fn:
|
|
200
|
-
|
|
208
|
+
V(T.value, (a) => ({
|
|
209
|
+
name: a,
|
|
210
|
+
fn: o((y) => [
|
|
211
|
+
$(e.$slots, a, N(O(y)))
|
|
201
212
|
])
|
|
202
213
|
}))
|
|
203
214
|
]), 1032, ["model", "items", "disabled"]),
|
|
204
|
-
|
|
215
|
+
g("div", _e, [
|
|
205
216
|
t(s, { onClick: P }, {
|
|
206
|
-
icon:
|
|
207
|
-
t(
|
|
217
|
+
icon: o(() => [
|
|
218
|
+
t(C, { icon: "zl:brush-color" })
|
|
208
219
|
]),
|
|
209
220
|
_: 1
|
|
210
221
|
}),
|
|
211
222
|
t(s, {
|
|
212
|
-
|
|
223
|
+
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)
|
|
213
228
|
}, {
|
|
214
|
-
icon:
|
|
215
|
-
t(
|
|
229
|
+
icon: o(() => [
|
|
230
|
+
t(C, { icon: "zl:filter-color" })
|
|
216
231
|
]),
|
|
217
232
|
_: 1
|
|
218
|
-
}),
|
|
233
|
+
}, 8, ["title", "aria-label", "aria-expanded"]),
|
|
219
234
|
t(s, {
|
|
220
235
|
type: "primary",
|
|
221
|
-
onClick:
|
|
236
|
+
onClick: _
|
|
222
237
|
}, {
|
|
223
|
-
default:
|
|
224
|
-
|
|
238
|
+
default: o(() => [
|
|
239
|
+
p(h(i(c)("zl.search.search", "查询")), 1)
|
|
225
240
|
]),
|
|
226
241
|
_: 1
|
|
227
242
|
})
|
|
228
243
|
])
|
|
229
|
-
])) :
|
|
244
|
+
])) : b("", !0)
|
|
230
245
|
]),
|
|
231
246
|
_: 3
|
|
232
247
|
})
|
|
233
|
-
])) :
|
|
234
|
-
e.$slots.actions ? (
|
|
235
|
-
|
|
236
|
-
])) :
|
|
248
|
+
])) : b("", !0),
|
|
249
|
+
e.$slots.actions ? (n(), f("div", ye, [
|
|
250
|
+
$(e.$slots, "actions")
|
|
251
|
+
])) : b("", !0)
|
|
237
252
|
]);
|
|
238
253
|
};
|
|
239
254
|
}
|
|
240
255
|
});
|
|
241
256
|
export {
|
|
242
|
-
|
|
257
|
+
$e as default
|
|
243
258
|
};
|
|
244
259
|
//# sourceMappingURL=index.vue.mjs.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/** 溢出项隐藏类,见 index.vue 样式 */
|
|
3
|
+
export declare const OVERFLOW_HIDE_CLASS = "zl-search-form-item-hide";
|
|
4
|
+
/**
|
|
5
|
+
* 查询条自适应溢出检测(移植自源组件 DnSearch 的 useSearchFormOverflow)。
|
|
6
|
+
*
|
|
7
|
+
* 思路:不猜「第几项之后折叠」,而是按**容器实测宽度**算出当前一行能放几列,
|
|
8
|
+
* 记下最后一项可见项的下标 `lastVisibleIndex`;超出的项打上隐藏类(绝对定位 + 不可见,
|
|
9
|
+
* 不占位但仍在 DOM 里,所以表单校验与 model 都不受影响)。
|
|
10
|
+
*
|
|
11
|
+
* `lastVisibleIndex === null` 表示「全部塞得进一行」,此时不显示展开按钮。
|
|
12
|
+
*/
|
|
13
|
+
export declare function useSearchFormOverflow(formRef: Ref<any>, itemMinWidth?: number): {
|
|
14
|
+
lastVisibleIndex: Ref<number | null, number | null>;
|
|
15
|
+
measure: () => void;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useSearchFormOverflow.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ref as h, watch as d, onBeforeUnmount as g } from "vue";
|
|
2
|
+
const v = 240, b = 20, A = "zl-search-form-item-hide";
|
|
3
|
+
function L(c, i = v) {
|
|
4
|
+
const l = h(null);
|
|
5
|
+
let r = null;
|
|
6
|
+
function u() {
|
|
7
|
+
return c.value?.$el ?? null;
|
|
8
|
+
}
|
|
9
|
+
function f(e) {
|
|
10
|
+
return Array.from(e.querySelectorAll(":scope > .el-form-item"));
|
|
11
|
+
}
|
|
12
|
+
function m() {
|
|
13
|
+
const e = u();
|
|
14
|
+
if (!e) return null;
|
|
15
|
+
const t = f(e);
|
|
16
|
+
if (!t.length) return null;
|
|
17
|
+
const o = e.getBoundingClientRect().width, n = Number.parseFloat(getComputedStyle(e).columnGap) || b;
|
|
18
|
+
if (t.length * (i + n) - n <= o) return null;
|
|
19
|
+
const p = Math.floor((o + n) / (i + n));
|
|
20
|
+
return Math.max(0, p - 1);
|
|
21
|
+
}
|
|
22
|
+
function a() {
|
|
23
|
+
const e = u();
|
|
24
|
+
if (!e) return;
|
|
25
|
+
const t = l.value;
|
|
26
|
+
f(e).forEach((o, n) => {
|
|
27
|
+
o.classList.toggle(A, t !== null && n > t);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function s() {
|
|
31
|
+
l.value = m(), a();
|
|
32
|
+
}
|
|
33
|
+
return d(
|
|
34
|
+
c,
|
|
35
|
+
(e) => {
|
|
36
|
+
if (r?.disconnect(), !e || (s(), typeof ResizeObserver > "u")) return;
|
|
37
|
+
r = new ResizeObserver(() => s());
|
|
38
|
+
const t = u();
|
|
39
|
+
t && r.observe(t);
|
|
40
|
+
},
|
|
41
|
+
{ immediate: !0, flush: "post" }
|
|
42
|
+
), g(() => {
|
|
43
|
+
r?.disconnect(), r = null;
|
|
44
|
+
}), { lastVisibleIndex: l, measure: s };
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
A as OVERFLOW_HIDE_CLASS,
|
|
48
|
+
L as useSearchFormOverflow
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=useSearchFormOverflow.mjs.map
|