@done-coding/admin-core 0.1.1-alpha.0 → 0.1.1-alpha.1

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,7 +1,7 @@
1
1
  import o from "./AutoRefresh.vue2.mjs";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-b734f05f"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-4446ddf0"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,51 +1,55 @@
1
- import { ElInputNumber as x, ElSwitch as M } from "element-plus/es";
1
+ import { ElInputNumber as y, ElSwitch as M } from "element-plus/es";
2
2
  import "element-plus/es/components/base/style/css";
3
3
  import "element-plus/es/components/switch/style/css";
4
4
  import "element-plus/es/components/input-number/style/css";
5
- import { defineComponent as N, useModel as m, watch as n, openBlock as i, createElementBlock as d, Fragment as b, createElementVNode as f, createVNode as p, createCommentVNode as k, mergeModels as w } from "vue";
6
- import { useTimeout as B } from "../../hooks/timeout.mjs";
5
+ import { defineComponent as N, useModel as f, computed as w, watch as x, openBlock as p, createElementBlock as c, Fragment as B, createElementVNode as v, createVNode as V, createCommentVNode as R, mergeModels as k } from "vue";
6
+ import { useTimeout as F } from "../../hooks/timeout.mjs";
7
7
  import { useActivatedExec as T } from "../../hooks/activated.mjs";
