@baishuyun/ui-base 6.16.0 → 6.17.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 (140) hide show
  1. package/dist/Amap/Amap-CNsoge6e.js +826 -0
  2. package/dist/Amap/index.js +3 -10
  3. package/dist/Calendar/Calendar-BlsUX2vX.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-BRwPZeui.js +111 -0
  12. package/dist/DatePicker/{DatePickerPanel-CRnLvIwc.js → DatePickerPanel-UwjSXS-U.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-CvG9IFVk.js → DropDown-B_szM67V.js} +86 -82
  16. package/dist/DropDown/index.js +8 -9
  17. package/dist/Editor/index.js +2839 -880
  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-Bla1mQ8v.js → Select-VIy6OKEj.js} +262 -259
  33. package/dist/Select/{SelectInputSearch-CRgBcsq2.js → SelectInputSearch-MApQHnU9.js} +21 -10
  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/HtmlPreview.d.ts +2 -3
  44. package/dist/components/Editor/__tests__/createTestEditor.d.ts +1 -0
  45. package/dist/components/Editor/constants/portableEditorStyles.d.ts +2 -0
  46. package/dist/components/Editor/hooks/useEditorFocus.d.ts +1 -0
  47. package/dist/components/Editor/hooks/useTextFormatsState.d.ts +1 -2
  48. package/dist/components/Editor/index.d.ts +1 -0
  49. package/dist/components/Editor/nodes/ExtendedLinkNode.d.ts +9 -0
  50. package/dist/components/Editor/utils/getToolbarItems.d.ts +14 -0
  51. package/dist/components/Editor/utils/placeProgrammaticCaret.d.ts +5 -0
  52. package/dist/components/Editor/utils/readTextFormats.d.ts +6 -0
  53. package/dist/components/Editor/utils/retainCodeSelection.d.ts +3 -0
  54. package/dist/components/Select/SelectInputSearch/SelectInputSearch.d.ts +2 -0
  55. package/dist/index.js +28 -50
  56. package/dist/style.css +1 -1
  57. package/dist/vendors/Tree-D0Q1IZ2D.js +267 -0
  58. package/dist/vendors/{version-CFii9VTt.js → version-CfjNx5v2.js} +1 -1
  59. package/package.json +1 -1
  60. package/dist/Amap/Amap-BLSziesG.js +0 -77
  61. package/dist/Amap/AmapCircle/index.js +0 -5
  62. package/dist/Amap/AmapCircle-2qupysHe.js +0 -55
  63. package/dist/Amap/AmapContext-CJBe6lld.js +0 -11
  64. package/dist/Amap/AmapMarker/index.js +0 -6
  65. package/dist/Amap/AmapMarker-xEqoVnFR.js +0 -153
  66. package/dist/Amap/AmapMarkerCluster/index.js +0 -6
  67. package/dist/Amap/AmapMarkerCluster-CvEQa3o9.js +0 -240
  68. package/dist/Amap/AmapProvider/index.js +0 -7
  69. package/dist/Amap/AmapProvider-B-R2DrkJ.js +0 -107
  70. package/dist/Amap/hooks/index.js +0 -4
  71. package/dist/Amap/hooks-BTcFpdd0.js +0 -121
  72. package/dist/Amap/useMarkerInfoWindowController-Cjx0xQXw.js +0 -94
  73. package/dist/Calendar/AllDaySection-pO7suGJM.js +0 -53
  74. package/dist/Calendar/Calendar-DUD4iffO.js +0 -795
  75. package/dist/Calendar/CurrentTimeIndicator-BF3_INSL.js +0 -65
  76. package/dist/Calendar/EventCard-DKEZQRTp.js +0 -155
  77. package/dist/Calendar/TimeAxis-DUc6EL-j.js +0 -13
  78. package/dist/Calendar/TimeGrid-BV8x9VnF.js +0 -47
  79. package/dist/Calendar/colorUtils-BbeSMnOs.js +0 -55
  80. package/dist/Calendar/context/index.js +0 -3
  81. package/dist/Calendar/context-CamSpkj3.js +0 -21
  82. package/dist/Calendar/layout-CpOabFQ2.js +0 -300
  83. package/dist/Calendar/subcomponents/AllDaySection/index.js +0 -11
  84. package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +0 -8
  85. package/dist/Calendar/subcomponents/EventCard/index.js +0 -9
  86. package/dist/Calendar/subcomponents/TimeAxis/index.js +0 -5
  87. package/dist/Calendar/subcomponents/TimeGrid/index.js +0 -7
  88. package/dist/Calendar/theme-Dc8hjcdo.js +0 -71
  89. package/dist/Calendar/utils/index.js +0 -111
  90. package/dist/Calendar/utils/layout/index.js +0 -4
  91. package/dist/Calendar/utils/theme/index.js +0 -3
  92. package/dist/DatePicker/DatePicker-BWMmI6rl.js +0 -101
  93. package/dist/DatePicker/ensureDayjsPlugins-CSqhjLS7.js +0 -15
  94. package/dist/DatePicker/pickerLocale-CcPLUbZO.js +0 -15
  95. package/dist/DatePicker/style/index.js +0 -3
  96. package/dist/DatePicker/style-W7f5wyUb.js +0 -15
  97. package/dist/DropDown/style/index.js +0 -3
  98. package/dist/DropDown/style-DZpkarne.js +0 -9
  99. package/dist/Editor/Buttons-vt3gwedu.js +0 -1841
  100. package/dist/Editor/ToolbarPlugin/Buttons/index.js +0 -21
  101. package/dist/Editor/constants/index.js +0 -61
  102. package/dist/Gantt/GanttChart/index.js +0 -21
  103. package/dist/Gantt/GanttChart-DRzJdEm-.js +0 -2292
  104. package/dist/Gantt/GanttHighlightContext-dtyoq-oj.js +0 -12
  105. package/dist/Gantt/GanttTable/index.js +0 -13
  106. package/dist/Gantt/GanttTable-fOv1Zn2-.js +0 -84
  107. package/dist/Gantt/GanttToolBar/index.js +0 -17
  108. package/dist/Gantt/GanttToolBar-4kxZP6oS.js +0 -120
  109. package/dist/Gantt/collapseKeys-BV_8sIA-.js +0 -160
  110. package/dist/Gantt/columnResize-Bkenlbab.js +0 -46
  111. package/dist/Gantt/constants-mEGQ1U1Q.js +0 -39
  112. package/dist/Gantt/highlightTarget-D3Nf9_7S.js +0 -25
  113. package/dist/Gantt/theme-B7Iap-tZ.js +0 -31
  114. package/dist/Gantt/timelineViewConfig-DNt7yi83.js +0 -118
  115. package/dist/Gantt/utils/index.js +0 -7
  116. package/dist/Gantt/utils/theme/index.js +0 -3
  117. package/dist/Select/style/index.js +0 -3
  118. package/dist/Select/style-C4A8kUd1.js +0 -9
  119. package/dist/Table/Table-3LSO0xSH.js +0 -545
  120. package/dist/Table/constants-D7wLH8Qy.js +0 -25
  121. package/dist/Table/hooks/index.js +0 -3
  122. package/dist/Table/hooks-DSBl2e4O.js +0 -108
  123. package/dist/Table/processRowspan-B6HMqw0Q.js +0 -144
  124. package/dist/Table/style/index.js +0 -3
  125. package/dist/Table/style-B8Cw8HJe.js +0 -9
  126. package/dist/Table/utils/index.js +0 -3
  127. package/dist/Tree/utils/index.js +0 -26
  128. package/dist/vendors/Tree-DSl4lDjx.js +0 -248
  129. /package/dist/Card/{Card-rJeWgxu5.js → Card-DAz0dvA3.js} +0 -0
  130. /package/dist/CheckBox/{CheckBox-DOK5N7z6.js → CheckBox-CcHskTz_.js} +0 -0
  131. /package/dist/Modal/{Modal-CRKitOOj.js → Modal-eZijJ7CB.js} +0 -0
  132. /package/dist/NotFoundContent/{NotFoundContent-BLmzWNBi.js → NotFoundContent-DJUQ0_2D.js} +0 -0
  133. /package/dist/Radio/{Radio-CX9cUqb7.js → Radio-D9jhW7K6.js} +0 -0
  134. /package/dist/vendors/{animations-Dn_5xJ7B.js → animations-ISccYUE3.js} +0 -0
  135. /package/dist/vendors/{cssVars-l4-kP_14.js → cssVars-UpriQzph.js} +0 -0
  136. /package/dist/vendors/{mergeRefs-TiJ0xjUN.js → mergeRefs-mEH9TBYV.js} +0 -0
  137. /package/dist/vendors/{useFloatingOverlay-B3M9k8nj.js → useFloatingOverlay-B66lOL8v.js} +0 -0
  138. /package/dist/vendors/{useFloatingPortal-VpzL-EPh.js → useFloatingPortal-DJ1iKmW-.js} +0 -0
  139. /package/dist/vendors/{useLatchedPopupPortalRoot-4fVhqVT4.js → useLatchedPopupPortalRoot-CC6af8t-.js} +0 -0
  140. /package/dist/vendors/{useLocale-D31qCCff.js → useLocale-Be4e7Xfn.js} +0 -0
