@mineadmin/table 1.0.31 → 1.0.35

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.
@@ -22,39 +22,31 @@ declare const _default: {
22
22
  };
23
23
  stripe: BooleanConstructor;
24
24
  border: BooleanConstructor;
25
- rowKey: PropType<string | ((row: any) => string) | undefined>;
25
+ rowKey: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["rowKey"]>;
26
26
  showHeader: {
27
27
  type: BooleanConstructor;
28
28
  default: boolean;
29
29
  };
30
30
  showSummary: BooleanConstructor;
31
31
  sumText: StringConstructor;
32
- summaryMethod: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").SummaryMethod<any> | undefined>;
33
- rowClassName: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").ColumnCls<any> | undefined>;
34
- rowStyle: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").ColumnStyle<any> | undefined>;
35
- cellClassName: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").CellCls<any> | undefined>;
36
- cellStyle: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").CellStyle<any> | undefined>;
37
- headerRowClassName: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").ColumnCls<any> | undefined>;
38
- headerRowStyle: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").ColumnStyle<any> | undefined>;
39
- headerCellClassName: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").CellCls<any> | undefined>;
40
- headerCellStyle: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").CellStyle<any> | undefined>;
32
+ summaryMethod: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["summaryMethod"]>;
33
+ rowClassName: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["rowClassName"]>;
34
+ rowStyle: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["rowStyle"]>;
35
+ cellClassName: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["cellClassName"]>;
36
+ cellStyle: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["cellStyle"]>;
37
+ headerRowClassName: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["headerRowClassName"]>;
38
+ headerRowStyle: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["headerRowStyle"]>;
39
+ headerCellClassName: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["headerCellClassName"]>;
40
+ headerCellStyle: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["headerCellStyle"]>;
41
41
  highlightCurrentRow: BooleanConstructor;
42
42
  currentRowKey: (NumberConstructor | StringConstructor)[];
43
43
  emptyText: StringConstructor;
44
- expandRowKeys: PropType<string[] | undefined>;
44
+ expandRowKeys: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["expandRowKeys"]>;
45
45
  defaultExpandAll: BooleanConstructor;
46
- defaultSort: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").Sort | undefined>;
46
+ defaultSort: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["defaultSort"]>;
47
47
  tooltipEffect: StringConstructor;
