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