vft 0.0.439 → 0.0.441

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.
Files changed (41) hide show
  1. package/attributes.json +1 -1
  2. package/dist/index.css +1 -1
  3. package/es/components/pagination/index.d.ts +3 -1
  4. package/es/components/pagination/pagination.vue.d.ts +3 -1
  5. package/es/components/pagination/pagination.vue2.js +47 -44
  6. package/es/components/table/constants.d.ts +2 -1
  7. package/es/components/table/constants.js +2 -2
  8. package/es/components/table/field.d.ts +60 -0
  9. package/es/components/table/index.d.ts +1271 -544
  10. package/es/components/table/table.vue.d.ts +291 -124
  11. package/es/components/table/table.vue2.js +143 -132
  12. package/es/components/table/types.d.ts +48 -43
  13. package/es/components/table/use/use-data-source.js +69 -69
  14. package/es/components/table/use/use-pagination.d.ts +11 -7
  15. package/es/components/table/use/use-pagination.js +36 -46
  16. package/es/components/table/utils.d.ts +24 -4
  17. package/es/index.js +2 -2
  18. package/es/package.json.d.ts +4 -3
  19. package/es/package.json.js +1 -1
  20. package/lib/components/pagination/index.d.ts +3 -1
  21. package/lib/components/pagination/pagination.vue.d.ts +3 -1
  22. package/lib/components/pagination/pagination.vue2.cjs +1 -1
  23. package/lib/components/table/constants.cjs +1 -1
  24. package/lib/components/table/constants.d.ts +2 -1
  25. package/lib/components/table/field.d.ts +60 -0
  26. package/lib/components/table/index.d.ts +1271 -544
  27. package/lib/components/table/table.vue.d.ts +291 -124
  28. package/lib/components/table/table.vue2.cjs +1 -1
  29. package/lib/components/table/types.d.ts +48 -43
  30. package/lib/components/table/use/use-data-source.cjs +1 -1
  31. package/lib/components/table/use/use-pagination.cjs +1 -1
  32. package/lib/components/table/use/use-pagination.d.ts +11 -7
  33. package/lib/components/table/utils.d.ts +24 -4
  34. package/lib/package.json.cjs +1 -1
  35. package/lib/package.json.d.ts +4 -3
  36. package/package.json +6 -5
  37. package/tags.json +1 -1
  38. package/theme-style/index.css +1 -1
  39. package/theme-style/src/table.scss +6 -1
  40. package/theme-style/vft-table.css +1 -1
  41. package/web-types.json +1 -1
@@ -53,7 +53,9 @@ export declare const VftPagination: import("vft/es/utils").SFCWithInstall<import
53
53
  hideOnSinglePage: {
54
54
  type: import("vue").PropType<boolean>;
55
55
  };
