@quillsql/admin 1.6.1 → 1.6.2

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 (678) hide show
  1. package/dist/cjs/Admin.d.ts +41 -87
  2. package/dist/cjs/Admin.d.ts.map +1 -1
  3. package/dist/cjs/Admin.js +358 -456
  4. package/dist/cjs/AdminProvider.d.ts +108 -50
  5. package/dist/cjs/AdminProvider.d.ts.map +1 -1
  6. package/dist/cjs/AdminProvider.js +390 -208
  7. package/dist/cjs/api/ConnectionClient.d.ts +20 -38
  8. package/dist/cjs/api/ConnectionClient.d.ts.map +1 -1
  9. package/dist/cjs/api/ConnectionClient.js +291 -321
  10. package/dist/cjs/assets/ArrowDownHeadIcon.d.ts.map +1 -1
  11. package/dist/cjs/components/Banner/index.d.ts +0 -1
  12. package/dist/cjs/components/Banner/index.d.ts.map +1 -1
  13. package/dist/cjs/components/Banner/index.js +1 -1
  14. package/dist/cjs/components/CardSection.js +1 -1
  15. package/dist/cjs/components/CardTitle.js +1 -1
  16. package/dist/cjs/components/ClipboardButton.d.ts +8 -0
  17. package/dist/cjs/components/ClipboardButton.d.ts.map +1 -0
  18. package/dist/cjs/components/ClipboardButton.js +74 -0
  19. package/dist/cjs/components/DashboardSelectPopover.d.ts +8 -5
  20. package/dist/cjs/components/DashboardSelectPopover.d.ts.map +1 -1
  21. package/dist/cjs/components/DashboardSelectPopover.js +74 -185
  22. package/dist/cjs/components/DatabaseMismatchCard.d.ts +3 -3
  23. package/dist/cjs/components/DatabaseMismatchCard.d.ts.map +1 -1
  24. package/dist/cjs/components/DatabaseMismatchCard.js +3 -3
  25. package/dist/cjs/components/DatabaseSelector.d.ts.map +1 -1
  26. package/dist/cjs/components/DatabaseSelector.js +10 -2
  27. package/dist/cjs/components/DateRangePicker/SingleDatePicker.d.ts +10 -0
  28. package/dist/cjs/components/DateRangePicker/SingleDatePicker.d.ts.map +1 -0
  29. package/dist/cjs/components/DateRangePicker/SingleDatePicker.js +263 -0
  30. package/dist/cjs/components/DateRangePicker/YearlessDateRangePicker.d.ts +18 -0
  31. package/dist/cjs/components/DateRangePicker/YearlessDateRangePicker.d.ts.map +1 -0
  32. package/dist/cjs/components/DateRangePicker/YearlessDateRangePicker.js +288 -0
  33. package/dist/cjs/components/DateRangePicker/dateRangePickerUtils.d.ts +91 -0
  34. package/dist/cjs/components/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -0
  35. package/dist/cjs/components/DateRangePicker/dateRangePickerUtils.js +898 -0
  36. package/dist/cjs/components/DeleteButton.d.ts +0 -1
  37. package/dist/cjs/components/DeleteButton.d.ts.map +1 -1
  38. package/dist/cjs/components/DeleteButton.js +1 -1
  39. package/dist/cjs/components/DropDownMenu.js +1 -1
  40. package/dist/cjs/components/DropDownMenuWithLabel.d.ts +4 -3
  41. package/dist/cjs/components/DropDownMenuWithLabel.d.ts.map +1 -1
  42. package/dist/cjs/components/DropDownMenuWithLabel.js +56 -29
  43. package/dist/cjs/components/DynamicBanner.d.ts +2 -5
  44. package/dist/cjs/components/DynamicBanner.d.ts.map +1 -1
  45. package/dist/cjs/components/DynamicBanner.js +3 -3
  46. package/dist/cjs/components/EmptyDashboardComponent/index.d.ts +0 -1
  47. package/dist/cjs/components/EmptyDashboardComponent/index.d.ts.map +1 -1
  48. package/dist/cjs/components/EmptyDashboardComponent/index.js +6 -5
  49. package/dist/cjs/components/EmptyVirtualTablesComponent.d.ts +4 -0
  50. package/dist/cjs/components/EmptyVirtualTablesComponent.d.ts.map +1 -0
  51. package/dist/cjs/components/EmptyVirtualTablesComponent.js +41 -0
  52. package/dist/cjs/components/ExternalLink.d.ts +4 -0
  53. package/dist/cjs/components/ExternalLink.d.ts.map +1 -0
  54. package/dist/cjs/components/ExternalLink.js +15 -0
  55. package/dist/cjs/components/FormTooltip.d.ts +8 -0
  56. package/dist/cjs/components/FormTooltip.d.ts.map +1 -0
  57. package/dist/cjs/components/FormTooltip.js +89 -0
  58. package/dist/cjs/components/InputLabel.d.ts +4 -1
  59. package/dist/cjs/components/InputLabel.d.ts.map +1 -1
  60. package/dist/cjs/components/InputLabel.js +13 -8
  61. package/dist/cjs/components/InternalDashboard/ChartSkeleton.d.ts +11 -0
  62. package/dist/cjs/components/InternalDashboard/ChartSkeleton.d.ts.map +1 -0
  63. package/dist/cjs/components/InternalDashboard/ChartSkeleton.js +21 -0
  64. package/dist/cjs/components/InternalDashboard/DashboardFilter.d.ts +20 -0
  65. package/dist/cjs/components/InternalDashboard/DashboardFilter.d.ts.map +1 -0
  66. package/dist/cjs/components/InternalDashboard/DashboardFilter.js +104 -0
  67. package/dist/cjs/components/InternalDashboard/DashboardLoadingComponent.d.ts +7 -0
  68. package/dist/cjs/components/InternalDashboard/DashboardLoadingComponent.d.ts.map +1 -0
  69. package/dist/cjs/components/InternalDashboard/DashboardLoadingComponent.js +22 -0
  70. package/dist/cjs/components/InternalDashboard/DateRangePicker/QuillDateRangePicker.d.ts +37 -0
  71. package/dist/cjs/components/InternalDashboard/DateRangePicker/QuillDateRangePicker.d.ts.map +1 -0
  72. package/dist/cjs/components/InternalDashboard/DateRangePicker/QuillDateRangePicker.js +275 -0
  73. package/dist/cjs/components/InternalDashboard/DateRangePicker/dateRangePickerUtils.d.ts +85 -0
  74. package/dist/cjs/components/InternalDashboard/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -0
  75. package/dist/cjs/components/InternalDashboard/DateRangePicker/dateRangePickerUtils.js +534 -0
  76. package/dist/cjs/components/InternalDashboard/InternalDashboard.d.ts +17 -0
  77. package/dist/cjs/components/InternalDashboard/InternalDashboard.d.ts.map +1 -0
  78. package/dist/cjs/components/InternalDashboard/InternalDashboard.js +1947 -0
  79. package/dist/cjs/components/OrgSelect.d.ts +9 -13
  80. package/dist/cjs/components/OrgSelect.d.ts.map +1 -1
  81. package/dist/cjs/components/OrgSelect.js +136 -119
  82. package/dist/cjs/components/QuillMultiSelectWithCombo.d.ts +30 -0
  83. package/dist/cjs/components/QuillMultiSelectWithCombo.d.ts.map +1 -0
  84. package/dist/cjs/components/QuillMultiSelectWithCombo.js +504 -0
  85. package/dist/cjs/components/QuillPopover.d.ts +11 -0
  86. package/dist/cjs/components/QuillPopover.d.ts.map +1 -0
  87. package/dist/cjs/components/QuillPopover.js +180 -0
  88. package/dist/cjs/components/QuillSelect.d.ts +1 -1
  89. package/dist/cjs/components/QuillSelect.d.ts.map +1 -1
  90. package/dist/cjs/components/QuillSelect.js +38 -16
  91. package/dist/cjs/components/QuillSelectWithCombo.d.ts +22 -0
  92. package/dist/cjs/components/QuillSelectWithCombo.d.ts.map +1 -0
  93. package/dist/cjs/components/QuillSelectWithCombo.js +327 -0
  94. package/dist/cjs/components/QuillTab.d.ts +12 -0
  95. package/dist/cjs/components/QuillTab.d.ts.map +1 -0
  96. package/dist/cjs/components/QuillTab.js +84 -0
  97. package/dist/cjs/components/QuillToolTipPortal.d.ts +11 -0
  98. package/dist/cjs/components/QuillToolTipPortal.d.ts.map +1 -0
  99. package/dist/cjs/components/QuillToolTipPortal.js +108 -0
  100. package/dist/cjs/components/SegmentedControl.d.ts +8 -2
  101. package/dist/cjs/components/SegmentedControl.d.ts.map +1 -1
  102. package/dist/cjs/components/SegmentedControl.js +11 -12
  103. package/dist/cjs/components/SqlTextEditor.d.ts +2 -5
  104. package/dist/cjs/components/SqlTextEditor.d.ts.map +1 -1
  105. package/dist/cjs/components/SqlTextEditor.js +20 -19
  106. package/dist/cjs/components/StepDisplay.d.ts.map +1 -1
  107. package/dist/cjs/components/StepDisplay.js +2 -2
  108. package/dist/cjs/components/Tenants/EditTenant.d.ts +41 -0
  109. package/dist/cjs/components/Tenants/EditTenant.d.ts.map +1 -0
  110. package/dist/cjs/components/Tenants/EditTenant.js +760 -0
  111. package/dist/cjs/components/UiComponents.d.ts +35 -6
  112. package/dist/cjs/components/UiComponents.d.ts.map +1 -1
  113. package/dist/cjs/components/UiComponents.js +226 -28
  114. package/dist/cjs/components/VirtualTableTile.d.ts +7 -0
  115. package/dist/cjs/components/VirtualTableTile.d.ts.map +1 -0
  116. package/dist/cjs/components/VirtualTableTile.js +51 -0
  117. package/dist/cjs/components/index.d.ts +5 -5
  118. package/dist/cjs/components/index.d.ts.map +1 -1
  119. package/dist/cjs/components/index.js +1 -1
  120. package/dist/cjs/constants/dataTypes.d.ts.map +1 -1
  121. package/dist/cjs/constants/dataTypes.js +2 -0
  122. package/dist/cjs/forms/client_onboard/ConnectDatabase.d.ts +15 -6
  123. package/dist/cjs/forms/client_onboard/ConnectDatabase.d.ts.map +1 -1
  124. package/dist/cjs/forms/client_onboard/ConnectDatabase.js +209 -96
  125. package/dist/cjs/forms/client_onboard/ConnectSchema.d.ts +13 -9
  126. package/dist/cjs/forms/client_onboard/ConnectSchema.d.ts.map +1 -1
  127. package/dist/cjs/forms/client_onboard/ConnectSchema.js +158 -236
  128. package/dist/cjs/forms/client_onboard/CreateVirtualTables.d.ts +47 -0
  129. package/dist/cjs/forms/client_onboard/CreateVirtualTables.d.ts.map +1 -0
  130. package/dist/cjs/forms/client_onboard/CreateVirtualTables.js +396 -0
  131. package/dist/cjs/forms/client_onboard/__tests__/ConnectDatabase.test.d.ts +2 -0
  132. package/dist/cjs/forms/client_onboard/__tests__/ConnectDatabase.test.d.ts.map +1 -0
  133. package/dist/cjs/forms/client_onboard/__tests__/ConnectDatabase.test.js +571 -0
  134. package/dist/cjs/forms/client_onboard/__tests__/ConnectSchema.test.d.ts +2 -0
  135. package/dist/cjs/forms/client_onboard/__tests__/ConnectSchema.test.d.ts.map +1 -0
  136. package/dist/cjs/forms/client_onboard/__tests__/ConnectSchema.test.js +459 -0
  137. package/dist/cjs/forms/client_onboard/__tests__/CreateVirtualTables.test.d.ts +2 -0
  138. package/dist/cjs/forms/client_onboard/__tests__/CreateVirtualTables.test.d.ts.map +1 -0
  139. package/dist/cjs/forms/client_onboard/__tests__/CreateVirtualTables.test.js +385 -0
  140. package/dist/cjs/forms/virtual_tables/CreateEditVirtualTable.d.ts +20 -0
  141. package/dist/cjs/forms/virtual_tables/CreateEditVirtualTable.d.ts.map +1 -0
  142. package/dist/cjs/forms/virtual_tables/CreateEditVirtualTable.js +294 -0
  143. package/dist/cjs/hooks/useDashboardManager.d.ts +16 -0
  144. package/dist/cjs/hooks/useDashboardManager.d.ts.map +1 -0
  145. package/dist/cjs/hooks/useDashboardManager.js +113 -0
  146. package/dist/cjs/hooks/useDatabaseSchema.d.ts +5 -0
  147. package/dist/cjs/hooks/useDatabaseSchema.d.ts.map +1 -0
  148. package/dist/cjs/hooks/useDatabaseSchema.js +54 -0
  149. package/dist/cjs/hooks/useItemBeingEdited.d.ts +1 -2
  150. package/dist/cjs/hooks/useItemBeingEdited.d.ts.map +1 -1
  151. package/dist/cjs/hooks/useItemBeingEdited.js +2 -14
  152. package/dist/cjs/hooks/useOnClickOutside.d.ts +4 -1
  153. package/dist/cjs/hooks/useOnClickOutside.d.ts.map +1 -1
  154. package/dist/cjs/hooks/useOnClickOutside.js +50 -7
  155. package/dist/cjs/hooks/useTenants.d.ts +13 -0
  156. package/dist/cjs/hooks/useTenants.d.ts.map +1 -0
  157. package/dist/cjs/hooks/useTenants.js +174 -0
  158. package/dist/cjs/hooks/useThrottle.d.ts +2 -0
  159. package/dist/cjs/hooks/useThrottle.d.ts.map +1 -0
  160. package/dist/cjs/hooks/useThrottle.js +14 -0
  161. package/dist/cjs/icons/CheckCircleIcon.d.ts +5 -0
  162. package/dist/cjs/icons/CheckCircleIcon.d.ts.map +1 -0
  163. package/dist/cjs/icons/CheckCircleIcon.js +5 -0
  164. package/dist/cjs/icons/DownChevronIcon.d.ts +2 -0
  165. package/dist/cjs/icons/DownChevronIcon.d.ts.map +1 -0
  166. package/dist/cjs/icons/DownChevronIcon.js +7 -0
  167. package/dist/cjs/icons/ExclamationFilledIcon.d.ts +5 -0
  168. package/dist/cjs/icons/ExclamationFilledIcon.d.ts.map +1 -0
  169. package/dist/cjs/icons/ExclamationFilledIcon.js +5 -0
  170. package/dist/cjs/icons/ExteriorLinkIcon.d.ts +5 -0
  171. package/dist/cjs/icons/ExteriorLinkIcon.d.ts.map +1 -0
  172. package/dist/cjs/icons/ExteriorLinkIcon.js +5 -0
  173. package/dist/cjs/icons/GlobeIcon.d.ts +5 -0
  174. package/dist/cjs/icons/GlobeIcon.d.ts.map +1 -0
  175. package/dist/cjs/icons/GlobeIcon.js +15 -0
  176. package/dist/cjs/icons/InformationCircleIcon.d.ts +4 -0
  177. package/dist/cjs/icons/InformationCircleIcon.d.ts.map +1 -0
  178. package/dist/cjs/icons/InformationCircleIcon.js +7 -0
  179. package/dist/cjs/icons/LeftChevronIcon.d.ts +2 -0
  180. package/dist/cjs/icons/LeftChevronIcon.d.ts.map +1 -0
  181. package/dist/cjs/icons/LeftChevronIcon.js +7 -0
  182. package/dist/cjs/icons/QuestionMarkCircleIcon.d.ts +5 -0
  183. package/dist/cjs/icons/QuestionMarkCircleIcon.d.ts.map +1 -0
  184. package/dist/cjs/icons/QuestionMarkCircleIcon.js +5 -0
  185. package/dist/cjs/icons/RightChevronIcon.d.ts +2 -0
  186. package/dist/cjs/icons/RightChevronIcon.d.ts.map +1 -0
  187. package/dist/cjs/icons/RightChevronIcon.js +7 -0
  188. package/dist/cjs/icons/XMarkIcon.d.ts +0 -1
  189. package/dist/cjs/icons/XMarkIcon.d.ts.map +1 -1
  190. package/dist/cjs/icons/XMarkIcon.js +1 -1
  191. package/dist/cjs/index.d.ts +2 -3
  192. package/dist/cjs/index.d.ts.map +1 -1
  193. package/dist/cjs/index.js +6 -7
  194. package/dist/cjs/modals/CodePreview.d.ts +6 -0
  195. package/dist/cjs/modals/CodePreview.d.ts.map +1 -0
  196. package/dist/cjs/modals/CodePreview.js +151 -0
  197. package/dist/cjs/modals/EditEnvironmentModal.d.ts +15 -0
  198. package/dist/cjs/modals/EditEnvironmentModal.d.ts.map +1 -0
  199. package/dist/cjs/modals/EditEnvironmentModal.js +551 -0
  200. package/dist/cjs/modals/EditFiltersModal.d.ts +14 -10
  201. package/dist/cjs/modals/EditFiltersModal.d.ts.map +1 -1
  202. package/dist/cjs/modals/EditFiltersModal.js +1219 -263
  203. package/dist/cjs/modals/NewDashboardModal.d.ts +6 -8
  204. package/dist/cjs/modals/NewDashboardModal.d.ts.map +1 -1
  205. package/dist/cjs/modals/NewDashboardModal.js +147 -146
  206. package/dist/cjs/modals/PromoteDashboardModal.d.ts +16 -0
  207. package/dist/cjs/modals/PromoteDashboardModal.d.ts.map +1 -0
  208. package/dist/cjs/modals/PromoteDashboardModal.js +56 -0
  209. package/dist/cjs/modals/PromoteReportModal.d.ts +15 -0
  210. package/dist/cjs/modals/PromoteReportModal.d.ts.map +1 -0
  211. package/dist/cjs/modals/PromoteReportModal.js +128 -0
  212. package/dist/cjs/modals/PromoteViewModal.d.ts +5 -5
  213. package/dist/cjs/modals/PromoteViewModal.d.ts.map +1 -1
  214. package/dist/cjs/modals/PromoteViewModal.js +58 -94
  215. package/dist/cjs/modals/ReorderDashboardModal.d.ts +1 -2
  216. package/dist/cjs/modals/ReorderDashboardModal.d.ts.map +1 -1
  217. package/dist/cjs/modals/ReorderDashboardModal.js +34 -20
  218. package/dist/cjs/modals/SavedQueriesModal.d.ts +7 -0
  219. package/dist/cjs/modals/SavedQueriesModal.d.ts.map +1 -0
  220. package/dist/cjs/modals/SavedQueriesModal.js +128 -0
  221. package/dist/cjs/modals/index.d.ts +0 -1
  222. package/dist/cjs/modals/index.d.ts.map +1 -1
  223. package/dist/cjs/modals/index.js +1 -3
  224. package/dist/cjs/primitives/ButtonPrimitive.d.ts +3 -1
  225. package/dist/cjs/primitives/ButtonPrimitive.d.ts.map +1 -1
  226. package/dist/cjs/primitives/ButtonPrimitive.js +24 -16
  227. package/dist/cjs/primitives/CheckboxPrimitive.d.ts +12 -0
  228. package/dist/cjs/primitives/CheckboxPrimitive.d.ts.map +1 -0
  229. package/dist/cjs/primitives/CheckboxPrimitive.js +29 -0
  230. package/dist/cjs/primitives/HeaderPrimitive.d.ts.map +1 -1
  231. package/dist/cjs/primitives/HeaderPrimitive.js +1 -1
  232. package/dist/cjs/primitives/MiniButtonPrimitive.d.ts +7 -0
  233. package/dist/cjs/primitives/MiniButtonPrimitive.d.ts.map +1 -0
  234. package/dist/cjs/primitives/MiniButtonPrimitive.js +56 -0
  235. package/dist/cjs/primitives/ModalPrimitive.d.ts +2 -10
  236. package/dist/cjs/primitives/ModalPrimitive.d.ts.map +1 -1
  237. package/dist/cjs/primitives/ModalPrimitive.js +6 -6
  238. package/dist/cjs/primitives/PlaceholderPrimitive.d.ts +5 -0
  239. package/dist/cjs/primitives/PlaceholderPrimitive.d.ts.map +1 -0
  240. package/dist/cjs/primitives/PlaceholderPrimitive.js +18 -0
  241. package/dist/cjs/primitives/PopoverPrimitive.d.ts +8 -0
  242. package/dist/cjs/primitives/PopoverPrimitive.d.ts.map +1 -0
  243. package/dist/cjs/primitives/PopoverPrimitive.js +53 -0
  244. package/dist/cjs/primitives/SecondaryButtonPrimitive.d.ts +3 -1
  245. package/dist/cjs/primitives/SecondaryButtonPrimitive.d.ts.map +1 -1
  246. package/dist/cjs/primitives/SecondaryButtonPrimitive.js +13 -10
  247. package/dist/cjs/primitives/TextInputPrimitive.d.ts +7 -2
  248. package/dist/cjs/primitives/TextInputPrimitive.d.ts.map +1 -1
  249. package/dist/cjs/primitives/TextInputPrimitive.js +109 -14
  250. package/dist/cjs/primitives/TogglePrimitive.d.ts +6 -3
  251. package/dist/cjs/primitives/TogglePrimitive.d.ts.map +1 -1
  252. package/dist/cjs/primitives/TogglePrimitive.js +10 -7
  253. package/dist/cjs/primitives/index.d.ts +1 -1
  254. package/dist/cjs/primitives/index.d.ts.map +1 -1
  255. package/dist/cjs/primitives/index.js +3 -3
  256. package/dist/cjs/public_components/ChartQueryBuilder.d.ts +9 -0
  257. package/dist/cjs/public_components/ChartQueryBuilder.d.ts.map +1 -0
  258. package/dist/cjs/public_components/ChartQueryBuilder.js +131 -0
  259. package/dist/cjs/public_components/CreateEnvironment.d.ts +1 -1
  260. package/dist/cjs/public_components/CreateEnvironment.d.ts.map +1 -1
  261. package/dist/cjs/public_components/CreateEnvironment.js +168 -81
  262. package/dist/cjs/public_components/DashboardManager.d.ts +2 -2
  263. package/dist/cjs/public_components/DashboardManager.d.ts.map +1 -1
  264. package/dist/cjs/public_components/DashboardManager.js +346 -187
  265. package/dist/cjs/public_components/EnvSelectPopover.d.ts +12 -0
  266. package/dist/cjs/public_components/EnvSelectPopover.d.ts.map +1 -0
  267. package/dist/cjs/public_components/EnvSelectPopover.js +144 -0
  268. package/dist/cjs/public_components/{SQLViewManager.d.ts → VirtualTableManager.d.ts} +3 -2
  269. package/dist/cjs/public_components/VirtualTableManager.d.ts.map +1 -0
  270. package/dist/cjs/public_components/VirtualTableManager.js +731 -0
  271. package/dist/cjs/public_components/__tests__/CreateEnvironment.test.d.ts +2 -0
  272. package/dist/cjs/public_components/__tests__/CreateEnvironment.test.d.ts.map +1 -0
  273. package/dist/cjs/public_components/__tests__/CreateEnvironment.test.js +685 -0
  274. package/dist/cjs/utils/astProcessing.d.ts +14 -1
  275. package/dist/cjs/utils/astProcessing.d.ts.map +1 -1
  276. package/dist/cjs/utils/astProcessing.js +72 -8
  277. package/dist/cjs/utils/astProcessing.uspec.js +7 -3
  278. package/dist/cjs/utils/columnProcessing.d.ts +12 -0
  279. package/dist/cjs/utils/columnProcessing.d.ts.map +1 -1
  280. package/dist/cjs/utils/columnProcessing.js +173 -7
  281. package/dist/cjs/utils/constants.d.ts +4 -21
  282. package/dist/cjs/utils/constants.d.ts.map +1 -1
  283. package/dist/cjs/utils/constants.js +20 -11
  284. package/dist/cjs/utils/dataEditor.d.ts +4 -3
  285. package/dist/cjs/utils/dataEditor.d.ts.map +1 -1
  286. package/dist/cjs/utils/dataEditor.js +69 -121
  287. package/dist/cjs/utils/dataFetcher.d.ts +20 -2
  288. package/dist/cjs/utils/dataFetcher.d.ts.map +1 -1
  289. package/dist/cjs/utils/dataFetcher.js +46 -56
  290. package/dist/cjs/utils/databases.d.ts +20 -8
  291. package/dist/cjs/utils/databases.d.ts.map +1 -1
  292. package/dist/cjs/utils/databases.js +63 -24
  293. package/dist/cjs/utils/filter.d.ts +222 -0
  294. package/dist/cjs/utils/filter.d.ts.map +1 -0
  295. package/dist/cjs/utils/filter.js +347 -0
  296. package/dist/cjs/utils/monacoAutocomplete.d.ts +2 -1
  297. package/dist/cjs/utils/monacoAutocomplete.d.ts.map +1 -1
  298. package/dist/cjs/utils/monacoAutocomplete.js +149 -44
  299. package/dist/cjs/utils/report.d.ts +120 -0
  300. package/dist/cjs/utils/report.d.ts.map +1 -0
  301. package/dist/cjs/utils/report.js +109 -0
  302. package/dist/cjs/utils/schema.d.ts +41 -29
  303. package/dist/cjs/utils/schema.d.ts.map +1 -1
  304. package/dist/cjs/utils/schema.js +137 -91
  305. package/dist/cjs/utils/table.d.ts +70 -4
  306. package/dist/cjs/utils/table.d.ts.map +1 -1
  307. package/dist/cjs/utils/tenants.d.ts +48 -0
  308. package/dist/cjs/utils/tenants.d.ts.map +1 -0
  309. package/dist/cjs/utils/tenants.js +37 -0
  310. package/dist/cjs/utils/textProcessing.js +1 -2
  311. package/dist/cjs/utils/ui.d.ts +2 -0
  312. package/dist/cjs/utils/ui.d.ts.map +1 -0
  313. package/dist/cjs/utils/ui.js +18 -0
  314. package/dist/cjs/utils/validation.d.ts +2 -0
  315. package/dist/cjs/utils/validation.d.ts.map +1 -0
  316. package/dist/cjs/utils/validation.js +77 -0
  317. package/dist/cjs/utils/validation.uspec.d.ts +2 -0
  318. package/dist/cjs/utils/validation.uspec.d.ts.map +1 -0
  319. package/dist/cjs/utils/validation.uspec.js +53 -0
  320. package/dist/esm/Admin.d.ts +41 -87
  321. package/dist/esm/Admin.d.ts.map +1 -1
  322. package/dist/esm/Admin.js +355 -422
  323. package/dist/esm/AdminProvider.d.ts +108 -50
  324. package/dist/esm/AdminProvider.d.ts.map +1 -1
  325. package/dist/esm/AdminProvider.js +390 -209
  326. package/dist/esm/api/ConnectionClient.d.ts +20 -38
  327. package/dist/esm/api/ConnectionClient.d.ts.map +1 -1
  328. package/dist/esm/api/ConnectionClient.js +280 -306
  329. package/dist/esm/assets/ArrowDownHeadIcon.d.ts.map +1 -1
  330. package/dist/esm/components/Banner/index.d.ts +0 -1
  331. package/dist/esm/components/Banner/index.d.ts.map +1 -1
  332. package/dist/esm/components/ClipboardButton.d.ts +8 -0
  333. package/dist/esm/components/ClipboardButton.d.ts.map +1 -0
  334. package/dist/esm/components/ClipboardButton.js +69 -0
  335. package/dist/esm/components/DashboardSelectPopover.d.ts +8 -5
  336. package/dist/esm/components/DashboardSelectPopover.d.ts.map +1 -1
  337. package/dist/esm/components/DashboardSelectPopover.js +72 -186
  338. package/dist/esm/components/DatabaseMismatchCard.d.ts +3 -3
  339. package/dist/esm/components/DatabaseMismatchCard.d.ts.map +1 -1
  340. package/dist/esm/components/DatabaseMismatchCard.js +2 -2
  341. package/dist/esm/components/DatabaseSelector.d.ts.map +1 -1
  342. package/dist/esm/components/DatabaseSelector.js +9 -1
  343. package/dist/esm/components/DateRangePicker/SingleDatePicker.d.ts +10 -0
  344. package/dist/esm/components/DateRangePicker/SingleDatePicker.d.ts.map +1 -0
  345. package/dist/esm/components/DateRangePicker/SingleDatePicker.js +227 -0
  346. package/dist/esm/components/DateRangePicker/YearlessDateRangePicker.d.ts +18 -0
  347. package/dist/esm/components/DateRangePicker/YearlessDateRangePicker.d.ts.map +1 -0
  348. package/dist/esm/components/DateRangePicker/YearlessDateRangePicker.js +282 -0
  349. package/dist/esm/components/DateRangePicker/dateRangePickerUtils.d.ts +91 -0
  350. package/dist/esm/components/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -0
  351. package/dist/esm/components/DateRangePicker/dateRangePickerUtils.js +883 -0
  352. package/dist/esm/components/DeleteButton.d.ts +0 -1
  353. package/dist/esm/components/DeleteButton.d.ts.map +1 -1
  354. package/dist/esm/components/DropDownMenuWithLabel.d.ts +4 -3
  355. package/dist/esm/components/DropDownMenuWithLabel.d.ts.map +1 -1
  356. package/dist/esm/components/DropDownMenuWithLabel.js +37 -23
  357. package/dist/esm/components/DynamicBanner.d.ts +2 -5
  358. package/dist/esm/components/DynamicBanner.d.ts.map +1 -1
  359. package/dist/esm/components/DynamicBanner.js +2 -2
  360. package/dist/esm/components/EmptyDashboardComponent/index.d.ts +0 -1
  361. package/dist/esm/components/EmptyDashboardComponent/index.d.ts.map +1 -1
  362. package/dist/esm/components/EmptyDashboardComponent/index.js +5 -4
  363. package/dist/esm/components/EmptyVirtualTablesComponent.d.ts +4 -0
  364. package/dist/esm/components/EmptyVirtualTablesComponent.d.ts.map +1 -0
  365. package/dist/esm/components/EmptyVirtualTablesComponent.js +38 -0
  366. package/dist/esm/components/ExternalLink.d.ts +4 -0
  367. package/dist/esm/components/ExternalLink.d.ts.map +1 -0
  368. package/dist/esm/components/ExternalLink.js +9 -0
  369. package/dist/esm/components/FormTooltip.d.ts +8 -0
  370. package/dist/esm/components/FormTooltip.d.ts.map +1 -0
  371. package/dist/esm/components/FormTooltip.js +84 -0
  372. package/dist/esm/components/InputLabel.d.ts +4 -1
  373. package/dist/esm/components/InputLabel.d.ts.map +1 -1
  374. package/dist/esm/components/InputLabel.js +10 -8
  375. package/dist/esm/components/InternalDashboard/ChartSkeleton.d.ts +11 -0
  376. package/dist/esm/components/InternalDashboard/ChartSkeleton.d.ts.map +1 -0
  377. package/dist/esm/components/InternalDashboard/ChartSkeleton.js +16 -0
  378. package/dist/esm/components/InternalDashboard/DashboardFilter.d.ts +20 -0
  379. package/dist/esm/components/InternalDashboard/DashboardFilter.d.ts.map +1 -0
  380. package/dist/esm/components/InternalDashboard/DashboardFilter.js +101 -0
  381. package/dist/esm/components/InternalDashboard/DashboardLoadingComponent.d.ts +7 -0
  382. package/dist/esm/components/InternalDashboard/DashboardLoadingComponent.d.ts.map +1 -0
  383. package/dist/esm/components/InternalDashboard/DashboardLoadingComponent.js +15 -0
  384. package/dist/esm/components/InternalDashboard/DateRangePicker/QuillDateRangePicker.d.ts +37 -0
  385. package/dist/esm/components/InternalDashboard/DateRangePicker/QuillDateRangePicker.d.ts.map +1 -0
  386. package/dist/esm/components/InternalDashboard/DateRangePicker/QuillDateRangePicker.js +269 -0
  387. package/dist/esm/components/InternalDashboard/DateRangePicker/dateRangePickerUtils.d.ts +85 -0
  388. package/dist/esm/components/InternalDashboard/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -0
  389. package/dist/esm/components/InternalDashboard/DateRangePicker/dateRangePickerUtils.js +520 -0
  390. package/dist/esm/components/InternalDashboard/InternalDashboard.d.ts +17 -0
  391. package/dist/esm/components/InternalDashboard/InternalDashboard.d.ts.map +1 -0
  392. package/dist/esm/components/InternalDashboard/InternalDashboard.js +1940 -0
  393. package/dist/esm/components/OrgSelect.d.ts +9 -13
  394. package/dist/esm/components/OrgSelect.d.ts.map +1 -1
  395. package/dist/esm/components/OrgSelect.js +134 -117
  396. package/dist/esm/components/QuillMultiSelectWithCombo.d.ts +30 -0
  397. package/dist/esm/components/QuillMultiSelectWithCombo.d.ts.map +1 -0
  398. package/dist/esm/components/QuillMultiSelectWithCombo.js +466 -0
  399. package/dist/esm/components/QuillPopover.d.ts +11 -0
  400. package/dist/esm/components/QuillPopover.d.ts.map +1 -0
  401. package/dist/esm/components/QuillPopover.js +144 -0
  402. package/dist/esm/components/QuillSelect.d.ts +1 -1
  403. package/dist/esm/components/QuillSelect.d.ts.map +1 -1
  404. package/dist/esm/components/QuillSelect.js +39 -16
  405. package/dist/esm/components/QuillSelectWithCombo.d.ts +22 -0
  406. package/dist/esm/components/QuillSelectWithCombo.d.ts.map +1 -0
  407. package/dist/esm/components/QuillSelectWithCombo.js +291 -0
  408. package/dist/esm/components/QuillTab.d.ts +12 -0
  409. package/dist/esm/components/QuillTab.d.ts.map +1 -0
  410. package/dist/esm/components/QuillTab.js +81 -0
  411. package/dist/esm/components/QuillToolTipPortal.d.ts +11 -0
  412. package/dist/esm/components/QuillToolTipPortal.d.ts.map +1 -0
  413. package/dist/esm/components/QuillToolTipPortal.js +104 -0
  414. package/dist/esm/components/SegmentedControl.d.ts +8 -2
  415. package/dist/esm/components/SegmentedControl.d.ts.map +1 -1
  416. package/dist/esm/components/SegmentedControl.js +10 -10
  417. package/dist/esm/components/SqlTextEditor.d.ts +2 -5
  418. package/dist/esm/components/SqlTextEditor.d.ts.map +1 -1
  419. package/dist/esm/components/SqlTextEditor.js +21 -20
  420. package/dist/esm/components/StepDisplay.d.ts.map +1 -1
  421. package/dist/esm/components/StepDisplay.js +1 -1
  422. package/dist/esm/components/Tenants/EditTenant.d.ts +41 -0
  423. package/dist/esm/components/Tenants/EditTenant.d.ts.map +1 -0
  424. package/dist/esm/components/Tenants/EditTenant.js +754 -0
  425. package/dist/esm/components/UiComponents.d.ts +35 -6
  426. package/dist/esm/components/UiComponents.d.ts.map +1 -1
  427. package/dist/esm/components/UiComponents.js +220 -26
  428. package/dist/esm/components/VirtualTableTile.d.ts +7 -0
  429. package/dist/esm/components/VirtualTableTile.d.ts.map +1 -0
  430. package/dist/esm/components/VirtualTableTile.js +48 -0
  431. package/dist/esm/components/index.d.ts +5 -5
  432. package/dist/esm/components/index.d.ts.map +1 -1
  433. package/dist/esm/components/index.js +5 -5
  434. package/dist/esm/constants/dataTypes.d.ts.map +1 -1
  435. package/dist/esm/constants/dataTypes.js +2 -0
  436. package/dist/esm/forms/client_onboard/ConnectDatabase.d.ts +15 -6
  437. package/dist/esm/forms/client_onboard/ConnectDatabase.d.ts.map +1 -1
  438. package/dist/esm/forms/client_onboard/ConnectDatabase.js +211 -98
  439. package/dist/esm/forms/client_onboard/ConnectSchema.d.ts +13 -9
  440. package/dist/esm/forms/client_onboard/ConnectSchema.d.ts.map +1 -1
  441. package/dist/esm/forms/client_onboard/ConnectSchema.js +160 -238
  442. package/dist/esm/forms/client_onboard/CreateVirtualTables.d.ts +47 -0
  443. package/dist/esm/forms/client_onboard/CreateVirtualTables.d.ts.map +1 -0
  444. package/dist/esm/forms/client_onboard/CreateVirtualTables.js +388 -0
  445. package/dist/esm/forms/client_onboard/__tests__/ConnectDatabase.test.d.ts +2 -0
  446. package/dist/esm/forms/client_onboard/__tests__/ConnectDatabase.test.d.ts.map +1 -0
  447. package/dist/esm/forms/client_onboard/__tests__/ConnectDatabase.test.js +566 -0
  448. package/dist/esm/forms/client_onboard/__tests__/ConnectSchema.test.d.ts +2 -0
  449. package/dist/esm/forms/client_onboard/__tests__/ConnectSchema.test.d.ts.map +1 -0
  450. package/dist/esm/forms/client_onboard/__tests__/ConnectSchema.test.js +454 -0
  451. package/dist/esm/forms/client_onboard/__tests__/CreateVirtualTables.test.d.ts +2 -0
  452. package/dist/esm/forms/client_onboard/__tests__/CreateVirtualTables.test.d.ts.map +1 -0
  453. package/dist/esm/forms/client_onboard/__tests__/CreateVirtualTables.test.js +380 -0
  454. package/dist/esm/forms/virtual_tables/CreateEditVirtualTable.d.ts +20 -0
  455. package/dist/esm/forms/virtual_tables/CreateEditVirtualTable.d.ts.map +1 -0
  456. package/dist/esm/forms/virtual_tables/CreateEditVirtualTable.js +288 -0
  457. package/dist/esm/hooks/useDashboardManager.d.ts +16 -0
  458. package/dist/esm/hooks/useDashboardManager.d.ts.map +1 -0
  459. package/dist/esm/hooks/useDashboardManager.js +109 -0
  460. package/dist/esm/hooks/useDatabaseSchema.d.ts +5 -0
  461. package/dist/esm/hooks/useDatabaseSchema.d.ts.map +1 -0
  462. package/dist/esm/hooks/useDatabaseSchema.js +50 -0
  463. package/dist/esm/hooks/useItemBeingEdited.d.ts +1 -2
  464. package/dist/esm/hooks/useItemBeingEdited.d.ts.map +1 -1
  465. package/dist/esm/hooks/useItemBeingEdited.js +3 -15
  466. package/dist/esm/hooks/useOnClickOutside.d.ts +4 -1
  467. package/dist/esm/hooks/useOnClickOutside.d.ts.map +1 -1
  468. package/dist/esm/hooks/useOnClickOutside.js +49 -8
  469. package/dist/esm/hooks/useTenants.d.ts +13 -0
  470. package/dist/esm/hooks/useTenants.d.ts.map +1 -0
  471. package/dist/esm/hooks/useTenants.js +170 -0
  472. package/dist/esm/hooks/useThrottle.d.ts +2 -0
  473. package/dist/esm/hooks/useThrottle.d.ts.map +1 -0
  474. package/dist/esm/hooks/useThrottle.js +11 -0
  475. package/dist/esm/icons/CheckCircleIcon.d.ts +5 -0
  476. package/dist/esm/icons/CheckCircleIcon.d.ts.map +1 -0
  477. package/dist/esm/icons/CheckCircleIcon.js +3 -0
  478. package/dist/esm/icons/DownChevronIcon.d.ts +2 -0
  479. package/dist/esm/icons/DownChevronIcon.d.ts.map +1 -0
  480. package/dist/esm/icons/DownChevronIcon.js +4 -0
  481. package/dist/esm/icons/ExclamationFilledIcon.d.ts +5 -0
  482. package/dist/esm/icons/ExclamationFilledIcon.d.ts.map +1 -0
  483. package/dist/esm/icons/ExclamationFilledIcon.js +3 -0
  484. package/dist/esm/icons/ExteriorLinkIcon.d.ts +5 -0
  485. package/dist/esm/icons/ExteriorLinkIcon.d.ts.map +1 -0
  486. package/dist/esm/icons/ExteriorLinkIcon.js +3 -0
  487. package/dist/esm/icons/GlobeIcon.d.ts +5 -0
  488. package/dist/esm/icons/GlobeIcon.d.ts.map +1 -0
  489. package/dist/esm/icons/GlobeIcon.js +12 -0
  490. package/dist/esm/icons/InformationCircleIcon.d.ts +4 -0
  491. package/dist/esm/icons/InformationCircleIcon.d.ts.map +1 -0
  492. package/dist/esm/icons/InformationCircleIcon.js +4 -0
  493. package/dist/esm/icons/LeftChevronIcon.d.ts +2 -0
  494. package/dist/esm/icons/LeftChevronIcon.d.ts.map +1 -0
  495. package/dist/esm/icons/LeftChevronIcon.js +4 -0
  496. package/dist/esm/icons/QuestionMarkCircleIcon.d.ts +5 -0
  497. package/dist/esm/icons/QuestionMarkCircleIcon.d.ts.map +1 -0
  498. package/dist/esm/icons/QuestionMarkCircleIcon.js +3 -0
  499. package/dist/esm/icons/RightChevronIcon.d.ts +2 -0
  500. package/dist/esm/icons/RightChevronIcon.d.ts.map +1 -0
  501. package/dist/esm/icons/RightChevronIcon.js +4 -0
  502. package/dist/esm/icons/XMarkIcon.d.ts +0 -1
  503. package/dist/esm/icons/XMarkIcon.d.ts.map +1 -1
  504. package/dist/esm/index.d.ts +2 -3
  505. package/dist/esm/index.d.ts.map +1 -1
  506. package/dist/esm/index.js +3 -3
  507. package/dist/esm/modals/CodePreview.d.ts +6 -0
  508. package/dist/esm/modals/CodePreview.d.ts.map +1 -0
  509. package/dist/esm/modals/CodePreview.js +145 -0
  510. package/dist/esm/modals/EditEnvironmentModal.d.ts +15 -0
  511. package/dist/esm/modals/EditEnvironmentModal.d.ts.map +1 -0
  512. package/dist/esm/modals/EditEnvironmentModal.js +545 -0
  513. package/dist/esm/modals/EditFiltersModal.d.ts +14 -10
  514. package/dist/esm/modals/EditFiltersModal.d.ts.map +1 -1
  515. package/dist/esm/modals/EditFiltersModal.js +1226 -264
  516. package/dist/esm/modals/NewDashboardModal.d.ts +6 -8
  517. package/dist/esm/modals/NewDashboardModal.d.ts.map +1 -1
  518. package/dist/esm/modals/NewDashboardModal.js +148 -146
  519. package/dist/esm/modals/PromoteDashboardModal.d.ts +16 -0
  520. package/dist/esm/modals/PromoteDashboardModal.d.ts.map +1 -0
  521. package/dist/esm/modals/PromoteDashboardModal.js +53 -0
  522. package/dist/esm/modals/PromoteReportModal.d.ts +15 -0
  523. package/dist/esm/modals/PromoteReportModal.d.ts.map +1 -0
  524. package/dist/esm/modals/PromoteReportModal.js +125 -0
  525. package/dist/esm/modals/PromoteViewModal.d.ts +5 -5
  526. package/dist/esm/modals/PromoteViewModal.d.ts.map +1 -1
  527. package/dist/esm/modals/PromoteViewModal.js +58 -94
  528. package/dist/esm/modals/ReorderDashboardModal.d.ts +1 -2
  529. package/dist/esm/modals/ReorderDashboardModal.d.ts.map +1 -1
  530. package/dist/esm/modals/ReorderDashboardModal.js +34 -20
  531. package/dist/esm/modals/SavedQueriesModal.d.ts +7 -0
  532. package/dist/esm/modals/SavedQueriesModal.d.ts.map +1 -0
  533. package/dist/esm/modals/SavedQueriesModal.js +125 -0
  534. package/dist/esm/modals/index.d.ts +0 -1
  535. package/dist/esm/modals/index.d.ts.map +1 -1
  536. package/dist/esm/modals/index.js +0 -1
  537. package/dist/esm/primitives/ButtonPrimitive.d.ts +3 -1
  538. package/dist/esm/primitives/ButtonPrimitive.d.ts.map +1 -1
  539. package/dist/esm/primitives/ButtonPrimitive.js +25 -17
  540. package/dist/esm/primitives/CheckboxPrimitive.d.ts +12 -0
  541. package/dist/esm/primitives/CheckboxPrimitive.d.ts.map +1 -0
  542. package/dist/esm/primitives/CheckboxPrimitive.js +27 -0
  543. package/dist/esm/primitives/HeaderPrimitive.d.ts.map +1 -1
  544. package/dist/esm/primitives/HeaderPrimitive.js +1 -1
  545. package/dist/esm/primitives/MiniButtonPrimitive.d.ts +7 -0
  546. package/dist/esm/primitives/MiniButtonPrimitive.d.ts.map +1 -0
  547. package/dist/esm/primitives/MiniButtonPrimitive.js +54 -0
  548. package/dist/esm/primitives/ModalPrimitive.d.ts +2 -10
  549. package/dist/esm/primitives/ModalPrimitive.d.ts.map +1 -1
  550. package/dist/esm/primitives/ModalPrimitive.js +7 -7
  551. package/dist/esm/primitives/PlaceholderPrimitive.d.ts +5 -0
  552. package/dist/esm/primitives/PlaceholderPrimitive.d.ts.map +1 -0
  553. package/dist/esm/primitives/PlaceholderPrimitive.js +15 -0
  554. package/dist/esm/primitives/PopoverPrimitive.d.ts +8 -0
  555. package/dist/esm/primitives/PopoverPrimitive.d.ts.map +1 -0
  556. package/dist/esm/primitives/PopoverPrimitive.js +49 -0
  557. package/dist/esm/primitives/SecondaryButtonPrimitive.d.ts +3 -1
  558. package/dist/esm/primitives/SecondaryButtonPrimitive.d.ts.map +1 -1
  559. package/dist/esm/primitives/SecondaryButtonPrimitive.js +14 -11
  560. package/dist/esm/primitives/TextInputPrimitive.d.ts +7 -2
  561. package/dist/esm/primitives/TextInputPrimitive.d.ts.map +1 -1
  562. package/dist/esm/primitives/TextInputPrimitive.js +77 -12
  563. package/dist/esm/primitives/TogglePrimitive.d.ts +6 -3
  564. package/dist/esm/primitives/TogglePrimitive.d.ts.map +1 -1
  565. package/dist/esm/primitives/TogglePrimitive.js +10 -7
  566. package/dist/esm/primitives/index.d.ts +1 -1
  567. package/dist/esm/primitives/index.d.ts.map +1 -1
  568. package/dist/esm/primitives/index.js +1 -1
  569. package/dist/esm/public_components/ChartQueryBuilder.d.ts +9 -0
  570. package/dist/esm/public_components/ChartQueryBuilder.d.ts.map +1 -0
  571. package/dist/esm/public_components/ChartQueryBuilder.js +125 -0
  572. package/dist/esm/public_components/CreateEnvironment.d.ts +1 -1
  573. package/dist/esm/public_components/CreateEnvironment.d.ts.map +1 -1
  574. package/dist/esm/public_components/CreateEnvironment.js +152 -75
  575. package/dist/esm/public_components/DashboardManager.d.ts +2 -2
  576. package/dist/esm/public_components/DashboardManager.d.ts.map +1 -1
  577. package/dist/esm/public_components/DashboardManager.js +350 -191
  578. package/dist/esm/public_components/EnvSelectPopover.d.ts +12 -0
  579. package/dist/esm/public_components/EnvSelectPopover.d.ts.map +1 -0
  580. package/dist/esm/public_components/EnvSelectPopover.js +138 -0
  581. package/dist/esm/public_components/{SQLViewManager.d.ts → VirtualTableManager.d.ts} +3 -2
  582. package/dist/esm/public_components/VirtualTableManager.d.ts.map +1 -0
  583. package/dist/esm/public_components/VirtualTableManager.js +723 -0
  584. package/dist/esm/public_components/__tests__/CreateEnvironment.test.d.ts +2 -0
  585. package/dist/esm/public_components/__tests__/CreateEnvironment.test.d.ts.map +1 -0
  586. package/dist/esm/public_components/__tests__/CreateEnvironment.test.js +680 -0
  587. package/dist/esm/utils/astProcessing.d.ts +14 -1
  588. package/dist/esm/utils/astProcessing.d.ts.map +1 -1
  589. package/dist/esm/utils/astProcessing.js +67 -6
  590. package/dist/esm/utils/astProcessing.uspec.js +8 -4
  591. package/dist/esm/utils/columnProcessing.d.ts +12 -0
  592. package/dist/esm/utils/columnProcessing.d.ts.map +1 -1
  593. package/dist/esm/utils/columnProcessing.js +167 -4
  594. package/dist/esm/utils/constants.d.ts +4 -21
  595. package/dist/esm/utils/constants.d.ts.map +1 -1
  596. package/dist/esm/utils/constants.js +18 -9
  597. package/dist/esm/utils/dataEditor.d.ts +4 -3
  598. package/dist/esm/utils/dataEditor.d.ts.map +1 -1
  599. package/dist/esm/utils/dataEditor.js +65 -117
  600. package/dist/esm/utils/dataFetcher.d.ts +20 -2
  601. package/dist/esm/utils/dataFetcher.d.ts.map +1 -1
  602. package/dist/esm/utils/dataFetcher.js +44 -53
  603. package/dist/esm/utils/databases.d.ts +20 -8
  604. package/dist/esm/utils/databases.d.ts.map +1 -1
  605. package/dist/esm/utils/databases.js +60 -21
  606. package/dist/esm/utils/filter.d.ts +222 -0
  607. package/dist/esm/utils/filter.d.ts.map +1 -0
  608. package/dist/esm/utils/filter.js +343 -0
  609. package/dist/esm/utils/monacoAutocomplete.d.ts +2 -1
  610. package/dist/esm/utils/monacoAutocomplete.d.ts.map +1 -1
  611. package/dist/esm/utils/monacoAutocomplete.js +146 -41
  612. package/dist/esm/utils/report.d.ts +120 -0
  613. package/dist/esm/utils/report.d.ts.map +1 -0
  614. package/dist/esm/utils/report.js +106 -0
  615. package/dist/esm/utils/schema.d.ts +41 -29
  616. package/dist/esm/utils/schema.d.ts.map +1 -1
  617. package/dist/esm/utils/schema.js +133 -88
  618. package/dist/esm/utils/table.d.ts +70 -4
  619. package/dist/esm/utils/table.d.ts.map +1 -1
  620. package/dist/esm/utils/tenants.d.ts +48 -0
  621. package/dist/esm/utils/tenants.d.ts.map +1 -0
  622. package/dist/esm/utils/tenants.js +31 -0
  623. package/dist/esm/utils/ui.d.ts +2 -0
  624. package/dist/esm/utils/ui.d.ts.map +1 -0
  625. package/dist/esm/utils/ui.js +14 -0
  626. package/dist/esm/utils/validation.d.ts +2 -0
  627. package/dist/esm/utils/validation.d.ts.map +1 -0
  628. package/dist/esm/utils/validation.js +74 -0
  629. package/dist/esm/utils/validation.uspec.d.ts +2 -0
  630. package/dist/esm/utils/validation.uspec.d.ts.map +1 -0
  631. package/dist/esm/utils/validation.uspec.js +51 -0
  632. package/package.json +21 -8
  633. package/dist/cjs/components/EnvSelectPopover.d.ts +0 -13
  634. package/dist/cjs/components/EnvSelectPopover.d.ts.map +0 -1
  635. package/dist/cjs/components/EnvSelectPopover.js +0 -224
  636. package/dist/cjs/components/SqlViewTile.d.ts +0 -8
  637. package/dist/cjs/components/SqlViewTile.d.ts.map +0 -1
  638. package/dist/cjs/components/SqlViewTile.js +0 -69
  639. package/dist/cjs/forms/client_onboard/CreateSqlViews.d.ts +0 -24
  640. package/dist/cjs/forms/client_onboard/CreateSqlViews.d.ts.map +0 -1
  641. package/dist/cjs/forms/client_onboard/CreateSqlViews.js +0 -250
  642. package/dist/cjs/forms/sql_views/CreateEditSqlView.d.ts +0 -29
  643. package/dist/cjs/forms/sql_views/CreateEditSqlView.d.ts.map +0 -1
  644. package/dist/cjs/forms/sql_views/CreateEditSqlView.js +0 -228
  645. package/dist/cjs/modals/PromoteDashModal.d.ts +0 -17
  646. package/dist/cjs/modals/PromoteDashModal.d.ts.map +0 -1
  647. package/dist/cjs/modals/PromoteDashModal.js +0 -133
  648. package/dist/cjs/primitives/SelectPrimitive.d.ts +0 -16
  649. package/dist/cjs/primitives/SelectPrimitive.d.ts.map +0 -1
  650. package/dist/cjs/primitives/SelectPrimitive.js +0 -43
  651. package/dist/cjs/public_components/DashboardBuilder.d.ts +0 -7
  652. package/dist/cjs/public_components/DashboardBuilder.d.ts.map +0 -1
  653. package/dist/cjs/public_components/DashboardBuilder.js +0 -220
  654. package/dist/cjs/public_components/SQLViewManager.d.ts.map +0 -1
  655. package/dist/cjs/public_components/SQLViewManager.js +0 -563
  656. package/dist/esm/components/EnvSelectPopover.d.ts +0 -13
  657. package/dist/esm/components/EnvSelectPopover.d.ts.map +0 -1
  658. package/dist/esm/components/EnvSelectPopover.js +0 -221
  659. package/dist/esm/components/SqlViewTile.d.ts +0 -8
  660. package/dist/esm/components/SqlViewTile.d.ts.map +0 -1
  661. package/dist/esm/components/SqlViewTile.js +0 -40
  662. package/dist/esm/forms/client_onboard/CreateSqlViews.d.ts +0 -24
  663. package/dist/esm/forms/client_onboard/CreateSqlViews.d.ts.map +0 -1
  664. package/dist/esm/forms/client_onboard/CreateSqlViews.js +0 -242
  665. package/dist/esm/forms/sql_views/CreateEditSqlView.d.ts +0 -29
  666. package/dist/esm/forms/sql_views/CreateEditSqlView.d.ts.map +0 -1
  667. package/dist/esm/forms/sql_views/CreateEditSqlView.js +0 -222
  668. package/dist/esm/modals/PromoteDashModal.d.ts +0 -17
  669. package/dist/esm/modals/PromoteDashModal.d.ts.map +0 -1
  670. package/dist/esm/modals/PromoteDashModal.js +0 -130
  671. package/dist/esm/primitives/SelectPrimitive.d.ts +0 -16
  672. package/dist/esm/primitives/SelectPrimitive.d.ts.map +0 -1
  673. package/dist/esm/primitives/SelectPrimitive.js +0 -41
  674. package/dist/esm/public_components/DashboardBuilder.d.ts +0 -7
  675. package/dist/esm/public_components/DashboardBuilder.d.ts.map +0 -1
  676. package/dist/esm/public_components/DashboardBuilder.js +0 -214
  677. package/dist/esm/public_components/SQLViewManager.d.ts.map +0 -1
  678. package/dist/esm/public_components/SQLViewManager.js +0 -555
