@vrojs/element-plus 0.0.17 → 0.0.19

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,61 +1,62 @@
1
- import { defineComponent as P, useTemplateRef as R, computed as d, watch as T, nextTick as V, createBlock as $, openBlock as E, unref as _, mergeProps as w, createSlots as g, withCtx as m, renderSlot as k, normalizeProps as B, guardReactiveProps as S } from "vue";
2
- import { pick as z, typedKeys as D, isUndefined as y } from "@daysnap/utils";
3
- import { treeProps as M, ElTree as N } from "element-plus";
4
- import { vroElTreeProps as U } from "./types.js";
5
- const A = /* @__PURE__ */ P({
1
+ import { defineComponent as T, shallowRef as V, computed as i, watch as $, nextTick as w, createBlock as E, openBlock as P, unref as R, mergeProps as g, createSlots as B, withCtx as m, renderSlot as k, normalizeProps as S, guardReactiveProps as z } from "vue";
2
+ import { isUndefined as y } from "@daysnap/utils";
3
+ import { ElTree as A } from "element-plus";
4
+ import { vroElTreeProps as D } from "./types.js";
5
+ const b = /* @__PURE__ */ T({
6
6
  name: "VroElTree",
7
+ inheritAttrs: !1,
7
8
  __name: "vro-el-tree",
8
- props: U,
9
+ props: D,
9
10
  emits: ["update:modelValue", "check"],
10
11
  setup(v, { emit: I }) {
11
- const l = I, n = v, u = R("treeRef"), C = d(() => z(n, D(M))), p = d(() => n.options ? n.options : n.data), f = d(() => {
12
- const { modelValue: e, rootId: r } = n, { childIds: o, mapping: t } = i(p.value), a = e.reduce(
13
- (s, c) => (s[c] = !0, s),
12
+ const d = I, l = v, c = V(null), C = (e) => {
13
+ c.value = e || null;
14
+ }, u = i(() => l.options ?? l.data ?? []), f = i(() => {
15
+ const { modelValue: e, rootId: r } = l, { childIds: o, mapping: t } = p(u.value), a = e.reduce(
16
+ (s, n) => (s[n] = !0, s),
14
17
  {}
15
18
  ), h = (s) => {
16
19
  if (s === r)
17
20
  return !0;
18
21
  if (!a[s])
19
22
  return !1;
20
- const c = t[s];
21
- return !y(c) && h(c);
23
+ const n = t[s];
24
+ return !y(n) && h(n);
22
25
  };
23
26
  return o.filter(h);
24
27
  });
25
- T(
28
+ $(
26
29
  f,
27
30
  async (e) => {
28
- await V(), u.value?.setCheckedKeys(e);
31
+ await w(), c.value?.setCheckedKeys(e);
29
32
  },
30
33
  { immediate: !0 }
31
34
  );
32
35
  const K = (e, r) => {
33
36
  const { checkedKeys: o, halfCheckedKeys: t } = r;
34
- l("check", e, r), l("update:modelValue", [...t, ...o]);
37
+ d("check", e, r), d("update:modelValue", [...t, ...o]);
35
38
  };
36
- function i(e, r = {}) {
39
+ function p(e, r = {}) {
37
40
  const o = [];
38
41
  return e.forEach((t) => {
39
42
  if (y(t.parentId) || (r[t.id] = t.parentId), t.children && t.children.length > 0) {
40
- const a = i(t.children ?? [], r);
43
+ const a = p(t.children ?? [], r);
41
44
  o.push(...a.childIds);
42
45
  } else
43
46
  o.push(t.id);
44
47
  }), { childIds: o, mapping: r };
45
48
  }
46
- return (e, r) => (E(), $(_(N), w({
47
- ref_key: "treeRef",
48
- ref: u
49
- }, C.value, {
49
+ return (e, r) => (P(), E(R(A), g({ ref: C }, e.$attrs, {
50
50
  class: "vro-el-tree",
51
- data: p.value,
51
+ data: u.value,
52
+ "node-key": e.nodeKey,
52
53
  "default-checked-keys": f.value,
53
54
  onCheck: K
54
- }), g({ _: 2 }, [
55
+ }), B({ _: 2 }, [
55
56
  e.$slots.default ? {
56
57
  name: "default",
57
58
  fn: m((o) => [
58
- k(e.$slots, "default", B(S(o)))
59
+ k(e.$slots, "default", S(z(o)))
59
60
  ]),
60
61
  key: "0"
61
62
  } : void 0,
@@ -66,9 +67,9 @@ const A = /* @__PURE__ */ P({
66
67
  ]),
67
68
  key: "1"
68
69
  } : void 0
69
- ]), 1040, ["data", "default-checked-keys"]));
70
+ ]), 1040, ["data", "node-key", "default-checked-keys"]));
70
71
  }
71
72
  });
72
73
  export {
73
- A as default
74
+ b as default
74
75
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vrojs/element-plus",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "vrojs ui",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -53,8 +53,8 @@
53
53
  "vite": "^7.1.12",
54
54
  "vite-plugin-dts": "^4.5.4",
55
55
  "vue": "^3.5.22",
56
- "@vrojs/base": "0.0.11",
57
- "@vrojs/use": "0.0.5"
56
+ "@vrojs/use": "0.0.5",
57
+ "@vrojs/base": "0.0.11"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "npm run clean && vite build",