@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.
- package/dist/cjs/components/layout/List.vue.cjs.js +1 -1
- package/dist/cjs/hooks/http/index.cjs.js +1 -1
- package/dist/esm/components/layout/List.vue.esm.js +57 -54
- package/dist/esm/hooks/http/index.esm.js +15 -14
- package/package.json +1 -1
- package/src/components/layout/List.vue +16 -20
- package/src/hooks/http/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
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=(
|
|
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
|
|
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" },
|
|
9
|
+
}, K = { style: { height: "100%" } }, M = { class: "ditari-content-extra" }, P = {
|
|
10
10
|
name: "DListLayout"
|
|
11
|
-
},
|
|
12
|
-
...
|
|
11
|
+
}, se = /* @__PURE__ */ $({
|
|
12
|
+
...P,
|
|
13
13
|
emits: ["refresh"],
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
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
|
-
|
|
18
|
-
() =>
|
|
17
|
+
u(
|
|
18
|
+
() => n == null ? void 0 : n.componentSize,
|
|
19
19
|
(e) => {
|
|
20
|
-
|
|
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
|
-
),
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}),
|
|
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 =
|
|
28
|
+
})) : (r = y(), E(() => {
|
|
32
29
|
r();
|
|
33
30
|
}));
|
|
34
31
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
37
|
-
() =>
|
|
32
|
+
function y() {
|
|
33
|
+
return u(
|
|
34
|
+
() => i.value,
|
|
38
35
|
(e) => {
|
|
39
36
|
e && _("refresh");
|
|
40
37
|
}
|
|
41
38
|
);
|
|
42
39
|
}
|
|
43
|
-
const
|
|
44
|
-
|
|
40
|
+
const g = t(null), { height: C } = O(g);
|
|
41
|
+
u(
|
|
45
42
|
() => C.value,
|
|
46
43
|
(e) => {
|
|
47
|
-
|
|
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
|
-
), (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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:
|
|
61
|
+
ref: g,
|
|
59
62
|
bordered: !1,
|
|
60
|
-
class: W({ "ditari-list-form":
|
|
61
|
-
style:
|
|
63
|
+
class: W({ "ditari-list-form": d(a).form }),
|
|
64
|
+
style: S({ "margin-bottom": d(a).form ? v + "px" : 0 })
|
|
62
65
|
}, {
|
|
63
|
-
default:
|
|
64
|
-
|
|
66
|
+
default: h(() => [
|
|
67
|
+
l(e.$slots, "form")
|
|
65
68
|
]),
|
|
66
69
|
_: 3
|
|
67
70
|
}, 8, ["class", "style"]),
|
|
68
|
-
|
|
71
|
+
m(R, {
|
|
69
72
|
class: "ditari-list-table",
|
|
70
73
|
bordered: !1
|
|
71
74
|
}, {
|
|
72
|
-
default:
|
|
73
|
-
|
|
75
|
+
default: h(() => [
|
|
76
|
+
o("div", {
|
|
74
77
|
ref_key: "toolsRef",
|
|
75
|
-
ref:
|
|
78
|
+
ref: z,
|
|
76
79
|
class: "xi-tools",
|
|
77
|
-
style:
|
|
80
|
+
style: S({ "margin-bottom": d(a).tools ? v + "px" : 0 })
|
|
78
81
|
}, [
|
|
79
|
-
|
|
80
|
-
default:
|
|
81
|
-
|
|
82
|
+
m(H, null, {
|
|
83
|
+
default: h(() => [
|
|
84
|
+
l(e.$slots, "tools")
|
|
82
85
|
]),
|
|
83
86
|
_: 3
|
|
84
87
|
})
|
|
85
88
|
], 4),
|
|
86
|
-
|
|
89
|
+
o("div", {
|
|
87
90
|
ref_key: "tableRef",
|
|
88
|
-
ref:
|
|
91
|
+
ref: s,
|
|
89
92
|
style: { flex: "1" }
|
|
90
93
|
}, [
|
|
91
|
-
j(
|
|
92
|
-
|
|
94
|
+
j(o("div", K, [
|
|
95
|
+
l(e.$slots, "table", { height: p.value })
|
|
93
96
|
], 512), [
|
|
94
|
-
[A,
|
|
97
|
+
[A, c.value]
|
|
95
98
|
])
|
|
96
99
|
], 512)
|
|
97
100
|
]),
|
|
98
101
|
_: 3
|
|
99
102
|
})
|
|
100
103
|
], 512),
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
o("div", M, [
|
|
105
|
+
l(e.$slots, "default")
|
|
103
106
|
])
|
|
104
107
|
]);
|
|
105
108
|
};
|
|
106
109
|
}
|
|
107
110
|
});
|
|
108
111
|
export {
|
|
109
|
-
|
|
112
|
+
se as default
|
|
110
113
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ref as S, computed as
|
|
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 = (
|
|
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:
|
|
12
|
-
pagination: { currentKey: l, pageSizeKey:
|
|
11
|
+
dataKey: g,
|
|
12
|
+
pagination: { currentKey: l, pageSizeKey: s }
|
|
13
13
|
} = a, e = a.params || S({}), {
|
|
14
|
-
total:
|
|
14
|
+
total: r,
|
|
15
15
|
pageSize: v,
|
|
16
16
|
current: m,
|
|
17
|
-
loading:
|
|
17
|
+
loading: o,
|
|
18
18
|
data: d,
|
|
19
19
|
run: n
|
|
20
|
-
} = D(
|
|
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),
|
|
29
|
+
console.warn(u, t), o.value = !1;
|
|
30
30
|
}
|
|
31
|
-
}), p =
|
|
32
|
-
total:
|
|
31
|
+
}), p = i(() => ({
|
|
32
|
+
total: r.value,
|
|
33
33
|
current: m.value,
|
|
34
34
|
pageSize: v.value
|
|
35
|
-
})), f =
|
|
36
|
-
() => P(d.value,
|
|
35
|
+
})), f = i(
|
|
36
|
+
() => P(d.value, g || "data", []) || []
|
|
37
37
|
), y = (t) => {
|
|
38
|
-
e.value[l] = t.page, 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:
|
|
47
|
+
loading: o,
|
|
48
|
+
total: r,
|
|
48
49
|
run: n,
|
|
49
50
|
onPageChange: y,
|
|
50
51
|
onQuery: K
|
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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 {
|