@decisiv/ui-components 2.0.1-alpha.8 → 2.0.1-alpha.82

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 (240) hide show
  1. package/lib/atoms/BaseButton/index.d.ts.map +1 -1
  2. package/lib/atoms/BaseButton/index.js +1 -1
  3. package/lib/atoms/BooleanInput/index.d.ts.map +1 -1
  4. package/lib/atoms/BooleanInput/index.js +19 -2
  5. package/lib/atoms/BooleanInput/index.test.js +17 -6
  6. package/lib/atoms/BooleanInput/types.d.ts +2 -0
  7. package/lib/atoms/BooleanInput/types.d.ts.map +1 -1
  8. package/lib/atoms/Calendar/hooks/useCalendar/index.d.ts.map +1 -1
  9. package/lib/atoms/Calendar/hooks/useCalendar/index.js +2 -1
  10. package/lib/atoms/Calendar/hooks/useCalendar/index.test.js +5 -6
  11. package/lib/atoms/Calendar/index.d.ts.map +1 -1
  12. package/lib/atoms/Calendar/index.js +8 -1
  13. package/lib/atoms/Calendar/index.test.js +70 -40
  14. package/lib/atoms/InputField/Containers.d.ts +10 -6
  15. package/lib/atoms/InputField/Containers.d.ts.map +1 -1
  16. package/lib/atoms/InputField/Containers.js +6 -6
  17. package/lib/atoms/InputField/InputLabel.d.ts +1 -0
  18. package/lib/atoms/InputField/InputLabel.d.ts.map +1 -1
  19. package/lib/atoms/InputField/InputLabel.js +2 -1
  20. package/lib/atoms/InputField/index.d.ts +4 -0
  21. package/lib/atoms/InputField/index.d.ts.map +1 -1
  22. package/lib/atoms/InputField/index.js +18 -7
  23. package/lib/atoms/InputField/index.test.js +91 -0
  24. package/lib/atoms/InputField/schema.d.ts.map +1 -1
  25. package/lib/atoms/InputField/schema.js +1 -0
  26. package/lib/atoms/OptionsList/Category.d.ts +1 -1
  27. package/lib/atoms/OptionsList/Category.d.ts.map +1 -1
  28. package/lib/atoms/OptionsList/Category.js +4 -2
  29. package/lib/atoms/OptionsList/Footer.d.ts +8 -0
  30. package/lib/atoms/OptionsList/Footer.d.ts.map +1 -0
  31. package/lib/atoms/OptionsList/Footer.js +72 -0
  32. package/lib/atoms/OptionsList/Option.d.ts.map +1 -1
  33. package/lib/atoms/OptionsList/Option.js +8 -5
  34. package/lib/atoms/OptionsList/index.d.ts.map +1 -1
  35. package/lib/atoms/OptionsList/index.js +43 -16
  36. package/lib/atoms/OptionsList/index.test.js +107 -11
  37. package/lib/atoms/OptionsList/schema.d.ts.map +1 -1
  38. package/lib/atoms/OptionsList/schema.js +4 -0
  39. package/lib/atoms/OptionsList/types.d.ts +14 -0
  40. package/lib/atoms/OptionsList/types.d.ts.map +1 -1
  41. package/lib/atoms/RequiredIcon.d.ts +9 -0
  42. package/lib/atoms/RequiredIcon.d.ts.map +1 -0
  43. package/lib/atoms/{InputField/RequiredIcon.js → RequiredIcon.js} +7 -3
  44. package/lib/components/Button/schema.d.ts +6 -1
  45. package/lib/components/Button/schema.d.ts.map +1 -1
  46. package/lib/components/Button/schema.js +9 -4
  47. package/lib/components/Checkbox/index.d.ts.map +1 -1
  48. package/lib/components/Checkbox/index.js +3 -1
  49. package/lib/components/Checkbox/schema.d.ts.map +1 -1
  50. package/lib/components/Checkbox/schema.js +2 -0
  51. package/lib/components/Combobox/Target.d.ts.map +1 -1
  52. package/lib/components/Combobox/Target.js +45 -14
  53. package/lib/components/Combobox/index.d.ts.map +1 -1
  54. package/lib/components/Combobox/index.js +182 -64
  55. package/lib/components/Combobox/index.test.js +358 -135
  56. package/lib/components/Combobox/schema.d.ts.map +1 -1
  57. package/lib/components/Combobox/schema.js +9 -2
  58. package/lib/components/Combobox/types.d.ts +12 -3
  59. package/lib/components/Combobox/types.d.ts.map +1 -1
  60. package/lib/components/DropdownList/index.d.ts +4 -0
  61. package/lib/components/DropdownList/index.d.ts.map +1 -1
  62. package/lib/components/DropdownList/index.js +76 -11
  63. package/lib/components/DropdownList/propTypes.d.ts +4 -0
  64. package/lib/components/DropdownList/propTypes.d.ts.map +1 -0
  65. package/lib/components/DropdownList/propTypes.js +42 -0
  66. package/lib/components/DropdownList/schema.d.ts.map +1 -1
  67. package/lib/components/DropdownList/schema.js +5 -0
  68. package/lib/components/DropdownList/types.d.ts +4 -1
  69. package/lib/components/DropdownList/types.d.ts.map +1 -1
  70. package/lib/components/Filter/IconWrapper/index.d.ts +197 -0
  71. package/lib/components/Filter/IconWrapper/index.d.ts.map +1 -0
  72. package/lib/components/Filter/IconWrapper/index.js +35 -0
  73. package/lib/components/Filter/SimplePrimary/index.d.ts +31 -0
  74. package/lib/components/Filter/SimplePrimary/index.d.ts.map +1 -0
  75. package/lib/components/Filter/SimplePrimary/index.js +58 -0
  76. package/lib/components/Filter/SimplePrimary/index.test.js +34 -0
  77. package/lib/components/Filter/StyledFilter.d.ts +4 -0
  78. package/lib/components/Filter/StyledFilter.d.ts.map +1 -0
  79. package/lib/components/Filter/StyledFilter.js +39 -0
  80. package/lib/components/Filter/StyledLabel/index.d.ts +8 -0
  81. package/lib/components/Filter/StyledLabel/index.d.ts.map +1 -0
  82. package/lib/components/Filter/StyledLabel/index.js +30 -0
  83. package/lib/components/Filter/index.d.ts +27 -0
  84. package/lib/components/Filter/index.d.ts.map +1 -0
  85. package/lib/components/Filter/index.js +95 -0
  86. package/lib/components/Filter/index.test.js +41 -0
  87. package/lib/components/Filter/kind.d.ts +6 -0
  88. package/lib/components/Filter/kind.d.ts.map +1 -0
  89. package/lib/components/Filter/kind.js +45 -0
  90. package/lib/components/Filter/schema.d.ts +9 -0
  91. package/lib/components/Filter/schema.d.ts.map +1 -0
  92. package/lib/components/Filter/schema.js +32 -0
  93. package/lib/components/Filter/types.d.ts +17 -0
  94. package/lib/components/Filter/types.d.ts.map +1 -0
  95. package/lib/components/Filter/types.js +1 -0
  96. package/lib/components/LeftNav/Item/ClickArea.d.ts.map +1 -1
  97. package/lib/components/LeftNav/Item/ClickArea.js +2 -2
  98. package/lib/components/LeftNav/Item/ItemWrapper.d.ts.map +1 -1
  99. package/lib/components/LeftNav/Item/ItemWrapper.js +3 -3
  100. package/lib/components/LeftNav/Item/MenuItemWrapper.d.ts +7 -0
  101. package/lib/components/LeftNav/Item/MenuItemWrapper.d.ts.map +1 -0
  102. package/lib/components/LeftNav/Item/MenuItemWrapper.js +20 -0
  103. package/lib/components/LeftNav/Item/NavCollapsedXItem/index.d.ts.map +1 -1
  104. package/lib/components/LeftNav/Item/NavCollapsedXItem/index.js +7 -5
  105. package/lib/components/LeftNav/Item/NavExpandedItem/index.d.ts.map +1 -1
  106. package/lib/components/LeftNav/Item/NavExpandedItem/index.js +24 -13
  107. package/lib/components/LeftNav/Item/types.d.ts +1 -1
  108. package/lib/components/LeftNav/Item/types.d.ts.map +1 -1
  109. package/lib/components/LeftNav/index.test.js +13 -3
  110. package/lib/components/LeftNav/schema.d.ts.map +1 -1
  111. package/lib/components/LeftNav/schema.js +2 -0
  112. package/lib/components/LeftNav/types.d.ts +1 -0
  113. package/lib/components/LeftNav/types.d.ts.map +1 -1
  114. package/lib/components/Menu/index.d.ts.map +1 -1
  115. package/lib/components/Menu/index.js +3 -1
  116. package/lib/components/Menu/types.d.ts +2 -0
  117. package/lib/components/Menu/types.d.ts.map +1 -1
  118. package/lib/components/Modal/components.d.ts +2 -2
  119. package/lib/components/Modal/index.d.ts.map +1 -1
  120. package/lib/components/Modal/index.js +5 -5
  121. package/lib/components/Modal/index.test.js +32 -0
  122. package/lib/components/Modal/schema.d.ts.map +1 -1
  123. package/lib/components/Modal/schema.js +2 -2
  124. package/lib/components/Modal/types.d.ts +2 -2
  125. package/lib/components/Modal/types.d.ts.map +1 -1
  126. package/lib/components/Notifications/Notification/components.d.ts +3 -3
  127. package/lib/components/Notifications/Notification/components.d.ts.map +1 -1
  128. package/lib/components/Notifications/Notification/components.js +12 -6
  129. package/lib/components/Notifications/Notification/index.d.ts +3 -6
  130. package/lib/components/Notifications/Notification/index.d.ts.map +1 -1
  131. package/lib/components/Notifications/Notification/index.js +19 -12
  132. package/lib/components/Notifications/Notification/index.test.js +38 -19
  133. package/lib/components/Notifications/NotificationsPanel/index.d.ts +2 -1
  134. package/lib/components/Notifications/NotificationsPanel/index.d.ts.map +1 -1
  135. package/lib/components/Notifications/NotificationsPanel/index.js +44 -21
  136. package/lib/components/Notifications/NotificationsPanel/schema.js +1 -1
  137. package/lib/components/Notifications/Notifier.test.js +79 -10
  138. package/lib/components/Notifications/constants.d.ts +2 -0
  139. package/lib/components/Notifications/constants.d.ts.map +1 -0
  140. package/lib/components/Notifications/constants.js +16 -0
  141. package/lib/components/Notifications/schema.d.ts.map +1 -1
  142. package/lib/components/Notifications/schema.js +2 -1
  143. package/lib/components/Notifications/useNotifications.d.ts +1 -0
  144. package/lib/components/Notifications/useNotifications.d.ts.map +1 -1
  145. package/lib/components/Notifications/useNotifications.js +3 -3
  146. package/lib/components/Notifications/useNotifications.test.js +7 -4
  147. package/lib/components/Pagination/Pagination.d.ts +1 -1
  148. package/lib/components/Pagination/Pagination.d.ts.map +1 -1
  149. package/lib/components/Pagination/Pagination.js +1 -0
  150. package/lib/components/Pagination/Pagination.test.js +9 -0
  151. package/lib/components/Popover/utils.d.ts +1 -1
  152. package/lib/components/Select/Target.js +1 -1
  153. package/lib/components/Select/index.d.ts.map +1 -1
  154. package/lib/components/Select/index.js +20 -1
  155. package/lib/components/Select/index.test.js +31 -9
  156. package/lib/components/Select/schema.d.ts.map +1 -1
  157. package/lib/components/Select/schema.js +5 -0
  158. package/lib/components/Select/types.d.ts +2 -1
  159. package/lib/components/Select/types.d.ts.map +1 -1
  160. package/lib/components/SelectDate/Target.js +1 -1
  161. package/lib/components/SelectDate/index.test.js +71 -51
  162. package/lib/components/SelectDateRange/index.test.js +78 -58
  163. package/lib/components/SelectMenu/index.d.ts +5 -0
  164. package/lib/components/SelectMenu/index.d.ts.map +1 -1
  165. package/lib/components/SelectMenu/index.js +27 -3
  166. package/lib/components/SelectMenu/schema.d.ts.map +1 -1
  167. package/lib/components/SelectMenu/schema.js +4 -0
  168. package/lib/components/Table/Body.d.ts.map +1 -1
  169. package/lib/components/Table/Body.js +182 -38
  170. package/lib/components/Table/Container.d.ts.map +1 -1
  171. package/lib/components/Table/Container.js +2 -2
  172. package/lib/components/Table/DataRow.d.ts.map +1 -1
  173. package/lib/components/Table/DataRow.js +43 -16
  174. package/lib/components/Table/DraggableWrapper.d.ts +5 -0
  175. package/lib/components/Table/DraggableWrapper.d.ts.map +1 -0
  176. package/lib/components/Table/DraggableWrapper.js +38 -0
  177. package/lib/components/Table/Grip.d.ts +4 -0
  178. package/lib/components/Table/Grip.d.ts.map +1 -0
  179. package/lib/components/Table/Grip.js +30 -0
  180. package/lib/components/Table/Head.d.ts +1 -1
  181. package/lib/components/Table/Head.d.ts.map +1 -1
  182. package/lib/components/Table/Head.js +11 -5
  183. package/lib/components/Table/HeaderCell/index.d.ts.map +1 -1
  184. package/lib/components/Table/HeaderCell/index.js +22 -8
  185. package/lib/components/Table/HeaderCell/types.d.ts +6 -1
  186. package/lib/components/Table/HeaderCell/types.d.ts.map +1 -1
  187. package/lib/components/Table/Provider.d.ts +13 -4
  188. package/lib/components/Table/Provider.d.ts.map +1 -1
  189. package/lib/components/Table/Provider.js +45 -5
  190. package/lib/components/Table/index.d.ts.map +1 -1
  191. package/lib/components/Table/index.js +112 -18
  192. package/lib/components/Table/index.test.js +330 -84
  193. package/lib/components/Table/schema.columns.d.ts.map +1 -1
  194. package/lib/components/Table/schema.columns.js +6 -4
  195. package/lib/components/Table/schema.d.ts.map +1 -1
  196. package/lib/components/Table/schema.js +8 -6
  197. package/lib/components/Table/types.d.ts +34 -4
  198. package/lib/components/Table/types.d.ts.map +1 -1
  199. package/lib/components/Table/utils.d.ts +2 -8
  200. package/lib/components/Table/utils.d.ts.map +1 -1
  201. package/lib/components/Table/utils.js +21 -20
  202. package/lib/components/Tag/types.d.ts +1 -1
  203. package/lib/components/Tag/types.d.ts.map +1 -1
  204. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  205. package/lib/components/TextArea/TextArea.js +1 -1
  206. package/lib/components/TextArea/index.js +1 -0
  207. package/lib/components/TextArea/index.test.js +5 -0
  208. package/lib/components/TextField/Input.js +1 -1
  209. package/lib/components/TextField/index.test.js +5 -0
  210. package/lib/components/Toggle/index.d.ts.map +1 -1
  211. package/lib/components/Toggle/index.js +4 -0
  212. package/lib/components/Toggle/index.test.js +39 -10
  213. package/lib/components/TopNav/BrandInfo/index.d.ts +2 -1
  214. package/lib/components/TopNav/BrandInfo/index.d.ts.map +1 -1
  215. package/lib/components/TopNav/BrandInfo/index.js +9 -1
  216. package/lib/components/TopNav/BrandInfo/schema.d.ts.map +1 -1
  217. package/lib/components/TopNav/BrandInfo/schema.js +4 -1
  218. package/lib/components/TopNav/index.test.js +28 -0
  219. package/lib/components/index.d.ts +1 -0
  220. package/lib/components/index.d.ts.map +1 -1
  221. package/lib/components/index.js +9 -0
  222. package/lib/providers/ConfigProvider/index.d.ts.map +1 -1
  223. package/lib/providers/ConfigProvider/index.js +5 -1
  224. package/lib/providers/ConfigProvider/utils/context.d.ts +1 -1
  225. package/lib/providers/ConfigProvider/utils/context.d.ts.map +1 -1
  226. package/lib/providers/ConfigProvider/utils/normalizer.d.ts.map +1 -1
  227. package/lib/providers/ConfigProvider/utils/normalizer.js +1 -1
  228. package/lib/providers/ConfigProvider/utils/translations.d.ts +1 -1
  229. package/lib/providers/ConfigProvider/utils/translations.js +1 -1
  230. package/lib/providers/NotificationsProvider/index.d.ts +6 -5
  231. package/lib/providers/NotificationsProvider/index.d.ts.map +1 -1
  232. package/lib/providers/NotificationsProvider/index.js +47 -28
  233. package/lib/providers/NotificationsProvider/types.d.ts +4 -1
  234. package/lib/providers/NotificationsProvider/types.d.ts.map +1 -1
  235. package/lib/utils/joinClassnames.d.ts +3 -0
  236. package/lib/utils/joinClassnames.d.ts.map +1 -0
  237. package/lib/utils/joinClassnames.js +26 -0
  238. package/package.json +4 -2
  239. package/lib/atoms/InputField/RequiredIcon.d.ts +0 -4
  240. package/lib/atoms/InputField/RequiredIcon.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/HeaderCell/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,IAAI,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;CACf"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/HeaderCell/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,IAAI,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,GAAG,CAAC,OAAO,CAAC;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CACjE;AAED,oBAAY,qBAAqB,GAAG,IAAI,CACtC,eAAe,EACf,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CACtC,CAAC;AAEF,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -1,16 +1,25 @@
