@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
@@ -1,240 +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 { useCallback as r, useEffect as i, useMemo as a, useRef as o } from "react";
4
- //#region src/components/Amap/AmapMarkerCluster/utils.ts
5
- var s = "[ui-base] AmapMarkerCluster requires AMap.MarkerCluster plugin. Please add \"AMap.MarkerCluster\" to AmapProvider plugins.", c = {}, l = /* @__PURE__ */ new WeakMap(), u = 0, d = (e) => Array.isArray(e) && e.length === 2 && Number.isFinite(e[0]) && Number.isFinite(e[1]), f = (e) => Array.isArray(e) ? e : [], p = (e) => e?.extData, m = (e) => {
6
- let t = { ...e };
7
- return delete t.renderMarker, delete t.renderClusterMarker, t;
8
- }, h = (e) => l.get(e) || (u += 1, l.set(e, u), u), g = (e) => e === void 0 ? "empty" : typeof e == "string" ? `string:${e}` : `element:${h(e)}`, _ = (e) => e.map((e) => [
9
- e.key,
10
- h(e.marker),
11
- g(e.content)
12
- ].join(":")).join("|"), v = (e) => e.map((e) => e.key).join("|"), y = () => "\n <div\n class=\"bsy-amap-marker-cluster__marker\"\n style=\"width: 16px; height: 16px; border-radius: 50%; background: #1677ff; border: 3px solid #ffffff; box-shadow: 0 2px 8px rgba(22, 119, 255, 0.35); box-sizing: border-box;\"\n ></div>\n", b = (e) => `
13
- <div
14
- class="bsy-amap-marker-cluster__cluster"
15
- style="display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 10px 10px 10px 4px; border-radius: 100px; background: #ffffff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.06); white-space: nowrap; box-sizing: border-box;"
16
- >
17
- <svg
18
- xmlns="http://www.w3.org/2000/svg"
19
- class="bsy-amap-marker-cluster__cluster-icon"
20
- data-testid="map-cluster-marker-icon"
21
- aria-hidden="true"
22
- width="22"
23
- height="22"
24
- viewBox="0 0 22 22"
25
- fill="none"
26
- style="flex: none; width: 22px; height: 22px;"
27
- >
28
- <path d="M11 20.1693C9.85417 20.1693 2.75 14.6422 2.75 10.0859C2.75 5.52965 6.44371 1.83594 11 1.83594C15.5563 1.83594 19.25 5.52965 19.25 10.0859C19.25 14.6422 12.1458 20.1693 11 20.1693ZM11 12.6068C12.3922 12.6068 13.5208 11.4781 13.5208 10.0859C13.5208 8.69375 12.3922 7.5651 11 7.5651C9.60781 7.5651 8.47917 8.69375 8.47917 10.0859C8.47917 11.4781 9.60781 12.6068 11 12.6068Z" fill="#0265ff"/>
29
- </svg>
30
- <span
31
- class="bsy-amap-marker-cluster__cluster-count"
32
- style="color: #121111; font-family: Arial, sans-serif; font-size: 18px; font-weight: 700; line-height: 1.4;"
33
- >${e}</span>
34
- </div>
35
- `, x = (e, t, n = g(t)) => {
36
- t === void 0 || e.__bsyAmapMarkerClusterContentSignature === n || (e.setContent?.(t), e.__bsyAmapMarkerClusterContentSignature = n);
37
- }, S = (e) => {
38
- e.setAnchor?.(t);
39
- }, C = (e, t, n) => {
40
- let r = n ?? [0, 0];
41
- if (Array.isArray(r) && typeof e.Pixel == "function") {
42
- t.setOffset?.(new e.Pixel(r[0], r[1]));
43
- return;
44
- }
45
- t.setOffset?.(r);
46
- }, w = (e) => {
47
- let t = e.__bsyAmapMarkerClusterRuntime;
48
- if (!t) return;
49
- let { handleClick: n, handleMouseEnter: r, handleMouseLeave: i, key: a } = t;
50
- return n && e.off?.("click", n), r && e.off?.("mouseover", r), i && e.off?.("mouseout", i), e.__bsyAmapMarkerClusterRuntime = null, a;
51
- };
52
- //#endregion
53
- //#region src/components/Amap/AmapMarkerCluster/AmapMarkerCluster.tsx
54
- function T(t) {
55
- let { AMap: l, map: u, mapReady: h } = e(), { data: T, getKey: E, getPosition: D, renderMarker: O, renderCluster: k, clusterOptions: A = c, markerOffset: j, onError: M } = t, { scheduleInfoWindowOpen: N, scheduleInfoWindowClose: P, closeInfoWindow: F } = n({
56
- AMap: l,
57
- map: u,
58
- mapReady: h
59
- }), I = o(null), L = o(/* @__PURE__ */ new Set()), R = o(/* @__PURE__ */ new Map()), z = o(null), B = o(""), V = o(""), H = o(t), U = o([]), W = o(!0);
60
- H.current = t, i(() => {
61
- t.markerInfoWindow || F();
62
- }, [F, t.markerInfoWindow]);
63
- let G = a(() => {
64
- let e = [];
65
- return T.forEach((t, n) => {
66
- let r = D(t);
67
- d(r) && e.push({
68
- lnglat: r,
69
- extData: {
70
- item: t,
71
- index: n,
72
- key: E(t)
73
- }
74
- });
75
- }), { validItems: e };
76
- }, [
77
- T,
78
- E,
79
- D
80
- ]);
81
- U.current = G.validItems;
82
- let K = r((e) => {
83
- let t = H.current, n = v(e), r = _(e);
84
- n !== B.current && (B.current = n, t.onVisibleItemsChange?.(e.map((e) => e.item))), r !== V.current && (V.current = r, t.onMarkerRuntimeChange?.(e));
85
- }, []), q = r(() => {
86
- B.current = "", V.current = "";
87
- let e = H.current;
88
- e.onVisibleItemsChange?.([]), e.onMarkerRuntimeChange?.([]);
89
- }, []), J = r(() => {
90
- !H.current.onVisibleItemsChange && !H.current.onMarkerRuntimeChange || (z.current && clearTimeout(z.current), z.current = setTimeout(() => {
91
- z.current = null, K(Array.from(R.current.values()));
92
- }, 0));
93
- }, [K]), Y = r(() => {
94
- R.current.clear(), J();
95
- }, [J]);
96
- return i(() => {
97
- if (!l || !u || !h) return;
98
- let e = l.MarkerCluster || l.MarkerClusterer, t = R.current;
99
- if (!e) {
100
- M?.(Error(s));
101
- return;
102
- }
103
- let n = () => {
104
- L.current.forEach((e) => w(e)), L.current.clear(), F();
105
- }, r = (e) => {
106
- let n = w(e);
107
- n && (t.delete(n), J(), F());
108
- }, i = (e, t) => {
109
- let n = e, r = p(t);
110
- if (!r) return;
111
- let i = () => ({
112
- item: r.item,
113
- marker: e,
114
- AMap: l,
115
- map: u
116
- });
117
- if (H.current.onMarkerMouseEnter || H.current.markerInfoWindow) {
118
- let t = () => {
119
- let t = H.current, n = t.markerInfoWindow?.({
120
- item: r.item,
121
- index: r.index
122
- });
123
- n && N(e, n), t.onMarkerMouseEnter?.(i());
124
- };
125
- e.on?.("mouseover", t), n.__bsyAmapMarkerClusterRuntime = {
126
- ...n.__bsyAmapMarkerClusterRuntime,
127
- handleMouseEnter: t
128
- };
129
- }
130
- if (H.current.onMarkerMouseLeave || H.current.markerInfoWindow) {
131
- let t = () => {
132
- let e = H.current;
133
- e.markerInfoWindow && P(), e.onMarkerMouseLeave?.(i());
134
- };
135
- e.on?.("mouseout", t), n.__bsyAmapMarkerClusterRuntime = {
136
- ...n.__bsyAmapMarkerClusterRuntime,
137
- handleMouseLeave: t
138
- };
139
- }
140
- }, a = (e) => {
141
- let t = H.current;
142
- if (t.autoFitOnClusterClick === !1 || e.length === 0) return;
143
- let n = e.map((e) => t.getPosition(e)).filter(d);
144
- if (n.length === 1) {
145
- u.setZoomAndCenter?.(t.fitOptions?.singlePointZoom ?? u.getZoom?.() ?? 16, n[0]);
146
- return;
147
- }
148
- let r = n.map((e) => new l.Marker({ position: e }));
149
- u.setFitView?.(r, !1, t.fitOptions?.padding, t.fitOptions?.maxZoom), r.forEach((e) => e.setMap?.(null));
150
- }, o = m(A);
151
- o.renderMarker = (e) => {
152
- let n = f(e.data)[0], a = H.current;
153
- if (e.marker) {
154
- let o = e.marker;
155
- if (r(o), L.current.add(o), o.__bsyAmapMarkerClusterRuntime = {}, i(e.marker, n), n) {
156
- let r = a.renderMarker ? a.renderMarker({
157
- item: n.extData.item,
158
- index: n.extData.index
159
- }) : y(), i = a.renderMarker ? g(r) : "default-marker";
160
- S(o), x(o, r, i), C(l, o, a.markerOffset), o.__bsyAmapMarkerClusterRuntime = {
161
- ...o.__bsyAmapMarkerClusterRuntime,
162
- key: n.extData.key
163
- }, t.set(n.extData.key, {
164
- item: n.extData.item,
165
- index: n.extData.index,
166
- key: n.extData.key,
167
- marker: e.marker,
168
- content: r
169
- }), J();
170
- }
171
- }
172
- }, o.renderClusterMarker = (e) => {
173
- let t = H.current, n = f(e.data).map((e) => e.extData?.item).filter(Boolean);
174
- if (e.marker) {
175
- let i = e.marker;
176
- r(i), L.current.add(i), i.__bsyAmapMarkerClusterRuntime = {};
177
- let a = e.count ?? n.length, o = t.renderCluster ? t.renderCluster({
178
- count: a,
179
- items: n
180
- }) : b(a), s = t.renderCluster ? g(o) : `default-cluster:${a}`;
181
- S(i), x(i, o, s);
182
- }
183
- };
184
- let c = new e(u, U.current, o);
185
- I.current = c, W.current = !0;
186
- let _ = (e) => {
187
- let t = e?.marker || e?.target, n = f(e?.clusterData || e?.data).map((e) => e.extData?.item).filter(Boolean);
188
- if (!t || n.length === 0) return;
189
- if (n.length === 1) {
190
- H.current.onMarkerClick?.({
191
- item: n[0],
192
- marker: t,
193
- AMap: l,
194
- map: u
195
- });
196
- return;
197
- }
198
- a(n);
199
- let r = {
200
- items: n,
201
- marker: t,
202
- AMap: l,
203
- map: u
204
- };
205
- H.current.onClusterClick?.(r);
206
- };
207
- return c.on?.("click", _), () => {
208
- z.current &&= (clearTimeout(z.current), null), c.off?.("click", _), n(), t.clear(), q(), c.clearMarkers?.(), c.setMap?.(null), I.current = null;
209
- };
210
- }, [
211
- l,
212
- A,
213
- F,
214
- K,
215
- u,
216
- h,
217
- M,
218
- J,
219
- q,
220
- P,
221
- N
222
- ]), i(() => {
223
- if (I.current) {
224
- if (W.current) {
225
- W.current = !1;
226
- return;
227
- }
228
- L.current.forEach((e) => w(e)), L.current.clear(), F(), Y(), I.current.setData?.(G.validItems);
229
- }
230
- }, [
231
- Y,
232
- F,
233
- j,
234
- G.validItems,
235
- k,
236
- O
237
- ]), null;
238
- }
239
- //#endregion
240
- export { T as t };
@@ -1,7 +0,0 @@
1
- import "../../vendors/version-CFii9VTt.js";
2
- import "../../vendors/LocaleContext-DXQoOKM2.js";
3
- import "../../vendors/ConfigProvider-gZYvcwIQ.js";
4
- import "../../Overlay/OverlayContext-CVSFoyqN.js";
5
- import "../AmapContext-CJBe6lld.js";
6
- import { t as e } from "../AmapProvider-B-R2DrkJ.js";
7
- export { e as AmapProvider, e as default };
@@ -1,107 +0,0 @@
1
- import { n as e } from "../vendors/ConfigProvider-gZYvcwIQ.js";
2
- import { n as t } from "./AmapContext-CJBe6lld.js";
3
- import { Fragment as n, jsx as r } from "react/jsx-runtime";
4
- import { useEffect as i, useState as a } from "react";
5
- //#region src/components/Amap/loader.ts
6
- var o = "2.0", s = "[ui-base] AMap has already been loaded with a different key, version, or securityJsCode.", c = null, l = null, u = null, d = /* @__PURE__ */ new Map(), f = (e = []) => Array.from(new Set(e.filter(Boolean))), p = (e) => e || void 0, m = (e) => {
7
- if (l && (l.key !== e.key || l.version !== e.version || p(l.securityJsCode) !== p(e.securityJsCode))) throw Error(s);
8
- }, h = (e) => {
9
- f(e).forEach((e) => {
10
- d.set(e, { status: "loaded" });
11
- });
12
- }, g = async (e, t) => {
13
- let n = f(t).filter((e) => d.get(e)?.status !== "loaded");
14
- await Promise.all(n.map((t) => {
15
- let n = d.get(t);
16
- if (n?.status === "loading" && n.promise) return n.promise;
17
- let r = new Promise((n, r) => {
18
- try {
19
- e.plugin([t], () => {
20
- d.set(t, { status: "loaded" }), n();
21
- });
22
- } catch (e) {
23
- d.set(t, { status: "failed" }), r(e);
24
- }
25
- });
26
- return d.set(t, {
27
- status: "loading",
28
- promise: r
29
- }), r;
30
- }));
31
- }, _ = async (e) => {
32
- let t = e.version || o, n = f(e.plugins), r = {
33
- key: e.key,
34
- securityJsCode: p(e.securityJsCode),
35
- version: t
36
- };
37
- if (!e.key) throw Error("[ui-base] AMap key is required.");
38
- if (typeof window > "u") throw Error("[ui-base] AMap can only be loaded in the browser.");
39
- if (window.AMap || (u = null, l = null, c = null, d.clear()), m(r), r.securityJsCode && (window._AMapSecurityConfig = { securityJsCode: r.securityJsCode }), u || window.AMap) {
40
- let e = u || window.AMap;
41
- return u = e, l = r, await g(e, n), e;
42
- }
43
- c ||= import("@amap/amap-jsapi-loader").then((r) => (r.default ?? r).load({
44
- key: e.key,
45
- version: t,
46
- plugins: n
47
- })).then((e) => (u = e, l = r, window.AMap = e, h(n), e)).catch((e) => {
48
- throw c = null, u = null, l = null, d.clear(), e;
49
- });
50
- let i = await c;
51
- return await g(i, n), i;
52
- }, v = (e = []) => Array.from(new Set(e.filter(Boolean))), y = [], b = "", x = (e, t) => typeof e == "function" ? e(t) : e ?? null, S = (e) => e ? v(e.split(b)) : y;
53
- function C(o) {
54
- let s = e(), { amapKey: c, securityJsCode: l, version: u, plugins: d = y, fallback: f = null, errorFallback: p = null, children: m } = o, h = s.amap, g = [...h?.plugins || y, ...d].filter(Boolean).join(b), [v, C] = a({
55
- AMap: null,
56
- status: "idle",
57
- loading: !1,
58
- error: null,
59
- plugins: S(g)
60
- });
61
- return i(() => {
62
- let e = !1, t = S(g);
63
- return C({
64
- AMap: null,
65
- status: "loading",
66
- loading: !0,
67
- error: null,
68
- plugins: t
69
- }), _({
70
- key: c || h?.key || "",
71
- securityJsCode: l ?? h?.securityJsCode,
72
- version: u || h?.version,
73
- plugins: t
74
- }).then((n) => {
75
- e || C({
76
- AMap: n,
77
- status: "success",
78
- loading: !1,
79
- error: null,
80
- plugins: t
81
- });
82
- }).catch((n) => {
83
- e || C({
84
- AMap: null,
85
- status: "error",
86
- loading: !1,
87
- error: n,
88
- plugins: t
89
- });
90
- }), () => {
91
- e = !0;
92
- };
93
- }, [
94
- h?.key,
95
- h?.securityJsCode,
96
- h?.version,
97
- c,
98
- g,
99
- l,
100
- u
101
- ]), v.loading ? /* @__PURE__ */ r(n, { children: f }) : v.error ? /* @__PURE__ */ r(n, { children: x(p, v.error) }) : v.status === "success" ? /* @__PURE__ */ r(t.Provider, {
102
- value: v,
103
- children: m
104
- }) : null;
105
- }
106
- //#endregion
107
- export { C as t };
@@ -1,4 +0,0 @@
1
- import "../../vendors/version-CFii9VTt.js";
2
- import "../AmapContext-CJBe6lld.js";
3
- import { n as e, t } from "../hooks-BTcFpdd0.js";
4
- export { e as useAmap, t as useCurrentLocation };
@@ -1,121 +0,0 @@
1
- import { n as e, t } from "./AmapContext-CJBe6lld.js";
2
- import { useCallback as n, useContext as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
3
- //#region src/components/Amap/hooks/useAmap.ts
4
- var c = () => {
5
- let e = r(t);
6
- if (!e) throw Error("[ui-base] useAmap must be used within Amap.");
7
- return e;
8
- }, l = (e) => !Array.isArray(e) || e.length !== 2 ? !1 : Number.isFinite(Number(e[0])) && Number.isFinite(Number(e[1])), u = (e, t) => {
9
- let n = [Number(e), Number(t)];
10
- return l(n) ? n : null;
11
- }, d = (e, t) => {
12
- let n = t?.info ? String(t.info).toLowerCase() : "";
13
- return e === "complete" || n === "ok";
14
- }, f = (e, t, n) => new Promise((r, i) => {
15
- let a = window.setTimeout(() => {
16
- i(Error(n));
17
- }, t);
18
- e.then((e) => {
19
- window.clearTimeout(a), r(e);
20
- }).catch((e) => {
21
- window.clearTimeout(a), i(e);
22
- });
23
- }), p = (e) => new Promise((t, n) => {
24
- if (!navigator.geolocation?.getCurrentPosition) {
25
- n(/* @__PURE__ */ Error("[ui-base] Browser geolocation is unavailable."));
26
- return;
27
- }
28
- navigator.geolocation.getCurrentPosition(t, n, {
29
- enableHighAccuracy: !1,
30
- timeout: e,
31
- maximumAge: 0
32
- });
33
- }), m = (e, t, n) => f(new Promise((n, r) => {
34
- if (!e?.convertFrom) {
35
- r(/* @__PURE__ */ Error("[ui-base] AMap.convertFrom is unavailable."));
36
- return;
37
- }
38
- e.convertFrom(t, "gps", (e, t) => {
39
- if (!d(e, t)) {
40
- r(/* @__PURE__ */ Error("[ui-base] Failed to convert browser geolocation."));
41
- return;
42
- }
43
- let i = t?.locations?.[0], a = u(i?.lng, i?.lat);
44
- if (!a) {
45
- r(/* @__PURE__ */ Error("[ui-base] Converted geolocation is invalid."));
46
- return;
47
- }
48
- n(a);
49
- });
50
- }), n, "[ui-base] AMap.convertFrom timed out."), h = (e, t) => f(new Promise((t, n) => {
51
- if (typeof e?.Geolocation != "function" || typeof e?.DistrictSearch != "function") {
52
- n(/* @__PURE__ */ Error("[ui-base] AMap city location plugins are unavailable."));
53
- return;
54
- }
55
- let { Geolocation: r, DistrictSearch: i } = e;
56
- new r().getCityInfo((e, r) => {
57
- if (!d(e, r) || !r?.adcode) {
58
- n(/* @__PURE__ */ Error("[ui-base] Failed to resolve current city."));
59
- return;
60
- }
61
- new i({
62
- subdistrict: 0,
63
- extensions: "base",
64
- level: "district"
65
- }).search(String(r.adcode), (e, r) => {
66
- if (!d(e, r)) {
67
- n(/* @__PURE__ */ Error("[ui-base] Failed to resolve current city center."));
68
- return;
69
- }
70
- let i = r?.districtList?.[0]?.center, a = u(i?.lng, i?.lat);
71
- if (!a) {
72
- n(/* @__PURE__ */ Error("[ui-base] Current city center is invalid."));
73
- return;
74
- }
75
- t(a);
76
- });
77
- });
78
- }), t, "[ui-base] AMap city location timed out."), g = [116.4074, 39.9042], _ = 3e3, v = (t = {}) => {
79
- let { AMap: c } = r(e), l = a(() => c, [c]), d = t.defaultLocation?.[0], f = t.defaultLocation?.[1], v = a(() => u(d, f) || g, [d, f]), y = t.fallbackToCity ?? !0, b = t.timeout ?? _, x = o(0), S = o(!0), [C, w] = s(v), [T, E] = s(!1), [D, O] = s(null);
80
- i(() => (S.current = !0, () => {
81
- S.current = !1;
82
- }), []), i(() => {
83
- w(v);
84
- }, [v]);
85
- let k = n(async () => {
86
- let e = x.current + 1;
87
- if (x.current = e, !l) {
88
- let e = /* @__PURE__ */ Error("[ui-base] AMap is unavailable.");
89
- return S.current && (E(!1), O(e), w(v)), v;
90
- }
91
- S.current && E(!0);
92
- let t = null, n = v;
93
- try {
94
- let e = await p(b), r = u(e.coords.longitude, e.coords.latitude);
95
- if (!r) throw Error("[ui-base] Browser geolocation is invalid.");
96
- n = await m(l, r, b), t = null;
97
- } catch (e) {
98
- if (t = e, y) try {
99
- n = await h(l, b), t = null;
100
- } catch (e) {
101
- t = e, n = v;
102
- }
103
- }
104
- return S.current && x.current === e && (w(n), O(t), E(!1)), n;
105
- }, [
106
- l,
107
- v,
108
- y,
109
- b
110
- ]);
111
- return i(() => {
112
- k();
113
- }, [k]), {
114
- location: C,
115
- loading: T,
116
- error: D,
117
- refresh: k
118
- };
119
- };
120
- //#endregion
121
- export { c as n, v as t };
@@ -1,94 +0,0 @@
1
- import { Fragment as e, jsx as t } from "react/jsx-runtime";
2
- import { useCallback as n, useEffect as r, useRef as i } from "react";
3
- import { createRoot as a } from "react-dom/client";
4
- import { flushSync as o } from "react-dom";
5
- //#region src/components/Amap/utils/constants.ts
6
- var s = "bottom-center", c = (e) => {
7
- queueMicrotask(() => e.unmount());
8
- }, l = "bottom-center", u = 250, d = (e, t) => Array.isArray(t) && typeof e.Pixel == "function" ? new e.Pixel(t[0], t[1]) : t, f = (e) => e.options?.offset !== void 0 && e.options?.offset !== null, p = ({ AMap: s, map: p, mapReady: m }) => {
9
- let h = i(null), g = i(null), _ = i(null), v = i(null), y = i(!1), b = i({
10
- openDelay: null,
11
- openFrame: null,
12
- closeDelay: null
13
- }), x = i(!1), S = n(() => {
14
- b.current.openDelay !== null && (window.clearTimeout(b.current.openDelay), b.current.openDelay = null), b.current.openFrame !== null && (window.cancelAnimationFrame(b.current.openFrame), b.current.openFrame = null);
15
- }, []), C = n(() => {
16
- b.current.closeDelay !== null && (window.clearTimeout(b.current.closeDelay), b.current.closeDelay = null);
17
- }, []), w = n(() => {
18
- S(), C(), v.current = null, x.current = !1, h.current?.close?.();
19
- }, [C, S]), T = n(() => {
20
- w(), _.current && (_.current.onmouseenter = null, _.current.onmouseleave = null), g.current && c(g.current), g.current = null, _.current = null, h.current = null, y.current = !1;
21
- }, [w]), E = n(() => {
22
- S(), C(), b.current.closeDelay = window.setTimeout(() => {
23
- b.current.closeDelay = null, !x.current && w();
24
- }, u);
25
- }, [
26
- C,
27
- S,
28
- w
29
- ]), D = n((e) => {
30
- if (!e || !s || !p || !m) return null;
31
- let t = f(e);
32
- if (y.current && !t && h.current && _.current && g.current && T(), h.current && _.current && g.current) return {
33
- infoWindow: h.current,
34
- contentElement: _.current,
35
- contentRoot: g.current
36
- };
37
- let n = document.createElement("div"), r = {
38
- ...e.options,
39
- autoMove: !1,
40
- isCustom: !0,
41
- anchor: l
42
- };
43
- t && (r.offset = d(s, e.options?.offset));
44
- let i = new s.InfoWindow(r), o = a(n);
45
- return n.onmouseenter = () => {
46
- x.current = !0, C();
47
- }, n.onmouseleave = () => {
48
- x.current = !1, E();
49
- }, h.current = i, _.current = n, g.current = o, y.current = t, {
50
- infoWindow: i,
51
- contentElement: n,
52
- contentRoot: o
53
- };
54
- }, [
55
- s,
56
- C,
57
- p,
58
- m,
59
- T,
60
- E
61
- ]), O = n((n, r) => {
62
- !n || !r || !s || !p || !m || (v.current = n, C(), S(), b.current.openDelay = window.setTimeout(() => {
63
- b.current.openDelay = null;
64
- let i = D(r);
65
- if (!i || v.current !== n) return;
66
- let { infoWindow: a, contentElement: c, contentRoot: u } = i, m = f(r);
67
- if (a.setAnchor?.(l), m) {
68
- let e = d(s, r.options?.offset);
69
- a.setOffset?.(e);
70
- }
71
- o(() => {
72
- u.render(/* @__PURE__ */ t(e, { children: r.content }));
73
- }), a.setContent?.(c), b.current.openFrame = window.requestAnimationFrame(() => {
74
- b.current.openFrame = null, v.current === n && a.open?.(p, n.getPosition?.());
75
- });
76
- }, u));
77
- }, [
78
- s,
79
- C,
80
- S,
81
- D,
82
- p,
83
- m
84
- ]);
85
- return r(() => () => {
86
- w(), _.current && (_.current.onmouseenter = null, _.current.onmouseleave = null), g.current && c(g.current), g.current = null, _.current = null, h.current = null, y.current = !1;
87
- }, [w]), {
88
- scheduleInfoWindowOpen: O,
89
- scheduleInfoWindowClose: E,
90
- closeInfoWindow: w
91
- };
92
- };
93
- //#endregion
94
- export { s as n, p as t };
@@ -1,53 +0,0 @@
1
- import { t as e } from "../Icon/Icon-DrdQOEJE.js";
2
- import { n as t } from "./context-CamSpkj3.js";
3
- import { p as n } from "./layout-CpOabFQ2.js";
4
- import { getTimeZoneLabel as r } from "./utils/index.js";
5
- import { n as i, t as a } from "./EventCard-DKEZQRTp.js";
6
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
- import { useMemo as c, useState as l } from "react";
8
- import u from "clsx";
9
- //#region src/components/Calendar/subcomponents/AllDaySection/AllDaySection.tsx
10
- var { COLLAPSED_COUNT: d, EXPANDED_COUNT: f, EVENT_HEIGHT: p, EVENT_GAP: m } = i, h = ({ events: i = [], onClick: h }) => {
11
- let g = t((e) => e.formatMessage), [_, v] = l(!1), y = t((e) => e.timeZone), b = i.length, x = b - d, S = b > d, C = _ && b > f, w = c(() => n(_ ? Math.min(b, f) : Math.min(b, d), p, m), [_, b]), T = c(() => r(y), [y]), E = () => {
12
- v((e) => !e);
13
- }, D = { "--max-height": `${w}px` };
14
- return /* @__PURE__ */ s("div", {
15
- className: "bsy-calendar-allday-section",
16
- children: [/* @__PURE__ */ o("div", {
17
- className: "bsy-calendar-allday-section__label",
18
- children: /* @__PURE__ */ o("div", {
19
- className: "bsy-calendar-allday-section__label-text",
20
- children: T
21
- })
22
- }), /* @__PURE__ */ s("div", {
23
- className: "bsy-calendar-allday-section__content",
24
- children: [/* @__PURE__ */ o("div", {
25
- className: u("bsy-calendar-allday-section__events", { "bsy-calendar-allday-section__events--scroll": C }),
26
- style: D,
27
- children: i.map((e, t) => /* @__PURE__ */ o(a, {
28
- event: e,
29
- eventIndex: e.sourceIndex ?? t,
30
- onClick: h,
31
- variant: "allDay"
32
- }, e.id))
33
- }), S ? /* @__PURE__ */ s("button", {
34
- type: "button",
35
- className: "bsy-calendar-allday-section__toggle-btn",
36
- onClick: E,
37
- "aria-label": _ ? g("collapse") : g("remainingCount", { count: x }),
38
- children: [/* @__PURE__ */ o("span", {
39
- className: "bsy-calendar-allday-section__toggle-icon",
40
- children: /* @__PURE__ */ o(e, {
41
- name: _ ? "arrow-up" : "arrow-down",
42
- size: 14
43
- })
44
- }), /* @__PURE__ */ o("span", {
45
- className: "bsy-calendar-allday-section__toggle-text",
46
- children: _ ? g("collapse") : g("remainingCount", { count: x })
47
- })]
48
- }) : null]
49
- })]
50
- });
51
- };
52
- //#endregion
53
- export { h as t };