@sheetxl/studio-mui 0.8.0-beta.2 → 0.8.0-beta.20

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 (299) hide show
  1. package/LICENSE.md +17 -7
  2. package/browser/esm/3xocDjPLOJXjOs3x.mjs +633 -0
  3. package/browser/esm/4RkuBXBVmw7VYQ2a.mjs +490 -0
  4. package/browser/esm/6R-JS1ZrhnwQAyOl.mjs +975 -0
  5. package/browser/esm/B4L3swgLGqcOHo7U.mjs +335 -0
  6. package/browser/esm/BAFzUBAc7BpGUWl_.mjs +87 -0
  7. package/browser/esm/{DIGlcemS7napWyKW.mjs → BENsK9C3A3CnZyXZ.mjs} +8 -6
  8. package/browser/esm/BRnwCembfaZpk0sc.mjs +1288 -0
  9. package/browser/esm/BSVc4NYkBnFa7T_w.mjs +119 -0
  10. package/browser/esm/{C5-J1xiO3O1-qaaP.mjs → BTWjCKBwd6qXldxi.mjs} +83 -95
  11. package/browser/esm/BWSZkGPSgg9pPKni.mjs +1550 -0
  12. package/browser/esm/{B1YOQZHyO_dmHUN4.mjs → BXVE3yfw5gdtyl-s.mjs} +2 -2
  13. package/browser/esm/Bfb84N1ywaVZm9kH.mjs +72 -0
  14. package/browser/esm/{C2Eke_9Dj_m6mtMj.mjs → BrZVnbTt-3DeAMxo.mjs} +47 -48
  15. package/browser/esm/BrdpRbJ-xKeF87FO.mjs +392 -0
  16. package/browser/esm/{xGJU5xUJx3HF317Q.mjs → BtrFK5bYpBJfHRDr.mjs} +14 -13
  17. package/browser/esm/BuSv-OgJpZJGjcyA.mjs +318 -0
  18. package/browser/esm/C1XMVwyIJNbYmtkV.mjs +414 -0
  19. package/browser/esm/{DE7MVTTfExTzvyMW.mjs → C2MuUgU0H05eZ5qQ.mjs} +33 -31
  20. package/browser/esm/{Dv3hSCyjvwo6GcH1.mjs → C5ZWkOAoFpcZwFw2.mjs} +4 -4
  21. package/browser/esm/C72jL8eQk_hPFDLn.mjs +8 -0
  22. package/browser/esm/CDJ0jdx7Km3a5v6w.mjs +294 -0
  23. package/browser/esm/CGDNdoMTlI8f1kRw.mjs +14 -0
  24. package/browser/esm/{Bo74PCF42KVYJF0j.mjs → CGomW4hI6SQ96yIm.mjs} +4 -4
  25. package/browser/esm/CHT8_XB3_hp307XA.mjs +68 -0
  26. package/browser/esm/{CppDmJ4ckCH3alQf.mjs → COkfKd7FvEtpgAAI.mjs} +156 -109
  27. package/browser/esm/CSgwY4Yb3l0WoprP.mjs +225 -0
  28. package/browser/esm/CgvHVv7iIzRRgmlF.mjs +197 -0
  29. package/browser/esm/ClqW5S7FR6Pwmp1U.mjs +442 -0
  30. package/browser/esm/ColttpEsydVwkHtf.mjs +77 -0
  31. package/browser/esm/Cvwz0PddEGW1FJ4c.mjs +94 -0
  32. package/browser/esm/CzfkYZGGhFc_gq0P.mjs +424 -0
  33. package/browser/esm/D-3WlyQuxUZCwLkb.mjs +831 -0
  34. package/browser/esm/D3Aests6-QUrBfmJ.mjs +235 -0
  35. package/browser/esm/D3bI-7D37_22_-T9.mjs +31 -0
  36. package/browser/esm/D7ZdGXqJXmdAHu8I.mjs +14 -0
  37. package/browser/esm/D83oSH8xR3JfeRjI.mjs +242 -0
  38. package/browser/esm/DCxc5HMSf1ZSHRoi.mjs +412 -0
  39. package/browser/esm/{DSGFnb1gYyL22p0t.mjs → DF0hjPW_C_3TpnDs.mjs} +20 -18
  40. package/browser/esm/DGFdTu5VfKecMohK.mjs +386 -0
  41. package/browser/esm/DHrJOjy3Du7ZBo96.mjs +360 -0
  42. package/browser/esm/DIZ9pueRPHaNzQqo.mjs +103 -0
  43. package/browser/esm/DMifD__JRvHH4COB.mjs +106 -0
  44. package/browser/esm/{D7fA9EyCNSzQMgxg.mjs → DQNnDQPNut_4wO6Y.mjs} +2 -2
  45. package/browser/esm/D_VpGjXScR-D-TWZ.mjs +2699 -0
  46. package/browser/esm/DdtM4Sy4hFIFwWvO.mjs +13 -0
  47. package/browser/esm/De7cege6OU7QJqBb.mjs +225 -0
  48. package/browser/esm/{iM5uEM9H4e8HGt5y.mjs → DobmIAozt-IiJp1P.mjs} +3 -3
  49. package/browser/esm/DwYjy-b-w1xnqteA.mjs +267 -0
  50. package/browser/esm/JBCZvp0T2f4n-Csb.mjs +94 -0
  51. package/browser/esm/LOzFCd9lrGWhNoCz.mjs +161 -0
  52. package/browser/esm/LQC_4LWJQR_JjcxV.mjs +141 -0
  53. package/browser/esm/UC9qbIWz2dYrCbJn.mjs +252 -0
  54. package/browser/esm/{CNLLwRPWnd4PJgPO.mjs → VoncM-mkj4eoKD1J.mjs} +5 -5
  55. package/browser/esm/{BlZiWp3SB3wH5O38.mjs → bOlMSpqTkmRboj5-.mjs} +4 -4
  56. package/browser/esm/hbiHjiOvIyYM3TIl.mjs +517 -0
  57. package/browser/esm/index.mjs +1878 -286
  58. package/browser/esm/mlTMBwB5PG7Fo1mU.mjs +8547 -0
  59. package/browser/esm/nmox4_ypwR5ILBKj.mjs +516 -0
  60. package/browser/esm/p-2ZZeZwGZfutcDk.mjs +973 -0
  61. package/browser/esm/{_v6Wbw_y3QgJy3qY.mjs → xLnpGjmsP-zJuXUE.mjs} +2 -2
  62. package/licenses/dependencies.txt +113 -366
  63. package/node/esm/3MP8rnjjEE0LpSoH.mjs +638 -0
  64. package/node/esm/{C0M1VbsIRuRauUI-.mjs → 539u16kqHOnXHBnN.mjs} +85 -97
  65. package/node/esm/{BMoRatciTqOi1HkT.mjs → B1WnY8cmRz7W1yrZ.mjs} +21 -21
  66. package/node/esm/B5kuWO6ix3DmmdhQ.mjs +391 -0
  67. package/node/esm/{DN-bhyNbuBbNB0Ky.mjs → BCYThTuIrSXfyd-N.mjs} +3 -3
  68. package/node/esm/{DVshSSmP5QZU7GoY.mjs → BJLg7uLC_b9f_1NJ.mjs} +29 -29
  69. package/node/esm/BWIatgbno8eMdTy4.mjs +385 -0
  70. package/node/esm/BXKb4oUGpTWCF8ni.mjs +412 -0
  71. package/node/esm/B_TEor8YFmwmyhWj.mjs +294 -0
  72. package/node/esm/Bqda2dQ0l75gjnDb.mjs +267 -0
  73. package/node/esm/BqkiJZsCP2hEkJs9.mjs +142 -0
  74. package/node/esm/C-s3vhDAhWAnJntP.mjs +118 -0
  75. package/node/esm/CAfDDLrXsXte2avr.mjs +224 -0
  76. package/node/esm/{DvMAUBSQsZmIsRxi.mjs → CDj1mR4aA0wufjjK.mjs} +2 -2
  77. package/node/esm/CJX21c9lbs0lFHFH.mjs +14 -0
  78. package/node/esm/CN5U8EzIhztKzktG.mjs +425 -0
  79. package/node/esm/CY8Mel9qXoQcoE6D.mjs +516 -0
  80. package/node/esm/Cs9OyntWvICLrQk-.mjs +141 -0
  81. package/node/esm/{BoDCV8cDmFVAYtaW.mjs → CsnknBUOfx3FVTP_.mjs} +2 -2
  82. package/node/esm/{CCWQ116Z67Kz78Uo.mjs → D8RVd9U84QC8lAvP.mjs} +33 -31
  83. package/node/esm/DAuVxjZwldORNkvx.mjs +1838 -0
  84. package/node/esm/DLx_RKfK6MMX0tiy.mjs +94 -0
  85. package/node/esm/DSZIOgi3X_EmsT65.mjs +106 -0
  86. package/node/esm/D_dyzcsGBlCNrIVJ.mjs +73 -0
  87. package/node/esm/Dbg6kW_63xZ_x2es.mjs +975 -0
  88. package/node/esm/DcIZXVJ5TJYu8Xf1.mjs +68 -0
  89. package/node/esm/DcIySopuRr-At74Y.mjs +94 -0
  90. package/node/esm/{DVaQ6xIbKQgBk0uw.mjs → Dpzk8tIhwke93vji.mjs} +70 -71
  91. package/node/esm/FHL9tW8a0eqpp8dm.mjs +1283 -0
  92. package/node/esm/GeLMvw9JlqlFr6jw.mjs +972 -0
  93. package/node/esm/{BJi0FlhIqCMEwROu.mjs → N8h_Ft32UJATwjlk.mjs} +190 -141
  94. package/node/esm/{cJDXopFIX6f3_oi3.mjs → VeNMuIWoztqGMKsZ.mjs} +2 -2
  95. package/node/esm/XJAfD-_V2Sx4aW33.mjs +77 -0
  96. package/node/esm/bIfQAr55kQq2xXaT.mjs +197 -0
  97. package/node/esm/e5DJjIF9cuF9r_ub.mjs +242 -0
  98. package/node/esm/h0ih_bazDGjgIXQd.mjs +489 -0
  99. package/node/esm/index.mjs +10334 -8697
  100. package/node/esm/rEdJke7xorzb_Nmh.mjs +519 -0
  101. package/node/esm/uCFRHXTVhzTQ53TT.mjs +319 -0
  102. package/node/esm/{DAji2BXelmIUxioS.mjs → ymnOnQfaRduubuPk.mjs} +23 -23
  103. package/package.json +16 -19
  104. package/resources/contents.json +6 -0
  105. package/resources/locales/contents.json +14 -0
  106. package/resources/locales/de/groups.cmd.json +61 -10
  107. package/resources/locales/de/ui.msg.json +293 -17
  108. package/resources/locales/de/workbookAnomalies.cmd.json +14 -0
  109. package/resources/locales/en/groups.cmd.json +71 -11
  110. package/resources/locales/en/ui.msg.json +298 -17
  111. package/resources/locales/en/workbookAnomalies.cmd.json +14 -0
  112. package/types/src/anchorItems/AnchorItemsDescriptor.d.ts +10 -4
  113. package/types/src/anomalies/AnomaliesCommands.d.ts +8 -0
  114. package/types/src/anomalies/AnomaliesMessages.d.ts +30 -0
  115. package/types/src/anomalies/AnomaliesPlugin.d.ts +12 -0
  116. package/types/src/anomalies/AnomaliesTaskPane.d.ts +17 -0
  117. package/types/src/anomalies/_source.d.ts +7 -0
  118. package/types/src/anomalies/index.d.ts +3 -0
  119. package/types/src/border/BorderPopupButton.d.ts +1 -1
  120. package/types/src/border/BorderTemplateIcon.d.ts +6 -1
  121. package/types/src/chart/ChartFormatPanel.d.ts +20 -0
  122. package/types/src/chart/ChartPlugin.d.ts +6 -0
  123. package/types/src/chart/index.d.ts +3 -0
  124. package/types/src/color/ColorPopupButton.d.ts +1 -1
  125. package/types/src/command/AccountingStyleCommandButton.d.ts +1 -1
  126. package/types/src/command/ColorCommandButton.d.ts +5 -0
  127. package/types/src/command/DocThemeCommandButton.d.ts +1 -1
  128. package/types/src/command/FontFamilyCommandButton.d.ts +1 -1
  129. package/types/src/command/FontSizeCommandButton.d.ts +1 -1
  130. package/types/src/command/InsertCellControlCommandButton.d.ts +17 -0
  131. package/types/src/command/LanguageCommandButton.d.ts +1 -1
  132. package/types/src/command/LocaleCommandButton.d.ts +1 -1
  133. package/types/src/command/PresetCellStylesCommandButton.d.ts +3 -3
  134. package/types/src/command/PresetPivotStylesCommandButton.d.ts +17 -0
  135. package/types/src/command/SheetZoomCommandButton.d.ts +4 -3
  136. package/types/src/command/index.d.ts +2 -0
  137. package/types/src/comments/CommentCard.d.ts +41 -0
  138. package/types/src/comments/CommentsPlugin.d.ts +6 -0
  139. package/types/src/comments/CommentsTaskPane.d.ts +23 -0
  140. package/types/src/comments/index.d.ts +4 -0
  141. package/types/src/conditionalFormat/ConditionalFormatPlugin.d.ts +1 -1
  142. package/types/src/conditionalFormat/ConditionalFormatStylePicker.d.ts +4 -4
  143. package/types/src/conditionalFormat/IconPickerPopupButton.d.ts +3 -3
  144. package/types/src/conditionalFormat/IconSetRulePanel.d.ts +1 -1
  145. package/types/src/conditions/BetweenOption.d.ts +5 -0
  146. package/types/src/conditions/CombinatorOption.d.ts +7 -0
  147. package/types/src/conditions/ConditionEditor.d.ts +55 -3
  148. package/types/src/conditions/ConditionUtils.d.ts +34 -6
  149. package/types/src/conditions/ExpressionOption.d.ts +6 -0
  150. package/types/src/conditions/MembershipOption.d.ts +67 -0
  151. package/types/src/conditions/OperatorAndParamEditor.d.ts +36 -1
  152. package/types/src/conditions/OperatorSelectPopupButton.d.ts +1 -1
  153. package/types/src/conditions/ScalarOption.d.ts +19 -0
  154. package/types/src/conditions/SelectorSelect.d.ts +16 -7
  155. package/types/src/conditions/index.d.ts +1 -1
  156. package/types/src/conditions/useFormulaOption.d.ts +2 -2
  157. package/types/src/dataValidation/DataValidationEditorPanel.d.ts +9 -5
  158. package/types/src/dataValidation/DataValidationIcon.d.ts +1 -1
  159. package/types/src/dataValidation/DataValidationPlugin.d.ts +1 -1
  160. package/types/src/dialog/HyperlinkDialog.d.ts +15 -0
  161. package/types/src/dialog/OutlineSettingsDialog.d.ts +12 -0
  162. package/types/src/dialog/PivotTableNewDialog.d.ts +11 -0
  163. package/types/src/dialog/SparklineEditDialog.d.ts +10 -0
  164. package/types/src/dialog/SparklineNewDialog.d.ts +23 -0
  165. package/types/src/dialog/WorkbookStatisticsDialog.d.ts +1 -1
  166. package/types/src/dialog/_ShortcutSearch.d.ts +26 -0
  167. package/types/src/dialog/index.d.ts +0 -1
  168. package/types/src/externalLink/ExternalLinkSettingsTab.d.ts +1 -1
  169. package/types/src/externalLink/ExternalLinksPlugin.d.ts +1 -1
  170. package/types/src/fill/GradientEditor.d.ts +15 -13
  171. package/types/src/fill/GradientStopsBar.d.ts +43 -0
  172. package/types/src/fill/PatternPopupButton.d.ts +1 -1
  173. package/types/src/fill/index.d.ts +1 -0
  174. package/types/src/filter/ColumnMenu.d.ts +31 -1
  175. package/types/src/filter/PivotMenu.d.ts +31 -0
  176. package/types/src/filter/index.d.ts +1 -1
  177. package/types/src/form/FormulaField.d.ts +10 -4
  178. package/types/src/form/InputField.d.ts +5 -5
  179. package/types/src/format/AlignmentPanel.d.ts +1 -2
  180. package/types/src/format/BorderPreview.d.ts +33 -16
  181. package/types/src/format/FillPanel.d.ts +42 -2
  182. package/types/src/format/FormatPanelParts.d.ts +3 -1
  183. package/types/src/format/FormatPlugin.d.ts +1 -6
  184. package/types/src/format/LinePanel.d.ts +53 -0
  185. package/types/src/format/LinePreviews.d.ts +71 -0
  186. package/types/src/format/index.d.ts +1 -0
  187. package/types/src/format/useFormatSelection.d.ts +7 -6
  188. package/types/src/formulaBar/IFormulaBar.d.ts +32 -3
  189. package/types/src/formulaBar/MobileFormulaBar.d.ts +42 -0
  190. package/types/src/formulaBar/MobileInputToolbar.d.ts +43 -0
  191. package/types/src/formulaBar/index.d.ts +3 -0
  192. package/types/src/formulaBar/useFormulaBarSession.d.ts +68 -0
  193. package/types/src/index.d.ts +19 -5
  194. package/types/src/itemsPanel/EditorCommit.d.ts +32 -0
  195. package/types/src/itemsPanel/EditorPanel.d.ts +1 -2
  196. package/types/src/itemsPanel/ItemCard.d.ts +50 -7
  197. package/types/src/itemsPanel/ItemsDescriptor.d.ts +13 -0
  198. package/types/src/itemsPanel/ItemsPanel.d.ts +5 -0
  199. package/types/src/itemsPanel/ItemsSearchField.d.ts +17 -0
  200. package/types/src/itemsPanel/index.d.ts +2 -0
  201. package/types/src/named/NamedDetailsPanel.d.ts +2 -2
  202. package/types/src/named/NamedPlugin.d.ts +1 -1
  203. package/types/src/picture/PicturePlugin.d.ts +6 -0
  204. package/types/src/picture/index.d.ts +2 -0
  205. package/types/src/pivot/PivotChipMenu.d.ts +10 -0
  206. package/types/src/pivot/PivotPlugin.d.ts +3 -0
  207. package/types/src/pivot/PivotStyleCanvasPreview.d.ts +23 -0
  208. package/types/src/pivot/PivotTableHeader.d.ts +12 -0
  209. package/types/src/pivot/PivotValueSettingsDialog.d.ts +15 -0
  210. package/types/src/pivot/_pivotSource.d.ts +7 -0
  211. package/types/src/presence/PresenceOverlay.d.ts +14 -0
  212. package/types/src/presence/PresencePlugin.d.ts +31 -0
  213. package/types/src/presence/PresenceStrip.d.ts +22 -0
  214. package/types/src/presence/PresenceTaskPane.d.ts +13 -0
  215. package/types/src/presence/Timeline.d.ts +29 -0
  216. package/types/src/presence/index.d.ts +5 -0
  217. package/types/src/protection/ProtectedCellsPanel.d.ts +3 -3
  218. package/types/src/protection/ProtectionPlugin.d.ts +1 -1
  219. package/types/src/protection/{SheetProtectionPanel.d.ts → WorksheetProtectionPanel.d.ts} +6 -6
  220. package/types/src/protection/index.d.ts +1 -1
  221. package/types/src/shape/ShapeFormatPanel.d.ts +11 -0
  222. package/types/src/shape/ShapeGalleryCommandButton.d.ts +18 -0
  223. package/types/src/shape/ShapePlugin.d.ts +8 -0
  224. package/types/src/shape/index.d.ts +3 -0
  225. package/types/src/slicer/InsertSlicerCommandButton.d.ts +13 -0
  226. package/types/src/slicer/PresetSlicerStylesCommandButton.d.ts +12 -0
  227. package/types/src/slicer/SlicerPlugin.d.ts +6 -0
  228. package/types/src/slicer/index.d.ts +3 -0
  229. package/types/src/statusBar/PendingStatus.d.ts +19 -0
  230. package/types/src/statusBar/SheetZoomScale.d.ts +6 -0
  231. package/types/src/statusBar/index.d.ts +1 -0
  232. package/types/src/studio/CommandsWrapper.d.ts +2 -0
  233. package/types/src/studio/StudioCommandProvider.d.ts +7 -0
  234. package/types/src/studio/StudioCommands.d.ts +2 -2
  235. package/types/src/studio/StudioProps.d.ts +50 -22
  236. package/types/src/studio/StudioSplitPane.d.ts +1 -1
  237. package/types/src/studio/formulaBarPlacement.d.ts +35 -0
  238. package/types/src/studio/useStudioApp.d.ts +23 -23
  239. package/types/src/table/TablePlugin.d.ts +1 -1
  240. package/types/src/table/_drawStyleSwatch.d.ts +25 -0
  241. package/types/src/template/TemplateDialog.d.ts +1 -1
  242. package/types/src/template/TemplatePanel.d.ts +5 -1
  243. package/types/src/template/TemplateSearchField.d.ts +17 -1
  244. package/types/src/template/categoryColor.d.ts +8 -0
  245. package/types/src/template/useTemplateCatalog.d.ts +7 -5
  246. package/types/src/theme/ThemeSelectPopupButton.d.ts +1 -1
  247. package/types/src/toolbar/WorkbookToolbars.d.ts +2 -2
  248. package/types/src/workbook/DefaultRenderers.d.ts +45 -15
  249. package/types/src/workbook/OutlineButtons.d.ts +11 -0
  250. package/types/src/workbook/WorkbookContextMenu.d.ts +4 -0
  251. package/types/src/workbook/WorkbookElement.d.ts +5 -4
  252. package/types/src/workbook/WorkbookStrip.d.ts +8 -7
  253. package/types/src/workbook/index.d.ts +1 -1
  254. package/browser/cjs/3k_KqDFr-AybPztc.cjs +0 -5
  255. package/browser/cjs/3uprnzi2l0iT17Dg.cjs +0 -1
  256. package/browser/cjs/B9GcCj7sj8XdjPZF.cjs +0 -1
  257. package/browser/cjs/BGvoJjUs21bbuE1i.cjs +0 -1
  258. package/browser/cjs/BHb7TnK1NmimV4OX.cjs +0 -1
  259. package/browser/cjs/BJ-wdkCaXqJaejKf.cjs +0 -1
  260. package/browser/cjs/BNqyPYRxYISp-uEg.cjs +0 -1
  261. package/browser/cjs/BQJKf40kttQWOzLw.cjs +0 -20
  262. package/browser/cjs/BTZ5uzK0wHzpiZGC.cjs +0 -1
  263. package/browser/cjs/BXkdjAb4jpTr412c.cjs +0 -1
  264. package/browser/cjs/Bc-YisjBtD56vBAW.cjs +0 -1
  265. package/browser/cjs/Bo9Kx3L_XQkGPBJ5.cjs +0 -1
  266. package/browser/cjs/C97KHSuikAbr1qVM.cjs +0 -1
  267. package/browser/cjs/CPSc2VSYZeZ1B9mi.cjs +0 -1
  268. package/browser/cjs/CPcBvw4ZPwHVTUZF.cjs +0 -1
  269. package/browser/cjs/CdDYyAfccXme8w6m.cjs +0 -1
  270. package/browser/cjs/CuqM721PsKey3yMP.cjs +0 -1
  271. package/browser/cjs/Cy_XmYq6BsWmCXkk.cjs +0 -3
  272. package/browser/cjs/D948H7ell-f87BX3.cjs +0 -1
  273. package/browser/cjs/Dy6O3OWbDBKIj_Ak.cjs +0 -8
  274. package/browser/cjs/KZvriGbhEOVkQD0b.cjs +0 -1
  275. package/browser/cjs/M0_dvdYwhikqP9kg.cjs +0 -2
  276. package/browser/cjs/QI6GKw7uo1f8gY8C.cjs +0 -1
  277. package/browser/cjs/eCw4rAEIYE3BftpG.cjs +0 -1
  278. package/browser/cjs/iMWEL01eC83oU-YY.cjs +0 -1
  279. package/browser/cjs/index.cjs +0 -2
  280. package/browser/cjs/rCZbExyf1Q3aHloQ.cjs +0 -13
  281. package/browser/esm/894KM-_Oc5cB6ExA.mjs +0 -97
  282. package/browser/esm/BQSamOMBAoFdQdJe.mjs +0 -12903
  283. package/browser/esm/CIbDvsCeLOFHzzId.mjs +0 -152
  284. package/browser/esm/CyHNVjgkMYZYlJpY.mjs +0 -5315
  285. package/browser/esm/D8VPmFDvXDE778_x.mjs +0 -222
  286. package/browser/esm/DEEnXLhYlUARg6MU.mjs +0 -410
  287. package/browser/esm/DN4cwAPYCrtR4gS9.mjs +0 -236
  288. package/browser/esm/DlEshYp6NPfHxFvI.mjs +0 -115
  289. package/browser/esm/GmQ9XFFY3hi1L_Ej.mjs +0 -1150
  290. package/browser/esm/z3zkU7Jf3WJ2_Z_P.mjs +0 -52
  291. package/node/esm/BI8XFczUY--Db2n3.mjs +0 -98
  292. package/node/esm/BgxeTfCn3jZHGwd7.mjs +0 -414
  293. package/node/esm/C_oV7ldFStOF_fAd.mjs +0 -115
  294. package/node/esm/Dbv0IltYad9SQrj3.mjs +0 -236
  295. package/node/esm/OmUP1AfaJcOxWQAg.mjs +0 -4462
  296. package/types/src/conditions/DateTimeOption.d.ts +0 -43
  297. package/types/src/conditions/ListSourceOption.d.ts +0 -31
  298. package/types/src/dialog/CommentsDialog.d.ts +0 -11
  299. package/types/src/filter/FilterList.d.ts +0 -31
