@baishuyun/ui-base 6.5.1 → 6.6.0
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.
|
@@ -438,67 +438,68 @@ var pe = (e) => {
|
|
|
438
438
|
}
|
|
439
439
|
return e;
|
|
440
440
|
}, []), he = (e) => {
|
|
441
|
-
let { options: t = [], searchValue: r = "", type: i, filterOption: a, optionRender: o, optionStyle: s } = e, { t:
|
|
441
|
+
let { options: t = [], searchValue: r = "", type: i, filterOption: a, optionRender: o, optionStyle: s, notFoundContent: c } = e, { t: u } = n(), { value: d, setIsOpen: f, setValue: m } = L(), { fieldNames: h } = R(), v = D(() => i === I.TREE ? me(t, h) : t, [
|
|
442
442
|
t,
|
|
443
|
-
|
|
443
|
+
h,
|
|
444
444
|
i
|
|
445
|
-
]),
|
|
446
|
-
keys: [
|
|
445
|
+
]), y = D(() => new P(v, {
|
|
446
|
+
keys: [h.label],
|
|
447
447
|
ignoreLocation: !0,
|
|
448
448
|
threshold: .3
|
|
449
|
-
}), [
|
|
450
|
-
|
|
451
|
-
}, [
|
|
452
|
-
|
|
453
|
-
}, [
|
|
454
|
-
|
|
455
|
-
}, [
|
|
449
|
+
}), [v, h]), b = C((e, t) => {
|
|
450
|
+
f?.(!1), m(e, t);
|
|
451
|
+
}, [f, m]), x = C((e, t) => {
|
|
452
|
+
m(e, t);
|
|
453
|
+
}, [m]), S = C((e, t) => {
|
|
454
|
+
f?.(!1), m(e, t);
|
|
455
|
+
}, [f, m]), w = () => {
|
|
456
456
|
if (!a || p(r)) return t;
|
|
457
|
-
let e =
|
|
458
|
-
return i === I.TREE ? $(t, n,
|
|
457
|
+
let e = y.search(r), n = new Set(e.map((e) => e.item[h.value]));
|
|
458
|
+
return i === I.TREE ? $(t, n, h) : t.filter((e) => n.has(e[h.value]));
|
|
459
459
|
};
|
|
460
460
|
return /* @__PURE__ */ _(g, { children: (() => {
|
|
461
461
|
let e = {
|
|
462
|
-
options:
|
|
462
|
+
options: w(),
|
|
463
463
|
searchValue: r,
|
|
464
464
|
optionStyle: s
|
|
465
465
|
};
|
|
466
|
-
if (!p(r) && e.options.length === 0) return /* @__PURE__ */ _(l, { text:
|
|
466
|
+
if (!p(r) && e.options.length === 0) return c === void 0 ? /* @__PURE__ */ _(l, { text: u("noDataFound") }) : c;
|
|
467
467
|
switch (i) {
|
|
468
468
|
case I.SINGLE: return /* @__PURE__ */ _(Z, {
|
|
469
469
|
...e,
|
|
470
|
-
value:
|
|
471
|
-
fieldNames:
|
|
472
|
-
onSelect:
|
|
470
|
+
value: d,
|
|
471
|
+
fieldNames: h,
|
|
472
|
+
onSelect: b,
|
|
473
473
|
optionRender: o
|
|
474
474
|
});
|
|
475
475
|
case I.MULTIPLE: return /* @__PURE__ */ _(Q, {
|
|
476
476
|
...e,
|
|
477
|
-
value:
|
|
478
|
-
fieldNames:
|
|
479
|
-
onSelect:
|
|
477
|
+
value: d,
|
|
478
|
+
fieldNames: h,
|
|
479
|
+
onSelect: x,
|
|
480
480
|
optionRender: o
|
|
481
481
|
});
|
|
482
482
|
case I.TREE: return /* @__PURE__ */ _(pe, {
|
|
483
483
|
...e,
|
|
484
|
-
value:
|
|
485
|
-
fieldNames:
|
|
486
|
-
onSelect:
|
|
484
|
+
value: d,
|
|
485
|
+
fieldNames: h,
|
|
486
|
+
onSelect: S
|
|
487
487
|
});
|
|
488
488
|
default: return null;
|
|
489
489
|
}
|
|
490
490
|
})() });
|
|
491
491
|
}, ge = (t) => {
|
|
492
|
-
let { options: i = [], type: o = I.SINGLE, filterOption: s = !0, onSearch: c, showSearch: u, searchPlaceholder: d, onPopupScroll: f } = t, { t:
|
|
493
|
-
|
|
494
|
-
},
|
|
495
|
-
searchValue:
|
|
492
|
+
let { options: i = [], type: o = I.SINGLE, filterOption: s = !0, onSearch: c, showSearch: u, searchPlaceholder: d, onPopupScroll: f, notFoundContent: p } = t, { t: m } = n(), { searchValue: h = "", setSearchValue: g } = L(), b = T(h), x = (e) => {
|
|
493
|
+
g?.(e), c?.(e);
|
|
494
|
+
}, S = () => t.fetching ? /* @__PURE__ */ _(l, { text: m("dataSearching") }) : i.length === 0 && !h ? p === void 0 ? /* @__PURE__ */ _(l, { text: m("noData") }) : p : /* @__PURE__ */ _(he, {
|
|
495
|
+
searchValue: b,
|
|
496
496
|
options: i,
|
|
497
497
|
type: o,
|
|
498
498
|
filterOption: s,
|
|
499
499
|
optionRender: t.optionRender,
|
|
500
|
-
optionStyle: t.optionStyle
|
|
501
|
-
|
|
500
|
+
optionStyle: t.optionStyle,
|
|
501
|
+
notFoundContent: p
|
|
502
|
+
}), w = C((e) => {
|
|
502
503
|
f?.(e);
|
|
503
504
|
}, [f]);
|
|
504
505
|
return /* @__PURE__ */ _(N.div, {
|
|
@@ -506,15 +507,15 @@ var pe = (e) => {
|
|
|
506
507
|
children: /* @__PURE__ */ _("div", {
|
|
507
508
|
className: "bsy-select-panel",
|
|
508
509
|
children: /* @__PURE__ */ v(y, { children: [u && /* @__PURE__ */ _(a, {
|
|
509
|
-
value:
|
|
510
|
-
onChange:
|
|
510
|
+
value: h,
|
|
511
|
+
onChange: x,
|
|
511
512
|
searchPlaceholder: d
|
|
512
513
|
}), /* @__PURE__ */ _("div", {
|
|
513
514
|
className: j({ "pt-[4px]": u }),
|
|
514
515
|
children: /* @__PURE__ */ _(e, {
|
|
515
516
|
style: { maxHeight: 300 },
|
|
516
|
-
onScroll:
|
|
517
|
-
children:
|
|
517
|
+
onScroll: w,
|
|
518
|
+
children: S()
|
|
518
519
|
})
|
|
519
520
|
})] })
|
|
520
521
|
})
|
package/dist/Select/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import "../ScrollBar/ScrollBar-CSGBOE3e.js";
|
|
|
2
2
|
import "../Icon/Icon-SQ5tu-yG.js";
|
|
3
3
|
import "../vendors/LocaleContext-CBcJzvUD.js";
|
|
4
4
|
import "../vendors/useLocale-DZ8XW2VL.js";
|
|
5
|
-
import { n as e, r as t, t as n } from "./Select-
|
|
5
|
+
import { n as e, r as t, t as n } from "./Select-DTximYG6.js";
|
|
6
6
|
import "./SelectInputSearch-BDwg-Noi.js";
|
|
7
7
|
import "../vendors/Tree-DqnOGJtB.js";
|
|
8
8
|
import "../CheckBox/CheckBox-ejvbDr-a.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SelectProps } from '../interface';
|
|
2
2
|
type OptionListProps = {
|
|
3
3
|
searchValue?: string;
|
|
4
|
-
} & Pick<SelectProps, 'options' | 'type' | 'filterOption' | 'optionRender' | 'optionStyle'>;
|
|
4
|
+
} & Pick<SelectProps, 'options' | 'type' | 'filterOption' | 'optionRender' | 'optionStyle' | 'notFoundContent'>;
|
|
5
5
|
declare const OptionList: React.FC<OptionListProps>;
|
|
6
6
|
export default OptionList;
|
|
@@ -183,6 +183,11 @@ export interface SelectProps<ValueType = any, OptionType extends DefaultOptionTy
|
|
|
183
183
|
* @description 指定下拉浮层渲染的父级 DOM 节点;未传、返回空值或非元素节点时回退到 body
|
|
184
184
|
*/
|
|
185
185
|
getPopupContainer?: () => HTMLElement;
|
|
186
|
+
/**
|
|
187
|
+
* @description 自定义下拉空态内容(源数据为空或搜索无匹配时展示)
|
|
188
|
+
* @description 不覆盖 fetching 加载态;未传时使用默认文案;传 null 可隐藏空态文案
|
|
189
|
+
*/
|
|
190
|
+
notFoundContent?: React.ReactNode;
|
|
186
191
|
}
|
|
187
192
|
export interface SelectRef {
|
|
188
193
|
/**
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import "./vendors/useLocale-DZ8XW2VL.js";
|
|
|
18
18
|
import "./vendors/color-BQYy0Wgy.js";
|
|
19
19
|
import { t as m } from "./Segmented/Segmented-CzVKrL6o.js";
|
|
20
20
|
import { n as h, t as g } from "./Tooltip/Tooltip-B_SZOy6k.js";
|
|
21
|
-
import { t as _ } from "./Select/Select-
|
|
21
|
+
import { t as _ } from "./Select/Select-DTximYG6.js";
|
|
22
22
|
import "./Select/SelectInputSearch-BDwg-Noi.js";
|
|
23
23
|
import { t as v } from "./vendors/Tree-DqnOGJtB.js";
|
|
24
24
|
import "./CheckBox/CheckBox-ejvbDr-a.js";
|