@zl-ui-kit/components 0.7.2 → 0.8.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,12 +1,12 @@
1
- import { defineComponent as Z, useSlots as j, ref as x, computed as l, watch as K, resolveDirective as M, withDirectives as V, openBlock as u, createElementBlock as q, normalizeStyle as F, createBlock as p, createSlots as L, withCtx as P, renderSlot as h, renderList as S, normalizeProps as G, guardReactiveProps as H, createCommentVNode as k, createElementVNode as z, Fragment as J, mergeProps as $, unref as g } from "vue";
2
- import { usePageableRequest as Q } from "@zl-ui-kit/composables";
3
- import { isArray as w } from "@zl-ui-kit/utils";
4
- import T from "../ZlEmpty/index.vue.mjs";
5
- import U from "../ZlPagination/index.vue.mjs";
6
- import X from "../ZlSearch/index.vue.mjs";
1
+ import { defineComponent as M, useSlots as V, ref as _, computed as u, watch as x, resolveDirective as F, withDirectives as L, openBlock as m, createElementBlock as P, normalizeStyle as G, createBlock as v, createSlots as H, withCtx as S, renderSlot as h, renderList as k, normalizeProps as J, guardReactiveProps as Q, createCommentVNode as q, createElementVNode as z, Fragment as T, mergeProps as $, unref as g } from "vue";
2
+ import { usePageableRequest as U } from "@zl-ui-kit/composables";
3
+ import { isArray as D } from "@zl-ui-kit/utils";
4
+ import X from "../ZlEmpty/index.vue.mjs";
5
+ import Y from "../ZlPagination/index.vue.mjs";
6
+ import ee from "../ZlSearch/index.vue.mjs";
7
7
  import '../ZlSearch/index.css';/* empty css */
