element-plus-suite 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -45,6 +45,7 @@ import { createApp } from 'vue'
45
45
  import ElementPlus from 'element-plus'
46
46
  import 'element-plus/dist/index.css'
47
47
  import ElementPlusSuite from 'element-plus-suite'
48
+ import 'element-plus-suite/dist/index.css'
48
49
  import App from './App.vue'
49
50
 
50
51
  const app = createApp(App)
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),b=require("element-plus");function M(e,t){return e.flatMap(r=>{if(r.visible===!1)return[];const{visible:l,slot:c,headerSlot:s,render:u,headerRender:n,autoMerge:a,children:d,...m}=r,p={...m},g={},h=c?t[c]:void 0,y=s?t[s]:void 0;if(h?g.default=h:u&&(g.default=f=>u({row:f.row,column:f.column,$index:f.$index})),y?g.header=y:n&&(g.header=f=>n({column:f.column,$index:f.$index,store:f.store,_self:f._self})),d?.length){const f={default:()=>M(d,t)};return g.header&&(f.header=g.header),[o.h(b.ElTableColumn,p,f)]}return[o.h(b.ElTableColumn,p,Object.keys(g).length?g:void 0)]})}function z(e){return e.prop??e.property}function x(e,t){if(e===null||typeof e!="object")return;const r=e;if(Object.prototype.hasOwnProperty.call(r,t))return r[t];if(!t.includes("."))return;let l=r;for(const c of t.split(".")){if(l===null||typeof l!="object")return;l=l[c]}return l}function q(e){return e.flatMap(t=>t.visible===!1?[]:t.children?.length?q(t.children):[t])}function C(e,t=[]){const r=q(e),l=new Map;for(const n of r){const a=z(n);a&&!l.has(a)&&l.set(a,n)}const c=new Set,s=[],u=n=>{!n||c.has(n)||!l.has(n)||(c.add(n),s.push({key:n,getValue:a=>x(a,n)}))};return t.forEach(u),r.forEach(n=>{n.autoMerge&&u(z(n))}),s}function D(e,t){const r=e.length,l=new Map(t.map(u=>[u.key,Array.from({length:r},()=>1)]));if(!r||!t.length)return l;const c=e.map(u=>t.map(n=>n.getValue(u))),s=t.map(()=>0);for(let u=1;u<=r;u+=1){let n=!0;for(let a=0;a<t.length;a+=1){const d=u<r&&n&&c[u][a]===c[u-1][a];if(!d){const m=l.get(t[a].key),p=s[a],g=u-p;m[p]=g;for(let h=p+1;h<u;h+=1)m[h]=0;s[a]=u}n=d}}return l}function I(e,t="children"){return e.some(r=>{if(r===null||typeof r!="object")return!1;const l=r[t];return Array.isArray(l)&&l.length>0})}function L(e){const t=o.computed(()=>C(e.columns(),e.mergeFields())),r=o.computed(()=>t.value.length?e.tableRef.value?.store?.states?.data?.value??e.data.value:e.data.value),l=o.computed(()=>{if(!t.value.length||e.lazy())return new Map;const s=e.treeProps()?.children??"children",u=r.value;return I(u,s)?new Map:D(u,t.value)});return{spanMethod:o.computed(()=>{const s=e.userSpanMethod();return t.value.length?u=>{const n=s?.(u);if(n!==void 0)return n;const a=u.column.property,d=a?l.value.get(a)?.[u.rowIndex]:void 0;if(!(d===void 0||d===1))return{rowspan:d,colspan:1}}:s}),spanMap:l}}const T={page:1,pageSize:20,pageSizes:[10,20,50,100],layout:"total, sizes, prev, pager, next, jumper",background:!0};function _(e){return e===!1?null:{...T,...e===!0?{}:e??{}}}function O(e){const t=o.computed(()=>_(e())),r=o.shallowRef(t.value?.page??1),l=o.shallowRef(t.value?.pageSize??20);o.watch(()=>t.value?.page,n=>{n!==void 0&&(r.value=n)}),o.watch(()=>t.value?.pageSize,n=>{n!==void 0&&(l.value=n)});const c=o.computed(()=>t.value?r.value:null),s=o.computed(()=>t.value?l.value:null);function u(n){l.value=n,r.value=1}return{enabled:o.computed(()=>t.value!=null),config:t,currentPage:r,pageSize:l,requestPage:c,requestPageSize:s,setPageSize:u}}function j(e){const t=o.shallowRef(!1);let r=null,l=0;async function c(){const u=e.request();if(!u)return;r?.abort(),r=new AbortController;const n=++l,a=r;t.value=!0;try{const d=await u({page:e.page(),pageSize:e.pageSize(),signal:a.signal});if(a.signal.aborted||n!==l)return;e.onData?.(d),e.onLoaded?.(d)}catch(d){if(a.signal.aborted||n!==l)return;e.onError?.(d)}finally{n===l&&(t.value=!1)}}function s(){r?.abort(),l+=1,t.value=!1}return o.onBeforeUnmount(s),{loading:t,load:c,cancel:s}}const A=o.defineComponent({name:"ElTablePro",inheritAttrs:!1,props:{columns:{type:Array,default:()=>[]},request:{type:Function,default:void 0},pagination:{type:[Boolean,Object],default:!0},mergeFields:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},rowKey:{type:[String,Function],required:!0}},emits:{loaded:e=>!0,error:e=>!0},setup(e,{attrs:t,emit:r,expose:l}){const c=o.useSlots(),s=o.shallowRef(null),u=o.shallowRef([]),n=o.shallowRef(0),a=O(()=>e.pagination),d=o.computed(()=>{const i=e.rowKey;return typeof i=="function"?v=>String(i(v)):i}),{loading:m,load:p,cancel:g}=j({request:()=>e.request,page:()=>a.requestPage.value,pageSize:()=>a.requestPageSize.value,onData:i=>{u.value=i.data,n.value=i.total},onLoaded:i=>r("loaded",i),onError:i=>r("error",i)}),h=o.computed(()=>m.value),y=o.computed(()=>{if(e.request)return u.value;if(!e.data)return[];if(!a.config.value)return e.data;const i=(a.currentPage.value-1)*a.pageSize.value;return e.data.slice(i,i+a.pageSize.value)}),f=o.computed(()=>e.request?n.value:e.data?.length??0),{spanMethod:R}=L({tableRef:s,columns:()=>e.columns,data:y,mergeFields:()=>e.mergeFields,userSpanMethod:()=>t.spanMethod,treeProps:()=>t.treeProps,lazy:()=>!!t.lazy});async function S(i){i?.page!==void 0&&(a.currentPage.value=i.page),await p()}o.watch(()=>e.request,i=>{u.value=[],n.value=0,i?S():g()}),o.watch(()=>[a.requestPage.value,a.requestPageSize.value],()=>{e.request&&S()});const F=new Proxy({},{get(i,v){if(v==="reload")return S;const P=s.value;if(!P)return;const w=P[v];return typeof w=="function"?w.bind(P):w},has(i,v){return v==="reload"?!0:s.value!=null&&v in s.value}});return l(F),o.onMounted(()=>{e.request&&S()}),()=>{const i=o.h(b.ElTable,{...t,ref:s,data:y.value,rowKey:d.value,spanMethod:R.value},{default:()=>M(e.columns,c),empty:c.empty,append:c.append});return[o.withDirectives(i,[[b.vLoading,h.value]]),a.enabled.value?o.h(b.ElPagination,{currentPage:a.currentPage.value,pageSize:a.pageSize.value,total:f.value,pageSizes:[...a.config.value?.pageSizes??[]],layout:a.config.value?.layout,background:a.config.value?.background,"onUpdate:currentPage":v=>{a.currentPage.value=v},"onUpdate:pageSize":v=>{a.setPageSize(v)}}):null]}}}),k=[A];function E(e){k.forEach(t=>{const r=t.name;r&&e.component(r,t)})}const B={install:E};exports.ElTablePro=A;exports.TABLE_PRO_DEFAULT_PAGINATION=T;exports.default=B;exports.install=E;exports.normalizePagination=_;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),b=require("element-plus");function M(e,t){return e.flatMap(r=>{if(r.visible===!1)return[];const{visible:u,slot:c,headerSlot:s,render:l,headerRender:n,autoMerge:a,children:d,...m}=r,p={...m},g={},h=c?t[c]:void 0,y=s?t[s]:void 0;if(h?g.default=h:l&&(g.default=f=>l({row:f.row,column:f.column,$index:f.$index})),y?g.header=y:n&&(g.header=f=>n({column:f.column,$index:f.$index,store:f.store,_self:f._self})),d?.length){const f={default:()=>M(d,t)};return g.header&&(f.header=g.header),[o.h(b.ElTableColumn,p,f)]}return[o.h(b.ElTableColumn,p,Object.keys(g).length?g:void 0)]})}function z(e){return e.prop??e.property}function x(e,t){if(e===null||typeof e!="object")return;const r=e;if(Object.prototype.hasOwnProperty.call(r,t))return r[t];if(!t.includes("."))return;let u=r;for(const c of t.split(".")){if(u===null||typeof u!="object")return;u=u[c]}return u}function q(e){return e.flatMap(t=>t.visible===!1?[]:t.children?.length?q(t.children):[t])}function C(e,t=[]){const r=q(e),u=new Map;for(const n of r){const a=z(n);a&&!u.has(a)&&u.set(a,n)}const c=new Set,s=[],l=n=>{!n||c.has(n)||!u.has(n)||(c.add(n),s.push({key:n,getValue:a=>x(a,n)}))};return t.forEach(l),r.forEach(n=>{n.autoMerge&&l(z(n))}),s}function D(e,t){const r=e.length,u=new Map(t.map(l=>[l.key,Array.from({length:r},()=>1)]));if(!r||!t.length)return u;const c=e.map(l=>t.map(n=>n.getValue(l))),s=t.map(()=>0);for(let l=1;l<=r;l+=1){let n=!0;for(let a=0;a<t.length;a+=1){const d=l<r&&n&&c[l][a]===c[l-1][a];if(!d){const m=u.get(t[a].key),p=s[a],g=l-p;m[p]=g;for(let h=p+1;h<l;h+=1)m[h]=0;s[a]=l}n=d}}return u}function I(e,t="children"){return e.some(r=>{if(r===null||typeof r!="object")return!1;const u=r[t];return Array.isArray(u)&&u.length>0})}function L(e){const t=o.computed(()=>C(e.columns(),e.mergeFields())),r=o.computed(()=>t.value.length?e.tableRef.value?.store?.states?.data?.value??e.data.value:e.data.value),u=o.computed(()=>{if(!t.value.length||e.lazy())return new Map;const s=e.treeProps()?.children??"children",l=r.value;return I(l,s)?new Map:D(l,t.value)});return{spanMethod:o.computed(()=>{const s=e.userSpanMethod();return t.value.length?l=>{const n=s?.(l);if(n!==void 0)return n;const a=l.column.property,d=a?u.value.get(a)?.[l.rowIndex]:void 0;if(!(d===void 0||d===1))return{rowspan:d,colspan:1}}:s}),spanMap:u}}const T={page:1,pageSize:20,pageSizes:[10,20,50,100],layout:"total, sizes, prev, pager, next, jumper",background:!0};function _(e){return e===!1?null:{...T,...e===!0?{}:e??{}}}function O(e){const t=o.computed(()=>_(e())),r=o.shallowRef(t.value?.page??1),u=o.shallowRef(t.value?.pageSize??20);o.watch(()=>t.value?.page,n=>{n!==void 0&&(r.value=n)}),o.watch(()=>t.value?.pageSize,n=>{n!==void 0&&(u.value=n)});const c=o.computed(()=>t.value?r.value:null),s=o.computed(()=>t.value?u.value:null);function l(n){u.value=n,r.value=1}return{enabled:o.computed(()=>t.value!=null),config:t,currentPage:r,pageSize:u,requestPage:c,requestPageSize:s,setPageSize:l}}function j(e){const t=o.shallowRef(!1);let r=null,u=0;async function c(){const l=e.request();if(!l)return;r?.abort(),r=new AbortController;const n=++u,a=r;t.value=!0;try{const d=await l({page:e.page(),pageSize:e.pageSize(),signal:a.signal});if(a.signal.aborted||n!==u)return;e.onData?.(d),e.onLoaded?.(d)}catch(d){if(a.signal.aborted||n!==u)return;e.onError?.(d)}finally{n===u&&(t.value=!1)}}function s(){r?.abort(),u+=1,t.value=!1}return o.onBeforeUnmount(s),{loading:t,load:c,cancel:s}}const A=o.defineComponent({name:"ElTablePro",inheritAttrs:!1,props:{columns:{type:Array,default:()=>[]},request:{type:Function,default:void 0},pagination:{type:[Boolean,Object],default:!0},mergeFields:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},rowKey:{type:[String,Function],required:!0}},emits:{loaded:e=>!0,error:e=>!0},setup(e,{attrs:t,emit:r,expose:u}){const c=o.useSlots(),s=o.shallowRef(null),l=o.shallowRef([]),n=o.shallowRef(0),a=O(()=>e.pagination),d=o.computed(()=>{const i=e.rowKey;return typeof i=="function"?v=>String(i(v)):i}),{loading:m,load:p,cancel:g}=j({request:()=>e.request,page:()=>a.requestPage.value,pageSize:()=>a.requestPageSize.value,onData:i=>{l.value=i.data,n.value=i.total},onLoaded:i=>r("loaded",i),onError:i=>r("error",i)}),h=o.computed(()=>m.value),y=o.computed(()=>{if(e.request)return l.value;if(!e.data)return[];if(!a.config.value)return e.data;const i=(a.currentPage.value-1)*a.pageSize.value;return e.data.slice(i,i+a.pageSize.value)}),f=o.computed(()=>e.request?n.value:e.data?.length??0),{spanMethod:R}=L({tableRef:s,columns:()=>e.columns,data:y,mergeFields:()=>e.mergeFields,userSpanMethod:()=>t.spanMethod,treeProps:()=>t.treeProps,lazy:()=>!!t.lazy});async function S(i){i?.page!==void 0&&(a.currentPage.value=i.page),await p()}o.watch(()=>e.request,i=>{l.value=[],n.value=0,i?S():g()}),o.watch(()=>[a.requestPage.value,a.requestPageSize.value],()=>{e.request&&S()});const F=new Proxy({},{get(i,v){if(v==="reload")return S;const P=s.value;if(!P)return;const w=P[v];return typeof w=="function"?w.bind(P):w},has(i,v){return v==="reload"?!0:s.value!=null&&v in s.value}});return u(F),o.onMounted(()=>{e.request&&S()}),()=>{const i=o.h(b.ElTable,{...t,ref:s,data:y.value,rowKey:d.value,spanMethod:R.value},{default:()=>M(e.columns,c),empty:c.empty,append:c.append});return o.h("div",{class:"el-table-pro"},[o.withDirectives(i,[[b.vLoading,h.value]]),a.enabled.value?o.h(b.ElPagination,{currentPage:a.currentPage.value,pageSize:a.pageSize.value,total:f.value,pageSizes:[...a.config.value?.pageSizes??[]],layout:a.config.value?.layout,background:a.config.value?.background,"onUpdate:currentPage":v=>{a.currentPage.value=v},"onUpdate:pageSize":v=>{a.setPageSize(v)}}):null])}}}),k=[A];function E(e){k.forEach(t=>{const r=t.name;r&&e.component(r,t)})}const B={install:E};exports.ElTablePro=A;exports.TABLE_PRO_DEFAULT_PAGINATION=T;exports.default=B;exports.install=E;exports.normalizePagination=_;
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ .el-table-pro{display:flex;flex-direction:column;gap:16px;min-width:0}
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
- import { h as P, computed as g, shallowRef as m, watch as z, onBeforeUnmount as F, defineComponent as C, useSlots as D, onMounted as R, withDirectives as j } from "vue";
1
+ import { h as S, computed as g, shallowRef as m, watch as z, onBeforeUnmount as F, defineComponent as C, useSlots as D, onMounted as R, withDirectives as j } from "vue";
2
2
  import { ElTableColumn as q, ElTable as I, vLoading as L, ElPagination as k } from "element-plus";
