@mailstep/design-system 0.5.1-beta.1 → 0.6.0

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 (280) hide show
  1. package/package.json +40 -20
  2. package/ui/Blocks/CommonGrid/CommonGrid.d.ts +5 -2
  3. package/ui/Blocks/CommonGrid/CommonGrid.js +12 -22
  4. package/ui/Blocks/CommonGrid/CommonGridContainer.d.ts +3 -0
  5. package/ui/Blocks/CommonGrid/CommonGridContainer.js +66 -0
  6. package/ui/Blocks/CommonGrid/StandardButtons.d.ts +4 -0
  7. package/ui/Blocks/CommonGrid/StandardButtons.js +36 -0
  8. package/ui/Blocks/CommonGrid/components/ActionHead/ActionHead.d.ts +12 -0
  9. package/ui/Blocks/CommonGrid/components/ActionHead/ActionHead.js +50 -0
  10. package/ui/Blocks/CommonGrid/components/ActionHead/components/ActionDropdownMenu.d.ts +11 -0
  11. package/ui/Blocks/CommonGrid/components/ActionHead/components/ActionDropdownMenu.js +18 -0
  12. package/ui/Blocks/CommonGrid/components/ActionHead/components/ActionDropdownSelect.d.ts +12 -0
  13. package/ui/Blocks/CommonGrid/components/ActionHead/components/ActionDropdownSelect.js +45 -0
  14. package/ui/Blocks/CommonGrid/components/ActionHead/index.d.ts +2 -0
  15. package/ui/Blocks/CommonGrid/components/ActionHead/index.js +2 -0
  16. package/ui/Blocks/CommonGrid/components/BooleanSelect/BooleanSelect.d.ts +6 -0
  17. package/ui/Blocks/CommonGrid/components/BooleanSelect/BooleanSelect.js +37 -0
  18. package/ui/Blocks/CommonGrid/components/BooleanSelect/index.d.ts +2 -0
  19. package/ui/Blocks/CommonGrid/components/BooleanSelect/index.js +2 -0
  20. package/ui/Blocks/CommonGrid/components/ButtonMore/ButtonMore.d.ts +13 -0
  21. package/ui/Blocks/CommonGrid/components/ButtonMore/ButtonMore.js +32 -0
  22. package/ui/Blocks/CommonGrid/components/ButtonMore/index.d.ts +2 -0
  23. package/ui/Blocks/CommonGrid/components/ButtonMore/index.js +2 -0
  24. package/ui/Blocks/CommonGrid/components/ColumnFilterCell.js +1 -1
  25. package/ui/Blocks/CommonGrid/components/ColumnTitle/ColumnTitle.d.ts +5 -0
  26. package/ui/Blocks/CommonGrid/components/ColumnTitle/ColumnTitle.js +58 -0
  27. package/ui/Blocks/CommonGrid/components/ColumnTitle/index.d.ts +2 -0
  28. package/ui/Blocks/CommonGrid/components/ColumnTitle/index.js +2 -0
  29. package/ui/Blocks/CommonGrid/components/ControlButtons/ControlButtons.d.ts +11 -0
  30. package/ui/Blocks/CommonGrid/components/ControlButtons/ControlButtons.js +20 -0
  31. package/ui/Blocks/CommonGrid/components/ControlButtons/index.d.ts +2 -0
  32. package/ui/Blocks/CommonGrid/components/ControlButtons/index.js +2 -0
  33. package/ui/Blocks/CommonGrid/components/DataRow.js +4 -4
  34. package/ui/Blocks/CommonGrid/components/DatePickerRange/DatePickerRange.d.ts +12 -0
  35. package/ui/Blocks/CommonGrid/components/DatePickerRange/DatePickerRange.js +113 -0
  36. package/ui/Blocks/CommonGrid/components/DatePickerRange/index.d.ts +2 -0
  37. package/ui/Blocks/CommonGrid/components/DatePickerRange/index.js +2 -0
  38. package/ui/Blocks/CommonGrid/components/DatePickerRange/utils/sameDate.d.ts +1 -0
  39. package/ui/Blocks/CommonGrid/components/DatePickerRange/utils/sameDate.js +3 -0
  40. package/ui/Blocks/CommonGrid/components/ExtraControlButtons/ExtraControlButtons.d.ts +8 -0
  41. package/ui/Blocks/CommonGrid/components/ExtraControlButtons/ExtraControlButtons.js +43 -0
  42. package/ui/Blocks/CommonGrid/components/ExtraControlButtons/index.d.ts +2 -0
  43. package/ui/Blocks/CommonGrid/components/ExtraControlButtons/index.js +2 -0
  44. package/ui/Blocks/CommonGrid/components/FilterRow.js +2 -3
  45. package/ui/Blocks/CommonGrid/components/FloatingButton/FloatingButton.d.ts +7 -0
  46. package/ui/Blocks/CommonGrid/components/FloatingButton/FloatingButton.js +46 -0
  47. package/ui/Blocks/CommonGrid/components/FloatingButton/index.d.ts +2 -0
  48. package/ui/Blocks/CommonGrid/components/FloatingButton/index.js +2 -0
  49. package/ui/Blocks/CommonGrid/components/GridSelect/GridSelect.d.ts +10 -0
  50. package/ui/Blocks/CommonGrid/components/GridSelect/GridSelect.js +19 -0
  51. package/ui/Blocks/CommonGrid/components/GridSelect/index.d.ts +2 -0
  52. package/ui/Blocks/CommonGrid/components/GridSelect/index.js +2 -0
  53. package/ui/Blocks/CommonGrid/components/HeadCell.js +1 -4
  54. package/ui/Blocks/CommonGrid/components/IconList/IconList.d.ts +18 -0
  55. package/ui/Blocks/CommonGrid/components/IconList/IconList.js +29 -0
  56. package/ui/Blocks/CommonGrid/components/IconList/index.d.ts +2 -0
  57. package/ui/Blocks/CommonGrid/components/IconList/index.js +2 -0
  58. package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.d.ts +11 -0
  59. package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.js +20 -0
  60. package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ActionRow.d.ts +12 -0
  61. package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ActionRow.js +47 -0
  62. package/ui/Blocks/CommonGrid/components/ManageColumnForm/index.d.ts +2 -0
  63. package/ui/Blocks/CommonGrid/components/ManageColumnForm/index.js +2 -0
  64. package/ui/Blocks/CommonGrid/components/NumberRange/NumberRange.d.ts +3 -0
  65. package/ui/Blocks/CommonGrid/components/NumberRange/NumberRange.js +76 -0
  66. package/ui/Blocks/CommonGrid/components/NumberRange/index.d.ts +2 -0
  67. package/ui/Blocks/CommonGrid/components/NumberRange/index.js +2 -0
  68. package/ui/Blocks/CommonGrid/components/NumberRange/types.d.ts +17 -0
  69. package/ui/Blocks/CommonGrid/components/NumberRange/types.js +1 -0
  70. package/ui/Blocks/CommonGrid/components/OversizedScroll.js +1 -4
  71. package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/ReadEditButtonCell.d.ts +6 -0
  72. package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/ReadEditButtonCell.js +26 -0
  73. package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/index.d.ts +2 -0
  74. package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/index.js +2 -0
  75. package/ui/Blocks/CommonGrid/components/Table.d.ts +0 -6
  76. package/ui/Blocks/CommonGrid/components/Table.js +0 -5
  77. package/ui/Blocks/CommonGrid/components/TablePagination/TablePagination.d.ts +8 -0
  78. package/ui/Blocks/CommonGrid/components/TablePagination/TablePagination.js +32 -0
  79. package/ui/Blocks/CommonGrid/components/TablePagination/index.d.ts +2 -0
  80. package/ui/Blocks/CommonGrid/components/TablePagination/index.js +2 -0
  81. package/ui/Blocks/CommonGrid/components/TextRange/TextRange.d.ts +4 -0
  82. package/ui/Blocks/CommonGrid/components/TextRange/TextRange.js +89 -0
  83. package/ui/Blocks/CommonGrid/components/TextRange/index.d.ts +2 -0
  84. package/ui/Blocks/CommonGrid/components/TextRange/index.js +2 -0
  85. package/ui/Blocks/CommonGrid/components/TextRange/types.d.ts +21 -0
  86. package/ui/Blocks/CommonGrid/components/TextRange/types.js +1 -0
  87. package/ui/Blocks/CommonGrid/components/gridCells/BoolIcon.d.ts +5 -0
  88. package/ui/Blocks/CommonGrid/components/gridCells/BoolIcon.js +22 -0
  89. package/ui/Blocks/CommonGrid/components/gridCells/ButtonInCell.d.ts +4 -0
  90. package/ui/Blocks/CommonGrid/components/{icons/ArrowSimple.js → gridCells/ButtonInCell.js} +4 -2
  91. package/ui/Blocks/CommonGrid/components/gridCells/Date.d.ts +4 -0
  92. package/ui/Blocks/CommonGrid/components/gridCells/Date.js +8 -0
  93. package/ui/Blocks/CommonGrid/components/gridCells/DateTime.d.ts +4 -0
  94. package/ui/Blocks/CommonGrid/components/gridCells/DateTime.js +13 -0
  95. package/ui/Blocks/CommonGrid/components/gridCells/EnumInCell.d.ts +9 -0
  96. package/ui/Blocks/CommonGrid/components/gridCells/EnumInCell.js +33 -0
  97. package/ui/Blocks/CommonGrid/components/gridCells/HoverBubble.d.ts +4 -0
  98. package/ui/Blocks/CommonGrid/components/gridCells/HoverBubble.js +18 -0
  99. package/ui/Blocks/CommonGrid/components/gridCells/IconButtonInCell.d.ts +9 -0
  100. package/ui/Blocks/CommonGrid/components/gridCells/IconButtonInCell.js +15 -0
  101. package/ui/Blocks/CommonGrid/components/gridCells/ImageCell.d.ts +6 -0
  102. package/ui/Blocks/CommonGrid/components/gridCells/ImageCell.js +23 -0
  103. package/ui/Blocks/CommonGrid/components/gridCells/LinkInCell.d.ts +1 -0
  104. package/ui/Blocks/CommonGrid/components/gridCells/LinkInCell.js +8 -0
  105. package/ui/Blocks/CommonGrid/components/gridCells/RemoveItem.d.ts +5 -0
  106. package/ui/Blocks/CommonGrid/components/gridCells/RemoveItem.js +24 -0
  107. package/ui/Blocks/CommonGrid/components/gridCells/RowActionsCell.d.ts +7 -0
  108. package/ui/Blocks/CommonGrid/components/gridCells/RowActionsCell.js +30 -0
  109. package/ui/Blocks/CommonGrid/components/gridCells/StringJoin.d.ts +4 -0
  110. package/ui/Blocks/CommonGrid/components/gridCells/StringJoin.js +7 -0
  111. package/ui/Blocks/CommonGrid/components/gridCells/SwitchInCell.d.ts +2 -0
  112. package/ui/Blocks/CommonGrid/components/gridCells/SwitchInCell.js +16 -0
  113. package/ui/Blocks/CommonGrid/components/gridCells/ToggleCell.d.ts +7 -0
  114. package/ui/Blocks/CommonGrid/components/gridCells/ToggleCell.js +30 -0
  115. package/ui/Blocks/CommonGrid/components/gridCells/index.d.ts +14 -0
  116. package/ui/Blocks/CommonGrid/components/gridCells/index.js +14 -0
  117. package/ui/Blocks/CommonGrid/hooks/useAddFilter.d.ts +4 -0
  118. package/ui/Blocks/CommonGrid/hooks/useAddFilter.js +14 -0
  119. package/ui/Blocks/CommonGrid/hooks/useEditReadAsColumn.d.ts +15 -0
  120. package/ui/Blocks/CommonGrid/hooks/useEditReadAsColumn.js +70 -0
  121. package/ui/Blocks/CommonGrid/hooks/useFloatingButton.d.ts +3 -0
  122. package/ui/Blocks/CommonGrid/hooks/useFloatingButton.js +13 -0
  123. package/ui/Blocks/CommonGrid/hooks/useGetGridHeight.d.ts +7 -0
  124. package/ui/Blocks/CommonGrid/hooks/useGetGridHeight.js +33 -0
  125. package/ui/Blocks/CommonGrid/hooks/useGridActionTrigger.d.ts +8 -0
  126. package/ui/Blocks/CommonGrid/hooks/useGridActionTrigger.js +25 -0
  127. package/ui/Blocks/CommonGrid/hooks/useManageColumn.d.ts +19 -0
  128. package/ui/Blocks/CommonGrid/hooks/useManageColumn.js +34 -0
  129. package/ui/Blocks/CommonGrid/hooks/useToggleAllCheckbox.d.ts +8 -0
  130. package/ui/Blocks/CommonGrid/hooks/useToggleAllCheckbox.js +15 -0
  131. package/ui/Blocks/CommonGrid/index.d.ts +8 -6
  132. package/ui/Blocks/CommonGrid/index.js +8 -8
  133. package/ui/Blocks/CommonGrid/storybook/stories/complexWithPaginationAndRedux.stories.js +4 -4
  134. package/ui/Blocks/CommonGrid/storybook/stories/default.stories.js +3 -2
  135. package/ui/Blocks/CommonGrid/storybook/stories/loading.stories.js +3 -2
  136. package/ui/Blocks/CommonGrid/storybook/stories/manyColumnsNoScrollLayout.stories.js +3 -3
  137. package/ui/Blocks/CommonGrid/storybook/stories/manyColumnsNormalLayout.stories.js +3 -3
  138. package/ui/Blocks/CommonGrid/storybook/stories/styledCommonGrid.stories.js +2 -2
  139. package/ui/Blocks/CommonGrid/storybook/stories/withCustomGridActions.stories.js +3 -3
  140. package/ui/Blocks/CommonGrid/storybook/stories/withForcedCheckboxes.stories.js +2 -1
  141. package/ui/Blocks/CommonGrid/storybook/utils/linguiContainer.d.ts +1 -0
  142. package/ui/Blocks/CommonGrid/storybook/utils/linguiContainer.js +8 -0
  143. package/ui/Blocks/CommonGrid/storybook/utils/utils.js +1 -1
  144. package/ui/Blocks/CommonGrid/storybook/utils/withTheme.js +1 -17
  145. package/ui/Blocks/CommonGrid/styles.d.ts +14 -0
  146. package/ui/Blocks/CommonGrid/styles.js +33 -0
  147. package/ui/Blocks/CommonGrid/translations.d.ts +1 -0
  148. package/ui/Blocks/CommonGrid/translations.js +6 -0
  149. package/ui/Blocks/CommonGrid/types.d.ts +29 -15
  150. package/ui/Blocks/CommonGrid/utils/index.d.ts +4 -1
  151. package/ui/Blocks/CommonGrid/utils/index.js +19 -0
  152. package/ui/Blocks/HidePrint/HidePrint.d.ts +6 -0
  153. package/ui/Blocks/HidePrint/HidePrint.js +13 -0
  154. package/ui/Blocks/Popover/index.d.ts +12 -0
  155. package/ui/Blocks/Popover/index.js +21 -0
  156. package/ui/Elements/DatePicker/DatePicker.d.ts +20 -0
  157. package/ui/Elements/DatePicker/DatePicker.js +65 -0
  158. package/ui/Elements/DatePicker/Datetime/DateTime.d.ts +95 -0
  159. package/ui/Elements/DatePicker/Datetime/DateTime.js +516 -0
  160. package/ui/Elements/DatePicker/Datetime/components/Timepicker.d.ts +8 -0
  161. package/ui/Elements/DatePicker/Datetime/components/Timepicker.js +57 -0
  162. package/ui/Elements/DatePicker/Datetime/components/ViewNavigation.d.ts +9 -0
  163. package/ui/Elements/DatePicker/Datetime/components/ViewNavigation.js +16 -0
  164. package/ui/Elements/DatePicker/Datetime/types.d.ts +61 -0
  165. package/ui/Elements/DatePicker/Datetime/types.js +7 -0
  166. package/ui/Elements/DatePicker/Datetime/views/DaysView.d.ts +14 -0
  167. package/ui/Elements/DatePicker/Datetime/views/DaysView.js +145 -0
  168. package/ui/Elements/DatePicker/Datetime/views/MonthsView.d.ts +10 -0
  169. package/ui/Elements/DatePicker/Datetime/views/MonthsView.js +111 -0
  170. package/ui/Elements/DatePicker/Datetime/views/YearsView.d.ts +15 -0
  171. package/ui/Elements/DatePicker/Datetime/views/YearsView.js +117 -0
  172. package/ui/Elements/DatePicker/index.d.ts +2 -0
  173. package/ui/Elements/DatePicker/index.js +2 -0
  174. package/ui/Elements/DatePicker/styles.d.ts +2 -0
  175. package/ui/Elements/DatePicker/styles.js +8 -0
  176. package/ui/Elements/DropdownMenu/DropdownMenu.d.ts +2 -0
  177. package/ui/Elements/DropdownMenu/DropdownMenu.js +36 -0
  178. package/ui/Elements/DropdownMenu/components/DefaultItem.d.ts +3 -0
  179. package/ui/Elements/DropdownMenu/components/DefaultItem.js +16 -0
  180. package/ui/Elements/DropdownMenu/components/MenuItem.d.ts +3 -0
  181. package/ui/Elements/DropdownMenu/components/MenuItem.js +51 -0
  182. package/ui/Elements/DropdownMenu/components/MenuList.d.ts +3 -0
  183. package/ui/Elements/DropdownMenu/components/MenuList.js +10 -0
  184. package/ui/Elements/DropdownMenu/index.d.ts +1 -0
  185. package/ui/Elements/DropdownMenu/index.js +1 -0
  186. package/ui/Elements/DropdownMenu/types.d.ts +41 -0
  187. package/ui/Elements/DropdownMenu/types.js +1 -0
  188. package/ui/Elements/DropdownSelect/DropdownSelect.d.ts +21 -0
  189. package/ui/Elements/DropdownSelect/DropdownSelect.js +47 -0
  190. package/ui/Elements/DropdownSelect/index.d.ts +4 -0
  191. package/ui/Elements/DropdownSelect/index.js +3 -0
  192. package/ui/Elements/HighlightBox/HighlightBox.d.ts +50 -0
  193. package/ui/Elements/HighlightBox/HighlightBox.js +65 -0
  194. package/ui/Elements/HighlightBox/index.d.ts +2 -0
  195. package/ui/Elements/HighlightBox/index.js +2 -0
  196. package/ui/Elements/Icon/icons/Company.d.ts +3 -0
  197. package/ui/Elements/Icon/icons/Company.js +13 -0
  198. package/ui/Elements/Icon/icons/Integrations.d.ts +3 -0
  199. package/ui/Elements/Icon/icons/Integrations.js +13 -0
  200. package/ui/Elements/Icon/icons/ShoppingBag.d.ts +3 -0
  201. package/ui/Elements/Icon/icons/ShoppingBag.js +13 -0
  202. package/ui/Elements/Icon/icons/Truck.d.ts +3 -0
  203. package/ui/Elements/Icon/icons/Truck.js +13 -0
  204. package/ui/Elements/Icon/icons/TwoUsers.d.ts +3 -0
  205. package/ui/Elements/Icon/icons/TwoUsers.js +13 -0
  206. package/ui/Elements/Icon/icons/index.d.ts +5 -0
  207. package/ui/Elements/Icon/icons/index.js +5 -0
  208. package/ui/Elements/MultiSelect/MultiSelect.d.ts +6 -0
  209. package/ui/Elements/MultiSelect/MultiSelect.js +29 -0
  210. package/ui/Elements/MultiSelect/index.d.ts +2 -0
  211. package/ui/Elements/MultiSelect/index.js +2 -0
  212. package/ui/Elements/Pagination/Pagination.d.ts +4 -3
  213. package/ui/Elements/Pagination/Pagination.js +11 -3
  214. package/ui/Elements/Pagination/stories/Pagination.stories.d.ts +1 -1
  215. package/ui/Elements/Pagination/styled.js +6 -6
  216. package/ui/Elements/Select/Select.d.ts +3 -0
  217. package/ui/Elements/Select/Select.js +69 -0
  218. package/ui/Elements/Select/index.d.ts +2 -0
  219. package/ui/Elements/Select/index.js +2 -0
  220. package/ui/Elements/Select/styles.d.ts +5 -0
  221. package/ui/Elements/Select/styles.js +12 -0
  222. package/ui/Elements/Select/themes/CustomComponents.d.ts +8 -0
  223. package/ui/Elements/Select/themes/CustomComponents.js +125 -0
  224. package/ui/Elements/Select/themes/baseStyles.d.ts +28 -0
  225. package/ui/Elements/Select/themes/baseStyles.js +87 -0
  226. package/ui/Elements/Select/themes/formStyles.d.ts +24 -0
  227. package/ui/Elements/Select/themes/formStyles.js +102 -0
  228. package/ui/Elements/Select/themes/index.d.ts +3 -0
  229. package/ui/Elements/Select/themes/index.js +43 -0
  230. package/ui/Elements/Select/types.d.ts +55 -0
  231. package/ui/Elements/Select/types.js +1 -0
  232. package/ui/Elements/SingleSelect/SingleSelect.d.ts +20 -0
  233. package/ui/Elements/SingleSelect/SingleSelect.js +197 -0
  234. package/ui/Elements/SingleSelect/index.d.ts +2 -0
  235. package/ui/Elements/SingleSelect/index.js +2 -0
  236. package/ui/Elements/Toggle/Toggle.d.ts +1 -1
  237. package/ui/Elements/Toggle/Toggle.js +2 -2
  238. package/ui/Elements/Toggle/stories/Toggle.stories.d.ts +1 -1
  239. package/ui/Elements/Toggle/types.d.ts +1 -0
  240. package/ui/Forms/Input/types.d.ts +2 -2
  241. package/ui/Forms/TextArea/TextArea.d.ts +20 -0
  242. package/ui/Forms/TextArea/TextArea.js +34 -0
  243. package/ui/Forms/TextArea/index.d.ts +2 -0
  244. package/ui/Forms/TextArea/index.js +2 -0
  245. package/ui/Forms/TextArea/styles.d.ts +12 -0
  246. package/ui/Forms/TextArea/styles.js +31 -0
  247. package/ui/ThemeProvider/ThemeProvider.d.ts +3 -1
  248. package/ui/ThemeProvider/ThemeProvider.js +4 -2
  249. package/ui/ThemeProvider/types.d.ts +1 -0
  250. package/ui/index.d.ts +17 -1
  251. package/ui/index.es.js +42462 -8524
  252. package/ui/index.js +17 -1
  253. package/ui/index.umd.js +1647 -270
  254. package/ui/Blocks/CommonGrid/CommonGridContext.d.ts +0 -12
  255. package/ui/Blocks/CommonGrid/CommonGridContext.js +0 -45
  256. package/ui/Blocks/CommonGrid/components/ActionColumnHead.d.ts +0 -4
  257. package/ui/Blocks/CommonGrid/components/ActionColumnHead.js +0 -16
  258. package/ui/Blocks/CommonGrid/components/ButtonStrip.d.ts +0 -7
  259. package/ui/Blocks/CommonGrid/components/ButtonStrip.js +0 -35
  260. package/ui/Blocks/CommonGrid/components/ConfigForm.d.ts +0 -9
  261. package/ui/Blocks/CommonGrid/components/ConfigForm.js +0 -58
  262. package/ui/Blocks/CommonGrid/components/DefaultPaginator.d.ts +0 -3
  263. package/ui/Blocks/CommonGrid/components/DefaultPaginator.js +0 -11
  264. package/ui/Blocks/CommonGrid/components/Dialog.d.ts +0 -11
  265. package/ui/Blocks/CommonGrid/components/Dialog.js +0 -19
  266. package/ui/Blocks/CommonGrid/components/DropdownMenu.d.ts +0 -21
  267. package/ui/Blocks/CommonGrid/components/DropdownMenu.js +0 -59
  268. package/ui/Blocks/CommonGrid/components/DropdownSelect.d.ts +0 -15
  269. package/ui/Blocks/CommonGrid/components/DropdownSelect.js +0 -35
  270. package/ui/Blocks/CommonGrid/components/FloatingButton.d.ts +0 -6
  271. package/ui/Blocks/CommonGrid/components/FloatingButton.js +0 -13
  272. package/ui/Blocks/CommonGrid/components/icons/ArrowSimple.d.ts +0 -2
  273. package/ui/Blocks/CommonGrid/hooks/useControlButtons.d.ts +0 -10
  274. package/ui/Blocks/CommonGrid/hooks/useControlButtons.js +0 -64
  275. package/ui/Blocks/CommonGrid/storybook/stories/customControllButtons.stories.d.ts +0 -13
  276. package/ui/Blocks/CommonGrid/storybook/stories/customControllButtons.stories.js +0 -49
  277. package/ui/Blocks/CommonGrid/storybook/utils/filters.d.ts +0 -2
  278. package/ui/Blocks/CommonGrid/storybook/utils/filters.js +0 -23
  279. package/ui/Blocks/CommonGrid/utils/public.d.ts +0 -16
  280. package/ui/Blocks/CommonGrid/utils/public.js +0 -52
