@web-utils/component 4.0.1 → 4.0.2

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,70 @@
1
+ import { t as u, a as l } from "./core.DJEgjQW6.mjs";
2
+ import { g as h } from "./configComponents.BDhlZU8F.mjs";
3
+ const d = {}, D = {}, $ = {}, T = (t, c = !0, { options: o, treeDict: n, idAsValue: i, labelAsValue: r } = {}) => {
4
+ let e = t;
5
+ n && (e = `${t}-${i}-${r}${o ? "-options" : ""}`);
6
+ const a = d[e];
7
+ return c && a ? a : n ? C(t, c, { idAsValue: i, labelAsValue: r }) : w(t, c);
8
+ }, w = (t, c = !0) => {
9
+ if ($[t])
10
+ return $[t];
11
+ const o = new Promise((n, i) => {
12
+ var r, e;
13
+ c && d[t] ? n(d[t]) : ((e = (r = h) == null ? void 0 : r.dict) != null && e.remote && n([]), h.dict.remote(t).then((a) => {
14
+ let s = a.data.data;
15
+ if (c) {
16
+ const f = {};
17
+ s.forEach(({ label: g, value: m }) => {
18
+ f[m] = Object.freeze({ label: g, value: m });
19
+ }), D[t] = f, s = Object.freeze(s), d[t] = s;
20
+ }
21
+ $[t] = null, n(s);
22
+ }).catch((a) => {
23
+ $[t] = null, i(a);
24
+ }));
25
+ });
26
+ return $[t] = o, o;
27
+ }, C = (t, c = !0, { idAsValue: o, labelAsValue: n } = {}) => {
28
+ const i = `${t}-${o}-${n}`;
29
+ if ($[i])
30
+ return $[i];
31
+ const r = new Promise((e, a) => {
32
+ var s, f;
33
+ c && d[i] ? e(d[i]) : ((f = (s = h) == null ? void 0 : s.dict) != null && f.getDictTreeByType && e([]), h.dict.getDictTreeByType(t, { idAsValue: o, labelAsValue: n }).then((g) => {
34
+ const m = g.data.data;
35
+ c && (d[i] = m, d[`${i}-options`] = u(m), D[i] = l(m)), $[i] = null, e(m);
36
+ }).catch((g) => {
37
+ $[i] = null, a(g);
38
+ }));
39
+ });
40
+ return $[i] = r, r;
41
+ }, b = async (t, c, o = !0, { treeDict: n, idAsValue: i, labelAsValue: r } = {}) => {
42
+ let e = t;
43
+ n && (e = `${t}-${i}-${r}`);
44
+ const a = D[e];
45
+ let s;
46
+ if (o && a)
47
+ s = a[c];
48
+ else {
49
+ let f = await T(t, o, { treeDict: n, idAsValue: i, labelAsValue: r });
50
+ if (o)
51
+ s = D[e][c];
52
+ else {
53
+ n && (f = u(f));
54
+ for (let g = 0; g < f.length; g++) {
55
+ const m = f[g];
56
+ if (m.value === c) {
57
+ s = m;
58
+ break;
59
+ }
60
+ }
61
+ }
62
+ }
63
+ return s;
64
+ }, j = async (t, c, o = !0, { treeDict: n, idAsValue: i, labelAsValue: r } = {}) => {
65
+ var e;
66
+ return ((e = await b(t, c, o, { treeDict: n, idAsValue: i, labelAsValue: r })) == null ? void 0 : e.label) || c || "";
67
+ };
68
+ export {
69
+ j as g
70
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@web-utils/component",
3
3
  "description": "Web Components",
4
- "version": "4.0.1",
4
+ "version": "4.0.2",
5
5
  "author": "Simple",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -1,85 +1,120 @@
1
- import { copy as T, hasOwn as w } from "@web-utils/core";
2
- import y from "element-ui/lib/message";
3
- import { merge as m } from "@web-utils/integrations/lodash";
4
- import { f as S, g as $, h as _ } from "../chunks/index.d3MV3Wq2.mjs";
5
- import { t as C, a as x } from "../chunks/core.DJEgjQW6.mjs";
6
- import { g } from "../chunks/configComponents.BDhlZU8F.mjs";
7
- import k from "../table-column-filterable/index.mjs";
8
- import E from "../table-column-filter/index.mjs";
9
- import { isEqual as R } from "lodash-es";
10
- import { n as P } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
11
- function B(t) {
12
- T(
1
+ import { copy as R, hasOwn as v } from "@web-utils/core";
2
+ import S from "element-ui/lib/message";
3
+ import { merge as f } from "@web-utils/integrations/lodash";
4
+ import { f as _, g as P, h as B } from "../chunks/index.d3MV3Wq2.mjs";
5
+ import { g as A } from "../chunks/dictionary.DsN-2ukC.mjs";
6
+ import { _ as C } from "../chunks/helper.BiMLcEEk.mjs";
7
+ import "vue";
8
+ import { n as b } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
9
+ import { isEqual as K } from "lodash-es";
10
+ function L(t) {
11
+ R(
13
12
  t,
14
- () => y.success({ duration: 1e3, message: "复制成功!", type: "success" }),
15
- () => y.error({ duration: 1e3, message: "复制失败!", type: "error" })
13
+ () => S.success({ duration: 1e3, message: "复制成功!", type: "success" }),
14
+ () => S.error({ duration: 1e3, message: "复制失败!", type: "error" })
16
15
  );
17
16
  }
18
- const u = {}, b = {}, h = {}, K = (t, e = !0, { options: s, treeDict: a, idAsValue: l, labelAsValue: i } = {}) => {
19
- let o = t;
20
- a && (o = `${t}-${l}-${i}${s ? "-options" : ""}`);
21
- const n = u[o];
22
- return e && n ? n : a ? D(t, e, { idAsValue: l, labelAsValue: i }) : L(t, e);
23
- }, L = (t, e = !0) => {
24
- if (h[t])
25
- return h[t];
26
- const s = new Promise((a, l) => {
27
- var i, o;
28
- e && u[t] ? a(u[t]) : ((o = (i = g) == null ? void 0 : i.dict) != null && o.remote && a([]), g.dict.remote(t).then((n) => {
29
- let r = n.data.data;
30
- if (e) {
31
- const p = {};
32
- r.forEach(({ label: c, value: d }) => {
33
- p[d] = Object.freeze({ label: c, value: d });
34
- }), b[t] = p, r = Object.freeze(r), u[t] = r;
35
- }
36
- h[t] = null, a(r);
37
- }).catch((n) => {
38
- h[t] = null, l(n);
39
- }));
40
- });
41
- return h[t] = s, s;
42
- }, D = (t, e = !0, { idAsValue: s, labelAsValue: a } = {}) => {
43
- const l = `${t}-${s}-${a}`;
44
- if (h[l])
45
- return h[l];
46
- const i = new Promise((o, n) => {
47
- var r, p;
48
- e && u[l] ? o(u[l]) : ((p = (r = g) == null ? void 0 : r.dict) != null && p.getDictTreeByType && o([]), g.dict.getDictTreeByType(t, { idAsValue: s, labelAsValue: a }).then((c) => {
49
- const d = c.data.data;
50
- e && (u[l] = d, u[`${l}-options`] = C(d), b[l] = x(d)), h[l] = null, o(d);
51
- }).catch((c) => {
52
- h[l] = null, n(c);
53
- }));
54
- });
55
- return h[l] = i, i;
56
- }, O = async (t, e, s = !0, { treeDict: a, idAsValue: l, labelAsValue: i } = {}) => {
57
- let o = t;
58
- a && (o = `${t}-${l}-${i}`);
59
- const n = b[o];
60
- let r;
61
- if (s && n)
62
- r = n[e];
63
- else {
64
- let p = await K(t, s, { treeDict: a, idAsValue: l, labelAsValue: i });
65
- if (s)
66
- r = b[o][e];
67
- else {
68
- a && (p = C(p));
69
- for (let c = 0; c < p.length; c++) {
70
- const d = p[c];
71
- if (d.value === e) {
72
- r = d;
73
- break;
74
- }
17
+ const F = {
18
+ name: "TableColumnFilterable",
19
+ functional: !0,
20
+ /**
21
+ *
22
+ * @param h
23
+ * @param context {FunctionalContext}
24
+ * @returns {JSX.Element}
25
+ */
26
+ render(t, e) {
27
+ const {
28
+ data: {
29
+ key: s
30
+ },
31
+ props: l,
32
+ parent: {
33
+ records: i
34
+ },
35
+ scopedSlots: a
36
+ } = e, {
37
+ hide: o,
38
+ isVNode: n,
39
+ filterable: r,
40
+ allowSort: g,
41
+ autoUpdate: d,
42
+ scopedSlots: T,
43
+ prop: m,
44
+ ...x
45
+ } = l, y = `${s}-${r}${d ? `-${Math.random()}`.replace("0.", "") : ""}`, u = {
46
+ props: {
47
+ prop: m,
48
+ ...x
75
49
  }
50
+ };
51
+ if (r) {
52
+ const $ = [...new Set(i.map((c) => c[m]).filter((c) => c))].map((c) => ({
53
+ text: c,
54
+ value: c
55
+ }));
56
+ u.props.filterMethod = (c, w, k) => {
57
+ const E = k.property;
58
+ return w[E] === c;
59
+ }, u.props.filters = $;
76
60
  }
61
+ const h = T || a;
62
+ return h != null && h.default ? t("ElTableColumn", C([{}, u, {
63
+ scopedSlots: h,
64
+ key: y
65
+ }])) : t("TableColumn", C([{}, u, {
66
+ key: y
67
+ }]));
68
+ }
69
+ }, z = null, O = null;
70
+ var W = /* @__PURE__ */ b(
71
+ F,
72
+ z,
73
+ O,
74
+ !1,
75
+ null,
76
+ null
77
+ );
78
+ const V = W.exports, D = {
79
+ name: "TableColumnFilter",
80
+ props: {
81
+ columns: {
82
+ type: Array,
83
+ default: () => []
84
+ },
85
+ visible: Boolean
77
86
  }
78
- return r;
79
- }, z = async (t, e, s = !0, { treeDict: a, idAsValue: l, labelAsValue: i } = {}) => {
80
- var o;
81
- return ((o = await O(t, e, s, { treeDict: a, idAsValue: l, labelAsValue: i })) == null ? void 0 : o.label) || e || "";
82
- }, W = {
87
+ };
88
+ var M = function() {
89
+ var e = this, s = e._self._c;
90
+ return s("ElDrawer", { staticClass: "table-column-filter", attrs: { visible: e.visible, title: "表格设置", "append-to-body": "" }, on: { "update:visible": (l) => e.$emit("update:visible", l) } }, [s("ElTable", { attrs: { data: e.columns, border: "" } }, [s("ElTableColumn", { attrs: { label: "列名" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
91
+ return [e._v(" " + e._s(l.label) + " ")];
92
+ } }]) }), s("ElTableColumn", { attrs: { label: "隐藏", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
93
+ return [s("ElCheckbox", { model: { value: l.hide, callback: function(i) {
94
+ e.$set(l, "hide", i);
95
+ }, expression: "row.hide" } })];
96
+ } }]) }), s("ElTableColumn", { attrs: { label: "冻结", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
97
+ return [s("ElCheckbox", { model: { value: l.fixed, callback: function(i) {
98
+ e.$set(l, "fixed", i);
99
+ }, expression: "row.fixed" } })];
100
+ } }]) }), s("ElTableColumn", { attrs: { label: "过滤", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
101
+ return [s("ElCheckbox", { model: { value: l.filterable, callback: function(i) {
102
+ e.$set(l, "filterable", i);
103
+ }, expression: "row.filterable" } })];
104
+ } }]) }), s("ElTableColumn", { attrs: { label: "排序", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
105
+ return [s("ElCheckbox", { attrs: { title: l.allowSort ? null : "该列不支持排序!", disabled: !l.allowSort }, model: { value: l.sortable, callback: function(i) {
106
+ e.$set(l, "sortable", i);
107
+ }, expression: "row.sortable" } })];
108
+ } }]) })], 1)], 1);
109
+ }, U = [], N = /* @__PURE__ */ b(
110
+ D,
111
+ M,
112
+ U,
113
+ !1,
114
+ null,
115
+ null
116
+ );
117
+ const H = N.exports, j = {
83
118
  props: {
84
119
  useVisibilityChange: Boolean
85
120
  },
@@ -96,32 +131,32 @@ const u = {}, b = {}, h = {}, K = (t, e = !0, { options: s, treeDict: a, idAsVal
96
131
  }
97
132
  }
98
133
  };
