vft 0.0.67 → 0.0.69
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/es/components/table/table.vue.d.ts +9 -25
- package/es/components/table/table.vue2.js +141 -94
- package/es/package.json.js +1 -1
- package/lib/components/table/table.vue.d.ts +9 -25
- package/lib/components/table/table.vue2.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/package.json +4 -6
- package/web-types.json +1 -1
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
import type { PropType as __PropType } from 'vue';
|
|
2
2
|
import { type PaginationProps } from 'vft/es/components/pagination';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IDefaultSort, TableConfigProps } from './type';
|
|
4
4
|
interface stickyOption {
|
|
5
5
|
offsetTop: number;
|
|
6
6
|
getContainer?: HTMLElement;
|
|
7
7
|
}
|
|
8
|
-
export interface TableProps {
|
|
9
|
-
/** 最大高度,设置后自动开启虚拟滚动 */
|
|
10
|
-
maxHeight?: number;
|
|
11
|
-
/** 列配置项 */
|
|
12
|
-
columns: IColumnsOption[];
|
|
13
|
-
/** 表格数据 */
|
|
14
|
-
tableData: any[];
|
|
15
|
-
/** 是否在加载中 */
|
|
16
|
-
loading?: boolean;
|
|
17
|
-
/** 表格高度 */
|
|
18
|
-
height?: Numberish;
|
|
19
|
-
/** 分页页数 */
|
|
20
|
-
pageSize?: number;
|
|
21
|
-
/** 总数 */
|
|
22
|
-
total?: number;
|
|
23
|
-
/** 默认排序 */
|
|
24
|
-
defaultSort?: IDefaultSort;
|
|
25
|
-
/** 表格配置 */
|
|
26
|
-
tableConfig?: TableConfigProps;
|
|
27
|
-
/** 滚动条是否固定在底部 */
|
|
28
|
-
sticky?: boolean | stickyOption;
|
|
29
|
-
pagePlacement?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
|
|
30
|
-
pageOptions: Partial<PaginationProps>;
|
|
31
|
-
}
|
|
32
8
|
declare const _sfc_main: import("vue").DefineComponent<{
|
|
33
9
|
maxHeight: {
|
|
34
10
|
type: __PropType<number | undefined>;
|
|
@@ -54,6 +30,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
54
30
|
type: __PropType<number | undefined>;
|
|
55
31
|
required: false;
|
|
56
32
|
};
|
|
33
|
+
pageNum: {
|
|
34
|
+
type: __PropType<number | undefined>;
|
|
35
|
+
required: false;
|
|
36
|
+
};
|
|
57
37
|
total: {
|
|
58
38
|
type: __PropType<number | undefined>;
|
|
59
39
|
required: false;
|
|
@@ -105,6 +85,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
105
85
|
type: __PropType<number | undefined>;
|
|
106
86
|
required: false;
|
|
107
87
|
};
|
|
88
|
+
pageNum: {
|
|
89
|
+
type: __PropType<number | undefined>;
|
|
90
|
+
required: false;
|
|
91
|
+
};
|
|
108
92
|
total: {
|
|
109
93
|
type: __PropType<number | undefined>;
|
|
110
94
|
required: false;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { VftEmpty as
|
|
3
|
-
import { VftPagination as
|
|
4
|
-
import { useNamespace as
|
|
1
|
+
import { defineComponent as W, useAttrs as U, ref as d, computed as x, watch as w, createVNode as y, resolveComponent as L, nextTick as Z, reactive as _, onMounted as ee, openBlock as S, createElementBlock as te, normalizeClass as k, unref as a, createBlock as O, mergeProps as N, createCommentVNode as D, createSlots as le, withCtx as P, withDirectives as ne, createElementVNode as T, vShow as ae } from "vue";
|
|
2
|
+
import { VftEmpty as oe } from "../empty/index.js";
|
|
3
|
+
import { VftPagination as I } from "../pagination/index.js";
|
|
4
|
+
import { useNamespace as re } 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 ie, useResizeObserver as ce } from "@vueuse/core";
|
|
9
9
|
import "@vft/utils";
|
|
10
10
|
import "../../utils/ns-cover.js";
|
|
11
11
|
import "@vue/reactivity";
|
|
12
12
|
import "@vue/shared";
|
|
13
|
-
import
|
|
14
|
-
import { EmptyEnum as
|
|
15
|
-
const
|
|
13
|
+
import E from "vxe-table";
|
|
14
|
+
import { EmptyEnum as se } from "../empty/constants.js";
|
|
15
|
+
const c = (
|
|
16
16
|
/* hoist-static*/
|
|
17
|
-
|
|
18
|
-
),
|
|
19
|
-
name:
|
|
20
|
-
}),
|
|
21
|
-
...
|
|
17
|
+
re("table")
|
|
18
|
+
), ue = W({
|
|
19
|
+
name: c.b()
|
|
20
|
+
}), Ne = /* @__PURE__ */ W({
|
|
21
|
+
...ue,
|
|
22
22
|
props: {
|
|
23
23
|
maxHeight: null,
|
|
24
24
|
columns: null,
|
|
@@ -33,6 +33,9 @@ const s = (
|
|
|
33
33
|
pageSize: {
|
|
34
34
|
default: 50
|
|
35
35
|
},
|
|
36
|
+
pageNum: {
|
|
37
|
+
default: 1
|
|
38
|
+
},
|
|
36
39
|
total: null,
|
|
37
40
|
defaultSort: {
|
|
38
41
|
default: {}
|
|
@@ -50,39 +53,85 @@ const s = (
|
|
|
50
53
|
},
|
|
51
54
|
emits: ["page-change", "sort-change", "update:pageNum"],
|
|
52
55
|
setup(t, {
|
|
53
|
-
expose:
|
|
54
|
-
emit:
|
|
56
|
+
expose: q,
|
|
57
|
+
emit: h
|
|
55
58
|
}) {
|
|
56
|
-
const V =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
const V = U(), A = d(0), s = d(), $ = ie(() => M(), 120), z = x(() => t.pagePlacement.startsWith("bottom"));
|
|
60
|
+
w([() => t.loading, () => t.tableData, () => t.columns], () => {
|
|
61
|
+
$();
|
|
59
62
|
}, {
|
|
60
63
|
immediate: !0
|
|
61
64
|
});
|
|
62
|
-
function
|
|
63
|
-
|
|
65
|
+
function M() {
|
|
66
|
+
v.data = t.tableData, H(t.pageNum);
|
|
64
67
|
}
|
|
65
|
-
|
|
68
|
+
E.renderer.add("Encrypt", {
|
|
69
|
+
// 加密模板
|
|
70
|
+
renderDefault(e, l) {
|
|
71
|
+
const {
|
|
72
|
+
row: n,
|
|
73
|
+
column: o
|
|
74
|
+
} = l;
|
|
75
|
+
return y("span", {
|
|
76
|
+
class: "line-clamp",
|
|
77
|
+
innerHTML: n[o.field] || "-"
|
|
78
|
+
}, null);
|
|
79
|
+
}
|
|
80
|
+
}), E.renderer.add("Clamp", {
|
|
81
|
+
// 展开收起
|
|
82
|
+
renderDefault(e, l) {
|
|
83
|
+
const {
|
|
84
|
+
row: n,
|
|
85
|
+
column: o
|
|
86
|
+
} = l;
|
|
87
|
+
return o.showOverflow = null, y(L("vftClampToggle"), {
|
|
88
|
+
autoResize: !0,
|
|
89
|
+
maxLines: 2,
|
|
90
|
+
text: n[o.field],
|
|
91
|
+
title: n[o.field],
|
|
92
|
+
toggleText: ["展开", "收起"],
|
|
93
|
+
onClampChange: (i) => X(l)
|
|
94
|
+
}, null);
|
|
95
|
+
}
|
|
96
|
+
}), E.formats.mixin({
|
|
66
97
|
showEmpty({
|
|
67
98
|
cellValue: e
|
|
68
99
|
}) {
|
|
69
100
|
return e || "-";
|
|
70
101
|
}
|
|
71
102
|
});
|
|
72
|
-
|
|
103
|
+
function G(e) {
|
|
104
|
+
h("page-change", e), h("update:pageNum", e);
|
|
105
|
+
}
|
|
106
|
+
const X = (e, l) => {
|
|
107
|
+
const {
|
|
108
|
+
rowid: n
|
|
109
|
+
} = e;
|
|
110
|
+
Z(() => {
|
|
111
|
+
const o = document.getElementsByClassName("vxe-body--row"), i = [];
|
|
112
|
+
for (var u = 0; u < o.length; u++)
|
|
113
|
+
o[u].getAttribute("rowid") === n && i.push(o[u]);
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
if (i.length > 1) {
|
|
116
|
+
const g = i[0].clientHeight, Q = i[1].clientHeight;
|
|
117
|
+
g !== Q && (i[1].style.height = g + "px");
|
|
118
|
+
}
|
|
119
|
+
}, 1);
|
|
120
|
+
});
|
|
121
|
+
}, j = x(() => t.columns.filter((e) => (e && e.type !== "seq" && !e.formatter && !e.slots && !e.cellRender && (e.cellRender = {
|
|
73
122
|
name: "Encrypt"
|
|
74
|
-
}), e))),
|
|
123
|
+
}), e))), F = () => ({
|
|
75
124
|
maxHeight: "88px",
|
|
76
125
|
height: "44px"
|
|
77
|
-
}),
|
|
78
|
-
var
|
|
126
|
+
}), Y = (e) => {
|
|
127
|
+
var n;
|
|
79
128
|
const {
|
|
80
129
|
column: l
|
|
81
130
|
} = e;
|
|
82
131
|
return {
|
|
83
|
-
maxHeight: ((
|
|
132
|
+
maxHeight: ((n = l == null ? void 0 : l.cellRender) == null ? void 0 : n.name) === "Clamp" ? "max-content" : "44px"
|
|
84
133
|
};
|
|
85
|
-
},
|
|
134
|
+
}, v = _({
|
|
86
135
|
autoResize: !0,
|
|
87
136
|
sortConfig: {
|
|
88
137
|
trigger: "cell",
|
|
@@ -95,12 +144,12 @@ const s = (
|
|
|
95
144
|
orders: ["desc", "asc", null]
|
|
96
145
|
},
|
|
97
146
|
seqConfig: {
|
|
98
|
-
startIndex:
|
|
147
|
+
startIndex: A.value
|
|
99
148
|
},
|
|
100
149
|
cellClassName: "cellClass",
|
|
101
150
|
rowClassName: "rowClass",
|
|
102
|
-
cellStyle:
|
|
103
|
-
rowStyle:
|
|
151
|
+
cellStyle: Y,
|
|
152
|
+
rowStyle: F,
|
|
104
153
|
headerRowClassName: "headerRowClass",
|
|
105
154
|
headerAlign: "center",
|
|
106
155
|
columnConfig: {
|
|
@@ -118,115 +167,113 @@ const s = (
|
|
|
118
167
|
},
|
|
119
168
|
...t.tableConfig,
|
|
120
169
|
...V
|
|
121
|
-
}),
|
|
122
|
-
|
|
170
|
+
}), J = (e) => {
|
|
171
|
+
h("sort-change", e);
|
|
123
172
|
};
|
|
124
|
-
|
|
125
|
-
|
|
173
|
+
w(() => t.pageNum, (e) => {
|
|
174
|
+
H(e);
|
|
126
175
|
});
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
let
|
|
131
|
-
const
|
|
176
|
+
const H = (e) => {
|
|
177
|
+
v.seqConfig && (v.seqConfig.startIndex = (e - 1) * t.pageSize);
|
|
178
|
+
}, m = d(), B = d(), C = d(!1);
|
|
179
|
+
let r = d(), p = d();
|
|
180
|
+
const f = x(() => {
|
|
132
181
|
var e;
|
|
133
182
|
return ((e = t.sticky) == null ? void 0 : e.getContainer) || document.documentElement || document.body;
|
|
134
183
|
});
|
|
135
|
-
|
|
136
|
-
var e, l,
|
|
137
|
-
(e =
|
|
138
|
-
|
|
184
|
+
w(() => [s, t.sticky], () => {
|
|
185
|
+
var e, l, n;
|
|
186
|
+
(e = s.value) != null && e.$el && t.sticky && ((l = f.value) == null || l.removeEventListener("scroll", b), (n = f.value) == null || n.addEventListener("scroll", b), setTimeout(() => {
|
|
187
|
+
R();
|
|
139
188
|
}, 50));
|
|
140
189
|
}, {
|
|
141
190
|
immediate: !0,
|
|
142
191
|
deep: !0
|
|
143
192
|
});
|
|
144
|
-
function
|
|
145
|
-
if (!
|
|
193
|
+
function R() {
|
|
194
|
+
if (!r.value || !p.value || (b(), !C.value))
|
|
146
195
|
return;
|
|
147
|
-
const e =
|
|
148
|
-
|
|
196
|
+
const e = r.value.clientWidth, l = p.value.offsetWidth;
|
|
197
|
+
m.value.style.width = e - 1 + "px", B.value.style.width = l + "px";
|
|
149
198
|
}
|
|
150
|
-
function
|
|
151
|
-
var
|
|
152
|
-
if (!((
|
|
199
|
+
function b() {
|
|
200
|
+
var i, u, g;
|
|
201
|
+
if (!((i = s.value) != null && i.$el) || !r.value || !f.value)
|
|
153
202
|
return;
|
|
154
|
-
const e = ((
|
|
203
|
+
const e = ((u = f.value) == null ? void 0 : u.clientHeight) || window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight, {
|
|
155
204
|
top: l,
|
|
156
|
-
bottom:
|
|
157
|
-
} =
|
|
158
|
-
|
|
205
|
+
bottom: n
|
|
206
|
+
} = r.value.getBoundingClientRect(), o = ((g = f.value) == null ? void 0 : g.getBoundingClientRect().top) || document.body.getBoundingClientRect().top;
|
|
207
|
+
C.value = l < e && n > e && n - o > e, m.value.scrollLeft = r.value.scrollLeft;
|
|
159
208
|
}
|
|
160
|
-
const
|
|
209
|
+
const K = () => {
|
|
161
210
|
var l;
|
|
162
|
-
const e = (l =
|
|
163
|
-
e && (
|
|
164
|
-
|
|
165
|
-
}),
|
|
166
|
-
|
|
211
|
+
const e = (l = s.value) == null ? void 0 : l.$el;
|
|
212
|
+
e && (r.value = e.querySelector(".vxe-table--body-wrapper"), p.value = e.querySelector(".vxe-table--body"), !(!r.value && !p.value) && (r.value.addEventListener("scroll", function(n) {
|
|
213
|
+
m.value.scrollLeft = n.target.scrollLeft;
|
|
214
|
+
}), m.value.addEventListener("scroll", function(n) {
|
|
215
|
+
r.value.scrollLeft = n.target.scrollLeft;
|
|
167
216
|
})));
|
|
168
217
|
};
|
|
169
|
-
return
|
|
170
|
-
t.sticky && (
|
|
171
|
-
}),
|
|
172
|
-
table:
|
|
218
|
+
return ee(() => {
|
|
219
|
+
t.sticky && (K(), ce(s, () => R()));
|
|
220
|
+
}), q({
|
|
221
|
+
table: s
|
|
173
222
|
}), (e, l) => {
|
|
174
|
-
const
|
|
175
|
-
return
|
|
176
|
-
class:
|
|
177
|
-
}, [
|
|
223
|
+
const n = L("vxe-grid");
|
|
224
|
+
return S(), te("div", {
|
|
225
|
+
class: k(a(c).b())
|
|
226
|
+
}, [a(z) ? D("", !0) : (S(), O(a(I), N({
|
|
178
227
|
key: 0,
|
|
179
|
-
class: [
|
|
228
|
+
class: [a(c).e("pager"), a(c).m("pager-" + t.pagePlacement)],
|
|
180
229
|
layout: "prev, pager, next"
|
|
181
230
|
}, t.pageOptions, {
|
|
182
231
|
total: t.total,
|
|
183
232
|
"page-size": t.pageSize,
|
|
184
|
-
onCurrentChange: l[0] || (l[0] = (
|
|
185
|
-
"current-page":
|
|
186
|
-
|
|
187
|
-
}), null, 16, ["class", "total", "page-size", "current-page"])), P(a, S({
|
|
233
|
+
onCurrentChange: l[0] || (l[0] = (o) => h("page-change", t.pageNum)),
|
|
234
|
+
"current-page": t.pageNum
|
|
235
|
+
}), null, 16, ["class", "total", "page-size", "current-page"])), y(n, N({
|
|
188
236
|
ref_key: "xGrid",
|
|
189
|
-
ref:
|
|
190
|
-
},
|
|
237
|
+
ref: s
|
|
238
|
+
}, v, {
|
|
191
239
|
height: t.height,
|
|
192
240
|
"max-height": t.maxHeight,
|
|
193
|
-
columns:
|
|
241
|
+
columns: a(j),
|
|
194
242
|
data: t.tableData,
|
|
195
243
|
"auto-resize": "",
|
|
196
244
|
loading: t.loading,
|
|
197
245
|
resizable: "",
|
|
198
|
-
onSortChange:
|
|
199
|
-
}),
|
|
200
|
-
empty:
|
|
201
|
-
type:
|
|
246
|
+
onSortChange: J
|
|
247
|
+
}), le({
|
|
248
|
+
empty: P(() => [y(a(oe), {
|
|
249
|
+
type: a(se).NO_DATA
|
|
202
250
|
}, null, 8, ["type"])]),
|
|
203
251
|
_: 2
|
|
204
252
|
}, [t.sticky ? {
|
|
205
253
|
name: "bottom",
|
|
206
|
-
fn:
|
|
254
|
+
fn: P(() => [ne(T("div", {
|
|
207
255
|
ref_key: "stickyScroll",
|
|
208
|
-
ref:
|
|
209
|
-
class:
|
|
210
|
-
}, [
|
|
256
|
+
ref: m,
|
|
257
|
+
class: k(a(c).e("sticky-scroll-warpper"))
|
|
258
|
+
}, [T("div", {
|
|
211
259
|
ref_key: "stickyScrollBar",
|
|
212
|
-
ref:
|
|
213
|
-
class:
|
|
214
|
-
}, null, 2)], 2), [[
|
|
260
|
+
ref: B,
|
|
261
|
+
class: k(a(c).e("sticky-scroll-bar"))
|
|
262
|
+
}, null, 2)], 2), [[ae, C.value]])]),
|
|
215
263
|
key: "0"
|
|
216
|
-
} : void 0]), 1040, ["height", "max-height", "columns", "data", "loading"]),
|
|
264
|
+
} : void 0]), 1040, ["height", "max-height", "columns", "data", "loading"]), a(z) ? (S(), O(a(I), N({
|
|
217
265
|
key: 1,
|
|
218
|
-
class: [
|
|
266
|
+
class: [a(c).e("pager"), a(c).m("pager-" + t.pagePlacement)],
|
|
219
267
|
layout: "prev, pager, next"
|
|
220
268
|
}, t.pageOptions, {
|
|
221
269
|
total: t.total,
|
|
222
270
|
"page-size": t.pageSize,
|
|
223
|
-
onCurrentChange:
|
|
224
|
-
"current-page":
|
|
225
|
-
|
|
226
|
-
}), null, 16, ["class", "total", "page-size", "current-page"])) : N("", !0)], 2);
|
|
271
|
+
onCurrentChange: G,
|
|
272
|
+
"current-page": t.pageNum
|
|
273
|
+
}), null, 16, ["class", "total", "page-size", "current-page"])) : D("", !0)], 2);
|
|
227
274
|
};
|
|
228
275
|
}
|
|
229
276
|
});
|
|
230
277
|
export {
|
|
231
|
-
|
|
278
|
+
Ne as default
|
|
232
279
|
};
|
package/es/package.json.js
CHANGED
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
import type { PropType as __PropType } from 'vue';
|
|
2
2
|
import { type PaginationProps } from 'vft/es/components/pagination';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IDefaultSort, TableConfigProps } from './type';
|
|
4
4
|
interface stickyOption {
|
|
5
5
|
offsetTop: number;
|
|
6
6
|
getContainer?: HTMLElement;
|
|
7
7
|
}
|
|
8
|
-
export interface TableProps {
|
|
9
|
-
/** 最大高度,设置后自动开启虚拟滚动 */
|
|
10
|
-
maxHeight?: number;
|
|
11
|
-
/** 列配置项 */
|
|
12
|
-
columns: IColumnsOption[];
|
|
13
|
-
/** 表格数据 */
|
|
14
|
-
tableData: any[];
|
|
15
|
-
/** 是否在加载中 */
|
|
16
|
-
loading?: boolean;
|
|
17
|
-
/** 表格高度 */
|
|
18
|
-
height?: Numberish;
|
|
19
|
-
/** 分页页数 */
|
|
20
|
-
pageSize?: number;
|
|
21
|
-
/** 总数 */
|
|
22
|
-
total?: number;
|
|
23
|
-
/** 默认排序 */
|
|
24
|
-
defaultSort?: IDefaultSort;
|
|
25
|
-
/** 表格配置 */
|
|
26
|
-
tableConfig?: TableConfigProps;
|
|
27
|
-
/** 滚动条是否固定在底部 */
|
|
28
|
-
sticky?: boolean | stickyOption;
|
|
29
|
-
pagePlacement?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
|
|
30
|
-
pageOptions: Partial<PaginationProps>;
|
|
31
|
-
}
|
|
32
8
|
declare const _sfc_main: import("vue").DefineComponent<{
|
|
33
9
|
maxHeight: {
|
|
34
10
|
type: __PropType<number | undefined>;
|
|
@@ -54,6 +30,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
54
30
|
type: __PropType<number | undefined>;
|
|
55
31
|
required: false;
|
|
56
32
|
};
|
|
33
|
+
pageNum: {
|
|
34
|
+
type: __PropType<number | undefined>;
|
|
35
|
+
required: false;
|
|
36
|
+
};
|
|
57
37
|
total: {
|
|
58
38
|
type: __PropType<number | undefined>;
|
|
59
39
|
required: false;
|
|
@@ -105,6 +85,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
105
85
|
type: __PropType<number | undefined>;
|
|
106
86
|
required: false;
|
|
107
87
|
};
|
|
88
|
+
pageNum: {
|
|
89
|
+
type: __PropType<number | undefined>;
|
|
90
|
+
required: false;
|
|
91
|
+
};
|
|
108
92
|
total: {
|
|
109
93
|
type: __PropType<number | undefined>;
|
|
110
94
|
required: false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),W=require("../empty/index.cjs"),k=require("../pagination/index.cjs"),$=require("../../hooks/use-namespace/index.cjs");require("@popperjs/core");require("lodash");require("../../hooks/use-z-index/index.cjs");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),W=require("../empty/index.cjs"),k=require("../pagination/index.cjs"),$=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");require("@vue/reactivity");require("@vue/shared");const p=require("vxe-table"),A=require("../empty/constants.cjs"),u=$.useNamespace("table"),M=e.defineComponent({name:u.b()}),j=e.defineComponent({...M,props:{maxHeight:null,columns:null,tableData:{default:[]},loading:{type:Boolean,default:!1},height:null,pageSize:{default:50},pageNum:{default:1},total:null,defaultSort:{default:{}},tableConfig:{default:{}},sticky:{type:[Boolean,Object]},pagePlacement:{default:"bottom-right"},pageOptions:null},emits:["page-change","sort-change","update:pageNum"],setup(n,{expose:q,emit:m}){const z=e.useAttrs(),B=e.ref(0),i=e.ref(),E=N.useDebounceFn(()=>H(),120),x=e.computed(()=>n.pagePlacement.startsWith("bottom"));e.watch([()=>n.loading,()=>n.tableData,()=>n.columns],()=>{E()},{immediate:!0});function H(){h.data=n.tableData,b(n.pageNum)}p.renderer.add("Encrypt",{renderDefault(t,l){const{row:a,column:r}=l;return e.createVNode("span",{class:"line-clamp",innerHTML:a[r.field]||"-"},null)}}),p.renderer.add("Clamp",{renderDefault(t,l){const{row:a,column:r}=l;return r.showOverflow=null,e.createVNode(e.resolveComponent("vftClampToggle"),{autoResize:!0,maxLines:2,text:a[r.field],title:a[r.field],toggleText:["展开","收起"],onClampChange:c=>R(l)},null)}}),p.formats.mixin({showEmpty({cellValue:t}){return t||"-"}});function P(t){m("page-change",t),m("update:pageNum",t)}const R=(t,l)=>{const{rowid:a}=t;e.nextTick(()=>{const r=document.getElementsByClassName("vxe-body--row"),c=[];for(var s=0;s<r.length;s++)r[s].getAttribute("rowid")===a&&c.push(r[s]);setTimeout(()=>{if(c.length>1){const d=c[0].clientHeight,I=c[1].clientHeight;d!==I&&(c[1].style.height=d+"px")}},1)})},L=e.computed(()=>n.columns.filter(t=>(t&&t.type!=="seq"&&!t.formatter&&!t.slots&&!t.cellRender&&(t.cellRender={name:"Encrypt"}),t))),V=()=>({maxHeight:"88px",height:"44px"}),O=t=>{var a;const{column:l}=t;return{maxHeight:((a=l==null?void 0:l.cellRender)==null?void 0:a.name)==="Clamp"?"max-content":"44px"}},h=e.reactive({autoResize:!0,sortConfig:{trigger:"cell",remote:!0,defaultSort:{field:"",order:"desc",...n.defaultSort},orders:["desc","asc",null]},seqConfig:{startIndex:B.value},cellClassName:"cellClass",rowClassName:"rowClass",cellStyle:O,rowStyle:V,headerRowClassName:"headerRowClass",headerAlign:"center",columnConfig:{resizable:!0},rowConfig:{isHover:!0},scrollY:{mode:"wheel"},scrollX:{enabled:!1},...n.tableConfig,...z}),T=t=>{m("sort-change",t)};e.watch(()=>n.pageNum,t=>{b(t)});const b=t=>{h.seqConfig&&(h.seqConfig.startIndex=(t-1)*n.pageSize)},g=e.ref(),w=e.ref(),y=e.ref(!1);let o=e.ref(),v=e.ref();const f=e.computed(()=>{var t;return((t=n.sticky)==null?void 0:t.getContainer)||document.documentElement||document.body});e.watch(()=>[i,n.sticky],()=>{var t,l,a;(t=i.value)!=null&&t.$el&&n.sticky&&((l=f.value)==null||l.removeEventListener("scroll",C),(a=f.value)==null||a.addEventListener("scroll",C),setTimeout(()=>{S()},50))},{immediate:!0,deep:!0});function S(){if(!o.value||!v.value||(C(),!y.value))return;const t=o.value.clientWidth,l=v.value.offsetWidth;g.value.style.width=t-1+"px",w.value.style.width=l+"px"}function C(){var c,s,d;if(!((c=i.value)!=null&&c.$el)||!o.value||!f.value)return;const t=((s=f.value)==null?void 0:s.clientHeight)||window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,{top:l,bottom:a}=o.value.getBoundingClientRect(),r=((d=f.value)==null?void 0:d.getBoundingClientRect().top)||document.body.getBoundingClientRect().top;y.value=l<t&&a>t&&a-r>t,g.value.scrollLeft=o.value.scrollLeft}const D=()=>{var l;const t=(l=i.value)==null?void 0:l.$el;t&&(o.value=t.querySelector(".vxe-table--body-wrapper"),v.value=t.querySelector(".vxe-table--body"),!(!o.value&&!v.value)&&(o.value.addEventListener("scroll",function(a){g.value.scrollLeft=a.target.scrollLeft}),g.value.addEventListener("scroll",function(a){o.value.scrollLeft=a.target.scrollLeft})))};return e.onMounted(()=>{n.sticky&&(D(),N.useResizeObserver(i,()=>S()))}),q({table:i}),(t,l)=>{const a=e.resolveComponent("vxe-grid");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(u).b())},[e.unref(x)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(k.VftPagination),e.mergeProps({key:0,class:[e.unref(u).e("pager"),e.unref(u).m("pager-"+n.pagePlacement)],layout:"prev, pager, next"},n.pageOptions,{total:n.total,"page-size":n.pageSize,onCurrentChange:l[0]||(l[0]=r=>m("page-change",n.pageNum)),"current-page":n.pageNum}),null,16,["class","total","page-size","current-page"])),e.createVNode(a,e.mergeProps({ref_key:"xGrid",ref:i},h,{height:n.height,"max-height":n.maxHeight,columns:e.unref(L),data:n.tableData,"auto-resize":"",loading:n.loading,resizable:"",onSortChange:T}),e.createSlots({empty:e.withCtx(()=>[e.createVNode(e.unref(W.VftEmpty),{type:e.unref(A.EmptyEnum).NO_DATA},null,8,["type"])]),_:2},[n.sticky?{name:"bottom",fn:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"stickyScroll",ref:g,class:e.normalizeClass(e.unref(u).e("sticky-scroll-warpper"))},[e.createElementVNode("div",{ref_key:"stickyScrollBar",ref:w,class:e.normalizeClass(e.unref(u).e("sticky-scroll-bar"))},null,2)],2),[[e.vShow,y.value]])]),key:"0"}:void 0]),1040,["height","max-height","columns","data","loading"]),e.unref(x)?(e.openBlock(),e.createBlock(e.unref(k.VftPagination),e.mergeProps({key:1,class:[e.unref(u).e("pager"),e.unref(u).m("pager-"+n.pagePlacement)],layout:"prev, pager, next"},n.pageOptions,{total:n.total,"page-size":n.pageSize,onCurrentChange:P,"current-page":n.pageNum}),null,16,["class","total","page-size","current-page"])):e.createCommentVNode("",!0)],2)}}});exports.default=j;
|
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.69";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.69",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
],
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"vue": ">=3.2.0",
|
|
36
|
-
"vue-router": ">=4.0.16"
|
|
36
|
+
"vue-router": ">=4.0.16",
|
|
37
|
+
"vxe-table": "^4.3.6",
|
|
38
|
+
"xe-utils": "^3.5.7"
|
|
37
39
|
},
|
|
38
40
|
"dependencies": {
|
|
39
41
|
"@ctrl/tinycolor": "^3.6.0",
|
|
@@ -51,10 +53,6 @@
|
|
|
51
53
|
"qrcode": "1.5.1",
|
|
52
54
|
"resize-detector": "0.3.0",
|
|
53
55
|
"sortablejs": "^1.15.0",
|
|
54
|
-
"vue": "^3.2.47",
|
|
55
|
-
"vue-router": "^4.1.6",
|
|
56
|
-
"vxe-table": "^4.3.6",
|
|
57
|
-
"xe-utils": "^3.5.7",
|
|
58
56
|
"@vft/constants": "0.0.45",
|
|
59
57
|
"@vft/router": "0.0.16",
|
|
60
58
|
"@vft/store": "0.0.17",
|
package/web-types.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"http://json.schemastore.org/web-types","framework":"vue","name":"vft","version":"0.0.
|
|
1
|
+
{"$schema":"http://json.schemastore.org/web-types","framework":"vue","name":"vft","version":"0.0.69","js-types-syntax":"typescript","description-markup":"markdown","contributions":{"html":{"vue-components":[{"name":"vft-button","source":{"symbol":"VftButton"},"description":"常用的操作按钮。","doc-url":"https://wflynn.cn/pages/button#button","props":[{"name":"size","description":"尺寸","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":[{"name":"large default small","source":{"symbol":"large default small"}}]},{"name":"type","description":"类型","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["'primary' | 'success' | 'warning' | 'danger' | 'info'"]},{"name":"plain","description":"是否为朴素按钮","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["boolean"],"default":"false"},{"name":"text","description":"是否为文字按钮","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["boolean"],"default":"false"},{"name":"bg","description":"是否显示文字按钮背景颜色","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["boolean"],"default":"false"},{"name":"link<VersionTag version=\"2.2.1\" />","description":"是否为链接按钮","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["boolean"],"default":"false"},{"name":"round","description":"是否为圆角按钮","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["boolean"],"default":"false"},{"name":"circle","description":"是否为圆形按钮","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["boolean"],"default":"false"},{"name":"loading","description":"是否为加载中状态","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["boolean"],"default":"false"},{"name":"loading-icon","description":"自定义加载中状态图标组件","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":[{"name":"string` `Component","source":{"symbol":"string` `Component"}}],"default":"Loading"},{"name":"disabled","description":"按钮是否为禁用状态","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["boolean"],"default":"false"},{"name":"icon","description":"图标组件","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":[{"name":"string` `Component","source":{"symbol":"string` `Component"}}]},{"name":"autofocus","description":"原生`autofocus` 属性","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["boolean"],"default":"false"},{"name":"native-type","description":"原生 type 属性","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":[{"name":"button` `submit` `reset","source":{"symbol":"button` `submit` `reset"}}],"default":"button"},{"name":"auto-insert-space","description":"自动在两个中文字符之间插入空格","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["boolean"]},{"name":"color","description":"自定义按钮颜色, 并自动计算`hover` 和 `active` 触发后的颜色","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["string"]},{"name":"dark","description":"dark 模式, 意味着自动设置`color` 为 dark 模式的颜色","doc-url":"https://wflynn.cn/pages/button#button-attributes","type":["boolean"],"default":"false"}],"slots":[{"name":"default","description":"自定义默认内容","doc-url":"https://wflynn.cn/pages/button#button-slots"},{"name":"loading","description":"自定义加载中组件","doc-url":"https://wflynn.cn/pages/button#button-slots"},{"name":"icon","description":"自定义图标组件","doc-url":"https://wflynn.cn/pages/button#button-slots"}]},{"name":"vft-button-group","source":{"symbol":"VftButtonGroup"},"doc-url":"https://wflynn.cn/pages/button#buttongroup","slots":[{"name":"default","description":"自定义按钮组内容","doc-url":"https://wflynn.cn/pages/button#buttongroup-slots"}]},{"name":"vft-icon","source":{"symbol":"VftIcon"},"description":"图标 [图标资源地址]","doc-url":"https://wflynn.cn/pages/icon#icon","props":[{"name":"icon","description":"图标 _*_ https://icon-sets.iconify.design/","doc-url":"https://wflynn.cn/pages/icon#icon-attributes","type":["string"]},{"name":"size","description":"图标大小","doc-url":"https://wflynn.cn/pages/icon#icon-attributes","type":["string","number"]},{"name":"color","description":"图标颜色","doc-url":"https://wflynn.cn/pages/icon#icon-attributes","type":["string"]},{"name":"hoverColor","description":"滑入图标时的颜色","doc-url":"https://wflynn.cn/pages/icon#icon-attributes","type":["string"]},{"name":"rotate","description":"是否旋转","doc-url":"https://wflynn.cn/pages/icon#icon-attributes","type":["boolean"],"default":"false"},{"name":"rotateSpeed","description":"旋转速度","doc-url":"https://wflynn.cn/pages/icon#icon-attributes","type":["number"],"default":"2"},{"name":"pointer","description":"手指样式","doc-url":"https://wflynn.cn/pages/icon#icon-attributes","type":["boolean"],"default":"false"}]},{"name":"vft-list-cell","source":{"symbol":"VftListCell"},"description":"菜单列表","doc-url":"https://wflynn.cn/pages/list-cell#listcell","props":[{"name":"list","description":"文本 _*_","doc-url":"https://wflynn.cn/pages/list-cell#listcell-attributes","type":["Array<{ leftIcon?: string | IconProps;rightIcon?: string | IconProps;text: string;rightContent?: any;[key: string]: any }>"],"default":"[]"},{"name":"cellHeight","description":"单元格高度","doc-url":"https://wflynn.cn/pages/list-cell#listcell-attributes","type":["string","number"],"default":"50"},{"name":"leftTextDistance","description":"左侧图标文字间距","doc-url":"https://wflynn.cn/pages/list-cell#listcell-attributes","type":["string","number"],"default":"8"},{"name":"activeIndex","description":"默认激活的列表项","doc-url":"https://wflynn.cn/pages/list-cell#listcell-attributes","type":["number"]}],"js":{"events":[{"name":"item-click","description":"菜单项点击","doc-url":"https://wflynn.cn/pages/list-cell#listcell-events"}]}},{"name":"vft-page-wrapper","source":{"symbol":"VftPageWrapper"},"description":"页面 demo 容器","doc-url":"https://wflynn.cn/pages/page-wrapper#pagewrapper","props":[{"name":"title","description":"标题","doc-url":"https://wflynn.cn/pages/page-wrapper#pagewrapper-attributes","type":["string"],"default":"路由 title"}]},{"name":"vft-date-time-select","source":{"symbol":"VftDateTimeSelect"},"description":"文字与图标组合","doc-url":"https://wflynn.cn/pages/date-time-select#datetimeselect","props":[{"name":"dateList","description":"时间配置 _\\*_","doc-url":"https://wflynn.cn/pages/date-time-select#datetimeselect-attributes","type":[{"name":"{count: number; text: string; type: DateType; startOfType: DateType; endOfType: DateType; format: string; dateRange: boolean;}[][]","source":{"symbol":"{count: number; text: string; type: DateType; startOfType: DateType; endOfType: DateType; format: string; dateRange: boolean;}[]"}}]},{"name":"defaultFormat","description":"默认时间格式化值","doc-url":"https://wflynn.cn/pages/date-time-select#datetimeselect-attributes","type":["string"]},{"name":"placement","description":"tootip 位置","doc-url":"https://wflynn.cn/pages/date-time-select#datetimeselect-attributes","type":["'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'right-start' | 'right-end' | 'left-start' | 'left-end'"]}]},{"name":"vft-list-cell","source":{"symbol":"VftListCell"},"doc-url":"https://wflynn.cn/pages/date-time-select#listcell","js":{"events":[{"name":"change","description":"时间选择完成回调","doc-url":"https://wflynn.cn/pages/date-time-select#listcell-events"}]}},{"name":"vft-icon-text","source":{"symbol":"VftIconText"},"description":"文字与图标组合","doc-url":"https://wflynn.cn/pages/icon-text#icontext","props":[{"name":"text","description":"文本 _\\*_","doc-url":"https://wflynn.cn/pages/icon-text#icontext-attributes","type":["string"]},{"name":"icon","description":"图标 _\\*_","doc-url":"https://wflynn.cn/pages/icon-text#icontext-attributes","type":[{"name":"IconProps","source":{"symbol":"IconProps"}},"string"]},{"name":"color","description":"颜色","doc-url":"https://wflynn.cn/pages/icon-text#icontext-attributes","type":["string"]},{"name":"hoverColor","description":"滑入颜色","doc-url":"https://wflynn.cn/pages/icon-text#icontext-attributes","type":["string"]},{"name":"distance","description":"图标与文字之间距离","doc-url":"https://wflynn.cn/pages/icon-text#icontext-attributes","type":["string","number"]},{"name":"reverse","description":"图标与文字位置翻转","doc-url":"https://wflynn.cn/pages/icon-text#icontext-attributes","type":["boolean"],"default":"false"},{"name":"size","description":"大小","doc-url":"https://wflynn.cn/pages/icon-text#icontext-attributes","type":["string","number"]},{"name":"direction","description":"文字图标排列方向","doc-url":"https://wflynn.cn/pages/icon-text#icontext-attributes","type":["'col' | 'row'"]},{"name":"pointer","description":"手指样式","doc-url":"https://wflynn.cn/pages/icon-text#icontext-attributes","type":["boolean"],"default":"false"}]}]}}}
|