1
1
  import React from 'react';
2
2
  import { SortableState, UseSortableHeaders } from './hooks/useSortableHeaders';
3
+ import { FixedColumns, DragVariant } from './types';
3
4
  interface TableContextValue extends UseSortableHeaders {
5
+ isDnDEnabled: boolean;
4
6
  onColumnResize?: (columnName: string, width: number) => void;
5
- columnsOffset: {
6
- [name: string]: number;
7
+ columnsWidth: {
8
+ [id: string]: number;
7
9
  };
10
+ isDragging: boolean;
11
+ setIsDragging: (value: boolean) => void;
12
+ contextId: string;
13
+ hasDragHandlers: boolean;
14
+ setHasDragHandlers: (value: boolean) => void;
15
+ fixedColumns: FixedColumns;
16
+ dragVariant?: DragVariant;
8
17
  }
9
- interface TableProviderProps extends Pick<TableContextValue, 'onColumnResize' | 'columnsOffset'> {
18
+ interface TableProviderProps extends Pick<TableContextValue, 'onColumnResize' | 'fixedColumns' | 'columnsWidth' | 'isDnDEnabled' | 'hasDragHandlers' | 'setHasDragHandlers' | 'dragVariant'> {
10
19
  children: JSX.Element;
11
20
  defaultSort?: SortableState;
12
21
  }
13
22
  export declare const TableContext: React.Context<TableContextValue>;
14
- declare function TableProvider({ children, defaultSort, onColumnResize, columnsOffset, }: TableProviderProps): JSX.Element;
23
+ declare function TableProvider({ children, defaultSort, isDnDEnabled, onColumnResize, columnsWidth, fixedColumns, hasDragHandlers, setHasDragHandlers, dragVariant, }: TableProviderProps): JSX.Element;
15
24
  export default TableProvider;
16
25
  //# sourceMappingURL=Provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/components/Table/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAA2B,EACzB,aAAa,EACb,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAEpC,UAAU,iBAAkB,SAAQ,kBAAkB;IACpD,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,aAAa,EAAE;QACb,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;CACH;AAED,UAAU,kBACR,SAAQ,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,GAAG,eAAe,CAAC;IACnE,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,kCAGvB,CAAC;AAEH,iBAAS,aAAa,CAAC,EACrB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,aAAa,GACd,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAalC;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/components/Table/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAA2B,EACzB,aAAa,EACb,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEpD,UAAU,iBAAkB,SAAQ,kBAAkB;IACpD,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,YAAY,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACvC,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,UAAU,kBACR,SAAQ,IAAI,CACV,iBAAiB,EACf,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,cAAc,GACd,iBAAiB,GACjB,oBAAoB,GACpB,aAAa,CAChB;IACD,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,kCAUvB,CAAC;AAEH,iBAAS,aAAa,CAAC,EACrB,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,WAAW,GACZ,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAwBlC;AAED,eAAe,aAAa,CAAC"}
@@ -5,21 +5,40 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.TableContext = void 0;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _useSortableHeaders = _interopRequireDefault(require("./hooks/useSortableHeaders"));
11
11
 
12
+ var _useUniqueId = _interopRequireDefault(require("../../utils/useUniqueId"));
13
+
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
16
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
17
+
14
18
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
15
19
 
16
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
21
 
18
22
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
23
 
24
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
25
+
26
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
27
+
28
+ function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
29
+
30
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
+
20
32
  var TableContext = _react.default.createContext({
21
33
  sort: function sort() {},
22
- columnsOffset: {}
34
+ isDnDEnabled: false,
35
+ columnsWidth: {},
36
+ isDragging: false,
37
+ setIsDragging: function setIsDragging() {},
38
+ contextId: '',
39
+ hasDragHandlers: true,
40
+ setHasDragHandlers: function setHasDragHandlers() {},
41
+ fixedColumns: {}
23
42
  });
24
43
 
25
44
  exports.TableContext = TableContext;
@@ -27,14 +46,35 @@ exports.TableContext = TableContext;
27
46
  function TableProvider(_ref) {
28
47
  var children = _ref.children,
29
48
  defaultSort = _ref.defaultSort,
49
+ isDnDEnabled = _ref.isDnDEnabled,
30
50
  onColumnResize = _ref.onColumnResize,
31
- columnsOffset = _ref.columnsOffset;
51
+ columnsWidth = _ref.columnsWidth,
52
+ fixedColumns = _ref.fixedColumns,
53
+ hasDragHandlers = _ref.hasDragHandlers,
54
+ setHasDragHandlers = _ref.setHasDragHandlers,
55
+ dragVariant = _ref.dragVariant;
32
56
  var sortableProps = (0, _useSortableHeaders.default)(defaultSort);
57
+ var contextId = (0, _useUniqueId.default)(undefined, 'table-');
58
+
59
+ var _useState = (0, _react.useState)(false),
60
+ _useState2 = _slicedToArray(_useState, 2),
61
+ isDragging = _useState2[0],
62
+ setIsDragging = _useState2[1];
63
+
33
64
  return _react.default.createElement(TableContext.Provider, {
34
65
  value: _objectSpread({
35
66
  onColumnResize: onColumnResize,
36
- columnsOffset: columnsOffset
37
- }, sortableProps)
67
+ fixedColumns: fixedColumns
68
+ }, sortableProps, {
69
+ isDnDEnabled: isDnDEnabled,
70
+ columnsWidth: columnsWidth,
71
+ isDragging: isDragging,
72
+ setIsDragging: setIsDragging,
73
+ contextId: contextId,
74
+ hasDragHandlers: hasDragHandlers,
75
+ setHasDragHandlers: setHasDragHandlers,
76
+ dragVariant: dragVariant
77
+ })
38
78
  }, children);
39
79
  }
