@baishuyun/ui-base 6.10.0 → 6.11.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 (181) hide show
  1. package/dist/Amap/{Amap-BNnmSPnl.js → Amap-BLSziesG.js} +1 -1
  2. package/dist/Amap/AmapCircle/index.js +4 -4
  3. package/dist/Amap/{AmapCircle-BDW6pnNR.js → AmapCircle-2qupysHe.js} +1 -1
  4. package/dist/Amap/AmapMarker/index.js +5 -5
  5. package/dist/Amap/{AmapMarker-CdoPWdff.js → AmapMarker-xEqoVnFR.js} +2 -2
  6. package/dist/Amap/AmapMarkerCluster/index.js +5 -5
  7. package/dist/Amap/{AmapMarkerCluster-CSIxiVC5.js → AmapMarkerCluster-CvEQa3o9.js} +2 -2
  8. package/dist/Amap/AmapProvider/index.js +6 -5
  9. package/dist/Amap/{AmapProvider-Cwi6WOe0.js → AmapProvider-CvRHhN42.js} +2 -2
  10. package/dist/Amap/hooks/index.js +3 -3
  11. package/dist/Amap/{hooks-DAN31s_-.js → hooks-BTcFpdd0.js} +1 -1
  12. package/dist/Amap/index.js +12 -11
  13. package/dist/Calendar/{AllDaySection-DNsVyixx.js → AllDaySection-BqbcPQls.js} +3 -3
  14. package/dist/Calendar/{Calendar-DL2X3z_z.js → Calendar-BS0nzK4h.js} +12 -13
  15. package/dist/Calendar/{CurrentTimeIndicator-twXtFHIp.js → CurrentTimeIndicator-dRYot1Rk.js} +24 -18
  16. package/dist/Calendar/{EventCard-CvEnWcKd.js → EventCard-Di5UX4pB.js} +3 -4
  17. package/dist/Calendar/{TimeGrid-D62R57Bo.js → TimeGrid-CBpDFAM4.js} +1 -1
  18. package/dist/Calendar/context/index.js +2 -2
  19. package/dist/Calendar/index.js +21 -20
  20. package/dist/Calendar/subcomponents/AllDaySection/index.js +8 -7
  21. package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +6 -5
  22. package/dist/Calendar/subcomponents/EventCard/index.js +7 -6
  23. package/dist/Calendar/subcomponents/TimeAxis/index.js +4 -4
  24. package/dist/Calendar/subcomponents/TimeGrid/index.js +4 -3
  25. package/dist/Calendar/{theme-BRVmxhqD.js → theme-i60ueO92.js} +2 -2
  26. package/dist/Calendar/utils/index.js +4 -4
  27. package/dist/Calendar/utils/layout/index.js +3 -3
  28. package/dist/Calendar/utils/theme/index.js +2 -2
  29. package/dist/Card/index.js +2 -2
  30. package/dist/CheckBox/{CheckBox-CcM19LnP.js → CheckBox-nBm0u6zX.js} +1 -1
  31. package/dist/CheckBox/index.js +3 -3
  32. package/dist/ColorPicker/ColorPicker-DVwg07Gs.js +174 -0
  33. package/dist/ColorPicker/index.js +7 -6
  34. package/dist/ConfigProvider/index.js +4 -3
  35. package/dist/DatePicker/DatePicker-DNPnHLT2.js +101 -0
  36. package/dist/DatePicker/{DatePickerPanel-Bz3uvbYF.js → DatePickerPanel-TS6AxAH-.js} +5 -5
  37. package/dist/DatePicker/index.js +10 -9
  38. package/dist/DatePicker/style/index.js +2 -2
  39. package/dist/DatePicker/{style-BwmM26RP.js → style-UKXn1N_p.js} +1 -1
  40. package/dist/DropDown/DropDown-DWf5yf4l.js +178 -0
  41. package/dist/DropDown/index.js +11 -10
  42. package/dist/DropDown/style/index.js +2 -2
  43. package/dist/DropDown/{style-BSgosymi.js → style-LLDVPpPa.js} +1 -1
  44. package/dist/Editor/Buttons-BBioCubp.js +1148 -0
  45. package/dist/Editor/ToolbarPlugin/Buttons/index.js +17 -16
  46. package/dist/Editor/constants/index.js +3 -3
  47. package/dist/Editor/index.js +1015 -257
  48. package/dist/Gantt/GanttChart/index.js +18 -17
  49. package/dist/Gantt/{GanttChart-6gpw5vi6.js → GanttChart-BaEW7EDO.js} +8 -10
  50. package/dist/Gantt/GanttTable/index.js +11 -11
  51. package/dist/Gantt/{GanttTable-lVu-YUtt.js → GanttTable-CdXhMHF6.js} +5 -5
  52. package/dist/Gantt/GanttToolBar/index.js +14 -13
  53. package/dist/Gantt/{GanttToolBar-CarBWZg-.js → GanttToolBar-COwsYlMG.js} +3 -4
  54. package/dist/Gantt/{collapseKeys-_ShTXPKt.js → collapseKeys-B4SOVHjd.js} +2 -2
  55. package/dist/Gantt/index.js +26 -25
  56. package/dist/Gantt/{theme-CiMD9Y6i.js → theme-2LyXJRDe.js} +1 -1
  57. package/dist/Gantt/{timelineViewConfig-CLIpppp0.js → timelineViewConfig-9HArvbmb.js} +1 -1
  58. package/dist/Gantt/utils/index.js +6 -6
  59. package/dist/Gantt/utils/theme/index.js +2 -2
  60. package/dist/Icon/index.js +1 -1
  61. package/dist/InputTag/{InputTag-DxPO0DwD.js → InputTag-Jpm8H32L.js} +2 -2
  62. package/dist/InputTag/index.js +5 -5
  63. package/dist/Loading/{Loading-CVyzO5-s.js → Loading-CiRe7i2R.js} +1 -1
  64. package/dist/Loading/index.js +4 -4
  65. package/dist/Modal/Modal-Cb7Msq26.js +96 -0
  66. package/dist/Modal/index.js +3 -2
  67. package/dist/NotFoundContent/index.js +2 -2
  68. package/dist/Overlay/OverlayContext-CVSFoyqN.js +23 -0
  69. package/dist/Overlay/index.js +3 -0
  70. package/dist/Radio/index.js +2 -2
  71. package/dist/ScrollBar/{ScrollBar-CnwYQfXM.js → ScrollBar-N2pOLv-8.js} +1 -1
  72. package/dist/ScrollBar/index.js +2 -2
  73. package/dist/Segmented/{Segmented-Ck2ZmfF7.js → Segmented-BCQRrc65.js} +1 -1
  74. package/dist/Segmented/index.js +2 -2
  75. package/dist/Select/Select-BY5Rpo3f.js +753 -0
  76. package/dist/Select/{SelectInputSearch-CrGW_eVo.js → SelectInputSearch-i3egm8Wy.js} +1 -1
  77. package/dist/Select/index.js +14 -13
  78. package/dist/Table/{Table-CL-KfNY3.js → Table-CSPdFGYn.js} +5 -5
  79. package/dist/Table/hooks/index.js +2 -2
  80. package/dist/Table/{hooks-uCDY9dqx.js → hooks-BceUZQQm.js} +1 -1
  81. package/dist/Table/index.js +8 -8
  82. package/dist/Table/{processRowspan-nIGqGyHh.js → processRowspan-B0WELhG2.js} +1 -1
  83. package/dist/Table/style/index.js +2 -2
  84. package/dist/Table/{style-x9xfw6te.js → style-C4wp0IOM.js} +1 -1
  85. package/dist/Table/utils/index.js +2 -2
  86. package/dist/Tabs/Tabs-C0m3mt-j.js +413 -0
  87. package/dist/Tabs/index.js +6 -5
  88. package/dist/Tooltip/Tooltip-Bb3Jx-If.js +172 -0
  89. package/dist/Tooltip/index.js +3 -2
  90. package/dist/Tree/index.js +4 -4
  91. package/dist/Tree/utils/index.js +1 -1
  92. package/dist/components/ColorPicker/ColorPalettes.d.ts +2 -0
  93. package/dist/components/ColorPicker/ColorPicker.type.d.ts +1 -7
  94. package/dist/components/ConfigProvider/ConfigProvider.type.d.ts +2 -0
  95. package/dist/components/DatePicker/interface.d.ts +2 -0
  96. package/dist/components/Editor/ToolbarPlugin/Buttons/BulletListButton.d.ts +2 -0
  97. package/dist/components/Editor/ToolbarPlugin/Buttons/CodeButton.d.ts +2 -0
  98. package/dist/components/Editor/ToolbarPlugin/Buttons/CodeLanguageButton.d.ts +2 -0
  99. package/dist/components/Editor/ToolbarPlugin/Buttons/HeadingButton.d.ts +2 -0
  100. package/dist/components/Editor/ToolbarPlugin/Buttons/IndentButton.d.ts +2 -0
  101. package/dist/components/Editor/ToolbarPlugin/Buttons/NumberListButton.d.ts +2 -0
  102. package/dist/components/Editor/ToolbarPlugin/Buttons/OutdentButton.d.ts +2 -0
  103. package/dist/components/Editor/ToolbarPlugin/Buttons/RedoButton.d.ts +2 -0
  104. package/dist/components/Editor/ToolbarPlugin/Buttons/SourceButton.d.ts +2 -0
  105. package/dist/components/Editor/ToolbarPlugin/Buttons/StrikeThroughButton.d.ts +2 -0
  106. package/dist/components/Editor/ToolbarPlugin/Buttons/SubscriptButton.d.ts +2 -0
  107. package/dist/components/Editor/ToolbarPlugin/Buttons/SuperscriptButton.d.ts +2 -0
  108. package/dist/components/Editor/ToolbarPlugin/Buttons/TableButton.d.ts +2 -0
  109. package/dist/components/Editor/ToolbarPlugin/Buttons/UndoButton.d.ts +2 -0
  110. package/dist/components/Editor/ToolbarPlugin/Buttons/index.d.ts +13 -0
  111. package/dist/components/Editor/ToolbarPlugin/context/HistoryStateProvider.d.ts +8 -0
  112. package/dist/components/Editor/ToolbarPlugin/context/TextFormatsContext.d.ts +10 -1
  113. package/dist/components/Editor/ToolbarPlugin/icons/ToolbarIcon.d.ts +13 -0
  114. package/dist/components/Editor/constants/codeLanguages.d.ts +69 -0
  115. package/dist/components/Editor/constants/index.d.ts +3 -0
  116. package/dist/components/Editor/context/EditorContainerContext.d.ts +0 -1
  117. package/dist/components/Editor/context/SourceModeContext.d.ts +9 -0
  118. package/dist/components/Editor/htmlConfig.d.ts +2 -0
  119. package/dist/components/Editor/interface.d.ts +1 -1
  120. package/dist/components/Editor/plugins/CodeHighlightPlugin.d.ts +1 -0
  121. package/dist/components/Editor/plugins/HeadingPlugin.d.ts +3 -0
  122. package/dist/components/Editor/plugins/LinkColorPlugin.d.ts +2 -0
  123. package/dist/components/Editor/plugins/PasteStripImagePlugin.d.ts +1 -0
  124. package/dist/components/Editor/plugins/SourceModePlugin.d.ts +7 -0
  125. package/dist/components/Editor/plugins/TabIndentPlugin.d.ts +1 -0
  126. package/dist/components/Editor/plugins/TablePlugin.d.ts +1 -0
  127. package/dist/components/Editor/utils/codeHighlighter.d.ts +12 -0
  128. package/dist/components/Editor/utils/fillRootFromHtml.d.ts +2 -0
  129. package/dist/components/Editor/utils/formatEditorHtml.d.ts +1 -0
  130. package/dist/components/Editor/utils/formatTruncatedFilename.d.ts +4 -0
  131. package/dist/components/Editor/utils/isEmptyEditorHtml.d.ts +1 -0
  132. package/dist/components/Editor/utils/sanitizeEditorHtml.d.ts +1 -0
  133. package/dist/components/Editor/utils/stripImagesFromHtml.d.ts +1 -0
  134. package/dist/components/Editor/utils/stripInlineStyleProperty.d.ts +2 -0
  135. package/dist/components/Editor/utils/writeHtmlSource.d.ts +1 -0
  136. package/dist/components/Overlay/OverlayContext.d.ts +16 -0
  137. package/dist/components/Overlay/index.d.ts +2 -0
  138. package/dist/components/Tooltip/Tooltip.type.d.ts +1 -1
  139. package/dist/components/index.d.ts +2 -0
  140. package/dist/index.js +53 -51
  141. package/dist/locale/lang/en-US.json.d.ts +21 -2
  142. package/dist/locale/lang/zh-CN.json.d.ts +21 -2
  143. package/dist/locale/lang/zh-TW.json.d.ts +21 -2
  144. package/dist/style.css +1 -1
  145. package/dist/vendors/{ConfigProvider-DxrZpdIb.js → ConfigProvider-4xHyyeop.js} +84 -36
  146. package/dist/vendors/{LocaleContext-Dcw6C1LX.js → LocaleContext-I4PW9j4M.js} +21 -2
  147. package/dist/vendors/{Tree-D1s-eADo.js → Tree-B09frqQX.js} +3 -2
  148. package/dist/vendors/{useLocale-BKZX2_zw.js → useLocale-FGYsRWSe.js} +1 -1
  149. package/dist/vendors/{version-L-kG2La0.js → version-BxI5QM5W.js} +1 -1
  150. package/package.json +10 -1
  151. package/dist/ColorPicker/ColorPicker-D3JuQ7a7.js +0 -153
  152. package/dist/DatePicker/DatePicker-Dah_CjYG.js +0 -96
  153. package/dist/DropDown/DropDown-Daxr9BYf.js +0 -171
  154. package/dist/Editor/Buttons-DG_-Sg_C.js +0 -600
  155. package/dist/Modal/Modal-LiztSF7x.js +0 -92
  156. package/dist/Select/Select-CBI5PgeQ.js +0 -746
  157. package/dist/Tabs/Tabs-B1RsYb2W.js +0 -409
  158. package/dist/Tooltip/Tooltip-DWWWYn1a.js +0 -168
  159. /package/dist/Amap/{AmapContext-D7Njjm5a.js → AmapContext-CJBe6lld.js} +0 -0
  160. /package/dist/Amap/{useMarkerInfoWindowController-BQmhR0N7.js → useMarkerInfoWindowController-Cjx0xQXw.js} +0 -0
  161. /package/dist/Calendar/{TimeAxis-D7bgZDKs.js → TimeAxis-C9e2BdYs.js} +0 -0
  162. /package/dist/Calendar/{colorUtils-lXNjGoCk.js → colorUtils-CBLTsDX0.js} +0 -0
  163. /package/dist/Calendar/{context-CBJnz0IH.js → context-4tCN5X33.js} +0 -0
  164. /package/dist/Calendar/{layout-BglMom3m.js → layout-Dz-grtu9.js} +0 -0
  165. /package/dist/Card/{Card-CtKLNh3n.js → Card-Ds5Rpq--.js} +0 -0
  166. /package/dist/CheckBox/{CheckBox-Bb0UuX1Y.js → CheckBox-ByWSy9Yr.js} +0 -0
  167. /package/dist/DatePicker/{ensureDayjsPlugins-CVL-fnAl.js → ensureDayjsPlugins-Cn9Bkjkj.js} +0 -0
  168. /package/dist/DatePicker/{pickerLocale-BeMlfhKu.js → pickerLocale-BRnNjLcv.js} +0 -0
  169. /package/dist/Gantt/{GanttHighlightContext-grda5bhd.js → GanttHighlightContext-ChThr8ia.js} +0 -0
  170. /package/dist/Gantt/{columnResize-DV1tSBx_.js → columnResize-jG0Wy2PC.js} +0 -0
  171. /package/dist/Gantt/{constants-BObDP0h6.js → constants-LIz5jwed.js} +0 -0
  172. /package/dist/Gantt/{highlightTarget-DrP0_NrM.js → highlightTarget-BpkYTonb.js} +0 -0
  173. /package/dist/NotFoundContent/{NotFoundContent-J-TEnljc.js → NotFoundContent-BLmzWNBi.js} +0 -0
  174. /package/dist/Radio/{Radio-CBUZ7DB5.js → Radio-CX9cUqb7.js} +0 -0
  175. /package/dist/Table/{constants-CcwjDbe7.js → constants-kRpjsoet.js} +0 -0
  176. /package/dist/vendors/{animations-Mlw78WYo.js → animations-rwUbyoT0.js} +0 -0
  177. /package/dist/vendors/{cssVars-B8o94Yao.js → cssVars-l4-kP_14.js} +0 -0
  178. /package/dist/vendors/{mergeRefs-Bai1cIzv.js → mergeRefs-TiJ0xjUN.js} +0 -0
  179. /package/dist/vendors/{useFloatingOverlay-BApqkHSu.js → useFloatingOverlay-B3M9k8nj.js} +0 -0
  180. /package/dist/vendors/{useFloatingPortal-C8V67X0v.js → useFloatingPortal-CmVJbuRm.js} +0 -0
  181. /package/dist/vendors/{useLatchedPopupPortalRoot-hwf14FJ5.js → useLatchedPopupPortalRoot-4fVhqVT4.js} +0 -0