@@ -0,0 +1,1947 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.InternalDashboard = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const sortable_1 = require("@dnd-kit/sortable");
9
+ const utilities_1 = require("@dnd-kit/utilities");
10
+ const utilities_2 = require("@dnd-kit/utilities");
11
+ const core_1 = require("@dnd-kit/core");
12
+ const react_1 = require("react");
13
+ const react_2 = require("@quillsql/react");
14
+ const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
15
+ const AdminProvider_1 = require("../../AdminProvider");
16
+ const filter_1 = require("../../utils/filter");
17
+ const EmptyDashboardComponent_1 = __importDefault(require("../EmptyDashboardComponent"));
18
+ const DashboardLoadingComponent_1 = require("./DashboardLoadingComponent");
19
+ const UiComponents_1 = require("../UiComponents");
20
+ const DashboardFilter_1 = require("./DashboardFilter");
21
+ const dateRangePickerUtils_1 = require("./DateRangePicker/dateRangePickerUtils");
22
+ const primitives_1 = require("../../primitives");
23
+ const dateRangePickerUtils_2 = require("../DateRangePicker/dateRangePickerUtils");
24
+ const sortByOrdering = (a, b) => {
25
+ if (a.order === undefined && b.order === undefined)
26
+ return 0;
27
+ if (a.order === undefined)
28
+ return 1;
29
+ if (b.order === undefined)
30
+ return -1;
31
+ return a.order - b.order;
32
+ };
33
+ const snapRightToCursor = ({ activatorEvent, draggingNodeRect, transform, }) => {
34
+ if (draggingNodeRect && activatorEvent) {
35
+ const activatorCoordinates = (0, utilities_1.getEventCoordinates)(activatorEvent);
36
+ if (!activatorCoordinates) {
37
+ return transform;
38
+ }
39
+ const offsetX = activatorCoordinates.x - draggingNodeRect.right;
40
+ return {
41
+ ...transform,
42
+ x: transform.x + offsetX,
43
+ };
44
+ }
45
+ return transform;
46
+ };
47
+ const MemoizedChart = (0, react_1.memo)(({ reportId, chartType }) => {
48
+ const hasRendered = (0, react_1.useRef)(false);
49
+ (0, react_1.useEffect)(() => {
50
+ hasRendered.current = true;
51
+ }, []);
52
+ return ((0, jsx_runtime_1.jsx)(react_2.Chart, { reportId: reportId, containerStyle: {
53
+ padding: 10,
54
+ height: chartType === 'metric' ? 80 : chartType === 'table' ? 420 : 250,
55
+ }, hideFilters: true, hideDateRangeFilter: true, propagateChanges: !!hasRendered.current }));
56
+ }, (prevProps, nextProps) => prevProps.reportId === nextProps.reportId &&
57
+ prevProps.chartType === nextProps.chartType);
58
+ const InternalDashboard = ({ name, hidden = false, onClickReport,
59
+ // hoverActions,
60
+ onChangeLoading, filters,
61
+ // onUserFiltersUpdated,
62
+ // onClickChartElement,
63
+ // dateBucket,
64
+ containerStyle, parentLoading, onManageDashboard, }) => {
65
+ const { state, clientLoading: isClientLoading } = (0, AdminProvider_1.useAdmin)();
66
+ const tenants = state.currentTenantIdentity;
67
+ // const client = state.client;
68
+ // const [userFilters, setUserFilters] = useState<{
69
+ // [label: string]: InternalFilter;
70
+ // }>({});
71
+ // const dataLoaderUserFilters = useMemo(() => {
72
+ // return (filters?.map((f) => convertCustomFilter(f)) ?? []).concat(
73
+ // Object.values(userFilters),
74
+ // );
75
+ // }, [filters, userFilters]);
76
+ // useEffect(() => {
77
+ // onUserFiltersUpdated?.(Object.values(userFilters));
78
+ // }, [userFilters]);
79
+ const { isLoading, data, isDashboardFilterLoading, dashboardFilters: populatedDashboardFilters, reload, setSectionOrder, } = (0, react_2.useDashboard)(name, filters?.map((f) => (0, filter_1.convertCustomFilter)(f)) ?? []);
80
+ const { allReportsById } = (0, react_2.useAllReports)();
81
+ const [previewSectionOrder, setPreviewSectionOrder] = (0, react_1.useState)({});
82
+ const [isEditingNewSection, setIsEditingNewSection] = (0, react_1.useState)(false);
83
+ const metrics = (0, react_1.useMemo)(() => {
84
+ const map = {};
85
+ Object.keys(data?.sections ?? {}).forEach((section) => {
86
+ if (!data?.sections?.[section])
87
+ return;
88
+ const sectionMetrics = data.sections[section].filter(({ id, chartType }) => id && ['metric'].includes(chartType ?? ''));
89
+ const sectionOrder = data?.sectionOrder?.find((s) => s.section === section);
90
+ const reportOrder = previewSectionOrder[section] ?? sectionOrder?.reportOrder ?? [];
91
+ if (reportOrder.length > 0) {
92
+ map[section] = [...sectionMetrics].sort((a, b) => {
93
+ const aIndex = reportOrder.indexOf(a.id);
94
+ const bIndex = reportOrder.indexOf(b.id);
95
+ if (aIndex !== -1 && bIndex !== -1) {
96
+ return aIndex - bIndex;
97
+ }
98
+ if (aIndex !== -1)
99
+ return -1;
100
+ if (bIndex !== -1)
101
+ return 1;
102
+ return sortByOrdering(a, b);
103
+ });
104
+ }
105
+ else {
106
+ // Fallback to order property if no reportOrder
107
+ map[section] = sectionMetrics.sort(sortByOrdering);
108
+ }
109
+ });
110
+ return map;
111
+ }, [data?.sections, data?.sectionOrder]);
112
+ const charts = (0, react_1.useMemo)(() => {
113
+ const map = {};
114
+ Object.keys(data?.sections ?? {}).forEach((section) => {
115
+ if (!data?.sections?.[section])
116
+ return;
117
+ const sectionCharts = data.sections[section].filter(({ id, chartType }) => id && !['metric', 'table'].includes(chartType ?? ''));
118
+ const sectionOrder = data?.sectionOrder?.find((s) => s.section === section);
119
+ const reportOrder = previewSectionOrder[section] ?? sectionOrder?.reportOrder ?? [];
120
+ if (reportOrder.length > 0) {
121
+ map[section] = [...sectionCharts].sort((a, b) => {
122
+ const aIndex = reportOrder.indexOf(a.id);
123
+ const bIndex = reportOrder.indexOf(b.id);
124
+ if (aIndex !== -1 && bIndex !== -1)
125
+ return aIndex - bIndex;
126
+ if (aIndex !== -1)
127
+ return -1;
128
+ if (bIndex !== -1)
129
+ return 1;
130
+ return sortByOrdering(a, b);
131
+ });
132
+ }
133
+ else {
134
+ map[section] = sectionCharts.sort(sortByOrdering);
135
+ }
136
+ });
137
+ return map;
138
+ }, [data?.sections, data?.sectionOrder]);
139
+ const tables = (0, react_1.useMemo)(() => {
140
+ const map = {};
141
+ Object.keys(data?.sections ?? {}).forEach((section) => {
142
+ if (!data?.sections?.[section])
143
+ return;
144
+ const sectionTables = data.sections[section].filter(({ id, chartType }) => id && chartType === 'table');
145
+ const sectionOrder = data?.sectionOrder?.find((s) => s.section === section);
146
+ const reportOrder = previewSectionOrder[section] ?? sectionOrder?.reportOrder ?? [];
147
+ if (reportOrder.length > 0) {
148
+ map[section] = [...sectionTables].sort((a, b) => {
149
+ const aIndex = reportOrder.indexOf(a.id);
150
+ const bIndex = reportOrder.indexOf(b.id);
151
+ if (aIndex !== -1 && bIndex !== -1)
152
+ return aIndex - bIndex;
153
+ if (aIndex !== -1)
154
+ return -1;
155
+ if (bIndex !== -1)
156
+ return 1;
157
+ return sortByOrdering(a, b);
158
+ });
159
+ }
160
+ else {
161
+ map[section] = sectionTables.sort(sortByOrdering);
162
+ }
163
+ });
164
+ return map;
165
+ }, [data?.sections, data?.sectionOrder]);
166
+ const mounted = (0, react_1.useRef)(false);
167
+ (0, react_1.useEffect)(() => {
168
+ if (!mounted.current) {
169
+ mounted.current = true;
170
+ return;
171
+ }
172
+ if (isClientLoading || tenants === undefined) {
173
+ return;
174
+ }
175
+ reload(name, false, undefined, {
176
+ filters: populatedDashboardFilters ?? [],
177
+ });
178
+ }, [filters]);
179
+ const handleReorder = (0, react_1.useCallback)(async (items) => {
180
+ // find the section order
181
+ const sectionOrder = data?.sectionOrder;
182
+ if (!sectionOrder)
183
+ return;
184
+ const newSectionOrder = Object.entries(items)
185
+ .map(([section, reports]) => {
186
+ const sectionId = sectionOrder.find((s) => s.section === section)?._id;
187
+ if (!sectionId)
188
+ return;
189
+ return {
190
+ _id: sectionId,
191
+ section,
192
+ reportOrder: reports.map((r) => r.id),
193
+ };
194
+ })
195
+ .filter((s) => s);
196
+ await setSectionOrder(newSectionOrder);
197
+ }, [data?.sectionOrder]);
198
+ // New function to handle section reordering
199
+ const handleSectionReorder = (0, react_1.useCallback)(async (newSectionOrder) => {
200
+ if (!data?.sectionOrder)
201
+ return;
202
+ const reorderedSections = newSectionOrder
203
+ .map((sectionName) => {
204
+ const sectionData = data.sectionOrder?.find((s) => s.section === sectionName);
205
+ return sectionData;
206
+ })
207
+ .filter(Boolean);
208
+ await setSectionOrder(reorderedSections);
209
+ }, [data?.sectionOrder, setSectionOrder]);
210
+ const handleSectionNameUpdate = (0, react_1.useCallback)(async (oldSectionName, newSectionName) => {
211
+ if (!data?.sectionOrder)
212
+ return;
213
+ const updatedSections = data.sectionOrder.map((section) => {
214
+ if (section.section === oldSectionName) {
215
+ return {
216
+ ...section,
217
+ section: newSectionName,
218
+ };
219
+ }
220
+ return section;
221
+ });
222
+ await setSectionOrder(updatedSections);
223
+ }, [data?.sectionOrder, setSectionOrder]);
224
+ const handleSectionDelete = (0, react_1.useCallback)(async (sectionName) => {
225
+ if (!data?.sectionOrder || !data?.sections)
226
+ return;
227
+ const sectionToDelete = data.sectionOrder.find((s) => s.section === sectionName);
228
+ const reportsToMove = data.sections[sectionName] || [];
229
+ if (!sectionToDelete)
230
+ return;
231
+ const updatedSectionOrder = data.sectionOrder.filter((section) => section.section !== sectionName);
232
+ const defaultSection = updatedSectionOrder.find((s) => s.section === '');
233
+ if (defaultSection) {
234
+ defaultSection.reportOrder = [
235
+ ...defaultSection.reportOrder,
236
+ ...reportsToMove.map((r) => r.id),
237
+ ];
238
+ }
239
+ await setSectionOrder(updatedSectionOrder);
240
+ }, [data?.sectionOrder, data?.sections, setSectionOrder, reload, name]);
241
+ const handleClickReport = (0, react_1.useCallback)((report) => {
242
+ if (allReportsById[report.id]?.rows !== undefined) {
243
+ onClickReport?.(allReportsById[report.id] ?? report);
244
+ }
245
+ }, [allReportsById, onClickReport]);
246
+ // const [client, isClientLoading] = useContext(ClientContext);
247
+ // const { tenants, flags } = useTenants();
248
+ // const [theme] = useContext<any>(ThemeContext);
249
+ // const [schemaData] = useContext(SchemaDataContext);
250
+ // const { dispatch: dashboardFiltersDispatch } = useContext(
251
+ // DashboardFiltersContext,
252
+ // );
253
+ // const [fieldValuesMap, setFieldValuesMap] = useState<{
254
+ // [key: string]: { [key: string]: string[] };
255
+ // }>({}); // Mapping of unique values per field, used in string filter 'in' and 'not in'
256
+ // const [fieldValuesIsLoaded, setFieldValuesIsLoaded] = useState(false);
257
+ // const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] = useState(false);
258
+ // const [filterListIsOpen, setFilterListIsOpen] = useState(false);
259
+ // const [
260
+ // filterListAddFilterPopoverIsOpen,
261
+ // setFilterListAddFilterPopoverIsOpen,
262
+ // ] = useState(false);
263
+ const presetOptions = (0, react_1.useMemo)(() => {
264
+ return populatedDashboardFilters?.[0]?.filterType === 'date_range'
265
+ ? (0, dateRangePickerUtils_2.convertPresetOptionsToSelectableList)(populatedDashboardFilters[0].presetOptions ?? [], populatedDashboardFilters[0].defaultPresetRanges ?? [])
266
+ : dateRangePickerUtils_1.defaultOptionsV2;
267
+ }, [populatedDashboardFilters]);
268
+ // A filter value can either be a string, an array of strings for a multiselect, or a date range (that could have a comparison range)
269
+ const [filterValues, setFilterValues] = (0, react_1.useState)({});
270
+ const prevNameRef = (0, react_1.useRef)(name);
271
+ const prevTenantsRef = (0, react_1.useRef)(tenants);
272
+ // const prevFlagsRef = useRef<string[] | undefined>(flags);
273
+ // const prevClientRef = useRef<string>(client?.publicKey ?? '');
274
+ // const addFilterPopoverButtonRef = useRef<HTMLDivElement>(null);
275
+ // const viewFiltersPopoverButtonRef = useRef<HTMLDivElement>(null);
276
+ const previousFilters = (0, react_1.useRef)(filters);
277
+ if (!(0, fast_deep_equal_1.default)(previousFilters.current, filters)) {
278
+ previousFilters.current = filters;
279
+ }
280
+ // const pendingReloadRef = useRef(false);
281
+ const isInitialLoadOfDashboardRef = (0, react_1.useRef)(false);
282
+ // const referencedTables = useMemo(() => {
283
+ // const sections = data?.sections || {};
284
+ // // find intersection of all referenced tables
285
+ // const tables: string[] = Object.values(sections)
286
+ // .flatMap((section: any) =>
287
+ // section.map((chart: QuillReportInternal) => chart.referencedTables),
288
+ // )
289
+ // .flat();
290
+ // return Array.from(new Set(tables));
291
+ // }, [data?.sections]);
292
+ (0, react_1.useEffect)(() => {
293
+ if (prevNameRef.current === name &&
294
+ Object.values(data?.sections ?? {}).flat().length) {
295
+ return;
296
+ }
297
+ prevNameRef.current = name;
298
+ if (isClientLoading || parentLoading || tenants === undefined) {
299
+ // Reload the dashboard when the client is loaded
300
+ // pendingReloadRef.current = true;
301
+ return;
302
+ }
303
+ if (isInitialLoadOfDashboardRef.current)
304
+ return;
305
+ isInitialLoadOfDashboardRef.current = true;
306
+ reload(name, true, undefined, populatedDashboardFilters?.length
307
+ ? { filters: populatedDashboardFilters, refetchReports: true }
308
+ : undefined).then(() => {
309
+ isInitialLoadOfDashboardRef.current = false;
310
+ prevTenantsRef.current = tenants;
311
+ // prevFlagsRef.current = flags;
312
+ });
313
+ }, [name, isClientLoading, parentLoading, tenants]);
314
+ const tenantMounted = (0, react_1.useRef)(false);
315
+ (0, react_1.useEffect)(() => {
316
+ if (!tenantMounted.current) {
317
+ tenantMounted.current = true;
318
+ return;
319
+ }
320
+ const tenantsChanged = !(0, fast_deep_equal_1.default)(prevTenantsRef.current, tenants);
321
+ // || equal(prevFlagsRef.current, flags);
322
+ if (isClientLoading || tenants === undefined || !tenantsChanged) {
323
+ // Reload the dashboard when the client is loaded
324
+ // pendingReloadRef.current = true;
325
+ return;
326
+ }
327
+ if (isInitialLoadOfDashboardRef.current)
328
+ return;
329
+ isInitialLoadOfDashboardRef.current = true;
330
+ reload(name, tenantsChanged).then(() => {
331
+ prevTenantsRef.current = tenants;
332
+ // prevFlagsRef.current = flags;
333
+ isInitialLoadOfDashboardRef.current = false;
334
+ });
335
+ }, [tenants]);
336
+ // TODO: this block does not appear necessary, uncomment if otherwise
337
+ // useEffect(() => {
338
+ // if (prevClientRef.current === client?.publicKey) {
339
+ // return;
340
+ // }
341
+ // prevClientRef.current = client?.publicKey ?? '';
342
+ // if (isClientLoading || tenants === undefined) {
343
+ // // Reload the dashboard when the client is loaded
344
+ // // pendingReloadRef.current = true;
345
+ // return;
346
+ // }
347
+ // if (isInitialLoadOfDashboardRef.current) return;
348
+ // isInitialLoadOfDashboardRef.current = true;
349
+ // reload(name, true).then(() => {
350
+ // prevTenantsRef.current = tenants;
351
+ // // prevFlagsRef.current = flags;
352
+ // isInitialLoadOfDashboardRef.current = false;
353
+ // });
354
+ // }, [client?.publicKey]);
355
+ (0, react_1.useEffect)(() => {
356
+ setFilterValues(Object.values(populatedDashboardFilters ?? {}).reduce((acc, f) => {
357
+ acc[f.label] =
358
+ f.filterType === 'string'
359
+ ? f.stringFilterType === 'multiselect'
360
+ ? { values: f.values, operator: 'IN' }
361
+ : { selectedValue: f.selectedValue }
362
+ : {
363
+ startDate: f.startDate,
364
+ endDate: f.endDate,
365
+ preset: f.preset,
366
+ comparisonRange: f.comparisonRange,
367
+ };
368
+ return acc;
369
+ }, {}));
370
+ }, [populatedDashboardFilters]);
371
+ // FIXME: enable user filters in internal dashboard
372
+ // useEffect(() => {
373
+ // const dashboardDateFilter = populatedDashboardFilters?.find(
374
+ // (f) => f.filterType === 'date_range',
375
+ // );
376
+ // if (dashboardDateFilter) {
377
+ // // Filter for custom date filter that applies to the report's dateField
378
+ // const customDateFilter = previousFilters.current?.find(
379
+ // (f) => f.filterType === FilterType.Date,
380
+ // // FIXME: this is the correct way to do it but the demo has a hardcoded filter field
381
+ // // && f.field === report?.dateField?.field && f.table === report?.dateField?.table,
382
+ // );
383
+ // if (!customDateFilter) {
384
+ // return;
385
+ // }
386
+ // const newFilter = applyCustomFilterToDashDateFilter(
387
+ // customDateFilter,
388
+ // dashboardDateFilter,
389
+ // );
390
+ // setFilterValues((filterValues) => ({
391
+ // ...filterValues,
392
+ // [dashboardDateFilter.label]: {
393
+ // startDate: newFilter.startDate,
394
+ // endDate: newFilter.endDate,
395
+ // preset: newFilter.preset,
396
+ // comparisonRange: newFilter.comparisonRange,
397
+ // },
398
+ // }));
399
+ // dashboardFiltersDispatch({
400
+ // type: 'UPDATE_DASHBOARD_FILTER',
401
+ // dashboardName: name,
402
+ // filterName: dashboardDateFilter.label,
403
+ // data: {
404
+ // filter: newFilter,
405
+ // loading: false,
406
+ // },
407
+ // });
408
+ // }
409
+ // }, [previousFilters.current]);
410
+ // Go through all columns in the referenced tables and get the unique values to use in fieldValuesMap
411
+ // useEffect(() => {
412
+ // const fetchData = async () => {
413
+ // setFieldValuesIsLoaded(false);
414
+ // const newFieldValues: { [key: string]: { [key: string]: string[] } } = {};
415
+ // await Promise.all(
416
+ // referencedTables.map(async (table: string) => {
417
+ // const tableInfo = schema.find(
418
+ // (tableInfo: Table) => tableInfo.name === table,
419
+ // );
420
+ // if (tableInfo) {
421
+ // const uniqueValues = await getUniqueStringValuesByColumn({
422
+ // columns: tableInfo.columns,
423
+ // tableName: table,
424
+ // client,
425
+ // tenants,
426
+ // dashboardName: name,
427
+ // });
428
+ // if (uniqueValues) {
429
+ // newFieldValues[table] = {};
430
+ // Object.keys(uniqueValues).forEach((field) => {
431
+ // newFieldValues[table]![field] = uniqueValues[field] || [];
432
+ // });
433
+ // }
434
+ // }
435
+ // }),
436
+ // );
437
+ // setFieldValuesMap(newFieldValues);
438
+ // setFieldValuesIsLoaded(true);
439
+ // };
440
+ // if (data?.customFiltersEnabled) {
441
+ // fetchData();
442
+ // }
443
+ // }, [referencedTables]);
444
+ const updateFilter = (filter, value, comparison) => {
445
+ if (!populatedDashboardFilters)
446
+ return;
447
+ let filterValue = {};
448
+ if (filter.filterType === 'string') {
449
+ if (filter.stringFilterType === 'multiselect') {
450
+ if ((value?.length ?? 0) === 0) {
451
+ filterValue = { values: undefined, operator: undefined };
452
+ }
453
+ else {
454
+ filterValue = { values: value, operator: 'IN' };
455
+ }
456
+ }
457
+ else {
458
+ filterValue = { selectedValue: value };
459
+ }
460
+ }
461
+ else if (filter.filterType === filter_1.DashboardFilterType.Date) {
462
+ if (comparison ||
463
+ (filter.comparison &&
464
+ (filter.comparisonRange?.value ?? 'NO_COMPARISON') !==
465
+ 'NO_COMPARISON')) {
466
+ let preset = '';
467
+ if (comparison) {
468
+ preset = filter.preset.value;
469
+ }
470
+ const key = comparison?.value ||
471
+ (filter.comparisonRange?.value ?? 'NO_COMPARISON');
472
+ let primaryRange = {
473
+ startDate: value ? value.startDate : filter.startDate,
474
+ endDate: value ? value.endDate : filter.endDate,
475
+ };
476
+ if (value && value.preset) {
477
+ preset = value.preset;
478
+ primaryRange = (0, dateRangePickerUtils_1.getRangeFromPresetOptions)(value.preset, presetOptions);
479
+ }
480
+ filterValue = {
481
+ startDate: primaryRange.startDate,
482
+ endDate: primaryRange.endDate,
483
+ preset: {
484
+ label: presetOptions.find((o) => o.value === preset)?.label ?? preset,
485
+ value: preset,
486
+ },
487
+ comparisonRange: {
488
+ startDate: dateRangePickerUtils_1.COMPARISON_RANGE[key](primaryRange)
489
+ ?.startDate,
490
+ endDate: dateRangePickerUtils_1.COMPARISON_RANGE[key](primaryRange)
491
+ ?.endDate,
492
+ value: key,
493
+ },
494
+ };
495
+ }
496
+ else {
497
+ const primaryRange = value && value.preset
498
+ ? (0, dateRangePickerUtils_1.getRangeFromPresetOptions)(value.preset, presetOptions)
499
+ : {
500
+ startDate: value?.startDate || filter.startDate,
501
+ endDate: value?.endDate || filter.endDate,
502
+ };
503
+ const preset = value?.preset ? value.preset : '';
504
+ filterValue = {
505
+ startDate: primaryRange.startDate,
506
+ endDate: primaryRange.endDate,
507
+ preset: {
508
+ label: presetOptions.find((o) => o.value === preset)?.label ?? preset,
509
+ value: preset,
510
+ },
511
+ };
512
+ }
513
+ }
514
+ setFilterValues((filterValues) => ({
515
+ ...filterValues,
516
+ [filter.label]: filterValue,
517
+ }));
518
+ reload(name, false, undefined, {
519
+ filters: populatedDashboardFilters.map((f) => filter.label === f.label ? { ...f, ...filterValue } : f),
520
+ editedFilterLabel: filter.label,
521
+ });
522
+ };
523
+ // generate the correct filter structure
524
+ // const getUserFilter = (
525
+ // filter: InternalFilter,
526
+ // id: number,
527
+ // existingFilter?: any,
528
+ // ): any => {
529
+ // let userFilter = {};
530
+ // if (existingFilter) {
531
+ // userFilter = { ...existingFilter };
532
+ // } else {
533
+ // userFilter = { _id: `userFilter_${id}` };
534
+ // }
535
+ // userFilter = {
536
+ // ...userFilter,
537
+ // table: filter.table ?? '',
538
+ // field: filter.field,
539
+ // filterType: filter.filterType,
540
+ // fieldType: filter.fieldType,
541
+ // value: filter.value,
542
+ // operator: filter.operator,
543
+ // dashboardName: name,
544
+ // isUserFilter: true,
545
+ // };
546
+ // return userFilter;
547
+ // };
548
+ // // new update filter function for user added filters
549
+ // const updateUserFilter = (filter: InternalFilter) => {
550
+ // setUserFilters((userFilters) => ({
551
+ // ...userFilters,
552
+ // [filter.field]: filter,
553
+ // }));
554
+ // };
555
+ (0, react_1.useEffect)(() => {
556
+ if (onChangeLoading && isLoading) {
557
+ onChangeLoading(isLoading);
558
+ }
559
+ }, [isLoading, onChangeLoading]);
560
+ const sortedSections = (0, react_1.useMemo)(() => {
561
+ const sectionMap = (data?.sectionOrder || []).reduce((acc, section) => {
562
+ acc[section.section] = section._id;
563
+ return acc;
564
+ }, {});
565
+ return Object.keys(data?.sections ?? {})
566
+ .sort((a, b) => {
567
+ if (a === '')
568
+ return -1;
569
+ if (b === '')
570
+ return 1;
571
+ const sectionOrder = data?.sectionOrder;
572
+ if (!sectionOrder)
573
+ return 0;
574
+ const aIndex = sectionOrder.map((s) => s.section).indexOf(a);
575
+ const bIndex = sectionOrder.map((s) => s.section).indexOf(b);
576
+ if (aIndex === -1 && bIndex === -1)
577
+ return 0;
578
+ if (aIndex === -1)
579
+ return 1;
580
+ if (bIndex === -1)
581
+ return -1;
582
+ return aIndex - bIndex;
583
+ })
584
+ .map((sectionName) => ({
585
+ name: sectionName,
586
+ id: sectionMap[sectionName] || sectionName, // Fall back to name if ID is not found
587
+ }));
588
+ }, [data?.sections, data?.sectionOrder]);
589
+ const sortedSectionNames = (0, react_1.useMemo)(() => sortedSections.map((section) => section.name), [sortedSections]);
590
+ const dragSensors = (0, core_1.useSensors)((0, core_1.useSensor)(core_1.PointerSensor, {
591
+ activationConstraint: {
592
+ distance: 5,
593
+ },
594
+ }), (0, core_1.useSensor)(core_1.KeyboardSensor, {
595
+ coordinateGetter: sortable_1.sortableKeyboardCoordinates,
596
+ }), (0, core_1.useSensor)(core_1.TouchSensor, {
597
+ activationConstraint: {
598
+ delay: 100,
599
+ tolerance: 8,
600
+ },
601
+ }));
602
+ const [activeId, setActiveId] = (0, react_1.useState)(null);
603
+ const [overId, setOverId] = (0, react_1.useState)(null);
604
+ const [activeItem, setActiveItem] = (0, react_1.useState)(null);
605
+ const [isDraggingSection, setIsDraggingSection] = (0, react_1.useState)(false);
606
+ const handleDragStart = (0, react_1.useCallback)((event) => {
607
+ const { active } = event;
608
+ setActiveId(active.id);
609
+ const activeDraggingSection = !String(active.id).includes('::');
610
+ setIsDraggingSection(activeDraggingSection);
611
+ if (activeDraggingSection) {
612
+ const sectionName = String(active.id);
613
+ setActiveItem({
614
+ type: 'section',
615
+ name: sectionName === '' ? 'Default Section' : sectionName,
616
+ id: sectionName,
617
+ });
618
+ }
619
+ else {
620
+ const [section, itemId] = String(active.id).split('::');
621
+ if (section === undefined || !itemId)
622
+ return;
623
+ let report;
624
+ report = data?.sections?.[section]?.find((r) => r._id === itemId || r.id === itemId);
625
+ if (!report && section === '') {
626
+ if (metrics?.[section]) {
627
+ report = metrics[section].find((r) => r._id === itemId || r.id === itemId);
628
+ }
629
+ if (!report && charts?.[section]) {
630
+ report = charts[section].find((r) => r._id === itemId || r.id === itemId);
631
+ }
632
+ if (!report && tables?.[section]) {
633
+ report = tables[section].find((r) => r._id === itemId || r.id === itemId);
634
+ }
635
+ }
636
+ if (report) {
637
+ const newActiveItem = {
638
+ type: 'report',
639
+ id: report.id,
640
+ section: section,
641
+ name: report.name || 'Untitled Report',
642
+ chartType: report.chartType || 'chart',
643
+ };
644
+ setActiveItem(newActiveItem);
645
+ }
646
+ else {
647
+ console.warn('Could not find report data for:', section, itemId);
648
+ }
649
+ }
650
+ }, [data?.sections, metrics, charts, tables]);
651
+ const handleDragEnd = (0, react_1.useCallback)((event) => {
652
+ const { active, over } = event;
653
+ setActiveId(null);
654
+ setOverId(null);
655
+ setActiveItem(null);
656
+ setIsDraggingSection(false);
657
+ setPreviewSectionOrder({});
658
+ if (!active || !over)
659
+ return;
660
+ const activeId = active.id.toString();
661
+ const overId = over.id.toString();
662
+ if (!activeId.includes('::')) {
663
+ let targetSection = overId;
664
+ if (overId.startsWith('section-')) {
665
+ targetSection = overId.replace('section-', '');
666
+ }
667
+ else if (overId.includes('::')) {
668
+ const [sectionName] = overId.split('::');
669
+ targetSection = sectionName;
670
+ }
671
+ if (targetSection &&
672
+ sortedSectionNames.includes(activeId) &&
673
+ sortedSectionNames.includes(targetSection)) {
674
+ const oldIndex = sortedSectionNames.indexOf(activeId);
675
+ const newIndex = sortedSectionNames.indexOf(targetSection);
676
+ if (oldIndex !== -1 && newIndex !== -1 && oldIndex !== newIndex) {
677
+ const newSectionOrder = (0, sortable_1.arrayMove)(sortedSectionNames, oldIndex, newIndex);
678
+ handleSectionReorder(newSectionOrder);
679
+ }
680
+ }
681
+ return;
682
+ }
683
+ const [sourceSection, reportId] = activeId.split('::');
684
+ let targetSection = '';
685
+ let targetReportId = '';
686
+ if (overId.startsWith('section-')) {
687
+ targetSection = overId.replace('section-', '');
688
+ }
689
+ else if (overId.includes('::')) {
690
+ [targetSection, targetReportId] = overId.split('::');
691
+ }
692
+ else {
693
+ targetSection = overId;
694
+ }
695
+ if (sourceSection === undefined ||
696
+ reportId === undefined ||
697
+ targetSection === undefined)
698
+ return;
699
+ const newItems = { ...data?.sections };
700
+ const report = newItems[sourceSection]?.find((item) => item._id === reportId || item.id === reportId);
701
+ if (!report || !newItems[sourceSection])
702
+ return;
703
+ if (sourceSection === '' && targetSection === '') {
704
+ const activeChartType = report.chartType || 'chart';
705
+ if (!targetReportId)
706
+ return;
707
+ const overItem = newItems[targetSection]?.find((item) => item._id === targetReportId || item.id === targetReportId);
708
+ if (!overItem)
709
+ return;
710
+ const overChartType = overItem.chartType || 'chart';
711
+ const isMetric = (type) => type === 'metric';
712
+ const isTable = (type) => type === 'table';
713
+ const isChart = (type) => !isMetric(type) && !isTable(type);
714
+ const isSameCategory = (isMetric(activeChartType) && isMetric(overChartType)) ||
715
+ (isTable(activeChartType) && isTable(overChartType)) ||
716
+ (isChart(activeChartType) && isChart(overChartType));
717
+ if (!isSameCategory) {
718
+ return;
719
+ }
720
+ const activeIndex = newItems[sourceSection].findIndex((item) => item._id === reportId || item.id === reportId);
721
+ const overIndex = newItems[sourceSection].findIndex((item) => item._id === targetReportId || item.id === targetReportId);
722
+ if (activeIndex !== -1 && overIndex !== -1) {
723
+ const sameTypeItems = newItems[sourceSection]
724
+ .map((item, index) => ({ item, index }))
725
+ .filter(({ item }) => {
726
+ const itemType = item.chartType || 'chart';
727
+ if (isMetric(activeChartType))
728
+ return isMetric(itemType);
729
+ if (isTable(activeChartType))
730
+ return isTable(itemType);
731
+ return isChart(itemType);
732
+ });
733
+ const typeActiveIndex = sameTypeItems.findIndex(({ item }) => item.id === reportId);
734
+ const typeOverIndex = sameTypeItems.findIndex(({ item }) => item.id === targetReportId);
735
+ if (typeActiveIndex !== -1 && typeOverIndex !== -1) {
736
+ const reordered = (0, sortable_1.arrayMove)(sameTypeItems.map(({ item }) => item), typeActiveIndex, typeOverIndex);
737
+ const result = [...newItems[sourceSection]];
738
+ let reorderedIndex = 0;
739
+ for (let i = 0; i < result.length; i++) {
740
+ const itemType = result[i]?.chartType || 'chart';
741
+ const isRightCategory = (isMetric(activeChartType) && isMetric(itemType)) ||
742
+ (isTable(activeChartType) && isTable(itemType)) ||
743
+ (isChart(activeChartType) && isChart(itemType));
744
+ if (isRightCategory && reorderedIndex < reordered.length) {
745
+ result[i] = reordered[reorderedIndex++];
746
+ }
747
+ }
748
+ newItems[sourceSection] = result;
749
+ handleReorder(newItems);
750
+ }
751
+ }
752
+ }
753
+ else if (sourceSection === targetSection) {
754
+ const overItem = newItems[sourceSection]?.find((item) => item._id === targetReportId);
755
+ if (!overItem)
756
+ return;
757
+ const activeIndex = newItems[sourceSection].indexOf(report);
758
+ const overIndex = newItems[sourceSection].indexOf(overItem);
759
+ if (activeIndex !== -1 && overIndex !== -1) {
760
+ newItems[sourceSection] = (0, sortable_1.arrayMove)(newItems[sourceSection], activeIndex, overIndex);
761
+ handleReorder(newItems);
762
+ }
763
+ }
764
+ else if (newItems[targetSection]) {
765
+ newItems[sourceSection] = newItems[sourceSection].filter((item) => item._id !== reportId && item.id !== reportId);
766
+ if (!newItems[targetSection]) {
767
+ newItems[targetSection] = [];
768
+ }
769
+ // Check if we're dropping on section header (starts with section-)
770
+ // or if the overId is exactly the section name (no specific report)
771
+ if (overId.startsWith('section-') ||
772
+ overId === targetSection ||
773
+ !targetReportId) {
774
+ // PREPEND to the section when dropped on section header IF the source section comes before the target section
775
+ // otherwise APPEND to the section
776
+ const targetIndex = sortedSectionNames.indexOf(targetSection);
777
+ const sourceIndex = sortedSectionNames.indexOf(sourceSection);
778
+ if (sourceIndex < targetIndex) {
779
+ newItems[targetSection]?.unshift(report);
780
+ }
781
+ else {
782
+ newItems[targetSection]?.push(report);
783
+ }
784
+ }
785
+ else {
786
+ // Regular drop on a specific report
787
+ const targetReport = newItems[targetSection]?.find((item) => item._id === targetReportId || item.id === targetReportId);
788
+ if (targetReport) {
789
+ const targetSectionIndex = sortedSectionNames.indexOf(targetSection);
790
+ const sourceSectionIndex = sortedSectionNames.indexOf(sourceSection);
791
+ const targetIndex = newItems[targetSection]?.indexOf(targetReport);
792
+ newItems[targetSection]?.splice((targetIndex ?? 0) +
793
+ (sourceSectionIndex > targetSectionIndex ? 1 : 0), 0, report);
794
+ }
795
+ else {
796
+ // No target found, append to end
797
+ newItems[targetSection]?.push(report);
798
+ }
799
+ }
800
+ handleReorder(newItems);
801
+ }
802
+ }, [data?.sections, sortedSectionNames, handleReorder, handleSectionReorder]);
803
+ const handleDragOver = (0, react_1.useCallback)((event) => {
804
+ const { active, over } = event;
805
+ if (!active || !over) {
806
+ setOverId(null);
807
+ return;
808
+ }
809
+ const activeId = active.id.toString();
810
+ const overId = over.id.toString();
811
+ // Check if we're dragging a section
812
+ const isDraggingSection = !activeId.includes('::');
813
+ if (isDraggingSection) {
814
+ let targetId = overId;
815
+ if (activeId === overId ||
816
+ (overId.startsWith('section-') && `section-${activeId}` === overId) ||
817
+ activeId === overId.replace('section-', '')) {
818
+ setOverId(null);
819
+ return;
820
+ }
821
+ if (overId.startsWith('section-')) {
822
+ targetId = overId.replace('section-', '');
823
+ // Don't allow unassigned section to be a target
824
+ if (targetId === '') {
825
+ setOverId(null);
826
+ return;
827
+ }
828
+ }
829
+ else if (overId.includes('::')) {
830
+ // If hovering over a report, extract its section
831
+ const [targetSection] = overId.split('::');
832
+ // Skip invalid section targets
833
+ if (!targetSection ||
834
+ targetSection === activeId ||
835
+ targetSection === '') {
836
+ setOverId(null);
837
+ return;
838
+ }
839
+ targetId = targetSection;
840
+ }
841
+ else if (overId === '') {
842
+ setOverId(null);
843
+ return;
844
+ }
845
+ setOverId(targetId);
846
+ return;
847
+ }
848
+ const [sourceSection] = activeId.split('::');
849
+ // Case 1: Hovering over a section container
850
+ if (overId.startsWith('section-')) {
851
+ const targetSection = overId.replace('section-', '');
852
+ if (sourceSection !== targetSection) {
853
+ setOverId(`section::${targetSection}`);
854
+ }
855
+ else {
856
+ setOverId(null);
857
+ }
858
+ return;
859
+ }
860
+ // Case 2: Hovering over a report
861
+ if (overId.includes('::')) {
862
+ const [targetSection] = overId.split('::');
863
+ if (sourceSection !== targetSection && targetSection) {
864
+ setOverId(`section::${targetSection}`);
865
+ }
866
+ else if (sourceSection === targetSection &&
867
+ overId !== activeId &&
868
+ sourceSection) {
869
+ const activeItemId = activeId.split('::')[1];
870
+ const overItemId = overId.split('::')[1];
871
+ // Always use the latest state with the functional form of setPreviewSectionOrder
872
+ setPreviewSectionOrder((prevOrder) => {
873
+ // Check if we already have a preview order for this section
874
+ const existingOrder = prevOrder[sourceSection];
875
+ if (!existingOrder) {
876
+ // No preview order yet, create one from the original data
877
+ const sectionItems = data?.sections?.[sourceSection]?.map((r) => r.id) ?? [];
878
+ const oldIndex = sectionItems.indexOf(activeItemId);
879
+ const newIndex = sectionItems.indexOf(overItemId);
880
+ if (oldIndex !== -1 && newIndex !== -1 && oldIndex !== newIndex) {
881
+ // Create new preview order but keep other sections
882
+ return {
883
+ ...prevOrder,
884
+ [sourceSection]: (0, sortable_1.arrayMove)(sectionItems, oldIndex, newIndex),
885
+ };
886
+ }
887
+ }
888
+ else {
889
+ // We already have a preview order, update it
890
+ const oldIndex = existingOrder.indexOf(activeItemId);
891
+ const newIndex = existingOrder.indexOf(overItemId);
892
+ if (oldIndex !== -1 && newIndex !== -1 && oldIndex !== newIndex) {
893
+ // Update existing preview order but keep other sections
894
+ return {
895
+ ...prevOrder,
896
+ [sourceSection]: (0, sortable_1.arrayMove)([...existingOrder], oldIndex, newIndex),
897
+ };
898
+ }
899
+ }
900
+ // Return unchanged state if conditions aren't met
901
+ return prevOrder;
902
+ });
903
+ setOverId(overId);
904
+ }
905
+ return;
906
+ }
907
+ setOverId(overId);
908
+ }, [data?.sections, setPreviewSectionOrder]);
909
+ const draggedIndex = (0, react_1.useMemo)(() => {
910
+ if (!activeId || !sortedSectionNames.includes(activeId))
911
+ return -1;
912
+ return sortedSectionNames.indexOf(activeId || '');
913
+ }, [activeId, sortedSectionNames]);
914
+ const collisionDetectionStrategy = (0, react_1.useCallback)((args) => {
915
+ if (!String(args.active.id).includes('::')) {
916
+ const collisions = (0, core_1.pointerWithin)(args).filter((collision) => {
917
+ return collision.id.toString().startsWith('section-');
918
+ });
919
+ if (collisions.length > 0)
920
+ return collisions;
921
+ // Fall back to closest corners
922
+ return (0, core_1.closestCenter)(args).filter((c) => c.id.toString().startsWith('section-'));
923
+ }
924
+ const [sourceSection] = String(args.active.id).split('::');
925
+ const sectionIntersections = args.droppableContainers
926
+ .filter((container) => {
927
+ const containerId = String(container.id);
928
+ return containerId.startsWith('section-');
929
+ })
930
+ .filter((container) => {
931
+ const sectionId = String(container.id).replace('section-', '');
932
+ return sectionId !== sourceSection;
933
+ })
934
+ .map((container) => {
935
+ const rect = container.rect.current;
936
+ const activeRect = args.active.rect.current;
937
+ if (!rect || !activeRect)
938
+ return null;
939
+ const isIntersecting = activeRect.left < rect.right &&
940
+ activeRect.right > rect.left &&
941
+ activeRect.top < rect.bottom &&
942
+ activeRect.bottom > rect.top;
943
+ if (isIntersecting) {
944
+ return {
945
+ id: container.id,
946
+ data: {
947
+ droppableContainer: true,
948
+ value: container.id,
949
+ },
950
+ };
951
+ }
952
+ return null;
953
+ })
954
+ .filter(Boolean);
955
+ if (sectionIntersections.length > 0) {
956
+ return sectionIntersections;
957
+ }
958
+ const pointerIntersections = (0, core_1.pointerWithin)(args);
959
+ if (pointerIntersections.length > 0)
960
+ return pointerIntersections;
961
+ const rectIntersections = (0, core_1.rectIntersection)(args);
962
+ if (rectIntersections.length > 0)
963
+ return rectIntersections;
964
+ return (0, core_1.closestCorners)(args);
965
+ }, []);
966
+ const handleAddSection = (0, react_1.useCallback)((sectionName) => {
967
+ if (!data?.sectionOrder)
968
+ return;
969
+ const updatedSectionOrder = [
970
+ ...data.sectionOrder,
971
+ {
972
+ section: sectionName,
973
+ reportOrder: [],
974
+ },
975
+ ];
976
+ setSectionOrder(updatedSectionOrder);
977
+ }, [data?.sectionOrder, data?.sections, setSectionOrder]);
978
+ const existingSectionNames = (0, react_1.useMemo)(() => Object.keys(data?.sections || {}), [data?.sections]);
979
+ if (!isLoading &&
980
+ (Object.keys(data?.sections ?? {}).length === 0 ||
981
+ Object.values(data?.sections ?? {}).flat().length === 0)) {
982
+ return (0, jsx_runtime_1.jsx)(EmptyDashboardComponent_1.default, {});
983
+ }
984
+ if (hidden || isLoading || isClientLoading || parentLoading) {
985
+ return (0, jsx_runtime_1.jsx)(DashboardLoadingComponent_1.DashboardLoadingComponent, { containerStyle: containerStyle });
986
+ }
987
+ if (!data?.sections) {
988
+ return ((0, jsx_runtime_1.jsx)(UiComponents_1.QuillErrorMessageComponent, { containerStyle: { height: 100 }, errorMessage: "Error loading dashboard" }));
989
+ }
990
+ return ((0, jsx_runtime_1.jsxs)("div", { style: containerStyle, children: [(0, jsx_runtime_1.jsx)("style", { children: `
991
+ .section-header {
992
+ display: flex;
993
+ flex-direction: row;
994
+ align-items: center;
995
+ gap: 10px;
996
+ }
997
+ .section-drag-handle {
998
+ transform: translateY(2px);
999
+ }
1000
+ .section-name-input {
1001
+ font-size: 22px;
1002
+ font-weight: bold;
1003
+ border: none;
1004
+ background: transparent;
1005
+ // border-bottom: 2px solid #3b82f6;
1006
+ outline: none;
1007
+ width: auto;
1008
+ padding: 0;
1009
+ margin: 0;
1010
+ text-align: left;
1011
+ box-sizing: content-box;
1012
+ }
1013
+ .section-name-display {
1014
+ cursor: pointer;
1015
+ }
1016
+ .section-name-display:hover {
1017
+ text-decoration: underline;
1018
+ text-decoration-style: dotted;
1019
+ text-decoration-color: #9CA0A7;
1020
+ }
1021
+ .section-delete-button {
1022
+ cursor: pointer;
1023
+ color: #9CA0A7;
1024
+ transform: translateY(2px);
1025
+ }
1026
+ .section-delete-button:hover {
1027
+ color: #EF4444;
1028
+ }
1029
+ .dragging-item {
1030
+ opacity: 0.8;
1031
+ box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2) !important;
1032
+ transform-origin: 0 0;
1033
+ transition: box-shadow 200ms ease, opacity 200ms ease !important;
1034
+ }
1035
+
1036
+ .section-drop-target {
1037
+ transition: all 150ms ease;
1038
+ }
1039
+
1040
+ .dragging-item {
1041
+ opacity: 0.7 !important;
1042
+ z-index: 9999 !important;
1043
+ cursor: grabbing !important;
1044
+ transform-origin: 0 0;
1045
+ box-shadow: 0px 10px 20px rgba(0,0,0,0.2) !important;
1046
+ transition: none !important;
1047
+ pointer-events: none;
1048
+ }
1049
+
1050
+ .section-drop-target {
1051
+ position: relative;
1052
+ border-radius: 8px;
1053
+ transition: all 0.2s ease;
1054
+ min-height: 100px;
1055
+ }
1056
+
1057
+ .section-grid-container {
1058
+ min-height: 100px;
1059
+ width: 100%;
1060
+ transition: background-color 0.2s ease;
1061
+ }
1062
+
1063
+ .section-container {
1064
+ position: relative;
1065
+ transition: all 150ms ease;
1066
+ }
1067
+
1068
+ .section-grid-container {
1069
+ min-height: 120px;
1070
+ width: 100%;
1071
+ border-radius: 8px;
1072
+ transition: all 0.15s ease-in-out;
1073
+ }
1074
+
1075
+ .dragging-section {
1076
+ z-index: 9999 !important;
1077
+ opacity: 0.8;
1078
+ background-color: white;
1079
+ box-shadow: 0px 10px 25px rgba(0,0,0,0.15) !important;
1080
+ outline: 1px solid #e5e7eb;
1081
+ transition: none !important;
1082
+ transform-origin: 0 0;
1083
+ }
1084
+
1085
+ .section-container {
1086
+ position: relative;
1087
+ transition: all 150ms ease;
1088
+ height: auto !important;
1089
+ min-height: fit-content;
1090
+ }
1091
+
1092
+ .section-grid-container.empty {
1093
+ border: 1px dashed #e5e7eb;
1094
+ min-height: 120px;
1095
+ padding: 16px !important;
1096
+ }
1097
+
1098
+ .sortable-section-wrapper {
1099
+ height: auto !important;
1100
+ min-height: fit-content !important;
1101
+ position: relative;
1102
+ margin-bottom: 20px;
1103
+ }
1104
+
1105
+ .dashboard-container.dragging-section .section-container {
1106
+ outline: none !important;
1107
+ box-shadow: none !important;
1108
+ background-color: transparent !important;
1109
+ }
1110
+
1111
+
1112
+ .section-container {
1113
+ position: relative;
1114
+ transition: all 150ms ease;
1115
+ height: auto !important;
1116
+ min-height: fit-content;
1117
+ padding: 0px;
1118
+ margin: 0px;
1119
+ }
1120
+
1121
+ .dashboard-container:not(.dragging-section) .section-highlighted {
1122
+ background-color: rgba(59, 130, 246, 0.05) !important;
1123
+ border-radius: 8px !important;
1124
+ outline: 2px solid #3b82f6 !important;
1125
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1) !important;
1126
+ padding: 12px !important;
1127
+ margin: -12px !important;
1128
+ }
1129
+
1130
+ .dashboard-container.dragging-section .section-container {
1131
+ outline: none !important;
1132
+ box-shadow: none !important;
1133
+ background-color: transparent !important;
1134
+ /* Reset padding/margin when dragging sections */
1135
+ padding: 0px !important;
1136
+ margin: 0px !important;
1137
+ }
1138
+
1139
+ .section-drag-preview {
1140
+ background: white;
1141
+ border-radius: 8px;
1142
+ box-shadow: 0px 10px 25px rgba(0, 0, 0, 0.15);
1143
+ padding: 16px;
1144
+ border: 1px solid #e5e7eb;
1145
+ transform-origin: 0 0;
1146
+ cursor: grabbing;
1147
+ min-height: 300px;
1148
+ }
1149
+
1150
+ .section-drag-preview .section-header {
1151
+ display: flex;
1152
+ flex-direction: row;
1153
+ align-items: center;
1154
+ width: 100%;
1155
+ }
1156
+
1157
+ .section-drag-preview h2 {
1158
+ font-size: 22px;
1159
+ font-weight: bold;
1160
+ margin: 0;
1161
+ padding: 0;
1162
+ overflow: hidden;
1163
+ text-overflow: ellipsis;
1164
+ white-space: nowrap;
1165
+ }
1166
+
1167
+ .dashboard-container.dragging-section {
1168
+ box-shadow: none !important;
1169
+ outline: none !important;
1170
+ }
1171
+
1172
+ .dashboard-container.dragging-section > div {
1173
+ box-shadow: none;
1174
+ }
1175
+
1176
+ .quill-report-edit {
1177
+ box-shadow: 0px 2px 8px rgba(56, 65, 81, 0.08);
1178
+ }
1179
+
1180
+ .quill-report-edit.dragging-item {
1181
+ box-shadow: 0px 10px 20px rgba(0,0,0,0.2) !important;
1182
+ }
1183
+
1184
+ .section-grid-container.empty {
1185
+ background-color: rgba(249, 250, 251, 0.5);
1186
+ transition: all 0.2s ease;
1187
+ position: relative;
1188
+ }
1189
+
1190
+ .section-grid-container.empty::after {
1191
+ content: 'Drop reports here';
1192
+ color: #9CA3AF;
1193
+ font-size: 16px;
1194
+ opacity: 0.8;
1195
+ position: absolute;
1196
+ top: 50%;
1197
+ left: 50%;
1198
+ transform: translate(-50%, -50%);
1199
+ white-space: nowrap;
1200
+ }
1201
+
1202
+ .new-section-button.editing {
1203
+ opacity: 1;
1204
+ border-color: #3b82f6;
1205
+ background-color: white;
1206
+ cursor: default;
1207
+ min-height: 100px;
1208
+ height: auto;
1209
+ }
1210
+
1211
+ .new-section-button {
1212
+ border: 2px dashed #e5e7eb;
1213
+ border-radius: 8px;
1214
+ margin-top: 20px;
1215
+ padding: 16px;
1216
+ display: flex;
1217
+ flex-direction: column;
1218
+ align-items: center;
1219
+ justify-content: center;
1220
+ cursor: pointer;
1221
+ height: 100px;
1222
+ opacity: 0;
1223
+ pointer-events: auto; /* Enable pointer events by default */
1224
+ }
1225
+
1226
+ /* Only show hover effect when NOT dragging */
1227
+ .dashboard-container:not(.dragging-section):not(.dragging-report) .new-section-button:hover {
1228
+ opacity: 1;
1229
+ border-color: #3b82f6;
1230
+ }
1231
+
1232
+ .new-section-button.editing {
1233
+ opacity: 1;
1234
+ border-color: #3b82f6;
1235
+ background-color: white;
1236
+ cursor: default;
1237
+ min-height: 100px;
1238
+ height: auto;
1239
+ }
1240
+
1241
+ /* Disable button during drag operations */
1242
+ .dashboard-container.dragging-section .new-section-button,
1243
+ .dashboard-container.dragging-report .new-section-button {
1244
+ pointer-events: none;
1245
+ }
1246
+
1247
+ /* Disable pointer events on charts when dragging */
1248
+ .dashboard-container.dragging-section .quill-report-edit .MemoizedChart,
1249
+ .dashboard-container.dragging-report .quill-report-edit .MemoizedChart,
1250
+ .dashboard-container.dragging-section .quill-report-edit [data-testid="chart-container"],
1251
+ .dashboard-container.dragging-report .quill-report-edit [data-testid="chart-container"] {
1252
+ pointer-events: none !important;
1253
+ }
1254
+
1255
+ /* Also disable pointer events on all chart inner elements */
1256
+ .dashboard-container.dragging-section .quill-report-edit svg,
1257
+ .dashboard-container.dragging-report .quill-report-edit svg,
1258
+ .dashboard-container.dragging-section .quill-report-edit canvas,
1259
+ .dashboard-container.dragging-report .quill-report-edit canvas,
1260
+ .dashboard-container.dragging-section .quill-report-edit .recharts-wrapper,
1261
+ .dashboard-container.dragging-report .quill-report-edit .recharts-wrapper,
1262
+ .dashboard-container.dragging-section .quill-report-edit .recharts-surface,
1263
+ .dashboard-container.dragging-report .quill-report-edit .recharts-surface {
1264
+ pointer-events: none !important;
1265
+ }
1266
+
1267
+ .dragging-item * {
1268
+ pointer-events: none !important;
1269
+ }
1270
+
1271
+ /* Add transition for spacing changes */
1272
+ .sortable-section-wrapper {
1273
+ height: auto !important;
1274
+ min-height: fit-content !important;
1275
+ position: relative;
1276
+ margin-bottom: 20px;
1277
+ transition: margin 0.2s ease;
1278
+ }
1279
+
1280
+ /* Section drop indicator */
1281
+ .section-drop-indicator {
1282
+ position: absolute;
1283
+ left: 0;
1284
+ right: 0;
1285
+ height: 4px;
1286
+ background-color: #3b82f6;
1287
+ border-radius: 2px;
1288
+ opacity: 0;
1289
+ transition: opacity 0.15s ease;
1290
+ z-index: 999;
1291
+ }
1292
+
1293
+ .section-drop-indicator.top {
1294
+ top: -12px;
1295
+ }
1296
+
1297
+ .section-drop-indicator.bottom {
1298
+ bottom: -12px;
1299
+ }
1300
+
1301
+ .section-drop-indicator.active {
1302
+ opacity: 1;
1303
+ }
1304
+
1305
+ /* Add pointer events none to drop indicators so they don't interfere with dragging */
1306
+ .section-drop-indicator {
1307
+ pointer-events: none;
1308
+ }
1309
+
1310
+ /* Adjust spacing for the dragged item preview */
1311
+ .section-drag-preview {
1312
+ background: white;
1313
+ border-radius: 8px;
1314
+ box-shadow: 0px 10px 25px rgba(0, 0, 0, 0.15);
1315
+ padding: 16px;
1316
+ min-width: 300px;
1317
+ width: 70%;
1318
+ border: 1px solid #e5e7eb;
1319
+ transform-origin: 0 0;
1320
+ cursor: grabbing;
1321
+ }
1322
+
1323
+ /* Add additional styling to new section button to maintain spacing */
1324
+ .new-section-button {
1325
+ transition: opacity 0.2s ease, border-color 0.2s ease, margin 0.2s ease;
1326
+ margin-top: 20px;
1327
+ }
1328
+
1329
+ .dashboard-container.dragging-section .new-section-button {
1330
+ margin-top: 50px;
1331
+ }
1332
+ ` }), (0, jsx_runtime_1.jsxs)("div", { className: `dashboard-container ${isDraggingSection ? 'dragging-section' : ''} ${activeId && !isDraggingSection ? 'dragging-report' : ''}`, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1333
+ display: 'flex',
1334
+ flexDirection: 'row',
1335
+ gap: 12,
1336
+ marginBottom: 6,
1337
+ marginTop: -12,
1338
+ }, children: [(0, jsx_runtime_1.jsx)(primitives_1.SecondaryButtonPrimitive, { onClick: onManageDashboard, label: "Manage Dashboard" }), (0, jsx_runtime_1.jsx)(primitives_1.SecondaryButtonPrimitive, { onClick: () => {
1339
+ // Same as if the user clicked the Add section button at the bottom
1340
+ setIsEditingNewSection(true);
1341
+ // Scroll to the bottom of the page
1342
+ window.scrollTo({
1343
+ top: document.body.scrollHeight,
1344
+ behavior: 'smooth',
1345
+ });
1346
+ }, label: "Add Section +" })] }), (0, jsx_runtime_1.jsx)("div", { style: {
1347
+ display: 'flex',
1348
+ flexDirection: 'row',
1349
+ alignItems: 'center',
1350
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
1351
+ width: '100%',
1352
+ marginBottom: 25,
1353
+ display: 'flex',
1354
+ flexDirection: 'row',
1355
+ alignItems: 'flex-end',
1356
+ flexWrap: 'wrap',
1357
+ gap: 12,
1358
+ }, children: (populatedDashboardFilters ?? []).map((filter) => ((0, jsx_runtime_1.jsx)(DashboardFilter_1.DashboardFilter, { filter: {
1359
+ ...filter,
1360
+ ...(filter.filterType === 'date_range' && {
1361
+ options: presetOptions,
1362
+ }),
1363
+ ...filterValues[filter.label],
1364
+ }, onChangeFilter: updateFilter, isLoading: isDashboardFilterLoading(filter.label) }, filter.label + name))) }) }), (0, jsx_runtime_1.jsxs)(core_1.DndContext, { sensors: dragSensors, collisionDetection: collisionDetectionStrategy, onDragStart: handleDragStart, onDragOver: handleDragOver, onDragEnd: handleDragEnd, measuring: {
1365
+ droppable: {
1366
+ strategy: core_1.MeasuringStrategy.Always,
1367
+ },
1368
+ }, autoScroll: {
1369
+ threshold: {
1370
+ x: 0.1,
1371
+ y: 0.2,
1372
+ },
1373
+ acceleration: 10,
1374
+ interval: 5,
1375
+ }, children: [(0, jsx_runtime_1.jsx)(sortable_1.SortableContext, { items: sortedSectionNames, strategy: sortable_1.rectSortingStrategy, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: 20 }, children: [sortedSections
1376
+ .filter((s) => s.name ||
1377
+ metrics[s.name]?.length ||
1378
+ charts[s.name]?.length ||
1379
+ tables[s.name]?.length)
1380
+ .map((section) => {
1381
+ return ((0, jsx_runtime_1.jsx)(SortableSection, { id: section.name, sectionId: section.id, sectionName: section.name, sectionIndex: sortedSectionNames.indexOf(section.name), metrics: metrics, charts: charts, tables: tables, data: data, previewSectionOrder: previewSectionOrder, handleReorder: handleReorder, onClickReport: handleClickReport, onSectionNameUpdate: handleSectionNameUpdate, onSectionDelete: handleSectionDelete, isActive: activeId?.startsWith(`${section.name}::`) || false, activeId: activeId, overId: overId, draggedIndex: draggedIndex === -1 ? undefined : draggedIndex, isHighlighted: overId === section.name, isDraggingAnySection: isDraggingSection }, section.id));
1382
+ }), !isLoading && ((0, jsx_runtime_1.jsx)(NewSectionButton, { onAddSection: handleAddSection, existingSections: existingSectionNames, isEditing: isEditingNewSection, setIsEditing: setIsEditingNewSection }))] }) }), (0, jsx_runtime_1.jsx)(core_1.DragOverlay, { modifiers: activeItem?.type === 'section' ? undefined : [snapRightToCursor], children: activeItem &&
1383
+ (activeItem.type === 'section' ? ((0, jsx_runtime_1.jsxs)("div", { className: "section-drag-preview", style: { width: '100%', maxWidth: '100%', minWidth: 'unset' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "section-header", style: { marginBottom: '12px' }, children: [(0, jsx_runtime_1.jsx)("h2", { style: {
1384
+ margin: 0,
1385
+ padding: 0,
1386
+ fontSize: '22px',
1387
+ fontWeight: 'bold',
1388
+ }, children: activeItem.name }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: 8, alignItems: 'center' }, children: [activeItem.id !== '' && ((0, jsx_runtime_1.jsx)("div", { style: {
1389
+ color: '#9CA0A7',
1390
+ marginLeft: -4,
1391
+ transform: 'translateY(2px)',
1392
+ }, children: (0, jsx_runtime_1.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M1 1L13 13M1 13L13 1", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })), activeItem.id !== '' && ((0, jsx_runtime_1.jsx)("div", { className: "section-drag-handle", children: (0, jsx_runtime_1.jsxs)("div", { style: {
1393
+ display: 'flex',
1394
+ gap: 2,
1395
+ flexDirection: 'row',
1396
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1397
+ display: 'flex',
1398
+ gap: 2,
1399
+ flexDirection: 'column',
1400
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1401
+ width: 3,
1402
+ height: 3,
1403
+ borderRadius: 3,
1404
+ background: '#9CA0A7',
1405
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
1406
+ width: 3,
1407
+ height: 3,
1408
+ borderRadius: 3,
1409
+ background: '#9CA0A7',
1410
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
1411
+ width: 3,
1412
+ height: 3,
1413
+ borderRadius: 3,
1414
+ background: '#9CA0A7',
1415
+ } })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
1416
+ display: 'flex',
1417
+ gap: 2,
1418
+ flexDirection: 'column',
1419
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1420
+ width: 3,
1421
+ height: 3,
1422
+ borderRadius: 3,
1423
+ background: '#9CA0A7',
1424
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
1425
+ width: 3,
1426
+ height: 3,
1427
+ borderRadius: 3,
1428
+ background: '#9CA0A7',
1429
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
1430
+ width: 3,
1431
+ height: 3,
1432
+ borderRadius: 3,
1433
+ background: '#9CA0A7',
1434
+ } })] })] }) }))] })] }), (0, jsx_runtime_1.jsx)("div", { style: {
1435
+ backgroundColor: 'rgba(249, 250, 251, 0.5)',
1436
+ minHeight: '300px',
1437
+ borderRadius: '8px',
1438
+ border: '1px dashed #e5e7eb',
1439
+ width: '100%',
1440
+ } })] })) : ((0, jsx_runtime_1.jsx)("div", { style: {
1441
+ display: 'flex',
1442
+ justifyContent: 'space-between',
1443
+ alignItems: 'top',
1444
+ borderRadius: '10px',
1445
+ border: '1px solid #E7E7E7',
1446
+ background: 'white',
1447
+ height: activeItem.chartType === 'metric'
1448
+ ? '150px'
1449
+ : activeItem.chartType === 'table'
1450
+ ? '500px'
1451
+ : '320px',
1452
+ opacity: 0.85,
1453
+ boxShadow: '0px 10px 25px rgba(0,0,0,0.2)',
1454
+ transform: 'rotate(1deg)',
1455
+ zIndex: 9999,
1456
+ pointerEvents: 'none',
1457
+ padding: '15px',
1458
+ transition: 'none',
1459
+ }, "data-chart-type": activeItem.chartType, children: (0, jsx_runtime_1.jsx)("div", { style: {
1460
+ display: 'flex',
1461
+ alignItems: 'center',
1462
+ gap: '8px',
1463
+ width: '100%',
1464
+ marginBottom: 'auto',
1465
+ }, children: (0, jsx_runtime_1.jsx)("h1", { style: {
1466
+ fontSize: 18,
1467
+ fontWeight: '500',
1468
+ margin: 0,
1469
+ textOverflow: 'ellipsis',
1470
+ overflow: 'hidden',
1471
+ whiteSpace: 'nowrap',
1472
+ maxWidth: '100%',
1473
+ }, children: activeItem.name || 'Report' }) }) }))) })] })] })] }));
1474
+ };
1475
+ exports.InternalDashboard = InternalDashboard;
1476
+ const DeleteButton = ({ onClick }) => {
1477
+ return ((0, jsx_runtime_1.jsx)("div", { className: "section-delete-button", onClick: onClick, title: "Delete section", style: {
1478
+ display: 'flex',
1479
+ alignItems: 'center',
1480
+ justifyContent: 'center',
1481
+ width: 12,
1482
+ height: 12,
1483
+ }, children: (0, jsx_runtime_1.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M1 1L13 13M1 13L13 1", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) }));
1484
+ };
1485
+ const SortableSection = ({ id, sectionName, sectionIndex, metrics, charts, tables, data, previewSectionOrder, onClickReport, onSectionNameUpdate, onSectionDelete, activeId, overId, draggedIndex, isHighlighted, isDraggingAnySection, }) => {
1486
+ const { attributes, listeners, setNodeRef: setSortableNodeRef, isDragging, } = (0, sortable_1.useSortable)({ id, animateLayoutChanges: () => false });
1487
+ const [isEditing, setIsEditing] = (0, react_1.useState)(false);
1488
+ const [editedName, setEditedName] = (0, react_1.useState)(sectionName);
1489
+ const [inputWidth, setInputWidth] = (0, react_1.useState)('auto');
1490
+ const inputRef = (0, react_1.useRef)(null);
1491
+ const measurementRef = (0, react_1.useRef)(null);
1492
+ const h1Ref = (0, react_1.useRef)(null);
1493
+ const { setNodeRef: setDroppableNodeRef, isOver } = (0, core_1.useDroppable)({
1494
+ id: `section-${sectionName}`,
1495
+ data: {
1496
+ section: sectionName,
1497
+ type: 'section',
1498
+ },
1499
+ disabled: sectionName === '', // Disable dropping on unassigned section
1500
+ });
1501
+ const setNodeRef = (0, react_1.useCallback)((node) => {
1502
+ setSortableNodeRef(node);
1503
+ setDroppableNodeRef(node);
1504
+ }, [setSortableNodeRef, setDroppableNodeRef]);
1505
+ const calculateTextWidth = (text) => {
1506
+ if (!measurementRef.current)
1507
+ return 0;
1508
+ measurementRef.current.textContent = text;
1509
+ const width = measurementRef.current.getBoundingClientRect().width;
1510
+ return width;
1511
+ };
1512
+ (0, react_1.useEffect)(() => {
1513
+ if (isEditing && inputRef.current) {
1514
+ inputRef.current.focus();
1515
+ inputRef.current.selectionStart = inputRef.current.value.length;
1516
+ const width = calculateTextWidth(editedName);
1517
+ setInputWidth(`${width}px`);
1518
+ }
1519
+ }, [isEditing]);
1520
+ const handleTextChange = (e) => {
1521
+ const newText = e.target.value;
1522
+ setEditedName(newText);
1523
+ const width = calculateTextWidth(newText);
1524
+ setInputWidth(`${width}px`);
1525
+ };
1526
+ const handleStartEditing = () => {
1527
+ // Don't allow editing for empty section name (default section)
1528
+ if (sectionName === '')
1529
+ return;
1530
+ if (h1Ref.current) {
1531
+ setIsEditing(true);
1532
+ }
1533
+ else {
1534
+ setIsEditing(true);
1535
+ }
1536
+ };
1537
+ const handleSave = () => {
1538
+ if (isEditing && editedName.trim() !== '' && editedName !== sectionName) {
1539
+ // Make sure name doesn't already exist
1540
+ const sectionNames = Object.keys(data?.sections ?? {});
1541
+ if (sectionNames.includes(editedName)) {
1542
+ alert('Section name already exists');
1543
+ setEditedName(sectionName);
1544
+ }
1545
+ else {
1546
+ onSectionNameUpdate(sectionName, editedName);
1547
+ }
1548
+ }
1549
+ setIsEditing(false);
1550
+ };
1551
+ const handleKeyDown = (e) => {
1552
+ if (e.key === 'Enter') {
1553
+ handleSave();
1554
+ }
1555
+ else if (e.key === 'Escape') {
1556
+ setEditedName(sectionName);
1557
+ setIsEditing(false);
1558
+ }
1559
+ };
1560
+ // Handle clicking outside to save
1561
+ (0, react_1.useEffect)(() => {
1562
+ const handleClickOutside = (event) => {
1563
+ if (isEditing &&
1564
+ inputRef.current &&
1565
+ !inputRef.current.contains(event.target)) {
1566
+ handleSave();
1567
+ }
1568
+ };
1569
+ if (isEditing) {
1570
+ document.addEventListener('mousedown', handleClickOutside);
1571
+ }
1572
+ return () => {
1573
+ document.removeEventListener('mousedown', handleClickOutside);
1574
+ };
1575
+ }, [isEditing, handleSave]);
1576
+ const handleDeleteSection = () => {
1577
+ if (sectionName === '')
1578
+ return;
1579
+ if (window.confirm(`Are you sure you want to delete "${sectionName}"? All reports will be moved to the unassigned section.`)) {
1580
+ onSectionDelete(sectionName);
1581
+ }
1582
+ };
1583
+ const isDraggedOver = (overId?.split('::')[1] === sectionName ||
1584
+ overId === sectionName ||
1585
+ (overId?.startsWith('::') && sectionName == '')) &&
1586
+ activeId?.split('::')[0] !== sectionName;
1587
+ const isDraggingThisSection = activeId === sectionName;
1588
+ const shouldHighlight = (isDraggedOver || isOver) &&
1589
+ !isDraggingThisSection &&
1590
+ !activeId?.startsWith(sectionName + '::');
1591
+ const style = {
1592
+ zIndex: isDragging ? 100 : undefined,
1593
+ position: 'relative',
1594
+ boxShadow: shouldHighlight
1595
+ ? '0 0 0 2px #3b82f6, 0 0 20px rgba(59, 130, 246, 0.2)'
1596
+ : undefined,
1597
+ backgroundColor: shouldHighlight ? 'rgba(59, 130, 246, 0.05)' : undefined,
1598
+ borderRadius: shouldHighlight ? '8px' : undefined,
1599
+ padding: shouldHighlight ? '12px' : '0px',
1600
+ margin: shouldHighlight ? '-12px' : '0px',
1601
+ };
1602
+ const sectionClassName = `section-container ${shouldHighlight ? 'section-highlighted' : ''}`;
1603
+ const dataAttributes = {
1604
+ 'data-is-over': shouldHighlight ? 'true' : 'false',
1605
+ 'data-section': sectionName,
1606
+ 'data-unassigned': sectionName === '' ? 'true' : 'false',
1607
+ };
1608
+ const hasMultipleSections = (0, react_1.useMemo)(() => {
1609
+ return Object.keys(data?.sections || {}).length > 1;
1610
+ }, [data?.sections]);
1611
+ const isDefaultSection = sectionName === '';
1612
+ const reports = (0, react_1.useMemo)(() => {
1613
+ return previewSectionOrder[sectionName]
1614
+ ? // sort the reports based on the preview order
1615
+ data?.sections?.[sectionName]?.sort((a, b) => {
1616
+ const aIndex = previewSectionOrder[sectionName]?.indexOf(a.id) ?? 0;
1617
+ const bIndex = previewSectionOrder[sectionName]?.indexOf(b.id) ?? 0;
1618
+ return aIndex - bIndex;
1619
+ })
1620
+ : data?.sections?.[sectionName] || [];
1621
+ }, [data?.sections[sectionName], previewSectionOrder[sectionName]]);
1622
+ const isEmpty = reports.length === 0;
1623
+ const containerClass = `section-grid-container ${isEmpty ? 'empty' : ''} ${isHighlighted ? 'active-drop-target' : ''}`;
1624
+ const showTopDropIndicator = isDraggingAnySection &&
1625
+ draggedIndex !== undefined &&
1626
+ draggedIndex > sectionIndex &&
1627
+ isHighlighted;
1628
+ const showBottomDropIndicator = isDraggingAnySection &&
1629
+ draggedIndex !== undefined &&
1630
+ draggedIndex < sectionIndex &&
1631
+ isHighlighted;
1632
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "sortable-section-wrapper", style: {
1633
+ position: 'relative',
1634
+ marginBottom: 20,
1635
+ marginTop: 0,
1636
+ transition: 'margin 0.2s ease',
1637
+ }, children: [(0, jsx_runtime_1.jsx)("div", { className: `section-drop-indicator top ${showTopDropIndicator ? 'active' : ''}`, style: {
1638
+ position: 'absolute',
1639
+ top: -30,
1640
+ left: 0,
1641
+ right: 0,
1642
+ height: 4,
1643
+ backgroundColor: '#3b82f6',
1644
+ borderRadius: 2,
1645
+ opacity: showTopDropIndicator ? 1 : 0,
1646
+ transition: 'opacity 0.15s ease',
1647
+ zIndex: 999,
1648
+ } }), (0, jsx_runtime_1.jsxs)("div", { ref: setNodeRef, style: style, className: sectionClassName, ...dataAttributes, children: [(0, jsx_runtime_1.jsx)("span", { ref: measurementRef, style: {
1649
+ position: 'absolute',
1650
+ visibility: 'hidden',
1651
+ whiteSpace: 'pre',
1652
+ fontSize: '22px',
1653
+ fontWeight: 'bold',
1654
+ fontFamily: 'inherit',
1655
+ } }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: 20 }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "section-header", style: { marginTop: sectionIndex > 0 ? 20 : 0 }, children: [sectionName ? (isEditing ? ((0, jsx_runtime_1.jsx)("input", { ref: inputRef, className: "section-name-input", value: editedName, onChange: handleTextChange, onKeyDown: handleKeyDown, onBlur: handleSave, style: {
1656
+ fontSize: 22,
1657
+ fontWeight: 'bold',
1658
+ width: inputWidth,
1659
+ minWidth: '20px',
1660
+ textAlign: 'left',
1661
+ display: 'block',
1662
+ lineHeight: 'normal',
1663
+ margin: 0,
1664
+ padding: 0,
1665
+ } })) : ((0, jsx_runtime_1.jsx)("h1", { className: isDefaultSection ? '' : 'section-name-display', onClick: isDefaultSection ? undefined : handleStartEditing, ref: h1Ref, style: {
1666
+ fontSize: 22,
1667
+ fontWeight: 'bold',
1668
+ textAlign: 'left',
1669
+ margin: 0,
1670
+ padding: 0,
1671
+ lineHeight: 'normal',
1672
+ display: 'block',
1673
+ cursor: isDefaultSection ? 'default' : 'pointer',
1674
+ }, children: isDefaultSection && hasMultipleSections
1675
+ ? 'Unassigned Items'
1676
+ : sectionName }))) : (
1677
+ // For the default empty section, show a non-editable header
1678
+ // (isDefaultSection && hasMultipleSections) && <h1
1679
+ // style={{
1680
+ // fontSize: 22,
1681
+ // fontWeight: 'bold',
1682
+ // textAlign: 'left',
1683
+ // margin: 0,
1684
+ // padding: 0,
1685
+ // lineHeight: 'normal',
1686
+ // display: 'block'
1687
+ // }}
1688
+ // >
1689
+ // Unassigned Items
1690
+ // </h1>
1691
+ (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: 4, alignItems: 'center' }, children: [!isDefaultSection && ((0, jsx_runtime_1.jsx)(DeleteButton, { onClick: handleDeleteSection })), !isDefaultSection && ((0, jsx_runtime_1.jsx)("div", { className: `section-drag-handle`, children: (0, jsx_runtime_1.jsx)(HandleButton, { ...listeners, ...attributes }) }))] })] }), (0, jsx_runtime_1.jsx)("div", { className: containerClass, style: {
1692
+ boxSizing: 'border-box',
1693
+ width: '100%',
1694
+ minHeight: isEmpty ? '120px' : 'auto',
1695
+ padding: isEmpty ? '10px' : '0px',
1696
+ display: isEmpty && sectionName === '' ? 'none' : 'block',
1697
+ }, children: isDefaultSection && !isEmpty ? ((0, jsx_runtime_1.jsxs)("div", { style: {
1698
+ display: 'flex',
1699
+ flexDirection: 'column',
1700
+ gap: 20,
1701
+ width: '100%',
1702
+ }, children: [(metrics?.[sectionName]?.length ?? 0) > 0 && ((0, jsx_runtime_1.jsx)("div", { style: {
1703
+ display: 'grid',
1704
+ gap: 20,
1705
+ gridTemplateColumns: `repeat(auto-fill, minmax(400px, 1fr))`,
1706
+ width: '100%',
1707
+ }, "data-type": "metric", className: "unassigned-category-grid", children: (0, jsx_runtime_1.jsx)(sortable_1.SortableContext, { items: metrics?.[sectionName]?.map((item) => `${sectionName}::${item._id || item.id}`) || [], strategy: sortable_1.rectSortingStrategy, children: metrics?.[sectionName]?.map((item) => ((0, jsx_runtime_1.jsx)(SortableItem, { id: item.id, section: sectionName, chartType: item.chartType || 'metric', value: item.name || item._id || item.id, onClickReport: onClickReport }, item.id))) }) })), (charts?.[sectionName]?.length ?? 0) > 0 && ((0, jsx_runtime_1.jsx)("div", { style: {
1708
+ display: 'grid',
1709
+ gap: 20,
1710
+ gridTemplateColumns: `repeat(auto-fill, minmax(400px, 1fr))`,
1711
+ width: '100%',
1712
+ }, "data-type": "chart", className: "unassigned-category-grid", children: (0, jsx_runtime_1.jsx)(sortable_1.SortableContext, { items: charts?.[sectionName]?.map((item) => `${sectionName}::${item._id || item.id}`) || [], strategy: sortable_1.rectSortingStrategy, children: charts?.[sectionName]?.map((item) => ((0, jsx_runtime_1.jsx)(SortableItem, { id: item.id, section: sectionName, chartType: item.chartType || 'chart', value: item.name || item._id || item.id, onClickReport: onClickReport }, item.id))) }) })), (tables?.[sectionName]?.length ?? 0) > 0 && ((0, jsx_runtime_1.jsx)("div", { style: {
1713
+ display: 'grid',
1714
+ gap: 20,
1715
+ gridTemplateColumns: `repeat(auto-fill, minmax(400px, 1fr))`,
1716
+ width: '100%',
1717
+ }, "data-type": "table", className: "unassigned-category-grid", children: (0, jsx_runtime_1.jsx)(sortable_1.SortableContext, { items: tables?.[sectionName]?.map((item) => `${sectionName}::${item._id || item.id}`) || [], strategy: sortable_1.rectSortingStrategy, children: tables?.[sectionName]?.map((item) => ((0, jsx_runtime_1.jsx)(SortableItem, { id: item.id, section: sectionName, chartType: "table", value: item.name || item._id || item.id, onClickReport: onClickReport }, item.id))) }) }))] })) : ((0, jsx_runtime_1.jsx)("div", { style: {
1718
+ display: 'grid',
1719
+ gap: 20,
1720
+ gridTemplateColumns: `repeat(auto-fill, minmax(400px, 1fr))`,
1721
+ width: '100%',
1722
+ minHeight: isEmpty ? '80px' : 'auto',
1723
+ }, children: (0, jsx_runtime_1.jsx)(sortable_1.SortableContext, { items: reports.map((item) => `${sectionName}::${item._id || item.id}`) || [], strategy: () => null, children: reports.map((item) => ((0, jsx_runtime_1.jsx)(SortableItem, { id: item.id, section: sectionName, chartType: item?.chartType ?? 'chart', value: item?.name ?? item.id, onClickReport: onClickReport }, item.id))) }) })) })] })] }), (0, jsx_runtime_1.jsx)("div", { className: `section-drop-indicator bottom ${showBottomDropIndicator ? 'active' : ''}`, style: {
1724
+ position: 'absolute',
1725
+ bottom: -30,
1726
+ left: 0,
1727
+ right: 0,
1728
+ height: 4,
1729
+ backgroundColor: '#3b82f6',
1730
+ borderRadius: 2,
1731
+ opacity: showBottomDropIndicator ? 1 : 0,
1732
+ transition: 'opacity 0.15s ease',
1733
+ zIndex: 999,
1734
+ } })] }));
1735
+ };
1736
+ const SortableItem = ({ id, section, chartType, value, onClickReport, }) => {
1737
+ const compoundId = `${section}::${id}`;
1738
+ const { attributes, listeners, setNodeRef, transform, isDragging } = (0, sortable_1.useSortable)({
1739
+ id: compoundId,
1740
+ data: {
1741
+ chartType,
1742
+ section,
1743
+ id,
1744
+ },
1745
+ animateLayoutChanges: () => false,
1746
+ });
1747
+ const className = `quill-report-edit ${isDragging ? 'dragging-item' : ''}`;
1748
+ const style = {
1749
+ transform: utilities_2.CSS.Translate.toString(transform),
1750
+ display: 'flex',
1751
+ width: '100%',
1752
+ justifyContent: 'space-between',
1753
+ alignItems: 'center',
1754
+ borderRadius: '10px',
1755
+ border: '1px solid #E7E7E7',
1756
+ cursor: isDragging ? 'grabbing' : 'grab',
1757
+ userSelect: 'none',
1758
+ background: 'white',
1759
+ gridColumn: chartType === 'table' ? '1 / -1' : 'auto',
1760
+ height: 'fit-content',
1761
+ zIndex: isDragging ? 999 : undefined,
1762
+ boxShadow: isDragging
1763
+ ? '0px 10px 20px rgba(0,0,0,0.2)'
1764
+ : '0px 2px 8px rgba(56, 65, 81, 0.08)',
1765
+ opacity: isDragging ? 0.8 : 1,
1766
+ position: 'relative',
1767
+ };
1768
+ const handleReportClick = (0, react_1.useCallback)(() => {
1769
+ onClickReport?.({ id });
1770
+ }, [id, onClickReport]);
1771
+ return ((0, jsx_runtime_1.jsx)("div", { ref: setNodeRef, style: {
1772
+ padding: '10px',
1773
+ margin: '-10px',
1774
+ gridColumn: chartType === 'table' ? '1 / -1' : 'auto',
1775
+ }, ...attributes, children: (0, jsx_runtime_1.jsx)("div", { className: className, style: style, children: (0, jsx_runtime_1.jsxs)("div", { style: {
1776
+ display: 'flex',
1777
+ flexDirection: 'column',
1778
+ width: '100%',
1779
+ padding: 20,
1780
+ cursor: 'pointer',
1781
+ }, onClick: handleReportClick, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1782
+ display: 'flex',
1783
+ flexDirection: 'row',
1784
+ width: '100%',
1785
+ }, children: [(0, jsx_runtime_1.jsx)("h1", { style: {
1786
+ fontSize: 18,
1787
+ fontWeight: '500',
1788
+ flexGrow: 1,
1789
+ }, children: value }), (0, jsx_runtime_1.jsx)("div", { className: "quill-report-edit-buttons", style: {
1790
+ display: 'flex',
1791
+ flexDirection: 'column',
1792
+ }, children: (0, jsx_runtime_1.jsx)(HandleButton, { ...listeners }) })] }), isDragging ? ((0, jsx_runtime_1.jsx)("div", { style: {
1793
+ padding: 10,
1794
+ height: chartType === 'metric'
1795
+ ? 80
1796
+ : chartType === 'table'
1797
+ ? 420
1798
+ : 250,
1799
+ background: '#f9fafb',
1800
+ borderRadius: '6px',
1801
+ display: 'flex',
1802
+ alignItems: 'center',
1803
+ justifyContent: 'center',
1804
+ } })) : ((0, jsx_runtime_1.jsx)(MemoizedChart, { reportId: id, chartType: chartType }))] }) }) }));
1805
+ };
1806
+ function HandleButton(props) {
1807
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
1808
+ display: 'flex',
1809
+ gap: 2,
1810
+ flexDirection: 'row',
1811
+ paddingTop: 8,
1812
+ paddingBottom: 8,
1813
+ paddingLeft: 8,
1814
+ paddingRight: 8,
1815
+ borderRadius: 4,
1816
+ cursor: 'grab',
1817
+ }, className: "handle", ...props, children: [(0, jsx_runtime_1.jsx)("style", { children: `.handle:hover{background:rgba(0,0,0,0.03);}` }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: 2, flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1818
+ width: 3,
1819
+ height: 3,
1820
+ borderRadius: 3,
1821
+ background: '#9CA0A7',
1822
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
1823
+ width: 3,
1824
+ height: 3,
1825
+ borderRadius: 3,
1826
+ background: '#9CA0A7',
1827
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
1828
+ width: 3,
1829
+ height: 3,
1830
+ borderRadius: 3,
1831
+ background: '#9CA0A7',
1832
+ } })] }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: 2, flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1833
+ width: 3,
1834
+ height: 3,
1835
+ borderRadius: 3,
1836
+ background: '#9CA0A7',
1837
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
1838
+ width: 3,
1839
+ height: 3,
1840
+ borderRadius: 3,
1841
+ background: '#9CA0A7',
1842
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
1843
+ width: 3,
1844
+ height: 3,
1845
+ borderRadius: 3,
1846
+ background: '#9CA0A7',
1847
+ } })] })] }));
1848
+ }
1849
+ const NewSectionButton = ({ onAddSection, existingSections, isEditing, setIsEditing, }) => {
1850
+ const [sectionName, setSectionName] = (0, react_1.useState)('');
1851
+ const [error, setError] = (0, react_1.useState)('');
1852
+ const inputRef = (0, react_1.useRef)(null);
1853
+ (0, react_1.useEffect)(() => {
1854
+ if (isEditing && inputRef.current) {
1855
+ inputRef.current.focus();
1856
+ }
1857
+ }, [isEditing]);
1858
+ const handleClick = () => {
1859
+ setIsEditing(true);
1860
+ };
1861
+ const handleSave = () => {
1862
+ if (sectionName.trim() !== '') {
1863
+ if (existingSections.includes(sectionName.trim())) {
1864
+ setError('Section name already exists');
1865
+ inputRef.current?.focus();
1866
+ return;
1867
+ }
1868
+ onAddSection(sectionName.trim());
1869
+ setSectionName('');
1870
+ setError('');
1871
+ setIsEditing(false);
1872
+ }
1873
+ else {
1874
+ setIsEditing(false);
1875
+ }
1876
+ };
1877
+ const handleKeyDown = (e) => {
1878
+ if (e.key === 'Enter') {
1879
+ if (sectionName.trim() === '') {
1880
+ setError('Section name cannot be empty');
1881
+ return;
1882
+ }
1883
+ if (existingSections.includes(sectionName.trim())) {
1884
+ setError('Section name already exists');
1885
+ return;
1886
+ }
1887
+ onAddSection(sectionName.trim());
1888
+ setSectionName('');
1889
+ setError('');
1890
+ setIsEditing(false);
1891
+ }
1892
+ else if (e.key === 'Escape') {
1893
+ setSectionName('');
1894
+ setError('');
1895
+ setIsEditing(false);
1896
+ }
1897
+ };
1898
+ if (!isEditing) {
1899
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "new-section-button", onClick: handleClick, style: {
1900
+ border: '2px dashed #e5e7eb',
1901
+ borderRadius: '8px',
1902
+ marginTop: '20px',
1903
+ padding: '16px',
1904
+ display: 'flex',
1905
+ flexDirection: 'column',
1906
+ alignItems: 'center',
1907
+ justifyContent: 'center',
1908
+ cursor: 'pointer',
1909
+ height: '100px',
1910
+ transition: 'border-color 0.2s ease, background-color 0.2s ease',
1911
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: '24px', fontWeight: 'bold', color: '#9CA0A7' }, children: "+" }), (0, jsx_runtime_1.jsx)("div", { style: {
1912
+ marginTop: '8px',
1913
+ fontSize: '16px',
1914
+ fontWeight: 300,
1915
+ color: '#9CA0A7',
1916
+ }, children: "New section" })] }));
1917
+ }
1918
+ return ((0, jsx_runtime_1.jsx)("div", { className: "section-container", style: { marginTop: 20 }, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: 20 }, children: [(0, jsx_runtime_1.jsx)("div", { className: "section-header", children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, className: "section-name-input", value: sectionName, onChange: (e) => {
1919
+ setSectionName(e.target.value);
1920
+ if (e.target.value.trim() !== '' && error) {
1921
+ setError('');
1922
+ }
1923
+ }, onBlur: handleSave, onKeyDown: handleKeyDown, placeholder: "New section name...", style: {
1924
+ fontSize: 22,
1925
+ fontWeight: 'bold',
1926
+ border: 'none',
1927
+ background: 'transparent',
1928
+ outline: 'none',
1929
+ width: '100%',
1930
+ minWidth: '200px',
1931
+ textAlign: 'left',
1932
+ padding: 0,
1933
+ margin: 0,
1934
+ lineHeight: 'normal',
1935
+ } }), error && ((0, jsx_runtime_1.jsx)("div", { style: { color: '#EF4444', fontSize: '14px', marginTop: '4px' }, children: error }))] }) }), (0, jsx_runtime_1.jsx)("div", { className: "section-grid-container empty", style: {
1936
+ boxSizing: 'border-box',
1937
+ width: '100%',
1938
+ minHeight: '120px',
1939
+ border: '1px dashed #e5e7eb',
1940
+ borderRadius: '8px',
1941
+ backgroundColor: 'rgba(249, 250, 251, 0.5)',
1942
+ position: 'relative',
1943
+ display: 'flex',
1944
+ alignItems: 'center',
1945
+ justifyContent: 'center',
1946
+ } })] }) }));
1947
+ };