@sheetxl/studio-mui 0.8.0-beta.9 → 1.0.0

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