ele-scroll-table-vue2 0.1.5

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.
@@ -0,0 +1,536 @@
1
+ function h(t, e, a, s, n, i, r, o) {
2
+ var l = typeof t == "function" ? t.options : t;
3
+ return e && (l.render = e, l.staticRenderFns = a, l._compiled = !0), i && (l._scopeId = "data-v-" + i), {
4
+ exports: t,
5
+ options: l
6
+ };
7
+ }
8
+ const w = {
9
+ name: "TableColumn",
10
+ props: {
11
+ item: {
12
+ type: Object,
13
+ default: () => ({})
14
+ },
15
+ align: {
16
+ type: String,
17
+ default: "center"
18
+ },
19
+ hideItems: {
20
+ type: [Array, Object],
21
+ default: () => []
22
+ }
23
+ },
24
+ methods: {
25
+ isHiddenItem(t) {
26
+ return Array.isArray(this.hideItems) ? this.hideItems.includes(t.prop) : !1;
27
+ }
28
+ }
29
+ };
30
+ var k = function() {
31
+ var e = this, a = e._self._c;
32
+ return e.item.merges ? a("el-table-column", e._b({ attrs: { align: e.align, border: "" }, scopedSlots: e._u([{ key: "header", fn: function(s) {
33
+ return [e._t(`${e.item.slotName}Header`, function() {
34
+ return [e._v(" " + e._s(e.item.label) + " ")];
35
+ }, { backData: s })];
36
+ } }], null, !0) }, "el-table-column", e.item, !1), e._l(e.item.merges, function(s, n) {
37
+ return !s.hide && !e.isHiddenItem(s) ? a("TableColumn", { key: n, attrs: { item: s, align: e.align, hideItems: e.hideItems }, scopedSlots: e._u([e._l(e.$scopedSlots, function(i, r) {
38
+ return { key: r, fn: function(o) {
39
+ return [e._t(r, null, null, o)];
40
+ } };
41
+ })], null, !0) }) : e._e();
42
+ }), 1) : a("el-table-column", e._b({ attrs: { align: e.align, border: "" }, scopedSlots: e._u([{ key: "header", fn: function(s) {
43
+ return [e._t(`${e.item.slotName}Header`, function() {
44
+ return [e._v(" " + e._s(e.item.label) + " ")];
45
+ }, { backData: s })];
46
+ } }, { key: "default", fn: function(s) {
47
+ return [e._t(e.item.slotName, function() {
48
+ return [e.item.prop ? a("span", [e._v(e._s(s.row[e.item.prop]))]) : e._e()];
49
+ }, { backData: s.row, currentItem: e.item })];
50
+ } }], null, !0) }, "el-table-column", e.item, !1));
51
+ }, T = [], I = /* @__PURE__ */ h(
52
+ w,
53
+ k,
54
+ T,
55
+ !1,
56
+ null,
57
+ null
58
+ );
59
+ const L = I.exports, $ = (t, e = {}) => {
60
+ const { onStart: a } = e;
61
+ let s = null;
62
+ const n = () => {
63
+ const o = t.$el || t;
64
+ if (!o) return null;
65
+ const l = o.querySelector(".el-table__body-wrapper .el-scrollbar__wrap") || o.querySelector(".el-table__body-wrapper");
66
+ if (!l) return null;
67
+ let u = !1, f = 0, m = 0;
68
+ const g = (c) => {
69
+ c.button === 1 && (c.preventDefault(), a && a(), u = !0, f = c.clientX, m = l.scrollLeft, o.style.cursor = "grabbing", document.body.style.userSelect = "none");
70
+ }, d = () => {
71
+ u && (u = !1, o.style.cursor = "", document.body.style.userSelect = "");
72
+ }, b = (c) => {
73
+ if (!u) return;
74
+ c.preventDefault();
75
+ const S = c.clientX - f;
76
+ l.scrollLeft = m - S;
77
+ }, y = () => {
78
+ d();
79
+ }, p = o.querySelector(".el-table__body-wrapper");
80
+ return p && p.addEventListener("mousedown", g), window.addEventListener("mousemove", b), window.addEventListener("mouseup", y), window.addEventListener("blur", d), window.addEventListener("mouseleave", d), () => {
81
+ p && p.removeEventListener("mousedown", g), window.removeEventListener("mousemove", b), window.removeEventListener("mouseup", y), window.removeEventListener("blur", d), window.removeEventListener("mouseleave", d);
82
+ };
83
+ };
84
+ return { start: () => {
85
+ s = n();
86
+ }, stop: () => {
87
+ s && s(), s = null;
88
+ } };
89
+ }, x = {
90
+ name: "BaseTable",
91
+ components: {
92
+ TableColumn: L
93
+ },
94
+ props: {
95
+ border: { type: Boolean, default: !0 },
96
+ dataList: { type: Array, default: () => [] },
97
+ tableItem: { type: Array, default: () => [] },
98
+ tableListener: { type: Object, default: () => ({}) },
99
+ showChoose: { type: Boolean, default: !1 },
100
+ showIndex: { type: Boolean, default: !1 },
101
+ pagination: { type: Boolean, default: !0 },
102
+ listCount: { type: Number, default: 0 },
103
+ paginationInfo: { type: Object, default: () => ({ pageNum: 1, pageSize: 50 }) },
104
+ elTableConfig: { type: Object, default: () => ({}) },
105
+ showExpand: { type: Boolean, default: !1 },
106
+ align: { type: String, default: "center" },
107
+ paginationLayout: { type: String, default: "total, sizes, prev, pager, next, jumper" },
108
+ hideItems: { type: [Array, Object], default: () => ({}) },
109
+ maxHeight: { type: [Number, String] },
110
+ selectionConfig: { type: Object, default: () => ({}) },
111
+ autoResize: { type: Boolean, default: !0 },
112
+ dragTipScope: { type: String, default: "global" },
113
+ dragTipStorageKey: { type: String },
114
+ headerButtons: { type: Array, default: () => ["columnDisplay", "comSearch"] },
115
+ columnDisplayThreshold: { type: Number, default: 12 },
116
+ enableDblclickCopy: { type: Boolean, default: !0 },
117
+ copyFeedback: { type: Boolean, default: !0 },
118
+ copyLocale: {
119
+ type: Object,
120
+ default: () => ({
121
+ success: "已复制",
122
+ failed: "复制失败",
123
+ empty: "无可复制内容"
124
+ })
125
+ },
126
+ persistenceColumn: { type: Boolean, default: !0 },
127
+ persistenceKey: { type: String, default: "" }
128
+ },
129
+ data() {
130
+ return {
131
+ expandAll: !1,
132
+ otherSlots: [],
133
+ columnChecked: [],
134
+ showPageSearch: !1,
135
+ columnDialogVisible: !1,
136
+ scrollTipVisible: !1,
137
+ dragTipSeen: !1,
138
+ dragScrollController: null,
139
+ isSmall: window.innerWidth < 768,
140
+ resizeListener: null
141
+ };
142
+ },
143
+ computed: {
144
+ showHeader() {
145
+ return !!this.$slots.handleLeft || !!this.$slots.handleRight || this.headerButtons && this.headerButtons.length > 0;
146
+ },
147
+ computedMaxHeight() {
148
+ if (this.maxHeight)
149
+ return this.maxHeight;
150
+ this.autoResize;
151
+ },
152
+ paginationLayoutComputed() {
153
+ return this.isSmall ? "total, prev, pager, next" : this.paginationLayout;
154
+ },
155
+ propsHiddenSet() {
156
+ return new Set(this.normalizeHiddenToArray(this.hideItems));
157
+ },
158
+ hideItemsComputed() {
159
+ const t = (this.tableItem || []).filter((n) => n && n.prop && !n.hide).map((n) => n.prop), e = new Set(this.columnChecked), a = t.filter((n) => !e.has(n)), s = this.normalizeHiddenToArray(this.hideItems);
160
+ return Array.from(/* @__PURE__ */ new Set([...s, ...a]));
161
+ },
162
+ hideItemsSet() {
163
+ return new Set(this.hideItemsComputed);
164
+ },
165
+ columnDisplayUseDialog() {
166
+ return (this.tableItem || []).filter((e) => e && e.prop && !e.hide).length > this.columnDisplayThreshold;
167
+ },
168
+ columnTransferData() {
169
+ return (this.tableItem || []).filter((t) => t && t.prop && !t.hide).map((t) => ({
170
+ key: t.prop,
171
+ label: t.label || t.prop,
172
+ disabled: this.isPropHiddenByProps(t.prop)
173
+ }));
174
+ },
175
+ columnStorageKey() {
176
+ return this.persistenceKey && this.persistenceKey.trim() || null;
177
+ },
178
+ storageKeyForDragTip() {
179
+ const t = this.dragTipStorageKey && this.dragTipStorageKey.trim();
180
+ return t || (this.dragTipScope === "instance" ? `baseTableDragTipSeen_v2_${this._uid}` : "baseTableDragTipSeen_v2");
181
+ }
182
+ },
183
+ watch: {
184
+ tableItem: {
185
+ handler() {
186
+ this.updateColumnChecked();
187
+ },
188
+ immediate: !0
189
+ },
190
+ hideItems: {
191
+ handler() {
192
+ this.updateColumnChecked();
193
+ }
194
+ },
195
+ columnChecked: {
196
+ handler(t) {
197
+ if (this.persistenceColumn && this.columnStorageKey)
198
+ try {
199
+ localStorage.setItem(this.columnStorageKey, JSON.stringify(t));
200
+ } catch (e) {
201
+ console.warn("EleScrollTable: Failed to save column settings", e);
202
+ }
203
+ },
204
+ deep: !0
205
+ }
206
+ },
207
+ mounted() {
208
+ this.handleResize(), this.resizeListener = () => this.handleResize(), window.addEventListener("resize", this.resizeListener), setTimeout(() => {
209
+ this.dragScrollController = $(this.$refs.elTableRef, {
210
+ onStart: this.dismissTip
211
+ }), this.dragScrollController && (this.dragScrollController.start(), this.checkDragTip());
212
+ }, 100);
213
+ },
214
+ beforeDestroy() {
215
+ this.resizeListener && window.removeEventListener("resize", this.resizeListener), this.dragScrollController && this.dragScrollController.stop();
216
+ },
217
+ methods: {
218
+ handleResize() {
219
+ this.isSmall = window.innerWidth < 768;
220
+ },
221
+ handleCurrentChange(t) {
222
+ this.$refs.elTableRef && this.$refs.elTableRef.bodyWrapper && (this.$refs.elTableRef.bodyWrapper.scrollTop = 0), this.$emit("update:paginationInfo", { ...this.paginationInfo, pageNum: t });
223
+ },
224
+ handleSizeChange(t) {
225
+ this.$refs.elTableRef && this.$refs.elTableRef.bodyWrapper && (this.$refs.elTableRef.bodyWrapper.scrollTop = 0), this.$emit("update:paginationInfo", { ...this.paginationInfo, pageSize: t });
226
+ },
227
+ sortChange(t) {
228
+ this.$refs.elTableRef && this.$refs.elTableRef.bodyWrapper && (this.$refs.elTableRef.bodyWrapper.scrollTop = 0), this.$emit("sortChange", t);
229
+ },
230
+ normalizeHiddenToArray(t) {
231
+ let e = t;
232
+ return Array.isArray(e) ? e.filter(Boolean) : e && typeof e == "object" ? Object.keys(e).filter((a) => e[a]) : [];
233
+ },
234
+ isPropHiddenByProps(t) {
235
+ return this.propsHiddenSet.has(t);
236
+ },
237
+ updateColumnChecked() {
238
+ const t = (this.tableItem || []).filter((s) => s && s.prop && !s.hide), e = t.filter((s) => !this.propsHiddenSet.has(s.prop)).map((s) => s.prop);
239
+ let a = null;
240
+ if (this.persistenceColumn && this.columnStorageKey)
241
+ try {
242
+ const s = localStorage.getItem(this.columnStorageKey);
243
+ s && (a = JSON.parse(s));
244
+ } catch (s) {
245
+ console.warn("EleScrollTable: Failed to read column settings", s);
246
+ }
247
+ if (a && Array.isArray(a)) {
248
+ const s = new Set(t.map((i) => i.prop)), n = a.filter((i) => s.has(i));
249
+ this.columnChecked = n;
250
+ } else
251
+ this.columnChecked = e;
252
+ },
253
+ triggerShowSearch() {
254
+ this.showPageSearch = !this.showPageSearch, this.$emit("toggleSearch", this.showPageSearch);
255
+ },
256
+ async copyText(t) {
257
+ if (!t) return !1;
258
+ try {
259
+ if (navigator && navigator.clipboard && navigator.clipboard.writeText)
260
+ return await navigator.clipboard.writeText(t), !0;
261
+ const e = document.createElement("textarea");
262
+ e.value = t, e.setAttribute("readonly", ""), e.style.position = "fixed", e.style.opacity = "0", document.body.appendChild(e), e.select();
263
+ const a = document.execCommand("copy");
264
+ return document.body.removeChild(e), a;
265
+ } catch {
266
+ return !1;
267
+ }
268
+ },
269
+ getCellCopyText(t, e, a) {
270
+ const s = e && e.property;
271
+ if (s) {
272
+ const i = t[s];
273
+ return i == null ? "" : String(i);
274
+ }
275
+ const n = a && a.target && a.target.closest && a.target.closest(".cell");
276
+ return n && n.innerText ? n.innerText.trim() : "";
277
+ },
278
+ async handleRowDblclick(t, e, a) {
279
+ if (!this.enableDblclickCopy) return;
280
+ const s = this.getCellCopyText(t, e, a);
281
+ if (!s) {
282
+ this.copyFeedback && this.$message.warning(this.copyLocale.empty);
283
+ return;
284
+ }
285
+ const n = await this.copyText(s);
286
+ this.copyFeedback && (n ? this.$message.success(this.copyLocale.success) : this.$message.error(this.copyLocale.failed));
287
+ },
288
+ checkDragTip() {
289
+ if (localStorage.getItem(this.storageKeyForDragTip) === "true") {
290
+ this.dragTipSeen = !0;
291
+ return;
292
+ }
293
+ this.checkHorizontalOverflow() && (this.scrollTipVisible = !0, setTimeout(() => {
294
+ this.scrollTipVisible && this.dismissTip();
295
+ }, 6e3));
296
+ },
297
+ checkHorizontalOverflow() {
298
+ const t = this.$refs.elTableRef ? this.$refs.elTableRef.$el : null;
299
+ if (!t) return !1;
300
+ const e = t.querySelector(".el-table__body-wrapper .el-scrollbar__wrap") || t.querySelector(".el-table__body-wrapper");
301
+ return e ? e.scrollWidth > e.clientWidth + 2 : !1;
302
+ },
303
+ dismissTip() {
304
+ this.scrollTipVisible && (this.scrollTipVisible = !1), this.dragTipSeen = !0, localStorage.setItem(this.storageKeyForDragTip, "true");
305
+ },
306
+ unFoldAll(t) {
307
+ }
308
+ }
309
+ };
310
+ var z = function() {
311
+ var e = this, a = e._self._c;
312
+ return a("div", { staticClass: "baseTable" }, [e.scrollTipVisible ? a("div", { staticClass: "drag-tip-overlay", on: { click: e.dismissTip } }, [a("div", { staticClass: "tip-content" }, [a("svg", { staticClass: "tip-icon", attrs: { viewBox: "0 0 1024 1024", width: "24", height: "24" } }, [a("path", { attrs: { d: "M512 64C335.264 64 192 207.264 192 384v256c0 176.736 143.264 320 320 320s320-143.264 320-320V384c0-176.736-143.264-320-320-320z m0 72c136.992 0 248 111.008 248 248v256c0 136.992-111.008 248-248 248s-248-111.008-248-248V384c0-136.992 111.008-248 248-248z m0 144c-19.872 0-36 16.128-36 36v128c0 19.872 16.128 36 36 36s36-16.128 36-36V316c0-19.872-16.128-36-36-36z", fill: "currentColor" } })]), a("span", { staticClass: "tip-text" }, [e._v("按住鼠标中键可横向拖动")])]), e._m(0)]) : e._e(), e.showHeader ? a("div", { ref: "headerRef", staticClass: "header" }, [e._t("header", function() {
313
+ return [a("div", { staticClass: "handle" }, [e._t("handleLeft")], 2), a("div", { staticClass: "handleRight" }, [e.headerButtons && e.headerButtons.length ? a("div", { staticClass: "table-search-button-group" }, [e.headerButtons.includes("columnDisplay") ? [e.columnDisplayUseDialog ? [a("el-button", { class: { "right-border": e.headerButtons.includes("comSearch") }, attrs: { plain: "", size: "small" }, on: { click: function(s) {
314
+ e.columnDialogVisible = !0;
315
+ } } }, [e._v(" 列设置 ")]), a("el-dialog", { attrs: { title: "列设置", visible: e.columnDialogVisible, width: "600px", "append-to-body": !0, "custom-class": "column-setting-dialog" }, on: { "update:visible": function(s) {
316
+ e.columnDialogVisible = s;
317
+ } } }, [a("div", { staticClass: "column-setting-body" }, [a("el-transfer", { attrs: { filterable: "", data: e.columnTransferData, titles: ["隐藏列", "显示列"] }, model: { value: e.columnChecked, callback: function(s) {
318
+ e.columnChecked = s;
319
+ }, expression: "columnChecked" } })], 1), a("span", { staticClass: "dialog-footer", attrs: { slot: "footer" }, slot: "footer" }, [a("el-button", { on: { click: function(s) {
320
+ e.columnDialogVisible = !1;
321
+ } } }, [e._v("关闭")])], 1)])] : a("el-dropdown", { staticClass: "column-display-dropdown", attrs: { "hide-on-click": !1, trigger: "click" } }, [a("el-button", { class: { "right-border": e.headerButtons.includes("comSearch") }, attrs: { plain: "", size: "small" } }, [e._v(" 列设置 ")]), a("el-dropdown-menu", { attrs: { slot: "dropdown" }, slot: "dropdown" }, [a("el-checkbox-group", { staticClass: "dropdown-checkbox-group", model: { value: e.columnChecked, callback: function(s) {
322
+ e.columnChecked = s;
323
+ }, expression: "columnChecked" } }, e._l(e.tableItem, function(s, n) {
324
+ return a("el-dropdown-item", { key: n }, [s.prop ? a("el-checkbox", { attrs: { label: s.prop, disabled: e.isPropHiddenByProps(s.prop) } }, [e._v(" " + e._s(s.label) + " ")]) : e._e()], 1);
325
+ }), 1)], 1)], 1)] : e._e(), e.headerButtons.includes("comSearch") ? a("el-tooltip", { attrs: { content: e.showPageSearch ? "关闭搜索" : "展开搜索", placement: "top" } }, [a("el-button", { attrs: { plain: "", size: "small", icon: "el-icon-search" }, on: { click: e.triggerShowSearch } }, [e._v(" 搜索 ")])], 1) : e._e()], 2) : e._e(), e._t("handleRight")], 2)];
326
+ })], 2) : e._e(), a("el-table", e._g(e._b({ ref: "elTableRef", staticClass: "elTable", staticStyle: { width: "100%" }, attrs: { data: e.dataList, border: e.border, "max-height": e.computedMaxHeight, stripe: "" }, on: { "sort-change": e.sortChange, "row-dblclick": e.handleRowDblclick } }, "el-table", e.elTableConfig, !1), e.tableListener), [e.showExpand ? a("el-table-column", { attrs: { type: "expand" }, scopedSlots: e._u([{ key: "default", fn: function({ row: s }) {
327
+ return [e._t("expand", null, { backData: s })];
328
+ } }], null, !0) }) : e._e(), e.showChoose ? a("el-table-column", e._b({ attrs: { type: "selection", width: "55", align: e.align } }, "el-table-column", e.selectionConfig, !1)) : e._e(), e.showIndex ? a("el-table-column", { attrs: { width: "55", align: e.align, label: "序号", type: "index" } }) : e._e(), e._l(e.tableItem, function(s) {
329
+ return !s.hide && (!s.prop || !e.hideItemsSet.has(s.prop)) ? a("TableColumn", { key: s.prop, attrs: { item: s, align: e.align, hideItems: e.hideItemsComputed }, scopedSlots: e._u([e._l(e.$scopedSlots, function(n, i) {
330
+ return { key: i, fn: function(r) {
331
+ return [e._t(i, null, null, r)];
332
+ } };
333
+ })], null, !0) }) : e._e();
334
+ })], 2), e.pagination ? a("div", { ref: "footerRef", staticClass: "footer lmw-pagination-footer", class: { isSmall: e.isSmall } }, [e._t("footer", function() {
335
+ return [a("el-pagination", { attrs: { "current-page": e.paginationInfo.pageNum, "page-size": e.paginationInfo.pageSize, "page-sizes": [20, 50, 100, 200, 300], layout: e.paginationLayoutComputed, total: e.listCount, "pager-count": e.isSmall ? 5 : 7, background: "", "hide-on-single-page": "" }, on: { "size-change": e.handleSizeChange, "current-change": e.handleCurrentChange } })];
336
+ })], 2) : e._e()], 1);
337
+ }, D = [function() {
338
+ var t = this, e = t._self._c;
339
+ return e("div", { staticClass: "tip-close" }, [e("i", { staticClass: "el-icon-close", staticStyle: { "font-size": "14px" } })]);
340
+ }], H = /* @__PURE__ */ h(
341
+ x,
342
+ z,
343
+ D,
344
+ !1,
345
+ null,
346
+ "2669d7a9"
347
+ );
348
+ const _ = H.exports, R = {
349
+ name: "BaseMobileTable",
350
+ props: {
351
+ dataList: {
352
+ type: Array,
353
+ default: () => []
354
+ },
355
+ tableItem: {
356
+ type: Array,
357
+ default: () => []
358
+ },
359
+ tableListener: {
360
+ type: Object,
361
+ default: () => ({})
362
+ },
363
+ showChoose: {
364
+ type: Boolean,
365
+ default: !1
366
+ },
367
+ pagination: {
368
+ type: Boolean,
369
+ default: !0
370
+ },
371
+ listCount: {
372
+ type: Number,
373
+ default: 0
374
+ },
375
+ paginationInfo: {
376
+ type: Object,
377
+ default: () => ({ pageNum: 1, pageSize: 10 })
378
+ },
379
+ paginationLayout: {
380
+ type: String,
381
+ default: "prev, pager, next"
382
+ },
383
+ hideItems: {
384
+ type: [Array, Object],
385
+ default: () => ({})
386
+ },
387
+ showBacktop: {
388
+ type: Boolean,
389
+ default: !0
390
+ },
391
+ visibilityHeight: {
392
+ type: Number,
393
+ default: 100
394
+ },
395
+ selectionConfig: {
396
+ type: Object,
397
+ default: () => ({})
398
+ },
399
+ tableLayout: {
400
+ type: Object,
401
+ default: () => ({
402
+ xl: 6,
403
+ lg: 8,
404
+ md: 12,
405
+ sm: 12,
406
+ xs: 24
407
+ })
408
+ }
409
+ },
410
+ data() {
411
+ return {
412
+ headerItem: [],
413
+ centerItem: [],
414
+ footerItem: [],
415
+ checkList: []
416
+ };
417
+ },
418
+ computed: {
419
+ isCheckAll() {
420
+ return this.checkList.length === this.dataList.length;
421
+ }
422
+ },
423
+ watch: {
424
+ tableItem: {
425
+ handler() {
426
+ this.filterTableItems();
427
+ },
428
+ immediate: !0
429
+ }
430
+ },
431
+ directives: {
432
+ "show-footer": {
433
+ inserted: (t) => {
434
+ t.querySelectorAll("*").length <= 1 ? (t.setAttribute("hiden", ""), t.style.display = "none") : (t.removeAttribute("hiden"), t.style.display = "");
435
+ },
436
+ componentUpdated: (t) => {
437
+ t.querySelectorAll("*").length <= 1 ? (t.setAttribute("hiden", ""), t.style.display = "none") : (t.removeAttribute("hiden"), t.style.display = "");
438
+ }
439
+ }
440
+ },
441
+ methods: {
442
+ filterTableItems() {
443
+ this.headerItem = [], this.centerItem = [], this.footerItem = [], this.tableItem.forEach((t) => {
444
+ t.mobileSlot === "header" && this.headerItem.push({
445
+ ...t,
446
+ slotName: t.slotName || t.prop + "Header"
447
+ }), (t.mobileSlot === "footer" || t.prop === "todo") && this.footerItem.push({
448
+ ...t,
449
+ slotName: t.slotName || t.prop + "Slot"
450
+ }), t.mobileSlot || this.centerItem.push({
451
+ ...t,
452
+ slotName: t.slotName || t.prop + "Content"
453
+ });
454
+ });
455
+ },
456
+ handleToTop() {
457
+ const t = document.querySelector(".el-main");
458
+ t && t.scrollTo(0, 0), this.$emit("update:paginationInfo", this.paginationInfo);
459
+ },
460
+ isHiddenItem(t) {
461
+ let e = !1;
462
+ return Array.isArray(this.hideItems) && this.hideItems.includes(t.prop) && (e = !0), e;
463
+ },
464
+ cardHeaderClick(t) {
465
+ this.$emit("cardHeaderClick", t);
466
+ },
467
+ selectionChange(t) {
468
+ this.$emit("selectionChange", t);
469
+ },
470
+ hasSlot(t, e) {
471
+ return e.some((a) => this.$slots[a] || this.$scopedSlots[a]);
472
+ },
473
+ checkAll() {
474
+ this.isCheckAll ? this.checkList = [] : this.checkList = [...this.dataList], this.selectionChange(this.checkList);
475
+ }
476
+ }
477
+ };
478
+ var A = function() {
479
+ var e = this, a = e._self._c;
480
+ return a("div", { staticClass: "mobileContent" }, [e.hasSlot(e.$slots, ["handleLeft", "handleRight"]) ? a("div", { staticClass: "mb12 header" }, [a("el-scrollbar", [a("div", { staticClass: "headerContent" }, [e._t("header", function() {
481
+ return [a("div", { staticClass: "handleRight" }, [e._t("handleLeft")], 2), a("div", { staticClass: "handleRight" }, [e._t("handleRight")], 2)];
482
+ })], 2)])], 1) : e._e(), e.dataList.length !== 0 ? a("div", { staticClass: "dataList" }, [a("el-checkbox-group", { on: { change: e.selectionChange }, model: { value: e.checkList, callback: function(s) {
483
+ e.checkList = s;
484
+ }, expression: "checkList" } }, [a("el-row", { attrs: { gutter: 12 } }, e._l(e.dataList, function(s, n) {
485
+ return a("el-col", e._b({ key: n, staticClass: "mb12" }, "el-col", e.tableLayout, !1), [a("div", { staticClass: "data-card overlayColor" }, [e._l(e.headerItem, function(i) {
486
+ return [!e.isHiddenItem(i) && !i.hide ? a("div", { key: i.prop, staticClass: "card-header" }, [a("div", { staticClass: "order-number" }, [e._t(i.slotName + "Header", function() {
487
+ return [a("div", { staticClass: "label" }, [e._v(e._s(i.label) + ":")])];
488
+ }, { backData: Object.assign({}, s, { column: i }) }), e._t(i.slotName, function() {
489
+ return [a("div", { staticClass: "value", on: { click: function(r) {
490
+ return e.cardHeaderClick(s);
491
+ } } }, [e._v(" " + e._s(s[i.prop]) + " ")])];
492
+ }, { backData: Object.assign({}, s, { column: i }) })], 2), e.showChoose ? a("el-checkbox", { staticClass: "checkSize", attrs: { label: s, disabled: e.selectionConfig.selectable && !e.selectionConfig.selectable(s) } }, [e._v("   ")]) : e._e()], 1) : e._e()];
493
+ }), a("div", { staticClass: "info-list" }, [a("div", { staticClass: "info-row" }, [e._l(e.centerItem, function(i) {
494
+ return [!e.isHiddenItem(i) && !i.hide ? a("div", { key: i.prop, staticClass: "info-item", class: {
495
+ "full-width": i.width >= 160 || i.minWidth >= 160
496
+ } }, [i.prop !== "todo" ? [e._t(i.slotName + "Header", function() {
497
+ return [a("span", { staticClass: "label" }, [e._v(" " + e._s(i.label) + ": ")])];
498
+ }, { backData: Object.assign({}, s, { column: i }) }), e._t(i.slotName, function() {
499
+ return [a("span", { staticClass: "value" }, [e._v(e._s(s[i.prop]))])];
500
+ }, { backData: Object.assign({}, s, { column: i }) })] : e._e()], 2) : e._e()];
501
+ })], 2)]), a("div", { directives: [{ name: "show-footer", rawName: "v-show-footer" }], staticClass: "card-footer mobileFooter" }, [e._l(e.footerItem, function(i) {
502
+ return [e.isHiddenItem(i) ? e._e() : e._t(i.slotName, null, { backData: Object.assign({}, s, { column: i }) })];
503
+ })], 2)], 2)]);
504
+ }), 1)], 1)], 1) : a("el-empty", { staticClass: "overlayColor", attrs: { description: "暂无数据" } }), e.pagination && e.listCount > e.paginationInfo.pageSize ? a("div", { staticClass: "footer lmw-pagination-footer" }, [a("span", { staticClass: "mr2" }, [e._v(" " + e._s(e.listCount) + "条 ")]), a("el-pagination", { attrs: { "current-page": e.paginationInfo.pageNum, "page-size": e.paginationInfo.pageSize, layout: e.paginationLayout, total: e.listCount, "pager-count": 5, background: "", "hide-on-single-page": "" }, on: { "size-change": e.handleToTop, "current-change": e.handleToTop, "update:currentPage": function(s) {
505
+ return e.$set(e.paginationInfo, "pageNum", s);
506
+ }, "update:current-page": function(s) {
507
+ return e.$set(e.paginationInfo, "pageNum", s);
508
+ }, "update:pageSize": function(s) {
509
+ return e.$set(e.paginationInfo, "pageSize", s);
510
+ }, "update:page-size": function(s) {
511
+ return e.$set(e.paginationInfo, "pageSize", s);
512
+ } } })], 1) : e._e(), a("el-backtop", { attrs: { target: ".el-main", right: 10, bottom: 100, "visibility-height": e.visibilityHeight } })], 1);
513
+ }, B = [], N = /* @__PURE__ */ h(
514
+ R,
515
+ A,
516
+ B,
517
+ !1,
518
+ null,
519
+ "f2686979"
520
+ );
521
+ const C = N.exports, O = [_, C], v = function(t) {
522
+ O.forEach((e) => {
523
+ e.name && t.component(e.name, e);
524
+ });
525
+ };
526
+ typeof window < "u" && window.Vue && v(window.Vue);
527
+ const j = {
528
+ install: v,
529
+ Table: _,
530
+ MoblieTable: C
531
+ };
532
+ export {
533
+ C as MoblieTable,
534
+ _ as Table,
535
+ j as default
536
+ };
@@ -0,0 +1 @@
1
+ (function(r,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(r=typeof globalThis<"u"?globalThis:r||self,c(r.EleScrollTableVue2={}))})(this,function(r){"use strict";function c(t,e,a,s,n,i,d,l){var o=typeof t=="function"?t.options:t;return e&&(o.render=e,o.staticRenderFns=a,o._compiled=!0),i&&(o._scopeId="data-v-"+i),{exports:t,options:o}}const w={name:"TableColumn",props:{item:{type:Object,default:()=>({})},align:{type:String,default:"center"},hideItems:{type:[Array,Object],default:()=>[]}},methods:{isHiddenItem(t){return Array.isArray(this.hideItems)?this.hideItems.includes(t.prop):!1}}};var T=function(){var e=this,a=e._self._c;return e.item.merges?a("el-table-column",e._b({attrs:{align:e.align,border:""},scopedSlots:e._u([{key:"header",fn:function(s){return[e._t(`${e.item.slotName}Header`,function(){return[e._v(" "+e._s(e.item.label)+" ")]},{backData:s})]}}],null,!0)},"el-table-column",e.item,!1),e._l(e.item.merges,function(s,n){return!s.hide&&!e.isHiddenItem(s)?a("TableColumn",{key:n,attrs:{item:s,align:e.align,hideItems:e.hideItems},scopedSlots:e._u([e._l(e.$scopedSlots,function(i,d){return{key:d,fn:function(l){return[e._t(d,null,null,l)]}}})],null,!0)}):e._e()}),1):a("el-table-column",e._b({attrs:{align:e.align,border:""},scopedSlots:e._u([{key:"header",fn:function(s){return[e._t(`${e.item.slotName}Header`,function(){return[e._v(" "+e._s(e.item.label)+" ")]},{backData:s})]}},{key:"default",fn:function(s){return[e._t(e.item.slotName,function(){return[e.item.prop?a("span",[e._v(e._s(s.row[e.item.prop]))]):e._e()]},{backData:s.row,currentItem:e.item})]}}],null,!0)},"el-table-column",e.item,!1))},k=[],I=c(w,T,k,!1,null,null);const L=I.exports,$=(t,e={})=>{const{onStart:a}=e;let s=null;const n=()=>{const l=t.$el||t;if(!l)return null;const o=l.querySelector(".el-table__body-wrapper .el-scrollbar__wrap")||l.querySelector(".el-table__body-wrapper");if(!o)return null;let h=!1,y=0,_=0;const v=u=>{u.button===1&&(u.preventDefault(),a&&a(),h=!0,y=u.clientX,_=o.scrollLeft,l.style.cursor="grabbing",document.body.style.userSelect="none")},p=()=>{h&&(h=!1,l.style.cursor="",document.body.style.userSelect="")},C=u=>{if(!h)return;u.preventDefault();const E=u.clientX-y;o.scrollLeft=_-E},S=()=>{p()},f=l.querySelector(".el-table__body-wrapper");return f&&f.addEventListener("mousedown",v),window.addEventListener("mousemove",C),window.addEventListener("mouseup",S),window.addEventListener("blur",p),window.addEventListener("mouseleave",p),()=>{f&&f.removeEventListener("mousedown",v),window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",S),window.removeEventListener("blur",p),window.removeEventListener("mouseleave",p)}};return{start:()=>{s=n()},stop:()=>{s&&s(),s=null}}},x={name:"BaseTable",components:{TableColumn:L},props:{border:{type:Boolean,default:!0},dataList:{type:Array,default:()=>[]},tableItem:{type:Array,default:()=>[]},tableListener:{type:Object,default:()=>({})},showChoose:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},pagination:{type:Boolean,default:!0},listCount:{type:Number,default:0},paginationInfo:{type:Object,default:()=>({pageNum:1,pageSize:50})},elTableConfig:{type:Object,default:()=>({})},showExpand:{type:Boolean,default:!1},align:{type:String,default:"center"},paginationLayout:{type:String,default:"total, sizes, prev, pager, next, jumper"},hideItems:{type:[Array,Object],default:()=>({})},maxHeight:{type:[Number,String]},selectionConfig:{type:Object,default:()=>({})},autoResize:{type:Boolean,default:!0},dragTipScope:{type:String,default:"global"},dragTipStorageKey:{type:String},headerButtons:{type:Array,default:()=>["columnDisplay","comSearch"]},columnDisplayThreshold:{type:Number,default:12},enableDblclickCopy:{type:Boolean,default:!0},copyFeedback:{type:Boolean,default:!0},copyLocale:{type:Object,default:()=>({success:"已复制",failed:"复制失败",empty:"无可复制内容"})},persistenceColumn:{type:Boolean,default:!0},persistenceKey:{type:String,default:""}},data(){return{expandAll:!1,otherSlots:[],columnChecked:[],showPageSearch:!1,columnDialogVisible:!1,scrollTipVisible:!1,dragTipSeen:!1,dragScrollController:null,isSmall:window.innerWidth<768,resizeListener:null}},computed:{showHeader(){return!!this.$slots.handleLeft||!!this.$slots.handleRight||this.headerButtons&&this.headerButtons.length>0},computedMaxHeight(){if(this.maxHeight)return this.maxHeight;this.autoResize},paginationLayoutComputed(){return this.isSmall?"total, prev, pager, next":this.paginationLayout},propsHiddenSet(){return new Set(this.normalizeHiddenToArray(this.hideItems))},hideItemsComputed(){const t=(this.tableItem||[]).filter(n=>n&&n.prop&&!n.hide).map(n=>n.prop),e=new Set(this.columnChecked),a=t.filter(n=>!e.has(n)),s=this.normalizeHiddenToArray(this.hideItems);return Array.from(new Set([...s,...a]))},hideItemsSet(){return new Set(this.hideItemsComputed)},columnDisplayUseDialog(){return(this.tableItem||[]).filter(e=>e&&e.prop&&!e.hide).length>this.columnDisplayThreshold},columnTransferData(){return(this.tableItem||[]).filter(t=>t&&t.prop&&!t.hide).map(t=>({key:t.prop,label:t.label||t.prop,disabled:this.isPropHiddenByProps(t.prop)}))},columnStorageKey(){return this.persistenceKey&&this.persistenceKey.trim()||null},storageKeyForDragTip(){const t=this.dragTipStorageKey&&this.dragTipStorageKey.trim();return t||(this.dragTipScope==="instance"?`baseTableDragTipSeen_v2_${this._uid}`:"baseTableDragTipSeen_v2")}},watch:{tableItem:{handler(){this.updateColumnChecked()},immediate:!0},hideItems:{handler(){this.updateColumnChecked()}},columnChecked:{handler(t){if(this.persistenceColumn&&this.columnStorageKey)try{localStorage.setItem(this.columnStorageKey,JSON.stringify(t))}catch(e){console.warn("EleScrollTable: Failed to save column settings",e)}},deep:!0}},mounted(){this.handleResize(),this.resizeListener=()=>this.handleResize(),window.addEventListener("resize",this.resizeListener),setTimeout(()=>{this.dragScrollController=$(this.$refs.elTableRef,{onStart:this.dismissTip}),this.dragScrollController&&(this.dragScrollController.start(),this.checkDragTip())},100)},beforeDestroy(){this.resizeListener&&window.removeEventListener("resize",this.resizeListener),this.dragScrollController&&this.dragScrollController.stop()},methods:{handleResize(){this.isSmall=window.innerWidth<768},handleCurrentChange(t){this.$refs.elTableRef&&this.$refs.elTableRef.bodyWrapper&&(this.$refs.elTableRef.bodyWrapper.scrollTop=0),this.$emit("update:paginationInfo",{...this.paginationInfo,pageNum:t})},handleSizeChange(t){this.$refs.elTableRef&&this.$refs.elTableRef.bodyWrapper&&(this.$refs.elTableRef.bodyWrapper.scrollTop=0),this.$emit("update:paginationInfo",{...this.paginationInfo,pageSize:t})},sortChange(t){this.$refs.elTableRef&&this.$refs.elTableRef.bodyWrapper&&(this.$refs.elTableRef.bodyWrapper.scrollTop=0),this.$emit("sortChange",t)},normalizeHiddenToArray(t){let e=t;return Array.isArray(e)?e.filter(Boolean):e&&typeof e=="object"?Object.keys(e).filter(a=>e[a]):[]},isPropHiddenByProps(t){return this.propsHiddenSet.has(t)},updateColumnChecked(){const t=(this.tableItem||[]).filter(s=>s&&s.prop&&!s.hide),e=t.filter(s=>!this.propsHiddenSet.has(s.prop)).map(s=>s.prop);let a=null;if(this.persistenceColumn&&this.columnStorageKey)try{const s=localStorage.getItem(this.columnStorageKey);s&&(a=JSON.parse(s))}catch(s){console.warn("EleScrollTable: Failed to read column settings",s)}if(a&&Array.isArray(a)){const s=new Set(t.map(i=>i.prop)),n=a.filter(i=>s.has(i));this.columnChecked=n}else this.columnChecked=e},triggerShowSearch(){this.showPageSearch=!this.showPageSearch,this.$emit("toggleSearch",this.showPageSearch)},async copyText(t){if(!t)return!1;try{if(navigator&&navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(t),!0;const e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();const a=document.execCommand("copy");return document.body.removeChild(e),a}catch{return!1}},getCellCopyText(t,e,a){const s=e&&e.property;if(s){const i=t[s];return i==null?"":String(i)}const n=a&&a.target&&a.target.closest&&a.target.closest(".cell");return n&&n.innerText?n.innerText.trim():""},async handleRowDblclick(t,e,a){if(!this.enableDblclickCopy)return;const s=this.getCellCopyText(t,e,a);if(!s){this.copyFeedback&&this.$message.warning(this.copyLocale.empty);return}const n=await this.copyText(s);this.copyFeedback&&(n?this.$message.success(this.copyLocale.success):this.$message.error(this.copyLocale.failed))},checkDragTip(){if(localStorage.getItem(this.storageKeyForDragTip)==="true"){this.dragTipSeen=!0;return}this.checkHorizontalOverflow()&&(this.scrollTipVisible=!0,setTimeout(()=>{this.scrollTipVisible&&this.dismissTip()},6e3))},checkHorizontalOverflow(){const t=this.$refs.elTableRef?this.$refs.elTableRef.$el:null;if(!t)return!1;const e=t.querySelector(".el-table__body-wrapper .el-scrollbar__wrap")||t.querySelector(".el-table__body-wrapper");return e?e.scrollWidth>e.clientWidth+2:!1},dismissTip(){this.scrollTipVisible&&(this.scrollTipVisible=!1),this.dragTipSeen=!0,localStorage.setItem(this.storageKeyForDragTip,"true")},unFoldAll(t){}}};var z=function(){var e=this,a=e._self._c;return a("div",{staticClass:"baseTable"},[e.scrollTipVisible?a("div",{staticClass:"drag-tip-overlay",on:{click:e.dismissTip}},[a("div",{staticClass:"tip-content"},[a("svg",{staticClass:"tip-icon",attrs:{viewBox:"0 0 1024 1024",width:"24",height:"24"}},[a("path",{attrs:{d:"M512 64C335.264 64 192 207.264 192 384v256c0 176.736 143.264 320 320 320s320-143.264 320-320V384c0-176.736-143.264-320-320-320z m0 72c136.992 0 248 111.008 248 248v256c0 136.992-111.008 248-248 248s-248-111.008-248-248V384c0-136.992 111.008-248 248-248z m0 144c-19.872 0-36 16.128-36 36v128c0 19.872 16.128 36 36 36s36-16.128 36-36V316c0-19.872-16.128-36-36-36z",fill:"currentColor"}})]),a("span",{staticClass:"tip-text"},[e._v("按住鼠标中键可横向拖动")])]),e._m(0)]):e._e(),e.showHeader?a("div",{ref:"headerRef",staticClass:"header"},[e._t("header",function(){return[a("div",{staticClass:"handle"},[e._t("handleLeft")],2),a("div",{staticClass:"handleRight"},[e.headerButtons&&e.headerButtons.length?a("div",{staticClass:"table-search-button-group"},[e.headerButtons.includes("columnDisplay")?[e.columnDisplayUseDialog?[a("el-button",{class:{"right-border":e.headerButtons.includes("comSearch")},attrs:{plain:"",size:"small"},on:{click:function(s){e.columnDialogVisible=!0}}},[e._v(" 列设置 ")]),a("el-dialog",{attrs:{title:"列设置",visible:e.columnDialogVisible,width:"600px","append-to-body":!0,"custom-class":"column-setting-dialog"},on:{"update:visible":function(s){e.columnDialogVisible=s}}},[a("div",{staticClass:"column-setting-body"},[a("el-transfer",{attrs:{filterable:"",data:e.columnTransferData,titles:["隐藏列","显示列"]},model:{value:e.columnChecked,callback:function(s){e.columnChecked=s},expression:"columnChecked"}})],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(s){e.columnDialogVisible=!1}}},[e._v("关闭")])],1)])]:a("el-dropdown",{staticClass:"column-display-dropdown",attrs:{"hide-on-click":!1,trigger:"click"}},[a("el-button",{class:{"right-border":e.headerButtons.includes("comSearch")},attrs:{plain:"",size:"small"}},[e._v(" 列设置 ")]),a("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[a("el-checkbox-group",{staticClass:"dropdown-checkbox-group",model:{value:e.columnChecked,callback:function(s){e.columnChecked=s},expression:"columnChecked"}},e._l(e.tableItem,function(s,n){return a("el-dropdown-item",{key:n},[s.prop?a("el-checkbox",{attrs:{label:s.prop,disabled:e.isPropHiddenByProps(s.prop)}},[e._v(" "+e._s(s.label)+" ")]):e._e()],1)}),1)],1)],1)]:e._e(),e.headerButtons.includes("comSearch")?a("el-tooltip",{attrs:{content:e.showPageSearch?"关闭搜索":"展开搜索",placement:"top"}},[a("el-button",{attrs:{plain:"",size:"small",icon:"el-icon-search"},on:{click:e.triggerShowSearch}},[e._v(" 搜索 ")])],1):e._e()],2):e._e(),e._t("handleRight")],2)]})],2):e._e(),a("el-table",e._g(e._b({ref:"elTableRef",staticClass:"elTable",staticStyle:{width:"100%"},attrs:{data:e.dataList,border:e.border,"max-height":e.computedMaxHeight,stripe:""},on:{"sort-change":e.sortChange,"row-dblclick":e.handleRowDblclick}},"el-table",e.elTableConfig,!1),e.tableListener),[e.showExpand?a("el-table-column",{attrs:{type:"expand"},scopedSlots:e._u([{key:"default",fn:function({row:s}){return[e._t("expand",null,{backData:s})]}}],null,!0)}):e._e(),e.showChoose?a("el-table-column",e._b({attrs:{type:"selection",width:"55",align:e.align}},"el-table-column",e.selectionConfig,!1)):e._e(),e.showIndex?a("el-table-column",{attrs:{width:"55",align:e.align,label:"序号",type:"index"}}):e._e(),e._l(e.tableItem,function(s){return!s.hide&&(!s.prop||!e.hideItemsSet.has(s.prop))?a("TableColumn",{key:s.prop,attrs:{item:s,align:e.align,hideItems:e.hideItemsComputed},scopedSlots:e._u([e._l(e.$scopedSlots,function(n,i){return{key:i,fn:function(d){return[e._t(i,null,null,d)]}}})],null,!0)}):e._e()})],2),e.pagination?a("div",{ref:"footerRef",staticClass:"footer lmw-pagination-footer",class:{isSmall:e.isSmall}},[e._t("footer",function(){return[a("el-pagination",{attrs:{"current-page":e.paginationInfo.pageNum,"page-size":e.paginationInfo.pageSize,"page-sizes":[20,50,100,200,300],layout:e.paginationLayoutComputed,total:e.listCount,"pager-count":e.isSmall?5:7,background:"","hide-on-single-page":""},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})]})],2):e._e()],1)},D=[function(){var t=this,e=t._self._c;return e("div",{staticClass:"tip-close"},[e("i",{staticClass:"el-icon-close",staticStyle:{"font-size":"14px"}})])}],H=c(x,z,D,!1,null,"2669d7a9");const m=H.exports,R={name:"BaseMobileTable",props:{dataList:{type:Array,default:()=>[]},tableItem:{type:Array,default:()=>[]},tableListener:{type:Object,default:()=>({})},showChoose:{type:Boolean,default:!1},pagination:{type:Boolean,default:!0},listCount:{type:Number,default:0},paginationInfo:{type:Object,default:()=>({pageNum:1,pageSize:10})},paginationLayout:{type:String,default:"prev, pager, next"},hideItems:{type:[Array,Object],default:()=>({})},showBacktop:{type:Boolean,default:!0},visibilityHeight:{type:Number,default:100},selectionConfig:{type:Object,default:()=>({})},tableLayout:{type:Object,default:()=>({xl:6,lg:8,md:12,sm:12,xs:24})}},data(){return{headerItem:[],centerItem:[],footerItem:[],checkList:[]}},computed:{isCheckAll(){return this.checkList.length===this.dataList.length}},watch:{tableItem:{handler(){this.filterTableItems()},immediate:!0}},directives:{"show-footer":{inserted:t=>{t.querySelectorAll("*").length<=1?(t.setAttribute("hiden",""),t.style.display="none"):(t.removeAttribute("hiden"),t.style.display="")},componentUpdated:t=>{t.querySelectorAll("*").length<=1?(t.setAttribute("hiden",""),t.style.display="none"):(t.removeAttribute("hiden"),t.style.display="")}}},methods:{filterTableItems(){this.headerItem=[],this.centerItem=[],this.footerItem=[],this.tableItem.forEach(t=>{t.mobileSlot==="header"&&this.headerItem.push({...t,slotName:t.slotName||t.prop+"Header"}),(t.mobileSlot==="footer"||t.prop==="todo")&&this.footerItem.push({...t,slotName:t.slotName||t.prop+"Slot"}),t.mobileSlot||this.centerItem.push({...t,slotName:t.slotName||t.prop+"Content"})})},handleToTop(){const t=document.querySelector(".el-main");t&&t.scrollTo(0,0),this.$emit("update:paginationInfo",this.paginationInfo)},isHiddenItem(t){let e=!1;return Array.isArray(this.hideItems)&&this.hideItems.includes(t.prop)&&(e=!0),e},cardHeaderClick(t){this.$emit("cardHeaderClick",t)},selectionChange(t){this.$emit("selectionChange",t)},hasSlot(t,e){return e.some(a=>this.$slots[a]||this.$scopedSlots[a])},checkAll(){this.isCheckAll?this.checkList=[]:this.checkList=[...this.dataList],this.selectionChange(this.checkList)}}};var A=function(){var e=this,a=e._self._c;return a("div",{staticClass:"mobileContent"},[e.hasSlot(e.$slots,["handleLeft","handleRight"])?a("div",{staticClass:"mb12 header"},[a("el-scrollbar",[a("div",{staticClass:"headerContent"},[e._t("header",function(){return[a("div",{staticClass:"handleRight"},[e._t("handleLeft")],2),a("div",{staticClass:"handleRight"},[e._t("handleRight")],2)]})],2)])],1):e._e(),e.dataList.length!==0?a("div",{staticClass:"dataList"},[a("el-checkbox-group",{on:{change:e.selectionChange},model:{value:e.checkList,callback:function(s){e.checkList=s},expression:"checkList"}},[a("el-row",{attrs:{gutter:12}},e._l(e.dataList,function(s,n){return a("el-col",e._b({key:n,staticClass:"mb12"},"el-col",e.tableLayout,!1),[a("div",{staticClass:"data-card overlayColor"},[e._l(e.headerItem,function(i){return[!e.isHiddenItem(i)&&!i.hide?a("div",{key:i.prop,staticClass:"card-header"},[a("div",{staticClass:"order-number"},[e._t(i.slotName+"Header",function(){return[a("div",{staticClass:"label"},[e._v(e._s(i.label)+":")])]},{backData:Object.assign({},s,{column:i})}),e._t(i.slotName,function(){return[a("div",{staticClass:"value",on:{click:function(d){return e.cardHeaderClick(s)}}},[e._v(" "+e._s(s[i.prop])+" ")])]},{backData:Object.assign({},s,{column:i})})],2),e.showChoose?a("el-checkbox",{staticClass:"checkSize",attrs:{label:s,disabled:e.selectionConfig.selectable&&!e.selectionConfig.selectable(s)}},[e._v("   ")]):e._e()],1):e._e()]}),a("div",{staticClass:"info-list"},[a("div",{staticClass:"info-row"},[e._l(e.centerItem,function(i){return[!e.isHiddenItem(i)&&!i.hide?a("div",{key:i.prop,staticClass:"info-item",class:{"full-width":i.width>=160||i.minWidth>=160}},[i.prop!=="todo"?[e._t(i.slotName+"Header",function(){return[a("span",{staticClass:"label"},[e._v(" "+e._s(i.label)+": ")])]},{backData:Object.assign({},s,{column:i})}),e._t(i.slotName,function(){return[a("span",{staticClass:"value"},[e._v(e._s(s[i.prop]))])]},{backData:Object.assign({},s,{column:i})})]:e._e()],2):e._e()]})],2)]),a("div",{directives:[{name:"show-footer",rawName:"v-show-footer"}],staticClass:"card-footer mobileFooter"},[e._l(e.footerItem,function(i){return[e.isHiddenItem(i)?e._e():e._t(i.slotName,null,{backData:Object.assign({},s,{column:i})})]})],2)],2)])}),1)],1)],1):a("el-empty",{staticClass:"overlayColor",attrs:{description:"暂无数据"}}),e.pagination&&e.listCount>e.paginationInfo.pageSize?a("div",{staticClass:"footer lmw-pagination-footer"},[a("span",{staticClass:"mr2"},[e._v(" "+e._s(e.listCount)+"条 ")]),a("el-pagination",{attrs:{"current-page":e.paginationInfo.pageNum,"page-size":e.paginationInfo.pageSize,layout:e.paginationLayout,total:e.listCount,"pager-count":5,background:"","hide-on-single-page":""},on:{"size-change":e.handleToTop,"current-change":e.handleToTop,"update:currentPage":function(s){return e.$set(e.paginationInfo,"pageNum",s)},"update:current-page":function(s){return e.$set(e.paginationInfo,"pageNum",s)},"update:pageSize":function(s){return e.$set(e.paginationInfo,"pageSize",s)},"update:page-size":function(s){return e.$set(e.paginationInfo,"pageSize",s)}}})],1):e._e(),a("el-backtop",{attrs:{target:".el-main",right:10,bottom:100,"visibility-height":e.visibilityHeight}})],1)},B=[],N=c(R,A,B,!1,null,"f2686979");const g=N.exports,j=[m,g],b=function(t){j.forEach(e=>{e.name&&t.component(e.name,e)})};typeof window<"u"&&window.Vue&&b(window.Vue);const O={install:b,Table:m,MoblieTable:g};r.MoblieTable=g,r.Table=m,r.default=O,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .baseTable[data-v-2669d7a9]{position:relative}.drag-tip-overlay[data-v-2669d7a9]{position:absolute;top:20px;right:20px;z-index:2000;display:flex;align-items:center;gap:16px;background:#000000d9;border:1px solid rgba(255,255,255,.25);box-shadow:0 8px 24px #0000004d;border-radius:30px;padding:12px 20px;cursor:pointer;transition:all .3s ease;-webkit-user-select:none;user-select:none}.drag-tip-overlay[data-v-2669d7a9]:hover{background:#000000f2;transform:scale(1.05)}.tip-content[data-v-2669d7a9]{display:flex;align-items:center;gap:12px;color:#fff;font-size:16px;font-weight:600}.tip-icon[data-v-2669d7a9]{color:#409eff;animation:scrollIconAnim-2669d7a9 2s ease-in-out infinite;display:block}.tip-close[data-v-2669d7a9]{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;background:#fff3;color:#ddd}.tip-close[data-v-2669d7a9]:hover{background:#fff6;color:#fff}@keyframes scrollIconAnim-2669d7a9{0%,to{transform:translateY(0)}50%{transform:translateY(2px)}}.header[data-v-2669d7a9]{position:relative;overflow-x:auto;box-sizing:border-box;display:flex;justify-content:space-between;align-items:center;width:100%;max-width:100%;background-color:#f5f7fa;border:1px solid #EBEEF5;border-bottom:none;padding:13px 15px;font-size:14px}.handleRight[data-v-2669d7a9]{display:flex;align-items:center}.table-search-button-group[data-v-2669d7a9]{display:flex;align-items:center;gap:8px}.table-search-button-group>*[data-v-2669d7a9]{margin-left:8px}.table-search-button-group>*[data-v-2669d7a9]:first-child{margin-left:0}.column-display-dropdown[data-v-2669d7a9]{margin-right:0}.dropdown-checkbox-group[data-v-2669d7a9]{padding:5px 0}.el-dropdown-menu__item .el-checkbox[data-v-2669d7a9]{display:block;margin-right:0}.column-setting-body[data-v-2669d7a9]{height:400px;display:flex;justify-content:center}.column-setting-body .el-transfer[data-v-2669d7a9]{display:flex;align-items:center}.footer[data-v-2669d7a9]{background-color:#f5f7fa;border:1px solid #EBEEF5;border-top:none;padding:10px;display:flex;justify-content:flex-end}.header[data-v-f2686979]{border:1px solid #ebeef5;background-color:#fff;font-size:14px;padding:12px 12px 0}.headerContent[data-v-f2686979]{padding-bottom:12px}.data-card[data-v-f2686979]{border-radius:12px;line-height:32px;border:1px solid #ebeef5;overflow:hidden;height:100%;background-color:#fff}.checkSize[data-v-f2686979] .el-checkbox__inner{height:18px;width:18px}.checkSize[data-v-f2686979] .el-checkbox__inner:after{left:5px;width:5px;height:10px}.card-header[data-v-f2686979]{display:flex;justify-content:space-between;align-items:center;padding:12px;border-bottom:1px solid #ebeef5}.card-header .order-number[data-v-f2686979]{display:flex;font-size:15px;overflow:hidden}.card-header .order-number .label[data-v-f2686979]{max-width:90px;color:#303133;font-weight:500}.card-header .order-number .value[data-v-f2686979]{color:#409eff;font-weight:500;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:200px;cursor:pointer}.info-list[data-v-f2686979]{padding:16px}.info-list .info-row[data-v-f2686979]{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px 24px}.info-list .info-item[data-v-f2686979]{display:flex;align-items:center;font-size:14px;line-height:1.5;white-space:nowrap;overflow:hidden}.info-list .info-item.full-width[data-v-f2686979]{grid-column:1/-1}.info-list .info-item .label[data-v-f2686979]{color:#666;margin-right:4px}.info-list .info-item .value[data-v-f2686979]{color:#303133;flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.card-footer[data-v-f2686979]{display:flex;justify-content:flex-end;flex-wrap:wrap;padding:10px 12px}.card-footer[data-v-f2686979] .el-button{margin:4px!important}.card-footer[hiden][data-v-f2686979]{display:none!important}@media screen and (max-width: 768px){.info-list[data-v-f2686979]{padding:12px}.info-list .info-row[data-v-f2686979]{grid-template-columns:repeat(2,1fr);gap:8px}.info-item[data-v-f2686979]{font-size:13px}.card-footer[data-v-f2686979]{padding:8px 12px;flex-wrap:wrap}}@media screen and (max-width: 375px){.info-list .info-row[data-v-f2686979]{grid-template-columns:1fr}}.footer[data-v-f2686979]{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap}.footer[data-v-f2686979] .el-pager li{margin:0 1px}.footer[data-v-f2686979] .btn-prev{margin:0 2px}.footer[data-v-f2686979] .btn-next{margin:0 0 0 2px}.footer[data-v-f2686979] .el-pagination{padding:0}.footer[data-v-f2686979] .el-pagination .el-pager li,.footer[data-v-f2686979] .el-pagination button{height:28px;min-width:28px;line-height:28px}.footer[data-v-f2686979]{background-color:#fff;padding:8px}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "ele-scroll-table-vue2",
3
+ "version": "0.1.5",
4
+ "type": "module",
5
+ "main": "./dist/ele-scroll-table-vue2.umd.cjs",
6
+ "module": "./dist/ele-scroll-table-vue2.mjs",
7
+ "style": "./dist/style.css",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/ele-scroll-table-vue2.mjs",
11
+ "require": "./dist/ele-scroll-table-vue2.umd.cjs"
12
+ },
13
+ "./style.css": "./dist/style.css"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "dev": "vite --host 0.0.0.0 --port 5174",
20
+ "build": "vite build",
21
+ "prepublishOnly": "npm run build",
22
+ "release": "npm version patch && npm publish"
23
+ },
24
+ "peerDependencies": {
25
+ "vue": ">=2.6.0",
26
+ "element-ui": ">=2.0.0"
27
+ },
28
+ "devDependencies": {
29
+ "@vitejs/plugin-vue2": "^2.3.0",
30
+ "vite": "^5.0.0",
31
+ "vue": "^2.7.0",
32
+ "element-ui": "^2.15.0",
33
+ "sass": "^1.70.0"
34
+ }
35
+ }