@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.
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -0
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.js +120 -114
- package/dist/components/tt-panel-select/src/index.vue.d.ts +4 -0
- package/dist/components/tt-panel-select/src/index.vue.js +277 -229
- package/dist/components/tt-panel-select/src/types.d.ts +4 -0
- package/package.json +3 -3
|
@@ -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
|
|
2
|
-
import { TtButton as
|
|
3
|
-
import { TtText as
|
|
4
|
-
import { Search as
|
|
5
|
-
import { useResizeObserver as
|
|
6
|
-
import { ElInput as
|
|
7
|
-
import { DEFAULT_PANEL_SELECT_SEPARATORS as
|
|
8
|
-
const
|
|
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: () => [...
|
|
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(
|
|
34
|
-
const
|
|
35
|
-
let
|
|
36
|
-
const Q =
|
|
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 =
|
|
39
|
-
}), te =
|
|
40
|
-
() =>
|
|
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
|
-
() =>
|
|
44
|
+
() => l.keyword,
|
|
44
45
|
(e) => {
|
|
45
46
|
w.value = e;
|
|
46
47
|
},
|
|
47
48
|
{ immediate: !0 }
|
|
48
49
|
);
|
|
49
|
-
function
|
|
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,
|
|
53
|
+
e && (J.value = e, D.value = e.clientHeight, T.value = e.scrollTop);
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
+
ce(
|
|
55
56
|
() => {
|
|
56
57
|
var e;
|
|
57
58
|
return (e = g.value) == null ? void 0 : e.wrapRef;
|
|
58
59
|
},
|
|
59
|
-
() =>
|
|
60
|
+
() => A()
|
|
60
61
|
);
|
|
61
|
-
function
|
|
62
|
+
function K() {
|
|
62
63
|
var a;
|
|
63
64
|
const e = (a = g.value) == null ? void 0 : a.wrapRef;
|
|
64
|
-
e && (
|
|
65
|
+
e && (T.value = e.scrollTop);
|
|
65
66
|
}
|
|
66
67
|
function ae(e) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
|
74
|
-
var
|
|
75
|
-
await
|
|
76
|
-
const a =
|
|
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 *
|
|
79
|
-
(
|
|
80
|
-
|
|
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
|
|
85
|
-
if (
|
|
85
|
+
var N;
|
|
86
|
+
if (l.disabled)
|
|
86
87
|
return;
|
|
87
88
|
e.preventDefault();
|
|
88
|
-
const a = ((
|
|
89
|
-
w.value = a.trim(),
|
|
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 =
|
|
93
|
+
const o = me(a, l.separator), f = () => {
|
|
93
94
|
requestAnimationFrame(() => {
|
|
94
|
-
var
|
|
95
|
-
const u = (
|
|
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
|
-
|
|
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
|
-
|
|
106
|
+
f();
|
|
106
107
|
return;
|
|
107
108
|
}
|
|
108
|
-
if (
|
|
109
|
-
|
|
109
|
+
if (l.multiple) {
|
|
110
|
+
c("optionsCheck", C, !0), f();
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
|
-
|
|
113
|
+
c("optionCheck", C.at(-1), !0), f();
|
|
113
114
|
}
|
|
114
115
|
function re(e) {
|
|
115
|
-
w.value = e, !R.value &&
|
|
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
|
-
() =>
|
|
123
|
+
() => l.scrollToGroupValue,
|
|
119
124
|
async (e) => {
|
|
120
|
-
e !== void 0 && await
|
|
125
|
+
e !== void 0 && await L(e);
|
|
121
126
|
},
|
|
122
127
|
{ flush: "post" }
|
|
123
128
|
), M(
|
|
124
|
-
() =>
|
|
129
|
+
() => l.rows.length,
|
|
125
130
|
async () => {
|
|
126
|
-
await
|
|
131
|
+
await U(), A();
|
|
127
132
|
},
|
|
128
133
|
{ immediate: !0 }
|
|
129
134
|
), W({
|
|
130
|
-
scrollToGroup:
|
|
135
|
+
scrollToGroup: L,
|
|
131
136
|
inputFocus: () => {
|
|
132
137
|
var e, a;
|
|
133
|
-
(a = (e =
|
|
138
|
+
(a = (e = x.value) == null ? void 0 : e.focus) == null || a.call(e);
|
|
134
139
|
}
|
|
135
|
-
}), (e, a) => (s(),
|
|
136
|
-
class: n(`${
|
|
140
|
+
}), (e, a) => (s(), p("div", {
|
|
141
|
+
class: n(`${t.prefixCls}__list`)
|
|
137
142
|
}, [
|
|
138
143
|
k("div", {
|
|
139
|
-
class: n(`${
|
|
144
|
+
class: n(`${t.prefixCls}__toolbar`)
|
|
140
145
|
}, [
|
|
141
|
-
|
|
146
|
+
h(i(fe), {
|
|
142
147
|
ref_key: "searchInputRef",
|
|
143
|
-
ref:
|
|
148
|
+
ref: x,
|
|
144
149
|
"model-value": w.value,
|
|
145
|
-
class: n(`${
|
|
146
|
-
placeholder:
|
|
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
|
-
|
|
158
|
+
h(i(pe), null, {
|
|
153
159
|
default: d(() => [
|
|
154
|
-
|
|
160
|
+
h(i(de))
|
|
155
161
|
]),
|
|
156
162
|
_: 1
|
|
157
163
|
})
|
|
158
164
|
]),
|
|
159
165
|
_: 1
|
|
160
166
|
}, 8, ["model-value", "class", "placeholder"]),
|
|
161
|
-
|
|
167
|
+
t.multiple && t.showMultiple ? (s(), I(i(ue), {
|
|
162
168
|
key: 0,
|
|
163
|
-
disabled:
|
|
169
|
+
disabled: t.disabled,
|
|
164
170
|
plain: "",
|
|
165
|
-
onClick: a[0] || (a[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"])) :
|
|
177
|
+
}, 8, ["disabled"])) : z("", !0)
|
|
172
178
|
], 2),
|
|
173
|
-
|
|
179
|
+
l.showAll ? (s(), p("div", {
|
|
174
180
|
key: 0,
|
|
175
|
-
class: n([`${
|
|
181
|
+
class: n([`${t.prefixCls}__panel-head`, le.value ? "is-standalone" : ""])
|
|
176
182
|
}, [
|
|
177
|
-
|
|
178
|
-
disabled:
|
|
179
|
-
"model-value":
|
|
180
|
-
onChange: a[1] || (a[1] = (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
|
-
|
|
189
|
+
h(i($), null, {
|
|
184
190
|
default: d(() => [...a[3] || (a[3] = [
|
|
185
|
-
|
|
191
|
+
S("全部", -1)
|
|
186
192
|
])]),
|
|
187
193
|
_: 1
|
|
188
194
|
})
|
|
189
195
|
]),
|
|
190
196
|
_: 1
|
|
191
197
|
}, 8, ["disabled", "model-value"])
|
|
192
|
-
], 2)) :
|
|
198
|
+
], 2)) : z("", !0),
|
|
193
199
|
k("div", {
|
|
194
|
-
class: n(`${
|
|
200
|
+
class: n(`${t.prefixCls}__checkbox-group`)
|
|
195
201
|
}, [
|
|
196
|
-
|
|
202
|
+
h(i(he), {
|
|
197
203
|
ref_key: "scrollbarRef",
|
|
198
204
|
ref: g,
|
|
199
|
-
class: n(`${
|
|
200
|
-
onScroll:
|
|
205
|
+
class: n(`${t.prefixCls}__middle-scrollbar`),
|
|
206
|
+
onScroll: K
|
|
201
207
|
}, {
|
|
202
208
|
default: d(() => [
|
|
203
209
|
k("div", {
|
|
204
|
-
class: n(`${
|
|
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),
|
|
216
|
+
(s(!0), p(H, null, V(ee.value, (o, f) => (s(), p("div", {
|
|
211
217
|
key: o.key,
|
|
212
|
-
style: P({ height: `${
|
|
218
|
+
style: P({ height: `${t.rowHeight}px` }),
|
|
213
219
|
class: n([
|
|
214
|
-
`${
|
|
215
|
-
o.type === "group" ? `${
|
|
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 +
|
|
218
|
-
|
|
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 +
|
|
226
|
+
"data-virtual-index": y.value + f,
|
|
221
227
|
"data-flash-seed": G.value
|
|
222
228
|
}, [
|
|
223
|
-
o.type === "group" ? (s(),
|
|
229
|
+
o.type === "group" ? (s(), p("div", {
|
|
224
230
|
key: 0,
|
|
225
|
-
class: n(`${
|
|
231
|
+
class: n(`${t.prefixCls}__panel-head`)
|
|
226
232
|
}, [
|
|
227
|
-
|
|
233
|
+
l.multiple ? (s(), I(i(F), {
|
|
228
234
|
key: 0,
|
|
229
|
-
"model-value":
|
|
230
|
-
indeterminate:
|
|
231
|
-
disabled:
|
|
232
|
-
onChange: (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
|
-
|
|
241
|
+
h(i($), null, {
|
|
236
242
|
default: d(() => [
|
|
237
|
-
|
|
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(
|
|
249
|
+
}, 1032, ["model-value", "indeterminate", "disabled", "onChange"])) : (s(), I(i($), { key: 1 }, {
|
|
244
250
|
default: d(() => [
|
|
245
|
-
|
|
251
|
+
S(E(o.group.label), 1)
|
|
246
252
|
]),
|
|
247
253
|
_: 2
|
|
248
254
|
}, 1024))
|
|
249
|
-
], 2)) : (s(),
|
|
255
|
+
], 2)) : (s(), p("div", {
|
|
250
256
|
key: 1,
|
|
251
|
-
class: n(`${
|
|
257
|
+
class: n(`${t.prefixCls}__option-row`)
|
|
252
258
|
}, [
|
|
253
|
-
(s(!0),
|
|
259
|
+
(s(!0), p(H, null, V(o.options, (r) => (s(), p("div", {
|
|
254
260
|
key: r.value,
|
|
255
|
-
class: n(`${
|
|
261
|
+
class: n(`${t.prefixCls}__option-cell`)
|
|
256
262
|
}, [
|
|
257
|
-
|
|
258
|
-
"model-value":
|
|
259
|
-
disabled:
|
|
260
|
-
class: n(`${
|
|
261
|
-
onChange: (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
|
-
|
|
270
|
+
h(i($), { "tool-tip-line": 2 }, {
|
|
265
271
|
default: d(() => [
|
|
266
|
-
|
|
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),
|
|
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(`${
|
|
282
|
+
class: n(`${t.prefixCls}__option-cell`)
|
|
277
283
|
}, null, 2))), 128))
|
|
278
284
|
], 2))
|
|
279
|
-
], 14,
|
|
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
|
-
|
|
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
|
|
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
|
|
3
|
+
import { useDesign as ul } from "../../../packages/hooks/src/useDesign.js";
|
|
4
4
|
import "axios";
|
|
5
|
-
import { ElSelect as
|
|
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
|
|
19
|
-
import { useSelectCollapseOptions as
|
|
20
|
-
import { ALL as
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import { usePanelSelectData as
|
|
25
|
-
import { usePanelSelectSelection as
|
|
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
|
|
28
|
+
const h = 4, Jl = /* @__PURE__ */ tl({
|
|
28
29
|
name: "TtPanelSelect",
|
|
29
30
|
__name: "index",
|
|
30
|
-
props: /* @__PURE__ */
|
|
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: () => [...
|
|
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:
|
|
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__ */
|
|
66
|
-
setup(
|
|
67
|
-
const
|
|
68
|
-
loading:
|
|
69
|
-
fetchApi:
|
|
70
|
-
treeOptions:
|
|
71
|
-
navTreeOptions:
|
|
72
|
-
navNodes:
|
|
73
|
-
leafNodes:
|
|
74
|
-
isFirstLoaded:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
|
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:
|
|
91
|
+
return e === t.showAllField ? { label: "全部", value: t.showAllField } : { label: me.value.get(e) ?? String(e), value: e };
|
|
88
92
|
}
|
|
89
|
-
function
|
|
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
|
|
97
|
+
const U = i({
|
|
94
98
|
get() {
|
|
95
|
-
return Array.isArray(
|
|
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
|
-
|
|
102
|
+
r.value = t.multiple ? [...e] : e.at(-1);
|
|
99
103
|
}
|
|
100
|
-
})
|
|
101
|
-
|
|
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) || (
|
|
113
|
+
Array.isArray(l) || (r.value = l === void 0 ? [] : [l]);
|
|
104
114
|
return;
|
|
105
115
|
}
|
|
106
|
-
Array.isArray(l) && (
|
|
116
|
+
Array.isArray(l) && (r.value = l.at(-1));
|
|
107
117
|
});
|
|
108
|
-
const
|
|
109
|
-
function
|
|
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 && (
|
|
121
|
+
e && (E.value = e.offsetWidth);
|
|
112
122
|
}
|
|
113
|
-
|
|
114
|
-
const
|
|
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:
|
|
124
|
-
})), { selectComponentProps:
|
|
133
|
+
selectRef: I
|
|
134
|
+
})), { selectComponentProps: ve } = ml(he), j = i(() => {
|
|
125
135
|
const e = y.value.trim().toLowerCase();
|
|
126
|
-
if (!e) return
|
|
136
|
+
if (!e) return T.value;
|
|
127
137
|
const l = (a) => {
|
|
128
138
|
const o = [];
|
|
129
|
-
return a.forEach((
|
|
130
|
-
var
|
|
131
|
-
const
|
|
132
|
-
(String(
|
|
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(
|
|
136
|
-
}),
|
|
145
|
+
return l(T.value);
|
|
146
|
+
}), we = i(() => {
|
|
137
147
|
const e = [], l = (a) => {
|
|
138
148
|
a.forEach((o) => {
|
|
139
|
-
var
|
|
140
|
-
e.push(o.value), (
|
|
149
|
+
var n;
|
|
150
|
+
e.push(o.value), (n = o.children) != null && n.length && l(o.children);
|
|
141
151
|
});
|
|
142
152
|
};
|
|
143
|
-
return l(
|
|
144
|
-
}),
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
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 /
|
|
155
|
-
for (let
|
|
156
|
-
const
|
|
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)}-${
|
|
204
|
+
key: `options-${String(l.value)}-${n / h}`,
|
|
159
205
|
type: "options",
|
|
160
206
|
group: l,
|
|
161
|
-
options: l.options.slice(
|
|
162
|
-
isLast:
|
|
207
|
+
options: l.options.slice(n, n + h),
|
|
208
|
+
isLast: u === o - 1
|
|
163
209
|
});
|
|
164
210
|
}
|
|
165
211
|
}), e;
|
|
166
212
|
}), {
|
|
167
|
-
selectedOptions:
|
|
168
|
-
selectedValueSet:
|
|
169
|
-
isAllChecked:
|
|
170
|
-
isIndeterminate:
|
|
171
|
-
getGroupCheckCount:
|
|
172
|
-
handleGroupCheck:
|
|
173
|
-
handleAllOptionCheck:
|
|
174
|
-
handleOptionCheck:
|
|
175
|
-
handleOptionsCheck:
|
|
176
|
-
handleCheckAll:
|
|
177
|
-
clearSelected:
|
|
178
|
-
removeSelected:
|
|
179
|
-
withLockedSelectedValues:
|
|
180
|
-
} =
|
|
181
|
-
multiple:
|
|
182
|
-
modelValue:
|
|
183
|
-
selectedValues:
|
|
184
|
-
leafNodes:
|
|
185
|
-
allValue:
|
|
186
|
-
}),
|
|
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(
|
|
190
|
-
if (Array.isArray(
|
|
191
|
-
const e =
|
|
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
|
|
240
|
+
return r.value === void 0 ? void 0 : x(r.value);
|
|
195
241
|
},
|
|
196
242
|
set(e) {
|
|
197
|
-
const l = r
|
|
198
|
-
if (
|
|
199
|
-
const o = (Array.isArray(e) ? e : []).map((
|
|
200
|
-
|
|
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
|
-
|
|
249
|
+
r.value = K(e);
|
|
204
250
|
}
|
|
205
|
-
}),
|
|
251
|
+
}), J = i(
|
|
206
252
|
() => {
|
|
207
253
|
const e = {}, l = {};
|
|
208
254
|
return k.value.forEach((a) => {
|
|
209
|
-
const { enabledCount: o, checkedCount:
|
|
210
|
-
e[
|
|
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
|
-
),
|
|
214
|
-
function
|
|
215
|
-
const l =
|
|
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
|
|
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 =
|
|
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
|
|
230
|
-
|
|
231
|
-
const l =
|
|
232
|
-
|
|
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
|
-
|
|
280
|
+
M.value = l, l !== void 0 && ((a = $.value) == null || a.scrollToGroup(l));
|
|
235
281
|
});
|
|
236
282
|
}
|
|
237
|
-
function
|
|
283
|
+
function Ke(e) {
|
|
238
284
|
y.value = e;
|
|
239
285
|
}
|
|
240
|
-
function
|
|
241
|
-
|
|
286
|
+
function Ue(e) {
|
|
287
|
+
d.value = e;
|
|
242
288
|
}
|
|
243
|
-
function
|
|
289
|
+
function Ie(e, l) {
|
|
244
290
|
const a = k.value.find((o) => o.value === e);
|
|
245
|
-
a &&
|
|
291
|
+
a && Me(a, l);
|
|
246
292
|
}
|
|
247
|
-
async function
|
|
293
|
+
async function ze(e) {
|
|
248
294
|
var l;
|
|
249
|
-
|
|
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
|
|
252
|
-
|
|
297
|
+
function je() {
|
|
298
|
+
X(W);
|
|
253
299
|
}
|
|
254
|
-
function
|
|
255
|
-
|
|
300
|
+
function qe(e) {
|
|
301
|
+
b("change", e, [...s(Q)], _e(e));
|
|
256
302
|
}
|
|
257
|
-
function
|
|
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
|
|
261
|
-
|
|
262
|
-
const l = r
|
|
263
|
-
|
|
306
|
+
function X(e) {
|
|
307
|
+
P(() => {
|
|
308
|
+
const l = s(r);
|
|
309
|
+
He(l, e) || qe(l);
|
|
264
310
|
});
|
|
265
311
|
}
|
|
266
|
-
function
|
|
267
|
-
const l = r
|
|
268
|
-
e(),
|
|
312
|
+
function p(e) {
|
|
313
|
+
const l = s(r), a = Array.isArray(l) ? [...l] : l;
|
|
314
|
+
e(), X(a);
|
|
269
315
|
}
|
|
270
|
-
function
|
|
271
|
-
|
|
272
|
-
|
|
316
|
+
function Je(e) {
|
|
317
|
+
p(() => {
|
|
318
|
+
$e(e);
|
|
273
319
|
});
|
|
274
320
|
}
|
|
275
|
-
function
|
|
276
|
-
|
|
277
|
-
|
|
321
|
+
function Qe(e) {
|
|
322
|
+
p(() => {
|
|
323
|
+
Ne(e);
|
|
278
324
|
});
|
|
279
325
|
}
|
|
280
|
-
function
|
|
281
|
-
|
|
282
|
-
|
|
326
|
+
function Xe(e, l) {
|
|
327
|
+
p(() => {
|
|
328
|
+
Ie(e, l);
|
|
283
329
|
});
|
|
284
330
|
}
|
|
285
|
-
function
|
|
286
|
-
|
|
287
|
-
|
|
331
|
+
function Ye(e, l) {
|
|
332
|
+
p(() => {
|
|
333
|
+
Ee(e, l);
|
|
288
334
|
});
|
|
289
335
|
}
|
|
290
|
-
function
|
|
291
|
-
|
|
292
|
-
|
|
336
|
+
function Y(e, l) {
|
|
337
|
+
p(() => {
|
|
338
|
+
Fe(e, l);
|
|
293
339
|
});
|
|
294
340
|
}
|
|
295
|
-
function
|
|
296
|
-
|
|
297
|
-
|
|
341
|
+
function Ze(e) {
|
|
342
|
+
p(() => {
|
|
343
|
+
Pe(e);
|
|
298
344
|
});
|
|
299
345
|
}
|
|
300
|
-
function
|
|
301
|
-
|
|
302
|
-
|
|
346
|
+
function el() {
|
|
347
|
+
p(() => {
|
|
348
|
+
Le();
|
|
303
349
|
});
|
|
304
350
|
}
|
|
305
|
-
function
|
|
306
|
-
|
|
351
|
+
function ll(e) {
|
|
352
|
+
b("focus", e);
|
|
307
353
|
}
|
|
308
|
-
return
|
|
354
|
+
return N(
|
|
309
355
|
() => t.params,
|
|
310
356
|
() => {
|
|
311
|
-
|
|
357
|
+
v();
|
|
312
358
|
},
|
|
313
359
|
{ deep: !0 }
|
|
314
|
-
),
|
|
315
|
-
|
|
360
|
+
), N(
|
|
361
|
+
de,
|
|
316
362
|
(e) => {
|
|
317
363
|
var l;
|
|
318
|
-
|
|
364
|
+
O.value !== void 0 || !e.length || (O.value = (l = e[0]) == null ? void 0 : l.value);
|
|
319
365
|
},
|
|
320
366
|
{ immediate: !0 }
|
|
321
|
-
),
|
|
322
|
-
t.immediate &&
|
|
323
|
-
}),
|
|
367
|
+
), ol(() => {
|
|
368
|
+
t.immediate && v();
|
|
369
|
+
}), re({
|
|
324
370
|
/** 重新加载数据源*/
|
|
325
|
-
reload:
|
|
371
|
+
reload: v,
|
|
326
372
|
/** 获取当前归一化后的树形选项数据 */
|
|
327
|
-
getOptions: () =>
|
|
373
|
+
getOptions: () => s(ce),
|
|
328
374
|
/** 获取当前v-model值 */
|
|
329
|
-
getValue: () => r
|
|
330
|
-
}), (e, l) => (A(),
|
|
375
|
+
getValue: () => s(r)
|
|
376
|
+
}), (e, l) => (A(), le("div", {
|
|
331
377
|
ref_key: "selectWrapRef",
|
|
332
378
|
ref: g,
|
|
333
|
-
class:
|
|
379
|
+
class: te(s(f))
|
|
334
380
|
}, [
|
|
335
|
-
|
|
381
|
+
ae(s(ue), nl({
|
|
336
382
|
ref_key: "selectRef",
|
|
337
|
-
ref:
|
|
338
|
-
modelValue:
|
|
339
|
-
"onUpdate:modelValue": l[0] || (l[0] = (a) =>
|
|
340
|
-
},
|
|
341
|
-
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:
|
|
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:
|
|
347
|
-
"popper-class": `${
|
|
348
|
-
onVisibleChange:
|
|
349
|
-
onChange:
|
|
350
|
-
onFocus:
|
|
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:
|
|
353
|
-
|
|
398
|
+
empty: rl(() => [
|
|
399
|
+
il((A(), le("div", {
|
|
354
400
|
"element-loading-text": "加载中",
|
|
355
|
-
class:
|
|
356
|
-
style:
|
|
357
|
-
"--columns":
|
|
358
|
-
"--panel-min-width":
|
|
359
|
-
"--panel-width":
|
|
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(),
|
|
408
|
+
t.showNav ? (A(), oe(wl, {
|
|
363
409
|
key: 0,
|
|
364
|
-
"prefix-cls":
|
|
410
|
+
"prefix-cls": s(f),
|
|
365
411
|
keyword: y.value,
|
|
366
|
-
"tree-data":
|
|
367
|
-
"expanded-keys":
|
|
368
|
-
"left-placeholder":
|
|
369
|
-
"onUpdate:keyword":
|
|
370
|
-
onSelect:
|
|
371
|
-
}, null, 8, ["prefix-cls", "keyword", "tree-data", "expanded-keys", "left-placeholder"])) :
|
|
372
|
-
|
|
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:
|
|
375
|
-
"
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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":
|
|
428
|
+
"option-per-row": h,
|
|
382
429
|
"row-height": 40,
|
|
383
|
-
"selected-value-set":
|
|
384
|
-
"is-all-checked":
|
|
385
|
-
"is-indeterminate":
|
|
386
|
-
"all-checked":
|
|
387
|
-
"scroll-to-group-value":
|
|
388
|
-
"group-checked-map":
|
|
389
|
-
"group-indeterminate-map":
|
|
390
|
-
"paste-search":
|
|
391
|
-
separator:
|
|
392
|
-
"middle-placeholder":
|
|
393
|
-
"show-multiple":
|
|
394
|
-
"onUpdate:keyword":
|
|
395
|
-
onAllCheck:
|
|
396
|
-
onCheckAll:
|
|
397
|
-
onGroupCheck:
|
|
398
|
-
onOptionCheck:
|
|
399
|
-
onOptionsCheck:
|
|
400
|
-
|
|
401
|
-
|
|
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":
|
|
404
|
-
multiple:
|
|
405
|
-
disabled:
|
|
406
|
-
"selected-options":
|
|
407
|
-
onClearAll:
|
|
408
|
-
onRemove:
|
|
409
|
-
}, null, 8, ["prefix-cls", "multiple", "disabled", "selected-options"])) :
|
|
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
|
-
[
|
|
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
|
-
|
|
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.
|
|
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.
|
|
73
|
-
"@dazhicheng/utils": "1.3.
|
|
72
|
+
"@dazhicheng/hooks": "1.4.63",
|
|
73
|
+
"@dazhicheng/utils": "1.3.60"
|
|
74
74
|
},
|
|
75
75
|
"files": [
|
|
76
76
|
"dist"
|