auto-vue-manual 0.0.8 → 0.0.9
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/dist/auto-vue-page.es.js
CHANGED
|
@@ -37,7 +37,7 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
37
37
|
searchInitParam: {},
|
|
38
38
|
// 总参数(包含分页和查询参数)
|
|
39
39
|
totalParam: {}
|
|
40
|
-
}), p = d(null), B = d(0), W = d(0),
|
|
40
|
+
}), p = d(null), B = d(0), W = d(0), M = d(null), $ = d(0), m = d(5), T = d(0), F = d(0), L = () => {
|
|
41
41
|
ae(() => {
|
|
42
42
|
if (!p.value) return;
|
|
43
43
|
const t = p.value.parentElement, e = (t == null ? void 0 : t.clientHeight) || 0, l = (t == null ? void 0 : t.clientWidth) || 0, r = t ? getComputedStyle(t) : null, c = r ? parseFloat(r.paddingTop) + parseFloat(r.paddingBottom) : 0, h = r ? parseFloat(r.marginTop) + parseFloat(r.marginBottom) : 0, b = Array.from((t == null ? void 0 : t.children) || []).filter((V) => V !== p.value).reduce((V, Z) => {
|
|
@@ -59,7 +59,7 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
59
59
|
};
|
|
60
60
|
let { rowH: r, extH: c, size: h } = o;
|
|
61
61
|
const b = l[h || "small"] || 41, S = e[h || "small"] || 32, g = n ? 44 : 0;
|
|
62
|
-
r = r || b, c = (c || 0) + S + g, $.value = t - g,
|
|
62
|
+
r = r || b, c = (c || 0) + S + g, $.value = t - g, T.value = r, F.value = S, o != null && o.pageSize && (o == null ? void 0 : o.pageSize) > 0 ? a.pagination.size = o == null ? void 0 : o.pageSize : t > 0 && (a.pagination.size = Math.floor((t - c) / r) - (o != null && o.sumUrl ? 1 : 0));
|
|
63
63
|
}, { deep: !0, immediate: !0 }), le(W, (t) => {
|
|
64
64
|
if (!n || !t) return;
|
|
65
65
|
let { size: e = "small" } = o;
|
|
@@ -72,7 +72,7 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
72
72
|
m.value = Math.min(Math.max(h, 2), 7);
|
|
73
73
|
}, { deep: !0, immediate: !0 }), se(() => {
|
|
74
74
|
L(), window.addEventListener("resize", () => {
|
|
75
|
-
|
|
75
|
+
M.value && clearTimeout(M.value), M.value = setTimeout(() => {
|
|
76
76
|
L();
|
|
77
77
|
}, 300);
|
|
78
78
|
});
|
|
@@ -161,12 +161,12 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
161
161
|
flatColumnsFunc: Y,
|
|
162
162
|
containerRef: p,
|
|
163
163
|
calculateHeight: $,
|
|
164
|
-
calculateRowH:
|
|
164
|
+
calculateRowH: T,
|
|
165
165
|
calculateTitleH: F,
|
|
166
166
|
pagerCount: m,
|
|
167
167
|
updatePageSize: O
|
|
168
168
|
};
|
|
169
|
-
},
|
|
169
|
+
}, Me = (s = "id", i) => {
|
|
170
170
|
const n = d(!1), u = d([]), z = H(() => {
|
|
171
171
|
let a = [];
|
|
172
172
|
return u.value.forEach((p) => a.push(p[s])), a;
|
|
@@ -179,7 +179,7 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
179
179
|
a.length ? n.value = !0 : n.value = !1, u.value = a;
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
|
-
},
|
|
182
|
+
}, Te = /* @__PURE__ */ ue({
|
|
183
183
|
__name: "Pagination",
|
|
184
184
|
props: {
|
|
185
185
|
className: {},
|
|
@@ -254,10 +254,10 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
254
254
|
"index",
|
|
255
255
|
"expand"
|
|
256
256
|
// "sort",
|
|
257
|
-
], a = d(""), { selectionChange: p, selectedList: B, selectedListIds: W, isSelected:
|
|
257
|
+
], a = d(""), { selectionChange: p, selectedList: B, selectedListIds: W, isSelected: M } = Me(n.rowKey), {
|
|
258
258
|
tableData: $,
|
|
259
259
|
pagination: m,
|
|
260
|
-
searchParam:
|
|
260
|
+
searchParam: T,
|
|
261
261
|
searchInitParam: F,
|
|
262
262
|
enumMap: L,
|
|
263
263
|
getTableList: I,
|
|
@@ -296,16 +296,16 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
296
296
|
var h, b, S;
|
|
297
297
|
e.search.order = ((h = e.search) == null ? void 0 : h.order) ?? l + 2;
|
|
298
298
|
const r = ((b = e.search) == null ? void 0 : b.key) ?? _e(e.prop), c = (S = e.search) == null ? void 0 : S.defaultValue;
|
|
299
|
-
c != null && (
|
|
299
|
+
c != null && (T.value[r] = c, F.value[r] = c);
|
|
300
300
|
}), i({
|
|
301
301
|
element: u,
|
|
302
302
|
tableData: O,
|
|
303
303
|
radio: a,
|
|
304
304
|
enumMap: L,
|
|
305
305
|
pagination: m,
|
|
306
|
-
searchParam:
|
|
306
|
+
searchParam: T,
|
|
307
307
|
searchInitParam: F,
|
|
308
|
-
isSelected:
|
|
308
|
+
isSelected: M,
|
|
309
309
|
selectedList: B,
|
|
310
310
|
selectedListIds: W,
|
|
311
311
|
// 下面为 function
|
|
@@ -399,7 +399,7 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
399
399
|
[S, e.loading]
|
|
400
400
|
]),
|
|
401
401
|
v(m) ? D(e.$slots, "pagination", { key: 0 }, () => [
|
|
402
|
-
re(
|
|
402
|
+
re(Te, {
|
|
403
403
|
className: "basic-table-pagination",
|
|
404
404
|
styles: "margin-top: 12px; margin-right: 20px; display: flex; justify-content: flex-end;",
|
|
405
405
|
size: e.size,
|
|
@@ -426,6 +426,5 @@ const He = (s, i = {}, n = !0, u, z, o) => {
|
|
|
426
426
|
};
|
|
427
427
|
export {
|
|
428
428
|
Be as ProTable,
|
|
429
|
-
Be as ProTableList,
|
|
430
429
|
We as default
|
|
431
430
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(y,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(y=typeof globalThis<"u"?globalThis:y||self,e(y.AutoVuePage={},y.Vue,y.ElementPlus))})(this,function(y,e,G){"use strict";let I;const J=c=>{if(!c.request)throw new Error("request function is required");I=c.request,c.mittBus};function Q(c){const r=c.split(".");return r.length==1?c:r[r.length-1]}function X(){let c="";for(let r=0;r<32;r++){let l=Math.random()*16|0;(r===8||r===12||r===16||r===20)&&(c+="-"),c+=(r===12?4:r===16?l&3|8:l).toString(16)}return c}const Y=(c,r={},l=!0,d,C,s)=>{const n=e.reactive({tableData:[],pagination:{page:1,size:10,total:0},searchParam:{},searchInitParam:{},totalParam:{}}),h=e.ref(null),H=e.ref(0),x=e.ref(0),P=e.ref(null),F=e.ref(0),f=e.ref(5),_=e.ref(0),B=e.ref(0),T=()=>{e.nextTick(()=>{if(!h.value)return;const a=h.value.parentElement,t=(a==null?void 0:a.clientHeight)||0,o=(a==null?void 0:a.clientWidth)||0,i=a?getComputedStyle(a):null,g=i?parseFloat(i.paddingTop)+parseFloat(i.paddingBottom):0,m=i?parseFloat(i.marginTop)+parseFloat(i.marginBottom):0,b=Array.from((a==null?void 0:a.children)||[]).filter(W=>W!==h.value).reduce((W,K)=>{const $=getComputedStyle(K),ne=parseFloat($.marginTop)+parseFloat($.marginBottom),le=parseFloat($.marginLeft)+parseFloat($.marginRight);return[W[0]+K.clientHeight+ne,W[1]+K.clientWidth+le]},[0,0]),[z,u]=b,p=t-z-g-m,w=o-u-g-m;h.value.style.height=p?`${p}px`:"100%",h.value.style.width=w?`${w}px`:"100%",H.value=p,x.value=w})};e.watch(H,a=>{const t={small:32,default:40,large:48},o={small:41,default:49,large:57};let{rowH:i,extH:g,size:m}=s;const b=o[m||"small"]||41,z=t[m||"small"]||32,u=l?44:0;i=i||b,g=(g||0)+z+u,F.value=a-u,_.value=i,B.value=z,s!=null&&s.pageSize&&(s==null?void 0:s.pageSize)>0?n.pagination.size=s==null?void 0:s.pageSize:a>0&&(n.pagination.size=Math.floor((a-g)/i)-(s!=null&&s.sumUrl?1:0))},{deep:!0,immediate:!0}),e.watch(x,a=>{if(!l||!a)return;let{size:t="small"}=s;const i={"":32,default:32,small:24,large:40}[t],g=a-80-16-(i+8)*2-16-(t==="small"?108:114),m=Math.floor(g/(i+8))-1;f.value=Math.min(Math.max(m,2),7)},{deep:!0,immediate:!0}),e.onMounted(()=>{T(),window.addEventListener("resize",()=>{P.value&&clearTimeout(P.value),P.value=setTimeout(()=>{T()},300)})});const L=e.computed({get:()=>({page:n.pagination.page,size:n.pagination.size}),set:a=>{console.log("我是分页更新之后的值",a)}}),k=()=>{e.nextTick(async()=>{let a=c;if(!(a==""&&!(s!=null&&s.api)))try{Object.assign(n.totalParam,r,l?L.value:{});let{data:t}=await I(a,{...n.searchInitParam,...n.totalParam});d&&(t=d(t)),n.tableData=l?t.list:t,l&&(n.pagination.total=t.total)}catch(t){C&&C(t)}})},M=()=>{n.totalParam={};let a={};for(let t in n.searchParam)(n.searchParam[t]||n.searchParam[t]===!1||n.searchParam[t]===0)&&(a[t]=n.searchParam[t]);Object.assign(n.totalParam,a)},U=()=>{n.pagination.page=1,M(),k(),s!=null&&s.sumUrl&&R()},E=()=>{n.pagination.page=1,n.searchParam={...n.searchInitParam},M(),k(),s!=null&&s.sumUrl&&R()},D=a=>{n.pagination.page=1,n.pagination.size=a,k()},q=a=>{n.pagination.page=a,k()},N=e.ref([]);function j(){const a=[];for(const t of N.value)a[t.index]=t.text;return a}async function R(){await I(s.sumUrl,{...n.searchInitParam,...n.totalParam,page:1,size:1}).then(a=>{N.value=(a==null?void 0:a.data)||[]})}const V=a=>{n.pagination.size=a},S=e.ref(new Map),O=async({prop:a,enum:t})=>{if(!t||S.value.has(a)&&(typeof t=="function"||S.value.get(a)===t))return;if(typeof t!="function")return S.value.set(a,e.unref(t));S.value.set(a,[]);const{data:o}=await t();S.value.set(a,o)},A=(a,t=[])=>(a.forEach(async o=>{var i;(i=o._children)!=null&&i.length&&t.push(...A(o._children)),t.push(o),o.isShow=o.isShow??!0,o.isSetting=o.isSetting??!0,o.isFilterEnum=o.isFilterEnum??!0,await O(o)}),t.filter(o=>{var i;return!((i=o._children)!=null&&i.length)}));return{...e.toRefs(n),enumMap:S,getTableList:k,getSummaries:j,search:U,reset:E,handleSizeChange:D,handleCurrentChange:q,updatedTotalParam:M,flatColumnsFunc:A,containerRef:h,calculateHeight:F,calculateRowH:_,calculateTitleH:B,pagerCount:f,updatePageSize:V}},Z=(c="id",r)=>{const l=e.ref(!1),d=e.ref([]),C=e.computed(()=>{let n=[];return d.value.forEach(h=>n.push(h[c])),n});return{isSelected:l,selectedList:d,selectedListIds:C,selectionChange:n=>{n.length?l.value=!0:l.value=!1,d.value=n}}},v=e.defineComponent({__name:"Pagination",props:{className:{},styles:{},size:{},pagination:{},pageSize:{},pagerCount:{},handleSizeChange:{type:Function},handleCurrentChange:{type:Function}},setup(c){const r=c,l=e.computed(()=>r.pageSize>0?[r.pageSize,r.pageSize*2,r.pageSize*3,r.pageSize*4,r.pageSize*5]:[]);return(d,C)=>{const s=e.resolveComponent("el-pagination");return e.openBlock(),e.createBlock(s,{class:e.normalizeClass(d.className),style:e.normalizeStyle(d.styles),background:!0,"current-page":d.pagination.page,"page-size":d.pagination.size,"page-sizes":l.value,total:d.pagination.total,"pager-count":r.pagerCount||7,size:d.size,layout:`total, ${l.value.length>0?"sizes,":""} prev, pager, next, jumper`,onSizeChange:d.handleSizeChange,onCurrentChange:d.handleCurrentChange},null,8,["class","style","current-page","page-size","page-sizes","total","pager-count","size","layout","onSizeChange","onCurrentChange"])}}}),ee=(c="stroke-width: 4px; fill: rgba(0, 0, 0, 0)")=>`
|
|
2
2
|
<path class="path" d="
|
|
3
3
|
M 30 15
|
|
4
4
|
L 28 17
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
A 15 15, 0, 1, 1, 27.99 7.5
|
|
8
8
|
L 15 15
|
|
9
9
|
" style="${c}"/>
|
|
10
|
-
`,
|
|
10
|
+
`,te=((c,r)=>{const l=c.__vccOpts||c;for(const[d,C]of r)l[d]=C;return l})(e.defineComponent({__name:"index",props:{columns:{default:()=>[]},data:{},api:{},url:{},sumUrl:{},autoSearch:{type:Boolean,default:!0},requestError:{},dataCallback:{},title:{},pagination:{type:Boolean,default:!0},initParam:{default:{}},border:{type:Boolean,default:!1},toolButton:{type:[Array,Boolean]},rowKey:{default:"id"},searchCol:{},loading:{},size:{default:""},pageSize:{default:0},rowH:{default:0},extH:{default:0},sumText:{},sumTextFormat:{}},setup(c,{expose:r}){var a;const l=c,d=e.ref(),C=e.ref("id-"+X()),s=["selection","radio","index","expand"],n=e.ref(""),{selectionChange:h,selectedList:H,selectedListIds:x,isSelected:P}=Z(l.rowKey),{tableData:F,pagination:f,searchParam:_,searchInitParam:B,enumMap:T,getTableList:L,search:k,reset:M,flatColumnsFunc:U,handleSizeChange:E,handleCurrentChange:D,containerRef:q,calculateHeight:N,pagerCount:j}=Y(l.url,l.initParam,l.pagination,l.dataCallback,l.requestError,l),R=()=>d.value.clearSelection();e.onMounted(()=>{e.nextTick(()=>{l.autoSearch&&L(),l.data&&(f.value.total=l.data.length)})});const V=e.computed(()=>l.data?l.data.slice((f.value.page-1)*f.value.size,f.value.size*f.value.page):F.value),S=e.reactive(l.columns),O=e.computed(()=>U(S));return e.provide("enumMap",T),(a=e.computed(()=>{var t;return(t=O.value)==null?void 0:t.filter(o=>{var i,g;return((i=o.search)==null?void 0:i.el)||((g=o.search)==null?void 0:g.render)}).sort((o,i)=>o.search.order-i.search.order)}).value)==null||a.forEach((t,o)=>{var m,b,z;t.search.order=((m=t.search)==null?void 0:m.order)??o+2;const i=((b=t.search)==null?void 0:b.key)??Q(t.prop),g=(z=t.search)==null?void 0:z.defaultValue;g!=null&&(_.value[i]=g,B.value[i]=g)}),r({element:d,tableData:V,radio:n,enumMap:T,pagination:f,searchParam:_,searchInitParam:B,isSelected:P,selectedList:H,selectedListIds:x,getTableList:L,search:k,reset:M,handleSizeChange:E,handleCurrentChange:D,clearSelection:R}),(t,o)=>{const i=e.resolveComponent("el-radio"),g=e.resolveComponent("el-table-column"),m=e.resolveComponent("TableColumn"),b=e.resolveComponent("el-empty"),z=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{ref_key:"containerRef",ref:q},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(G.ElTable),{ref_key:"tableRef",ref:d,size:t.size,id:C.value,height:e.unref(N)||void 0,"cell-style":()=>({padding:0,height:t.rowH?t.rowH+"px":void 0}),"element-loading-text":"Loading...","element-loading-spinner":e.unref(ee)(),"element-loading-svg-view-box":"-10, -10, 50, 50",data:V.value,border:t.border,"row-key":t.rowKey,"table-layout":"auto",onSelectionChange:e.unref(h)},{append:e.withCtx(()=>[e.renderSlot(t.$slots,"append",{},void 0,!0)]),empty:e.withCtx(()=>[e.createVNode(b,null,{description:e.withCtx(()=>o[2]||(o[2]=[e.createTextVNode(e.toDisplayString("No Data"))])),_:1})]),default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},void 0,!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S,u=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[u.type&&s.includes(u.type)?(e.openBlock(),e.createBlock(g,e.mergeProps({key:0,ref_for:!0},u,{align:u.align??"center","reserve-selection":u.type=="selection"}),{default:e.withCtx(p=>[u.type=="expand"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[u.render?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.render),e.mergeProps({key:0,ref_for:!0},p),null,16)):e.renderSlot(t.$slots,u.type,e.mergeProps({key:1,ref_for:!0},p),void 0,!0)],64)):e.createCommentVNode("",!0),u.type=="radio"?(e.openBlock(),e.createBlock(i,{key:1,modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=w=>n.value=w),label:p.row[t.rowKey]},{default:e.withCtx(()=>o[1]||(o[1]=[e.createElementVNode("i",null,null,-1)])),_:2},1032,["modelValue","label"])):e.createCommentVNode("",!0)]),_:2},1040,["align","reserve-selection"])):(e.openBlock(),e.createBlock(m,{key:1,column:u},e.createSlots({_:2},[e.renderList(Object.keys(t.$slots),p=>({name:p,fn:e.withCtx(w=>[e.renderSlot(t.$slots,p,e.mergeProps({ref_for:!0},w),void 0,!0)])}))]),1032,["column"]))],64))),128))]),_:3},8,["size","id","height","cell-style","element-loading-spinner","data","border","row-key","onSelectionChange"])),[[z,t.loading]]),e.unref(f)?e.renderSlot(t.$slots,"pagination",{key:0},()=>[e.createVNode(v,{className:"basic-table-pagination",styles:"margin-top: 12px; margin-right: 20px; display: flex; justify-content: flex-end;",size:t.size,"page-size":t.pageSize,"pager-count":e.unref(j),pagination:e.unref(f),handleSizeChange:e.unref(E),handleCurrentChange:e.unref(D)},null,8,["size","page-size","pager-count","pagination","handleSizeChange","handleCurrentChange"])],!0):e.createCommentVNode("",!0)],512)}}}),[["__scopeId","data-v-4a4bf617"]]),ae={install:(c,r)=>{Reflect.ownKeys(c._context.provides).some(l=>String(l)==="Symbol(pinia)")||console.warn("Pinia is not provided. Please install and provide Pinia in your app."),J(r)},version:"__VERSION__"};y.ProTable=te,y.default=ae,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { default as ProTable } from './table/index.vue';
|
|
2
|
-
export { ProTable,
|
|
2
|
+
export { ProTable, };
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const __VERSION__ = "0.0.
|
|
1
|
+
export const __VERSION__ = "0.0.8'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-vue-manual",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/auto-vue-manual.umd.js",
|
|
6
6
|
"module": "./dist/auto-vue-manual.es.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@element-plus/icons-vue": "^2.3.1",
|
|
20
20
|
"@types/react": "^19.0.10",
|
|
21
|
-
"auto-vue-manual": "^0.0.
|
|
21
|
+
"auto-vue-manual": "^0.0.7",
|
|
22
22
|
"axios": "^1.7.9",
|
|
23
23
|
"element-plus": "^2.9.3",
|
|
24
24
|
"mitt": "^3.0.1",
|