@dazhicheng/ui 1.6.56 → 1.6.59

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.
@@ -11,6 +11,7 @@ declare const _default: import('vue').DefineComponent<PanelMiddleProps, {
11
11
  groupCheck: (groupValue: PanelSelectValue, checked: boolean) => any;
12
12
  optionCheck: (value: PanelSelectValue, checked: boolean) => any;
13
13
  optionsCheck: (values: PanelSelectValue[], checked: boolean) => any;
14
+ selectCreatedOptions: () => any;
14
15
  }, string, import('vue').PublicProps, Readonly<PanelMiddleProps> & Readonly<{
15
16
  "onUpdate:keyword"?: ((value: string) => any) | undefined;
16
17
  onCheckAll?: ((checked: boolean) => any) | undefined;
@@ -18,6 +19,7 @@ declare const _default: import('vue').DefineComponent<PanelMiddleProps, {
18
19
  onGroupCheck?: ((groupValue: PanelSelectValue, checked: boolean) => any) | undefined;
19
20
  onOptionCheck?: ((value: PanelSelectValue, checked: boolean) => any) | undefined;
20
21
  onOptionsCheck?: ((values: PanelSelectValue[], checked: boolean) => any) | undefined;
22
+ onSelectCreatedOptions?: (() => any) | undefined;
21
23
  }>, {
22
24
  disabled: boolean;
23
25
  showMultiple: boolean;
@@ -1,14 +1,15 @@
1
- import { defineComponent as se, useTemplateRef as z, ref as m, computed as h, watch as M, nextTick as K, createElementBlock as f, openBlock as s, normalizeClass as n, createElementVNode as k, createCommentVNode as O, createVNode as p, createBlock as I, unref as i, withCtx as d, createTextVNode as b, normalizeStyle as P, Fragment as H, renderList as V, toDisplayString as E } from "vue";
2
- import { TtButton as ne } from "../../../tt-button/index.js";
3
- import { TtText as S } from "../../../tt-text/index.js";
4
- import { Search as ie } from "@element-plus/icons-vue";
5
- import { useResizeObserver as ue } from "@vueuse/core";
6
- import { ElInput as de, ElIcon as ce, ElCheckbox as F, ElScrollbar as fe } from "element-plus";
7
- import { DEFAULT_PANEL_SELECT_SEPARATORS as pe, splitPanelSelectText as ve } from "../common.js";
8
- const he = ["data-virtual-index", "data-flash-seed"], Y = 2, be = /* @__PURE__ */ se({
1
+ import { defineComponent as ne, useTemplateRef as q, ref as m, computed as v, watch as M, nextTick as U, createElementBlock as p, openBlock as s, normalizeClass as n, createElementVNode as k, createCommentVNode as z, createVNode as h, createBlock as I, unref as i, withKeys as ie, withCtx as d, createTextVNode as S, normalizeStyle as P, Fragment as H, renderList as V, toDisplayString as E } from "vue";
2
+ import { TtButton as ue } from "../../../tt-button/index.js";
3
+ import { TtText as $ } from "../../../tt-text/index.js";
4
+ import { Search as de } from "@element-plus/icons-vue";
5
+ import { useResizeObserver as ce } from "@vueuse/core";
6
+ import { ElInput as fe, ElIcon as pe, ElCheckbox as F, ElScrollbar as he } from "element-plus";
7
+ import { DEFAULT_PANEL_SELECT_SEPARATORS as ve, splitPanelSelectText as me } from "../common.js";
8
+ const we = ["data-virtual-index", "data-flash-seed"], Y = 2, $e = /* @__PURE__ */ ne({
9
9
  name: "PanelMiddle",
10
10
  __name: "PanelMiddle",
11
11
  props: {
12
+ allowCreate: { type: Boolean },
12
13
  disabled: { type: Boolean, default: !1 },
13
14
  prefixCls: {},
14
15
  multiple: { type: Boolean },
@@ -25,245 +26,250 @@ const he = ["data-virtual-index", "data-flash-seed"], Y = 2, be = /* @__PURE__ *
25
26
  groupIndeterminateMap: {},
26
27
  scrollToGroupValue: { default: void 0 },
27
28
  pasteSearch: { type: Boolean, default: !1 },
28
- separator: { default: () => [...pe] },
29
+ separator: { default: () => [...ve] },
29
30
  showAll: { type: Boolean },
30
31
  middlePlaceholder: {}
31
32
  },
32
- emits: ["update:keyword", "checkAll", "allCheck", "groupCheck", "optionCheck", "optionsCheck"],
33
- setup(l, { expose: W, emit: j }) {
34
- const t = l, v = j, g = z("scrollbarRef"), T = z("searchInputRef"), J = m(), $ = m(0), D = m(0), w = m(""), x = m(), G = m(0), R = m(!1);
35
- let A;
36
- const Q = h(() => t.rows.length * t.rowHeight), X = h(() => Math.max(1, Math.ceil(D.value / t.rowHeight))), y = h(() => Math.max(0, Math.floor($.value / t.rowHeight) - Y)), Z = h(() => Math.min(t.rows.length, y.value + X.value + Y * 2)), _ = h(() => y.value * t.rowHeight), ee = h(() => t.rows.slice(y.value, Z.value)), le = h(() => {
33
+ emits: ["update:keyword", "checkAll", "allCheck", "groupCheck", "optionCheck", "optionsCheck", "selectCreatedOptions"],
34
+ setup(t, { expose: W, emit: j }) {
35
+ const l = t, c = j, g = q("scrollbarRef"), x = q("searchInputRef"), J = m(), T = m(0), D = m(0), w = m(""), b = m(), G = m(0), R = m(!1);
36
+ let B;
37
+ const Q = v(() => l.rows.length * l.rowHeight), X = v(() => Math.max(1, Math.ceil(D.value / l.rowHeight))), y = v(() => Math.max(0, Math.floor(T.value / l.rowHeight) - Y)), Z = v(() => Math.min(l.rows.length, y.value + X.value + Y * 2)), _ = v(() => y.value * l.rowHeight), ee = v(() => l.rows.slice(y.value, Z.value)), le = v(() => {
37
38
  var e;
38
- return ((e = t.rows[0]) == null ? void 0 : e.type) === "group";
39
- }), te = h(
40
- () => t.rows.filter((e) => e.type === "options").flatMap((e) => e.options).filter((e) => !e.disabled)
39
+ return ((e = l.rows[0]) == null ? void 0 : e.type) === "group";
40
+ }), te = v(
41
+ () => l.rows.filter((e) => e.type === "options").flatMap((e) => e.options).filter((e) => !e.disabled)
41
42
  );
42
43
  M(
43
- () => t.keyword,
44
+ () => l.keyword,
44
45
  (e) => {
45
46
  w.value = e;
46
47
  },
47
48
  { immediate: !0 }
48
49
  );
49
- function B() {
50
+ function A() {
50
51
  var a;
51
52
  const e = (a = g.value) == null ? void 0 : a.wrapRef;
52
- e && (J.value = e, D.value = e.clientHeight, $.value = e.scrollTop);
53
+ e && (J.value = e, D.value = e.clientHeight, T.value = e.scrollTop);
53
54
  }
54
- ue(
55
+ ce(
55
56
  () => {
56
57
  var e;
57
58
  return (e = g.value) == null ? void 0 : e.wrapRef;
58
59
  },
59
- () => B()
60
+ () => A()
60
61
  );
61
- function L() {
62
+ function K() {
62
63
  var a;
63
64
  const e = (a = g.value) == null ? void 0 : a.wrapRef;
64
- e && ($.value = e.scrollTop);
65
+ e && (T.value = e.scrollTop);
65
66
  }
66
67
  function ae(e) {
67
- x.value = void 0, G.value += 1, requestAnimationFrame(() => {
68
- x.value = e, A && clearTimeout(A), A = setTimeout(() => {
69
- x.value = void 0;
68
+ b.value = void 0, G.value += 1, requestAnimationFrame(() => {
69
+ b.value = e, B && clearTimeout(B), B = setTimeout(() => {
70
+ b.value = void 0;
70
71
  }, 1400);
71
72
  });
72
73
  }
73
- async function N(e) {
74
- var c;
75
- await K(), B();
76
- const a = t.rows.findIndex((r) => r.type === "group" && r.group.value === e);
74
+ async function L(e) {
75
+ var f;
76
+ await U(), A();
77
+ const a = l.rows.findIndex((r) => r.type === "group" && r.group.value === e);
77
78
  if (a < 0) return;
78
- const o = a * t.rowHeight;
79
- (c = g.value) == null || c.setScrollTop(o), requestAnimationFrame(() => {
80
- L(), ae(e);
79
+ const o = a * l.rowHeight;
80
+ (f = g.value) == null || f.setScrollTop(o), requestAnimationFrame(() => {
81
+ K(), ae(e);
81
82
  });
82
83
  }
83
84
  function oe(e) {
84
- var q;
85
- if (t.disabled)
85
+ var N;
86
+ if (l.disabled)
86
87
  return;
87
88
  e.preventDefault();
88
- const a = ((q = e.clipboardData) == null ? void 0 : q.getData("text")) || "";
89
- w.value = a.trim(), t.pasteSearch ? v("update:keyword", w.value) : (R.value = !0, requestAnimationFrame(() => {
89
+ const a = ((N = e.clipboardData) == null ? void 0 : N.getData("text")) || "";
90
+ w.value = a.trim(), l.pasteSearch ? c("update:keyword", w.value) : (R.value = !0, requestAnimationFrame(() => {
90
91
  R.value = !1;
91
92
  }));
92
- const o = ve(a, t.separator), c = () => {
93
+ const o = me(a, l.separator), f = () => {
93
94
  requestAnimationFrame(() => {
94
- var U;
95
- const u = (U = T.value) == null ? void 0 : U.input;
95
+ var O;
96
+ const u = (O = x.value) == null ? void 0 : O.input;
96
97
  u == null || u.focus(), u == null || u.select();
97
98
  });
98
99
  };
99
100
  if (!o.length) {
100
- c();
101
+ f();
101
102
  return;
102
103
  }
103
104
  const r = new Set(o), C = te.value.filter((u) => r.has(u.label) || r.has(String(u.value))).map((u) => u.value);
104
105
  if (!C.length) {
105
- c();
106
+ f();
106
107
  return;
107
108
  }
108
- if (t.multiple) {
109
- v("optionsCheck", C, !0), c();
109
+ if (l.multiple) {
110
+ c("optionsCheck", C, !0), f();
110
111
  return;
111
112
  }
112
- v("optionCheck", C.at(-1), !0), c();
113
+ c("optionCheck", C.at(-1), !0), f();
113
114
  }
114
115
  function re(e) {
115
- w.value = e, !R.value && v("update:keyword", e);
116
+ w.value = e, !R.value && c("update:keyword", e);
117
+ }
118
+ function se(e) {
119
+ var a;
120
+ !l.allowCreate || l.disabled || e.isComposing || (a = x.value) != null && a.isComposing || (e.preventDefault(), e.stopPropagation(), c("update:keyword", w.value), c("selectCreatedOptions"));
116
121
  }
117
122
  return M(
118
- () => t.scrollToGroupValue,
123
+ () => l.scrollToGroupValue,
119
124
  async (e) => {
120
- e !== void 0 && await N(e);
125
+ e !== void 0 && await L(e);
121
126
  },
122
127
  { flush: "post" }
123
128
  ), M(
124
- () => t.rows.length,
129
+ () => l.rows.length,
125
130
  async () => {
126
- await K(), B();
131
+ await U(), A();
127
132
  },
128
133
  { immediate: !0 }
129
134
  ), W({
130
- scrollToGroup: N,
135
+ scrollToGroup: L,
131
136
  inputFocus: () => {
132
137
  var e, a;
133
- (a = (e = T.value) == null ? void 0 : e.focus) == null || a.call(e);
138
+ (a = (e = x.value) == null ? void 0 : e.focus) == null || a.call(e);
134
139
  }
135
- }), (e, a) => (s(), f("div", {
136
- class: n(`${l.prefixCls}__list`)
140
+ }), (e, a) => (s(), p("div", {
141
+ class: n(`${t.prefixCls}__list`)
137
142
  }, [
138
143
  k("div", {
139
- class: n(`${l.prefixCls}__toolbar`)
144
+ class: n(`${t.prefixCls}__toolbar`)
140
145
  }, [
141
- p(i(de), {
146
+ h(i(fe), {
142
147
  ref_key: "searchInputRef",
143
- ref: T,
148
+ ref: x,
144
149
  "model-value": w.value,
145
- class: n(`${l.prefixCls}__search`),
146
- placeholder: t.middlePlaceholder,
150
+ class: n(`${t.prefixCls}__search`),
151
+ placeholder: l.allowCreate ? `${l.middlePlaceholder}(可创建)` : l.middlePlaceholder,
147
152
  clearable: "",
148
153
  "onUpdate:modelValue": re,
149
- onPaste: oe
154
+ onPaste: oe,
155
+ onKeydown: ie(se, ["enter"])
150
156
  }, {
151
157
  prefix: d(() => [
152
- p(i(ce), null, {
158
+ h(i(pe), null, {
153
159
  default: d(() => [
154
- p(i(ie))
160
+ h(i(de))
155
161
  ]),
156
162
  _: 1
157
163
  })
158
164
  ]),
159
165
  _: 1
160
166
  }, 8, ["model-value", "class", "placeholder"]),
161
- l.multiple && l.showMultiple ? (s(), I(i(ne), {
167
+ t.multiple && t.showMultiple ? (s(), I(i(ue), {
162
168
  key: 0,
163
- disabled: l.disabled,
169
+ disabled: t.disabled,
164
170
  plain: "",
165
- onClick: a[0] || (a[0] = () => v("checkAll", !0))
171
+ onClick: a[0] || (a[0] = () => c("checkAll", !0))
166
172
  }, {
167
173
  default: d(() => [...a[2] || (a[2] = [
168
174
  k("span", null, "全选", -1)
169
175
  ])]),
170
176
  _: 1
171
- }, 8, ["disabled"])) : O("", !0)
177
+ }, 8, ["disabled"])) : z("", !0)
172
178
  ], 2),
173
- t.showAll ? (s(), f("div", {
179
+ l.showAll ? (s(), p("div", {
174
180
  key: 0,
175
- class: n([`${l.prefixCls}__panel-head`, le.value ? "is-standalone" : ""])
181
+ class: n([`${t.prefixCls}__panel-head`, le.value ? "is-standalone" : ""])
176
182
  }, [
177
- p(i(F), {
178
- disabled: l.disabled,
179
- "model-value": t.allChecked,
180
- onChange: a[1] || (a[1] = (o) => v("allCheck", !!o))
183
+ h(i(F), {
184
+ disabled: t.disabled,
185
+ "model-value": l.allChecked,
186
+ onChange: a[1] || (a[1] = (o) => c("allCheck", !!o))
181
187
  }, {
182
188
  default: d(() => [
183
- p(i(S), null, {
189
+ h(i($), null, {
184
190
  default: d(() => [...a[3] || (a[3] = [
185
- b("全部", -1)
191
+ S("全部", -1)
186
192
  ])]),
187
193
  _: 1
188
194
  })
189
195
  ]),
190
196
  _: 1
191
197
  }, 8, ["disabled", "model-value"])
192
- ], 2)) : O("", !0),
198
+ ], 2)) : z("", !0),
193
199
  k("div", {
194
- class: n(`${l.prefixCls}__checkbox-group`)
200
+ class: n(`${t.prefixCls}__checkbox-group`)
195
201
  }, [
196
- p(i(fe), {
202
+ h(i(he), {
197
203
  ref_key: "scrollbarRef",
198
204
  ref: g,
199
- class: n(`${l.prefixCls}__middle-scrollbar`),
200
- onScroll: L
205
+ class: n(`${t.prefixCls}__middle-scrollbar`),
206
+ onScroll: K
201
207
  }, {
202
208
  default: d(() => [
203
209
  k("div", {
204
- class: n(`${l.prefixCls}__middle-virtual-host`),
210
+ class: n(`${t.prefixCls}__middle-virtual-host`),
205
211
  style: P({ height: `${Q.value}px` })
206
212
  }, [
207
213
  k("div", {
208
214
  style: P({ transform: `translateY(${_.value}px)` })
209
215
  }, [
210
- (s(!0), f(H, null, V(ee.value, (o, c) => (s(), f("div", {
216
+ (s(!0), p(H, null, V(ee.value, (o, f) => (s(), p("div", {
211
217
  key: o.key,
212
- style: P({ height: `${l.rowHeight}px` }),
218
+ style: P({ height: `${t.rowHeight}px` }),
213
219
  class: n([
214
- `${l.prefixCls}__middle-row`,
215
- o.type === "group" ? `${l.prefixCls}__middle-group` : `${l.prefixCls}__middle-options`,
220
+ `${t.prefixCls}__middle-row`,
221
+ o.type === "group" ? `${t.prefixCls}__middle-group` : `${t.prefixCls}__middle-options`,
216
222
  o.type === "options" && o.isLast ? "is-last" : "",
217
- o.type === "options" && y.value + c === 0 && !t.showAll ? "is-first" : "",
218
- x.value === o.group.value ? `${l.prefixCls}__group-flash` : ""
223
+ o.type === "options" && y.value + f === 0 && !l.showAll ? "is-first" : "",
224
+ b.value === o.group.value ? `${t.prefixCls}__group-flash` : ""
219
225
  ]),
220
- "data-virtual-index": y.value + c,
226
+ "data-virtual-index": y.value + f,
221
227
  "data-flash-seed": G.value
222
228
  }, [
223
- o.type === "group" ? (s(), f("div", {
229
+ o.type === "group" ? (s(), p("div", {
224
230
  key: 0,
225
- class: n(`${l.prefixCls}__panel-head`)
231
+ class: n(`${t.prefixCls}__panel-head`)
226
232
  }, [
227
- t.multiple ? (s(), I(i(F), {
233
+ l.multiple ? (s(), I(i(F), {
228
234
  key: 0,
229
- "model-value": l.groupCheckedMap[String(o.group.value)],
230
- indeterminate: l.groupIndeterminateMap[String(o.group.value)],
231
- disabled: l.disabled,
232
- onChange: (r) => v("groupCheck", o.group.value, !!r)
235
+ "model-value": t.groupCheckedMap[String(o.group.value)],
236
+ indeterminate: t.groupIndeterminateMap[String(o.group.value)],
237
+ disabled: t.disabled,
238
+ onChange: (r) => c("groupCheck", o.group.value, !!r)
233
239
  }, {
234
240
  default: d(() => [
235
- p(i(S), null, {
241
+ h(i($), null, {
236
242
  default: d(() => [
237
- b(E(o.group.label), 1)
243
+ S(E(o.group.label), 1)
238
244
  ]),
239
245
  _: 2
240
246
  }, 1024)
241
247
  ]),
242
248
  _: 2
243
- }, 1032, ["model-value", "indeterminate", "disabled", "onChange"])) : (s(), I(i(S), { key: 1 }, {
249
+ }, 1032, ["model-value", "indeterminate", "disabled", "onChange"])) : (s(), I(i($), { key: 1 }, {
244
250
  default: d(() => [
245
- b(E(o.group.label), 1)
251
+ S(E(o.group.label), 1)
246
252
  ]),
247
253
  _: 2
248
254
  }, 1024))
249
- ], 2)) : (s(), f("div", {
255
+ ], 2)) : (s(), p("div", {
250
256
  key: 1,
251
- class: n(`${l.prefixCls}__option-row`)
257
+ class: n(`${t.prefixCls}__option-row`)
252
258
  }, [
253
- (s(!0), f(H, null, V(o.options, (r) => (s(), f("div", {
259
+ (s(!0), p(H, null, V(o.options, (r) => (s(), p("div", {
254
260
  key: r.value,
255
- class: n(`${l.prefixCls}__option-cell`)
261
+ class: n(`${t.prefixCls}__option-cell`)
256
262
  }, [
257
- p(i(F), {
258
- "model-value": t.selectedValueSet.has(r.value),
259
- disabled: l.disabled || r.disabled,
260
- class: n(`${l.prefixCls}__option`),
261
- onChange: (C) => v("optionCheck", r.value, !!C)
263
+ h(i(F), {
264
+ "model-value": l.selectedValueSet.has(r.value),
265
+ disabled: t.disabled || r.disabled,
266
+ class: n(`${t.prefixCls}__option`),
267
+ onChange: (C) => c("optionCheck", r.value, !!C)
262
268
  }, {
263
269
  default: d(() => [
264
- p(i(S), { "tool-tip-line": 2 }, {
270
+ h(i($), { "tool-tip-line": 2 }, {
265
271
  default: d(() => [
266
- b(E(r.label), 1)
272
+ S(E(r.label), 1)
267
273
  ]),
268
274
  _: 2
269
275
  }, 1024)
@@ -271,12 +277,12 @@ const he = ["data-virtual-index", "data-flash-seed"], Y = 2, be = /* @__PURE__ *
271
277
  _: 2
272
278
  }, 1032, ["model-value", "disabled", "class", "onChange"])
273
279
  ], 2))), 128)),
274
- (s(!0), f(H, null, V(l.optionPerRow - o.options.length, (r) => (s(), f("div", {
280
+ (s(!0), p(H, null, V(t.optionPerRow - o.options.length, (r) => (s(), p("div", {
275
281
  key: `empty-${o.key}-${r}`,
276
- class: n(`${l.prefixCls}__option-cell`)
282
+ class: n(`${t.prefixCls}__option-cell`)
277
283
  }, null, 2))), 128))
278
284
  ], 2))
279
- ], 14, he))), 128))
285
+ ], 14, we))), 128))
280
286
  ], 4)
281
287
  ], 6)
282
288
  ]),
@@ -287,5 +293,5 @@ const he = ["data-virtual-index", "data-flash-seed"], Y = 2, be = /* @__PURE__ *
287
293
  }
288
294
  });
289
295
  export {
290
- be as default
296
+ $e as default
291
297
  };
@@ -26,6 +26,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
26
26
  disabled: boolean;
27
27
  immediate: boolean;
28
28
  params: import('../../../../../utils/src').Recordable;
29
+ allowCreate: boolean;
29
30
  multiple: boolean;
30
31
  options: PanelSelectOption[];
31
32
  treeConfig: import('./types').PanelSelectTreeConfig;
@@ -53,6 +54,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
53
54
  onGroupCheck?: ((groupValue: PanelSelectValue, checked: boolean) => any) | undefined;
54
55
  onOptionCheck?: ((value: PanelSelectValue, checked: boolean) => any) | undefined;
55
56
  onOptionsCheck?: ((values: PanelSelectValue[], checked: boolean) => any) | undefined;
57
+ onSelectCreatedOptions?: (() => any) | undefined;
56
58
  }>, {
57
59
  scrollToGroup: (groupValue: PanelSelectValue) => Promise<void>;
58
60
  inputFocus: () => void;
@@ -63,6 +65,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
63
65
  groupCheck: (groupValue: PanelSelectValue, checked: boolean) => any;
64
66
  optionCheck: (value: PanelSelectValue, checked: boolean) => any;
65
67
  optionsCheck: (values: PanelSelectValue[], checked: boolean) => any;
68
+ selectCreatedOptions: () => any;
66
69
  }, import('vue').PublicProps, {
67
70
  disabled: boolean;
68
71
  showMultiple: boolean;
@@ -397,6 +400,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
397
400
  onGroupCheck?: ((groupValue: PanelSelectValue, checked: boolean) => any) | undefined;
398
401
  onOptionCheck?: ((value: PanelSelectValue, checked: boolean) => any) | undefined;
399
402
  onOptionsCheck?: ((values: PanelSelectValue[], checked: boolean) => any) | undefined;
403
+ onSelectCreatedOptions?: (() => any) | undefined;
400
404
  }>, {
401
405
  scrollToGroup: (groupValue: PanelSelectValue) => Promise<void>;
402
406
  inputFocus: () => void;
@@ -1,8 +1,9 @@
1
- import { defineComponent as qe, mergeModels as I, useModel as He, computed as u, watch as O, ref as v, useTemplateRef as $, unref as r, onMounted as Je, createElementBlock as z, openBlock as A, normalizeClass as j, createVNode as q, mergeProps as Qe, withCtx as Xe, withDirectives as Ye, normalizeStyle as Ze, createBlock as H, createCommentVNode as J, nextTick as E } from "vue";
1
+ import { defineComponent as tl, mergeModels as ee, useModel as al, computed as i, watch as N, ref as w, useTemplateRef as L, unref as s, onMounted as ol, createElementBlock as le, openBlock as A, normalizeClass as te, createVNode as ae, mergeProps as nl, withCtx as rl, withDirectives as il, normalizeStyle as sl, createBlock as oe, createCommentVNode as ne, nextTick as P } from "vue";
2
2
  import "../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.34_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
3
- import { useDesign as el } from "../../../packages/hooks/src/useDesign.js";
3
+ import { useDesign as ul } from "../../../packages/hooks/src/useDesign.js";
4
4
  import "axios";
5
- import { ElSelect as ll, vLoading as tl } from "element-plus";
5
+ import { ElSelect as cl, vLoading as dl } from "element-plus";
6
+ import { isString as pl } from "../../../packages/utils/src/is.js";
6
7
  import "dayjs";
7
8
  import "numeral";
8
9
  import "xe-utils";
@@ -15,19 +16,20 @@ import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-
15
16
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
16
17
  import "lodash-es";
17
18
  import "vue-router";
18
- import { useResizeObserver as al } from "@vueuse/core";
19
- import { useSelectCollapseOptions as ol } from "../../tt-form/src/hooks/useSelectCollapse.js";
20
- import { ALL as nl, DEFAULT_PANEL_SELECT_SEPARATORS as il } from "./common.js";
21
- import rl from "./components/PanelLeft.vue.js";
22
- import ul from "./components/PanelMiddle.vue.js";
23
- import sl from "./components/PanelRight.vue.js";
24
- import { usePanelSelectData as cl } from "./hooks/usePanelData.js";
25
- import { usePanelSelectSelection as dl } from "./hooks/usePanelSelection.js";
19
+ import { useResizeObserver as fl } from "@vueuse/core";
20
+ import { useSelectCollapseOptions as ml } from "../../tt-form/src/hooks/useSelectCollapse.js";
21
+ import { splitPanelSelectText as R, ALL as hl, DEFAULT_PANEL_SELECT_SEPARATORS as vl } from "./common.js";
22
+ import wl from "./components/PanelLeft.vue.js";
23
+ import yl from "./components/PanelMiddle.vue.js";
24
+ import gl from "./components/PanelRight.vue.js";
25
+ import { usePanelSelectData as Cl } from "./hooks/usePanelData.js";
26
+ import { usePanelSelectSelection as kl } from "./hooks/usePanelSelection.js";
26
27
  /* empty css */
27
- const m = 4, Wl = /* @__PURE__ */ qe({
28
+ const h = 4, Jl = /* @__PURE__ */ tl({
28
29
  name: "TtPanelSelect",
29
30
  __name: "index",
30
- props: /* @__PURE__ */ I({
31
+ props: /* @__PURE__ */ ee({
32
+ allowCreate: { type: Boolean, default: !1 },
31
33
  disabled: { type: Boolean, default: !1 },
32
34
  showNav: { type: Boolean, default: !0 },
33
35
  multiple: { type: Boolean, default: !0 },
@@ -48,11 +50,11 @@ const m = 4, Wl = /* @__PURE__ */ qe({
48
50
  immediate: { type: Boolean, default: !0 },
49
51
  beforeFetch: { type: Function, default: void 0 },
50
52
  afterFetch: { type: Function, default: void 0 },
51
- separator: { default: () => [...il] },
53
+ separator: { default: () => [...vl] },
52
54
  pasteSearch: { type: Boolean, default: !0 },
53
55
  alwaysLoad: { type: Boolean, default: !1 },
54
56
  showAll: { type: Boolean, default: !0 },
55
- showAllField: { default: nl },
57
+ showAllField: { default: hl },
56
58
  showPinyinMode: { type: Boolean, default: !1 },
57
59
  showOriginMode: { type: Boolean, default: !0 },
58
60
  leftPlaceholder: { default: "支持模糊搜索" },
@@ -62,56 +64,64 @@ const m = 4, Wl = /* @__PURE__ */ qe({
62
64
  modelValue: {},
63
65
  modelModifiers: {}
64
66
  }),
65
- emits: /* @__PURE__ */ I(["visible-change", "change", "focus"], ["update:modelValue"]),
66
- setup(s, { expose: Q, emit: X }) {
67
- const Y = tl, Z = ll, t = s, C = X, { prefixCls: p } = el("panel-select"), {
68
- loading: ee,
69
- fetchApi: f,
70
- treeOptions: le,
71
- navTreeOptions: F,
72
- navNodes: te,
73
- leafNodes: h,
74
- isFirstLoaded: ae,
75
- buildOptionGroups: oe
76
- } = cl(t), n = He(s, "modelValue");
77
- let P;
78
- const R = u(() => t.disabled), ne = u(() => {
79
- if (!t.multiple) return t.placeholder;
80
- const e = t.showMultiple ? "支持多选和全选" : "支持多选", l = typeof t.placeholder == "string" && t.placeholder.trim() ? t.placeholder.trim().replace(/[,,]\s*$/, "") : "请选择";
81
- return l.includes("支持多选和全选") || l.includes("支持多选") ? l : `${l},${e}`;
82
- }), ie = u(() => {
67
+ emits: /* @__PURE__ */ ee(["visible-change", "change", "focus"], ["update:modelValue"]),
68
+ setup(c, { expose: re, emit: ie }) {
69
+ const se = dl, ue = cl, t = c, b = ie, { prefixCls: f } = ul("panel-select"), {
70
+ loading: B,
71
+ fetchApi: v,
72
+ treeOptions: ce,
73
+ navTreeOptions: T,
74
+ navNodes: de,
75
+ leafNodes: m,
76
+ isFirstLoaded: G,
77
+ filterNodes: pe,
78
+ buildOptionGroups: _
79
+ } = Cl(t), r = al(c, "modelValue");
80
+ let W;
81
+ const D = i(() => t.disabled), fe = i(() => {
82
+ if (!t.multiple)
83
+ return t.allowCreate ? `${t.placeholder ? t.placeholder : "请选择"}(可创建)` : t.placeholder;
84
+ const e = t.showMultiple ? "支持多选和全选" : "支持多选", l = typeof t.placeholder == "string" && t.placeholder.trim() ? t.placeholder.trim().replace(/[,,]\s*$/, "") : "请选择", a = l.includes("支持多选和全选") || l.includes("支持多选") ? l : `${l},${e}`;
85
+ return t.allowCreate ? `${a}(可创建)` : a;
86
+ }), me = i(() => {
83
87
  const e = /* @__PURE__ */ new Map();
84
- return h.value.forEach((l) => e.set(l.value, l.label)), e;
88
+ return m.value.forEach((l) => e.set(l.value, l.label)), e;
85
89
  });
86
90
  function x(e) {
87
- return e === t.showAllField ? { label: "全部", value: t.showAllField } : { label: ie.value.get(e) ?? String(e), value: e };
91
+ return e === t.showAllField ? { label: "全部", value: t.showAllField } : { label: me.value.get(e) ?? String(e), value: e };
88
92
  }
89
- function L(e) {
93
+ function K(e) {
90
94
  if (e != null)
91
95
  return typeof e == "object" && "value" in e ? e.value : e;
92
96
  }
93
- const re = u({
97
+ const U = i({
94
98
  get() {
95
- return Array.isArray(n.value) ? t.multiple ? n.value : n.value.slice(-1) : n.value === void 0 ? [] : [n.value];
99
+ return Array.isArray(r.value) ? t.multiple ? r.value : r.value.slice(-1) : r.value === void 0 ? [] : [r.value];
96
100
  },
97
101
  set(e) {
98
- n.value = t.multiple ? [...e] : e.at(-1);
102
+ r.value = t.multiple ? [...e] : e.at(-1);
99
103
  }
100
- });
101
- O([() => t.multiple, () => n.value], ([e, l]) => {
104
+ }), S = i(() => {
105
+ if (!t.allowCreate) return [];
106
+ const e = new Set(m.value.map((a) => a.value)), l = [];
107
+ return new Set(U.value).forEach((a) => {
108
+ !pl(a) || a === t.showAllField || e.has(a) || l.push({ label: a, value: a, level: 0, path: [], raw: { label: a, value: a } });
109
+ }), l;
110
+ }), V = i(() => [...m.value, ...S.value]);
111
+ N([() => t.multiple, () => r.value], ([e, l]) => {
102
112
  if (e) {
103
- Array.isArray(l) || (n.value = l === void 0 ? [] : [l]);
113
+ Array.isArray(l) || (r.value = l === void 0 ? [] : [l]);
104
114
  return;
105
115
  }
106
- Array.isArray(l) && (n.value = l.at(-1));
116
+ Array.isArray(l) && (r.value = l.at(-1));
107
117
  });
108
- const b = v(), y = v(""), w = v(""), S = v(), V = $("middleRef"), g = $("selectWrapRef"), B = $("selectRef"), M = v(0);
109
- function N() {
118
+ const O = w(), y = w(""), d = w(""), M = w(), $ = L("middleRef"), g = L("selectWrapRef"), I = L("selectRef"), E = w(0);
119
+ function z() {
110
120
  const e = g.value;
111
- e && (M.value = e.offsetWidth);
121
+ e && (E.value = e.offsetWidth);
112
122
  }
113
- al(g, () => N());
114
- const ue = u(() => ({
123
+ fl(g, () => z());
124
+ const he = i(() => ({
115
125
  componentProps: {
116
126
  multiple: t.multiple,
117
127
  component: {
@@ -120,99 +130,135 @@ const m = 4, Wl = /* @__PURE__ */ qe({
120
130
  },
121
131
  component: "TtPanelSelect",
122
132
  selectWrapRef: g,
123
- selectRef: B
124
- })), { selectComponentProps: se } = ol(ue), T = u(() => {
133
+ selectRef: I
134
+ })), { selectComponentProps: ve } = ml(he), j = i(() => {
125
135
  const e = y.value.trim().toLowerCase();
126
- if (!e) return F.value;
136
+ if (!e) return T.value;
127
137
  const l = (a) => {
128
138
  const o = [];
129
- return a.forEach((i) => {
130
- var _;
131
- const c = (_ = i.children) != null && _.length ? l(i.children) : void 0;
132
- (String(i.label).toLowerCase().includes(e) || c && c.length) && o.push({ ...i, children: c != null && c.length ? c : void 0 });
139
+ return a.forEach((n) => {
140
+ var Z;
141
+ const u = (Z = n.children) != null && Z.length ? l(n.children) : void 0;
142
+ (String(n.label).toLowerCase().includes(e) || u && u.length) && o.push({ ...n, children: u != null && u.length ? u : void 0 });
133
143
  }), o;
134
144
  };
135
- return l(F.value);
136
- }), ce = u(() => {
145
+ return l(T.value);
146
+ }), we = i(() => {
137
147
  const e = [], l = (a) => {
138
148
  a.forEach((o) => {
139
- var i;
140
- e.push(o.value), (i = o.children) != null && i.length && l(o.children);
149
+ var n;
150
+ e.push(o.value), (n = o.children) != null && n.length && l(o.children);
141
151
  });
142
152
  };
143
- return l(T.value), e;
144
- }), k = u(() => oe(h.value, w.value)), de = u(() => {
153
+ return l(j.value), e;
154
+ }), C = i(
155
+ () => ge(d.value).map((e) => ({
156
+ label: e,
157
+ value: e,
158
+ level: 0,
159
+ path: [],
160
+ raw: { label: e, value: e }
161
+ }))
162
+ ), ye = i(() => [...V.value, ...C.value]), k = i(() => {
163
+ const e = _(m.value, d.value), l = pe([...S.value, ...C.value], d.value);
164
+ if (!l.length) return e;
165
+ const a = new Map(l.map((u) => [u.value, u])), o = [];
166
+ R(d.value, t.separator).forEach((u) => {
167
+ const F = a.get(u);
168
+ F && (o.push(F), a.delete(u));
169
+ }), o.push(...a.values());
170
+ let n = "__created__";
171
+ for (; e.some((u) => u.value === n); ) n += "_";
172
+ return [{ value: n, label: "自定义", options: o }, ...e];
173
+ });
174
+ function ge(e) {
175
+ if (!t.allowCreate || t.disabled || B.value || t.api && !G.value) return [];
176
+ const l = R(e, t.separator);
177
+ if (!l.length || _(m.value, e).length) return [];
178
+ const a = new Set(V.value.map((o) => `${o.value}`));
179
+ return [...new Set(l)].filter((o) => o !== `${t.showAllField}` && !a.has(o));
180
+ }
181
+ function Ce() {
182
+ if (!C.value.length) return;
183
+ const e = new Set(
184
+ [...S.value, ...C.value].map((a) => a.value)
185
+ ), l = [...new Set(R(d.value, t.separator))].filter(
186
+ (a) => e.has(a)
187
+ );
188
+ Y(l, !0);
189
+ }
190
+ const ke = i(() => {
145
191
  const e = "minmax(var(--tt-panel-select-middle-width, 450px), 1fr)";
146
192
  return t.showNav && !t.multiple ? `200px ${e}` : !t.showNav && t.multiple ? `${e} 180px` : !t.showNav && !t.multiple ? e : `200px ${e} 180px`;
147
- }), pe = u(() => {
193
+ }), Ae = i(() => {
148
194
  const e = "var(--tt-panel-select-middle-width, 450px)";
149
195
  return t.showNav && !t.multiple ? `max(calc(200px + ${e}), 800px)` : !t.showNav && t.multiple ? `max(calc(${e} + 180px), 800px)` : !t.showNav && !t.multiple ? `max(${e}, 800px)` : `max(calc(200px + ${e} + 180px), 800px)`;
150
- }), me = u(() => {
196
+ }), be = i(() => {
151
197
  const e = [];
152
198
  return k.value.forEach((l) => {
153
199
  !(t.showOriginMode && l.value === "__origin__") && e.push({ key: `group-${String(l.value)}`, type: "group", group: l });
154
- const o = Math.ceil(l.options.length / m);
155
- for (let i = 0; i < l.options.length; i += m) {
156
- const c = i / m;
200
+ const o = Math.ceil(l.options.length / h);
201
+ for (let n = 0; n < l.options.length; n += h) {
202
+ const u = n / h;
157
203
  e.push({
158
- key: `options-${String(l.value)}-${i / m}`,
204
+ key: `options-${String(l.value)}-${n / h}`,
159
205
  type: "options",
160
206
  group: l,
161
- options: l.options.slice(i, i + m),
162
- isLast: c === o - 1
207
+ options: l.options.slice(n, n + h),
208
+ isLast: u === o - 1
163
209
  });
164
210
  }
165
211
  }), e;
166
212
  }), {
167
- selectedOptions: fe,
168
- selectedValueSet: G,
169
- isAllChecked: he,
170
- isIndeterminate: ve,
171
- getGroupCheckCount: ye,
172
- handleGroupCheck: we,
173
- handleAllOptionCheck: ge,
174
- handleOptionCheck: ke,
175
- handleOptionsCheck: Ae,
176
- handleCheckAll: Ce,
177
- clearSelected: xe,
178
- removeSelected: be,
179
- withLockedSelectedValues: Se
180
- } = dl({
181
- multiple: u(() => t.multiple),
182
- modelValue: n,
183
- selectedValues: re,
184
- leafNodes: h,
185
- allValue: u(() => t.showAllField)
186
- }), W = u({
213
+ selectedOptions: xe,
214
+ selectedValueSet: q,
215
+ isAllChecked: Se,
216
+ isIndeterminate: Ve,
217
+ getGroupCheckCount: Oe,
218
+ handleGroupCheck: Me,
219
+ handleAllOptionCheck: $e,
220
+ handleOptionCheck: Ee,
221
+ handleOptionsCheck: Fe,
222
+ handleCheckAll: Ne,
223
+ clearSelected: Le,
224
+ removeSelected: Pe,
225
+ withLockedSelectedValues: Re
226
+ } = kl({
227
+ multiple: i(() => t.multiple),
228
+ modelValue: r,
229
+ selectedValues: U,
230
+ leafNodes: ye,
231
+ allValue: i(() => t.showAllField)
232
+ }), H = i({
187
233
  get() {
188
234
  if (t.multiple)
189
- return (Array.isArray(n.value) ? n.value : n.value === void 0 ? [] : [n.value]).map((l) => x(l));
190
- if (Array.isArray(n.value)) {
191
- const e = n.value.at(-1);
235
+ return (Array.isArray(r.value) ? r.value : r.value === void 0 ? [] : [r.value]).map((l) => x(l));
236
+ if (Array.isArray(r.value)) {
237
+ const e = r.value.at(-1);
192
238
  return e === void 0 ? void 0 : x(e);
193
239
  }
194
- return n.value === void 0 ? void 0 : x(n.value);
240
+ return r.value === void 0 ? void 0 : x(r.value);
195
241
  },
196
242
  set(e) {
197
- const l = r(n);
198
- if (P = Array.isArray(l) ? [...l] : l, t.multiple) {
199
- const o = (Array.isArray(e) ? e : []).map((i) => L(i)).filter((i) => i !== void 0);
200
- n.value = Se(o);
243
+ const l = s(r);
244
+ if (W = Array.isArray(l) ? [...l] : l, t.multiple) {
245
+ const o = (Array.isArray(e) ? e : []).map((n) => K(n)).filter((n) => n !== void 0);
246
+ r.value = Re(o);
201
247
  return;
202
248
  }
203
- n.value = L(e);
249
+ r.value = K(e);
204
250
  }
205
- }), D = u(
251
+ }), J = i(
206
252
  () => {
207
253
  const e = {}, l = {};
208
254
  return k.value.forEach((a) => {
209
- const { enabledCount: o, checkedCount: i } = ye(a), c = String(a.value);
210
- e[c] = o > 0 && i === o, l[c] = o > 0 && i > 0 && i < o;
255
+ const { enabledCount: o, checkedCount: n } = Oe(a), u = String(a.value);
256
+ e[u] = o > 0 && n === o, l[u] = o > 0 && n > 0 && n < o;
211
257
  }), { checkedMap: e, indeterminateMap: l };
212
258
  }
213
- ), Ve = u(() => D.value.checkedMap), Me = u(() => D.value.indeterminateMap), Oe = u(() => G.value.has(t.showAllField)), K = u(() => [...t.showAll ? [{ label: "全部", value: t.showAllField }] : [], ...h.value.map((l) => ({ ...l }))]);
214
- function $e(e) {
215
- const l = r(K);
259
+ ), Be = i(() => J.value.checkedMap), Te = i(() => J.value.indeterminateMap), Ge = i(() => q.value.has(t.showAllField)), Q = i(() => [...t.showAll ? [{ label: "全部", value: t.showAllField }] : [], ...V.value.map((l) => ({ ...l }))]);
260
+ function _e(e) {
261
+ const l = s(Q);
216
262
  if (Array.isArray(e)) {
217
263
  const a = new Set(e);
218
264
  return l.filter((o) => o.value !== void 0 && a.has(o.value));
@@ -220,195 +266,197 @@ const m = 4, Wl = /* @__PURE__ */ qe({
220
266
  if (e !== void 0)
221
267
  return l.find((a) => a.value === e);
222
268
  }
223
- function Ee(e) {
269
+ function We(e) {
224
270
  var a;
225
271
  if (t.showPinyinMode || k.value.some((o) => o.value === e.value)) return e.value;
226
- const l = h.value.find((o) => o.path.some((i) => i.value === e.value));
272
+ const l = m.value.find((o) => o.path.some((n) => n.value === e.value));
227
273
  return (a = l == null ? void 0 : l.path.at(-2)) == null ? void 0 : a.value;
228
274
  }
229
- function Fe(e) {
230
- b.value = e.value;
231
- const l = Ee(e);
232
- S.value = void 0, E(() => {
275
+ function De(e) {
276
+ O.value = e.value;
277
+ const l = We(e);
278
+ M.value = void 0, P(() => {
233
279
  var a;
234
- S.value = l, l !== void 0 && ((a = V.value) == null || a.scrollToGroup(l));
280
+ M.value = l, l !== void 0 && ((a = $.value) == null || a.scrollToGroup(l));
235
281
  });
236
282
  }
237
- function Pe(e) {
283
+ function Ke(e) {
238
284
  y.value = e;
239
285
  }
240
- function Re(e) {
241
- w.value = e;
286
+ function Ue(e) {
287
+ d.value = e;
242
288
  }
243
- function Le(e, l) {
289
+ function Ie(e, l) {
244
290
  const a = k.value.find((o) => o.value === e);
245
- a && we(a, l);
291
+ a && Me(a, l);
246
292
  }
247
- async function Be(e) {
293
+ async function ze(e) {
248
294
  var l;
249
- C("visible-change", e), e && (w.value = "", y.value = "", await E(), (l = V.value) == null || l.inputFocus(), N(), t.alwaysLoad ? await f() : !t.immediate && !r(ae) && await f());
295
+ b("visible-change", e), e && (d.value = "", y.value = "", await P(), (l = $.value) == null || l.inputFocus(), z(), t.alwaysLoad ? await v() : !t.immediate && !s(G) && await v());
250
296
  }
251
- function Ne() {
252
- U(P);
297
+ function je() {
298
+ X(W);
253
299
  }
254
- function Te(e) {
255
- C("change", e, [...r(K)], $e(e));
300
+ function qe(e) {
301
+ b("change", e, [...s(Q)], _e(e));
256
302
  }
257
- function Ge(e, l) {
303
+ function He(e, l) {
258
304
  return Array.isArray(e) && Array.isArray(l) ? e.length === l.length && e.every((a, o) => a === l[o]) : e === l;
259
305
  }
260
- function U(e) {
261
- E(() => {
262
- const l = r(n);
263
- Ge(l, e) || Te(l);
306
+ function X(e) {
307
+ P(() => {
308
+ const l = s(r);
309
+ He(l, e) || qe(l);
264
310
  });
265
311
  }
266
- function d(e) {
267
- const l = r(n), a = Array.isArray(l) ? [...l] : l;
268
- e(), U(a);
312
+ function p(e) {
313
+ const l = s(r), a = Array.isArray(l) ? [...l] : l;
314
+ e(), X(a);
269
315
  }
270
- function We(e) {
271
- d(() => {
272
- ge(e);
316
+ function Je(e) {
317
+ p(() => {
318
+ $e(e);
273
319
  });
274
320
  }
275
- function De(e) {
276
- d(() => {
277
- Ce(e);
321
+ function Qe(e) {
322
+ p(() => {
323
+ Ne(e);
278
324
  });
279
325
  }
280
- function Ke(e, l) {
281
- d(() => {
282
- Le(e, l);
326
+ function Xe(e, l) {
327
+ p(() => {
328
+ Ie(e, l);
283
329
  });
284
330
  }
285
- function Ue(e, l) {
286
- d(() => {
287
- ke(e, l);
331
+ function Ye(e, l) {
332
+ p(() => {
333
+ Ee(e, l);
288
334
  });
289
335
  }
290
- function _e(e, l) {
291
- d(() => {
292
- Ae(e, l);
336
+ function Y(e, l) {
337
+ p(() => {
338
+ Fe(e, l);
293
339
  });
294
340
  }
295
- function Ie(e) {
296
- d(() => {
297
- be(e);
341
+ function Ze(e) {
342
+ p(() => {
343
+ Pe(e);
298
344
  });
299
345
  }
300
- function ze() {
301
- d(() => {
302
- xe();
346
+ function el() {
347
+ p(() => {
348
+ Le();
303
349
  });
304
350
  }
305
- function je(e) {
306
- C("focus", e);
351
+ function ll(e) {
352
+ b("focus", e);
307
353
  }
308
- return O(
354
+ return N(
309
355
  () => t.params,
310
356
  () => {
311
- f();
357
+ v();
312
358
  },
313
359
  { deep: !0 }
314
- ), O(
315
- te,
360
+ ), N(
361
+ de,
316
362
  (e) => {
317
363
  var l;
318
- b.value !== void 0 || !e.length || (b.value = (l = e[0]) == null ? void 0 : l.value);
364
+ O.value !== void 0 || !e.length || (O.value = (l = e[0]) == null ? void 0 : l.value);
319
365
  },
320
366
  { immediate: !0 }
321
- ), Je(() => {
322
- t.immediate && f();
323
- }), Q({
367
+ ), ol(() => {
368
+ t.immediate && v();
369
+ }), re({
324
370
  /** 重新加载数据源*/
325
- reload: f,
371
+ reload: v,
326
372
  /** 获取当前归一化后的树形选项数据 */
327
- getOptions: () => r(le),
373
+ getOptions: () => s(ce),
328
374
  /** 获取当前v-model值 */
329
- getValue: () => r(n)
330
- }), (e, l) => (A(), z("div", {
375
+ getValue: () => s(r)
376
+ }), (e, l) => (A(), le("div", {
331
377
  ref_key: "selectWrapRef",
332
378
  ref: g,
333
- class: j(r(p))
379
+ class: te(s(f))
334
380
  }, [
335
- q(r(Z), Qe({
381
+ ae(s(ue), nl({
336
382
  ref_key: "selectRef",
337
- ref: B,
338
- modelValue: W.value,
339
- "onUpdate:modelValue": l[0] || (l[0] = (a) => W.value = a)
340
- }, r(se), {
341
- multiple: s.multiple,
383
+ ref: I,
384
+ modelValue: H.value,
385
+ "onUpdate:modelValue": l[0] || (l[0] = (a) => H.value = a)
386
+ }, s(ve), {
387
+ multiple: c.multiple,
342
388
  filterable: !1,
343
- placeholder: ne.value,
389
+ placeholder: fe.value,
344
390
  persistent: !1,
345
391
  "fallback-placements": ["bottom-start", "bottom-end", "bottom", "top-start", "top-end", "top", "right", "left"],
346
- disabled: s.disabled,
347
- "popper-class": `${r(p)}__popper vxe-table--ignore-clear`,
348
- onVisibleChange: Be,
349
- onChange: Ne,
350
- onFocus: je
392
+ disabled: c.disabled,
393
+ "popper-class": `${s(f)}__popper vxe-table--ignore-clear`,
394
+ onVisibleChange: ze,
395
+ onChange: je,
396
+ onFocus: ll
351
397
  }), {
352
- empty: Xe(() => [
353
- Ye((A(), z("div", {
398
+ empty: rl(() => [
399
+ il((A(), le("div", {
354
400
  "element-loading-text": "加载中",
355
- class: j(`${r(p)}__panel`),
356
- style: Ze({
357
- "--columns": de.value,
358
- "--panel-min-width": pe.value,
359
- "--panel-width": M.value ? `${M.value}px` : "100%"
401
+ class: te(`${s(f)}__panel`),
402
+ style: sl({
403
+ "--columns": ke.value,
404
+ "--panel-min-width": Ae.value,
405
+ "--panel-width": E.value ? `${E.value}px` : "100%"
360
406
  })
361
407
  }, [
362
- t.showNav ? (A(), H(rl, {
408
+ t.showNav ? (A(), oe(wl, {
363
409
  key: 0,
364
- "prefix-cls": r(p),
410
+ "prefix-cls": s(f),
365
411
  keyword: y.value,
366
- "tree-data": T.value,
367
- "expanded-keys": ce.value,
368
- "left-placeholder": s.leftPlaceholder,
369
- "onUpdate:keyword": Pe,
370
- onSelect: Fe
371
- }, null, 8, ["prefix-cls", "keyword", "tree-data", "expanded-keys", "left-placeholder"])) : J("", !0),
372
- q(ul, {
412
+ "tree-data": j.value,
413
+ "expanded-keys": we.value,
414
+ "left-placeholder": c.leftPlaceholder,
415
+ "onUpdate:keyword": Ke,
416
+ onSelect: De
417
+ }, null, 8, ["prefix-cls", "keyword", "tree-data", "expanded-keys", "left-placeholder"])) : ne("", !0),
418
+ ae(yl, {
373
419
  ref_key: "middleRef",
374
- ref: V,
375
- "prefix-cls": r(p),
376
- multiple: s.multiple,
377
- keyword: w.value,
378
- rows: me.value,
379
- disabled: R.value,
420
+ ref: $,
421
+ "allow-create": t.allowCreate,
422
+ "prefix-cls": s(f),
423
+ multiple: c.multiple,
424
+ keyword: d.value,
425
+ rows: be.value,
426
+ disabled: D.value,
380
427
  "show-all": t.showAll,
381
- "option-per-row": m,
428
+ "option-per-row": h,
382
429
  "row-height": 40,
383
- "selected-value-set": r(G),
384
- "is-all-checked": r(he),
385
- "is-indeterminate": r(ve),
386
- "all-checked": Oe.value,
387
- "scroll-to-group-value": S.value,
388
- "group-checked-map": Ve.value,
389
- "group-indeterminate-map": Me.value,
390
- "paste-search": s.pasteSearch,
391
- separator: s.separator,
392
- "middle-placeholder": s.middlePlaceholder,
393
- "show-multiple": s.showMultiple,
394
- "onUpdate:keyword": Re,
395
- onAllCheck: We,
396
- onCheckAll: De,
397
- onGroupCheck: Ke,
398
- onOptionCheck: Ue,
399
- onOptionsCheck: _e
400
- }, null, 8, ["prefix-cls", "multiple", "keyword", "rows", "disabled", "show-all", "selected-value-set", "is-all-checked", "is-indeterminate", "all-checked", "scroll-to-group-value", "group-checked-map", "group-indeterminate-map", "paste-search", "separator", "middle-placeholder", "show-multiple"]),
401
- t.multiple ? (A(), H(sl, {
430
+ "selected-value-set": s(q),
431
+ "is-all-checked": s(Se),
432
+ "is-indeterminate": s(Ve),
433
+ "all-checked": Ge.value,
434
+ "scroll-to-group-value": M.value,
435
+ "group-checked-map": Be.value,
436
+ "group-indeterminate-map": Te.value,
437
+ "paste-search": c.pasteSearch,
438
+ separator: c.separator,
439
+ "middle-placeholder": c.middlePlaceholder,
440
+ "show-multiple": c.showMultiple,
441
+ "onUpdate:keyword": Ue,
442
+ onAllCheck: Je,
443
+ onCheckAll: Qe,
444
+ onGroupCheck: Xe,
445
+ onOptionCheck: Ye,
446
+ onOptionsCheck: Y,
447
+ onSelectCreatedOptions: Ce
448
+ }, null, 8, ["allow-create", "prefix-cls", "multiple", "keyword", "rows", "disabled", "show-all", "selected-value-set", "is-all-checked", "is-indeterminate", "all-checked", "scroll-to-group-value", "group-checked-map", "group-indeterminate-map", "paste-search", "separator", "middle-placeholder", "show-multiple"]),
449
+ t.multiple ? (A(), oe(gl, {
402
450
  key: 1,
403
- "prefix-cls": r(p),
404
- multiple: s.multiple,
405
- disabled: R.value,
406
- "selected-options": r(fe),
407
- onClearAll: ze,
408
- onRemove: Ie
409
- }, null, 8, ["prefix-cls", "multiple", "disabled", "selected-options"])) : J("", !0)
451
+ "prefix-cls": s(f),
452
+ multiple: c.multiple,
453
+ disabled: D.value,
454
+ "selected-options": s(xe),
455
+ onClearAll: el,
456
+ onRemove: Ze
457
+ }, null, 8, ["prefix-cls", "multiple", "disabled", "selected-options"])) : ne("", !0)
410
458
  ], 6)), [
411
- [r(Y), r(ee)]
459
+ [s(se), s(B)]
412
460
  ])
413
461
  ]),
414
462
  _: 1
@@ -417,5 +465,5 @@ const m = 4, Wl = /* @__PURE__ */ qe({
417
465
  }
418
466
  });
419
467
  export {
420
- Wl as default
468
+ Jl as default
421
469
  };
@@ -10,6 +10,8 @@ export interface PanelSelectOption extends Recordable {
10
10
  children?: PanelSelectOption[];
11
11
  }
12
12
  export interface PanelMiddleProps {
13
+ /** 是否展示可创建占位提示,并允许 Enter 选中创建候选 */
14
+ allowCreate?: boolean;
13
15
  /** 是否禁用 */
14
16
  disabled: boolean;
15
17
  /** class */
@@ -61,6 +63,8 @@ export interface PanelSelectTreeConfig {
61
63
  rootParentValue?: PanelSelectValue | null;
62
64
  }
63
65
  export interface PanelContainerProps {
66
+ /** 搜索完全无匹配时生成文本候选,点击或 Enter 选中 */
67
+ allowCreate?: boolean;
64
68
  /** 是否禁用 */
65
69
  disabled?: boolean;
66
70
  /** 是否显示左侧导航树 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.6.56",
3
+ "version": "1.6.59",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -69,8 +69,8 @@
69
69
  "vue-router": "^5.0.2",
70
70
  "vxe-pc-ui": "^4.14.15",
71
71
  "vxe-table": "^4.18.13",
72
- "@dazhicheng/hooks": "1.4.61",
73
- "@dazhicheng/utils": "1.3.58"
72
+ "@dazhicheng/hooks": "1.4.63",
73
+ "@dazhicheng/utils": "1.3.60"
74
74
  },
75
75
  "files": [
76
76
  "dist"