react-restyle-components 0.4.39 → 0.4.41

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 (243) 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.js +334 -1
  18. 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
  19. 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
  20. 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
  21. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-single-select/auto-complete-filter-single-select.component.js +55 -1
  22. 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
  23. package/lib/src/core-components/src/components/AutoComplete/auto-complete-group-by/auto-complete-group-by.component.js +115 -1
  24. package/lib/src/core-components/src/components/AutoComplete/autocomplete/autocomplete.js +442 -2
  25. package/lib/src/core-components/src/components/AutoComplete/index.js +8 -1
  26. package/lib/src/core-components/src/components/Avatar/Avatar.js +148 -14
  27. package/lib/src/core-components/src/components/Badge/Badge.js +25 -2
  28. package/lib/src/core-components/src/components/Badge/InnerBadge/Inline.js +25 -1
  29. package/lib/src/core-components/src/components/Badge/InnerBadge/InnerBadge.js +25 -1
  30. package/lib/src/core-components/src/components/Badge/InnerBadge/elements.js +78 -32
  31. package/lib/src/core-components/src/components/Badge/InnerBadge/index.js +1 -1
  32. package/lib/src/core-components/src/components/Badge/index.js +1 -1
  33. package/lib/src/core-components/src/components/Badge/types.js +5 -1
  34. package/lib/src/core-components/src/components/Breadcrumb/Breadcrumb.js +83 -1
  35. package/lib/src/core-components/src/components/Breadcrumb/elements.js +166 -94
  36. package/lib/src/core-components/src/components/Breadcrumb/index.js +3 -1
  37. package/lib/src/core-components/src/components/Breadcrumb/types.js +3 -1
  38. package/lib/src/core-components/src/components/Button/button.component.js +18 -1
  39. package/lib/src/core-components/src/components/Button/buttonGroup/buttonGroup.component.js +4 -1
  40. package/lib/src/core-components/src/components/Button/index.js +2 -1
  41. package/lib/src/core-components/src/components/Button/types.js +1 -1
  42. package/lib/src/core-components/src/components/Chip/Chip.js +64 -1
  43. package/lib/src/core-components/src/components/Chip/elements.js +148 -48
  44. package/lib/src/core-components/src/components/Chip/index.js +2 -1
  45. package/lib/src/core-components/src/components/Chip/types.js +4 -1
  46. package/lib/src/core-components/src/components/Divider/Divider.js +25 -1
  47. package/lib/src/core-components/src/components/Divider/elements.js +68 -31
  48. package/lib/src/core-components/src/components/Divider/index.js +2 -1
  49. package/lib/src/core-components/src/components/Divider/types.js +4 -1
  50. package/lib/src/core-components/src/components/DynamicGrid/DynamicGrid.js +147 -1
  51. package/lib/src/core-components/src/components/DynamicGrid/GridContainer.js +24 -17
  52. package/lib/src/core-components/src/components/DynamicGrid/elements.js +162 -100
  53. package/lib/src/core-components/src/components/DynamicGrid/index.js +3 -1
  54. package/lib/src/core-components/src/components/DynamicGrid/types.js +28 -1
  55. package/lib/src/core-components/src/components/DynamicGrid/utils.js +193 -1
  56. package/lib/src/core-components/src/components/FormField/FormField.js +103 -1
  57. package/lib/src/core-components/src/components/FormField/components/CheckboxGroupInput.js +37 -1
  58. package/lib/src/core-components/src/components/FormField/components/CheckboxInput.js +8 -1
  59. package/lib/src/core-components/src/components/FormField/components/CssMultilineInput.js +192 -1
  60. package/lib/src/core-components/src/components/FormField/components/DatePickerInput.js +99 -1
  61. package/lib/src/core-components/src/components/FormField/components/DropdownInput.js +70 -1
  62. package/lib/src/core-components/src/components/FormField/components/OtpInput.js +81 -1
  63. package/lib/src/core-components/src/components/FormField/components/PasswordInput.js +40 -1
  64. package/lib/src/core-components/src/components/FormField/components/PinInput.js +75 -1
  65. package/lib/src/core-components/src/components/FormField/components/RadioInput.js +54 -1
  66. package/lib/src/core-components/src/components/FormField/components/TextDropdownInput.js +94 -1
  67. package/lib/src/core-components/src/components/FormField/components/ToggleInput.js +36 -1
  68. package/lib/src/core-components/src/components/FormField/components/index.js +11 -1
  69. package/lib/src/core-components/src/components/FormField/css-properties.js +161 -1
  70. package/lib/src/core-components/src/components/FormField/index.js +2 -1
  71. package/lib/src/core-components/src/components/Icon/Icon.js +79 -1
  72. package/lib/src/core-components/src/components/Icon/index.js +2 -1
  73. package/lib/src/core-components/src/components/Icon/types.js +9 -1
  74. package/lib/src/core-components/src/components/Loader/loader.component.js +215 -2
  75. package/lib/src/core-components/src/components/Masonry/Masonry.js +73 -1
  76. package/lib/src/core-components/src/components/Masonry/elements.js +46 -29
  77. package/lib/src/core-components/src/components/Masonry/hooks.js +100 -1
  78. package/lib/src/core-components/src/components/Masonry/index.js +3 -1
  79. package/lib/src/core-components/src/components/Masonry/types.js +1 -1
  80. package/lib/src/core-components/src/components/Modal/BasicModal/modal.component.js +116 -1
  81. package/lib/src/core-components/src/components/Modal/index.js +2 -1
  82. package/lib/src/core-components/src/components/Modal/modal-confirm/modal-confirm.component.js +147 -1
  83. package/lib/src/core-components/src/components/Picker/color-picker/color-picker.component.js +12 -1
  84. package/lib/src/core-components/src/components/Picker/color-picker-modal/color-picker-modal.component.js +40 -1
  85. package/lib/src/core-components/src/components/Picker/index.js +2 -1
  86. package/lib/src/core-components/src/components/Selection/index.js +4 -1
  87. package/lib/src/core-components/src/components/Selection/multi-select/multi-select.component.js +49 -1
  88. package/lib/src/core-components/src/components/Selection/multi-select-with-field/multi-select-with-field.component.js +58 -1
  89. package/lib/src/core-components/src/components/Selection/multi-selection-dropdown/multi-selection-dropdown.component.js +43 -1
  90. package/lib/src/core-components/src/components/Selection/single-select/single-select.component.js +87 -1
  91. package/lib/src/core-components/src/components/Skeleton/Skeleton.js +51 -1
  92. package/lib/src/core-components/src/components/Skeleton/elements.js +143 -54
  93. package/lib/src/core-components/src/components/Skeleton/index.js +2 -1
  94. package/lib/src/core-components/src/components/Skeleton/types.js +4 -1
  95. package/lib/src/core-components/src/components/SpeedDial/SpeedDial.js +128 -1
  96. package/lib/src/core-components/src/components/SpeedDial/elements.js +132 -62
  97. package/lib/src/core-components/src/components/SpeedDial/index.js +2 -1
  98. package/lib/src/core-components/src/components/SpeedDial/types.js +3 -1
  99. package/lib/src/core-components/src/components/Stepper2/stepper.component.js +139 -1
  100. package/lib/src/core-components/src/components/Switch/Switch.js +26 -1
  101. package/lib/src/core-components/src/components/Switch/elements.js +103 -34
  102. package/lib/src/core-components/src/components/Switch/index.js +2 -1
  103. package/lib/src/core-components/src/components/Switch/types.js +3 -1
  104. package/lib/src/core-components/src/components/Table/Table.js +1357 -1
  105. package/lib/src/core-components/src/components/Table/columnReorder.d.ts +128 -0
  106. package/lib/src/core-components/src/components/Table/columnReorder.js +530 -0
  107. package/lib/src/core-components/src/components/Table/columnResize.d.ts +99 -0
  108. package/lib/src/core-components/src/components/Table/columnResize.js +399 -0
  109. package/lib/src/core-components/src/components/Table/elements.d.ts +9 -1
  110. package/lib/src/core-components/src/components/Table/elements.js +324 -155
  111. package/lib/src/core-components/src/components/Table/filters.js +555 -30
  112. package/lib/src/core-components/src/components/Table/hooks.js +536 -2
  113. package/lib/src/core-components/src/components/Table/index.d.ts +4 -0
  114. package/lib/src/core-components/src/components/Table/index.js +6 -1
  115. package/lib/src/core-components/src/components/Table/types.d.ts +58 -0
  116. package/lib/src/core-components/src/components/Table/types.js +1 -1
  117. package/lib/src/core-components/src/components/Tabs/tabs.component.js +22 -1
  118. package/lib/src/core-components/src/components/Tags1/Tags.component.js +118 -1
  119. package/lib/src/core-components/src/components/Tags1/types.js +20 -1
  120. package/lib/src/core-components/src/components/Timer1/timer.component.js +76 -1
  121. package/lib/src/core-components/src/components/Toast/Toast.js +50 -1
  122. package/lib/src/core-components/src/components/Toast/elements.js +122 -41
  123. package/lib/src/core-components/src/components/Toast/index.js +2 -1
  124. package/lib/src/core-components/src/components/Toast/types.js +9 -1
  125. package/lib/src/core-components/src/components/Tooltip/Tooltip.js +200 -1
  126. package/lib/src/core-components/src/components/Tooltip/elements.js +117 -55
  127. package/lib/src/core-components/src/components/Tooltip/index.js +2 -1
  128. package/lib/src/core-components/src/components/Tooltip/types.js +17 -1
  129. package/lib/src/core-components/src/components/Tooltip/utils.js +140 -1
  130. package/lib/src/core-components/src/components/TreeSelect/TreeSelect.js +303 -1
  131. package/lib/src/core-components/src/components/TreeSelect/elements.js +216 -117
  132. package/lib/src/core-components/src/components/TreeSelect/hooks.js +252 -1
  133. package/lib/src/core-components/src/components/TreeSelect/index.js +3 -1
  134. package/lib/src/core-components/src/components/TreeSelect/types.js +1 -1
  135. package/lib/src/core-components/src/components/ag-grid/AgGrid.d.ts +11 -0
  136. package/lib/src/core-components/src/components/ag-grid/AgGrid.js +733 -0
  137. package/lib/src/core-components/src/components/ag-grid/elements.d.ts +246 -0
  138. package/lib/src/core-components/src/components/ag-grid/elements.js +1156 -0
  139. package/lib/src/core-components/src/components/ag-grid/hooks.d.ts +196 -0
  140. package/lib/src/core-components/src/components/ag-grid/hooks.js +943 -0
  141. package/lib/src/core-components/src/components/ag-grid/index.d.ts +9 -0
  142. package/lib/src/core-components/src/components/ag-grid/index.js +13 -0
  143. package/lib/src/core-components/src/components/ag-grid/types.d.ts +1367 -0
  144. package/lib/src/core-components/src/components/ag-grid/types.js +6 -0
  145. package/lib/src/core-components/src/components/index.d.ts +1 -0
  146. package/lib/src/core-components/src/components/index.js +31 -1
  147. package/lib/src/core-components/src/components/pdf/pdf-images.components.js +7 -1
  148. package/lib/src/core-components/src/components/pdf/pdf-table.components.js +48 -5
  149. package/lib/src/core-components/src/components/pdf/pdf-typography.components.js +70 -1
  150. package/lib/src/core-components/src/components/pdf/pdf-wrapped-view.components.js +50 -1
  151. package/lib/src/core-components/src/core-components/Avatar.js +33 -4
  152. package/lib/src/core-components/src/core-components/CoreButton/CoreButton.js +10 -1
  153. package/lib/src/core-components/src/core-components/CoreButton/elements.js +176 -67
  154. package/lib/src/core-components/src/core-components/CoreButton/index.js +3 -1
  155. package/lib/src/core-components/src/core-components/CoreButton/types.js +6 -1
  156. package/lib/src/core-components/src/core-components/CoreButton/utils.js +12 -1
  157. package/lib/src/core-components/src/core-components/Divider/Divider.js +19 -4
  158. package/lib/src/core-components/src/core-components/Divider/index.js +1 -1
  159. package/lib/src/core-components/src/core-components/SelectionCardStrip/index.js +1 -1
  160. package/lib/src/core-components/src/core-components/SelectionCardStrip/selectionCardStrip.js +33 -10
  161. package/lib/src/core-components/src/core-components/StateLayer.js +5 -3
  162. package/lib/src/core-components/src/core-components/ToggleCore/elements.js +50 -25
  163. package/lib/src/core-components/src/core-components/ToggleCore/index.js +2 -1
  164. package/lib/src/core-components/src/core-components/ToggleCore/toggleCore.js +14 -1
  165. package/lib/src/core-components/src/core-components/atoms/Input/Input.js +22 -1
  166. package/lib/src/core-components/src/core-components/atoms/Label/Label.js +21 -1
  167. package/lib/src/core-components/src/core-components/atoms/Textarea/Textarea.js +19 -1
  168. package/lib/src/core-components/src/core-components/index.js +3 -1
  169. package/lib/src/core-components/src/helpers/constants.js +11 -1
  170. package/lib/src/core-components/src/hooks/index.js +1 -1
  171. package/lib/src/core-components/src/hooks/outside.hook.js +28 -1
  172. package/lib/src/core-components/src/index.js +12 -1
  173. package/lib/src/core-components/src/tc.global.css +16 -3
  174. package/lib/src/core-components/src/tc.module.css +2 -2
  175. package/lib/src/core-components/src/utils/abstracts/breakpoints/index.js +28 -1
  176. package/lib/src/core-components/src/utils/abstracts/colors/index.js +49 -1
  177. package/lib/src/core-components/src/utils/abstracts/index.js +5 -1
  178. package/lib/src/core-components/src/utils/abstracts/space/index.js +26 -1
  179. package/lib/src/core-components/src/utils/abstracts/theme/ThemeBoundary.js +8 -1
  180. package/lib/src/core-components/src/utils/abstracts/theme/default-themes.js +30 -1
  181. package/lib/src/core-components/src/utils/abstracts/theme/index.js +3 -1
  182. package/lib/src/core-components/src/utils/abstracts/theme/theme.js +30 -1
  183. package/lib/src/core-components/src/utils/abstracts/theme/types.js +1 -1
  184. package/lib/src/core-components/src/utils/abstracts/theme/useTheme.js +17 -1
  185. package/lib/src/core-components/src/utils/abstracts/typography/index.js +25 -1
  186. package/lib/src/core-components/src/utils/context/DefaultsProvider.js +8 -1
  187. package/lib/src/core-components/src/utils/context/InternalProvider.js +24 -1
  188. package/lib/src/core-components/src/utils/context/index.js +2 -1
  189. package/lib/src/core-components/src/utils/designTokens.js +125 -1
  190. package/lib/src/core-components/src/utils/helpers/attachSubComponents.js +23 -1
  191. package/lib/src/core-components/src/utils/helpers/flattenChildren.js +11 -1
  192. package/lib/src/core-components/src/utils/helpers/getChildByType.js +3 -1
  193. package/lib/src/core-components/src/utils/helpers/index.js +5 -1
  194. package/lib/src/core-components/src/utils/helpers/isComponentType.js +16 -1
  195. package/lib/src/core-components/src/utils/helpers/separateChildrenByType.js +12 -1
  196. package/lib/src/core-components/src/utils/hooks/index.js +18 -1
  197. package/lib/src/core-components/src/utils/hooks/useClickOutside.js +18 -1
  198. package/lib/src/core-components/src/utils/hooks/useCombinedRefs.js +17 -1
  199. package/lib/src/core-components/src/utils/hooks/useDebouncedCallback.js +12 -1
  200. package/lib/src/core-components/src/utils/hooks/useDebouncedValue.js +20 -1
  201. package/lib/src/core-components/src/utils/hooks/useDeprecation.js +40 -1
  202. package/lib/src/core-components/src/utils/hooks/useDeviceDetect.js +10 -1
  203. package/lib/src/core-components/src/utils/hooks/useDeviceForm.js +24 -1
  204. package/lib/src/core-components/src/utils/hooks/useDisableBodyScroll.js +16 -1
  205. package/lib/src/core-components/src/utils/hooks/useHoverState.js +36 -1
  206. package/lib/src/core-components/src/utils/hooks/useId.js +7 -1
  207. package/lib/src/core-components/src/utils/hooks/useIsBrowser.js +11 -1
  208. package/lib/src/core-components/src/utils/hooks/useMediaQuery.js +16 -1
  209. package/lib/src/core-components/src/utils/hooks/useOverflow.js +22 -1
  210. package/lib/src/core-components/src/utils/hooks/useSafeLayoutEffect.js +5 -1
  211. package/lib/src/core-components/src/utils/hooks/useScrollingUp.js +18 -1
  212. package/lib/src/core-components/src/utils/hooks/useTrapFocus.js +30 -1
  213. package/lib/src/core-components/src/utils/hooks/useWindowDimensions.js +23 -1
  214. package/lib/src/core-components/src/utils/index.js +9 -1
  215. package/lib/src/core-components/src/utils/stories/Wrappers.js +23 -8
  216. package/lib/src/core-components/src/utils/stories/cleanProps.js +5 -1
  217. package/lib/src/core-components/src/utils/stories/index.js +4 -1
  218. package/lib/src/core-components/src/utils/stories/sleep.js +4 -1
  219. package/lib/src/core-components/src/utils/stories/view-ports.js +50 -1
  220. package/lib/src/core-components/src/utils/styling/calcWidthOfColumns.js +5 -1
  221. package/lib/src/core-components/src/utils/styling/createGridContainer.js +12 -6
  222. package/lib/src/core-components/src/utils/styling/createTransition.js +7 -2
  223. package/lib/src/core-components/src/utils/styling/forwardProps.js +10 -1
  224. package/lib/src/core-components/src/utils/styling/index.js +5 -1
  225. package/lib/src/core-components/src/utils/styling/pxToRem.js +6 -1
  226. package/lib/src/core-components/src/utils/testing/getComputedStyle.js +3 -1
  227. package/lib/src/core-components/src/utils/testing/index.js +1 -1
  228. package/lib/src/core-components/src/utils/utility.util.js +14 -1
  229. package/lib/src/core-components/tailwind.config.js +233 -1
  230. package/lib/src/core-hooks/index.js +3 -1
  231. package/lib/src/core-hooks/src/useClickOutside/useClickOutside.hook.js +46 -1
  232. package/lib/src/core-hooks/src/useDebounce/useDebounce.hook.js +30 -1
  233. package/lib/src/core-hooks/src/usePreventEKey/usePreventEKey.hook.js +8 -1
  234. package/lib/src/core-utils/index.js +7 -1
  235. package/lib/src/core-utils/src/calculation/calculation.util.js +89 -1
  236. package/lib/src/core-utils/src/colors/color.util.js +15 -1
  237. package/lib/src/core-utils/src/convert/numberToWords/numToWords.util.js +145 -1
  238. package/lib/src/core-utils/src/convert/typography/camelCaseToTitleCase.util.js +5 -1
  239. package/lib/src/core-utils/src/form-helper/form-helper.util.js +82 -1
  240. package/lib/src/core-utils/src/index.js +7 -1
  241. package/lib/src/core-utils/src/utility/utility.util.js +12 -1
  242. package/lib/src/core-utils/src/uuid/uuid.util.js +8 -1
  243. package/package.json +1 -1
