ling-yun-custom-components 0.0.76 → 0.0.77

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.
@@ -1,27 +1,27 @@
1
1
  import { w as Ee } from "./chunks/index.bCzIhWFw.js";
2
- import { useSlots as ke, computed as m, ref as v, watch as oe, onMounted as ze, nextTick as Ne, createElementBlock as E, openBlock as S, createElementVNode as y, createCommentVNode as k, unref as p, renderSlot as j, Fragment as Pe, createBlock as de, withCtx as O, createTextVNode as re, toDisplayString as Ae, createVNode as U, createSlots as We, renderList as De, normalizeProps as Ie, guardReactiveProps as je, h as H } from "vue";
3
- import { ElButton as ce, ElAutoResizer as Oe, ElTableV2 as qe, ElCheckbox as Ke } from "element-plus";
4
- import { emitsMap as fe, paginationConfig as Fe, calculateScale as Ve } from "color-star-custom-methods";
5
- import { _ as _e } from "./chunks/layout.BOupEsmd.js";
6
- import { cloneDeep as $e } from "lodash";
7
- import { _ as Le } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
8
- import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col" }, Ue = {
2
+ import { useSlots as ke, computed as m, ref as v, watch as ue, onMounted as ze, nextTick as Pe, createElementBlock as E, openBlock as S, createElementVNode as y, createCommentVNode as k, unref as p, renderSlot as I, Fragment as Ne, createBlock as oe, withCtx as j, createTextVNode as de, toDisplayString as Ae, createVNode as U, createSlots as We, renderList as De, normalizeProps as Ie, guardReactiveProps as je, mergeProps as Oe, h as H } from "vue";
3
+ import { ElButton as re, ElAutoResizer as qe, ElTableV2 as Ke, ElCheckbox as $e } from "element-plus";
4
+ import { emitsMap as ce, paginationConfig as Fe, calculateScale as Ve } from "color-star-custom-methods";
5
+ import { _ as Le } from "./chunks/layout.BOupEsmd.js";
6
+ import { cloneDeep as Me } from "lodash";
7
+ import { _ as _e } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
8
+ import './assets/PaginationTable.css';const Ue = { class: "flex h-full flex-col" }, He = {
9
9
  class: "w-full flex justify-between overflow-hidden",
10
10
  style: { height: "auto" }
11
- }, He = {
11
+ }, Ge = {
12
12
  key: 0,
13
13
  class: "flex-1 overflow-hidden"
14
- }, Ge = {
14
+ }, Je = {
15
15
  class: "flex",
16
16
  style: { width: "auto", gap: "10px" }
17
- }, Je = {
17
+ }, Qe = {
18
18
  key: 1,
19
19
  class: "flex items-center mg-b-18"
20
- }, Qe = { class: "fz-12 text-74798c" }, Xe = { class: "btn-group mg-l-12" }, Ye = { class: "w-full flex-1 overflow-hidden flex flex-col" }, Ze = { class: "flex-1 overflow-hidden TABLE-AREA" }, et = {
20
+ }, Xe = { class: "fz-12 text-74798c" }, Ye = { class: "btn-group mg-l-12" }, Ze = { class: "w-full flex-1 overflow-hidden flex flex-col" }, et = { class: "flex-1 overflow-hidden TABLE-AREA" }, tt = {
21
21
  key: 0,
22
22
  class: "flex justify-end mg-t-20",
23
23
  style: { height: "auto" }
24
- }, tt = /* @__PURE__ */ Object.assign({
24
+ }, lt = /* @__PURE__ */ Object.assign({
25
25
  name: "PaginationTable"
26
26
  }, {
27
27
  __name: "layout",
@@ -104,20 +104,20 @@ import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col"
104
104
  }
105
105
  },
106
106
  emits: [
107
- fe.paginationChange,
107
+ ce.paginationChange,
108
108
  "updateTableData",
109
109
  "handleTableSelect",
110
110
  "handleBatchDelete",
111
111
  "updateSortState",
112
112
  "endReached"
113
113
  ],
114
- setup(c, { expose: he, emit: ve }) {
115
- const b = ve, u = c, q = ke(), z = m(() => typeof u.requestFn == "function"), r = m({
114
+ setup(c, { expose: fe, emit: he }) {
115
+ const b = he, u = c, O = ke(), z = m(() => typeof u.requestFn == "function"), r = m({
116
116
  get: () => z.value ? x.value : u.tableData,
117
117
  set: (e) => {
118
118
  z.value ? x.value = e : b("updateTableData", e);
119
119
  }
120
- }), K = v(0), G = m(() => z.value ? K.value : u.total), w = m({
120
+ }), q = v(0), ve = m(() => z.value ? q.value : u.total), w = m({
121
121
  get: () => u.sortState,
122
122
  set: (e) => {
123
123
  b("updateSortState", e);
@@ -126,12 +126,12 @@ import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col"
126
126
  w.value[e] = t, r.value = r.value.reverse();
127
127
  }, ge = (e) => {
128
128
  b("endReached", e);
129
- }, x = v([]), h = m(() => u.pageMapping.pageNum), N = m(() => u.pageMapping.pageSize), F = {
129
+ }, x = v([]), h = m(() => u.pageMapping.pageNum), K = m(() => u.pageMapping.pageSize), $ = {
130
130
  [h.value]: 1,
131
- [N.value]: 20
131
+ [K.value]: 20
132
132
  }, d = v({
133
- ...F
134
- }), g = v([]), i = v([]), J = v([]), C = v({}), Q = m(() => me(C.value));
133
+ ...$
134
+ }), g = v([]), i = v([]), G = v([]), C = v({}), J = m(() => me(C.value));
135
135
  function me(e) {
136
136
  const t = /* @__PURE__ */ new Set();
137
137
  for (const l in e)
@@ -140,7 +140,7 @@ import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col"
140
140
  });
141
141
  return t;
142
142
  }
143
- const X = ({ value: e, intermediate: t = !1, onChange: l }) => H(Ke, {
143
+ const Q = ({ value: e, intermediate: t = !1, onChange: l }) => H($e, {
144
144
  onChange: l,
145
145
  modelValue: e,
146
146
  indeterminate: t
@@ -153,46 +153,46 @@ import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col"
153
153
  };
154
154
  l(e.children);
155
155
  }
156
- e.parentId && Y(e.parentId), ee(), R();
157
- }, Y = (e) => {
158
- const t = Z(r.value, e);
156
+ e.parentId && X(e.parentId), Z(), R();
157
+ }, X = (e) => {
158
+ const t = Y(r.value, e);
159
159
  if (!t) return;
160
160
  const l = t.children.every((a) => a.selected);
161
- l && !t.selected ? (t.selected = !0, i.value.some((a) => a.id === t.id) || i.value.push(t)) : !l && t.selected && (t.selected = !1, i.value = i.value.filter(({ id: a }) => a !== t.id)), t.parentId && Y(t.parentId);
162
- }, Z = (e, t) => {
161
+ l && !t.selected ? (t.selected = !0, i.value.some((a) => a.id === t.id) || i.value.push(t)) : !l && t.selected && (t.selected = !1, i.value = i.value.filter(({ id: a }) => a !== t.id)), t.parentId && X(t.parentId);
162
+ }, Y = (e, t) => {
163
163
  for (const l of e) {
164
164
  if (l.id === t) return l;
165
165
  if (l.children) {
166
- const a = Z(l.children, t);
166
+ const a = Y(l.children, t);
167
167
  if (a) return a;
168
168
  }
169
169
  }
170
170
  return null;
171
171
  };
172
- function ee() {
173
- C.value[d.value[h.value]] = te(
172
+ function Z() {
173
+ C.value[d.value[h.value]] = ee(
174
174
  r.value
175
175
  );
176
176
  }
177
- function te(e) {
177
+ function ee(e) {
178
178
  let t = [];
179
179
  return e.forEach((l) => {
180
- l.selected && t.push(l), l.children && l.children.length > 0 && (t = t.concat(te(l.children)));
180
+ l.selected && t.push(l), l.children && l.children.length > 0 && (t = t.concat(ee(l.children)));
181
181
  }), t;
182
182
  }
183
- function V(e, t) {
184
- e.selected = t, e.children && e.children.length > 0 && e.children.forEach((l) => V(l, t));
183
+ function F(e, t) {
184
+ e.selected = t, e.children && e.children.length > 0 && e.children.forEach((l) => F(l, t));
185
185
  }
186
186
  const ye = (e) => {
187
- const t = r.value.map((l) => (V(l, e), l));
188
- return r.value = [...t], ee(), i.value = e ? [...Object.values(C.value).flat()] : [], R(), [...i.value];
187
+ const t = r.value.map((l) => (F(l, e), l));
188
+ return r.value = [...t], Z(), i.value = e ? [...Object.values(C.value).flat()] : [], R(), [...i.value];
189
189
  }, be = () => {
190
190
  g.value.unshift({
191
191
  key: "selection",
192
192
  width: 50,
193
193
  cellRenderer: (e) => {
194
194
  const { rowData: t } = e, a = t.children && t.children.length > 0 ? xe(t) : !1;
195
- return H(X, {
195
+ return H(Q, {
196
196
  value: t.selected,
197
197
  intermediate: a,
198
198
  onChange: (s) => Se(t, s)
@@ -200,10 +200,10 @@ import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col"
200
200
  },
201
201
  headerCellRenderer: () => {
202
202
  const e = p(r), t = e.every((a) => {
203
- const s = a.selected, o = le(a);
203
+ const s = a.selected, o = te(a);
204
204
  return s && o;
205
- }), l = e.some((a) => a.selected || ae(a));
206
- return H(X, {
205
+ }), l = e.some((a) => a.selected || le(a));
206
+ return H(Q, {
207
207
  value: t,
208
208
  intermediate: l && !t,
209
209
  // 目前是当前页全选就是全选状态,也就是每页的全选状态单独的
@@ -217,28 +217,28 @@ import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col"
217
217
  const t = e.children.filter((l) => l.selected).length;
218
218
  return t > 0 && t < e.children.length;
219
219
  };
220
+ function te(e) {
221
+ return e.children?.length ? !!e.selected && e.children.every(te) : !!e.selected;
222
+ }
220
223
  function le(e) {
221
- return e.children?.length ? !!e.selected && e.children.every(le) : !!e.selected;
224
+ return e.selected ? !0 : e.children?.some(le) || !1;
222
225
  }
223
226
  function ae(e) {
224
- return e.selected ? !0 : e.children?.some(ae) || !1;
225
- }
226
- function ne(e) {
227
227
  return e.map((t) => {
228
228
  const l = { ...t, selected: !1 };
229
- return l.children && (l.children = ne(l.children)), l;
229
+ return l.children && (l.children = ae(l.children)), l;
230
230
  });
231
231
  }
232
232
  const B = v(!1), Ce = () => {
233
233
  B.value = !0, be();
234
- }, _ = () => {
235
- B.value = !1, i.value = [], r.value = r.value.map((e) => (V(e, !1), e)), C.value = {}, x.value = ne(x.value), g.value.shift(), R();
234
+ }, V = () => {
235
+ B.value = !1, i.value = [], r.value = r.value.map((e) => (F(e, !1), e)), C.value = {}, x.value = ae(x.value), g.value.shift(), R();
236
236
  }, we = () => {
237
237
  b("handleBatchDelete", {
238
238
  selectedRows: Object.values(C.value).flat(),
239
239
  // getAllSelectedNodes(finalTableData.value)
240
240
  cb: () => {
241
- _(), R();
241
+ V(), R();
242
242
  }
243
243
  });
244
244
  }, Be = () => {
@@ -259,24 +259,24 @@ import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col"
259
259
  ...u.params,
260
260
  ...d.value
261
261
  }).then((e) => {
262
- x.value = $(
262
+ x.value = L(
263
263
  e?.data[u.tableDataKey],
264
264
  d.value[h.value],
265
- Q.value
266
- ) || [], K.value = e?.data?.total;
267
- }) : (x.value = $(
265
+ J.value
266
+ ) || [], q.value = e?.data?.total;
267
+ }) : (x.value = L(
268
268
  u.tableData,
269
269
  d.value[h.value],
270
- Q.value
271
- ), K.value = u.total);
270
+ J.value
271
+ ), q.value = u.total);
272
272
  };
273
- function $(e, t, l, a = !1) {
273
+ function L(e, t, l, a = !1) {
274
274
  return e.map((s) => {
275
275
  const o = l.has(s.id) || a, f = {
276
276
  ...s,
277
277
  selected: o
278
278
  };
279
- return f.children && (f.children = $(
279
+ return f.children && (f.children = L(
280
280
  f.children,
281
281
  t,
282
282
  l,
@@ -286,116 +286,116 @@ import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col"
286
286
  });
287
287
  }
288
288
  const Re = () => {
289
- d.value[h.value] = F[h.value], T();
289
+ d.value[h.value] = $[h.value], T();
290
290
  }, Te = () => {
291
- d.value = { ...F }, T();
292
- }, se = (e) => {
293
- e === "size" && (d.value[h.value] = 1), T(), b(fe.paginationChange, d.value);
294
- }, P = v(0), A = () => {
295
- let e = P.value, t = $e(u.columns);
291
+ d.value = { ...$ }, T();
292
+ }, ne = (e) => {
293
+ e === "size" && (d.value[h.value] = 1), T(), b(ce.paginationChange, d.value);
294
+ }, P = v(0), N = () => {
295
+ let e = P.value, t = Me(u.columns);
296
296
  const l = 1 / Ve(), a = t.filter((n) => n.fixedWidth), s = t.filter((n) => !n.fixedWidth);
297
297
  let o = 0;
298
298
  a.forEach((n) => {
299
299
  n.width && (o += n.width);
300
300
  });
301
- let f = e - o, L = 0;
301
+ let f = e - o, M = 0;
302
302
  s.forEach((n) => {
303
- n.width && (L += n.width);
303
+ n.width && (M += n.width);
304
304
  });
305
- const ue = [];
306
- if (t.forEach((n, W) => {
307
- let D;
305
+ const ie = [];
306
+ if (t.forEach((n, A) => {
307
+ let W;
308
308
  if (n.fixedWidth)
309
- D = n.width || 100;
310
- else if (n.width && L > 0) {
311
- const I = n.width / L, M = f * I;
312
- D = Math.max(M, n.width);
309
+ W = n.width || 100;
310
+ else if (n.width && M > 0) {
311
+ const D = n.width / M, _ = f * D;
312
+ W = Math.max(_, n.width);
313
313
  } else {
314
- const I = s.filter((M) => !M.width);
315
- D = I.length > 0 ? f / I.length : f / s.length;
314
+ const D = s.filter((_) => !_.width);
315
+ W = D.length > 0 ? f / D.length : f / s.length;
316
316
  }
317
- ue.push(D);
318
- }), t = t.map((n, W) => (n.width = ue[W] * l, w.value && Object.keys(w.value).length && w.value[n.key] && (n.sortable = !0), n)), B.value) {
319
- const n = g.value.find((W) => W.key === "selection");
317
+ ie.push(W);
318
+ }), t = t.map((n, A) => (n.width = ie[A] * l, w.value && Object.keys(w.value).length && w.value[n.key] && (n.sortable = !0), n)), B.value) {
319
+ const n = g.value.find((A) => A.key === "selection");
320
320
  n && (g.value = [n, ...t]);
321
321
  } else
322
322
  g.value = [...t];
323
323
  };
324
- oe(
324
+ ue(
325
325
  () => B.value,
326
326
  () => {
327
- A();
327
+ N();
328
328
  }
329
- ), oe(
329
+ ), ue(
330
330
  () => u.tableDomWidth,
331
331
  (e) => {
332
- e && (P.value = e, A());
332
+ e && (P.value = e, N());
333
333
  }
334
334
  );
335
- const ie = () => {
336
- P.value = document.querySelector(".TABLE-AREA").getBoundingClientRect().width, A();
335
+ const se = () => {
336
+ P.value = document.querySelector(".TABLE-AREA").getBoundingClientRect().width, N();
337
337
  };
338
338
  return ze(() => {
339
- T(), g.value = u.columns, P.value = document.querySelector(".TABLE-AREA").getBoundingClientRect().width, Ne(() => {
340
- A();
341
- }), window.addEventListener("resize", ie);
342
- }), he({
339
+ T(), g.value = u.columns, P.value = document.querySelector(".TABLE-AREA").getBoundingClientRect().width, Pe(() => {
340
+ N();
341
+ }), window.addEventListener("resize", se);
342
+ }), fe({
343
343
  getTableList: T,
344
344
  search: Re,
345
345
  reset: Te,
346
346
  initBatchSelect: Be,
347
- handleCancelSelect: _,
348
- handleResize: ie
349
- }), (e, t) => (S(), E("div", Me, [
350
- y("div", Ue, [
351
- p(q)["filter-left"] ? (S(), E("div", He, [
352
- j(e.$slots, "filter-left", {}, void 0, !0)
347
+ handleCancelSelect: V,
348
+ handleResize: se
349
+ }), (e, t) => (S(), E("div", Ue, [
350
+ y("div", He, [
351
+ p(O)["filter-left"] ? (S(), E("div", Ge, [
352
+ I(e.$slots, "filter-left", {}, void 0, !0)
353
353
  ])) : k("", !0),
354
- y("div", Ge, [
355
- c.hasBatchSelect && r.value.length ? (S(), E(Pe, { key: 0 }, [
356
- B.value ? (S(), E("div", Je, [
357
- y("div", Qe, "已选" + Ae(i.value.length) + "条数据", 1),
354
+ y("div", Je, [
355
+ c.hasBatchSelect && r.value.length ? (S(), E(Ne, { key: 0 }, [
356
+ B.value ? (S(), E("div", Qe, [
357
+ y("div", Xe, "已选" + Ae(i.value.length) + "条数据", 1),
358
358
  y("div", {
359
359
  class: "fz-12 text-3b64ff mg-l-4 pointer",
360
- onClick: _
360
+ onClick: V
361
361
  }, "取消选择"),
362
- j(e.$slots, "btn-group", {}, () => [
363
- y("div", Xe, [
364
- U(p(ce), {
362
+ I(e.$slots, "btn-group", {}, () => [
363
+ y("div", Ye, [
364
+ U(p(re), {
365
365
  type: "danger",
366
366
  onClick: we,
367
367
  disabled: !i.value.length
368
368
  }, {
369
- default: O(() => [...t[6] || (t[6] = [
370
- re(" 删除 ", -1)
369
+ default: j(() => [...t[6] || (t[6] = [
370
+ de(" 删除 ", -1)
371
371
  ])]),
372
372
  _: 1
373
373
  }, 8, ["disabled"])
374
374
  ])
375
375
  ], !0)
376
- ])) : (S(), de(p(ce), {
376
+ ])) : (S(), oe(p(re), {
377
377
  key: 0,
378
378
  disabled: c.disableBatchSelect,
379
379
  title: c.disableBatchSelect ? c.disableBatchSelectText : "",
380
380
  type: "default",
381
381
  onClick: Ce
382
382
  }, {
383
- default: O(() => [...t[5] || (t[5] = [
384
- re(" 批量选择 ", -1)
383
+ default: j(() => [...t[5] || (t[5] = [
384
+ de(" 批量选择 ", -1)
385
385
  ])]),
386
386
  _: 1
387
387
  }, 8, ["disabled", "title"]))
388
388
  ], 64)) : k("", !0),
389
- p(q)["filter-right"] ? j(e.$slots, "filter-right", { key: 1 }, void 0, !0) : k("", !0)
389
+ p(O)["filter-right"] ? I(e.$slots, "filter-right", { key: 1 }, void 0, !0) : k("", !0)
390
390
  ])
391
391
  ]),
392
- y("div", Ye, [
393
- y("div", Ze, [
394
- U(p(Oe), null, {
395
- default: O(({ width: l, height: a }) => [
396
- U(p(qe), {
397
- "expanded-row-keys": J.value,
398
- "onUpdate:expandedRowKeys": t[0] || (t[0] = (s) => J.value = s),
392
+ y("div", Ze, [
393
+ y("div", et, [
394
+ U(p(qe), null, {
395
+ default: j(({ width: l, height: a }) => [
396
+ U(p(Ke), {
397
+ "expanded-row-keys": G.value,
398
+ "onUpdate:expandedRowKeys": t[0] || (t[0] = (s) => G.value = s),
399
399
  "expand-column-key": c.expandColumnKey,
400
400
  columns: g.value,
401
401
  data: r.value,
@@ -406,10 +406,10 @@ import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col"
406
406
  onEndReached: ge,
407
407
  onColumnSort: pe
408
408
  }, We({ _: 2 }, [
409
- De(p(q), (s, o) => ({
409
+ De(p(O), (s, o) => ({
410
410
  name: o,
411
- fn: O((f) => [
412
- j(e.$slots, o, Ie(je(f)), void 0, !0)
411
+ fn: j((f) => [
412
+ I(e.$slots, o, Ie(je(f)), void 0, !0)
413
413
  ])
414
414
  }))
415
415
  ]), 1032, ["expanded-row-keys", "expand-column-key", "columns", "data", "width", "height", "sort-state"])
@@ -417,25 +417,26 @@ import './assets/PaginationTable.css';const Me = { class: "flex h-full flex-col"
417
417
  _: 3
418
418
  })
419
419
  ]),
420
- c.isPagination && G.value > d.value[N.value] ? (S(), E("div", et, [
421
- c.isPagination ? (S(), de(_e, {
420
+ c.isPagination ? (S(), E("div", tt, [
421
+ c.isPagination ? (S(), oe(Le, Oe({
422
422
  key: 0,
423
423
  "current-page": d.value[h.value],
424
424
  "onUpdate:currentPage": t[1] || (t[1] = (l) => d.value[h.value] = l),
425
- "page-size": d.value[N.value],
426
- "onUpdate:pageSize": t[2] || (t[2] = (l) => d.value[N.value] = l),
425
+ "page-size": d.value[K.value],
426
+ "onUpdate:pageSize": t[2] || (t[2] = (l) => d.value[K.value] = l),
427
427
  "page-sizes": c.pagination.pageSizes,
428
428
  layout: c.pagination.layout,
429
- total: G.value,
430
- onSizeChange: t[3] || (t[3] = (l) => se("size")),
431
- onCurrentChange: t[4] || (t[4] = (l) => se("page"))
432
- }, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total"])) : k("", !0)
429
+ total: ve.value
430
+ }, e.$attrs, {
431
+ onSizeChange: t[3] || (t[3] = (l) => ne("size")),
432
+ onCurrentChange: t[4] || (t[4] = (l) => ne("page"))
433
+ }), null, 16, ["current-page", "page-size", "page-sizes", "layout", "total"])) : k("", !0)
433
434
  ])) : k("", !0)
434
435
  ])
435
436
  ]));
436
437
  }
437
- }), lt = /* @__PURE__ */ Le(tt, [["__scopeId", "data-v-8b1b65e5"]]), rt = Ee(lt);
438
+ }), at = /* @__PURE__ */ _e(lt, [["__scopeId", "data-v-7c948317"]]), ct = Ee(at);
438
439
  export {
439
- rt as PaginationTable,
440
- rt as default
440
+ ct as PaginationTable,
441
+ ct as default
441
442
  };
@@ -1 +1 @@
1
- [data-v-8b1b65e5] .el-table-v2__header-cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1
+ [data-v-7c948317] .el-table-v2__header-cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/PaginationTable.css');const pe=require("./chunks/index.CkihWzK6.js"),l=require("vue"),B=require("element-plus"),V=require("color-star-custom-methods"),ge=require("./chunks/layout.DbtiD7D3.js"),me=require("lodash"),Se=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),ye={class:"flex h-full flex-col"},be={class:"w-full flex justify-between overflow-hidden",style:{height:"auto"}},Ce={key:0,class:"flex-1 overflow-hidden"},xe={class:"flex",style:{width:"auto",gap:"10px"}},Be={key:1,class:"flex items-center mg-b-18"},Ee={class:"fz-12 text-74798c"},ke={class:"btn-group mg-l-12"},we={class:"w-full flex-1 overflow-hidden flex flex-col"},Ne={class:"flex-1 overflow-hidden TABLE-AREA"},Te={key:0,class:"flex justify-end mg-t-20",style:{height:"auto"}},Re=Object.assign({name:"PaginationTable"},{__name:"layout",props:{isPagination:{type:Boolean,default:!0},disableBatchSelect:{type:Boolean,default:!1},disableBatchSelectText:{type:String,default:""},total:{type:Number,default:0},tableData:{type:Array,default:()=>[]},pagination:{type:Object,default:()=>V.paginationConfig},params:{type:Object,default:()=>{}},requestFn:{type:Function},columns:{type:Array,default:()=>[]},hasBatchSelect:{type:Boolean,default:!1},expandColumnKey:{type:String,default:""},tableDataKey:{type:String,default:"list"},tableDomWidth:{type:Number,default:0},pageMapping:{type:Object,default:()=>({pageSize:"pageSize",pageNum:"pageNum"})},sortState:{type:Object,default:()=>{}}},emits:[V.emitsMap.paginationChange,"updateTableData","handleTableSelect","handleBatchDelete","updateSortState","endReached"],setup(f,{expose:te,emit:le}){const g=le,i=f,z=l.useSlots(),E=l.computed(()=>typeof i.requestFn=="function"),d=l.computed({get:()=>E.value?m.value:i.tableData,set:e=>{E.value?m.value=e:g("updateTableData",e)}}),A=l.ref(0),M=l.computed(()=>E.value?A.value:i.total),y=l.computed({get:()=>i.sortState,set:e=>{g("updateSortState",e)}}),ae=({key:e,order:t})=>{y.value[e]=t,d.value=d.value.reverse()},ne=e=>{g("endReached",e)},m=l.ref([]),v=l.computed(()=>i.pageMapping.pageNum),k=l.computed(()=>i.pageMapping.pageSize),q={[v.value]:1,[k.value]:20},c=l.ref({...q}),p=l.ref([]),s=l.ref([]),_=l.ref([]),S=l.ref({}),K=l.computed(()=>oe(S.value));function oe(e){const t=new Set;for(const a in e)e.hasOwnProperty(a)&&e[a].forEach(n=>{t.add(n.id)});return t}const F=({value:e,intermediate:t=!1,onChange:a})=>l.h(B.ElCheckbox,{onChange:a,modelValue:e,indeterminate:t}),ue=(e,t)=>{if(e.selected=t,t?s.value.some(a=>a.id===e.id)||s.value.push(e):s.value=s.value.filter(({id:a})=>a!==e.id),e.children&&e.children.length>0){const a=n=>{n.forEach(u=>{u.selected=t,t?s.value.some(r=>r.id===u.id)||s.value.push(u):s.value=s.value.filter(({id:r})=>r!==u.id),u.children&&u.children.length>0&&a(u.children)})};a(e.children)}e.parentId&&L(e.parentId),U(),C()},L=e=>{const t=$(d.value,e);if(!t)return;const a=t.children.every(n=>n.selected);a&&!t.selected?(t.selected=!0,s.value.some(n=>n.id===t.id)||s.value.push(t)):!a&&t.selected&&(t.selected=!1,s.value=s.value.filter(({id:n})=>n!==t.id)),t.parentId&&L(t.parentId)},$=(e,t)=>{for(const a of e){if(a.id===t)return a;if(a.children){const n=$(a.children,t);if(n)return n}}return null};function U(){S.value[c.value[v.value]]=H(d.value)}function H(e){let t=[];return e.forEach(a=>{a.selected&&t.push(a),a.children&&a.children.length>0&&(t=t.concat(H(a.children)))}),t}function W(e,t){e.selected=t,e.children&&e.children.length>0&&e.children.forEach(a=>W(a,t))}const se=e=>{const t=d.value.map(a=>(W(a,e),a));return d.value=[...t],U(),s.value=e?[...Object.values(S.value).flat()]:[],C(),[...s.value]},ie=()=>{p.value.unshift({key:"selection",width:50,cellRenderer:e=>{const{rowData:t}=e,n=t.children&&t.children.length>0?re(t):!1;return l.h(F,{value:t.selected,intermediate:n,onChange:u=>ue(t,u)})},headerCellRenderer:()=>{const e=l.unref(d),t=e.every(n=>{const u=n.selected,r=G(n);return u&&r}),a=e.some(n=>n.selected||J(n));return l.h(F,{value:t,intermediate:a&&!t,onChange:se})}})},re=e=>{if(!e.children||e.children.length===0)return!1;const t=e.children.filter(a=>a.selected).length;return t>0&&t<e.children.length};function G(e){return e.children?.length?!!e.selected&&e.children.every(G):!!e.selected}function J(e){return e.selected?!0:e.children?.some(J)||!1}function Q(e){return e.map(t=>{const a={...t,selected:!1};return a.children&&(a.children=Q(a.children)),a})}const b=l.ref(!1),ce=()=>{b.value=!0,ie()},D=()=>{b.value=!1,s.value=[],d.value=d.value.map(e=>(W(e,!1),e)),S.value={},m.value=Q(m.value),p.value.shift(),C()},de=()=>{g("handleBatchDelete",{selectedRows:Object.values(S.value).flat(),cb:()=>{D(),C()}})},fe=()=>{s.value=[],C()};function C(){const e=Object.values(S.value).flat();g("handleTableSelect",{originNodeData:s.value,allSelectedNodes:e,selectedSubNodes:e.filter(t=>!t.children)})}const x=()=>{E.value?i.requestFn({...i.params,...c.value}).then(e=>{m.value=j(e?.data[i.tableDataKey],c.value[v.value],K.value)||[],A.value=e?.data?.total}):(m.value=j(i.tableData,c.value[v.value],K.value),A.value=i.total)};function j(e,t,a,n=!1){return e.map(u=>{const r=a.has(u.id)||n,h={...u,selected:r};return h.children&&(h.children=j(h.children,t,a,r)),h})}const he=()=>{c.value[v.value]=q[v.value],x()},ve=()=>{c.value={...q},x()},X=e=>{e==="size"&&(c.value[v.value]=1),x(),g(V.emitsMap.paginationChange,c.value)},w=l.ref(0),N=()=>{let e=w.value,t=me.cloneDeep(i.columns);const a=1/V.calculateScale(),n=t.filter(o=>o.fixedWidth),u=t.filter(o=>!o.fixedWidth);let r=0;n.forEach(o=>{o.width&&(r+=o.width)});let h=e-r,I=0;u.forEach(o=>{o.width&&(I+=o.width)});const Z=[];if(t.forEach((o,T)=>{let R;if(o.fixedWidth)R=o.width||100;else if(o.width&&I>0){const P=o.width/I,O=h*P;R=Math.max(O,o.width)}else{const P=u.filter(O=>!O.width);R=P.length>0?h/P.length:h/u.length}Z.push(R)}),t=t.map((o,T)=>(o.width=Z[T]*a,y.value&&Object.keys(y.value).length&&y.value[o.key]&&(o.sortable=!0),o)),b.value){const o=p.value.find(T=>T.key==="selection");o&&(p.value=[o,...t])}else p.value=[...t]};l.watch(()=>b.value,()=>{N()}),l.watch(()=>i.tableDomWidth,e=>{e&&(w.value=e,N())});const Y=()=>{w.value=document.querySelector(".TABLE-AREA").getBoundingClientRect().width,N()};return l.onMounted(()=>{x(),p.value=i.columns,w.value=document.querySelector(".TABLE-AREA").getBoundingClientRect().width,l.nextTick(()=>{N()}),window.addEventListener("resize",Y)}),te({getTableList:x,search:he,reset:ve,initBatchSelect:fe,handleCancelSelect:D,handleResize:Y}),(e,t)=>(l.openBlock(),l.createElementBlock("div",ye,[l.createElementVNode("div",be,[l.unref(z)["filter-left"]?(l.openBlock(),l.createElementBlock("div",Ce,[l.renderSlot(e.$slots,"filter-left",{},void 0,!0)])):l.createCommentVNode("",!0),l.createElementVNode("div",xe,[f.hasBatchSelect&&d.value.length?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[b.value?(l.openBlock(),l.createElementBlock("div",Be,[l.createElementVNode("div",Ee,"已选"+l.toDisplayString(s.value.length)+"条数据",1),l.createElementVNode("div",{class:"fz-12 text-3b64ff mg-l-4 pointer",onClick:D},"取消选择"),l.renderSlot(e.$slots,"btn-group",{},()=>[l.createElementVNode("div",ke,[l.createVNode(l.unref(B.ElButton),{type:"danger",onClick:de,disabled:!s.value.length},{default:l.withCtx(()=>[...t[6]||(t[6]=[l.createTextVNode(" 删除 ",-1)])]),_:1},8,["disabled"])])],!0)])):(l.openBlock(),l.createBlock(l.unref(B.ElButton),{key:0,disabled:f.disableBatchSelect,title:f.disableBatchSelect?f.disableBatchSelectText:"",type:"default",onClick:ce},{default:l.withCtx(()=>[...t[5]||(t[5]=[l.createTextVNode(" 批量选择 ",-1)])]),_:1},8,["disabled","title"]))],64)):l.createCommentVNode("",!0),l.unref(z)["filter-right"]?l.renderSlot(e.$slots,"filter-right",{key:1},void 0,!0):l.createCommentVNode("",!0)])]),l.createElementVNode("div",we,[l.createElementVNode("div",Ne,[l.createVNode(l.unref(B.ElAutoResizer),null,{default:l.withCtx(({width:a,height:n})=>[l.createVNode(l.unref(B.ElTableV2),{"expanded-row-keys":_.value,"onUpdate:expandedRowKeys":t[0]||(t[0]=u=>_.value=u),"expand-column-key":f.expandColumnKey,columns:p.value,data:d.value,width:a,height:n,fixed:"","sort-state":y.value,onEndReached:ne,onColumnSort:ae},l.createSlots({_:2},[l.renderList(l.unref(z),(u,r)=>({name:r,fn:l.withCtx(h=>[l.renderSlot(e.$slots,r,l.normalizeProps(l.guardReactiveProps(h)),void 0,!0)])}))]),1032,["expanded-row-keys","expand-column-key","columns","data","width","height","sort-state"])]),_:3})]),f.isPagination&&M.value>c.value[k.value]?(l.openBlock(),l.createElementBlock("div",Te,[f.isPagination?(l.openBlock(),l.createBlock(ge._sfc_main,{key:0,"current-page":c.value[v.value],"onUpdate:currentPage":t[1]||(t[1]=a=>c.value[v.value]=a),"page-size":c.value[k.value],"onUpdate:pageSize":t[2]||(t[2]=a=>c.value[k.value]=a),"page-sizes":f.pagination.pageSizes,layout:f.pagination.layout,total:M.value,onSizeChange:t[3]||(t[3]=a=>X("size")),onCurrentChange:t[4]||(t[4]=a=>X("page"))},null,8,["current-page","page-size","page-sizes","layout","total"])):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)])]))}}),Pe=Se._export_sfc(Re,[["__scopeId","data-v-8b1b65e5"]]),ee=pe.withInstall(Pe);exports.PaginationTable=ee;exports.default=ee;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/PaginationTable.css');const pe=require("./chunks/index.CkihWzK6.js"),t=require("vue"),B=require("element-plus"),P=require("color-star-custom-methods"),ge=require("./chunks/layout.DbtiD7D3.js"),me=require("lodash"),Se=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),ye={class:"flex h-full flex-col"},be={class:"w-full flex justify-between overflow-hidden",style:{height:"auto"}},Ce={key:0,class:"flex-1 overflow-hidden"},xe={class:"flex",style:{width:"auto",gap:"10px"}},Be={key:1,class:"flex items-center mg-b-18"},Ee={class:"fz-12 text-74798c"},ke={class:"btn-group mg-l-12"},we={class:"w-full flex-1 overflow-hidden flex flex-col"},Ne={class:"flex-1 overflow-hidden TABLE-AREA"},Te={key:0,class:"flex justify-end mg-t-20",style:{height:"auto"}},Re=Object.assign({name:"PaginationTable"},{__name:"layout",props:{isPagination:{type:Boolean,default:!0},disableBatchSelect:{type:Boolean,default:!1},disableBatchSelectText:{type:String,default:""},total:{type:Number,default:0},tableData:{type:Array,default:()=>[]},pagination:{type:Object,default:()=>P.paginationConfig},params:{type:Object,default:()=>{}},requestFn:{type:Function},columns:{type:Array,default:()=>[]},hasBatchSelect:{type:Boolean,default:!1},expandColumnKey:{type:String,default:""},tableDataKey:{type:String,default:"list"},tableDomWidth:{type:Number,default:0},pageMapping:{type:Object,default:()=>({pageSize:"pageSize",pageNum:"pageNum"})},sortState:{type:Object,default:()=>{}}},emits:[P.emitsMap.paginationChange,"updateTableData","handleTableSelect","handleBatchDelete","updateSortState","endReached"],setup(f,{expose:ee,emit:te}){const g=te,i=f,V=t.useSlots(),E=t.computed(()=>typeof i.requestFn=="function"),d=t.computed({get:()=>E.value?m.value:i.tableData,set:e=>{E.value?m.value=e:g("updateTableData",e)}}),z=t.ref(0),le=t.computed(()=>E.value?z.value:i.total),y=t.computed({get:()=>i.sortState,set:e=>{g("updateSortState",e)}}),ae=({key:e,order:l})=>{y.value[e]=l,d.value=d.value.reverse()},ne=e=>{g("endReached",e)},m=t.ref([]),v=t.computed(()=>i.pageMapping.pageNum),A=t.computed(()=>i.pageMapping.pageSize),q={[v.value]:1,[A.value]:20},c=t.ref({...q}),p=t.ref([]),u=t.ref([]),M=t.ref([]),S=t.ref({}),K=t.computed(()=>oe(S.value));function oe(e){const l=new Set;for(const a in e)e.hasOwnProperty(a)&&e[a].forEach(n=>{l.add(n.id)});return l}const _=({value:e,intermediate:l=!1,onChange:a})=>t.h(B.ElCheckbox,{onChange:a,modelValue:e,indeterminate:l}),se=(e,l)=>{if(e.selected=l,l?u.value.some(a=>a.id===e.id)||u.value.push(e):u.value=u.value.filter(({id:a})=>a!==e.id),e.children&&e.children.length>0){const a=n=>{n.forEach(s=>{s.selected=l,l?u.value.some(r=>r.id===s.id)||u.value.push(s):u.value=u.value.filter(({id:r})=>r!==s.id),s.children&&s.children.length>0&&a(s.children)})};a(e.children)}e.parentId&&F(e.parentId),L(),C()},F=e=>{const l=$(d.value,e);if(!l)return;const a=l.children.every(n=>n.selected);a&&!l.selected?(l.selected=!0,u.value.some(n=>n.id===l.id)||u.value.push(l)):!a&&l.selected&&(l.selected=!1,u.value=u.value.filter(({id:n})=>n!==l.id)),l.parentId&&F(l.parentId)},$=(e,l)=>{for(const a of e){if(a.id===l)return a;if(a.children){const n=$(a.children,l);if(n)return n}}return null};function L(){S.value[c.value[v.value]]=U(d.value)}function U(e){let l=[];return e.forEach(a=>{a.selected&&l.push(a),a.children&&a.children.length>0&&(l=l.concat(U(a.children)))}),l}function W(e,l){e.selected=l,e.children&&e.children.length>0&&e.children.forEach(a=>W(a,l))}const ue=e=>{const l=d.value.map(a=>(W(a,e),a));return d.value=[...l],L(),u.value=e?[...Object.values(S.value).flat()]:[],C(),[...u.value]},ie=()=>{p.value.unshift({key:"selection",width:50,cellRenderer:e=>{const{rowData:l}=e,n=l.children&&l.children.length>0?re(l):!1;return t.h(_,{value:l.selected,intermediate:n,onChange:s=>se(l,s)})},headerCellRenderer:()=>{const e=t.unref(d),l=e.every(n=>{const s=n.selected,r=H(n);return s&&r}),a=e.some(n=>n.selected||G(n));return t.h(_,{value:l,intermediate:a&&!l,onChange:ue})}})},re=e=>{if(!e.children||e.children.length===0)return!1;const l=e.children.filter(a=>a.selected).length;return l>0&&l<e.children.length};function H(e){return e.children?.length?!!e.selected&&e.children.every(H):!!e.selected}function G(e){return e.selected?!0:e.children?.some(G)||!1}function J(e){return e.map(l=>{const a={...l,selected:!1};return a.children&&(a.children=J(a.children)),a})}const b=t.ref(!1),ce=()=>{b.value=!0,ie()},D=()=>{b.value=!1,u.value=[],d.value=d.value.map(e=>(W(e,!1),e)),S.value={},m.value=J(m.value),p.value.shift(),C()},de=()=>{g("handleBatchDelete",{selectedRows:Object.values(S.value).flat(),cb:()=>{D(),C()}})},fe=()=>{u.value=[],C()};function C(){const e=Object.values(S.value).flat();g("handleTableSelect",{originNodeData:u.value,allSelectedNodes:e,selectedSubNodes:e.filter(l=>!l.children)})}const x=()=>{E.value?i.requestFn({...i.params,...c.value}).then(e=>{m.value=j(e?.data[i.tableDataKey],c.value[v.value],K.value)||[],z.value=e?.data?.total}):(m.value=j(i.tableData,c.value[v.value],K.value),z.value=i.total)};function j(e,l,a,n=!1){return e.map(s=>{const r=a.has(s.id)||n,h={...s,selected:r};return h.children&&(h.children=j(h.children,l,a,r)),h})}const he=()=>{c.value[v.value]=q[v.value],x()},ve=()=>{c.value={...q},x()},Q=e=>{e==="size"&&(c.value[v.value]=1),x(),g(P.emitsMap.paginationChange,c.value)},k=t.ref(0),w=()=>{let e=k.value,l=me.cloneDeep(i.columns);const a=1/P.calculateScale(),n=l.filter(o=>o.fixedWidth),s=l.filter(o=>!o.fixedWidth);let r=0;n.forEach(o=>{o.width&&(r+=o.width)});let h=e-r,I=0;s.forEach(o=>{o.width&&(I+=o.width)});const Y=[];if(l.forEach((o,N)=>{let T;if(o.fixedWidth)T=o.width||100;else if(o.width&&I>0){const R=o.width/I,O=h*R;T=Math.max(O,o.width)}else{const R=s.filter(O=>!O.width);T=R.length>0?h/R.length:h/s.length}Y.push(T)}),l=l.map((o,N)=>(o.width=Y[N]*a,y.value&&Object.keys(y.value).length&&y.value[o.key]&&(o.sortable=!0),o)),b.value){const o=p.value.find(N=>N.key==="selection");o&&(p.value=[o,...l])}else p.value=[...l]};t.watch(()=>b.value,()=>{w()}),t.watch(()=>i.tableDomWidth,e=>{e&&(k.value=e,w())});const X=()=>{k.value=document.querySelector(".TABLE-AREA").getBoundingClientRect().width,w()};return t.onMounted(()=>{x(),p.value=i.columns,k.value=document.querySelector(".TABLE-AREA").getBoundingClientRect().width,t.nextTick(()=>{w()}),window.addEventListener("resize",X)}),ee({getTableList:x,search:he,reset:ve,initBatchSelect:fe,handleCancelSelect:D,handleResize:X}),(e,l)=>(t.openBlock(),t.createElementBlock("div",ye,[t.createElementVNode("div",be,[t.unref(V)["filter-left"]?(t.openBlock(),t.createElementBlock("div",Ce,[t.renderSlot(e.$slots,"filter-left",{},void 0,!0)])):t.createCommentVNode("",!0),t.createElementVNode("div",xe,[f.hasBatchSelect&&d.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[b.value?(t.openBlock(),t.createElementBlock("div",Be,[t.createElementVNode("div",Ee,"已选"+t.toDisplayString(u.value.length)+"条数据",1),t.createElementVNode("div",{class:"fz-12 text-3b64ff mg-l-4 pointer",onClick:D},"取消选择"),t.renderSlot(e.$slots,"btn-group",{},()=>[t.createElementVNode("div",ke,[t.createVNode(t.unref(B.ElButton),{type:"danger",onClick:de,disabled:!u.value.length},{default:t.withCtx(()=>[...l[6]||(l[6]=[t.createTextVNode(" 删除 ",-1)])]),_:1},8,["disabled"])])],!0)])):(t.openBlock(),t.createBlock(t.unref(B.ElButton),{key:0,disabled:f.disableBatchSelect,title:f.disableBatchSelect?f.disableBatchSelectText:"",type:"default",onClick:ce},{default:t.withCtx(()=>[...l[5]||(l[5]=[t.createTextVNode(" 批量选择 ",-1)])]),_:1},8,["disabled","title"]))],64)):t.createCommentVNode("",!0),t.unref(V)["filter-right"]?t.renderSlot(e.$slots,"filter-right",{key:1},void 0,!0):t.createCommentVNode("",!0)])]),t.createElementVNode("div",we,[t.createElementVNode("div",Ne,[t.createVNode(t.unref(B.ElAutoResizer),null,{default:t.withCtx(({width:a,height:n})=>[t.createVNode(t.unref(B.ElTableV2),{"expanded-row-keys":M.value,"onUpdate:expandedRowKeys":l[0]||(l[0]=s=>M.value=s),"expand-column-key":f.expandColumnKey,columns:p.value,data:d.value,width:a,height:n,fixed:"","sort-state":y.value,onEndReached:ne,onColumnSort:ae},t.createSlots({_:2},[t.renderList(t.unref(V),(s,r)=>({name:r,fn:t.withCtx(h=>[t.renderSlot(e.$slots,r,t.normalizeProps(t.guardReactiveProps(h)),void 0,!0)])}))]),1032,["expanded-row-keys","expand-column-key","columns","data","width","height","sort-state"])]),_:3})]),f.isPagination?(t.openBlock(),t.createElementBlock("div",Te,[f.isPagination?(t.openBlock(),t.createBlock(ge._sfc_main,t.mergeProps({key:0,"current-page":c.value[v.value],"onUpdate:currentPage":l[1]||(l[1]=a=>c.value[v.value]=a),"page-size":c.value[A.value],"onUpdate:pageSize":l[2]||(l[2]=a=>c.value[A.value]=a),"page-sizes":f.pagination.pageSizes,layout:f.pagination.layout,total:le.value},e.$attrs,{onSizeChange:l[3]||(l[3]=a=>Q("size")),onCurrentChange:l[4]||(l[4]=a=>Q("page"))}),null,16,["current-page","page-size","page-sizes","layout","total"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])]))}}),Pe=Se._export_sfc(Re,[["__scopeId","data-v-7c948317"]]),Z=pe.withInstall(Pe);exports.PaginationTable=Z;exports.default=Z;
@@ -1 +1 @@
1
- [data-v-8b1b65e5] .el-table-v2__header-cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1
+ [data-v-7c948317] .el-table-v2__header-cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ling-yun-custom-components",
3
- "version": "0.0.76",
3
+ "version": "0.0.77",
4
4
  "keywords": [
5
5
  "component library",
6
6
  "ui framework",