@ditari/bsui 1.0.72 → 1.0.74

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 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),w=require("@vueuse/core"),N=require("../../store/modules/Settings.cjs.js"),V=require("pinia"),C=require("vue-router"),E={class:"ditari-list-layout"},R={ref:"contentRef",class:"wrapper"},b={style:{height:"100%"}},k={class:"ditari-content-extra"},q={name:"DListLayout"},x=e.defineComponent({...q,emits:["refresh"],setup(z,{emit:u}){const n=e.useSlots(),h=N.useSettingsStore(),_=C.useRoute(),a=e.inject("configProvider"),{refresh:i}=V.storeToRefs(h),p=e.ref(),o=e.ref(),f=16,r=e.ref(!1),c=e.ref(0);let l;e.watch(()=>a==null?void 0:a.componentSize,t=>{r.value=!1,setTimeout(()=>{var s;c.value=(s=o==null?void 0:o.value)==null?void 0:s.offsetHeight,r.value=!0},100)}),S();function S(){_.name?(e.onActivated(()=>{i.value&&(i.value=!1,u("refresh")),l=d()}),e.onDeactivated(()=>{l()})):(l=d(),e.onUnmounted(()=>{l()}))}function d(){return e.watch(()=>i.value,t=>{t&&u("refresh")})}const m=e.ref(null),{height:g}=w.useElementSize(m);return e.watch(()=>g.value,t=>{r.value=!1,setTimeout(()=>{var s;c.value=(s=o==null?void 0:o.value)==null?void 0:s.offsetHeight,r.value=!0},10)}),(t,s)=>{const v=e.resolveComponent("a-card"),y=e.resolveComponent("a-space");return e.openBlock(),e.createElementBlock("div",E,[e.createElementVNode("div",R,[e.createVNode(v,{ref_key:"formRef",ref:m,bordered:!1,class:e.normalizeClass({"ditari-list-form":e.unref(n).form}),style:e.normalizeStyle({"margin-bottom":e.unref(n).form?f+"px":0})},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form")]),_:3},8,["class","style"]),e.createVNode(v,{class:"ditari-list-table",bordered:!1},{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"toolsRef",ref:p,class:"xi-tools",style:e.normalizeStyle({"margin-bottom":e.unref(n).tools?f+"px":0})},[e.createVNode(y,null,{default:e.withCtx(()=>[e.renderSlot(t.$slots,"tools")]),_:3})],4),e.createElementVNode("div",{ref_key:"tableRef",ref:o,style:{flex:"1"}},[e.withDirectives(e.createElementVNode("div",b,[e.renderSlot(t.$slots,"table",{height:c.value})],512),[[e.vShow,r.value]])],512)]),_:3})],512),e.createElementVNode("div",k,[e.renderSlot(t.$slots,"default")])])}}});exports.default=x;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),v=require("@vueuse/core"),w=require("../../store/modules/Settings.cjs.js"),R=require("pinia"),N=require("vue-router"),V={class:"ditari-list-layout"},C={ref:"contentRef",class:"wrapper"},E={style:{height:"100%"}},z={class:"ditari-content-extra"},k={name:"DListLayout"},q=e.defineComponent({...k,emits:["refresh"],setup(x,{emit:c}){const r=e.useSlots(),_=w.useSettingsStore(),p=N.useRoute(),n=e.inject("configProvider"),{refresh:l}=R.storeToRefs(_),S=e.ref(),o=e.ref(),u=16,a=e.ref(!1),f=e.ref(0);let s;e.watch(()=>n==null?void 0:n.componentSize,t=>{i()}),g();function g(){p.name?(e.onActivated(()=>{l.value&&(l.value=!1,c("refresh")),s=d()}),e.onDeactivated(()=>{s()})):(s=d(),e.onUnmounted(()=>{s()}))}function d(){return e.watch(()=>l.value,t=>{t&&c("refresh")})}const m=e.ref(null),{height:y}=v.useElementSize(m);e.watch(()=>y.value,t=>{i()}),v.useResizeObserver(document.body,()=>{i()});function i(){a.value=!1,setTimeout(()=>{var t;f.value=(t=o==null?void 0:o.value)==null?void 0:t.offsetHeight,a.value=!0},300)}return(t,H)=>{const h=e.resolveComponent("a-card"),b=e.resolveComponent("a-space");return e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",C,[e.createVNode(h,{ref_key:"formRef",ref:m,bordered:!1,class:e.normalizeClass({"ditari-list-form":e.unref(r).form}),style:e.normalizeStyle({"margin-bottom":e.unref(r).form?u+"px":0})},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form")]),_:3},8,["class","style"]),e.createVNode(h,{class:"ditari-list-table",bordered:!1},{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"toolsRef",ref:S,class:"xi-tools",style:e.normalizeStyle({"margin-bottom":e.unref(r).tools?u+"px":0})},[e.createVNode(b,null,{default:e.withCtx(()=>[e.renderSlot(t.$slots,"tools")]),_:3})],4),e.createElementVNode("div",{ref_key:"tableRef",ref:o,style:{flex:"1"}},[e.withDirectives(e.createElementVNode("div",E,[e.renderSlot(t.$slots,"table",{height:f.value})],512),[[e.vShow,a.value]])],512)]),_:3})],512),e.createElementVNode("div",z,[e.renderSlot(t.$slots,"default")])])}}});exports.default=q;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),f=require("vue-request"),q=require("../../utils/get.cjs.js"),z=(c,e={})=>{e.pagination||(e.pagination={currentKey:"page",pageSizeKey:"limit",totalKey:"data.total"}),e.manual===void 0&&(e.manual=!0);const{dataKey:o,pagination:{currentKey:r,pageSizeKey:s}}=e,a=e.params||n.ref({}),{total:g,pageSize:v,current:d,loading:i,data:m,run:u}=f.usePagination(c,{manual:!0,pagination:e.pagination,loadingDelay:400,loadingKeep:100,onSuccess:(t,l)=>{e.onSuccess&&e.onSuccess(t,l)},onError:(t,l)=>{console.warn(l,t),i.value=!1}}),y=n.computed(()=>({total:g.value,current:d.value,pageSize:v.value})),S=n.computed(()=>q.get(m.value,o||"data",[])||[]),p=t=>{a.value[r]=t.page,a.value[s]=t.size,u(a.value||{})},K=t=>{a.value={...a.value,...t},a.value[r]=1,u(a.value||{})};return n.onMounted(()=>{e.manual&&u(a.value)}),{data:S,pagination:y,loading:i,run:u,onPageChange:p,onQuery:K}};exports.useRequestList=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),f=require("vue-request"),q=require("../../utils/get.cjs.js"),z=(o,e={})=>{e.pagination||(e.pagination={currentKey:"page",pageSizeKey:"limit",totalKey:"data.total"}),e.manual===void 0&&(e.manual=!0);const{dataKey:s,pagination:{currentKey:r,pageSizeKey:g}}=e,a=e.params||n.ref({}),{total:i,pageSize:v,current:d,loading:c,data:m,run:u}=f.usePagination(o,{manual:!0,pagination:e.pagination,loadingDelay:400,loadingKeep:100,onSuccess:(t,l)=>{e.onSuccess&&e.onSuccess(t,l)},onError:(t,l)=>{console.warn(l,t),c.value=!1}}),y=n.computed(()=>({total:i.value,current:d.value,pageSize:v.value})),S=n.computed(()=>q.get(m.value,s||"data",[])||[]),p=t=>{a.value[r]=t.page,a.value[g]=t.size,u(a.value||{})},K=t=>{a.value={...a.value,...t},a.value[r]=1,u(a.value||{})};return n.onMounted(()=>{e.manual&&u(a.value)}),{data:S,pagination:y,loading:c,total:i,run:u,onPageChange:p,onQuery:K}};exports.useRequestList=z;
@@ -1,110 +1,113 @@
1
- import { defineComponent as $, useSlots as B, inject as D, ref as l, watch as m, onUnmounted as E, onActivated as T, onDeactivated as L, resolveComponent as w, openBlock as N, createElementBlock as V, createElementVNode as a, createVNode as d, normalizeClass as W, unref as h, normalizeStyle as R, withCtx as v, renderSlot as n, withDirectives as j, vShow as A } from "vue";
2
- import { useElementSize as U } from "@vueuse/core";
1
+ import { defineComponent as $, useSlots as B, inject as D, ref as t, watch as u, onUnmounted as E, onActivated as L, onDeactivated as N, resolveComponent as b, openBlock as T, createElementBlock as V, createElementVNode as o, createVNode as m, normalizeClass as W, unref as d, normalizeStyle as S, withCtx as h, renderSlot as l, withDirectives as j, vShow as A } from "vue";
2
+ import { useElementSize as O, useResizeObserver as U } from "@vueuse/core";
3
3
  import { useSettingsStore as q } from "../../store/modules/Settings.esm.js";
4
4
  import { storeToRefs as F } from "pinia";
5
5
  import { useRoute as G } from "vue-router";
6
6
  const I = { class: "ditari-list-layout" }, J = {
7
7
  ref: "contentRef",
8
8
  class: "wrapper"
9
- }, K = { style: { height: "100%" } }, M = { class: "ditari-content-extra" }, O = {
9
+ }, K = { style: { height: "100%" } }, M = { class: "ditari-content-extra" }, P = {
10
10
  name: "DListLayout"
11
- }, te = /* @__PURE__ */ $({
12
- ...O,
11
+ }, se = /* @__PURE__ */ $({
12
+ ...P,
13
13
  emits: ["refresh"],
14
- setup(P, { emit: _ }) {
15
- const i = B(), k = q(), b = G(), f = D("configProvider"), { refresh: c } = F(k), x = l(), t = l(), p = 16, s = l(!1), u = l(0);
14
+ setup(Q, { emit: _ }) {
15
+ const a = B(), w = q(), k = G(), n = D("configProvider"), { refresh: i } = F(w), z = t(), s = t(), v = 16, c = t(!1), p = t(0);
16
16
  let r;
17
- m(
18
- () => f == null ? void 0 : f.componentSize,
17
+ u(
18
+ () => n == null ? void 0 : n.componentSize,
19
19
  (e) => {
20
- s.value = !1, setTimeout(() => {
21
- var o;
22
- u.value = (o = t == null ? void 0 : t.value) == null ? void 0 : o.offsetHeight, s.value = !0;
23
- }, 100);
20
+ f();
24
21
  }
25
- ), z();
26
- function z() {
27
- b.name ? (T(() => {
28
- c.value && (c.value = !1, _("refresh")), r = g();
29
- }), L(() => {
22
+ ), x();
23
+ function x() {
24
+ k.name ? (L(() => {
25
+ i.value && (i.value = !1, _("refresh")), r = y();
26
+ }), N(() => {
30
27
  r();
31
- })) : (r = g(), E(() => {
28
+ })) : (r = y(), E(() => {
32
29
  r();
33
30
  }));
34
31
  }
35
- function g() {
36
- return m(
37
- () => c.value,
32
+ function y() {
33
+ return u(
34
+ () => i.value,
38
35
  (e) => {
39
36
  e && _("refresh");
40
37
  }
41
38
  );
42
39
  }
43
- const y = l(null), { height: C } = U(y);
44
- return m(
40
+ const g = t(null), { height: C } = O(g);
41
+ u(
45
42
  () => C.value,
46
43
  (e) => {
47
- s.value = !1, setTimeout(() => {
48
- var o;
49
- u.value = (o = t == null ? void 0 : t.value) == null ? void 0 : o.offsetHeight, s.value = !0;
50
- }, 10);
44
+ f();
51
45
  }
52
- ), (e, o) => {
53
- const S = w("a-card"), H = w("a-space");
54
- return N(), V("div", I, [
55
- a("div", J, [
56
- d(S, {
46
+ ), U(document.body, () => {
47
+ f();
48
+ });
49
+ function f() {
50
+ c.value = !1, setTimeout(() => {
51
+ var e;
52
+ p.value = (e = s == null ? void 0 : s.value) == null ? void 0 : e.offsetHeight, c.value = !0;
53
+ }, 300);
54
+ }
55
+ return (e, X) => {
56
+ const R = b("a-card"), H = b("a-space");
57
+ return T(), V("div", I, [
58
+ o("div", J, [
59
+ m(R, {
57
60
  ref_key: "formRef",
58
- ref: y,
61
+ ref: g,
59
62
  bordered: !1,
60
- class: W({ "ditari-list-form": h(i).form }),
61
- style: R({ "margin-bottom": h(i).form ? p + "px" : 0 })
63
+ class: W({ "ditari-list-form": d(a).form }),
64
+ style: S({ "margin-bottom": d(a).form ? v + "px" : 0 })
62
65
  }, {
63
- default: v(() => [
64
- n(e.$slots, "form")
66
+ default: h(() => [
67
+ l(e.$slots, "form")
65
68
  ]),
66
69
  _: 3
67
70
  }, 8, ["class", "style"]),
68
- d(S, {
71
+ m(R, {
69
72
  class: "ditari-list-table",
70
73
  bordered: !1
71
74
  }, {
72
- default: v(() => [
73
- a("div", {
75
+ default: h(() => [
76
+ o("div", {
74
77
  ref_key: "toolsRef",
75
- ref: x,
78
+ ref: z,
76
79
  class: "xi-tools",
77
- style: R({ "margin-bottom": h(i).tools ? p + "px" : 0 })
80
+ style: S({ "margin-bottom": d(a).tools ? v + "px" : 0 })
78
81
  }, [
79
- d(H, null, {
80
- default: v(() => [
81
- n(e.$slots, "tools")
82
+ m(H, null, {
83
+ default: h(() => [
84
+ l(e.$slots, "tools")
82
85
  ]),
83
86
  _: 3
84
87
  })
85
88
  ], 4),
86
- a("div", {
89
+ o("div", {
87
90
  ref_key: "tableRef",
88
- ref: t,
91
+ ref: s,
89
92
  style: { flex: "1" }
90
93
  }, [
91
- j(a("div", K, [
92
- n(e.$slots, "table", { height: u.value })
94
+ j(o("div", K, [
95
+ l(e.$slots, "table", { height: p.value })
93
96
  ], 512), [
94
- [A, s.value]
97
+ [A, c.value]
95
98
  ])
96
99
  ], 512)
97
100
  ]),
98
101
  _: 3
99
102
  })
100
103
  ], 512),
101
- a("div", M, [
102
- n(e.$slots, "default")
104
+ o("div", M, [
105
+ l(e.$slots, "default")
103
106
  ])
104
107
  ]);
105
108
  };
106
109
  }
107
110
  });
108
111
  export {
109
- te as default
112
+ se as default
110
113
  };
@@ -1,23 +1,23 @@
1
- import { ref as S, computed as o, onMounted as z } from "vue";
1
+ import { ref as S, computed as i, onMounted as z } from "vue";
2
2
  import { usePagination as D } from "vue-request";
3
3
  import { get as P } from "../../utils/get.esm.js";
4
- const x = (i, a = {}) => {
4
+ const x = (c, a = {}) => {
5
5
  a.pagination || (a.pagination = {
6
6
  currentKey: "page",
7
7
  pageSizeKey: "limit",
8
8
  totalKey: "data.total"
9
9
  }), a.manual === void 0 && (a.manual = !0);
10
10
  const {
11
- dataKey: c,
12
- pagination: { currentKey: l, pageSizeKey: g }
11
+ dataKey: g,
12
+ pagination: { currentKey: l, pageSizeKey: s }
13
13
  } = a, e = a.params || S({}), {
14
- total: s,
14
+ total: r,
15
15
  pageSize: v,
16
16
  current: m,
17
- loading: r,
17
+ loading: o,
18
18
  data: d,
19
19
  run: n
20
- } = D(i, {
20
+ } = D(c, {
21
21
  manual: !0,
22
22
  pagination: a.pagination,
23
23
  loadingDelay: 400,
@@ -26,16 +26,16 @@ const x = (i, a = {}) => {
26
26
  a.onSuccess && a.onSuccess(t, u);
27
27
  },
28
28
  onError: (t, u) => {
29
- console.warn(u, t), r.value = !1;
29
+ console.warn(u, t), o.value = !1;
30
30
  }
31
- }), p = o(() => ({
32
- total: s.value,
31
+ }), p = i(() => ({
32
+ total: r.value,
33
33
  current: m.value,
34
34
  pageSize: v.value
35
- })), f = o(
36
- () => P(d.value, c || "data", []) || []
35
+ })), f = i(
36
+ () => P(d.value, g || "data", []) || []
37
37
  ), y = (t) => {
38
- e.value[l] = t.page, e.value[g] = t.size, n(e.value || {});
38
+ e.value[l] = t.page, e.value[s] = t.size, n(e.value || {});
39
39
  }, K = (t) => {
40
40
  e.value = { ...e.value, ...t }, e.value[l] = 1, n(e.value || {});
41
41
  };
@@ -44,7 +44,8 @@ const x = (i, a = {}) => {
44
44
  }), {
45
45
  data: f,
46
46
  pagination: p,
47
- loading: r,
47
+ loading: o,
48
+ total: r,
48
49
  run: n,
49
50
  onPageChange: y,
50
51
  onQuery: K
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.0.72",
3
+ "version": "1.0.74",
4
4
  "files": [
5
5
  "dist/**",
6
6
  "src"
@@ -1,10 +1,7 @@
1
1
  <script setup lang="ts">
2
- import { useElementSize } from "@vueuse/core";
3
-
4
2
  import {
5
3
  useSlots,
6
4
  ref,
7
- nextTick,
8
5
  onActivated,
9
6
  watch,
10
7
  onDeactivated,
@@ -12,6 +9,7 @@ import {
12
9
  WatchStopHandle,
13
10
  inject
14
11
  } from "vue";
12
+ import { useElementSize, useResizeObserver } from "@vueuse/core";
15
13
  import { useSettingsStore } from "../../store/modules/Settings";
16
14
  import { storeToRefs } from "pinia";
17
15
  import { useRoute } from "vue-router";
@@ -37,21 +35,10 @@ const height = ref(0);
37
35
 
38
36
  let stopHandleWatch: WatchStopHandle;
39
37
 
40
- // nextTick(() => {
41
- // setTimeout(() => {
42
- // height.value = tableRef?.value?.offsetHeight;
43
- // show.value = true;
44
- // }, 1);
45
- // });
46
-
47
38
  watch(
48
39
  () => configProvider?.componentSize,
49
40
  (val) => {
50
- show.value = false;
51
- setTimeout(() => {
52
- height.value = tableRef?.value?.offsetHeight;
53
- show.value = true;
54
- }, 100);
41
+ calcHeight();
55
42
  }
56
43
  );
57
44
 
@@ -101,13 +88,22 @@ const { height: formHeight } = useElementSize(formRef);
101
88
  watch(
102
89
  () => formHeight.value,
103
90
  (val) => {
104
- show.value = false;
105
- setTimeout(() => {
106
- height.value = tableRef?.value?.offsetHeight;
107
- show.value = true;
108
- }, 10);
91
+ calcHeight();
109
92
  }
110
93
  );
94
+
95
+ useResizeObserver(document.body, () => {
96
+ calcHeight();
97
+ });
98
+
99
+ // 动态计算高度
100
+ function calcHeight() {
101
+ show.value = false;
102
+ setTimeout(() => {
103
+ height.value = tableRef?.value?.offsetHeight;
104
+ show.value = true;
105
+ }, 300);
106
+ }
111
107
  </script>
112
108
  <script lang="ts">
113
109
  export default {
@@ -107,6 +107,7 @@ const useRequestList = (service: any, options: Options = {}) => {
107
107
  data,
108
108
  pagination,
109
109
  loading,
110
+ total,
110
111
  run,
111
112
  onPageChange,
112
113
  onQuery