react-restyle-components 0.4.47 → 0.4.48

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 (233) hide show
  1. package/lib/index.js +3 -1
  2. package/lib/src/core-components/index.js +1 -1
  3. package/lib/src/core-components/src/components/Accordion/AccordionSection/Accordion.js +15 -1
  4. package/lib/src/core-components/src/components/Accordion/AccordionSection/AccordionContext.js +6 -1
  5. package/lib/src/core-components/src/components/Accordion/AccordionSection/AccordionSection.js +39 -1
  6. package/lib/src/core-components/src/components/Accordion/AccordionSection/Header.js +39 -1
  7. package/lib/src/core-components/src/components/Accordion/AccordionSection/elements.js +94 -57
  8. package/lib/src/core-components/src/components/Accordion/AccordionSection/hooks/useCurrentAccordionIndex.js +13 -1
  9. package/lib/src/core-components/src/components/Accordion/AccordionSection/index.js +3 -1
  10. package/lib/src/core-components/src/components/Accordion/AccordionSection/types.js +9 -1
  11. package/lib/src/core-components/src/components/Accordion/Collapsible/Collapsible2.component.js +249 -1
  12. package/lib/src/core-components/src/components/Action/types.js +8 -1
  13. package/lib/src/core-components/src/components/AlertBanner/AlertBanner.js +45 -1
  14. package/lib/src/core-components/src/components/AlertBanner/elements.js +120 -45
  15. package/lib/src/core-components/src/components/AlertBanner/index.js +2 -1
  16. package/lib/src/core-components/src/components/AlertBanner/types.js +10 -1
  17. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-group-by-multiple-select-multiple-fields-display/auto-complete-filter-group-by-multiple-select-multiple-fields-display.component.d.ts +3 -1
  18. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-group-by-multiple-select-multiple-fields-display/auto-complete-filter-group-by-multiple-select-multiple-fields-display.component.js +466 -1
  19. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multi-select-multi-fields-display-drag-drop/auto-complete-filter-multi-select-multi-fields-display-drag-drop.component.js +229 -1
  20. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multi-select-selected-top-display/auto-complete-filter-multi-select-selected-top-display.component.js +174 -1
  21. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +129 -2
  22. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-single-select/auto-complete-filter-single-select.component.js +55 -1
  23. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +308 -2
  24. package/lib/src/core-components/src/components/AutoComplete/auto-complete-group-by/auto-complete-group-by.component.js +115 -1
  25. package/lib/src/core-components/src/components/AutoComplete/autocomplete/autocomplete.js +442 -2
  26. package/lib/src/core-components/src/components/AutoComplete/index.js +8 -1
  27. package/lib/src/core-components/src/components/Avatar/Avatar.js +148 -14
  28. package/lib/src/core-components/src/components/Badge/Badge.js +25 -2
  29. package/lib/src/core-components/src/components/Badge/InnerBadge/Inline.js +25 -1
  30. package/lib/src/core-components/src/components/Badge/InnerBadge/InnerBadge.js +25 -1
  31. package/lib/src/core-components/src/components/Badge/InnerBadge/elements.js +78 -32
  32. package/lib/src/core-components/src/components/Badge/InnerBadge/index.js +1 -1
  33. package/lib/src/core-components/src/components/Badge/index.js +1 -1
  34. package/lib/src/core-components/src/components/Badge/types.js +5 -1
  35. package/lib/src/core-components/src/components/Breadcrumb/Breadcrumb.js +83 -1
  36. package/lib/src/core-components/src/components/Breadcrumb/elements.js +166 -94
  37. package/lib/src/core-components/src/components/Breadcrumb/index.js +3 -1
  38. package/lib/src/core-components/src/components/Breadcrumb/types.js +3 -1
  39. package/lib/src/core-components/src/components/Button/button.component.js +18 -1
  40. package/lib/src/core-components/src/components/Button/buttonGroup/buttonGroup.component.js +4 -1
  41. package/lib/src/core-components/src/components/Button/index.js +2 -1
  42. package/lib/src/core-components/src/components/Button/types.js +1 -1
  43. package/lib/src/core-components/src/components/Chip/Chip.js +64 -1
  44. package/lib/src/core-components/src/components/Chip/elements.js +148 -48
  45. package/lib/src/core-components/src/components/Chip/index.js +2 -1
  46. package/lib/src/core-components/src/components/Chip/types.js +4 -1
  47. package/lib/src/core-components/src/components/Divider/Divider.js +25 -1
  48. package/lib/src/core-components/src/components/Divider/elements.js +68 -31
  49. package/lib/src/core-components/src/components/Divider/index.js +2 -1
  50. package/lib/src/core-components/src/components/Divider/types.js +4 -1
  51. package/lib/src/core-components/src/components/DynamicGrid/DynamicGrid.js +147 -1
  52. package/lib/src/core-components/src/components/DynamicGrid/GridContainer.js +24 -17
  53. package/lib/src/core-components/src/components/DynamicGrid/elements.js +162 -100
  54. package/lib/src/core-components/src/components/DynamicGrid/index.js +3 -1
  55. package/lib/src/core-components/src/components/DynamicGrid/types.js +28 -1
  56. package/lib/src/core-components/src/components/DynamicGrid/utils.js +193 -1
  57. package/lib/src/core-components/src/components/FormField/FormField.js +103 -1
  58. package/lib/src/core-components/src/components/FormField/components/CheckboxGroupInput.js +37 -1
  59. package/lib/src/core-components/src/components/FormField/components/CheckboxInput.js +8 -1
  60. package/lib/src/core-components/src/components/FormField/components/CssMultilineInput.js +192 -1
  61. package/lib/src/core-components/src/components/FormField/components/DatePickerInput.js +99 -1
  62. package/lib/src/core-components/src/components/FormField/components/DropdownInput.js +70 -1
  63. package/lib/src/core-components/src/components/FormField/components/OtpInput.js +81 -1
  64. package/lib/src/core-components/src/components/FormField/components/PasswordInput.js +40 -1
  65. package/lib/src/core-components/src/components/FormField/components/PinInput.js +75 -1
  66. package/lib/src/core-components/src/components/FormField/components/RadioInput.js +54 -1
  67. package/lib/src/core-components/src/components/FormField/components/TextDropdownInput.js +94 -1
  68. package/lib/src/core-components/src/components/FormField/components/ToggleInput.js +36 -1
  69. package/lib/src/core-components/src/components/FormField/components/index.js +11 -1
  70. package/lib/src/core-components/src/components/FormField/css-properties.js +161 -1
  71. package/lib/src/core-components/src/components/FormField/index.js +2 -1
  72. package/lib/src/core-components/src/components/Icon/Icon.js +159 -1
  73. package/lib/src/core-components/src/components/Icon/index.js +2 -1
  74. package/lib/src/core-components/src/components/Icon/types.js +9 -1
  75. package/lib/src/core-components/src/components/Loader/loader.component.js +215 -2
  76. package/lib/src/core-components/src/components/Masonry/Masonry.js +73 -1
  77. package/lib/src/core-components/src/components/Masonry/elements.js +46 -29
  78. package/lib/src/core-components/src/components/Masonry/hooks.js +100 -1
  79. package/lib/src/core-components/src/components/Masonry/index.js +3 -1
  80. package/lib/src/core-components/src/components/Masonry/types.js +1 -1
  81. package/lib/src/core-components/src/components/Modal/BasicModal/modal.component.js +116 -1
  82. package/lib/src/core-components/src/components/Modal/index.js +2 -1
  83. package/lib/src/core-components/src/components/Modal/modal-confirm/modal-confirm.component.js +147 -1
  84. package/lib/src/core-components/src/components/Picker/color-picker/color-picker.component.js +12 -1
  85. package/lib/src/core-components/src/components/Picker/color-picker-modal/color-picker-modal.component.js +40 -1
  86. package/lib/src/core-components/src/components/Picker/index.js +2 -1
  87. package/lib/src/core-components/src/components/Selection/index.js +4 -1
  88. package/lib/src/core-components/src/components/Selection/multi-select/multi-select.component.js +49 -1
  89. package/lib/src/core-components/src/components/Selection/multi-select-with-field/multi-select-with-field.component.js +58 -1
  90. package/lib/src/core-components/src/components/Selection/multi-selection-dropdown/multi-selection-dropdown.component.js +43 -1
  91. package/lib/src/core-components/src/components/Selection/single-select/single-select.component.js +87 -1
  92. package/lib/src/core-components/src/components/Skeleton/Skeleton.js +51 -1
  93. package/lib/src/core-components/src/components/Skeleton/elements.js +143 -54
  94. package/lib/src/core-components/src/components/Skeleton/index.js +2 -1
  95. package/lib/src/core-components/src/components/Skeleton/types.js +4 -1
  96. package/lib/src/core-components/src/components/SpeedDial/SpeedDial.js +128 -1
  97. package/lib/src/core-components/src/components/SpeedDial/elements.js +132 -62
  98. package/lib/src/core-components/src/components/SpeedDial/index.js +2 -1
  99. package/lib/src/core-components/src/components/SpeedDial/types.js +3 -1
  100. package/lib/src/core-components/src/components/Stepper2/stepper.component.js +139 -1
  101. package/lib/src/core-components/src/components/Switch/Switch.js +26 -1
  102. package/lib/src/core-components/src/components/Switch/elements.js +103 -34
  103. package/lib/src/core-components/src/components/Switch/index.js +2 -1
  104. package/lib/src/core-components/src/components/Switch/types.js +3 -1
  105. package/lib/src/core-components/src/components/Table/Table.js +1489 -1
  106. package/lib/src/core-components/src/components/Table/columnReorder.js +332 -36
  107. package/lib/src/core-components/src/components/Table/columnResize.js +284 -21
  108. package/lib/src/core-components/src/components/Table/elements.js +277 -173
  109. package/lib/src/core-components/src/components/Table/filters.js +555 -30
  110. package/lib/src/core-components/src/components/Table/hooks.js +536 -2
  111. package/lib/src/core-components/src/components/Table/index.js +6 -1
  112. package/lib/src/core-components/src/components/Table/types.js +1 -1
  113. package/lib/src/core-components/src/components/Tabs/tabs.component.js +22 -1
  114. package/lib/src/core-components/src/components/Tags1/Tags.component.js +118 -1
  115. package/lib/src/core-components/src/components/Tags1/types.js +20 -1
  116. package/lib/src/core-components/src/components/Timer1/timer.component.js +76 -1
  117. package/lib/src/core-components/src/components/Toast/Toast.js +50 -1
  118. package/lib/src/core-components/src/components/Toast/elements.js +122 -41
  119. package/lib/src/core-components/src/components/Toast/index.js +2 -1
  120. package/lib/src/core-components/src/components/Toast/types.js +9 -1
  121. package/lib/src/core-components/src/components/Tooltip/Tooltip.js +200 -1
  122. package/lib/src/core-components/src/components/Tooltip/elements.js +117 -55
  123. package/lib/src/core-components/src/components/Tooltip/index.js +2 -1
  124. package/lib/src/core-components/src/components/Tooltip/types.js +17 -1
  125. package/lib/src/core-components/src/components/Tooltip/utils.js +140 -1
  126. package/lib/src/core-components/src/components/TreeSelect/TreeSelect.js +303 -1
  127. package/lib/src/core-components/src/components/TreeSelect/elements.js +216 -117
  128. package/lib/src/core-components/src/components/TreeSelect/hooks.js +252 -1
  129. package/lib/src/core-components/src/components/TreeSelect/index.js +3 -1
  130. package/lib/src/core-components/src/components/TreeSelect/types.js +1 -1
  131. package/lib/src/core-components/src/components/ag-grid/AgGrid.js +1057 -1
  132. package/lib/src/core-components/src/components/ag-grid/elements.js +790 -396
  133. package/lib/src/core-components/src/components/ag-grid/hooks.js +1220 -4
  134. package/lib/src/core-components/src/components/ag-grid/index.js +15 -1
  135. package/lib/src/core-components/src/components/ag-grid/types.js +6 -1
  136. package/lib/src/core-components/src/components/index.js +31 -1
  137. package/lib/src/core-components/src/components/pdf/pdf-images.components.js +7 -1
  138. package/lib/src/core-components/src/components/pdf/pdf-table.components.js +48 -5
  139. package/lib/src/core-components/src/components/pdf/pdf-typography.components.js +70 -1
  140. package/lib/src/core-components/src/components/pdf/pdf-wrapped-view.components.js +50 -1
  141. package/lib/src/core-components/src/core-components/Avatar.js +33 -4
  142. package/lib/src/core-components/src/core-components/CoreButton/CoreButton.js +10 -1
  143. package/lib/src/core-components/src/core-components/CoreButton/elements.js +176 -67
  144. package/lib/src/core-components/src/core-components/CoreButton/index.js +3 -1
  145. package/lib/src/core-components/src/core-components/CoreButton/types.js +6 -1
  146. package/lib/src/core-components/src/core-components/CoreButton/utils.js +12 -1
  147. package/lib/src/core-components/src/core-components/Divider/Divider.js +19 -4
  148. package/lib/src/core-components/src/core-components/Divider/index.js +1 -1
  149. package/lib/src/core-components/src/core-components/SelectionCardStrip/index.js +1 -1
  150. package/lib/src/core-components/src/core-components/SelectionCardStrip/selectionCardStrip.js +33 -10
  151. package/lib/src/core-components/src/core-components/StateLayer.js +5 -3
  152. package/lib/src/core-components/src/core-components/ToggleCore/elements.js +50 -25
  153. package/lib/src/core-components/src/core-components/ToggleCore/index.js +2 -1
  154. package/lib/src/core-components/src/core-components/ToggleCore/toggleCore.js +14 -1
  155. package/lib/src/core-components/src/core-components/atoms/Input/Input.js +22 -1
  156. package/lib/src/core-components/src/core-components/atoms/Label/Label.js +21 -1
  157. package/lib/src/core-components/src/core-components/atoms/Textarea/Textarea.js +19 -1
  158. package/lib/src/core-components/src/core-components/index.js +3 -1
  159. package/lib/src/core-components/src/helpers/constants.js +11 -1
  160. package/lib/src/core-components/src/hooks/index.js +1 -1
  161. package/lib/src/core-components/src/hooks/outside.hook.js +28 -1
  162. package/lib/src/core-components/src/index.js +12 -1
  163. package/lib/src/core-components/src/tc.global.css +1 -0
  164. package/lib/src/core-components/src/tc.module.css +1 -1
  165. package/lib/src/core-components/src/utils/abstracts/breakpoints/index.js +28 -1
  166. package/lib/src/core-components/src/utils/abstracts/colors/index.js +49 -1
  167. package/lib/src/core-components/src/utils/abstracts/index.js +5 -1
  168. package/lib/src/core-components/src/utils/abstracts/space/index.js +26 -1
  169. package/lib/src/core-components/src/utils/abstracts/theme/ThemeBoundary.js +8 -1
  170. package/lib/src/core-components/src/utils/abstracts/theme/default-themes.js +30 -1
  171. package/lib/src/core-components/src/utils/abstracts/theme/index.js +3 -1
  172. package/lib/src/core-components/src/utils/abstracts/theme/theme.js +30 -1
  173. package/lib/src/core-components/src/utils/abstracts/theme/types.js +1 -1
  174. package/lib/src/core-components/src/utils/abstracts/theme/useTheme.js +17 -1
  175. package/lib/src/core-components/src/utils/abstracts/typography/index.js +25 -1
  176. package/lib/src/core-components/src/utils/context/DefaultsProvider.js +8 -1
  177. package/lib/src/core-components/src/utils/context/InternalProvider.js +24 -1
  178. package/lib/src/core-components/src/utils/context/index.js +2 -1
  179. package/lib/src/core-components/src/utils/designTokens.js +128 -1
  180. package/lib/src/core-components/src/utils/helpers/attachSubComponents.js +23 -1
  181. package/lib/src/core-components/src/utils/helpers/flattenChildren.js +11 -1
  182. package/lib/src/core-components/src/utils/helpers/getChildByType.js +3 -1
  183. package/lib/src/core-components/src/utils/helpers/index.js +5 -1
  184. package/lib/src/core-components/src/utils/helpers/isComponentType.js +16 -1
  185. package/lib/src/core-components/src/utils/helpers/separateChildrenByType.js +12 -1
  186. package/lib/src/core-components/src/utils/hooks/index.js +18 -1
  187. package/lib/src/core-components/src/utils/hooks/useClickOutside.js +18 -1
  188. package/lib/src/core-components/src/utils/hooks/useCombinedRefs.js +17 -1
  189. package/lib/src/core-components/src/utils/hooks/useDebouncedCallback.js +12 -1
  190. package/lib/src/core-components/src/utils/hooks/useDebouncedValue.js +20 -1
  191. package/lib/src/core-components/src/utils/hooks/useDeprecation.js +40 -1
  192. package/lib/src/core-components/src/utils/hooks/useDeviceDetect.js +10 -1
  193. package/lib/src/core-components/src/utils/hooks/useDeviceForm.js +24 -1
  194. package/lib/src/core-components/src/utils/hooks/useDisableBodyScroll.js +16 -1
  195. package/lib/src/core-components/src/utils/hooks/useHoverState.js +36 -1
  196. package/lib/src/core-components/src/utils/hooks/useId.js +7 -1
  197. package/lib/src/core-components/src/utils/hooks/useIsBrowser.js +11 -1
  198. package/lib/src/core-components/src/utils/hooks/useMediaQuery.js +16 -1
  199. package/lib/src/core-components/src/utils/hooks/useOverflow.js +22 -1
  200. package/lib/src/core-components/src/utils/hooks/useSafeLayoutEffect.js +5 -1
  201. package/lib/src/core-components/src/utils/hooks/useScrollingUp.js +18 -1
  202. package/lib/src/core-components/src/utils/hooks/useTrapFocus.js +30 -1
  203. package/lib/src/core-components/src/utils/hooks/useWindowDimensions.js +23 -1
  204. package/lib/src/core-components/src/utils/index.js +9 -1
  205. package/lib/src/core-components/src/utils/stories/Wrappers.js +23 -8
  206. package/lib/src/core-components/src/utils/stories/cleanProps.js +5 -1
  207. package/lib/src/core-components/src/utils/stories/index.js +4 -1
  208. package/lib/src/core-components/src/utils/stories/sleep.js +4 -1
  209. package/lib/src/core-components/src/utils/stories/view-ports.js +50 -1
  210. package/lib/src/core-components/src/utils/styling/calcWidthOfColumns.js +5 -1
  211. package/lib/src/core-components/src/utils/styling/createGridContainer.js +12 -6
  212. package/lib/src/core-components/src/utils/styling/createTransition.js +7 -2
  213. package/lib/src/core-components/src/utils/styling/forwardProps.js +10 -1
  214. package/lib/src/core-components/src/utils/styling/index.js +5 -1
  215. package/lib/src/core-components/src/utils/styling/pxToRem.js +6 -1
  216. package/lib/src/core-components/src/utils/testing/getComputedStyle.js +3 -1
  217. package/lib/src/core-components/src/utils/testing/index.js +1 -1
  218. package/lib/src/core-components/src/utils/utility.util.js +14 -1
  219. package/lib/src/core-components/tailwind.config.js +233 -1
  220. package/lib/src/core-hooks/index.js +3 -1
  221. package/lib/src/core-hooks/src/useClickOutside/useClickOutside.hook.js +46 -1
  222. package/lib/src/core-hooks/src/useDebounce/useDebounce.hook.js +30 -1
  223. package/lib/src/core-hooks/src/usePreventEKey/usePreventEKey.hook.js +8 -1
  224. package/lib/src/core-utils/index.js +7 -1
  225. package/lib/src/core-utils/src/calculation/calculation.util.js +89 -1
  226. package/lib/src/core-utils/src/colors/color.util.js +15 -1
  227. package/lib/src/core-utils/src/convert/numberToWords/numToWords.util.js +145 -1
  228. package/lib/src/core-utils/src/convert/typography/camelCaseToTitleCase.util.js +5 -1
  229. package/lib/src/core-utils/src/form-helper/form-helper.util.js +82 -1
  230. package/lib/src/core-utils/src/index.js +7 -1
  231. package/lib/src/core-utils/src/utility/utility.util.js +12 -1
  232. package/lib/src/core-utils/src/uuid/uuid.util.js +8 -1
  233. package/package.json +1 -1
