vft 0.0.91 → 0.0.93
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,22 +1,22 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { VftEmpty as
|
|
1
|
+
import { defineComponent as q, useAttrs as J, ref as s, computed as h, watch as y, createVNode as C, reactive as K, onMounted as Q, resolveComponent as U, openBlock as b, createElementBlock as Z, normalizeClass as S, unref as n, createBlock as L, mergeProps as w, createCommentVNode as R, createSlots as _, withCtx as P, withDirectives as ee, createElementVNode as O, vShow as te } from "vue";
|
|
2
|
+
import { VftEmpty as ae } from "../empty/index.js";
|
|
3
3
|
import { VftPagination as W } from "../pagination/index.js";
|
|
4
|
-
import { useNamespace as
|
|
4
|
+
import { useNamespace as le } from "../../hooks/use-namespace/index.js";
|
|
5
5
|
import "@popperjs/core";
|
|
6
6
|
import "lodash";
|
|
7
7
|
import "../../hooks/use-z-index/index.js";
|
|
8
|
-
import { useDebounceFn as
|
|
8
|
+
import { useDebounceFn as ne, useResizeObserver as oe } from "@vueuse/core";
|
|
9
9
|
import "@vft/utils";
|
|
10
10
|
import "../../utils/ns-cover.js";
|
|
11
11
|
import I from "vxe-table";
|
|
12
|
-
import { EmptyEnum as
|
|
12
|
+
import { EmptyEnum as re } from "../empty/constants.js";
|
|
13
13
|
const r = (
|
|
14
14
|
/* hoist-static*/
|
|
15
|
-
|
|
16
|
-
),
|
|
15
|
+
le("table")
|
|
16
|
+
), ie = q({
|
|
17
17
|
name: r.b()
|
|
18
|
-
}),
|
|
19
|
-
...
|
|
18
|
+
}), be = /* @__PURE__ */ q({
|
|
19
|
+
...ie,
|
|
20
20
|
props: {
|
|
21
21
|
maxHeight: {},
|
|
22
22
|
columns: {},
|
|
@@ -51,28 +51,30 @@ const r = (
|
|
|
51
51
|
},
|
|
52
52
|
emits: ["page-change", "sort-change", "update:pageNum"],
|
|
53
53
|
setup(l, {
|
|
54
|
-
expose:
|
|
54
|
+
expose: T,
|
|
55
55
|
emit: d
|
|
56
56
|
}) {
|
|
57
|
-
const
|
|
58
|
-
|
|
57
|
+
const V = J(), $ = s(0), i = s(), A = ne(() => G(), 120), k = h(() => l.pagePlacement.startsWith("bottom")), D = h(() => l.columns.map((e) => (e.align || (e.align = "center"), !e.formatter && !e.slots && !e.cellRender && (e.formatter = ({
|
|
58
|
+
cellValue: t
|
|
59
|
+
}) => t || "-"), e)));
|
|
60
|
+
y([() => l.loading, () => l.data, () => l.columns], () => {
|
|
59
61
|
A();
|
|
60
62
|
}, {
|
|
61
63
|
immediate: !0
|
|
62
64
|
});
|
|
63
|
-
function
|
|
64
|
-
g.data = l.data,
|
|
65
|
+
function G() {
|
|
66
|
+
g.data = l.data, N(l.pageNum);
|
|
65
67
|
}
|
|
66
68
|
I.renderer.add("Encrypt", {
|
|
67
69
|
// 加密模板
|
|
68
70
|
renderDefault(e, t) {
|
|
69
71
|
const {
|
|
70
72
|
row: a,
|
|
71
|
-
column:
|
|
73
|
+
column: f
|
|
72
74
|
} = t;
|
|
73
|
-
return
|
|
75
|
+
return C("span", {
|
|
74
76
|
class: "line-clamp",
|
|
75
|
-
innerHTML: a[
|
|
77
|
+
innerHTML: a[f.field] || "-"
|
|
76
78
|
}, null);
|
|
77
79
|
}
|
|
78
80
|
}), I.formats.mixin({
|
|
@@ -82,13 +84,13 @@ const r = (
|
|
|
82
84
|
return e || "-";
|
|
83
85
|
}
|
|
84
86
|
});
|
|
85
|
-
function
|
|
87
|
+
function M(e) {
|
|
86
88
|
d("page-change", e), d("update:pageNum", e);
|
|
87
89
|
}
|
|
88
|
-
const
|
|
90
|
+
const X = () => ({
|
|
89
91
|
maxHeight: "88px",
|
|
90
92
|
height: "44px"
|
|
91
|
-
}),
|
|
93
|
+
}), j = (e) => {
|
|
92
94
|
var a;
|
|
93
95
|
const {
|
|
94
96
|
column: t
|
|
@@ -96,7 +98,7 @@ const r = (
|
|
|
96
98
|
return {
|
|
97
99
|
maxHeight: ((a = t == null ? void 0 : t.cellRender) == null ? void 0 : a.name) === "Clamp" ? "max-content" : "44px"
|
|
98
100
|
};
|
|
99
|
-
}, g =
|
|
101
|
+
}, g = K({
|
|
100
102
|
autoResize: !0,
|
|
101
103
|
sortConfig: {
|
|
102
104
|
trigger: "cell",
|
|
@@ -113,8 +115,8 @@ const r = (
|
|
|
113
115
|
},
|
|
114
116
|
cellClassName: "cellClass",
|
|
115
117
|
rowClassName: "rowClass",
|
|
116
|
-
cellStyle:
|
|
117
|
-
rowStyle:
|
|
118
|
+
cellStyle: j,
|
|
119
|
+
rowStyle: X,
|
|
118
120
|
headerRowClassName: "headerRowClass",
|
|
119
121
|
headerAlign: "center",
|
|
120
122
|
columnConfig: {
|
|
@@ -131,47 +133,47 @@ const r = (
|
|
|
131
133
|
enabled: !1
|
|
132
134
|
},
|
|
133
135
|
...l.tableConfig,
|
|
134
|
-
...
|
|
135
|
-
}),
|
|
136
|
+
...V
|
|
137
|
+
}), F = (e) => {
|
|
136
138
|
d("sort-change", e);
|
|
137
139
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
y(() => l.pageNum, (e) => {
|
|
141
|
+
N(e);
|
|
140
142
|
});
|
|
141
|
-
const
|
|
143
|
+
const N = (e) => {
|
|
142
144
|
g.seqConfig && (g.seqConfig.startIndex = (e - 1) * l.pageSize);
|
|
143
|
-
}, u = s(),
|
|
144
|
-
let
|
|
145
|
-
const c =
|
|
145
|
+
}, u = s(), z = s();
|
|
146
|
+
let p = s(!1), o = s(null), m = s(null);
|
|
147
|
+
const c = h(() => {
|
|
146
148
|
var e;
|
|
147
149
|
return ((e = l.sticky) == null ? void 0 : e.getContainer) || document.documentElement || document.body;
|
|
148
150
|
});
|
|
149
|
-
|
|
151
|
+
y(() => [i, l.sticky], () => {
|
|
150
152
|
var e, t, a;
|
|
151
|
-
(e = i.value) != null && e.$el && l.sticky && ((t = c.value) == null || t.removeEventListener("scroll",
|
|
152
|
-
|
|
153
|
+
(e = i.value) != null && e.$el && l.sticky && ((t = c.value) == null || t.removeEventListener("scroll", v), (a = c.value) == null || a.addEventListener("scroll", v), setTimeout(() => {
|
|
154
|
+
E();
|
|
153
155
|
}, 50));
|
|
154
156
|
}, {
|
|
155
157
|
immediate: !0,
|
|
156
158
|
deep: !0
|
|
157
159
|
});
|
|
158
|
-
function
|
|
159
|
-
if (!o.value || !m.value || (
|
|
160
|
+
function E() {
|
|
161
|
+
if (!o.value || !m.value || (v(), !p.value))
|
|
160
162
|
return;
|
|
161
163
|
const e = o.value.clientWidth, t = m.value.offsetWidth;
|
|
162
|
-
u.value.style.width = e - 1 + "px",
|
|
164
|
+
u.value.style.width = e - 1 + "px", z.value.style.width = t + "px";
|
|
163
165
|
}
|
|
164
|
-
function
|
|
165
|
-
var
|
|
166
|
-
if (!((
|
|
166
|
+
function v() {
|
|
167
|
+
var x, B, H;
|
|
168
|
+
if (!((x = i.value) != null && x.$el) || !o.value || !c.value)
|
|
167
169
|
return;
|
|
168
170
|
const e = ((B = c.value) == null ? void 0 : B.clientHeight) || window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight, {
|
|
169
171
|
top: t,
|
|
170
172
|
bottom: a
|
|
171
|
-
} = o.value.getBoundingClientRect(),
|
|
172
|
-
|
|
173
|
+
} = o.value.getBoundingClientRect(), f = ((H = c.value) == null ? void 0 : H.getBoundingClientRect().top) || document.body.getBoundingClientRect().top;
|
|
174
|
+
p.value = t < e && a > e && a - f > e, u.value.scrollLeft = o.value.scrollLeft;
|
|
173
175
|
}
|
|
174
|
-
const
|
|
176
|
+
const Y = () => {
|
|
175
177
|
var t;
|
|
176
178
|
const e = (t = i.value) == null ? void 0 : t.$el;
|
|
177
179
|
e && (o.value = e.querySelector(".vxe-table--body-wrapper"), m.value = e.querySelector(".vxe-table--body"), !(!o.value && !m.value) && (o.value.addEventListener("scroll", function(a) {
|
|
@@ -180,65 +182,65 @@ const r = (
|
|
|
180
182
|
o.value.scrollLeft = a.target.scrollLeft;
|
|
181
183
|
})));
|
|
182
184
|
};
|
|
183
|
-
return
|
|
184
|
-
l.sticky && (
|
|
185
|
-
}),
|
|
185
|
+
return Q(() => {
|
|
186
|
+
l.sticky && (Y(), oe(i, () => E()));
|
|
187
|
+
}), T({
|
|
186
188
|
table: i
|
|
187
189
|
}), (e, t) => {
|
|
188
|
-
const a =
|
|
189
|
-
return
|
|
190
|
-
class:
|
|
191
|
-
}, [
|
|
190
|
+
const a = U("vxe-grid");
|
|
191
|
+
return b(), Z("div", {
|
|
192
|
+
class: S(n(r).b())
|
|
193
|
+
}, [k.value ? R("", !0) : (b(), L(n(W), w({
|
|
192
194
|
key: 0,
|
|
193
195
|
class: [n(r).e("pager"), n(r).m("pager-" + e.pagePlacement)],
|
|
194
196
|
layout: "prev, pager, next"
|
|
195
197
|
}, e.pageOptions, {
|
|
196
198
|
total: e.total,
|
|
197
199
|
"page-size": e.pageSize,
|
|
198
|
-
onCurrentChange: t[0] || (t[0] = (
|
|
200
|
+
onCurrentChange: t[0] || (t[0] = (f) => d("page-change", e.pageNum)),
|
|
199
201
|
"current-page": e.pageNum
|
|
200
|
-
}), null, 16, ["class", "total", "page-size", "current-page"])),
|
|
202
|
+
}), null, 16, ["class", "total", "page-size", "current-page"])), C(a, w({
|
|
201
203
|
ref_key: "xGrid",
|
|
202
204
|
ref: i
|
|
203
205
|
}, g, {
|
|
204
206
|
height: e.height,
|
|
205
207
|
"max-height": e.maxHeight,
|
|
206
|
-
columns:
|
|
208
|
+
columns: D.value,
|
|
207
209
|
data: e.data,
|
|
208
210
|
"auto-resize": "",
|
|
209
211
|
loading: e.loading,
|
|
210
212
|
resizable: "",
|
|
211
|
-
onSortChange:
|
|
212
|
-
}),
|
|
213
|
-
empty:
|
|
214
|
-
type: n(
|
|
213
|
+
onSortChange: F
|
|
214
|
+
}), _({
|
|
215
|
+
empty: P(() => [C(n(ae), {
|
|
216
|
+
type: n(re).NO_DATA
|
|
215
217
|
}, null, 8, ["type"])]),
|
|
216
218
|
_: 2
|
|
217
219
|
}, [e.sticky ? {
|
|
218
220
|
name: "bottom",
|
|
219
|
-
fn:
|
|
221
|
+
fn: P(() => [ee(O("div", {
|
|
220
222
|
ref_key: "stickyScroll",
|
|
221
223
|
ref: u,
|
|
222
|
-
class:
|
|
224
|
+
class: S(n(r).e("sticky-scroll-warpper"))
|
|
223
225
|
}, [O("div", {
|
|
224
226
|
ref_key: "stickyScrollBar",
|
|
225
|
-
ref:
|
|
226
|
-
class:
|
|
227
|
-
}, null, 2)], 2), [[
|
|
227
|
+
ref: z,
|
|
228
|
+
class: S(n(r).e("sticky-scroll-bar"))
|
|
229
|
+
}, null, 2)], 2), [[te, n(p)]])]),
|
|
228
230
|
key: "0"
|
|
229
|
-
} : void 0]), 1040, ["height", "max-height", "columns", "data", "loading"]),
|
|
231
|
+
} : void 0]), 1040, ["height", "max-height", "columns", "data", "loading"]), k.value ? (b(), L(n(W), w({
|
|
230
232
|
key: 1,
|
|
231
233
|
class: [n(r).e("pager"), n(r).m("pager-" + e.pagePlacement)],
|
|
232
234
|
layout: "prev, pager, next"
|
|
233
235
|
}, e.pageOptions, {
|
|
234
236
|
total: e.total,
|
|
235
237
|
"page-size": e.pageSize,
|
|
236
|
-
onCurrentChange:
|
|
238
|
+
onCurrentChange: M,
|
|
237
239
|
"current-page": e.pageNum
|
|
238
|
-
}), null, 16, ["class", "total", "page-size", "current-page"])) :
|
|
240
|
+
}), null, 16, ["class", "total", "page-size", "current-page"])) : R("", !0)], 2);
|
|
239
241
|
};
|
|
240
242
|
}
|
|
241
243
|
});
|
|
242
244
|
export {
|
|
243
|
-
|
|
245
|
+
be as default
|
|
244
246
|
};
|
package/es/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),$=require("../empty/index.cjs"),k=require("../pagination/index.cjs"),I=require("../../hooks/use-namespace/index.cjs");require("@popperjs/core");require("lodash");require("../../hooks/use-z-index/index.cjs");const N=require("@vueuse/core");require("@vft/utils");require("../../utils/ns-cover.cjs");const q=require("vxe-table"),T=require("../empty/constants.cjs"),o=I.useNamespace("table"),A=t.defineComponent({name:o.b()}),D=t.defineComponent({...A,props:{maxHeight:{},columns:{},data:{default:[]},loading:{type:Boolean,default:!1},height:{},pageSize:{default:50},pageNum:{default:1},total:{},defaultSort:{default:{}},tableConfig:{default:{}},sticky:{type:[Boolean,Object]},pagePlacement:{default:"bottom-right"},pageOptions:{}},emits:["page-change","sort-change","update:pageNum"],setup(r,{expose:x,emit:c}){const z=t.useAttrs(),B=t.ref(0),u=t.ref(),E=N.useDebounceFn(()=>H(),120),v=t.computed(()=>r.pagePlacement.startsWith("bottom")),P=t.computed(()=>r.columns.map(e=>(e.align||(e.align="center"),!e.formatter&&!e.slots&&!e.cellRender&&(e.formatter=({cellValue:n})=>n||"-"),e)));t.watch([()=>r.loading,()=>r.data,()=>r.columns],()=>{E()},{immediate:!0});function H(){d.data=r.data,h(r.pageNum)}q.renderer.add("Encrypt",{renderDefault(e,n){const{row:a,column:f}=n;return t.createVNode("span",{class:"line-clamp",innerHTML:a[f.field]||"-"},null)}}),q.formats.mixin({showEmpty({cellValue:e}){return e||"-"}});function L(e){c("page-change",e),c("update:pageNum",e)}const R=()=>({maxHeight:"88px",height:"44px"}),V=e=>{var a;const{column:n}=e;return{maxHeight:((a=n==null?void 0:n.cellRender)==null?void 0:a.name)==="Clamp"?"max-content":"44px"}},d=t.reactive({autoResize:!0,sortConfig:{trigger:"cell",remote:!0,defaultSort:{field:"",order:"desc",...r.defaultSort},orders:["desc","asc",null]},seqConfig:{startIndex:B.value},cellClassName:"cellClass",rowClassName:"rowClass",cellStyle:V,rowStyle:R,headerRowClassName:"headerRowClass",headerAlign:"center",columnConfig:{resizable:!0},rowConfig:{isHover:!0},scrollY:{mode:"wheel"},scrollX:{enabled:!1},...r.tableConfig,...z}),O=e=>{c("sort-change",e)};t.watch(()=>r.pageNum,e=>{h(e)});const h=e=>{d.seqConfig&&(d.seqConfig.startIndex=(e-1)*r.pageSize)},s=t.ref(),y=t.ref();let m=t.ref(!1),l=t.ref(null),g=t.ref(null);const i=t.computed(()=>{var e;return((e=r.sticky)==null?void 0:e.getContainer)||document.documentElement||document.body});t.watch(()=>[u,r.sticky],()=>{var e,n,a;(e=u.value)!=null&&e.$el&&r.sticky&&((n=i.value)==null||n.removeEventListener("scroll",p),(a=i.value)==null||a.addEventListener("scroll",p),setTimeout(()=>{C()},50))},{immediate:!0,deep:!0});function C(){if(!l.value||!g.value||(p(),!m.value))return;const e=l.value.clientWidth,n=g.value.offsetWidth;s.value.style.width=e-1+"px",y.value.style.width=n+"px"}function p(){var b,S,w;if(!((b=u.value)!=null&&b.$el)||!l.value||!i.value)return;const e=((S=i.value)==null?void 0:S.clientHeight)||window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,{top:n,bottom:a}=l.value.getBoundingClientRect(),f=((w=i.value)==null?void 0:w.getBoundingClientRect().top)||document.body.getBoundingClientRect().top;m.value=n<e&&a>e&&a-f>e,s.value.scrollLeft=l.value.scrollLeft}const W=()=>{var n;const e=(n=u.value)==null?void 0:n.$el;e&&(l.value=e.querySelector(".vxe-table--body-wrapper"),g.value=e.querySelector(".vxe-table--body"),!(!l.value&&!g.value)&&(l.value.addEventListener("scroll",function(a){s.value.scrollLeft=a.target.scrollLeft}),s.value.addEventListener("scroll",function(a){l.value.scrollLeft=a.target.scrollLeft})))};return t.onMounted(()=>{r.sticky&&(W(),N.useResizeObserver(u,()=>C()))}),x({table:u}),(e,n)=>{const a=t.resolveComponent("vxe-grid");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(o).b())},[v.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(k.VftPagination),t.mergeProps({key:0,class:[t.unref(o).e("pager"),t.unref(o).m("pager-"+e.pagePlacement)],layout:"prev, pager, next"},e.pageOptions,{total:e.total,"page-size":e.pageSize,onCurrentChange:n[0]||(n[0]=f=>c("page-change",e.pageNum)),"current-page":e.pageNum}),null,16,["class","total","page-size","current-page"])),t.createVNode(a,t.mergeProps({ref_key:"xGrid",ref:u},d,{height:e.height,"max-height":e.maxHeight,columns:P.value,data:e.data,"auto-resize":"",loading:e.loading,resizable:"",onSortChange:O}),t.createSlots({empty:t.withCtx(()=>[t.createVNode(t.unref($.VftEmpty),{type:t.unref(T.EmptyEnum).NO_DATA},null,8,["type"])]),_:2},[e.sticky?{name:"bottom",fn:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{ref_key:"stickyScroll",ref:s,class:t.normalizeClass(t.unref(o).e("sticky-scroll-warpper"))},[t.createElementVNode("div",{ref_key:"stickyScrollBar",ref:y,class:t.normalizeClass(t.unref(o).e("sticky-scroll-bar"))},null,2)],2),[[t.vShow,t.unref(m)]])]),key:"0"}:void 0]),1040,["height","max-height","columns","data","loading"]),v.value?(t.openBlock(),t.createBlock(t.unref(k.VftPagination),t.mergeProps({key:1,class:[t.unref(o).e("pager"),t.unref(o).m("pager-"+e.pagePlacement)],layout:"prev, pager, next"},e.pageOptions,{total:e.total,"page-size":e.pageSize,onCurrentChange:L,"current-page":e.pageNum}),null,16,["class","total","page-size","current-page"])):t.createCommentVNode("",!0)],2)}}});exports.default=D;
|
package/lib/package.json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.93";exports.version=e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.93",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"qrcode": "1.5.1",
|
|
54
54
|
"resize-detector": "0.3.0",
|
|
55
55
|
"sortablejs": "^1.15.0",
|
|
56
|
-
"@vft/
|
|
57
|
-
"@vft/
|
|
58
|
-
"@vft/
|
|
59
|
-
"@vft/
|
|
60
|
-
"@vft/
|
|
61
|
-
"@vft/
|
|
56
|
+
"@vft/constants": "0.0.55",
|
|
57
|
+
"@vft/router": "0.0.24",
|
|
58
|
+
"@vft/store": "0.0.24",
|
|
59
|
+
"@vft/use": "0.0.27",
|
|
60
|
+
"@vft/utils": "0.0.37",
|
|
61
|
+
"@vft/directives": "0.0.20"
|
|
62
62
|
},
|
|
63
63
|
"vetur": {
|
|
64
64
|
"tags": "tags.json",
|