@@ -0,0 +1,267 @@
1
+ import { t as e } from "../Icon/Icon-DrdQOEJE.js";
2
+ import { t } from "../CheckBox/CheckBox-CcHskTz_.js";
3
+ import { t as n } from "../Radio/Radio-D9jhW7K6.js";
4
+ import { isString as r, noop as i } from "lodash-es";
5
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ import c, { createContext as l, useCallback as u, useContext as d, useEffect as f, useMemo as p } from "react";
7
+ import m from "clsx";
8
+ import { useControllableValue as h } from "ahooks";
9
+ import { AnimatePresence as g, motion as _ } from "motion/react";
10
+ //#region src/components/Select/HighlightText/HighlightText.tsx
11
+ var v = ({ text: e, highlight: t, truncate: n = !0 }) => {
12
+ let [r, i] = p(() => e && t ? [e.toLowerCase(), t.toLowerCase()] : [], [e, t]), a = u(() => {
13
+ if (!t.trim()) return [{
14
+ text: e,
15
+ isMatch: !1
16
+ }];
17
+ let n = i ? r?.indexOf(i) : -1;
18
+ return n === -1 || n === void 0 ? [{
19
+ text: e,
20
+ isMatch: !1
21
+ }] : [
22
+ {
23
+ text: e.slice(0, n),
24
+ isMatch: !1
25
+ },
26
+ {
27
+ text: e.slice(n, n + t.length),
28
+ isMatch: !0
29
+ },
30
+ {
31
+ text: e.slice(n + t.length),
32
+ isMatch: !1
33
+ }
34
+ ].filter((e) => e.text);
35
+ }, [
36
+ e,
37
+ t,
38
+ r,
39
+ i
40
+ ])(), s = {
41
+ color: "var(--bsy-select-color-highlight, #0265ff)",
42
+ fontWeight: 500
43
+ };
44
+ return /* @__PURE__ */ o("div", {
45
+ className: n ? "select-none text-ellipsis overflow-hidden whitespace-nowrap truncate w-full" : "select-none whitespace-nowrap w-full",
46
+ children: a.map((e, t) => e.isMatch ? /* @__PURE__ */ o("span", {
47
+ style: s,
48
+ children: e.text
49
+ }, t) : /* @__PURE__ */ o("span", { children: e.text }, t))
50
+ });
51
+ };
52
+ v.displayName = "HighlightText";
53
+ var y = c.memo(v), b = {
54
+ "bsy-tree-node__title": "_bsy-tree-node__title_1of4m_1",
55
+ "bsy-tree-node__children": "_bsy-tree-node__children_1of4m_5"
56
+ }, x = l({
57
+ searchValue: "",
58
+ selectedKeys: [],
59
+ expandedKeys: [],
60
+ parentCheckable: !1,
61
+ onSelect: i,
62
+ onExpand: i,
63
+ icon: void 0,
64
+ switcherIcon: void 0,
65
+ checkType: "default",
66
+ showSwitcher: !0
67
+ }), S = 22, C = ({ node: r, level: i = 0, fieldNames: l }) => {
68
+ let u = d(x), { searchValue: f, selectedKeys: p, expandedKeys: h, onSelect: v, onExpand: w, onDeSelect: T, parentCheckable: E, checkType: D, showSwitcher: O } = d(x), k = r[l.children] && r[l.children].length > 0, A = p.includes(r[l.value]), j = k ? h.includes(r[l.value]) : !1, M = r.disabled === !0, N = () => {
69
+ if (r.checkable === !1) {
70
+ k && w?.(r[l.value], !j);
71
+ return;
72
+ }
73
+ if (!M) {
74
+ if (k) {
75
+ E ? P() : w?.(r[l.value], !j);
76
+ return;
77
+ }
78
+ P();
79
+ }
80
+ }, P = () => {
81
+ A ? T?.(r[l.value]) : v?.(r[l.value], r);
82
+ }, F = (e) => {
83
+ e.stopPropagation(), k && w?.(r[l.value], !j);
84
+ }, I = (e = !1) => {
85
+ let t = r.icon || u.icon;
86
+ if (!t) return null;
87
+ let n = typeof t == "function" ? t(r) : t;
88
+ return c.isValidElement(n) ? /* @__PURE__ */ o("span", {
89
+ className: m({
90
+ "text-[#0265ff]": e,
91
+ "text-[#73819c]": !e
92
+ }),
93
+ children: n
94
+ }) : null;
95
+ }, L = (t) => k ? u.switcherIcon ? u.switcherIcon(t, r) : /* @__PURE__ */ o(e, {
96
+ name: "arrow-right",
97
+ className: m("transition-transform duration-300 ease-in-out text-[#666]", { "rotate-90": t })
98
+ }) : null, R = () => k && !E || D === "default" || r.checkable === !1 ? null : /* @__PURE__ */ s("div", {
99
+ className: "ml-auto shrink-0",
100
+ children: [D === "radio" && /* @__PURE__ */ o(n, {
101
+ checked: A,
102
+ disabled: M
103
+ }), D === "checkbox" && /* @__PURE__ */ o(t, {
104
+ checked: A,
105
+ disabled: M
106
+ })]
107
+ });
108
+ return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("div", {
109
+ className: m("rounded-[4px]", {
110
+ "cursor-pointer": !M,
111
+ "cursor-not-allowed opacity-60": M,
112
+ "text-[#0265ff] bg-[#f0f6ff]": A && D === "default",
113
+ "hover:bg-[#eff0f6]": !M && (!A || D !== "default")
114
+ }),
115
+ onClick: N,
116
+ children: /* @__PURE__ */ s("div", {
117
+ className: "flex items-center px-[10px] py-[7px] gap-x-[6px]",
118
+ style: { marginLeft: `${i * S}px` },
119
+ children: [
120
+ O ? /* @__PURE__ */ o("div", {
121
+ className: "w-4 h-4 flex items-center justify-center flex-shrink-0",
122
+ "data-testid": "bsy-tree-switcher",
123
+ onClick: F,
124
+ children: L(j)
125
+ }) : null,
126
+ I(A),
127
+ /* @__PURE__ */ o("div", {
128
+ className: b["bsy-tree-node__title"],
129
+ children: c.isValidElement(r[l.title]) ? r[l.title] : /* @__PURE__ */ o(y, {
130
+ text: r[l.title],
131
+ highlight: f
132
+ })
133
+ }),
134
+ R()
135
+ ]
136
+ })
137
+ }), k && /* @__PURE__ */ o(g, {
138
+ initial: !1,
139
+ children: j ? /* @__PURE__ */ o(_.div, {
140
+ initial: {
141
+ height: 0,
142
+ opacity: 0
143
+ },
144
+ animate: {
145
+ height: "auto",
146
+ opacity: 1
147
+ },
148
+ exit: {
149
+ height: 0,
150
+ opacity: 0
151
+ },
152
+ transition: {
153
+ duration: .2,
154
+ ease: [
155
+ .4,
156
+ 0,
157
+ .2,
158
+ 1
159
+ ]
160
+ },
161
+ style: { overflow: "hidden" },
162
+ children: /* @__PURE__ */ o("div", {
163
+ className: b["bsy-tree-node__children"],
164
+ children: r[l.children]?.map((e) => /* @__PURE__ */ o(C, {
165
+ node: e,
166
+ level: i + 1,
167
+ fieldNames: l
168
+ }, e[l.value]))
169
+ })
170
+ }, "children") : null
171
+ })] });
172
+ }, w = { "bsy-tree": "_bsy-tree_x86u3_1" }, T = (e, t, n, r = []) => {
173
+ for (let i of e) {
174
+ let e = [...r, i[n.value]];
175
+ if (i[n.value] === t) return e;
176
+ if (i[n.children]?.length) {
177
+ let r = T(i[n.children], t, n, e);
178
+ if (r) return r;
179
+ }
180
+ }
181
+ return null;
182
+ }, E = (e, t, n, i = []) => {
183
+ let a = [];
184
+ for (let o of e) {
185
+ let e = [...i, o[n.value]], s = o[n.title];
186
+ if (r(s) && s.toLowerCase().includes(t.toLowerCase()) && a.push(e), o[n.children]?.length) {
187
+ let r = E(o[n.children], t, n, e);
188
+ a.push(...r);
189
+ }
190
+ }
191
+ return a;
192
+ }, D = (e) => {
193
+ let { data: t, searchValue: n = "", fieldNames: r = {
194
+ title: "title",
195
+ value: "value",
196
+ children: "children"
197
+ }, icon: i, switcherIcon: a, onSelect: s, parentCheckable: c = !1, checkType: l = "default", defaultExpandedKeys: d, showSwitcher: p = !0, onDeSelect: m } = e, [g, _] = h(e, {
198
+ defaultValuePropName: "defaultSelectedKeys",
199
+ valuePropName: "selectedKeys",
200
+ defaultValue: [],
201
+ trigger: "__DO_NOT_CALLED__"
202
+ }), [v, y] = h(e, {
203
+ valuePropName: "expandedKeys",
204
+ defaultValuePropName: "defaultExpandedKeys",
205
+ defaultValue: (() => {
206
+ let n = /* @__PURE__ */ new Set();
207
+ return e.selectedKeys?.length ? (e.selectedKeys.forEach((e) => {
208
+ let i = T(t, e, r);
209
+ i && i.length > 1 && i.slice(0, -1).forEach((e) => n.add(e));
210
+ }), [...n]) : [];
211
+ })(),
212
+ trigger: "onExpand"
213
+ });
214
+ f(() => {
215
+ if (!n) {
216
+ if (e.expandedKeys !== void 0 || g.length || d?.length || v.length) return;
217
+ y([]);
218
+ return;
219
+ }
220
+ let i = /* @__PURE__ */ new Set(), a = E(t, n, r);
221
+ if (a.length === 0) {
222
+ y([]);
223
+ return;
224
+ }
225
+ a.forEach((e) => e.slice(0, -1).forEach((e) => i.add(e))), i.size !== 0 && y([...i]);
226
+ }, [n]);
227
+ let b = u((e, t) => {
228
+ _((t) => l === "checkbox" ? [...new Set([...t, e])] : [e]), s && s?.(e, t);
229
+ }, [
230
+ s,
231
+ _,
232
+ l
233
+ ]), S = (e, t) => {
234
+ b(e, t);
235
+ }, D = u((e) => {
236
+ _((t) => t.filter((t) => t !== e)), m?.(e);
237
+ }, [_, m]), O = (e, t) => {
238
+ y(t ? [...v, e] : v.filter((t) => t !== e));
239
+ };
240
+ if (!t?.length) return null;
241
+ let k = t.some((e) => e[r.children]?.length > 0), A = {
242
+ searchValue: n,
243
+ selectedKeys: g,
244
+ expandedKeys: v,
245
+ onSelect: S,
246
+ onDeSelect: D,
247
+ onExpand: O,
248
+ icon: i,
249
+ switcherIcon: a,
250
+ checkType: l,
251
+ parentCheckable: c,
252
+ showSwitcher: p && k
253
+ };
254
+ return /* @__PURE__ */ o(x.Provider, {
255
+ value: A,
256
+ children: /* @__PURE__ */ o("div", {
257
+ className: `${w["bsy-tree"]} text-sm`,
258
+ children: t.map((e) => /* @__PURE__ */ o(C, {
259
+ node: e,
260
+ fieldNames: r
261
+ }, e[r.value]))
262
+ })
263
+ });
264
+ };
265
+ D.displayName = "BsyTree";
266
+ //#endregion
267
+ export { y as n, D as t };
@@ -1,6 +1,6 @@
1
1
  //#region src/version.ts