@@ -1,4462 +0,0 @@
1
- /**
2
- * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.2
3
- *
4
- * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */
7
- import { AutoColorPosition as e, BorderPopupButton as t, ColorPopupButton as o, DocumentTitle as n, ExternalLinksPlugin as r, FormatPlugin as a, FormulaField as l, NamedPlugin as i, ProtectionPlugin as s, T as d, TablePlugin as c, WorkbookElement as p, _ as u, a as m, b as g, c as h, createStudioThemeCSS as y, d as f, f as b, g as x, h as v, i as C, l as k, m as w, n as S, p as T, r as F, registerStudioCommandCatalogs as D, registerStudioCommandGroups as N, renderWorkbookToolbars as P, s as I, t as O, tokensToMuiOptions as M, u as A, v as W, x as E, y as B } from "./index.mjs";
8
- import { Color as R, CommonUtils as L, Condition as V, FormulaError as z, FormulaText as j, ICondition as $, IConditionalFormat as K, IDataValidation as _, IFill as H, IFont as U, IStyle as q, ScalarType as G, getLocaleProfile as Q } from "@sheetxl/sdk";
9
- import { COLOR_SCALE_PRESETS as Y, CommandRootProvider as J, DATA_BAR_PRESETS as X, DefaultTaskPaneRegistry as Z, ICON_CATALOG as ee, IconSetGlyphs as te, LogoNoPaddingIcon as oe, NO_CELL_ICON as ne, PickerPanel as re, STYLE_PRESETS as ae, TaskPaneArea as le, TaskPaneProvider as ie, ThemeStateKey as se, WorkbookIO as de, WorkbookProvider as ce, buildOOXMLThemeCSS as pe, createEditable as ue, createSystemColorVars as me, defaultColorScale as ge, defaultDataBar as he, defaultIconSet as ye, defaultIconStops as fe, getConditionalIconSet as be, iconSetSize as xe, resolveIconSetIcons as ve, useDocThemes as Ce, useModelSync as ke, useReferenceModeStore as we, useResolvedWorkbook as Se, useSheet as Te, useTaskPaneArea as Fe, useWorkbookEncrypted as De, useWorkbookName as Ne, useWorkbookSaveState as Pe, withIconOverride as Ie } from "@sheetxl/react";
10
- import { Command as Oe, DefaultIconService as Me, DefaultReactNotifier as Ae, DynamicIcon as We, KeyCodes as Ee, LanguageStateKey as Be, NotifierType as Re, ReactErrorBoundary as Le, ReactNotifierProvider as Ve, SplitPane as ze, UncaughtErrorBoundary as je, createBusyHandle as $e, floatThemeScopeProps as Ke, useCallbackRef as _e, useFloatSurface as He, useFullscreen as Ue, useImperativeElement as qe, useLanguage as Ge, useNotifier as Qe, usePersistenceState as Ye, useResolvedThemeMode as Je, useTokenThemeContext as Xe, useTranslator as Ze } from "@sheetxl/utils-react";
11
- import et, { createContext as tt, forwardRef as ot, isValidElement as nt, memo as rt, useCallback as at, useContext as lt, useEffect as it, useMemo as st, useRef as dt, useState as ct } from "react";
12
- import { AnimatedLoadingPanel as pt, AnimatedTraversingEllipsisIcon as ut, CommandGroup as mt, ExhibitFloatProvider as gt, ExhibitIconButton as ht, ExhibitPopupIconButton as yt, ExhibitTooltip as ft, ModalProvider as bt, SimpleTooltip as xt, StackTrace as vt, createExhibitTheme as Ct, defaultCreatePopupPanel as kt, hideLoadingPanel as wt, lazyModal as St, showLoadingPanel as Tt, useInputDialog as Ft, useLazyWindow as Dt, useModal as Nt, useOptionsDialog as Pt } from "@sheetxl/utils-mui";
13
- import { Fragment as It, jsx as Ot, jsxs as Mt } from "react/jsx-runtime";
14
- import { Accordion as At, AccordionDetails as Wt, AccordionSummary as Et, Box as Bt, Button as Rt, Card as Lt, CardActions as Vt, Checkbox as zt, Collapse as jt, CssBaseline as $t, DialogTitle as Kt, Divider as _t, FormControl as Ht, FormControlLabel as Ut, FormHelperText as qt, IconButton as Gt, InputLabel as Qt, ListSubheader as Yt, MenuItem as Jt, MenuList as Xt, Paper as Zt, Popover as eo, Select as to, SvgIcon as oo, Tab as no, Tabs as ro, TextField as ao, ThemeProvider as lo, ToggleButton as io, ToggleButtonGroup as so, Typography as co, alpha as po, useMediaQuery as uo, useTheme as mo } from "@mui/material";
15
- import { CommonUtils as go, DOMUtils as ho, DefaultLanguagePackService as yo, ErrorUtils as fo, ExpectedError as bo, PartialError as xo, defineLazyModule as vo, formatMessage as Co, messageKey as ko, t as wo } from "@sheetxl/utils";
16
- import So from "clsx";
17
- import { mergeRefs as To } from "react-merge-refs";
18
- import { useMeasure as Fo } from "react-use";
19
- import { SnackbarContent as Do, SnackbarProvider as No, useSnackbar as Po } from "notistack";
20
- var Io = rt((e) => {
21
- const { option: t, onOptionChange: o, readOnly: n, ...r } = e;
22
- return Ot(ao, {
23
- size: "small",
24
- type: "text",
25
- placeholder: Ze()("condition.enterText"),
26
- value: t ?? "",
27
- onChange: (e) => o(String(e.target.value)),
28
- disabled: n,
29
- ...r,
30
- slotProps: { input: { sx: { backgroundColor: "background.paper" } } }
31
- });
32
- });
33
- Io.displayName = "StringOption";
34
- var Oo = rt((e) => {
35
- const { option: t, onOptionChange: o, readOnly: n, ...r } = e;
36
- return Ot(ao, {
37
- size: "small",
38
- type: "number",
39
- placeholder: Ze()("condition.enterNumber"),
40
- value: "" + (t ?? ""),
41
- onChange: (e) => o(Number(e.target.value)),
42
- disabled: n,
43
- ...r,
44
- slotProps: { input: { sx: { backgroundColor: "background.paper" } } }
45
- });
46
- });
47
- Oo.displayName = "NumberOption";
48
- var Mo = tt(null), Ao = (e) => {
49
- const { rowIndex: t, colIndex: o } = e.getSelectedCell().getCoords();
50
- return {
51
- rowIndex: t,
52
- colIndex: o
53
- };
54
- }, Wo = (e, t) => {
55
- const o = ((e) => {
56
- const t = e?.getCoords();
57
- if (!t || 0 === t.length) return null;
58
- let o = t[0].rowStart, n = t[0].colStart;
59
- for (let e = 1; e < t.length; e++) o = Math.min(o, t[e].rowStart), n = Math.min(n, t[e].colStart);
60
- return {
61
- rowIndex: o,
62
- colIndex: n
63
- };
64
- })(t?.getRanges() ?? null);
65
- if (!e || !o) return null;
66
- const { rowIndex: n, colIndex: r } = Ao(e);
67
- return n === o.rowIndex && r === o.colIndex ? null : {
68
- active: {
69
- rowIndex: n,
70
- colIndex: r
71
- },
72
- anchor: o
73
- };
74
- }, Eo = () => {
75
- const e = Te(), t = lt(Mo), o = dt(null), n = e ? Ao(e) : null, r = e?.getName() ?? null, a = st(() => n && r ? {
76
- ...n,
77
- scope: r
78
- } : void 0, [
79
- r,
80
- n?.rowIndex,
81
- n?.colIndex
82
- ]);
83
- return st(() => ({
84
- home: a,
85
- display: (n) => {
86
- const r = o.current;
87
- if (r && r.stored === n.getExpression()) return r.text;
88
- const a = Wo(e, t);
89
- if (a) try {
90
- const t = e.createFormula(n.getExpression(), a.anchor).shift(a.active);
91
- if (t) return t.getExpression({ target: "display" });
92
- } catch {}
93
- return n.getExpression({ target: "display" });
94
- },
95
- compile: (n) => {
96
- const r = Wo(e, t);
97
- let a = null;
98
- try {
99
- a = e?.createFormula(n, r?.active, { target: "display" }) ?? null, a && r && (a = a.shift(r.anchor));
100
- } catch {
101
- a = null;
102
- }
103
- return o.current = a ? {
104
- stored: a.getExpression(),
105
- text: n
106
- } : null, a ?? n;
107
- }
108
- }), [
109
- e,
110
- t,
111
- a
112
- ]);
113
- }, Bo = (e, t) => null == e ? "" : e.isIFormula ? "=" + t.display(e) : "boolean" == typeof e ? e ? "TRUE" : "FALSE" : z.isError(e) ? e.getLabel() : String(e), Ro = rt((e) => {
114
- const { option: t, onOptionChange: o, readOnly: n, ...r } = e, a = Ze(), i = Eo();
115
- return Ot(l, {
116
- size: "small",
117
- home: i.home,
118
- value: Bo(t, i),
119
- onChangeText: (e) => o(((e, t) => {
120
- if (0 === e.length) return null;
121
- if (e.startsWith("=")) {
122
- const o = t.compile(e.substring(1));
123
- return "string" == typeof o ? e : o;
124
- }
125
- const o = e.trim();
126
- if (o.length > 0) {
127
- const e = Number(o);
128
- if (Number.isFinite(e)) return e;
129
- }
130
- return e;
131
- })(e, i)),
132
- placeholder: a("condition.enterValueOrFormula"),
133
- disabled: n,
134
- fullWidth: !0,
135
- equals: "literal",
136
- pickAs: "absolute",
137
- label: null,
138
- showError: !1,
139
- helperText: null,
140
- ...r
141
- });
142
- });
143
- Ro.displayName = "ScalarOption";
144
- var Lo = (e, t, o) => {
145
- if (null == e) return "";
146
- if (e.isIFormula) return "=" + o.display(e);
147
- if (Array.isArray(e)) return e.map((e) => String(e ?? "")).join(t);
148
- const n = V.parseListLiteral(e);
149
- return n ? n.join(t) : e.length > 0 ? "=" + e : "";
150
- }, Vo = rt((e) => {
151
- const { option: t, onOptionChange: o, readOnly: n, sx: r, ...a } = e, i = Ze(), s = Te(), d = lt(Mo), c = Eo(), p = Q(s?.getWorkbook()?.getLocale() ?? "en").listSeparator, [u, m] = ct(null), g = t?.items, [h, y] = ct(null), f = dt(0);
152
- it(() => {
153
- if (!d?.getListItemsAt || !s) return void y(null);
154
- const e = ++f.current, { rowIndex: t, colIndex: o } = Ao(s);
155
- d.getListItemsAt(t, o).then((t) => {
156
- e === f.current && y(t);
157
- }, () => {
158
- e === f.current && y([]);
159
- });
160
- }, [
161
- d,
162
- s,
163
- g
164
- ]);
165
- const [b, x] = ct(null), { className: v } = Ke(He()?.themeScope), C = st(() => s?.getStyles().getNormal().getFont().toCSS("adaptive"), [s]), [k, w] = ct(null), S = k ?? u;
166
- return Mt(Bt, {
167
- sx: {
168
- display: "flex",
169
- flexDirection: "column",
170
- mt: .75,
171
- ...r
172
- },
173
- children: [Mt(Bt, {
174
- sx: {
175
- display: "flex",
176
- alignItems: "stretch",
177
- gap: 1
178
- },
179
- children: [Ot(l, {
180
- size: "small",
181
- home: c.home,
182
- value: Lo(g, p, c),
183
- onChangeText: (e) => {
184
- const n = ((e, t, o) => {
185
- if (0 === e.length) return { items: "" };
186
- if (e.startsWith("=")) {
187
- if (0 === e.substring(1).trim().length) return {};
188
- const t = o.compile(e.substring(1));
189
- return "string" == typeof t ? { items: t } : ((e) => {
190
- let t = e;
191
- for (; "paren" === t?.type && 1 === t.inputs?.length;) t = t.inputs[0];
192
- return "list" === t?.type || "paren" === t?.type && (t.inputs?.length ?? 0) > 1;
193
- })(j.parse(t.getExpression())) ? { error: ko("condition.listSourceOneRange") } : { items: t.getExpression() };
194
- }
195
- const n = V.formatListLiteral(e.split(t));
196
- return null === n ? { error: ko("condition.listItemHasComma") } : { items: n };
197
- })(e, p, c);
198
- m(n.error ?? null), void 0 !== n.items && o({
199
- ...t,
200
- items: n.items
201
- });
202
- },
203
- label: i("condition.listSource"),
204
- placeholder: i("condition.enterListSource"),
205
- disabled: n,
206
- fullWidth: !0,
207
- equals: "literal",
208
- pickAs: "absolute",
209
- allowMulti: !1,
210
- validationError: u,
211
- onChangeError: w,
212
- showError: !1,
213
- helperText: null,
214
- ...a
215
- }), null !== h && Mt(It, { children: [Ot(Rt, {
216
- size: "small",
217
- variant: "outlined",
218
- color: "inherit",
219
- onClick: (e) => x(e.currentTarget),
220
- endIcon: Ot(We, { iconKey: "ExpandMore" }),
221
- sx: {
222
- flexShrink: 0,
223
- width: "8.5em",
224
- justifyContent: "space-between",
225
- textTransform: "none"
226
- },
227
- children: Ot(Bt, {
228
- component: "span",
229
- sx: {
230
- overflow: "hidden",
231
- textOverflow: "ellipsis",
232
- whiteSpace: "nowrap"
233
- },
234
- children: i("condition.listPreview", { count: h.length })
235
- })
236
- }), Ot(eo, {
237
- open: !!b,
238
- anchorEl: b,
239
- onClose: () => x(null),
240
- className: v,
241
- anchorOrigin: {
242
- vertical: "bottom",
243
- horizontal: "right"
244
- },
245
- transformOrigin: {
246
- vertical: "top",
247
- horizontal: "right"
248
- },
249
- children: Ot(re, {
250
- items: h,
251
- minWidth: b?.getBoundingClientRect().width,
252
- style: C,
253
- onChoose: () => x(null)
254
- })
255
- })] })]
256
- }), S && Ot(qt, {
257
- error: !0,
258
- children: i(S)
259
- })]
260
- });
261
- });
262
- Vo.displayName = "ListSourceOption";
263
- var zo = {}, jo = rt((e) => {
264
- const { option: t, onOptionChange: o, className: n, readOnly: r, ...a } = e, l = Ze(), i = t?.type ?? $.AverageType.Above, s = t?.stdDevs ?? "";
265
- let d = { backgroundColor: "background.paper" };
266
- return r && (d = {
267
- ...d,
268
- "& .MuiSelect-icon": { display: "none" },
269
- "& .MuiOutlinedInput-notchedOutline": { borderColor: "action.disabled" }
270
- }), Mt(Bt, {
271
- className: So(n, zo.option),
272
- ...a,
273
- sx: {
274
- display: "flex",
275
- flexDirection: "row",
276
- gap: .25,
277
- ...a?.sx
278
- },
279
- children: [Ot(Ht, {
280
- sx: { flex: .5 },
281
- size: "small",
282
- children: Mt(to, {
283
- value: i,
284
- sx: d,
285
- IconComponent: (e) => Ot(We, {
286
- iconKey: "ExpandMore",
287
- ...e
288
- }),
289
- disabled: r,
290
- onChange: (e) => o({
291
- ...t,
292
- type: e.target.value
293
- }),
294
- children: [Ot(Jt, {
295
- value: $.AverageType.Above,
296
- children: l("condition.above")
297
- }), Ot(Jt, {
298
- value: $.AverageType.Below,
299
- children: l("condition.below")
300
- })]
301
- })
302
- }), Ot(ao, {
303
- size: "small",
304
- placeholder: l("condition.stdDevs"),
305
- value: s,
306
- onChange: (e) => {
307
- const n = Number(e.target.value) || "", r = { ...t };
308
- "number" == typeof n ? r.stdDevs = n : delete r.stdDevs, o(r);
309
- },
310
- sx: { flex: .5 },
311
- disabled: r,
312
- slotProps: { input: { sx: { backgroundColor: "background.paper" } } },
313
- type: "number"
314
- })]
315
- });
316
- });
317
- jo.displayName = "AverageOption";
318
- var $o = 0, Ko = /* @__PURE__ */ new WeakMap(), _o = (e) => {
319
- let t = Ko.get(e);
320
- return t || (t = "__ci_" + ++$o, Ko.set(e, t)), t;
321
- }, Ho = Object.freeze([$.BuiltInOperatorNames.Icon, $.BuiltInOperatorNames.Color]), Uo = (e, t, o, n = Ho) => {
322
- const r = t ?? Object.values(V.BuiltInOperators), a = e?.getSelectType() ?? null, l = e?.isList;
323
- return r.filter((t) => {
324
- if (n.includes(t.getName())) return !1;
325
- const o = t.acceptsList?.();
326
- if (!l && o) return !1;
327
- if (l && !o) return !1;
328
- if (!e) return !0;
329
- const r = t.getAcceptsTypes?.();
330
- return !r || r.includes(a);
331
- }).sort((e, t) => (e.getTitle?.() ?? "").localeCompare(t.getTitle?.() ?? "", o));
332
- }, qo = (e, t, o, n) => {
333
- const r = (e, t) => (e.getTitle?.() ?? "").localeCompare(t.getTitle?.() ?? "", n), a = e.filter((e) => !e.isCombinator?.()).sort(r), l = e.filter((e) => e.isCombinator?.()).sort(r), i = [];
334
- return a.length > 0 && (i.push(Ot(Yt, {
335
- disableSticky: !0,
336
- sx: Qo,
337
- children: o("condition.groupBasic")
338
- }, "__header:leaf")), a.forEach((e) => i.push(t(e)))), a.length > 0 && l.length > 0 && i.push(Ot(_t, {}, "__divider")), l.length > 0 && (i.push(Ot(Yt, {
339
- disableSticky: !0,
340
- sx: Qo,
341
- children: o("condition.groupCombine")
342
- }, "__header:combinator")), l.forEach((e) => i.push(t(e)))), i;
343
- }, Go = (e, t, o = null) => {
344
- if (!e.isCombinator?.()) return e.createDefaultParam?.(o ?? void 0) ?? null;
345
- const n = t.find((e) => !e.isCombinator?.()) ?? null, r = n ? {
346
- operator: n.getName(),
347
- param: n.createDefaultParam?.(o ?? void 0) ?? null
348
- } : null;
349
- return "not" === e.getName() ? r : r ? [r] : [];
350
- }, Qo = {
351
- userSelect: "none",
352
- lineHeight: "2",
353
- fontSize: "0.75rem",
354
- fontWeight: 600,
355
- color: "text.secondary",
356
- paddingLeft: 1,
357
- paddingRight: 1
358
- }, Yo = { pl: 2 };
359
- var Jo = rt((e) => {
360
- const { option: t, onOptionChange: o, readOnly: n, ...r } = e, a = function(e, t) {
361
- const o = (e) => new Intl.DateTimeFormat(t, { month: "long" }).format(new Date(2e3, e, 1));
362
- return [
363
- {
364
- header: e("condition.period.day"),
365
- options: [
366
- {
367
- value: $.TimePeriodType.Today,
368
- label: e("condition.period.today")
369
- },
370
- {
371
- value: $.TimePeriodType.Yesterday,
372
- label: e("condition.period.yesterday")
373
- },
374
- {
375
- value: $.TimePeriodType.Tomorrow,
376
- label: e("condition.period.tomorrow")
377
- }
378
- ]
379
- },
380
- {
381
- header: e("condition.period.week"),
382
- options: [
383
- {
384
- value: $.TimePeriodType.ThisWeek,
385
- label: e("condition.period.thisWeek")
386
- },
387
- {
388
- value: $.TimePeriodType.LastWeek,
389
- label: e("condition.period.lastWeek")
390
- },
391
- {
392
- value: $.TimePeriodType.NextWeek,
393
- label: e("condition.period.nextWeek")
394
- }
395
- ]
396
- },
397
- {
398
- header: e("condition.period.month"),
399
- options: [
400
- {
401
- value: $.TimePeriodType.ThisMonth,
402
- label: e("condition.period.thisMonth")
403
- },
404
- {
405
- value: $.TimePeriodType.LastMonth,
406
- label: e("condition.period.lastMonth")
407
- },
408
- {
409
- value: $.TimePeriodType.NextMonth,
410
- label: e("condition.period.nextMonth")
411
- }
412
- ]
413
- },
414
- {
415
- header: e("condition.period.year"),
416
- options: [{
417
- value: $.TimePeriodType.YearToDate,
418
- label: e("condition.period.yearToDate")
419
- }, {
420
- value: $.TimePeriodType.LastYear,
421
- label: e("condition.period.lastYear")
422
- }]
423
- },
424
- {
425
- header: e("condition.period.byMonth"),
426
- options: [
427
- {
428
- value: $.TimePeriodType.M1,
429
- label: o(0)
430
- },
431
- {
432
- value: $.TimePeriodType.M2,
433
- label: o(1)
434
- },
435
- {
436
- value: $.TimePeriodType.M3,
437
- label: o(2)
438
- },
439
- {
440
- value: $.TimePeriodType.M4,
441
- label: o(3)
442
- },
443
- {
444
- value: $.TimePeriodType.M5,
445
- label: o(4)
446
- },
447
- {
448
- value: $.TimePeriodType.M6,
449
- label: o(5)
450
- },
451
- {
452
- value: $.TimePeriodType.M7,
453
- label: o(6)
454
- },
455
- {
456
- value: $.TimePeriodType.M8,
457
- label: o(7)
458
- },
459
- {
460
- value: $.TimePeriodType.M9,
461
- label: o(8)
462
- },
463
- {
464
- value: $.TimePeriodType.M10,
465
- label: o(9)
466
- },
467
- {
468
- value: $.TimePeriodType.M11,
469
- label: o(10)
470
- },
471
- {
472
- value: $.TimePeriodType.M12,
473
- label: o(11)
474
- }
475
- ]
476
- },
477
- {
478
- header: e("condition.period.byQuarter"),
479
- options: [
480
- {
481
- value: $.TimePeriodType.ThisQuarter,
482
- label: e("condition.period.thisQuarter")
483
- },
484
- {
485
- value: $.TimePeriodType.LastQuarter,
486
- label: e("condition.period.lastQuarter")
487
- },
488
- {
489
- value: $.TimePeriodType.NextQuarter,
490
- label: e("condition.period.nextQuarter")
491
- },
492
- {
493
- value: $.TimePeriodType.Q1,
494
- label: e("condition.period.q1")
495
- },
496
- {
497
- value: $.TimePeriodType.Q2,
498
- label: e("condition.period.q2")
499
- },
500
- {
501
- value: $.TimePeriodType.Q3,
502
- label: e("condition.period.q3")
503
- },
504
- {
505
- value: $.TimePeriodType.Q4,
506
- label: e("condition.period.q4")
507
- }
508
- ]
509
- }
510
- ];
511
- }(Ze(), Ge()), l = t?.type ?? $.TimePeriodType.Today;
512
- return Ot(Bt, {
513
- ...r,
514
- sx: {
515
- display: "flex",
516
- flexDirection: "column",
517
- gap: 2,
518
- ...r?.sx
519
- },
520
- children: Ot(Ht, {
521
- size: "small",
522
- children: Ot(to, {
523
- value: l,
524
- sx: { backgroundColor: "background.paper" },
525
- IconComponent: (e) => Ot(We, {
526
- iconKey: "ExpandMore",
527
- ...e
528
- }),
529
- onChange: (e) => o({
530
- ...t,
531
- type: e.target.value
532
- }),
533
- disabled: n,
534
- children: a.map((e, t) => {
535
- const o = [];
536
- return t > 0 && o.push(Ot(_t, {}, `divider-${t}`)), o.push(Ot(Yt, {
537
- sx: Qo,
538
- children: e.header
539
- }, `header-${t}`)), e.options.map((e) => o.push(Ot(Jt, {
540
- sx: Yo,
541
- value: e.value,
542
- children: e.label
543
- }, e.value))), o;
544
- })
545
- })
546
- })
547
- });
548
- });
549
- Jo.displayName = "TimePeriodOption";
550
- var Xo = rt((e) => {
551
- const { option: t, onOptionChange: o, readOnly: n, ...r } = e, a = Ze(), l = t?.top ?? !0, i = t?.limit ?? 10, s = t?.percent ?? !1;
552
- return Mt(Bt, {
553
- ...r,
554
- sx: {
555
- display: "flex",
556
- flexDirection: "row",
557
- gap: .25,
558
- ...r?.sx
559
- },
560
- children: [
561
- Ot(Ht, {
562
- size: "small",
563
- sx: { flex: 1 },
564
- children: Mt(to, {
565
- value: l ? "top" : "bottom",
566
- sx: { backgroundColor: "background.paper" },
567
- IconComponent: (e) => Ot(We, {
568
- iconKey: "ExpandMore",
569
- ...e
570
- }),
571
- onChange: (e) => o({
572
- ...t,
573
- top: "top" === e.target.value
574
- }),
575
- disabled: n,
576
- children: [Ot(Jt, {
577
- value: "top",
578
- children: a("condition.top")
579
- }), Ot(Jt, {
580
- value: "bottom",
581
- children: a("condition.bottom")
582
- })]
583
- })
584
- }),
585
- Ot(ao, {
586
- size: "small",
587
- placeholder: "10",
588
- value: i,
589
- onChange: (e) => {
590
- const n = parseFloat(e.target.value) || 10;
591
- o({
592
- ...t,
593
- limit: n
594
- });
595
- },
596
- disabled: n,
597
- type: "number",
598
- slotProps: { input: { sx: { backgroundColor: "background.paper" } } },
599
- sx: { flex: .6 }
600
- }),
601
- Ot(Ht, {
602
- size: "small",
603
- sx: { flex: 1 },
604
- children: Mt(to, {
605
- value: s ? "percent" : "items",
606
- sx: { backgroundColor: "background.paper" },
607
- IconComponent: (e) => Ot(We, {
608
- iconKey: "ExpandMore",
609
- ...e
610
- }),
611
- onChange: (e) => o({
612
- ...t,
613
- percent: "percent" === e.target.value
614
- }),
615
- disabled: n,
616
- children: [Ot(Jt, {
617
- value: "items",
618
- children: a("condition.items")
619
- }), Ot(Jt, {
620
- value: "percent",
621
- children: a("condition.percent")
622
- })]
623
- })
624
- })
625
- ]
626
- });
627
- });
628
- Xo.displayName = "TopNOption";
629
- var Zo = rt((e) => {
630
- const { option: t, onOptionChange: o, readOnly: n, ...r } = e, a = Ze();
631
- return Mt(Bt, {
632
- ...r,
633
- sx: {
634
- display: "flex",
635
- flexDirection: "row",
636
- gap: .25,
637
- ...r?.sx
638
- },
639
- children: [Ot(Ro, {
640
- option: t?.from ?? null,
641
- placeholder: a("condition.from"),
642
- onOptionChange: (e) => {
643
- o({
644
- ...t,
645
- from: e
646
- });
647
- },
648
- readOnly: n,
649
- sx: {
650
- flex: .6,
651
- minWidth: 0
652
- }
653
- }), Ot(Ro, {
654
- option: t?.to ?? null,
655
- placeholder: a("condition.to"),
656
- onOptionChange: (e) => {
657
- o({
658
- ...t,
659
- to: e
660
- });
661
- },
662
- readOnly: n,
663
- sx: {
664
- flex: .6,
665
- minWidth: 0
666
- }
667
- })]
668
- });
669
- });
670
- Zo.displayName = "BetweenOption";
671
- var en = rt((e) => {
672
- const { option: t, onOptionChange: o, readOnly: n, ...r } = e, a = Ze(), i = Eo(), s = t?.isIFormula ? i.display(t) : t ?? "";
673
- return Ot(l, {
674
- size: "small",
675
- home: i.home,
676
- value: s,
677
- onChangeText: (e) => o(e.trim().length > 0 ? i.compile(e) : e),
678
- placeholder: a("condition.enterFormula"),
679
- disabled: n,
680
- fullWidth: !0,
681
- equals: "bare",
682
- label: null,
683
- showError: !1,
684
- helperText: null,
685
- ...r
686
- });
687
- });
688
- en.displayName = "ExpressionOption";
689
- var tn = rt((e) => {
690
- const { value: t = null, selectors: o, onChange: n, title: r, allowNull: a = !1, readOnly: l = !1, ...i } = e, s = Ze(), d = r ?? s("condition.selectorTitle"), c = o.map((e) => {
691
- const t = e.getName();
692
- return Ot(Jt, {
693
- value: t,
694
- children: e.getTitle?.() ?? e.getName()
695
- }, t);
696
- });
697
- let p = { backgroundColor: "background.paper" };
698
- return l && (p = {
699
- ...p,
700
- "& .MuiSelect-icon": { display: "none" },
701
- "& .MuiOutlinedInput-notchedOutline": { borderColor: "action.disabled" }
702
- }), Mt(Ht, {
703
- size: "small",
704
- ...i,
705
- children: [Ot(Qt, { children: d }), Mt(to, {
706
- value: t?.getName() ?? "null",
707
- label: d,
708
- readOnly: l,
709
- IconComponent: (e) => Ot(We, {
710
- iconKey: "ExpandMore",
711
- ...e
712
- }),
713
- onChange: (e) => {
714
- const t = e.target.value, r = "null" === t ? null : o.find((e) => e.getName() === t) ?? null;
715
- n(r);
716
- },
717
- sx: p,
718
- children: [a && Ot(Jt, {
719
- value: "null",
720
- children: s("condition.anySelector")
721
- }), c]
722
- })]
723
- });
724
- });
725
- tn.displayName = "SelectorSelect";
726
- var on = rt((e) => {
727
- const { value: t, operators: o, onChange: n, title: r, readOnly: a = !1, ...l } = e, i = Ze(), s = Ge(), d = r ?? i("condition.operatorTitle"), c = /* @__PURE__ */ new Map();
728
- o.forEach((e) => {
729
- c.set(e.getName(), e);
730
- });
731
- const p = qo(o, (e) => Ot(Jt, {
732
- value: e.getName(),
733
- sx: Yo,
734
- children: e.getTitle?.()
735
- }, e.getName()), i, s);
736
- return Mt(Ht, {
737
- size: "small",
738
- ...l,
739
- children: [Ot(Qt, { children: d }), Ot(to, {
740
- value: t?.getName() ?? "null",
741
- label: d,
742
- readOnly: a,
743
- IconComponent: (e) => Ot(We, {
744
- iconKey: "ExpandMore",
745
- ...e
746
- }),
747
- onChange: (e) => {
748
- const t = e.target.value, o = "null" === t ? null : c.get(t) ?? null;
749
- n(o);
750
- },
751
- sx: a ? {
752
- "& .MuiSelect-icon": { display: "none" },
753
- "& .MuiOutlinedInput-notchedOutline": { borderColor: "action.disabled" }
754
- } : void 0,
755
- children: p
756
- })]
757
- });
758
- });
759
- on.displayName = "OperatorSelect";
760
- var nn = rt(ot((e, t) => {
761
- const { icon: o, tooltip: n, label: r, darkMode: a, propsPanel: l, value: i, operators: s, onChange: d, title: c, readOnly: p = !1, ...u } = e, m = Ze(), g = Ge();
762
- c ?? m("condition.operatorTitle");
763
- const h = o || Ot(We, { iconKey: "Add" }), y = dt(d);
764
- return y.current = d, Ot(yt, {
765
- ref: t,
766
- createPopupPanel: at((e) => {
767
- const { closeFloatAll: t } = e, o = qo(s, (e) => Ot(Jt, {
768
- sx: Yo,
769
- value: e.getName(),
770
- onClick: () => {
771
- t?.(), y.current(e);
772
- },
773
- children: e.getTitle?.()
774
- }, e.getName()), m, g);
775
- return Ot("div", {
776
- style: {
777
- minWidth: 200,
778
- paddingTop: "8px",
779
- paddingBottom: "8px",
780
- ...l?.style
781
- },
782
- ...l,
783
- onKeyDown: (e) => {
784
- e.which === Ee.Enter && t?.();
785
- },
786
- children: Ot(Xt, {
787
- disablePadding: !0,
788
- children: o
789
- })
790
- });
791
- }, [
792
- s,
793
- m,
794
- g
795
- ]),
796
- tooltip: n || r || "When",
797
- label: r,
798
- disabled: p,
799
- icon: h,
800
- ...u
801
- });
802
- })), rn = rt((e) => {
803
- const { operator: t, inputs: o, onOptionChange: n, operators: r, selector: a, readOnly: l, ...i } = e, s = Ze(), d = "not" === t.getName(), c = d ? null : "and" === t.getName() ? s("condition.and") : s("condition.or"), p = (e, t) => {
804
- const r = o.slice(), a = {
805
- operator: t.operator,
806
- param: t.param
807
- };
808
- ((e, t) => {
809
- const o = Ko.get(e);
810
- o && Ko.set(t, o);
811
- })(o[e], a), r[e] = a, n(r);
812
- }, u = d ? s("condition.not") : c;
813
- return Ot(Bt, {
814
- sx: {
815
- display: "flex",
816
- flexDirection: "column",
817
- gap: .5,
818
- pl: 1,
819
- borderLeft: 2,
820
- borderColor: "divider"
821
- },
822
- ...i,
823
- children: o.map((e, t) => Ot(et.Fragment, { children: Ot(un, {
824
- operatorTitle: t > 0 ? u ?? "" : "",
825
- operatorParam: e,
826
- onOperatorParamChange: (e) => p(t, e),
827
- onRemove: () => ((e) => {
828
- const t = o.filter((t, o) => o !== e);
829
- n(t);
830
- })(t),
831
- operators: r,
832
- selector: a,
833
- readOnly: l,
834
- required: d
835
- }) }, _o(e)))
836
- });
837
- });
838
- rn.displayName = "CombinatorOption";
839
- var an = rt((e) => {
840
- const { option: t, onOptionChange: o, readOnly: n } = e, r = Ze();
841
- return Mt(so, {
842
- exclusive: !0,
843
- size: "small",
844
- value: t ?? !0,
845
- onChange: (e, t) => {
846
- null !== t && o(t);
847
- },
848
- sx: {
849
- my: 0,
850
- py: 0,
851
- backgroundColor: "background.paper"
852
- },
853
- disabled: n,
854
- children: [Ot(io, {
855
- value: !0,
856
- children: r("condition.true")
857
- }), Ot(io, {
858
- value: !1,
859
- children: r("condition.false")
860
- })]
861
- });
862
- });
863
- function ln(e, t) {
864
- if (!e) return sn(t);
865
- const o = /* @__PURE__ */ new Date(`${e}T${t || "00:00"}`);
866
- return isNaN(o.getTime()) ? null : o;
867
- }
868
- function sn(e) {
869
- return e ? ln("1970-01-01", e) : null;
870
- }
871
- an.displayName = "BooleanOption";
872
- var dn = rt((e) => {
873
- const { option: t, onOptionChange: o, allowFormula: n, readOnly: r, type: a = "dateTime", ...l } = e, i = Ze(), s = "date" === a || "dateTime" === a, d = "time" === a || "dateTime" === a, c = Te(), p = at((e) => {
874
- if (!c || null === e) return null;
875
- const t = c.createCell({ value: e }), o = t.getValue();
876
- return t.getType() !== G.Number ? null : o;
877
- }, [c]), u = at((e) => c ? c.createCell({
878
- value: e,
879
- style: { numberFormat: "Short DateTime" }
880
- }).getDate() : null, [c]);
881
- if (n && ("string" == typeof t || t?.isIFormula)) return Ot(Ro, {
882
- option: t,
883
- onOptionChange: (e) => o(e),
884
- readOnly: r,
885
- sx: l?.sx
886
- });
887
- const m = u(t ?? null), g = !(h = m) || isNaN(h.getTime()) ? "" : `${h.getFullYear()}-${String(h.getMonth() + 1).padStart(2, "0")}-${String(h.getDate()).padStart(2, "0")}`;
888
- var h;
889
- const y = function(e) {
890
- return !e || isNaN(e.getTime()) ? "" : `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}`;
891
- }(m);
892
- return Mt(Bt, {
893
- ...l,
894
- sx: {
895
- display: "flex",
896
- flexDirection: "row",
897
- gap: .5,
898
- ...l?.sx
899
- },
900
- children: [s && Ot(Io, {
901
- option: g,
902
- type: "date",
903
- placeholder: i("condition.enterDate"),
904
- onOptionChange: (e) => {
905
- const t = p(ln(e, y));
906
- o(t);
907
- },
908
- sx: { flex: 1.5 },
909
- readOnly: r
910
- }), d && Ot(Io, {
911
- option: y,
912
- type: "time",
913
- placeholder: i("condition.enterTime"),
914
- onOptionChange: (e) => {
915
- const t = p("time" === a ? sn(e) : ln(g, e));
916
- o(t);
917
- },
918
- sx: { flex: 1 },
919
- readOnly: r
920
- })]
921
- });
922
- });
923
- dn.displayName = "DateTimeOption";
924
- var cn = $.BuiltInOperatorNames, pn = /* @__PURE__ */ new Set([
925
- cn.EqualTo,
926
- cn.GreaterThan,
927
- cn.GreaterThanEqualTo,
928
- cn.LessThan,
929
- cn.LessThanEqualTo,
930
- cn.After,
931
- cn.AfterEqualTo,
932
- cn.Before,
933
- cn.BeforeEqualTo
934
- ]), un = rt((e) => {
935
- const { operatorParam: t, onOperatorParamChange: o, onRemove: n, operators: r, selector: a, operatorTitle: l, readOnly: i, required: s, ...d } = e, c = Ze(), p = l ?? c("condition.when"), u = t?.operator ?? null, m = r.find((e) => e.getName() === u) ?? null, g = t?.param ?? null, h = !!m?.isCombinator?.(), [y, { width: f }] = Fo(), b = st(() => !m || h ? null : m.getParamType?.(a ?? void 0) ?? null, [
936
- m,
937
- h,
938
- a
939
- ]), x = !h && "list" !== b && f > 360, v = _e((e) => {
940
- o({
941
- operator: u,
942
- param: e
943
- });
944
- }, [o, u]), C = st(() => {
945
- if (!m || h || !b) return null;
946
- const e = {
947
- sx: {
948
- flex: .6,
949
- minWidth: 0
950
- },
951
- option: g,
952
- onOptionChange: v
953
- }, t = !!u && pn.has(u);
954
- return b === $.BuiltInSelectorNames.Number || b === $.BuiltInSelectorNames.TextLength ? Ot(t ? Ro : Oo, { ...e }) : b === $.BuiltInSelectorNames.Whole ? t ? Ot(Ro, { ...e }) : Ot(Oo, {
955
- ...e,
956
- placeholder: c("condition.enterWholeNumber"),
957
- slotProps: { htmlInput: {
958
- step: 1,
959
- onKeyDown: (e) => {
960
- [
961
- ".",
962
- ",",
963
- "e",
964
- "E"
965
- ].includes(e.key) && e.preventDefault();
966
- },
967
- onPaste: (e) => {
968
- /^-?\d+$/.test(e.clipboardData.getData("text")) || e.preventDefault();
969
- }
970
- } }
971
- }) : b === $.BuiltInSelectorNames.Text ? Ot(t ? Ro : Io, { ...e }) : b === $.BuiltInSelectorNames.DateTime ? Ot(dn, {
972
- ...e,
973
- allowFormula: t
974
- }) : b === $.BuiltInSelectorNames.Date ? Ot(dn, {
975
- ...e,
976
- type: "date",
977
- allowFormula: t
978
- }) : b === $.BuiltInSelectorNames.Time ? Ot(dn, {
979
- ...e,
980
- type: "time",
981
- allowFormula: t
982
- }) : b === $.BuiltInSelectorNames.List ? Ot(Vo, { ...e }) : b === $.BuiltInSelectorNames.Logical ? Ot(an, { ...e }) : b === $.BuiltInOperatorNames.Average ? Ot(jo, { ...e }) : b === $.BuiltInOperatorNames.TimePeriod ? Ot(Jo, { ...e }) : b === $.BuiltInOperatorNames.TopN ? Ot(Xo, { ...e }) : b === $.BuiltInOperatorNames.Between ? Ot(Zo, { ...e }) : b === $.BuiltInOperatorNames.Expression ? Ot(en, { ...e }) : null;
983
- }, [
984
- m,
985
- h,
986
- b,
987
- g,
988
- c
989
- ]), k = st(() => h && g ? Array.isArray(g) ? g : [g] : [], [h, g]), w = h && "not" === m?.getName(), S = (e) => {
990
- if (!e || e === m) return;
991
- const t = !!e.isCombinator?.();
992
- let n;
993
- if (t && h) n = "not" === e.getName() ? k[0] ?? Go(e, r, a) : k.length > 0 ? k : Go(e, r, a);
994
- else {
995
- const o = m?.getParamType?.(a ?? void 0) ?? null, l = e.getParamType?.(a ?? void 0) ?? null;
996
- n = !t && l && l === o ? g : Go(e, r, a);
997
- }
998
- o({
999
- operator: e?.getName() ?? null,
1000
- param: n
1001
- });
1002
- };
1003
- return Ot(Bt, {
1004
- ref: y,
1005
- sx: {
1006
- display: "flex",
1007
- flexDirection: "column",
1008
- gap: .5,
1009
- backgroundColor: "background.paper",
1010
- border: 1,
1011
- borderColor: "divider",
1012
- borderRadius: 1,
1013
- p: 1
1014
- },
1015
- ...d,
1016
- children: x ? Mt(Bt, {
1017
- sx: {
1018
- display: "flex",
1019
- flexDirection: "row",
1020
- alignItems: "center",
1021
- gap: .5
1022
- },
1023
- children: [
1024
- Ot(on, {
1025
- title: p,
1026
- sx: { flex: .4 },
1027
- value: m,
1028
- operators: r,
1029
- onChange: S,
1030
- readOnly: i
1031
- }),
1032
- C,
1033
- !i && !s && Ot(ht, {
1034
- icon: Ot(We, { iconKey: "Close" }),
1035
- onClick: n
1036
- })
1037
- ]
1038
- }) : Mt(It, { children: [Mt(Bt, {
1039
- sx: {
1040
- display: "flex",
1041
- flexDirection: "row",
1042
- alignItems: "center",
1043
- gap: .5
1044
- },
1045
- children: [
1046
- Ot(on, {
1047
- title: p,
1048
- sx: { flex: 1 },
1049
- value: m,
1050
- operators: r,
1051
- onChange: S,
1052
- readOnly: i
1053
- }),
1054
- h && !w && !i && Ot(nn, {
1055
- label: m?.getTitle?.(),
1056
- icon: Ot(We, { iconKey: "Add" }),
1057
- operators: r,
1058
- value: null,
1059
- onChange: (e) => {
1060
- if (!e) return;
1061
- const t = Go(e, r, a), n = [...k, {
1062
- operator: e?.getName() ?? null,
1063
- param: t
1064
- }];
1065
- o({
1066
- operator: u,
1067
- param: n
1068
- });
1069
- }
1070
- }),
1071
- !i && !s && Ot(ht, {
1072
- icon: Ot(We, { iconKey: "Close" }),
1073
- disabled: i,
1074
- onClick: n
1075
- })
1076
- ]
1077
- }), h ? Ot(rn, {
1078
- operator: m,
1079
- inputs: k,
1080
- onOptionChange: (e) => {
1081
- o({
1082
- operator: u,
1083
- param: w ? e[0] ?? null : e
1084
- });
1085
- },
1086
- operators: r,
1087
- selector: a,
1088
- readOnly: i
1089
- }) : C] })
1090
- });
1091
- });
1092
- un.displayName = "OperatorAndParamEditor";
1093
- var mn = rt((e) => {
1094
- const { condition: t, onConditionChange: o, showIncludeBlanks: n = !1, selectorTitle: r, readOnly: a, operators: l, selectors: i, ranges: s, ...d } = e, c = Ze(), p = Ge(), [u, m] = ct(() => t?.getSelector() ?? null), [g, h] = ct(() => t?.getOperator() ? {
1095
- operator: t.getOperator().getName(),
1096
- param: t.getParam()
1097
- } : null), [y, f] = ct(() => t?.isIncludeBlanks() ?? !1);
1098
- it(() => {
1099
- if (!t) return m(null), void h(null);
1100
- const e = t.getOperator(), o = t.getSelector() ?? null;
1101
- m(o), h(e ? {
1102
- operator: e.getName(),
1103
- param: t.getParam()
1104
- } : null), f(t.isIncludeBlanks());
1105
- }, [t]);
1106
- const b = st(() => (i ?? Object.values(V.BuiltInSelectors)).slice().sort((e, t) => (e.getTitle?.() ?? "").localeCompare(t.getTitle?.() ?? "", p)), [i, p]), x = st(() => l ?? Object.values(V.BuiltInOperators), [l]), v = st(() => Uo(u, x, p), [
1107
- u,
1108
- x,
1109
- p
1110
- ]), C = dt(/* @__PURE__ */ new Map()), k = (e) => e?.getName() ?? "", w = dt(null), S = dt(!1);
1111
- it(() => {
1112
- if (!S.current) return;
1113
- S.current = !1;
1114
- const e = Array.from(w.current?.querySelectorAll("input:not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"hidden\"]):not([tabindex=\"-1\"]), textarea") ?? []).find((e) => !e.disabled && !e.readOnly && "true" !== e.getAttribute("aria-hidden"));
1115
- e && (e.focus(), e.select());
1116
- }, [u, g]);
1117
- const T = (e) => {
1118
- h(e), o?.({
1119
- selector: u,
1120
- ...e,
1121
- includeBlanks: y
1122
- });
1123
- }, F = n;
1124
- return Mt(Bt, {
1125
- sx: {
1126
- display: "flex",
1127
- flexDirection: "column",
1128
- p: 2,
1129
- pb: F ? 0 : 1,
1130
- gap: 1,
1131
- backgroundColor: "action.hover",
1132
- border: 1,
1133
- borderColor: "divider",
1134
- borderRadius: 1
1135
- },
1136
- ...d,
1137
- children: [
1138
- Ot(tn, {
1139
- title: r,
1140
- selectors: b,
1141
- value: u,
1142
- onChange: (e) => {
1143
- g && C.current.set(k(u), g);
1144
- const t = ((e) => {
1145
- const { from: t, to: o, current: n, remembered: r, operators: a, context: l } = e, i = Uo(o, a), s = (e) => e && i.find((t) => t.getName() === e) || null;
1146
- if (r && s(r.operator)) return r;
1147
- const d = s(n?.operator);
1148
- if (n && d) {
1149
- const e = (d.getParamType?.(t ?? void 0) ?? null) !== (d.getParamType?.(o ?? void 0) ?? null);
1150
- return d.isCombinator?.() || e ? {
1151
- operator: n.operator,
1152
- param: Go(d, i, o)
1153
- } : n;
1154
- }
1155
- const c = o?.getDefaultCondition?.(l) ?? null, p = s(c?.operator);
1156
- return c && p ? {
1157
- operator: c.operator,
1158
- param: void 0 !== c.param ? c.param : Go(p, i, o)
1159
- } : null;
1160
- })({
1161
- from: u,
1162
- to: e,
1163
- current: g,
1164
- remembered: C.current.get(k(e)) ?? null,
1165
- operators: x,
1166
- context: { ranges: s }
1167
- });
1168
- m(e), h(t), S.current = !0, o?.({
1169
- selector: e,
1170
- ...t ?? {
1171
- operator: null,
1172
- param: null
1173
- },
1174
- includeBlanks: y
1175
- });
1176
- },
1177
- allowNull: !0,
1178
- readOnly: a
1179
- }),
1180
- g ? Ot(Bt, {
1181
- ref: w,
1182
- sx: { display: "contents" },
1183
- children: Ot(un, {
1184
- operatorParam: g,
1185
- onOperatorParamChange: T,
1186
- onRemove: () => {
1187
- h(null), o?.({
1188
- selector: u,
1189
- operator: null,
1190
- param: null,
1191
- includeBlanks: y
1192
- });
1193
- },
1194
- operators: v,
1195
- selector: u,
1196
- readOnly: a
1197
- })
1198
- }) : !a && Ot(Bt, {
1199
- sx: { display: "flex" },
1200
- children: Ot(nn, {
1201
- label: c("condition.when"),
1202
- operators: v,
1203
- value: null,
1204
- onChange: (e) => {
1205
- e && (S.current = !0, T({
1206
- operator: e?.getName() ?? null,
1207
- param: Go(e, v, u)
1208
- }));
1209
- },
1210
- readOnly: a
1211
- })
1212
- }),
1213
- F && Ot(Ut, {
1214
- control: Ot(zt, {
1215
- checked: y,
1216
- onChange: (e) => {
1217
- t = e.target.checked, f(t), o?.({
1218
- selector: u,
1219
- ...g,
1220
- includeBlanks: t
1221
- });
1222
- return;
1223
- var t;
1224
- }
1225
- }),
1226
- disabled: a,
1227
- label: c("condition.ignoreBlanks")
1228
- })
1229
- ]
1230
- });
1231
- });
1232
- mn.displayName = "ConditionEditor";
1233
- var gn = rt((e) => {
1234
- const { variant: t = "format", children: o, sx: n, ...r } = e;
1235
- return Ot(Bt, {
1236
- className: `sxl-cf-rule-section sxl-cf-rule-section-${t}`,
1237
- sx: {
1238
- display: "flex",
1239
- flexDirection: "column",
1240
- gap: 1,
1241
- p: 2,
1242
- border: 1,
1243
- borderColor: "divider",
1244
- borderRadius: 1,
1245
- ..."config" === t ? { backgroundColor: "action.hover" } : null,
1246
- ...n
1247
- },
1248
- ...r,
1249
- children: o
1250
- });
1251
- });
1252
- gn.displayName = "RuleSection";
1253
- var hn = new R("transparent"), yn = {
1254
- lightRedFillDarkRedText: ko("conditionalFormat.preset.lightRedFillDarkRedText"),
1255
- yellowFillDarkYellowText: ko("conditionalFormat.preset.yellowFillDarkYellowText"),
1256
- greenFillDarkGreenText: ko("conditionalFormat.preset.greenFillDarkGreenText"),
1257
- lightRedFill: ko("conditionalFormat.preset.lightRedFill"),
1258
- redText: ko("conditionalFormat.preset.redText"),
1259
- redBorder: ko("conditionalFormat.preset.redBorder")
1260
- }, fn = (e) => e ? "string" == typeof e ? e : e.type === H.Type.None ? null : e.color ?? e.foreground ?? null : null, bn = (e, t) => "auto" === e ? null : W(e, t), xn = rt((n) => {
1261
- const { format: r, onFormatChange: a, readOnly: l, ...i } = n, s = Ze(), { workbook: d, schemeLookup: c, themeKey: p, darkMode: u, propsColorPanel: m } = B(), g = r?.font ?? null, h = (g?.weight ?? 400) >= 600, y = g?.style === U.Style.Italic, f = !!g?.underline && g.underline !== U.UnderlineStyle.None, b = !!g?.strike, x = (e) => {
1262
- const t = { ...g };
1263
- for (const [o, n] of Object.entries(e)) void 0 === n ? delete t[o] : t[o] = n;
1264
- const o = { ...r };
1265
- 0 === Object.keys(t).length ? delete o.font : o.font = t, a(0 === Object.keys(o).length ? null : o);
1266
- }, v = st(() => d?.getStyles().getNormal().getFont().getColor(), [d, p]), C = st(() => bn(g?.color, d), [
1267
- g?.color,
1268
- d,
1269
- p
1270
- ]), k = st(() => bn(fn(r?.fill), d), [
1271
- r?.fill,
1272
- d,
1273
- p
1274
- ]), w = {
1275
- padding: "4px",
1276
- border: "none",
1277
- borderRadius: 1
1278
- };
1279
- return Mt(gn, {
1280
- ...i,
1281
- children: [Mt(Bt, {
1282
- sx: {
1283
- display: "flex",
1284
- alignItems: "flex-start",
1285
- gap: 1
1286
- },
1287
- children: [Ot(Bt, {
1288
- sx: {
1289
- flex: "1 1 auto",
1290
- minWidth: 0,
1291
- display: "flex",
1292
- gap: .5,
1293
- flexWrap: "wrap"
1294
- },
1295
- children: ae.map((e, t) => {
1296
- const o = bn(fn(e.style.fill), d), n = bn(e.style.font?.color, d), r = e.style.borders ? bn(Object.values(e.style.borders)[0]?.color, d) : null;
1297
- return Ot(A, {
1298
- sheet: !0,
1299
- title: s(yn[e.key] ?? e.key),
1300
- disabled: l,
1301
- onClick: () => a(structuredClone(e.style)),
1302
- sx: {
1303
- backgroundColor: o?.toCSS("adaptive") ?? void 0,
1304
- color: n?.toCSS("adaptive") ?? void 0,
1305
- outline: r ? `1px solid ${r.toCSS("adaptive")}` : void 0,
1306
- outlineOffset: "-3px"
1307
- },
1308
- children: "Aa"
1309
- }, t);
1310
- })
1311
- }), Ot(A, {
1312
- title: s("conditionalFormat.clearStyle"),
1313
- disabled: l || !r,
1314
- onClick: () => a(null),
1315
- sx: {
1316
- color: "text.secondary",
1317
- "&:disabled": { opacity: .4 }
1318
- },
1319
- children: Ot(We, {
1320
- iconKey: "ClearFormats",
1321
- size: 16
1322
- })
1323
- })]
1324
- }), Mt(Bt, {
1325
- sx: {
1326
- display: "flex",
1327
- alignItems: "center",
1328
- gap: .25
1329
- },
1330
- children: [
1331
- Ot(io, {
1332
- value: "bold",
1333
- size: "small",
1334
- sx: w,
1335
- selected: h,
1336
- disabled: l,
1337
- onChange: () => x({ weight: h ? void 0 : 700 }),
1338
- children: Ot(We, { iconKey: "TextBold" })
1339
- }),
1340
- Ot(io, {
1341
- value: "italic",
1342
- size: "small",
1343
- sx: w,
1344
- selected: y,
1345
- disabled: l,
1346
- onChange: () => x({ style: y ? void 0 : U.Style.Italic }),
1347
- children: Ot(We, { iconKey: "TextItalic" })
1348
- }),
1349
- Ot(io, {
1350
- value: "underline",
1351
- size: "small",
1352
- sx: w,
1353
- selected: f,
1354
- disabled: l,
1355
- onChange: () => x({ underline: f ? void 0 : U.UnderlineStyle.Single }),
1356
- children: Ot(We, { iconKey: "TextUnderline" })
1357
- }),
1358
- Ot(io, {
1359
- value: "strike",
1360
- size: "small",
1361
- sx: w,
1362
- selected: b,
1363
- disabled: l,
1364
- onChange: () => x({ strike: !b || void 0 }),
1365
- children: Ot(We, { iconKey: "TextStrike" })
1366
- }),
1367
- d && Ot(t, {
1368
- tooltip: s("conditionalFormat.border"),
1369
- selectedBorder: r?.borders,
1370
- createBorder: (e) => d.getStyles().getNormal().createStyle({ borders: e }).getBorders(),
1371
- schemeLookup: c,
1372
- autoColor: v,
1373
- darkMode: u,
1374
- disabled: l,
1375
- onSelectBorder: (e) => ((e) => {
1376
- const t = { ...r };
1377
- e && 0 !== Object.keys(e).length ? t.borders = e : delete t.borders, a(0 === Object.keys(t).length ? null : t);
1378
- })(e)
1379
- }),
1380
- Ot(o, {
1381
- icon: "fill.colored",
1382
- tooltip: s("conditionalFormat.fillColor"),
1383
- selectedColor: k,
1384
- disabled: l,
1385
- onSelectColor: (e) => ((e) => {
1386
- const t = { ...r };
1387
- e ? t.fill = {
1388
- type: H.Type.Solid,
1389
- color: e.toString()
1390
- } : delete t.fill, a(0 === Object.keys(t).length ? null : t);
1391
- })(e),
1392
- darkMode: u,
1393
- propsPanel: {
1394
- disableAlpha: !0,
1395
- autoColor: hn,
1396
- autoColorLabelKey: ko("color.noFill"),
1397
- autoColorPosition: e.End,
1398
- ...m
1399
- }
1400
- }),
1401
- Ot(o, {
1402
- icon: "text.colored",
1403
- tooltip: s("conditionalFormat.fontColor"),
1404
- selectedColor: C,
1405
- disabled: l,
1406
- onSelectColor: (e) => x({ color: e ? e.toString() : void 0 }),
1407
- darkMode: u,
1408
- propsPanel: {
1409
- disableAlpha: !0,
1410
- autoColor: v,
1411
- ...m
1412
- }
1413
- })
1414
- ]
1415
- })]
1416
- });
1417
- });
1418
- xn.displayName = "ConditionalFormatStylePicker";
1419
- var vn = {
1420
- [K.ColorStopType.AutoMin]: ko("conditionalFormat.stopType.autoMin"),
1421
- [K.ColorStopType.AutoMax]: ko("conditionalFormat.stopType.autoMax"),
1422
- [K.ColorStopType.Min]: ko("conditionalFormat.stopType.min"),
1423
- [K.ColorStopType.Max]: ko("conditionalFormat.stopType.max"),
1424
- [K.ColorStopType.Num]: ko("conditionalFormat.stopType.num"),
1425
- [K.ColorStopType.Percent]: ko("conditionalFormat.stopType.percent"),
1426
- [K.ColorStopType.Percentile]: ko("conditionalFormat.stopType.percentile"),
1427
- [K.ColorStopType.Formula]: ko("conditionalFormat.stopType.formula")
1428
- }, Cn = /* @__PURE__ */ new Set([
1429
- K.ColorStopType.AutoMin,
1430
- K.ColorStopType.AutoMax,
1431
- K.ColorStopType.Min,
1432
- K.ColorStopType.Max
1433
- ]), kn = rt((e) => {
1434
- const { label: t, stop: n, onStopChange: r, allowedTypes: a, showColor: i = !1, leading: s, showExclusive: d = !1, readOnly: c, ...p } = e, u = Ze(), { darkMode: m, toColor: g, propsColorPanel: h } = B(), y = Eo(), f = n.type ?? K.ColorStopType.Num, b = !Cn.has(f), x = c || !b, v = f === K.ColorStopType.Formula, C = n.value?.isIFormula ? n.value : null, k = n.color, w = i ? g(k) : null;
1435
- return Mt(Bt, {
1436
- sx: {
1437
- display: "flex",
1438
- alignItems: "center",
1439
- gap: .5
1440
- },
1441
- ...p,
1442
- children: [
1443
- void 0 !== t && Ot(co, {
1444
- variant: "caption",
1445
- sx: {
1446
- color: "text.secondary",
1447
- flex: "0 0 62px",
1448
- minWidth: 0,
1449
- overflow: "hidden",
1450
- textOverflow: "ellipsis"
1451
- },
1452
- children: t
1453
- }),
1454
- s,
1455
- i && Ot(o, {
1456
- tooltip: u("conditionalFormat.stopColor"),
1457
- selectedColor: w,
1458
- disabled: c,
1459
- onSelectColor: (e) => {
1460
- e && r({
1461
- ...n,
1462
- color: e.toString()
1463
- });
1464
- },
1465
- darkMode: m,
1466
- propsPanel: {
1467
- disableAlpha: !0,
1468
- ...h
1469
- }
1470
- }),
1471
- d && Mt(to, {
1472
- size: "small",
1473
- value: n.exclusive ? "gt" : "gte",
1474
- disabled: c,
1475
- onChange: (e) => {
1476
- const t = { ...n };
1477
- "gt" === e.target.value ? t.exclusive = !0 : delete t.exclusive, r(t);
1478
- },
1479
- sx: {
1480
- flex: "0 0 auto",
1481
- backgroundColor: "background.paper"
1482
- },
1483
- children: [Ot(Jt, {
1484
- value: "gte",
1485
- children: ">="
1486
- }), Ot(Jt, {
1487
- value: "gt",
1488
- children: ">"
1489
- })]
1490
- }),
1491
- Ot(to, {
1492
- size: "small",
1493
- value: f,
1494
- disabled: c,
1495
- onChange: (e) => ((e) => {
1496
- const t = {
1497
- ...n,
1498
- type: e
1499
- };
1500
- if (Cn.has(e)) delete t.value;
1501
- else if (void 0 === t.value) t.value = e === K.ColorStopType.Formula ? "" : 0;
1502
- else if (e !== K.ColorStopType.Formula && "number" != typeof t.value) {
1503
- const e = "string" == typeof t.value ? Number(t.value) : NaN;
1504
- t.value = Number.isFinite(e) ? e : 0;
1505
- }
1506
- r(t);
1507
- })(e.target.value),
1508
- sx: {
1509
- flex: "1 1 40%",
1510
- minWidth: 0,
1511
- backgroundColor: "background.paper"
1512
- },
1513
- children: a.map((e) => Ot(Jt, {
1514
- value: e,
1515
- children: u(vn[e])
1516
- }, e))
1517
- }),
1518
- v ? Ot(l, {
1519
- size: "small",
1520
- home: y.home,
1521
- value: C ? y.display(C) : `${n.value ?? ""}`,
1522
- onChangeText: (e) => {
1523
- r({
1524
- ...n,
1525
- value: e.trim().length > 0 ? y.compile(e) : e
1526
- });
1527
- },
1528
- placeholder: u("conditionalFormat.enterFormula"),
1529
- disabled: x,
1530
- equals: "bare",
1531
- pickAs: "absolute",
1532
- label: null,
1533
- showError: !1,
1534
- helperText: null,
1535
- sx: {
1536
- flex: "1 1 30%",
1537
- minWidth: 0,
1538
- "& .MuiInputBase-root": { backgroundColor: x ? "action.disabledBackground" : "background.paper" }
1539
- }
1540
- }) : Ot(ao, {
1541
- size: "small",
1542
- type: "number",
1543
- placeholder: b ? void 0 : u("conditionalFormat.stopFromData"),
1544
- value: b ? `${n.value ?? ""}` : "",
1545
- disabled: x,
1546
- onChange: (e) => {
1547
- const t = e.target.value;
1548
- r({
1549
- ...n,
1550
- value: "" === t ? 0 : Number(t)
1551
- });
1552
- },
1553
- sx: {
1554
- flex: "1 1 30%",
1555
- minWidth: 0,
1556
- cursor: x ? "not-allowed" : void 0
1557
- },
1558
- slotProps: { input: { sx: {
1559
- backgroundColor: x ? "action.disabledBackground" : "background.paper",
1560
- cursor: x ? "not-allowed" : void 0
1561
- } } }
1562
- })
1563
- ]
1564
- });
1565
- });
1566
- kn.displayName = "ScaleStopRow";
1567
- var wn = [
1568
- K.ColorStopType.Min,
1569
- K.ColorStopType.Max,
1570
- K.ColorStopType.Num,
1571
- K.ColorStopType.Percent,
1572
- K.ColorStopType.Percentile,
1573
- K.ColorStopType.Formula
1574
- ], Sn = rt((e) => {
1575
- const { scale: t, onScaleChange: o, readOnly: n, ...r } = e, a = Ze(), { workbook: l, toColor: i } = B(), s = t.stops ?? [], d = 2 === s.length ? [ko("conditionalFormat.stop.minimum"), ko("conditionalFormat.stop.maximum")] : [
1576
- ko("conditionalFormat.stop.minimum"),
1577
- ko("conditionalFormat.stop.midpoint"),
1578
- ko("conditionalFormat.stop.maximum")
1579
- ];
1580
- return Mt(Bt, {
1581
- sx: {
1582
- display: "flex",
1583
- flexDirection: "column",
1584
- gap: 1
1585
- },
1586
- ...r,
1587
- children: [Ot(gn, { children: Mt(Bt, {
1588
- sx: {
1589
- display: "flex",
1590
- alignItems: "flex-start",
1591
- gap: 1
1592
- },
1593
- children: [Ot(Bt, {
1594
- sx: {
1595
- flex: "1 1 auto",
1596
- minWidth: 0,
1597
- display: "flex",
1598
- gap: .5,
1599
- flexWrap: "wrap"
1600
- },
1601
- children: Y.filter((e) => e.stops.length === (2 === s.length ? 2 : 3)).map((e, t) => Ot(A, {
1602
- sheet: !0,
1603
- disabled: n,
1604
- onClick: () => o(structuredClone(e)),
1605
- children: Ot(v, { rows: x(e.stops ?? [], b, l) })
1606
- }, t))
1607
- }), Mt(so, {
1608
- exclusive: !0,
1609
- size: "small",
1610
- value: 2 === s.length ? 2 : 3,
1611
- disabled: n,
1612
- onChange: (e, n) => {
1613
- n && ((e) => {
1614
- if (e === s.length || 2 !== e && 3 !== e) return;
1615
- const n = s.slice();
1616
- if (3 === e) {
1617
- let e = "#FFEB84";
1618
- const t = i(s[0]?.color ?? e)?.toRGBA(), o = i(s[s.length - 1]?.color ?? e)?.toRGBA();
1619
- if (t && o) {
1620
- const n = (e) => Math.round(e).toString(16).padStart(2, "0").toUpperCase();
1621
- e = `#${n((t.red + o.red) / 2)}${n((t.green + o.green) / 2)}${n((t.blue + o.blue) / 2)}`;
1622
- }
1623
- n.splice(1, 0, {
1624
- type: K.ColorStopType.Percentile,
1625
- value: 50,
1626
- color: e
1627
- });
1628
- } else n.splice(1, n.length - 2);
1629
- o({
1630
- ...t,
1631
- stops: n
1632
- });
1633
- })(n);
1634
- },
1635
- sx: { flex: "0 0 auto" },
1636
- children: [Ot(io, {
1637
- value: 2,
1638
- sx: {
1639
- textTransform: "none",
1640
- pt: .25,
1641
- pb: .25
1642
- },
1643
- children: a("conditionalFormat.twoColor")
1644
- }), Ot(io, {
1645
- value: 3,
1646
- sx: {
1647
- textTransform: "none",
1648
- pt: .25,
1649
- pb: .25
1650
- },
1651
- children: a("conditionalFormat.threeColor")
1652
- })]
1653
- })]
1654
- }) }), Ot(gn, {
1655
- variant: "config",
1656
- children: s.map((e, r) => Ot(kn, {
1657
- label: a(d[Math.min(r, d.length - 1)]),
1658
- stop: e,
1659
- allowedTypes: wn,
1660
- showColor: !0,
1661
- readOnly: n,
1662
- onStopChange: (e) => {
1663
- const n = s.slice();
1664
- n[r] = e, o({
1665
- ...t,
1666
- stops: n
1667
- });
1668
- }
1669
- }, r))
1670
- })]
1671
- });
1672
- });
1673
- Sn.displayName = "ColorScaleRulePanel";
1674
- var Tn = [
1675
- K.ColorStopType.AutoMin,
1676
- K.ColorStopType.Min,
1677
- K.ColorStopType.Num,
1678
- K.ColorStopType.Percent,
1679
- K.ColorStopType.Percentile,
1680
- K.ColorStopType.Formula
1681
- ], Fn = [
1682
- K.ColorStopType.AutoMax,
1683
- K.ColorStopType.Max,
1684
- K.ColorStopType.Num,
1685
- K.ColorStopType.Percent,
1686
- K.ColorStopType.Percentile,
1687
- K.ColorStopType.Formula
1688
- ], Dn = "__auto__", Nn = rt((e) => {
1689
- const { scale: t, onScaleChange: n, readOnly: r, ...a } = e, l = Ze(), { darkMode: i, toColor: s, propsColorPanel: d } = B(), c = t.stops ?? [], p = s(t.color), m = s(t.negativeFillColor), g = s(t.borderColor), h = s(t.negativeBorderColor), y = t.gradient ?? !1, f = (e) => {
1690
- const o = { ...t };
1691
- for (const [t, n] of Object.entries(e)) void 0 === n ? delete o[t] : o[t] = n;
1692
- n(o);
1693
- }, b = { backgroundColor: "background.paper" };
1694
- return Mt(Bt, {
1695
- sx: {
1696
- display: "flex",
1697
- flexDirection: "column",
1698
- gap: 1
1699
- },
1700
- ...a,
1701
- children: [Mt(gn, { children: [
1702
- Mt(Bt, {
1703
- sx: {
1704
- display: "flex",
1705
- alignItems: "flex-start",
1706
- gap: 1
1707
- },
1708
- children: [Ot(Bt, {
1709
- sx: {
1710
- flex: "1 1 auto",
1711
- minWidth: 0,
1712
- display: "flex",
1713
- gap: .5,
1714
- flexWrap: "wrap"
1715
- },
1716
- children: X.filter((e) => (e.gradient ?? !1) === y).map((e, t) => Ot(A, {
1717
- sheet: !0,
1718
- disabled: r,
1719
- onClick: () => f({
1720
- color: e.color,
1721
- gradient: e.gradient,
1722
- borderColor: e.borderColor
1723
- }),
1724
- children: Ot(v, { rows: u(e, s(e.color)?.toCSS("adaptive") ?? "var(--sxl-color-primary, rgb(33, 115, 70))") })
1725
- }, t))
1726
- }), Mt(so, {
1727
- exclusive: !0,
1728
- size: "small",
1729
- value: y,
1730
- disabled: r,
1731
- onChange: (e, t) => {
1732
- null !== t && f({ gradient: !!t || void 0 });
1733
- },
1734
- sx: { flex: "0 0 auto" },
1735
- children: [Ot(io, {
1736
- value: !1,
1737
- sx: {
1738
- textTransform: "none",
1739
- pt: .25,
1740
- pb: .25
1741
- },
1742
- children: l("conditionalFormat.solidFill")
1743
- }), Ot(io, {
1744
- value: !0,
1745
- sx: {
1746
- textTransform: "none",
1747
- pt: .25,
1748
- pb: .25
1749
- },
1750
- children: l("conditionalFormat.gradientFill")
1751
- })]
1752
- })]
1753
- }),
1754
- Ot(Ut, {
1755
- control: Ot(zt, {
1756
- size: "small",
1757
- checked: !1 === t.showValue,
1758
- disabled: r,
1759
- onChange: (e) => f({ showValue: !e.target.checked && void 0 })
1760
- }),
1761
- label: Ot(co, {
1762
- variant: "body2",
1763
- children: l("conditionalFormat.showBarsOnly")
1764
- })
1765
- }),
1766
- Mt(Bt, {
1767
- sx: {
1768
- display: "flex",
1769
- alignItems: "center",
1770
- gap: .5
1771
- },
1772
- children: [
1773
- Ot(co, {
1774
- variant: "caption",
1775
- sx: {
1776
- color: "text.secondary",
1777
- flex: "0 0 62px"
1778
- },
1779
- children: l("conditionalFormat.bar")
1780
- }),
1781
- Ot(o, {
1782
- icon: "fill.colored",
1783
- tooltip: l("conditionalFormat.barColor"),
1784
- selectedColor: p,
1785
- disabled: r,
1786
- onSelectColor: (e) => f({ color: e ? e.toString() : void 0 }),
1787
- darkMode: i,
1788
- propsPanel: {
1789
- disableAlpha: !0,
1790
- ...d
1791
- }
1792
- }),
1793
- Ot(o, {
1794
- icon: "stroke.colored",
1795
- tooltip: l("conditionalFormat.barBorderColor"),
1796
- selectedColor: g,
1797
- disabled: r,
1798
- onSelectColor: (e) => f({ borderColor: e ? e.toString() : void 0 }),
1799
- darkMode: i,
1800
- propsPanel: {
1801
- disableAlpha: !0,
1802
- ...d
1803
- }
1804
- })
1805
- ]
1806
- }),
1807
- Mt(Bt, {
1808
- sx: {
1809
- display: "flex",
1810
- alignItems: "center",
1811
- gap: .5
1812
- },
1813
- children: [
1814
- Ot(co, {
1815
- variant: "caption",
1816
- sx: {
1817
- color: "text.secondary",
1818
- flex: "0 0 62px"
1819
- },
1820
- children: l("conditionalFormat.negative")
1821
- }),
1822
- Ot(o, {
1823
- icon: "fill.colored",
1824
- tooltip: l("conditionalFormat.negativeColor"),
1825
- selectedColor: m ?? p,
1826
- disabled: r,
1827
- onSelectColor: (e) => f({ negativeFillColor: e ? e.toString() : void 0 }),
1828
- darkMode: i,
1829
- propsPanel: {
1830
- disableAlpha: !0,
1831
- ...d
1832
- }
1833
- }),
1834
- Ot(o, {
1835
- icon: "stroke.colored",
1836
- tooltip: l("conditionalFormat.negativeBorderColor"),
1837
- selectedColor: h ?? g,
1838
- disabled: r,
1839
- onSelectColor: (e) => f({ negativeBorderColor: e ? e.toString() : void 0 }),
1840
- darkMode: i,
1841
- propsPanel: {
1842
- disableAlpha: !0,
1843
- ...d
1844
- }
1845
- }),
1846
- Ot(A, {
1847
- title: l("conditionalFormat.sameAsPositive"),
1848
- disabled: r || !t.negativeFillColor && !t.negativeBorderColor,
1849
- onClick: () => f({
1850
- negativeFillColor: void 0,
1851
- negativeBorderColor: void 0
1852
- }),
1853
- sx: {
1854
- color: "text.secondary",
1855
- "&:disabled": { opacity: .4 }
1856
- },
1857
- children: Ot(We, {
1858
- iconKey: "ClearFormats",
1859
- size: 16
1860
- })
1861
- })
1862
- ]
1863
- }),
1864
- Mt(Bt, {
1865
- sx: {
1866
- display: "flex",
1867
- gap: 1,
1868
- mt: .5
1869
- },
1870
- children: [Mt(Ht, {
1871
- size: "small",
1872
- sx: {
1873
- flex: 1,
1874
- minWidth: 0
1875
- },
1876
- children: [Ot(Qt, { children: l("conditionalFormat.axis") }), Mt(to, {
1877
- label: l("conditionalFormat.axis"),
1878
- value: t.axisPosition ?? Dn,
1879
- disabled: r,
1880
- sx: b,
1881
- onChange: (e) => {
1882
- const t = e.target.value;
1883
- f({ axisPosition: t === Dn ? void 0 : t });
1884
- },
1885
- children: [
1886
- Ot(Jt, {
1887
- value: Dn,
1888
- children: l("conditionalFormat.automatic")
1889
- }),
1890
- Ot(Jt, {
1891
- value: "middle",
1892
- children: l("conditionalFormat.axisMiddle")
1893
- }),
1894
- Ot(Jt, {
1895
- value: "none",
1896
- children: l("conditionalFormat.axisNone")
1897
- })
1898
- ]
1899
- })]
1900
- }), Mt(Ht, {
1901
- size: "small",
1902
- sx: {
1903
- flex: 1,
1904
- minWidth: 0
1905
- },
1906
- children: [Ot(Qt, { children: l("conditionalFormat.direction") }), Mt(to, {
1907
- label: l("conditionalFormat.direction"),
1908
- value: t.direction ?? Dn,
1909
- disabled: r,
1910
- sx: b,
1911
- onChange: (e) => {
1912
- const t = e.target.value;
1913
- f({ direction: t === Dn ? void 0 : t });
1914
- },
1915
- children: [
1916
- Ot(Jt, {
1917
- value: Dn,
1918
- children: l("conditionalFormat.automatic")
1919
- }),
1920
- Ot(Jt, {
1921
- value: "leftToRight",
1922
- children: l("conditionalFormat.leftToRight")
1923
- }),
1924
- Ot(Jt, {
1925
- value: "rightToLeft",
1926
- children: l("conditionalFormat.rightToLeft")
1927
- })
1928
- ]
1929
- })]
1930
- })]
1931
- })
1932
- ] }), Mt(gn, {
1933
- variant: "config",
1934
- children: [Ot(kn, {
1935
- label: l("conditionalFormat.stop.minimum"),
1936
- stop: c[0] ?? { type: K.ColorStopType.AutoMin },
1937
- allowedTypes: Tn,
1938
- readOnly: r,
1939
- onStopChange: (e) => {
1940
- const t = c.slice();
1941
- t[0] = e, f({ stops: t });
1942
- }
1943
- }), Ot(kn, {
1944
- label: l("conditionalFormat.stop.maximum"),
1945
- stop: c[1] ?? { type: K.ColorStopType.AutoMax },
1946
- allowedTypes: Fn,
1947
- readOnly: r,
1948
- onStopChange: (e) => {
1949
- const t = c.slice();
1950
- for (; t.length < 2;) t.push({ type: K.ColorStopType.AutoMax });
1951
- t[1] = e, f({ stops: t });
1952
- }
1953
- })]
1954
- })]
1955
- });
1956
- });
1957
- Nn.displayName = "DataBarRulePanel";
1958
- var Pn = ko("conditionalFormat.noCellIcon"), In = ko("conditionalFormat.cellIcon"), On = {
1959
- borderColor: "primary.main",
1960
- boxShadow: (e) => `inset 0 0 0 1px ${e.palette.primary.main}`
1961
- }, Mn = {
1962
- width: "28px",
1963
- height: "26px"
1964
- }, An = rt((e) => {
1965
- const { icon: t, onPick: o } = e, n = Ze();
1966
- return Mt(Bt, {
1967
- sx: {
1968
- display: "flex",
1969
- flexDirection: "column",
1970
- gap: "4px",
1971
- padding: "6px 8px"
1972
- },
1973
- children: [Ot(A, {
1974
- sheet: !0,
1975
- title: n(Pn),
1976
- "aria-pressed": null === t,
1977
- sx: {
1978
- ...Mn,
1979
- ...null === t ? On : null
1980
- },
1981
- onClick: () => {
1982
- o({ ...ne });
1983
- },
1984
- children: Ot(te, {
1985
- icons: [null],
1986
- size: 16
1987
- })
1988
- }), Ot(Bt, {
1989
- sx: {
1990
- display: "grid",
1991
- gridTemplateColumns: "repeat(8, auto)",
1992
- justifyContent: "start",
1993
- gap: "3px"
1994
- },
1995
- children: ee.map((e) => {
1996
- const r = (a = t, l = e.spec, !!a && a.iconKey === l.iconKey && a.color === l.color);
1997
- var a, l;
1998
- return Ot(A, {
1999
- sheet: !0,
2000
- title: k(n, e.spec),
2001
- "aria-pressed": r,
2002
- sx: {
2003
- ...Mn,
2004
- ...r ? On : null
2005
- },
2006
- onClick: () => {
2007
- o({
2008
- set: e.set,
2009
- id: e.id
2010
- });
2011
- },
2012
- children: Ot(te, {
2013
- icons: [e.spec],
2014
- size: 16
2015
- })
2016
- }, `${e.set}:${e.id}`);
2017
- })
2018
- })]
2019
- });
2020
- });
2021
- An.displayName = "IconCatalogPanel";
2022
- var Wn = rt(ot((e, t) => {
2023
- const { icon: o, onPick: n, tooltip: r, ...a } = e, l = Ze();
2024
- return Ot(yt, {
2025
- ref: t,
2026
- createPopupPanel: at((e) => {
2027
- const { closeFloat: t } = e, r = Ot(An, {
2028
- icon: o,
2029
- onPick: (e) => {
2030
- t?.(), n(e);
2031
- }
2032
- });
2033
- return kt({
2034
- ...e,
2035
- children: r
2036
- });
2037
- }, [o, n]),
2038
- tooltip: r ?? l(In),
2039
- icon: Ot(te, {
2040
- icons: [o],
2041
- size: 16
2042
- }),
2043
- outlined: !0,
2044
- ...a
2045
- });
2046
- }));
2047
- Wn.displayName = "IconPickerPopupButton";
2048
- var En = [
2049
- K.ColorStopType.Percent,
2050
- K.ColorStopType.Num,
2051
- K.ColorStopType.Percentile,
2052
- K.ColorStopType.Formula
2053
- ], Bn = rt((e) => {
2054
- const { scale: t, onScaleChange: o, readOnly: n, ...r } = e, a = Ze(), l = t.iconSet ?? q.IconSet.TrafficLights3, i = 0 === be(l).length, s = t.stops ?? [], d = s.length, c = ve(t), p = (e) => {
2055
- const n = { ...t };
2056
- for (const [t, o] of Object.entries(e)) void 0 === o ? delete n[t] : n[t] = o;
2057
- o(n);
2058
- }, u = at((e) => {
2059
- const { closeFloat: t } = e, o = Ot(h, {
2060
- groups: I,
2061
- disabled: n,
2062
- onPick: (e) => {
2063
- t?.(), e.type === K.ScaleType.IconSet && e.iconSet && ((e) => {
2064
- if (e === l) return;
2065
- const t = xe(e);
2066
- let o = s;
2067
- t !== s.length && (o = fe(t)), p({
2068
- iconSet: e,
2069
- stops: o,
2070
- icon: void 0
2071
- });
2072
- })(e.iconSet);
2073
- }
2074
- });
2075
- return kt({
2076
- ...e,
2077
- children: o
2078
- });
2079
- }, [n, t]), m = L.camelToPrettyCase(l);
2080
- return Mt(Bt, {
2081
- sx: {
2082
- display: "flex",
2083
- flexDirection: "column",
2084
- gap: 1
2085
- },
2086
- ...r,
2087
- children: [Mt(gn, { children: [
2088
- Ot(Bt, {
2089
- sx: {
2090
- display: "flex",
2091
- alignItems: "center",
2092
- gap: 1
2093
- },
2094
- children: Ot(yt, {
2095
- outlined: !0,
2096
- disabled: n,
2097
- label: m,
2098
- tooltip: m,
2099
- icon: Ot(Bt, {
2100
- sx: {
2101
- width: "82px",
2102
- display: "flex",
2103
- justifyContent: "center"
2104
- },
2105
- children: i ? Ot(co, {
2106
- variant: "caption",
2107
- noWrap: !0,
2108
- children: m
2109
- }) : Ot(te, {
2110
- icons: be(l),
2111
- order: "descending",
2112
- size: 14,
2113
- gap: 3
2114
- })
2115
- }),
2116
- createPopupPanel: u
2117
- })
2118
- }),
2119
- i && Ot(co, {
2120
- variant: "caption",
2121
- sx: { color: "text.secondary" },
2122
- children: a("conditionalFormat.adoptedIconSet")
2123
- }),
2124
- Mt(Bt, {
2125
- sx: {
2126
- display: "flex",
2127
- gap: 1
2128
- },
2129
- children: [Ot(Ut, {
2130
- control: Ot(zt, {
2131
- size: "small",
2132
- checked: !1 === t.showValue,
2133
- disabled: n,
2134
- onChange: (e) => p({ showValue: !e.target.checked && void 0 })
2135
- }),
2136
- label: Ot(co, {
2137
- variant: "body2",
2138
- children: a("conditionalFormat.showIconsOnly")
2139
- })
2140
- }), Ot(Ut, {
2141
- control: Ot(zt, {
2142
- size: "small",
2143
- checked: t.reverse ?? !1,
2144
- disabled: n,
2145
- onChange: (e) => p({ reverse: !!e.target.checked || void 0 })
2146
- }),
2147
- label: Ot(co, {
2148
- variant: "body2",
2149
- children: a("conditionalFormat.reverseIcons")
2150
- })
2151
- })]
2152
- })
2153
- ] }), Ot(gn, {
2154
- variant: "config",
2155
- children: s.map((e, r) => {
2156
- const a = t.reverse ? d - 1 - r : r;
2157
- return Ot(kn, {
2158
- stop: e,
2159
- allowedTypes: En,
2160
- showExclusive: !0,
2161
- readOnly: n || 0 === r,
2162
- leading: Ot(Wn, {
2163
- icon: c[r] ?? null,
2164
- disabled: n || i,
2165
- onPick: (e) => o(Ie(t, a, e))
2166
- }),
2167
- onStopChange: (e) => {
2168
- const t = s.slice();
2169
- t[r] = e, p({ stops: t });
2170
- }
2171
- }, r);
2172
- })
2173
- })]
2174
- });
2175
- });
2176
- Bn.displayName = "IconSetRulePanel";
2177
- var Rn = (e, t, o) => W(e, t)?.toCSS("adaptive") ?? o, Ln = (e, t, o) => {
2178
- if (!e) return o;
2179
- if ("string" == typeof e) return Rn(e, t, o);
2180
- if (e.type === H.Type.None) return o;
2181
- const n = e, r = e;
2182
- return Rn(r.foreground ?? n.color ?? r.background, t, o);
2183
- }, Vn = rt((e) => {
2184
- const { conditionalFormat: t, size: o = 28, ...n } = e, { workbook: r, themeKey: a } = B();
2185
- ke(t, "onAnyChange");
2186
- const l = t.getScale(), i = t.getStyle(), s = st(() => {
2187
- try {
2188
- return r?.getStyles().getNormal().getFont().toCSS("adaptive") ?? {};
2189
- } catch {
2190
- return {};
2191
- }
2192
- }, [r, a]), d = st(() => {
2193
- if (l?.type === K.ScaleType.ColorScale) return Ot(v, { rows: x(l.stops ?? [], b, r) });
2194
- if (l?.type === K.ScaleType.DataBar) return Ot(v, { rows: u(l, Rn(l.color, r, f), l.borderColor ? Rn(l.borderColor, r, f) : void 0) });
2195
- if (l?.type === K.ScaleType.IconSet) return Ot(Bt, {
2196
- sx: {
2197
- display: "flex",
2198
- alignItems: "center",
2199
- justifyContent: "center",
2200
- width: "100%",
2201
- height: "100%",
2202
- px: .5
2203
- },
2204
- children: Ot(te, {
2205
- icons: ve(l),
2206
- order: "descending",
2207
- size: 14,
2208
- gap: 3
2209
- })
2210
- });
2211
- const e = i?.font, t = e?.underline && e.underline !== U.UnderlineStyle.None;
2212
- return Ot(Bt, {
2213
- sx: {
2214
- width: "100%",
2215
- height: "100%",
2216
- display: "flex",
2217
- alignItems: "center",
2218
- justifyContent: "center",
2219
- ...s,
2220
- backgroundColor: Ln(i?.fill, r, "transparent"),
2221
- ...e?.color && "auto" !== e.color ? { color: Rn(e.color, r, w) } : null,
2222
- ...e?.weight ? { fontWeight: e.weight } : null,
2223
- ...e?.style ? { fontStyle: e.style } : null,
2224
- textDecoration: [t ? "underline" : "", e?.strike ? "line-through" : ""].join(" ").trim() || "none",
2225
- fontSize: `${Math.round(.5 * o)}px`,
2226
- lineHeight: 1,
2227
- outline: i?.borders ? `1px solid ${Rn(Object.values(i.borders)[0]?.color, r, T)}` : void 0,
2228
- outlineOffset: "-3px"
2229
- },
2230
- children: "Aa"
2231
- });
2232
- }, [
2233
- l,
2234
- i,
2235
- o,
2236
- s,
2237
- r,
2238
- a
2239
- ]);
2240
- return Ot(A, {
2241
- sheet: !0,
2242
- className: "sxl-cf-rule-preview",
2243
- sx: {
2244
- width: "auto",
2245
- minWidth: 1.7 * o + "px",
2246
- height: `${o}px`
2247
- },
2248
- ...n,
2249
- children: d
2250
- });
2251
- });
2252
- Vn.displayName = "RulePreview";
2253
- var zn = (e, t) => {
2254
- const o = e.getCondition()?.toString();
2255
- if (o) return o;
2256
- const n = e.getScale();
2257
- return n ? L.camelToPrettyCase(n.type) : t("conditionalFormat.noCondition");
2258
- }, jn = {
2259
- classic: ko("conditionalFormat.tab.classic"),
2260
- [K.ScaleType.ColorScale]: ko("conditionalFormat.tab.colorScale"),
2261
- [K.ScaleType.DataBar]: ko("conditionalFormat.tab.dataBars"),
2262
- [K.ScaleType.IconSet]: ko("conditionalFormat.tab.iconSets")
2263
- }, $n = rt((e) => {
2264
- const { conditionalFormat: t } = e, o = Ze();
2265
- ke(t, "onAnyChange");
2266
- const n = t.getScale(), r = t.getCondition(), a = t.getStyle(), l = t.isProtected(), i = n?.type ?? "classic", s = dt({ scales: {} }), c = (e) => {
2267
- t.update({ scale: e });
2268
- }, p = Mt(Zt, {
2269
- tabIndex: 0,
2270
- className: d["editor-panel"],
2271
- sx: {
2272
- gap: (e) => e.spacing(1),
2273
- paddingTop: (e) => e.spacing(1.25),
2274
- paddingBottom: (e) => e.spacing(2),
2275
- paddingLeft: (e) => e.spacing(1.5),
2276
- paddingRight: (e) => e.spacing(1.5),
2277
- border: (e) => `1px solid ${e.palette.divider}`,
2278
- borderRadius: (e) => e.spacing(1.25),
2279
- overflow: "auto"
2280
- },
2281
- children: [
2282
- Mt(Bt, {
2283
- sx: {
2284
- display: "flex",
2285
- flexDirection: "column",
2286
- gap: (e) => e.spacing(1.75),
2287
- margin: (e) => e.spacing(1.25),
2288
- marginBottom: 0
2289
- },
2290
- children: [Mt(Bt, {
2291
- sx: {
2292
- display: "flex",
2293
- alignItems: "center",
2294
- gap: (e) => e.spacing(1.5)
2295
- },
2296
- children: [Ot(Vn, {
2297
- conditionalFormat: t,
2298
- size: 48
2299
- }), Ot(co, {
2300
- variant: "body2",
2301
- sx: {
2302
- minWidth: 0,
2303
- wordBreak: "break-word"
2304
- },
2305
- children: zn(t, o)
2306
- })]
2307
- }), Ot(g, {
2308
- item: t,
2309
- label: o("conditionalFormat.applyTo")
2310
- })]
2311
- }),
2312
- Ot(ro, {
2313
- value: i,
2314
- onChange: (e, o) => {
2315
- l || ((e) => {
2316
- if (e !== i) if ("classic" === i ? (s.current.condition = r?.toJSON() ?? null, s.current.style = a) : n && (s.current.scales[n.type] = n), "classic" === e) t.update({
2317
- condition: s.current.condition ?? {
2318
- operator: $.BuiltInOperatorNames.Between,
2319
- param: null
2320
- },
2321
- style: s.current.style ?? null,
2322
- scale: null
2323
- });
2324
- else {
2325
- const o = s.current.scales[e] ?? (e === K.ScaleType.ColorScale ? ge() : e === K.ScaleType.DataBar ? he() : ye());
2326
- t.update({
2327
- scale: o,
2328
- condition: null,
2329
- style: null
2330
- });
2331
- }
2332
- })(o);
2333
- },
2334
- variant: "fullWidth",
2335
- sx: {
2336
- minHeight: "36px",
2337
- borderBottom: 1,
2338
- borderColor: "divider",
2339
- "& .MuiTab-root": {
2340
- minHeight: "36px",
2341
- textTransform: "none",
2342
- pt: .5,
2343
- pb: .5,
2344
- px: .5,
2345
- minWidth: 0
2346
- }
2347
- },
2348
- children: Object.keys(jn).map((e) => Ot(no, {
2349
- value: e,
2350
- label: o(jn[e])
2351
- }, e))
2352
- }),
2353
- "classic" === i && Mt(It, { children: [Ot(xn, {
2354
- format: a,
2355
- readOnly: l,
2356
- onFormatChange: (e) => t.update({ style: e })
2357
- }), Ot(mn, {
2358
- selectorTitle: o("conditionalFormat.highlight"),
2359
- condition: r,
2360
- ranges: t.getRanges(),
2361
- readOnly: l,
2362
- onConditionChange: (e) => t.setCondition(e)
2363
- })] }),
2364
- n?.type === K.ScaleType.ColorScale && Ot(Sn, {
2365
- scale: n,
2366
- onScaleChange: c,
2367
- readOnly: l
2368
- }),
2369
- n?.type === K.ScaleType.DataBar && Ot(Nn, {
2370
- scale: n,
2371
- onScaleChange: c,
2372
- readOnly: l
2373
- }),
2374
- n?.type === K.ScaleType.IconSet && Ot(Bn, {
2375
- scale: n,
2376
- onScaleChange: c,
2377
- readOnly: l
2378
- }),
2379
- "classic" === i && Ot(Bt, {
2380
- sx: {
2381
- pl: 2,
2382
- pr: 2,
2383
- border: 1,
2384
- borderColor: "divider",
2385
- borderRadius: 1
2386
- },
2387
- children: Ot(Ut, {
2388
- control: Ot(zt, {
2389
- checked: t.isStopIfTrue(),
2390
- disabled: l,
2391
- onChange: (e) => t.setStopIfTrue(e.target.checked)
2392
- }),
2393
- label: o("conditionalFormat.stopIfTrue")
2394
- })
2395
- })
2396
- ]
2397
- });
2398
- return Ot(Mo.Provider, {
2399
- value: t,
2400
- children: p
2401
- });
2402
- });
2403
- $n.displayName = "ConditionalFormatEditorPanel";
2404
- var Kn = rt(({ item: e }) => {
2405
- const t = Ze();
2406
- return ke(e, "onAnyChange"), !e.isStopIfTrue() || e.getScale() ? null : Ot(Bt, {
2407
- sx: {
2408
- display: "inline-flex",
2409
- alignItems: "center",
2410
- alignSelf: "flex-start",
2411
- px: .75,
2412
- py: .25,
2413
- border: 1,
2414
- borderColor: "divider",
2415
- borderRadius: 1,
2416
- color: "text.secondary"
2417
- },
2418
- children: Ot(co, {
2419
- variant: "caption",
2420
- children: t("conditionalFormat.stopIfTrue")
2421
- })
2422
- });
2423
- });
2424
- Kn.displayName = "StopIfTrueBadge";
2425
- var _n = rt(({ item: e }) => Ot(g, {
2426
- item: e,
2427
- label: Ze()("conditionalFormat.applyTo"),
2428
- helperText: null
2429
- }));
2430
- _n.displayName = "ConditionalFormatCardRanges";
2431
- var Hn = {
2432
- key: "conditional-format",
2433
- messageKeys: {
2434
- none: ko("conditionalFormat.none"),
2435
- addPrompt: ko("conditionalFormat.addPrompt"),
2436
- heading: ko("conditionalFormat.heading"),
2437
- insert: ko("conditionalFormat.insert"),
2438
- new: ko("conditionalFormat.new"),
2439
- moveUp: ko("conditionalFormat.moveUp"),
2440
- moveDown: ko("conditionalFormat.moveDown"),
2441
- edit: ko("conditionalFormat.edit"),
2442
- duplicate: ko("conditionalFormat.duplicate"),
2443
- delete: ko("conditionalFormat.delete"),
2444
- cancel: ko("conditionalFormat.cancel"),
2445
- save: ko("conditionalFormat.save")
2446
- },
2447
- getCollection: (e) => e.getConditionalFormats(),
2448
- changeEvents: ["onConditionalFormatsChange"],
2449
- isReadOnly: (e) => !e.getProtection().isFormatCellsAllowed(),
2450
- applyUpdate: (e, t) => {
2451
- e.update(t);
2452
- },
2453
- applySeed: (e, t) => {
2454
- e.update({
2455
- condition: t.condition ?? null,
2456
- style: t.style ?? null,
2457
- scale: t.scale ?? null,
2458
- stopIfTrue: t.stopIfTrue ?? !1
2459
- });
2460
- },
2461
- getCardTitle: zn,
2462
- CardMedia: ({ item: e }) => Ot(Vn, {
2463
- conditionalFormat: e,
2464
- size: 32
2465
- }),
2466
- CardSubtitle: _n,
2467
- CardBody: Kn,
2468
- EditorBody: ({ item: e }) => Ot($n, { conditionalFormat: e })
2469
- }, Un = rt(ot((e, t) => {
2470
- const { workbook: o, args: n, ...r } = e;
2471
- return Ot(E, {
2472
- ref: t,
2473
- workbook: o,
2474
- descriptor: Hn,
2475
- args: n,
2476
- dragReorder: !0,
2477
- ...r
2478
- });
2479
- }));
2480
- Un.displayName = "ConditionalFormatDetailsPanel";
2481
- var qn = (e) => {
2482
- const { model: t, entryKey: o, frame: n, args: r, ref: a, ...l } = e;
2483
- return Ot(Un, {
2484
- ref: a,
2485
- workbook: t,
2486
- args: r,
2487
- ...l
2488
- });
2489
- }, Gn = {
2490
- card: "_card_h0jnt_7",
2491
- actionRoot: "_actionRoot_h0jnt_11",
2492
- icons: "_icons_h0jnt_16",
2493
- expand: "_expand_h0jnt_22",
2494
- expandOpen: "_expandOpen_h0jnt_29",
2495
- stackTraceContainer: "_stackTraceContainer_h0jnt_33",
2496
- paper: "_paper_h0jnt_37",
2497
- checkIcon: "_checkIcon_h0jnt_42",
2498
- button: "_button_h0jnt_47"
2499
- }, Qn = rt(ot((e, t) => {
2500
- const { id: o, message: n, iconVariant: r, error: a, hideIconVariant: l, ...i } = e, s = Ze(), { closeSnackbar: d } = Po(), [c, p] = ct(!1), u = a ? fo.collectErrorChain(a, !0)?.[0]?.error : void 0, m = u && !(u instanceof bo), g = at(() => {
2501
- p((e) => !e);
2502
- }, []), h = at(() => {
2503
- d(o);
2504
- }, [o, d]);
2505
- let y = u?.message;
2506
- return !y && nt(n) && (y = n), y || "string" != typeof n || (y = n), y || (y = `Unknown Error: ${n}`), Ot(Do, {
2507
- ref: t,
2508
- className: So(Gn.root, "error-snackbar"),
2509
- children: Mt(Lt, {
2510
- className: Gn.card,
2511
- style: {
2512
- backgroundColor: "var(--sxl-color-error)",
2513
- color: "var(--sxl-color-error-content)",
2514
- border: "1px solid var(--sxl-color-error)"
2515
- },
2516
- children: [Mt(Vt, {
2517
- className: Gn.actionRoot,
2518
- children: [
2519
- l ? null : r?.error,
2520
- Ot(co, {
2521
- variant: "body2",
2522
- component: "div",
2523
- className: Gn.typography,
2524
- children: y
2525
- }),
2526
- Ot("div", { style: { flex: "1 1 auto" } }),
2527
- Mt("div", {
2528
- className: Gn.icons,
2529
- children: [m ? Ot(Gt, {
2530
- "aria-label": s("toast.showMore"),
2531
- size: "small",
2532
- className: So(Gn.expand, { [Gn.expandOpen]: c }),
2533
- onClick: g,
2534
- children: Ot(We, { iconKey: "ExpandMore" })
2535
- }) : null, Ot(Gt, {
2536
- size: "small",
2537
- className: Gn.expand,
2538
- onClick: h,
2539
- children: Ot(We, {
2540
- iconKey: "Close",
2541
- style: { transform: "scale(0.8)" }
2542
- })
2543
- })]
2544
- })
2545
- ]
2546
- }), m ? Ot(jt, {
2547
- in: c,
2548
- timeout: "auto",
2549
- children: Ot("div", {
2550
- className: Gn.stackTraceContainer,
2551
- style: {
2552
- backgroundColor: "color-mix(in srgb, var(--sxl-color-error) 90%, var(--sxl-color-base-100))",
2553
- borderTop: "1px solid var(--sxl-color-error)"
2554
- },
2555
- children: Ot(vt, {
2556
- error: a,
2557
- hideLineNumbers: !0
2558
- })
2559
- })
2560
- }) : null]
2561
- })
2562
- });
2563
- }));
2564
- Qn.displayName = "ToastError";
2565
- var Yn = Ot(() => Ot(ft, {
2566
- label: "SheetXL",
2567
- description: Ze()("logo.description"),
2568
- children: Ot(Bt, {
2569
- component: "a",
2570
- href: "https://www.sheetxl.com",
2571
- target: "_blank",
2572
- rel: "noopener noreferrer",
2573
- sx: {
2574
- display: "inline-flex",
2575
- width: "24px",
2576
- height: "24px",
2577
- marginBottom: "4px",
2578
- marginLeft: "6px",
2579
- cursor: "pointer"
2580
- },
2581
- children: Ot(oe, { style: {
2582
- width: "24px",
2583
- height: "24px"
2584
- } })
2585
- })
2586
- }), {}), Jn = rt(ot((e, t) => {
2587
- const { workbook: o, className: n, logo: r = Yn, mainElement: a, startElement: l, endElement: i, ...s } = e, [d, { width: c }] = Fo(), p = c < 530, u = dt(null);
2588
- return Ot(Bt, {
2589
- ...s,
2590
- ref: To([
2591
- u,
2592
- d,
2593
- t
2594
- ]),
2595
- className: n,
2596
- children: P({
2597
- isCompact: p,
2598
- wrapperSelect: (e) => Mt(Bt, {
2599
- sx: {
2600
- display: "grid",
2601
- gridTemplateColumns: "1fr auto 1fr",
2602
- flex: "1",
2603
- alignItems: "stretch",
2604
- gap: (e) => e.spacing(1),
2605
- paddingLeft: (e) => e.spacing(1),
2606
- paddingRight: (e) => e.spacing(1)
2607
- },
2608
- children: [
2609
- Mt(Bt, {
2610
- sx: {
2611
- display: "flex",
2612
- flexDirection: "row",
2613
- alignItems: "center",
2614
- justifyContent: "start",
2615
- gap: (e) => e.spacing(.5)
2616
- },
2617
- children: [r, Mt(Bt, {
2618
- sx: {
2619
- display: "flex",
2620
- flexDirection: "row",
2621
- alignItems: "center",
2622
- gap: (e) => e.spacing(.25)
2623
- },
2624
- children: [l, e]
2625
- })]
2626
- }),
2627
- Ot(Bt, {
2628
- sx: {
2629
- display: "flex",
2630
- flexDirection: "row",
2631
- minWidth: 0,
2632
- overflow: "hidden",
2633
- alignItems: "center",
2634
- justifyContent: "center"
2635
- },
2636
- children: a
2637
- }),
2638
- Ot(Bt, {
2639
- sx: {
2640
- display: "flex",
2641
- alignItems: "center",
2642
- justifyContent: "end"
2643
- },
2644
- children: i
2645
- })
2646
- ]
2647
- })
2648
- })
2649
- });
2650
- }));
2651
- Jn.displayName = "StudioToolbar";
2652
- var Xn = (e, t) => {
2653
- const o = new URL(window.location.pathname, window.location.origin);
2654
- e && o.searchParams.set("source", e), e && t && o.searchParams.set("title", t), window.open(o.toString(), "sheetxl-" + go.uuidV4(), "popup=true");
2655
- };
2656
- function Zn(e, t) {
2657
- const { workbook: o, setWorkbook: n, workbookTitle: r = "export", isDirty: a, notifier: l, refSave: i } = t;
2658
- let s = !1;
2659
- const d = async (e = null, t = null, o = null) => {
2660
- const n = [], r = {
2661
- source: e && "string" != typeof e ? e : null,
2662
- typedCreateWorkbookOptions: t ?? void 0,
2663
- onPassword: async ({ origin: e, validate: t }) => {
2664
- const o = await l.showInput({
2665
- title: wo("dialog.password.title"),
2666
- description: wo("dialog.password.open.description", { name: e.getName() ?? "" }),
2667
- inputType: "password",
2668
- options: [{
2669
- id: "Open",
2670
- label: () => wo("dialog.open")
2671
- }, "Cancel"],
2672
- defaultOption: "Open",
2673
- onValidateInput: async (e, o) => void 0 === o ? { valid: !0 } : e ? await t(e) ? { valid: !0 } : {
2674
- valid: !1,
2675
- message: wo("dialog.password.open.retry")
2676
- } : {
2677
- valid: !1,
2678
- message: wo("dialog.password.open.required")
2679
- }
2680
- });
2681
- return "Open" === o?.option ? o.input ?? null : null;
2682
- },
2683
- progress: { onWarning: (e) => {
2684
- n.push(e);
2685
- } }
2686
- };
2687
- let a;
2688
- o && (r.progress.onStart = o);
2689
- let i = -5;
2690
- return de.read({
2691
- ...r,
2692
- progress: {
2693
- async onStart(e, t) {
2694
- await r?.progress?.onStart?.(e, t), a = await l?.showBusy?.(wo("workbook.opening", { name: e?.getName() ?? "" })), t && a?.setProgress?.(0, t);
2695
- },
2696
- onProgress(e, t) {
2697
- if (!t) return;
2698
- const o = Math.min(100, Math.round(e / t * 100));
2699
- if (o >= 100) {
2700
- if (100 === i) return;
2701
- i = 100, a?.setProgress?.(e, t);
2702
- return;
2703
- }
2704
- o - i < 5 || (i = o, a?.setProgress?.(e, t));
2705
- },
2706
- onComplete() {
2707
- a?.(), n.length > 0 && (l.showMessage(wo("workbook.importWarnings")), console.warn("Import warnings:\n" + n.join("\n")));
2708
- },
2709
- onWarning(e, t) {
2710
- r?.progress?.onWarning?.(e, t);
2711
- }
2712
- }
2713
- });
2714
- }, c = async (e, t, o = !1, n) => {
2715
- let a;
2716
- const i = {
2717
- format: t?.key,
2718
- progress: {
2719
- async onStart(e) {
2720
- a = await l?.showBusy?.(wo("workbook.saving", { name: e?.getName() ?? "" }));
2721
- },
2722
- onComplete() {
2723
- a?.();
2724
- }
2725
- },
2726
- onWarnings: n ?? (async ({ warnings: e, origin: t, canCancel: o }) => {
2727
- a?.(), console.warn(`Not written to '${t.getName()}':\n${e.map((e) => ` ${e.message}`).join("\n")}`);
2728
- const n = wo("dialog.writeWarnings.title"), r = t.getFormat(), i = (r ? (await de.getWriteFormats({ search: r }))[0] : void 0)?.description ?? r ?? "", s = wo("dialog.writeWarnings.keep");
2729
- return o ? "Save" === await l.showOptions({
2730
- title: n,
2731
- type: Re.Warning,
2732
- description: `${wo("dialog.writeWarnings.confirm", { format: i })}\n\n${s}`,
2733
- options: [{
2734
- id: "Save",
2735
- label: () => wo("dialog.save")
2736
- }, "Cancel"],
2737
- defaultOption: "Cancel"
2738
- }) && (a = await l?.showBusy?.(wo("workbook.saving", { name: t?.getName() ?? "" })), !0) : (l.showOptions({
2739
- title: n,
2740
- type: Re.Warning,
2741
- description: `${wo("dialog.writeWarnings.saved", { format: i })}\n\n${s}`,
2742
- options: ["Ok"]
2743
- }), !0);
2744
- })
2745
- };
2746
- let s;
2747
- if (o) {
2748
- const o = e.getOrigin(), n = t?.exts?.[0] ?? (o.getExtension() || "sxl"), a = `${r || o.getName() || wo("workbook.defaultName")}.${n}`;
2749
- s = await de.writeAs(e, a, {
2750
- ...i,
2751
- prompt: !0
2752
- });
2753
- } else s = await de.write(e, void 0, i);
2754
- return s;
2755
- };
2756
- let p = null;
2757
- return e.updateCommand("newWorkbook", { callback: async (e) => {
2758
- const t = de.canRead() && !a();
2759
- e?.source ? t && p ? await p({
2760
- url: e.source,
2761
- title: e.title
2762
- }) : Xn(e.source, e.title) : t ? n({}) : Xn();
2763
- } }), e.updateCommand("closeWorkbook", { callback: async () => {
2764
- a() && "Close" !== await l.showOptions({
2765
- title: wo("dialog.confirm.title"),
2766
- description: wo("dialog.unsavedChanges"),
2767
- options: [{
2768
- id: "Close",
2769
- label: () => wo("dialog.close")
2770
- }, "Cancel"],
2771
- defaultOption: "Cancel"
2772
- }) || window.close();
2773
- } }), (async () => {
2774
- const t = await de.getWriteFormats();
2775
- if (s) return;
2776
- const r = de.canWrite(), u = de.canRead();
2777
- if (r) {
2778
- const n = (e) => {
2779
- const n = e ? t.find((t) => t.key === e) : void 0;
2780
- c(o, n, !0).catch((e) => l.showError(e));
2781
- };
2782
- e.updateCommand("saveWorkbook", { callback: () => {
2783
- c(o, void 0, !1).catch((e) => l.showError(e));
2784
- } }), i && (i.current = (e) => c(o, void 0, !1, e?.onWarnings)), e.updateCommand("saveWorkbookAs", { callback: (e) => {
2785
- n(e);
2786
- } });
2787
- for (const o of t) {
2788
- const t = o.key;
2789
- e.updateCommand(`saveWorkbookAs${t}`, {
2790
- label: () => wo("command.saveAsFormat.label", { format: o.description }),
2791
- groupLabels: {
2792
- workbook: () => wo("command.saveAsFormat.workbook", { format: o.description }),
2793
- saveWorkbookOptions: () => wo("command.saveAsFormat.compact", { format: o.description })
2794
- },
2795
- tags: o.tags,
2796
- description: () => wo("command.saveAsFormat", { format: o.description }),
2797
- icon: "CSV" === t ? "FileDownloadAsCSV" : "Excel" === t ? "FileDownloadAsExcel" : "FileDownloadAsSheet",
2798
- callback: () => {
2799
- n(t);
2800
- }
2801
- });
2802
- }
2803
- }
2804
- const m = async (e = null) => {
2805
- const t = { csv: {
2806
- date1904: o.getRuntime().isDate1904(),
2807
- ...o.options
2808
- } };
2809
- try {
2810
- let n = "";
2811
- const r = async (e) => {
2812
- n = e?.getName() ?? "";
2813
- }, a = await d(e, t, r);
2814
- if (!a) return;
2815
- const l = a.getSheets().getItems();
2816
- await o.doBatch(async () => {
2817
- for (let e = 0; e < l.length; e++) {
2818
- const t = l[e], r = 1 === l.length ? n : t.getName(), a = o.findValidSheetName(r);
2819
- await o.getSheets().add({
2820
- name: a,
2821
- autoSelect: e === l.length - 1
2822
- }).getEntireRange().copyFrom(t.getEntireRange());
2823
- }
2824
- }, ko("op.importData")), a.close();
2825
- } catch (e) {
2826
- l.showError(e);
2827
- }
2828
- };
2829
- if (e.updateCommand("insertDataFromFile", {
2830
- tags: ["noTransaction", "noRepeat"],
2831
- callback: async (e = null) => {
2832
- let t = e;
2833
- if (t || de.canRead() || (t = await (async () => {
2834
- const e = await de.getReadFormats(), t = [...new Set(e.flatMap((e) => e.exts))].map((e) => `.${e}`);
2835
- return ho.openFileDialog(t.length ? t.join(",") : "*.*");
2836
- })(), t)) return m(t);
2837
- }
2838
- }), e.updateCommand("insertDataFromURL", {
2839
- tags: ["noTransaction", "noRepeat"],
2840
- callback: async (e) => {
2841
- if (!e) {
2842
- const t = await l.showInput({
2843
- title: wo("dialog.importFromWeb.title"),
2844
- description: wo("dialog.importFromWeb.description"),
2845
- inputLabel: wo("dialog.webAddress.inputLabel"),
2846
- initialValue: "https://www.sheetxl.com/docs/examples/financial-calculators.xlsx",
2847
- propsInput: { style: { minWidth: "440px" } },
2848
- options: [{
2849
- id: "Import",
2850
- label: () => wo("dialog.import")
2851
- }]
2852
- });
2853
- if ("Import" !== t.option) return;
2854
- e = t.input;
2855
- }
2856
- if (e) try {
2857
- const t = await fetch(e);
2858
- if (!t.ok) throw new Error(`Could not fetch '${e}' (${t.status} ${t.statusText}).`);
2859
- const o = await t.blob(), n = decodeURIComponent(e.split("/").pop()?.split("?")[0] || "") || "import.xlsx";
2860
- await m(new File([o], n, { type: o.type }));
2861
- } catch (e) {
2862
- l.showError(e);
2863
- }
2864
- }
2865
- }), u) {
2866
- const t = async () => !a() || "Open" === await l.showOptions({
2867
- title: wo("dialog.confirm.title"),
2868
- description: wo("dialog.unsavedChanges"),
2869
- options: [{
2870
- id: "Open",
2871
- label: () => wo("dialog.open")
2872
- }, "Cancel"],
2873
- defaultOption: "Cancel"
2874
- }), r = async (e = null) => {
2875
- const t = { csv: {
2876
- date1904: o.getRuntime().isDate1904(),
2877
- ...o.options
2878
- } };
2879
- try {
2880
- const o = await d(e, t);
2881
- if (!o) return;
2882
- n(o);
2883
- } catch (e) {
2884
- l.showError(e);
2885
- }
2886
- };
2887
- e.updateCommand("openWorkbook", { callback: async (e = null) => {
2888
- await t() && await r(e);
2889
- } }), p = async (e) => {
2890
- let o = "string" == typeof e ? e : e?.url;
2891
- const n = "string" == typeof e ? void 0 : e?.title;
2892
- if (!o) {
2893
- const e = await l.showInput({
2894
- title: wo("dialog.openFromWeb.title"),
2895
- description: wo("dialog.openFromWeb.description"),
2896
- inputLabel: wo("dialog.webAddress.inputLabel"),
2897
- initialValue: "https://www.sheetxl.com/docs/examples/financial-calculators.xlsx",
2898
- propsInput: { style: { minWidth: "440px" } },
2899
- options: [{
2900
- id: "Open",
2901
- label: () => wo("dialog.open")
2902
- }]
2903
- });
2904
- if ("Open" !== e.option) return;
2905
- o = e.input;
2906
- }
2907
- if (o && await t()) try {
2908
- const e = await fetch(o);
2909
- if (!e.ok) throw new Error(`Could not fetch '${o}' (${e.status} ${e.statusText}).`);
2910
- const t = await e.blob(), a = decodeURIComponent(o.split("/").pop()?.split("?")[0] || "") || "workbook.xlsx", l = a.match(/\.[^/.]+$/)?.[0] ?? "", i = n ? `${n}${l}` : a;
2911
- await r(new File([t], i, { type: t.type }));
2912
- } catch (e) {
2913
- l.showError(e);
2914
- }
2915
- }, e.updateCommand("openWorkbookFromUrl", { callback: p });
2916
- }
2917
- })(), () => {
2918
- s = !0, i && (i.current = null);
2919
- };
2920
- }
2921
- var er = St(vo("studio:shortcutKeysDialog", () => import("./BJi0FlhIqCMEwROu.mjs")).load);
2922
- D(), O();
2923
- var tr = /* @__PURE__ */ new Set(["ui"]), or = (e) => {
2924
- const t = (e) => {
2925
- if ("function" != typeof e) return e;
2926
- try {
2927
- return e();
2928
- } catch {
2929
- return;
2930
- }
2931
- }, o = (e, o) => {
2932
- const n = t(e);
2933
- return "string" == typeof n ? Co(n, o, yo.getActive()) : void 0;
2934
- }, n = [];
2935
- for (const r of e.names()) if (!tr.has(r)) for (const a of e.keys(r)) {
2936
- const l = e.resolveDefinition(r, a);
2937
- n.push({
2938
- groupKey: r,
2939
- command: {
2940
- getLabel: () => o(l?.label, l?.params) ?? a,
2941
- getIcon: () => t(l?.icon),
2942
- getDescription: () => o(l?.description, l?.params) ?? "",
2943
- getShortcut: () => t(l?.shortcut) ?? null,
2944
- getScope: () => r,
2945
- getScopeLabel: () => Oe.DefaultCommandCatalogService.getScopeLabel(r)
2946
- }
2947
- });
2948
- }
2949
- return { getAllCommands: () => n };
2950
- }, nr = (e) => {
2951
- const { children: t, workbook: o, setWorkbook: n, workbookTitle: r, isDirty: a, refSave: l } = e, i = Oe.useCommandScope(), s = Qe(), { showModal: d } = Nt(), c = Ze(), p = dt(a);
2952
- p.current = a;
2953
- const u = _e(() => {
2954
- const e = i?.getRoot().getRegistry();
2955
- if (!e) return;
2956
- const t = d(er, {
2957
- title: c("dialog.shortcutKeys.title"),
2958
- commands: or(e),
2959
- onDone: () => t.hide(),
2960
- onLoadError: (e) => {
2961
- t.destroy(), s.showError(e);
2962
- }
2963
- });
2964
- }, [i, d]);
2965
- it(() => {
2966
- if (!i) return;
2967
- const e = i.getRoot().contribution();
2968
- return function(e, t) {
2969
- const o = () => t.showShortcuts();
2970
- e.updateCommand("showKeyboardShortcuts", { callback: o }), e.updateCommand("help", { callback: o });
2971
- for (const [t, o] of Object.entries({
2972
- gotoUrlGithub: "https://github.com/sheetxl/sheetxl",
2973
- gotoUrlDiscord: "https://discord.gg/NTKdwUgK9p",
2974
- gotoUrlDocumentation: "https://www.sheetxl.com/docs",
2975
- gotoUrlIssue: "https://github.com/sheetxl/sheetxl/issues"
2976
- })) e.updateCommand(t, { callback: () => {
2977
- window?.open(o);
2978
- } });
2979
- }(e, { showShortcuts: u }), () => e.remove();
2980
- }, [i, u]);
2981
- const m = uo("(prefers-color-scheme: dark)"), { themeMode: g } = Je(), [h, y] = Ye(se.Mode, null), [f, b] = Ye(se.DarkGrid, !1), [x, v] = Ye(se.DarkImages, !1);
2982
- it(() => {
2983
- if (!i) return;
2984
- const e = i.getRoot().contribution();
2985
- return function(e, t) {
2986
- e.updateCommand("themeMode", {
2987
- state: t.mode ?? null,
2988
- params: { dark: t.isDark },
2989
- icon: t.isDark ? "DarkMode" : "LightMode",
2990
- callback: () => t.setMode(t.isDark ? "light" : "dark")
2991
- }), e.updateCommand("defaultThemeMode", {
2992
- state: !t.mode,
2993
- icon: t.systemDefaultDark ? "SystemDefaultDarkMode" : "SystemDefaultLightMode",
2994
- callback: () => t.setMode(null)
2995
- }), e.updateCommand("enableDarkGrid", {
2996
- state: t.enableDarkGrid,
2997
- callback: () => t.setEnableDarkGrid((e) => !e)
2998
- }), e.updateCommand("enableDarkImages", {
2999
- state: t.enableDarkImages,
3000
- callback: () => t.setEnableDarkImages((e) => !e)
3001
- });
3002
- }(e, {
3003
- mode: h,
3004
- setMode: y,
3005
- isDark: "dark" === h || !h && "dark" === g,
3006
- systemDefaultDark: m,
3007
- enableDarkGrid: f,
3008
- setEnableDarkGrid: b,
3009
- enableDarkImages: x,
3010
- setEnableDarkImages: v
3011
- }), () => e.remove();
3012
- }, [
3013
- i,
3014
- h,
3015
- g,
3016
- m,
3017
- f,
3018
- x,
3019
- y,
3020
- b,
3021
- v
3022
- ]);
3023
- const [C, k] = Ye(Be.Active, null), [w, S] = ct(() => yo.getActive());
3024
- it(() => yo.addChangeListener(S), []), it(() => {
3025
- C && C !== yo.getActive() && yo.setActive(C);
3026
- }, [C]), it(() => {
3027
- if (!i) return;
3028
- const e = i.getRoot().contribution();
3029
- return function(e, t) {
3030
- e.updateCommand("language", {
3031
- state: t.active,
3032
- callback: (e) => {
3033
- e && t.setActive(e);
3034
- }
3035
- });
3036
- }(e, {
3037
- active: w,
3038
- setActive: (e) => {
3039
- k(e);
3040
- }
3041
- }), () => e.remove();
3042
- }, [
3043
- i,
3044
- w,
3045
- k
3046
- ]);
3047
- const { isFullscreenAvailable: T, isFullscreenEnabled: F, toggleFullscreen: D } = Ue();
3048
- it(() => {
3049
- if (!i) return;
3050
- const e = i.getRoot().contribution();
3051
- return function(e, t) {
3052
- e.updateCommand("fullScreenToggle", {
3053
- state: t.isFullscreenEnabled,
3054
- disabledReasons: t.isFullscreenAvailable ? [] : [ko("reason.fullscreenUnavailable")],
3055
- icon: t.isFullscreenEnabled ? "FullScreenOff" : "FullScreen",
3056
- callback: () => {
3057
- t.toggleFullscreen();
3058
- }
3059
- });
3060
- }(e, {
3061
- isFullscreenAvailable: T,
3062
- isFullscreenEnabled: F,
3063
- toggleFullscreen: D
3064
- }), () => e.remove();
3065
- }, [
3066
- i,
3067
- T,
3068
- F,
3069
- D
3070
- ]);
3071
- const N = Fe(!0);
3072
- return it(() => {
3073
- if (!i) return;
3074
- const e = i.getRoot().contribution();
3075
- return function(e, t) {
3076
- e.updateCommand("protectWorkbook", {
3077
- tags: ["noTransaction", "noRepeat"],
3078
- callback: () => {
3079
- t("manageProtection", { args: { tab: "workbook" } });
3080
- }
3081
- });
3082
- }(e, (e, t) => N.activate(e, t)), () => e.remove();
3083
- }, [i, N]), it(() => {
3084
- if (!i || !o) return;
3085
- const e = i.getRoot().contribution(), t = Zn(e, {
3086
- workbook: o,
3087
- setWorkbook: n,
3088
- workbookTitle: r ?? void 0,
3089
- isDirty: () => p.current?.() ?? !1,
3090
- notifier: s,
3091
- refSave: l
3092
- });
3093
- return () => {
3094
- t(), e.remove();
3095
- };
3096
- }, [
3097
- i,
3098
- o,
3099
- n,
3100
- r,
3101
- s,
3102
- l
3103
- ]), t;
3104
- };
3105
- nr.displayName = "StudioCommandProvider";
3106
- var rr = ({ renderWorkbook: e }) => {
3107
- const t = Oe.useCommandResolver(), o = dt(null), n = Ze(), [r, a] = ct(null), l = at((e) => {
3108
- const o = e.dataTransfer;
3109
- if (t && o) {
3110
- if ("dragenter" === e.type || "dragover" === e.type) {
3111
- const e = o.types, t = o.items;
3112
- let n = !1;
3113
- for (let e = 0; e < t.length; e++) if (t[e].type.startsWith("image/")) {
3114
- n = !0;
3115
- break;
3116
- }
3117
- n ? a("insertImage") : e.includes("Files") && t.length > 0 ? a("open") : (o.effectAllowed = "none", o.dropEffect = "none");
3118
- } else if ("dragleave" === e.type) {
3119
- const t = e.relatedTarget;
3120
- t && e.currentTarget.contains(t) || a(null);
3121
- }
3122
- e.preventDefault();
3123
- }
3124
- }, [t]), i = _e((e) => {
3125
- e.preventDefault();
3126
- const n = r;
3127
- if (a(null), n && t && (e.stopPropagation(), e.dataTransfer.files && e.dataTransfer.files.length > 0)) {
3128
- const n = e.dataTransfer.files[0];
3129
- if (!n) return;
3130
- if (n?.type?.startsWith("image/")) {
3131
- const r = o.current?.getSheetElement()?.getGridSurface().getPaneFromClient(e.clientX, e.clientY);
3132
- if (!r) return;
3133
- const a = r.getPanePointFromPointer(e.clientX, e.clientY);
3134
- if (!a) return;
3135
- const l = r.toAbsoluteBounds({
3136
- x: a.x ?? 0,
3137
- y: a.y ?? 0,
3138
- width: 0,
3139
- height: 0
3140
- });
3141
- t.execute("insertImageFromFile", {
3142
- file: n,
3143
- options: { bounds: {
3144
- x: l.x,
3145
- y: l.y
3146
- } }
3147
- });
3148
- } else {
3149
- if (!de.canRead()) return;
3150
- const o = e.dataTransfer.items?.[0], r = "undefined" != typeof window && window.isSecureContext ? o?.getAsFileSystemHandle?.() : void 0;
3151
- r ? r.then((e) => t.execute("openWorkbook", "file" === e?.kind ? e : n)).catch(() => t.execute("openWorkbook", n)) : t.execute("openWorkbook", n);
3152
- }
3153
- }
3154
- }, [t, r]), s = st(() => {
3155
- if (!r) return null;
3156
- const e = "insertImage" === r;
3157
- return Ot(Bt, {
3158
- className: "drop-overlay",
3159
- sx: {
3160
- position: "absolute",
3161
- inset: 0,
3162
- zIndex: 1,
3163
- boxSizing: "border-box",
3164
- pointerEvents: "none",
3165
- display: "flex",
3166
- justifyContent: "center",
3167
- alignItems: "center",
3168
- backgroundColor: (e) => po(e.palette.primary.main, .46),
3169
- outline: (e) => `2px dashed ${e.palette.primary.main}`,
3170
- outlineOffset: "-6px",
3171
- borderRadius: 2
3172
- },
3173
- children: Mt(Zt, {
3174
- elevation: 6,
3175
- sx: {
3176
- display: "flex",
3177
- alignItems: "center",
3178
- gap: 1.5,
3179
- px: 3,
3180
- py: 2,
3181
- borderRadius: 2,
3182
- color: "text.primary",
3183
- "& .drop-overlay-icon": { color: "primary.main" }
3184
- },
3185
- children: [Ot(We, {
3186
- iconKey: e ? "InsertImage" : "FileOpen",
3187
- className: "drop-overlay-icon",
3188
- size: 32
3189
- }), Ot(co, {
3190
- variant: "h6",
3191
- component: "span",
3192
- children: n(e ? "drop.insertImage" : "drop.open")
3193
- })]
3194
- })
3195
- });
3196
- }, [r, n]);
3197
- return Mt(It, { children: [e({
3198
- ref: o,
3199
- onDragStart: (e) => {
3200
- if (e.target.src) {
3201
- const t = new Image();
3202
- t.src = e.target.src, e.dataTransfer.setDragImage(t, 1, 1);
3203
- }
3204
- },
3205
- onDragEnter: l,
3206
- onDragLeave: l,
3207
- onDragOver: l,
3208
- onDrop: i
3209
- }), s] });
3210
- }, ar = rt((e) => {
3211
- const { workbook: t, setWorkbook: o, refDocumentTitle: n, titleWorkbook: r, setWorkbookTitle: a, isDirty: l, initialCommandAnchor: i, renderWorkbook: s, refSave: d } = e;
3212
- return Ot(J, {
3213
- initialAnchor: i,
3214
- children: Ot(nr, {
3215
- workbook: t,
3216
- setWorkbook: o,
3217
- workbookTitle: r,
3218
- isDirty: l,
3219
- refSave: d,
3220
- children: Ot(rr, { renderWorkbook: s })
3221
- })
3222
- });
3223
- });
3224
- ar.displayName = "CommandsWrapper";
3225
- var lr = {
3226
- sort: vo("studio:sortDialog", () => import("./DVshSSmP5QZU7GoY.mjs"), { tier: "common" }).load,
3227
- hyperlink: vo("studio:hyperlinkDialog", () => import("./Dbv0IltYad9SQrj3.mjs"), { tier: "common" }).load,
3228
- comments: vo("studio:commentsDialog", () => import("./BI8XFczUY--Db2n3.mjs"), { tier: "common" }).load,
3229
- find: vo("studio:findReplaceWindow", () => import("./DVaQ6xIbKQgBk0uw.mjs"), { tier: "common" }).load,
3230
- tableNew: vo("studio:tableNewDialog", () => import("./DAji2BXelmIUxioS.mjs"), { tier: "common" }).load,
3231
- namedDetails: vo("studio:namedReferenceDialog", () => import("./BoDCV8cDmFVAYtaW.mjs")).load,
3232
- insertFunction: vo("studio:insertFunctionDialog", () => import("./BMoRatciTqOi1HkT.mjs"), { tier: "common" }).load,
3233
- resizeHeader: vo("studio:resizeHeaderDialog", () => import("./DvMAUBSQsZmIsRxi.mjs")).load,
3234
- fillSeries: vo("studio:fillSeriesDialog", () => import("./cJDXopFIX6f3_oi3.mjs")).load,
3235
- workbookStatistics: vo("studio:workbookStatisticsDialog", () => import("./CCWQ116Z67Kz78Uo.mjs")).load,
3236
- password: vo("studio:passwordDialog", () => import("./index.mjs").then((e) => e.o)).load
3237
- }, ir = ["find"], sr = rt((e) => {
3238
- const { children: t } = e, o = Po(), n = o ? o.enqueueSnackbar : () => {}, r = o ? o.closeSnackbar : () => {}, a = dt(/* @__PURE__ */ new Set()), l = dt(null), i = dt(null), [s, d] = ct({
3239
- label: null,
3240
- progress: null
3241
- }), c = Ze(), p = go.EmptyObject, u = Dt(p), m = Pt(p), g = Ft(p), h = dt(!1);
3242
- it(() => {
3243
- if (h.current) return;
3244
- h.current = !0;
3245
- const e = window, t = e.requestIdleCallback ?? ((e) => setTimeout(e, 500)), o = e.cancelIdleCallback ?? clearTimeout, n = t(() => {
3246
- for (const e of ir) u(e, lr[e], { prewarm: !0 }).catch(() => {});
3247
- });
3248
- return () => o(n);
3249
- }, []);
3250
- const y = dt(/* @__PURE__ */ new Set());
3251
- return Mt(Ve, {
3252
- notifier: st(() => {
3253
- const e = (e, t) => {
3254
- if (t?.onceKey) {
3255
- if (y.current.has(t.onceKey)) return;
3256
- const e = new Set(y.current);
3257
- e.add(t.onceKey), y.current = e;
3258
- }
3259
- const o = {
3260
- variant: t?.type ?? Re.Info,
3261
- anchorOrigin: {
3262
- vertical: "top",
3263
- horizontal: "center"
3264
- },
3265
- preventDuplicate: t?.preventDuplicate,
3266
- persist: t?.persist ?? t?.type === Re.Error,
3267
- action: (e) => Ot(Gt, {
3268
- onClick: () => r(e),
3269
- children: Ot(We, { iconKey: "Cancel" })
3270
- })
3271
- };
3272
- t?.enqueueProps && Object.assign(o, t.enqueueProps), e || console.log("message is 'null'", t), n(e ?? "Alert", o);
3273
- }, t = {
3274
- showMessage: e,
3275
- showBusy: (e, t) => {
3276
- const o = Symbol("busy");
3277
- a.current.add(o), i.current = e, null != e && "string" != typeof e && d((t) => t.label === e ? t : {
3278
- ...t,
3279
- label: e
3280
- });
3281
- const n = $e(() => {
3282
- a.current.delete(o) && (a.current.size > 0 || (wt(l.current), i.current = null, d((e) => null === e.label && null === e.progress ? e : {
3283
- label: null,
3284
- progress: null
3285
- })));
3286
- }, (e, t) => {
3287
- const o = t && t > 0 && null != e ? Math.max(0, Math.min(1, e / t)) : null;
3288
- d((e) => e.progress === o ? e : {
3289
- ...e,
3290
- progress: o
3291
- });
3292
- }, (e) => {
3293
- i.current = e, "string" == typeof e ? Tt(l.current, e) : d((t) => ({
3294
- ...t,
3295
- label: e
3296
- }));
3297
- }), r = Tt(l.current, "string" == typeof e ? e : void 0);
3298
- return r ? r.then(() => n) : n;
3299
- },
3300
- showWindow: (e, t) => {
3301
- const o = t;
3302
- return t = {
3303
- ...t,
3304
- onKeyDown: (e) => {
3305
- e.isDefaultPrevented() || e.isPropagationStopped() || o?.onKeyDown?.(e);
3306
- }
3307
- }, u(e, lr[e], t);
3308
- },
3309
- showOptions: m,
3310
- showInput: g,
3311
- showError: (t) => {
3312
- let o, n = Re.Error, r = c("error.unknown");
3313
- "string" == typeof t ? r = t : t instanceof Error && (o = t, t.message && (r = c(t.message))), t instanceof xo && (n = Re.Info), e(r, {
3314
- type: n,
3315
- enqueueProps: { error: o }
3316
- });
3317
- }
3318
- }, o = new Ae();
3319
- return o.setOverrides(t), o;
3320
- }, [c]),
3321
- children: [st(() => Ot(pt, {
3322
- ref: l,
3323
- autoStart: !1,
3324
- icon: Ot(ut, { sx: {
3325
- transform: "scale(0.7)",
3326
- marginLeft: "-6px"
3327
- } }),
3328
- panel: !0,
3329
- label: s.label ?? ("string" == typeof i.current ? i.current : void 0),
3330
- progress: s.progress,
3331
- sx: {
3332
- position: "absolute",
3333
- left: "0",
3334
- top: "0",
3335
- width: "100%",
3336
- height: "100%",
3337
- zIndex: "9999",
3338
- pointerEvents: "none"
3339
- }
3340
- }), [s.label, s.progress]), t]
3341
- });
3342
- });
3343
- sr.displayName = "StudioNotifierProvider";
3344
- var dr = "var(--sxl-color-input-border, light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.2)))", cr = rt(ot((e, t) => {
3345
- const { children: o, title: n, taskPanes: r, onSelect: a, selected: l, registry: i = Z, style: s, iconsOnly: d, side: c = "right", className: p, ...u } = e, m = "right" !== c, g = st(() => r.map((t) => {
3346
- const o = i.getRegisteredTaskPane(t);
3347
- if (!o) return null;
3348
- let n = o.getIcon?.();
3349
- "string" == typeof n && (n = Ot(We, { iconKey: n }));
3350
- const r = t === l, a = n ? Ot(Bt, {
3351
- sx: {
3352
- display: "inline-block",
3353
- transform: m ? "rotate(-90deg)" : "rotate(90deg)",
3354
- transformOrigin: "center",
3355
- color: (e) => e.palette.text.secondary
3356
- },
3357
- children: n
3358
- }) : null, s = !n || !d && r, c = Ot(Bt, {
3359
- sx: {
3360
- display: "grid",
3361
- gridTemplateColumns: s ? "1fr" : "0fr",
3362
- opacity: s ? 1 : 0,
3363
- transition: (e) => e.transitions.create(["grid-template-columns", "opacity"], { duration: e.transitions.duration.short })
3364
- },
3365
- children: Ot(Bt, {
3366
- sx: {
3367
- overflow: "hidden",
3368
- minWidth: 0,
3369
- minHeight: 0
3370
- },
3371
- children: Ot(co, {
3372
- component: "div",
3373
- sx: {
3374
- textTransform: "none",
3375
- whiteSpace: "nowrap",
3376
- transform: m ? "rotate(180deg)" : void 0,
3377
- padding: "4px 0px",
3378
- color: (e) => r ? e.palette.primary.main : e.palette.text.secondary
3379
- },
3380
- children: o.getTitle()
3381
- })
3382
- })
3383
- });
3384
- return Ot(no, {
3385
- value: t,
3386
- label: Ot(xt, {
3387
- disableInteractive: !0,
3388
- title: o.getTitle() ?? "",
3389
- placement: "left-start",
3390
- children: Mt(Bt, {
3391
- sx: {
3392
- padding: "0px 0px",
3393
- writingMode: m ? "vertical-lr" : "vertical-rl",
3394
- textOrientation: "mixed",
3395
- display: "flex",
3396
- alignItems: "center",
3397
- justifyContent: "space-between",
3398
- minWidth: "0px",
3399
- color: (e) => e.palette.text.secondary
3400
- },
3401
- children: [m ? c : a, m ? a : c]
3402
- })
3403
- }),
3404
- sx: {
3405
- padding: "4px 4px",
3406
- minWidth: "0px",
3407
- minHeight: "0px",
3408
- borderRadius: "4px"
3409
- },
3410
- className: So("taskpane-strip-item", { "Mui-selected": r }),
3411
- onClick: () => e.onSelect(t)
3412
- }, t);
3413
- }), [
3414
- r,
3415
- l,
3416
- a,
3417
- i,
3418
- m,
3419
- d,
3420
- Ge()
3421
- ]);
3422
- return Ot(Bt, {
3423
- ref: qe(t, () => ({ isTaskPaneStrip: () => !0 }), []),
3424
- className: st(() => So("taskpane-strip", p), [p]),
3425
- sx: {
3426
- paddingLeft: m ? void 0 : "2px",
3427
- paddingRight: m ? "2px" : void 0,
3428
- paddingTop: "4px",
3429
- ...s
3430
- },
3431
- ...u,
3432
- children: Ot(ro, {
3433
- orientation: "vertical",
3434
- variant: "scrollable",
3435
- value: l,
3436
- onChange: (e, t) => {
3437
- a(t);
3438
- },
3439
- slotProps: {
3440
- list: { sx: { gap: "2px" } },
3441
- indicator: { sx: {
3442
- left: m ? void 0 : "0px",
3443
- right: m ? void 0 : "unset",
3444
- bottom: m ? "0px" : void 0
3445
- } }
3446
- },
3447
- children: g
3448
- })
3449
- });
3450
- })), pr = (e) => {
3451
- const { title: t, icon: o, onClose: n, readOnly: r, focused: a, ...l } = e, i = dt(null), s = Ze();
3452
- return Ot(Kt, {
3453
- className: So({ "Mui-selected": a }),
3454
- sx: {
3455
- display: "flex",
3456
- flex: "1 1 %0",
3457
- color: (e) => e.palette.text.secondary,
3458
- boxSizing: "border-box",
3459
- padding: "0 0",
3460
- transitionProperty: "opacity",
3461
- transitionDuration: (e) => `${e.transitions.duration.shortest}ms`,
3462
- opacity: .7,
3463
- "&.Mui-selected": {
3464
- opacity: 1,
3465
- transitionDuration: (e) => e.transitions.duration.shortest / 2 + "ms"
3466
- },
3467
- backgroundColor: (e) => po(e.palette.action.hover, .03),
3468
- borderBottom: `solid ${dr} 1px`
3469
- },
3470
- ...l,
3471
- children: Mt(Bt, {
3472
- sx: {
3473
- display: "flex",
3474
- flex: "1 1 10%",
3475
- flexDirection: "row",
3476
- alignItems: "center",
3477
- marginTop: (e) => e.spacing(.25),
3478
- marginBottom: (e) => e.spacing(.25),
3479
- marginLeft: (e) => e.spacing(1),
3480
- marginRight: (e) => e.spacing(1)
3481
- },
3482
- children: [Ot(Bt, {
3483
- sx: {
3484
- flex: "1 1 100%",
3485
- paddingLeft: (e) => e.spacing(1)
3486
- },
3487
- children: t
3488
- }), Ot(ft, {
3489
- label: s("taskPane.close"),
3490
- children: Ot(Gt, {
3491
- "aria-label": "close",
3492
- sx: { color: (e) => e.palette.text.icon ?? e.palette.action.active },
3493
- touchRippleRef: i,
3494
- onPointerDown: (e) => {
3495
- i.current?.start(e, { center: !1 }), e.stopPropagation(), e.preventDefault();
3496
- },
3497
- onPointerUp: () => {
3498
- n();
3499
- },
3500
- children: Ot(We, { iconKey: "Close" })
3501
- })
3502
- })]
3503
- })
3504
- });
3505
- }, ur = ot((e, t) => {
3506
- const { model: o, side: n, ...r } = e, a = mo();
3507
- return Ot(le, {
3508
- model: o,
3509
- ref: t,
3510
- propsFrame: { style: {
3511
- border: `solid ${dr} 1px`,
3512
- borderRadius: `${a.shape.borderRadius ?? 4}px`,
3513
- marginBottom: `${a.spacing?.(.5) ?? 4}px`
3514
- } },
3515
- alwaysShowStrip: !0,
3516
- componentTitle: pr,
3517
- componentStrip: cr,
3518
- side: n,
3519
- ...e,
3520
- onOpen: () => {
3521
- e?.onOpen?.();
3522
- },
3523
- onClose: () => {
3524
- e?.onClose?.();
3525
- },
3526
- ...r
3527
- });
3528
- }), mr = "_styled-resizer_fdl5y_3", gr = {}, hr = {
3529
- flex: "1 1 100%",
3530
- display: "flex",
3531
- boxSizing: "border-box"
3532
- }, yr = rt(ot((e, t) => {
3533
- const { mainElement: o, sidebarElement: n, position: r, persistKey: a, onPositionChange: l, className: i, style: s, taskSide: d = "right", ...c } = e, [p, u] = Ye(a ?? null, gr), m = mo(), [g, { width: h }] = Fo(), y = h > 530 || 0 === h, f = dt(null);
3534
- let b, x, v = null, C = 4, k = 13;
3535
- y ? v = "m 3.6261898,11.36243 c 0,0.88365 -0.71627,1.59991 -1.59991,1.59991 -0.8836498,0 -1.60004965,-0.71626 -1.60004965,-1.59991 0,-0.88365 0.71639985,-1.6000508 1.60004965,-1.6000508 0.88364,0 1.59991,0.7164008 1.59991,1.6000508 m 0,-4.881294 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 -0.8836498,0 -1.60004965,-0.7164 -1.60004965,-1.60004 0,-0.88365 0.71639985,-1.60005 1.60004965,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-4.881226 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 1.14263,3.19996 0.42623015,2.48356 0.42623015,1.59991 0.42623015,0.71626 1.14263,0 2.0262798,0 c 0.88364,0 1.59991,0.71626 1.59991,1.59991" : (v = "M 1.59991,3.62619 C 0.71626,3.62619 0,2.90992 0,2.02628 0,1.1426301 0.71626,0.42623015 1.59991,0.42623015 c 0.88365,0 1.6000508,0.71639995 1.6000508,1.60004985 0,0.88364 -0.7164008,1.59991 -1.6000508,1.59991 m 4.881294,0 c -0.88364,0 -1.60004,-0.71627 -1.60004,-1.59991 0,-0.8836499 0.7164,-1.60004985 1.60004,-1.60004985 0.88365,0 1.60005,0.71639995 1.60005,1.60004985 0,0.88364 -0.7164,1.59991 -1.60005,1.59991 m 4.881226,0 c -0.88365,0 -1.60005,-0.71627 -1.60005,-1.59991 0,-0.8836499 0.7164,-1.60004985 1.60005,-1.60004985 0.88365,0 1.59991,0.71639995 1.59991,1.60004985 0,0.88364 -0.71626,1.59991 -1.59991,1.59991", C = 13, k = 4);
3536
- let w, S = o, T = n;
3537
- const F = "right" !== d, D = y ? "row" : "column", N = F && T ? "before" : "after", P = `${D}:${N}`, I = a ? p[P] : void 0, O = null != I ? `${I}%` : ((e, t) => {
3538
- if (null == e) return "40%";
3539
- if ("number" == typeof e || "string" == typeof e) return e;
3540
- const o = e[t];
3541
- return null != o ? `${o}%` : "40%";
3542
- })(r, P), M = a || l ? (e) => {
3543
- a && u((t) => ({
3544
- ...t,
3545
- [P]: e.percent
3546
- })), l?.(e, {
3547
- orientation: D,
3548
- side: N,
3549
- key: P
3550
- });
3551
- } : void 0;
3552
- return F && T ? (S = n, T = o, x = { style: {
3553
- flexDirection: "column",
3554
- boxSizing: "border-box",
3555
- paddingRight: "2px"
3556
- } }, b = {}, w = {
3557
- fixedPane: "before",
3558
- position: O,
3559
- minBefore: y ? "280px" : "120px",
3560
- splitDirection: y ? "row" : "column"
3561
- }) : (b = { style: {
3562
- flexDirection: "column",
3563
- marginRight: n ? void 0 : "6px"
3564
- } }, x = { style: {
3565
- marginLeft: y ? "0px" : "4px",
3566
- marginRight: y ? "8px" : "4px"
3567
- } }, w = {
3568
- fixedPane: "after",
3569
- position: O,
3570
- minAfter: y ? "280px" : "120px",
3571
- splitDirection: y ? "row" : "column"
3572
- }), Ot(ze, {
3573
- ref: To([
3574
- f,
3575
- g,
3576
- t
3577
- ]),
3578
- className: i,
3579
- style: s ? {
3580
- ...hr,
3581
- ...s
3582
- } : hr,
3583
- ...c,
3584
- ...w,
3585
- onPositionChange: M,
3586
- propsResizer: {
3587
- className: So("styled-resizer", mr),
3588
- style: {
3589
- minWidth: y ? "7px" : void 0,
3590
- minHeight: y ? void 0 : "6px",
3591
- maskImage: `url("data:image/svg+xml,%3Csvg width='${C}' height='${k}' viewBox='0 0 ${C} ${k}' version='1.1' fill='${m.palette.text.icon ?? m.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='${v}' /%3E%3C/svg%3E%0A")`,
3592
- maskRepeat: "no-repeat",
3593
- maskPosition: F ? y ? "center center" : "bottom center" : y ? "left center" : "top center"
3594
- }
3595
- },
3596
- elementBefore: S,
3597
- propsPaneBefore: b,
3598
- elementAfter: T,
3599
- propsPaneAfter: x
3600
- });
3601
- }));
3602
- yr.displayName = "StudioSplitPane";
3603
- var fr = $.BuiltInSelectorNames, br = {
3604
- [fr.Whole]: "FormulaMathTrig",
3605
- [fr.Number]: "IncreaseDecimal",
3606
- [fr.List]: "Menu",
3607
- [fr.Date]: "FormulaDateTime",
3608
- [fr.DateTime]: "FormulaDateTime",
3609
- [fr.Time]: "FormulaDateTime",
3610
- [fr.TextLength]: "FormulaText"
3611
- }, xr = (e) => {
3612
- const t = e.getCondition();
3613
- if (!t) return "DataValidation";
3614
- const o = t.toJSON();
3615
- return o.operator === $.BuiltInOperatorNames.Expression ? "FormulaCustom" : "string" == typeof o.selector && br[o.selector] || "DataValidation";
3616
- }, vr = rt(({ dataValidation: e, size: t = 28 }) => (ke(e, "onAnyChange"), Ot(A, {
3617
- className: "sxl-dv-icon",
3618
- sx: {
3619
- width: "auto",
3620
- minWidth: 1.7 * t + "px",
3621
- height: `${t}px`
3622
- },
3623
- children: Ot(We, {
3624
- iconKey: xr(e),
3625
- size: Math.round(.6 * t),
3626
- ariaHidden: !0
3627
- })
3628
- })));
3629
- vr.displayName = "DataValidationIcon";
3630
- var Cr = (e, t) => {
3631
- const o = e.getCondition();
3632
- if (!o) return t("dataValidation.anyValue");
3633
- const n = o.toJSON();
3634
- if (n.operator === $.BuiltInOperatorNames.Expression && "string" == typeof n.param) return t("dataValidation.titleCustom", { formula: n.param });
3635
- if (n.selector === $.BuiltInSelectorNames.List && n.operator === $.BuiltInOperatorNames.InSet) {
3636
- const e = n.param?.items, o = Array.isArray(e) ? e.map((e) => String(e ?? "")) : "string" == typeof e ? ((e) => e.length < 2 || !e.startsWith("\"") || !e.endsWith("\"") ? null : e.slice(1, -1).replace(/""/g, "\"").split(",").map((e) => e.trimStart()))(e) : null;
3637
- if (o) return t("dataValidation.titleList", {
3638
- items: o.slice(0, 3).join(", "),
3639
- more: Math.max(0, o.length - 3)
3640
- });
3641
- if ("string" == typeof e) return t("dataValidation.titleListFrom", { source: e });
3642
- }
3643
- return o.toString();
3644
- }, kr = {
3645
- [_.AlertStyle.Stop]: "ValidationStop",
3646
- [_.AlertStyle.Warning]: "ValidationWarning",
3647
- [_.AlertStyle.Information]: "ValidationInformation"
3648
- }, wr = {
3649
- [_.AlertStyle.Stop]: ko("dataValidation.alertStop"),
3650
- [_.AlertStyle.Warning]: ko("dataValidation.alertWarning"),
3651
- [_.AlertStyle.Information]: ko("dataValidation.alertInformation")
3652
- }, Sr = ({ checked: e, onCheckedChange: t, label: o, readOnly: n, children: r }) => Mt(At, {
3653
- expanded: e,
3654
- onChange: (e, o) => {
3655
- n || t(o);
3656
- },
3657
- disableGutters: !0,
3658
- elevation: 0,
3659
- sx: {
3660
- backgroundColor: "action.hover",
3661
- border: 1,
3662
- borderColor: "divider",
3663
- borderRadius: 1,
3664
- mb: 0,
3665
- "&:before": { display: "none" },
3666
- "&.Mui-expanded": {
3667
- margin: 0,
3668
- mb: 1
3669
- }
3670
- },
3671
- children: [Ot(Et, {
3672
- expandIcon: Ot(We, { iconKey: "ExpandMore" }),
3673
- sx: {
3674
- px: 2,
3675
- "& .MuiAccordionSummary-content": { my: 0 },
3676
- "&.Mui-expanded .MuiAccordionSummary-content": { my: 0 }
3677
- },
3678
- children: Ot(Ut, {
3679
- control: Ot(zt, {
3680
- checked: e,
3681
- disabled: n,
3682
- onChange: (e) => {
3683
- e.stopPropagation(), t(e.target.checked);
3684
- },
3685
- onClick: (e) => e.stopPropagation()
3686
- }),
3687
- label: o,
3688
- onClick: (e) => e.stopPropagation()
3689
- })
3690
- }), Ot(Wt, {
3691
- sx: {
3692
- pl: 2,
3693
- pr: 2,
3694
- pt: 0,
3695
- pb: 2,
3696
- display: "flex",
3697
- flexDirection: "column",
3698
- gap: 2
3699
- },
3700
- children: r
3701
- })]
3702
- }), Tr = rt((e) => {
3703
- const { dataValidation: t } = e, o = Ze();
3704
- ke(t, "onAnyChange");
3705
- const n = t.isProtected(), r = t.getRenderHints().includes("list"), a = Mt(Zt, {
3706
- tabIndex: 0,
3707
- className: d["editor-panel"],
3708
- sx: {
3709
- gap: (e) => e.spacing(1),
3710
- paddingTop: (e) => e.spacing(1.25),
3711
- paddingBottom: (e) => e.spacing(2),
3712
- paddingLeft: (e) => e.spacing(1.5),
3713
- paddingRight: (e) => e.spacing(1.5),
3714
- border: (e) => `1px solid ${e.palette.divider}`,
3715
- borderRadius: (e) => e.spacing(1.25),
3716
- overflow: "auto"
3717
- },
3718
- children: [
3719
- Mt(Bt, {
3720
- sx: {
3721
- display: "flex",
3722
- flexDirection: "column",
3723
- gap: (e) => e.spacing(1.75),
3724
- margin: (e) => e.spacing(1.25),
3725
- marginBottom: 0
3726
- },
3727
- children: [Mt(Bt, {
3728
- sx: {
3729
- display: "flex",
3730
- alignItems: "center",
3731
- gap: (e) => e.spacing(1.5)
3732
- },
3733
- children: [Ot(vr, {
3734
- dataValidation: t,
3735
- size: 48
3736
- }), Ot(co, {
3737
- variant: "body2",
3738
- sx: {
3739
- minWidth: 0,
3740
- wordBreak: "break-word"
3741
- },
3742
- children: Cr(t, o)
3743
- })]
3744
- }), Ot(g, {
3745
- item: t,
3746
- label: o("dataValidation.applyTo")
3747
- })]
3748
- }),
3749
- Ot(mn, {
3750
- selectorTitle: o("dataValidation.allow"),
3751
- showIncludeBlanks: !0,
3752
- condition: t.getCondition(),
3753
- ranges: t.getRanges(),
3754
- readOnly: n,
3755
- onConditionChange: (e) => {
3756
- const o = !t.getCondition() && e ? {
3757
- ...e,
3758
- includeBlanks: !0
3759
- } : e;
3760
- t.setCondition(o);
3761
- }
3762
- }),
3763
- r && Ot(Bt, {
3764
- sx: {
3765
- pl: 2,
3766
- pr: 2,
3767
- border: 1,
3768
- borderColor: "divider",
3769
- borderRadius: 1
3770
- },
3771
- children: Ot(Ut, {
3772
- control: Ot(zt, {
3773
- checked: !t.isHideDropdown(),
3774
- disabled: n,
3775
- onChange: (e) => t.setHideDropdown(!e.target.checked)
3776
- }),
3777
- label: o("dataValidation.inCellDropdown")
3778
- })
3779
- }),
3780
- Mt(Sr, {
3781
- checked: t.isShowPromptMessage(),
3782
- onCheckedChange: (e) => t.setShowPromptMessage(e),
3783
- label: o("dataValidation.prompt"),
3784
- readOnly: n,
3785
- children: [Ot(ao, {
3786
- size: "small",
3787
- label: o("dataValidation.title"),
3788
- value: t.getPromptTitle(),
3789
- onChange: (e) => t.setPromptTitle(e.target.value),
3790
- disabled: n,
3791
- fullWidth: !0,
3792
- slotProps: { htmlInput: { maxLength: 32 } },
3793
- sx: { backgroundColor: "background.paper" }
3794
- }), Ot(ao, {
3795
- size: "small",
3796
- label: o("dataValidation.message"),
3797
- value: t.getPromptMessage(),
3798
- onChange: (e) => t.setPromptMessage(e.target.value),
3799
- disabled: n,
3800
- multiline: !0,
3801
- rows: 2,
3802
- fullWidth: !0,
3803
- slotProps: { htmlInput: { maxLength: 254 } },
3804
- sx: { backgroundColor: "background.paper" }
3805
- })]
3806
- }),
3807
- Mt(Sr, {
3808
- checked: t.isShowAlertMessage(),
3809
- onCheckedChange: (e) => t.setShowAlertMessage(e),
3810
- label: o("dataValidation.alert"),
3811
- readOnly: n,
3812
- children: [
3813
- Mt(Ht, {
3814
- fullWidth: !0,
3815
- size: "small",
3816
- disabled: n,
3817
- sx: { backgroundColor: "background.paper" },
3818
- children: [Ot(Qt, { children: o("dataValidation.alertStyle") }), Ot(to, {
3819
- value: t.getAlertStyle(),
3820
- label: o("dataValidation.alertStyle"),
3821
- onChange: (e) => t.setAlertStyle(e.target.value),
3822
- renderValue: (e) => Mt(Bt, {
3823
- sx: {
3824
- display: "flex",
3825
- alignItems: "center",
3826
- gap: 1
3827
- },
3828
- children: [Ot(We, {
3829
- iconKey: kr[e],
3830
- size: 18,
3831
- ariaHidden: !0
3832
- }), o(wr[e])]
3833
- }),
3834
- children: Object.keys(kr).map((e) => Mt(Jt, {
3835
- value: e,
3836
- sx: { gap: 1 },
3837
- children: [Ot(We, {
3838
- iconKey: kr[e],
3839
- size: 18,
3840
- ariaHidden: !0
3841
- }), o(wr[e])]
3842
- }, e))
3843
- })]
3844
- }),
3845
- Ot(ao, {
3846
- size: "small",
3847
- label: o("dataValidation.title"),
3848
- value: t.getAlertTitle(),
3849
- onChange: (e) => t.setAlertTitle(e.target.value),
3850
- disabled: n,
3851
- fullWidth: !0,
3852
- slotProps: { htmlInput: { maxLength: 32 } },
3853
- sx: { backgroundColor: "background.paper" }
3854
- }),
3855
- Ot(ao, {
3856
- size: "small",
3857
- label: o("dataValidation.message"),
3858
- value: t.getAlertMessage(),
3859
- onChange: (e) => t.setAlertMessage(e.target.value),
3860
- disabled: n,
3861
- multiline: !0,
3862
- rows: 2,
3863
- fullWidth: !0,
3864
- slotProps: { htmlInput: { maxLength: 225 } },
3865
- sx: { backgroundColor: "background.paper" }
3866
- })
3867
- ]
3868
- })
3869
- ]
3870
- });
3871
- return Ot(Mo.Provider, {
3872
- value: t,
3873
- children: a
3874
- });
3875
- });
3876
- Tr.displayName = "DataValidationEditorPanel";
3877
- var Fr = ({ children: e }) => Ot(Bt, {
3878
- sx: {
3879
- display: "inline-flex",
3880
- alignItems: "center",
3881
- px: .75,
3882
- py: .25,
3883
- border: 1,
3884
- borderColor: "divider",
3885
- borderRadius: 1,
3886
- color: "text.secondary"
3887
- },
3888
- children: Ot(co, {
3889
- variant: "caption",
3890
- children: e
3891
- })
3892
- }), Dr = rt(({ item: e }) => {
3893
- const t = Ze();
3894
- ke(e, "onAnyChange");
3895
- const o = [];
3896
- return e.isShowPromptMessage() && e.getPromptTitle() && o.push(t("dataValidation.promptPrefix", { title: e.getPromptTitle() })), e.getCondition() && (e.isShowAlertMessage() ? e.getAlertStyle() === _.AlertStyle.Warning ? o.push(t("dataValidation.alertWarning")) : e.getAlertStyle() === _.AlertStyle.Information && o.push(t("dataValidation.alertInformation")) : o.push(t("dataValidation.badgeNoAlert"))), e.isHideDropdown() && e.getRenderHints().includes("list") && o.push(t("dataValidation.badgeDropdownHidden")), 0 === o.length ? null : Ot(Bt, {
3897
- sx: {
3898
- display: "flex",
3899
- flexWrap: "wrap",
3900
- gap: .5
3901
- },
3902
- children: o.map((e, t) => Ot(Fr, { children: e }, t))
3903
- });
3904
- });
3905
- Dr.displayName = "DataValidationCardBody";
3906
- var Nr = rt(({ item: e }) => Ot(g, {
3907
- item: e,
3908
- label: Ze()("dataValidation.applyTo"),
3909
- helperText: null
3910
- }));
3911
- Nr.displayName = "DataValidationCardRanges";
3912
- var Pr = {
3913
- key: "data-validation",
3914
- messageKeys: {
3915
- none: ko("dataValidation.none"),
3916
- addPrompt: ko("dataValidation.addPrompt"),
3917
- heading: ko("dataValidation.heading"),
3918
- insert: ko("dataValidation.insert"),
3919
- new: ko("dataValidation.new"),
3920
- moveUp: ko("dataValidation.moveUp"),
3921
- moveDown: ko("dataValidation.moveDown"),
3922
- edit: ko("dataValidation.edit"),
3923
- duplicate: ko("dataValidation.duplicate"),
3924
- delete: ko("dataValidation.delete"),
3925
- cancel: ko("dataValidation.cancel"),
3926
- save: ko("dataValidation.save")
3927
- },
3928
- getCollection: (e) => e.getDataValidations(),
3929
- changeEvents: ["onDataValidationsChange"],
3930
- isReadOnly: (e) => e.getProtection().isLocked() || e.getProtection().isReadOnly(),
3931
- applyUpdate: (e, t) => {
3932
- e.update(t);
3933
- },
3934
- applyNewDefaults: (e) => {
3935
- e.update({
3936
- alertStyle: _.AlertStyle.Stop,
3937
- showAlertMessage: !0
3938
- });
3939
- },
3940
- applySeed: (e, t) => {
3941
- e.update(t);
3942
- },
3943
- getCardTitle: Cr,
3944
- CardMedia: ({ item: e }) => Ot(vr, {
3945
- dataValidation: e,
3946
- size: 32
3947
- }),
3948
- CardSubtitle: Nr,
3949
- CardBody: Dr,
3950
- EditorBody: ({ item: e }) => Ot(Tr, { dataValidation: e })
3951
- }, Ir = rt(ot((e, t) => {
3952
- const { workbook: o, args: n, ...r } = e;
3953
- return Ot(E, {
3954
- ref: t,
3955
- workbook: o,
3956
- descriptor: Pr,
3957
- args: n,
3958
- dragReorder: !0,
3959
- ...r
3960
- });
3961
- }));
3962
- Ir.displayName = "DataValidationDetailsPanel";
3963
- var Or = (e) => {
3964
- const { model: t, entryKey: o, frame: n, args: r, ref: a, ...l } = e;
3965
- return Ot(Ir, {
3966
- ref: a,
3967
- workbook: t,
3968
- args: r,
3969
- ...l
3970
- });
3971
- };
3972
- c(), Me.register("plugin-table", { icons: {} }), Z.registerTaskPane({
3973
- key: "dataValidationDetails",
3974
- getTitle: () => "Data Validation",
3975
- getIcon: () => "DataValidation",
3976
- component: Or
3977
- }, !0), Z.registerTaskPane({
3978
- key: "conditionalFormatDetails",
3979
- getTitle: () => "Conditional Formatting",
3980
- getIcon: () => "FormatPaint",
3981
- component: qn
3982
- }, !0), s(), i(), r(), a(), N();
3983
- var Mr = () => {
3984
- let e, t;
3985
- const o = new Promise((o, n) => {
3986
- e = o, t = n;
3987
- }), n = {
3988
- promise: o,
3989
- settled: !1,
3990
- resolve: (t) => {
3991
- n.settled = !0, e(t);
3992
- },
3993
- reject: (e) => {
3994
- n.settled = !0, t(e);
3995
- }
3996
- };
3997
- return o.catch(() => {}), n;
3998
- }, Ar = (e, t) => {
3999
- if (!e) return {};
4000
- const { colorSchemes: o, ...n } = e, r = o?.[t ? "dark" : "light"];
4001
- return r && "object" == typeof r ? go.deepMerge(n, r) : n;
4002
- }, Wr = "taskPanePosition", Er = rt(ot((e, t) => {
4003
- const { host: o, scopeClass: r, square: a, elevation: l, variant: i, onWorkbookLoad: s, onDocumentError: d, renderDocumentError: c = S, propsDocumentError: u, propsTaskPaneArea: g, renderTaskPaneArea: h = Br, taskPaneSide: f = "right", onKeyDown: b, workbook: x, onWorkbookChange: v, logo: k, topLeft: w, topRight: T, muiTheme: D, tokens: N, cssBaseline: P, autoFocus: I = !1, title: O, onDirtyChange: A, propsDocumentTitle: W, renderDocumentLoading: E = C, propsDocumentLoading: B, propsWorkbook: R, showFormulaBar: L, propsFormulaBar: V, renderFormulaBar: z, editable: j, showStatusBar: $, propsStatusBar: K, renderStatusBar: _, propsToolbar: H, renderToolbar: U } = e, q = dt(null), G = dt(null), Q = dt(null), Y = _e(() => {
4004
- Q.current?.getNamedCollectionEditorElement?.()?.focus?.();
4005
- }, []), J = _e(d ?? (() => {}), [d]), X = _e(A ?? (() => {}), [A]), Z = W?.placeHolder, [ee] = Ye(se.Mode, void 0), { themeMode: te } = Je({ mode: ee ?? void 0 }), [oe] = Ye(Be.Active, null), ne = dt(oe);
4006
- ne.current = oe;
4007
- const re = Xe(), ae = st(() => ({
4008
- light: Ct(!1, go.deepMerge(Ar(D, !1), M(re?.light))),
4009
- dark: Ct(!0, go.deepMerge(Ar(D, !0), M(re?.dark)))
4010
- }), [
4011
- D,
4012
- re?.light,
4013
- re?.dark
4014
- ]), le = "dark" === te, ge = st(() => y(ae.light, ae.dark, `.${r}`, N), [
4015
- ae,
4016
- r,
4017
- N
4018
- ]), he = st(() => pe("sxl-defaults", `.${r}`), [r]), ye = Ce(), [fe, be] = ct(() => x ?? null);
4019
- it(() => {
4020
- be(x ?? null);
4021
- }, [x]);
4022
- const [xe, ve] = ct(0), Te = dt(null);
4023
- Te.current || (Te.current = Mr());
4024
- const Fe = Se(fe, {
4025
- io: de,
4026
- defaultTheme: ye.getDefaultTheme(),
4027
- reloadKey: xe
4028
- }), Ie = "loaded" === Fe.status ? Fe.workbook : null, Ae = st(() => "error" === Fe.status ? {
4029
- status: "error",
4030
- error: Fe.error
4031
- } : "loaded" === Fe.status ? {
4032
- status: "loaded",
4033
- workbook: Fe.workbook
4034
- } : { status: "loading" }, [Fe]);
4035
- it(() => {
4036
- Te.current.settled && (Te.current = Mr());
4037
- }, [fe, xe]), it(() => {
4038
- "loaded" === Ae.status ? Te.current.resolve(Ae.workbook) : "error" === Ae.status && (J?.(Ae.error), Te.current.reject(Ae.error));
4039
- }, [Ae]);
4040
- const [Ee, Re] = ct(null);
4041
- Ie && !Ee && Re(Ie);
4042
- const Ve = Ie && Ee && Ie !== Ee ? Ie : null, ze = dt(Ve);
4043
- ze.current = Ve;
4044
- const $e = dt(Ee);
4045
- $e.current = Ee;
4046
- const Ke = dt([]), He = at((e) => {
4047
- const t = $e.current;
4048
- t && Ke.current.push(t), be(e);
4049
- }, []);
4050
- it(() => {
4051
- const e = Ke.current;
4052
- if (0 !== e.length) {
4053
- Ke.current = e.filter((e) => e === Ee);
4054
- for (let t = 0; t < e.length; t++) {
4055
- const o = e[t];
4056
- if (o !== Ee) try {
4057
- o.close();
4058
- } catch (e) {
4059
- console.warn("Unable to close the replaced workbook", e);
4060
- }
4061
- }
4062
- }
4063
- }, [Ee]);
4064
- const Ue = j ? null : Ee, Ge = we(), Qe = st(() => Ue ? ue(Ue.getSelectedSheet(), { referenceMode: Ge }) : null, [Ue, Ge]), Ze = j ?? Qe, et = dt(Ze);
4065
- et.current = Ze, it(() => {
4066
- if (!Ze) return;
4067
- let e = Ze.getSession();
4068
- return Ze.subscribe(() => {
4069
- const t = e;
4070
- e = Ze.getSession(), t && !e && "formula-bar" === t.getActiveEditorId() && Q.current?.contains?.(document.activeElement) && q.current?.focus();
4071
- });
4072
- }, [Ze]);
4073
- const tt = Ne(Ee), { isDirty: ot, saveState: nt } = Pe(Ee, de), rt = De(Ee), lt = dt(nt), pt = dt(null);
4074
- lt.current = nt;
4075
- const ut = at(() => lt.current?.isDirty() ?? !1, []), ht = dt(Ae);
4076
- ht.current = Ae;
4077
- const [yt, ft] = ct(null), xt = O ?? W?.title, [vt, kt] = ct(null);
4078
- it(() => {
4079
- kt(null);
4080
- }, [Ee]);
4081
- const wt = xt ?? vt ?? tt ?? "";
4082
- it(() => {
4083
- X?.(ot);
4084
- }, [ot]);
4085
- const St = _e(v ?? (() => {}), [v]);
4086
- it(() => {
4087
- St?.(Ie);
4088
- }, [Ie]);
4089
- const Tt = dt(Ie);
4090
- Tt.current = Ie, ke(Ee, "onViewChange");
4091
- const Ft = st(() => Ot(mt, {
4092
- groupKey: "helpOptions",
4093
- disableHover: !0,
4094
- sx: { padding: "0" },
4095
- propsButton: { sx: { maxHeight: "22px" } }
4096
- }), []), [Dt, Nt] = ct(null), Pt = at((e) => {
4097
- Nt(e);
4098
- }, []);
4099
- it(() => {
4100
- Me.prefetch().catch((e) => {
4101
- console.warn("Icons could not be loaded:", e);
4102
- });
4103
- }, []);
4104
- const At = dt(null);
4105
- At.current || (At.current = Mr());
4106
- const Wt = dt(null), Et = at(() => Wt.current?.getSheetElement()?.getGridSurface()?.getPane()?.getElement() ?? At.current.promise, []), Rt = _e(async (e) => {
4107
- const t = ne.current;
4108
- t && t !== yo.getActive() && await yo.setActive(t), await Oe.DefaultCommandCatalogService.prefetch(t ?? void 0), ft(e), Wt.current = e.source, At.current.settled || At.current.resolve(e.source.getSheetElement()?.getGridSurface()?.getPane()?.getElement() ?? null), s?.(e);
4109
- }, []), Lt = dt(null), Vt = at((e) => {
4110
- let t = null, o = {
4111
- readOnly: !0,
4112
- ...W
4113
- };
4114
- return W?.hidden || (t = Ot(n, {
4115
- ...o,
4116
- style: {
4117
- maxWidth: "100%",
4118
- ...W?.style
4119
- },
4120
- workbook: e.workbook ?? q.current,
4121
- ref: Lt,
4122
- title: wt,
4123
- modified: ot,
4124
- encrypted: rt,
4125
- placeHolder: Z,
4126
- onTitleChange: (e) => {
4127
- kt(e), W?.onTitleChange?.(e);
4128
- }
4129
- })), Ot(Jn, {
4130
- ...e,
4131
- logo: k,
4132
- mainElement: t,
4133
- startElement: w,
4134
- endElement: T
4135
- });
4136
- }, [
4137
- k,
4138
- wt,
4139
- ot,
4140
- rt,
4141
- W,
4142
- w,
4143
- T
4144
- ]);
4145
- it(() => {
4146
- const e = q.current;
4147
- if (!e) return;
4148
- const t = (e) => e.preventDefault();
4149
- return e.addEventListener("wheel", t, { passive: !1 }), () => {
4150
- e.removeEventListener("wheel", t);
4151
- };
4152
- }, [yt]);
4153
- const [zt, jt] = ct(null);
4154
- it(() => {
4155
- jt(yt?.source?.getCommandScope?.() ?? null);
4156
- }, [yt]);
4157
- const Kt = st(() => ({
4158
- "& .SnackbarContainer-root": { position: "absolute !important" },
4159
- "& .notistack-SnackbarContainer > div": { maxWidth: "min(100%, 720px)" },
4160
- "& .notistack-Snackbar": { minWidth: "unset" },
4161
- "& .notistack-Snackbar > .error-snackbar .MuiTypography-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
4162
- "& .notistack-Snackbar > .error-snackbar .MuiCardActions-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
4163
- "& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
4164
- "& .notistack-MuiContent *": { fontFamily: (e) => e.typography.fontFamily },
4165
- "& #notistack-snackbar": {
4166
- maxWidth: "560px",
4167
- whiteSpace: "pre-wrap"
4168
- },
4169
- "*": { userSelect: "none" }
4170
- }), []), [_t, Ht] = ct(null), [, Ut] = Ye(null, !1);
4171
- it(() => {
4172
- Ut(null != _t);
4173
- }, [_t, Ut]);
4174
- const qt = at((e) => h({
4175
- model: Ee,
4176
- side: f,
4177
- ...e,
4178
- ...g
4179
- }), [
4180
- Ee,
4181
- f,
4182
- g
4183
- ]), Gt = dt(o);
4184
- Gt.current = o, qe(t, () => ({
4185
- isStudioElement: () => !0,
4186
- save: (e) => {
4187
- const t = pt.current;
4188
- return t ? t(e) : Promise.reject(/* @__PURE__ */ new Error("The studio cannot save: no workbook, or the backing store cannot write."));
4189
- },
4190
- getWorkbookElement: () => q.current,
4191
- getWorkbook: () => Tt.current ?? null,
4192
- isDirty: () => lt.current?.isDirty() ?? !1,
4193
- getEditable: () => et.current,
4194
- getFormulaBarElement: () => Q.current ?? null,
4195
- focus: () => q.current?.focus(),
4196
- whenReady: () => (Te.current || (Te.current = Mr()), Te.current.promise),
4197
- getWorkbookState: () => ht.current,
4198
- retry: () => ve((e) => e + 1)
4199
- }), [], o);
4200
- const Qt = dt(!1), Yt = _e((e, t) => {
4201
- t === ze.current && requestAnimationFrame(() => requestAnimationFrame(() => {
4202
- t === ze.current && (Qt.current = Gt.current?.contains(document.activeElement) ?? !0, Re(t), Rt(e));
4203
- }));
4204
- }, []);
4205
- it(() => {
4206
- Qt.current && (Qt.current = !1, q.current?.focus());
4207
- }, [Ee]);
4208
- const Jt = at(() => Ot(It, {}), []), Xt = at((e) => {
4209
- const { ref: t, ...o } = e, n = le ? ae.dark : ae.light, r = "error" === Ae.status ? c({
4210
- ...u,
4211
- style: {
4212
- width: "100%",
4213
- height: "100%",
4214
- ...u?.style
4215
- },
4216
- error: Ae.error
4217
- }) : null;
4218
- if (r && !Ee) return Ot(Zt, {
4219
- style: {
4220
- width: "100%",
4221
- height: "100%",
4222
- position: "absolute",
4223
- display: "flex",
4224
- alignItems: "stretch",
4225
- justifyContent: "stretch"
4226
- },
4227
- children: r
4228
- });
4229
- let s = null;
4230
- if (Ee) {
4231
- const e = Ee, r = e.getView(), a = L ?? r?.isShowFormulaBar(), l = $ ?? r?.isShowStatusBar(), i = yt?.source ?? q.current, d = (U ?? Vt)({
4232
- workbook: i,
4233
- ...H
4234
- }), c = a ? (z ?? F)({
4235
- ref: Q,
4236
- style: {
4237
- marginTop: n.spacing(.25),
4238
- marginLeft: n.spacing(1),
4239
- marginRight: n.spacing(1),
4240
- marginBottom: n.spacing(.75)
4241
- },
4242
- workbook: e,
4243
- editable: Ze ?? void 0,
4244
- ...V,
4245
- propsNamedCollectionEditor: {
4246
- restoreFocus: (e) => i?.focus(e),
4247
- ...V?.propsNamedCollectionEditor
4248
- }
4249
- }) : null, u = l ? (_ ?? m)({
4250
- childrenEnd: Ft,
4251
- ...K
4252
- }) : null, g = (e, n) => Ot(p, {
4253
- ...R,
4254
- tabIndex: 0,
4255
- autoFocus: !n && I,
4256
- workbook: e,
4257
- editable: n ? void 0 : Ze ?? void 0,
4258
- focusNameBox: n ? void 0 : Y,
4259
- ref: n ? G : To([t, q]),
4260
- onWorkbookLoad: n ? (t) => Yt(t, e) : Rt,
4261
- onKeyDown: (e) => {
4262
- b?.(e);
4263
- },
4264
- propsWorkbookLoading: B,
4265
- renderWorkbookLoading: Jt,
4266
- style: n ? {
4267
- ...R?.style,
4268
- position: "absolute",
4269
- inset: 0,
4270
- visibility: "hidden"
4271
- } : {
4272
- flex: "1 1 100%",
4273
- minHeight: 0,
4274
- ...R?.style
4275
- },
4276
- onContextMenu: (e) => e.preventDefault(),
4277
- ...n ? null : o
4278
- }, e.getId());
4279
- s = Mt("div", {
4280
- style: {
4281
- display: "flex",
4282
- flexDirection: "column",
4283
- flex: "1 1 100%",
4284
- minWidth: 0,
4285
- minHeight: 0,
4286
- ...me({
4287
- window: n.palette.background.default,
4288
- windowText: n.palette.text.primary
4289
- })
4290
- },
4291
- children: [
4292
- d,
4293
- c,
4294
- Ot(yr, {
4295
- taskSide: f,
4296
- persistKey: Wr,
4297
- sidebarElement: _t ? Ot(Oe.CommandScopeProvider, {
4298
- scope: zt,
4299
- children: _t
4300
- }) : void 0,
4301
- mainElement: Mt("div", {
4302
- style: {
4303
- position: "relative",
4304
- display: "flex",
4305
- flexDirection: "column",
4306
- flex: "1 1 100%",
4307
- minWidth: 0,
4308
- minHeight: 0
4309
- },
4310
- children: [[g(Ee, !1), Ve ? g(Ve, !0) : null], Ot(Bt, {
4311
- ref: Pt,
4312
- sx: {
4313
- position: "absolute",
4314
- top: "10%",
4315
- left: 0,
4316
- right: 0,
4317
- bottom: 0,
4318
- pointerEvents: "none",
4319
- "& > :first-of-type": { position: "relative" }
4320
- }
4321
- })]
4322
- })
4323
- }),
4324
- u
4325
- ]
4326
- });
4327
- }
4328
- const d = yt ? null : E({ ...B });
4329
- return Mt(Zt, {
4330
- sx: Kt,
4331
- style: {
4332
- width: "100%",
4333
- height: "100%",
4334
- position: "absolute",
4335
- display: "flex",
4336
- alignItems: "stretch",
4337
- justifyContent: "stretch",
4338
- backgroundColor: "var(--sxl-color-base-200)"
4339
- },
4340
- className: "eager-studio",
4341
- square: a,
4342
- elevation: l,
4343
- variant: i,
4344
- children: [
4345
- s,
4346
- r ? Ot(Zt, {
4347
- style: {
4348
- position: "absolute",
4349
- inset: 0,
4350
- display: "flex",
4351
- alignItems: "stretch",
4352
- justifyContent: "stretch"
4353
- },
4354
- children: r
4355
- }) : null,
4356
- d ? Ot("div", {
4357
- style: {
4358
- position: "absolute",
4359
- inset: 0,
4360
- display: "flex",
4361
- alignItems: "center",
4362
- justifyContent: "center",
4363
- background: `var(--sxl-color-base-100, ${le ? "#121212" : "#fff"})`
4364
- },
4365
- children: d
4366
- }) : null
4367
- ]
4368
- });
4369
- }, [
4370
- Ae,
4371
- Ee,
4372
- Ve,
4373
- yt,
4374
- wt,
4375
- E,
4376
- B,
4377
- Jt,
4378
- R,
4379
- a,
4380
- l,
4381
- i,
4382
- Ft,
4383
- c,
4384
- u,
4385
- Vt,
4386
- Kt,
4387
- _t,
4388
- f,
4389
- zt,
4390
- L,
4391
- V,
4392
- z,
4393
- Ze,
4394
- $,
4395
- K,
4396
- _,
4397
- H,
4398
- U,
4399
- ae,
4400
- le
4401
- ]);
4402
- let eo = Ot(No, {
4403
- maxSnack: 3,
4404
- domRoot: Dt ?? void 0,
4405
- anchorOrigin: {
4406
- vertical: "bottom",
4407
- horizontal: "right"
4408
- },
4409
- autoHideDuration: 3500,
4410
- onClose: (e, t, o) => {
4411
- q.current?.focus();
4412
- },
4413
- Components: { error: Qn },
4414
- iconVariant: {
4415
- success: Ot(oo, {
4416
- style: { marginRight: "8px" },
4417
- children: Ot("path", { d: "M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z" })
4418
- }),
4419
- error: Ot(We, {
4420
- iconKey: "ErrorAlert",
4421
- style: { marginRight: "8px" }
4422
- })
4423
- },
4424
- children: Ot(ce, {
4425
- workbook: Ee,
4426
- children: Ot(ie, {
4427
- renderArea: qt,
4428
- onUpdateArea: (e) => {
4429
- Ht(e);
4430
- },
4431
- children: Ot(bt, { children: Ot(sr, { children: Ot(je, { children: Ot(Le, { children: Ot(ar, {
4432
- workbook: Ee,
4433
- initialCommandAnchor: Et,
4434
- renderWorkbook: Xt,
4435
- setWorkbook: He,
4436
- titleWorkbook: wt,
4437
- setWorkbookTitle: kt,
4438
- refDocumentTitle: Lt,
4439
- isDirty: ut,
4440
- refSave: pt
4441
- }) }) }) }) })
4442
- })
4443
- })
4444
- });
4445
- return eo = Mt(lo, {
4446
- theme: le ? ae.dark : ae.light,
4447
- children: [
4448
- P ? Ot($t, {}) : null,
4449
- Ot("style", { children: ge }),
4450
- Ot("style", { children: he }),
4451
- Ot(gt, {
4452
- themeScopeClass: r,
4453
- themeSurface: "app",
4454
- themeMode: te,
4455
- children: eo
4456
- })
4457
- ]
4458
- }), eo;
4459
- }));
4460
- Er.displayName = "EagerStudio";
4461
- var Br = (e) => Ot(ur, { ...e });
4462
- export { Er as EagerStudio, Er as default };