8
- const y = { class: "auto-refresh" }, F = /* @__PURE__ */ N({
8
+ const g = { class: "auto-refresh" }, _ = /* @__PURE__ */ N({
9
9
  __name: "AutoRefresh",
10
- props: {
10
+ props: /* @__PURE__ */ k({
11
+ refreshFn: {},
12
+ enabled: { type: Boolean, default: !0 }
13
+ }, {
11
14
  modelValue: { type: Boolean, default: !1 },
12
15
  modelModifiers: {},
13
16
  interval: { default: 30 },
14
17
  intervalModifiers: {}
15
- },
16
- emits: /* @__PURE__ */ w(["refresh"], ["update:modelValue", "update:interval"]),
17
- setup(s, { expose: v, emit: c }) {
18
- const r = c, e = m(s, "modelValue"), o = m(s, "interval"), [V, h] = B(), l = () => {
19
- V(() => {
20
- r("refresh"), e.value && l();
21
- }, o.value * 1e3);
18
+ }),
19
+ emits: ["update:modelValue", "update:interval"],
20
+ setup(r) {
21
+ const m = r, l = f(r, "modelValue"), t = f(r, "interval"), n = w(() => l.value && m.enabled), [h, i] = F();
22
+ let o = null;
23
+ const d = () => (o || (o = m.refreshFn().catch(() => {
24
+ }).finally(() => {
25
+ o = null;
26
+ })), o), s = () => {
27
+ h(async () => {
28
+ await d(), n.value && s();
29
+ }, t.value * 1e3);
22
30
  };
23
- return v({ trigger: () => {
24
- r("refresh"), e.value && l();
25
- } }), n(e, (u) => {
26
- u ? l() : h();
27
- }), n(o, () => {
28
- e.value && l();
29
- }), T(() => {
30
- e.value && (r("refresh"), l());
31
- }), (u, t) => {
32
- const E = x, g = M;
33
- return i(), d("div", y, [
34
- e.value ? (i(), d(b, { key: 0 }, [
35
- t[2] || (t[2] = f("span", { class: "auto-refresh-label" }, "刷新间隔", -1)),
36
- p(E, {
37
- modelValue: o.value,
38
- "onUpdate:modelValue": t[0] || (t[0] = (a) => o.value = a),
31
+ return x([n, t], ([a]) => {
32
+ a ? s() : i();
33
+ }), T(({ triggerType: a }) => {
34
+ n.value && (a === "activated" && (i(), d()), s());
35
+ }), (a, e) => {
36
+ const E = y, b = M;
37
+ return p(), c("div", g, [
38
+ l.value ? (p(), c(B, { key: 0 }, [
39
+ e[2] || (e[2] = v("span", { class: "auto-refresh-label" }, "刷新间隔", -1)),
40
+ V(E, {
41
+ modelValue: t.value,
42
+ "onUpdate:modelValue": e[0] || (e[0] = (u) => t.value = u),
39
43
  min: 1,
40
- step: 5,
44
+ step: 1,
41
45
  size: "small",
42
46
  class: "auto-refresh-interval"
43
47
  }, null, 8, ["modelValue"]),
44
- t[3] || (t[3] = f("span", { class: "auto-refresh-label" }, "秒", -1))
45
- ], 64)) : k("", !0),
46
- p(g, {
47
- modelValue: e.value,
48
- "onUpdate:modelValue": t[1] || (t[1] = (a) => e.value = a),
48
+ e[3] || (e[3] = v("span", { class: "auto-refresh-label" }, "秒", -1))
49
+ ], 64)) : R("", !0),
50
+ V(b, {
51
+ modelValue: l.value,
52
+ "onUpdate:modelValue": e[1] || (e[1] = (u) => l.value = u),
49
53
  "active-text": "自动刷新"
50
54
  }, null, 8, ["modelValue"])
51
55
  ]);
@@ -53,5 +57,5 @@ const y = { class: "auto-refresh" }, F = /* @__PURE__ */ N({
53
57
  }
54
58
  });
55
59
  export {
56
- F as default
60
+ _ as default
57
61
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./TableToolbar.vue2.mjs";
2
2
  /* empty css */
3
- import a from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const p = /* @__PURE__ */ a(o, [["__scopeId", "data-v-4a425d38"]]);
3
+ import r from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-efbd16f8"]]);
5
5
  export {
6
- p as default
6
+ e as default
7
7
  };
@@ -1,11 +1,11 @@
1
- import { ElButton as g, ElIcon as k } from "element-plus/es";
1
+ import { ElButton as b, ElIcon as R } from "element-plus/es";
2
2
  import "element-plus/es/components/base/style/css";
3
3
  import "element-plus/es/components/button/style/css";
4
4
  import "element-plus/es/components/icon/style/css";
5
- import { defineComponent as A, useModel as B, computed as f, ref as i, watch as _, openBlock as a, createElementBlock as V, createElementVNode as x, createBlock as d, createCommentVNode as m, withCtx as c, createVNode as h, normalizeClass as y, unref as C, mergeModels as I } from "vue";
6
- import { Refresh as M } from "@element-plus/icons-vue";
7
- import w from "../misc/AutoRefresh.vue.mjs";
8
- const N = { class: "table-toolbar" }, T = { class: "table-toolbar-right" }, G = /* @__PURE__ */ A({
5
+ import { defineComponent as E, useModel as A, computed as u, ref as B, watch as g, openBlock as s, createElementBlock as k, createElementVNode as x, createBlock as i, createCommentVNode as f, withCtx as d, createVNode as m, normalizeClass as V, unref as C, mergeModels as I } from "vue";
6
+ import { Refresh as w } from "@element-plus/icons-vue";
7
+ import y from "../misc/AutoRefresh.vue.mjs";
8
+ const M = { class: "table-toolbar" }, _ = { class: "table-toolbar-right" }, q = /* @__PURE__ */ E({
9
9
  __name: "TableToolbar",
10
10
  props: /* @__PURE__ */ I({
11
11
  features: { default: () => ["refresh", "autoRefresh"] },
@@ -17,59 +17,53 @@ const N = { class: "table-toolbar" }, T = { class: "table-toolbar-right" }, G =
17
17
  isAutoRefreshModifiers: {}
18
18
  }),
19
19
  emits: ["update:isAutoRefresh"],
20
- setup(s) {
21
- const e = s, n = B(s, "isAutoRefresh"), p = f(
20
+ setup(o) {
21
+ const e = o, a = A(o, "isAutoRefresh"), c = u(
22
22
  () => e.features === void 0 || e.features.includes("refresh")
23
- ), v = f(
23
+ ), h = u(
24
24
  () => e.features === void 0 || e.features.includes("autoRefresh")
25
- ), l = i(30);
26
- _(
25
+ ), l = B(30);
26
+ return g(
27
27
  () => e.refreshInterval,
28
- (o) => {
29
- l.value = o;
28
+ (n) => {
29
+ l.value = n;
30
30
  },
31
31
  { immediate: !0 }
32
- );
33
- const u = i(), R = () => {
34
- var o;
35
- (o = u.value) == null || o.trigger();
36
- };
37
- return (o, t) => {
38
- const b = k, E = g;
39
- return a(), V("div", N, [
40
- x("div", T, [
41
- v.value ? (a(), d(w, {
32
+ ), (n, t) => {
33
+ const p = R, v = b;
34
+ return s(), k("div", M, [
35
+ x("div", _, [
36
+ h.value ? (s(), i(y, {
42
37
  key: 0,
43
- ref_key: "autoRefreshRef",
44
- ref: u,
45
- modelValue: n.value,
46
- "onUpdate:modelValue": t[0] || (t[0] = (r) => n.value = r),
38
+ modelValue: a.value,
39
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => a.value = r),
47
40
  interval: l.value,
48
41
  "onUpdate:interval": t[1] || (t[1] = (r) => l.value = r),
49
- onRefresh: t[2] || (t[2] = (r) => e.tableExpose.refresh())
50
- }, null, 8, ["modelValue", "interval"])) : m("", !0),
51
- p.value ? (a(), d(E, {
42
+ refreshFn: e.tableExpose.refresh,
43
+ enabled: !o.loading
44
+ }, null, 8, ["modelValue", "interval", "refreshFn", "enabled"])) : f("", !0),
45
+ c.value ? (s(), i(v, {
52
46
  key: 1,
53
47
  circle: "",
54
- onClick: R
48
+ onClick: t[2] || (t[2] = (r) => e.tableExpose.refresh())
55
49
  }, {
56
- default: c(() => [
57
- h(b, {
58
- class: y({ "table-toolbar-icon--rotating": s.loading })
50
+ default: d(() => [
51
+ m(p, {
52
+ class: V({ "table-toolbar-icon--rotating": o.loading })
59
53
  }, {
60
- default: c(() => [
61
- h(C(M))
54
+ default: d(() => [
55
+ m(C(w))
62
56
  ]),
63
57
  _: 1
64
58
  }, 8, ["class"])
65
59
  ]),
66
60
  _: 1
67
- })) : m("", !0)
61
+ })) : f("", !0)
68
62
  ])
69
63
  ]);
70
64
  };
71
65
  }
72
66
  });
73
67
  export {
74
- G as default
68
+ q as default
75
69
  };
@@ -1,34 +1,40 @@
1
- import { watch as i, ref as s, onMounted as n, onActivated as u, onDeactivated as v, onBeforeUnmount as d } from "vue";
2
- const c = () => {
3
- const e = s(!1);
4
- return n(() => {
5
- e.value = !0, u(() => {
6
- e.value = !0;
1
+ import { watch as d, ref as n, computed as c, onMounted as o, onActivated as s, onDeactivated as r, onBeforeUnmount as u } from "vue";
2
+ const v = () => {
3
+ const e = n({
4
+ isActivated: !1,
5
+ triggerType: "mounted"
6
+ }), i = c(() => e.value.isActivated), t = (a) => {
7
+ e.value = a;
8
+ };
9
+ return o(() => {
10
+ t({ isActivated: !0, triggerType: "mounted" }), s(() => {
11
+ t({ isActivated: !0, triggerType: "activated" });
7
12
  });
8
- }), v(() => {
9
- e.value = !1;
10
- }), d(() => {
11
- e.value = !1;
13
+ }), r(() => {
14
+ t({ isActivated: !1, triggerType: "deactivated" });
15
+ }), u(() => {
16
+ t({ isActivated: !1, triggerType: "unmounted" });
12
17
  }), {
13
- isActivated: e
18
+ isActivated: i,
19
+ activatedInfo: c(() => e.value)
14
20
  };
15
- }, f = (e) => {
16
- const { isActivated: t } = c();
17
- i(
18
- t,
19
- (a) => {
20
- a && e();
21
+ }, g = (e) => {
22
+ const { activatedInfo: i } = v();
23
+ d(
24
+ i,
25
+ (t) => {
26
+ t.isActivated && e(t);
21
27
  },
22
28
  {
23
29
  immediate: !0
24
30
  }
25
31
  );
26
- }, l = (e, t) => {
27
- const { isActivated: a } = c();
28
- i(
29
- a,
30
- (o) => {
31
- o ? e() : t();
32
+ }, m = (e, i) => {
33
+ const { activatedInfo: t } = v();
34
+ d(
35
+ t,
36
+ (a) => {
37
+ a.isActivated ? e(a) : i(a);
32
38
  },
33
39
  {
34
40
  immediate: !0
@@ -36,7 +42,7 @@ const c = () => {
36
42
  );
37
43
  };
38
44
  export {
39
- c as useActivated,
40
- l as useActivatedEvent,
41
- f as useActivatedExec
45
+ v as useActivated,
46
+ m as useActivatedEvent,
47
+ g as useActivatedExec
42
48
  };
package/es/style.css CHANGED
@@ -1 +1 @@
1
- .form-item-tip[data-v-e889a0ed]{text-align:left;line-height:1.5;font-size:12px}.form-search_show[data-v-8896356d]{margin-bottom:10px}.form-search .btn-box[data-v-8896356d]{padding-left:20px}.form-search[data-v-8896356d] .el-col{padding-left:14px}.form-verify-image[data-v-a4baf877] .el-input__suffix-inner *{margin:0}.form-verify-image-suffix[data-v-a4baf877]{position:absolute;height:100%;border-radius:var(--el-input-border-radius, var(--el-border-radius-base));top:50%;transform:translateY(-50%);overflow:hidden;cursor:pointer}.form-verify-image-suffix-main[data-v-a4baf877]{position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f4f4f4}.auto-refresh[data-v-b734f05f]{display:flex;align-items:center;gap:8px}.auto-refresh-label[data-v-b734f05f]{font-size:13px;color:var(--el-text-color-regular)}.auto-refresh-interval[data-v-b734f05f]{width:80px}.confirm-dialog .content[data-v-2f0c870e]{overflow-x:hidden;overflow-y:auto;max-height:calc(100vh - 200px)}.confirm-dialog .btn[data-v-2f0c870e]{width:150px;height:40px;border-radius:4px}.confirm-dialog .main[data-v-2f0c870e]{position:relative;text-align:center}.confirm-dialog .main .close-box[data-v-2f0c870e]{position:absolute;top:0;right:0;cursor:pointer;z-index:2}.confirm-dialog .main .shim[data-v-2f0c870e]{position:relative;z-index:1}.confirm-dialog .main .shim .title[data-v-2f0c870e]{font-size:18px;font-weight:500}.confirm-dialog .main .shim .content[data-v-2f0c870e]{font-size:16px;margin-top:15px}.confirm-dialog .main .shim .footer[data-v-2f0c870e]{display:flex;justify-content:center;align-items:center;padding-top:5px}.confirm-dialog .main .shim .footer>.btn[data-v-2f0c870e]:not(:last-child){margin-right:30px}.confirm-dialog .main .shim .footer[reverse=true][data-v-2f0c870e]{flex-direction:row-reverse}.confirm-dialog .main .shim .footer[reverse=true]>.btn[data-v-2f0c870e]:not(:last-child){margin-right:0;margin-left:30px}.confirm-dialog .el-dialog__header,.confirm-dialog .el-dialog__body{padding:0;background-color:transparent}.table-toolbar[data-v-4a425d38]{display:flex;justify-content:flex-end;align-items:center;padding-bottom:8px}.table-toolbar-right[data-v-4a425d38]{display:flex;align-items:center;gap:8px}.table-toolbar-icon--rotating[data-v-4a425d38]{animation:table-toolbar-rotating-4a425d38 1s linear infinite}@keyframes table-toolbar-rotating-4a425d38{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.table-main-table[data-v-5944984b]{--el-table-header-bg-color: var(--v7c6ca44f)}.table-main-pagination[data-v-5944984b]{margin-top:10px;display:flex;justify-content:flex-end}.list-page[data-v-a578c778]{min-height:var(--bb4a2a8e)}.list-page-operation[data-v-a578c778]{margin-bottom:10px}.list-page[data-v-a578c778] .el-loading-mask{left:-10px;top:-10px;right:-10px;bottom:-10px}
1
+ .form-item-tip[data-v-e889a0ed]{text-align:left;line-height:1.5;font-size:12px}.form-search_show[data-v-8896356d]{margin-bottom:10px}.form-search .btn-box[data-v-8896356d]{padding-left:20px}.form-search[data-v-8896356d] .el-col{padding-left:14px}.form-verify-image[data-v-a4baf877] .el-input__suffix-inner *{margin:0}.form-verify-image-suffix[data-v-a4baf877]{position:absolute;height:100%;border-radius:var(--el-input-border-radius, var(--el-border-radius-base));top:50%;transform:translateY(-50%);overflow:hidden;cursor:pointer}.form-verify-image-suffix-main[data-v-a4baf877]{position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f4f4f4}.auto-refresh[data-v-4446ddf0]{display:flex;align-items:center;gap:8px}.auto-refresh-label[data-v-4446ddf0]{font-size:13px;color:var(--el-text-color-regular)}.auto-refresh-interval[data-v-4446ddf0]{width:80px}.confirm-dialog .content[data-v-2f0c870e]{overflow-x:hidden;overflow-y:auto;max-height:calc(100vh - 200px)}.confirm-dialog .btn[data-v-2f0c870e]{width:150px;height:40px;border-radius:4px}.confirm-dialog .main[data-v-2f0c870e]{position:relative;text-align:center}.confirm-dialog .main .close-box[data-v-2f0c870e]{position:absolute;top:0;right:0;cursor:pointer;z-index:2}.confirm-dialog .main .shim[data-v-2f0c870e]{position:relative;z-index:1}.confirm-dialog .main .shim .title[data-v-2f0c870e]{font-size:18px;font-weight:500}.confirm-dialog .main .shim .content[data-v-2f0c870e]{font-size:16px;margin-top:15px}.confirm-dialog .main .shim .footer[data-v-2f0c870e]{display:flex;justify-content:center;align-items:center;padding-top:5px}.confirm-dialog .main .shim .footer>.btn[data-v-2f0c870e]:not(:last-child){margin-right:30px}.confirm-dialog .main .shim .footer[reverse=true][data-v-2f0c870e]{flex-direction:row-reverse}.confirm-dialog .main .shim .footer[reverse=true]>.btn[data-v-2f0c870e]:not(:last-child){margin-right:0;margin-left:30px}.confirm-dialog .el-dialog__header,.confirm-dialog .el-dialog__body{padding:0;background-color:transparent}.table-toolbar[data-v-efbd16f8]{display:flex;justify-content:flex-end;align-items:center;padding-bottom:8px}.table-toolbar-right[data-v-efbd16f8]{display:flex;align-items:center;gap:8px}.table-toolbar-icon--rotating[data-v-efbd16f8]{animation:table-toolbar-rotating-efbd16f8 1s linear infinite}@keyframes table-toolbar-rotating-efbd16f8{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.table-main-table[data-v-5944984b]{--el-table-header-bg-color: var(--v7c6ca44f)}.table-main-pagination[data-v-5944984b]{margin-top:10px;display:flex;justify-content:flex-end}.list-page[data-v-a578c778]{min-height:var(--bb4a2a8e)}.list-page-operation[data-v-a578c778]{margin-bottom:10px}.list-page[data-v-a578c778] .el-loading-mask{left:-10px;top:-10px;right:-10px;bottom:-10px}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/admin-core",
3
- "version": "0.1.1-alpha.0",
3
+ "version": "0.1.1-alpha.1",
4
4
  "description": "后台管理核心",
5
5
  "private": false,
6
6
  "main": "lib/index.cjs",
@@ -77,5 +77,5 @@
77
77
  "node": ">=18.0.0",
78
78
  "pnpm": ">=9.0.0"
79
79
  },
80
- "gitHead": "ee98121b978b17eb12a861b97ef26227d2315523"
80
+ "gitHead": "702df9158b5cfa3bf2f7c667fb10cbe5168b9a7a"
81
81
  }
@@ -1,14 +1,26 @@
1
1
  declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
2
2
  modelValue: import('vue').PropType<boolean>;
3
3
  interval: import('vue').PropType<number>;
4
- }>, {
5
- trigger: () => void;
6
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
7
- refresh: () => void;
8
- }, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
4
+ refreshFn: {
5
+ type: globalThis.PropType<() => Promise<unknown>>;
6
+ required: true;
7
+ };
8
+ enabled: {
9
+ type: globalThis.PropType<boolean>;
10
+ default: boolean;
11
+ };
12
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
9
13
  modelValue: import('vue').PropType<boolean>;
10
14
  interval: import('vue').PropType<number>;
11
- }>> & Readonly<{
12
- onRefresh?: (() => any) | undefined;
13
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
15
+ refreshFn: {
16
+ type: globalThis.PropType<() => Promise<unknown>>;
17
+ required: true;
18
+ };
19
+ enabled: {
20
+ type: globalThis.PropType<boolean>;
21
+ default: boolean;
22
+ };
23
+ }>> & Readonly<{}>, {
24
+ enabled: boolean;
25
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
14
26
  export default _default;
@@ -1,8 +1,17 @@
1
+ /** 激活信息 */
2
+ export interface ActivatedInfo {
3
+ isActivated: boolean;
4
+ triggerType: "mounted" | "activated" | "deactivated" | "unmounted";
5
+ }
1
6
  /** 是否激活 */
2
7
  export declare const useActivated: () => {
3
- isActivated: globalThis.Ref<boolean, boolean>;
8
+ isActivated: globalThis.ComputedRef<boolean>;
9
+ activatedInfo: globalThis.ComputedRef<{
10
+ isActivated: boolean;
11
+ triggerType: "mounted" | "activated" | "deactivated" | "unmounted";
12
+ }>;
4
13
  };
5
14
  /** 激活时执行时间 */
6
- export declare const useActivatedExec: (callback: () => void) => void;
15
+ export declare const useActivatedExec: (callback: (info: ActivatedInfo) => void) => void;
7
16
  /** 激活时监听事件 */
8
- export declare const useActivatedEvent: (bind: () => void, unbind: () => void) => void;
17
+ export declare const useActivatedEvent: (bind: (info: ActivatedInfo) => void, unbind: (info: ActivatedInfo) => void) => void;