@baishuyun/ui-base 6.16.1 → 6.18.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.
Files changed (147) hide show
  1. package/dist/Amap/Amap-CNsoge6e.js +826 -0
  2. package/dist/Amap/index.js +3 -10
  3. package/dist/Calendar/Calendar-Dk6FVbJ2.js +1608 -0
  4. package/dist/Calendar/index.js +10 -20
  5. package/dist/Card/index.js +2 -2
  6. package/dist/CheckBox/{CheckBox-B92dxWNo.js → CheckBox-CM24-quL.js} +1 -1
  7. package/dist/CheckBox/index.js +3 -3
  8. package/dist/ColorPicker/{ColorPicker-CPr5j6ZN.js → ColorPicker-B_wLqurt.js} +5 -5
  9. package/dist/ColorPicker/index.js +5 -5
  10. package/dist/ConfigProvider/index.js +1 -1
  11. package/dist/DatePicker/DatePicker-CItkTpdZ.js +111 -0
  12. package/dist/DatePicker/{DatePickerPanel-CtLwYPmz.js → DatePickerPanel-DJXmFihs.js} +3 -4
  13. package/dist/DatePicker/index.js +6 -8
  14. package/dist/DatePicker/pickerLocale-Brf7_Tnd.js +30 -0
  15. package/dist/DropDown/{DropDown-Bi0TsCc_.js → DropDown-B_szM67V.js} +86 -82
  16. package/dist/DropDown/index.js +8 -9
  17. package/dist/Editor/index.js +2934 -961
  18. package/dist/Gantt/index.js +3055 -197
  19. package/dist/Icon/index.js +1 -1
  20. package/dist/InputTag/{InputTag-BfZycXw4.js → InputTag-C_5nm0eo.js} +2 -2
  21. package/dist/InputTag/index.js +4 -4
  22. package/dist/Loading/{Loading-DpbJSRYf.js → Loading-Cherk9Ax.js} +1 -1
  23. package/dist/Loading/index.js +3 -3
  24. package/dist/Modal/index.js +2 -2
  25. package/dist/NotFoundContent/index.js +2 -2
  26. package/dist/Overlay/index.js +1 -1
  27. package/dist/Radio/index.js +2 -2
  28. package/dist/ScrollBar/{ScrollBar-N2pOLv-8.js → ScrollBar-IMTuAOF5.js} +1 -1
  29. package/dist/ScrollBar/index.js +2 -2
  30. package/dist/Segmented/{Segmented-BCQRrc65.js → Segmented-DpmwFerw.js} +1 -1
  31. package/dist/Segmented/index.js +2 -2
  32. package/dist/Select/{Select-CB5FqBui.js → Select-VIy6OKEj.js} +257 -253
  33. package/dist/Select/{SelectInputSearch-DUAv2vE4.js → SelectInputSearch-MApQHnU9.js} +1 -1
  34. package/dist/Select/index.js +12 -13
  35. package/dist/Table/Table-8ac6xLZv.js +808 -0
  36. package/dist/Table/index.js +4 -8
  37. package/dist/Tabs/{Tabs-B9uCGlxM.js → Tabs-DnoZ8BO0.js} +3 -3
  38. package/dist/Tabs/index.js +4 -4
  39. package/dist/Tooltip/{Tooltip-nJU13gX4.js → Tooltip-DBrt3t2r.js} +3 -3
  40. package/dist/Tooltip/index.js +3 -3
  41. package/dist/Tree/index.js +4 -4
  42. package/dist/components/Editor/EditorHtmlPreview.d.ts +3 -0
  43. package/dist/components/Editor/Preview/EditorPreview.d.ts +1 -1
  44. package/dist/components/Editor/Preview/HtmlPreview.d.ts +2 -3
  45. package/dist/components/Editor/Preview/PolishModal.d.ts +0 -1
  46. package/dist/components/Editor/Preview/TypesetModal.d.ts +0 -1
  47. package/dist/components/Editor/Preview/useAiPreviewHtml.d.ts +8 -0
  48. package/dist/components/Editor/__tests__/createTestEditor.d.ts +1 -0
  49. package/dist/components/Editor/commands/ImageCommands.d.ts +1 -0
  50. package/dist/components/Editor/constants/portableEditorStyles.d.ts +2 -0
  51. package/dist/components/Editor/context/EditorContainerContext.d.ts +3 -2
  52. package/dist/components/Editor/hooks/useEditorFocus.d.ts +1 -0
  53. package/dist/components/Editor/hooks/useTextFormatsState.d.ts +1 -2
  54. package/dist/components/Editor/index.d.ts +1 -0
  55. package/dist/components/Editor/nodes/ExtendedLinkNode.d.ts +9 -0
  56. package/dist/components/Editor/nodes/ImageComponent.d.ts +1 -0
  57. package/dist/components/Editor/nodes/ImageNode.d.ts +5 -2
  58. package/dist/components/Editor/utils/getToolbarItems.d.ts +14 -0
  59. package/dist/components/Editor/utils/placeProgrammaticCaret.d.ts +5 -0
  60. package/dist/components/Editor/utils/readTextFormats.d.ts +6 -0
  61. package/dist/components/Editor/utils/retainCodeSelection.d.ts +3 -0
  62. package/dist/index.js +28 -50
  63. package/dist/style.css +1 -1
  64. package/dist/vendors/Tree-D0Q1IZ2D.js +267 -0
  65. package/dist/vendors/{version-Dzs4mguZ.js → version-BucxnUKs.js} +1 -1
  66. package/package.json +1 -1
  67. package/dist/Amap/Amap-BLSziesG.js +0 -77
  68. package/dist/Amap/AmapCircle/index.js +0 -5
  69. package/dist/Amap/AmapCircle-2qupysHe.js +0 -55
  70. package/dist/Amap/AmapContext-CJBe6lld.js +0 -11
  71. package/dist/Amap/AmapMarker/index.js +0 -6
  72. package/dist/Amap/AmapMarker-xEqoVnFR.js +0 -153
  73. package/dist/Amap/AmapMarkerCluster/index.js +0 -6
  74. package/dist/Amap/AmapMarkerCluster-CvEQa3o9.js +0 -240
  75. package/dist/Amap/AmapProvider/index.js +0 -7
  76. package/dist/Amap/AmapProvider-B-R2DrkJ.js +0 -107
  77. package/dist/Amap/hooks/index.js +0 -4
  78. package/dist/Amap/hooks-BTcFpdd0.js +0 -121
  79. package/dist/Amap/useMarkerInfoWindowController-Cjx0xQXw.js +0 -94
  80. package/dist/Calendar/AllDaySection-pO7suGJM.js +0 -53
  81. package/dist/Calendar/Calendar-Cjagi7mU.js +0 -795
  82. package/dist/Calendar/CurrentTimeIndicator-BF3_INSL.js +0 -65
  83. package/dist/Calendar/EventCard-DKEZQRTp.js +0 -155
  84. package/dist/Calendar/TimeAxis-DUc6EL-j.js +0 -13
  85. package/dist/Calendar/TimeGrid-BV8x9VnF.js +0 -47
  86. package/dist/Calendar/colorUtils-BbeSMnOs.js +0 -55
  87. package/dist/Calendar/context/index.js +0 -3
  88. package/dist/Calendar/context-CamSpkj3.js +0 -21
  89. package/dist/Calendar/layout-CpOabFQ2.js +0 -300
  90. package/dist/Calendar/subcomponents/AllDaySection/index.js +0 -11
  91. package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +0 -8
  92. package/dist/Calendar/subcomponents/EventCard/index.js +0 -9
  93. package/dist/Calendar/subcomponents/TimeAxis/index.js +0 -5
  94. package/dist/Calendar/subcomponents/TimeGrid/index.js +0 -7
  95. package/dist/Calendar/theme-Dc8hjcdo.js +0 -71
  96. package/dist/Calendar/utils/index.js +0 -111
  97. package/dist/Calendar/utils/layout/index.js +0 -4
  98. package/dist/Calendar/utils/theme/index.js +0 -3
  99. package/dist/DatePicker/DatePicker-neAwNSsc.js +0 -101
  100. package/dist/DatePicker/ensureDayjsPlugins-CSqhjLS7.js +0 -15
  101. package/dist/DatePicker/pickerLocale-CcPLUbZO.js +0 -15
  102. package/dist/DatePicker/style/index.js +0 -3
  103. package/dist/DatePicker/style-W7f5wyUb.js +0 -15
  104. package/dist/DropDown/style/index.js +0 -3
  105. package/dist/DropDown/style-DZpkarne.js +0 -9
  106. package/dist/Editor/Buttons-OwLs5bxR.js +0 -1841
  107. package/dist/Editor/ToolbarPlugin/Buttons/index.js +0 -21
  108. package/dist/Editor/constants/index.js +0 -61
  109. package/dist/Gantt/GanttChart/index.js +0 -21
  110. package/dist/Gantt/GanttChart-CDnF5qcc.js +0 -2292
  111. package/dist/Gantt/GanttHighlightContext-dtyoq-oj.js +0 -12
  112. package/dist/Gantt/GanttTable/index.js +0 -13
  113. package/dist/Gantt/GanttTable-fOv1Zn2-.js +0 -84
  114. package/dist/Gantt/GanttToolBar/index.js +0 -17
  115. package/dist/Gantt/GanttToolBar-BAoiWAHI.js +0 -120
  116. package/dist/Gantt/collapseKeys-BV_8sIA-.js +0 -160
  117. package/dist/Gantt/columnResize-Bkenlbab.js +0 -46
  118. package/dist/Gantt/constants-mEGQ1U1Q.js +0 -39
  119. package/dist/Gantt/highlightTarget-D3Nf9_7S.js +0 -25
  120. package/dist/Gantt/theme-B7Iap-tZ.js +0 -31
  121. package/dist/Gantt/timelineViewConfig-DNt7yi83.js +0 -118
  122. package/dist/Gantt/utils/index.js +0 -7
  123. package/dist/Gantt/utils/theme/index.js +0 -3
  124. package/dist/Select/style/index.js +0 -3
  125. package/dist/Select/style-C4A8kUd1.js +0 -9
  126. package/dist/Table/Table-3LSO0xSH.js +0 -545
  127. package/dist/Table/constants-D7wLH8Qy.js +0 -25
  128. package/dist/Table/hooks/index.js +0 -3
  129. package/dist/Table/hooks-DSBl2e4O.js +0 -108
  130. package/dist/Table/processRowspan-B6HMqw0Q.js +0 -144
  131. package/dist/Table/style/index.js +0 -3
  132. package/dist/Table/style-B8Cw8HJe.js +0 -9
  133. package/dist/Table/utils/index.js +0 -3
  134. package/dist/Tree/utils/index.js +0 -26
  135. package/dist/vendors/Tree-DSl4lDjx.js +0 -248
  136. /package/dist/Card/{Card-rJeWgxu5.js → Card-DAz0dvA3.js} +0 -0
  137. /package/dist/CheckBox/{CheckBox-DOK5N7z6.js → CheckBox-CcHskTz_.js} +0 -0
  138. /package/dist/Modal/{Modal-CRKitOOj.js → Modal-eZijJ7CB.js} +0 -0
  139. /package/dist/NotFoundContent/{NotFoundContent-BLmzWNBi.js → NotFoundContent-DJUQ0_2D.js} +0 -0
  140. /package/dist/Radio/{Radio-CX9cUqb7.js → Radio-D9jhW7K6.js} +0 -0
  141. /package/dist/vendors/{animations-Dn_5xJ7B.js → animations-ISccYUE3.js} +0 -0
  142. /package/dist/vendors/{cssVars-l4-kP_14.js → cssVars-UpriQzph.js} +0 -0
  143. /package/dist/vendors/{mergeRefs-TiJ0xjUN.js → mergeRefs-mEH9TBYV.js} +0 -0
  144. /package/dist/vendors/{useFloatingOverlay-B3M9k8nj.js → useFloatingOverlay-B66lOL8v.js} +0 -0
  145. /package/dist/vendors/{useFloatingPortal-VpzL-EPh.js → useFloatingPortal-DJ1iKmW-.js} +0 -0
  146. /package/dist/vendors/{useLatchedPopupPortalRoot-4fVhqVT4.js → useLatchedPopupPortalRoot-CC6af8t-.js} +0 -0
  147. /package/dist/vendors/{useLocale-D31qCCff.js → useLocale-Be4e7Xfn.js} +0 -0
