ik-next-ui 0.0.6 → 0.0.7

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 +1 @@
1
- .ik-tree-main[data-v-5bc868cd]{display:flex;flex-direction:column;height:100%;width:100%}.ik-tree-main.auto-flow[data-v-5bc868cd]{margin:-20px}.ik-tree-main.auto-flow .ik-tree-search[data-v-5bc868cd]{padding:0 var(--v7b25cf50)}.ik-tree-main.auto-flow .ik-tree.el-tree[data-v-5bc868cd]{padding:0 var(--v7b25cf50);overflow:auto}.ik-tree-main .ik-tree-search[data-v-5bc868cd]{margin-bottom:8px}.ik-tree-main .ik-tree-search[data-v-5bc868cd] .el-input-group__append{padding:0}.ik-tree-main .ik-tree.el-tree[data-v-5bc868cd]{flex:1;color:var(--ik-color-font-normal)}.ik-tree-main .ik-tree.el-tree.auto-flow[data-v-5bc868cd]{margin-right:calc(var(--v7b25cf50) * -1);padding-right:var(--v7b25cf50)}.ik-tree-main .ik-tree.el-tree[data-v-5bc868cd] .el-tree-node.is-current.is-focusable>.el-tree-node__content{color:var(--el-color-primary);background-color:var(--el-color-primary-light-9)}.ik-tree-main .ik-tree.el-tree[data-v-5bc868cd] .el-tree-node.is-expanded.is-focusable:not(.is-current)>.el-tree-node__content{color:var(--ik-text-color);background-color:transparent}.ik-tree-main .ik-tree.el-tree[data-v-5bc868cd] .el-tree-node:not(.is-current)>.el-tree-node__content{background-color:transparent!important}
1
+ .ik-tree-main[data-v-cd738723]{display:flex;flex-direction:column;height:100%;width:100%}.ik-tree-main.auto-flow[data-v-cd738723]{margin:-20px}.ik-tree-main.auto-flow .ik-tree-search[data-v-cd738723]{padding:0 var(--a631d680)}.ik-tree-main.auto-flow .ik-tree.el-tree[data-v-cd738723]{padding:0 var(--a631d680);overflow:auto}.ik-tree-main .ik-tree-search[data-v-cd738723]{margin-bottom:8px}.ik-tree-main .ik-tree-search[data-v-cd738723] .el-input-group__append{padding:0}.ik-tree-main .ik-tree.el-tree[data-v-cd738723]{flex:1;color:var(--ik-color-font-normal)}.ik-tree-main .ik-tree.el-tree.auto-flow[data-v-cd738723]{margin-right:calc(var(--a631d680) * -1);padding-right:var(--a631d680)}.ik-tree-main .ik-tree.el-tree[data-v-cd738723] .el-tree-node.is-current.is-focusable>.el-tree-node__content{color:var(--el-color-primary);background-color:var(--el-color-primary-light-9)}.ik-tree-main .ik-tree.el-tree[data-v-cd738723] .el-tree-node.is-expanded.is-focusable:not(.is-current)>.el-tree-node__content{color:var(--ik-text-color);background-color:transparent}.ik-tree-main .ik-tree.el-tree[data-v-cd738723] .el-tree-node:not(.is-current)>.el-tree-node__content{background-color:transparent!important}
@@ -1,12 +1,15 @@
1
- import { defineComponent as $, useCssVars as S, ref as m, watch as b, computed as x, resolveComponent as T, openBlock as v, createElementBlock as V, Fragment as B, renderSlot as y, createElementVNode as N, normalizeClass as I, createBlock as K, unref as h, createCommentVNode as E, createVNode as F, mergeProps as U, createSlots as O, withCtx as P } from "vue";
2
- import { ElTree as R } from "element-plus";
3
- import { Search as j } from "@element-plus/icons-vue";
4
- const z = (t, d) => (t.install = (r) => {
1
+ import { defineComponent as N, useCssVars as V, useAttrs as B, computed as m, ref as k, watch as F, resolveComponent as I, openBlock as h, createElementBlock as O, Fragment as A, renderSlot as y, createElementVNode as M, normalizeClass as U, createBlock as $, unref as v, createCommentVNode as j, createVNode as E, mergeProps as P, createSlots as R, withCtx as z } from "vue";
2
+ import { ElTree as _ } from "element-plus";
3
+ import { Search as q } from "@element-plus/icons-vue";
4
+ const D = (t, i) => (t.install = (a) => {
5
5
  for (const l of [t, ...Object.values({})])
6
- r.component(l.name, l);
7
- }, t), A = /* @__PURE__ */ $({
6
+ a.component(l.name, l);
7
+ }, t), G = /* @__PURE__ */ N({
8
+ name: "IkTree",
9
+ inheritAttrs: !1,
8
10
  __name: "IkTree",
9
11
  props: {
12
+ // ===== IkTree 自定义属性 =====
10
13
  showSearch: {
11
14
  type: Boolean,
12
15
  default: !0
@@ -15,10 +18,6 @@ const z = (t, d) => (t.install = (r) => {
15
18
  type: String,
16
19
  default: "请输入名称检索"
17
20
  },
18
- emptyText: {
19
- type: String,
20
- default: "暂无数据"
21
- },
22
21
  // 是否自适应滚动
23
22
  autoFlow: {
24
23
  type: Boolean,
@@ -34,91 +33,120 @@ const z = (t, d) => (t.install = (r) => {
34
33
  type: Boolean,
35
34
  default: !1
36
35
  },
36
+ // ===== el-tree 常用属性(提供更好的类型提示和默认值)=====
37
37
  data: {
38
38
  type: Array,
39
39
  default: () => []
40
+ },
41
+ emptyText: {
42
+ type: String,
43
+ default: "暂无数据"
44
+ },
45
+ nodeKey: {
46
+ type: String,
47
+ default: "id"
48
+ },
49
+ props: {
50
+ type: Object,
51
+ default: () => ({ children: "children", label: "label" })
40
52
  }
41
53
  },
42
54
  emits: ["node-click"],
43
- setup(t, { expose: d, emit: r }) {
44
- S((e) => ({
45
- v7b25cf50: g.value
55
+ setup(t, { expose: i, emit: a }) {
56
+ V((e) => ({
57
+ a631d680: x.value
46
58
  }));
47
- const l = t, a = m(""), c = m();
48
- b(
49
- () => a.value,
59
+ const l = t, s = B(), g = [
60
+ "showSearch",
61
+ "placeholder",
62
+ "autoFlow",
63
+ "padding",
64
+ "clickUncheck"
65
+ ], w = m(() => {
66
+ const e = {};
67
+ for (const [o, n] of Object.entries(s))
68
+ g.includes(o) || (e[o] = n);
69
+ return e;
70
+ }), d = k(""), c = k();
71
+ F(
72
+ () => d.value,
50
73
  (e) => {
51
- var n;
52
- (n = c.value) == null || n.filter(e);
74
+ var o;
75
+ (o = c.value) == null || o.filter(e);
53
76
  }
54
77
  );
55
- const g = x(
78
+ const x = m(
56
79
  () => typeof l.padding == "string" ? l.padding : `${l.padding}px`
57
- ), C = () => {
58
- a.value = "";
59
- }, p = r, s = m(null), w = (e) => {
60
- var u, o, i;
80
+ ), b = () => {
81
+ d.value = "";
82
+ }, p = a, f = k(null), C = (e) => {
83
+ var n, r, u;
61
84
  if (!l.clickUncheck) {
62
85
  p("node-click", e);
63
86
  return;
64
87
  }
65
- const n = (u = c.value) == null ? void 0 : u.getCurrentKey();
66
- if (s.value !== null && n === s.value)
67
- (o = c.value) == null || o.setCurrentKey(), s.value = null, p("node-click", null);
88
+ const o = (n = c.value) == null ? void 0 : n.getCurrentKey();
89
+ if (f.value !== null && o === f.value)
90
+ (r = c.value) == null || r.setCurrentKey(), f.value = null, p("node-click", null);
68
91
  else {
69
92
  p("node-click", e);
70
- const f = (i = c.value) == null ? void 0 : i.getCurrentKey();
71
- s.value = f ?? null;
93
+ const K = (u = c.value) == null ? void 0 : u.getCurrentKey();
94
+ f.value = K ?? null;
72
95
  }
73
- };
74
- return d({ tree: c, filterText: a, resetInput: C }), (e, n) => {
75
- const u = T("el-input");
76
- return v(), V(
77
- B,
96
+ }, S = (e, o) => {
97
+ var r, u;
98
+ const n = typeof ((r = l.props) == null ? void 0 : r.label) == "string" ? l.props.label : "label";
99
+ return ((u = o[n]) == null ? void 0 : u.includes(e)) ?? !1;
100
+ }, T = m(() => {
101
+ const e = s.filterNodeMethod || s["filter-node-method"];
102
+ return e || S;
103
+ });
104
+ return i({ tree: c, filterText: d, resetInput: b }), (e, o) => {
105
+ const n = I("el-input");
106
+ return h(), O(
107
+ A,
78
108
  null,
79
109
  [
80
110
  y(e.$slots, "inset", {}, void 0, !0),
81
- N(
111
+ M(
82
112
  "div",
83
113
  {
84
- class: I(["ik-tree-main", { "auto-flow": t.autoFlow }])
114
+ class: U(["ik-tree-main", { "auto-flow": t.autoFlow }])
85
115
  },
86
116
  [
87
- t.showSearch ? (v(), K(u, {
117
+ t.showSearch ? (h(), $(n, {
88
118
  key: 0,
89
- modelValue: a.value,
90
- "onUpdate:modelValue": n[0] || (n[0] = (o) => a.value = o),
119
+ modelValue: d.value,
120
+ "onUpdate:modelValue": o[0] || (o[0] = (r) => d.value = r),
91
121
  modelModifiers: { trim: !0 },
92
122
  class: "w-full ik-tree-search",
93
123
  placeholder: t.placeholder,
94
124
  clearable: "",
95
- "suffix-icon": h(j)
96
- }, null, 8, ["modelValue", "placeholder", "suffix-icon"])) : E("v-if", !0),
97
- F(h(R), U({
125
+ "suffix-icon": v(q)
126
+ }, null, 8, ["modelValue", "placeholder", "suffix-icon"])) : j("v-if", !0),
127
+ E(v(_), P({
98
128
  ref_key: "treeRef",
99
- ref: c,
100
- "empty-text": t.emptyText
101
- }, e.$attrs, {
102
- data: t.data || e.$attrs.data,
103
- "node-key": e.$attrs["node-key"] || e.$attrs.nodeKey || "id",
129
+ ref: c
130
+ }, w.value, {
131
+ data: t.data,
132
+ "empty-text": t.emptyText,
133
+ "node-key": t.nodeKey,
134
+ props: l,
135
+ "filter-node-method": T.value,
104
136
  class: "ik-tree",
105
- onNodeClick: w,
106
- "filter-node-method": (o, i) => {
107
- var f, k;
108
- return i[((k = (f = e.$attrs) == null ? void 0 : f.props) == null ? void 0 : k.label) || "label"].includes(o);
109
- }
110
- }), O({
137
+ onNodeClick: C
138
+ }), R({
111
139
  _: 2
112
140
  /* DYNAMIC */
113
141
  }, [
114
142
  e.$slots.default ? {
115
143
  name: "default",
116
- fn: P(({ data: o }) => [
117
- y(e.$slots, "default", { data: o }, void 0, !0)
144
+ fn: z(({ data: r }) => [
145
+ y(e.$slots, "default", { data: r }, void 0, !0)
118
146
  ]),
119
147
  key: "0"
120
148
  } : void 0
121
- ]), 1040, ["empty-text", "data", "node-key", "filter-node-method"])
149
+ ]), 1040, ["data", "empty-text", "node-key", "props", "filter-node-method"])
122
150
  ],
123
151
  2
124
152
  /* CLASS */
@@ -129,13 +157,13 @@ const z = (t, d) => (t.install = (r) => {
129
157
  );
130
158
  };
131
159
  }
132
- }), M = (t, d) => {
133
- const r = t.__vccOpts || t;
134
- for (const [l, a] of d)
135
- r[l] = a;
136
- return r;
137
- }, q = /* @__PURE__ */ M(A, [["__scopeId", "data-v-5bc868cd"]]), J = z(q);
160
+ }), H = (t, i) => {
161
+ const a = t.__vccOpts || t;
162
+ for (const [l, s] of i)
163
+ a[l] = s;
164
+ return a;
165
+ }, J = /* @__PURE__ */ H(G, [["__scopeId", "data-v-cd738723"]]), X = D(J);
138
166
  export {
139
- J as IkTree,
140
- J as default
167
+ X as IkTree,
168
+ X as default
141
169
  };