2
2
  if (typeof window < "u") {
3
3
  let e = window.__BSY_UI__ ??= {};
4
- e["@baishuyun/ui-base"] = "6.16.0";
4
+ e["@baishuyun/ui-base"] = "6.17.0";
5
5
  }
6
6
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baishuyun/ui-base",
3
- "version": "6.16.0",
3
+ "version": "6.17.0",
4
4
  "type": "module",
5
5
  "description": "百数云低代码平台通用组件库",
6
6
  "author": "bsy-fe team",
@@ -1,77 +0,0 @@
1
- import { n as e, t } from "./AmapContext-CJBe6lld.js";
2
- import { jsx as n } from "react/jsx-runtime";
3
- import { useContext as r, useEffect as i, useRef as a, useState as o } from "react";
4
- //#region src/components/Amap/Amap.tsx
5
- function s(s) {
6
- let { center: c, zoom: l, options: u = {}, className: d, style: f, children: p, onReady: m, onError: h } = s, { AMap: g, loading: _, error: v } = r(e), y = a(null), b = a(null), x = a({
7
- center: c,
8
- zoom: l,
9
- options: u,
10
- onReady: m,
11
- onError: h
12
- }), [S, C] = o(!1);
13
- x.current = {
14
- center: c,
15
- zoom: l,
16
- options: u,
17
- onReady: m,
18
- onError: h
19
- }, i(() => {
20
- if (!g || !y.current || b.current) return;
21
- let e = x.current, t = !1, n = new g.Map(y.current, {
22
- resizeEnable: !0,
23
- animateEnable: !1,
24
- zooms: [3, 20],
25
- ...e.options,
26
- ...e.center ? { center: e.center } : {},
27
- ...e.zoom !== null && e.zoom !== void 0 ? { zoom: e.zoom } : {}
28
- });
29
- b.current = n;
30
- let r = () => {
31
- t || (C(!0), x.current.onReady?.({
32
- AMap: g,
33
- map: n
34
- }));
35
- };
36
- try {
37
- n.on("complete", r);
38
- } catch (e) {
39
- x.current.onError?.(e);
40
- }
41
- return () => {
42
- t = !0;
43
- try {
44
- n.off?.("complete", r);
45
- } finally {
46
- n.destroy?.(), b.current = null, C(!1);
47
- }
48
- };
49
- }, [g]), i(() => {
50
- b.current && c && b.current.setCenter?.(c);
51
- }, [c]), i(() => {
52
- b.current && l != null && b.current.setZoom?.(l);
53
- }, [l]);
54
- let w = g && b.current ? {
55
- AMap: g,
56
- map: b.current,
57
- jsApiReady: !0,
58
- mapReady: S,
59
- loading: _,
60
- error: v
61
- } : null;
62
- return /* @__PURE__ */ n("div", {
63
- className: d,
64
- ref: y,
65
- style: {
66
- width: "100%",
67
- height: "100%",
68
- ...f
69
- },
70
- children: w && S ? /* @__PURE__ */ n(t.Provider, {
71
- value: w,
72
- children: p
73
- }) : null
74
- });
75
- }
76
- //#endregion
77
- export { s as t };
@@ -1,5 +0,0 @@
1
- import "../../vendors/version-CFii9VTt.js";
2
- import "../AmapContext-CJBe6lld.js";
3
- import "../hooks-BTcFpdd0.js";
4
- import { t as e } from "../AmapCircle-2qupysHe.js";
5
- export { e as AmapCircle, e as default };
@@ -1,55 +0,0 @@
1
- import { n as e } from "./hooks-BTcFpdd0.js";
2
- import { useEffect as t, useRef as n } from "react";
3
- //#region src/components/Amap/AmapCircle/AmapCircle.tsx
4
- function r(r) {
5
- let { AMap: i, map: a, mapReady: o } = e(), { center: s, radius: c, options: l = {}, visible: u = !0, onMouseEnter: d, onMouseLeave: f } = r, p = n(null), m = c > 0, h = n({
6
- center: s,
7
- radius: c,
8
- options: l
9
- });
10
- return h.current = {
11
- center: s,
12
- radius: c,
13
- options: l
14
- }, t(() => {
15
- if (!i || !a || !o || p.current || !m) return;
16
- let e = h.current, t = new i.Circle({
17
- ...e.options,
18
- center: e.center,
19
- radius: e.radius
20
- });
21
- return a.add(t), p.current = t, () => {
22
- t.setMap?.(null), p.current = null;
23
- };
24
- }, [
25
- i,
26
- m,
27
- a,
28
- o
29
- ]), t(() => {
30
- p.current?.setCenter(s);
31
- }, [s]), t(() => {
32
- c > 0 && p.current?.setRadius(c);
33
- }, [c]), t(() => {
34
- let e = p.current;
35
- e && (u ? e.show?.() : e.hide?.());
36
- }, [u]), t(() => {
37
- let e = p.current;
38
- if (!e) return;
39
- let t = () => ({
40
- circle: e,
41
- AMap: i,
42
- map: a
43
- }), n = () => d?.(t()), r = () => f?.(t());
44
- return e.on("mouseover", n), e.on("mouseout", r), () => {
45
- e.off("mouseover", n), e.off("mouseout", r);
46
- };
47
- }, [
48
- i,
49
- a,
50
- d,
51
- f
52
- ]), null;
53
- }
54
- //#endregion
55
- export { r as t };
@@ -1,11 +0,0 @@
1
- import { createContext as e } from "react";
2
- //#region src/components/Amap/context/AmapContext.ts
3
- var t = e({
4
- AMap: null,
5
- status: "idle",
6
- loading: !1,
7
- error: null,
8
- plugins: []
9
- }), n = e(null);
10
- //#endregion
11
- export { t as n, n as t };
@@ -1,6 +0,0 @@
1
- import "../../vendors/version-CFii9VTt.js";
2
- import "../AmapContext-CJBe6lld.js";
3
- import "../hooks-BTcFpdd0.js";
4
- import "../useMarkerInfoWindowController-Cjx0xQXw.js";
5
- import { t as e } from "../AmapMarker-xEqoVnFR.js";
6
- export { e as AmapMarker, e as default };
@@ -1,153 +0,0 @@
1
- import { n as e } from "./hooks-BTcFpdd0.js";
2
- import { n as t, t as n } from "./useMarkerInfoWindowController-Cjx0xQXw.js";
3
- import { Fragment as r, jsx as i } from "react/jsx-runtime";
4
- import { useCallback as a, useEffect as o, useRef as s } from "react";
5
- import { createRoot as c } from "react-dom/client";
6
- //#region src/components/Amap/AmapMarker/useMarkerInfoWindow.tsx
7
- var l = ({ AMap: e, map: t, mapReady: r, markerRef: i, infoWindow: s }) => {
8
- let { scheduleInfoWindowOpen: c, scheduleInfoWindowClose: l, closeInfoWindow: u } = n({
9
- AMap: e,
10
- map: t,
11
- mapReady: r
12
- }), d = a(() => {
13
- if (!s) return;
14
- let e = i.current;
15
- e && c(e, s);
16
- }, [
17
- s,
18
- i,
19
- c
20
- ]);
21
- return o(() => {
22
- if (s) return () => {
23
- u();
24
- };
25
- }, [u, s]), {
26
- scheduleInfoWindowOpen: d,
27
- scheduleInfoWindowClose: l,
28
- closeInfoWindow: u
29
- };
30
- }, u = (e) => typeof e == "string" || typeof e == "number", d = (e) => e != null && typeof e != "boolean", f = (e) => d(e) && !u(e), p = (e) => {
31
- queueMicrotask(() => e.unmount());
32
- };
33
- function m(n) {
34
- let { AMap: a, map: m, mapReady: h } = e(), { content: g, infoWindow: _, options: v = {}, onClick: y, onMouseEnter: b, onMouseLeave: x } = n, S = !!_, C = s(null), w = s(null), T = s(null), E = s(!0), D = s(!0), O = s({
35
- content: g,
36
- infoWindow: _,
37
- options: v
38
- });
39
- O.current = {
40
- content: g,
41
- infoWindow: _,
42
- options: v
43
- };
44
- let { scheduleInfoWindowOpen: k, scheduleInfoWindowClose: A, closeInfoWindow: j } = l({
45
- AMap: a,
46
- map: m,
47
- mapReady: h,
48
- markerRef: C,
49
- infoWindow: _
50
- });
51
- return o(() => {
52
- if (!a || !m || !h || C.current) return;
53
- let e = O.current, n = {
54
- anchor: t,
55
- ...e.options,
56
- map: m
57
- };
58
- if (u(e.content)) {
59
- let t = document.createElement("div");
60
- t.textContent = String(e.content), T.current = t, n.content = t;
61
- } else if (f(e.content)) {
62
- let e = document.createElement("div");
63
- T.current = e, n.content = e;
64
- }
65
- let o = new a.Marker(n);
66
- if (C.current = o, f(e.content) && T.current) {
67
- let t = c(T.current);
68
- w.current = t, t.render(/* @__PURE__ */ i(r, { children: e.content }));
69
- }
70
- return () => {
71
- let e = w.current;
72
- e && p(e), w.current = null, T.current = null, j(), o.setMap(null), C.current = null;
73
- };
74
- }, [
75
- a,
76
- j,
77
- m,
78
- h
79
- ]), o(() => {
80
- let e = v.position;
81
- if (!e) return;
82
- let t = C.current?.getPosition?.(), n = t?.getLng?.() ?? t?.lng, r = t?.getLat?.() ?? t?.lat, i = Array.isArray(e) ? e[0] : e.lng, a = Array.isArray(e) ? e[1] : e.lat;
83
- n === i && r === a || C.current?.setPosition(e);
84
- }, [v.position]), o(() => {
85
- if (D.current) {
86
- D.current = !1;
87
- return;
88
- }
89
- let e = C.current;
90
- e && (v.visible === !1 ? e.hide?.() : v.visible === !0 && e.show?.());
91
- }, [v.visible]), o(() => {
92
- if (E.current) {
93
- E.current = !1;
94
- return;
95
- }
96
- let e = C.current;
97
- if (e) {
98
- if (!d(g)) {
99
- w.current && p(w.current), w.current = null, T.current = null, e.setContent?.("");
100
- return;
101
- }
102
- if (u(g)) {
103
- if (w.current) {
104
- let t = w.current;
105
- p(t), w.current = null, T.current = document.createElement("div"), e.setContent?.(T.current);
106
- }
107
- T.current || (T.current = document.createElement("div"), e.setContent?.(T.current)), T.current.textContent = String(g);
108
- return;
109
- }
110
- T.current || (T.current = document.createElement("div"), e.setContent?.(T.current)), w.current ||= c(T.current), w.current.render(/* @__PURE__ */ i(r, { children: g }));
111
- }
112
- }, [g]), o(() => {
113
- let e = C.current;
114
- if (!e) return;
115
- let t = () => ({
116
- marker: e,
117
- AMap: a,
118
- map: m
119
- }), n = [];
120
- if (y) {
121
- let r = () => {
122
- y?.(t());
123
- };
124
- e.on("click", r), n.push(() => e.off("click", r));
125
- }
126
- if (b || S) {
127
- let r = () => {
128
- S && k(), b?.(t());
129
- };
130
- e.on("mouseover", r), n.push(() => e.off("mouseover", r));
131
- }
132
- if (x || S) {
133
- let r = () => {
134
- S && A(), x?.(t());
135
- };
136
- e.on("mouseout", r), n.push(() => e.off("mouseout", r));
137
- }
138
- return () => {
139
- n.forEach((e) => e());
140
- };
141
- }, [
142
- a,
143
- S,
144
- m,
145
- y,
146
- b,
147
- x,
148
- A,
149
- k
150
- ]), null;
151
- }
152
- //#endregion
153
- export { m as t };
@@ -1,6 +0,0 @@
1
- import "../../vendors/version-CFii9VTt.js";
2
- import "../AmapContext-CJBe6lld.js";
3
- import "../hooks-BTcFpdd0.js";
4
- import "../useMarkerInfoWindowController-Cjx0xQXw.js";
5
- import { t as e } from "../AmapMarkerCluster-CvEQa3o9.js";
6
- export { e as AmapMarkerCluster, e as default };