@envisiongroup/porygon 0.1.0-rc.1

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/LICENSE +11 -0
  2. package/README.md +69 -0
  3. package/dist/index.d.ts +24 -0
  4. package/dist/index.js +60 -0
  5. package/dist/react-components/buttons/EFWButton/EFWButton.d.ts +59 -0
  6. package/dist/react-components/buttons/EFWButton/EFWButton.hooks.d.ts +45 -0
  7. package/dist/react-components/buttons/EFWButton/EFWButton.hooks.js +75 -0
  8. package/dist/react-components/buttons/EFWButton/EFWButton.js +164 -0
  9. package/dist/react-components/buttons/EFWButton/EFWButton.types.d.ts +282 -0
  10. package/dist/react-components/buttons/EFWButton/index.d.ts +3 -0
  11. package/dist/react-components/buttons/EFWButton/index.js +6 -0
  12. package/dist/react-components/buttons/EFWDrawerButton/EFWDrawerButton.d.ts +36 -0
  13. package/dist/react-components/buttons/EFWDrawerButton/EFWDrawerButton.js +32 -0
  14. package/dist/react-components/buttons/EFWDrawerButton/EFWDrawerButton.types.d.ts +87 -0
  15. package/dist/react-components/buttons/EFWDrawerButton/index.d.ts +12 -0
  16. package/dist/react-components/buttons/EFWDrawerButton/index.js +4 -0
  17. package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.d.ts +65 -0
  18. package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.js +129 -0
  19. package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.types.d.ts +232 -0
  20. package/dist/react-components/buttons/EFWGroupButton/index.d.ts +2 -0
  21. package/dist/react-components/buttons/EFWGroupButton/index.js +4 -0
  22. package/dist/react-components/commons/utils.d.ts +55 -0
  23. package/dist/react-components/commons/utils.js +18 -0
  24. package/dist/react-components/fields/EFWAttachments/EFWAttachments.d.ts +18 -0
  25. package/dist/react-components/fields/EFWAttachments/EFWAttachments.js +124 -0
  26. package/dist/react-components/fields/EFWAttachments/EFWAttachments.types.d.ts +78 -0
  27. package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/EFWAttachmentsCard.d.ts +23 -0
  28. package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/EFWAttachmentsCard.js +107 -0
  29. package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/EFWAttachmentsCard.types.d.ts +73 -0
  30. package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/index.d.ts +1 -0
  31. package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/index.js +0 -0
  32. package/dist/react-components/fields/EFWAttachments/index.d.ts +2 -0
  33. package/dist/react-components/fields/EFWAttachments/index.js +4 -0
  34. package/dist/react-components/fields/EFWAttachmentsField/EFWAttachmentsField.d.ts +21 -0
  35. package/dist/react-components/fields/EFWAttachmentsField/EFWAttachmentsField.js +55 -0
  36. package/dist/react-components/fields/EFWAttachmentsField/EFWAttachmentsField.types.d.ts +7 -0
  37. package/dist/react-components/fields/EFWAttachmentsField/index.d.ts +2 -0
  38. package/dist/react-components/fields/EFWAttachmentsField/index.js +4 -0
  39. package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.d.ts +34 -0
  40. package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.js +135 -0
  41. package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.types.d.ts +81 -0
  42. package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.utils.d.ts +22 -0
  43. package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.utils.js +76 -0
  44. package/dist/react-components/fields/EFWDatePicker/index.d.ts +2 -0
  45. package/dist/react-components/fields/EFWDatePicker/index.js +4 -0
  46. package/dist/react-components/fields/EFWDatePickerField/EFWDatePickerField.d.ts +3 -0
  47. package/dist/react-components/fields/EFWDatePickerField/EFWDatePickerField.js +63 -0
  48. package/dist/react-components/fields/EFWDatePickerField/EFWDatePickerField.types.d.ts +7 -0
  49. package/dist/react-components/fields/EFWDatePickerField/index.d.ts +2 -0
  50. package/dist/react-components/fields/EFWDatePickerField/index.js +4 -0
  51. package/dist/react-components/fields/EFWField/EFWField.d.ts +53 -0
  52. package/dist/react-components/fields/EFWField/EFWField.js +90 -0
  53. package/dist/react-components/fields/EFWField/EFWField.types.d.ts +294 -0
  54. package/dist/react-components/fields/EFWField/EFWField.utils.d.ts +3 -0
  55. package/dist/react-components/fields/EFWField/EFWField.utils.js +17 -0
  56. package/dist/react-components/fields/EFWField/index.d.ts +2 -0
  57. package/dist/react-components/fields/EFWField/index.js +4 -0
  58. package/dist/react-components/fields/EFWInput/EFWInput.d.ts +26 -0
  59. package/dist/react-components/fields/EFWInput/EFWInput.js +100 -0
  60. package/dist/react-components/fields/EFWInput/EFWInput.types.d.ts +257 -0
  61. package/dist/react-components/fields/EFWInput/EFWInput.utils.d.ts +20 -0
  62. package/dist/react-components/fields/EFWInput/EFWInput.utils.js +84 -0
  63. package/dist/react-components/fields/EFWInput/index.d.ts +2 -0
  64. package/dist/react-components/fields/EFWInput/index.js +4 -0
  65. package/dist/react-components/fields/EFWInputField/EFWInputField.d.ts +3 -0
  66. package/dist/react-components/fields/EFWInputField/EFWInputField.js +71 -0
  67. package/dist/react-components/fields/EFWInputField/EFWInputField.types.d.ts +6 -0
  68. package/dist/react-components/fields/EFWInputField/EFWInputField.utils.d.ts +1 -0
  69. package/dist/react-components/fields/EFWInputField/EFWInputField.utils.js +0 -0
  70. package/dist/react-components/fields/EFWInputField/index.d.ts +2 -0
  71. package/dist/react-components/fields/EFWInputField/index.js +4 -0
  72. package/dist/react-components/fields/EFWNumberInput/EFWNumberInput.d.ts +8 -0
  73. package/dist/react-components/fields/EFWNumberInput/EFWNumberInput.js +183 -0
  74. package/dist/react-components/fields/EFWNumberInput/EFWNumberInput.types.d.ts +226 -0
  75. package/dist/react-components/fields/EFWNumberInput/EFWNumberInput.utils.d.ts +74 -0
  76. package/dist/react-components/fields/EFWNumberInput/EFWNumberInput.utils.js +76 -0
  77. package/dist/react-components/fields/EFWNumberInput/index.d.ts +2 -0
  78. package/dist/react-components/fields/EFWNumberInput/index.js +4 -0
  79. package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.d.ts +3 -0
  80. package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.js +65 -0
  81. package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.types.d.ts +6 -0
  82. package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.utils.d.ts +1 -0
  83. package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.utils.js +0 -0
  84. package/dist/react-components/fields/EFWNumberInputField/index.d.ts +2 -0
  85. package/dist/react-components/fields/EFWNumberInputField/index.js +4 -0
  86. package/dist/react-components/fields/EFWSwitch/EFWSwitch.d.ts +3 -0
  87. package/dist/react-components/fields/EFWSwitch/EFWSwitch.js +54 -0
  88. package/dist/react-components/fields/EFWSwitch/EFWSwitch.types.d.ts +49 -0
  89. package/dist/react-components/fields/EFWSwitch/index.d.ts +2 -0
  90. package/dist/react-components/fields/EFWSwitch/index.js +4 -0
  91. package/dist/react-components/fields/EFWSwitchField/EFWSwitchField.d.ts +3 -0
  92. package/dist/react-components/fields/EFWSwitchField/EFWSwitchField.js +53 -0
  93. package/dist/react-components/fields/EFWSwitchField/EFWSwitchField.types.d.ts +7 -0
  94. package/dist/react-components/fields/EFWSwitchField/index.d.ts +2 -0
  95. package/dist/react-components/fields/EFWSwitchField/index.js +4 -0
  96. package/dist/react-components/fields/EFWTagPicker/EFWTagPicker.d.ts +8 -0
  97. package/dist/react-components/fields/EFWTagPicker/EFWTagPicker.js +230 -0
  98. package/dist/react-components/fields/EFWTagPicker/EFWTagPicker.types.d.ts +136 -0
  99. package/dist/react-components/fields/EFWTagPicker/index.d.ts +2 -0
  100. package/dist/react-components/fields/EFWTagPicker/index.js +4 -0
  101. package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.d.ts +3 -0
  102. package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.js +72 -0
  103. package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.types.d.ts +8 -0
  104. package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.utils.d.ts +1 -0
  105. package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.utils.js +0 -0
  106. package/dist/react-components/fields/EFWTagPickerField/index.d.ts +2 -0
  107. package/dist/react-components/fields/EFWTagPickerField/index.js +4 -0
  108. package/dist/react-components/fields/EFWTextArea/EFWTextArea.d.ts +3 -0
  109. package/dist/react-components/fields/EFWTextArea/EFWTextArea.js +103 -0
  110. package/dist/react-components/fields/EFWTextArea/EFWTextArea.types.d.ts +79 -0
  111. package/dist/react-components/fields/EFWTextArea/EFWTextArea.utils.d.ts +1 -0
  112. package/dist/react-components/fields/EFWTextArea/EFWTextArea.utils.js +0 -0
  113. package/dist/react-components/fields/EFWTextArea/index.d.ts +2 -0
  114. package/dist/react-components/fields/EFWTextArea/index.js +4 -0
  115. package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.d.ts +3 -0
  116. package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.js +69 -0
  117. package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.types.d.ts +6 -0
  118. package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.utils.d.ts +1 -0
  119. package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.utils.js +0 -0
  120. package/dist/react-components/fields/EFWTextAreaField/index.d.ts +2 -0
  121. package/dist/react-components/fields/EFWTextAreaField/index.js +4 -0
  122. package/dist/react-components/fields/types.d.ts +1 -0
  123. package/dist/react-components/fields/types.js +0 -0
  124. package/dist/react-components/forms/EFWForm/EFWForm.converter.d.ts +3 -0
  125. package/dist/react-components/forms/EFWForm/EFWForm.converter.js +30 -0
  126. package/dist/react-components/forms/EFWForm/EFWForm.d.ts +96 -0
  127. package/dist/react-components/forms/EFWForm/EFWForm.hooks.d.ts +55 -0
  128. package/dist/react-components/forms/EFWForm/EFWForm.hooks.js +41 -0
  129. package/dist/react-components/forms/EFWForm/EFWForm.js +363 -0
  130. package/dist/react-components/forms/EFWForm/EFWForm.types.d.ts +981 -0
  131. package/dist/react-components/forms/EFWForm/EFWForm.utils.d.ts +19 -0
  132. package/dist/react-components/forms/EFWForm/EFWForm.utils.js +252 -0
  133. package/dist/react-components/forms/EFWForm/index.d.ts +4 -0
  134. package/dist/react-components/forms/EFWForm/index.js +8 -0
  135. package/dist/react-components/forms/EFWFormMessageBarGroup/EFWFormMessageBarGroup.d.ts +3 -0
  136. package/dist/react-components/forms/EFWFormMessageBarGroup/EFWFormMessageBarGroup.js +86 -0
  137. package/dist/react-components/forms/EFWFormMessageBarGroup/EFWFormMessageBarGroup.types.d.ts +34 -0
  138. package/dist/react-components/forms/EFWFormMessageBarGroup/index.d.ts +2 -0
  139. package/dist/react-components/forms/EFWFormMessageBarGroup/index.js +4 -0
  140. package/dist/react-components/forms/EFWMessageBarManager/EFWMessageBarManager.d.ts +3 -0
  141. package/dist/react-components/forms/EFWMessageBarManager/EFWMessageBarManager.js +32 -0
  142. package/dist/react-components/forms/EFWMessageBarManager/EFWMessageBarManager.types.d.ts +7 -0
  143. package/dist/react-components/hooks/useDrawer/component/EFWDrawer/EFWDrawer.d.ts +3 -0
  144. package/dist/react-components/hooks/useDrawer/component/EFWDrawer/EFWDrawer.js +96 -0
  145. package/dist/react-components/hooks/useDrawer/component/EFWDrawer/EFWDrawer.types.d.ts +15 -0
  146. package/dist/react-components/hooks/useDrawer/component/EFWDrawer/index.d.ts +2 -0
  147. package/dist/react-components/hooks/useDrawer/component/EFWDrawer/index.js +4 -0
  148. package/dist/react-components/hooks/useDrawer/component/EFWDrawerLoader/EFWDrawerLoader.d.ts +5 -0
  149. package/dist/react-components/hooks/useDrawer/component/EFWDrawerLoader/EFWDrawerLoader.js +24 -0
  150. package/dist/react-components/hooks/useDrawer/component/EFWDrawerLoader/index.d.ts +1 -0
  151. package/dist/react-components/hooks/useDrawer/component/EFWDrawerLoader/index.js +4 -0
  152. package/dist/react-components/hooks/useDrawer/index.d.ts +2 -0
  153. package/dist/react-components/hooks/useDrawer/index.js +4 -0
  154. package/dist/react-components/hooks/useDrawer/useDrawer.d.ts +10 -0
  155. package/dist/react-components/hooks/useDrawer/useDrawer.js +158 -0
  156. package/dist/react-components/hooks/useDrawer/useDrawer.types.d.ts +72 -0
  157. package/dist/react-components/layout/MainNavBar/MainNavBar.js +81 -0
  158. package/dist/react-components/layout/MainNavBar/index.js +4 -0
  159. package/dist/react-components/layout/MainNavItems/MainNavItems.js +35 -0
  160. package/dist/react-components/layout/MainNavItems/MainNavItems.styles.js +0 -0
  161. package/dist/react-components/layout/MainNavItems/index.js +4 -0
  162. package/dist/react-components/layout/NavBarContext/NavBarContext.js +24 -0
  163. package/dist/react-components/tables/EFWTable/EFWTable.d.ts +8 -0
  164. package/dist/react-components/tables/EFWTable/EFWTable.js +585 -0
  165. package/dist/react-components/tables/EFWTable/EFWTable.types.d.ts +367 -0
  166. package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.d.ts +3 -0
  167. package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.js +75 -0
  168. package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.types.d.ts +18 -0
  169. package/dist/react-components/tables/EFWTable/components/EFWTableBody/index.d.ts +2 -0
  170. package/dist/react-components/tables/EFWTable/components/EFWTableBody/index.js +4 -0
  171. package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.d.ts +16 -0
  172. package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.js +38 -0
  173. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.d.ts +17 -0
  174. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.js +105 -0
  175. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.types.d.ts +94 -0
  176. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.utils.d.ts +14 -0
  177. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.utils.js +26 -0
  178. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/index.d.ts +2 -0
  179. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/index.js +4 -0
  180. package/dist/react-components/tables/EFWTable/components/EFWTableEmpty/EFWTableEmpty.d.ts +3 -0
  181. package/dist/react-components/tables/EFWTable/components/EFWTableEmpty/EFWTableEmpty.js +46 -0
  182. package/dist/react-components/tables/EFWTable/components/EFWTableEmpty/EFWTableEmpty.types.d.ts +6 -0
  183. package/dist/react-components/tables/EFWTable/components/EFWTableEmpty/index.d.ts +2 -0
  184. package/dist/react-components/tables/EFWTable/components/EFWTableEmpty/index.js +4 -0
  185. package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.d.ts +3 -0
  186. package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.js +87 -0
  187. package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.types.d.ts +13 -0
  188. package/dist/react-components/tables/EFWTable/components/EFWTableHeader/index.d.ts +2 -0
  189. package/dist/react-components/tables/EFWTable/components/EFWTableHeader/index.js +4 -0
  190. package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.d.ts +22 -0
  191. package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.js +60 -0
  192. package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.d.ts +3 -0
  193. package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.js +95 -0
  194. package/dist/react-components/tables/EFWTable/hooks/useDefaultDeleteButton/useDefaultDeleteButton.d.ts +3 -0
  195. package/dist/react-components/tables/EFWTable/hooks/useDefaultDeleteButton/useDefaultDeleteButton.js +89 -0
  196. package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.d.ts +3 -0
  197. package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.js +98 -0
  198. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController copy.d.ts +4 -0
  199. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController copy.js +178 -0
  200. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.d.ts +4 -0
  201. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.js +178 -0
  202. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.types copy.d.ts +16 -0
  203. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.types copy.js +0 -0
  204. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.types.d.ts +16 -0
  205. package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.d.ts +3 -0
  206. package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.js +67 -0
  207. package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.types.d.ts +37 -0
  208. package/dist/react-components/tables/EFWTable/index.d.ts +3 -0
  209. package/dist/react-components/tables/EFWTable/index.js +6 -0
  210. package/dist/react-components/tables/EFWTable/utils/CellRenderer/CellRenderer.d.ts +7 -0
  211. package/dist/react-components/tables/EFWTable/utils/CellRenderer/CellRenderer.js +38 -0
  212. package/dist/react-components/tables/EFWTable/utils/CellRenderer/CellRenderer.types.d.ts +14 -0
  213. package/dist/react-components/tables/EFWTable/utils/cache.d.ts +37 -0
  214. package/dist/react-components/tables/EFWTable/utils/cache.js +127 -0
  215. package/dist/react-components/tables/EFWTable/utils/comparison.d.ts +6 -0
  216. package/dist/react-components/tables/EFWTable/utils/comparison.js +56 -0
  217. package/dist/react-components/tables/EFWTable/utils/constants.d.ts +8 -0
  218. package/dist/react-components/tables/EFWTable/utils/constants.js +9 -0
  219. package/dist/react-components/tables/EFWTable/utils/context.d.ts +8 -0
  220. package/dist/react-components/tables/EFWTable/utils/context.js +8 -0
  221. package/dist/react-components/tables/EFWTable/utils/general.d.ts +4 -0
  222. package/dist/react-components/tables/EFWTable/utils/general.js +4 -0
  223. package/dist/react-components/tables/EFWTable/utils/hashing.d.ts +18 -0
  224. package/dist/react-components/tables/EFWTable/utils/hashing.js +43 -0
  225. package/dist/react-components/tables/EFWTable/utils/index.d.ts +11 -0
  226. package/dist/react-components/tables/EFWTable/utils/index.js +24 -0
  227. package/dist/react-components/tables/EFWTable/utils/renderers.d.ts +8 -0
  228. package/dist/react-components/tables/EFWTable/utils/renderers.js +25 -0
  229. package/dist/react-components/tables/EFWTable/utils/types.d.ts +31 -0
  230. package/dist/react-components/tables/EFWTable/utils/types.js +0 -0
  231. package/dist/utils/htmlConverter.d.ts +15 -0
  232. package/dist/utils/htmlConverter.js +12 -0
  233. package/package.json +114 -0