48
- tooltipOptions: PropType<Partial<Pick<import("element-plus").ElTooltipProps, "offset" | "transition" | "placement" | "effect" | "showAfter" | "hideAfter" | "popperOptions" | "enterable" | "popperClass" | "appendTo" | "showArrow">> | undefined>;
49
- spanMethod: PropType<((data: {
50
- row: any;
51
- rowIndex: number;
52
- column: import("element-plus/es/components/table/src/table-column/defaults.mjs").TableColumnCtx<any>;
53
- columnIndex: number;
54
- }) => number[] | {
55
- rowspan: number;
56
- colspan: number;
57
- } | undefined) | undefined>;
48
+ tooltipOptions: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["tooltipOptions"]>;
49
+ spanMethod: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["spanMethod"]>;
58
50
  selectOnIndeterminate: {
59
51
  type: BooleanConstructor;
60
52
  default: boolean;
@@ -64,7 +56,7 @@ declare const _default: {
64
56
  default: number;
65
57
  };
66
58
  treeProps: {
67
- type: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TreeProps | undefined>;
59
+ type: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["treeProps"]>;
68
60
  default: () => {
69
61
  hasChildren: string;
70
62
  children: string;
@@ -72,7 +64,7 @@ declare const _default: {
72
64
  };
73
65
  };
74
66
  lazy: BooleanConstructor;
75
- load: PropType<((row: any, treeNode: import("element-plus/es/components/table/src/table/defaults.mjs").TreeNode, resolve: (data: any[]) => void) => void) | undefined>;
67
+ load: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["load"]>;
76
68
  style: {
77
69
  type: PropType<import("vue").CSSProperties>;
78
70
  default: () => {};
@@ -87,7 +79,19 @@ declare const _default: {
87
79
  };
88
80
  scrollbarAlwaysOn: BooleanConstructor;
89
81
  flexible: BooleanConstructor;
90
- showOverflowTooltip: PropType<boolean | Partial<Pick<import("element-plus").ElTooltipProps, "offset" | "transition" | "placement" | "effect" | "showAfter" | "hideAfter" | "popperOptions" | "enterable" | "popperClass" | "appendTo" | "showArrow">> | undefined>;
82
+ showOverflowTooltip: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["showOverflowTooltip"]>;
83
+ tooltipFormatter: PropType<import("element-plus/es/components/table/src/table/defaults.mjs").TableProps<any>["tooltipFormatter"]>;
84
+ appendFilterPanelTo: StringConstructor;
85
+ scrollbarTabindex: {
86
+ type: (NumberConstructor | StringConstructor)[];
87
+ default: undefined;
88
+ };
89
+ allowDragLastColumn: {
90
+ type: BooleanConstructor;
91
+ default: boolean;
92
+ };
93
+ preserveExpandedContent: BooleanConstructor;
94
+ nativeScrollbar: BooleanConstructor;
91
95
  loading: {
92
96
  type: BooleanConstructor;
93
97
  default: boolean;
package/dist/index.es.js CHANGED
@@ -1,33 +1,33 @@
1
- import { defineComponent as $, ref as b, inject as F, onMounted as H, watch as P, onBeforeUnmount as v, computed as U, withDirectives as R, createVNode as i, mergeProps as L, vShow as q, resolveDirective as G, Fragment as k, isVNode as J, getCurrentInstance as K } from "vue";
2
- import { ElLoadingDirective as Q, ElPagination as W, ElTable as X, ElEmpty as Y, ElTableColumn as Z } from "element-plus";
1
+ import { defineComponent as $, ref as h, inject as F, onMounted as H, watch as z, onBeforeUnmount as U, withDirectives as R, createVNode as i, resolveDirective as q, Fragment as k, mergeProps as x, vShow as G, isVNode as J, getCurrentInstance as K } from "vue";
2
+ import { ElLoadingDirective as Q, ElTable as W, ElEmpty as X, ElPagination as Y, ElTableColumn as Z } from "element-plus";
3
3
  const D = $({ name: "MaTable", props: { options: { type: Object, default: () => ({}) }, columns: { type: Array, default: () => [] } }, directives: { Loading: Q }, emits: ["set-data-callback"], setup(r, { slots: e, attrs: p, emit: m, expose: w }) {
4
- const t = b(r.options), d = b(r.columns), N = F("MaTableOptions"), y = b(!1), x = b(), h = () => {
4
+ const t = h(r.options), d = h(r.columns), N = F("MaTableOptions"), y = h(!1), T = h(), b = () => {
5
5
  const { adaptionOffsetBottom: a } = t.value, n = window.innerHeight - (a ?? 70);
6
6
  t.value.height = `${n}px`;
7
- };
7
+ }, O = h(1);
8
8
  H(async () => {
9
9
  y.value = !0;
10
- }), P(() => {
10
+ }), z(() => {
11
11
  var a;
12
12
  return (a = t.value) == null ? void 0 : a.adaption;
13
13
  }, (a) => {
14
- a && (window.addEventListener("resize", h), h());
15
- }, { immediate: !0 }), P(() => {
14
+ a && (window.addEventListener("resize", b), b());
15
+ }, { immediate: !0 }), z(() => {
16
16
  var a;
17
17
  return (a = t.value) == null ? void 0 : a.adaptionOffsetBottom;
18
18
  }, () => {
19
19
  var a;
20
- (a = t.value) != null && a.adaption && h();
21
- }, { immediate: !0 }), v(() => {
22
- y.value = !1, window.removeEventListener("resize", h);
20
+ (a = t.value) != null && a.adaption && b();
21
+ }, { immediate: !0 }), U(() => {
22
+ y.value = !1, window.removeEventListener("resize", b);
23
23
  });
24
- const V = U(() => {
24
+ const V = () => {
25
25
  var n, o;
26
26
  const { pagination: a } = t.value;
27
- return R(i("div", { className: "mineadmin-pagination" }, [i("div", { class: "mineadmin-pagination-left" }, [(n = e == null ? void 0 : e.pageLeft) == null ? void 0 : n.call(e)]), (((o = t.value) == null ? void 0 : o.showPagination) ?? !1) && a && i("div", { class: "mineadmin-el-page" }, [i(W, L({ total: 0, onChange: () => {
28
- } }, a, { size: (a == null ? void 0 : a.size) ?? "default", pagerCount: (a == null ? void 0 : a.pagerCount) ?? 5, layout: (a == null ? void 0 : a.layout) ?? "total, prev, pager, next, sizes, jumper" }), null)])]), [[q, e.pageLeft || a]]);
29
- }), T = (a, n) => {
30
- var M, A, B, z;
27
+ return R(i("div", { className: "mineadmin-pagination" }, [i("div", { class: "mineadmin-pagination-left" }, [(n = e == null ? void 0 : e.pageLeft) == null ? void 0 : n.call(e)]), (((o = t.value) == null ? void 0 : o.showPagination) ?? !1) && a && i("div", { class: "mineadmin-el-page" }, [i(Y, x({ total: 0, onChange: () => {
28
+ } }, a, { currentPage: O.value, "onUpdate:currentPage": (l) => O.value = l, size: (a == null ? void 0 : a.size) ?? "default", pagerCount: (a == null ? void 0 : a.pagerCount) ?? 5, layout: (a == null ? void 0 : a.layout) ?? "total, prev, pager, next, sizes, jumper" }), null)])]), [[G, e.pageLeft || a]]);
29
+ }, j = (a, n) => {
30
+ var M, A, B, c;
31
31
  if (a != null && a.hide && (a == null ? void 0 : a.hide) instanceof Function && a.hide(p) || a != null && a.hide && typeof (a == null ? void 0 : a.hide) == "boolean" && a.hide) return;
32
32
  const o = typeof a.prop == "function" ? a.prop(n) : a.prop;
33
33
  let l = { default: (s) => {
@@ -40,34 +40,34 @@ const D = $({ name: "MaTable", props: { options: { type: Object, default: () =>
40
40
  var u;
41
41
  return (u = e == null ? void 0 : e.filterIcon) == null ? void 0 : u.call(e, s);
42
42
  } };
43
- const { label: O, prop: _, children: c, cellRender: aa, headerRender: ea, ...S } = a;
44
- return c && c.length > 0 && (l = c == null ? void 0 : c.map(T)), i(Z, L({ key: n }, S, { label: typeof O == "function" ? O() : O, prop: o, align: (a == null ? void 0 : a.align) ?? ((M = t.value) == null ? void 0 : M.columnAlign) ?? "center", headerAlign: (a == null ? void 0 : a.align) ?? ((A = t.value) == null ? void 0 : A.columnAlign) ?? (a == null ? void 0 : a.headerAlign) ?? ((B = t.value) == null ? void 0 : B.headerAlign) ?? "center", showOverflowTooltip: (a == null ? void 0 : a.showOverflowTooltip) ?? ((z = t.value) == null ? void 0 : z.showOverflowTooltip) ?? !0 }), typeof (C = l) == "function" || Object.prototype.toString.call(C) === "[object Object]" && !J(C) ? l : { default: () => [l] });
45
- var C;
43
+ const { label: C, prop: _, children: v, cellRender: aa, headerRender: ea, ...S } = a;
44
+ return v && v.length > 0 && (l.default = () => v == null ? void 0 : v.map(j)), i(Z, x({ key: n }, S, { label: typeof C == "function" ? C() : C, prop: o, align: (a == null ? void 0 : a.align) ?? ((M = t.value) == null ? void 0 : M.columnAlign) ?? "center", headerAlign: (a == null ? void 0 : a.align) ?? ((A = t.value) == null ? void 0 : A.columnAlign) ?? (a == null ? void 0 : a.headerAlign) ?? ((B = t.value) == null ? void 0 : B.headerAlign) ?? "center", showOverflowTooltip: (a == null ? void 0 : a.showOverflowTooltip) ?? ((c = t.value) == null ? void 0 : c.showOverflowTooltip) ?? !0 }), typeof (L = l) == "function" || Object.prototype.toString.call(L) === "[object Object]" && !J(L) ? l : { default: () => [l] });
45
+ var L;
46
46
  }, I = () => {
47
47
  const { on: a, pagination: n, ...o } = t.value;
48
- return i(k, null, [i(X, L({ ref: x }, a, o, p), { default: () => {
48
+ return i(k, null, [i(W, x({ ref: T }, a, o, p), { default: () => {
49
49
  var l;
50
- return [i(k, null, [(l = d.value) == null ? void 0 : l.map(T)])];
50
+ return [i(k, null, [(l = d.value) == null ? void 0 : l.map(j)])];
51
51
  }, append: () => {
52
52
  var l;
53
53
  return (l = e.append) == null ? void 0 : l.call(e);
54
54
  }, empty: () => {
55
55
  var l;
56
- return ((l = e.empty) == null ? void 0 : l.call(e)) ?? i(Y, null, null);
57
- } }), V.value]);
58
- }, j = () => {
56
+ return ((l = e.empty) == null ? void 0 : l.call(e)) ?? i(X, null, null);
57
+ } }), V()]);
58
+ }, P = () => {
59
59
  const { loading: a, loadingConfig: n, height: o, maxHeight: l } = t.value;
60
- return R(i("div", { className: "mineadmin-table", "element-loading-svg": (n == null ? void 0 : n.svg) ?? '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 1024 1024"><path fill="currentColor" d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"/></svg>', "element-loading-svg-view-box": (n == null ? void 0 : n.viewBox) ?? "-9, -9, 50, 50", "element-loading-text": (n == null ? void 0 : n.text) ?? null, "element-loading-spinner": (n == null ? void 0 : n.spinner) ?? null, "element-loading-background": (n == null ? void 0 : n.spinner) ?? null, "element-loading-custom-class": (n == null ? void 0 : n.customClass) ?? null }, [I()]), [[G("loading"), a]]);
60
+ return R(i("div", { className: "mineadmin-table", "element-loading-svg": (n == null ? void 0 : n.svg) ?? '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 1024 1024"><path fill="currentColor" d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"/></svg>', "element-loading-svg-view-box": (n == null ? void 0 : n.viewBox) ?? "-9, -9, 50, 50", "element-loading-text": (n == null ? void 0 : n.text) ?? null, "element-loading-spinner": (n == null ? void 0 : n.spinner) ?? null, "element-loading-background": (n == null ? void 0 : n.spinner) ?? null, "element-loading-custom-class": (n == null ? void 0 : n.customClass) ?? null }, [I()]), [[q("loading"), a]]);
61
61
  }, E = (a) => d.value = a;
62
62
  return w({ setData: (a) => {
63
63
  t.value.data = a, m("set-data-callback", a);
64
64
  }, setPagination: (a) => {
65
65
  var n;
66
66
  return t.value.pagination = Object.assign(((n = t.value) == null ? void 0 : n.pagination) ?? {}, a);
67
- }, setLoadingState: (a) => t.value.loading = a, setOptions: (a) => t.value = Object.assign(t.value, a), getOptions: () => t.value, setColumns: E, getColumns: () => d.value, appendColumn: (a) => d.value.push(a), removeColumn: (a) => E(d.value.filter((n, o) => (typeof n.prop == "function" ? n.prop(o) : n.prop) !== a)), getColumnByProp: (a) => {
67
+ }, setCurrentPage: (a) => O.value = a, setLoadingState: (a) => t.value.loading = a, setOptions: (a) => t.value = Object.assign(t.value, a), getOptions: () => t.value, setColumns: E, getColumns: () => d.value, appendColumn: (a) => d.value.push(a), removeColumn: (a) => E(d.value.filter((n, o) => (typeof n.prop == "function" ? n.prop(o) : n.prop) !== a)), getColumnByProp: (a) => {
68
68
  var n;
69
69
  return ((n = d.value.filter((o, l) => (typeof o.prop == "function" ? o.prop(l) : o.prop) === a)) == null ? void 0 : n[0]) ?? null;
70
- }, getElTableRef: () => x.value }), () => N.ssr ? y.value && j() : j();
70
+ }, getElTableRef: () => T.value }), () => N.ssr ? y.value && P() : P();
71
71
  } });
72
72
  function la(r) {
73
73
  return new Promise(async (e, p) => {
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(r,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],o):o((r=typeof globalThis<"u"?globalThis:r||self).MaTable={},r.Vue,r.ElementPlus)})(this,function(r,o,m){"use strict";const C=o.defineComponent({name:"MaTable",props:{options:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]}},directives:{Loading:m.ElLoadingDirective},emits:["set-data-callback"],setup(u,{slots:t,attrs:d,emit:g,expose:w}){const l=o.ref(u.options),c=o.ref(u.columns),B=o.inject("MaTableOptions"),y=o.ref(!1),x=o.ref(),b=()=>{const{adaptionOffsetBottom:e}=l.value,a=window.innerHeight-(e??70);l.value.height=`${a}px`};o.onMounted(async()=>{y.value=!0}),o.watch(()=>{var e;return(e=l.value)==null?void 0:e.adaption},e=>{e&&(window.addEventListener("resize",b),b())},{immediate:!0}),o.watch(()=>{var e;return(e=l.value)==null?void 0:e.adaptionOffsetBottom},()=>{var e;(e=l.value)!=null&&e.adaption&&b()},{immediate:!0}),o.onBeforeUnmount(()=>{y.value=!1,window.removeEventListener("resize",b)});const z=o.computed(()=>{var a,n;const{pagination:e}=l.value;return o.withDirectives(o.createVNode("div",{className:"mineadmin-pagination"},[o.createVNode("div",{class:"mineadmin-pagination-left"},[(a=t==null?void 0:t.pageLeft)==null?void 0:a.call(t)]),(((n=l.value)==null?void 0:n.showPagination)??!1)&&e&&o.createVNode("div",{class:"mineadmin-el-page"},[o.createVNode(m.ElPagination,o.mergeProps({total:0,onChange:()=>{}},e,{size:(e==null?void 0:e.size)??"default",pagerCount:(e==null?void 0:e.pagerCount)??5,layout:(e==null?void 0:e.layout)??"total, prev, pager, next, sizes, jumper"}),null)])]),[[o.vShow,t.pageLeft||e]])}),L=(e,a)=>{var M,E,P,A;if(e!=null&&e.hide&&(e==null?void 0:e.hide)instanceof Function&&e.hide(d)||e!=null&&e.hide&&typeof(e==null?void 0:e.hide)=="boolean"&&e.hide)return;const n=typeof e.prop=="function"?e.prop(a):e.prop;let i={default:s=>{var p,f,h;return((p=e==null?void 0:e.cellRender)==null?void 0:p.call(e,Object.assign(s,{options:l.value,attrs:d})))??((f=t==null?void 0:t[`column-${n}`])==null?void 0:f.call(t,s))??((h=t==null?void 0:t.default)==null?void 0:h.call(t,s))},header:s=>{var p,f,h;return((p=e==null?void 0:e.headerRender)==null?void 0:p.call(e,Object.assign(s,{options:l.value,attrs:d})))??((f=t==null?void 0:t[`header-${n}`])==null?void 0:f.call(t,s))??((h=t==null?void 0:t.header)==null?void 0:h.call(t,s))},filterIcon:s=>{var p;return(p=t==null?void 0:t.filterIcon)==null?void 0:p.call(t,s)}};const{label:O,prop:S,children:v,cellRender:k,headerRender:H,...R}=e;return v&&v.length>0&&(i=v==null?void 0:v.map(L)),o.createVNode(m.ElTableColumn,o.mergeProps({key:a},R,{label:typeof O=="function"?O():O,prop:n,align:(e==null?void 0:e.align)??((M=l.value)==null?void 0:M.columnAlign)??"center",headerAlign:(e==null?void 0:e.align)??((E=l.value)==null?void 0:E.columnAlign)??(e==null?void 0:e.headerAlign)??((P=l.value)==null?void 0:P.headerAlign)??"center",showOverflowTooltip:(e==null?void 0:e.showOverflowTooltip)??((A=l.value)==null?void 0:A.showOverflowTooltip)??!0}),typeof(T=i)=="function"||Object.prototype.toString.call(T)==="[object Object]"&&!o.isVNode(T)?i:{default:()=>[i]});var T},D=()=>{const{on:e,pagination:a,...n}=l.value;return o.createVNode(o.Fragment,null,[o.createVNode(m.ElTable,o.mergeProps({ref:x},e,n,d),{default:()=>{var i;return[o.createVNode(o.Fragment,null,[(i=c.value)==null?void 0:i.map(L)])]},append:()=>{var i;return(i=t.append)==null?void 0:i.call(t)},empty:()=>{var i;return((i=t.empty)==null?void 0:i.call(t))??o.createVNode(m.ElEmpty,null,null)}}),z.value])},N=()=>{const{loading:e,loadingConfig:a,height:n,maxHeight:i}=l.value;return o.withDirectives(o.createVNode("div",{className:"mineadmin-table","element-loading-svg":(a==null?void 0:a.svg)??'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 1024 1024"><path fill="currentColor" d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"/></svg>',"element-loading-svg-view-box":(a==null?void 0:a.viewBox)??"-9, -9, 50, 50","element-loading-text":(a==null?void 0:a.text)??null,"element-loading-spinner":(a==null?void 0:a.spinner)??null,"element-loading-background":(a==null?void 0:a.spinner)??null,"element-loading-custom-class":(a==null?void 0:a.customClass)??null},[D()]),[[o.resolveDirective("loading"),e]])},j=e=>c.value=e;return w({setData:e=>{l.value.data=e,g("set-data-callback",e)},setPagination:e=>{var a;return l.value.pagination=Object.assign(((a=l.value)==null?void 0:a.pagination)??{},e)},setLoadingState:e=>l.value.loading=e,setOptions:e=>l.value=Object.assign(l.value,e),getOptions:()=>l.value,setColumns:j,getColumns:()=>c.value,appendColumn:e=>c.value.push(e),removeColumn:e=>j(c.value.filter((a,n)=>(typeof a.prop=="function"?a.prop(n):a.prop)!==e)),getColumnByProp:e=>{var a;return((a=c.value.filter((n,i)=>(typeof n.prop=="function"?n.prop(i):n.prop)===e))==null?void 0:a[0])??null},getElTableRef:()=>x.value}),()=>B.ssr?y.value&&N():N()}}),V={install(u,t){u.component(C.name,C),u.provide("MaTableOptions",t??{ssr:!1})}};r.MaTable=V,r.default=V,r.useTable=function(u){return new Promise(async(t,d)=>{const g=o.getCurrentInstance();o.onMounted(async()=>{if(g&&g.refs[u]){const w=g.refs[u];t({...w})}else d("[@mineadmin/table]: not found ref for ma-table component")})})},Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(r,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],o):o((r=typeof globalThis<"u"?globalThis:r||self).MaTable={},r.Vue,r.ElementPlus)})(this,function(r,o,g){"use strict";const V=o.defineComponent({name:"MaTable",props:{options:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]}},directives:{Loading:g.ElLoadingDirective},emits:["set-data-callback"],setup(u,{slots:t,attrs:d,emit:m,expose:w}){const l=o.ref(u.options),c=o.ref(u.columns),z=o.inject("MaTableOptions"),y=o.ref(!1),L=o.ref(),b=()=>{const{adaptionOffsetBottom:e}=l.value,a=window.innerHeight-(e??70);l.value.height=`${a}px`},O=o.ref(1);o.onMounted(async()=>{y.value=!0}),o.watch(()=>{var e;return(e=l.value)==null?void 0:e.adaption},e=>{e&&(window.addEventListener("resize",b),b())},{immediate:!0}),o.watch(()=>{var e;return(e=l.value)==null?void 0:e.adaptionOffsetBottom},()=>{var e;(e=l.value)!=null&&e.adaption&&b()},{immediate:!0}),o.onBeforeUnmount(()=>{y.value=!1,window.removeEventListener("resize",b)});const D=()=>{var a,n;const{pagination:e}=l.value;return o.withDirectives(o.createVNode("div",{className:"mineadmin-pagination"},[o.createVNode("div",{class:"mineadmin-pagination-left"},[(a=t==null?void 0:t.pageLeft)==null?void 0:a.call(t)]),(((n=l.value)==null?void 0:n.showPagination)??!1)&&e&&o.createVNode("div",{class:"mineadmin-el-page"},[o.createVNode(g.ElPagination,o.mergeProps({total:0,onChange:()=>{}},e,{currentPage:O.value,"onUpdate:currentPage":i=>O.value=i,size:(e==null?void 0:e.size)??"default",pagerCount:(e==null?void 0:e.pagerCount)??5,layout:(e==null?void 0:e.layout)??"total, prev, pager, next, sizes, jumper"}),null)])]),[[o.vShow,t.pageLeft||e]])},N=(e,a)=>{var M,E,A,B;if(e!=null&&e.hide&&(e==null?void 0:e.hide)instanceof Function&&e.hide(d)||e!=null&&e.hide&&typeof(e==null?void 0:e.hide)=="boolean"&&e.hide)return;const n=typeof e.prop=="function"?e.prop(a):e.prop;let i={default:s=>{var p,f,h;return((p=e==null?void 0:e.cellRender)==null?void 0:p.call(e,Object.assign(s,{options:l.value,attrs:d})))??((f=t==null?void 0:t[`column-${n}`])==null?void 0:f.call(t,s))??((h=t==null?void 0:t.default)==null?void 0:h.call(t,s))},header:s=>{var p,f,h;return((p=e==null?void 0:e.headerRender)==null?void 0:p.call(e,Object.assign(s,{options:l.value,attrs:d})))??((f=t==null?void 0:t[`header-${n}`])==null?void 0:f.call(t,s))??((h=t==null?void 0:t.header)==null?void 0:h.call(t,s))},filterIcon:s=>{var p;return(p=t==null?void 0:t.filterIcon)==null?void 0:p.call(t,s)}};const{label:C,prop:k,children:v,cellRender:H,headerRender:F,...S}=e;return v&&v.length>0&&(i.default=()=>v==null?void 0:v.map(N)),o.createVNode(g.ElTableColumn,o.mergeProps({key:a},S,{label:typeof C=="function"?C():C,prop:n,align:(e==null?void 0:e.align)??((M=l.value)==null?void 0:M.columnAlign)??"center",headerAlign:(e==null?void 0:e.align)??((E=l.value)==null?void 0:E.columnAlign)??(e==null?void 0:e.headerAlign)??((A=l.value)==null?void 0:A.headerAlign)??"center",showOverflowTooltip:(e==null?void 0:e.showOverflowTooltip)??((B=l.value)==null?void 0:B.showOverflowTooltip)??!0}),typeof(T=i)=="function"||Object.prototype.toString.call(T)==="[object Object]"&&!o.isVNode(T)?i:{default:()=>[i]});var T},R=()=>{const{on:e,pagination:a,...n}=l.value;return o.createVNode(o.Fragment,null,[o.createVNode(g.ElTable,o.mergeProps({ref:L},e,n,d),{default:()=>{var i;return[o.createVNode(o.Fragment,null,[(i=c.value)==null?void 0:i.map(N)])]},append:()=>{var i;return(i=t.append)==null?void 0:i.call(t)},empty:()=>{var i;return((i=t.empty)==null?void 0:i.call(t))??o.createVNode(g.ElEmpty,null,null)}}),D()])},P=()=>{const{loading:e,loadingConfig:a,height:n,maxHeight:i}=l.value;return o.withDirectives(o.createVNode("div",{className:"mineadmin-table","element-loading-svg":(a==null?void 0:a.svg)??'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 1024 1024"><path fill="currentColor" d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"/></svg>',"element-loading-svg-view-box":(a==null?void 0:a.viewBox)??"-9, -9, 50, 50","element-loading-text":(a==null?void 0:a.text)??null,"element-loading-spinner":(a==null?void 0:a.spinner)??null,"element-loading-background":(a==null?void 0:a.spinner)??null,"element-loading-custom-class":(a==null?void 0:a.customClass)??null},[R()]),[[o.resolveDirective("loading"),e]])},j=e=>c.value=e;return w({setData:e=>{l.value.data=e,m("set-data-callback",e)},setPagination:e=>{var a;return l.value.pagination=Object.assign(((a=l.value)==null?void 0:a.pagination)??{},e)},setCurrentPage:e=>O.value=e,setLoadingState:e=>l.value.loading=e,setOptions:e=>l.value=Object.assign(l.value,e),getOptions:()=>l.value,setColumns:j,getColumns:()=>c.value,appendColumn:e=>c.value.push(e),removeColumn:e=>j(c.value.filter((a,n)=>(typeof a.prop=="function"?a.prop(n):a.prop)!==e)),getColumnByProp:e=>{var a;return((a=c.value.filter((n,i)=>(typeof n.prop=="function"?n.prop(i):n.prop)===e))==null?void 0:a[0])??null},getElTableRef:()=>L.value}),()=>z.ssr?y.value&&P():P()}}),x={install(u,t){u.component(V.name,V),u.provide("MaTableOptions",t??{ssr:!1})}};r.MaTable=x,r.default=x,r.useTable=function(u){return new Promise(async(t,d)=>{const m=o.getCurrentInstance();o.onMounted(async()=>{if(m&&m.refs[u]){const w=m.refs[u];t({...w})}else d("[@mineadmin/table]: not found ref for ma-table component")})})},Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,15 +1,16 @@
1
- import { MaTableColumns, TableColumnFilterPlacement, TableColumnSortOrders, TableColumnSortable, TableColumnRenderer, TableColumnFixed, TableColumnScope, TableColumnType, TableColumn } from './table-column';
2
- import { MaTableOptions, MaTableSetting } from './table-options';
3
- import { LoadingConfig } from './loading-config';
4
- import { PaginationProps } from './pagination';
5
- import { Ref } from 'vue';
6
- import { ElTable } from 'element-plus';
7
- type MaTableInstallOptions = {
1
+ import type { Ref } from 'vue';
2
+ import type { ElTable } from 'element-plus';
3
+ import type { MaTableColumns, TableColumn, TableColumnFilterPlacement, TableColumnFixed, TableColumnRenderer, TableColumnScope, TableColumnSortOrders, TableColumnSortable, TableColumnType } from './table-column';
4
+ import type { MaTableOptions, MaTableSetting } from './table-options';
5
+ import type { LoadingConfig } from './loading-config';
6
+ import type { PaginationProps } from './pagination';
7
+ interface MaTableInstallOptions {
8
8
  ssr?: boolean;
9
- };
9
+ }
10
10
  interface MaTableExpose {
11
11
  setData: (data: any[]) => void;
12
12
  setPagination: (pagination: PaginationProps) => void;
13
+ setCurrentPage: (pager: number) => void;
13
14
  setLoadingState: (loading: boolean) => void;
14
15
  setOptions: (opts: MaTableOptions) => void;
15
16
  getOptions: () => MaTableOptions;
@@ -1,7 +1,7 @@
1
- import { PaginationProps, LoadingConfig } from './index';
2
- import { MaTableColumns } from './table-column';
3
- import type { TableColumnCtx, SummaryMethod, ColumnStyle, ColumnCls, CellStyle, TreeNode, CellCls, Sort } from 'element-plus';
1
+ import type { CellCls, CellStyle, ColumnCls, ColumnStyle, Sort, SummaryMethod, TableColumnCtx, TreeNode } from 'element-plus';
4
2
  import type { TableOverflowTooltipOptions } from 'element-plus/es/components/table/src/util';
3
+ import type { MaTableColumns } from './table-column';
4
+ import type { LoadingConfig, PaginationProps } from './index';
5
5
  export interface ExtraOptions {
6
6
  containerHeight?: string;
7
7
  loading?: boolean;
package/package.json CHANGED
@@ -1,106 +1,106 @@
1
- {
2
- "name": "@mineadmin/table",
3
- "version": "1.0.31",
4
- "packageManager": "pnpm@8.6.10",
5
- "description": "基于element plus的表格组件,进行封装,提供方便、灵活的配置和使用方式",
6
- "keywords": [
7
- "@mineadmin/table",
8
- "element-plus",
9
- "typescript",
10
- "el-table",
11
- "nuxt3",
12
- "vue3",
13
- "vite",
14
- "tsx"
15
- ],
16
- "homepage": "https://github.com/mineadmin/mineadmin-table/tree/main/#readme",
17
- "bugs": {
18
- "url": "https://github.com/mineadmin/mineadmin-table/issues"
19
- },
20
- "license": "MIT",
21
- "author": "kanyxmo",
22
- "repository": {
23
- "type": "git",
24
- "url": "git+https://github.com/mineadmin/mineadmin-table.git"
25
- },
26
- "publishConfig": {
27
- "registry": "https://registry.npmjs.org/",
28
- "access": "public"
29
- },
30
- "main": "dist/index.umd.js",
31
- "module": "dist/index.es.js",
32
- "types": "dist/index.d.ts",
33
- "jsdelivr": "dist/index.umd.js",
34
- "unpkg": "dist/index.umd.js",
35
- "exports": {
36
- ".": {
37
- "types": "./dist/index.d.ts",
38
- "import": "./dist/index.es.js",
39
- "require": "./dist/index.umd.js"
40
- },
41
- "./volar": {
42
- "types": "./volar.d.ts"
43
- },
44
- "./*": "./*"
45
- },
46
- "files": [
47
- "dist",
48
- "volar.d.ts"
49
- ],
50
- "style": "dist/index.css",
51
- "sideEffects": false,
52
- "scripts": {
53
- "dev": "vite",
54
- "test": "vitest run",
55
- "build": "vite build",
56
- "preview": "vite preview",
57
- "lib": "vite build && vue-tsc -p tsconfig.build.json",
58
- "lint": "prettier --write \"packages/**/*.{ts,tsx}\" \"__tests__/table.test.tsx\" \"src/*.{ts,tsx,vue}\"",
59
- "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
60
- "lint:pretty": "pretty-quick --staged"
61
- },
62
- "peerDependencies": {
63
- "element-plus": "^2.0.0"
64
- },
65
- "dependencies": {
66
- "element-plus": "^2.8.1",
67
- "vue": "^3.4.31"
68
- },
69
- "devDependencies": {
70
- "@antfu/eslint-config": "^2.25.1",
71
- "@commitlint/cli": "^18.4.3",
72
- "@commitlint/config-conventional": "^18.4.3",
73
- "@commitlint/types": "^18.4.3",
74
- "@intlify/unplugin-vue-i18n": "^2.0.0",
75
- "@rollup/plugin-terser": "^0.4.4",
76
- "@types/node": "^20.10.5",
77
- "@vitejs/plugin-vue": "^4.4.1",
78
- "@vitejs/plugin-vue-jsx": "^3.0.2",
79
- "@vue/test-utils": "^2.4.3",
80
- "@vueuse/core": "^10.11.0",
81
- "@vueuse/integrations": "^10.11.0",
82
- "sortablejs": "1.15.2",
83
- "eslint": "^9.7.0",
84
- "husky": "^8.0.3",
85
- "jsdom": "^23.0.1",
86
- "lint-staged": "^15.2.0",
87
- "prettier": "^3.1.1",
88
- "rollup": "^4.3.0",
89
- "sass": "^1.77.8",
90
- "sass-loader": "^13.3.2",
91
- "typescript": "^5.3.3",
92
- "vite": "5.3.3",
93
- "vite-svg-loader": "^5.1.0",
94
- "vitest": "0.34.6",
95
- "vue-i18n": "^9.13.1",
96
- "vue-router": "^4.4.2",
97
- "vue-tsc": "^2.0.26"
98
- },
99
- "pnpm": {
100
- "peerDependencyRules": {
101
- "ignoreMissing": [
102
- "webpack"
103
- ]
104
- }
105
- }
1
+ {
2
+ "name": "@mineadmin/table",
3
+ "version": "1.0.35",
4
+ "packageManager": "pnpm@8.6.10",
5
+ "description": "基于element plus的表格组件,进行封装,提供方便、灵活的配置和使用方式",
6
+ "keywords": [
7
+ "@mineadmin/table",
8
+ "element-plus",
9
+ "typescript",
10
+ "el-table",
11
+ "nuxt3",
12
+ "vue3",
13
+ "vite",
14
+ "tsx"
15
+ ],
16
+ "homepage": "https://github.com/mineadmin/mineadmin-table/tree/main/#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/mineadmin/mineadmin-table/issues"
19
+ },
20
+ "license": "MIT",
21
+ "author": "kanyxmo",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/mineadmin/mineadmin-table.git"
25
+ },
26
+ "publishConfig": {
27
+ "registry": "https://registry.npmjs.org/",
28
+ "access": "public"
29
+ },
30
+ "main": "dist/index.umd.js",
31
+ "module": "dist/index.es.js",
32
+ "types": "dist/index.d.ts",
33
+ "jsdelivr": "dist/index.umd.js",
34
+ "unpkg": "dist/index.umd.js",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "import": "./dist/index.es.js",
39
+ "require": "./dist/index.umd.js"
40
+ },
41
+ "./volar": {
42
+ "types": "./volar.d.ts"
43
+ },
44
+ "./*": "./*"
45
+ },
46
+ "files": [
47
+ "dist",
48
+ "volar.d.ts"
49
+ ],
50
+ "style": "dist/index.css",
51
+ "sideEffects": false,
52
+ "scripts": {
53
+ "dev": "vite",
54
+ "test": "vitest run",
55
+ "build": "vite build",
56
+ "preview": "vite preview",
57
+ "lib": "vite build && vue-tsc -p tsconfig.build.json",
58
+ "lint": "prettier --write \"packages/**/*.{ts,tsx}\" \"__tests__/table.test.tsx\" \"src/*.{ts,tsx,vue}\"",
59
+ "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
60
+ "lint:pretty": "pretty-quick --staged"
61
+ },
62
+ "peerDependencies": {
63
+ "element-plus": "^2.0.0"
64
+ },
65
+ "dependencies": {
66
+ "element-plus": "^2.11.2",
67
+ "vue": "^3.5.21"
68
+ },
69
+ "devDependencies": {
70
+ "@antfu/eslint-config": "^2.27.3",
71
+ "@commitlint/cli": "^18.6.1",
72
+ "@commitlint/config-conventional": "^18.6.3",
73
+ "@commitlint/types": "^18.6.1",
74
+ "@intlify/unplugin-vue-i18n": "^2.0.0",
75
+ "@rollup/plugin-terser": "^0.4.4",
76
+ "@types/node": "^20.19.17",
77
+ "@vitejs/plugin-vue": "^4.6.2",
78
+ "@vitejs/plugin-vue-jsx": "^3.1.0",
79
+ "@vue/test-utils": "^2.4.6",
80
+ "@vueuse/core": "^10.11.1",
81
+ "@vueuse/integrations": "^10.11.1",
82
+ "eslint": "^9.35.0",
83
+ "husky": "^8.0.3",
84
+ "jsdom": "^23.2.0",
85
+ "lint-staged": "^15.5.2",
86
+ "prettier": "^3.6.2",
87
+ "rollup": "^4.50.2",
88
+ "sass": "^1.92.1",
89
+ "sass-loader": "^13.3.3",
90
+ "sortablejs": "1.15.2",
91
+ "typescript": "^5.9.2",
92
+ "vite": "5.3.3",
93
+ "vite-svg-loader": "^5.1.0",
94
+ "vitest": "0.34.6",
95
+ "vue-i18n": "^9.14.5",
96
+ "vue-router": "^4.5.1",
97
+ "vue-tsc": "^2.2.12"
98
+ },
99
+ "pnpm": {
100
+ "peerDependencyRules": {
101
+ "ignoreMissing": [
102
+ "webpack"
103
+ ]
104
+ }
105
+ }
106
106
  }
@@ -1,28 +0,0 @@
1
- import type { PropType } from 'vue';
2
- import { MaTableOptions, MaTableColumns } from '../types';
3
- import '../style/index.scss';
4
- declare const _default: import("vue").DefineComponent<{
5
- options: {
6
- type: PropType<MaTableOptions>;
7
- default: () => {};
8
- };
9
- columns: {
10
- type: PropType<MaTableColumns[]>;
11
- default: () => any[];
12
- };
13
- }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "set-data-callback"[], "set-data-callback", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
14
- options: {
15
- type: PropType<MaTableOptions>;
16
- default: () => {};
17
- };
18
- columns: {
19
- type: PropType<MaTableColumns[]>;
20
- default: () => any[];
21
- };
22
- }>> & {
23
- "onSet-data-callback"?: (...args: any[]) => any;
24
- }, {
25
- columns: MaTableColumns[];
26
- options: {};
27
- }, {}>;
28
- export default _default;