40
80
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Table/index.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAW,UAAU,EAAE,MAAM,SAAS,CAAC;AAG9C,OAAO,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,QAAQ,GACT,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,iBAAS,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CAwC3D;kBAxCQ,KAAK;;;;;;;;;;;;;AAoHd,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Table/index.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAW,UAAU,EAAgB,MAAM,SAAS,CAAC;AAI5D,OAAO,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,QAAQ,GACT,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,iBAAS,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CAoG3D;kBApGQ,KAAK;;;;;;;;;;;;;AAuNd,eAAe,KAAK,CAAC"}
@@ -63,6 +63,8 @@ var _types = require("./types");
63
63
 
64
64
  var _utils = require("./utils");
65
65
 
66
+ var _Grip = _interopRequireDefault(require("./Grip"));
67
+
66
68
  var _useSortableHeaders = require("./hooks/useSortableHeaders");
67
69
 
68
70
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
@@ -71,6 +73,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
71
73
 
72
74
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
73
75
 
76
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
77
+
78
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
79
+
80
+ function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
81
+
82
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
83
+
74
84
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
75
85
 
76
86
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -94,8 +104,11 @@ function Table(props) {
94
104
  defaultSort = props.defaultSort,
95
105
  footer = props.footer,
96
106
  toolbar = props.toolbar,
97
- columns = props.columns,
98
- rest = _objectWithoutProperties(props, ["data", "defaultSort", "footer", "toolbar", "columns"]);
107
+ columnsProp = props.columns,
108
+ onDragEnd = props.onDragEnd,
109
+ _props$dragVariant = props.dragVariant,
110
+ dragVariant = _props$dragVariant === void 0 ? 'row' : _props$dragVariant,
111
+ rest = _objectWithoutProperties(props, ["data", "defaultSort", "footer", "toolbar", "columns", "onDragEnd", "dragVariant"]);
99
112
 
100
113
  var _useState = (0, _react.useState)({}),
101
114
  _useState2 = _slicedToArray(_useState, 2),
@@ -107,17 +120,61 @@ function Table(props) {
107
120
  return _objectSpread({}, prevColumnsWidth, _defineProperty({}, name, width));
108
121
  });
