@baishuyun/ui-base 6.6.1 → 6.7.1
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/Amap/AmapMarker/index.js +2 -2
- package/dist/Amap/AmapMarker-CMlzx_nj.js +153 -0
- package/dist/Amap/AmapMarkerCluster/index.js +2 -2
- package/dist/Amap/{AmapMarkerCluster-DvXchCC0.js → AmapMarkerCluster-MDUfcIqP.js} +27 -28
- package/dist/Amap/AmapProvider/index.js +1 -1
- package/dist/Amap/{AmapProvider-XCrqzo9W.js → AmapProvider-BGzdby3i.js} +19 -18
- package/dist/Amap/index.js +4 -4
- package/dist/Amap/{useMarkerInfoWindowController-G-Bg-NDJ.js → useMarkerInfoWindowController-BvP2jo7K.js} +21 -21
- package/dist/Select/{Select-CuAdbvvQ.js → Select-CAoozrW7.js} +193 -183
- package/dist/Select/index.js +1 -1
- package/dist/components/Amap/AmapMarkerCluster/utils.d.ts +0 -1
- package/dist/components/Amap/utils/constants.d.ts +2 -0
- package/dist/components/Select/__tests__/Select.optionDisabled.test.d.ts +1 -0
- package/dist/components/Select/interface.d.ts +0 -1
- package/dist/index.js +5 -5
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/Amap/AmapMarker-CB66dQIG.js +0 -152
|
@@ -16,47 +16,47 @@ import A from "clsx";
|
|
|
16
16
|
import { useControllableValue as ie, useHover as j, useToggle as ae } from "ahooks";
|
|
17
17
|
import { AnimatePresence as oe, motion as M } from "motion/react";
|
|
18
18
|
import { FloatingPortal as se } from "@floating-ui/react";
|
|
19
|
-
import
|
|
19
|
+
import ce from "fuse.js";
|
|
20
20
|
//#region src/components/Select/constants.ts
|
|
21
|
-
var
|
|
21
|
+
var N = /* @__PURE__ */ function(e) {
|
|
22
22
|
return e.SINGLE = "single", e.MULTIPLE = "multiple", e;
|
|
23
|
-
}({}),
|
|
23
|
+
}({}), P = /* @__PURE__ */ function(e) {
|
|
24
24
|
return e[e.SINGLE = 0] = "SINGLE", e[e.MULTIPLE = 1] = "MULTIPLE", e[e.TREE = 2] = "TREE", e[e.TREE_TAGS = 3] = "TREE_TAGS", e[e.MEMBER = 4] = "MEMBER", e[e.DEPARTEMENT = 5] = "DEPARTEMENT", e;
|
|
25
|
-
}({}),
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
},
|
|
25
|
+
}({}), le = {
|
|
26
|
+
[P.SINGLE]: N.SINGLE,
|
|
27
|
+
[P.TREE]: N.SINGLE,
|
|
28
|
+
[P.MULTIPLE]: N.MULTIPLE,
|
|
29
|
+
[P.TREE_TAGS]: N.MULTIPLE,
|
|
30
|
+
[P.MEMBER]: N.MULTIPLE,
|
|
31
|
+
[P.DEPARTEMENT]: N.MULTIPLE
|
|
32
|
+
}, ue = {
|
|
33
33
|
label: "label",
|
|
34
34
|
value: "value",
|
|
35
35
|
children: "children"
|
|
36
|
-
},
|
|
36
|
+
}, de = x({
|
|
37
37
|
value: void 0,
|
|
38
38
|
setValue: g,
|
|
39
39
|
isOpen: !1,
|
|
40
40
|
setIsOpen: g
|
|
41
|
-
}),
|
|
41
|
+
}), fe = x({
|
|
42
42
|
fieldNames: {
|
|
43
43
|
label: "label",
|
|
44
44
|
value: "value",
|
|
45
45
|
children: "children"
|
|
46
46
|
},
|
|
47
47
|
disabled: !1
|
|
48
|
-
}),
|
|
49
|
-
let e = T(
|
|
48
|
+
}), pe = x({}), F = () => {
|
|
49
|
+
let e = T(de);
|
|
50
50
|
if (!e) throw Error("Select.* components must be used within a SelectStateContext provider");
|
|
51
51
|
return e;
|
|
52
|
-
},
|
|
53
|
-
let e = T(
|
|
52
|
+
}, I = () => {
|
|
53
|
+
let e = T(fe);
|
|
54
54
|
if (!e) throw Error("Select.* components must be used within a SelectConfigContext provider");
|
|
55
55
|
return e;
|
|
56
|
-
},
|
|
56
|
+
}, L = () => T(pe);
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/components/Select/utils/fieldAccessor.ts
|
|
59
|
-
function
|
|
59
|
+
function R(e) {
|
|
60
60
|
let t = e;
|
|
61
61
|
return {
|
|
62
62
|
getLabel: (e) => e[t.label],
|
|
@@ -75,8 +75,8 @@ function z(e) {
|
|
|
75
75
|
}
|
|
76
76
|
//#endregion
|
|
77
77
|
//#region src/components/Select/SelectInput/SelectSingleInput/SelectSingleInput.tsx
|
|
78
|
-
var
|
|
79
|
-
let { value: t, inputValueStyle: n } = e, { fieldNames: r, otherInputPosition: i } =
|
|
78
|
+
var z = C((e) => {
|
|
79
|
+
let { value: t, inputValueStyle: n } = e, { fieldNames: r, otherInputPosition: i } = I(), { isSelectedOtherOption: a, otherOptionValue: o } = L(), s = R(r), c = f(t), l;
|
|
80
80
|
return l = a && o && i === "inline" ? o : e.labelRender && c ? e.labelRender(c) : c ? s.getLabel(c) : "", /* @__PURE__ */ v("div", {
|
|
81
81
|
className: A("bsy-select-input-container__input-value overflow-hidden"),
|
|
82
82
|
style: n,
|
|
@@ -86,38 +86,38 @@ var B = C((e) => {
|
|
|
86
86
|
})
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
|
-
|
|
89
|
+
z.displayName = "BsySelectSingleInput";
|
|
90
90
|
//#endregion
|
|
91
91
|
//#region src/components/Select/SelectInput/SelectMultipleInput/OptionTag/option-tag.module.scss
|
|
92
|
-
var
|
|
92
|
+
var B = {
|
|
93
93
|
"bsy-input-tag__container": "_bsy-input-tag__container_znvs6_1",
|
|
94
94
|
"bsy-input-tag__item": "_bsy-input-tag__item_znvs6_7",
|
|
95
95
|
"bsy-input-tag__item--disabled": "_bsy-input-tag__item--disabled_znvs6_20",
|
|
96
96
|
"bsy-input-tag__item-icon": "_bsy-input-tag__item-icon_znvs6_24"
|
|
97
|
-
},
|
|
97
|
+
}, V = S(({ children: e, style: t, disabled: n }, r) => /* @__PURE__ */ v("div", {
|
|
98
98
|
"data-bsy-input-tag": "true",
|
|
99
99
|
className: A({
|
|
100
|
-
[
|
|
101
|
-
[
|
|
100
|
+
[B["bsy-input-tag__item"]]: !0,
|
|
101
|
+
[B["bsy-input-tag__item--disabled"]]: n
|
|
102
102
|
}),
|
|
103
103
|
ref: r,
|
|
104
104
|
style: t,
|
|
105
105
|
children: e
|
|
106
106
|
}));
|
|
107
|
-
|
|
108
|
-
className: A(
|
|
107
|
+
V.Container = (e) => /* @__PURE__ */ v("div", {
|
|
108
|
+
className: A(B["bsy-input-tag__container"]),
|
|
109
109
|
children: e.children
|
|
110
|
-
}),
|
|
110
|
+
}), V.displayName = "BsyOptionTag";
|
|
111
111
|
//#endregion
|
|
112
112
|
//#region src/components/Select/SelectInput/SelectMultipleInput/select-multiple-input.module.scss
|
|
113
|
-
var
|
|
114
|
-
select_multiple_input__container:
|
|
115
|
-
select_multiple_input__measurement_layer:
|
|
116
|
-
select_multiple_input__close_btn:
|
|
113
|
+
var H = "_select_multiple_input__container_8pd2n_1", U = "_select_multiple_input__measurement_layer_8pd2n_6", W = "_select_multiple_input__close_btn_8pd2n_14", G = "_select_multiple_input__tag_content_8pd2n_24", K = {
|
|
114
|
+
select_multiple_input__container: H,
|
|
115
|
+
select_multiple_input__measurement_layer: U,
|
|
116
|
+
select_multiple_input__close_btn: W,
|
|
117
117
|
"select_multiple_input__close_btn--disabled": "_select_multiple_input__close_btn--disabled_8pd2n_21",
|
|
118
|
-
select_multiple_input__tag_content:
|
|
119
|
-
},
|
|
120
|
-
let { value: n, labelRender: r, tagStyle: i } = e, { setValue: a } =
|
|
118
|
+
select_multiple_input__tag_content: G
|
|
119
|
+
}, q = 4, J = C((e) => {
|
|
120
|
+
let { value: n, labelRender: r, tagStyle: i } = e, { setValue: a } = F(), { fieldNames: o, disabled: s } = I(), c = R(o), l = n?.length ?? 0, [u, d] = k(0), f = O(null), p = O(null);
|
|
121
121
|
ne(() => {
|
|
122
122
|
if (!f.current) return;
|
|
123
123
|
let e = new ResizeObserver((e) => {
|
|
@@ -130,7 +130,7 @@ var U = "_select_multiple_input__container_8pd2n_1", W = "_select_multiple_input
|
|
|
130
130
|
}
|
|
131
131
|
let a = p.current?.offsetWidth || 65, o = 0, s = 0;
|
|
132
132
|
for (let e = 0; e < i.length; e++) {
|
|
133
|
-
let t = i[e].clientWidth +
|
|
133
|
+
let t = i[e].clientWidth + q, n = e < l - 1 ? a : 0;
|
|
134
134
|
if (o + t + n <= r) o += t, s = e + 1;
|
|
135
135
|
else break;
|
|
136
136
|
}
|
|
@@ -143,25 +143,25 @@ var U = "_select_multiple_input__container_8pd2n_1", W = "_select_multiple_input
|
|
|
143
143
|
n.length
|
|
144
144
|
]);
|
|
145
145
|
let m = l - u, h = E(m), g = /* @__PURE__ */ v("div", {
|
|
146
|
-
className: `${
|
|
147
|
-
children: /* @__PURE__ */ y(
|
|
146
|
+
className: `${K.select_multiple_input__measurement_layer} measure-list`,
|
|
147
|
+
children: /* @__PURE__ */ y(V.Container, { children: [n?.map((e, n) => {
|
|
148
148
|
let a = (e) => /* @__PURE__ */ v("div", {
|
|
149
149
|
style: e,
|
|
150
|
-
className: A(
|
|
150
|
+
className: A(B["bsy-input-tag__item-icon"], "cursor-pointer"),
|
|
151
151
|
children: /* @__PURE__ */ v(t, {
|
|
152
152
|
name: "close",
|
|
153
153
|
style: { fontSize: 12 },
|
|
154
|
-
className:
|
|
154
|
+
className: K.select_multiple_input__close_btn
|
|
155
155
|
})
|
|
156
156
|
});
|
|
157
|
-
return /* @__PURE__ */ y(
|
|
157
|
+
return /* @__PURE__ */ y(V, {
|
|
158
158
|
style: i,
|
|
159
159
|
children: [r && r(e, a), !r && /* @__PURE__ */ y("div", {
|
|
160
|
-
className:
|
|
160
|
+
className: K.select_multiple_input__tag_content,
|
|
161
161
|
children: [/* @__PURE__ */ v("span", { children: c.getLabel(e) }), /* @__PURE__ */ v(a, {})]
|
|
162
162
|
})]
|
|
163
163
|
}, n);
|
|
164
|
-
}), u < l && h > 0 && /* @__PURE__ */ y(
|
|
164
|
+
}), u < l && h > 0 && /* @__PURE__ */ y(V, {
|
|
165
165
|
ref: p,
|
|
166
166
|
children: [`+ ${m}`, /* @__PURE__ */ v("span", {
|
|
167
167
|
className: "text-[#666]",
|
|
@@ -175,13 +175,13 @@ var U = "_select_multiple_input__container_8pd2n_1", W = "_select_multiple_input
|
|
|
175
175
|
};
|
|
176
176
|
return /* @__PURE__ */ y("div", {
|
|
177
177
|
ref: f,
|
|
178
|
-
className: A("bsy-select-input-container__input-value",
|
|
179
|
-
children: [g, /* @__PURE__ */ y(
|
|
178
|
+
className: A("bsy-select-input-container__input-value", K.select_multiple_input__container, "multiple"),
|
|
179
|
+
children: [g, /* @__PURE__ */ y(V.Container, { children: [n?.slice(0, u).map((e, n) => {
|
|
180
180
|
let a = (n) => /* @__PURE__ */ v("div", {
|
|
181
181
|
style: n,
|
|
182
|
-
className: A(
|
|
183
|
-
[
|
|
184
|
-
[
|
|
182
|
+
className: A(B["bsy-input-tag__item-icon"], {
|
|
183
|
+
[K.select_multiple_input__close_btn]: !s,
|
|
184
|
+
[K.select_multiple_input__close_btn + "--disabled"]: s
|
|
185
185
|
}),
|
|
186
186
|
onClick: (t) => {
|
|
187
187
|
t.stopPropagation(), _(e);
|
|
@@ -191,21 +191,21 @@ var U = "_select_multiple_input__container_8pd2n_1", W = "_select_multiple_input
|
|
|
191
191
|
style: { fontSize: 12 }
|
|
192
192
|
})
|
|
193
193
|
});
|
|
194
|
-
return /* @__PURE__ */ y(
|
|
194
|
+
return /* @__PURE__ */ y(V, {
|
|
195
195
|
style: {
|
|
196
196
|
...i,
|
|
197
197
|
flexShrink: u === 1 ? 1 : 0
|
|
198
198
|
},
|
|
199
199
|
disabled: s,
|
|
200
200
|
children: [r && r(e, a), !r && /* @__PURE__ */ y("div", {
|
|
201
|
-
className:
|
|
201
|
+
className: K.select_multiple_input__tag_content,
|
|
202
202
|
children: [/* @__PURE__ */ v("span", {
|
|
203
203
|
className: "truncate",
|
|
204
204
|
children: c.getLabel(e)
|
|
205
205
|
}), /* @__PURE__ */ v(a, {})]
|
|
206
206
|
})]
|
|
207
207
|
}, n);
|
|
208
|
-
}), u < l && h > 0 && /* @__PURE__ */ y(
|
|
208
|
+
}), u < l && h > 0 && /* @__PURE__ */ y(V, {
|
|
209
209
|
ref: p,
|
|
210
210
|
children: [`+ ${m} `, /* @__PURE__ */ v("span", {
|
|
211
211
|
className: "text-[#666]",
|
|
@@ -214,10 +214,10 @@ var U = "_select_multiple_input__container_8pd2n_1", W = "_select_multiple_input
|
|
|
214
214
|
})] })]
|
|
215
215
|
});
|
|
216
216
|
});
|
|
217
|
-
|
|
217
|
+
J.displayName = "BsySelectMultipleInput";
|
|
218
218
|
//#endregion
|
|
219
219
|
//#region src/components/Select/utils/tree.ts
|
|
220
|
-
var
|
|
220
|
+
var Y = (e, t) => {
|
|
221
221
|
let n = [], r = (e) => {
|
|
222
222
|
e.forEach((e) => {
|
|
223
223
|
let { [t.children]: i, ...a } = e;
|
|
@@ -225,12 +225,12 @@ var X = (e, t) => {
|
|
|
225
225
|
});
|
|
226
226
|
};
|
|
227
227
|
return r(e), n;
|
|
228
|
-
},
|
|
229
|
-
let b = O(null), x = j(o ? null : b), { isOpen: S, value: C, getCachedOptionByValue: w } =
|
|
228
|
+
}, me = ({ placeholder: e, mode: n, clearable: r, onClear: a, disabled: o = !1, labelRender: s, options: c = [], type: l, prefix: u, suffixIcon: d, ghost: f, inputValueStyle: m, tagStyle: g }) => {
|
|
229
|
+
let b = O(null), x = j(o ? null : b), { isOpen: S, value: C, getCachedOptionByValue: w } = F(), { fieldNames: T } = I(), E = D(() => {
|
|
230
230
|
if (h(C)) return [];
|
|
231
231
|
let e = p(C) ? C : [C];
|
|
232
|
-
if (l ===
|
|
233
|
-
let t =
|
|
232
|
+
if (l === P.TREE) {
|
|
233
|
+
let t = R(T), n = Y(c, T);
|
|
234
234
|
return e.map((e) => n.find((n) => t.getValue(n) === e) || w?.(e)).filter((e) => !!e);
|
|
235
235
|
}
|
|
236
236
|
return e.map((e) => c.find((t) => t[T.value] === e) || w?.(e)).filter((e) => !!e);
|
|
@@ -244,7 +244,7 @@ var X = (e, t) => {
|
|
|
244
244
|
return /* @__PURE__ */ v("div", {
|
|
245
245
|
className: A("bsy-select-input-container", {
|
|
246
246
|
disabled: o,
|
|
247
|
-
multiple: n ===
|
|
247
|
+
multiple: n === N.MULTIPLE,
|
|
248
248
|
active: S,
|
|
249
249
|
"ghost-style": f
|
|
250
250
|
}),
|
|
@@ -256,11 +256,11 @@ var X = (e, t) => {
|
|
|
256
256
|
className: "bsy-select-input-container-input-prefix",
|
|
257
257
|
children: u
|
|
258
258
|
}),
|
|
259
|
-
E?.length ? /* @__PURE__ */ y(_, { children: [n ===
|
|
259
|
+
E?.length ? /* @__PURE__ */ y(_, { children: [n === N.SINGLE && /* @__PURE__ */ v(z, {
|
|
260
260
|
value: E,
|
|
261
261
|
labelRender: s,
|
|
262
262
|
inputValueStyle: m
|
|
263
|
-
}), n ===
|
|
263
|
+
}), n === N.MULTIPLE && /* @__PURE__ */ v(J, {
|
|
264
264
|
value: E,
|
|
265
265
|
labelRender: s,
|
|
266
266
|
tagStyle: g
|
|
@@ -300,32 +300,35 @@ var X = (e, t) => {
|
|
|
300
300
|
})
|
|
301
301
|
});
|
|
302
302
|
};
|
|
303
|
-
|
|
303
|
+
me.displayName = "BsySelectInput";
|
|
304
304
|
//#endregion
|
|
305
305
|
//#region src/components/Select/OptionList/SingleOptionList/SingleOptionList.tsx
|
|
306
|
-
var
|
|
307
|
-
let { options: t, value: n, onSelect: r, searchValue: i = "", fieldNames: a, optionRender: o, optionStyle: c } = e, { otherInputPosition: l } =
|
|
306
|
+
var X = C((e) => {
|
|
307
|
+
let { options: t, value: n, onSelect: r, searchValue: i = "", fieldNames: a, optionRender: o, optionStyle: c } = e, { otherInputPosition: l } = I(), { otherOptionValue: u, setOtherOptionValue: d, onOtherInputChange: f, isSelectedOtherOption: p = !1 } = L(), m = O(null), h = R(a);
|
|
308
308
|
return /* @__PURE__ */ v("ul", {
|
|
309
309
|
role: "listbox",
|
|
310
310
|
children: t.map((e, t) => {
|
|
311
|
-
let a = h.getValue(e), g = h.getLabel(e), _ = e.systemField || !1, b = e.isOther === !0, x = b && l === "inline" && g.length > 6 ? g.slice(0, 6) + "..." : g,
|
|
311
|
+
let a = h.getValue(e), g = h.getLabel(e), _ = e.systemField || !1, b = e.isOther === !0, x = e.disabled === !0, S = b && l === "inline" && g.length > 6 ? g.slice(0, 6) + "..." : g, C = b ? p : a === n;
|
|
312
312
|
return /* @__PURE__ */ y("li", {
|
|
313
313
|
role: "option",
|
|
314
|
-
"aria-selected":
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
"
|
|
318
|
-
"text-[#
|
|
314
|
+
"aria-selected": C,
|
|
315
|
+
"aria-disabled": x,
|
|
316
|
+
className: A("rounded-[4px] py-[7px] px-[10px] min-h-[34px]", {
|
|
317
|
+
"cursor-pointer": !x,
|
|
318
|
+
"cursor-not-allowed text-[#999] bg-transparent": x,
|
|
319
|
+
"hover:bg-[#eff0f6]": !x && !C,
|
|
320
|
+
"text-[#4d609f]": !x && _ && !C,
|
|
321
|
+
"text-[#0265ff] bg-[#f0f6ff]": !x && C,
|
|
319
322
|
"flex items-center": b && l === "inline"
|
|
320
323
|
}),
|
|
321
324
|
style: c,
|
|
322
325
|
onClick: () => {
|
|
323
|
-
r(a, e);
|
|
326
|
+
x || r(a, e);
|
|
324
327
|
},
|
|
325
328
|
children: [/* @__PURE__ */ v("div", {
|
|
326
329
|
title: g,
|
|
327
|
-
children: o ? o(e, { index: t },
|
|
328
|
-
text:
|
|
330
|
+
children: o ? o(e, { index: t }, C) : /* @__PURE__ */ v(s, {
|
|
331
|
+
text: S,
|
|
329
332
|
highlight: i
|
|
330
333
|
})
|
|
331
334
|
}), b && l === "inline" && /* @__PURE__ */ v("div", {
|
|
@@ -335,15 +338,16 @@ var Z = C((e) => {
|
|
|
335
338
|
children: /* @__PURE__ */ v(re, {
|
|
336
339
|
ref: m,
|
|
337
340
|
value: u,
|
|
341
|
+
disabled: x,
|
|
338
342
|
onChange: (e) => {
|
|
339
343
|
let t = e.target.value;
|
|
340
344
|
d?.(t), f?.(t);
|
|
341
345
|
},
|
|
342
346
|
onPressEnter: () => {
|
|
343
|
-
u && r(a, e);
|
|
347
|
+
!x && u && r(a, e);
|
|
344
348
|
},
|
|
345
349
|
onBlur: () => {
|
|
346
|
-
u && r(a, e);
|
|
350
|
+
!x && u && r(a, e);
|
|
347
351
|
},
|
|
348
352
|
placeholder: "请输入内容"
|
|
349
353
|
})
|
|
@@ -352,11 +356,11 @@ var Z = C((e) => {
|
|
|
352
356
|
})
|
|
353
357
|
});
|
|
354
358
|
});
|
|
355
|
-
|
|
359
|
+
X.displayName = "BsySingleSelect";
|
|
356
360
|
//#endregion
|
|
357
361
|
//#region src/components/Select/OptionList/MultOptionList/MultOptionList.tsx
|
|
358
|
-
var
|
|
359
|
-
let { t } = n(), { options: r, searchValue: i = "", value: a, onSelect: o, fieldNames: c, optionRender: u } = e, d =
|
|
362
|
+
var Z = (e) => {
|
|
363
|
+
let { t } = n(), { options: r, searchValue: i = "", value: a, onSelect: o, fieldNames: c, optionRender: u } = e, d = R(c), f = a || [], p = r.filter((e) => !e.isOther), m = p.filter((e) => !e.disabled), h = m.map((e) => d.getValue(e)), g = m.length > 0 && m.every((e) => f.includes(d.getValue(e)));
|
|
360
364
|
return /* @__PURE__ */ v("div", {
|
|
361
365
|
className: "bsy-multiple-select",
|
|
362
366
|
children: /* @__PURE__ */ y("ul", {
|
|
@@ -364,11 +368,13 @@ var Q = (e) => {
|
|
|
364
368
|
children: [/* @__PURE__ */ v("li", {
|
|
365
369
|
className: A("flex items-center gap-[8px]", "cursor-pointer hover:bg-[#eff0f6] rounded-[4px] min-h-[34px]", "bsy-multiple-select-item"),
|
|
366
370
|
children: /* @__PURE__ */ v(l, {
|
|
367
|
-
checked:
|
|
371
|
+
checked: g,
|
|
372
|
+
disabled: m.length === 0,
|
|
368
373
|
onChange: () => {
|
|
369
|
-
|
|
374
|
+
let e = g ? f.filter((e) => !h.includes(e)) : [...f, ...h.filter((e) => !f.includes(e))];
|
|
375
|
+
o(e, p.filter((t) => e.includes(d.getValue(t))));
|
|
370
376
|
},
|
|
371
|
-
indeterminate:
|
|
377
|
+
indeterminate: m.some((e) => f.includes(d.getValue(e))) && !g,
|
|
372
378
|
style: { padding: "7px 10px" },
|
|
373
379
|
children: /* @__PURE__ */ v("span", {
|
|
374
380
|
className: "font-bold text-[#0265ff]",
|
|
@@ -381,14 +387,18 @@ var Q = (e) => {
|
|
|
381
387
|
o(e, p.filter((t) => e.includes(d.getValue(t))));
|
|
382
388
|
},
|
|
383
389
|
children: p.map((e, t) => {
|
|
384
|
-
let n = d.getValue(e), r = d.getLabel(e), a = f.includes(n), o = e.systemField || !1;
|
|
390
|
+
let n = d.getValue(e), r = d.getLabel(e), a = f.includes(n), o = e.systemField || !1, c = e.disabled === !0;
|
|
385
391
|
return /* @__PURE__ */ v("li", {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
"
|
|
392
|
+
"aria-disabled": c,
|
|
393
|
+
className: A("flex items-center gap-[8px] min-h-[34px]", "rounded-[4px]", "bsy-multiple-select-item", {
|
|
394
|
+
"cursor-pointer": !c,
|
|
395
|
+
"cursor-not-allowed text-[#999] bg-transparent": c,
|
|
396
|
+
"hover:bg-[#eff0f6]": !c,
|
|
397
|
+
"text-[#4d609f]": !c && o && !a
|
|
389
398
|
}),
|
|
390
399
|
children: /* @__PURE__ */ v(l, {
|
|
391
400
|
value: n,
|
|
401
|
+
disabled: c,
|
|
392
402
|
style: { padding: "7px 10px" },
|
|
393
403
|
children: u ? u(e, { index: t }, a) : /* @__PURE__ */ v(s, {
|
|
394
404
|
text: r,
|
|
@@ -401,10 +411,10 @@ var Q = (e) => {
|
|
|
401
411
|
})
|
|
402
412
|
});
|
|
403
413
|
};
|
|
404
|
-
|
|
414
|
+
Z.displayName = "BsyMultipleSelect";
|
|
405
415
|
//#endregion
|
|
406
416
|
//#region src/components/Select/OptionList/TreeOptionList/TreeOptionList.tsx
|
|
407
|
-
var
|
|
417
|
+
var he = (e) => {
|
|
408
418
|
let { options: t, searchValue: n, value: r, onSelect: i, fieldNames: a } = e;
|
|
409
419
|
return /* @__PURE__ */ v("div", {
|
|
410
420
|
className: "bsy-tree-select",
|
|
@@ -423,13 +433,13 @@ var me = (e) => {
|
|
|
423
433
|
})
|
|
424
434
|
})
|
|
425
435
|
});
|
|
426
|
-
},
|
|
436
|
+
}, ge = (e, t) => {
|
|
427
437
|
let n = [], r = (e) => {
|
|
428
438
|
if (e) for (let i of e) n.push(i), r(i[t.children]);
|
|
429
439
|
};
|
|
430
440
|
return r(e), n;
|
|
431
|
-
},
|
|
432
|
-
let i = r[n.children] ?
|
|
441
|
+
}, Q = (e, t, n) => e.reduce((e, r) => {
|
|
442
|
+
let i = r[n.children] ? Q(r[n.children], t, n) : void 0;
|
|
433
443
|
if (t.has(r[n.value]) || i && i.length > 0) {
|
|
434
444
|
let a = t.has(r[n.value]) ? r[n.children] : i;
|
|
435
445
|
e.push({
|
|
@@ -438,12 +448,12 @@ var me = (e) => {
|
|
|
438
448
|
});
|
|
439
449
|
}
|
|
440
450
|
return e;
|
|
441
|
-
}, []),
|
|
442
|
-
let { options: t = [], searchValue: r = "", type: i, filterOption: a, optionRender: o, optionStyle: s, notFoundContent: c } = e, { t: l } = n(), { value: d, setIsOpen: f, setValue: p } =
|
|
451
|
+
}, []), $ = (e) => {
|
|
452
|
+
let { options: t = [], searchValue: r = "", type: i, filterOption: a, optionRender: o, optionStyle: s, notFoundContent: c } = e, { t: l } = n(), { value: d, setIsOpen: f, setValue: p } = F(), { fieldNames: h } = I(), g = D(() => i === P.TREE ? ge(t, h) : t, [
|
|
443
453
|
t,
|
|
444
454
|
h,
|
|
445
455
|
i
|
|
446
|
-
]), y = D(() => new
|
|
456
|
+
]), y = D(() => new ce(g, {
|
|
447
457
|
keys: [h.label],
|
|
448
458
|
ignoreLocation: !0,
|
|
449
459
|
threshold: .3
|
|
@@ -456,7 +466,7 @@ var me = (e) => {
|
|
|
456
466
|
}, [f, p]), C = () => {
|
|
457
467
|
if (!a || m(r)) return t;
|
|
458
468
|
let e = y.search(r), n = new Set(e.map((e) => e.item[h.value]));
|
|
459
|
-
return i ===
|
|
469
|
+
return i === P.TREE ? Q(t, n, h) : t.filter((e) => n.has(e[h.value]));
|
|
460
470
|
};
|
|
461
471
|
return /* @__PURE__ */ v(_, { children: (() => {
|
|
462
472
|
let e = {
|
|
@@ -466,21 +476,21 @@ var me = (e) => {
|
|
|
466
476
|
};
|
|
467
477
|
if (!m(r) && e.options.length === 0) return c === void 0 ? /* @__PURE__ */ v(u, { text: l("noDataFound") }) : c;
|
|
468
478
|
switch (i) {
|
|
469
|
-
case
|
|
479
|
+
case P.SINGLE: return /* @__PURE__ */ v(X, {
|
|
470
480
|
...e,
|
|
471
481
|
value: d,
|
|
472
482
|
fieldNames: h,
|
|
473
483
|
onSelect: b,
|
|
474
484
|
optionRender: o
|
|
475
485
|
});
|
|
476
|
-
case
|
|
486
|
+
case P.MULTIPLE: return /* @__PURE__ */ v(Z, {
|
|
477
487
|
...e,
|
|
478
488
|
value: d,
|
|
479
489
|
fieldNames: h,
|
|
480
490
|
onSelect: x,
|
|
481
491
|
optionRender: o
|
|
482
492
|
});
|
|
483
|
-
case
|
|
493
|
+
case P.TREE: return /* @__PURE__ */ v(he, {
|
|
484
494
|
...e,
|
|
485
495
|
value: d,
|
|
486
496
|
fieldNames: h,
|
|
@@ -490,9 +500,9 @@ var me = (e) => {
|
|
|
490
500
|
}
|
|
491
501
|
})() });
|
|
492
502
|
}, _e = (t) => {
|
|
493
|
-
let { options: r = [], type: i =
|
|
503
|
+
let { options: r = [], type: i = P.SINGLE, filterOption: a = !0, onSearch: s, showSearch: c, searchPlaceholder: l, onPopupScroll: d, notFoundContent: f } = t, { t: p } = n(), { searchValue: m = "", setSearchValue: h } = F(), g = E(m), _ = (e) => {
|
|
494
504
|
h?.(e), s?.(e);
|
|
495
|
-
}, x = () => t.fetching ? /* @__PURE__ */ v(u, { text: p("dataSearching") }) : r.length === 0 && !m ? f === void 0 ? /* @__PURE__ */ v(u, { text: p("noData") }) : f : /* @__PURE__ */ v(
|
|
505
|
+
}, x = () => t.fetching ? /* @__PURE__ */ v(u, { text: p("dataSearching") }) : r.length === 0 && !m ? f === void 0 ? /* @__PURE__ */ v(u, { text: p("noData") }) : f : /* @__PURE__ */ v($, {
|
|
496
506
|
searchValue: g,
|
|
497
507
|
options: r,
|
|
498
508
|
type: i,
|
|
@@ -523,49 +533,49 @@ _e.displayName = "BsySelectPanel";
|
|
|
523
533
|
//#endregion
|
|
524
534
|
//#region src/components/Select/Select.tsx
|
|
525
535
|
var ve = S((e, t) => {
|
|
526
|
-
let { options: i = [], type: o =
|
|
527
|
-
defaultValue: j ===
|
|
536
|
+
let { options: i = [], type: o = P.SINGLE, fieldNames: s, clearable: c = !0, disabled: l = !1, placeholder: u, labelRender: f, onOtherInputChange: p, onOpenChange: m, onPopupScroll: h, prefix: g, suffixIcon: _, ghost: b, inputValueStyle: x, tagStyle: S, zIndex: C = 1101, zIndexMask: T = 1100, otherInputPosition: E = "bottom", popupMinWidth: ne, getPopupContainer: re } = e, j = le[o], { t: ce } = n(), F = ee(), { onChange: I } = e, L = s || ue, [R, z] = ie(e, {
|
|
537
|
+
defaultValue: j === N.SINGLE ? void 0 : [],
|
|
528
538
|
defaultValuePropName: "defaultValue",
|
|
529
539
|
valuePropName: "value",
|
|
530
540
|
trigger: "__NO_CUSTOM_CHANGE__"
|
|
531
|
-
}), [
|
|
532
|
-
if (j ===
|
|
533
|
-
let e = i.every((e) => e[
|
|
534
|
-
return e && t ?
|
|
541
|
+
}), [B, V] = k(""), H = O(/* @__PURE__ */ new Map()), [U, W] = k(() => {
|
|
542
|
+
if (j === N.SINGLE) {
|
|
543
|
+
let e = i.every((e) => e[L.value] !== R), t = i.find((e) => e.isOther === !0);
|
|
544
|
+
return e && t ? R : void 0;
|
|
535
545
|
}
|
|
536
|
-
}),
|
|
537
|
-
if (
|
|
546
|
+
}), G = w((e, t) => {
|
|
547
|
+
if (z(e), t) {
|
|
538
548
|
let n = /* @__PURE__ */ new Map();
|
|
539
549
|
if (Array.isArray(e)) {
|
|
540
550
|
let r = Array.isArray(t) ? t : [];
|
|
541
551
|
e.forEach((e) => {
|
|
542
|
-
let t = r.find((t) => t?.[
|
|
552
|
+
let t = r.find((t) => t?.[L.value] === e);
|
|
543
553
|
e !== null && t && n.set(e, t);
|
|
544
554
|
});
|
|
545
555
|
} else e !== null && !Array.isArray(t) && n.set(e, t);
|
|
546
|
-
|
|
556
|
+
H.current = n;
|
|
547
557
|
}
|
|
548
|
-
|
|
558
|
+
I && I(e, t);
|
|
549
559
|
}, [
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
]), [
|
|
554
|
-
e !==
|
|
560
|
+
I,
|
|
561
|
+
z,
|
|
562
|
+
L
|
|
563
|
+
]), [K, { set: q }] = ae(!1), J = w((e) => {
|
|
564
|
+
e !== K && (q(e), m?.(e));
|
|
555
565
|
}, [
|
|
556
|
-
|
|
566
|
+
q,
|
|
557
567
|
m,
|
|
558
|
-
|
|
559
|
-
]), { isSelectedOtherOption:
|
|
560
|
-
if (j ===
|
|
568
|
+
K
|
|
569
|
+
]), { isSelectedOtherOption: Y, shouldShowOtherInput: X } = D(() => {
|
|
570
|
+
if (j === N.MULTIPLE) return {
|
|
561
571
|
isSelectedOtherOption: !1,
|
|
562
572
|
shouldShowOtherInput: !1
|
|
563
573
|
};
|
|
564
|
-
let e = i.find((e) => e[
|
|
574
|
+
let e = i.find((e) => e[L.value] === R);
|
|
565
575
|
return e ? {
|
|
566
576
|
isSelectedOtherOption: e.isOther === !0,
|
|
567
577
|
shouldShowOtherInput: e.isOther === !0
|
|
568
|
-
} : i.find((e) => e.isOther === !0) &&
|
|
578
|
+
} : i.find((e) => e.isOther === !0) && R ? {
|
|
569
579
|
isSelectedOtherOption: !0,
|
|
570
580
|
shouldShowOtherInput: !0
|
|
571
581
|
} : {
|
|
@@ -573,59 +583,59 @@ var ve = S((e, t) => {
|
|
|
573
583
|
shouldShowOtherInput: !1
|
|
574
584
|
};
|
|
575
585
|
}, [
|
|
576
|
-
z,
|
|
577
|
-
i,
|
|
578
586
|
R,
|
|
587
|
+
i,
|
|
588
|
+
L,
|
|
579
589
|
j
|
|
580
|
-
]),
|
|
581
|
-
if (
|
|
582
|
-
if (j ===
|
|
583
|
-
let e = i.every((e) => e[
|
|
584
|
-
if (e && t) return t[
|
|
590
|
+
]), Z = w(() => {
|
|
591
|
+
if (R) {
|
|
592
|
+
if (j === N.SINGLE) {
|
|
593
|
+
let e = i.every((e) => e[L.value] !== R), t = i.find((e) => e.isOther === !0);
|
|
594
|
+
if (e && t) return t[L.value];
|
|
585
595
|
}
|
|
586
|
-
return
|
|
587
|
-
} else return
|
|
596
|
+
return R;
|
|
597
|
+
} else return R;
|
|
588
598
|
}, [
|
|
589
|
-
z,
|
|
590
|
-
i,
|
|
591
599
|
R,
|
|
600
|
+
i,
|
|
601
|
+
L,
|
|
592
602
|
j
|
|
593
|
-
]),
|
|
594
|
-
value:
|
|
595
|
-
setValue:
|
|
596
|
-
isOpen:
|
|
597
|
-
setIsOpen:
|
|
598
|
-
getCachedOptionByValue: (e) =>
|
|
599
|
-
searchValue:
|
|
600
|
-
setSearchValue:
|
|
603
|
+
]), he = D(() => ({
|
|
604
|
+
value: Z(),
|
|
605
|
+
setValue: G,
|
|
606
|
+
isOpen: K,
|
|
607
|
+
setIsOpen: J,
|
|
608
|
+
getCachedOptionByValue: (e) => H.current.get(e),
|
|
609
|
+
searchValue: B,
|
|
610
|
+
setSearchValue: V
|
|
601
611
|
}), [
|
|
602
|
-
|
|
612
|
+
Z,
|
|
613
|
+
G,
|
|
603
614
|
K,
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
fieldNames: s || le,
|
|
615
|
+
J,
|
|
616
|
+
B
|
|
617
|
+
]), ge = D(() => ({
|
|
618
|
+
fieldNames: s || ue,
|
|
609
619
|
disabled: l,
|
|
610
620
|
otherInputPosition: E
|
|
611
621
|
}), [
|
|
612
622
|
s,
|
|
613
623
|
l,
|
|
614
624
|
E
|
|
615
|
-
]),
|
|
616
|
-
isSelectedOtherOption:
|
|
617
|
-
otherOptionValue:
|
|
618
|
-
setOtherOptionValue:
|
|
625
|
+
]), Q = D(() => ({
|
|
626
|
+
isSelectedOtherOption: Y,
|
|
627
|
+
otherOptionValue: U,
|
|
628
|
+
setOtherOptionValue: W,
|
|
619
629
|
onOtherInputChange: p
|
|
620
630
|
}), [
|
|
621
|
-
|
|
631
|
+
Y,
|
|
632
|
+
U,
|
|
622
633
|
W,
|
|
623
|
-
G,
|
|
624
634
|
p
|
|
625
|
-
]), { refs:
|
|
626
|
-
isOpen:
|
|
635
|
+
]), { refs: $, floatingStyles: ve, getReferenceProps: ye, getFloatingProps: be, referenceStyle: xe } = d({
|
|
636
|
+
isOpen: K,
|
|
627
637
|
close: () => {
|
|
628
|
-
|
|
638
|
+
J(!1);
|
|
629
639
|
},
|
|
630
640
|
showMask: e.showMask,
|
|
631
641
|
zIndex: C,
|
|
@@ -635,48 +645,48 @@ var ve = S((e, t) => {
|
|
|
635
645
|
x: 0,
|
|
636
646
|
y: 4
|
|
637
647
|
}
|
|
638
|
-
}), { portalRoot: Se, portalMountKey: Ce, handleExitComplete: we } = a(
|
|
639
|
-
|
|
648
|
+
}), { portalRoot: Se, portalMountKey: Ce, handleExitComplete: we } = a(K, re), Te = w(() => {
|
|
649
|
+
Y && (W(""), p?.("")), J(!1), H.current.clear(), G(j === N.SINGLE ? void 0 : []);
|
|
640
650
|
}, [
|
|
641
|
-
|
|
651
|
+
Y,
|
|
642
652
|
p,
|
|
643
|
-
|
|
653
|
+
G,
|
|
644
654
|
j,
|
|
645
|
-
|
|
655
|
+
J
|
|
646
656
|
]);
|
|
647
657
|
return te(t, () => ({
|
|
648
|
-
getOtherOptionValue: () =>
|
|
658
|
+
getOtherOptionValue: () => U,
|
|
649
659
|
setOtherOptionValue: (e) => {
|
|
650
|
-
|
|
660
|
+
W(e), p?.(e);
|
|
651
661
|
}
|
|
652
|
-
}), [
|
|
653
|
-
value:
|
|
654
|
-
children: /* @__PURE__ */ v(
|
|
655
|
-
value:
|
|
656
|
-
children: /* @__PURE__ */ v(
|
|
657
|
-
value:
|
|
662
|
+
}), [U, p]), /* @__PURE__ */ v(de.Provider, {
|
|
663
|
+
value: he,
|
|
664
|
+
children: /* @__PURE__ */ v(fe.Provider, {
|
|
665
|
+
value: ge,
|
|
666
|
+
children: /* @__PURE__ */ v(pe.Provider, {
|
|
667
|
+
value: Q,
|
|
658
668
|
children: /* @__PURE__ */ y("div", {
|
|
659
669
|
className: A("bsy-select-container text-sm", e.className),
|
|
660
670
|
style: e.style,
|
|
661
671
|
children: [
|
|
662
672
|
/* @__PURE__ */ v("div", {
|
|
663
|
-
ref:
|
|
673
|
+
ref: $.setReference,
|
|
664
674
|
className: A("bsy-select-input-event", e.inputClassName),
|
|
665
675
|
...ye(),
|
|
666
676
|
style: xe,
|
|
667
677
|
onClick: () => {
|
|
668
|
-
e.disabled ||
|
|
678
|
+
e.disabled || J(!0);
|
|
669
679
|
},
|
|
670
680
|
role: "combobox",
|
|
671
|
-
"aria-expanded":
|
|
681
|
+
"aria-expanded": K,
|
|
672
682
|
"aria-haspopup": "listbox",
|
|
673
|
-
"aria-controls":
|
|
683
|
+
"aria-controls": F,
|
|
674
684
|
"aria-disabled": l,
|
|
675
|
-
children: /* @__PURE__ */ v(
|
|
685
|
+
children: /* @__PURE__ */ v(me, {
|
|
676
686
|
mode: j,
|
|
677
687
|
clearable: c,
|
|
678
688
|
disabled: l,
|
|
679
|
-
placeholder: u ||
|
|
689
|
+
placeholder: u || ce("select"),
|
|
680
690
|
labelRender: f,
|
|
681
691
|
options: i,
|
|
682
692
|
type: o,
|
|
@@ -690,16 +700,16 @@ var ve = S((e, t) => {
|
|
|
690
700
|
}),
|
|
691
701
|
/* @__PURE__ */ y(se, {
|
|
692
702
|
root: Se,
|
|
693
|
-
children: [
|
|
703
|
+
children: [K && e.showMask ? /* @__PURE__ */ v("div", {
|
|
694
704
|
className: "bsy-select-mask",
|
|
695
705
|
style: { zIndex: T }
|
|
696
706
|
}) : null, /* @__PURE__ */ v(oe, {
|
|
697
707
|
onExitComplete: we,
|
|
698
|
-
children:
|
|
699
|
-
ref:
|
|
708
|
+
children: K ? /* @__PURE__ */ v(M.div, {
|
|
709
|
+
ref: $.setFloating,
|
|
700
710
|
style: ve,
|
|
701
711
|
...be(),
|
|
702
|
-
id:
|
|
712
|
+
id: F,
|
|
703
713
|
...r,
|
|
704
714
|
children: /* @__PURE__ */ v(_e, {
|
|
705
715
|
...e,
|
|
@@ -709,15 +719,15 @@ var ve = S((e, t) => {
|
|
|
709
719
|
}, "bsy-select-panel") : null
|
|
710
720
|
})]
|
|
711
721
|
}, Ce),
|
|
712
|
-
|
|
722
|
+
X && E === "bottom" ? e.otherOptionRender ? e.otherOptionRender(U, i) : /* @__PURE__ */ v("div", {
|
|
713
723
|
className: A("mt-[6px] w-full px-[10px] py-[7px] bg-white rounded-[4px]", "border border-[#e0e0e0]"),
|
|
714
724
|
children: /* @__PURE__ */ v("input", {
|
|
715
|
-
value:
|
|
725
|
+
value: U || "",
|
|
716
726
|
onChange: (e) => {
|
|
717
|
-
|
|
727
|
+
W(e.target.value), p?.(e.target.value);
|
|
718
728
|
},
|
|
719
729
|
className: "w-full outline-none border-none placeholder:text-[#999]",
|
|
720
|
-
placeholder:
|
|
730
|
+
placeholder: ce("context"),
|
|
721
731
|
"aria-label": "其他选项输入框",
|
|
722
732
|
role: "textbox"
|
|
723
733
|
})
|
|
@@ -730,4 +740,4 @@ var ve = S((e, t) => {
|
|
|
730
740
|
});
|
|
731
741
|
ve.displayName = "BsySelect";
|
|
732
742
|
//#endregion
|
|
733
|
-
export {
|
|
743
|
+
export { N as n, P as r, ve as t };
|