@done-coding/admin-core 0.15.0 → 0.15.1-alpha.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.
Files changed (33) hide show
  1. package/es/components/app-layout/AppBody.vue.mjs +2 -2
  2. package/es/components/app-layout/AppBody.vue2.mjs +47 -44
  3. package/es/components/app-layout/AppPage.vue.mjs +1 -1
  4. package/es/components/app-layout/AppPage.vue2.mjs +146 -90
  5. package/es/components/app-layout/app-page-geometry.mjs +42 -15
  6. package/es/components/display/TabsMain.vue.mjs +114 -59
  7. package/es/components/display/TabsTile.vue.mjs +7 -0
  8. package/es/components/display/TabsTile.vue2.mjs +182 -0
  9. package/es/components/display/use-tabs-query-sync.mjs +26 -0
  10. package/es/components/form/FormSearch.vue.mjs +2 -2
  11. package/es/components/form/FormSearch.vue2.mjs +84 -75
  12. package/es/components/form/form-search-utils.mjs +58 -29
  13. package/es/components/panel/PanelMain.vue.mjs +1 -1
  14. package/es/components/panel/PanelMain.vue2.mjs +15 -15
  15. package/es/hooks/use-channel-viewport-height.mjs +1 -4
  16. package/es/hooks/use-theme-apply.mjs +65 -54
  17. package/es/index.mjs +203 -196
  18. package/es/inject/key.mjs +19 -13
  19. package/es/store/app.mjs +77 -68
  20. package/es/style.css +1 -1
  21. package/es/utils/dom.mjs +12 -0
  22. package/package.json +2 -2
  23. package/types/components/app-layout/app-page-geometry.d.ts +15 -0
  24. package/types/components/display/TabsTile.vue.d.ts +208 -0
  25. package/types/components/display/types.d.ts +7 -0
  26. package/types/components/display/use-tabs-query-sync.d.ts +16 -0
  27. package/types/components/form/form-search-utils.d.ts +13 -6
  28. package/types/components/modal/ConfirmModal.vue.d.ts +1 -1
  29. package/types/inject/key.d.ts +13 -1
  30. package/types/injectInfo.json.d.ts +1 -1
  31. package/types/store/app.d.ts +19 -1
  32. package/types/utils/dom.d.ts +1 -0
  33. package/types/utils/index.d.ts +1 -0