@@ -1,600 +0,0 @@
1
- import { t as e } from "../Icon/Icon-BBDcb-yw.js";
2
- import { t } from "../Modal/Modal-LiztSF7x.js";
3
- import { t as n } from "../ColorPicker/ColorPicker-D3JuQ7a7.js";
4
- import { t as r } from "../vendors/useLocale-BKZX2_zw.js";
5
- import { t as i } from "../CheckBox/CheckBox-CcM19LnP.js";
6
- import { t as a } from "../ScrollBar/ScrollBar-CnwYQfXM.js";
7
- import { t as o } from "../DropDown/DropDown-Daxr9BYf.js";
8
- import { FONT_SIZES as s } from "./constants/index.js";
9
- import { AlignCenterOutlined as c, AlignLeftOutlined as l, AlignRightOutlined as u } from "@ant-design/icons";
10
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
11
- import m, { createContext as h, forwardRef as g, useCallback as _, useContext as v, useEffect as y, useImperativeHandle as b, useMemo as x, useRef as S, useState as C } from "react";
12
- import { Button as w, Form as T, Input as E, message as D } from "antd";
13
- import O from "clsx";
14
- import { AnimatePresence as ee, motion as k } from "motion/react";
15
- import { $createParagraphNode as te, $createTextNode as A, $getRoot as ne, $getSelection as j, $isElementNode as re, $isRangeSelection as M, $isTextNode as N, $setSelection as P, FORMAT_ELEMENT_COMMAND as ie, FORMAT_TEXT_COMMAND as F, createCommand as ae } from "lexical";
16
- import { useLexicalComposerContext as I } from "@lexical/react/LexicalComposerContext";
17
- import { $patchStyleText as L } from "@lexical/selection";
18
- import { $createLinkNode as R, $toggleLink as oe, TOGGLE_LINK_COMMAND as se } from "@lexical/link";
19
- //#region src/components/Editor/ToolbarPlugin/context/TextFormatsContext.tsx
20
- var z = h(null), B = h({ iconSize: 14 }), ce = B.Provider, le = () => v(B), V = {
21
- "lexical-editor__toolbar-button": "_lexical-editor__toolbar-button_gbe3v_1",
22
- "lexical-editor__toolbar-button-active": "_lexical-editor__toolbar-button-active_gbe3v_12"
23
- }, H = (t) => {
24
- let { icon: n, tooltip: r, onClick: i, disabled: a = !1, active: o = !1, size: s } = t, { iconSize: c } = le(), l = s ?? c;
25
- return /* @__PURE__ */ f("button", {
26
- className: O(V["lexical-editor__toolbar-button"], { [V["lexical-editor__toolbar-button-active"]]: o }),
27
- type: "button",
28
- onClick: i,
29
- onMouseDown: (e) => e.preventDefault(),
30
- disabled: a,
31
- title: r,
32
- children: m.isValidElement(n) ? n : /* @__PURE__ */ f(e, {
33
- name: n,
34
- size: l
35
- })
36
- });
37
- }, U = () => {
38
- let e = v(z);
39
- if (!e) throw Error("useTextFormatsContext must be used within TextFormatsProvider");
40
- return e;
41
- }, ue = () => {
42
- let [e] = I(), t = U(), { t: n } = r(), i = t.bold;
43
- return /* @__PURE__ */ f(H, {
44
- icon: "bold",
45
- tooltip: n("editor.bold"),
46
- active: i,
47
- onClick: () => {
48
- e.dispatchCommand(F, "bold");
49
- }
50
- });
51
- }, W = () => {
52
- let [e] = I(), t = U(), { t: n } = r(), i = t.underline;
53
- return /* @__PURE__ */ f(H, {
54
- icon: "underline",
55
- tooltip: n("editor.underline"),
56
- active: i,
57
- onClick: () => {
58
- e.dispatchCommand(F, "underline");
59
- }
60
- });
61
- }, de = () => {
62
- let [e] = I(), t = U(), { t: n } = r(), i = t.italic;
63
- return /* @__PURE__ */ f(H, {
64
- icon: "italic",
65
- tooltip: n("editor.italic"),
66
- active: i,
67
- onClick: () => {
68
- e.dispatchCommand(F, "italic");
69
- }
70
- });
71
- }, G = h(null), K = () => {
72
- let e = v(G);
73
- if (!e) throw Error("useEditorContainer must be used within EditorContainerProvider");
74
- return e;
75
- }, fe = () => {
76
- let [e] = I(), { t } = r(), n = U(), { getPopupContainer: i } = K();
77
- return /* @__PURE__ */ f(o, {
78
- menus: x(() => s.map((e) => ({
79
- key: e.value,
80
- label: e.label
81
- })), []),
82
- onClick: _((t) => {
83
- let n = t.key;
84
- e.update(() => {
85
- let e = j();
86
- M(e) && L(e, { "font-size": n });
87
- });
88
- }, [e]),
89
- activeKey: [n.fontSize],
90
- showSearch: !1,
91
- getPopupContainer: i,
92
- style: {
93
- width: "60px",
94
- minWidth: "60px"
95
- },
96
- children: /* @__PURE__ */ f("div", {
97
- className: "dropdown__trigger inline-flex",
98
- children: /* @__PURE__ */ f(H, {
99
- icon: "fontsize",
100
- tooltip: t("editor.fontSize"),
101
- active: !1
102
- })
103
- })
104
- });
105
- }, pe = () => {
106
- let [e] = I(), t = U(), { t: i } = r(), { getPopupContainer: a } = K(), o = _((t) => {
107
- e.update(() => {
108
- let e = j();
109
- M(e) && L(e, { color: t });
110
- });
111
- }, [e]);
112
- return /* @__PURE__ */ f(n, {
113
- value: t.fontColor,
114
- onChange: o,
115
- placement: "bottom-start",
116
- presetColors: "basic",
117
- getPopupContainer: a,
118
- children: /* @__PURE__ */ f("div", {
119
- className: "trigger-picker inline-flex",
120
- children: /* @__PURE__ */ f(H, {
121
- icon: "fontcolor",
122
- tooltip: i("editor.fontColor"),
123
- onClick: () => {},
124
- active: !1
125
- })
126
- })
127
- });
128
- }, me = () => {
129
- let [e] = I(), t = U(), { t: i } = r(), { getPopupContainer: a } = K(), o = _((t) => {
130
- e.update(() => {
131
- let e = j();
132
- M(e) && L(e, { "background-color": t });
133
- });
134
- }, [e]);
135
- return /* @__PURE__ */ f(n, {
136
- value: t.backgroundColor,
137
- onChange: o,
138
- placement: "bottom-start",
139
- presetColors: "basic",
140
- getPopupContainer: a,
141
- children: /* @__PURE__ */ f("div", {
142
- className: "trigger-picker inline-flex",
143
- children: /* @__PURE__ */ f(H, {
144
- icon: "fill",
145
- tooltip: i("editor.fill"),
146
- onClick: () => {},
147
- active: !1
148
- })
149
- })
150
- });
151
- }, he = () => {
152
- let [e] = I(), { align: t } = U(), { t: n } = r(), { getPopupContainer: i } = K(), a = [
153
- {
154
- key: "left",
155
- label: n("leftAlign"),
156
- icon: /* @__PURE__ */ f(l, {})
157
- },
158
- {
159
- key: "center",
160
- label: n("editor.centerAlign"),
161
- icon: /* @__PURE__ */ f(c, {})
162
- },
163
- {
164
- key: "right",
165
- label: n("editor.rightAlign"),
166
- icon: /* @__PURE__ */ f(u, {})
167
- }
168
- ], s = _((t) => {
169
- e.dispatchCommand(ie, t);
170
- }, [e]), d = a.map((e) => ({
171
- key: e.key,
172
- label: /* @__PURE__ */ p("div", {
173
- className: "flex items-center gap-2",
174
- children: [e.icon, /* @__PURE__ */ f("span", { children: e.label })]
175
- })
176
- })), m = _((e) => {
177
- s(e.key);
178
- }, [s]), h = a.find((e) => e.key === t)?.icon || /* @__PURE__ */ f(l, {});
179
- return /* @__PURE__ */ f(o, {
180
- menus: d,
181
- onClick: m,
182
- showSearch: !1,
183
- activeKey: [t],
184
- getPopupContainer: i,
185
- style: {
186
- width: "110px",
187
- minWidth: "110px"
188
- },
189
- children: /* @__PURE__ */ f("div", {
190
- className: "trigger-dropdown inline-flex text-sm",
191
- children: /* @__PURE__ */ f(H, {
192
- icon: h,
193
- tooltip: n("editor.alignment"),
194
- onClick: () => {},
195
- active: !1
196
- })
197
- })
198
- });
199
- };
200
- //#endregion
201
- //#region src/components/Editor/ToolbarPlugin/Buttons/LinkButton.tsx
202
- function ge(e) {
203
- return e ? e.startsWith("@") ? "javascript:void(0);" : e.match(/^https?:\/\//) ? e : `http://${e}` : "";
204
- }
205
- var _e = () => {
206
- let [e] = I(), { link: n } = U(), { t: a } = r(), [o, s] = C(!1), [c, l] = C(""), [u, m] = C(""), [h, g] = C(!0), [v, y] = D.useMessage(), b = S(null), x = _((t) => {
207
- s(t), t || e.setEditable(!0);
208
- }, [e]), T = () => {
209
- if (!c) {
210
- v.warning(a("editor.linkAddressEmpty"));
211
- return;
212
- }
213
- let t = ge(c);
214
- e.setEditable(!0), e.update(() => {
215
- let e = h ? {
216
- target: "_blank",
217
- rel: "noopener noreferrer",
218
- title: c
219
- } : { title: c }, n = b.current;
220
- n !== null && P(n);
221
- let r = j();
222
- if (M(r)) {
223
- let n = u || c, i = r.getTextContent();
224
- if (!r.isCollapsed() && n === i) oe(t, e);
225
- else {
226
- let i = r.anchor.getNode(), a = N(i) ? i : null, o = r.style || r.getNodes().find(N)?.getStyle() || a?.getStyle() || "", s = r.format || a?.getFormat() || 0, c = R(t, e), l = A(n);
227
- l.setFormat(s), l.setStyle(o), c.append(l), r.insertNodes([c]);
228
- }
229
- } else {
230
- let n = R(t, e);
231
- n.append(A(u || c));
232
- let r = ne(), i = r.getLastChild();
233
- if (re(i) && i.isEmpty()) i.append(n);
234
- else {
235
- let e = te();
236
- e.append(n), r.append(e);
237
- }
238
- }
239
- }), b.current = null, l(""), m(""), x(!1);
240
- }, O = _(() => {
241
- let t = "";
242
- e.getEditorState().read(() => {
243
- let e = j();
244
- b.current = e ? e.clone() : null, M(e) && !e.isCollapsed() && (t = e.getTextContent());
245
- }), e.setEditable(!1), e.update(() => {
246
- P(null);
247
- }), window.getSelection()?.removeAllRanges(), e.getRootElement()?.blur(), n ? (l(n.link === "javascript:void(0);" ? "" : n.link ?? ""), m(n.linkText ?? "")) : (l(""), m(t)), s(!0);
248
- }, [n, e]);
249
- return /* @__PURE__ */ p(d, { children: [
250
- /* @__PURE__ */ f(H, {
251
- icon: "Insertlink",
252
- tooltip: a("link"),
253
- onClick: O,
254
- active: !!n?.link
255
- }),
256
- y,
257
- /* @__PURE__ */ f(t, {
258
- title: a("link"),
259
- open: o,
260
- onOpenChange: x,
261
- children: /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ p("div", {
262
- className: "px-[20px] pb-[60px] pt-[40px]",
263
- children: [/* @__PURE__ */ p("div", {
264
- className: "flex items-center relative",
265
- children: [
266
- /* @__PURE__ */ f("label", {
267
- className: "w-[80px] shrink-0",
268
- children: a("linkAddress")
269
- }),
270
- /* @__PURE__ */ f(E, {
271
- value: c,
272
- onChange: (e) => l(e.target.value),
273
- placeholder: a("editor.linkTip")
274
- }),
275
- /* @__PURE__ */ f("div", {
276
- className: "absolute bottom-[-30px] left-[80px]",
277
- children: /* @__PURE__ */ f("p", {
278
- className: "text-[#999]",
279
- children: a("editor.linkAliasTip")
280
- })
281
- })
282
- ]
283
- }), /* @__PURE__ */ p("div", {
284
- className: "flex items-center mt-[40px]",
285
- children: [/* @__PURE__ */ f("label", {
286
- className: "w-[80px] shrink-0",
287
- children: a("showContent")
288
- }), /* @__PURE__ */ f(E, {
289
- value: u,
290
- onChange: (e) => m(e.target.value)
291
- })]
292
- })]
293
- }), /* @__PURE__ */ p("div", {
294
- className: "py-[14px] px-[20px] flex justify-between items-center border-t-[1px] border-solid border-[#e0e0e0]",
295
- children: [/* @__PURE__ */ f("div", { children: /* @__PURE__ */ f(i, {
296
- checked: h,
297
- onChange: (e) => g(e),
298
- children: a("openInNewTab")
299
- }) }), /* @__PURE__ */ p("div", {
300
- className: "flex gap-[15px]",
301
- children: [/* @__PURE__ */ f(w, {
302
- onClick: () => x(!1),
303
- children: a("cancel")
304
- }), /* @__PURE__ */ f(w, {
305
- type: "primary",
306
- onClick: T,
307
- children: a("confirm")
308
- })]
309
- })]
310
- })] })
311
- })
312
- ] });
313
- }, ve = () => {
314
- let [e] = I(), { link: t } = U(), { t: n } = r();
315
- return /* @__PURE__ */ f(H, {
316
- icon: "cancellink",
317
- tooltip: n("cancelLink"),
318
- onClick: () => {
319
- t && e.dispatchCommand(se, null);
320
- }
321
- });
322
- }, q = {
323
- "picture-modal__container": "_picture-modal__container_dz4c0_1",
324
- "picture-modal__sidebar": "_picture-modal__sidebar_dz4c0_4",
325
- "picture-modal__menu-list": "_picture-modal__menu-list_dz4c0_8",
326
- "picture-modal__menu-item": "_picture-modal__menu-item_dz4c0_13",
327
- "picture-modal__menu-item--active": "_picture-modal__menu-item--active_dz4c0_22",
328
- "picture-modal__content": "_picture-modal__content_dz4c0_25",
329
- "picture-modal__content-body": "_picture-modal__content-body_dz4c0_31",
330
- "picture-modal__ops": "_picture-modal__ops_dz4c0_34",
331
- "picture-modal__content-title": "_picture-modal__content-title_dz4c0_42",
332
- "picture-modal__upload-area": "_picture-modal__upload-area_dz4c0_53",
333
- "picture-modal__upload-area--dragging": "_picture-modal__upload-area--dragging_dz4c0_69",
334
- "picture-modal__preview-list": "_picture-modal__preview-list_dz4c0_75",
335
- "picture-modal__preview": "_picture-modal__preview_dz4c0_75",
336
- "picture-modal__preview-image": "_picture-modal__preview-image_dz4c0_89",
337
- "picture-modal__preview-info": "_picture-modal__preview-info_dz4c0_102",
338
- "picture-modal__preview-filename": "_picture-modal__preview-filename_dz4c0_106",
339
- "picture-modal__preview-size": "_picture-modal__preview-size_dz4c0_112",
340
- "picture-modal__preview-delete": "_picture-modal__preview-delete_dz4c0_116",
341
- "picture-modal__upload-text": "_picture-modal__upload-text_dz4c0_124",
342
- "picture-modal__footer": "_picture-modal__footer_dz4c0_128"
343
- }, J = g((e, t) => {
344
- let [n] = T.useForm(), [i, a] = C(""), { t: o } = r(), s = (e) => /^https?:\/\/.+/i.test(e);
345
- return b(t, () => ({ getValue: async () => {
346
- try {
347
- return await n.validateFields(), i;
348
- } catch {
349
- throw Error("URL validation failed");
350
- }
351
- } })), /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", {
352
- className: q["picture-modal__content-title"],
353
- "data-title": o("editor.imageUrlNote"),
354
- children: o("editor.enterImageUrl")
355
- }), /* @__PURE__ */ f(T, {
356
- form: n,
357
- children: /* @__PURE__ */ f(T.Item, {
358
- name: "url",
359
- rules: [{
360
- required: !0,
361
- message: o("editor.pleaseEnterImageUrl")
362
- }, { validator: (e, t) => !t || s(t) ? Promise.resolve() : Promise.reject(Error(o("editor.pleaseEnterValidImageUrl"))) }],
363
- children: /* @__PURE__ */ f(E, {
364
- placeholder: o("editor.pleaseEnterImageUrl"),
365
- value: i,
366
- onChange: (e) => a(e.target.value)
367
- })
368
- })
369
- })] });
370
- });
371
- J.displayName = "LinkInput";
372
- //#endregion
373
- //#region src/components/Editor/ToolbarPlugin/Buttons/PictureButton/UploadImage.tsx
374
- var ye = (e) => new Promise((t, n) => {
375
- let r = new FileReader();
376
- r.onload = () => t(r.result), r.onerror = () => n(r.error), r.readAsDataURL(e);
377
- }), Y = g((t, n) => {
378
- let [i, a] = C(!1), [o, s] = C([]), c = S(o);
379
- c.current = o;
380
- let l = S(null), [u, d] = D.useMessage(), { t: m } = r(), h = (e) => (e / 1024).toFixed(1) + "kb", g = (e) => e.type.startsWith("image/") ? e.size > 1048576 ? (u.warning(m("editor.imageSizeNote")), !1) : !0 : (u.warning(m("editor.onlyImageFormatsSupported")), !1), _ = (e) => {
381
- let t = Array.from(e).filter(g).map((e) => ({
382
- id: `${e.name}-${e.size}-${e.lastModified}-${Math.random()}`,
383
- file: e,
384
- url: URL.createObjectURL(e)
385
- }));
386
- t.length && s((e) => [...e, ...t]);
387
- }, v = (e) => {
388
- s((t) => {
389
- let n = t.find((t) => t.id === e);
390
- return n && URL.revokeObjectURL(n.url), t.filter((t) => t.id !== e);
391
- });
392
- }, x = () => {
393
- l.current?.click();
394
- }, w = (e) => {
395
- e.target.files?.length && _(e.target.files), e.target.value = "";
396
- };
397
- return y(() => () => {
398
- c.current.forEach((e) => URL.revokeObjectURL(e.url));
399
- }, []), b(n, () => ({ getValue: async () => {
400
- if (!o.length) throw u.warning(m("editor.pleaseUploadImageFirst")), Error(m("editor.pleaseUploadImageFirst"));
401
- try {
402
- return await Promise.all(o.map(async (e) => ({
403
- src: await ye(e.file),
404
- fileName: e.file.name
405
- })));
406
- } catch {
407
- throw Error(m("editor.operationFailed"));
408
- }
409
- } }), [
410
- o,
411
- u,
412
- m
413
- ]), /* @__PURE__ */ p("div", {
414
- onDragOver: (e) => {
415
- e.preventDefault(), a(!0);
416
- },
417
- onDragLeave: (e) => {
418
- e.preventDefault(), a(!1);
419
- },
420
- onDrop: (e) => {
421
- e.preventDefault(), a(!1), e.dataTransfer.files.length && _(e.dataTransfer.files);
422
- },
423
- children: [
424
- /* @__PURE__ */ p("div", {
425
- className: q["picture-modal__ops"],
426
- children: [/* @__PURE__ */ f("div", {
427
- className: q["picture-modal__content-title"],
428
- "data-title": m("editor.imageSizeNote"),
429
- children: m("editor.uploadImage")
430
- }), /* @__PURE__ */ p("div", {
431
- className: `${q["picture-modal__upload-area"]} ${i ? q["picture-modal__upload-area--dragging"] : ""}`,
432
- onClick: x,
433
- children: [/* @__PURE__ */ f(e, { name: "upload" }), /* @__PURE__ */ f("span", {
434
- className: q["picture-modal__upload-text"],
435
- children: m("editor.clickOrDragToUpload")
436
- })]
437
- })]
438
- }),
439
- o.length > 0 ? /* @__PURE__ */ f("div", {
440
- className: q["picture-modal__preview-list"],
441
- children: /* @__PURE__ */ f(ee, { children: o.map((t) => /* @__PURE__ */ p(k.div, {
442
- className: q["picture-modal__preview"],
443
- initial: {
444
- opacity: 0,
445
- y: 12
446
- },
447
- animate: {
448
- opacity: 1,
449
- y: 0
450
- },
451
- exit: {
452
- opacity: 0,
453
- y: -8
454
- },
455
- transition: {
456
- duration: .2,
457
- ease: [
458
- .4,
459
- 0,
460
- .2,
461
- 1
462
- ]
463
- },
464
- children: [
465
- /* @__PURE__ */ f("div", {
466
- className: q["picture-modal__preview-image"],
467
- children: /* @__PURE__ */ f("img", {
468
- src: t.url,
469
- alt: m("editor.previewImage")
470
- })
471
- }),
472
- /* @__PURE__ */ p("div", {
473
- className: q["picture-modal__preview-info"],
474
- children: [/* @__PURE__ */ f("div", {
475
- className: q["picture-modal__preview-filename"],
476
- children: t.file.name
477
- }), /* @__PURE__ */ f("div", {
478
- className: q["picture-modal__preview-size"],
479
- children: h(t.file.size)
480
- })]
481
- }),
482
- /* @__PURE__ */ f("div", {
483
- className: q["picture-modal__preview-delete"],
484
- role: "button",
485
- onClick: () => v(t.id),
486
- children: /* @__PURE__ */ f(e, { name: "delete" })
487
- })
488
- ]
489
- }, t.id)) })
490
- }) : null,
491
- /* @__PURE__ */ f("input", {
492
- ref: l,
493
- type: "file",
494
- accept: "image/*",
495
- multiple: !0,
496
- style: { display: "none" },
497
- onChange: w
498
- }),
499
- d
500
- ]
501
- });
502
- });
503
- Y.displayName = "UploadImage";
504
- //#endregion
505
- //#region src/components/Editor/commands/ImageCommands.ts
506
- var X = ae("INSERT_INLINE_IMAGE_COMMAND"), be = () => {
507
- let { t: n } = r(), [i] = I(), [o, s] = C(!1), c = S(null), l = S(null), u = [{
508
- key: "upload",
509
- title: n("editor.uploadImage"),
510
- icon: /* @__PURE__ */ f(e, { name: "picture" })
511
- }, {
512
- key: "url",
513
- title: n("editor.imageUrl"),
514
- icon: /* @__PURE__ */ f(e, { name: "Insertlink" })
515
- }], [m, h] = C(u[0].key), g = async () => {
516
- try {
517
- if (m === "upload" && l.current) (await l.current.getValue()).forEach((e) => {
518
- i.dispatchCommand(X, {
519
- src: e.src,
520
- altText: e.fileName
521
- });
522
- });
523
- else if (c.current) {
524
- let e = await c.current.getValue();
525
- i.dispatchCommand(X, {
526
- src: e,
527
- altText: e
528
- });
529
- }
530
- s(!1);
531
- } catch (e) {
532
- D.error(e instanceof Error ? e.message : n("editor.operationFailed"));
533
- }
534
- }, _ = {
535
- upload: /* @__PURE__ */ f(Y, { ref: l }),
536
- url: /* @__PURE__ */ f(J, { ref: c })
537
- };
538
- return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(H, {
539
- icon: "picture",
540
- tooltip: n("picture"),
541
- onClick: () => s(!0)
542
- }), /* @__PURE__ */ p(t, {
543
- title: n("addPicture"),
544
- open: o,
545
- onOpenChange: s,
546
- width: "620px",
547
- children: [/* @__PURE__ */ p("div", {
548
- className: q["picture-modal__container"],
549
- children: [/* @__PURE__ */ f("div", {
550
- className: q["picture-modal__sidebar"],
551
- children: /* @__PURE__ */ f("ul", {
552
- className: q["picture-modal__menu-list"],
553
- children: u.map((e) => /* @__PURE__ */ p("li", {
554
- className: `${q["picture-modal__menu-item"]} ${m === e.key ? q["picture-modal__menu-item--active"] : ""}`,
555
- onClick: () => h(e.key),
556
- children: [/* @__PURE__ */ f("span", {
557
- className: q["picture-modal__menu-icon"],
558
- children: e.icon
559
- }), /* @__PURE__ */ f("span", { children: e.title })]
560
- }, e.title))
561
- })
562
- }), /* @__PURE__ */ f(a, {
563
- className: q["picture-modal__content"],
564
- contentClassName: q["picture-modal__content-body"],
565
- children: _[m]
566
- })]
567
- }), /* @__PURE__ */ p("div", {
568
- className: q["picture-modal__footer"],
569
- children: [/* @__PURE__ */ f(w, {
570
- onClick: () => s(!1),
571
- children: n("cancel")
572
- }), /* @__PURE__ */ f(w, {
573
- type: "primary",
574
- onClick: g,
575
- children: n("confirm")
576
- })]
577
- })]
578
- })] });
579
- }, Z = /* @__PURE__ */ new Map(), Q = (e, t) => {
580
- if (!e) throw Error("registerToolbarButton: name is required");
581
- Z.set(e, t);
582
- }, xe = (e) => {
583
- Z.delete(e);
584
- }, Se = (e) => Z.get(e), Ce = () => Array.from(Z.keys()), $ = {
585
- bold: ue,
586
- underline: W,
587
- italic: de,
588
- fontSize: fe,
589
- fontColor: pe,
590
- fill: me,
591
- align: he,
592
- link: _e,
593
- unLink: ve,
594
- picture: be
595
- };
596
- Object.entries($).forEach(([e, t]) => {
597
- Q(e, t);
598
- });
599
- //#endregion
600
- export { xe as a, K as c, z as d, Q as i, H as l, Se as n, X as o, Ce as r, G as s, $ as t, ce as u };
@@ -1,92 +0,0 @@
1
- import { t as e } from "../Icon/Icon-BBDcb-yw.js";
2
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
- import { useState as r } from "react";
4
- import { Modal as i } from "antd";
5
- import { useControllableValue as a } from "ahooks";
6
- //#region src/components/Modal/constants.ts
7
- var o = "bsy-modal-motion", s = "bsy-modal-mask-motion", c = "rgba(0, 0, 0, 0.5)", l = "_modal_1wkiy_1", u = "_modal__title_1wkiy_7", d = "_modal__actions_1wkiy_20", f = "_modal__button_groups_1wkiy_24", p = "_modal__button_1wkiy_24", m = "_modal__icon_1wkiy_44", h = {
8
- modal: l,
9
- modal__title: u,
10
- "modal__title-text": "_modal__title-text_1wkiy_16",
11
- modal__actions: d,
12
- modal__button_groups: f,
13
- modal__button: p,
14
- "modal__button--fullscreen": "_modal__button--fullscreen_1wkiy_41",
15
- modal__icon: m
16
- }, g = (l) => {
17
- let { fullSwitch: u = !1 } = l, [d, f] = a(l, {
18
- valuePropName: "open",
19
- defaultValue: !1,
20
- defaultValuePropName: "defaultOpen",
21
- trigger: "onOpenChange"
22
- }), [p, m] = r(!1);
23
- return /* @__PURE__ */ t(i, {
24
- destroyOnHidden: !0,
25
- open: d,
26
- onCancel: () => f(!1),
27
- footer: null,
28
- title: l.title ? /* @__PURE__ */ n("div", {
29
- className: h.modal__title,
30
- children: [/* @__PURE__ */ t("div", {
31
- className: h.modal__titleText,
32
- children: l.title
33
- }), u ? /* @__PURE__ */ n("div", {
34
- className: h.modal__button_groups,
35
- children: [/* @__PURE__ */ t("div", {
36
- "aria-label": "toggle fullscreen",
37
- role: "button",
38
- onClick: () => m(!p),
39
- className: h.modal__button,
40
- children: /* @__PURE__ */ t(e, {
41
- name: p ? "quanpingsuoxiao" : "quanpingfangda",
42
- className: h.modal__icon
43
- })
44
- }), /* @__PURE__ */ t("div", {
45
- role: "button",
46
- "aria-label": "close",
47
- onClick: () => f(!1),
48
- className: h.modal__button,
49
- children: /* @__PURE__ */ t(e, {
50
- name: "close",
51
- className: h.modal__icon
52
- })
53
- })]
54
- }) : /* @__PURE__ */ t("div", {
55
- role: "button",
56
- "aria-label": "close",
57
- onClick: () => f(!1),
58
- className: h.modal__button,
59
- children: /* @__PURE__ */ t(e, {
60
- name: "close",
61
- className: h.modal__icon,
62
- size: 18
63
- })
64
- })]
65
- }) : null,
66
- closable: !1,
67
- className: h.modal,
68
- width: p ? "100%" : l.width,
69
- zIndex: l.zIndex,
70
- transitionName: o,
71
- maskTransitionName: s,
72
- mask: {
73
- closable: !1,
74
- blur: !1
75
- },
76
- focusable: { trap: !1 },
77
- styles: {
78
- header: { marginBottom: 0 },
79
- container: {
80
- padding: 0,
81
- borderRadius: "10px",
82
- overflow: "hidden"
83
- },
84
- body: { padding: 0 },
85
- mask: { backgroundColor: c }
86
- },
87
- children: l.children
88
- });
89
- };
90
- g.displayName = "BsyModal";
91
- //#endregion
92
- export { g as t };