@@ -1,144 +0,0 @@
1
- import { i as e, t } from "./constants-D7wLH8Qy.js";
2
- import { groupBy as n, sumBy as r } from "lodash-es";
3
- //#region src/components/Table/utils/tableUtils.ts
4
- var i = (e = []) => e.flatMap((e) => e.children?.length ? e.children : [e]), a = (e, t) => t.findIndex((t) => e.isParent ? t.parentKey === e.key : t.key === e.key), o = (e, n, i, a = t.DEFAULT_WIDTH) => r(i === "left" ? n.slice(0, e) : n.slice(e + 1), (e) => e.width || a), s = (e, t, n) => n !== "left" && n !== "right" ? null : {
5
- position: "sticky",
6
- [n]: o(e, t, n),
7
- zIndex: 2
8
- }, c = (t, n, r, i) => {
9
- if (!n || !r) return t;
10
- let a = r === e.DESC ? -1 : 1;
11
- return [...t].sort((e, t) => {
12
- let r = e[n], o = t[n];
13
- return i ? i(r, o, e, t) * a : r === o ? 0 : r == null ? 1 : o == null ? -1 : typeof r == "string" && typeof o == "string" ? r.localeCompare(o) * a : (r < o ? -1 : 1) * a;
14
- });
15
- }, l = (e, t, n) => {
16
- let r = e[t];
17
- return typeof r == "string" || typeof r == "number" ? r : n;
18
- }, u = (e) => {
19
- let t = [], n = [], r = [];
20
- return e.forEach((e, i) => {
21
- let a = {
22
- ...e,
23
- index: i
24
- };
25
- e.fixed === "left" ? t.push(a) : e.fixed === "right" ? r.push(a) : n.push(a);
26
- }), {
27
- leftFixedColumns: t,
28
- normalColumns: n,
29
- rightFixedColumns: r
30
- };
31
- }, d = (e, n = t.DEFAULT_WIDTH) => r(e, (e) => e.children?.length ? r(e.children, (e) => e.width || n) : e.width || n), f = (e) => {
32
- let t = [], n = [], r = (e, i = 0, a = null) => {
33
- t[i] || (t[i] = []), e.forEach((e) => {
34
- let o = e.children, s = e.fixed || a || void 0;
35
- if (o && o.length > 0) t[i].push({
36
- ...e,
37
- colSpan: o.length,
38
- rowSpan: 1,
39
- isParent: !0,
40
- fixed: s
41
- }), r(o, i + 1, s || null);
42
- else {
43
- let r = i + 1, a = {
44
- ...e,
45
- colSpan: 1,
46
- rowSpan: r,
47
- isLeaf: !0,
48
- fixed: s
49
- };
50
- for (let n = 0; n < i; n++) t[n].find((t) => t.key === e.key) || t[n].push({
51
- ...a,
52
- isPlaceholder: !0
53
- });
54
- t[i].push(a), n.push(a);
55
- }
56
- });
57
- };
58
- r(e);
59
- let i = [], a = t.length;
60
- for (let t = 0; t < a; t++) {
61
- let n = [], r = 0, o = (e, i = 0, s = null) => {
62
- e.forEach((e) => {
63
- let c = e.children, l = e.fixed || s || void 0;
64
- c && c.length > 0 ? i === t ? n.push({
65
- ...e,
66
- colSpan: c.length,
67
- rowSpan: 1,
68
- isParent: !0,
69
- displayIndex: r++,
70
- fixed: l
71
- }) : i < t && o(c, i + 1, l || null) : i === t ? n.push({
72
- ...e,
73
- colSpan: 1,
74
- rowSpan: a - i,
75
- isLeaf: !0,
76
- displayIndex: r++,
77
- fixed: l
78
- }) : i < t && r++;
79
- });
80
- };
81
- o(e), i.push(n);
82
- }
83
- return {
84
- flatColumns: n,
85
- headerRows: i
86
- };
87
- }, p = (e, t) => {
88
- let n = t.name, r = t.children || [], i = 0;
89
- for (let t = 0; t < e.length; t++) {
90
- let a = e[t], o = Object.keys(a);
91
- r.some((e) => {
92
- let t = `${n}.${e.subformField || e.key}.`;
93
- return o.some((e) => e.startsWith(t) && a[e] !== void 0 && a[e] !== "");
94
- }) && (i = t + 1);
95
- }
96
- return i;
97
- }, m = (e, t, r = "_id") => {
98
- if (!e || e.length === 0) return [];
99
- let i = t.filter((e) => !!(e.children && e.children.length > 0));
100
- if (i.length === 0) return e.map((e) => ({
101
- ...e,
102
- _rowspan: {},
103
- _showMainFields: !0
104
- }));
105
- let a = n(e, (e) => String(e[r] || e._id || e.id)), o = {};
106
- Object.entries(a).forEach(([e, t]) => {
107
- let n = {};
108
- i.forEach((e) => {
109
- n[e.name] = p(t, e);
110
- }), o[e] = {
111
- groupSize: t.length,
112
- subformRowCounts: n
113
- };
114
- });
115
- let s = [], c = {};
116
- return e.forEach((e) => {
117
- let t = String(e[r] || e._id || e.id), n = o[t], a = c[t] ?? 0;
118
- c[t] = a + 1;
119
- let l = a === 0, u = {};
120
- i.forEach((e) => {
121
- u[e.key] = l ? n.groupSize : 0;
122
- }), u._mainFields = l ? n.groupSize : 0, s.push({
123
- ...e,
124
- _rowspan: u,
125
- _showMainFields: l,
126
- _groupIndex: a,
127
- _groupSize: n.groupSize,
128
- _subformRowCounts: n.subformRowCounts
129
- });
130
- }), s;
131
- }, h = (e, t) => {
132
- if (t.parentKey) return 1;
133
- if (e._rowspan && e._rowspan[t.key] !== void 0) {
134
- let n = e._rowspan[t.key];
135
- return n > 0 ? n : 0;
136
- }
137
- if (e._rowspan && e._rowspan._mainFields !== void 0) {
138
- let t = e._rowspan._mainFields;
139
- return t > 0 ? t : 0;
140
- }
141
- return 1;
142
- }, g = (e, t) => h(e, t) > 0;
143
- //#endregion
144
- export { o as a, d as c, c as d, u as f, f as i, s as l, m as n, i as o, g as r, a as s, h as t, l as u };
@@ -1,3 +0,0 @@
1
- import "../../vendors/version-Dzs4mguZ.js";
2
- import { t as e } from "../style-B8Cw8HJe.js";
3
- export { e as resolveTableThemeVars };
@@ -1,9 +0,0 @@
1
- import { t as e } from "../vendors/cssVars-l4-kP_14.js";
2
- //#region src/components/Table/style/resolveTableThemeVars.ts
3
- var t = (t) => {
4
- if (!t) return {};
5
- let n = {};
6
- return e(n, "--bsy-table-color-border", t.colorBorder), e(n, "--bsy-table-color-bg-header", t.colorBgHeader), e(n, "--bsy-table-color-bg-container", t.colorBgContainer), e(n, "--bsy-table-color-text", t.colorText), e(n, "--bsy-table-color-text-heading", t.colorTextHeading), e(n, "--bsy-table-color-bg-row-hover", t.colorBgRowHover), n;
7
- };
8
- //#endregion
9
- export { t };
@@ -1,3 +0,0 @@
1
- import "../../vendors/version-Dzs4mguZ.js";
2
- import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "../processRowspan-B6HMqw0Q.js";
3
- export { e as calculateFixedOffset, s as expandLeafColumns, l as findFlatColumnIndex, i as flattenColumns, u as getCellRowspan, t as getColumnsWidth, a as getFixedStickyStyle, d as getRowKey, o as processRowspan, c as shouldRenderCell, n as sortData, r as splitFixedColumns };
@@ -1,26 +0,0 @@
1
- import "../../vendors/version-Dzs4mguZ.js";
2
- import { isString as e } from "lodash-es";
3
- //#region src/components/Tree/utils/index.ts
4
- var t = (e, n, r, i = []) => {
5
- for (let a of e) {
6
- let e = [...i, a[r.value]];
7
- if (a[r.value] === n) return e;
8
- if (a[r.children]?.length) {
9
- let i = t(a[r.children], n, r, e);
10
- if (i) return i;
11
- }
12
- }
13
- return null;
14
- }, n = (t, r, i, a = []) => {
15
- let o = [];
16
- for (let s of t) {
17
- let t = [...a, s[i.value]], c = s[i.title];
18
- if (e(c) && c.toLowerCase().includes(r.toLowerCase()) && o.push(t), s[i.children]?.length) {
19
- let e = n(s[i.children], r, i, t);
20
- o.push(...e);
21
- }
22
- }
23
- return o;
24
- };
25
- //#endregion
26
- export { n as getMatchingNodesPaths, t as getNodePath };
@@ -1,248 +0,0 @@
1
- import { t as e } from "../Icon/Icon-DrdQOEJE.js";
2
- import { t } from "../CheckBox/CheckBox-DOK5N7z6.js";
3
- import { t as n } from "../Radio/Radio-CX9cUqb7.js";
4
- import { getMatchingNodesPaths as r, getNodePath as i } from "../Tree/utils/index.js";
5
- import { noop as a } from "lodash-es";
6
- import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
7
- import l, { createContext as u, useCallback as d, useContext as f, useEffect as p, useMemo as m } from "react";
8
- import h from "clsx";
9
- import { useControllableValue as g } from "ahooks";
10
- import { AnimatePresence as _, motion as v } from "motion/react";
11
- //#region src/components/Select/HighlightText/HighlightText.tsx
12
- var y = ({ text: e, highlight: t, truncate: n = !0 }) => {
13
- let [r, i] = m(() => e && t ? [e.toLowerCase(), t.toLowerCase()] : [], [e, t]), a = d(() => {
14
- if (!t.trim()) return [{
15
- text: e,
16
- isMatch: !1
17
- }];
18
- let n = i ? r?.indexOf(i) : -1;
19
- return n === -1 || n === void 0 ? [{
20
- text: e,
21
- isMatch: !1
22
- }] : [
23
- {
24
- text: e.slice(0, n),
25
- isMatch: !1
26
- },
27
- {
28
- text: e.slice(n, n + t.length),
29
- isMatch: !0
30
- },
31
- {
32
- text: e.slice(n + t.length),
33
- isMatch: !1
34
- }
35
- ].filter((e) => e.text);
36
- }, [
37
- e,
38
- t,
39
- r,
40
- i
41
- ])(), o = {
42
- color: "var(--bsy-select-color-highlight, #0265ff)",
43
- fontWeight: 500
44
- };
45
- return /* @__PURE__ */ s("div", {
46
- className: n ? "select-none text-ellipsis overflow-hidden whitespace-nowrap truncate w-full" : "select-none whitespace-nowrap w-full",
47
- children: a.map((e, t) => e.isMatch ? /* @__PURE__ */ s("span", {
48
- style: o,
49
- children: e.text
50
- }, t) : /* @__PURE__ */ s("span", { children: e.text }, t))
51
- });
52
- };
53
- y.displayName = "HighlightText";
54
- var b = l.memo(y), x = {
55
- "bsy-tree-node__title": "_bsy-tree-node__title_1of4m_1",
56
- "bsy-tree-node__children": "_bsy-tree-node__children_1of4m_5"
57
- }, S = u({
58
- searchValue: "",
59
- selectedKeys: [],
60
- expandedKeys: [],
61
- parentCheckable: !1,
62
- onSelect: a,
63
- onExpand: a,
64
- icon: void 0,
65
- switcherIcon: void 0,
66
- checkType: "default",
67
- showSwitcher: !0
68
- }), C = 22, w = ({ node: r, level: i = 0, fieldNames: a }) => {
69
- let u = f(S), { searchValue: d, selectedKeys: p, expandedKeys: m, onSelect: g, onExpand: y, onDeSelect: T, parentCheckable: E, checkType: D, showSwitcher: O } = f(S), k = r[a.children] && r[a.children].length > 0, A = p.includes(r[a.value]), j = k ? m.includes(r[a.value]) : !1, M = r.disabled === !0, N = () => {
70
- if (r.checkable === !1) {
71
- k && y?.(r[a.value], !j);
72
- return;
73
- }
74
- if (!M) {
75
- if (k) {
76
- E ? P() : y?.(r[a.value], !j);
77
- return;
78
- }
79
- P();
80
- }
81
- }, P = () => {
82
- A ? T?.(r[a.value]) : g?.(r[a.value], r);
83
- }, F = (e) => {
84
- e.stopPropagation(), k && y?.(r[a.value], !j);
85
- }, I = (e = !1) => {
86
- let t = r.icon || u.icon;
87
- if (!t) return null;
88
- let n = typeof t == "function" ? t(r) : t;
89
- return l.isValidElement(n) ? /* @__PURE__ */ s("span", {
90
- className: h({
91
- "text-[#0265ff]": e,
92
- "text-[#73819c]": !e
93
- }),
94
- children: n
95
- }) : null;
96
- }, L = (t) => k ? u.switcherIcon ? u.switcherIcon(t, r) : /* @__PURE__ */ s(e, {
97
- name: "arrow-right",
98
- className: h("transition-transform duration-300 ease-in-out text-[#666]", { "rotate-90": t })
99
- }) : null, R = () => k && !E || D === "default" || r.checkable === !1 ? null : /* @__PURE__ */ c("div", {
100
- className: "ml-auto shrink-0",
101
- children: [D === "radio" && /* @__PURE__ */ s(n, {
102
- checked: A,
103
- disabled: M
104
- }), D === "checkbox" && /* @__PURE__ */ s(t, {
105
- checked: A,
106
- disabled: M
107
- })]
108
- });
109
- return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", {
110
- className: h("rounded-[4px]", {
111
- "cursor-pointer": !M,
112
- "cursor-not-allowed opacity-60": M,
113
- "text-[#0265ff] bg-[#f0f6ff]": A && D === "default",
114
- "hover:bg-[#eff0f6]": !M && (!A || D !== "default")
115
- }),
116
- onClick: N,
117
- children: /* @__PURE__ */ c("div", {
118
- className: "flex items-center px-[10px] py-[7px] gap-x-[6px]",
119
- style: { marginLeft: `${i * C}px` },
120
- children: [
121
- O ? /* @__PURE__ */ s("div", {
122
- className: "w-4 h-4 flex items-center justify-center flex-shrink-0",
123
- "data-testid": "bsy-tree-switcher",
124
- onClick: F,
125
- children: L(j)
126
- }) : null,
127
- I(A),
128
- /* @__PURE__ */ s("div", {
129
- className: x["bsy-tree-node__title"],
130
- children: l.isValidElement(r[a.title]) ? r[a.title] : /* @__PURE__ */ s(b, {
131
- text: r[a.title],
132
- highlight: d
133
- })
134
- }),
135
- R()
136
- ]
137
- })
138
- }), k && /* @__PURE__ */ s(_, {
139
- initial: !1,
140
- children: j ? /* @__PURE__ */ s(v.div, {
141
- initial: {
142
- height: 0,
143
- opacity: 0
144
- },
145
- animate: {
146
- height: "auto",
147
- opacity: 1
148
- },
149
- exit: {
150
- height: 0,
151
- opacity: 0
152
- },
153
- transition: {
154
- duration: .2,
155
- ease: [
156
- .4,
157
- 0,
158
- .2,
159
- 1
160
- ]
161
- },
162
- style: { overflow: "hidden" },
163
- children: /* @__PURE__ */ s("div", {
164
- className: x["bsy-tree-node__children"],
165
- children: r[a.children]?.map((e) => /* @__PURE__ */ s(w, {
166
- node: e,
167
- level: i + 1,
168
- fieldNames: a
169
- }, e[a.value]))
170
- })
171
- }, "children") : null
172
- })] });
173
- }, T = { "bsy-tree": "_bsy-tree_x86u3_1" }, E = (e) => {
174
- let { data: t, searchValue: n = "", fieldNames: a = {
175
- title: "title",
176
- value: "value",
177
- children: "children"
178
- }, icon: o, switcherIcon: c, onSelect: l, parentCheckable: u = !1, checkType: f = "default", defaultExpandedKeys: m, showSwitcher: h = !0, onDeSelect: _ } = e, [v, y] = g(e, {
179
- defaultValuePropName: "defaultSelectedKeys",
180
- valuePropName: "selectedKeys",
181
- defaultValue: [],
182
- trigger: "__DO_NOT_CALLED__"
183
- }), [b, x] = g(e, {
184
- valuePropName: "expandedKeys",
185
- defaultValuePropName: "defaultExpandedKeys",
186
- defaultValue: (() => {
187
- let n = /* @__PURE__ */ new Set();
188
- return e.selectedKeys?.length ? (e.selectedKeys.forEach((e) => {
189
- let r = i(t, e, a);
190
- r && r.length > 1 && r.slice(0, -1).forEach((e) => n.add(e));
191
- }), [...n]) : [];
192
- })(),
193
- trigger: "onExpand"
194
- });
195
- p(() => {
196
- if (!n) {
197
- if (e.expandedKeys !== void 0 || v.length || m?.length || b.length) return;
198
- x([]);
199
- return;
200
- }
201
- let i = /* @__PURE__ */ new Set(), o = r(t, n, a);
202
- if (o.length === 0) {
203
- x([]);
204
- return;
205
- }
206
- o.forEach((e) => e.slice(0, -1).forEach((e) => i.add(e))), i.size !== 0 && x([...i]);
207
- }, [n]);
208
- let C = d((e, t) => {
209
- y((t) => f === "checkbox" ? [...new Set([...t, e])] : [e]), l && l?.(e, t);
210
- }, [
211
- l,
212
- y,
213
- f
214
- ]), E = (e, t) => {
215
- C(e, t);
216
- }, D = d((e) => {
217
- y((t) => t.filter((t) => t !== e)), _?.(e);
218
- }, [y, _]), O = (e, t) => {
219
- x(t ? [...b, e] : b.filter((t) => t !== e));
220
- };
221
- if (!t?.length) return null;
222
- let k = t.some((e) => e[a.children]?.length > 0), A = {
223
- searchValue: n,
224
- selectedKeys: v,
225
- expandedKeys: b,
226
- onSelect: E,
227
- onDeSelect: D,
228
- onExpand: O,
229
- icon: o,
230
- switcherIcon: c,
231
- checkType: f,
232
- parentCheckable: u,
233
- showSwitcher: h && k
234
- };
235
- return /* @__PURE__ */ s(S.Provider, {
236
- value: A,
237
- children: /* @__PURE__ */ s("div", {
238
- className: `${T["bsy-tree"]} text-sm`,
239
- children: t.map((e) => /* @__PURE__ */ s(w, {
240
- node: e,
241
- fieldNames: a
242
- }, e[a.value]))
243
- })
244
- });
245
- };
246
- E.displayName = "BsyTree";
247
- //#endregion
248
- export { b as n, E as t };