@@ -0,0 +1,9 @@
1
+ import { FlagAppearanceType } from '../../../../Elements/HighlightBox/HighlightBox';
2
+ type Props = {
3
+ value: string;
4
+ appearanceMap: Record<string, FlagAppearanceType>;
5
+ enumObj: Record<string, () => string>;
6
+ size?: 'default' | 'small' | 'wide' | 'fitContent';
7
+ };
8
+ export declare const EnumInCell: ({ value, enumObj, appearanceMap, size }: Props) => JSX.Element | null;
9
+ export {};
@@ -0,0 +1,33 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { useMemo } from 'react';
18
+ import styled from '@xstyled/styled-components';
19
+ import HighlightBox from '../../../../Elements/HighlightBox';
20
+ var Center = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: flex-start;\n width: 100%;\n"], ["\n display: flex;\n justify-content: flex-start;\n width: 100%;\n"])));
21
+ export var EnumInCell = function (_a) {
22
+ var value = _a.value, enumObj = _a.enumObj, appearanceMap = _a.appearanceMap, size = _a.size;
23
+ var finalLabel = useMemo(function () {
24
+ return enumObj[value] ? enumObj[value]() : value;
25
+ }, [enumObj, value]);
26
+ var coloringProp = useMemo(function () {
27
+ return { appearance: appearanceMap[value] };
28
+ }, [appearanceMap, value]);
29
+ if (!finalLabel)
30
+ return null;
31
+ return (_jsx(Center, { children: _jsx(HighlightBox, __assign({}, coloringProp, { size: size, prefix: "grid", children: finalLabel })) }));
32
+ };
33
+ var templateObject_1;
@@ -0,0 +1,4 @@
1
+ import { DataCellProps } from '../../types';
2
+ type Props = DataCellProps<{}>;
3
+ export declare const HoverBubble: ({ rowData, column }: Props) => JSX.Element | null;
4
+ export {};
@@ -0,0 +1,18 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ import styled from '@xstyled/styled-components';
7
+ import get from 'lodash/fp/get';
8
+ var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n\n :hover {\n cursor: pointer;\n .tooltip {\n display: block;\n }\n }\n"], ["\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n\n :hover {\n cursor: pointer;\n .tooltip {\n display: block;\n }\n }\n"])));
9
+ var Tooltip = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-content: center;\n justify-content: center;\n margin-bottom: 2;\n\n div {\n display: none;\n position: absolute;\n background-color: white;\n color: gray;\n border-color: gray;\n border: 1px solid;\n border-radius: md;\n padding: 2 3;\n margin: 1;\n z-index: 1;\n box-shadow: tooltipBoxShadow;\n transform: translateY(-100%);\n\n max-width: 400px;\n line-break: anywhere;\n white-space: initial;\n }\n"], ["\n display: flex;\n align-content: center;\n justify-content: center;\n margin-bottom: 2;\n\n div {\n display: none;\n position: absolute;\n background-color: white;\n color: gray;\n border-color: gray;\n border: 1px solid;\n border-radius: md;\n padding: 2 3;\n margin: 1;\n z-index: 1;\n box-shadow: tooltipBoxShadow;\n transform: translateY(-100%);\n\n max-width: 400px;\n line-break: anywhere;\n white-space: initial;\n }\n"])));
10
+ export var HoverBubble = function (_a) {
11
+ var rowData = _a.rowData, column = _a.column;
12
+ var value = get(column.name, rowData);
13
+ if (value) {
14
+ return (_jsxs(Wrapper, { children: [_jsx(Tooltip, { children: _jsx("div", { className: "tooltip", children: value }) }), value] }));
15
+ }
16
+ return null;
17
+ };
18
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ icon?: string;
4
+ isLoading?: boolean;
5
+ onClick: React.HTMLProps<HTMLButtonElement>['onClick'];
6
+ linkTo?: string;
7
+ };
8
+ export declare const IconButtonInCell: ({ icon, isLoading, onClick, linkTo }: Props) => JSX.Element;
9
+ export {};
@@ -0,0 +1,15 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import styled from '@xstyled/styled-components';
7
+ import { Link as ReactLink } from 'react-router-dom';
8
+ import Spinner from '../../../../Elements/Spinner/Spinner';
9
+ import Icon from '../../../../Elements/Icon/Icon';
10
+ var Center = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n width: 100%;\n & > * {\n cursor: pointer;\n color: gray1;\n :hover {\n color: blue2;\n }\n }\n"], ["\n display: flex;\n justify-content: center;\n width: 100%;\n & > * {\n cursor: pointer;\n color: gray1;\n :hover {\n color: blue2;\n }\n }\n"])));
11
+ export var IconButtonInCell = function (_a) {
12
+ var icon = _a.icon, isLoading = _a.isLoading, onClick = _a.onClick, linkTo = _a.linkTo;
13
+ return (_jsx(Center, { children: isLoading ? (_jsx(Spinner, { variant: "sm" })) : linkTo ? (_jsx(ReactLink, { to: linkTo, "data-cy": "".concat(icon, "IconBtn"), children: _jsx(Icon, { icon: icon || 'warning', size: "16px" }) })) : (_jsx("span", { onClick: onClick, "data-cy": "".concat(icon, "IconBtn"), children: _jsx(Icon, { icon: icon || 'warning', size: "16px" }) })) }));
14
+ };
15
+ var templateObject_1;
@@ -0,0 +1,6 @@
1
+ import { DataCellProps } from '../../types';
2
+ type Props = DataCellProps<{}> & {
3
+ onClick?: () => void;
4
+ };
5
+ export declare const ImageCell: ({ rowData, column, onClick }: Props) => JSX.Element | null;
6
+ export {};
@@ -0,0 +1,23 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import styled from '@xstyled/styled-components';
7
+ import get from 'lodash/fp/get';
8
+ import Image from '../../../../Elements/Image/Image';
9
+ var ImageWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n height: 100%;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n"], ["\n ", "\n height: 100%;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n"])), function (_a) {
10
+ var onClick = _a.onClick;
11
+ return (onClick ? 'cursor: pointer;' : '');
12
+ });
13
+ var StyledImage = styled(Image)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n max-width: 100%;\n height: 30px;\n border: 1x solid;\n border-radius: md;\n border-color: lightGray3;\n"], ["\n max-width: 100%;\n height: 30px;\n border: 1x solid;\n border-radius: md;\n border-color: lightGray3;\n"])));
14
+ export var ImageCell = function (_a) {
15
+ var _b;
16
+ var rowData = _a.rowData, column = _a.column, onClick = _a.onClick;
17
+ var value = get(column.name, rowData);
18
+ if ((_b = value === null || value === void 0 ? void 0 : value[0]) === null || _b === void 0 ? void 0 : _b.urlSmall) {
19
+ return (_jsx(ImageWrapper, { onClick: onClick, children: _jsx(StyledImage, { src: value[0].urlSmall }) }));
20
+ }
21
+ return null;
22
+ };
23
+ var templateObject_1, templateObject_2;
@@ -0,0 +1 @@
1
+ export declare const LinkInCell: import("styled-components").StyledComponent<typeof import("react-router-dom").Link, import("@xstyled/system").Theme, import("../../../../Elements/SimpleLink/SimpleLink").Props, never>;
@@ -0,0 +1,8 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import styled from '@xstyled/styled-components';
6
+ import { SimpleLink } from '../../../../Elements/SimpleLink';
7
+ export var LinkInCell = styled(SimpleLink)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n text-decoration: underline;\n"], ["\n text-decoration: underline;\n"])));
8
+ var templateObject_1;
@@ -0,0 +1,5 @@
1
+ import { DataCellProps } from '../../types';
2
+ type Props = DataCellProps<any>;
3
+ export declare const Wrap: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
4
+ export declare const RemoveCell: ({ rowData, onRowAction }: Props) => JSX.Element;
5
+ export {};
@@ -0,0 +1,24 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ import React from 'react';
7
+ import styled from '@xstyled/styled-components';
8
+ import { Trans } from '@lingui/react';
9
+ import Icon from '../../../../Elements/Icon/Icon';
10
+ export var Wrap = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n"], ["\n width: 100%;\n"])));
11
+ var Trigger = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n cursor: pointer;\n color: gray;\n font-weight: bold;\n font-size: 10px;\n & .faIcon {\n margin-right: 4px;\n }\n"], ["\n display: flex;\n justify-content: center;\n cursor: pointer;\n color: gray;\n font-weight: bold;\n font-size: 10px;\n & .faIcon {\n margin-right: 4px;\n }\n"])));
12
+ export var RemoveCell = function (_a) {
13
+ var _b;
14
+ var rowData = _a.rowData, onRowAction = _a.onRowAction;
15
+ var onRemoveClick = React.useCallback(function () {
16
+ if (onRowAction)
17
+ onRowAction(rowData.id, 'remove', rowData);
18
+ }, [rowData, onRowAction]);
19
+ if (((_b = rowData === null || rowData === void 0 ? void 0 : rowData.product) === null || _b === void 0 ? void 0 : _b.type) === 'virtual') {
20
+ return _jsx(Trans, { id: "dataGrid.columnLot.NA", message: "N/A" });
21
+ }
22
+ return (_jsx(Wrap, { children: _jsxs(Trigger, { onClick: onRemoveClick, children: [_jsx(Icon, { icon: "deleteX", size: "12px" }), _jsx(Trans, { id: "dataGrid.deleteItem", message: "Delete" })] }) }));
23
+ };
24
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,7 @@
1
+ type Props = {
2
+ canEdit: boolean;
3
+ onClick: () => void;
4
+ linkTo?: string;
5
+ };
6
+ export declare const RowActionsCell: ({ canEdit, onClick, linkTo }: Props) => JSX.Element;
7
+ export {};
@@ -0,0 +1,30 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { useCallback, useMemo } from 'react';
7
+ import styled from '@xstyled/styled-components';
8
+ import { isFunction } from 'lodash/fp';
9
+ import { IconButtonInCell } from './IconButtonInCell';
10
+ var Center = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n cursor: pointer;\n width: 100%;\n\n svg {\n color: blue2;\n }\n"], ["\n display: flex;\n justify-content: center;\n cursor: pointer;\n width: 100%;\n\n svg {\n color: blue2;\n }\n"])));
11
+ export var RowActionsCell = function (_a) {
12
+ var canEdit = _a.canEdit, onClick = _a.onClick, linkTo = _a.linkTo;
13
+ var handleOnClick = useCallback(function () {
14
+ if (isFunction(onClick)) {
15
+ onClick();
16
+ }
17
+ }, [onClick]);
18
+ var actions = useMemo(function () {
19
+ var actionOptions = [];
20
+ if (canEdit) {
21
+ actionOptions.push(_jsx(IconButtonInCell, { icon: "pen", onClick: handleOnClick, linkTo: linkTo }, "edit"));
22
+ }
23
+ else {
24
+ actionOptions.push(_jsx(IconButtonInCell, { icon: "chevronRight", onClick: handleOnClick, linkTo: linkTo }, "read"));
25
+ }
26
+ return actionOptions;
27
+ }, [canEdit, handleOnClick, linkTo]);
28
+ return _jsx(Center, { onClick: handleOnClick, children: actions });
29
+ };
30
+ var templateObject_1;
@@ -0,0 +1,4 @@
1
+ import { DataCellProps } from '../../types';
2
+ type Props = DataCellProps<{}>;
3
+ export declare const StringJoinCell: ({ rowData, column }: Props) => JSX.Element | null;
4
+ export {};
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import get from 'lodash/fp/get';
3
+ export var StringJoinCell = function (_a) {
4
+ var rowData = _a.rowData, column = _a.column;
5
+ var values = get(column.name, rowData);
6
+ return values && values.length ? _jsx("span", { className: "cell", children: values.join(', ') }) : null;
7
+ };
@@ -0,0 +1,2 @@
1
+ import { Props } from '../../../../Elements/Toggle/types';
2
+ export declare const SwitchInCell: (props: Props) => JSX.Element;
@@ -0,0 +1,16 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import Toggle from '../../../../Elements/Toggle/Toggle';
14
+ export var SwitchInCell = function (props) {
15
+ return _jsx(Toggle, __assign({}, props, { variant: "grid" }));
16
+ };
@@ -0,0 +1,7 @@
1
+ import { DataCellProps } from '../../types';
2
+ type SwitchData = {
3
+ id: string;
4
+ };
5
+ type Props = DataCellProps<SwitchData>;
6
+ export declare const ToggleCell: ({ rowData, column, onRowAction }: Props) => JSX.Element;
7
+ export {};
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React, { useCallback } from 'react';
3
+ import { SwitchInCell } from './SwitchInCell';
4
+ import get from 'lodash/fp/get';
5
+ export var ToggleCell = function (_a) {
6
+ var _b;
7
+ var rowData = _a.rowData, column = _a.column, onRowAction = _a.onRowAction;
8
+ var inverse = !!((_b = column === null || column === void 0 ? void 0 : column.passProps) === null || _b === void 0 ? void 0 : _b.inverse);
9
+ var rawValue = get(column.name, rowData);
10
+ var value = inverse ? !rawValue : !!rawValue;
11
+ var actionName = "toggle_".concat(column.name);
12
+ var _c = React.useState(value), isChecked = _c[0], setIsChecked = _c[1];
13
+ React.useEffect(function () {
14
+ setIsChecked(value);
15
+ }, [rowData.id]);
16
+ var onSwitchChange = useCallback(function () {
17
+ if (!onRowAction)
18
+ return;
19
+ var ret = onRowAction(rowData.id, actionName, !isChecked);
20
+ if (ret) {
21
+ // promise returned = we wait for result
22
+ ret.then(function () { return setIsChecked(!isChecked); });
23
+ }
24
+ else {
25
+ // no promise = we fake feedback
26
+ setIsChecked(!isChecked);
27
+ }
28
+ }, [onRowAction, rowData.id, actionName, isChecked]);
29
+ return _jsx(SwitchInCell, { checked: isChecked, onChange: onSwitchChange });
30
+ };
@@ -0,0 +1,14 @@
1
+ export { DateCell } from './Date';
2
+ export { DateTimeCell } from './DateTime';
3
+ export { StringJoinCell } from './StringJoin';
4
+ export { BoolIconCell } from './BoolIcon';
5
+ export { RemoveCell } from './RemoveItem';
6
+ export { LinkInCell } from './LinkInCell';
7
+ export { ButtonInCell } from './ButtonInCell';
8
+ export { IconButtonInCell } from './IconButtonInCell';
9
+ export { SwitchInCell } from './SwitchInCell';
10
+ export { ImageCell } from './ImageCell';
11
+ export { EnumInCell } from './EnumInCell';
12
+ export { HoverBubble } from './HoverBubble';
13
+ export { RowActionsCell } from './RowActionsCell';
14
+ export { ToggleCell } from './ToggleCell';
@@ -0,0 +1,14 @@
1
+ export { DateCell } from './Date';
2
+ export { DateTimeCell } from './DateTime';
3
+ export { StringJoinCell } from './StringJoin';
4
+ export { BoolIconCell } from './BoolIcon';
5
+ export { RemoveCell } from './RemoveItem';
6
+ export { LinkInCell } from './LinkInCell';
7
+ export { ButtonInCell } from './ButtonInCell';
8
+ export { IconButtonInCell } from './IconButtonInCell';
9
+ export { SwitchInCell } from './SwitchInCell';
10
+ export { ImageCell } from './ImageCell';
11
+ export { EnumInCell } from './EnumInCell';
12
+ export { HoverBubble } from './HoverBubble';
13
+ export { RowActionsCell } from './RowActionsCell';
14
+ export { ToggleCell } from './ToggleCell';
@@ -0,0 +1,4 @@
1
+ import { GridActionsType, ColumnDefinition } from '../types';
2
+ type AddFilterRet = (value: any, column: ColumnDefinition) => void;
3
+ export declare const useAddFilter: (onChange: Required<GridActionsType>['addFilter']) => AddFilterRet;
4
+ export {};
@@ -0,0 +1,14 @@
1
+ import { useCallback } from 'react';
2
+ import { createFilterType, getFilterName } from '../utils';
3
+ export var useAddFilter = function (onChange) {
4
+ return useCallback(function (value, column) {
5
+ if (onChange) {
6
+ var filterProps = {
7
+ type: createFilterType(column),
8
+ filterExtraProps: column.filterExtraProps || {},
9
+ computedValue: column.getFilterCriteria ? column.getFilterCriteria(value) : null,
10
+ };
11
+ onChange(getFilterName(column), value, filterProps);
12
+ }
13
+ }, [onChange]);
14
+ };
@@ -0,0 +1,15 @@
1
+ import { CommonGridProps } from '../types';
2
+ type ExcludedProps = 'components' | 'filters' | 'onBatchAction' | 'extraControlButtons';
3
+ type Props = Omit<CommonGridProps, ExcludedProps>;
4
+ type UseEditReadAsColumnHook = {
5
+ columnsDefinitions: CommonGridProps['columnsDefinitions'];
6
+ actionColumnDefinition: CommonGridProps['actionColumnDefinition'];
7
+ onRowAction: CommonGridProps['onRowAction'];
8
+ };
9
+ /**
10
+ * Because in new design we are displaying lot of the controlls differently, including read and edit buttons in grid,
11
+ * easiest way to make all the definition changes is to just overwrite the here once, instead of modifying every single grid (33 instances atm).
12
+ * This will also allow to easily swap back to grid provided logic, if it becomes usable for redesigned grid or if design changes again
13
+ * */
14
+ declare const useEditReadAsColumn: (props: Props) => UseEditReadAsColumnHook;
15
+ export default useEditReadAsColumn;
@@ -0,0 +1,70 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ import { useCallback, useMemo } from 'react';
11
+ import getReadEditButtonCell from '../components/ReadEditButtonCell';
12
+ /**
13
+ * Because in new design we are displaying lot of the controlls differently, including read and edit buttons in grid,
14
+ * easiest way to make all the definition changes is to just overwrite the here once, instead of modifying every single grid (33 instances atm).
15
+ * This will also allow to easily swap back to grid provided logic, if it becomes usable for redesigned grid or if design changes again
16
+ * */
17
+ var useEditReadAsColumn = function (props) {
18
+ var onRowAction = props.onRowAction, actionColumnDefinition = props.actionColumnDefinition, columnsDefinitions = props.columnsDefinitions, onRowEditClick = props.onRowEditClick, onRowReadClick = props.onRowReadClick;
19
+ var modifiedActionColumnDefinition = useMemo(function () {
20
+ var _a;
21
+ if ((actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.forceCheckboxes) || ((_a = actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.actionOptions) === null || _a === void 0 ? void 0 : _a.length)) {
22
+ // note: this also removes actions, because we render action trigger outside the grid anyway
23
+ return { flexBasis: 40, forceCheckboxes: true, addRowNumbers: true, checkAllPosition: 'top' };
24
+ }
25
+ else if (actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.addRowNumbers) {
26
+ return { flexBasis: 40, addRowNumbers: true };
27
+ }
28
+ else {
29
+ return undefined;
30
+ }
31
+ }, [actionColumnDefinition]);
32
+ var modifiedOnRowAction = useCallback(function (id, field, value) {
33
+ if (field === 'row_edit' || field === 'row_read') {
34
+ if (field === 'row_edit' && onRowEditClick)
35
+ onRowEditClick(id, value);
36
+ if (field === 'row_read' && onRowReadClick)
37
+ onRowReadClick(id, value);
38
+ }
39
+ else if (onRowAction) {
40
+ return onRowAction(id, field, value);
41
+ }
42
+ }, [onRowAction, onRowEditClick, onRowReadClick]);
43
+ // TODO Entire logic of row edit / row read need to be completely refactored.
44
+ var CellComponent = useMemo(function () { return getReadEditButtonCell(actionColumnDefinition); }, [actionColumnDefinition]);
45
+ var modifiedColumnsDefinitions = useMemo(function () {
46
+ if ((actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.canRowEdit) !== undefined || (actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.canRowRead) !== undefined) {
47
+ return __spreadArray(__spreadArray([], columnsDefinitions, true), [
48
+ {
49
+ name: 'sticky',
50
+ flexBasis: 88,
51
+ filtering: false,
52
+ sorting: false,
53
+ sticky: true,
54
+ stickTo: 'right',
55
+ alwaysOn: true,
56
+ cellComponent: CellComponent,
57
+ },
58
+ ], false);
59
+ }
60
+ else {
61
+ return columnsDefinitions;
62
+ }
63
+ }, [CellComponent, actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.canRowEdit, actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.canRowRead, columnsDefinitions]);
64
+ return {
65
+ columnsDefinitions: modifiedColumnsDefinitions,
66
+ actionColumnDefinition: modifiedActionColumnDefinition,
67
+ onRowAction: modifiedOnRowAction,
68
+ };
69
+ };
70
+ export default useEditReadAsColumn;
@@ -0,0 +1,3 @@
1
+ import { FloatingButtonProps, Item } from '../types';
2
+ declare const useFloatingButton: (hasPermission: any, onClick?: () => void, options?: Item[], onSelect?: ((value: string) => void) | undefined) => FloatingButtonProps | undefined;
3
+ export default useFloatingButton;
@@ -0,0 +1,13 @@
1
+ import { useMemo } from 'react';
2
+ var useFloatingButton = function (hasPermission, onClick, options, onSelect) {
3
+ return useMemo(function () {
4
+ if (!hasPermission)
5
+ return;
6
+ return {
7
+ onClick: onClick,
8
+ options: options,
9
+ onSelect: onSelect,
10
+ };
11
+ }, [hasPermission, onClick, options, onSelect]);
12
+ };
13
+ export default useFloatingButton;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare const useGetGridHeight: () => {
3
+ gridHeight: number | undefined;
4
+ gridRef: import("react").MutableRefObject<HTMLElement | null>;
5
+ paginationRef: import("react").MutableRefObject<HTMLElement | null>;
6
+ };
7
+ export default useGetGridHeight;
@@ -0,0 +1,33 @@
1
+ import { useEffect, useMemo, useRef, useState } from 'react';
2
+ var useGetGridHeight = function () {
3
+ var _a = useState(window.innerHeight), windowHeight = _a[0], setWindowHeight = _a[1];
4
+ var _b = useState(0), topDistance = _b[0], setTopDistance = _b[1];
5
+ var _c = useState(0), bottomDistance = _c[0], setBottomDistance = _c[1];
6
+ var gridRef = useRef(null);
7
+ var paginationRef = useRef(null);
8
+ useEffect(function () {
9
+ var handleResize = function () {
10
+ var _a, _b;
11
+ setTopDistance(((_a = gridRef.current) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0);
12
+ setBottomDistance(((_b = paginationRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0);
13
+ setWindowHeight(window.innerHeight);
14
+ };
15
+ handleResize();
16
+ window.addEventListener('resize', handleResize);
17
+ return function () {
18
+ window.removeEventListener('resize', handleResize);
19
+ };
20
+ }, []);
21
+ var gridHeight = useMemo(function () {
22
+ var calculatedHeight = windowHeight - topDistance - bottomDistance;
23
+ if (calculatedHeight !== windowHeight && calculatedHeight > 360) {
24
+ return calculatedHeight - 25;
25
+ }
26
+ else {
27
+ // grids inside modals
28
+ return undefined;
29
+ }
30
+ }, [bottomDistance, topDistance, windowHeight]);
31
+ return { gridHeight: gridHeight, gridRef: gridRef, paginationRef: paginationRef };
32
+ };
33
+ export default useGetGridHeight;
@@ -0,0 +1,8 @@
1
+ import { RowProps, UxState, ActionColumn, OnBatchActionFn } from '../types';
2
+ /**
3
+ * hook for action selection and trigger
4
+ * returns [subset of actions that are enabled, onSelect(value) - param1: selected action value]
5
+ */
6
+ type GridActionTriggerRet = [Required<ActionColumn>['actionOptions'], (value: any) => void];
7
+ export declare const useGridActionTrigger: (rowsData: RowProps[], uxState: UxState, actionOptions?: ActionColumn['actionOptions'], onBatchAction?: OnBatchActionFn) => GridActionTriggerRet;
8
+ export {};
@@ -0,0 +1,25 @@
1
+ import { useMemo, useCallback } from 'react';
2
+ import find from 'lodash/find';
3
+ export var useGridActionTrigger = function (rowsData, uxState, actionOptions, onBatchAction) {
4
+ if (actionOptions === void 0) { actionOptions = []; }
5
+ var actionRows = useMemo(function () {
6
+ return (rowsData || []).filter(function (row) { var _a; return (_a = uxState.checkedRows) === null || _a === void 0 ? void 0 : _a[row.id]; });
7
+ }, [uxState, rowsData]);
8
+ var enabledActions = useMemo(function () {
9
+ var actionsOptions = actionOptions || [];
10
+ return actionsOptions.filter(function (action) {
11
+ if (action.isEnabled) {
12
+ return action.isEnabled(actionRows);
13
+ }
14
+ else {
15
+ return uxState.checkedRows && find(uxState.checkedRows, Boolean);
16
+ }
17
+ });
18
+ }, [uxState, actionRows, actionOptions]);
19
+ var handleBatchAction = useCallback(function (value) {
20
+ var actionsOptions = actionOptions || [];
21
+ var action = actionsOptions.find(function (option) { return option.value == value; });
22
+ action && onBatchAction && onBatchAction(action, actionRows);
23
+ }, [actionOptions, onBatchAction, actionRows]);
24
+ return [enabledActions, handleBatchAction];
25
+ };
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { CommonGridProps, GridActionsType, GridSelectorsType } from '../types';
3
+ type Props = {
4
+ columns: CommonGridProps['columnsDefinitions'];
5
+ gridActions: GridActionsType;
6
+ gridSelectors: GridSelectorsType;
7
+ onClose?: () => void;
8
+ };
9
+ declare const useManageColumn: ({ columns, gridSelectors, gridActions, onClose }: Props) => {
10
+ columnsConfigValues: string[];
11
+ setColumnsConfigOptions: import("react").Dispatch<import("react").SetStateAction<{
12
+ [x: string]: {
13
+ isHidden?: boolean | undefined;
14
+ };
15
+ }>>;
16
+ onConfirmForm: () => void;
17
+ resetColumnConfig: () => void;
18
+ };
19
+ export default useManageColumn;
@@ -0,0 +1,34 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { useCallback, useMemo, useState } from 'react';
13
+ var useManageColumn = function (_a) {
14
+ var columns = _a.columns, gridSelectors = _a.gridSelectors, gridActions = _a.gridActions, onClose = _a.onClose;
15
+ var resetGrid = gridActions.resetGrid, setColumnConfig = gridActions.setColumnConfig;
16
+ var columnConfig = gridSelectors.columnConfig;
17
+ var _b = useState(__assign({}, columnConfig)), columnsConfigOptions = _b[0], setColumnsConfigOptions = _b[1];
18
+ var columnsConfigValues = useMemo(function () {
19
+ return columns === null || columns === void 0 ? void 0 : columns.filter(function (column) {
20
+ var _a;
21
+ var isHidden = (_a = columnConfig === null || columnConfig === void 0 ? void 0 : columnConfig[column.name]) === null || _a === void 0 ? void 0 : _a.isHidden;
22
+ return (column === null || column === void 0 ? void 0 : column.alwaysOn) || typeof isHidden === 'boolean' ? !isHidden : !(column === null || column === void 0 ? void 0 : column.defaultHidden);
23
+ }).map(function (column) { return column.name; });
24
+ }, [columnConfig, columns]);
25
+ var onConfirmForm = useCallback(function () {
26
+ (setColumnConfig === null || setColumnConfig === void 0 ? void 0 : setColumnConfig(columnsConfigOptions)) && (onClose === null || onClose === void 0 ? void 0 : onClose());
27
+ }, [columnsConfigOptions, onClose, setColumnConfig]);
28
+ var resetColumnConfig = useCallback(function () {
29
+ (resetGrid === null || resetGrid === void 0 ? void 0 : resetGrid()) && (onClose === null || onClose === void 0 ? void 0 : onClose());
30
+ setColumnsConfigOptions(columnConfig || {});
31
+ }, [onClose, resetGrid]);
32
+ return { columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, onConfirmForm: onConfirmForm, resetColumnConfig: resetColumnConfig };
33
+ };
34
+ export default useManageColumn;
@@ -0,0 +1,8 @@
1
+ import { RowProps, GridActionsType, UxState } from '../types';
2
+ /**
3
+ * hook for checkbox that select and unselects all row
4
+ * returns [checked state, toggleAllHandler()] for checkbox
5
+ */
6
+ type ToggleAllCheckboxRet = [boolean, () => void];
7
+ export declare const useToggleAllCheckbox: (rowsData: RowProps[], uxState: UxState, handleUxChange?: GridActionsType['handleUxChange']) => ToggleAllCheckboxRet;
8
+ export {};
@@ -0,0 +1,15 @@
1
+ import { useMemo, useCallback } from 'react';
2
+ export var useToggleAllCheckbox = function (rowsData, uxState, handleUxChange) {
3
+ var allChecked = useMemo(function () { return (rowsData || []).length >= 1 && rowsData.every(function (row) { var _a; return (_a = uxState.checkedRows) === null || _a === void 0 ? void 0 : _a[row.id]; }); }, [rowsData, uxState.checkedRows]);
4
+ var toggleAllHandler = useCallback(function () {
5
+ var checkedRows = {};
6
+ // if check all is not check, we check all
7
+ if (!allChecked && rowsData) {
8
+ rowsData.forEach(function (row) {
9
+ checkedRows[row.id] = true;
10
+ });
11
+ }
12
+ handleUxChange && handleUxChange('checkedRows', checkedRows);
13
+ }, [handleUxChange, rowsData, allChecked]);
14
+ return [allChecked, toggleAllHandler];
15
+ };