8
- import { usePagination as Y } from "../ZlPagination/usePagination.mjs";
9
- const ee = { class: "zl-card-page__content" }, te = { class: "zl-card-page__list" }, D = "search-", ce = /* @__PURE__ */ Z({
8
+ import { usePagination as te } from "../ZlPagination/usePagination.mjs";
9
+ const ae = { class: "zl-card-page__content" }, re = { class: "zl-card-page__list" }, b = "search-", de = /* @__PURE__ */ M({
10
10
  name: "ZlCardPage",
11
11
  __name: "index",
12
12
  props: {
@@ -18,123 +18,117 @@ const ee = { class: "zl-card-page__content" }, te = { class: "zl-card-page__list
18
18
  cardMinWidth: {}
19
19
  },
20
20
  emits: ["search-reset"],
21
- setup(s, { expose: B, emit: C }) {
22
- const r = s, R = C, E = j(), c = x(null), v = l(() => {
21
+ setup(r, { expose: R, emit: w }) {
22
+ const i = r, B = w, C = V(), E = _(null), f = u(() => {
23
+ const e = i.request;
24
+ if (e && typeof e == "object" && "run" in e && "data" in e && !("service" in e))
25
+ return {
26
+ instance: e,
27
+ service: () => Promise.resolve([]),
28
+ options: { manual: !0, initialData: [] }
29
+ };
23
30
  const t = { manual: !0, initialData: [] };
24
- if (typeof r.request == "function")
25
- return { service: r.request, options: t };
26
- const {
27
- refreshDeps: e,
28
- refreshDepsAction: o,
29
- ...a
30
- } = r.request.options ?? {};
31
+ if (typeof e == "function")
32
+ return { instance: null, service: e, options: t };
33
+ const { refreshDeps: n, refreshDepsAction: a, ...c } = e.options ?? {};
31
34
  return {
32
- ...r.request,
35
+ instance: null,
36
+ service: e.service,
33
37
  options: {
38
+ ...c,
34
39
  ...t,
35
- ...a,
36
- manual: !0,
37
- ...e ? { refreshDeps: e, refreshDepsAction: o ?? (() => i()) } : {}
40
+ ...n ? { refreshDeps: n, refreshDepsAction: a ?? (() => l()) } : {}
38
41
  }
39
42
  };
40
- }), {
41
- loading: I,
42
- data: n,
43
- run: N,
44
- params: _,
45
- refresh: b
46
- } = Q(v.value.service, v.value.options), A = l(() => _.value?.[0]), O = l(() => {
47
- if (w(n.value))
48
- return r.pagination && { total: n.value.length, ...r.pagination };
43
+ }), o = U(f.value.service, f.value.options), I = f.value.instance ?? {
44
+ loading: o.loading,
45
+ data: o.data,
46
+ run: o.run,
47
+ params: o.params,
48
+ refresh: o.refresh
49
+ }, { loading: N, data: s, run: O, params: j, refresh: A } = I, W = u(() => j.value?.[0]), Z = u(() => {
50
+ if (D(s.value))
51
+ return i.pagination && { total: s.value.length, ...i.pagination };
49
52
  {
50
- const { pageNum: t, pageSize: e, total: o = 0 } = n.value;
51
- return { pageNum: t, pageSize: e, total: o };
53
+ const { pageNum: e, pageSize: t, total: n = 0 } = s.value;
54
+ return { pageNum: e, pageSize: t, total: n };
52
55
  }
53
- }), m = Y(() => O.value ?? !1), y = l(
54
- () => w(n.value) ? n.value : n.value?.rows ?? []
55
- ), W = l(() => {
56
- const t = [];
57
- return Object.keys(E).forEach((e) => {
58
- e.startsWith(D) && e !== "search-actions" && t.push(e.slice(D.length));
59
- }), t;
56
+ }), d = te(() => Z.value ?? !1), y = u(
57
+ () => D(s.value) ? s.value : s.value?.rows ?? []
58
+ ), K = u(() => {
59
+ const e = [];
60
+ return Object.keys(C).forEach((t) => {
61
+ t.startsWith(b) && t !== "search-actions" && e.push(t.slice(b.length));
62
+ }), e;
60
63
  });
61
- let d;
62
- function i(t, e = {
64
+ let p;
65
+ function l(e, t = {
63
66
  pageNum: 1,
64
- pageSize: m.value !== !1 ? m.value.pageSize : 30
67
+ pageSize: d.value !== !1 ? d.value.pageSize : 30
65
68
  }) {
66
- d = {
67
- ...d,
68
- ...t,
69
- ...e
70
- }, N(d);
69
+ p = {
70
+ ...p,
71
+ ...e,
72
+ ...t
73
+ }, O(p);
71
74
  }
72
- return K(
73
- () => r.immediate,
74
- (t) => {
75
- t && !r.queryItems.length && i();
75
+ return x(
76
+ () => i.immediate,
77
+ (e) => {
78
+ e && !i.queryItems.length && l();
76
79
  },
77
80
  { immediate: !0, once: !0 }
78
- ), B({
79
- refresh: b,
80
- params: A,
81
- search: new Proxy(
82
- {},
83
- {
84
- get(t, e) {
85
- return !c.value && e === "search" ? i : c.value?.[e];
86
- },
87
- has(t, e) {
88
- return e in (c.value ?? {});
89
- }
90
- }
91
- )
92
- }), (t, e) => {
93
- const o = M("loading");
94
- return V((u(), q("div", {
81
+ ), R({
82
+ refresh: A,
83
+ params: W,
84
+ /** 重新查询并回到第 1 页;消费方可在 useRequest 的 refreshDepsAction 里调用 */
85
+ search: l
86
+ }), (e, t) => {
87
+ const n = F("loading");
88
+ return L((m(), P("div", {
95
89
  class: "zl-card-page",
96
- style: F({ "--card-min-width": s.cardMinWidth })
90
+ style: G({ "--card-min-width": r.cardMinWidth })
97
91
  }, [
98
- s.queryItems.length || t.$slots["search-actions"] ? (u(), p(X, {
92
+ r.queryItems.length || e.$slots["search-actions"] ? (m(), v(ee, {
99
93
  key: 0,
100
94
  ref_key: "searchRef",
101
- ref: c,
102
- items: s.queryItems,
103
- immediate: s.immediate,
104
- onSearch: i,
105
- onReset: e[0] || (e[0] = (a) => R("search-reset"))
106
- }, L({ _: 2 }, [
107
- t.$slots["search-actions"] ? {
95
+ ref: E,
96
+ items: r.queryItems,
97
+ immediate: r.immediate,
98
+ onSearch: l,
99
+ onReset: t[0] || (t[0] = (a) => B("search-reset"))
100
+ }, H({ _: 2 }, [
101
+ e.$slots["search-actions"] ? {
108
102
  name: "actions",
109
- fn: P(() => [
110
- h(t.$slots, "search-actions")
103
+ fn: S(() => [
104
+ h(e.$slots, "search-actions")
111
105
  ]),
112
106
  key: "0"
113
107
  } : void 0,
114
- S(W.value, (a) => ({
108
+ k(K.value, (a) => ({
115
109
  name: a,
116
- fn: P((f) => [
117
- h(t.$slots, `search-${a}`, G(H(f)))
110
+ fn: S((c) => [
111
+ h(e.$slots, `search-${a}`, J(Q(c)))
118
112
  ])
119
113
  }))
120
- ]), 1032, ["items", "immediate"])) : k("", !0),
121
- z("div", ee, [
122
- z("div", te, [
123
- y.value.length ? (u(!0), q(J, { key: 0 }, S(y.value, (a, f) => h(t.$slots, "default", $({
124
- key: a[s.itemKey] || f
125
- }, { ref_for: !0 }, { data: a }))), 128)) : (u(), p(T, { key: 1 }))
114
+ ]), 1032, ["items", "immediate"])) : q("", !0),
115
+ z("div", ae, [
116
+ z("div", re, [
117
+ y.value.length ? (m(!0), P(T, { key: 0 }, k(y.value, (a, c) => h(e.$slots, "default", $({
118
+ key: a[r.itemKey] || c
119
+ }, { ref_for: !0 }, { data: a }))), 128)) : (m(), v(X, { key: 1 }))
126
120
  ])
127
121
  ]),
128
- s.pagination && g(m) !== !1 ? (u(), p(U, $({ key: 1 }, g(m), {
129
- onChange: e[1] || (e[1] = (a) => i(void 0, a))
130
- }), null, 16)) : k("", !0)
122
+ r.pagination && g(d) !== !1 ? (m(), v(Y, $({ key: 1 }, g(d), {
123
+ onChange: t[1] || (t[1] = (a) => l(void 0, a))
124
+ }), null, 16)) : q("", !0)
131
125
  ], 4)), [
132
- [o, g(I)]
126
+ [n, g(N)]
133
127
  ]);
134
128
  };
135
129
  }
136
130
  });
137
131
  export {
138
- ce as default
132
+ de as default
139
133
  };
140
134
  //# sourceMappingURL=index.vue.mjs.map
@@ -7,10 +7,15 @@ type __VLS_Props = {
7
7
  corner?: boolean | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
8
8
  value?: string;
9
9
  simple?: boolean;
10
+ /** 是否展示字典项图标(默认 true) */
11
+ iconVisible?: boolean;
12
+ /** @deprecated 用 `iconVisible`:全库显隐统一用 visible 语义,且不要用反向命名 */
10
13
  hideIcon?: boolean;
11
14
  };
12
15
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
13
16
  corner: boolean | "top-left" | "top-right" | "bottom-left" | "bottom-right";
17
+ iconVisible: boolean;
18
+ hideIcon: boolean;
14
19
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
15
20
  export default _default;
16
21
  //# sourceMappingURL=index.vue.d.ts.map
@@ -1,10 +1,10 @@
1
- import { defineComponent as f, watch as y, computed as r, openBlock as n, createBlock as s, mergeProps as u, withCtx as d, createTextVNode as p, toDisplayString as m } from "vue";
1
+ import { defineComponent as f, watch as y, computed as l, openBlock as n, createBlock as s, mergeProps as u, withCtx as d, createTextVNode as p, toDisplayString as m } from "vue";
2
2
  import { useDict as g, useDictStore as h } from "@zl-ui-kit/composables";
3
- import _ from "../ZlTag/ZlCornerTag.vue.mjs";
3
+ import B from "../ZlTag/ZlCornerTag.vue.mjs";
4
4
  import '../ZlTag/index.css';import '../ZlTag/ZlCornerTag.css';/* empty css */
5
- import B from "../ZlTag/index.vue.mjs";
5
+ import _ from "../ZlTag/index.vue.mjs";
6
6
  /* empty css */
7
- const b = /* @__PURE__ */ f({
7
+ const K = /* @__PURE__ */ f({
8
8
  name: "ZlDictTag",
9
9
  __name: "index",
10
10
  props: {
@@ -13,44 +13,45 @@ const b = /* @__PURE__ */ f({
13
13
  corner: { type: [Boolean, String], default: !1 },
14
14
  value: {},
15
15
  simple: { type: Boolean },
16
- hideIcon: { type: Boolean }
16
+ iconVisible: { type: Boolean, default: void 0 },
17
+ hideIcon: { type: Boolean, default: void 0 }
17
18
  },
18
- setup(a) {
19
- const e = a, v = g(e.dictKey, { data: e.dict });
19
+ setup(i) {
20
+ const e = i, v = g(e.dictKey, { data: e.dict });
20
21
  y(
21
22
  () => e.dict,
22
23
  (t) => {
23
24
  if (t?.length) {
24
- const { dictStore: i } = h();
25
- i.value = { ...i.value, [e.dictKey]: t };
25
+ const { dictStore: a } = h();
26
+ a.value = { ...a.value, [e.dictKey]: t };
26
27
  }
27
28
  },
28
29
  { deep: !1 }
29
30
  );
30
- const o = r(() => v.value.find((t) => t.value === e.value)), c = r(() => o.value ? {
31
+ const o = l(() => v.value.find((t) => t.value === e.value)), r = l(() => o.value ? {
31
32
  color: e.simple ? void 0 : o.value.color,
32
- icon: e.hideIcon ? void 0 : o.value.icon
33
- } : {}), l = r(() => e.corner === !0 ? "top-right" : e.corner);
34
- return (t, i) => l.value ? (n(), s(_, u({
33
+ icon: e.iconVisible ?? !e.hideIcon ? o.value.icon : void 0
34
+ } : {}), c = l(() => e.corner === !0 ? "top-right" : e.corner);
35
+ return (t, a) => c.value ? (n(), s(B, u({
35
36
  key: 0,
36
37
  class: "zl-dict-corner-tag"
37
- }, { ...c.value, ...t.$attrs }, { position: l.value }), {
38
+ }, { ...r.value, ...t.$attrs }, { position: c.value }), {
38
39
  default: d(() => [
39
- p(m(o.value?.label || a.value), 1)
40
+ p(m(o.value?.label || i.value), 1)
40
41
  ]),
41
42
  _: 1
42
- }, 16, ["position"])) : (n(), s(B, u({
43
+ }, 16, ["position"])) : (n(), s(_, u({
43
44
  key: 1,
44
45
  class: "zl-dict-tag"
45
- }, { ...c.value, ...t.$attrs }), {
46
+ }, { ...r.value, ...t.$attrs }), {
46
47
  default: d(() => [
47
- p(m(o.value?.label || a.value), 1)
48
+ p(m(o.value?.label || i.value), 1)
48
49
  ]),
49
50
  _: 1
50
51
  }, 16));
51
52
  }
52
53
  });
53
54
  export {
54
- b as default
55
+ K as default
55
56
  };
56
57
  //# sourceMappingURL=index.vue.mjs.map
@@ -1 +1 @@
1
- @charset "UTF-8";.zl-pagination[data-v-5eee61b9]{padding:6px 16px;background-color:var(--zl-fill-1, #f9fbfd);justify-content:var(--zl-pagination-justify, flex-end)}.zl-pagination--left[data-v-5eee61b9]{--zl-pagination-justify: flex-start}.zl-pagination--center[data-v-5eee61b9]{--zl-pagination-justify: center}.zl-pagination--right[data-v-5eee61b9]{--zl-pagination-justify: flex-end}
1
+ @charset "UTF-8";.zl-pagination[data-v-fd07517c]{padding:6px 16px;background-color:var(--zl-fill-1, #f9fbfd);justify-content:var(--zl-pagination-justify, flex-end)}.zl-pagination--left[data-v-fd07517c]{--zl-pagination-justify: flex-start}.zl-pagination--center[data-v-fd07517c]{--zl-pagination-justify: center}.zl-pagination--right[data-v-fd07517c]{--zl-pagination-justify: flex-end}
@@ -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 i = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5eee61b9"]]);
4
+ const i = /* @__PURE__ */ t(o, [["__scopeId", "data-v-fd07517c"]]);
5
5
  export {
6
6
  i as default
7
7
  };
@@ -4,7 +4,13 @@ export interface PaginationProps {
4
4
  pageNum?: number;
5
5
  pageSize?: number;
6
6
  pageSizeOptions?: number[];
7
+ /** 是否展示总数(默认 true) */
8
+ totalVisible?: boolean;
9
+ /** 是否展示每页条数选择器(默认 true) */
10
+ pageSizeVisible?: boolean;
11
+ /** @deprecated 用 `totalVisible`(全库显隐统一用 visible 语义) */
7
12
  showTotal?: boolean;
13
+ /** @deprecated 用 `pageSizeVisible`(全库显隐统一用 visible 语义) */
8
14
  showPageSize?: boolean;
9
15
  simple?: boolean;
10
16
  [key: string]: any;
@@ -1,39 +1,42 @@
1
- import { computed as f, toValue as m } from "vue";
2
- function h(a) {
3
- return f(() => {
4
- const o = m(a);
1
+ import { computed as S, toValue as h } from "vue";
2
+ function P(s) {
3
+ return S(() => {
4
+ const o = h(s);
5
5
  if (o === !1)
6
6
  return !1;
7
7
  const {
8
- pageSizeOptions: i = [10, 30, 50],
8
+ pageSizeOptions: a = [10, 30, 50],
9
9
  pageSize: t = 30,
10
10
  pageNum: n = 1,
11
- simple: s = !0,
12
- showTotal: r = !0,
13
- showPageSize: p,
14
- ...u
15
- } = o || {}, e = i.slice();
11
+ simple: i = !0,
12
+ totalVisible: r,
13
+ pageSizeVisible: l,
14
+ // 旧名回落:新名优先,两者都没给才用默认值
15
+ showTotal: p,
16
+ showPageSize: u,
17
+ ...g
18
+ } = o || {}, c = r ?? p ?? !0, e = a.slice();
16
19
  e.includes(t) || e.push(t);
17
- const l = [
18
- r ? "total" : "",
19
- p ?? e.length > 0 ? "sizes" : "",
20
+ const f = [
21
+ c ? "total" : "",
22
+ l ?? u ?? e.length > 0 ? "sizes" : "",
20
23
  "prev",
21
24
  "pager",
22
25
  "next",
23
- s ? "" : "jumper"
26
+ i ? "" : "jumper"
24
27
  ].filter(Boolean).join(", ");
25
28
  return {
26
29
  // EP 2.7+ 官方推荐 size(原 arco simple/mini 语义映射为小尺寸)
27
- size: s ? "small" : "default",
28
- ...u,
29
- layout: l,
30
+ size: i ? "small" : "default",
31
+ ...g,
32
+ layout: f,
30
33
  currentPage: n,
31
34
  pageSize: t,
32
- pageSizes: e.sort((g, c) => g - c)
35
+ pageSizes: e.sort((z, m) => z - m)
33
36
  };
34
37
  });
35
38
  }
36
39
  export {
37
- h as usePagination
40
+ P as usePagination
38
41
  };
39
42
  //# sourceMappingURL=usePagination.mjs.map
@@ -13,6 +13,8 @@ type __VLS_Props = {
13
13
  /** 禁用全部查询项 */
14
14
  disabled?: boolean;
15
15
  /** 是否展示「筛选条件」标签行;不传时按「是否发生溢出」自动判定 */
16
+ labelsVisible?: boolean;
17
+ /** @deprecated 用 `labelsVisible`(全库显隐统一用 visible 语义) */
16
18
  showLabels?: boolean;
17
19
  };
18
20
  declare function search(): Promise<void>;
@@ -239,6 +241,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
239
241
  immediate: boolean;
240
242
  disabled: boolean;
241
243
  items: SearchItem[];
244
+ labelsVisible: boolean;
242
245
  showLabels: boolean;
243
246
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
244
247
  formRef: ({