geekin-devtoys 0.2.16 → 0.2.17
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/lib/GTable/index.js +1 -1
- package/lib/GTable/index.mjs +314 -108
- package/lib/GTable/style.css +1 -1
- package/lib/components/GCount/index.d.ts +4 -4
- package/package.json +1 -1
package/lib/GTable/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),h=require("../index-B1MYKy3L.js"),y=require("sortablejs"),S=require("../_plugin-vue_export-helper-BHFhmbuH.js");var k={name:"zh-cn",el:{breadcrumb:{label:"面包屑"},colorpicker:{confirm:"确定",clear:"清空",defaultLabel:"颜色选择器",description:"当前颜色 {color},按 Enter 键选择新颜色",alphaLabel:"选择透明度的值",alphaDescription:"透明度 {alpha}, 当前颜色 {color}",hueLabel:"选择色相值",hueDescription:"色相 {hue}, 当前颜色 {color}",svLabel:"选择饱和度与明度的值",svDescription:"饱和度 {saturation}, 明度 {brightness}, 当前颜色 {color}",predefineDescription:"选择 {value} 作为颜色"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",dateTablePrompt:"使用方向键与 Enter 键可选择日期",monthTablePrompt:"使用方向键与 Enter 键可选择月份",yearTablePrompt:"使用方向键与 Enter 键可选择年份",selectedDate:"已选日期",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},weeksFull:{sun:"星期日",mon:"星期一",tue:"星期二",wed:"星期三",thu:"星期四",fri:"星期五",sat:"星期六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},inputNumber:{decrease:"减少数值",increase:"增加数值"},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},mention:{loading:"加载中"},dropdown:{toggleDropdown:"切换下拉选项"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页",page:"页",prev:"上一页",next:"下一页",currentPage:"第 {pager} 页",prevPages:"向前 {pager} 页",nextPages:"向后 {pager} 页",deprecationWarning:"你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"},dialog:{close:"关闭此对话框"},drawer:{close:"关闭此对话框"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!",close:"关闭此对话框"},upload:{deleteTip:"按 Delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},slider:{defaultLabel:"滑块介于 {min} 至 {max}",defaultRangeStartLabel:"选择起始值",defaultRangeEndLabel:"选择结束值"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计",selectAllLabel:"选择所有行",selectRowLabel:"选择当前行",expandRowLabel:"展开当前行",collapseRowLabel:"收起当前行",sortLabel:"按 {column} 排序",filterLabel:"按 {column} 过滤"},tag:{close:"关闭此标签"},tour:{next:"下一步",previous:"上一步",finish:"结束导览",close:"关闭此对话框"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"},carousel:{leftArrow:"上一张幻灯片",rightArrow:"下一张幻灯片",indicator:"幻灯片切换至索引 {index}"}}};const x={class:"g-table"},z={key:0,class:"g-table-action"},T={key:1},P={class:"g-dropdown-link"},N=u.defineComponent({name:"GTable",inheritAttrs:!1,__name:"index",props:{data:{default:()=>[]},pagination:{type:Boolean,default:!1},operationLabel:{default:"操作"},operaWidth:{default:160},dragSort:{type:Boolean,default:!1},dragSortProps:{default:()=>[]},currentPage:{default:1},pageSize:{default:10},total:{default:0},pageSizes:{default:()=>[10,20,50,100]},layout:{default:"total, sizes, prev, pager, next"}},emits:["update:currentPage","update:pageSize","sorted:data"],setup(g,{emit:B}){const s=g,c=B,b=e=>{c("update:pageSize",e)},w=e=>{c("update:currentPage",e)},v=u.useSlots(),f=e=>!!v[e],d=u.useAttrs(),A=e=>{const t=!!d["page-size"],n=!!d["current-page"];if(t&&n){const a=Number(d["page-size"]||10),o=Number(d["current-page"]||1);return e+1+a*(o-1)}return e},E=u.ref(null),p=u.shallowRef(null),_=(e=20)=>new Promise(t=>{let n=0;const a=()=>{if(!E.value){t(null);return}const o=E.value.$el.querySelectorAll("tbody");for(let l=0;l<o.length;l++)if(o[l].querySelectorAll("tr").length>0){t(o[l]);return}if(++n>=e){t(null);return}setTimeout(a,500)};a()}),C=async()=>{if(E.value)try{const e=await _();if(!e){console.error("未找到包含数据行的 tbody 元素");return}p.value?.destroy?.(),p.value=new y(e,{draggable:"tr",handle:".g-drag-icon",animation:200,ghostClass:"g-sortable-ghost",forceFallback:!0,onStart:function(t){t.item.classList.add("dragging")},onEnd:async function(t){t.item.classList.remove("dragging");const{oldIndex:n,newIndex:a}=t;if(n===void 0||a===void 0){console.error("无效的索引值");return}const o=[...s.data],[l]=o.splice(n,1);if(o.splice(a,0,l),s.dragSortProps.length===0){c("sorted:data",o);return}if(s.dragSortProps.length>0){const F=o.map(D=>{const m={};return s.dragSortProps.forEach(r=>{m[r]=D[r]}),m});c("sorted:data",F)}}})}catch(e){console.error("初始化拖拽排序失败:",e)}};return u.onMounted(()=>{s.dragSort&&C()}),u.watch(()=>s.data,()=>{s.dragSort&&C()}),u.onBeforeUnmount(()=>{p.value?.destroy?.(),p.value=null}),(e,t)=>{const n=u.resolveComponent("el-icon"),a=u.resolveComponent("el-table-column"),o=u.resolveComponent("el-dropdown-menu"),l=u.resolveComponent("el-dropdown"),F=u.resolveComponent("el-table"),D=u.resolveComponent("el-pagination"),m=u.resolveComponent("el-config-provider");return u.openBlock(),u.createElementBlock("div",x,[e.$slots.action?(u.openBlock(),u.createElementBlock("div",z,[u.renderSlot(e.$slots,"action",{},void 0,!0)])):u.createCommentVNode("",!0),u.createVNode(F,u.mergeProps({data:e.data||[]},e.$attrs,{stripe:"",ref_key:"tableRef",ref:E,class:"g-table-main"}),{empty:u.withCtx(()=>[e.$slots.empty?u.renderSlot(e.$slots,"empty",{key:0},void 0,!0):(u.openBlock(),u.createElementBlock("span",T,"暂无数据"))]),default:u.withCtx(()=>[e.dragSort?(u.openBlock(),u.createBlock(a,{key:0,label:"序号",width:"65"},{default:u.withCtx(r=>[u.createElementVNode("div",null,[u.createTextVNode(u.toDisplayString(A(r.$index))+" ",1),u.createVNode(n,{class:"g-drag-icon"},{default:u.withCtx(()=>[u.createVNode(u.unref(h.operation_default))]),_:1})])]),_:1})):u.createCommentVNode("",!0),u.renderSlot(e.$slots,"default",{},void 0,!0),f("operations")?(u.openBlock(),u.createBlock(a,{key:1,fixed:"right",label:e.operationLabel||"操作",width:e.operaWidth},{default:u.withCtx(r=>[u.renderSlot(e.$slots,"operations",{row:r.row,index:r.$index},void 0,!0),f("more")?(u.openBlock(),u.createBlock(l,{key:0,size:"small",style:{"vertical-align":"baseline"}},{dropdown:u.withCtx(()=>[u.createVNode(o,null,{default:u.withCtx(()=>[u.renderSlot(e.$slots,"more",{row:r.row,index:r.$index},void 0,!0)]),_:2},1024)]),default:u.withCtx(()=>[u.createElementVNode("span",P,[t[0]||(t[0]=u.createTextVNode(" 更多 ")),u.createVNode(n,null,{default:u.withCtx(()=>[u.createVNode(u.unref(h.arrow_down_default))]),_:1})])]),_:2},1024)):u.createCommentVNode("",!0)]),_:3},8,["label","width"])):u.createCommentVNode("",!0)]),_:3},16,["data"]),e.pagination?(u.openBlock(),u.createBlock(m,{key:1,locale:u.unref(k)},{default:u.withCtx(()=>[u.createVNode(D,{class:"g-pagination-contianer",size:"small","current-page":e.currentPage,"page-size":e.pageSize,total:e.total,"page-sizes":e.pageSizes,layout:e.layout,onSizeChange:b,onCurrentChange:w},null,8,["current-page","page-size","total","page-sizes","layout"])]),_:1},8,["locale"])):u.createCommentVNode("",!0)])}}}),i=S._export_sfc(N,[["__scopeId","data-v-2f3eaf74"]]);i.install=g=>{g.component(i.name,i)};exports.GTable=i;exports.default=i;
|
package/lib/GTable/index.mjs
CHANGED
|
@@ -1,8 +1,205 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { o as
|
|
3
|
-
import
|
|
4
|
-
import { _ as
|
|
5
|
-
|
|
1
|
+
import { defineComponent as R, useSlots as N, useAttrs as I, ref as M, shallowRef as V, onMounted as W, watch as j, onBeforeUnmount as q, resolveComponent as i, createElementBlock as A, openBlock as E, createCommentVNode as c, createVNode as d, createBlock as h, renderSlot as p, mergeProps as G, withCtx as o, createElementVNode as S, createTextVNode as z, toDisplayString as Y, unref as w } from "vue";
|
|
2
|
+
import { o as H, d as U } from "../index-Dxw2pU4z.mjs";
|
|
3
|
+
import J from "sortablejs";
|
|
4
|
+
import { _ as K } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
5
|
+
var O = {
|
|
6
|
+
name: "zh-cn",
|
|
7
|
+
el: {
|
|
8
|
+
breadcrumb: {
|
|
9
|
+
label: "面包屑"
|
|
10
|
+
},
|
|
11
|
+
colorpicker: {
|
|
12
|
+
confirm: "确定",
|
|
13
|
+
clear: "清空",
|
|
14
|
+
defaultLabel: "颜色选择器",
|
|
15
|
+
description: "当前颜色 {color},按 Enter 键选择新颜色",
|
|
16
|
+
alphaLabel: "选择透明度的值",
|
|
17
|
+
alphaDescription: "透明度 {alpha}, 当前颜色 {color}",
|
|
18
|
+
hueLabel: "选择色相值",
|
|
19
|
+
hueDescription: "色相 {hue}, 当前颜色 {color}",
|
|
20
|
+
svLabel: "选择饱和度与明度的值",
|
|
21
|
+
svDescription: "饱和度 {saturation}, 明度 {brightness}, 当前颜色 {color}",
|
|
22
|
+
predefineDescription: "选择 {value} 作为颜色"
|
|
23
|
+
},
|
|
24
|
+
datepicker: {
|
|
25
|
+
now: "此刻",
|
|
26
|
+
today: "今天",
|
|
27
|
+
cancel: "取消",
|
|
28
|
+
clear: "清空",
|
|
29
|
+
confirm: "确定",
|
|
30
|
+
dateTablePrompt: "使用方向键与 Enter 键可选择日期",
|
|
31
|
+
monthTablePrompt: "使用方向键与 Enter 键可选择月份",
|
|
32
|
+
yearTablePrompt: "使用方向键与 Enter 键可选择年份",
|
|
33
|
+
selectedDate: "已选日期",
|
|
34
|
+
selectDate: "选择日期",
|
|
35
|
+
selectTime: "选择时间",
|
|
36
|
+
startDate: "开始日期",
|
|
37
|
+
startTime: "开始时间",
|
|
38
|
+
endDate: "结束日期",
|
|
39
|
+
endTime: "结束时间",
|
|
40
|
+
prevYear: "前一年",
|
|
41
|
+
nextYear: "后一年",
|
|
42
|
+
prevMonth: "上个月",
|
|
43
|
+
nextMonth: "下个月",
|
|
44
|
+
year: "年",
|
|
45
|
+
month1: "1 月",
|
|
46
|
+
month2: "2 月",
|
|
47
|
+
month3: "3 月",
|
|
48
|
+
month4: "4 月",
|
|
49
|
+
month5: "5 月",
|
|
50
|
+
month6: "6 月",
|
|
51
|
+
month7: "7 月",
|
|
52
|
+
month8: "8 月",
|
|
53
|
+
month9: "9 月",
|
|
54
|
+
month10: "10 月",
|
|
55
|
+
month11: "11 月",
|
|
56
|
+
month12: "12 月",
|
|
57
|
+
weeks: {
|
|
58
|
+
sun: "日",
|
|
59
|
+
mon: "一",
|
|
60
|
+
tue: "二",
|
|
61
|
+
wed: "三",
|
|
62
|
+
thu: "四",
|
|
63
|
+
fri: "五",
|
|
64
|
+
sat: "六"
|
|
65
|
+
},
|
|
66
|
+
weeksFull: {
|
|
67
|
+
sun: "星期日",
|
|
68
|
+
mon: "星期一",
|
|
69
|
+
tue: "星期二",
|
|
70
|
+
wed: "星期三",
|
|
71
|
+
thu: "星期四",
|
|
72
|
+
fri: "星期五",
|
|
73
|
+
sat: "星期六"
|
|
74
|
+
},
|
|
75
|
+
months: {
|
|
76
|
+
jan: "一月",
|
|
77
|
+
feb: "二月",
|
|
78
|
+
mar: "三月",
|
|
79
|
+
apr: "四月",
|
|
80
|
+
may: "五月",
|
|
81
|
+
jun: "六月",
|
|
82
|
+
jul: "七月",
|
|
83
|
+
aug: "八月",
|
|
84
|
+
sep: "九月",
|
|
85
|
+
oct: "十月",
|
|
86
|
+
nov: "十一月",
|
|
87
|
+
dec: "十二月"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
inputNumber: {
|
|
91
|
+
decrease: "减少数值",
|
|
92
|
+
increase: "增加数值"
|
|
93
|
+
},
|
|
94
|
+
select: {
|
|
95
|
+
loading: "加载中",
|
|
96
|
+
noMatch: "无匹配数据",
|
|
97
|
+
noData: "无数据",
|
|
98
|
+
placeholder: "请选择"
|
|
99
|
+
},
|
|
100
|
+
mention: {
|
|
101
|
+
loading: "加载中"
|
|
102
|
+
},
|
|
103
|
+
dropdown: {
|
|
104
|
+
toggleDropdown: "切换下拉选项"
|
|
105
|
+
},
|
|
106
|
+
cascader: {
|
|
107
|
+
noMatch: "无匹配数据",
|
|
108
|
+
loading: "加载中",
|
|
109
|
+
placeholder: "请选择",
|
|
110
|
+
noData: "暂无数据"
|
|
111
|
+
},
|
|
112
|
+
pagination: {
|
|
113
|
+
goto: "前往",
|
|
114
|
+
pagesize: "条/页",
|
|
115
|
+
total: "共 {total} 条",
|
|
116
|
+
pageClassifier: "页",
|
|
117
|
+
page: "页",
|
|
118
|
+
prev: "上一页",
|
|
119
|
+
next: "下一页",
|
|
120
|
+
currentPage: "第 {pager} 页",
|
|
121
|
+
prevPages: "向前 {pager} 页",
|
|
122
|
+
nextPages: "向后 {pager} 页",
|
|
123
|
+
deprecationWarning: "你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"
|
|
124
|
+
},
|
|
125
|
+
dialog: {
|
|
126
|
+
close: "关闭此对话框"
|
|
127
|
+
},
|
|
128
|
+
drawer: {
|
|
129
|
+
close: "关闭此对话框"
|
|
130
|
+
},
|
|
131
|
+
messagebox: {
|
|
132
|
+
title: "提示",
|
|
133
|
+
confirm: "确定",
|
|
134
|
+
cancel: "取消",
|
|
135
|
+
error: "输入的数据不合法!",
|
|
136
|
+
close: "关闭此对话框"
|
|
137
|
+
},
|
|
138
|
+
upload: {
|
|
139
|
+
deleteTip: "按 Delete 键可删除",
|
|
140
|
+
delete: "删除",
|
|
141
|
+
preview: "查看图片",
|
|
142
|
+
continue: "继续上传"
|
|
143
|
+
},
|
|
144
|
+
slider: {
|
|
145
|
+
defaultLabel: "滑块介于 {min} 至 {max}",
|
|
146
|
+
defaultRangeStartLabel: "选择起始值",
|
|
147
|
+
defaultRangeEndLabel: "选择结束值"
|
|
148
|
+
},
|
|
149
|
+
table: {
|
|
150
|
+
emptyText: "暂无数据",
|
|
151
|
+
confirmFilter: "筛选",
|
|
152
|
+
resetFilter: "重置",
|
|
153
|
+
clearFilter: "全部",
|
|
154
|
+
sumText: "合计",
|
|
155
|
+
selectAllLabel: "选择所有行",
|
|
156
|
+
selectRowLabel: "选择当前行",
|
|
157
|
+
expandRowLabel: "展开当前行",
|
|
158
|
+
collapseRowLabel: "收起当前行",
|
|
159
|
+
sortLabel: "按 {column} 排序",
|
|
160
|
+
filterLabel: "按 {column} 过滤"
|
|
161
|
+
},
|
|
162
|
+
tag: {
|
|
163
|
+
close: "关闭此标签"
|
|
164
|
+
},
|
|
165
|
+
tour: {
|
|
166
|
+
next: "下一步",
|
|
167
|
+
previous: "上一步",
|
|
168
|
+
finish: "结束导览",
|
|
169
|
+
close: "关闭此对话框"
|
|
170
|
+
},
|
|
171
|
+
tree: {
|
|
172
|
+
emptyText: "暂无数据"
|
|
173
|
+
},
|
|
174
|
+
transfer: {
|
|
175
|
+
noMatch: "无匹配数据",
|
|
176
|
+
noData: "无数据",
|
|
177
|
+
titles: ["列表 1", "列表 2"],
|
|
178
|
+
filterPlaceholder: "请输入搜索内容",
|
|
179
|
+
noCheckedFormat: "共 {total} 项",
|
|
180
|
+
hasCheckedFormat: "已选 {checked}/{total} 项"
|
|
181
|
+
},
|
|
182
|
+
image: {
|
|
183
|
+
error: "加载失败"
|
|
184
|
+
},
|
|
185
|
+
pageHeader: {
|
|
186
|
+
title: "返回"
|
|
187
|
+
},
|
|
188
|
+
popconfirm: {
|
|
189
|
+
confirmButtonText: "确定",
|
|
190
|
+
cancelButtonText: "取消"
|
|
191
|
+
},
|
|
192
|
+
carousel: {
|
|
193
|
+
leftArrow: "上一张幻灯片",
|
|
194
|
+
rightArrow: "下一张幻灯片",
|
|
195
|
+
indicator: "幻灯片切换至索引 {index}"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
const Q = { class: "g-table" }, X = {
|
|
200
|
+
key: 0,
|
|
201
|
+
class: "g-table-action"
|
|
202
|
+
}, Z = { key: 1 }, uu = { class: "g-dropdown-link" }, eu = /* @__PURE__ */ R({
|
|
6
203
|
name: "GTable",
|
|
7
204
|
inheritAttrs: !1,
|
|
8
205
|
__name: "index",
|
|
@@ -10,7 +207,7 @@ const Y = { class: "g-table" }, Z = { key: 1 }, j = { class: "g-dropdown-link" }
|
|
|
10
207
|
data: { default: () => [] },
|
|
11
208
|
pagination: { type: Boolean, default: !1 },
|
|
12
209
|
operationLabel: { default: "操作" },
|
|
13
|
-
operaWidth: { default:
|
|
210
|
+
operaWidth: { default: 160 },
|
|
14
211
|
dragSort: { type: Boolean, default: !1 },
|
|
15
212
|
dragSortProps: { default: () => [] },
|
|
16
213
|
currentPage: { default: 1 },
|
|
@@ -20,47 +217,47 @@ const Y = { class: "g-table" }, Z = { key: 1 }, j = { class: "g-dropdown-link" }
|
|
|
20
217
|
layout: { default: "total, sizes, prev, pager, next" }
|
|
21
218
|
},
|
|
22
219
|
emits: ["update:currentPage", "update:pageSize", "sorted:data"],
|
|
23
|
-
setup(
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
const a = Number(
|
|
32
|
-
return
|
|
220
|
+
setup(B, { emit: k }) {
|
|
221
|
+
const s = B, F = k, P = (u) => {
|
|
222
|
+
F("update:pageSize", u);
|
|
223
|
+
}, T = (u) => {
|
|
224
|
+
F("update:currentPage", u);
|
|
225
|
+
}, L = N(), _ = (u) => !!L[u], g = I(), $ = (u) => {
|
|
226
|
+
const e = !!g["page-size"], n = !!g["current-page"];
|
|
227
|
+
if (e && n) {
|
|
228
|
+
const a = Number(g["page-size"] || 10), t = Number(g["current-page"] || 1);
|
|
229
|
+
return u + 1 + a * (t - 1);
|
|
33
230
|
}
|
|
34
|
-
return
|
|
35
|
-
}, m =
|
|
231
|
+
return u;
|
|
232
|
+
}, m = M(null), D = V(null), x = (u = 20) => new Promise((e) => {
|
|
36
233
|
let n = 0;
|
|
37
234
|
const a = () => {
|
|
38
235
|
if (!m.value) {
|
|
39
|
-
|
|
236
|
+
e(null);
|
|
40
237
|
return;
|
|
41
238
|
}
|
|
42
|
-
const
|
|
43
|
-
for (let
|
|
44
|
-
if (
|
|
45
|
-
t
|
|
239
|
+
const t = m.value.$el.querySelectorAll("tbody");
|
|
240
|
+
for (let l = 0; l < t.length; l++)
|
|
241
|
+
if (t[l].querySelectorAll("tr").length > 0) {
|
|
242
|
+
e(t[l]);
|
|
46
243
|
return;
|
|
47
244
|
}
|
|
48
|
-
if (++n >=
|
|
49
|
-
|
|
245
|
+
if (++n >= u) {
|
|
246
|
+
e(null);
|
|
50
247
|
return;
|
|
51
248
|
}
|
|
52
249
|
setTimeout(a, 500);
|
|
53
250
|
};
|
|
54
251
|
a();
|
|
55
|
-
}),
|
|
252
|
+
}), v = async () => {
|
|
56
253
|
if (m.value)
|
|
57
254
|
try {
|
|
58
|
-
const
|
|
59
|
-
if (!
|
|
255
|
+
const u = await x();
|
|
256
|
+
if (!u) {
|
|
60
257
|
console.error("未找到包含数据行的 tbody 元素");
|
|
61
258
|
return;
|
|
62
259
|
}
|
|
63
|
-
|
|
260
|
+
D.value?.destroy?.(), D.value = new J(u, {
|
|
64
261
|
// 拖拽的元素选择器
|
|
65
262
|
draggable: "tr",
|
|
66
263
|
// 拖拽的触发元素选择器
|
|
@@ -71,98 +268,99 @@ const Y = { class: "g-table" }, Z = { key: 1 }, j = { class: "g-dropdown-link" }
|
|
|
71
268
|
ghostClass: "g-sortable-ghost",
|
|
72
269
|
// 禁用 Sortable 的默认拖拽反馈
|
|
73
270
|
forceFallback: !0,
|
|
74
|
-
onStart: function(
|
|
75
|
-
|
|
271
|
+
onStart: function(e) {
|
|
272
|
+
e.item.classList.add("dragging");
|
|
76
273
|
},
|
|
77
|
-
onEnd: async function(
|
|
78
|
-
|
|
79
|
-
const { oldIndex: n, newIndex: a } =
|
|
274
|
+
onEnd: async function(e) {
|
|
275
|
+
e.item.classList.remove("dragging");
|
|
276
|
+
const { oldIndex: n, newIndex: a } = e;
|
|
80
277
|
if (n === void 0 || a === void 0) {
|
|
81
278
|
console.error("无效的索引值");
|
|
82
279
|
return;
|
|
83
280
|
}
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
|
|
281
|
+
const t = [...s.data], [l] = t.splice(n, 1);
|
|
282
|
+
if (t.splice(a, 0, l), s.dragSortProps.length === 0) {
|
|
283
|
+
F("sorted:data", t);
|
|
87
284
|
return;
|
|
88
285
|
}
|
|
89
|
-
if (
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
return
|
|
93
|
-
r
|
|
94
|
-
}),
|
|
286
|
+
if (s.dragSortProps.length > 0) {
|
|
287
|
+
const C = t.map((b) => {
|
|
288
|
+
const f = {};
|
|
289
|
+
return s.dragSortProps.forEach((r) => {
|
|
290
|
+
f[r] = b[r];
|
|
291
|
+
}), f;
|
|
95
292
|
});
|
|
96
|
-
|
|
293
|
+
F("sorted:data", C);
|
|
97
294
|
}
|
|
98
295
|
}
|
|
99
296
|
});
|
|
100
|
-
} catch (
|
|
101
|
-
console.error("初始化拖拽排序失败:",
|
|
297
|
+
} catch (u) {
|
|
298
|
+
console.error("初始化拖拽排序失败:", u);
|
|
102
299
|
}
|
|
103
300
|
};
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
}),
|
|
107
|
-
|
|
108
|
-
}),
|
|
109
|
-
|
|
110
|
-
}), (
|
|
111
|
-
const n = i("el-icon"), a = i("el-table-column"),
|
|
112
|
-
return
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
]),
|
|
116
|
-
|
|
117
|
-
data:
|
|
118
|
-
},
|
|
301
|
+
return W(() => {
|
|
302
|
+
s.dragSort && v();
|
|
303
|
+
}), j(() => s.data, () => {
|
|
304
|
+
s.dragSort && v();
|
|
305
|
+
}), q(() => {
|
|
306
|
+
D.value?.destroy?.(), D.value = null;
|
|
307
|
+
}), (u, e) => {
|
|
308
|
+
const n = i("el-icon"), a = i("el-table-column"), t = i("el-dropdown-menu"), l = i("el-dropdown"), C = i("el-table"), b = i("el-pagination"), f = i("el-config-provider");
|
|
309
|
+
return E(), A("div", Q, [
|
|
310
|
+
u.$slots.action ? (E(), A("div", X, [
|
|
311
|
+
p(u.$slots, "action", {}, void 0, !0)
|
|
312
|
+
])) : c("", !0),
|
|
313
|
+
d(C, G({
|
|
314
|
+
data: u.data || []
|
|
315
|
+
}, u.$attrs, {
|
|
119
316
|
stripe: "",
|
|
120
317
|
ref_key: "tableRef",
|
|
121
|
-
ref: m
|
|
318
|
+
ref: m,
|
|
319
|
+
class: "g-table-main"
|
|
122
320
|
}), {
|
|
123
|
-
empty:
|
|
124
|
-
|
|
321
|
+
empty: o(() => [
|
|
322
|
+
u.$slots.empty ? p(u.$slots, "empty", { key: 0 }, void 0, !0) : (E(), A("span", Z, "暂无数据"))
|
|
125
323
|
]),
|
|
126
|
-
default:
|
|
127
|
-
|
|
324
|
+
default: o(() => [
|
|
325
|
+
u.dragSort ? (E(), h(a, {
|
|
128
326
|
key: 0,
|
|
129
327
|
label: "序号",
|
|
130
328
|
width: "65"
|
|
131
329
|
}, {
|
|
132
|
-
default:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
default:
|
|
137
|
-
|
|
330
|
+
default: o((r) => [
|
|
331
|
+
S("div", null, [
|
|
332
|
+
z(Y($(r.$index)) + " ", 1),
|
|
333
|
+
d(n, { class: "g-drag-icon" }, {
|
|
334
|
+
default: o(() => [
|
|
335
|
+
d(w(H))
|
|
138
336
|
]),
|
|
139
337
|
_: 1
|
|
140
338
|
})
|
|
141
339
|
])
|
|
142
340
|
]),
|
|
143
341
|
_: 1
|
|
144
|
-
})) :
|
|
145
|
-
|
|
146
|
-
|
|
342
|
+
})) : c("", !0),
|
|
343
|
+
p(u.$slots, "default", {}, void 0, !0),
|
|
344
|
+
_("operations") ? (E(), h(a, {
|
|
147
345
|
key: 1,
|
|
148
346
|
fixed: "right",
|
|
149
|
-
label:
|
|
150
|
-
width:
|
|
347
|
+
label: u.operationLabel || "操作",
|
|
348
|
+
width: u.operaWidth
|
|
151
349
|
}, {
|
|
152
|
-
default:
|
|
153
|
-
|
|
350
|
+
default: o((r) => [
|
|
351
|
+
p(u.$slots, "operations", {
|
|
154
352
|
row: r.row,
|
|
155
353
|
index: r.$index
|
|
156
354
|
}, void 0, !0),
|
|
157
|
-
|
|
355
|
+
_("more") ? (E(), h(l, {
|
|
158
356
|
key: 0,
|
|
159
357
|
size: "small",
|
|
160
358
|
style: { "vertical-align": "baseline" }
|
|
161
359
|
}, {
|
|
162
|
-
dropdown:
|
|
163
|
-
|
|
164
|
-
default:
|
|
165
|
-
|
|
360
|
+
dropdown: o(() => [
|
|
361
|
+
d(t, null, {
|
|
362
|
+
default: o(() => [
|
|
363
|
+
p(u.$slots, "more", {
|
|
166
364
|
row: r.row,
|
|
167
365
|
index: r.$index
|
|
168
366
|
}, void 0, !0)
|
|
@@ -170,44 +368,52 @@ const Y = { class: "g-table" }, Z = { key: 1 }, j = { class: "g-dropdown-link" }
|
|
|
170
368
|
_: 2
|
|
171
369
|
}, 1024)
|
|
172
370
|
]),
|
|
173
|
-
default:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
default:
|
|
178
|
-
|
|
371
|
+
default: o(() => [
|
|
372
|
+
S("span", uu, [
|
|
373
|
+
e[0] || (e[0] = z(" 更多 ")),
|
|
374
|
+
d(n, null, {
|
|
375
|
+
default: o(() => [
|
|
376
|
+
d(w(U))
|
|
179
377
|
]),
|
|
180
378
|
_: 1
|
|
181
379
|
})
|
|
182
380
|
])
|
|
183
381
|
]),
|
|
184
382
|
_: 2
|
|
185
|
-
}, 1024)) :
|
|
383
|
+
}, 1024)) : c("", !0)
|
|
186
384
|
]),
|
|
187
385
|
_: 3
|
|
188
|
-
}, 8, ["label", "width"])) :
|
|
386
|
+
}, 8, ["label", "width"])) : c("", !0)
|
|
189
387
|
]),
|
|
190
388
|
_: 3
|
|
191
389
|
}, 16, ["data"]),
|
|
192
|
-
|
|
193
|
-
key:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
390
|
+
u.pagination ? (E(), h(f, {
|
|
391
|
+
key: 1,
|
|
392
|
+
locale: w(O)
|
|
393
|
+
}, {
|
|
394
|
+
default: o(() => [
|
|
395
|
+
d(b, {
|
|
396
|
+
class: "g-pagination-contianer",
|
|
397
|
+
size: "small",
|
|
398
|
+
"current-page": u.currentPage,
|
|
399
|
+
"page-size": u.pageSize,
|
|
400
|
+
total: u.total,
|
|
401
|
+
"page-sizes": u.pageSizes,
|
|
402
|
+
layout: u.layout,
|
|
403
|
+
onSizeChange: P,
|
|
404
|
+
onCurrentChange: T
|
|
405
|
+
}, null, 8, ["current-page", "page-size", "total", "page-sizes", "layout"])
|
|
406
|
+
]),
|
|
407
|
+
_: 1
|
|
408
|
+
}, 8, ["locale"])) : c("", !0)
|
|
203
409
|
]);
|
|
204
410
|
};
|
|
205
411
|
}
|
|
206
|
-
}),
|
|
207
|
-
|
|
208
|
-
|
|
412
|
+
}), y = /* @__PURE__ */ K(eu, [["__scopeId", "data-v-2f3eaf74"]]);
|
|
413
|
+
y.install = (B) => {
|
|
414
|
+
B.component(y.name, y);
|
|
209
415
|
};
|
|
210
416
|
export {
|
|
211
|
-
|
|
212
|
-
|
|
417
|
+
y as GTable,
|
|
418
|
+
y as default
|
|
213
419
|
};
|
package/lib/GTable/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.g-table[data-v-
|
|
1
|
+
@charset "UTF-8";.g-table[data-v-2f3eaf74]{width:100%;font-size:12px}.g-table .g-table-action[data-v-2f3eaf74]{margin-bottom:10px;display:flex;flex-wrap:wrap;align-items:center;gap:8px}.g-table .g-table-action[data-v-2f3eaf74] .el-button{border-radius:4px;font-size:12px;font-weight:500;padding:6px 12px;height:28px;transition:all .2s ease}.g-table .g-table-action[data-v-2f3eaf74] .el-button.el-button--primary{box-shadow:0 2px 6px rgba(var(--el-color-primary-rgb, 64, 158, 255),.2)}.g-table .g-table-action[data-v-2f3eaf74] .el-button.el-button--primary:hover{box-shadow:0 3px 10px rgba(var(--el-color-primary-rgb, 64, 158, 255),.3)}.g-table .g-table-action[data-v-2f3eaf74] .el-button:not(.el-button--primary):not(.el-button--text){background:#fff;border-color:#e2e8f0;color:#475569}.g-table .g-table-action[data-v-2f3eaf74] .el-button:not(.el-button--primary):not(.el-button--text):hover{background:var(--el-color-primary-light-9);border-color:var(--el-color-primary);color:var(--el-color-primary)}.g-table .g-table-action[data-v-2f3eaf74] .el-input .el-input__wrapper,.g-table .g-table-action[data-v-2f3eaf74] .el-input .el-select__wrapper,.g-table .g-table-action[data-v-2f3eaf74] .el-select .el-input__wrapper,.g-table .g-table-action[data-v-2f3eaf74] .el-select .el-select__wrapper{border-radius:4px;min-height:28px;box-shadow:0 0 0 1px #e2e8f0 inset;transition:all .2s ease}.g-table .g-table-action[data-v-2f3eaf74] .el-input .el-input__wrapper:hover,.g-table .g-table-action[data-v-2f3eaf74] .el-input .el-select__wrapper:hover,.g-table .g-table-action[data-v-2f3eaf74] .el-select .el-input__wrapper:hover,.g-table .g-table-action[data-v-2f3eaf74] .el-select .el-select__wrapper:hover{box-shadow:0 0 0 1px var(--el-color-primary) inset}.g-table .g-table-action[data-v-2f3eaf74] .el-input .el-input__wrapper.is-focus,.g-table .g-table-action[data-v-2f3eaf74] .el-input .el-input__wrapper.is-focused,.g-table .g-table-action[data-v-2f3eaf74] .el-input .el-select__wrapper.is-focus,.g-table .g-table-action[data-v-2f3eaf74] .el-input .el-select__wrapper.is-focused,.g-table .g-table-action[data-v-2f3eaf74] .el-select .el-input__wrapper.is-focus,.g-table .g-table-action[data-v-2f3eaf74] .el-select .el-input__wrapper.is-focused,.g-table .g-table-action[data-v-2f3eaf74] .el-select .el-select__wrapper.is-focus,.g-table .g-table-action[data-v-2f3eaf74] .el-select .el-select__wrapper.is-focused{box-shadow:0 0 0 1px var(--el-color-primary) inset!important}.g-table .g-table-action[data-v-2f3eaf74] .el-input .el-input__inner,.g-table .g-table-action[data-v-2f3eaf74] .el-select .el-input__inner{font-size:12px;height:26px}.g-table .g-table-main[data-v-2f3eaf74]{border-radius:6px;overflow:hidden;box-shadow:0 1px 2px #00000008,0 0 0 1px #0000000d}.g-table .g-table-main[data-v-2f3eaf74] .el-table__header-wrapper th.el-table__cell{background:linear-gradient(135deg,#f8fafc,#f1f5f9);color:#334155;font-weight:600;font-size:12px;height:38px;padding:6px 0;border-bottom:1px solid #e2e8f0;position:relative}.g-table .g-table-main[data-v-2f3eaf74] .el-table__header-wrapper th.el-table__cell .cell{line-height:1.4;padding:0 10px}.g-table .g-table-main[data-v-2f3eaf74] .el-table__header-wrapper th.el-table__cell:not(:last-child):after{content:"";position:absolute;right:0;top:50%;transform:translateY(-50%);width:1px;height:16px;background:#e2e8f0}.g-table .g-table-main[data-v-2f3eaf74] .el-table__header-wrapper th.el-table__cell.is-leaf:last-of-type:after{display:none}.g-table .g-table-main[data-v-2f3eaf74] .el-table__body-wrapper td.el-table__cell{font-size:12px;color:#475569;padding:6px 0;border-bottom:1px solid #f1f5f9}.g-table .g-table-main[data-v-2f3eaf74] .el-table__body-wrapper td.el-table__cell .cell{line-height:1.5;padding:0 10px}.g-table .g-table-main[data-v-2f3eaf74] .el-table__body-wrapper tr.el-table__row--striped td.el-table__cell{background:#fafbfc}.g-table .g-table-main[data-v-2f3eaf74] .el-table__body-wrapper tr.el-table__row:hover>td.el-table__cell{background:var(--el-color-primary-light-9)!important;transition:background .15s ease}.g-table .g-table-main[data-v-2f3eaf74] .el-table__empty-block{min-height:120px}.g-table .g-table-main[data-v-2f3eaf74] .el-table__empty-block .el-table__empty-text{color:#94a3b8;font-size:12px}.g-table .g-table-main[data-v-2f3eaf74] .el-table__inner-wrapper:before{display:none}.g-table .g-dropdown-link[data-v-2f3eaf74]{cursor:pointer;color:var(--el-color-primary);display:inline-flex;align-items:center;gap:2px;padding:2px 8px;font-size:12px;margin-left:8px;border-radius:4px;outline:none;border:1px solid transparent;background:transparent;transition:all .2s ease}.g-table .g-dropdown-link[data-v-2f3eaf74]:hover,.g-table .g-dropdown-link[aria-expanded=true][data-v-2f3eaf74]{color:var(--el-color-primary);background:var(--el-color-primary-light-9);border-color:var(--el-color-primary);box-shadow:0 2px 6px rgba(var(--el-color-primary-rgb, 64, 158, 255),.15);outline:none}.g-table .g-dropdown-link[data-v-2f3eaf74]:focus{outline:none}.g-table .g-dropdown-link .el-icon[data-v-2f3eaf74]{font-size:12px;transition:transform .25s ease}.g-table .g-dropdown-link:hover .el-icon[data-v-2f3eaf74],.g-table .g-dropdown-link[aria-expanded=true] .el-icon[data-v-2f3eaf74]{transform:rotate(180deg)}.g-table[data-v-2f3eaf74] .el-dropdown-menu__item{font-size:12px;padding:5px 14px;outline:none;border:none;transition:all .15s ease}.g-table[data-v-2f3eaf74] .el-dropdown-menu__item:hover{background:var(--el-color-primary-light-9);color:var(--el-color-primary);outline:none;border:none}.g-table .g-pagination-contianer[data-v-2f3eaf74]{padding:8px 12px;background:linear-gradient(135deg,#fff,#f8fafc);border-radius:6px;box-shadow:0 1px 2px #00000008,0 0 0 1px #0000000a;display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:6px;transition:box-shadow .25s ease}.g-table .g-pagination-contianer[data-v-2f3eaf74]:hover{box-shadow:0 2px 6px #0000000d,0 0 0 1px #0000000d}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__total{color:#64748b;font-weight:500;font-size:12px;margin-right:2px}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__sizes{margin:0 4px}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__sizes .el-select .el-select__wrapper{border-radius:4px;box-shadow:0 0 0 1px #e2e8f0 inset;transition:all .2s ease;min-height:24px;padding:0 8px;font-size:12px}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__sizes .el-select .el-select__wrapper:hover{box-shadow:0 0 0 1px var(--el-color-primary) inset}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__sizes .el-select .el-select__wrapper.is-focused{box-shadow:0 0 0 1px var(--el-color-primary) inset!important}.g-table .g-pagination-contianer[data-v-2f3eaf74] .btn-prev,.g-table .g-pagination-contianer[data-v-2f3eaf74] .btn-next{min-width:24px;height:24px;padding:0 4px;border-radius:4px;background:#fff;border:1px solid #e2e8f0;color:#475569;font-size:12px;transition:all .2s ease;margin:0 1px}.g-table .g-pagination-contianer[data-v-2f3eaf74] .btn-prev:hover:not(:disabled),.g-table .g-pagination-contianer[data-v-2f3eaf74] .btn-next:hover:not(:disabled){background:var(--el-color-primary);border-color:var(--el-color-primary);color:#fff;box-shadow:0 2px 6px rgba(var(--el-color-primary-rgb, 64, 158, 255),.25)}.g-table .g-pagination-contianer[data-v-2f3eaf74] .btn-prev:disabled,.g-table .g-pagination-contianer[data-v-2f3eaf74] .btn-next:disabled{background:#f1f5f9;color:#cbd5e1;cursor:not-allowed}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pager li{min-width:24px;height:24px;line-height:24px;padding:0 4px;border-radius:4px;background:#fff;border:1px solid #e2e8f0;color:#475569;font-weight:500;font-size:12px;margin:0 1px;transition:all .2s ease}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pager li:hover:not(.is-active){color:var(--el-color-primary);border-color:var(--el-color-primary)}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pager li.is-active{background:linear-gradient(135deg,var(--el-color-primary) 0%,var(--el-color-primary-light-3) 100%);border-color:var(--el-color-primary);color:#fff;box-shadow:0 2px 6px rgba(var(--el-color-primary-rgb, 64, 158, 255),.3)}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pager li.more{background:transparent;border:none;color:#94a3b8}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pager li.more:hover{color:var(--el-color-primary)}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__jump{color:#64748b;font-size:12px;margin-left:6px;height:24px;line-height:24px}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__jump .el-input .el-input__wrapper{border-radius:4px;box-shadow:0 0 0 1px #e2e8f0 inset;transition:all .2s ease;padding:0 6px}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__jump .el-input .el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-color-primary) inset}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__jump .el-input .el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-color-primary) inset!important}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__jump .el-input .el-input__inner{height:22px;font-size:12px}.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__classifier,.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__goto,.g-table .g-pagination-contianer[data-v-2f3eaf74] .el-pagination__editor{font-size:12px;color:#64748b}.g-table .g-drag-icon[data-v-2f3eaf74]{cursor:move;color:#cbd5e1;font-size:14px;margin-left:4px;transition:color .2s ease;vertical-align:middle}.g-table .g-drag-icon[data-v-2f3eaf74]:hover{color:var(--el-color-primary)}.g-table[data-v-2f3eaf74] .g-sortable-ghost{background:var(--el-color-primary-light-9)!important;opacity:.6}.g-table[data-v-2f3eaf74] .dragging{background:#fff!important;box-shadow:0 6px 20px #00000014}
|