@@ -0,0 +1,733 @@
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, } from './elements';
10
+ import { useSorting, useFiltering, usePagination, useRowSelection, useRowExpansion, useColumnState, useCellEditing, useContextMenu, useResponsive, useClipboard, getNestedValue, createRowNode, exportToCsv, } from './hooks';
11
+ // ============================================================================
12
+ // Icons
13
+ // ============================================================================
14
+ 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" })] }));
15
+ const SortAscIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", children: _jsx("path", { d: "M7 14l5-5 5 5H7z" }) }));
16
+ const SortDescIcon = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", children: _jsx("path", { d: "M7 10l5 5 5-5H7z" }) }));
17
+ 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" }) }));
18
+ 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" }) }));
19
+ 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" }) }));
20
+ 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" }) }));
21
+ 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" }) }));
22
+ 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" }) }));
23
+ 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" })] }));
24
+ 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" })] }));
25
+ 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" })] }));
26
+ 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" })] }));
27
+ 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" })] }));
28
+ 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" }) }));
29
+ // ============================================================================
30
+ // Helper Functions
31
+ // ============================================================================
32
+ function isColGroupDef(col) {
33
+ return 'children' in col;
34
+ }
35
+ function flattenColumnDefs(columns) {
36
+ const result = [];
37
+ columns.forEach((col) => {
38
+ if (isColGroupDef(col)) {
39
+ result.push(...flattenColumnDefs(col.children));
40
+ }
41
+ else {
42
+ result.push(col);
43
+ }
44
+ });
45
+ return result;
46
+ }
47
+ // ============================================================================
48
+ // Main Component
49
+ // ============================================================================
50
+ function AgGridInner(props, ref) {
51
+ const {
52
+ // Data
53
+ rowData, columnDefs, defaultColDef, getRowId = (params) => String(params.data._id ?? params.data.id ?? Math.random()),
54
+ // Theme
55
+ theme = 'quartz', customTheme, rowHeight = 42, headerHeight = 42, floatingFiltersHeight = 32, domLayout = 'normal',
56
+ // Selection
57
+ rowSelection, rowMultiSelectWithClick = false, suppressRowClickSelection = false, isRowSelectable,
58
+ // Sorting
59
+ sortable = true, suppressMultiSort = false, alwaysMultiSort = false,
60
+ // Filtering
61
+ filter = true, floatingFilter = false, quickFilterText: controlledQuickFilter,
62
+ // Pagination
63
+ pagination = false, paginationPageSize = 10, paginationPageSizeSelector = [10, 25, 50, 100], suppressPaginationPanel = false,
64
+ // Editing
65
+ singleClickEdit = false, stopEditingWhenCellsLoseFocus = true, undoRedoCellEditing = false,
66
+ // Row Grouping
67
+ groupDefaultExpanded = 0,
68
+ // Master/Detail
69
+ masterDetail = false, detailCellRenderer, isRowMaster,
70
+ // Row Dragging
71
+ rowDragManaged = false,
72
+ // Overlays
73
+ loadingOverlayComponent, noRowsOverlayComponent,
74
+ // Status Bar
75
+ statusBar,
76
+ // Clipboard
77
+ enableClipboard = true,
78
+ // Export
79
+ suppressCsvExport = false,
80
+ // Context Menu
81
+ getContextMenuItems, suppressContextMenu = false,
82
+ // Tooltips
83
+ enableBrowserTooltips = false,
84
+ // Responsive
85
+ responsive = true, mobileBreakpoint = 768, mobileCardRenderer,
86
+ // Misc
87
+ animateRows = true, enableRtl = false,
88
+ // Events
89
+ onGridReady, onCellClicked, onCellDoubleClicked, onCellValueChanged, onRowClicked, onRowDoubleClicked, onRowSelected, onSelectionChanged, onSortChanged, onFilterChanged, onPaginationChanged,
90
+ // Custom props
91
+ containerStyle, containerClassName, context, gridId, } = props;
92
+ // ============================================================================
93
+ // Theme
94
+ // ============================================================================
95
+ const gridTheme = useMemo(() => getTheme(theme, customTheme), [theme, customTheme]);
96
+ // ============================================================================
97
+ // Flatten and process columns
98
+ // ============================================================================
99
+ const flatColumns = useMemo(() => {
100
+ const flat = flattenColumnDefs(columnDefs);
101
+ return flat.map((col) => ({
102
+ ...defaultColDef,
103
+ ...col,
104
+ colId: col.colId || col.field || `col-${Math.random()}`,
105
+ }));
106
+ }, [columnDefs, defaultColDef]);
107
+ // ============================================================================
108
+ // Column State (visibility, width, order, pinning)
109
+ // ============================================================================
110
+ const { columnState, processedColumns, visibleColumns, setColumnVisible, setColumnWidth, setColumnPinned, moveColumn, resetColumnState, } = useColumnState(flatColumns, gridId);
111
+ // ============================================================================
112
+ // Sorting
113
+ // ============================================================================
114
+ const { sortModel, handleSort, getSortForColumn, clearSort, sortData, } = useSorting([], !suppressMultiSort || alwaysMultiSort);
115
+ // ============================================================================
116
+ // Filtering
117
+ // ============================================================================
118
+ const { filterModel, quickFilterText, setQuickFilterText, setColumnFilter, clearFilters, isFilterActive, hasActiveFilters, filterData, } = useFiltering();
119
+ // Sync controlled quick filter
120
+ useEffect(() => {
121
+ if (controlledQuickFilter !== undefined) {
122
+ setQuickFilterText(controlledQuickFilter);
123
+ }
124
+ }, [controlledQuickFilter, setQuickFilterText]);
125
+ // ============================================================================
126
+ // Processed Data (sort + filter)
127
+ // ============================================================================
128
+ const processedData = useMemo(() => {
129
+ let data = [...rowData];
130
+ data = filterData(data, visibleColumns);
131
+ data = sortData(data, visibleColumns);
132
+ return data;
133
+ }, [rowData, filterData, sortData, visibleColumns]);
134
+ // ============================================================================
135
+ // Pagination
136
+ // ============================================================================
137
+ const { currentPage, pageSize, totalPages, startRow, endRow, goToPage, goToNextPage, goToPreviousPage, goToFirstPage, goToLastPage, changePageSize, paginateData, } = usePagination(processedData.length, paginationPageSize);
138
+ const displayData = useMemo(() => {
139
+ if (!pagination)
140
+ return processedData;
141
+ return paginateData(processedData);
142
+ }, [processedData, pagination, paginateData]);
143
+ // ============================================================================
144
+ // Selection
145
+ // ============================================================================
146
+ const { selectedIds, isSelected, toggleRow, selectAll, deselectAll, isAllSelected, isIndeterminate, selectedRows, } = useRowSelection(displayData, (row) => getRowId({ data: row }), rowSelection || 'multiple', isRowSelectable);
147
+ // ============================================================================
148
+ // Expansion (for master/detail)
149
+ // ============================================================================
150
+ const { isExpanded, toggleExpand, expandAll, collapseAll, } = useRowExpansion((row) => getRowId({ data: row }), groupDefaultExpanded);
151
+ // ============================================================================
152
+ // Cell Editing
153
+ // ============================================================================
154
+ const { editingCell, startEditing, stopEditing, isEditing, } = useCellEditing();
155
+ const [editValue, setEditValue] = useState(null);
156
+ // ============================================================================
157
+ // Context Menu
158
+ // ============================================================================
159
+ const { contextMenu, showContextMenu, hideContextMenu } = useContextMenu();
160
+ // ============================================================================
161
+ // Clipboard
162
+ // ============================================================================
163
+ const { copyToClipboard } = useClipboard();
164
+ // ============================================================================
165
+ // Responsive
166
+ // ============================================================================
167
+ const { isMobile } = useResponsive(mobileBreakpoint);
168
+ // ============================================================================
169
+ // Refs
170
+ // ============================================================================
171
+ const containerRef = useRef(null);
172
+ const tableRef = useRef(null);
173
+ const [isLoading, setIsLoading] = useState(false);
174
+ // ============================================================================
175
+ // Column Resize State
176
+ // ============================================================================
177
+ const [resizing, setResizing] = useState(null);
178
+ const handleResizeStart = useCallback((e, colId, currentWidth) => {
179
+ e.preventDefault();
180
+ setResizing({ colId, startX: e.clientX, startWidth: currentWidth });
181
+ }, []);
182
+ useEffect(() => {
183
+ if (!resizing)
184
+ return;
185
+ const handleMouseMove = (e) => {
186
+ const delta = e.clientX - resizing.startX;
187
+ const newWidth = Math.max(50, resizing.startWidth + delta);
188
+ setColumnWidth(resizing.colId, newWidth);
189
+ };
190
+ const handleMouseUp = () => {
191
+ setResizing(null);
192
+ };
193
+ document.addEventListener('mousemove', handleMouseMove);
194
+ document.addEventListener('mouseup', handleMouseUp);
195
+ return () => {
196
+ document.removeEventListener('mousemove', handleMouseMove);
197
+ document.removeEventListener('mouseup', handleMouseUp);
198
+ };
199
+ }, [resizing, setColumnWidth]);
200
+ // ============================================================================
201
+ // Grid API
202
+ // ============================================================================
203
+ const gridApi = useMemo(() => ({
204
+ // Data
205
+ setRowData: () => { },
206
+ getRowData: () => rowData,
207
+ applyTransaction: () => { },
208
+ applyTransactionAsync: () => { },
209
+ refreshCells: () => { },
210
+ redrawRows: () => { },
211
+ // Row Nodes
212
+ getRowNode: (id) => displayData.find((row) => getRowId({ data: row }) === id),
213
+ forEachNode: (callback) => displayData.forEach((row, i) => callback(createRowNode(row, i), i)),
214
+ forEachLeafNode: (callback) => displayData.forEach((row, i) => callback(createRowNode(row, i), i)),
215
+ getDisplayedRowCount: () => displayData.length,
216
+ getDisplayedRowAtIndex: (index) => createRowNode(displayData[index], index),
217
+ getFirstDisplayedRow: () => startRow,
218
+ getLastDisplayedRow: () => endRow,
219
+ // Selection
220
+ selectAll,
221
+ deselectAll,
222
+ selectAllFiltered: selectAll,
223
+ deselectAllFiltered: deselectAll,
224
+ getSelectedRows: () => selectedRows,
225
+ getSelectedNodes: () => selectedRows.map((row, i) => createRowNode(row, i)),
226
+ // Sorting
227
+ getSortModel: () => sortModel,
228
+ setSortModel: () => { },
229
+ // Filtering
230
+ setFilterModel: () => { },
231
+ getFilterModel: () => filterModel,
232
+ setQuickFilter: setQuickFilterText,
233
+ isQuickFilterPresent: () => quickFilterText.length > 0,
234
+ isAnyFilterPresent: () => hasActiveFilters,
235
+ destroyFilter: () => { },
236
+ getFilterInstance: () => null,
237
+ onFilterChanged: () => { },
238
+ // Pagination
239
+ paginationGetPageSize: () => pageSize,
240
+ paginationSetPageSize: changePageSize,
241
+ paginationGetCurrentPage: () => currentPage,
242
+ paginationGetTotalPages: () => totalPages,
243
+ paginationGetRowCount: () => processedData.length,
244
+ paginationGoToPage: goToPage,
245
+ paginationGoToNextPage: goToNextPage,
246
+ paginationGoToPreviousPage: goToPreviousPage,
247
+ paginationGoToFirstPage: goToFirstPage,
248
+ paginationGoToLastPage: goToLastPage,
249
+ // Editing
250
+ startEditingCell: ({ rowIndex, colKey }) => {
251
+ const row = displayData[rowIndex];
252
+ if (row) {
253
+ const value = getNestedValue(row, colKey);
254
+ startEditing(getRowId({ data: row }), colKey, rowIndex, value);
255
+ }
256
+ },
257
+ stopEditing: (cancel) => stopEditing(cancel || false),
258
+ getEditingCells: () => editingCell ? [{ rowIndex: editingCell.rowIndex, column: {} }] : [],
259
+ // Export
260
+ exportDataAsCsv: (params) => {
261
+ exportToCsv(selectedRows.length > 0 && params?.onlySelected ? selectedRows : processedData, visibleColumns, params?.fileName || 'export.csv');
262
+ },
263
+ getDataAsCsv: () => '',
264
+ exportDataAsExcel: () => { },
265
+ // Clipboard
266
+ copySelectedRangeToClipboard: (includeHeaders) => copyToClipboard(selectedRows, visibleColumns, includeHeaders),
267
+ copySelectedRowsToClipboard: (includeHeaders) => copyToClipboard(selectedRows, visibleColumns, includeHeaders),
268
+ pasteFromClipboard: () => { },
269
+ // Scrolling
270
+ ensureIndexVisible: () => { },
271
+ ensureNodeVisible: () => { },
272
+ ensureColumnVisible: () => { },
273
+ getHorizontalScrollPosition: () => containerRef.current?.scrollLeft || 0,
274
+ getVerticalScrollPosition: () => containerRef.current?.scrollTop || 0,
275
+ // Row Height
276
+ resetRowHeights: () => { },
277
+ onRowHeightChanged: () => { },
278
+ // Display
279
+ sizeColumnsToFit: () => { },
280
+ autoSizeAllColumns: () => { },
281
+ autoSizeColumn: () => { },
282
+ // Grouping
283
+ expandAll: () => expandAll(displayData),
284
+ collapseAll,
285
+ setRowGroupColumns: () => { },
286
+ getRowGroupColumns: () => [],
287
+ // Events
288
+ addEventListener: () => { },
289
+ removeEventListener: () => { },
290
+ // Misc
291
+ destroy: () => { },
292
+ getContext: () => context,
293
+ setContext: () => { },
294
+ isDestroyed: () => false,
295
+ refreshHeader: () => { },
296
+ setHeaderHeight: () => { },
297
+ showLoadingOverlay: () => setIsLoading(true),
298
+ showNoRowsOverlay: () => { },
299
+ hideOverlay: () => setIsLoading(false),
300
+ getGridElement: () => containerRef.current,
301
+ }), [
302
+ rowData, displayData, getRowId, startRow, endRow, selectAll, deselectAll, selectedRows,
303
+ sortModel, filterModel, setQuickFilterText, quickFilterText, hasActiveFilters,
304
+ pageSize, changePageSize, currentPage, totalPages, processedData, goToPage,
305
+ goToNextPage, goToPreviousPage, goToFirstPage, goToLastPage, startEditing, stopEditing,
306
+ editingCell, visibleColumns, copyToClipboard, expandAll, collapseAll, context,
307
+ ]);
308
+ // ============================================================================
309
+ // Column API
310
+ // ============================================================================
311
+ const columnApi = useMemo(() => ({
312
+ 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: () => { } })),
313
+ getAllGridColumns: () => [],
314
+ getVisibleColumns: () => visibleColumns.map((col) => ({ colId: col.colId, colDef: col })),
315
+ getColumn: (colId) => processedColumns.find((c) => c.colId === colId),
316
+ setColumnVisible,
317
+ setColumnsVisible: (colIds, visible) => colIds.forEach((id) => setColumnVisible(String(id), visible)),
318
+ setColumnPinned,
319
+ setColumnsPinned: (colIds, pinned) => colIds.forEach((id) => setColumnPinned(String(id), pinned)),
320
+ moveColumn,
321
+ moveColumns: (colIds, toIndex) => colIds.forEach((id, i) => moveColumn(String(id), toIndex + i)),
322
+ getColumnState: () => columnState,
323
+ applyColumnState: () => true,
324
+ resetColumnState,
325
+ setColumnWidth,
326
+ setColumnsWidth: (colIds, width) => colIds.forEach((id) => setColumnWidth(String(id), width)),
327
+ autoSizeColumn: () => { },
328
+ autoSizeColumns: () => { },
329
+ sizeColumnsToFit: () => { },
330
+ isPinningLeft: () => visibleColumns.some((c) => c.pinned === 'left'),
331
+ isPinningRight: () => visibleColumns.some((c) => c.pinned === 'right'),
332
+ getDisplayNameForColumn: (column) => column.colDef.headerName || column.colDef.field || '',
333
+ }), [processedColumns, visibleColumns, columnState, setColumnVisible, setColumnPinned, moveColumn, resetColumnState, setColumnWidth, getSortForColumn]);
334
+ // ============================================================================
335
+ // Expose API via ref
336
+ // ============================================================================
337
+ useImperativeHandle(ref, () => ({ api: gridApi, columnApi }), [gridApi, columnApi]);
338
+ // ============================================================================
339
+ // Grid Ready Event
340
+ // ============================================================================
341
+ useEffect(() => {
342
+ onGridReady?.({
343
+ type: 'gridReady',
344
+ api: gridApi,
345
+ columnApi,
346
+ context,
347
+ });
348
+ }, []);
349
+ // ============================================================================
350
+ // Event Handlers
351
+ // ============================================================================
352
+ const handleCellClick = useCallback((e, row, rowIndex, col, colIndex) => {
353
+ const value = col.field ? getNestedValue(row, col.field) : null;
354
+ const node = createRowNode(row, rowIndex);
355
+ onCellClicked?.({
356
+ type: 'cellClicked',
357
+ api: gridApi,
358
+ columnApi,
359
+ context,
360
+ data: row,
361
+ node,
362
+ column: { colId: col.colId, colDef: col },
363
+ colDef: col,
364
+ value,
365
+ rowIndex,
366
+ event: e.nativeEvent,
367
+ });
368
+ // Single click edit
369
+ if (singleClickEdit && col.editable) {
370
+ startEditing(getRowId({ data: row }), col.colId, rowIndex, value);
371
+ setEditValue(value);
372
+ }
373
+ // Row selection on click
374
+ if (rowSelection && !suppressRowClickSelection && !col.checkboxSelection) {
375
+ toggleRow(row, rowIndex);
376
+ onRowSelected?.({
377
+ type: 'rowSelected',
378
+ api: gridApi,
379
+ columnApi,
380
+ context,
381
+ data: row,
382
+ node,
383
+ rowIndex,
384
+ });
385
+ }
386
+ }, [gridApi, columnApi, context, onCellClicked, singleClickEdit, rowSelection, suppressRowClickSelection, toggleRow, onRowSelected, startEditing, getRowId]);
387
+ const handleCellDoubleClick = useCallback((e, row, rowIndex, col, colIndex) => {
388
+ const value = col.field ? getNestedValue(row, col.field) : null;
389
+ const node = createRowNode(row, rowIndex);
390
+ onCellDoubleClicked?.({
391
+ type: 'cellDoubleClicked',
392
+ api: gridApi,
393
+ columnApi,
394
+ context,
395
+ data: row,
396
+ node,
397
+ column: { colId: col.colId, colDef: col },
398
+ colDef: col,
399
+ value,
400
+ rowIndex,
401
+ event: e.nativeEvent,
402
+ });
403
+ // Double click edit
404
+ if (!singleClickEdit && col.editable) {
405
+ startEditing(getRowId({ data: row }), col.colId, rowIndex, value);
406
+ setEditValue(value);
407
+ }
408
+ }, [gridApi, columnApi, context, onCellDoubleClicked, singleClickEdit, startEditing, getRowId]);
409
+ const handleRowClick = useCallback((e, row, rowIndex) => {
410
+ const node = createRowNode(row, rowIndex);
411
+ onRowClicked?.({
412
+ type: 'rowClicked',
413
+ api: gridApi,
414
+ columnApi,
415
+ context,
416
+ data: row,
417
+ node,
418
+ rowIndex,
419
+ event: e.nativeEvent,
420
+ });
421
+ }, [gridApi, columnApi, context, onRowClicked]);
422
+ const handleHeaderClick = useCallback((col, e) => {
423
+ if (col.sortable !== false && sortable) {
424
+ handleSort(col.colId, e.shiftKey || alwaysMultiSort);
425
+ onSortChanged?.({
426
+ type: 'sortChanged',
427
+ api: gridApi,
428
+ columnApi,
429
+ context,
430
+ });
431
+ }
432
+ }, [sortable, handleSort, alwaysMultiSort, onSortChanged, gridApi, columnApi, context]);
433
+ const handleContextMenu = useCallback((e, row, rowIndex, col) => {
434
+ if (suppressContextMenu)
435
+ return;
436
+ e.preventDefault();
437
+ showContextMenu(e.clientX, e.clientY, { row, rowIndex, col });
438
+ }, [suppressContextMenu, showContextMenu]);
439
+ const handleEditComplete = useCallback((newValue) => {
440
+ if (editingCell) {
441
+ onCellValueChanged?.({
442
+ type: 'cellValueChanged',
443
+ api: gridApi,
444
+ columnApi,
445
+ context,
446
+ data: {},
447
+ node: createRowNode({}, editingCell.rowIndex),
448
+ column: {},
449
+ colDef: {},
450
+ oldValue: editingCell.value,
451
+ newValue,
452
+ rowIndex: editingCell.rowIndex,
453
+ });
454
+ }
455
+ stopEditing(false, newValue);
456
+ setEditValue(null);
457
+ }, [editingCell, onCellValueChanged, gridApi, columnApi, context, stopEditing]);
458
+ // ============================================================================
459
+ // Keyboard Handlers
460
+ // ============================================================================
461
+ const handleKeyDown = useCallback((e) => {
462
+ if (editingCell) {
463
+ if (e.key === 'Escape') {
464
+ stopEditing(true);
465
+ setEditValue(null);
466
+ }
467
+ else if (e.key === 'Enter') {
468
+ handleEditComplete(editValue);
469
+ }
470
+ }
471
+ // Clipboard shortcuts
472
+ if (enableClipboard && (e.ctrlKey || e.metaKey)) {
473
+ if (e.key === 'c') {
474
+ copyToClipboard(selectedRows, visibleColumns, true);
475
+ }
476
+ }
477
+ }, [editingCell, stopEditing, handleEditComplete, editValue, enableClipboard, copyToClipboard, selectedRows, visibleColumns]);
478
+ // ============================================================================
479
+ // Render Column Groups (if any)
480
+ // ============================================================================
481
+ const hasColumnGroups = columnDefs.some(isColGroupDef);
482
+ const renderColumnGroups = () => {
483
+ if (!hasColumnGroups)
484
+ return null;
485
+ return (_jsx(GroupHeaderRow, { "$theme": gridTheme, children: columnDefs.map((col, i) => {
486
+ if (isColGroupDef(col)) {
487
+ return (_jsx(GroupHeaderCell, { "$theme": gridTheme, "$colSpan": flattenColumnDefs(col.children).length, colSpan: flattenColumnDefs(col.children).length, children: col.headerName }, col.groupId || i));
488
+ }
489
+ return _jsx(GroupHeaderCell, { "$theme": gridTheme, "$colSpan": 1 }, col.field || i);
490
+ }) }));
491
+ };
492
+ // ============================================================================
493
+ // Render Header
494
+ // ============================================================================
495
+ 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) => {
496
+ if (e.target.checked) {
497
+ selectAll();
498
+ }
499
+ else {
500
+ deselectAll();
501
+ }
502
+ onSelectionChanged?.({
503
+ type: 'selectionChanged',
504
+ api: gridApi,
505
+ columnApi,
506
+ context,
507
+ });
508
+ } }) }) })), rowDragManaged && (_jsx(HeaderCell, { "$theme": gridTheme, "$width": 40, "$align": "center" })), masterDetail && (_jsx(HeaderCell, { "$theme": gridTheme, "$width": 40, "$align": "center" })), visibleColumns.map((col, colIndex) => {
509
+ const colId = col.colId;
510
+ const { sort: sortDir } = getSortForColumn(colId);
511
+ const state = columnState.find((s) => s.colId === colId);
512
+ const width = state?.width || col.width;
513
+ 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), 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 || ''), "$theme": gridTheme, children: _jsx(FilterIcon, {}) }))] }), col.resizable !== false && (_jsx(ResizeHandle, { "$theme": gridTheme, "$resizing": resizing?.colId === colId, onMouseDown: (e) => handleResizeStart(e, colId, width || 100) }))] }, colId));
514
+ })] }));
515
+ // ============================================================================
516
+ // Render Floating Filters
517
+ // ============================================================================
518
+ const renderFloatingFilters = () => {
519
+ if (!floatingFilter)
520
+ return null;
521
+ 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) => {
522
+ setColumnFilter(col.field || '', {
523
+ filterType: 'text',
524
+ filter: e.target.value,
525
+ });
526
+ onFilterChanged?.({
527
+ type: 'filterChanged',
528
+ api: gridApi,
529
+ columnApi,
530
+ context,
531
+ });
532
+ } })) }, col.colId)))] }));
533
+ };
534
+ // ============================================================================
535
+ // Render Cell
536
+ // ============================================================================
537
+ const renderCell = (row, rowIndex, col, colIndex) => {
538
+ const colId = col.colId;
539
+ const rowId = getRowId({ data: row });
540
+ const value = col.field ? getNestedValue(row, col.field) : null;
541
+ const isEditingThis = isEditing(rowId, colId);
542
+ const state = columnState.find((s) => s.colId === colId);
543
+ const width = state?.width || col.width;
544
+ // Editing mode
545
+ if (isEditingThis) {
546
+ 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) => {
547
+ if (e.key === 'Enter')
548
+ handleEditComplete(editValue);
549
+ if (e.key === 'Escape') {
550
+ stopEditing(true);
551
+ setEditValue(null);
552
+ }
553
+ }, autoFocus: true }) }) }, colId));
554
+ }
555
+ // Custom cell renderer
556
+ if (col.cellRenderer) {
557
+ const CellRenderer = col.cellRenderer;
558
+ const params = {
559
+ value,
560
+ data: row,
561
+ node: createRowNode(row, rowIndex, rowId),
562
+ rowIndex,
563
+ colDef: col,
564
+ column: { colId, colDef: col },
565
+ api: gridApi,
566
+ columnApi,
567
+ context,
568
+ refreshCell: () => { },
569
+ eGridCell: null,
570
+ getValue: () => value,
571
+ setValue: () => { },
572
+ };
573
+ 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));
574
+ }
575
+ // Value formatter
576
+ let displayValue = value;
577
+ if (col.valueFormatter) {
578
+ displayValue = col.valueFormatter({
579
+ value,
580
+ data: row,
581
+ node: createRowNode(row, rowIndex, rowId),
582
+ colDef: col,
583
+ column: { colId, colDef: col },
584
+ api: gridApi,
585
+ columnApi,
586
+ context,
587
+ });
588
+ }
589
+ 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));
590
+ };
591
+ // ============================================================================
592
+ // Render Row
593
+ // ============================================================================
594
+ const renderRow = (row, rowIndex) => {
595
+ const rowId = getRowId({ data: row });
596
+ const selected = isSelected(rowId);
597
+ const expanded = isExpanded(rowId);
598
+ const isMaster = masterDetail && (isRowMaster?.(row) ?? true);
599
+ 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: () => {
600
+ toggleRow(row, rowIndex);
601
+ onSelectionChanged?.({
602
+ type: 'selectionChanged',
603
+ api: gridApi,
604
+ columnApi,
605
+ context,
606
+ });
607
+ }, 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) => {
608
+ e.stopPropagation();
609
+ toggleExpand(row);
610
+ }, 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, {
611
+ value: null,
612
+ data: row,
613
+ node: createRowNode(row, rowIndex, rowId),
614
+ rowIndex,
615
+ colDef: {},
616
+ column: {},
617
+ api: gridApi,
618
+ columnApi,
619
+ context,
620
+ refreshCell: () => { },
621
+ eGridCell: null,
622
+ getValue: () => null,
623
+ setValue: () => { },
624
+ }) }) }))] }, rowId));
625
+ };
626
+ // ============================================================================
627
+ // Render Mobile Card View
628
+ // ============================================================================
629
+ const renderMobileCards = () => {
630
+ if (mobileCardRenderer) {
631
+ return (_jsx(MobileCardContainer, { "$theme": gridTheme, children: displayData.map((row, i) => {
632
+ const rowId = getRowId({ data: row });
633
+ return (_jsx(MobileCard, { "$theme": gridTheme, "$selected": isSelected(rowId), onClick: (e) => handleRowClick(e, row, i), children: React.createElement(mobileCardRenderer, {
634
+ data: row,
635
+ node: createRowNode(row, i, rowId),
636
+ }) }, rowId));
637
+ }) }));
638
+ }
639
+ return (_jsx(MobileCardContainer, { "$theme": gridTheme, children: displayData.map((row, i) => {
640
+ const rowId = getRowId({ data: row });
641
+ 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) => {
642
+ const value = col.field ? getNestedValue(row, col.field) : null;
643
+ return (_jsxs(MobileCardRow, { "$theme": gridTheme, children: [_jsx(MobileCardLabel, { "$theme": gridTheme, children: col.headerName || col.field }), _jsx(MobileCardValue, { "$theme": gridTheme, children: String(value ?? '') })] }, col.colId));
644
+ })] }, rowId));
645
+ }) }));
646
+ };
647
+ // ============================================================================
648
+ // Render Empty State
649
+ // ============================================================================
650
+ const renderEmptyState = () => {
651
+ if (noRowsOverlayComponent) {
652
+ return (_jsx(NoRowsOverlay, { "$theme": gridTheme, children: React.createElement(noRowsOverlayComponent, {}) }));
653
+ }
654
+ return (_jsxs(NoRowsOverlay, { "$theme": gridTheme, children: [_jsx(EmptyIcon, {}), _jsx("span", { children: "No Rows To Show" })] }));
655
+ };
656
+ // ============================================================================
657
+ // Render Loading State
658
+ // ============================================================================
659
+ const renderLoadingState = () => {
660
+ if (loadingOverlayComponent) {
661
+ return (_jsx(LoadingOverlay, { "$theme": gridTheme, children: React.createElement(loadingOverlayComponent, {}) }));
662
+ }
663
+ return (_jsxs(LoadingOverlay, { "$theme": gridTheme, children: [_jsx(Spinner, { "$theme": gridTheme }), _jsx("span", { children: "Loading..." })] }));
664
+ };
665
+ // ============================================================================
666
+ // Render Pagination
667
+ // ============================================================================
668
+ const renderPagination = () => {
669
+ if (!pagination || suppressPaginationPanel)
670
+ return null;
671
+ 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) => {
672
+ changePageSize(Number(e.target.value));
673
+ onPaginationChanged?.({
674
+ type: 'paginationChanged',
675
+ api: gridApi,
676
+ columnApi,
677
+ context,
678
+ newPage: false,
679
+ newPageSize: true,
680
+ animate: true,
681
+ keepRenderedRows: false,
682
+ });
683
+ }, children: paginationPageSizeSelector.map((size) => (_jsxs("option", { value: size, children: [size, " rows"] }, size))) }))] })] }));
684
+ };
685
+ // ============================================================================
686
+ // Render Context Menu
687
+ // ============================================================================
688
+ const renderContextMenu = () => {
689
+ if (!contextMenu.visible)
690
+ return null;
691
+ const items = getContextMenuItems?.({
692
+ node: contextMenu.data?.row ? createRowNode(contextMenu.data.row, contextMenu.data.rowIndex) : {},
693
+ column: { colId: contextMenu.data?.col?.colId, colDef: contextMenu.data?.col },
694
+ value: contextMenu.data?.col?.field ? getNestedValue(contextMenu.data.row, contextMenu.data.col.field) : null,
695
+ }) || ['copy', 'separator', 'export'];
696
+ return (_jsx(ContextMenu, { "$theme": gridTheme, "$x": contextMenu.x, "$y": contextMenu.y, children: items.map((item, i) => {
697
+ if (item === 'separator') {
698
+ return _jsx(ContextMenuDivider, { "$theme": gridTheme }, i);
699
+ }
700
+ if (typeof item === 'string') {
701
+ // Default menu items
702
+ switch (item) {
703
+ case 'copy':
704
+ return (_jsxs(ContextMenuItem, { "$theme": gridTheme, onClick: () => copyToClipboard(selectedRows, visibleColumns, true), children: ["Copy", _jsx("span", { className: "shortcut", children: "Ctrl+C" })] }, item));
705
+ case 'export':
706
+ return (_jsx(ContextMenuItem, { "$theme": gridTheme, onClick: () => exportToCsv(processedData, visibleColumns, 'export.csv'), children: "Export to CSV" }, item));
707
+ default:
708
+ return null;
709
+ }
710
+ }
711
+ 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));
712
+ }) }));
713
+ };
714
+ // ============================================================================
715
+ // Main Render
716
+ // ============================================================================
717
+ 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) => {
718
+ setQuickFilterText(e.target.value);
719
+ onFilterChanged?.({
720
+ type: 'filterChanged',
721
+ api: gridApi,
722
+ columnApi,
723
+ context,
724
+ });
725
+ } })] }), hasActiveFilters && (_jsxs(ToolbarButton, { "$theme": gridTheme, onClick: clearFilters, 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"] })] })] }), 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"] }) })] })), _jsx(GridWrapper, { children: _jsxs(TableContainer, { "$stickyHeader": true, "$maxHeight": domLayout === 'autoHeight' ? undefined : 'calc(100% - 100px)', children: [responsive && isMobile ? (displayData.length === 0 ? renderEmptyState() : renderMobileCards()) : (
726
+ /* Desktop Table View */
727
+ _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: "Total:" }), " ", processedData.length, " rows"] }), _jsxs(StatusItem, { children: [_jsx("strong", { children: "Selected:" }), " ", selectedRows.length] })] })), renderContextMenu()] }));
728
+ }
729
+ // ============================================================================
730
+ // Exported Component with ForwardRef
731
+ // ============================================================================
732
+ export const AgGrid = forwardRef(AgGridInner);
733
+ export default AgGrid;