3
3
  function T(e, t) {
4
4
  return e.flatMap((r) => {
5
5
  if (r.visible === !1) return [];
6
6
  const {
7
- visible: l,
7
+ visible: u,
8
8
  slot: s,
9
9
  headerSlot: o,
10
- render: u,
10
+ render: l,
11
11
  headerRender: n,
12
12
  autoMerge: a,
13
13
  children: c,
14
14
  ...y
15
15
  } = r, p = { ...y }, f = {}, h = s ? t[s] : void 0, b = o ? t[o] : void 0;
16
- if (h ? f.default = h : u && (f.default = (d) => u({
16
+ if (h ? f.default = h : l && (f.default = (d) => l({
17
17
  row: d.row,
18
18
  column: d.column,
19
19
  $index: d.$index
@@ -26,10 +26,10 @@ function T(e, t) {
26
26
  const d = {
27
27
  default: () => T(c, t)
28
28
  };
29
- return f.header && (d.header = f.header), [P(q, p, d)];
29
+ return f.header && (d.header = f.header), [S(q, p, d)];
30
30
  }
31
31
  return [
32
- P(
32
+ S(
33
33
  q,
34
34
  p,
35
35
  Object.keys(f).length ? f : void 0
@@ -46,82 +46,82 @@ function O(e, t) {
46
46
  if (Object.prototype.hasOwnProperty.call(r, t))
47
47
  return r[t];
48
48
  if (!t.includes(".")) return;
49
- let l = r;
49
+ let u = r;
50
50
  for (const s of t.split(".")) {
51
- if (l === null || typeof l != "object") return;
52
- l = l[s];
51
+ if (u === null || typeof u != "object") return;
52
+ u = u[s];
53
53
  }
54
- return l;
54
+ return u;
55
55
  }
56
56
  function _(e) {
57
57
  return e.flatMap((t) => t.visible === !1 ? [] : t.children?.length ? _(t.children) : [t]);
58
58
  }
59
59
  function V(e, t = []) {
60
- const r = _(e), l = /* @__PURE__ */ new Map();
60
+ const r = _(e), u = /* @__PURE__ */ new Map();
61
61
  for (const n of r) {
62
62
  const a = x(n);
63
- a && !l.has(a) && l.set(a, n);
63
+ a && !u.has(a) && u.set(a, n);
64
64
  }
65
- const s = /* @__PURE__ */ new Set(), o = [], u = (n) => {
66
- !n || s.has(n) || !l.has(n) || (s.add(n), o.push({
65
+ const s = /* @__PURE__ */ new Set(), o = [], l = (n) => {
66
+ !n || s.has(n) || !u.has(n) || (s.add(n), o.push({
67
67
  key: n,
68
68
  getValue: (a) => O(a, n)
69
69
  }));
70
70
  };
71
- return t.forEach(u), r.forEach((n) => {
72
- n.autoMerge && u(x(n));
71
+ return t.forEach(l), r.forEach((n) => {
72
+ n.autoMerge && l(x(n));
73
73
  }), o;
74
74
  }
75
75
  function B(e, t) {
76
- const r = e.length, l = new Map(
77
- t.map((u) => [u.key, Array.from({ length: r }, () => 1)])
76
+ const r = e.length, u = new Map(
77
+ t.map((l) => [l.key, Array.from({ length: r }, () => 1)])
78
78
  );
79
- if (!r || !t.length) return l;
80
- const s = e.map((u) => t.map((n) => n.getValue(u))), o = t.map(() => 0);
81
- for (let u = 1; u <= r; u += 1) {
79
+ if (!r || !t.length) return u;
80
+ const s = e.map((l) => t.map((n) => n.getValue(l))), o = t.map(() => 0);
81
+ for (let l = 1; l <= r; l += 1) {
82
82
  let n = !0;
83
83
  for (let a = 0; a < t.length; a += 1) {
84
- const c = u < r && n && s[u][a] === s[u - 1][a];
84
+ const c = l < r && n && s[l][a] === s[l - 1][a];
85
85
  if (!c) {
86
- const y = l.get(t[a].key), p = o[a], f = u - p;
86
+ const y = u.get(t[a].key), p = o[a], f = l - p;
87
87
  y[p] = f;
88
- for (let h = p + 1; h < u; h += 1)
88
+ for (let h = p + 1; h < l; h += 1)
89
89
  y[h] = 0;
90
- o[a] = u;
90
+ o[a] = l;
91
91
  }
92
92
  n = c;
93
93
  }
94
94
  }
95
- return l;
95
+ return u;
96
96
  }
97
97
  function K(e, t = "children") {
98
98
  return e.some((r) => {
99
99
  if (r === null || typeof r != "object") return !1;
100
- const l = r[t];
101
- return Array.isArray(l) && l.length > 0;
100
+ const u = r[t];
101
+ return Array.isArray(u) && u.length > 0;
102
102
  });
103
103
  }
104
104
  function U(e) {
105
105
  const t = g(
106
106
  () => V(e.columns(), e.mergeFields())
107
- ), r = g(() => t.value.length ? e.tableRef.value?.store?.states?.data?.value ?? e.data.value : e.data.value), l = g(() => {
107
+ ), r = g(() => t.value.length ? e.tableRef.value?.store?.states?.data?.value ?? e.data.value : e.data.value), u = g(() => {
108
108
  if (!t.value.length || e.lazy())
109
109
  return /* @__PURE__ */ new Map();
110
- const o = e.treeProps()?.children ?? "children", u = r.value;
111
- return K(u, o) ? /* @__PURE__ */ new Map() : B(u, t.value);
110
+ const o = e.treeProps()?.children ?? "children", l = r.value;
111
+ return K(l, o) ? /* @__PURE__ */ new Map() : B(l, t.value);
112
112
  });
113
113
  return {
114
114
  spanMethod: g(() => {
115
115
  const o = e.userSpanMethod();
116
- return t.value.length ? (u) => {
117
- const n = o?.(u);
116
+ return t.value.length ? (l) => {
117
+ const n = o?.(l);
118
118
  if (n !== void 0) return n;
119
- const a = u.column.property, c = a ? l.value.get(a)?.[u.rowIndex] : void 0;
119
+ const a = l.column.property, c = a ? u.value.get(a)?.[l.rowIndex] : void 0;
120
120
  if (!(c === void 0 || c === 1))
121
121
  return { rowspan: c, colspan: 1 };
122
122
  } : o;
123
123
  }),
124
- spanMap: l
124
+ spanMap: u
125
125
  };
126
126
  }
127
127
  const $ = {
@@ -138,7 +138,7 @@ function N(e) {
138
138
  };
139
139
  }
140
140
  function G(e) {
141
- const t = g(() => N(e())), r = m(t.value?.page ?? 1), l = m(t.value?.pageSize ?? 20);
141
+ const t = g(() => N(e())), r = m(t.value?.page ?? 1), u = m(t.value?.pageSize ?? 20);
142
142
  z(
143
143
  () => t.value?.page,
144
144
  (n) => {
@@ -147,56 +147,56 @@ function G(e) {
147
147
  ), z(
148
148
  () => t.value?.pageSize,
149
149
  (n) => {
150
- n !== void 0 && (l.value = n);
150
+ n !== void 0 && (u.value = n);
151
151
  }
152
152
  );
153
153
  const s = g(
154
154
  () => t.value ? r.value : null
155
155
  ), o = g(
156
- () => t.value ? l.value : null
156
+ () => t.value ? u.value : null
157
157
  );
158
- function u(n) {
159
- l.value = n, r.value = 1;
158
+ function l(n) {
159
+ u.value = n, r.value = 1;
160
160
  }
161
161
  return {
162
162
  // 模板直接依赖这个布尔值,避免访问可能为 null 的配置。
163
163
  enabled: g(() => t.value != null),
164
164
  config: t,
165
165
  currentPage: r,
166
- pageSize: l,
166
+ pageSize: u,
167
167
  requestPage: s,
168
168
  requestPageSize: o,
169
- setPageSize: u
169
+ setPageSize: l
170
170
  };
171
171
  }
172
172
  function H(e) {
173
173
  const t = m(!1);
174
- let r = null, l = 0;
174
+ let r = null, u = 0;
175
175
  async function s() {
176
- const u = e.request();
177
- if (!u) return;
176
+ const l = e.request();
177
+ if (!l) return;
178
178
  r?.abort(), r = new AbortController();
179
- const n = ++l, a = r;
179
+ const n = ++u, a = r;
180
180
  t.value = !0;
181
181
  try {
182
- const c = await u({
182
+ const c = await l({
183
183
  page: e.page(),
184
184
  pageSize: e.pageSize(),
185
185
  signal: a.signal
186
186
  });
187
- if (a.signal.aborted || n !== l)
187
+ if (a.signal.aborted || n !== u)
188
188
  return;
189
189
  e.onData?.(c), e.onLoaded?.(c);
190
190
  } catch (c) {
191
- if (a.signal.aborted || n !== l)
191
+ if (a.signal.aborted || n !== u)
192
192
  return;
193
193
  e.onError?.(c);
194
194
  } finally {
195
- n === l && (t.value = !1);
195
+ n === u && (t.value = !1);
196
196
  }
197
197
  }
198
198
  function o() {
199
- r?.abort(), l += 1, t.value = !1;
199
+ r?.abort(), u += 1, t.value = !1;
200
200
  }
201
201
  return F(o), { loading: t, load: s, cancel: o };
202
202
  }
@@ -236,9 +236,9 @@ const J = /* @__PURE__ */ C({
236
236
  setup(e, {
237
237
  attrs: t,
238
238
  emit: r,
239
- expose: l
239
+ expose: u
240
240
  }) {
241
- const s = D(), o = m(null), u = m([]), n = m(0), a = G(() => e.pagination), c = g(() => {
241
+ const s = D(), o = m(null), l = m([]), n = m(0), a = G(() => e.pagination), c = g(() => {
242
242
  const i = e.rowKey;
243
243
  return typeof i == "function" ? (v) => String(i(v)) : i;
244
244
  }), {
@@ -250,12 +250,12 @@ const J = /* @__PURE__ */ C({
250
250
  page: () => a.requestPage.value,
251
251
  pageSize: () => a.requestPageSize.value,
252
252
  onData: (i) => {
253
- u.value = i.data, n.value = i.total;
253
+ l.value = i.data, n.value = i.total;
254
254
  },
255
255
  onLoaded: (i) => r("loaded", i),
256
256
  onError: (i) => r("error", i)
257
257
  }), h = g(() => y.value), b = g(() => {
258
- if (e.request) return u.value;
258
+ if (e.request) return l.value;
259
259
  if (!e.data) return [];
260
260
  if (!a.config.value) return e.data;
261
261
  const i = (a.currentPage.value - 1) * a.pageSize.value;
@@ -271,17 +271,17 @@ const J = /* @__PURE__ */ C({
271
271
  treeProps: () => t.treeProps,
272
272
  lazy: () => !!t.lazy
273
273
  });
274
- async function S(i) {
274
+ async function P(i) {
275
275
  i?.page !== void 0 && (a.currentPage.value = i.page), await p();
276
276
  }
277
277
  z(() => e.request, (i) => {
278
- u.value = [], n.value = 0, i ? S() : f();
278
+ l.value = [], n.value = 0, i ? P() : f();
279
279
  }), z(() => [a.requestPage.value, a.requestPageSize.value], () => {
280
- e.request && S();
280
+ e.request && P();
281
281
  });
282
282
  const E = new Proxy({}, {
283
283
  get(i, v) {
284
- if (v === "reload") return S;
284
+ if (v === "reload") return P;
285
285
  const M = o.value;
286
286
  if (!M) return;
287
287
  const w = M[v];
@@ -291,10 +291,10 @@ const J = /* @__PURE__ */ C({
291
291
  return v === "reload" ? !0 : o.value != null && v in o.value;
292
292
  }
293
293
  });
294
- return l(E), R(() => {
295
- e.request && S();
294
+ return u(E), R(() => {
295
+ e.request && P();
296
296
  }), () => {
297
- const i = P(I, {
297
+ const i = S(I, {
298
298
  ...t,
299
299
  ref: o,
300
300
  data: b.value,
@@ -305,7 +305,9 @@ const J = /* @__PURE__ */ C({
305
305
  empty: s.empty,
306
306
  append: s.append
307
307
  });
308
- return [j(i, [[L, h.value]]), a.enabled.value ? P(k, {
308
+ return S("div", {
309
+ class: "el-table-pro"
310
+ }, [j(i, [[L, h.value]]), a.enabled.value ? S(k, {
309
311
  currentPage: a.currentPage.value,
310
312
  pageSize: a.pageSize.value,
311
313
  total: d.value,
@@ -318,7 +320,7 @@ const J = /* @__PURE__ */ C({
318
320
  "onUpdate:pageSize": (v) => {
319
321
  a.setPageSize(v);
320
322
  }
321
- }) : null];
323
+ }) : null]);
322
324
  };
323
325
  }
324
326
  }), Q = [J];
@@ -25,9 +25,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
25
25
  type: PropType<string | ((row: any) => string | number)>;
26
26
  required: true;
27
27
  };
28
- }>, () => (import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
28
+ }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
29
29
  [key: string]: any;
30
- }> | null)[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
30
+ }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
31
31
  loaded: (_result: TableProRequestResult<any>) => true;
32
32
  error: (_error: unknown) => true;
33
33
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "element-plus-suite",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Unofficial enhancement components for Element Plus",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/th74100/element-plus-suite.git"
9
+ },
10
+ "homepage": "https://th74100.github.io/element-plus-suite/",
5
11
  "type": "module",
6
- "sideEffects": false,
12
+ "sideEffects": [
13
+ "**/*.css"
14
+ ],
7
15
  "files": [
8
16
  "dist"
9
17
  ],
@@ -15,7 +23,8 @@
15
23
  "types": "./dist/index.d.ts",
16
24
  "import": "./dist/index.js",
17
25
  "require": "./dist/index.cjs"
18
- }
26
+ },
27
+ "./dist/index.css": "./dist/index.css"
19
28
  },
20
29
  "scripts": {
21
30
  "build": "vite build",