@@ -0,0 +1,367 @@
1
+ import { ListChildComponentProps } from 'react-window';
2
+ import { TableRowData, CardProps } from '@fluentui/react-components';
3
+ import { DefaultDrawerButtonProps, EFWTableCommandBarButton } from './components/EFWTableCommandBar/EFWTableCommandBar.types';
4
+ import { EFWFormFieldProps, EFWFormFieldType, EFWFormFieldValue } from '../../forms/EFWForm';
5
+
6
+ export interface EFWTableItem {
7
+ readonly id?: string;
8
+ [key: string]: EFWFormFieldValue | undefined;
9
+ }
10
+ export interface EFWTableRow<T = EFWTableItem> {
11
+ index: number;
12
+ item: T;
13
+ }
14
+ export interface OperationResult<T> {
15
+ successful: {
16
+ index: number;
17
+ item: T;
18
+ }[];
19
+ failed: {
20
+ index: number;
21
+ item?: Partial<T>;
22
+ error?: string | Error;
23
+ }[];
24
+ }
25
+ /**
26
+ * Interfaz que define los métodos expuestos por el componente EFWForm para controlar su estado y comportamiento.
27
+ * Estos métodos permiten interactuar con los valores, estado de edición, validaciones y mensajes del formulario.
28
+ */
29
+ export interface EFWTableMethods {
30
+ getFields: () => EFWFormFieldProps[];
31
+ addItem: (item: Omit<EFWTableItem, 'id'>) => Promise<OperationResult<EFWTableItem>>;
32
+ addItems: (items: Omit<EFWTableItem, 'id'>[]) => Promise<OperationResult<EFWTableItem>>;
33
+ updateItem: (index: number, item: Partial<EFWTableItem>) => Promise<OperationResult<EFWTableItem>>;
34
+ updateItems: (items: {
35
+ index: number;
36
+ item: Partial<EFWTableItem>;
37
+ }[]) => Promise<OperationResult<EFWTableItem>>;
38
+ deleteItem: (index: number) => Promise<OperationResult<EFWTableItem>>;
39
+ deleteItems: (indexes: number[]) => Promise<OperationResult<EFWTableItem>>;
40
+ getItem: (id: string | number) => EFWTableItem | undefined;
41
+ getItemByIndex: (index: number) => EFWTableItem | undefined;
42
+ replaceAllItems: (newItems: EFWTableItem[]) => void;
43
+ clearItems: () => void;
44
+ getItemIndex: (id: string | number) => number;
45
+ itemExists: (id: string | number) => boolean;
46
+ getItemsCount: () => number;
47
+ getItems: () => EFWTableItem[];
48
+ getSelectedRows: () => EFWTableRow[];
49
+ deselectAllRows: () => void;
50
+ getSelectedItems: () => {
51
+ items: EFWTableItem[];
52
+ indexes: number[];
53
+ };
54
+ }
55
+ /**
56
+ * Tipo que representa la referencia al componente EFWForm.
57
+ * Puede ser un objeto con los métodos de `EFWFormMethods` o null si no está inicializado.
58
+ */
59
+ export type EFWTableRef = EFWTableMethods | null;
60
+ export interface EFWTableButton {
61
+ key: string;
62
+ label?: string | (() => string);
63
+ icon?: React.ReactNode | (() => React.ReactNode);
64
+ appearance?: "primary" | "outline" | "subtle" | "secondary" | "transparent";
65
+ disabled?: boolean | ((selectedItems: EFWTableItem[], selectedIndexes: number[]) => boolean);
66
+ hidden?: boolean;
67
+ title?: string | (() => string);
68
+ loading?: boolean | (() => boolean);
69
+ className?: string;
70
+ onClick?: (e: React.MouseEvent) => void;
71
+ render?: (config: EFWTableButton, selectedItems: EFWTableItem[], selectedIndexes: number[]) => React.ReactNode;
72
+ }
73
+ export interface EFWTableRowData extends TableRowData<EFWTableItem> {
74
+ onClick: (e: React.MouseEvent) => void;
75
+ onKeyDown: (e: React.KeyboardEvent) => void;
76
+ onCheckboxClick: (e: React.MouseEvent) => void;
77
+ selected: boolean;
78
+ appearance: "brand" | "none" | "neutral";
79
+ }
80
+ export interface ReactWindowRenderFnProps extends ListChildComponentProps {
81
+ data: EFWTableRowData[];
82
+ fields: EFWFormFieldProps[];
83
+ columnSizing?: any;
84
+ resizableColumns: boolean;
85
+ customGetFieldIcon?: (internalName: string, item: EFWTableItem) => React.ReactNode;
86
+ }
87
+ export interface EFWTableProps {
88
+ appearance?: CardProps['appearance'];
89
+ fields: EFWFormFieldProps[];
90
+ items?: EFWTableItem[];
91
+ height?: number;
92
+ itemSize?: number;
93
+ enableSelection?: boolean;
94
+ enableCommandBar?: boolean;
95
+ tableStyle?: 'row' | 'grid';
96
+ style?: React.CSSProperties;
97
+ className?: string;
98
+ defaultSelectedItems?: Set<number>;
99
+ onSelectionChange?: (selectedItems: Set<number>) => void;
100
+ onRowClick?: (item: EFWTableItem, index: number) => void;
101
+ resizableColumns?: boolean;
102
+ autoSizeColumns?: boolean;
103
+ columnSizing?: Record<string, {
104
+ maxWidth?: number;
105
+ width?: number;
106
+ minWidth?: number;
107
+ sticky?: boolean;
108
+ }>;
109
+ useVirtualization?: boolean;
110
+ getFieldIcon?: (internalName: string, item: EFWTableItem) => React.ReactNode;
111
+ tableRef?: React.MutableRefObject<EFWTableRef>;
112
+ onItemsChange?: (newItems: EFWTableItem[]) => void;
113
+ onBeforeDelete?: (selectedItems: EFWTableItem[], selectedIndexes: number[]) => number[] | Promise<number[]>;
114
+ /** Botones que se renderizan siempre, independientemente de la selección. */
115
+ alwaysButtons?: EFWTableCommandBarButton[];
116
+ /** Botones que se renderizan solo cuando no hay filas seleccionadas. */
117
+ noSelectionButtons?: EFWTableCommandBarButton[];
118
+ /** Botones que se renderizan solo cuando hay exactamente una fila seleccionada. */
119
+ singleSelectionButtons?: EFWTableCommandBarButton[];
120
+ /** Botones que se renderizan cuando hay más de una fila seleccionada. */
121
+ multiSelectionButtons?: EFWTableCommandBarButton[];
122
+ onScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
123
+ addButtonConfig?: DefaultDrawerButtonProps;
124
+ updateButtonConfig?: DefaultDrawerButtonProps;
125
+ deleteButtonConfig?: DefaultDrawerButtonProps;
126
+ /**
127
+ * Callback que se ejecuta antes de agregar elementos
128
+ *
129
+ * @description Hook que permite interceptar y controlar la operación de agregar elementos.
130
+ * Se ejecuta antes de que los elementos se agreguen a la tabla local. Útil para validaciones,
131
+ * persistencia en BD, transformaciones de datos o control de flujo.
132
+ *
133
+ * @param {EFWTableItem[]} items - Elementos que se van a agregar (ya incluyen ID generado)
134
+ * @param {EFWTableMethods} tableMethods - Métodos de la tabla para operaciones adicionales
135
+ * @returns {Promise<OperationResult<EFWTableItem> | void>}
136
+ * - `void`: Continúa con la operación normal de agregar
137
+ * - `OperationResult`: Controla exactamente qué elementos se agregan basado en el resultado
138
+ *
139
+ * @example
140
+ * // Validación simple - devuelve void para continuar normal
141
+ * const beforeAddItems = async (items, tableMethods) => {
142
+ * for (const item of items) {
143
+ * if (!item.email) {
144
+ * throw new Error('Email es requerido');
145
+ * }
146
+ * }
147
+ * // No devuelve nada (void) = continúa operación normal
148
+ * };
149
+ *
150
+ * @example
151
+ * // Control total - guardar en BD y controlar resultado
152
+ * const beforeAddItems = async (items, tableMethods) => {
153
+ * try {
154
+ * const savedItems = await database.insertMany(items);
155
+ * return {
156
+ * successful: savedItems.map((item, index) => ({ index, item })),
157
+ * failed: []
158
+ * };
159
+ * } catch (error) {
160
+ * return {
161
+ * successful: [],
162
+ * failed: items.map((item, index) => ({ index, item, error: error.message }))
163
+ * };
164
+ * }
165
+ * };
166
+ *
167
+ * @example
168
+ * // Validación con algunos elementos válidos
169
+ * const beforeAddItems = async (items, tableMethods) => {
170
+ * const existing = await tableMethods.getItems();
171
+ * const valid = [];
172
+ * const invalid = [];
173
+ *
174
+ * items.forEach((item, index) => {
175
+ * if (existing.some(e => e.email === item.email)) {
176
+ * invalid.push({ index, item, error: 'Email ya existe' });
177
+ * } else {
178
+ * valid.push({ index, item });
179
+ * }
180
+ * });
181
+ *
182
+ * if (invalid.length > 0) {
183
+ * return { successful: valid, failed: invalid };
184
+ * }
185
+ * // Si todos son válidos, no devolver nada (void)
186
+ * };
187
+ */
188
+ beforeAddItems?: (items: EFWTableItem[], tableMethods: EFWTableMethods) => Promise<OperationResult<EFWTableItem> | void>;
189
+ /**
190
+ * Callback que se ejecuta antes de actualizar elementos
191
+ *
192
+ * @description Hook que permite interceptar y controlar las operaciones de actualización.
193
+ * Se ejecuta antes de que los cambios se apliquen a la tabla local. Útil para validaciones
194
+ * de permisos, persistencia en BD, auditoría o transformaciones de datos.
195
+ *
196
+ * @param {Array<{index: number, item: Partial<EFWTableItem>}>} items - Elementos a actualizar con sus índices
197
+ * @param {EFWTableMethods} tableMethods - Métodos de la tabla para operaciones adicionales
198
+ * @returns {Promise<OperationResult<EFWTableItem> | void>}
199
+ * - `void`: Continúa con la operación normal de actualización
200
+ * - `OperationResult`: Controla exactamente qué elementos se actualizan
201
+ *
202
+ * @example
203
+ * // Validación de permisos - devuelve void si todo OK
204
+ * const beforeUpdateItems = async (items, tableMethods) => {
205
+ * const currentUser = getCurrentUser();
206
+ * for (const { index, item } of items) {
207
+ * const existing = tableMethods.getItem(index);
208
+ * if (existing.ownerId !== currentUser.id) {
209
+ * throw new Error('No tienes permisos para actualizar este elemento');
210
+ * }
211
+ * }
212
+ * // Continúa operación normal
213
+ * };
214
+ *
215
+ * @example
216
+ * // Persistencia en BD con control granular
217
+ * const beforeUpdateItems = async (items, tableMethods) => {
218
+ * const successful = [];
219
+ * const failed = [];
220
+ *
221
+ * for (const { index, item } of items) {
222
+ * try {
223
+ * const current = tableMethods.getItem(index);
224
+ * const updated = await database.update(current.id, item);
225
+ * successful.push({ index, item: { ...current, ...updated } });
226
+ * } catch (error) {
227
+ * failed.push({ index, item, error: error.message });
228
+ * }
229
+ * }
230
+ *
231
+ * return { successful, failed };
232
+ * };
233
+ *
234
+ * @example
235
+ * // Auditoría de cambios
236
+ * const beforeUpdateItems = async (items, tableMethods) => {
237
+ * const auditLog = items.map(({ index, item }) => ({
238
+ * action: 'UPDATE',
239
+ * index,
240
+ * oldValue: tableMethods.getItem(index),
241
+ * newValue: item,
242
+ * timestamp: new Date(),
243
+ * userId: getCurrentUser().id
244
+ * }));
245
+ *
246
+ * await auditService.log(auditLog);
247
+ * // No devuelve nada = continúa operación normal
248
+ * };
249
+ */
250
+ beforeUpdateItems?: (items: {
251
+ index: number;
252
+ item: Partial<EFWTableItem>;
253
+ }[], tableMethods: EFWTableMethods) => Promise<OperationResult<EFWTableItem> | void>;
254
+ /**
255
+ * Callback que se ejecuta antes de eliminar elementos
256
+ *
257
+ * @description Hook que permite interceptar y controlar las operaciones de eliminación.
258
+ * Se ejecuta antes de que los elementos se eliminen de la tabla local. Útil para validar
259
+ * dependencias, hacer soft deletes, backup de datos o control de permisos.
260
+ *
261
+ * @param {Array<{index: number, item: Partial<EFWTableItem>}>} items - Elementos a eliminar con sus índices
262
+ * @param {EFWTableMethods} tableMethods - Métodos de la tabla para operaciones adicionales
263
+ * @returns {Promise<OperationResult<EFWTableItem> | void>}
264
+ * - `void`: Continúa con la operación normal de eliminación
265
+ * - `OperationResult`: Controla exactamente qué elementos se eliminan
266
+ *
267
+ * @example
268
+ * // Validación de dependencias - devuelve void si todo OK
269
+ * const beforeDeleteItems = async (items, tableMethods) => {
270
+ * for (const { item } of items) {
271
+ * const hasDependencies = await checkDependencies(item.id);
272
+ * if (hasDependencies) {
273
+ * throw new Error(`El elemento ${item.name} tiene dependencias y no puede eliminarse`);
274
+ * }
275
+ * }
276
+ * // Continúa operación normal
277
+ * };
278
+ *
279
+ * @example
280
+ * // Soft delete en BD
281
+ * const beforeDeleteItems = async (items, tableMethods) => {
282
+ * const successful = [];
283
+ * const failed = [];
284
+ *
285
+ * for (const { index, item } of items) {
286
+ * try {
287
+ * await database.softDelete(item.id);
288
+ * successful.push({ index, item });
289
+ * } catch (error) {
290
+ * failed.push({ index, item, error: error.message });
291
+ * }
292
+ * }
293
+ *
294
+ * return { successful, failed };
295
+ * };
296
+ *
297
+ * @example
298
+ * // Backup antes de eliminar con validación selectiva
299
+ * const beforeDeleteItems = async (items, tableMethods) => {
300
+ * const backupable = [];
301
+ * const protected = [];
302
+ *
303
+ * for (const { index, item } of items) {
304
+ * if (item.protected) {
305
+ * protected.push({ index, item, error: 'Elemento protegido' });
306
+ * } else {
307
+ * await backupService.backup(item);
308
+ * await database.delete(item.id);
309
+ * backupable.push({ index, item });
310
+ * }
311
+ * }
312
+ *
313
+ * if (protected.length > 0) {
314
+ * return { successful: backupable, failed: protected };
315
+ * }
316
+ * // Si todos son eliminables, no devolver nada (void)
317
+ * };
318
+ *
319
+ * @example
320
+ * // Control de permisos con tabla relacionada
321
+ * const beforeDeleteItems = async (items, tableMethods) => {
322
+ * const user = getCurrentUser();
323
+ * const allowed = [];
324
+ * const denied = [];
325
+ *
326
+ * for (const { index, item } of items) {
327
+ * if (user.role === 'admin' || item.ownerId === user.id) {
328
+ * allowed.push({ index, item });
329
+ * } else {
330
+ * denied.push({ index, item, error: 'Sin permisos de eliminación' });
331
+ * }
332
+ * }
333
+ *
334
+ * return { successful: allowed, failed: denied };
335
+ * };
336
+ */
337
+ beforeDeleteItems?: (items: {
338
+ index: number;
339
+ item: Partial<EFWTableItem>;
340
+ }[], tableMethods: EFWTableMethods) => Promise<OperationResult<EFWTableItem> | void>;
341
+ /**
342
+ * Renderers personalizados para tipos de campo.
343
+ * Si el renderer retorna null/undefined, se usará el renderer por defecto.
344
+ */
345
+ columnRenderers?: ColumnRenderers;
346
+ /** Si usar el renderer por defecto como fallback final (default: true) */
347
+ useDefaultRendererAsFallback?: boolean;
348
+ }
349
+ export interface CellRendererContext<T extends EFWFormFieldType> {
350
+ field: EFWFormFieldProps<T>;
351
+ value: EFWFormFieldValue<T>;
352
+ item: EFWTableItem;
353
+ rowIndex: number;
354
+ columnId: string;
355
+ }
356
+ export type CellRenderer<T extends EFWFormFieldType> = (context: CellRendererContext<T>) => React.ReactNode;
357
+ export type Renderers = {
358
+ [K in EFWFormFieldType]?: CellRenderer<K>;
359
+ };
360
+ export type ColumnRenderers = {
361
+ [K in EFWFormFieldType]?: {
362
+ default?: CellRenderer<K>;
363
+ fields?: {
364
+ [fieldName: string]: CellRenderer<K>;
365
+ };
366
+ };
367
+ };
@@ -0,0 +1,3 @@
1
+ import { EFWTableBodyProps } from './EFWTableBody.types';
2
+
3
+ export declare const EFWTableBody: ({ tableContainerRef, useVirtualization, enableSelection, itemSize, table, gridTemplateColumns, columnSizing, stickyColumnsInfo, onRowClick, }: EFWTableBodyProps) => React.ReactElement;
@@ -0,0 +1,75 @@
1
+ import { jsxs as E, jsx as g } from "react/jsx-runtime";
2
+ import { useEffect as f } from "react";
3
+ import { useVirtualizer as F } from "@tanstack/react-virtual";
4
+ import { EFWTableRow as R } from "../EFWTableRow/EFWTableRow.js";
5
+ const S = (l) => {
6
+ f(() => {
7
+ const e = l.current;
8
+ if (!e) return;
9
+ let s = 0, d = !1, r = !1;
10
+ const c = () => {
11
+ cancelAnimationFrame(s), s = requestAnimationFrame(() => {
12
+ const i = e.scrollLeft > 0, a = e.scrollTop > 0;
13
+ i !== d && (e.classList.toggle("is-scrolling-x", i), d = i), a !== r && (e.classList.toggle("is-scrolling-y", a), r = a);
14
+ });
15
+ };
16
+ return e.addEventListener("scroll", c, { passive: !0 }), c(), () => {
17
+ e.removeEventListener("scroll", c), cancelAnimationFrame(s);
18
+ };
19
+ }, [l]);
20
+ }, M = ({
21
+ tableContainerRef: l,
22
+ useVirtualization: e,
23
+ enableSelection: s = !0,
24
+ itemSize: d,
25
+ table: r,
26
+ gridTemplateColumns: c,
27
+ columnSizing: i,
28
+ stickyColumnsInfo: a,
29
+ onRowClick: h
30
+ }) => {
31
+ const m = r.getRowModel().rows.length, w = m > 0;
32
+ S(w ? l : { current: null });
33
+ const o = e ? F({
34
+ count: m,
35
+ getScrollElement: () => l.current,
36
+ estimateSize: () => d,
37
+ measureElement: typeof window < "u" && navigator.userAgent.indexOf("Firefox") === -1 ? (t) => t?.getBoundingClientRect().height : void 0,
38
+ overscan: 10
39
+ }) : null;
40
+ f(() => {
41
+ !e || !o || requestAnimationFrame(() => {
42
+ try {
43
+ o.measure();
44
+ } catch (t) {
45
+ console.warn("Error al recalcular virtualizer:", t);
46
+ }
47
+ });
48
+ }, [m > 0, e, o]);
49
+ const n = o?.getVirtualItems() || [], v = o?.getTotalSize() || 0, u = n.length > 0 ? n[0].start : 0, p = n.length > 0 ? v - n[n.length - 1].end : 0, x = e ? n.map((t) => ({
50
+ virtualRow: t,
51
+ row: r.getRowModel().rows[t.index]
52
+ })) : r.getRowModel().rows.map((t) => ({ row: t, virtualRow: null }));
53
+ return /* @__PURE__ */ E("div", { className: "table-body", style: { fontSize: "12px", lineHeight: "16px" }, children: [
54
+ e && u > 0 && /* @__PURE__ */ g("div", { style: { height: u } }),
55
+ x.map(({ row: t, virtualRow: y }) => /* @__PURE__ */ g(
56
+ R,
57
+ {
58
+ row: t,
59
+ virtualRow: y,
60
+ rowVirtualizer: o,
61
+ useVirtualization: e,
62
+ enableSelection: s,
63
+ gridTemplateColumns: c,
64
+ columnSizing: i,
65
+ stickyColumnsInfo: a,
66
+ onRowClick: h
67
+ },
68
+ t.id
69
+ )),
70
+ e && p > 0 && /* @__PURE__ */ g("div", { style: { height: p } })
71
+ ] });
72
+ };
73
+ export {
74
+ M as EFWTableBody
75
+ };
@@ -0,0 +1,18 @@
1
+ import { Row, Table } from '@tanstack/react-table';
2
+ import { EFWTableProps, EFWTableItem } from '../../EFWTable.types';
3
+
4
+ export interface EFWTableBodyProps {
5
+ tableContainerRef: React.RefObject<HTMLDivElement>;
6
+ useVirtualization: boolean;
7
+ enableSelection?: boolean;
8
+ itemSize: number;
9
+ table: Table<EFWTableItem>;
10
+ gridTemplateColumns: string;
11
+ columnSizing: Record<string, number>;
12
+ fields: EFWTableProps['fields'];
13
+ stickyColumnsInfo: {
14
+ stickyColumns: string[];
15
+ stickyPositions: Record<string, number>;
16
+ };
17
+ onRowClick: (row: Row<EFWTableItem>, event?: React.MouseEvent) => void;
18
+ }
@@ -0,0 +1,2 @@
1
+ export { EFWTableBody } from './EFWTableBody';
2
+ export type { EFWTableBodyProps } from './EFWTableBody.types';
@@ -0,0 +1,4 @@
1
+ import { EFWTableBody as r } from "./EFWTableBody.js";
2
+ export {
3
+ r as EFWTableBody
4
+ };
@@ -0,0 +1,16 @@
1
+ import { Cell } from '@tanstack/react-table';
2
+ import { EFWTableItem } from '../../EFWTable.types';
3
+
4
+ /**
5
+ * Componente para renderizar una celda individual.
6
+ * Separa la lógica de estilos y propiedades de celda para mayor claridad.
7
+ */
8
+ export declare const EFWTableCell: ({ cell, columnSizing, stickyColumnsInfo, useVirtualization, }: {
9
+ cell: Cell<EFWTableItem, unknown>;
10
+ columnSizing: Record<string, number>;
11
+ stickyColumnsInfo: {
12
+ stickyColumns: string[];
13
+ stickyPositions: Record<string, number>;
14
+ };
15
+ useVirtualization: boolean;
16
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,38 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { flexRender as u } from "@tanstack/react-table";
3
+ import { COLS_MAX_WIDTH as a, COLS_MIN_WIDTH as p } from "../../EFWTable.js";
4
+ const g = ({
5
+ cell: o,
6
+ columnSizing: e,
7
+ stickyColumnsInfo: n,
8
+ useVirtualization: r
9
+ }) => {
10
+ const t = o.column.id === "select", i = n.stickyColumns.includes(o.column.id), c = n.stickyPositions[o.column.id] || 0, m = e[o.column.id] || o.column.getSize(), s = o.column.columnDef.minSize || p, d = o.column.columnDef.maxSize || a;
11
+ return /* @__PURE__ */ l(
12
+ "div",
13
+ {
14
+ className: `table-cell ${i || t ? "sticky-column" : ""}`,
15
+ style: {
16
+ width: m,
17
+ minWidth: `${s}px`,
18
+ maxWidth: `${d}px`,
19
+ position: i || t ? "sticky" : "static",
20
+ left: i || t ? `${c}px` : "auto",
21
+ zIndex: i || t ? 1 : 0,
22
+ padding: t ? "0px" : "4px 8px",
23
+ whiteSpace: t ? "nowrap" : "pre-wrap",
24
+ wordWrap: t ? "normal" : "break-word",
25
+ verticalAlign: "top",
26
+ minHeight: r ? "32px" : "auto",
27
+ overflow: "hidden",
28
+ textAlign: t ? "center" : "left",
29
+ backgroundColor: "var(--current-row-bg)",
30
+ boxSizing: "border-box"
31
+ },
32
+ children: u(o.column.columnDef.cell, o.getContext())
33
+ }
34
+ );
35
+ };
36
+ export {
37
+ g as EFWTableCell
38
+ };
@@ -0,0 +1,17 @@
1
+ import { EFWTableCommandBarProps } from './EFWTableCommandBar.types';
2
+ import { default as React } from 'react';
3
+
4
+ /**
5
+ * Componente EFWTableCommandBar que renderiza botones dinámicamente basados en la selección de filas.
6
+ *
7
+ * @description
8
+ * - Evalúa la propiedad `enabled` de cada botón (boolean o función) para decidir si renderizarlo.
9
+ * - Combina botones "always" con botones específicos del escenario de selección.
10
+ * - Usa EFWGroupButton internamente para renderizar el grupo de botones filtrados.
11
+ * - Pasa { selectedRows, tableMethods } como onClickParams a todos los botones.
12
+ * - Optimizado con React.memo para evitar re-renders innecesarios.
13
+ *
14
+ * @param {EFWTableCommandBarProps} props - Propiedades del componente.
15
+ * @returns {JSX.Element|null} - El grupo de botones renderizados o null si no hay botones visibles.
16
+ */
17
+ export declare const EFWTableCommandBar: React.FC<EFWTableCommandBarProps>;
@@ -0,0 +1,105 @@
1
+ import { jsx as s, jsxs as T } from "react/jsx-runtime";
2
+ import r, { useCallback as h } from "react";
3
+ import { CardHeader as N, tokens as W, Button as _ } from "@fluentui/react-components";
4
+ import { Dismiss20Regular as A } from "@fluentui/react-icons";
5
+ import { EFWGroupButton as P } from "../../../../buttons/EFWGroupButton/EFWGroupButton.js";
6
+ const l = [], $ = r.memo(({
7
+ alwaysButtons: m = l,
8
+ noSelectionButtons: d = l,
9
+ singleSelectionButtons: u = l,
10
+ multiSelectionButtons: f = l,
11
+ selectedRows: o = [],
12
+ tableMethods: n,
13
+ containerStyle: k,
14
+ gap: g,
15
+ className: y
16
+ }) => {
17
+ const t = r.useMemo(() => o.length, [o]), i = r.useCallback(
18
+ (c) => c.filter((e) => e.enabled === void 0 ? !0 : typeof e.enabled == "boolean" ? e.enabled : e.enabled(o, n)).map(({ enabled: e, ...p }) => p),
19
+ [o, n]
20
+ ), B = h(() => {
21
+ n.deselectAllRows();
22
+ }, [n]), b = r.useMemo(
23
+ () => i(m),
24
+ [m, i]
25
+ ), x = r.useMemo(() => {
26
+ const c = () => t === 0 ? {
27
+ buttons: d,
28
+ // Botones disponibles cuando no hay selección
29
+ prefix: "no-selected-button"
30
+ // Prefijo para IDs: "no-selected-button-0", "no-selected-button-1", etc.
31
+ } : t === 1 ? {
32
+ buttons: u,
33
+ // Botones disponibles para selección única
34
+ prefix: "one-selected-button"
35
+ // Prefijo para IDs: "one-selected-button-0", "one-selected-button-1", etc.
36
+ } : {
37
+ buttons: f,
38
+ // Botones disponibles para selección múltiple
39
+ prefix: "many-selected-button"
40
+ // Prefijo para IDs: "many-selected-button-0", "many-selected-button-1", etc.
41
+ }, { buttons: e, prefix: p } = c(), E = e.map(
42
+ (a, F) => a.props.id ? a : {
43
+ ...a,
44
+ props: {
45
+ ...a.props,
46
+ id: `${p}-${F}`
47
+ }
48
+ }
49
+ );
50
+ return i(E);
51
+ }, [
52
+ t,
53
+ // Número de elementos seleccionados en la tabla/lista
54
+ d,
55
+ // Array de botones para mostrar cuando no hay selección
56
+ u,
57
+ // Array de botones para mostrar con selección única
58
+ f,
59
+ // Array de botones para mostrar con selección múltiple
60
+ i
61
+ // Función que determina qué botones están habilitados
62
+ ]), C = r.useMemo(
63
+ () => [...b, ...x],
64
+ [b, x]
65
+ );
66
+ return /* @__PURE__ */ s(
67
+ N,
68
+ {
69
+ style: {
70
+ padding: "4px 8px 3px",
71
+ borderBottom: `1px solid ${W.colorNeutralStroke1}`,
72
+ transition: "background-color 0.2s ease"
73
+ },
74
+ header: t > 0 ? /* @__PURE__ */ T(
75
+ _,
76
+ {
77
+ appearance: "subtle",
78
+ icon: /* @__PURE__ */ s(A, {}),
79
+ onClick: B,
80
+ title: "Limpiar selección",
81
+ iconPosition: "after",
82
+ children: [
83
+ "Seleccionados (",
84
+ t,
85
+ ")"
86
+ ]
87
+ }
88
+ ) : /* @__PURE__ */ s("div", { style: { height: 32 } }),
89
+ action: C.length > 0 ? /* @__PURE__ */ s(
90
+ P,
91
+ {
92
+ buttons: C,
93
+ onClickParams: { selectedRows: o, tableMethods: n },
94
+ style: k,
95
+ gap: g,
96
+ className: y
97
+ }
98
+ ) : null
99
+ }
100
+ );
101
+ });
102
+ $.displayName = "EFWTableCommandBar";
103
+ export {
104
+ $ as EFWTableCommandBar
105
+ };