@@ -1,11 +1,15 @@
1
- import { defineComponent as c, inject as N, toRefs as R, useModel as T, useSlots as A, ref as P, computed as f, h as $, provide as x, watch as E, openBlock as o, createBlock as l, resolveDynamicComponent as q, mergeProps as I, withCtx as s, KeepAlive as U, unref as i, createCommentVNode as j, createVNode as z, createSlots as D, renderList as F, renderSlot as G, normalizeProps as J, guardReactiveProps as O, createElementVNode as Q, mergeModels as W } from "vue";
2
- import X from "./TabsRefineFlow.vue.mjs";
3
- import Y from "./TabsNaturalFlow.vue.mjs";
4
- import Z from "./TabsHeader.vue.mjs";
5
- import { TABS_MAIN_VISUAL_LEVEL as h } from "../../inject/key.mjs";
6
- const oe = /* @__PURE__ */ c({
1
+ import { defineComponent as K, inject as O, toRefs as j, useModel as x, useSlots as z, ref as D, computed as T, h as G, provide as J, watch as W, unref as a, openBlock as u, createBlock as v, createSlots as C, renderList as m, withCtx as s, renderSlot as d, normalizeProps as f, guardReactiveProps as c, resolveDynamicComponent as X, mergeProps as Y, KeepAlive as Z, createCommentVNode as ee, createVNode as te, createElementVNode as ae, mergeModels as ne } from "vue";
2
+ import { useRoute as oe, useRouter as re } from "vue-router";
3
+ import ie from "./TabsRefineFlow.vue.mjs";
4
+ import le from "./TabsNaturalFlow.vue.mjs";
5
+ import se from "./TabsHeader.vue.mjs";
6
+ import ue from "./TabsTile.vue.mjs";
7
+ import { watchTabToQuery as ve, getTabQuery as pe } from "./use-tabs-query-sync.mjs";
8
+ import { TABS_MAIN_VISUAL_LEVEL as q } from "../../inject/key.mjs";
9
+ import { useActivated as me } from "../../hooks/activated.mjs";
10
+ const He = /* @__PURE__ */ K({
7
11
  __name: "TabsMain",
8
- props: /* @__PURE__ */ W({
12
+ props: /* @__PURE__ */ ne({
9
13
  tabs: {},
10
14
  viewportHeight: {},
11
15
  minHeight: { default: 100 },
@@ -14,84 +18,135 @@ const oe = /* @__PURE__ */ c({
14
18
  padding: {},
15
19
  refine: { type: Boolean, default: !1 },
16
20
  refineReduceHeight: { default: 0 },
17
- variant: {}
21
+ variant: {},
22
+ queryKey: {},
23
+ tile: { type: Boolean },
24
+ navPosition: {},
25
+ navMode: {},
26
+ navOffset: {}
18
27
  }, {
19
28
  modelValue: {},
20
29
  modelModifiers: {}
21
30
  }),
22
31
  emits: ["update:modelValue"],
23
- setup(u) {
24
- const r = u, p = N(h, 0) + 1, {
32
+ setup(y) {
33
+ const r = y, h = O(q, 0) + 1, {
25
34
  viewportHeight: g,
26
- minHeight: y,
27
- channel: H,
28
- parentChannel: b,
29
- padding: w,
30
- refine: v,
31
- refineReduceHeight: V,
32
- variant: k,
33
- tabs: d
34
- } = R(r), n = T(u, "modelValue"), C = A(), m = P(void 0), _ = f(
35
- () => v.value ? X : Y
36
- ), L = f(
37
- () => v.value ? {
35
+ minHeight: b,
36
+ channel: M,
37
+ parentChannel: k,
38
+ padding: R,
39
+ refine: p,
40
+ refineReduceHeight: $,
41
+ variant: L,
42
+ tabs: i,
43
+ tile: A,
44
+ navPosition: B,
45
+ navMode: P,
46
+ navOffset: S
47
+ } = j(r), o = x(y, "modelValue"), w = oe(), N = re();
48
+ let V = !1;
49
+ me((n) => {
50
+ if (!n.isActivated) return;
51
+ const t = r.queryKey ? pe(w, r.queryKey) : void 0;
52
+ t && (o.value = t), V = !0;
53
+ }), ve({
54
+ model: o,
55
+ route: w,
56
+ router: N,
57
+ queryKey: () => r.queryKey,
58
+ ready: () => V
59
+ });
60
+ const _ = z(), H = D(void 0), E = T(
61
+ () => p.value ? ie : le
62
+ ), Q = T(
63
+ () => p.value ? {
38
64
  viewportHeight: g.value,
39
- minHeight: y.value,
40
- channel: H.value,
41
- parentChannel: b.value,
42
- padding: w.value,
43
- refineReduceHeight: V.value
65
+ minHeight: b.value,
66
+ channel: M.value,
67
+ parentChannel: k.value,
68
+ padding: R.value,
69
+ refineReduceHeight: $.value
44
70
  } : {}
45
- ), K = (t) => r.tabs.find((e) => e.key === t), M = (t) => {
46
- m.value = t;
47
- }, S = c({
71
+ ), U = (n) => r.tabs.find((t) => t.key === n), F = (n) => {
72
+ H.value = n;
73
+ }, I = K({
48
74
  name: "TabsMainPane",
49
75
  props: {
50
76
  paneKey: { type: String, required: !0 },
51
77
  viewportHeight: { type: Number, required: !1 }
52
78
  },
53
- setup(t) {
79
+ setup(n) {
54
80
  return () => {
55
- const e = C[t.paneKey], a = K(t.paneKey);
56
- return e ? e({
57
- tab: a,
81
+ const t = _[n.paneKey], e = U(n.paneKey);
82
+ return t ? t({
83
+ tab: e,
58
84
  active: !0,
59
- viewportHeight: t.viewportHeight
60
- }) : a != null && a.component ? $(a.component) : null;
85
+ viewportHeight: n.viewportHeight
86
+ }) : e != null && e.component ? G(e.component) : null;
61
87
  };
62
88
  }
63
89
  });
64
- return x(h, p), E(
65
- [n, () => r.tabs],
90
+ return J(q, h), W(
91
+ [o, () => r.tabs],
66
92
  () => {
67
- !(!!n.value && r.tabs.some((e) => e.key === n.value)) && r.tabs.length && (n.value = r.tabs[0].key);
93
+ !(!!o.value && r.tabs.some((t) => t.key === o.value)) && r.tabs.length && (o.value = r.tabs[0].key);
68
94
  },
69
95
  { immediate: !0 }
70
- ), (t, e) => (o(), l(q(_.value), I({ class: "dc-tabs-main" }, L.value, { onViewportHeightChange: M }), {
96
+ ), (n, t) => a(A) ? (u(), v(ue, {
97
+ key: 0,
98
+ modelValue: o.value,
99
+ "onUpdate:modelValue": t[0] || (t[0] = (e) => o.value = e),
100
+ class: "dc-tabs-main",
101
+ tabs: a(i),
102
+ refine: a(p),
103
+ "viewport-height": a(g),
104
+ "min-height": a(b),
105
+ "parent-channel": a(k),
106
+ "nav-position": a(B),
107
+ "nav-mode": a(P),
108
+ "nav-offset": a(S)
109
+ }, C({ _: 2 }, [
110
+ m(a(i), (e) => ({
111
+ name: e.key,
112
+ fn: s((l) => [
113
+ d(n.$slots, e.key, f(c(l)))
114
+ ])
115
+ })),
116
+ m(a(i), (e) => ({
117
+ name: `header-${e.key}`,
118
+ fn: s((l) => [
119
+ d(n.$slots, `header-${e.key}`, f(c(l)))
120
+ ])
121
+ }))
122
+ ]), 1032, ["modelValue", "tabs", "refine", "viewport-height", "min-height", "parent-channel", "nav-position", "nav-mode", "nav-offset"])) : (u(), v(X(E.value), Y({
123
+ key: 1,
124
+ class: "dc-tabs-main"
125
+ }, Q.value, { onViewportHeightChange: F }), {
71
126
  header: s(() => [
72
- z(Z, {
73
- "active-key": n.value,
74
- "onUpdate:activeKey": e[0] || (e[0] = (a) => n.value = a),
75
- tabs: i(d),
76
- level: p,
77
- variant: i(k)
78
- }, D({ _: 2 }, [
79
- F(i(d), (a) => ({
80
- name: a.key,
81
- fn: s((B) => [
82
- G(t.$slots, `header-${a.key}`, J(O(B)))
127
+ te(se, {
128
+ "active-key": o.value,
129
+ "onUpdate:activeKey": t[1] || (t[1] = (e) => o.value = e),
130
+ tabs: a(i),
131
+ level: h,
132
+ variant: a(L)
133
+ }, C({ _: 2 }, [
134
+ m(a(i), (e) => ({
135
+ name: e.key,
136
+ fn: s((l) => [
137
+ d(n.$slots, `header-${e.key}`, f(c(l)))
83
138
  ])
84
139
  }))
85
140
  ]), 1032, ["active-key", "tabs", "variant"]),
86
- e[1] || (e[1] = Q("div", { style: { height: "8px" } }, null, -1))
141
+ t[2] || (t[2] = ae("div", { style: { height: "8px" } }, null, -1))
87
142
  ]),
88
143
  default: s(() => [
89
- (o(), l(U, null, [
90
- n.value ? (o(), l(i(S), {
91
- key: n.value,
92
- "pane-key": n.value,
93
- "viewport-height": m.value
94
- }, null, 8, ["pane-key", "viewport-height"])) : j("", !0)
144
+ (u(), v(Z, null, [
145
+ o.value ? (u(), v(a(I), {
146
+ key: o.value,
147
+ "pane-key": o.value,
148
+ "viewport-height": H.value
149
+ }, null, 8, ["pane-key", "viewport-height"])) : ee("", !0)
95
150
  ], 1024))
96
151
  ]),
97
152
  _: 3
@@ -99,5 +154,5 @@ const oe = /* @__PURE__ */ c({
99
154
  }
100
155
  });
101
156
  export {
102
- oe as default
157
+ He as default
103
158
  };
@@ -0,0 +1,7 @@
1
+ import o from "./TabsTile.vue2.mjs";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-39fad9e5"]]);
5
+ export {
6
+ f as default
7
+ };
@@ -0,0 +1,182 @@
1
+ import { defineComponent as Q, toRefs as U, useModel as X, ref as _, computed as r, inject as Y, watch as C, onMounted as Z, nextTick as M, openBlock as a, createElementBlock as d, normalizeClass as ee, createElementVNode as N, normalizeStyle as V, Fragment as H, renderList as P, unref as c, createVNode as B, withCtx as $, renderSlot as F, createBlock as I, resolveDynamicComponent as te, createCommentVNode as oe, createTextVNode as ne, toDisplayString as le, withModifiers as re, mergeModels as se } from "vue";
2
+ import { ElCard as ae, ElAnchor as ie, ElAnchorLink as ce } from "element-plus";
3
+ import ue from "../slot-layout/SlotLayoutTemplate.vue.mjs";
4
+ import { getId as fe } from "../../utils/id.mjs";
5
+ import { APP_PAGE_CONTENT_INSET as de } from "../../inject/key.mjs";
6
+ import { useChannelViewportHeight as me } from "../../hooks/use-channel-viewport-height.mjs";
7
+ import { useActivated as ve } from "../../hooks/activated.mjs";
8
+ import { domClosestScrollableAncestor as he } from "../../utils/dom.mjs";
9
+ const pe = ["id", "data-tab-key"], Ae = /* @__PURE__ */ Q({
10
+ __name: "TabsTile",
11
+ props: /* @__PURE__ */ se({
12
+ tabs: {},
13
+ refine: { type: Boolean, default: !1 },
14
+ viewportHeight: {},
15
+ minHeight: { default: 100 },
16
+ parentChannel: {},
17
+ navPosition: { default: "bottom-right" },
18
+ navMode: { default: "auto" },
19
+ navOffset: { default: 12 }
20
+ }, {
21
+ modelValue: {},
22
+ modelModifiers: {}
23
+ }),
24
+ emits: ["update:modelValue"],
25
+ setup(A) {
26
+ const n = A, { tabs: S } = U(n), s = X(A, "modelValue"), m = _(), v = _();
27
+ let h = !1, p = !1;
28
+ const O = fe(`dc-tt-${Math.random().toString(36).slice(2, 7)}`), u = (e) => `${O}-p${e}`, D = r(() => {
29
+ const e = /* @__PURE__ */ new Map();
30
+ return n.tabs.forEach((o, t) => e.set(`#${u(t)}`, o.key)), e;
31
+ }), b = r(() => {
32
+ const e = /* @__PURE__ */ new Map();
33
+ return n.tabs.forEach((o, t) => e.set(o.key, `#${u(t)}`)), e;
34
+ }), f = Y(de, void 0), { viewportHeightFinal: L } = me(n), z = r(
35
+ () => Math.max(L.value, n.minHeight)
36
+ ), W = r(() => {
37
+ const e = {};
38
+ return n.refine ? { height: `${z.value}px`, overflow: "auto" } : e;
39
+ }), y = _(), j = () => {
40
+ y.value = he(
41
+ m.value
42
+ );
43
+ }, G = r(
44
+ () => n.refine ? m.value : y.value
45
+ ), w = r(
46
+ () => n.refine || y.value ? 0 : (f == null ? void 0 : f.value.top) ?? 0
47
+ ), E = r(
48
+ () => n.navMode === "auto" ? n.refine ? "absolute" : "sticky" : n.navMode
49
+ ), K = r(() => `dc-tabs-tile--nav-${E.value}`), q = r(() => {
50
+ const e = `${n.navOffset}px`, o = n.navPosition.startsWith("top"), t = n.navPosition.endsWith("left"), l = E.value;
51
+ return l === "sticky" ? {
52
+ position: "sticky",
53
+ [o ? "top" : "bottom"]: e,
54
+ alignSelf: t ? "flex-start" : "flex-end",
55
+ order: o ? -1 : 1
56
+ } : {
57
+ position: l,
58
+ [o ? "top" : "bottom"]: e,
59
+ [t ? "left" : "right"]: e
60
+ };
61
+ }), J = (e) => {
62
+ const o = D.value.get(e);
63
+ !o || o === s.value || (h = !0, s.value = o);
64
+ };
65
+ C(
66
+ s,
67
+ (e) => {
68
+ var l;
69
+ const o = h;
70
+ if (h = !1, !p || !e || o) return;
71
+ const t = b.value.get(e);
72
+ t && ((l = v.value) == null || l.scrollTo(t));
73
+ },
74
+ { flush: "post" }
75
+ );
76
+ let k = !1;
77
+ const g = () => {
78
+ var e, o;
79
+ if (!k && n.tabs.length && (k = !0, s.value && s.value !== ((e = n.tabs[0]) == null ? void 0 : e.key))) {
80
+ const t = b.value.get(s.value);
81
+ t && ((o = v.value) == null || o.scrollTo(t));
82
+ }
83
+ };
84
+ C(
85
+ () => n.tabs.length,
86
+ (e, o) => {
87
+ !e || o || !p || k || M(g);
88
+ },
89
+ { flush: "post" }
90
+ );
91
+ let T, R, i;
92
+ const x = () => {
93
+ clearTimeout(T), clearTimeout(R), i == null || i(), i = void 0;
94
+ };
95
+ return ve((e) => {
96
+ if (!e.isActivated) {
97
+ x();
98
+ return;
99
+ }
100
+ j();
101
+ }), Z(() => {
102
+ if (M(() => {
103
+ p = !0;
104
+ }), !f) {
105
+ M(g);
106
+ return;
107
+ }
108
+ const e = () => {
109
+ x(), g();
110
+ }, o = () => {
111
+ clearTimeout(T), T = setTimeout(e, 80);
112
+ };
113
+ i = C(w, o, { flush: "post" }), o(), R = setTimeout(e, 1e3);
114
+ }), (e, o) => (a(), d("div", {
115
+ class: ee(["dc-tabs-tile", K.value])
116
+ }, [
117
+ N("div", {
118
+ ref_key: "scrollRootRef",
119
+ ref: m,
120
+ class: "dc-tabs-tile__scroll",
121
+ style: V(W.value)
122
+ }, [
123
+ (a(!0), d(H, null, P(c(S), (t, l) => (a(), d("div", {
124
+ id: u(l),
125
+ key: t.key,
126
+ class: "dc-tabs-tile__item",
127
+ "data-tab-key": t.key
128
+ }, [
129
+ B(ue, {
130
+ tag: c(ae),
131
+ class: "dc-tabs-tile__card"
132
+ }, {
133
+ header: $(() => [
134
+ F(e.$slots, `header-${t.key}`, {
135
+ tab: t,
136
+ active: t.key === s.value
137
+ }, () => [
138
+ ne(le(t.title), 1)
139
+ ], !0)
140
+ ]),
141
+ default: $(() => [
142
+ F(e.$slots, t.key, {
143
+ tab: t,
144
+ active: t.key === s.value
145
+ }, () => [
146
+ t.component ? (a(), I(te(t.component), { key: 0 })) : oe("", !0)
147
+ ], !0)
148
+ ]),
149
+ _: 2
150
+ }, 1032, ["tag"])
151
+ ], 8, pe))), 128))
152
+ ], 4),
153
+ N("div", {
154
+ class: "dc-tabs-tile__nav",
155
+ style: V(q.value),
156
+ onClick: o[0] || (o[0] = re(() => {
157
+ }, ["prevent"]))
158
+ }, [
159
+ B(c(ie), {
160
+ ref_key: "anchorRef",
161
+ ref: v,
162
+ container: G.value,
163
+ offset: w.value,
164
+ bound: 20,
165
+ onChange: J
166
+ }, {
167
+ default: $(() => [
168
+ (a(!0), d(H, null, P(c(S), (t, l) => (a(), I(c(ce), {
169
+ key: t.key,
170
+ href: `#${u(l)}`,
171
+ title: t.title
172
+ }, null, 8, ["href", "title"]))), 128))
173
+ ]),
174
+ _: 1
175
+ }, 8, ["container", "offset"])
176
+ ], 4)
177
+ ], 2));
178
+ }
179
+ });
180
+ export {
181
+ Ae as default
182
+ };
@@ -0,0 +1,26 @@
1
+ import { watch as y } from "vue";
2
+ function a(t, e) {
3
+ if (!t || !e) return;
4
+ const r = t.query[e];
5
+ return Array.isArray(r) ? r[0] ?? void 0 : r ?? void 0;
6
+ }
7
+ function c(t) {
8
+ const { activeKey: e, route: r, router: u, queryKey: o } = t;
9
+ !r || !u || !o || !e || a(r, o) !== e && u.replace({ query: { ...r.query, [o]: e } }).catch(() => {
10
+ });
11
+ }
12
+ function s(t) {
13
+ const { model: e, route: r, router: u, queryKey: o, ready: i } = t;
14
+ !r || !u || y(
15
+ e,
16
+ (n) => {
17
+ i() && c({ activeKey: n, route: r, router: u, queryKey: o() });
18
+ },
19
+ { flush: "post" }
20
+ );
21
+ }
22
+ export {
23
+ a as getTabQuery,
24
+ s as watchTabToQuery,
25
+ c as writeTabQuery
26
+ };
@@ -1,7 +1,7 @@
1
1
  import o from "./FormSearch.vue2.mjs";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const a = /* @__PURE__ */ r(o, [["__scopeId", "data-v-290fe11f"]]);
4
+ const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-eb50264d"]]);
5
5
  export {
6
- a as default
6
+ e as default
7
7
  };