@baishuyun/ui-base 6.10.0 → 6.10.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/{Amap-BNnmSPnl.js → Amap-BLSziesG.js} +1 -1
- package/dist/Amap/AmapCircle/index.js +4 -4
- package/dist/Amap/{AmapCircle-BDW6pnNR.js → AmapCircle-2qupysHe.js} +1 -1
- package/dist/Amap/AmapMarker/index.js +5 -5
- package/dist/Amap/{AmapMarker-CdoPWdff.js → AmapMarker-xEqoVnFR.js} +2 -2
- package/dist/Amap/AmapMarkerCluster/index.js +5 -5
- package/dist/Amap/{AmapMarkerCluster-CSIxiVC5.js → AmapMarkerCluster-CvEQa3o9.js} +2 -2
- package/dist/Amap/AmapProvider/index.js +6 -5
- package/dist/Amap/{AmapProvider-Cwi6WOe0.js → AmapProvider-DqFp3DZ5.js} +2 -2
- package/dist/Amap/hooks/index.js +3 -3
- package/dist/Amap/{hooks-DAN31s_-.js → hooks-BTcFpdd0.js} +1 -1
- package/dist/Amap/index.js +12 -11
- package/dist/Calendar/{AllDaySection-DNsVyixx.js → AllDaySection-BqbcPQls.js} +3 -3
- package/dist/Calendar/{Calendar-DL2X3z_z.js → Calendar-gEtuBW7Y.js} +12 -13
- package/dist/Calendar/{CurrentTimeIndicator-twXtFHIp.js → CurrentTimeIndicator-dRYot1Rk.js} +24 -18
- package/dist/Calendar/{EventCard-CvEnWcKd.js → EventCard-Di5UX4pB.js} +3 -4
- package/dist/Calendar/{TimeGrid-D62R57Bo.js → TimeGrid-CBpDFAM4.js} +1 -1
- package/dist/Calendar/context/index.js +2 -2
- package/dist/Calendar/index.js +21 -20
- package/dist/Calendar/subcomponents/AllDaySection/index.js +8 -7
- package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +6 -5
- package/dist/Calendar/subcomponents/EventCard/index.js +7 -6
- package/dist/Calendar/subcomponents/TimeAxis/index.js +4 -4
- package/dist/Calendar/subcomponents/TimeGrid/index.js +4 -3
- package/dist/Calendar/{theme-BRVmxhqD.js → theme-i60ueO92.js} +2 -2
- package/dist/Calendar/utils/index.js +4 -4
- package/dist/Calendar/utils/layout/index.js +3 -3
- package/dist/Calendar/utils/theme/index.js +2 -2
- package/dist/Card/index.js +2 -2
- package/dist/CheckBox/{CheckBox-CcM19LnP.js → CheckBox-nBm0u6zX.js} +1 -1
- package/dist/CheckBox/index.js +3 -3
- package/dist/ColorPicker/ColorPicker-CYlrnMwM.js +174 -0
- package/dist/ColorPicker/index.js +7 -6
- package/dist/ConfigProvider/index.js +4 -3
- package/dist/DatePicker/DatePicker-CagGt_f0.js +101 -0
- package/dist/DatePicker/{DatePickerPanel-Bz3uvbYF.js → DatePickerPanel-CaDZzxMD.js} +5 -5
- package/dist/DatePicker/index.js +10 -9
- package/dist/DatePicker/style/index.js +2 -2
- package/dist/DatePicker/{style-BwmM26RP.js → style-UKXn1N_p.js} +1 -1
- package/dist/DropDown/DropDown-CLuQf970.js +178 -0
- package/dist/DropDown/index.js +11 -10
- package/dist/DropDown/style/index.js +2 -2
- package/dist/DropDown/{style-BSgosymi.js → style-LLDVPpPa.js} +1 -1
- package/dist/Editor/Buttons-ByO5rS19.js +937 -0
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +17 -16
- package/dist/Editor/constants/index.js +3 -3
- package/dist/Editor/index.js +593 -238
- package/dist/Gantt/GanttChart/index.js +18 -17
- package/dist/Gantt/{GanttChart-6gpw5vi6.js → GanttChart-DvCAp8Dk.js} +8 -10
- package/dist/Gantt/GanttTable/index.js +11 -11
- package/dist/Gantt/{GanttTable-lVu-YUtt.js → GanttTable-DyVJOVo3.js} +5 -5
- package/dist/Gantt/GanttToolBar/index.js +14 -13
- package/dist/Gantt/{GanttToolBar-CarBWZg-.js → GanttToolBar-CxT68kmT.js} +3 -4
- package/dist/Gantt/{collapseKeys-_ShTXPKt.js → collapseKeys-B4SOVHjd.js} +2 -2
- package/dist/Gantt/index.js +26 -25
- package/dist/Gantt/{theme-CiMD9Y6i.js → theme-2LyXJRDe.js} +1 -1
- package/dist/Gantt/{timelineViewConfig-CLIpppp0.js → timelineViewConfig-9HArvbmb.js} +1 -1
- package/dist/Gantt/utils/index.js +6 -6
- package/dist/Gantt/utils/theme/index.js +2 -2
- package/dist/Icon/index.js +1 -1
- package/dist/InputTag/{InputTag-DxPO0DwD.js → InputTag-yRPO90Ku.js} +2 -2
- package/dist/InputTag/index.js +5 -5
- package/dist/Loading/{Loading-CVyzO5-s.js → Loading-BF_dtuLc.js} +1 -1
- package/dist/Loading/index.js +4 -4
- package/dist/Modal/Modal-Cb7Msq26.js +96 -0
- package/dist/Modal/index.js +3 -2
- package/dist/NotFoundContent/index.js +2 -2
- package/dist/Overlay/OverlayContext-CVSFoyqN.js +23 -0
- package/dist/Overlay/index.js +3 -0
- package/dist/Radio/index.js +2 -2
- package/dist/ScrollBar/{ScrollBar-CnwYQfXM.js → ScrollBar-N2pOLv-8.js} +1 -1
- package/dist/ScrollBar/index.js +2 -2
- package/dist/Segmented/{Segmented-Ck2ZmfF7.js → Segmented-BCQRrc65.js} +1 -1
- package/dist/Segmented/index.js +2 -2
- package/dist/Select/Select-iwzfNy9d.js +753 -0
- package/dist/Select/{SelectInputSearch-CrGW_eVo.js → SelectInputSearch-Bc_aPNbG.js} +1 -1
- package/dist/Select/index.js +14 -13
- package/dist/Table/{Table-CL-KfNY3.js → Table-Cm8zFl2G.js} +5 -5
- package/dist/Table/hooks/index.js +2 -2
- package/dist/Table/{hooks-uCDY9dqx.js → hooks-BceUZQQm.js} +1 -1
- package/dist/Table/index.js +8 -8
- package/dist/Table/{processRowspan-nIGqGyHh.js → processRowspan-B0WELhG2.js} +1 -1
- package/dist/Table/style/index.js +2 -2
- package/dist/Table/{style-x9xfw6te.js → style-C4wp0IOM.js} +1 -1
- package/dist/Table/utils/index.js +2 -2
- package/dist/Tabs/Tabs-BPWRIwtD.js +413 -0
- package/dist/Tabs/index.js +6 -5
- package/dist/Tooltip/Tooltip-Bb3Jx-If.js +172 -0
- package/dist/Tooltip/index.js +3 -2
- package/dist/Tree/index.js +4 -4
- package/dist/Tree/utils/index.js +1 -1
- package/dist/components/ColorPicker/ColorPalettes.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPicker.type.d.ts +1 -7
- package/dist/components/ConfigProvider/ConfigProvider.type.d.ts +2 -0
- package/dist/components/DatePicker/interface.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/BulletListButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/CodeButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/CodeLanguageButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/IndentButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/NumberListButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/OutdentButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/RedoButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/StrikeThroughButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/SubscriptButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/SuperscriptButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/UndoButton.d.ts +2 -0
- package/dist/components/Editor/ToolbarPlugin/Buttons/index.d.ts +10 -0
- package/dist/components/Editor/ToolbarPlugin/context/HistoryStateProvider.d.ts +8 -0
- package/dist/components/Editor/ToolbarPlugin/context/TextFormatsContext.d.ts +8 -1
- package/dist/components/Editor/ToolbarPlugin/icons/ToolbarIcon.d.ts +13 -0
- package/dist/components/Editor/constants/codeLanguages.d.ts +69 -0
- package/dist/components/Editor/constants/index.d.ts +2 -0
- package/dist/components/Editor/plugins/CodeHighlightPlugin.d.ts +1 -0
- package/dist/components/Editor/plugins/PasteStripImagePlugin.d.ts +1 -0
- package/dist/components/Editor/utils/codeHighlighter.d.ts +12 -0
- package/dist/components/Editor/utils/formatTruncatedFilename.d.ts +4 -0
- package/dist/components/Editor/utils/stripImagesFromHtml.d.ts +1 -0
- package/dist/components/Overlay/OverlayContext.d.ts +16 -0
- package/dist/components/Overlay/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.type.d.ts +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/index.js +53 -51
- package/dist/locale/lang/en-US.json.d.ts +14 -2
- package/dist/locale/lang/zh-CN.json.d.ts +14 -2
- package/dist/locale/lang/zh-TW.json.d.ts +14 -2
- package/dist/style.css +1 -1
- package/dist/vendors/{ConfigProvider-DxrZpdIb.js → ConfigProvider-vPuwReNX.js} +70 -36
- package/dist/vendors/{LocaleContext-Dcw6C1LX.js → LocaleContext-CN9doEXT.js} +14 -2
- package/dist/vendors/{Tree-D1s-eADo.js → Tree-B09frqQX.js} +3 -2
- package/dist/vendors/{useLocale-BKZX2_zw.js → useLocale-sawv8CEL.js} +1 -1
- package/dist/vendors/{version-L-kG2La0.js → version-DdQLttdL.js} +1 -1
- package/package.json +7 -1
- package/dist/ColorPicker/ColorPicker-D3JuQ7a7.js +0 -153
- package/dist/DatePicker/DatePicker-Dah_CjYG.js +0 -96
- package/dist/DropDown/DropDown-Daxr9BYf.js +0 -171
- package/dist/Editor/Buttons-DG_-Sg_C.js +0 -600
- package/dist/Modal/Modal-LiztSF7x.js +0 -92
- package/dist/Select/Select-CBI5PgeQ.js +0 -746
- package/dist/Tabs/Tabs-B1RsYb2W.js +0 -409
- package/dist/Tooltip/Tooltip-DWWWYn1a.js +0 -168
- /package/dist/Amap/{AmapContext-D7Njjm5a.js → AmapContext-CJBe6lld.js} +0 -0
- /package/dist/Amap/{useMarkerInfoWindowController-BQmhR0N7.js → useMarkerInfoWindowController-Cjx0xQXw.js} +0 -0
- /package/dist/Calendar/{TimeAxis-D7bgZDKs.js → TimeAxis-C9e2BdYs.js} +0 -0
- /package/dist/Calendar/{colorUtils-lXNjGoCk.js → colorUtils-CBLTsDX0.js} +0 -0
- /package/dist/Calendar/{context-CBJnz0IH.js → context-4tCN5X33.js} +0 -0
- /package/dist/Calendar/{layout-BglMom3m.js → layout-Dz-grtu9.js} +0 -0
- /package/dist/Card/{Card-CtKLNh3n.js → Card-Ds5Rpq--.js} +0 -0
- /package/dist/CheckBox/{CheckBox-Bb0UuX1Y.js → CheckBox-ByWSy9Yr.js} +0 -0
- /package/dist/DatePicker/{ensureDayjsPlugins-CVL-fnAl.js → ensureDayjsPlugins-Cn9Bkjkj.js} +0 -0
- /package/dist/DatePicker/{pickerLocale-BeMlfhKu.js → pickerLocale-BRnNjLcv.js} +0 -0
- /package/dist/Gantt/{GanttHighlightContext-grda5bhd.js → GanttHighlightContext-ChThr8ia.js} +0 -0
- /package/dist/Gantt/{columnResize-DV1tSBx_.js → columnResize-jG0Wy2PC.js} +0 -0
- /package/dist/Gantt/{constants-BObDP0h6.js → constants-LIz5jwed.js} +0 -0
- /package/dist/Gantt/{highlightTarget-DrP0_NrM.js → highlightTarget-BpkYTonb.js} +0 -0
- /package/dist/NotFoundContent/{NotFoundContent-J-TEnljc.js → NotFoundContent-BLmzWNBi.js} +0 -0
- /package/dist/Radio/{Radio-CBUZ7DB5.js → Radio-CX9cUqb7.js} +0 -0
- /package/dist/Table/{constants-CcwjDbe7.js → constants-kRpjsoet.js} +0 -0
- /package/dist/vendors/{animations-Mlw78WYo.js → animations-rwUbyoT0.js} +0 -0
- /package/dist/vendors/{cssVars-B8o94Yao.js → cssVars-l4-kP_14.js} +0 -0
- /package/dist/vendors/{mergeRefs-Bai1cIzv.js → mergeRefs-TiJ0xjUN.js} +0 -0
- /package/dist/vendors/{useFloatingOverlay-BApqkHSu.js → useFloatingOverlay-B3M9k8nj.js} +0 -0
- /package/dist/vendors/{useFloatingPortal-C8V67X0v.js → useFloatingPortal-CmVJbuRm.js} +0 -0
- /package/dist/vendors/{useLatchedPopupPortalRoot-hwf14FJ5.js → useLatchedPopupPortalRoot-4fVhqVT4.js} +0 -0
|
@@ -1,746 +0,0 @@
|
|
|
1
|
-
import { t as e } from "../Icon/Icon-BBDcb-yw.js";
|
|
2
|
-
import { t } from "../vendors/useLocale-BKZX2_zw.js";
|
|
3
|
-
import { n, t as r } from "../vendors/animations-Mlw78WYo.js";
|
|
4
|
-
import { t as i } from "../vendors/useLatchedPopupPortalRoot-hwf14FJ5.js";
|
|
5
|
-
import { t as a } from "./SelectInputSearch-CrGW_eVo.js";
|
|
6
|
-
import { n as o, t as s } from "../vendors/Tree-D1s-eADo.js";
|
|
7
|
-
import { t as c } from "../CheckBox/CheckBox-CcM19LnP.js";
|
|
8
|
-
import { t as l } from "../NotFoundContent/NotFoundContent-J-TEnljc.js";
|
|
9
|
-
import { t as u } from "../ScrollBar/ScrollBar-CnwYQfXM.js";
|
|
10
|
-
import { t as d } from "../vendors/useFloatingPortal-C8V67X0v.js";
|
|
11
|
-
import { first as f, isArray as p, isEmpty as m, isNil as h, noop as g } from "lodash-es";
|
|
12
|
-
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
13
|
-
import { Suspense as b, createContext as x, forwardRef as S, memo as C, useCallback as w, useContext as T, useDeferredValue as E, useId as ee, useImperativeHandle as te, useLayoutEffect as ne, useMemo as D, useRef as O, useState as k } from "react";
|
|
14
|
-
import { Input as re } from "antd";
|
|
15
|
-
import A from "clsx";
|
|
16
|
-
import { useControllableValue as ie, useHover as j, useToggle as ae } from "ahooks";
|
|
17
|
-
import { AnimatePresence as oe, motion as M } from "motion/react";
|
|
18
|
-
import { FloatingPortal as se } from "@floating-ui/react";
|
|
19
|
-
import N from "fuse.js";
|
|
20
|
-
//#region src/components/Select/constants.ts
|
|
21
|
-
var P = /* @__PURE__ */ function(e) {
|
|
22
|
-
return e.SINGLE = "single", e.MULTIPLE = "multiple", e;
|
|
23
|
-
}({}), F = /* @__PURE__ */ function(e) {
|
|
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
|
-
}({}), ce = {
|
|
26
|
-
[F.SINGLE]: P.SINGLE,
|
|
27
|
-
[F.TREE]: P.SINGLE,
|
|
28
|
-
[F.MULTIPLE]: P.MULTIPLE,
|
|
29
|
-
[F.TREE_TAGS]: P.MULTIPLE,
|
|
30
|
-
[F.MEMBER]: P.MULTIPLE,
|
|
31
|
-
[F.DEPARTEMENT]: P.MULTIPLE
|
|
32
|
-
}, le = {
|
|
33
|
-
label: "label",
|
|
34
|
-
value: "value",
|
|
35
|
-
children: "children"
|
|
36
|
-
}, ue = x({
|
|
37
|
-
value: void 0,
|
|
38
|
-
setValue: g,
|
|
39
|
-
isOpen: !1,
|
|
40
|
-
setIsOpen: g
|
|
41
|
-
}), de = x({
|
|
42
|
-
fieldNames: {
|
|
43
|
-
label: "label",
|
|
44
|
-
value: "value",
|
|
45
|
-
children: "children"
|
|
46
|
-
},
|
|
47
|
-
disabled: !1
|
|
48
|
-
}), fe = x({}), I = () => {
|
|
49
|
-
let e = T(ue);
|
|
50
|
-
if (!e) throw Error("Select.* components must be used within a SelectStateContext provider");
|
|
51
|
-
return e;
|
|
52
|
-
}, L = () => {
|
|
53
|
-
let e = T(de);
|
|
54
|
-
if (!e) throw Error("Select.* components must be used within a SelectConfigContext provider");
|
|
55
|
-
return e;
|
|
56
|
-
}, R = () => T(fe);
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/components/Select/utils/fieldAccessor.ts
|
|
59
|
-
function z(e) {
|
|
60
|
-
let t = e;
|
|
61
|
-
return {
|
|
62
|
-
getLabel: (e) => e[t.label],
|
|
63
|
-
getValue: (e) => e[t.value],
|
|
64
|
-
getChildren: (e) => {
|
|
65
|
-
if (t.children) return e[t.children];
|
|
66
|
-
},
|
|
67
|
-
normalizeOption: (e) => ({
|
|
68
|
-
...e,
|
|
69
|
-
label: e[t.label],
|
|
70
|
-
value: e[t.value],
|
|
71
|
-
children: t.children ? e[t.children] : void 0
|
|
72
|
-
}),
|
|
73
|
-
getFieldNames: () => t
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/components/Select/SelectInput/SelectSingleInput/SelectSingleInput.tsx
|
|
78
|
-
var B = C((e) => {
|
|
79
|
-
let { value: t, inputValueStyle: n } = e, { fieldNames: r, otherInputPosition: i } = L(), { isSelectedOtherOption: a, otherOptionValue: o } = R(), s = z(r), c = f(t), l;
|
|
80
|
-
return l = a && o && i === "inline" ? o : e.labelRender && c ? e.labelRender(c) : c ? s.getLabel(c) : "", /* @__PURE__ */ v("div", {
|
|
81
|
-
className: A("bsy-select-input-container__input-value overflow-hidden"),
|
|
82
|
-
style: n,
|
|
83
|
-
children: /* @__PURE__ */ v("div", {
|
|
84
|
-
className: "bsy-select-input-container__input-value-text",
|
|
85
|
-
children: l
|
|
86
|
-
})
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
B.displayName = "BsySelectSingleInput";
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region src/components/Select/SelectInput/SelectMultipleInput/OptionTag/option-tag.module.scss
|
|
92
|
-
var V = {
|
|
93
|
-
"bsy-input-tag__container": "_bsy-input-tag__container_znvs6_1",
|
|
94
|
-
"bsy-input-tag__item": "_bsy-input-tag__item_znvs6_7",
|
|
95
|
-
"bsy-input-tag__item--disabled": "_bsy-input-tag__item--disabled_znvs6_20",
|
|
96
|
-
"bsy-input-tag__item-icon": "_bsy-input-tag__item-icon_znvs6_24"
|
|
97
|
-
}, H = S(({ children: e, style: t, disabled: n }, r) => /* @__PURE__ */ v("div", {
|
|
98
|
-
"data-bsy-input-tag": "true",
|
|
99
|
-
className: A({
|
|
100
|
-
[V["bsy-input-tag__item"]]: !0,
|
|
101
|
-
[V["bsy-input-tag__item--disabled"]]: n
|
|
102
|
-
}),
|
|
103
|
-
ref: r,
|
|
104
|
-
style: t,
|
|
105
|
-
children: e
|
|
106
|
-
}));
|
|
107
|
-
H.Container = (e) => /* @__PURE__ */ v("div", {
|
|
108
|
-
className: A(V["bsy-input-tag__container"]),
|
|
109
|
-
children: e.children
|
|
110
|
-
}), H.displayName = "BsyOptionTag";
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region src/components/Select/SelectInput/SelectMultipleInput/select-multiple-input.module.scss
|
|
113
|
-
var U = "_select_multiple_input__container_8pd2n_1", W = "_select_multiple_input__measurement_layer_8pd2n_6", G = "_select_multiple_input__close_btn_8pd2n_14", K = "_select_multiple_input__tag_content_8pd2n_24", q = {
|
|
114
|
-
select_multiple_input__container: U,
|
|
115
|
-
select_multiple_input__measurement_layer: W,
|
|
116
|
-
select_multiple_input__close_btn: G,
|
|
117
|
-
"select_multiple_input__close_btn--disabled": "_select_multiple_input__close_btn--disabled_8pd2n_21",
|
|
118
|
-
select_multiple_input__tag_content: K
|
|
119
|
-
}, J = 4, Y = C((t) => {
|
|
120
|
-
let { value: n, labelRender: r, tagStyle: i } = t, { setValue: a } = I(), { fieldNames: o, disabled: s } = L(), c = z(o), l = n?.length ?? 0, [u, d] = k(0), f = O(null), p = O(null);
|
|
121
|
-
ne(() => {
|
|
122
|
-
if (!f.current) return;
|
|
123
|
-
let e = new ResizeObserver((e) => {
|
|
124
|
-
let t = e[0];
|
|
125
|
-
if (!t) return;
|
|
126
|
-
let r = t.contentRect.width, i = t.target.querySelectorAll(".measure-list [data-bsy-input-tag=\"true\"]");
|
|
127
|
-
if (i.length === 0) {
|
|
128
|
-
d(n?.length ?? 0);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
let a = p.current?.offsetWidth || 65, o = 0, s = 0;
|
|
132
|
-
for (let e = 0; e < i.length; e++) {
|
|
133
|
-
let t = i[e].clientWidth + J, n = e < l - 1 ? a : 0;
|
|
134
|
-
if (o + t + n <= r) o += t, s = e + 1;
|
|
135
|
-
else break;
|
|
136
|
-
}
|
|
137
|
-
s === 0 && l === 1 && (s = 1), u !== s && d(s);
|
|
138
|
-
});
|
|
139
|
-
return e.observe(f.current), () => e.disconnect();
|
|
140
|
-
}, [
|
|
141
|
-
l,
|
|
142
|
-
u,
|
|
143
|
-
n.length
|
|
144
|
-
]);
|
|
145
|
-
let m = l - u, h = E(m), g = /* @__PURE__ */ v("div", {
|
|
146
|
-
className: `${q.select_multiple_input__measurement_layer} measure-list`,
|
|
147
|
-
children: /* @__PURE__ */ y(H.Container, { children: [n?.map((t, n) => {
|
|
148
|
-
let a = (t) => /* @__PURE__ */ v("div", {
|
|
149
|
-
style: t,
|
|
150
|
-
className: A(V["bsy-input-tag__item-icon"], "cursor-pointer"),
|
|
151
|
-
children: /* @__PURE__ */ v(e, {
|
|
152
|
-
name: "close",
|
|
153
|
-
style: { fontSize: 12 },
|
|
154
|
-
className: q.select_multiple_input__close_btn
|
|
155
|
-
})
|
|
156
|
-
});
|
|
157
|
-
return /* @__PURE__ */ y(H, {
|
|
158
|
-
style: i,
|
|
159
|
-
children: [r && r(t, a), !r && /* @__PURE__ */ y("div", {
|
|
160
|
-
className: q.select_multiple_input__tag_content,
|
|
161
|
-
children: [/* @__PURE__ */ v("span", { children: c.getLabel(t) }), /* @__PURE__ */ v(a, {})]
|
|
162
|
-
})]
|
|
163
|
-
}, n);
|
|
164
|
-
}), u < l && h > 0 && /* @__PURE__ */ y(H, {
|
|
165
|
-
ref: p,
|
|
166
|
-
children: [`+ ${m}`, /* @__PURE__ */ v("span", {
|
|
167
|
-
className: "text-[#666]",
|
|
168
|
-
children: "..."
|
|
169
|
-
})]
|
|
170
|
-
})] })
|
|
171
|
-
}), _ = (e) => {
|
|
172
|
-
if (s) return;
|
|
173
|
-
let t = n.filter((t) => c.getValue(t) !== c.getValue(e));
|
|
174
|
-
a(t.map((e) => c.getValue(e)), t);
|
|
175
|
-
};
|
|
176
|
-
return /* @__PURE__ */ y("div", {
|
|
177
|
-
ref: f,
|
|
178
|
-
className: A("bsy-select-input-container__input-value", q.select_multiple_input__container, "multiple"),
|
|
179
|
-
children: [g, /* @__PURE__ */ y(H.Container, { children: [n?.slice(0, u).map((t, n) => {
|
|
180
|
-
let a = (n) => /* @__PURE__ */ v("div", {
|
|
181
|
-
style: n,
|
|
182
|
-
className: A(V["bsy-input-tag__item-icon"], {
|
|
183
|
-
[q.select_multiple_input__close_btn]: !s,
|
|
184
|
-
[q.select_multiple_input__close_btn + "--disabled"]: s
|
|
185
|
-
}),
|
|
186
|
-
onClick: (e) => {
|
|
187
|
-
e.stopPropagation(), _(t);
|
|
188
|
-
},
|
|
189
|
-
children: /* @__PURE__ */ v(e, {
|
|
190
|
-
name: "close",
|
|
191
|
-
style: { fontSize: 12 }
|
|
192
|
-
})
|
|
193
|
-
});
|
|
194
|
-
return /* @__PURE__ */ y(H, {
|
|
195
|
-
style: {
|
|
196
|
-
...i,
|
|
197
|
-
flexShrink: u === 1 ? 1 : 0
|
|
198
|
-
},
|
|
199
|
-
disabled: s,
|
|
200
|
-
children: [r && r(t, a), !r && /* @__PURE__ */ y("div", {
|
|
201
|
-
className: q.select_multiple_input__tag_content,
|
|
202
|
-
children: [/* @__PURE__ */ v("span", {
|
|
203
|
-
className: "truncate",
|
|
204
|
-
children: c.getLabel(t)
|
|
205
|
-
}), /* @__PURE__ */ v(a, {})]
|
|
206
|
-
})]
|
|
207
|
-
}, n);
|
|
208
|
-
}), u < l && h > 0 && /* @__PURE__ */ y(H, {
|
|
209
|
-
ref: p,
|
|
210
|
-
children: [`+ ${m} `, /* @__PURE__ */ v("span", {
|
|
211
|
-
className: "text-[#666]",
|
|
212
|
-
children: "..."
|
|
213
|
-
})]
|
|
214
|
-
})] })]
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
Y.displayName = "BsySelectMultipleInput";
|
|
218
|
-
//#endregion
|
|
219
|
-
//#region src/components/Select/utils/tree.ts
|
|
220
|
-
var X = (e, t) => {
|
|
221
|
-
let n = [], r = (e) => {
|
|
222
|
-
e.forEach((e) => {
|
|
223
|
-
let { [t.children]: i, ...a } = e;
|
|
224
|
-
n.push(a), i && r(i);
|
|
225
|
-
});
|
|
226
|
-
};
|
|
227
|
-
return r(e), n;
|
|
228
|
-
}, pe = ({ placeholder: t, mode: n, clearable: i, 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 } = I(), { fieldNames: T } = L(), E = D(() => {
|
|
230
|
-
if (h(C)) return [];
|
|
231
|
-
let e = p(C) ? C : [C];
|
|
232
|
-
if (l === F.TREE) {
|
|
233
|
-
let t = z(T), n = X(c, T);
|
|
234
|
-
return e.map((e) => n.find((n) => t.getValue(n) === e) || w?.(e)).filter((e) => !!e);
|
|
235
|
-
}
|
|
236
|
-
return e.map((e) => c.find((t) => t[T.value] === e) || w?.(e)).filter((e) => !!e);
|
|
237
|
-
}, [
|
|
238
|
-
C,
|
|
239
|
-
c,
|
|
240
|
-
l,
|
|
241
|
-
T,
|
|
242
|
-
w
|
|
243
|
-
]);
|
|
244
|
-
return /* @__PURE__ */ v("div", {
|
|
245
|
-
className: A("bsy-select-input-container", {
|
|
246
|
-
disabled: o,
|
|
247
|
-
multiple: n === P.MULTIPLE,
|
|
248
|
-
active: S,
|
|
249
|
-
"ghost-style": f
|
|
250
|
-
}),
|
|
251
|
-
ref: b,
|
|
252
|
-
children: /* @__PURE__ */ y("div", {
|
|
253
|
-
className: A("bsy-select-input-container-input"),
|
|
254
|
-
children: [
|
|
255
|
-
u && /* @__PURE__ */ v("div", {
|
|
256
|
-
className: "bsy-select-input-container-input-prefix",
|
|
257
|
-
children: u
|
|
258
|
-
}),
|
|
259
|
-
E?.length ? /* @__PURE__ */ y(_, { children: [n === P.SINGLE && /* @__PURE__ */ v(B, {
|
|
260
|
-
value: E,
|
|
261
|
-
labelRender: s,
|
|
262
|
-
inputValueStyle: m
|
|
263
|
-
}), n === P.MULTIPLE && /* @__PURE__ */ v(Y, {
|
|
264
|
-
value: E,
|
|
265
|
-
labelRender: s,
|
|
266
|
-
tagStyle: g
|
|
267
|
-
})] }) : /* @__PURE__ */ v("div", {
|
|
268
|
-
className: "bsy-select-input-container__input-value-placeholder truncate",
|
|
269
|
-
children: t
|
|
270
|
-
}),
|
|
271
|
-
/* @__PURE__ */ v("div", {
|
|
272
|
-
className: A("bsy-select-input-container__icon"),
|
|
273
|
-
children: /* @__PURE__ */ v(oe, {
|
|
274
|
-
mode: "wait",
|
|
275
|
-
children: E?.length && i && x ? /* @__PURE__ */ v(M.div, {
|
|
276
|
-
className: "bsy-select-input-container__icon-motion",
|
|
277
|
-
...r,
|
|
278
|
-
children: /* @__PURE__ */ v(e, {
|
|
279
|
-
name: "cancel",
|
|
280
|
-
className: "icon hover:text-[#0265ff] text-[#666]",
|
|
281
|
-
role: "button",
|
|
282
|
-
"aria-label": "clear",
|
|
283
|
-
onClick: (e) => {
|
|
284
|
-
e.stopPropagation(), a?.();
|
|
285
|
-
}
|
|
286
|
-
})
|
|
287
|
-
}, "cancel") : /* @__PURE__ */ v(M.div, {
|
|
288
|
-
className: "bsy-select-input-container__icon-motion",
|
|
289
|
-
...r,
|
|
290
|
-
children: d ? d(S, o) : /* @__PURE__ */ v(e, {
|
|
291
|
-
name: "arrow-down",
|
|
292
|
-
className: A("icon", {
|
|
293
|
-
active: S,
|
|
294
|
-
"text-[#c2c2c2]": o,
|
|
295
|
-
"text-[#666]": !o
|
|
296
|
-
})
|
|
297
|
-
})
|
|
298
|
-
}, "arrow")
|
|
299
|
-
})
|
|
300
|
-
})
|
|
301
|
-
]
|
|
302
|
-
})
|
|
303
|
-
});
|
|
304
|
-
};
|
|
305
|
-
pe.displayName = "BsySelectInput";
|
|
306
|
-
//#endregion
|
|
307
|
-
//#region src/components/Select/OptionList/SingleOptionList/SingleOptionList.tsx
|
|
308
|
-
var Z = C((e) => {
|
|
309
|
-
let { options: n, value: r, onSelect: i, searchValue: a = "", fieldNames: s, optionRender: c, optionStyle: l } = e, { t: u } = t(), { otherInputPosition: d } = L(), { otherOptionValue: f, setOtherOptionValue: p, onOtherInputChange: m, isSelectedOtherOption: h = !1 } = R(), g = O(null), _ = z(s);
|
|
310
|
-
return /* @__PURE__ */ v("ul", {
|
|
311
|
-
role: "listbox",
|
|
312
|
-
children: n.map((e, t) => {
|
|
313
|
-
let n = _.getValue(e), s = _.getLabel(e), b = e.systemField || !1, x = e.isOther === !0, S = e.disabled === !0, C = x && d === "inline" && s.length > 6 ? s.slice(0, 6) + "..." : s, w = x ? h : n === r;
|
|
314
|
-
return /* @__PURE__ */ y("li", {
|
|
315
|
-
role: "option",
|
|
316
|
-
"aria-selected": w,
|
|
317
|
-
"aria-disabled": S,
|
|
318
|
-
className: A("rounded-[4px] py-[7px] px-[10px] min-h-[34px]", {
|
|
319
|
-
"cursor-pointer": !S,
|
|
320
|
-
"cursor-not-allowed text-[#999] bg-transparent": S,
|
|
321
|
-
"hover:bg-[#eff0f6]": !S && !w,
|
|
322
|
-
"text-[#4d609f]": !S && b && !w,
|
|
323
|
-
"text-[#0265ff] bg-[#f0f6ff]": !S && w,
|
|
324
|
-
"flex items-center": x && d === "inline"
|
|
325
|
-
}),
|
|
326
|
-
style: l,
|
|
327
|
-
onClick: () => {
|
|
328
|
-
S || i(n, e);
|
|
329
|
-
},
|
|
330
|
-
children: [/* @__PURE__ */ v("div", {
|
|
331
|
-
title: s,
|
|
332
|
-
children: c ? c(e, { index: t }, w) : /* @__PURE__ */ v(o, {
|
|
333
|
-
text: C,
|
|
334
|
-
highlight: a
|
|
335
|
-
})
|
|
336
|
-
}), x && d === "inline" && /* @__PURE__ */ v("div", {
|
|
337
|
-
className: "ml-2 flex-1",
|
|
338
|
-
onClick: (e) => e.stopPropagation(),
|
|
339
|
-
style: { minWidth: "146px" },
|
|
340
|
-
children: /* @__PURE__ */ v(re, {
|
|
341
|
-
ref: g,
|
|
342
|
-
value: f,
|
|
343
|
-
disabled: S,
|
|
344
|
-
onChange: (e) => {
|
|
345
|
-
let t = e.target.value;
|
|
346
|
-
p?.(t), m?.(t);
|
|
347
|
-
},
|
|
348
|
-
onPressEnter: () => {
|
|
349
|
-
!S && f && i(n, e);
|
|
350
|
-
},
|
|
351
|
-
onBlur: () => {
|
|
352
|
-
!S && f && i(n, e);
|
|
353
|
-
},
|
|
354
|
-
placeholder: u("context"),
|
|
355
|
-
"aria-label": u("otherOptionInput")
|
|
356
|
-
})
|
|
357
|
-
})]
|
|
358
|
-
}, `${n}-${t}`);
|
|
359
|
-
})
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
Z.displayName = "BsySingleSelect";
|
|
363
|
-
//#endregion
|
|
364
|
-
//#region src/components/Select/OptionList/MultOptionList/MultOptionList.tsx
|
|
365
|
-
var Q = (e) => {
|
|
366
|
-
let { t: n } = t(), { options: r, searchValue: i = "", value: a, onSelect: s, fieldNames: l, optionRender: u } = e, d = z(l), 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)));
|
|
367
|
-
return /* @__PURE__ */ v("div", {
|
|
368
|
-
className: "bsy-multiple-select",
|
|
369
|
-
children: /* @__PURE__ */ y("ul", {
|
|
370
|
-
className: "bsy-multiple-select-list",
|
|
371
|
-
children: [/* @__PURE__ */ v("li", {
|
|
372
|
-
className: A("flex items-center gap-[8px]", "cursor-pointer hover:bg-[#eff0f6] rounded-[4px] min-h-[34px]", "bsy-multiple-select-item"),
|
|
373
|
-
children: /* @__PURE__ */ v(c, {
|
|
374
|
-
checked: g,
|
|
375
|
-
disabled: m.length === 0,
|
|
376
|
-
onChange: () => {
|
|
377
|
-
let e = g ? f.filter((e) => !h.includes(e)) : [...f, ...h.filter((e) => !f.includes(e))];
|
|
378
|
-
s(e, p.filter((t) => e.includes(d.getValue(t))));
|
|
379
|
-
},
|
|
380
|
-
indeterminate: m.some((e) => f.includes(d.getValue(e))) && !g,
|
|
381
|
-
style: { padding: "7px 10px" },
|
|
382
|
-
children: /* @__PURE__ */ v("span", {
|
|
383
|
-
className: "font-bold text-[#0265ff]",
|
|
384
|
-
children: n(i ? "allSelectedBySearch" : "allSelect")
|
|
385
|
-
})
|
|
386
|
-
})
|
|
387
|
-
}), /* @__PURE__ */ v(c.Group, {
|
|
388
|
-
value: f,
|
|
389
|
-
onChange: (e) => {
|
|
390
|
-
s(e, p.filter((t) => e.includes(d.getValue(t))));
|
|
391
|
-
},
|
|
392
|
-
children: p.map((e, t) => {
|
|
393
|
-
let n = d.getValue(e), r = d.getLabel(e), a = f.includes(n), s = e.systemField || !1, l = e.disabled === !0;
|
|
394
|
-
return /* @__PURE__ */ v("li", {
|
|
395
|
-
"aria-disabled": l,
|
|
396
|
-
className: A("flex items-center gap-[8px] min-h-[34px]", "rounded-[4px]", "bsy-multiple-select-item", {
|
|
397
|
-
"cursor-pointer": !l,
|
|
398
|
-
"cursor-not-allowed text-[#999] bg-transparent": l,
|
|
399
|
-
"hover:bg-[#eff0f6]": !l,
|
|
400
|
-
"text-[#4d609f]": !l && s && !a
|
|
401
|
-
}),
|
|
402
|
-
children: /* @__PURE__ */ v(c, {
|
|
403
|
-
value: n,
|
|
404
|
-
disabled: l,
|
|
405
|
-
style: { padding: "7px 10px" },
|
|
406
|
-
children: u ? u(e, { index: t }, a) : /* @__PURE__ */ v(o, {
|
|
407
|
-
text: r,
|
|
408
|
-
highlight: i
|
|
409
|
-
})
|
|
410
|
-
})
|
|
411
|
-
}, `${n}-${t}`);
|
|
412
|
-
})
|
|
413
|
-
})]
|
|
414
|
-
})
|
|
415
|
-
});
|
|
416
|
-
};
|
|
417
|
-
Q.displayName = "BsyMultipleSelect";
|
|
418
|
-
//#endregion
|
|
419
|
-
//#region src/components/Select/OptionList/TreeOptionList/TreeOptionList.tsx
|
|
420
|
-
var me = (e) => {
|
|
421
|
-
let { options: t, searchValue: n, value: r, onSelect: i, fieldNames: a } = e;
|
|
422
|
-
return /* @__PURE__ */ v("div", {
|
|
423
|
-
className: "bsy-tree-select",
|
|
424
|
-
children: /* @__PURE__ */ v("div", {
|
|
425
|
-
className: "bsy-tree-select-nodes",
|
|
426
|
-
children: /* @__PURE__ */ v(s, {
|
|
427
|
-
data: t,
|
|
428
|
-
searchValue: n,
|
|
429
|
-
fieldNames: a ? {
|
|
430
|
-
title: a.label,
|
|
431
|
-
value: a.value,
|
|
432
|
-
children: a.children
|
|
433
|
-
} : void 0,
|
|
434
|
-
selectedKeys: r ? [r] : [],
|
|
435
|
-
onSelect: i
|
|
436
|
-
})
|
|
437
|
-
})
|
|
438
|
-
});
|
|
439
|
-
}, he = (e, t) => {
|
|
440
|
-
let n = [], r = (e) => {
|
|
441
|
-
if (e) for (let i of e) n.push(i), r(i[t.children]);
|
|
442
|
-
};
|
|
443
|
-
return r(e), n;
|
|
444
|
-
}, $ = (e, t, n) => e.reduce((e, r) => {
|
|
445
|
-
let i = r[n.children] ? $(r[n.children], t, n) : void 0;
|
|
446
|
-
if (t.has(r[n.value]) || i && i.length > 0) {
|
|
447
|
-
let a = t.has(r[n.value]) ? r[n.children] : i;
|
|
448
|
-
e.push({
|
|
449
|
-
...r,
|
|
450
|
-
children: a
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
return e;
|
|
454
|
-
}, []), ge = (e) => {
|
|
455
|
-
let { options: n = [], searchValue: r = "", type: i, filterOption: a, optionRender: o, optionStyle: s, notFoundContent: c } = e, { t: u } = t(), { value: d, setIsOpen: f, setValue: p } = I(), { fieldNames: h } = L(), g = D(() => i === F.TREE ? he(n, h) : n, [
|
|
456
|
-
n,
|
|
457
|
-
h,
|
|
458
|
-
i
|
|
459
|
-
]), y = D(() => new N(g, {
|
|
460
|
-
keys: [h.label],
|
|
461
|
-
ignoreLocation: !0,
|
|
462
|
-
threshold: .3
|
|
463
|
-
}), [g, h]), b = w((e, t) => {
|
|
464
|
-
f?.(!1), p(e, t);
|
|
465
|
-
}, [f, p]), x = w((e, t) => {
|
|
466
|
-
p(e, t);
|
|
467
|
-
}, [p]), S = w((e, t) => {
|
|
468
|
-
f?.(!1), p(e, t);
|
|
469
|
-
}, [f, p]), C = () => {
|
|
470
|
-
if (!a || m(r)) return n;
|
|
471
|
-
let e = y.search(r), t = new Set(e.map((e) => e.item[h.value]));
|
|
472
|
-
return i === F.TREE ? $(n, t, h) : n.filter((e) => t.has(e[h.value]));
|
|
473
|
-
};
|
|
474
|
-
return /* @__PURE__ */ v(_, { children: (() => {
|
|
475
|
-
let e = {
|
|
476
|
-
options: C(),
|
|
477
|
-
searchValue: r,
|
|
478
|
-
optionStyle: s
|
|
479
|
-
};
|
|
480
|
-
if (!m(r) && e.options.length === 0) return c === void 0 ? /* @__PURE__ */ v(l, { text: u("noDataFound") }) : c;
|
|
481
|
-
switch (i) {
|
|
482
|
-
case F.SINGLE: return /* @__PURE__ */ v(Z, {
|
|
483
|
-
...e,
|
|
484
|
-
value: d,
|
|
485
|
-
fieldNames: h,
|
|
486
|
-
onSelect: b,
|
|
487
|
-
optionRender: o
|
|
488
|
-
});
|
|
489
|
-
case F.MULTIPLE: return /* @__PURE__ */ v(Q, {
|
|
490
|
-
...e,
|
|
491
|
-
value: d,
|
|
492
|
-
fieldNames: h,
|
|
493
|
-
onSelect: x,
|
|
494
|
-
optionRender: o
|
|
495
|
-
});
|
|
496
|
-
case F.TREE: return /* @__PURE__ */ v(me, {
|
|
497
|
-
...e,
|
|
498
|
-
value: d,
|
|
499
|
-
fieldNames: h,
|
|
500
|
-
onSelect: S
|
|
501
|
-
});
|
|
502
|
-
default: return null;
|
|
503
|
-
}
|
|
504
|
-
})() });
|
|
505
|
-
}, _e = (e) => {
|
|
506
|
-
let { options: n = [], type: r = F.SINGLE, filterOption: i = !0, onSearch: o, showSearch: s, searchPlaceholder: c, onPopupScroll: d, notFoundContent: f } = e, { t: p } = t(), { searchValue: m = "", setSearchValue: h } = I(), g = E(m), _ = (e) => {
|
|
507
|
-
h?.(e), o?.(e);
|
|
508
|
-
}, x = () => e.fetching ? /* @__PURE__ */ v(l, { text: p("dataSearching") }) : n.length === 0 && !m ? f === void 0 ? /* @__PURE__ */ v(l, { text: p("noData") }) : f : /* @__PURE__ */ v(ge, {
|
|
509
|
-
searchValue: g,
|
|
510
|
-
options: n,
|
|
511
|
-
type: r,
|
|
512
|
-
filterOption: i,
|
|
513
|
-
optionRender: e.optionRender,
|
|
514
|
-
optionStyle: e.optionStyle,
|
|
515
|
-
notFoundContent: f
|
|
516
|
-
}), S = w((e) => {
|
|
517
|
-
d?.(e);
|
|
518
|
-
}, [d]);
|
|
519
|
-
return /* @__PURE__ */ v("div", {
|
|
520
|
-
className: "bsy-select-panel",
|
|
521
|
-
children: /* @__PURE__ */ y(b, { children: [s && /* @__PURE__ */ v(a, {
|
|
522
|
-
value: m,
|
|
523
|
-
onChange: _,
|
|
524
|
-
searchPlaceholder: c
|
|
525
|
-
}), /* @__PURE__ */ v("div", {
|
|
526
|
-
className: A({ "pt-[4px]": s }),
|
|
527
|
-
children: /* @__PURE__ */ v(u, {
|
|
528
|
-
style: { maxHeight: 300 },
|
|
529
|
-
onScroll: S,
|
|
530
|
-
children: x()
|
|
531
|
-
})
|
|
532
|
-
})] })
|
|
533
|
-
});
|
|
534
|
-
};
|
|
535
|
-
_e.displayName = "BsySelectPanel";
|
|
536
|
-
//#endregion
|
|
537
|
-
//#region src/components/Select/Select.tsx
|
|
538
|
-
var ve = S((e, r) => {
|
|
539
|
-
let { options: a = [], type: o = F.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 = ce[o], { t: N } = t(), I = ee(), { onChange: L } = e, R = s || le, [z, B] = ie(e, {
|
|
540
|
-
defaultValue: j === P.SINGLE ? void 0 : [],
|
|
541
|
-
defaultValuePropName: "defaultValue",
|
|
542
|
-
valuePropName: "value",
|
|
543
|
-
trigger: "__NO_CUSTOM_CHANGE__"
|
|
544
|
-
}), [V, H] = k(""), U = O(/* @__PURE__ */ new Map()), [W, G] = k(() => {
|
|
545
|
-
if (j === P.SINGLE) {
|
|
546
|
-
let e = a.every((e) => e[R.value] !== z), t = a.find((e) => e.isOther === !0);
|
|
547
|
-
return e && t ? z : void 0;
|
|
548
|
-
}
|
|
549
|
-
}), K = w((e, t) => {
|
|
550
|
-
if (B(e), t) {
|
|
551
|
-
let n = /* @__PURE__ */ new Map();
|
|
552
|
-
if (Array.isArray(e)) {
|
|
553
|
-
let r = Array.isArray(t) ? t : [];
|
|
554
|
-
e.forEach((e) => {
|
|
555
|
-
let t = r.find((t) => t?.[R.value] === e);
|
|
556
|
-
e !== null && t && n.set(e, t);
|
|
557
|
-
});
|
|
558
|
-
} else e !== null && !Array.isArray(t) && n.set(e, t);
|
|
559
|
-
U.current = n;
|
|
560
|
-
}
|
|
561
|
-
L && L(e, t);
|
|
562
|
-
}, [
|
|
563
|
-
L,
|
|
564
|
-
B,
|
|
565
|
-
R
|
|
566
|
-
]), [q, { set: J }] = ae(!1), Y = w((e) => {
|
|
567
|
-
e !== q && (J(e), m?.(e));
|
|
568
|
-
}, [
|
|
569
|
-
J,
|
|
570
|
-
m,
|
|
571
|
-
q
|
|
572
|
-
]), { isSelectedOtherOption: X, shouldShowOtherInput: Z } = D(() => {
|
|
573
|
-
if (j === P.MULTIPLE) return {
|
|
574
|
-
isSelectedOtherOption: !1,
|
|
575
|
-
shouldShowOtherInput: !1
|
|
576
|
-
};
|
|
577
|
-
let e = a.find((e) => e[R.value] === z);
|
|
578
|
-
return e ? {
|
|
579
|
-
isSelectedOtherOption: e.isOther === !0,
|
|
580
|
-
shouldShowOtherInput: e.isOther === !0
|
|
581
|
-
} : a.find((e) => e.isOther === !0) && z ? {
|
|
582
|
-
isSelectedOtherOption: !0,
|
|
583
|
-
shouldShowOtherInput: !0
|
|
584
|
-
} : {
|
|
585
|
-
isSelectedOtherOption: !1,
|
|
586
|
-
shouldShowOtherInput: !1
|
|
587
|
-
};
|
|
588
|
-
}, [
|
|
589
|
-
z,
|
|
590
|
-
a,
|
|
591
|
-
R,
|
|
592
|
-
j
|
|
593
|
-
]), Q = w(() => {
|
|
594
|
-
if (z) {
|
|
595
|
-
if (j === P.SINGLE) {
|
|
596
|
-
let e = a.every((e) => e[R.value] !== z), t = a.find((e) => e.isOther === !0);
|
|
597
|
-
if (e && t) return t[R.value];
|
|
598
|
-
}
|
|
599
|
-
return z;
|
|
600
|
-
} else return z;
|
|
601
|
-
}, [
|
|
602
|
-
z,
|
|
603
|
-
a,
|
|
604
|
-
R,
|
|
605
|
-
j
|
|
606
|
-
]), me = D(() => ({
|
|
607
|
-
value: Q(),
|
|
608
|
-
setValue: K,
|
|
609
|
-
isOpen: q,
|
|
610
|
-
setIsOpen: Y,
|
|
611
|
-
getCachedOptionByValue: (e) => U.current.get(e),
|
|
612
|
-
searchValue: V,
|
|
613
|
-
setSearchValue: H
|
|
614
|
-
}), [
|
|
615
|
-
Q,
|
|
616
|
-
K,
|
|
617
|
-
q,
|
|
618
|
-
Y,
|
|
619
|
-
V
|
|
620
|
-
]), he = D(() => ({
|
|
621
|
-
fieldNames: s || le,
|
|
622
|
-
disabled: l,
|
|
623
|
-
otherInputPosition: E
|
|
624
|
-
}), [
|
|
625
|
-
s,
|
|
626
|
-
l,
|
|
627
|
-
E
|
|
628
|
-
]), $ = D(() => ({
|
|
629
|
-
isSelectedOtherOption: X,
|
|
630
|
-
otherOptionValue: W,
|
|
631
|
-
setOtherOptionValue: G,
|
|
632
|
-
onOtherInputChange: p
|
|
633
|
-
}), [
|
|
634
|
-
X,
|
|
635
|
-
W,
|
|
636
|
-
G,
|
|
637
|
-
p
|
|
638
|
-
]), { refs: ge, floatingStyles: ve, getReferenceProps: ye, getFloatingProps: be, referenceStyle: xe } = d({
|
|
639
|
-
isOpen: q,
|
|
640
|
-
close: () => {
|
|
641
|
-
Y(!1);
|
|
642
|
-
},
|
|
643
|
-
showMask: e.showMask,
|
|
644
|
-
zIndex: C,
|
|
645
|
-
zIndexMask: T,
|
|
646
|
-
popupMinWidth: ne,
|
|
647
|
-
offset: {
|
|
648
|
-
x: 0,
|
|
649
|
-
y: 4
|
|
650
|
-
}
|
|
651
|
-
}), { portalRoot: Se, portalMountKey: Ce, handleExitComplete: we } = i(q, re), Te = w(() => {
|
|
652
|
-
X && (G(""), p?.("")), Y(!1), U.current.clear(), K(j === P.SINGLE ? void 0 : []);
|
|
653
|
-
}, [
|
|
654
|
-
X,
|
|
655
|
-
p,
|
|
656
|
-
K,
|
|
657
|
-
j,
|
|
658
|
-
Y
|
|
659
|
-
]);
|
|
660
|
-
return te(r, () => ({
|
|
661
|
-
getOtherOptionValue: () => W,
|
|
662
|
-
setOtherOptionValue: (e) => {
|
|
663
|
-
G(e), p?.(e);
|
|
664
|
-
}
|
|
665
|
-
}), [W, p]), /* @__PURE__ */ v(ue.Provider, {
|
|
666
|
-
value: me,
|
|
667
|
-
children: /* @__PURE__ */ v(de.Provider, {
|
|
668
|
-
value: he,
|
|
669
|
-
children: /* @__PURE__ */ v(fe.Provider, {
|
|
670
|
-
value: $,
|
|
671
|
-
children: /* @__PURE__ */ y("div", {
|
|
672
|
-
className: A("bsy-select-container text-sm", e.className),
|
|
673
|
-
style: e.style,
|
|
674
|
-
children: [
|
|
675
|
-
/* @__PURE__ */ v("div", {
|
|
676
|
-
ref: ge.setReference,
|
|
677
|
-
className: A("bsy-select-input-event", e.inputClassName),
|
|
678
|
-
...ye(),
|
|
679
|
-
style: xe,
|
|
680
|
-
onClick: () => {
|
|
681
|
-
e.disabled || Y(!q);
|
|
682
|
-
},
|
|
683
|
-
role: "combobox",
|
|
684
|
-
"aria-expanded": q,
|
|
685
|
-
"aria-haspopup": "listbox",
|
|
686
|
-
"aria-controls": I,
|
|
687
|
-
"aria-disabled": l,
|
|
688
|
-
children: /* @__PURE__ */ v(pe, {
|
|
689
|
-
mode: j,
|
|
690
|
-
clearable: c,
|
|
691
|
-
disabled: l,
|
|
692
|
-
placeholder: u || N("select"),
|
|
693
|
-
labelRender: f,
|
|
694
|
-
options: a,
|
|
695
|
-
type: o,
|
|
696
|
-
prefix: g,
|
|
697
|
-
suffixIcon: _,
|
|
698
|
-
ghost: b,
|
|
699
|
-
inputValueStyle: x,
|
|
700
|
-
tagStyle: S,
|
|
701
|
-
onClear: Te
|
|
702
|
-
})
|
|
703
|
-
}),
|
|
704
|
-
/* @__PURE__ */ y(se, {
|
|
705
|
-
root: Se,
|
|
706
|
-
children: [q && e.showMask ? /* @__PURE__ */ v("div", {
|
|
707
|
-
className: "bsy-select-mask",
|
|
708
|
-
style: { zIndex: T }
|
|
709
|
-
}) : null, /* @__PURE__ */ v(oe, {
|
|
710
|
-
onExitComplete: we,
|
|
711
|
-
children: q ? /* @__PURE__ */ v(M.div, {
|
|
712
|
-
ref: ge.setFloating,
|
|
713
|
-
style: ve,
|
|
714
|
-
...be(),
|
|
715
|
-
id: I,
|
|
716
|
-
...n,
|
|
717
|
-
children: /* @__PURE__ */ v(_e, {
|
|
718
|
-
...e,
|
|
719
|
-
options: a,
|
|
720
|
-
onPopupScroll: h
|
|
721
|
-
})
|
|
722
|
-
}, "bsy-select-panel") : null
|
|
723
|
-
})]
|
|
724
|
-
}, Ce),
|
|
725
|
-
Z && E === "bottom" ? e.otherOptionRender ? e.otherOptionRender(W, a) : /* @__PURE__ */ v("div", {
|
|
726
|
-
className: A("mt-[6px] w-full px-[10px] py-[7px] bg-white rounded-[4px]", "border border-[#e0e0e0]"),
|
|
727
|
-
children: /* @__PURE__ */ v("input", {
|
|
728
|
-
value: W || "",
|
|
729
|
-
onChange: (e) => {
|
|
730
|
-
G(e.target.value), p?.(e.target.value);
|
|
731
|
-
},
|
|
732
|
-
className: "w-full outline-none border-none placeholder:text-[#999]",
|
|
733
|
-
placeholder: N("context"),
|
|
734
|
-
"aria-label": N("otherOptionInput"),
|
|
735
|
-
role: "textbox"
|
|
736
|
-
})
|
|
737
|
-
}) : null
|
|
738
|
-
]
|
|
739
|
-
})
|
|
740
|
-
})
|
|
741
|
-
})
|
|
742
|
-
});
|
|
743
|
-
});
|
|
744
|
-
ve.displayName = "BsySelect";
|
|
745
|
-
//#endregion
|
|
746
|
-
export { P as n, F as r, ve as t };
|