geekplus-digital-ui 0.2.4 → 0.2.6

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.
@@ -8,9 +8,9 @@ import o from "./inline-edit/index.js";
8
8
  import s from "./upload/index.js";
9
9
  import c from "./search-form/index.js";
10
10
  import l from "./search-item/index.js";
11
- import u from "./table/index.js";
11
+ import u, { DTableWrapper as d } from "./table/index.js";
12
12
  //#region packages/components/index.js
13
- var d = /* @__PURE__ */ e({
13
+ var f = /* @__PURE__ */ e({
14
14
  DCopy: () => t,
15
15
  DEditor: () => n,
16
16
  DFoldText: () => r,
@@ -20,7 +20,8 @@ var d = /* @__PURE__ */ e({
20
20
  DSearchForm: () => c,
21
21
  DSearchItem: () => l,
22
22
  DTable: () => u,
23
+ DTableWrapper: () => d,
23
24
  DUpload: () => s
24
25
  });
25
26
  //#endregion
26
- export { t as DCopy, n as DEditor, r as DFoldText, i as DIcon, a as DIconTip, o as DInlineEdit, c as DSearchForm, l as DSearchItem, u as DTable, s as DUpload, d as components_exports };
27
+ export { t as DCopy, n as DEditor, r as DFoldText, i as DIcon, a as DIconTip, o as DInlineEdit, c as DSearchForm, l as DSearchItem, u as DTable, d as DTableWrapper, s as DUpload, f as components_exports };
@@ -120,4 +120,5 @@ export const DTable: {
120
120
  pagination?(_: {}): any;
121
121
  };
122
122
  });
123
+ export const DTableWrapper: import('vue').DefineComponent<{}, () => any, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
123
124
  export default DTable;
@@ -1,5 +1,6 @@
1
- import e from "./src/table.vue.js";
1
+ import e from "./src/table-wrapper.vue.js";
2
+ import t from "./src/table.vue.js";
2
3
  //#region packages/components/table/index.js
3
- var t = e;
4
+ var n = t, r = e;
4
5
  //#endregion
5
- export { t as default };
6
+ export { r as DTableWrapper, n as default };
@@ -1,13 +1,34 @@
1
1
  import { Fragment as e, h as t, inject as n } from "vue";
2
2
  //#region packages/components/table/src/table-wrapper.vue
3
- var r = (e) => (e?.type?.name || e?.type?.__name) === "ElTableColumn", i = (t) => {
3
+ var r = (e) => (e?.type?.name || e?.type?.__name) === "ElTableColumn", i = (e) => (e?.type?.name || e?.type?.__name) === "ElTable", a = (t) => {
4
4
  let n = [];
5
5
  for (let r of t) if (r.type === e) {
6
6
  let e = Array.isArray(r.children) ? r.children : [];
7
- n.push(...i(e));
7
+ n.push(...a(e));
8
8
  } else n.push(r);
9
9
  return n;
10
- }, a = (e) => {
10
+ }, o = (t) => {
11
+ for (let n of t) {
12
+ if (i(n)) return n;
13
+ let t = null;
14
+ if (n.type === e ? t = Array.isArray(n.children) ? n.children : [] : typeof n.type == "string" && Array.isArray(n.children) && (t = n.children), t) {
15
+ let e = o(t);
16
+ if (e) return e;
17
+ }
18
+ }
19
+ return null;
20
+ }, s = (n, r, i) => n.map((n) => {
21
+ if (n === r) return i;
22
+ if (n.type === e) {
23
+ let a = Array.isArray(n.children) ? n.children : [], o = s(a, r, i);
24
+ return o === a ? n : t(e, null, o);
25
+ }
26
+ if (typeof n.type == "string" && Array.isArray(n.children)) {
27
+ let e = s(n.children, r, i);
28
+ return e === n.children ? n : t(n.type, n.props, e);
29
+ }
30
+ return n;
31
+ }), c = (e) => {
11
32
  let t = [], n = [];
12
33
  for (let i of e) {
13
34
  if (!r(i)) continue;
@@ -18,45 +39,45 @@ var r = (e) => (e?.type?.name || e?.type?.__name) === "ElTableColumn", i = (t) =
18
39
  controllable: t,
19
40
  always: n
20
41
  };
21
- }, o = (e, t, n) => n.length === 0 ? e : n.filter((e) => t.includes(e)).map((t) => e.find((e) => e.props?.prop === t)).filter(Boolean), s = {
42
+ }, l = (e, t, n) => n.length === 0 ? e : n.filter((e) => t.includes(e)).map((t) => e.find((e) => e.props?.prop === t)).filter(Boolean), u = {
22
43
  name: "DTableWrapper",
23
44
  setup(e, { slots: r }) {
24
- let s = n("dTableContext");
45
+ let i = n("dTableContext");
25
46
  return () => {
26
- if (!s) return r.default?.() ?? [];
27
- let e = r.default?.() ?? [], n = i(e), c = n.find((e) => (e?.type?.name || e?.type?.__name) === "ElTable");
28
- if (!c) return e;
29
- let l = c.children?.default, { controllable: u, always: d } = a(i(typeof l == "function" ? l() : [])), f = u.map((e) => ({
47
+ if (!i) return r.default?.() ?? [];
48
+ let e = r.default?.() ?? [], n = o(e);
49
+ if (!n) return e;
50
+ let u = n.children?.default, { controllable: d, always: f } = c(a(typeof u == "function" ? u() : [])), p = d.map((e) => ({
30
51
  prop: e.props.prop,
31
52
  label: e.props.label || e.props.type || e.props.prop,
32
53
  fixed: e.props.fixed === "right" ? "right" : e.props.fixed ? "left" : !1
33
54
  }));
34
55
  queueMicrotask(() => {
35
- JSON.stringify(s.columnList.value) !== JSON.stringify(f) && (s.columnList.value = f);
56
+ JSON.stringify(i.columnList.value) !== JSON.stringify(p) && (i.columnList.value = p);
36
57
  });
37
- let p = o(u, s.checkedKeys.value, s.columnOrder.value), m = d.filter((e) => e.props?.type), h = d.filter((e) => !e.props?.type), g = s.columnFixed?.value ?? {}, _ = (e) => {
58
+ let m = l(d, i.checkedKeys.value, i.columnOrder.value), h = f.filter((e) => e.props?.type), g = f.filter((e) => !e.props?.type), _ = i.columnFixed?.value ?? {}, v = (e) => {
38
59
  let n = e.props?.prop;
39
- if (!n || !Object.prototype.hasOwnProperty.call(g, n)) return e;
40
- let r = g[n], i = { ...e.props };
60
+ if (!n || !Object.prototype.hasOwnProperty.call(_, n)) return e;
61
+ let r = _[n], i = { ...e.props };
41
62
  return r ? i.fixed = r : delete i.fixed, t(e.type, i, e.children);
42
- }, v = [
43
- ...m,
44
- ...p.map(_),
45
- ...h
46
- ], y = Object.entries(g).map(([e, t]) => `${e}:${t}`).join(","), b = [
47
- ...s.checkedKeys.value,
48
- ...s.columnOrder.value,
49
- y
50
- ].join(","), x = t(c.type, {
51
- ...c.props,
52
- key: b
63
+ }, y = [
64
+ ...h,
65
+ ...m.map(v),
66
+ ...g
67
+ ], b = Object.entries(_).map(([e, t]) => `${e}:${t}`).join(","), x = [
68
+ ...i.checkedKeys.value,
69
+ ...i.columnOrder.value,
70
+ b
71
+ ].join(",");
72
+ return s(e, n, t(n.type, {
73
+ ...n.props,
74
+ key: x
53
75
  }, {
54
- ...c.children,
55
- default: () => v
56
- });
57
- return n.map((e) => e === c ? x : e);
76
+ ...n.children,
77
+ default: () => y
78
+ }));
58
79
  };
59
80
  }
60
81
  };
61
82
  //#endregion
62
- export { s as default };
83
+ export { u as default };
package/index.js CHANGED
@@ -10,11 +10,11 @@ import s from "./components/inline-edit/index.js";
10
10
  import c from "./components/upload/index.js";
11
11
  import l from "./components/search-form/index.js";
12
12
  import u from "./components/search-item/index.js";
13
- import d from "./components/table/index.js";
13
+ import d, { DTableWrapper as f } from "./components/table/index.js";
14
14
  import "./components/index.js";
15
- import { setComponentRegistry as f, setGlobalConfig as p } from "./config/index.js";
16
- import { install as m } from "./install.js";
15
+ import { setComponentRegistry as p, setGlobalConfig as m } from "./config/index.js";
16
+ import { install as h } from "./install.js";
17
17
  //#region packages/index.js
18
- var h = { install: m };
18
+ var g = { install: h };
19
19
  //#endregion
20
- export { n as DCopy, r as DEditor, i as DFoldText, a as DIcon, o as DIconTip, s as DInlineEdit, l as DSearchForm, u as DSearchItem, d as DTable, c as DUpload, h as default, m as install, f as setComponentRegistry, p as setGlobalConfig, t as useActivated, e as useLocale };
20
+ export { n as DCopy, r as DEditor, i as DFoldText, a as DIcon, o as DIconTip, s as DInlineEdit, l as DSearchForm, u as DSearchItem, d as DTable, f as DTableWrapper, c as DUpload, g as default, h as install, p as setComponentRegistry, m as setGlobalConfig, t as useActivated, e as useLocale };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geekplus-digital-ui",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "homepage": "https://ui.geekplus.cc/static/ui/",
5
5
  "type": "module",
6
6
  "main": "index.js",