99
- function A(t, e) {
100
- const s = t.map((l) => {
101
- const { hide: i, filterable: o, allowSort: n, sortable: r, fixed: p, ...c } = l;
102
- return c;
103
- }), a = e.map((l) => {
104
- const { hide: i, filterable: o, allowSort: n, sortable: r, fixed: p, ...c } = l;
105
- return c;
134
+ function Q(t, e) {
135
+ const s = t.map((i) => {
136
+ const { hide: a, filterable: o, allowSort: n, sortable: r, fixed: g, ...d } = i;
137
+ return d;
138
+ }), l = e.map((i) => {
139
+ const { hide: a, filterable: o, allowSort: n, sortable: r, fixed: g, ...d } = i;
140
+ return d;
106
141
  });
107
- return R(s, a);
142
+ return K(s, l);
108
143
  }
109
- function F(t) {
144
+ function q(t) {
110
145
  let e = "";
111
146
  for (const s in t)
112
147
  e += `<TableColumn prop="${s}" label="${s}"/>
113
148
  `;
114
149
  return e;
115
150
  }
116
- const f = {
151
+ const p = {
117
152
  loading: 1,
118
153
  error: -1,
119
154
  empty: 2,
120
155
  success: 0
121
- }, M = {
156
+ }, I = {
122
157
  name: "PageableTable",
123
- components: { TableColumnFilter: E, TableColumnFilterable: k },
124
- mixins: [W],
158
+ components: { TableColumnFilter: H, TableColumnFilterable: V },
159
+ mixins: [j],
125
160
  emits: ["page-loaded", "row-dblclick"],
126
161
  bus: {
127
162
  reloadTableView(t) {
@@ -198,8 +233,8 @@ const f = {
198
233
  data() {
199
234
  const t = this.pageSize;
200
235
  return {
201
- TABLE_STATUS: Object.freeze(f),
202
- tableStatus: f.empty,
236
+ TABLE_STATUS: Object.freeze(p),
237
+ tableStatus: p.empty,
203
238
  records: [],
204
239
  currentRow: null,
205
240
  showSettings: !1,
@@ -226,11 +261,11 @@ const f = {
226
261
  return t.length > 3 ? 60 + (t.length - 3) * 10 : 60;
227
262
  },
228
263
  mergeAttrs() {
229
- return m({}, this.$attrs, { height: this.autoHeight ? null : "auto" });
264
+ return f({}, this.$attrs, { height: this.autoHeight ? null : "auto" });
230
265
  },
231
266
  headers() {
232
267
  var t;
233
- return ((t = this.columns) == null ? void 0 : t.map(S)) || [];
268
+ return ((t = this.columns) == null ? void 0 : t.map(_)) || [];
234
269
  }
235
270
  },
236
271
  watch: {
@@ -245,19 +280,19 @@ const f = {
245
280
  const e = [];
246
281
  let s = null;
247
282
  if (t) {
248
- const a = this.$slots.default, { columns: l } = t;
249
- a ? a.forEach((i) => {
250
- if (!i.isComment && i.data) {
251
- const { attrs: o, props: n, scopedSlots: r } = i.data;
252
- i.data.props = i.data.props || {}, i.data.props.type === "expand" ? s = {
283
+ const l = this.$slots.default, { columns: i } = t;
284
+ l ? l.forEach((a) => {
285
+ if (!a.isComment && a.data) {
286
+ const { attrs: o, props: n, scopedSlots: r } = a.data;
287
+ a.data.props = a.data.props || {}, a.data.props.type === "expand" ? s = {
253
288
  ...o,
254
289
  ...n,
255
290
  scopedSlots: r,
256
291
  hide: !1,
257
292
  filterable: !1,
258
- allowSort: i.data.props.sortable !== !1,
293
+ allowSort: a.data.props.sortable !== !1,
259
294
  sortable: !1,
260
- fixed: i.data.props.fixed
295
+ fixed: a.data.props.fixed
261
296
  } : e.push({
262
297
  ...o,
263
298
  ...n,
@@ -265,28 +300,28 @@ const f = {
265
300
  hide: !1,
266
301
  isVNode: !0,
267
302
  filterable: !1,
268
- allowSort: i.data.props.sortable !== !1,
303
+ allowSort: a.data.props.sortable !== !1,
269
304
  sortable: !1,
270
- fixed: i.data.props.fixed
305
+ fixed: a.data.props.fixed
271
306
  });
272
307
  }
273
- }) : l && l.forEach((i) => {
274
- i.type === "expand" ? s = {
275
- ...i,
276
- props: i,
308
+ }) : i && i.forEach((a) => {
309
+ a.type === "expand" ? s = {
310
+ ...a,
311
+ props: a,
277
312
  hide: !1,
278
313
  filterable: !1,
279
- allowSort: i.sortable !== !1,
314
+ allowSort: a.sortable !== !1,
280
315
  sortable: !1,
281
- fixed: i.fixed
316
+ fixed: a.fixed
282
317
  } : e.push({
283
- ...i,
284
- props: i,
318
+ ...a,
319
+ props: a,
285
320
  hide: !1,
286
321
  filterable: !1,
287
- allowSort: i.sortable !== !1,
322
+ allowSort: a.sortable !== !1,
288
323
  sortable: !1,
289
- fixed: i.fixed
324
+ fixed: a.fixed
290
325
  });
291
326
  }), this.updateExpandColumn(s), this.updateColumns(e);
292
327
  }
@@ -309,32 +344,32 @@ const f = {
309
344
  },
310
345
  rowClick(t, e, s) {
311
346
  if (this.clickRowSelect && this.selectable(t)) {
312
- const a = this.$refs.table;
313
- if (this.selectedRows.find((i) => i[this.rowKey] === t[this.rowKey])) {
314
- a.toggleRowSelection(t, !1);
347
+ const l = this.$refs.table;
348
+ if (this.selectedRows.find((a) => a[this.rowKey] === t[this.rowKey])) {
349
+ l.toggleRowSelection(t, !1);
315
350
  return;
316
351
  }
317
- a.toggleRowSelection(t);
352
+ l.toggleRowSelection(t);
318
353
  }
319
354
  },
320
355
  hideTooltip() {
321
356
  var e;
322
357
  const t = this.$refs.table.$children.find((s) => {
323
- var a;
324
- return ((a = s.$options) == null ? void 0 : a.name) === "ElTableBody";
358
+ var l;
359
+ return ((l = s.$options) == null ? void 0 : l.name) === "ElTableBody";
325
360
  });
326
361
  (e = t == null ? void 0 : t.$refs.tooltip) == null || e.hide();
327
362
  },
328
363
  updateTableScrollPosition() {
329
364
  this.$refs.table.bodyWrapper && this.scrollTo(this.tableScrollTop, this.tableScrollLeft);
330
365
  },
331
- filterTableProperties: _,
332
- filterTableEvents: $,
333
- filterTableColumnProperties: S,
366
+ filterTableProperties: B,
367
+ filterTableEvents: P,
368
+ filterTableColumnProperties: _,
334
369
  onTableScroll() {
335
370
  this.tableScrollTop = this.$refs.table.bodyWrapper.scrollTop, this.tableScrollLeft = this.$refs.table.bodyWrapper.scrollLeft;
336
371
  },
337
- copy: (t) => B(F(t)),
372
+ copy: (t) => L(q(t)),
338
373
  onSortChange({ prop: t, order: e }) {
339
374
  this.payloadStyle !== "body" ? (this.page.ascs = e === "ascending" ? t : "", this.page.descs = e === "descending" ? t : "") : (this.page.ascs = e === "ascending" ? [t] : this.ascs, this.page.descs = e === "descending" ? [t] : this.descs);
340
375
  },
@@ -353,7 +388,7 @@ const f = {
353
388
  },
354
389
  async getPage(t) {
355
390
  var o;
356
- if (w(this.$attrs, "data") && this.$attrs.data !== !1) {
391
+ if (v(this.$attrs, "data") && this.$attrs.data !== !1) {
357
392
  this.records = this.$attrs.data, this.page.page = 1, this.page.total = (o = this.records) == null ? void 0 : o.length, this.page.limit = this.page.total;
358
393
  return;
359
394
  }
@@ -361,11 +396,11 @@ const f = {
361
396
  let e;
362
397
  const s = this.getPageQuery();
363
398
  if (this.api || this.url) {
364
- t !== !1 && (this.tableStatus = f.loading);
399
+ t !== !1 && (this.tableStatus = p.loading);
365
400
  try {
366
401
  this.api && (e = await this.api(s));
367
402
  } catch {
368
- this.tableStatus = f.error;
403
+ this.tableStatus = p.error;
369
404
  return;
370
405
  }
371
406
  } else {
@@ -376,9 +411,9 @@ const f = {
376
411
  return;
377
412
  }
378
413
  const {
379
- data: { data: a }
380
- } = e || {}, { total: l, records: i } = a || {};
381
- this.page.total = Number(l), this.records = await this.mapRow(i), !i || !i.length ? this.tableStatus = f.empty : this.tableStatus = f.success, this.doLayout(), this.$emit("page-loaded", a);
414
+ data: { data: l }
415
+ } = e || {}, { total: i, records: a } = l || {};
416
+ this.page.total = Number(i), this.records = await this.mapRow(a), !a || !a.length ? this.tableStatus = p.empty : this.tableStatus = p.success, this.doLayout(), this.$emit("page-loaded", l);
382
417
  },
383
418
  doLayout() {
384
419
  var t;
@@ -398,8 +433,8 @@ const f = {
398
433
  },
399
434
  mapRow(t) {
400
435
  return t.map((e) => (this.dicOptions.forEach(async (s) => {
401
- var a;
402
- e[`$${s.prop}`] = e[s.prop], s.dicData ? e[s.prop] = ((a = s.dicData.find((l) => l.value === e[s.prop])) == null ? void 0 : a.label) || e[s.prop] : e[s.prop] = await z(s.dicType, e[s.prop]);
436
+ var l;
437
+ e[`$${s.prop}`] = e[s.prop], s.dicData ? e[s.prop] = ((l = s.dicData.find((i) => i.value === e[s.prop])) == null ? void 0 : l.label) || e[s.prop] : e[s.prop] = await A(s.dicType, e[s.prop]);
403
438
  }), e));
404
439
  },
405
440
  toggleSettings() {
@@ -410,18 +445,18 @@ const f = {
410
445
  return !(t != null && t.disabled) && !((e = this.disabledRowKeys) != null && e.includes(t == null ? void 0 : t[this.rowKey]));
411
446
  },
412
447
  updateExpandColumn(t) {
413
- t && this.expandColumn ? m(this.expandColumn, t) : this.expandColumn = t;
448
+ t && this.expandColumn ? f(this.expandColumn, t) : this.expandColumn = t;
414
449
  },
415
450
  updateColumns(t) {
416
- if (!A(this.tableColumns, t)) {
451
+ if (!Q(this.tableColumns, t)) {
417
452
  const e = {};
418
453
  this.tableColumns.forEach((s) => {
419
454
  e[s.prop] = s;
420
455
  }), t.map((s) => {
421
- const a = e[s.prop];
422
- if (a) {
423
- const { hide: l, filterable: i, allowSort: o, sortable: n, fixed: r } = a;
424
- return m(a, s), a.hide = l, a.filterable = i, a.allowSort = o, a.sortable = n, a.fixed = r, a;
456
+ const l = e[s.prop];
457
+ if (l) {
458
+ const { hide: i, filterable: a, allowSort: o, sortable: n, fixed: r } = l;
459
+ return f(l, s), l.hide = i, l.filterable = a, l.allowSort = o, l.sortable = n, l.fixed = r, l;
425
460
  }
426
461
  return s;
427
462
  }), this.tableColumns = t;
@@ -432,7 +467,7 @@ const f = {
432
467
  }
433
468
  }
434
469
  };
435
- var j = function() {
470
+ var J = function() {
436
471
  var e = this, s = e._self._c;
437
472
  return s("div", { class: ["pageable-table", { "auto-height": e.autoHeight }] }, [s("div", { staticClass: "pageable-table-wrapper" }, [e._t("toolbar", null, { selectedRows: e.selectedRows }), s("ElTable", e._g(e._b({ ref: "table", class: ["flex-item", { "header-bold": e.headerBold }], attrs: { data: e.records, border: e.border, stripe: "", size: "medium" }, on: { "hook:updated": e.updateTableScrollPosition, "sort-change": e.onSortChange, "row-dblclick": e.rowDbClick, "row-click": e.rowClick, "cell-click": e.hideTooltip, "current-change": e.onCurrentChange, "selection-change": e.handleSelectionChange }, scopedSlots: e._u([{ key: "empty", fn: function() {
438
473
  return [e._t("empty", function() {
@@ -442,36 +477,36 @@ var j = function() {
442
477
  return [e._t("append")];
443
478
  }, proxy: !0 }], null, !0) }, "ElTable", e.filterTableProperties(e.mergeAttrs), !1), e.filterTableEvents(e.$listeners)), [e.expandColumn ? s("TableColumnFilterable", e._b({}, "TableColumnFilterable", e.expandColumn, !1)) : e._e(), e.multiple && e.selection ? s("TableColumn", { key: "multiple", attrs: { type: "selection", selectable: e.selectable, width: e.selectionWidth, align: "center" } }) : e._e(), !e.multiple && e.selection ? s("TableColumn", { key: "single", attrs: { sortable: !1, type: "single-selection", "class-name": "single-select-column", width: e.selectionWidth, align: "center" }, scopedSlots: e._u([{ key: "header", fn: function() {
444
479
  return [s("ElRadio", { attrs: { value: !!e.currentRow, label: !0 } }, [s("span")])];
445
- }, proxy: !0 }, { key: "default", fn: function({ row: a }) {
446
- return [s("ElRadio", { attrs: { label: !0, disabled: !e.selectable(a), value: e.currentRow && e.currentRow[e.$attrs["row-key"] || e.rowKey || "id"] === a[e.$attrs["row-key"] || e.rowKey || "id"] } }, [s("span")])];
447
- } }], null, !1, 1270221895) }) : e._e(), e.index ? s("TableColumn", { key: "order", attrs: { type: "index", label: "序号", width: e.indexWidth, align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ $index: a }) {
448
- return [e._v(" " + e._s((e.page.page - 1) * e.page.limit + a + 1 || a + 1) + " ")];
449
- } }], null, !1, 4238275121) }) : e._e(), e.tableColumns ? e._l(e.tableColumns.filter((a) => !a.hide), function(a, l) {
450
- var i, o;
451
- return s("TableColumnFilterable", e._b({ key: `${((i = a.props) == null ? void 0 : i.prop) || a.prop}-${l}`, scopedSlots: e._u([e.$scopedSlots[((o = a.props) == null ? void 0 : o.prop) || a.prop] ? { key: "default", fn: function({ row: n }) {
480
+ }, proxy: !0 }, { key: "default", fn: function({ row: l }) {
481
+ return [s("ElRadio", { attrs: { label: !0, disabled: !e.selectable(l), value: e.currentRow && e.currentRow[e.$attrs["row-key"] || e.rowKey || "id"] === l[e.$attrs["row-key"] || e.rowKey || "id"] } }, [s("span")])];
482
+ } }], null, !1, 1270221895) }) : e._e(), e.index ? s("TableColumn", { key: "order", attrs: { type: "index", label: "序号", width: e.indexWidth, align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ $index: l }) {
483
+ return [e._v(" " + e._s((e.page.page - 1) * e.page.limit + l + 1 || l + 1) + " ")];
484
+ } }], null, !1, 4238275121) }) : e._e(), e.tableColumns ? e._l(e.tableColumns.filter((l) => !l.hide), function(l, i) {
485
+ var a, o;
486
+ return s("TableColumnFilterable", e._b({ key: `${((a = l.props) == null ? void 0 : a.prop) || l.prop}-${i}`, scopedSlots: e._u([e.$scopedSlots[((o = l.props) == null ? void 0 : o.prop) || l.prop] ? { key: "default", fn: function({ row: n }) {
452
487
  var r;
453
- return [e._t(((r = a.props) == null ? void 0 : r.prop) || a.prop, null, { row: n })];
454
- } } : null], null, !0) }, "TableColumnFilterable", a, !1));
455
- }) : [s("TableColumn", { attrs: { label: "点击表格行复制模板" }, scopedSlots: e._u([{ key: "default", fn: function({ row: a }) {
456
- return [s("pre", { staticClass: "pointer", on: { click: function(l) {
457
- return e.copy(a);
458
- } } }, [e._v(e._s(JSON.stringify(a, null, " ")))])];
459
- } }]) })]], 2), e.paging ? s("ElPagination", { staticClass: "flex-not-shrink", attrs: { "current-page": e.page.page, "hide-on-single-page": e.hideOnSinglePage, "page-size": e.page.limit, total: e.page.total, "page-sizes": [10, 25, 50, 100, 500, 1e3, 2e3], background: "", layout: "total, sizes, prev, pager, next, jumper" }, on: { "size-change": (a) => {
460
- e.page.limit = a;
461
- }, "current-change": (a) => {
462
- e.page.page = a;
463
- } } }) : e._e(), s("TableColumnFilter", { attrs: { visible: e.showSettings, columns: e.tableColumns }, on: { "update:visible": function(a) {
464
- e.showSettings = a;
488
+ return [e._t(((r = l.props) == null ? void 0 : r.prop) || l.prop, null, { row: n })];
489
+ } } : null], null, !0) }, "TableColumnFilterable", l, !1));
490
+ }) : [s("TableColumn", { attrs: { label: "点击表格行复制模板" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
491
+ return [s("pre", { staticClass: "pointer", on: { click: function(i) {
492
+ return e.copy(l);
493
+ } } }, [e._v(e._s(JSON.stringify(l, null, " ")))])];
494
+ } }]) })]], 2), e.paging ? s("ElPagination", { staticClass: "flex-not-shrink", attrs: { "current-page": e.page.page, "hide-on-single-page": e.hideOnSinglePage, "page-size": e.page.limit, total: e.page.total, "page-sizes": [10, 25, 50, 100, 500, 1e3, 2e3], background: "", layout: "total, sizes, prev, pager, next, jumper" }, on: { "size-change": (l) => {
495
+ e.page.limit = l;
496
+ }, "current-change": (l) => {
497
+ e.page.page = l;
498
+ } } }) : e._e(), s("TableColumnFilter", { attrs: { visible: e.showSettings, columns: e.tableColumns }, on: { "update:visible": function(l) {
499
+ e.showSettings = l;
465
500
  } } })], 2), s("ResizeObserver", { on: { notify: e.doLayout } })], 1);
466
- }, v = [], U = /* @__PURE__ */ P(
467
- M,
468
- j,
469
- v,
501
+ }, X = [], G = /* @__PURE__ */ b(
502
+ I,
503
+ J,
504
+ X,
470
505
  !1,
471
506
  null,
472
507
  null
473
508
  );
474
- const Z = U.exports;
509
+ const re = G.exports;
475
510
  export {
476
- Z as default
511
+ re as default
477
512
  };
@@ -1 +1 @@
1
- .pageable-table{flex:auto;height:100%;position:relative}.pageable-table .single-select-column .el-radio__label{padding:0}.pageable-table.auto-height{height:auto;position:static}.pageable-table.auto-height .el-table{min-height:200px;position:relative}.pageable-table.auto-height .pageable-table-wrapper{position:static}.pageable-table .pageable-table-wrapper{flex-direction:column;display:flex}.pageable-table .el-pagination{background-color:#fff}.pageable-table .table-status-icon{font-size:20px}.pageable-table .pageable-table-loading{align-items:center;display:inline-flex}.pageable-table .pageable-table-error{color:red;border:1px solid #fca4a4;align-items:center;display:inline-flex}.pageable-table .pageable-table-error:hover{background-color:#fff0f0}.pageable-table .pageable-table-total{padding:0 10px 10px}.pageable-table .underline{position:relative}.pageable-table .underline:after{z-index:1;content:"";background-color:#606266;width:100%;height:1px;position:absolute;bottom:0;left:0}.pageable-table .el-table th{color:#000000d9;word-break:break-word;background-color:#fafafa}.pageable-table .total{padding:10px}
1
+ .table-column-filter .el-drawer__body{padding:10px}.table-column-filter .el-drawer__header{border-bottom:1px solid #f0f0f0;min-height:20px;margin-bottom:0;padding:16px 10px 16px 24px}.pageable-table{flex:auto;height:100%;position:relative}.pageable-table .single-select-column .el-radio__label{padding:0}.pageable-table.auto-height{height:auto;position:static}.pageable-table.auto-height .el-table{min-height:200px;position:relative}.pageable-table.auto-height .pageable-table-wrapper{position:static}.pageable-table .pageable-table-wrapper{flex-direction:column;display:flex}.pageable-table .el-pagination{background-color:#fff}.pageable-table .table-status-icon{font-size:20px}.pageable-table .pageable-table-loading{align-items:center;display:inline-flex}.pageable-table .pageable-table-error{color:red;border:1px solid #fca4a4;align-items:center;display:inline-flex}.pageable-table .pageable-table-error:hover{background-color:#fff0f0}.pageable-table .pageable-table-total{padding:0 10px 10px}.pageable-table .underline{position:relative}.pageable-table .underline:after{z-index:1;content:"";background-color:#606266;width:100%;height:1px;position:absolute;bottom:0;left:0}.pageable-table .el-table th{color:#000000d9;word-break:break-word;background-color:#fafafa}.pageable-table .total{padding:10px}
@@ -1,9 +1,63 @@
1
- import { _ } from "../chunks/helper.BiMLcEEk.mjs";
2
- import { h as g } from "vue";
3
- import w from "../dict-render/index.mjs";
4
- import { f as v } from "../chunks/core.DJEgjQW6.mjs";
5
- import { n as F } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
6
- const x = {
1
+ import { _ as T } from "../chunks/helper.BiMLcEEk.mjs";
2
+ import { h as d } from "vue";
3
+ import { g as C } from "../chunks/dictionary.DsN-2ukC.mjs";
4
+ import { n as B } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
5
+ import { f as V } from "../chunks/core.DJEgjQW6.mjs";
6
+ const D = {
7
+ name: "DictRender",
8
+ inheritAttrs: !1,
9
+ props: {
10
+ row: Object,
11
+ column: Object,
12
+ dictType: String,
13
+ options: Array,
14
+ treeDict: Boolean,
15
+ idAsValue: {
16
+ type: Boolean,
17
+ default: !0
18
+ },
19
+ labelAsValue: Boolean
20
+ },
21
+ data() {
22
+ return {
23
+ label: ""
24
+ };
25
+ },
26
+ computed: {
27
+ value() {
28
+ return this.row[this.column.property];
29
+ }
30
+ },
31
+ watch: {
32
+ value: {
33
+ immediate: !0,
34
+ async handler() {
35
+ var l, e;
36
+ this.dictType ? this.label = await C(this.dictType, this.value, !0, {
37
+ treeDict: this.treeDict,
38
+ idAsValue: this.idAsValue,
39
+ labelAsValue: this.labelAsValue
40
+ }) : this.label = ((e = (l = this.options) == null ? void 0 : l.find((t) => `${t.value}` == `${this.value}`)) == null ? void 0 : e.label) ?? `${this.value}`;
41
+ }
42
+ }
43
+ },
44
+ render() {
45
+ return d("span", T([{}, {
46
+ on: this.$listeners
47
+ }, {}, {
48
+ domProps: this.$attrs
49
+ }]), [this.label]);
50
+ }
51
+ }, F = null, O = null;
52
+ var $ = /* @__PURE__ */ B(
53
+ D,
54
+ F,
55
+ O,
56
+ !1,
57
+ null,
58
+ null
59
+ );
60
+ const x = $.exports, N = {
7
61
  props: {
8
62
  type: {
9
63
  type: String,
@@ -55,8 +109,8 @@ const x = {
55
109
  default() {
56
110
  return ["ascending", "descending", null];
57
111
  },
58
- validator(n) {
59
- return n.every((t) => ["ascending", "descending", null].indexOf(t) > -1);
112
+ validator(l) {
113
+ return l.every((e) => ["ascending", "descending", null].indexOf(e) > -1);
60
114
  }
61
115
  },
62
116
  dictType: String,
@@ -69,103 +123,103 @@ const x = {
69
123
  },
70
124
  labelAsValue: Boolean
71
125
  }
72
- }, N = {
126
+ }, M = {
73
127
  selection: !0,
74
128
  "single-selection": !0,
75
129
  index: !0,
76
130
  expand: !0
77
- }, O = (n, t, e, y, d) => {
131
+ }, k = (l, e, t, y, p) => {
78
132
  var i;
79
- const l = n.rowDbClick || ((i = n.$children.find((f) => f.$options.name === "TableView")) == null ? void 0 : i.rowDbClick);
80
- l == null || l(t, e, y, d);
81
- }, V = (n) => {
82
- let t = n.target;
83
- for (; t && t.tagName.toUpperCase() !== "HTML"; ) {
84
- if (t.tagName.toUpperCase() === "TD")
85
- return t;
86
- t = t.parentNode;
133
+ const n = l.rowDbClick || ((i = l.$children.find((f) => f.$options.name === "TableView")) == null ? void 0 : i.rowDbClick);
134
+ n == null || n(e, t, y, p);
135
+ }, H = (l) => {
136
+ let e = l.target;
137
+ for (; e && e.tagName.toUpperCase() !== "HTML"; ) {
138
+ if (e.tagName.toUpperCase() === "TD")
139
+ return e;
140
+ e = e.parentNode;
87
141
  }
88
142
  return null;
89
- }, D = () => {
90
- }, M = (n) => !v(n).length, k = {
143
+ }, P = () => {
144
+ }, R = (l) => !V(l).length, U = {
91
145
  name: "TableColumn",
92
146
  functional: !0,
93
- mixins: [x],
94
- render(n, {
95
- data: t,
96
- props: e,
147
+ mixins: [N],
148
+ render(l, {
149
+ data: e,
150
+ props: t,
97
151
  children: y,
98
- parent: d,
152
+ parent: p,
99
153
  listeners: {
100
- click: l
154
+ click: n
101
155
  }
102
156
  }) {
103
157
  const {
104
158
  scopedSlots: i,
105
159
  ...f
106
- } = t, {
107
- clickable: C,
160
+ } = e, {
161
+ clickable: v,
108
162
  cellClick: a,
109
163
  ...b
110
- } = e, S = {
164
+ } = t, g = {
111
165
  ...i || {}
112
- }, h = N[e.type];
113
- if (!h) {
114
- const p = i == null ? void 0 : i.default, c = C || l || a;
115
- (c || e.dictType || e.options) && (S.default = (T) => {
166
+ }, _ = M[t.type];
167
+ if (!_) {
168
+ const m = i == null ? void 0 : i.default, c = v || n || a;
169
+ (c || t.dictType || t.options) && (g.default = (A) => {
116
170
  const {
117
171
  row: o,
118
172
  column: r
119
- } = T, B = c ? (u) => {
120
- const m = V(u);
121
- l || a ? (l == null || l(o, r, o, r, m, u), a == null || a(o, r, o, r, m, u)) : O(d, o, r, m, u);
122
- } : D;
123
- let s = p == null ? void 0 : p(T);
124
- return M(s) && (s = null), (e.dictType || e.options) && !s ? g(w, {
173
+ } = A, S = c ? (u) => {
174
+ const h = H(u);
175
+ n || a ? (n == null || n(o, r, o, r, h, u), a == null || a(o, r, o, r, h, u)) : k(p, o, r, h, u);
176
+ } : P;
177
+ let s = m == null ? void 0 : m(A);
178
+ return R(s) && (s = null), (t.dictType || t.options) && !s ? d(x, {
125
179
  class: {
126
180
  "is-clickable": c
127
181
  },
128
182
  on: {
129
- click: B
183
+ click: S
130
184
  },
131
185
  attrs: {
132
186
  row: o,
133
187
  column: r,
134
- dictType: e.dictType,
135
- treeDict: e.treeDict,
136
- idAsValue: e.idAsValue,
137
- labelAsValue: e.labelAsValue,
138
- options: e.options
188
+ dictType: t.dictType,
189
+ treeDict: t.treeDict,
190
+ idAsValue: t.idAsValue,
191
+ labelAsValue: t.labelAsValue,
192
+ options: t.options
139
193
  }
140
- }) : c ? g("span", {
194
+ }) : c ? d("span", {
141
195
  class: "is-clickable",
142
196
  on: {
143
- click: B
197
+ click: S
144
198
  }
145
199
  }, [s || (o == null ? void 0 : o[r == null ? void 0 : r.property])]) : s;
146
200
  });
147
201
  }
148
- const A = {
202
+ const w = {
149
203
  ...f,
150
204
  props: {
151
205
  ...b,
152
- showOverflowTooltip: h ? !1 : b.showOverflowTooltip
206
+ showOverflowTooltip: _ ? !1 : b.showOverflowTooltip
153
207
  }
154
208
  };
155
- return g("ElTableColumn", _([{}, A, {
156
- scopedSlots: S
209
+ return d("ElTableColumn", T([{}, w, {
210
+ scopedSlots: g
157
211
  }]));
158
212
  }
159
- }, H = null, P = null;
160
- var U = /* @__PURE__ */ F(
161
- k,
162
- H,
163
- P,
213
+ }, j = null, z = null;
214
+ var E = /* @__PURE__ */ B(
215
+ U,
216
+ j,
217
+ z,
164
218
  !1,
165
219
  null,
166
220
  null
167
221
  );
168
- const K = U.exports;
222
+ const X = E.exports;
169
223
  export {
170
- K as default
224
+ X as default
171
225
  };
package/web-types.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "@web-utils/component",
5
- "version": "4.0.1",
5
+ "version": "4.0.2",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "description-markup": "markdown",