109
122
  }, []);
123
+ var isDnDEnabled = !!onDragEnd;
124
+
125
+ var _useState3 = (0, _react.useState)(false),
126
+ _useState4 = _slicedToArray(_useState3, 2),
127
+ hasDragHandlers = _useState4[0],
128
+ setHasDragHandlers = _useState4[1];
129
+
130
+ var columns = (0, _react.useMemo)(function () {
131
+ if (isDnDEnabled && !hasDragHandlers) {
132
+ return [{
133
+ name: 'default-drag-handle',
134
+ DataCell: function DataCell(_ref) {
135
+ var DragHandle = _ref.DragHandle;
136
+
137
+ if (dragVariant === 'handle') {
138
+ var defaultHandle = _react.default.cloneElement(DragHandle, {
139
+ 'data-drag-handle-context-id': undefined
140
+ });
141
+
142
+ return defaultHandle;
143
+ }
144
+
145
+ return _react.default.createElement("div", null, _react.default.createElement(_Grip.default, null));
146
+ },
147
+ getHeaderCellAttrs: function getHeaderCellAttrs() {
148
+ return {
149
+ className: 'handle-container'
150
+ };
151
+ },
152
+ getCellAttrs: function getCellAttrs() {
153
+ return {
154
+ className: 'handle-container'
155
+ };
156
+ },
157
+ getCellKey: function getCellKey() {
158
+ return 'default-drag-handle';
159
+ },
160
+ fixed: columnsProp[0].fixed
161
+ }].concat(_toConsumableArray(columnsProp));
162
+ }
110
163
 
111
- var _useMemo = (0, _react.useMemo)(function () {
164
+ return columnsProp;
165
+ }, [isDnDEnabled, hasDragHandlers, columnsProp, dragVariant]);
166
+ var fixedColumns = (0, _react.useMemo)(function () {
112
167
  return (0, _utils.calculateOffsets)(columns, columnsWidth);
113
- }, [columns, columnsWidth]),
114
- leftColumnsOffset = _useMemo.leftColumnsOffset,
115
- rightColumnsOffset = _useMemo.rightColumnsOffset;
116
-
168
+ }, [columns, columnsWidth]);
117
169
  return _react.default.createElement(_Provider.default, {
118
170
  defaultSort: defaultSort,
119
171
  onColumnResize: onColumnResize,
120
- columnsOffset: _objectSpread({}, leftColumnsOffset, {}, rightColumnsOffset)
172
+ columnsWidth: columnsWidth,
173
+ fixedColumns: fixedColumns,
174
+ isDnDEnabled: isDnDEnabled,
175
+ hasDragHandlers: hasDragHandlers,
176
+ setHasDragHandlers: setHasDragHandlers,
177
+ dragVariant: dragVariant
121
178
  }, _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_Toolbar.default, {
122
179
  kind: rest.kind,
123
180
  toolbar: toolbar
@@ -127,7 +184,8 @@ function Table(props) {
127
184
  columns: columns
128
185
  })), _react.default.createElement(_Body.default, _extends({}, rest, {
129
186
  columns: columns,
130
- data: data
187
+ data: data,
188
+ onDragEnd: onDragEnd
131
189
  })))), _react.default.createElement(_Foot.default, {
132
190
  kind: rest.kind,
133
191
  variant: rest.variant,
@@ -136,8 +194,8 @@ function Table(props) {
136
194
  }
137
195
 
138
196
  Table.propTypes = _objectSpread({}, _schema.default.propTypes, {
139
- GroupHeader: (0, _propTypes.requireIf)(_propTypes2.default.elementType, function (_ref) {
140
- var rowDataPath = _ref.rowDataPath;
197
+ GroupHeader: (0, _propTypes.requireIf)(_propTypes2.default.elementType, function (_ref2) {
198
+ var rowDataPath = _ref2.rowDataPath;
141
199
  return !!rowDataPath;
142
200
  }),
143
201
  // eslint-disable-next-line react/require-default-props
@@ -151,6 +209,34 @@ Table.propTypes = _objectSpread({}, _schema.default.propTypes, {
151
209
  return new Error("You have set a column as fixed but the Table doesn't have horizontal scroll, you need to enable it via scroll prop for this feature to work correctly");
152
210
  }
153
211
 
212
+ var previousColumn = null;
213
+ var isleColumnIndex = null;
214
+
215
+ for (var index = 0; index < columns.length; index += 1) {
216
+ var column = columns[index];
217
+
218
+ if (previousColumn && column.fixed && !previousColumn.fixed) {
219
+ isleColumnIndex = index;
220
+ break;
221
+ }
222
+
223
+ previousColumn = column;
224
+ }
225
+
226
+ previousColumn = null;
227
+
228
+ for (var _index = columns.length - 1; _index >= 0; _index -= 1) {
229
+ var _column = columns[_index];
230
+
231
+ if (previousColumn && _column.fixed && !previousColumn.fixed) {
232
+ if (isleColumnIndex && isleColumnIndex <= _index) {
233
+ return new Error("Column [".concat(_column.name, "] will not be fixed. Fixed columns must be consecutive, grouped at the beginning or at the end of the array."));
234
+ }
235
+ }
236
+
237
+ previousColumn = _column;
238
+ }
239
+
154
240
  _propTypes2.default.checkPropTypes({
155
241
  columns: _propTypes2.default.arrayOf(_propTypes2.default.shape({
156
242
  DataCell: _propTypes2.default.elementType.isRequired,
@@ -158,7 +244,7 @@ Table.propTypes = _objectSpread({}, _schema.default.propTypes, {
158
244
  name: _propTypes2.default.string.isRequired,
159
245
  sortBy: _propTypes2.default.func,
160
246
  title: _propTypes2.default.string,
161
- fixed: _propTypes2.default.oneOf(['right', 'left'])
247
+ fixed: _propTypes2.default.bool
162
248
  }))
163
249
  }, props, propName, componentName);
164
250
 
@@ -166,16 +252,24 @@ Table.propTypes = _objectSpread({}, _schema.default.propTypes, {
166
252
  },
167
253
  toolbar: _propTypes2.default.elementType,
168
254
  footer: _propTypes2.default.elementType,
169
- getRowKey: (0, _propTypes.requireIf)(_propTypes2.default.func, function (_ref2) {
170
- var data = _ref2.data;
255
+ getRowKey: (0, _propTypes.requireIf)(_propTypes2.default.func, function (_ref3) {
256
+ var data = _ref3.data;
171
257
  return !((0, _get.default)(data, '0.key') || (0, _get.default)(data, '0.id'));
172
258
  }),
173
- height: (0, _propTypes.requireIf)(_propTypes2.default.string, function (_ref3) {
174
- var scroll = _ref3.scroll,
175
- size = _ref3.size;
259
+ height: (0, _propTypes.requireIf)(_propTypes2.default.string, function (_ref4) {
260
+ var scroll = _ref4.scroll,
261
+ size = _ref4.size;
176
262
  return (0, _modifiersPropApplies.default)('y', scroll, size);
177
263
  }),
178
- scroll: _propTypes2.default.oneOfType([_propTypes2.default.oneOf(['x', 'y']), _propTypes2.default.arrayOf(_propTypes2.default.oneOf(['x', 'y'])), _propTypes2.default.objectOf(_propTypes2.default.oneOfType([_propTypes2.default.oneOf(['x', 'y']), _propTypes2.default.arrayOf(_propTypes2.default.oneOf(['x', 'y']))]))])
264
+ scroll: _propTypes2.default.oneOfType([_propTypes2.default.oneOf(['x', 'y']), _propTypes2.default.arrayOf(_propTypes2.default.oneOf(['x', 'y'])), _propTypes2.default.objectOf(_propTypes2.default.oneOfType([_propTypes2.default.oneOf(['x', 'y']), _propTypes2.default.arrayOf(_propTypes2.default.oneOf(['x', 'y']))]))]),
265
+ // eslint-disable-next-line react/require-default-props
266
+ dragVariant: function dragVariant(_ref5) {
267
+ var onDragEnd = _ref5.onDragEnd,
268
+ props = _objectWithoutProperties(_ref5, ["onDragEnd"]);
269
+
270
+ if (!onDragEnd && 'dragVariant' in props) return new Error('You have set dragVariant prop but Drag-and-Drop sorting is not enabled, you can enable it by passing [onDragEnd] callback');
271
+ return null;
272
+ }
179
273
  });
180
274
  Table.defaultProps = {
181
275
  GroupHeader: undefined,