@@ -1 +1,1057 @@
1
- "use strict";"use client";import{jsx as t,jsxs as i,Fragment as ie}from"react/jsx-runtime";import oe,{forwardRef as Gl,useImperativeHandle as zl,useMemo as z,useCallback as p,useState as V,useEffect as Ie,useRef as ln}from"react";import{GridRoot as Vl,GridWrapper as Hl,GridToolbar as Wl,ToolbarGroup as rn,ToolbarButton as ae,QuickFilter as Nl,TableContainer as jl,StyledTable as Ol,TableHead as ql,HeaderRow as Kl,HeaderCell as Pe,HeaderCellContent as Ql,HeaderText as Xl,SortIndicator as _l,FilterIndicator as Ul,ResizeHandle as Yl,GroupHeaderRow as Zl,GroupHeaderCell as on,FloatingFilterRow as Jl,FloatingFilterCell as Re,TableBody as er,TableRow as an,TableCell as H,CellContent as sn,Checkbox as De,CheckboxCell as dn,ExpandButton as tr,DragHandle as nr,CellEditor as lr,PaginationBar as rr,PaginationInfo as ir,PaginationControls as or,PageButton as Le,PageSizeSelect as ar,StatusBar as sr,StatusItem as cn,LoadingOverlay as hn,Spinner as dr,NoRowsOverlay as un,ContextMenu as cr,ContextMenuItem as rt,ContextMenuDivider as hr,MobileCardContainer as gn,MobileCard as pn,MobileCardHeader as ur,MobileCardRow as gr,MobileCardLabel as pr,MobileCardValue as mr,SelectionBar as Cr,SelectionActions as fr,getTheme as $r,SidePanel as kr,SidePanelTabs as vr,SidePanelTab as Fe,SidePanelContent as Sr,SidePanelSearch as mn,SidePanelSection as it,SidePanelSectionHeader as ot,SidePanelColumnItem as xr,SidePanelDragHandle as Cn,SidePanelGroupLabel as yr,RowGroupsZone as at,RowGroupsLabel as st,RowGroupChip as fn,ValuesPanel as br,ValueItem as wr,ValueItemLabel as Mr,ValueItemRemove as Ir,PivotModeToggle as Pr,PivotModeLabel as Rr,ToggleSwitch as Dr,HeaderMenuButton as Lr,ColumnMenuPopup as Fr,ColumnMenuSection as se,ColumnMenuItem as M,SetFilterContainer as Er,SetFilterHeader as Tr,SetFilterSearch as Ar,SetFilterList as $n,SetFilterItem as de,SetFilterActions as Br,SetFilterButton as kn,FilterPanelColumn as Gr,FilterPanelHeader as zr,FilterPanelContent as Vr,GridLayout as Hr,GridMainArea as Wr}from"./elements";import{useSorting as Nr,useFiltering as jr,usePagination as Or,useRowSelection as qr,useRowExpansion as Kr,useColumnState as Qr,useCellEditing as Xr,useContextMenu as _r,useResponsive as Ur,useClipboard as Yr,getNestedValue as D,createRowNode as x,exportToCsv as dt,useAggregationPanel as Zr,useRowGroupingPanel as Jr,useColumnMenu as ei,useSidePanel as ti,usePivotMode as ni}from"./hooks";const li=()=>i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("circle",{cx:"11",cy:"11",r:"8"}),t("path",{d:"M21 21l-4.35-4.35",strokeLinecap:"round"})]}),vn=()=>t("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:t("path",{d:"M7 14l5-5 5 5H7z"})}),Sn=()=>t("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:t("path",{d:"M7 10l5 5 5-5H7z"})}),Ee=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M22 3H2l8 9.46V19l4 2v-8.54L22 3z",strokeLinecap:"round",strokeLinejoin:"round"})}),ct=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M9 18l6-6-6-6",strokeLinecap:"round",strokeLinejoin:"round"})}),ri=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M15 18l-6-6 6-6",strokeLinecap:"round",strokeLinejoin:"round"})}),ii=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M11 17l-5-5 5-5M18 17l-5-5 5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),oi=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M13 7l5 5-5 5M6 7l5 5-5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),ai=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M7 10l5 5 5-5M12 15V3",strokeLinecap:"round",strokeLinejoin:"round"})}),Te=()=>i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"}),t("rect",{x:"14",y:"3",width:"7",height:"18",rx:"1"})]}),si=()=>i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("path",{d:"M23 4v6h-6M1 20v-6h6",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15",strokeLinecap:"round",strokeLinejoin:"round"})]}),di=()=>i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("circle",{cx:"12",cy:"12",r:"1"}),t("circle",{cx:"12",cy:"5",r:"1"}),t("circle",{cx:"12",cy:"19",r:"1"})]}),ht=()=>i("svg",{viewBox:"0 0 24 24",fill:"currentColor",opacity:"0.5",children:[t("circle",{cx:"9",cy:"5",r:"1.5"}),t("circle",{cx:"9",cy:"12",r:"1.5"}),t("circle",{cx:"9",cy:"19",r:"1.5"}),t("circle",{cx:"15",cy:"5",r:"1.5"}),t("circle",{cx:"15",cy:"12",r:"1.5"}),t("circle",{cx:"15",cy:"19",r:"1.5"})]}),ci=()=>i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[t("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),t("path",{d:"M3 9h18M9 3v18",strokeLinecap:"round"})]}),ce=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M18 6L6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})}),hi=()=>i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("path",{d:"M12 2v10M12 22v-6M4 12h16",strokeLinecap:"round"}),t("circle",{cx:"12",cy:"12",r:"3"})]}),ui=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M4 4v16M8 12h12M15 7l5 5-5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),gi=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M20 4v16M4 12h12M9 7l-5 5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),pi=()=>i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("path",{d:"M3 3l18 18M12 2v10M12 22v-6",strokeLinecap:"round"}),t("circle",{cx:"12",cy:"12",r:"3"})]}),Ae=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M4 6h16M4 12h16M4 18h16",strokeLinecap:"round"})}),xn=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M4 12h16M9 7l-5 5 5 5M15 7l5 5-5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),mi=()=>i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("path",{d:"M3 12a9 9 0 109-9 9.75 9.75 0 00-6.74 2.74L3 8",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M3 3v5h5",strokeLinecap:"round",strokeLinejoin:"round"})]}),yn=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M18 6H6l6 6-6 6h12",strokeLinecap:"round",strokeLinejoin:"round"})}),Ai=()=>i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),t("circle",{cx:"12",cy:"12",r:"3"})]}),Bi=()=>i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("path",{d:"M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"}),t("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}),Gi=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("polyline",{points:"20 6 9 17 4 12",strokeLinecap:"round",strokeLinejoin:"round"})}),Ci=()=>i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),t("path",{d:"M15 3v18",strokeLinecap:"round"})]});function ut(R){return"children"in R}function Be(R){const Q=[];return R.forEach(b=>{ut(b)?Q.push(...Be(b.children)):Q.push(b)}),Q}function fi(R,Q){const{rowData:b,columnDefs:he,defaultColDef:gt,getRowId:k=e=>String(e.data._id??e.data.id??Math.random()),theme:pt="quartz",customTheme:mt,rowHeight:bn=42,headerHeight:wn=42,floatingFiltersHeight:Mn=32,domLayout:In="normal",rowSelection:L,rowMultiSelectWithClick:$i=!1,suppressRowClickSelection:Ct=!1,isRowSelectable:Pn,sortable:ue=!0,suppressMultiSort:Rn=!1,alwaysMultiSort:Ge=!1,filter:ki=!0,floatingFilter:Dn=!1,quickFilterText:ze,pagination:Ve=!1,paginationPageSize:Ln=10,paginationPageSizeSelector:ft=[10,25,50,100],suppressPaginationPanel:Fn=!1,singleClickEdit:ge=!1,stopEditingWhenCellsLoseFocus:En=!0,undoRedoCellEditing:vi=!1,groupDefaultExpanded:Tn=0,masterDetail:X=!1,detailCellRenderer:$t,isRowMaster:An,rowDragManaged:pe=!1,loadingOverlayComponent:kt,noRowsOverlayComponent:vt,statusBar:Bn,enableClipboard:St=!0,suppressCsvExport:Gn=!1,getContextMenuItems:zn,suppressContextMenu:xt=!1,enableBrowserTooltips:Vn=!1,responsive:yt=!0,mobileBreakpoint:Hn=768,mobileCardRenderer:bt,animateRows:Wn=!0,enableRtl:Nn=!1,onGridReady:jn,onCellClicked:wt,onCellDoubleClicked:Mt,onCellValueChanged:It,onRowClicked:Pt,onRowDoubleClicked:Si,onRowSelected:Rt,onSelectionChanged:Dt,onSortChanged:Lt,onFilterChanged:Ft,onPaginationChanged:On,containerStyle:qn,containerClassName:Kn,context:c,gridId:Qn}=R,l=z(()=>$r(pt,mt),[pt,mt]),_=z(()=>Be(he).map(n=>({...gt,...n,colId:n.colId||n.field||`col-${Math.random()}`})),[he,gt]),{columnState:T,processedColumns:me,visibleColumns:g,setColumnVisible:Ce,setColumnWidth:U,setColumnPinned:W,moveColumn:Y,resetColumnState:fe}=Qr(_,Qn),{sortModel:Et,handleSort:$e,getSortForColumn:ke,clearSort:xi,sortData:Tt}=Nr([],!Rn||Ge),{filterModel:At,quickFilterText:He,setQuickFilterText:Z,setColumnFilter:Xn,clearFilters:Bt,isFilterActive:Gt,hasActiveFilters:We,filterData:zt}=jr();Ie(()=>{ze!==void 0&&Z(ze)},[ze,Z]);const[F,Ne]=V({}),y=z(()=>{let e=[...b];return e=zt(e,g),Object.entries(F).forEach(([n,r])=>{const o=new Set;b.forEach(s=>{const a=D(s,n);a!=null&&o.add(String(a))}),r.size>0&&r.size<o.size?e=e.filter(s=>{const a=D(s,n);return a==null?!1:r.has(String(a))}):r.size===0&&(e=[])}),e=Tt(e,g),e},[b,zt,Tt,g,F]),{currentPage:A,pageSize:je,totalPages:J,startRow:ve,endRow:Oe,goToPage:Vt,goToNextPage:qe,goToPreviousPage:Ke,goToFirstPage:Qe,goToLastPage:Xe,changePageSize:_e,paginateData:Ht}=Or(y.length,Ln),m=z(()=>Ve?Ht(y):y,[y,Ve,Ht]),{selectedIds:yi,isSelected:Se,toggleRow:xe,selectAll:ye,deselectAll:ee,isAllSelected:_n,isIndeterminate:Un,selectedRows:C}=qr(m,e=>k({data:e}),L||"multiple",Pn),{isExpanded:Yn,toggleExpand:Zn,expandAll:Wt,collapseAll:Nt}=Kr(e=>k({data:e}),Tn),{editingCell:I,startEditing:N,stopEditing:B,isEditing:Jn}=Xr(),[te,j]=V(null),{contextMenu:w,showContextMenu:jt,hideContextMenu:bi}=_r(),{copyToClipboard:O}=Yr(),{isMobile:el}=Ur(Hn),{isOpen:ne,activeTab:q,toggle:tl,switchTab:le,setIsOpen:Ue}=ti(R.sideBar!==!1,"columns"),{menuState:v,showColumnMenu:nl,hideColumnMenu:S,filterDropdownState:G,showFilterDropdown:ll,hideFilterDropdown:Ye}=ei(),{rowGroupColumns:Ze,addRowGroupColumn:rl,removeRowGroupColumn:Ot,clearRowGroupColumns:wi,groupableColumns:Mi,groupedColumnsInfo:qt}=Jr(_),{valueColumns:Kt,addValueColumn:Ii,removeValueColumn:il,clearValueColumns:Pi,aggregatedValues:Ri}=Zr(y),{isPivotMode:ol,togglePivotMode:al}=ni(),[sl,dl]=V(new Set),[E,Je]=V(null),[cl,be]=V(null),hl=p((e,n)=>{Je(n),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",n)},[]),ul=p((e,n)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",n!==E&&be(n)},[E]),gl=p(()=>{be(null)},[]),pl=p((e,n)=>{if(e.preventDefault(),E&&E!==n){const r=T.findIndex(s=>s.colId===E),o=T.findIndex(s=>s.colId===n);r!==-1&&o!==-1&&Y(E,o)}Je(null),be(null)},[E,T,Y]),ml=p(()=>{Je(null),be(null)},[]),P=p(e=>{const n=new Set;return b.forEach(r=>{const o=D(r,e);o!=null&&n.add(String(o))}),Array.from(n).sort()},[b]),Cl=p(e=>{dl(n=>{const r=new Set(n);return r.has(e)?r.delete(e):r.add(e),r})},[]),Qt=p((e,n)=>{Ne(r=>{const o=r[e]||new Set(P(e)),s=new Set(o);return s.has(n)?s.delete(n):s.add(n),{...r,[e]:s}})},[P]),et=p(e=>{Ne(n=>{const r=P(e),o=n[e];return!o||o.size===r.length?{...n,[e]:new Set}:{...n,[e]:new Set(r)}})},[P]),Xt=p(e=>{const n=F[e];if(!n)return!1;const r=P(e);return n.size>0&&n.size<r.length},[F,P]),fl=z(()=>Object.entries(F).some(([e,n])=>{const r=P(e);return n.size>0&&n.size<r.length}),[F,P]),_t=p(()=>{Ne({})},[]),$l=p(()=>{Bt(),_t()},[Bt,_t]),we=ln(null),kl=ln(null),[Ut,Yt]=V(!1),[K,Zt]=V(null),vl=p((e,n,r)=>{e.preventDefault(),Zt({colId:n,startX:e.clientX,startWidth:r})},[]);Ie(()=>{if(!K)return;const e=r=>{const o=r.clientX-K.startX,s=Math.max(50,K.startWidth+o);U(K.colId,s)},n=()=>{Zt(null)};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",n)}},[K,U]);const h=z(()=>({setRowData:()=>{},getRowData:()=>b,applyTransaction:()=>{},applyTransactionAsync:()=>{},refreshCells:()=>{},redrawRows:()=>{},getRowNode:e=>m.find(n=>k({data:n})===e),forEachNode:e=>m.forEach((n,r)=>e(x(n,r),r)),forEachLeafNode:e=>m.forEach((n,r)=>e(x(n,r),r)),getDisplayedRowCount:()=>m.length,getDisplayedRowAtIndex:e=>x(m[e],e),getFirstDisplayedRow:()=>ve,getLastDisplayedRow:()=>Oe,selectAll:ye,deselectAll:ee,selectAllFiltered:ye,deselectAllFiltered:ee,getSelectedRows:()=>C,getSelectedNodes:()=>C.map((e,n)=>x(e,n)),getSortModel:()=>Et,setSortModel:()=>{},setFilterModel:()=>{},getFilterModel:()=>At,setQuickFilter:Z,isQuickFilterPresent:()=>He.length>0,isAnyFilterPresent:()=>We,destroyFilter:()=>{},getFilterInstance:()=>null,onFilterChanged:()=>{},paginationGetPageSize:()=>je,paginationSetPageSize:_e,paginationGetCurrentPage:()=>A,paginationGetTotalPages:()=>J,paginationGetRowCount:()=>y.length,paginationGoToPage:Vt,paginationGoToNextPage:qe,paginationGoToPreviousPage:Ke,paginationGoToFirstPage:Qe,paginationGoToLastPage:Xe,startEditingCell:({rowIndex:e,colKey:n})=>{const r=m[e];if(r){const o=D(r,n);N(k({data:r}),n,e,o)}},stopEditing:e=>B(e||!1),getEditingCells:()=>I?[{rowIndex:I.rowIndex,column:{}}]:[],exportDataAsCsv:e=>{dt(C.length>0&&e?.onlySelected?C:y,g,e?.fileName||"export.csv")},getDataAsCsv:()=>"",exportDataAsExcel:()=>{},copySelectedRangeToClipboard:e=>O(C,g,e),copySelectedRowsToClipboard:e=>O(C,g,e),pasteFromClipboard:()=>{},ensureIndexVisible:()=>{},ensureNodeVisible:()=>{},ensureColumnVisible:()=>{},getHorizontalScrollPosition:()=>we.current?.scrollLeft||0,getVerticalScrollPosition:()=>we.current?.scrollTop||0,resetRowHeights:()=>{},onRowHeightChanged:()=>{},sizeColumnsToFit:()=>{},autoSizeAllColumns:()=>{},autoSizeColumn:()=>{},expandAll:()=>Wt(m),collapseAll:Nt,setRowGroupColumns:()=>{},getRowGroupColumns:()=>[],addEventListener:()=>{},removeEventListener:()=>{},destroy:()=>{},getContext:()=>c,setContext:()=>{},isDestroyed:()=>!1,refreshHeader:()=>{},setHeaderHeight:()=>{},showLoadingOverlay:()=>Yt(!0),showNoRowsOverlay:()=>{},hideOverlay:()=>Yt(!1),getGridElement:()=>we.current}),[b,m,k,ve,Oe,ye,ee,C,Et,At,Z,He,We,je,_e,A,J,y,Vt,qe,Ke,Qe,Xe,N,B,I,g,O,Wt,Nt,c]),u=z(()=>({getAllColumns:()=>me.map((e,n)=>({...e,colId:e.colId,colDef:e,sort:null,visible:!e.hide,pinned:e.pinned||null,width:e.width||100,left:0,getColDef:()=>e,getColId:()=>e.colId,isVisible:()=>!e.hide,isPinned:()=>!!e.pinned,getSort:()=>ke(e.colId).sort,setSort:()=>{}})),getAllGridColumns:()=>[],getVisibleColumns:()=>g.map(e=>({colId:e.colId,colDef:e})),getColumn:e=>me.find(n=>n.colId===e),setColumnVisible:Ce,setColumnsVisible:(e,n)=>e.forEach(r=>Ce(String(r),n)),setColumnPinned:W,setColumnsPinned:(e,n)=>e.forEach(r=>W(String(r),n)),moveColumn:Y,moveColumns:(e,n)=>e.forEach((r,o)=>Y(String(r),n+o)),getColumnState:()=>T,applyColumnState:()=>!0,resetColumnState:fe,setColumnWidth:U,setColumnsWidth:(e,n)=>e.forEach(r=>U(String(r),n)),autoSizeColumn:()=>{},autoSizeColumns:()=>{},sizeColumnsToFit:()=>{},isPinningLeft:()=>g.some(e=>e.pinned==="left"),isPinningRight:()=>g.some(e=>e.pinned==="right"),getDisplayNameForColumn:e=>e.colDef.headerName||e.colDef.field||""}),[me,g,T,Ce,W,Y,fe,U,ke]);zl(Q,()=>({api:h,columnApi:u}),[h,u]),Ie(()=>{jn?.({type:"gridReady",api:h,columnApi:u,context:c})},[]);const Jt=p((e,n,r,o,s)=>{const a=o.field?D(n,o.field):null,d=x(n,r);wt?.({type:"cellClicked",api:h,columnApi:u,context:c,data:n,node:d,column:{colId:o.colId,colDef:o},colDef:o,value:a,rowIndex:r,event:e.nativeEvent}),ge&&o.editable&&(N(k({data:n}),o.colId,r,a),j(a)),L&&!Ct&&!o.checkboxSelection&&(xe(n,r),Rt?.({type:"rowSelected",api:h,columnApi:u,context:c,data:n,node:d,rowIndex:r}))},[h,u,c,wt,ge,L,Ct,xe,Rt,N,k]),en=p((e,n,r,o,s)=>{const a=o.field?D(n,o.field):null,d=x(n,r);Mt?.({type:"cellDoubleClicked",api:h,columnApi:u,context:c,data:n,node:d,column:{colId:o.colId,colDef:o},colDef:o,value:a,rowIndex:r,event:e.nativeEvent}),!ge&&o.editable&&(N(k({data:n}),o.colId,r,a),j(a))},[h,u,c,Mt,ge,N,k]),tt=p((e,n,r)=>{const o=x(n,r);Pt?.({type:"rowClicked",api:h,columnApi:u,context:c,data:n,node:o,rowIndex:r,event:e.nativeEvent})},[h,u,c,Pt]),Sl=p((e,n)=>{e.sortable!==!1&&ue&&($e(e.colId,n.shiftKey||Ge),Lt?.({type:"sortChanged",api:h,columnApi:u,context:c}))},[ue,$e,Ge,Lt,h,u,c]),tn=p((e,n,r,o)=>{xt||(e.preventDefault(),jt(e.clientX,e.clientY,{row:n,rowIndex:r,col:o}))},[xt,jt]),Me=p(e=>{I&&It?.({type:"cellValueChanged",api:h,columnApi:u,context:c,data:{},node:x({},I.rowIndex),column:{},colDef:{},oldValue:I.value,newValue:e,rowIndex:I.rowIndex}),B(!1,e),j(null)},[I,It,h,u,c,B]),xl=p(e=>{I&&(e.key==="Escape"?(B(!0),j(null)):e.key==="Enter"&&Me(te)),St&&(e.ctrlKey||e.metaKey)&&e.key==="c"&&O(C,g,!0)},[I,B,Me,te,St,O,C,g]),yl=he.some(ut),bl=()=>yl?t(Zl,{$theme:l,children:he.map((e,n)=>ut(e)?t(on,{$theme:l,$colSpan:Be(e.children).length,colSpan:Be(e.children).length,children:e.headerName},e.groupId||n):t(on,{$theme:l,$colSpan:1},e.field||n))}):null,wl=()=>i(Kl,{$theme:l,$height:wn,children:[L&&t(Pe,{$theme:l,$width:40,$align:"center",children:t(dn,{children:t(De,{type:"checkbox",$theme:l,checked:_n,ref:e=>e&&(e.indeterminate=Un),onChange:e=>{e.target.checked?ye():ee(),Dt?.({type:"selectionChanged",api:h,columnApi:u,context:c})}})})}),pe&&t(Pe,{$theme:l,$width:40,$align:"center"}),X&&t(Pe,{$theme:l,$width:40,$align:"center"}),g.map((e,n)=>{const r=e.colId,{sort:o}=ke(r),a=T.find(d=>d.colId===r)?.width||e.width;return i(Pe,{$theme:l,$align:e.headerAlign||e.align,$sortable:e.sortable!==!1&&ue,$sorted:!!o,$resizable:e.resizable!==!1,$pinned:e.pinned,$width:a,$minWidth:e.minWidth,$maxWidth:e.maxWidth,onClick:d=>Sl(e,d),onMouseEnter:d=>{const f=d.currentTarget.querySelector("[data-menu-button]");f&&(f.style.opacity="1")},onMouseLeave:d=>{const f=d.currentTarget.querySelector("[data-menu-button]");f&&v.colId!==r&&(f.style.opacity="0")},children:[i(Ql,{children:[t(Xl,{children:e.headerName||e.field}),e.sortable!==!1&&ue&&t(_l,{$direction:o,$active:!!o,children:o==="desc"?t(Sn,{}):t(vn,{})}),e.filter&&t(Ul,{$active:Gt(e.field||"")||Xt(e.field||""),$theme:l,onClick:d=>{d.stopPropagation();const f=d.target.getBoundingClientRect();ll(r,f.left,f.bottom+4)},children:t(Ee,{})}),!e.suppressMenu&&t(Lr,{"data-menu-button":!0,$theme:l,$active:v.visible&&v.colId===r,onClick:d=>{d.stopPropagation();const f=d.target.getBoundingClientRect();v.visible&&v.colId===r?S():nl(r,f.left,f.bottom+4)},children:t(di,{})})]}),e.resizable!==!1&&t(Yl,{$theme:l,$resizing:K?.colId===r,onMouseDown:d=>vl(d,r,a||100)})]},r)})]}),Ml=()=>Dn?i(Jl,{$theme:l,$height:Mn,children:[L&&t(Re,{$theme:l}),pe&&t(Re,{$theme:l}),X&&t(Re,{$theme:l}),g.map(e=>t(Re,{$theme:l,children:e.filter&&t("input",{type:"text",placeholder:`Filter ${e.headerName||e.field}...`,onChange:n=>{Xn(e.field||"",{filterType:"text",filter:n.target.value}),Ft?.({type:"filterChanged",api:h,columnApi:u,context:c})}})},e.colId))]}):null,Il=(e,n,r,o)=>{const s=r.colId,a=k({data:e}),d=r.field?D(e,r.field):null,f=Jn(a,s),nt=T.find($=>$.colId===s)?.width||r.width;if(f)return t(H,{$theme:l,$editing:!0,$align:r.align,$width:nt,children:t(lr,{$theme:l,children:t("input",{type:r.cellEditor==="agNumberCellEditor"?"number":"text",value:te??"",onChange:$=>j($.target.value),onBlur:()=>En&&Me(te),onKeyDown:$=>{$.key==="Enter"&&Me(te),$.key==="Escape"&&(B(!0),j(null))},autoFocus:!0})})},s);if(r.cellRenderer){const $=r.cellRenderer,Bl={value:d,data:e,node:x(e,n,a),rowIndex:n,colDef:r,column:{colId:s,colDef:r},api:h,columnApi:u,context:c,refreshCell:()=>{},eGridCell:null,getValue:()=>d,setValue:()=>{}};return t(H,{$theme:l,$align:r.align,$pinned:r.pinned,$width:nt,onClick:re=>Jt(re,e,n,r,o),onDoubleClick:re=>en(re,e,n,r,o),onContextMenu:re=>tn(re,e,n,r),children:t(sn,{$wrapText:r.wrapText,children:t($,{...Bl})})},s)}let lt=d;return r.valueFormatter&&(lt=r.valueFormatter({value:d,data:e,node:x(e,n,a),colDef:r,column:{colId:s,colDef:r},api:h,columnApi:u,context:c})),t(H,{$theme:l,$align:r.align,$pinned:r.pinned,$width:nt,title:Vn?String(lt??""):void 0,onClick:$=>Jt($,e,n,r,o),onDoubleClick:$=>en($,e,n,r,o),onContextMenu:$=>tn($,e,n,r),children:t(sn,{$wrapText:r.wrapText,children:lt??""})},s)},Pl=(e,n)=>{const r=k({data:e}),o=Se(r),s=Yn(r),a=X&&(An?.(e)??!0);return i(oe.Fragment,{children:[i(an,{$theme:l,$selected:o,$striped:!0,$even:n%2===0,$height:bn,$animate:Wn,onClick:d=>tt(d,e,n),children:[L&&t(H,{$theme:l,$align:"center",$width:40,children:t(dn,{children:t(De,{type:"checkbox",$theme:l,checked:o,onChange:()=>{xe(e,n),Dt?.({type:"selectionChanged",api:h,columnApi:u,context:c})},onClick:d=>d.stopPropagation()})})}),pe&&t(H,{$theme:l,$align:"center",$width:40,children:t(nr,{$theme:l,children:t(ht,{})})}),X&&t(H,{$theme:l,$align:"center",$width:40,children:a&&t(tr,{$theme:l,$expanded:s,onClick:d=>{d.stopPropagation(),Zn(e)},children:t(ct,{})})}),g.map((d,f)=>Il(e,n,d,f))]}),X&&a&&s&&$t&&t(an,{$theme:l,children:t(H,{$theme:l,colSpan:g.length+(L?1:0)+(pe?1:0)+1,style:{padding:"16px"},children:oe.createElement($t,{value:null,data:e,node:x(e,n,r),rowIndex:n,colDef:{},column:{},api:h,columnApi:u,context:c,refreshCell:()=>{},eGridCell:null,getValue:()=>null,setValue:()=>{}})})})]},r)},Rl=()=>bt?t(gn,{$theme:l,children:m.map((e,n)=>{const r=k({data:e});return t(pn,{$theme:l,$selected:Se(r),onClick:o=>tt(o,e,n),children:oe.createElement(bt,{data:e,node:x(e,n,r)})},r)})}):t(gn,{$theme:l,children:m.map((e,n)=>{const r=k({data:e});return i(pn,{$theme:l,$selected:Se(r),onClick:o=>tt(o,e,n),children:[L&&t(ur,{$theme:l,children:t(De,{type:"checkbox",$theme:l,checked:Se(r),onChange:()=>xe(e,n)})}),g.slice(0,6).map(o=>{const s=o.field?D(e,o.field):null;return i(gr,{$theme:l,children:[t(pr,{$theme:l,children:o.headerName||o.field}),t(mr,{$theme:l,children:String(s??"")})]},o.colId)})]},r)})}),nn=()=>vt?t(un,{$theme:l,children:oe.createElement(vt,{})}):i(un,{$theme:l,children:[t(ci,{}),t("span",{children:"No Rows To Show"})]}),Dl=()=>kt?t(hn,{$theme:l,children:oe.createElement(kt,{})}):i(hn,{$theme:l,children:[t(dr,{$theme:l}),t("span",{children:"Loading..."})]}),Ll=()=>!Ve||Fn?null:i(rr,{$theme:l,children:[i(ir,{$theme:l,children:["Showing ",ve+1," to ",Oe," of ",y.length," rows"]}),i(or,{children:[t(Le,{$theme:l,onClick:Qe,disabled:A===0,children:t(ii,{})}),t(Le,{$theme:l,onClick:Ke,disabled:A===0,children:t(ri,{})}),i("span",{style:{padding:"0 12px",fontSize:"13px"},children:["Page ",A+1," of ",J]}),t(Le,{$theme:l,onClick:qe,disabled:A>=J-1,children:t(ct,{})}),t(Le,{$theme:l,onClick:Xe,disabled:A>=J-1,children:t(oi,{})}),Array.isArray(ft)&&t(ar,{$theme:l,value:je,onChange:e=>{_e(Number(e.target.value)),On?.({type:"paginationChanged",api:h,columnApi:u,context:c,newPage:!1,newPageSize:!0,animate:!0,keepRenderedRows:!1})},children:ft.map(e=>i("option",{value:e,children:[e," rows"]},e))})]})]}),Fl=()=>{if(!w.visible)return null;const e=zn?.({node:w.data?.row?x(w.data.row,w.data.rowIndex):{},column:{colId:w.data?.col?.colId,colDef:w.data?.col},value:w.data?.col?.field?D(w.data.row,w.data.col.field):null})||["copy","separator","export"];return t(cr,{$theme:l,$x:w.x,$y:w.y,children:e.map((n,r)=>{if(n==="separator")return t(hr,{$theme:l},r);if(typeof n=="string")switch(n){case"copy":return i(rt,{$theme:l,onClick:()=>O(C,g,!0),children:["Copy",t("span",{className:"shortcut",children:"Ctrl+C"})]},n);case"export":return t(rt,{$theme:l,onClick:()=>dt(y,g,"export.csv"),children:"Export to CSV"},n);default:return null}return i(rt,{$theme:l,$disabled:n.disabled,$danger:n.cssClasses?.includes("danger"),onClick:()=>!n.disabled&&n.action?.(),children:[n.icon,n.name,n.shortcut&&t("span",{className:"shortcut",children:n.shortcut})]},n.name)})})},El=()=>{if(!v.visible||!v.colId)return null;const e=_.find(o=>o.colId===v.colId);if(!e)return null;const n=v.colId,{sort:r}=ke(n);return i(Fr,{$theme:l,$x:v.x,$y:v.y,onClick:o=>o.stopPropagation(),children:[i(se,{$theme:l,children:[i(M,{$theme:l,onClick:()=>{$e(n,!1),S()},children:[t(vn,{}),t("span",{children:"Sort Ascending"})]}),i(M,{$theme:l,onClick:()=>{$e(n,!1),S()},children:[t(Sn,{}),t("span",{children:"Sort Descending"})]})]}),i(se,{$theme:l,children:[i(M,{$theme:l,$hasSubmenu:!0,onClick:()=>{},children:[t(hi,{}),t("span",{children:"Pin Column"})]}),i(M,{$theme:l,onClick:()=>{W(n,"left"),S()},style:{paddingLeft:36},children:[t(ui,{}),t("span",{children:"Pin Left"})]}),i(M,{$theme:l,onClick:()=>{W(n,"right"),S()},style:{paddingLeft:36},children:[t(gi,{}),t("span",{children:"Pin Right"})]}),i(M,{$theme:l,onClick:()=>{W(n,null),S()},style:{paddingLeft:36},children:[t(pi,{}),t("span",{children:"No Pin"})]})]}),i(se,{$theme:l,children:[i(M,{$theme:l,onClick:()=>{S()},children:[t(xn,{}),t("span",{children:"Autosize This Column"})]}),i(M,{$theme:l,onClick:()=>{S()},children:[t(xn,{}),t("span",{children:"Autosize All Columns"})]})]}),e.field&&e.enableRowGroup!==!1&&t(se,{$theme:l,children:i(M,{$theme:l,onClick:()=>{rl(e.field),S()},children:[t(Ae,{}),i("span",{children:["Group by ",e.headerName||e.field]})]})}),i(se,{$theme:l,children:[i(M,{$theme:l,onClick:()=>{Ue(!0),le("columns"),S()},children:[t(Te,{}),t("span",{children:"Choose Columns"})]}),i(M,{$theme:l,onClick:()=>{fe(),S()},children:[t(mi,{}),t("span",{children:"Reset Columns"})]})]})]})},Tl=()=>{if(!G.visible||!G.colId)return null;const e=_.find(a=>a.colId===G.colId);if(!e||!e.field)return null;const n=e.field,r=P(n),o=F[n]||new Set(r),s=o.size===r.length;return i(Er,{$theme:l,style:{position:"fixed",top:G.y,left:G.x,zIndex:1e3},onClick:a=>a.stopPropagation(),children:[t(Tr,{$theme:l,children:"Text Filter"}),t(Ar,{$theme:l,children:t("input",{type:"text",placeholder:"Search...",autoFocus:!0})}),i($n,{$theme:l,children:[i(de,{$theme:l,$selectAll:!0,children:[t("input",{type:"checkbox",checked:s,onChange:()=>et(n)}),"(Select All)"]}),r.map(a=>i(de,{$theme:l,children:[t("input",{type:"checkbox",checked:o.has(a),onChange:()=>Qt(n,a)}),a]},a))]}),i(Br,{$theme:l,children:[t(kn,{$theme:l,onClick:()=>{et(n)},children:"Reset"}),t(kn,{$theme:l,$primary:!0,onClick:()=>{Ye()},children:"Apply"})]})]})},Al=()=>R.sideBar===!1?null:i(kr,{$theme:l,$open:ne,children:[t(vr,{$theme:l,$collapsed:!ne,children:ne?i(ie,{children:[i(Fe,{$theme:l,$active:q==="columns",onClick:()=>le("columns"),children:[t(Te,{}),"Columns"]}),i(Fe,{$theme:l,$active:q==="filters",onClick:()=>le("filters"),children:[t(Ee,{}),"Filters"]})]}):i(ie,{children:[t(Fe,{$theme:l,$collapsed:!0,$active:q==="columns",onClick:()=>{Ue(!0),le("columns")},title:"Columns",children:t(Te,{})}),t(Fe,{$theme:l,$collapsed:!0,$active:q==="filters",onClick:()=>{Ue(!0),le("filters")},title:"Filters",children:t(Ee,{})})]})}),ne&&i(Sr,{$theme:l,children:[q==="columns"&&i(ie,{children:[i(Pr,{$theme:l,children:[t(Rr,{$theme:l,children:"Pivot Mode"}),i(Dr,{$theme:l,children:[t("input",{type:"checkbox",checked:ol,onChange:al}),t("span",{})]})]}),t(mn,{$theme:l,children:t("input",{type:"text",placeholder:"Search..."})}),i(it,{$theme:l,children:[i(ot,{$theme:l,children:[t(Te,{}),"Columns"]}),me.map(e=>{const n=e.colId,r=!e.hide;return i(xr,{$theme:l,$dragging:E===n,$selected:cl===n,draggable:!0,onDragStart:a=>hl(a,n),onDragOver:a=>ul(a,n),onDragLeave:gl,onDrop:a=>pl(a,n),onDragEnd:ml,children:[t(Cn,{$theme:l,children:t(ht,{})}),t(De,{type:"checkbox",$theme:l,checked:r,onChange:a=>{Ce(n,a.target.checked)}}),t(yr,{children:e.headerName||e.field})]},n)})]}),i(it,{$theme:l,children:[i(ot,{$theme:l,children:[t(Ae,{}),"Row Groups"]}),t(at,{$theme:l,$hasItems:Ze.length>0,children:Ze.length===0?i(st,{$theme:l,children:[t(Ae,{}),"Drag here to set row groups"]}):qt.map(({field:e,headerName:n})=>i(fn,{$theme:l,children:[n,t("button",{onClick:()=>Ot(e),children:t(ce,{})})]},e))})]}),i(it,{$theme:l,children:[i(ot,{$theme:l,children:[t(yn,{}),"Values"]}),t(br,{$theme:l,children:Kt.length===0?t(at,{$theme:l,$hasItems:!1,children:i(st,{$theme:l,children:[t(yn,{}),"Drag here to aggregate"]})}):Kt.map(({field:e,aggFunc:n,displayName:r})=>i(wr,{$theme:l,children:[i(Mr,{$theme:l,children:[t(Cn,{$theme:l,children:t(ht,{})}),n,"(",r,")"]}),t(Ir,{$theme:l,onClick:()=>il(e,n),children:t(ce,{})})]},`${n}-${e}`))})]})]}),q==="filters"&&i(ie,{children:[t(mn,{$theme:l,children:t("input",{type:"text",placeholder:"Search..."})}),_.filter(e=>e.filter&&e.field).map(e=>{const n=e.field,r=sl.has(n),o=Gt(n)||Xt(n),s=P(n),a=F[n]||new Set(s);return i(Gr,{$theme:l,children:[i(zr,{$theme:l,$expanded:r,$hasFilter:o,onClick:()=>Cl(n),children:[t(ct,{}),e.headerName||e.field,o&&t(Ee,{})]}),r&&t(Vr,{$theme:l,$expanded:r,children:i($n,{$theme:l,style:{maxHeight:200,marginBottom:8},children:[i(de,{$theme:l,$selectAll:!0,children:[t("input",{type:"checkbox",checked:a.size===s.length,onChange:()=>et(n)}),"(Select All)"]}),s.slice(0,20).map(d=>i(de,{$theme:l,children:[t("input",{type:"checkbox",checked:a.has(d),onChange:()=>Qt(n,d)}),d]},d)),s.length>20&&t(de,{$theme:l,children:i("span",{style:{opacity:.6,fontSize:12},children:["...and ",s.length-20," more"]})})]})})]},e.colId)})]})]})]});return Ie(()=>{const e=()=>{v.visible&&S(),G.visible&&Ye()};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[v.visible,G.visible,S,Ye]),i(Vl,{ref:we,$theme:l,$responsive:yt,style:qn,className:Kn,onKeyDown:xl,tabIndex:0,dir:Nn?"rtl":"ltr",children:[i(Wl,{$theme:l,children:[i(rn,{children:[i(Nl,{$theme:l,children:[t(li,{}),t("input",{type:"text",placeholder:"Search...",value:He,onChange:e=>{Z(e.target.value),Ft?.({type:"filterChanged",api:h,columnApi:u,context:c})}})]}),(We||fl)&&i(ae,{$theme:l,onClick:$l,children:[t(ce,{}),"Clear Filters"]})]}),i(rn,{children:[!Gn&&i(ae,{$theme:l,onClick:()=>dt(y,g,"export.csv"),children:[t(ai,{}),"Export"]}),i(ae,{$theme:l,onClick:fe,children:[t(si,{}),"Reset"]}),R.sideBar!==!1&&t(ae,{$theme:l,$active:ne,onClick:tl,children:t(Ci,{})})]})]}),R.rowGroupPanelShow!=="never"&&Ze.length>0&&i(at,{$theme:l,$hasItems:!0,children:[t(st,{$theme:l,children:t(Ae,{})}),qt.map(({field:e,headerName:n})=>i(fn,{$theme:l,children:[n,t("button",{onClick:()=>Ot(e),children:t(ce,{})})]},e))]}),C.length>0&&i(Cr,{$theme:l,$visible:C.length>0,children:[i("span",{children:[C.length," row",C.length!==1?"s":""," selected"]}),t(fr,{children:i(ae,{$theme:l,style:{background:"transparent",border:"none",color:"white"},onClick:ee,children:[t(ce,{}),"Clear"]})})]}),i(Hr,{children:[i(Wr,{children:[t(Hl,{children:i(jl,{$stickyHeader:!0,$maxHeight:In==="autoHeight"?void 0:"calc(100% - 100px)",children:[yt&&el?m.length===0?nn():Rl():i(ie,{children:[m.length===0&&!Ut&&nn(),m.length>0&&i(Ol,{ref:kl,$theme:l,$fixedLayout:!0,children:[i(ql,{$theme:l,$sticky:!0,children:[bl(),wl(),Ml()]}),t(er,{$theme:l,children:m.map((e,n)=>Pl(e,ve+n))})]})]}),Ut&&Dl()]})}),Ll(),Bn&&i(sr,{$theme:l,children:[i(cn,{children:[t("strong",{children:"Rows:"})," ",y.length]}),i(cn,{children:[t("strong",{children:"Selected:"})," ",C.length]})]})]}),Al()]}),Fl(),El(),Tl()]})}export const AgGrid=Gl(fi);export default AgGrid;
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ /**
4
+ * AG Grid Component
5
+ * A comprehensive, AG Grid-like data table with all enterprise features
6
+ * Reference: https://www.ag-grid.com/react-data-grid/getting-started/
7
+ */
8
+ import React, { forwardRef, useImperativeHandle, useMemo, useCallback, useState, useEffect, useRef, } from 'react';
9
+ import { GridRoot, GridWrapper, GridToolbar, ToolbarGroup, ToolbarButton, QuickFilter, TableContainer, StyledTable, TableHead, HeaderRow, HeaderCell, HeaderCellContent, HeaderText, SortIndicator, FilterIndicator, ResizeHandle, GroupHeaderRow, GroupHeaderCell, FloatingFilterRow, FloatingFilterCell, TableBody, TableRow, TableCell, CellContent, Checkbox, CheckboxCell, ExpandButton, DragHandle, CellEditor, PaginationBar, PaginationInfo, PaginationControls, PageButton, PageSizeSelect, StatusBar, StatusItem, LoadingOverlay, Spinner, NoRowsOverlay, ContextMenu, ContextMenuItem, ContextMenuDivider, MobileCardContainer, MobileCard, MobileCardHeader, MobileCardRow, MobileCardLabel, MobileCardValue, SelectionBar, SelectionActions, getTheme,
10
+ // New Side Panel Components
11
+ SidePanel, SidePanelTabs, SidePanelTab, SidePanelContent, SidePanelSearch, SidePanelSection, SidePanelSectionHeader, SidePanelColumnItem, SidePanelDragHandle, SidePanelGroupLabel,
12
+ // Row Groups
13
+ RowGroupsZone, RowGroupsLabel, RowGroupChip,
14
+ // Values Panel
15
+ ValuesPanel, ValueItem, ValueItemLabel, ValueItemRemove,
16
+ // Pivot Mode
17
+ PivotModeToggle, PivotModeLabel, ToggleSwitch,
18
+ // Column Menu
19
+ HeaderMenuButton, ColumnMenuPopup, ColumnMenuSection, ColumnMenuItem,
20
+ // Set Filter
21
+ SetFilterContainer, SetFilterHeader, SetFilterSearch, SetFilterList, SetFilterItem, SetFilterActions, SetFilterButton,
22
+ // Filter Panel
23
+ FilterPanelColumn, FilterPanelHeader, FilterPanelContent,
24
+ // Layout
25
+ GridLayout, GridMainArea, } from './elements';
26
+ import { useSorting, useFiltering, usePagination, useRowSelection, useRowExpansion, useColumnState, useCellEditing, useContextMenu, useResponsive, useClipboard, getNestedValue, createRowNode, exportToCsv, useAggregationPanel, useRowGroupingPanel, useColumnMenu, useSidePanel, usePivotMode, } from './hooks';
27
+ // ============================================================================
28
+ // Icons
29
+ // ============================================================================
30
+ const SearchIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("circle", { cx: "11", cy: "11", r: "8" }), _jsx("path", { d: "M21 21l-4.35-4.35", strokeLinecap: "round" })] }));
31
+ const SortAscIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", children: _jsx("path", { d: "M7 14l5-5 5 5H7z" }) }));
32
+ const SortDescIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", children: _jsx("path", { d: "M7 10l5 5 5-5H7z" }) }));
33
+ const FilterIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M22 3H2l8 9.46V19l4 2v-8.54L22 3z", strokeLinecap: "round", strokeLinejoin: "round" }) }));
34
+ const ChevronRightIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M9 18l6-6-6-6", strokeLinecap: "round", strokeLinejoin: "round" }) }));
35
+ const ChevronLeftIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M15 18l-6-6 6-6", strokeLinecap: "round", strokeLinejoin: "round" }) }));
36
+ const ChevronsLeftIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M11 17l-5-5 5-5M18 17l-5-5 5-5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
37
+ const ChevronsRightIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M13 7l5 5-5 5M6 7l5 5-5 5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
38
+ const DownloadIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M7 10l5 5 5-5M12 15V3", strokeLinecap: "round", strokeLinejoin: "round" }) }));
39
+ const ColumnsIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("rect", { x: "3", y: "3", width: "7", height: "18", rx: "1" }), _jsx("rect", { x: "14", y: "3", width: "7", height: "18", rx: "1" })] }));
40
+ const RefreshIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M23 4v6h-6M1 20v-6h6", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15", strokeLinecap: "round", strokeLinejoin: "round" })] }));
41
+ const MenuIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("circle", { cx: "12", cy: "12", r: "1" }), _jsx("circle", { cx: "12", cy: "5", r: "1" }), _jsx("circle", { cx: "12", cy: "19", r: "1" })] }));
42
+ const GripIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "currentColor", opacity: "0.5", children: [_jsx("circle", { cx: "9", cy: "5", r: "1.5" }), _jsx("circle", { cx: "9", cy: "12", r: "1.5" }), _jsx("circle", { cx: "9", cy: "19", r: "1.5" }), _jsx("circle", { cx: "15", cy: "5", r: "1.5" }), _jsx("circle", { cx: "15", cy: "12", r: "1.5" }), _jsx("circle", { cx: "15", cy: "19", r: "1.5" })] }));
43
+ const EmptyIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [_jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }), _jsx("path", { d: "M3 9h18M9 3v18", strokeLinecap: "round" })] }));
44
+ const CloseIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M18 6L6 18M6 6l12 12", strokeLinecap: "round", strokeLinejoin: "round" }) }));
45
+ const PinIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M12 2v10M12 22v-6M4 12h16", strokeLinecap: "round" }), _jsx("circle", { cx: "12", cy: "12", r: "3" })] }));
46
+ const PinLeftIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M4 4v16M8 12h12M15 7l5 5-5 5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
47
+ const PinRightIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M20 4v16M4 12h12M9 7l-5 5 5 5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
48
+ const NoPinIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M3 3l18 18M12 2v10M12 22v-6", strokeLinecap: "round" }), _jsx("circle", { cx: "12", cy: "12", r: "3" })] }));
49
+ const GroupIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M4 6h16M4 12h16M4 18h16", strokeLinecap: "round" }) }));
50
+ const AutosizeIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M4 12h16M9 7l-5 5 5 5M15 7l5 5-5 5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
51
+ const ResetIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M3 12a9 9 0 109-9 9.75 9.75 0 00-6.74 2.74L3 8", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M3 3v5h5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
52
+ const SigmaIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M18 6H6l6 6-6 6h12", strokeLinecap: "round", strokeLinejoin: "round" }) }));
53
+ const EyeIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }), _jsx("circle", { cx: "12", cy: "12", r: "3" })] }));
54
+ const EyeOffIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24" }), _jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })] }));
55
+ const CheckIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("polyline", { points: "20 6 9 17 4 12", strokeLinecap: "round", strokeLinejoin: "round" }) }));
56
+ const PanelRightIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }), _jsx("path", { d: "M15 3v18", strokeLinecap: "round" })] }));
57
+ // ============================================================================
58
+ // Helper Functions
59
+ // ============================================================================
60
+ function isColGroupDef(col) {
61
+ return 'children' in col;
62
+ }
63
+ function flattenColumnDefs(columns) {
64
+ const result = [];
65
+ columns.forEach((col) => {
66
+ if (isColGroupDef(col)) {
67
+ result.push(...flattenColumnDefs(col.children));
68
+ }
69
+ else {
70
+ result.push(col);
71
+ }
72
+ });
73
+ return result;
74
+ }
75
+ // ============================================================================
76
+ // Main Component
77
+ // ============================================================================
78
+ function AgGridInner(props, ref) {
79
+ const {
80
+ // Data
81
+ rowData, columnDefs, defaultColDef, getRowId = (params) => String(params.data._id ?? params.data.id ?? Math.random()),
82
+ // Theme
83
+ theme = 'quartz', customTheme, rowHeight = 42, headerHeight = 42, floatingFiltersHeight = 32, domLayout = 'normal',
84
+ // Selection
85
+ rowSelection, rowMultiSelectWithClick = false, suppressRowClickSelection = false, isRowSelectable,
86
+ // Sorting
87
+ sortable = true, suppressMultiSort = false, alwaysMultiSort = false,
88
+ // Filtering
89
+ filter = true, floatingFilter = false, quickFilterText: controlledQuickFilter,
90
+ // Pagination
91
+ pagination = false, paginationPageSize = 10, paginationPageSizeSelector = [10, 25, 50, 100], suppressPaginationPanel = false,
92
+ // Editing
93
+ singleClickEdit = false, stopEditingWhenCellsLoseFocus = true, undoRedoCellEditing = false,
94
+ // Row Grouping
95
+ groupDefaultExpanded = 0,
96
+ // Master/Detail
97
+ masterDetail = false, detailCellRenderer, isRowMaster,
98
+ // Row Dragging
99
+ rowDragManaged = false,
100
+ // Overlays
101
+ loadingOverlayComponent, noRowsOverlayComponent,
102
+ // Status Bar
103
+ statusBar,
104
+ // Clipboard
105
+ enableClipboard = true,
106
+ // Export
107
+ suppressCsvExport = false,
108
+ // Context Menu
109
+ getContextMenuItems, suppressContextMenu = false,
110
+ // Tooltips
111
+ enableBrowserTooltips = false,
112
+ // Responsive
113
+ responsive = true, mobileBreakpoint = 768, mobileCardRenderer,
114
+ // Misc
115
+ animateRows = true, enableRtl = false,
116
+ // Events
117
+ onGridReady, onCellClicked, onCellDoubleClicked, onCellValueChanged, onRowClicked, onRowDoubleClicked, onRowSelected, onSelectionChanged, onSortChanged, onFilterChanged, onPaginationChanged,
118
+ // Custom props
119
+ containerStyle, containerClassName, context, gridId, } = props;
120
+ // ============================================================================
121
+ // Theme
122
+ // ============================================================================
123
+ const gridTheme = useMemo(() => getTheme(theme, customTheme), [theme, customTheme]);
124
+ // ============================================================================
125
+ // Flatten and process columns
126
+ // ============================================================================
127
+ const flatColumns = useMemo(() => {
128
+ const flat = flattenColumnDefs(columnDefs);
129
+ return flat.map((col) => ({
130
+ ...defaultColDef,
131
+ ...col,
132
+ colId: col.colId || col.field || `col-${Math.random()}`,
133
+ }));
134
+ }, [columnDefs, defaultColDef]);
135
+ // ============================================================================
136
+ // Column State (visibility, width, order, pinning)
137
+ // ============================================================================
138
+ const { columnState, processedColumns, visibleColumns, setColumnVisible, setColumnWidth, setColumnPinned, moveColumn, resetColumnState, } = useColumnState(flatColumns, gridId);
139
+ // ============================================================================
140
+ // Sorting
141
+ // ============================================================================
142
+ const { sortModel, handleSort, getSortForColumn, clearSort, sortData, } = useSorting([], !suppressMultiSort || alwaysMultiSort);
143
+ // ============================================================================
144
+ // Filtering
145
+ // ============================================================================
146
+ const { filterModel, quickFilterText, setQuickFilterText, setColumnFilter, clearFilters, isFilterActive, hasActiveFilters, filterData, } = useFiltering();
147
+ // Sync controlled quick filter
148
+ useEffect(() => {
149
+ if (controlledQuickFilter !== undefined) {
150
+ setQuickFilterText(controlledQuickFilter);
151
+ }
152
+ }, [controlledQuickFilter, setQuickFilterText]);
153
+ // ============================================================================
154
+ // Set Filter State (for each column) - moved up for processedData dependency
155
+ // ============================================================================
156
+ const [setFilterStates, setSetFilterStates] = useState({});
157
+ // ============================================================================
158
+ // Processed Data (sort + filter + set filter)
159
+ // ============================================================================
160
+ const processedData = useMemo(() => {
161
+ let data = [...rowData];
162
+ // Apply quick filter and column text filters
163
+ data = filterData(data, visibleColumns);
164
+ // Apply set filters (filter by selected values)
165
+ Object.entries(setFilterStates).forEach(([field, selectedValues]) => {
166
+ // If no values selected or all values selected, skip filtering
167
+ const allValues = new Set();
168
+ rowData.forEach((row) => {
169
+ const value = getNestedValue(row, field);
170
+ if (value != null) {
171
+ allValues.add(String(value));
172
+ }
173
+ });
174
+ // Only apply filter if some values are deselected
175
+ if (selectedValues.size > 0 && selectedValues.size < allValues.size) {
176
+ data = data.filter((row) => {
177
+ const value = getNestedValue(row, field);
178
+ if (value == null)
179
+ return false;
180
+ return selectedValues.has(String(value));
181
+ });
182
+ }
183
+ else if (selectedValues.size === 0) {
184
+ // No values selected means filter out all
185
+ data = [];
186
+ }
187
+ });
188
+ // Apply sorting
189
+ data = sortData(data, visibleColumns);
190
+ return data;
191
+ }, [rowData, filterData, sortData, visibleColumns, setFilterStates]);
192
+ // ============================================================================
193
+ // Pagination
194
+ // ============================================================================
195
+ const { currentPage, pageSize, totalPages, startRow, endRow, goToPage, goToNextPage, goToPreviousPage, goToFirstPage, goToLastPage, changePageSize, paginateData, } = usePagination(processedData.length, paginationPageSize);
196
+ const displayData = useMemo(() => {
197
+ if (!pagination)
198
+ return processedData;
199
+ return paginateData(processedData);
200
+ }, [processedData, pagination, paginateData]);
201
+ // ============================================================================
202
+ // Selection
203
+ // ============================================================================
204
+ const { selectedIds, isSelected, toggleRow, selectAll, deselectAll, isAllSelected, isIndeterminate, selectedRows, } = useRowSelection(displayData, (row) => getRowId({ data: row }), rowSelection || 'multiple', isRowSelectable);
205
+ // ============================================================================
206
+ // Expansion (for master/detail)
207
+ // ============================================================================
208
+ const { isExpanded, toggleExpand, expandAll, collapseAll, } = useRowExpansion((row) => getRowId({ data: row }), groupDefaultExpanded);
209
+ // ============================================================================
210
+ // Cell Editing
211
+ // ============================================================================
212
+ const { editingCell, startEditing, stopEditing, isEditing, } = useCellEditing();
213
+ const [editValue, setEditValue] = useState(null);
214
+ // ============================================================================
215
+ // Context Menu
216
+ // ============================================================================
217
+ const { contextMenu, showContextMenu, hideContextMenu } = useContextMenu();
218
+ // ============================================================================
219
+ // Clipboard
220
+ // ============================================================================
221
+ const { copyToClipboard } = useClipboard();
222
+ // ============================================================================
223
+ // Responsive
224
+ // ============================================================================
225
+ const { isMobile } = useResponsive(mobileBreakpoint);
226
+ // ============================================================================
227
+ // Side Panel
228
+ // ============================================================================
229
+ const { isOpen: isSidePanelOpen, activeTab: sidePanelTab, toggle: toggleSidePanel, switchTab: switchSidePanelTab, setIsOpen: setSidePanelOpen, } = useSidePanel(props.sideBar !== false, 'columns');
230
+ // ============================================================================
231
+ // Column Menu
232
+ // ============================================================================
233
+ const { menuState: columnMenuState, showColumnMenu, hideColumnMenu, filterDropdownState, showFilterDropdown, hideFilterDropdown, } = useColumnMenu();
234
+ // ============================================================================
235
+ // Row Grouping Panel
236
+ // ============================================================================
237
+ const { rowGroupColumns, addRowGroupColumn, removeRowGroupColumn, clearRowGroupColumns, groupableColumns, groupedColumnsInfo, } = useRowGroupingPanel(flatColumns);
238
+ // ============================================================================
239
+ // Aggregation Panel
240
+ // ============================================================================
241
+ const { valueColumns, addValueColumn, removeValueColumn, clearValueColumns, aggregatedValues, } = useAggregationPanel(processedData);
242
+ // ============================================================================
243
+ // Pivot Mode
244
+ // ============================================================================
245
+ const { isPivotMode, togglePivotMode, } = usePivotMode();
246
+ // ============================================================================
247
+ // Expanded Filter Panels State
248
+ // ============================================================================
249
+ const [expandedFilterPanels, setExpandedFilterPanels] = useState(new Set());
250
+ // ============================================================================
251
+ // Column Drag State (for reordering in side panel)
252
+ // ============================================================================
253
+ const [draggedColumnId, setDraggedColumnId] = useState(null);
254
+ const [dragOverColumnId, setDragOverColumnId] = useState(null);
255
+ const handleColumnDragStart = useCallback((e, colId) => {
256
+ setDraggedColumnId(colId);
257
+ e.dataTransfer.effectAllowed = 'move';
258
+ e.dataTransfer.setData('text/plain', colId);
259
+ }, []);
260
+ const handleColumnDragOver = useCallback((e, colId) => {
261
+ e.preventDefault();
262
+ e.dataTransfer.dropEffect = 'move';
263
+ if (colId !== draggedColumnId) {
264
+ setDragOverColumnId(colId);
265
+ }
266
+ }, [draggedColumnId]);
267
+ const handleColumnDragLeave = useCallback(() => {
268
+ setDragOverColumnId(null);
269
+ }, []);
270
+ const handleColumnDrop = useCallback((e, targetColId) => {
271
+ e.preventDefault();
272
+ if (draggedColumnId && draggedColumnId !== targetColId) {
273
+ // Find indices in columnState
274
+ const fromIndex = columnState.findIndex((s) => s.colId === draggedColumnId);
275
+ const toIndex = columnState.findIndex((s) => s.colId === targetColId);
276
+ if (fromIndex !== -1 && toIndex !== -1) {
277
+ moveColumn(draggedColumnId, toIndex);
278
+ }
279
+ }
280
+ setDraggedColumnId(null);
281
+ setDragOverColumnId(null);
282
+ }, [draggedColumnId, columnState, moveColumn]);
283
+ const handleColumnDragEnd = useCallback(() => {
284
+ setDraggedColumnId(null);
285
+ setDragOverColumnId(null);
286
+ }, []);
287
+ // Extract unique values for a field
288
+ const getUniqueValuesForField = useCallback((field) => {
289
+ const values = new Set();
290
+ rowData.forEach((row) => {
291
+ const value = getNestedValue(row, field);
292
+ if (value != null) {
293
+ values.add(String(value));
294
+ }
295
+ });
296
+ return Array.from(values).sort();
297
+ }, [rowData]);
298
+ // Toggle filter panel expansion
299
+ const toggleFilterPanel = useCallback((field) => {
300
+ setExpandedFilterPanels((prev) => {
301
+ const next = new Set(prev);
302
+ if (next.has(field)) {
303
+ next.delete(field);
304
+ }
305
+ else {
306
+ next.add(field);
307
+ }
308
+ return next;
309
+ });
310
+ }, []);
311
+ // Toggle value in set filter
312
+ const toggleSetFilterValue = useCallback((field, value) => {
313
+ setSetFilterStates((prev) => {
314
+ const currentValues = prev[field] || new Set(getUniqueValuesForField(field));
315
+ const next = new Set(currentValues);
316
+ if (next.has(value)) {
317
+ next.delete(value);
318
+ }
319
+ else {
320
+ next.add(value);
321
+ }
322
+ return { ...prev, [field]: next };
323
+ });
324
+ }, [getUniqueValuesForField]);
325
+ // Select/deselect all in set filter
326
+ const toggleSetFilterSelectAll = useCallback((field) => {
327
+ setSetFilterStates((prev) => {
328
+ const allValues = getUniqueValuesForField(field);
329
+ const currentValues = prev[field];
330
+ const isAllSelected = !currentValues || currentValues.size === allValues.length;
331
+ if (isAllSelected) {
332
+ return { ...prev, [field]: new Set() };
333
+ }
334
+ else {
335
+ return { ...prev, [field]: new Set(allValues) };
336
+ }
337
+ });
338
+ }, [getUniqueValuesForField]);
339
+ // Check if set filter has active filter
340
+ const isSetFilterActive = useCallback((field) => {
341
+ const state = setFilterStates[field];
342
+ if (!state)
343
+ return false;
344
+ const allValues = getUniqueValuesForField(field);
345
+ return state.size > 0 && state.size < allValues.length;
346
+ }, [setFilterStates, getUniqueValuesForField]);
347
+ // Check if any set filter is active
348
+ const hasActiveSetFilters = useMemo(() => {
349
+ return Object.entries(setFilterStates).some(([field, selectedValues]) => {
350
+ const allValues = getUniqueValuesForField(field);
351
+ return selectedValues.size > 0 && selectedValues.size < allValues.length;
352
+ });
353
+ }, [setFilterStates, getUniqueValuesForField]);
354
+ // Clear all set filters
355
+ const clearSetFilters = useCallback(() => {
356
+ setSetFilterStates({});
357
+ }, []);
358
+ // Clear all filters (including set filters)
359
+ const clearAllFilters = useCallback(() => {
360
+ clearFilters();
361
+ clearSetFilters();
362
+ }, [clearFilters, clearSetFilters]);
363
+ // ============================================================================
364
+ // Refs
365
+ // ============================================================================
366
+ const containerRef = useRef(null);
367
+ const tableRef = useRef(null);
368
+ const [isLoading, setIsLoading] = useState(false);
369
+ // ============================================================================
370
+ // Column Resize State
371
+ // ============================================================================
372
+ const [resizing, setResizing] = useState(null);
373
+ const handleResizeStart = useCallback((e, colId, currentWidth) => {
374
+ e.preventDefault();
375
+ setResizing({ colId, startX: e.clientX, startWidth: currentWidth });
376
+ }, []);
377
+ useEffect(() => {
378
+ if (!resizing)
379
+ return;
380
+ const handleMouseMove = (e) => {
381
+ const delta = e.clientX - resizing.startX;
382
+ const newWidth = Math.max(50, resizing.startWidth + delta);
383
+ setColumnWidth(resizing.colId, newWidth);
384
+ };
385
+ const handleMouseUp = () => {
386
+ setResizing(null);
387
+ };
388
+ document.addEventListener('mousemove', handleMouseMove);
389
+ document.addEventListener('mouseup', handleMouseUp);
390
+ return () => {
391
+ document.removeEventListener('mousemove', handleMouseMove);
392
+ document.removeEventListener('mouseup', handleMouseUp);
393
+ };
394
+ }, [resizing, setColumnWidth]);
395
+ // ============================================================================
396
+ // Grid API
397
+ // ============================================================================
398
+ const gridApi = useMemo(() => ({
399
+ // Data
400
+ setRowData: () => { },
401
+ getRowData: () => rowData,
402
+ applyTransaction: () => { },
403
+ applyTransactionAsync: () => { },
404
+ refreshCells: () => { },
405
+ redrawRows: () => { },
406
+ // Row Nodes
407
+ getRowNode: (id) => displayData.find((row) => getRowId({ data: row }) === id),
408
+ forEachNode: (callback) => displayData.forEach((row, i) => callback(createRowNode(row, i), i)),
409
+ forEachLeafNode: (callback) => displayData.forEach((row, i) => callback(createRowNode(row, i), i)),
410
+ getDisplayedRowCount: () => displayData.length,
411
+ getDisplayedRowAtIndex: (index) => createRowNode(displayData[index], index),
412
+ getFirstDisplayedRow: () => startRow,
413
+ getLastDisplayedRow: () => endRow,
414
+ // Selection
415
+ selectAll,
416
+ deselectAll,
417
+ selectAllFiltered: selectAll,
418
+ deselectAllFiltered: deselectAll,
419
+ getSelectedRows: () => selectedRows,
420
+ getSelectedNodes: () => selectedRows.map((row, i) => createRowNode(row, i)),
421
+ // Sorting
422
+ getSortModel: () => sortModel,
423
+ setSortModel: () => { },
424
+ // Filtering
425
+ setFilterModel: () => { },
426
+ getFilterModel: () => filterModel,
427
+ setQuickFilter: setQuickFilterText,
428
+ isQuickFilterPresent: () => quickFilterText.length > 0,
429
+ isAnyFilterPresent: () => hasActiveFilters,
430
+ destroyFilter: () => { },
431
+ getFilterInstance: () => null,
432
+ onFilterChanged: () => { },
433
+ // Pagination
434
+ paginationGetPageSize: () => pageSize,
435
+ paginationSetPageSize: changePageSize,
436
+ paginationGetCurrentPage: () => currentPage,
437
+ paginationGetTotalPages: () => totalPages,
438
+ paginationGetRowCount: () => processedData.length,
439
+ paginationGoToPage: goToPage,
440
+ paginationGoToNextPage: goToNextPage,
441
+ paginationGoToPreviousPage: goToPreviousPage,
442
+ paginationGoToFirstPage: goToFirstPage,
443
+ paginationGoToLastPage: goToLastPage,
444
+ // Editing
445
+ startEditingCell: ({ rowIndex, colKey }) => {
446
+ const row = displayData[rowIndex];
447
+ if (row) {
448
+ const value = getNestedValue(row, colKey);
449
+ startEditing(getRowId({ data: row }), colKey, rowIndex, value);
450
+ }
451
+ },
452
+ stopEditing: (cancel) => stopEditing(cancel || false),
453
+ getEditingCells: () => editingCell ? [{ rowIndex: editingCell.rowIndex, column: {} }] : [],
454
+ // Export
455
+ exportDataAsCsv: (params) => {
456
+ exportToCsv(selectedRows.length > 0 && params?.onlySelected ? selectedRows : processedData, visibleColumns, params?.fileName || 'export.csv');
457
+ },
458
+ getDataAsCsv: () => '',
459
+ exportDataAsExcel: () => { },
460
+ // Clipboard
461
+ copySelectedRangeToClipboard: (includeHeaders) => copyToClipboard(selectedRows, visibleColumns, includeHeaders),
462
+ copySelectedRowsToClipboard: (includeHeaders) => copyToClipboard(selectedRows, visibleColumns, includeHeaders),
463
+ pasteFromClipboard: () => { },
464
+ // Scrolling
465
+ ensureIndexVisible: () => { },
466
+ ensureNodeVisible: () => { },
467
+ ensureColumnVisible: () => { },
468
+ getHorizontalScrollPosition: () => containerRef.current?.scrollLeft || 0,
469
+ getVerticalScrollPosition: () => containerRef.current?.scrollTop || 0,
470
+ // Row Height
471
+ resetRowHeights: () => { },
472
+ onRowHeightChanged: () => { },
473
+ // Display
474
+ sizeColumnsToFit: () => { },
475
+ autoSizeAllColumns: () => { },
476
+ autoSizeColumn: () => { },
477
+ // Grouping
478
+ expandAll: () => expandAll(displayData),
479
+ collapseAll,
480
+ setRowGroupColumns: () => { },
481
+ getRowGroupColumns: () => [],
482
+ // Events
483
+ addEventListener: () => { },
484
+ removeEventListener: () => { },
485
+ // Misc
486
+ destroy: () => { },
487
+ getContext: () => context,
488
+ setContext: () => { },
489
+ isDestroyed: () => false,
490
+ refreshHeader: () => { },
491
+ setHeaderHeight: () => { },
492
+ showLoadingOverlay: () => setIsLoading(true),
493
+ showNoRowsOverlay: () => { },
494
+ hideOverlay: () => setIsLoading(false),
495
+ getGridElement: () => containerRef.current,
496
+ }), [
497
+ rowData, displayData, getRowId, startRow, endRow, selectAll, deselectAll, selectedRows,
498
+ sortModel, filterModel, setQuickFilterText, quickFilterText, hasActiveFilters,
499
+ pageSize, changePageSize, currentPage, totalPages, processedData, goToPage,
500
+ goToNextPage, goToPreviousPage, goToFirstPage, goToLastPage, startEditing, stopEditing,
501
+ editingCell, visibleColumns, copyToClipboard, expandAll, collapseAll, context,
502
+ ]);
503
+ // ============================================================================
504
+ // Column API
505
+ // ============================================================================
506
+ const columnApi = useMemo(() => ({
507
+ getAllColumns: () => processedColumns.map((col, i) => ({ ...col, colId: col.colId, colDef: col, sort: null, visible: !col.hide, pinned: col.pinned || null, width: col.width || 100, left: 0, getColDef: () => col, getColId: () => col.colId, isVisible: () => !col.hide, isPinned: () => !!col.pinned, getSort: () => getSortForColumn(col.colId).sort, setSort: () => { } })),
508
+ getAllGridColumns: () => [],
509
+ getVisibleColumns: () => visibleColumns.map((col) => ({ colId: col.colId, colDef: col })),
510
+ getColumn: (colId) => processedColumns.find((c) => c.colId === colId),
511
+ setColumnVisible,
512
+ setColumnsVisible: (colIds, visible) => colIds.forEach((id) => setColumnVisible(String(id), visible)),
513
+ setColumnPinned,
514
+ setColumnsPinned: (colIds, pinned) => colIds.forEach((id) => setColumnPinned(String(id), pinned)),
515
+ moveColumn,
516
+ moveColumns: (colIds, toIndex) => colIds.forEach((id, i) => moveColumn(String(id), toIndex + i)),
517
+ getColumnState: () => columnState,
518
+ applyColumnState: () => true,
519
+ resetColumnState,
520
+ setColumnWidth,
521
+ setColumnsWidth: (colIds, width) => colIds.forEach((id) => setColumnWidth(String(id), width)),
522
+ autoSizeColumn: () => { },
523
+ autoSizeColumns: () => { },
524
+ sizeColumnsToFit: () => { },
525
+ isPinningLeft: () => visibleColumns.some((c) => c.pinned === 'left'),
526
+ isPinningRight: () => visibleColumns.some((c) => c.pinned === 'right'),
527
+ getDisplayNameForColumn: (column) => column.colDef.headerName || column.colDef.field || '',
528
+ }), [processedColumns, visibleColumns, columnState, setColumnVisible, setColumnPinned, moveColumn, resetColumnState, setColumnWidth, getSortForColumn]);
529
+ // ============================================================================
530
+ // Expose API via ref
531
+ // ============================================================================
532
+ useImperativeHandle(ref, () => ({ api: gridApi, columnApi }), [gridApi, columnApi]);
533
+ // ============================================================================
534
+ // Grid Ready Event
535
+ // ============================================================================
536
+ useEffect(() => {
537
+ onGridReady?.({
538
+ type: 'gridReady',
539
+ api: gridApi,
540
+ columnApi,
541
+ context,
542
+ });
543
+ }, []);
544
+ // ============================================================================
545
+ // Event Handlers
546
+ // ============================================================================
547
+ const handleCellClick = useCallback((e, row, rowIndex, col, colIndex) => {
548
+ const value = col.field ? getNestedValue(row, col.field) : null;
549
+ const node = createRowNode(row, rowIndex);
550
+ onCellClicked?.({
551
+ type: 'cellClicked',
552
+ api: gridApi,
553
+ columnApi,
554
+ context,
555
+ data: row,
556
+ node,
557
+ column: { colId: col.colId, colDef: col },
558
+ colDef: col,
559
+ value,
560
+ rowIndex,
561
+ event: e.nativeEvent,
562
+ });
563
+ // Single click edit
564
+ if (singleClickEdit && col.editable) {
565
+ startEditing(getRowId({ data: row }), col.colId, rowIndex, value);
566
+ setEditValue(value);
567
+ }
568
+ // Row selection on click
569
+ if (rowSelection && !suppressRowClickSelection && !col.checkboxSelection) {
570
+ toggleRow(row, rowIndex);
571
+ onRowSelected?.({
572
+ type: 'rowSelected',
573
+ api: gridApi,
574
+ columnApi,
575
+ context,
576
+ data: row,
577
+ node,
578
+ rowIndex,
579
+ });
580
+ }
581
+ }, [gridApi, columnApi, context, onCellClicked, singleClickEdit, rowSelection, suppressRowClickSelection, toggleRow, onRowSelected, startEditing, getRowId]);
582
+ const handleCellDoubleClick = useCallback((e, row, rowIndex, col, colIndex) => {
583
+ const value = col.field ? getNestedValue(row, col.field) : null;
584
+ const node = createRowNode(row, rowIndex);
585
+ onCellDoubleClicked?.({
586
+ type: 'cellDoubleClicked',
587
+ api: gridApi,
588
+ columnApi,
589
+ context,
590
+ data: row,
591
+ node,
592
+ column: { colId: col.colId, colDef: col },
593
+ colDef: col,
594
+ value,
595
+ rowIndex,
596
+ event: e.nativeEvent,
597
+ });
598
+ // Double click edit
599
+ if (!singleClickEdit && col.editable) {
600
+ startEditing(getRowId({ data: row }), col.colId, rowIndex, value);
601
+ setEditValue(value);
602
+ }
603
+ }, [gridApi, columnApi, context, onCellDoubleClicked, singleClickEdit, startEditing, getRowId]);
604
+ const handleRowClick = useCallback((e, row, rowIndex) => {
605
+ const node = createRowNode(row, rowIndex);
606
+ onRowClicked?.({
607
+ type: 'rowClicked',
608
+ api: gridApi,
609
+ columnApi,
610
+ context,
611
+ data: row,
612
+ node,
613
+ rowIndex,
614
+ event: e.nativeEvent,
615
+ });
616
+ }, [gridApi, columnApi, context, onRowClicked]);
617
+ const handleHeaderClick = useCallback((col, e) => {
618
+ if (col.sortable !== false && sortable) {
619
+ handleSort(col.colId, e.shiftKey || alwaysMultiSort);
620
+ onSortChanged?.({
621
+ type: 'sortChanged',
622
+ api: gridApi,
623
+ columnApi,
624
+ context,
625
+ });
626
+ }
627
+ }, [sortable, handleSort, alwaysMultiSort, onSortChanged, gridApi, columnApi, context]);
628
+ const handleContextMenu = useCallback((e, row, rowIndex, col) => {
629
+ if (suppressContextMenu)
630
+ return;
631
+ e.preventDefault();
632
+ showContextMenu(e.clientX, e.clientY, { row, rowIndex, col });
633
+ }, [suppressContextMenu, showContextMenu]);
634
+ const handleEditComplete = useCallback((newValue) => {
635
+ if (editingCell) {
636
+ onCellValueChanged?.({
637
+ type: 'cellValueChanged',
638
+ api: gridApi,
639
+ columnApi,
640
+ context,
641
+ data: {},
642
+ node: createRowNode({}, editingCell.rowIndex),
643
+ column: {},
644
+ colDef: {},
645
+ oldValue: editingCell.value,
646
+ newValue,
647
+ rowIndex: editingCell.rowIndex,
648
+ });
649
+ }
650
+ stopEditing(false, newValue);
651
+ setEditValue(null);
652
+ }, [editingCell, onCellValueChanged, gridApi, columnApi, context, stopEditing]);
653
+ // ============================================================================
654
+ // Keyboard Handlers
655
+ // ============================================================================
656
+ const handleKeyDown = useCallback((e) => {
657
+ if (editingCell) {
658
+ if (e.key === 'Escape') {
659
+ stopEditing(true);
660
+ setEditValue(null);
661
+ }
662
+ else if (e.key === 'Enter') {
663
+ handleEditComplete(editValue);
664
+ }
665
+ }
666
+ // Clipboard shortcuts
667
+ if (enableClipboard && (e.ctrlKey || e.metaKey)) {
668
+ if (e.key === 'c') {
669
+ copyToClipboard(selectedRows, visibleColumns, true);
670
+ }
671
+ }
672
+ }, [editingCell, stopEditing, handleEditComplete, editValue, enableClipboard, copyToClipboard, selectedRows, visibleColumns]);
673
+ // ============================================================================
674
+ // Render Column Groups (if any)
675
+ // ============================================================================
676
+ const hasColumnGroups = columnDefs.some(isColGroupDef);
677
+ const renderColumnGroups = () => {
678
+ if (!hasColumnGroups)
679
+ return null;
680
+ return (_jsx(GroupHeaderRow, { "$theme": gridTheme, children: columnDefs.map((col, i) => {
681
+ if (isColGroupDef(col)) {
682
+ return (_jsx(GroupHeaderCell, { "$theme": gridTheme, "$colSpan": flattenColumnDefs(col.children).length, colSpan: flattenColumnDefs(col.children).length, children: col.headerName }, col.groupId || i));
683
+ }
684
+ return _jsx(GroupHeaderCell, { "$theme": gridTheme, "$colSpan": 1 }, col.field || i);
685
+ }) }));
686
+ };
687
+ // ============================================================================
688
+ // Render Header
689
+ // ============================================================================
690
+ const renderHeader = () => (_jsxs(HeaderRow, { "$theme": gridTheme, "$height": headerHeight, children: [rowSelection && (_jsx(HeaderCell, { "$theme": gridTheme, "$width": 40, "$align": "center", children: _jsx(CheckboxCell, { children: _jsx(Checkbox, { type: "checkbox", "$theme": gridTheme, checked: isAllSelected, ref: (el) => el && (el.indeterminate = isIndeterminate), onChange: (e) => {
691
+ if (e.target.checked) {
692
+ selectAll();
693
+ }
694
+ else {
695
+ deselectAll();
696
+ }
697
+ onSelectionChanged?.({
698
+ type: 'selectionChanged',
699
+ api: gridApi,
700
+ columnApi,
701
+ context,
702
+ });
703
+ } }) }) })), rowDragManaged && (_jsx(HeaderCell, { "$theme": gridTheme, "$width": 40, "$align": "center" })), masterDetail && (_jsx(HeaderCell, { "$theme": gridTheme, "$width": 40, "$align": "center" })), visibleColumns.map((col, colIndex) => {
704
+ const colId = col.colId;
705
+ const { sort: sortDir } = getSortForColumn(colId);
706
+ const state = columnState.find((s) => s.colId === colId);
707
+ const width = state?.width || col.width;
708
+ return (_jsxs(HeaderCell, { "$theme": gridTheme, "$align": col.headerAlign || col.align, "$sortable": col.sortable !== false && sortable, "$sorted": !!sortDir, "$resizable": col.resizable !== false, "$pinned": col.pinned, "$width": width, "$minWidth": col.minWidth, "$maxWidth": col.maxWidth, onClick: (e) => handleHeaderClick(col, e), onMouseEnter: (e) => {
709
+ const target = e.currentTarget.querySelector('[data-menu-button]');
710
+ if (target)
711
+ target.style.opacity = '1';
712
+ }, onMouseLeave: (e) => {
713
+ const target = e.currentTarget.querySelector('[data-menu-button]');
714
+ if (target && columnMenuState.colId !== colId)
715
+ target.style.opacity = '0';
716
+ }, children: [_jsxs(HeaderCellContent, { children: [_jsx(HeaderText, { children: col.headerName || col.field }), col.sortable !== false && sortable && (_jsx(SortIndicator, { "$direction": sortDir, "$active": !!sortDir, children: sortDir === 'desc' ? _jsx(SortDescIcon, {}) : _jsx(SortAscIcon, {}) })), col.filter && (_jsx(FilterIndicator, { "$active": isFilterActive(col.field || '') || isSetFilterActive(col.field || ''), "$theme": gridTheme, onClick: (e) => {
717
+ e.stopPropagation();
718
+ const rect = e.target.getBoundingClientRect();
719
+ showFilterDropdown(colId, rect.left, rect.bottom + 4);
720
+ }, children: _jsx(FilterIcon, {}) })), !col.suppressMenu && (_jsx(HeaderMenuButton, { "data-menu-button": true, "$theme": gridTheme, "$active": columnMenuState.visible && columnMenuState.colId === colId, onClick: (e) => {
721
+ e.stopPropagation();
722
+ const rect = e.target.getBoundingClientRect();
723
+ if (columnMenuState.visible && columnMenuState.colId === colId) {
724
+ hideColumnMenu();
725
+ }
726
+ else {
727
+ showColumnMenu(colId, rect.left, rect.bottom + 4);
728
+ }
729
+ }, children: _jsx(MenuIcon, {}) }))] }), col.resizable !== false && (_jsx(ResizeHandle, { "$theme": gridTheme, "$resizing": resizing?.colId === colId, onMouseDown: (e) => handleResizeStart(e, colId, width || 100) }))] }, colId));
730
+ })] }));
731
+ // ============================================================================
732
+ // Render Floating Filters
733
+ // ============================================================================
734
+ const renderFloatingFilters = () => {
735
+ if (!floatingFilter)
736
+ return null;
737
+ return (_jsxs(FloatingFilterRow, { "$theme": gridTheme, "$height": floatingFiltersHeight, children: [rowSelection && _jsx(FloatingFilterCell, { "$theme": gridTheme }), rowDragManaged && _jsx(FloatingFilterCell, { "$theme": gridTheme }), masterDetail && _jsx(FloatingFilterCell, { "$theme": gridTheme }), visibleColumns.map((col) => (_jsx(FloatingFilterCell, { "$theme": gridTheme, children: col.filter && (_jsx("input", { type: "text", placeholder: `Filter ${col.headerName || col.field}...`, onChange: (e) => {
738
+ setColumnFilter(col.field || '', {
739
+ filterType: 'text',
740
+ filter: e.target.value,
741
+ });
742
+ onFilterChanged?.({
743
+ type: 'filterChanged',
744
+ api: gridApi,
745
+ columnApi,
746
+ context,
747
+ });
748
+ } })) }, col.colId)))] }));
749
+ };
750
+ // ============================================================================
751
+ // Render Cell
752
+ // ============================================================================
753
+ const renderCell = (row, rowIndex, col, colIndex) => {
754
+ const colId = col.colId;
755
+ const rowId = getRowId({ data: row });
756
+ const value = col.field ? getNestedValue(row, col.field) : null;
757
+ const isEditingThis = isEditing(rowId, colId);
758
+ const state = columnState.find((s) => s.colId === colId);
759
+ const width = state?.width || col.width;
760
+ // Editing mode
761
+ if (isEditingThis) {
762
+ return (_jsx(TableCell, { "$theme": gridTheme, "$editing": true, "$align": col.align, "$width": width, children: _jsx(CellEditor, { "$theme": gridTheme, children: _jsx("input", { type: col.cellEditor === 'agNumberCellEditor' ? 'number' : 'text', value: editValue ?? '', onChange: (e) => setEditValue(e.target.value), onBlur: () => stopEditingWhenCellsLoseFocus && handleEditComplete(editValue), onKeyDown: (e) => {
763
+ if (e.key === 'Enter')
764
+ handleEditComplete(editValue);
765
+ if (e.key === 'Escape') {
766
+ stopEditing(true);
767
+ setEditValue(null);
768
+ }
769
+ }, autoFocus: true }) }) }, colId));
770
+ }
771
+ // Custom cell renderer
772
+ if (col.cellRenderer) {
773
+ const CellRenderer = col.cellRenderer;
774
+ const params = {
775
+ value,
776
+ data: row,
777
+ node: createRowNode(row, rowIndex, rowId),
778
+ rowIndex,
779
+ colDef: col,
780
+ column: { colId, colDef: col },
781
+ api: gridApi,
782
+ columnApi,
783
+ context,
784
+ refreshCell: () => { },
785
+ eGridCell: null,
786
+ getValue: () => value,
787
+ setValue: () => { },
788
+ };
789
+ return (_jsx(TableCell, { "$theme": gridTheme, "$align": col.align, "$pinned": col.pinned, "$width": width, onClick: (e) => handleCellClick(e, row, rowIndex, col, colIndex), onDoubleClick: (e) => handleCellDoubleClick(e, row, rowIndex, col, colIndex), onContextMenu: (e) => handleContextMenu(e, row, rowIndex, col), children: _jsx(CellContent, { "$wrapText": col.wrapText, children: _jsx(CellRenderer, { ...params }) }) }, colId));
790
+ }
791
+ // Value formatter
792
+ let displayValue = value;
793
+ if (col.valueFormatter) {
794
+ displayValue = col.valueFormatter({
795
+ value,
796
+ data: row,
797
+ node: createRowNode(row, rowIndex, rowId),
798
+ colDef: col,
799
+ column: { colId, colDef: col },
800
+ api: gridApi,
801
+ columnApi,
802
+ context,
803
+ });
804
+ }
805
+ return (_jsx(TableCell, { "$theme": gridTheme, "$align": col.align, "$pinned": col.pinned, "$width": width, title: enableBrowserTooltips ? String(displayValue ?? '') : undefined, onClick: (e) => handleCellClick(e, row, rowIndex, col, colIndex), onDoubleClick: (e) => handleCellDoubleClick(e, row, rowIndex, col, colIndex), onContextMenu: (e) => handleContextMenu(e, row, rowIndex, col), children: _jsx(CellContent, { "$wrapText": col.wrapText, children: displayValue ?? '' }) }, colId));
806
+ };
807
+ // ============================================================================
808
+ // Render Row
809
+ // ============================================================================
810
+ const renderRow = (row, rowIndex) => {
811
+ const rowId = getRowId({ data: row });
812
+ const selected = isSelected(rowId);
813
+ const expanded = isExpanded(rowId);
814
+ const isMaster = masterDetail && (isRowMaster?.(row) ?? true);
815
+ return (_jsxs(React.Fragment, { children: [_jsxs(TableRow, { "$theme": gridTheme, "$selected": selected, "$striped": true, "$even": rowIndex % 2 === 0, "$height": rowHeight, "$animate": animateRows, onClick: (e) => handleRowClick(e, row, rowIndex), children: [rowSelection && (_jsx(TableCell, { "$theme": gridTheme, "$align": "center", "$width": 40, children: _jsx(CheckboxCell, { children: _jsx(Checkbox, { type: "checkbox", "$theme": gridTheme, checked: selected, onChange: () => {
816
+ toggleRow(row, rowIndex);
817
+ onSelectionChanged?.({
818
+ type: 'selectionChanged',
819
+ api: gridApi,
820
+ columnApi,
821
+ context,
822
+ });
823
+ }, onClick: (e) => e.stopPropagation() }) }) })), rowDragManaged && (_jsx(TableCell, { "$theme": gridTheme, "$align": "center", "$width": 40, children: _jsx(DragHandle, { "$theme": gridTheme, children: _jsx(GripIcon, {}) }) })), masterDetail && (_jsx(TableCell, { "$theme": gridTheme, "$align": "center", "$width": 40, children: isMaster && (_jsx(ExpandButton, { "$theme": gridTheme, "$expanded": expanded, onClick: (e) => {
824
+ e.stopPropagation();
825
+ toggleExpand(row);
826
+ }, children: _jsx(ChevronRightIcon, {}) })) })), visibleColumns.map((col, colIndex) => renderCell(row, rowIndex, col, colIndex))] }), masterDetail && isMaster && expanded && detailCellRenderer && (_jsx(TableRow, { "$theme": gridTheme, children: _jsx(TableCell, { "$theme": gridTheme, colSpan: visibleColumns.length + (rowSelection ? 1 : 0) + (rowDragManaged ? 1 : 0) + 1, style: { padding: '16px' }, children: React.createElement(detailCellRenderer, {
827
+ value: null,
828
+ data: row,
829
+ node: createRowNode(row, rowIndex, rowId),
830
+ rowIndex,
831
+ colDef: {},
832
+ column: {},
833
+ api: gridApi,
834
+ columnApi,
835
+ context,
836
+ refreshCell: () => { },
837
+ eGridCell: null,
838
+ getValue: () => null,
839
+ setValue: () => { },
840
+ }) }) }))] }, rowId));
841
+ };
842
+ // ============================================================================
843
+ // Render Mobile Card View
844
+ // ============================================================================
845
+ const renderMobileCards = () => {
846
+ if (mobileCardRenderer) {
847
+ return (_jsx(MobileCardContainer, { "$theme": gridTheme, children: displayData.map((row, i) => {
848
+ const rowId = getRowId({ data: row });
849
+ return (_jsx(MobileCard, { "$theme": gridTheme, "$selected": isSelected(rowId), onClick: (e) => handleRowClick(e, row, i), children: React.createElement(mobileCardRenderer, {
850
+ data: row,
851
+ node: createRowNode(row, i, rowId),
852
+ }) }, rowId));
853
+ }) }));
854
+ }
855
+ return (_jsx(MobileCardContainer, { "$theme": gridTheme, children: displayData.map((row, i) => {
856
+ const rowId = getRowId({ data: row });
857
+ return (_jsxs(MobileCard, { "$theme": gridTheme, "$selected": isSelected(rowId), onClick: (e) => handleRowClick(e, row, i), children: [rowSelection && (_jsx(MobileCardHeader, { "$theme": gridTheme, children: _jsx(Checkbox, { type: "checkbox", "$theme": gridTheme, checked: isSelected(rowId), onChange: () => toggleRow(row, i) }) })), visibleColumns.slice(0, 6).map((col) => {
858
+ const value = col.field ? getNestedValue(row, col.field) : null;
859
+ return (_jsxs(MobileCardRow, { "$theme": gridTheme, children: [_jsx(MobileCardLabel, { "$theme": gridTheme, children: col.headerName || col.field }), _jsx(MobileCardValue, { "$theme": gridTheme, children: String(value ?? '') })] }, col.colId));
860
+ })] }, rowId));
861
+ }) }));
862
+ };
863
+ // ============================================================================
864
+ // Render Empty State
865
+ // ============================================================================
866
+ const renderEmptyState = () => {
867
+ if (noRowsOverlayComponent) {
868
+ return (_jsx(NoRowsOverlay, { "$theme": gridTheme, children: React.createElement(noRowsOverlayComponent, {}) }));
869
+ }
870
+ return (_jsxs(NoRowsOverlay, { "$theme": gridTheme, children: [_jsx(EmptyIcon, {}), _jsx("span", { children: "No Rows To Show" })] }));
871
+ };
872
+ // ============================================================================
873
+ // Render Loading State
874
+ // ============================================================================
875
+ const renderLoadingState = () => {
876
+ if (loadingOverlayComponent) {
877
+ return (_jsx(LoadingOverlay, { "$theme": gridTheme, children: React.createElement(loadingOverlayComponent, {}) }));
878
+ }
879
+ return (_jsxs(LoadingOverlay, { "$theme": gridTheme, children: [_jsx(Spinner, { "$theme": gridTheme }), _jsx("span", { children: "Loading..." })] }));
880
+ };
881
+ // ============================================================================
882
+ // Render Pagination
883
+ // ============================================================================
884
+ const renderPagination = () => {
885
+ if (!pagination || suppressPaginationPanel)
886
+ return null;
887
+ return (_jsxs(PaginationBar, { "$theme": gridTheme, children: [_jsxs(PaginationInfo, { "$theme": gridTheme, children: ["Showing ", startRow + 1, " to ", endRow, " of ", processedData.length, " rows"] }), _jsxs(PaginationControls, { children: [_jsx(PageButton, { "$theme": gridTheme, onClick: goToFirstPage, disabled: currentPage === 0, children: _jsx(ChevronsLeftIcon, {}) }), _jsx(PageButton, { "$theme": gridTheme, onClick: goToPreviousPage, disabled: currentPage === 0, children: _jsx(ChevronLeftIcon, {}) }), _jsxs("span", { style: { padding: '0 12px', fontSize: '13px' }, children: ["Page ", currentPage + 1, " of ", totalPages] }), _jsx(PageButton, { "$theme": gridTheme, onClick: goToNextPage, disabled: currentPage >= totalPages - 1, children: _jsx(ChevronRightIcon, {}) }), _jsx(PageButton, { "$theme": gridTheme, onClick: goToLastPage, disabled: currentPage >= totalPages - 1, children: _jsx(ChevronsRightIcon, {}) }), Array.isArray(paginationPageSizeSelector) && (_jsx(PageSizeSelect, { "$theme": gridTheme, value: pageSize, onChange: (e) => {
888
+ changePageSize(Number(e.target.value));
889
+ onPaginationChanged?.({
890
+ type: 'paginationChanged',
891
+ api: gridApi,
892
+ columnApi,
893
+ context,
894
+ newPage: false,
895
+ newPageSize: true,
896
+ animate: true,
897
+ keepRenderedRows: false,
898
+ });
899
+ }, children: paginationPageSizeSelector.map((size) => (_jsxs("option", { value: size, children: [size, " rows"] }, size))) }))] })] }));
900
+ };
901
+ // ============================================================================
902
+ // Render Context Menu
903
+ // ============================================================================
904
+ const renderContextMenu = () => {
905
+ if (!contextMenu.visible)
906
+ return null;
907
+ const items = getContextMenuItems?.({
908
+ node: contextMenu.data?.row ? createRowNode(contextMenu.data.row, contextMenu.data.rowIndex) : {},
909
+ column: { colId: contextMenu.data?.col?.colId, colDef: contextMenu.data?.col },
910
+ value: contextMenu.data?.col?.field ? getNestedValue(contextMenu.data.row, contextMenu.data.col.field) : null,
911
+ }) || ['copy', 'separator', 'export'];
912
+ return (_jsx(ContextMenu, { "$theme": gridTheme, "$x": contextMenu.x, "$y": contextMenu.y, children: items.map((item, i) => {
913
+ if (item === 'separator') {
914
+ return _jsx(ContextMenuDivider, { "$theme": gridTheme }, i);
915
+ }
916
+ if (typeof item === 'string') {
917
+ // Default menu items
918
+ switch (item) {
919
+ case 'copy':
920
+ return (_jsxs(ContextMenuItem, { "$theme": gridTheme, onClick: () => copyToClipboard(selectedRows, visibleColumns, true), children: ["Copy", _jsx("span", { className: "shortcut", children: "Ctrl+C" })] }, item));
921
+ case 'export':
922
+ return (_jsx(ContextMenuItem, { "$theme": gridTheme, onClick: () => exportToCsv(processedData, visibleColumns, 'export.csv'), children: "Export to CSV" }, item));
923
+ default:
924
+ return null;
925
+ }
926
+ }
927
+ return (_jsxs(ContextMenuItem, { "$theme": gridTheme, "$disabled": item.disabled, "$danger": item.cssClasses?.includes('danger'), onClick: () => !item.disabled && item.action?.(), children: [item.icon, item.name, item.shortcut && _jsx("span", { className: "shortcut", children: item.shortcut })] }, item.name));
928
+ }) }));
929
+ };
930
+ // ============================================================================
931
+ // Render Column Menu Popup
932
+ // ============================================================================
933
+ const renderColumnMenuPopup = () => {
934
+ if (!columnMenuState.visible || !columnMenuState.colId)
935
+ return null;
936
+ const col = flatColumns.find((c) => c.colId === columnMenuState.colId);
937
+ if (!col)
938
+ return null;
939
+ const colId = columnMenuState.colId;
940
+ const { sort: sortDir } = getSortForColumn(colId);
941
+ return (_jsxs(ColumnMenuPopup, { "$theme": gridTheme, "$x": columnMenuState.x, "$y": columnMenuState.y, onClick: (e) => e.stopPropagation(), children: [_jsxs(ColumnMenuSection, { "$theme": gridTheme, children: [_jsxs(ColumnMenuItem, { "$theme": gridTheme, onClick: () => {
942
+ handleSort(colId, false);
943
+ if (sortDir !== 'asc') {
944
+ // Force asc
945
+ }
946
+ hideColumnMenu();
947
+ }, children: [_jsx(SortAscIcon, {}), _jsx("span", { children: "Sort Ascending" })] }), _jsxs(ColumnMenuItem, { "$theme": gridTheme, onClick: () => {
948
+ handleSort(colId, false);
949
+ hideColumnMenu();
950
+ }, children: [_jsx(SortDescIcon, {}), _jsx("span", { children: "Sort Descending" })] })] }), _jsxs(ColumnMenuSection, { "$theme": gridTheme, children: [_jsxs(ColumnMenuItem, { "$theme": gridTheme, "$hasSubmenu": true, onClick: () => { }, children: [_jsx(PinIcon, {}), _jsx("span", { children: "Pin Column" })] }), _jsxs(ColumnMenuItem, { "$theme": gridTheme, onClick: () => {
951
+ setColumnPinned(colId, 'left');
952
+ hideColumnMenu();
953
+ }, style: { paddingLeft: 36 }, children: [_jsx(PinLeftIcon, {}), _jsx("span", { children: "Pin Left" })] }), _jsxs(ColumnMenuItem, { "$theme": gridTheme, onClick: () => {
954
+ setColumnPinned(colId, 'right');
955
+ hideColumnMenu();
956
+ }, style: { paddingLeft: 36 }, children: [_jsx(PinRightIcon, {}), _jsx("span", { children: "Pin Right" })] }), _jsxs(ColumnMenuItem, { "$theme": gridTheme, onClick: () => {
957
+ setColumnPinned(colId, null);
958
+ hideColumnMenu();
959
+ }, style: { paddingLeft: 36 }, children: [_jsx(NoPinIcon, {}), _jsx("span", { children: "No Pin" })] })] }), _jsxs(ColumnMenuSection, { "$theme": gridTheme, children: [_jsxs(ColumnMenuItem, { "$theme": gridTheme, onClick: () => {
960
+ // Autosize this column (simplified)
961
+ hideColumnMenu();
962
+ }, children: [_jsx(AutosizeIcon, {}), _jsx("span", { children: "Autosize This Column" })] }), _jsxs(ColumnMenuItem, { "$theme": gridTheme, onClick: () => {
963
+ // Autosize all columns (simplified)
964
+ hideColumnMenu();
965
+ }, children: [_jsx(AutosizeIcon, {}), _jsx("span", { children: "Autosize All Columns" })] })] }), col.field && col.enableRowGroup !== false && (_jsx(ColumnMenuSection, { "$theme": gridTheme, children: _jsxs(ColumnMenuItem, { "$theme": gridTheme, onClick: () => {
966
+ addRowGroupColumn(col.field);
967
+ hideColumnMenu();
968
+ }, children: [_jsx(GroupIcon, {}), _jsxs("span", { children: ["Group by ", col.headerName || col.field] })] }) })), _jsxs(ColumnMenuSection, { "$theme": gridTheme, children: [_jsxs(ColumnMenuItem, { "$theme": gridTheme, onClick: () => {
969
+ setSidePanelOpen(true);
970
+ switchSidePanelTab('columns');
971
+ hideColumnMenu();
972
+ }, children: [_jsx(ColumnsIcon, {}), _jsx("span", { children: "Choose Columns" })] }), _jsxs(ColumnMenuItem, { "$theme": gridTheme, onClick: () => {
973
+ resetColumnState();
974
+ hideColumnMenu();
975
+ }, children: [_jsx(ResetIcon, {}), _jsx("span", { children: "Reset Columns" })] })] })] }));
976
+ };
977
+ // ============================================================================
978
+ // Render Set Filter Dropdown
979
+ // ============================================================================
980
+ const renderSetFilterDropdown = () => {
981
+ if (!filterDropdownState.visible || !filterDropdownState.colId)
982
+ return null;
983
+ const col = flatColumns.find((c) => c.colId === filterDropdownState.colId);
984
+ if (!col || !col.field)
985
+ return null;
986
+ const field = col.field;
987
+ const uniqueValues = getUniqueValuesForField(field);
988
+ const selectedValues = setFilterStates[field] || new Set(uniqueValues);
989
+ const isAllSelected = selectedValues.size === uniqueValues.length;
990
+ return (_jsxs(SetFilterContainer, { "$theme": gridTheme, style: {
991
+ position: 'fixed',
992
+ top: filterDropdownState.y,
993
+ left: filterDropdownState.x,
994
+ zIndex: 1000,
995
+ }, onClick: (e) => e.stopPropagation(), children: [_jsx(SetFilterHeader, { "$theme": gridTheme, children: "Text Filter" }), _jsx(SetFilterSearch, { "$theme": gridTheme, children: _jsx("input", { type: "text", placeholder: "Search...", autoFocus: true }) }), _jsxs(SetFilterList, { "$theme": gridTheme, children: [_jsxs(SetFilterItem, { "$theme": gridTheme, "$selectAll": true, children: [_jsx("input", { type: "checkbox", checked: isAllSelected, onChange: () => toggleSetFilterSelectAll(field) }), "(Select All)"] }), uniqueValues.map((value) => (_jsxs(SetFilterItem, { "$theme": gridTheme, children: [_jsx("input", { type: "checkbox", checked: selectedValues.has(value), onChange: () => toggleSetFilterValue(field, value) }), value] }, value)))] }), _jsxs(SetFilterActions, { "$theme": gridTheme, children: [_jsx(SetFilterButton, { "$theme": gridTheme, onClick: () => {
996
+ toggleSetFilterSelectAll(field);
997
+ }, children: "Reset" }), _jsx(SetFilterButton, { "$theme": gridTheme, "$primary": true, onClick: () => {
998
+ hideFilterDropdown();
999
+ }, children: "Apply" })] })] }));
1000
+ };
1001
+ // ============================================================================
1002
+ // Render Side Panel
1003
+ // ============================================================================
1004
+ const renderSidePanel = () => {
1005
+ if (props.sideBar === false)
1006
+ return null;
1007
+ return (_jsxs(SidePanel, { "$theme": gridTheme, "$open": isSidePanelOpen, children: [_jsx(SidePanelTabs, { "$theme": gridTheme, "$collapsed": !isSidePanelOpen, children: isSidePanelOpen ? (_jsxs(_Fragment, { children: [_jsxs(SidePanelTab, { "$theme": gridTheme, "$active": sidePanelTab === 'columns', onClick: () => switchSidePanelTab('columns'), children: [_jsx(ColumnsIcon, {}), "Columns"] }), _jsxs(SidePanelTab, { "$theme": gridTheme, "$active": sidePanelTab === 'filters', onClick: () => switchSidePanelTab('filters'), children: [_jsx(FilterIcon, {}), "Filters"] })] })) : (_jsxs(_Fragment, { children: [_jsx(SidePanelTab, { "$theme": gridTheme, "$collapsed": true, "$active": sidePanelTab === 'columns', onClick: () => { setSidePanelOpen(true); switchSidePanelTab('columns'); }, title: "Columns", children: _jsx(ColumnsIcon, {}) }), _jsx(SidePanelTab, { "$theme": gridTheme, "$collapsed": true, "$active": sidePanelTab === 'filters', onClick: () => { setSidePanelOpen(true); switchSidePanelTab('filters'); }, title: "Filters", children: _jsx(FilterIcon, {}) })] })) }), isSidePanelOpen && (_jsxs(SidePanelContent, { "$theme": gridTheme, children: [sidePanelTab === 'columns' && (_jsxs(_Fragment, { children: [_jsxs(PivotModeToggle, { "$theme": gridTheme, children: [_jsx(PivotModeLabel, { "$theme": gridTheme, children: "Pivot Mode" }), _jsxs(ToggleSwitch, { "$theme": gridTheme, children: [_jsx("input", { type: "checkbox", checked: isPivotMode, onChange: togglePivotMode }), _jsx("span", {})] })] }), _jsx(SidePanelSearch, { "$theme": gridTheme, children: _jsx("input", { type: "text", placeholder: "Search..." }) }), _jsxs(SidePanelSection, { "$theme": gridTheme, children: [_jsxs(SidePanelSectionHeader, { "$theme": gridTheme, children: [_jsx(ColumnsIcon, {}), "Columns"] }), processedColumns.map((col) => {
1008
+ const colId = col.colId;
1009
+ const isVisible = !col.hide;
1010
+ const isDragging = draggedColumnId === colId;
1011
+ const isDragOver = dragOverColumnId === colId;
1012
+ return (_jsxs(SidePanelColumnItem, { "$theme": gridTheme, "$dragging": isDragging, "$selected": isDragOver, draggable: true, onDragStart: (e) => handleColumnDragStart(e, colId), onDragOver: (e) => handleColumnDragOver(e, colId), onDragLeave: handleColumnDragLeave, onDrop: (e) => handleColumnDrop(e, colId), onDragEnd: handleColumnDragEnd, children: [_jsx(SidePanelDragHandle, { "$theme": gridTheme, children: _jsx(GripIcon, {}) }), _jsx(Checkbox, { type: "checkbox", "$theme": gridTheme, checked: isVisible, onChange: (e) => {
1013
+ // Toggle visibility: if checked, show (visible=true); if unchecked, hide (visible=false)
1014
+ setColumnVisible(colId, e.target.checked);
1015
+ } }), _jsx(SidePanelGroupLabel, { children: col.headerName || col.field })] }, colId));
1016
+ })] }), _jsxs(SidePanelSection, { "$theme": gridTheme, children: [_jsxs(SidePanelSectionHeader, { "$theme": gridTheme, children: [_jsx(GroupIcon, {}), "Row Groups"] }), _jsx(RowGroupsZone, { "$theme": gridTheme, "$hasItems": rowGroupColumns.length > 0, children: rowGroupColumns.length === 0 ? (_jsxs(RowGroupsLabel, { "$theme": gridTheme, children: [_jsx(GroupIcon, {}), "Drag here to set row groups"] })) : (groupedColumnsInfo.map(({ field, headerName }) => (_jsxs(RowGroupChip, { "$theme": gridTheme, children: [headerName, _jsx("button", { onClick: () => removeRowGroupColumn(field), children: _jsx(CloseIcon, {}) })] }, field)))) })] }), _jsxs(SidePanelSection, { "$theme": gridTheme, children: [_jsxs(SidePanelSectionHeader, { "$theme": gridTheme, children: [_jsx(SigmaIcon, {}), "Values"] }), _jsx(ValuesPanel, { "$theme": gridTheme, children: valueColumns.length === 0 ? (_jsx(RowGroupsZone, { "$theme": gridTheme, "$hasItems": false, children: _jsxs(RowGroupsLabel, { "$theme": gridTheme, children: [_jsx(SigmaIcon, {}), "Drag here to aggregate"] }) })) : (valueColumns.map(({ field, aggFunc, displayName }) => (_jsxs(ValueItem, { "$theme": gridTheme, children: [_jsxs(ValueItemLabel, { "$theme": gridTheme, children: [_jsx(SidePanelDragHandle, { "$theme": gridTheme, children: _jsx(GripIcon, {}) }), aggFunc, "(", displayName, ")"] }), _jsx(ValueItemRemove, { "$theme": gridTheme, onClick: () => removeValueColumn(field, aggFunc), children: _jsx(CloseIcon, {}) })] }, `${aggFunc}-${field}`)))) })] })] })), sidePanelTab === 'filters' && (_jsxs(_Fragment, { children: [_jsx(SidePanelSearch, { "$theme": gridTheme, children: _jsx("input", { type: "text", placeholder: "Search..." }) }), flatColumns
1017
+ .filter((col) => col.filter && col.field)
1018
+ .map((col) => {
1019
+ const field = col.field;
1020
+ const isExpanded = expandedFilterPanels.has(field);
1021
+ const hasFilter = isFilterActive(field) || isSetFilterActive(field);
1022
+ const uniqueValues = getUniqueValuesForField(field);
1023
+ const selectedValues = setFilterStates[field] || new Set(uniqueValues);
1024
+ return (_jsxs(FilterPanelColumn, { "$theme": gridTheme, children: [_jsxs(FilterPanelHeader, { "$theme": gridTheme, "$expanded": isExpanded, "$hasFilter": hasFilter, onClick: () => toggleFilterPanel(field), children: [_jsx(ChevronRightIcon, {}), col.headerName || col.field, hasFilter && _jsx(FilterIcon, {})] }), isExpanded && (_jsx(FilterPanelContent, { "$theme": gridTheme, "$expanded": isExpanded, children: _jsxs(SetFilterList, { "$theme": gridTheme, style: { maxHeight: 200, marginBottom: 8 }, children: [_jsxs(SetFilterItem, { "$theme": gridTheme, "$selectAll": true, children: [_jsx("input", { type: "checkbox", checked: selectedValues.size === uniqueValues.length, onChange: () => toggleSetFilterSelectAll(field) }), "(Select All)"] }), uniqueValues.slice(0, 20).map((value) => (_jsxs(SetFilterItem, { "$theme": gridTheme, children: [_jsx("input", { type: "checkbox", checked: selectedValues.has(value), onChange: () => toggleSetFilterValue(field, value) }), value] }, value))), uniqueValues.length > 20 && (_jsx(SetFilterItem, { "$theme": gridTheme, children: _jsxs("span", { style: { opacity: 0.6, fontSize: 12 }, children: ["...and ", uniqueValues.length - 20, " more"] }) }))] }) }))] }, col.colId));
1025
+ })] }))] }))] }));
1026
+ };
1027
+ // ============================================================================
1028
+ // Main Render
1029
+ // ============================================================================
1030
+ // Close menus on outside click
1031
+ useEffect(() => {
1032
+ const handleClickOutside = () => {
1033
+ if (columnMenuState.visible)
1034
+ hideColumnMenu();
1035
+ if (filterDropdownState.visible)
1036
+ hideFilterDropdown();
1037
+ };
1038
+ document.addEventListener('click', handleClickOutside);
1039
+ return () => document.removeEventListener('click', handleClickOutside);
1040
+ }, [columnMenuState.visible, filterDropdownState.visible, hideColumnMenu, hideFilterDropdown]);
1041
+ return (_jsxs(GridRoot, { ref: containerRef, "$theme": gridTheme, "$responsive": responsive, style: containerStyle, className: containerClassName, onKeyDown: handleKeyDown, tabIndex: 0, dir: enableRtl ? 'rtl' : 'ltr', children: [_jsxs(GridToolbar, { "$theme": gridTheme, children: [_jsxs(ToolbarGroup, { children: [_jsxs(QuickFilter, { "$theme": gridTheme, children: [_jsx(SearchIcon, {}), _jsx("input", { type: "text", placeholder: "Search...", value: quickFilterText, onChange: (e) => {
1042
+ setQuickFilterText(e.target.value);
1043
+ onFilterChanged?.({
1044
+ type: 'filterChanged',
1045
+ api: gridApi,
1046
+ columnApi,
1047
+ context,
1048
+ });
1049
+ } })] }), (hasActiveFilters || hasActiveSetFilters) && (_jsxs(ToolbarButton, { "$theme": gridTheme, onClick: clearAllFilters, children: [_jsx(CloseIcon, {}), "Clear Filters"] }))] }), _jsxs(ToolbarGroup, { children: [!suppressCsvExport && (_jsxs(ToolbarButton, { "$theme": gridTheme, onClick: () => exportToCsv(processedData, visibleColumns, 'export.csv'), children: [_jsx(DownloadIcon, {}), "Export"] })), _jsxs(ToolbarButton, { "$theme": gridTheme, onClick: resetColumnState, children: [_jsx(RefreshIcon, {}), "Reset"] }), props.sideBar !== false && (_jsx(ToolbarButton, { "$theme": gridTheme, "$active": isSidePanelOpen, onClick: toggleSidePanel, children: _jsx(PanelRightIcon, {}) }))] })] }), props.rowGroupPanelShow !== 'never' && rowGroupColumns.length > 0 && (_jsxs(RowGroupsZone, { "$theme": gridTheme, "$hasItems": true, children: [_jsx(RowGroupsLabel, { "$theme": gridTheme, children: _jsx(GroupIcon, {}) }), groupedColumnsInfo.map(({ field, headerName }) => (_jsxs(RowGroupChip, { "$theme": gridTheme, children: [headerName, _jsx("button", { onClick: () => removeRowGroupColumn(field), children: _jsx(CloseIcon, {}) })] }, field)))] })), selectedRows.length > 0 && (_jsxs(SelectionBar, { "$theme": gridTheme, "$visible": selectedRows.length > 0, children: [_jsxs("span", { children: [selectedRows.length, " row", selectedRows.length !== 1 ? 's' : '', " selected"] }), _jsx(SelectionActions, { children: _jsxs(ToolbarButton, { "$theme": gridTheme, style: { background: 'transparent', border: 'none', color: 'white' }, onClick: deselectAll, children: [_jsx(CloseIcon, {}), "Clear"] }) })] })), _jsxs(GridLayout, { children: [_jsxs(GridMainArea, { children: [_jsx(GridWrapper, { children: _jsxs(TableContainer, { "$stickyHeader": true, "$maxHeight": domLayout === 'autoHeight' ? undefined : 'calc(100% - 100px)', children: [responsive && isMobile ? (displayData.length === 0 ? renderEmptyState() : renderMobileCards()) : (
1050
+ /* Desktop Table View */
1051
+ _jsxs(_Fragment, { children: [displayData.length === 0 && !isLoading && renderEmptyState(), displayData.length > 0 && (_jsxs(StyledTable, { ref: tableRef, "$theme": gridTheme, "$fixedLayout": true, children: [_jsxs(TableHead, { "$theme": gridTheme, "$sticky": true, children: [renderColumnGroups(), renderHeader(), renderFloatingFilters()] }), _jsx(TableBody, { "$theme": gridTheme, children: displayData.map((row, i) => renderRow(row, startRow + i)) })] }))] })), isLoading && renderLoadingState()] }) }), renderPagination(), statusBar && (_jsxs(StatusBar, { "$theme": gridTheme, children: [_jsxs(StatusItem, { children: [_jsx("strong", { children: "Rows:" }), " ", processedData.length] }), _jsxs(StatusItem, { children: [_jsx("strong", { children: "Selected:" }), " ", selectedRows.length] })] }))] }), renderSidePanel()] }), renderContextMenu(), renderColumnMenuPopup(), renderSetFilterDropdown()] }));
1052
+ }
1053
+ // ============================================================================
1054
+ // Exported Component with ForwardRef
1055
+ // ============================================================================
1056
+ export const AgGrid = forwardRef(AgGridInner);
1057
+ export default AgGrid;