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