56
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
56
+ }>, {
57
+ pageCountBridge: import("vue").ComputedRef<number>;
58
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
57
59
  "update:current-page": (val: number) => void;
58
60
  "update:page-size": (val: number) => void;
59
61
  "size-change": (val: number) => void;
@@ -20,7 +20,9 @@ export interface PaginationProps {
20
20
  disabled?: boolean;
21
21
  hideOnSinglePage?: boolean;
22
22
  }
23
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<PaginationProps>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<PaginationProps>>, {
24
+ pageCountBridge: import("vue").ComputedRef<number>;
25
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
26
  "update:current-page": (val: number) => void;
25
27
  "update:page-size": (val: number) => void;
26
28
  "size-change": (val: number) => void;
@@ -1,24 +1,24 @@
1
- import { defineComponent as b, useSlots as w, getCurrentInstance as E, computed as c, ref as S, watch as M, provide as L, h as r } from "vue";
1
+ import { defineComponent as b, useSlots as E, getCurrentInstance as M, computed as c, ref as S, watch as L, provide as W, h as r } from "vue";
2
2
  import { isNumber as t } from "@vft/utils";
3
3
  import "@vueuse/core";
4
4
  import "../config-provider/hooks/use-global-config.js";
5
5
  import "lodash-es";
6
6
  import "../form/index.js";
7
- import { useNamespace as W } from "../../hooks/use-namespace/index.js";
7
+ import { useNamespace as j } from "../../hooks/use-namespace/index.js";
8
8
  import "../../hooks/use-model-toggle/index.js";
9
9
  import "@popperjs/core";
10
10
  import "../../hooks/use-z-index/index.js";
11
- import j from "./components/jumper.vue2.js";
12
- import A from "./components/next.vue2.js";
13
- import N from "./components/pager.vue2.js";
14
- import O from "./components/prev.vue2.js";
15
- import R from "./components/sizes.vue2.js";
16
- import K from "./components/total.vue2.js";
17
- import { vftPaginationKey as V } from "./usePagination.js";
18
- const q = b({
11
+ import A from "./components/jumper.vue2.js";
12
+ import N from "./components/next.vue2.js";
13
+ import O from "./components/pager.vue2.js";
14
+ import R from "./components/prev.vue2.js";
15
+ import K from "./components/sizes.vue2.js";
16
+ import V from "./components/total.vue2.js";
17
+ import { vftPaginationKey as q } from "./usePagination.js";
18
+ const D = b({
19
19
  name: "vft-pagination"
20
- }), re = /* @__PURE__ */ b({
21
- ...q,
20
+ }), oe = /* @__PURE__ */ b({
21
+ ...D,
22
22
  props: {
23
23
  total: {},
24
24
  pageSize: {},
@@ -62,9 +62,10 @@ const q = b({
62
62
  "next-click": (e) => t(e)
63
63
  },
64
64
  setup(e, {
65
- emit: x
65
+ expose: x,
66
+ emit: k
66
67
  }) {
67
- const l = W("pagination"), o = x, k = w(), g = E().vnode.props || {}, C = "onUpdate:currentPage" in g || "onUpdate:current-page" in g || "onCurrentChange" in g, d = "onUpdate:pageSize" in g || "onUpdate:page-size" in g || "onSizeChange" in g, y = c(() => {
68
+ const u = j("pagination"), o = k, y = E(), g = M().vnode.props || {}, C = "onUpdate:currentPage" in g || "onUpdate:current-page" in g || "onCurrentChange" in g, d = "onUpdate:pageSize" in g || "onUpdate:page-size" in g || "onSizeChange" in g, T = c(() => {
68
69
  if (!t(e.total) && !t(e.pageCount) || t(e.currentPage) && !C) return !1;
69
70
  if (e.layout.includes("sizes")) {
70
71
  if (t(e.pageCount)) {
@@ -80,7 +81,7 @@ const q = b({
80
81
  set(a) {
81
82
  t(e.pageSize) || (h.value = a), d && (o("update:page-size", a), o("size-change", a));
82
83
  }
83
- }), u = c(() => {
84
+ }), l = c(() => {
84
85
  let a = 0;
85
86
  return t(e.pageCount) ? a = e.pageCount : t(e.total) && (a = Math.max(1, Math.ceil(e.total / m.value))), a;
86
87
  }), i = c({
@@ -89,94 +90,96 @@ const q = b({
89
90
  },
90
91
  set(a) {
91
92
  let n = a;
92
- a < 1 ? n = 1 : a > u.value && (n = u.value), t(e.currentPage) || (P.value = n), C && (o("update:current-page", n), o("current-change", n));
93
+ a < 1 ? n = 1 : a > l.value && (n = l.value), t(e.currentPage) || (P.value = n), C && (o("update:current-page", n), o("current-change", n));
93
94
  }
94
95
  });
95
- M(u, (a) => {
96
+ L(l, (a) => {
96
97
  i.value > a && (i.value = a);
97
98
  });
98
99
  function p(a) {
99
100
  i.value = a;
100
101
  }
101
- function T(a) {
102
+ function B(a) {
102
103
  m.value = a;
103
- const n = u.value;
104
+ const n = l.value;
104
105
  i.value > n && (i.value = n);
105
106
  }
106
- function B() {
107
+ function I() {
107
108
  e.disabled || (i.value -= 1, o("prev-click", i.value));
108
109
  }
109
- function I() {
110
+ function $() {
110
111
  e.disabled || (i.value += 1, o("next-click", i.value));
111
112
  }
112
113
  function f(a, n) {
113
114
  a && (a.props || (a.props = {}), a.class = [a.class, n].join(" "));
114
115
  }
115
- return L(V, {
116
- pageCount: u,
116
+ return W(q, {
117
+ pageCount: l,
117
118
  disabled: c(() => e.disabled),
118
119
  currentPage: i,
119
120
  changeEvent: p,
120
- handleSizeChange: T
121
+ handleSizeChange: B
122
+ }), x({
123
+ pageCountBridge: l
121
124
  }), () => {
122
- if (!y.value || !e.layout || e.hideOnSinglePage && u.value <= 1) return null;
123
- const a = [], n = [], $ = r("div", {
124
- class: l.e("rightwrapper")
125
+ if (!T.value || !e.layout || e.hideOnSinglePage && l.value <= 1) return null;
126
+ const a = [], n = [], U = r("div", {
127
+ class: u.e("rightwrapper")
125
128
  }, n), z = {
126
- prev: r(O, {
129
+ prev: r(R, {
127
130
  disabled: e.disabled,
128
131
  currentPage: i.value,
129
132
  prevText: e.prevText,
130
133
  prevIcon: e.prevIcon,
131
- onClick: B
134
+ onClick: I
132
135
  }),
133
- jumper: r(j, {
136
+ jumper: r(A, {
134
137
  size: e.small ? "small" : "default"
135
138
  }),
136
- pager: r(N, {
139
+ pager: r(O, {
137
140
  currentPage: i.value,
138
- pageCount: u.value,
141
+ pageCount: l.value,
139
142
  pagerCount: e.pagerCount,
140
143
  onChange: p,
141
144
  disabled: e.disabled
142
145
  }),
143
- next: r(A, {
146
+ next: r(N, {
144
147
  disabled: e.disabled,
145
148
  currentPage: i.value,
146
- pageCount: u.value,
149
+ pageCount: l.value,
147
150
  nextText: e.nextText,
148
151
  nextIcon: e.nextIcon,
149
- onClick: I
152
+ onClick: $
150
153
  }),
151
- sizes: r(R, {
154
+ sizes: r(K, {
152
155
  pageSize: m.value,
153
156
  pageSizes: e.pageSizes,
154
157
  popperClass: e.popperClass,
155
158
  disabled: e.disabled,
156
159
  size: e.small ? "small" : "default"
157
160
  }),
158
- slot: k?.default?.() ?? null,
159
- total: r(K, {
161
+ slot: y?.default?.() ?? null,
162
+ total: r(V, {
160
163
  total: t(e.total) ? e.total : 0
161
164
  })
162
- }, U = e.layout.split(",").map((s) => s.trim());
165
+ }, w = e.layout.split(",").map((s) => s.trim());
163
166
  let v = !1;
164
- return U.forEach((s) => {
167
+ return w.forEach((s) => {
165
168
  if (s === "->") {
166
169
  v = !0;
167
170
  return;
168
171
  }
169
172
  v ? n.push(z[s]) : a.push(z[s]);
170
- }), f(a[0], l.is("first")), f(a[a.length - 1], l.is("last")), v && n.length > 0 && (f(n[0], l.is("first")), f(n[n.length - 1], l.is("last")), a.push($)), r("div", {
173
+ }), f(a[0], u.is("first")), f(a[a.length - 1], u.is("last")), v && n.length > 0 && (f(n[0], u.is("first")), f(n[n.length - 1], u.is("last")), a.push(U)), r("div", {
171
174
  role: "pagination",
172
175
  "aria-label": "pagination",
173
- class: [l.b(), l.is("background", e.background), {
174
- [l.m("small")]: e.small
176
+ class: [u.b(), u.is("background", e.background), {
177
+ [u.m("small")]: e.small
175
178
  }]
176
179
  }, a);
177
180
  };
178
181
  }
179
182
  });
180
183
  export {
181
- re as default
184
+ oe as default
182
185
  };
@@ -1 +1,2 @@
1
- export declare const PAGE_SIZE = 15;
1
+ /** 默认每页显示条数 */
2
+ export declare const PageSize = 15;
@@ -1,4 +1,4 @@
1
- const o = 15;
1
+ const e = 15;
2
2
  export {
3
- o as PAGE_SIZE
3
+ e as PageSize
4
4
  };
@@ -1,8 +1,19 @@
1
1
  import type { ColumnItemProps } from './types';
2
+ /** 序号列配置 */
2
3
  export declare const SEQ_FIELD: ColumnItemProps;
4
+ /** 复选框列配置 */
3
5
  export declare const CHECKED_FIELD: ColumnItemProps;
6
+ /** ID 列配置 */
4
7
  export declare const ID_FIELD: ColumnItemProps;
8
+ /** 名称列配置 */
5
9
  export declare const NAME_FIELD: ColumnItemProps;
10
+ /**
11
+ * 日期列配置生成器
12
+ * @param format - 日期格式,默认为 'YYYY-MM-DD'
13
+ * @param field - 字段名,默认为 'date'
14
+ * @param title - 列标题,默认为 '时间'
15
+ * @returns 日期列配置对象
16
+ */
6
17
  export declare const DATE_FIELD: ({ format, field, title, }?: {
7
18
  format?: string | undefined;
8
19
  field?: string | undefined;
@@ -15,6 +26,13 @@ export declare const DATE_FIELD: ({ format, field, title, }?: {
15
26
  row: any;
16
27
  }) => string;
17
28
  };
29
+ /**
30
+ * 日期时间列配置生成器
31
+ * @param format - 日期时间格式,默认为 'YYYY-MM-DD HH:mm:ss'
32
+ * @param field - 字段名,默认为 'date'
33
+ * @param title - 列标题,默认为 '时间'
34
+ * @returns 日期时间列配置对象
35
+ */
18
36
  export declare const DATE_TIME_FIELD: ({ format, field, title, }?: {
19
37
  format?: string | undefined;
20
38
  field?: string | undefined;
@@ -27,6 +45,13 @@ export declare const DATE_TIME_FIELD: ({ format, field, title, }?: {
27
45
  row: any;
28
46
  }) => string;
29
47
  };
48
+ /**
49
+ * 创建时间列配置生成器
50
+ * @param format - 日期时间格式,默认为 'YYYY-MM-DD HH:mm:ss'
51
+ * @param field - 字段名,默认为 'createTime'
52
+ * @param title - 列标题,默认为 '创建时间'
53
+ * @returns 创建时间列配置对象
54
+ */
30
55
  export declare const CREATE_TIME_FIELD: ({ format, field, title, }?: {
31
56
  format?: string | undefined;
32
57
  field?: string | undefined;
@@ -39,6 +64,13 @@ export declare const CREATE_TIME_FIELD: ({ format, field, title, }?: {
39
64
  row: any;
40
65
  }) => string;
41
66
  };
67
+ /**
68
+ * 更新时间列配置生成器
69
+ * @param format - 日期时间格式,默认为 'YYYY-MM-DD HH:mm:ss'
70
+ * @param field - 字段名,默认为 'updateTime'
71
+ * @param title - 列标题,默认为 '更新时间'
72
+ * @returns 更新时间列配置对象
73
+ */
42
74
  export declare const UPDATE_TIME_FIELD: ({ format, field, title, }?: {
43
75
  format?: string | undefined;
44
76
  field?: string | undefined;
@@ -51,6 +83,15 @@ export declare const UPDATE_TIME_FIELD: ({ format, field, title, }?: {
51
83
  row: any;
52
84
  }) => string;
53
85
  };
86
+ /**
87
+ * 状态列配置生成器
88
+ * @param field - 字段名,默认为 'status'
89
+ * @param title - 列标题,默认为 '状态'
90
+ * @param normalText - 正常状态显示文本,默认为 '正常'
91
+ * @param disabledText - 禁用状态显示文本,默认为 '禁用'
92
+ * @param strToNumber - 是否将字符串转换为数字进行判断,默认为 true
93
+ * @returns 状态列配置对象
94
+ */
54
95
  export declare const STATUS_FIELD: ({ field, title, normalText, disabledText, strToNumber, }?: {
55
96
  field?: string | undefined;
56
97
  title?: string | undefined;
@@ -58,14 +99,33 @@ export declare const STATUS_FIELD: ({ field, title, normalText, disabledText, st
58
99
  disabledText?: string | undefined;
59
100
  strToNumber?: boolean | undefined;
60
101
  }) => ColumnItemProps;
102
+ /** 操作列配置参数接口 */
61
103
  interface ActionFieldProps {
104
+ /** 确认删除提示文本 */
62
105
  confirmText?: string;
106
+ /** 左侧按钮点击回调函数 */
63
107
  leftCallback?: (data?: any) => void;
108
+ /** 右侧按钮点击回调函数,支持异步操作 */
64
109
  rightCallback?: ((data?: any) => Promise<any>) | ((data?: any) => void);
110
+ /** 左侧按钮文本 */
65
111
  leftText?: string;
112
+ /** 右侧按钮文本 */
66
113
  rightText?: string;
114
+ /** 是否显示左侧按钮 */
67
115
  showLeft?: boolean;
116
+ /** 是否显示右侧按钮 */
68
117
  showRight?: boolean;
69
118
  }
119
+ /**
120
+ * 操作列配置生成器
121
+ * @param confirmText - 确认删除提示文本,默认为 '确认删除?'
122
+ * @param leftCallback - 左侧按钮点击回调
123
+ * @param rightCallback - 右侧按钮点击回调
124
+ * @param leftText - 左侧按钮文本,默认为 '编辑'
125
+ * @param rightText - 右侧按钮文本,默认为 '删除'
126
+ * @param showLeft - 是否显示左侧按钮,默认为 true
127
+ * @param showRight - 是否显示右侧按钮,默认为 true
128
+ * @returns 操作列配置对象
129
+ */
70
130
  export declare const ACTION_FIELD: ({ confirmText, leftCallback, rightCallback, leftText, rightText, showLeft, showRight, }?: ActionFieldProps) => ColumnItemProps;
71
131
  export {};