@reltio/components 1.4.2018 → 1.4.2019

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 (268) hide show
  1. package/BarChart/helpers.d.ts +2 -2
  2. package/BasicTable/IntegrationBasicTable.test.js +6 -18
  3. package/EditModeAttributesView/IntegrationEditModeAttributesView.test.js +2 -5
  4. package/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +2 -5
  5. package/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.js +33 -22
  6. package/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.test.js +120 -112
  7. package/InlineSimpleAttribute/InlineSimpleAttribute.js +1 -1
  8. package/LineChart/helpers.d.ts +2 -2
  9. package/PieChart/PieChart.test.js +4 -0
  10. package/UploadImageDialog/UploadImageDialog.specs.js +1 -4
  11. package/UploadImageDialog/components/TargetBox/TargetBox.js +31 -20
  12. package/UploadImageDialog/components/TargetBox/TargetBox.specs.d.ts +1 -1
  13. package/UploadImageDialog/components/TargetBox/TargetBox.specs.js +57 -16
  14. package/UploadImageDialog/components/TargetBox/styles.js +2 -1
  15. package/VerticalHeadingsTable/DndVerticalHeadingsTable.test.js +114 -0
  16. package/VerticalHeadingsTable/VerticalHeadingsTable.d.ts +2 -1
  17. package/VerticalHeadingsTable/VerticalHeadingsTable.js +10 -13
  18. package/VerticalHeadingsTable/VerticalHeadingsTable.test.js +74 -269
  19. package/VerticalHeadingsTable/components/DndComponent/DndComponent.d.ts +14 -0
  20. package/VerticalHeadingsTable/components/DndComponent/DndComponent.js +96 -0
  21. package/VerticalHeadingsTable/components/DndComponent/helpers.d.ts +3 -0
  22. package/VerticalHeadingsTable/components/DndComponent/helpers.js +35 -0
  23. package/VerticalHeadingsTable/components/DndComponent/index.d.ts +1 -0
  24. package/VerticalHeadingsTable/components/DndComponent/index.js +1 -0
  25. package/VerticalHeadingsTable/components/{TableColumnDragLayer → DndComponent}/styles.d.ts +1 -1
  26. package/VerticalHeadingsTable/components/DndComponent/styles.js +10 -0
  27. package/VerticalHeadingsTable/components/DndComponent/types.d.ts +14 -0
  28. package/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.d.ts +7 -0
  29. package/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.js +13 -0
  30. package/VerticalHeadingsTable/components/DndMeasurer/index.d.ts +1 -0
  31. package/VerticalHeadingsTable/components/DndMeasurer/index.js +1 -0
  32. package/VerticalHeadingsTable/components/TableCell/TableCell.d.ts +2 -2
  33. package/VerticalHeadingsTable/components/TableCell/TableCell.js +2 -2
  34. package/VerticalHeadingsTable/components/TableCell/TableCell.test.js +101 -43
  35. package/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.d.ts +10 -0
  36. package/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.js +32 -0
  37. package/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.d.ts +2 -4
  38. package/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.js +30 -59
  39. package/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.test.js +126 -56
  40. package/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.d.ts +3 -3
  41. package/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.js +16 -6
  42. package/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.d.ts +9 -0
  43. package/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.js +30 -0
  44. package/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.d.ts +4 -4
  45. package/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.js +3 -4
  46. package/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.test.js +44 -29
  47. package/VerticalHeadingsTable/components/TableRow/TableRow.d.ts +4 -5
  48. package/VerticalHeadingsTable/components/TableRow/TableRow.js +3 -3
  49. package/VerticalHeadingsTable/components/TableRow/TableRow.test.js +35 -57
  50. package/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.d.ts +12 -0
  51. package/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.js +16 -0
  52. package/VerticalHeadingsTable/components/TableRowDragPreview/index.d.ts +1 -0
  53. package/VerticalHeadingsTable/components/TableRowDragPreview/index.js +1 -0
  54. package/{cjs/VerticalHeadingsTable/components/TableColumnDragLayer → VerticalHeadingsTable/components/TableRowDragPreview}/styles.d.ts +1 -1
  55. package/VerticalHeadingsTable/components/TableRowDragPreview/styles.js +8 -0
  56. package/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.d.ts +2 -8
  57. package/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.js +22 -53
  58. package/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.test.js +53 -83
  59. package/cjs/BarChart/helpers.d.ts +2 -2
  60. package/cjs/BasicTable/IntegrationBasicTable.test.js +6 -18
  61. package/cjs/EditModeAttributesView/IntegrationEditModeAttributesView.test.js +2 -5
  62. package/cjs/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +2 -5
  63. package/cjs/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.js +55 -21
  64. package/cjs/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.test.js +120 -135
  65. package/cjs/InlineSimpleAttribute/InlineSimpleAttribute.js +1 -1
  66. package/cjs/LineChart/helpers.d.ts +2 -2
  67. package/cjs/PieChart/PieChart.test.js +4 -0
  68. package/cjs/UploadImageDialog/UploadImageDialog.specs.js +1 -4
  69. package/cjs/UploadImageDialog/components/TargetBox/TargetBox.js +54 -20
  70. package/cjs/UploadImageDialog/components/TargetBox/TargetBox.specs.d.ts +1 -1
  71. package/cjs/UploadImageDialog/components/TargetBox/TargetBox.specs.js +57 -16
  72. package/cjs/UploadImageDialog/components/TargetBox/styles.js +2 -1
  73. package/cjs/VerticalHeadingsTable/DndVerticalHeadingsTable.test.d.ts +1 -0
  74. package/cjs/VerticalHeadingsTable/DndVerticalHeadingsTable.test.js +119 -0
  75. package/cjs/VerticalHeadingsTable/VerticalHeadingsTable.d.ts +2 -1
  76. package/cjs/VerticalHeadingsTable/VerticalHeadingsTable.js +9 -12
  77. package/cjs/VerticalHeadingsTable/VerticalHeadingsTable.test.js +74 -269
  78. package/cjs/VerticalHeadingsTable/components/DndComponent/DndComponent.d.ts +14 -0
  79. package/cjs/VerticalHeadingsTable/components/DndComponent/DndComponent.js +123 -0
  80. package/cjs/VerticalHeadingsTable/components/DndComponent/helpers.d.ts +3 -0
  81. package/cjs/VerticalHeadingsTable/components/DndComponent/helpers.js +40 -0
  82. package/cjs/VerticalHeadingsTable/components/DndComponent/index.d.ts +1 -0
  83. package/cjs/VerticalHeadingsTable/components/DndComponent/index.js +5 -0
  84. package/{features/crosswalks/CrosswalkDragLayer → cjs/VerticalHeadingsTable/components/DndComponent}/styles.d.ts +1 -1
  85. package/cjs/VerticalHeadingsTable/components/DndComponent/styles.js +13 -0
  86. package/cjs/VerticalHeadingsTable/components/DndComponent/types.d.ts +14 -0
  87. package/cjs/VerticalHeadingsTable/components/DndComponent/types.js +2 -0
  88. package/cjs/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.d.ts +7 -0
  89. package/cjs/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.js +40 -0
  90. package/cjs/VerticalHeadingsTable/components/DndMeasurer/index.d.ts +1 -0
  91. package/cjs/VerticalHeadingsTable/components/DndMeasurer/index.js +5 -0
  92. package/cjs/VerticalHeadingsTable/components/TableCell/TableCell.d.ts +2 -2
  93. package/cjs/VerticalHeadingsTable/components/TableCell/TableCell.js +2 -2
  94. package/cjs/VerticalHeadingsTable/components/TableCell/TableCell.test.js +101 -43
  95. package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.d.ts +10 -0
  96. package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.js +39 -0
  97. package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.d.ts +2 -4
  98. package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.js +29 -58
  99. package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.test.js +128 -58
  100. package/cjs/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.d.ts +3 -3
  101. package/cjs/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.js +38 -9
  102. package/cjs/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.d.ts +9 -0
  103. package/cjs/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.js +37 -0
  104. package/cjs/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.d.ts +4 -4
  105. package/cjs/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.js +3 -4
  106. package/cjs/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.test.js +43 -51
  107. package/cjs/VerticalHeadingsTable/components/TableRow/TableRow.d.ts +4 -5
  108. package/cjs/VerticalHeadingsTable/components/TableRow/TableRow.js +3 -3
  109. package/cjs/VerticalHeadingsTable/components/TableRow/TableRow.test.js +35 -57
  110. package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.d.ts +12 -0
  111. package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.js +42 -0
  112. package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/index.d.ts +1 -0
  113. package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/index.js +5 -0
  114. package/cjs/{features/crosswalks/CrosswalkDragLayer → VerticalHeadingsTable/components/TableRowDragPreview}/styles.d.ts +1 -1
  115. package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/styles.js +11 -0
  116. package/cjs/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.d.ts +2 -8
  117. package/cjs/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.js +21 -52
  118. package/cjs/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.test.js +55 -85
  119. package/cjs/contexts/CrosswalksDisplayContext/index.d.ts +2 -2
  120. package/cjs/contexts/CrosswalksDisplayContext/index.js +6 -2
  121. package/cjs/features/crosswalks/AttributesTable/AttributesTable.d.ts +3 -1
  122. package/cjs/features/crosswalks/AttributesTable/AttributesTable.js +2 -2
  123. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +17 -10
  124. package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.d.ts +3 -2
  125. package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +13 -2
  126. package/cjs/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.d.ts +8 -0
  127. package/cjs/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.js +51 -0
  128. package/cjs/features/crosswalks/CrosswalkDndComponent/index.d.ts +1 -0
  129. package/cjs/features/crosswalks/CrosswalkDndComponent/index.js +5 -0
  130. package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/CrosswalkDragPreview.js +16 -5
  131. package/cjs/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +1 -0
  132. package/cjs/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.js +97 -0
  133. package/{features/crosswalks/CrosswalkDragLayer/components → cjs/features/crosswalks}/CrosswalkDragPreview/styles.d.ts +1 -1
  134. package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/styles.js +6 -1
  135. package/cjs/features/crosswalks/CrosswalkRow/CrosswalkRow.js +25 -16
  136. package/cjs/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +7 -33
  137. package/cjs/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.d.ts +1 -0
  138. package/cjs/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.js +134 -0
  139. package/cjs/features/crosswalks/CrosswalkRow/styles.d.ts +1 -1
  140. package/cjs/features/crosswalks/CrosswalkRow/styles.js +10 -1
  141. package/cjs/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +0 -1
  142. package/cjs/features/crosswalks/hooks/useDraggingCrosswalk.d.ts +6 -0
  143. package/cjs/features/crosswalks/hooks/useDraggingCrosswalk.js +19 -0
  144. package/cjs/features/crosswalks/hooks/useModifiedEntity.js +6 -6
  145. package/cjs/features/crosswalks/index.d.ts +1 -1
  146. package/cjs/features/crosswalks/index.js +3 -3
  147. package/cjs/hooks/useDndBasicTableScrollModifier/index.d.ts +1 -0
  148. package/cjs/hooks/useDndBasicTableScrollModifier/index.js +5 -0
  149. package/cjs/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.d.ts +10 -0
  150. package/cjs/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.js +57 -0
  151. package/cjs/index.d.ts +2 -1
  152. package/cjs/index.js +3 -1
  153. package/cjs/test-utils/dndKit/DndContext.d.ts +12 -0
  154. package/cjs/test-utils/dndKit/DndContext.js +5 -0
  155. package/cjs/test-utils/dndKit/DndContextComponent.d.ts +5 -0
  156. package/cjs/test-utils/dndKit/DndContextComponent.js +97 -0
  157. package/cjs/test-utils/dndKit/DndMonitorContext.d.ts +2 -0
  158. package/cjs/test-utils/dndKit/DndMonitorContext.js +5 -0
  159. package/cjs/test-utils/dndKit/DragOverlay.d.ts +5 -0
  160. package/cjs/test-utils/dndKit/DragOverlay.js +14 -0
  161. package/cjs/test-utils/dndKit/index.d.ts +32 -0
  162. package/cjs/test-utils/dndKit/index.js +22 -0
  163. package/cjs/test-utils/dndKit/type.d.ts +17 -0
  164. package/cjs/test-utils/dndKit/type.js +2 -0
  165. package/cjs/test-utils/dndKit/useDndContext.d.ts +8 -0
  166. package/cjs/test-utils/dndKit/useDndContext.js +13 -0
  167. package/cjs/test-utils/dndKit/useDndMonitor.d.ts +2 -0
  168. package/cjs/test-utils/dndKit/useDndMonitor.js +13 -0
  169. package/cjs/test-utils/dndKit/useDndMonitorProvider.d.ts +1 -0
  170. package/cjs/test-utils/dndKit/useDndMonitorProvider.js +17 -0
  171. package/cjs/test-utils/dndKit/useDraggable.d.ts +12 -0
  172. package/cjs/test-utils/dndKit/useDraggable.js +43 -0
  173. package/cjs/test-utils/dndKit/useDroppable.d.ts +4 -0
  174. package/cjs/test-utils/dndKit/useDroppable.js +45 -0
  175. package/cjs/types/basicTable.d.ts +4 -0
  176. package/contexts/CrosswalksDisplayContext/index.d.ts +2 -2
  177. package/contexts/CrosswalksDisplayContext/index.js +6 -2
  178. package/features/crosswalks/AttributesTable/AttributesTable.d.ts +3 -1
  179. package/features/crosswalks/AttributesTable/AttributesTable.js +2 -2
  180. package/features/crosswalks/AttributesTable/AttributesTable.test.js +17 -10
  181. package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.d.ts +3 -2
  182. package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +13 -2
  183. package/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.d.ts +8 -0
  184. package/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.js +24 -0
  185. package/features/crosswalks/CrosswalkDndComponent/index.d.ts +1 -0
  186. package/features/crosswalks/CrosswalkDndComponent/index.js +1 -0
  187. package/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.js +30 -0
  188. package/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +1 -0
  189. package/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.js +69 -0
  190. package/{cjs/features/crosswalks/CrosswalkDragLayer/components → features/crosswalks}/CrosswalkDragPreview/styles.d.ts +1 -1
  191. package/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/styles.js +6 -1
  192. package/features/crosswalks/CrosswalkRow/CrosswalkRow.js +25 -16
  193. package/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +7 -33
  194. package/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.d.ts +1 -0
  195. package/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.js +129 -0
  196. package/features/crosswalks/CrosswalkRow/styles.d.ts +1 -1
  197. package/features/crosswalks/CrosswalkRow/styles.js +10 -1
  198. package/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +0 -1
  199. package/features/crosswalks/hooks/useDraggingCrosswalk.d.ts +6 -0
  200. package/features/crosswalks/hooks/useDraggingCrosswalk.js +15 -0
  201. package/features/crosswalks/hooks/useModifiedEntity.js +6 -6
  202. package/features/crosswalks/index.d.ts +1 -1
  203. package/features/crosswalks/index.js +1 -1
  204. package/hooks/useDndBasicTableScrollModifier/index.d.ts +1 -0
  205. package/hooks/useDndBasicTableScrollModifier/index.js +1 -0
  206. package/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.d.ts +10 -0
  207. package/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.js +53 -0
  208. package/index.d.ts +2 -1
  209. package/index.js +1 -0
  210. package/package.json +3 -3
  211. package/test-utils/dndKit/DndContext.d.ts +12 -0
  212. package/test-utils/dndKit/DndContext.js +2 -0
  213. package/test-utils/dndKit/DndContextComponent.d.ts +5 -0
  214. package/test-utils/dndKit/DndContextComponent.js +70 -0
  215. package/test-utils/dndKit/DndMonitorContext.d.ts +2 -0
  216. package/test-utils/dndKit/DndMonitorContext.js +2 -0
  217. package/test-utils/dndKit/DragOverlay.d.ts +5 -0
  218. package/test-utils/dndKit/DragOverlay.js +7 -0
  219. package/test-utils/dndKit/index.d.ts +32 -0
  220. package/test-utils/dndKit/index.js +19 -0
  221. package/test-utils/dndKit/type.d.ts +17 -0
  222. package/test-utils/dndKit/type.js +1 -0
  223. package/test-utils/dndKit/useDndContext.d.ts +8 -0
  224. package/test-utils/dndKit/useDndContext.js +9 -0
  225. package/test-utils/dndKit/useDndMonitor.d.ts +2 -0
  226. package/test-utils/dndKit/useDndMonitor.js +9 -0
  227. package/test-utils/dndKit/useDndMonitorProvider.d.ts +1 -0
  228. package/test-utils/dndKit/useDndMonitorProvider.js +13 -0
  229. package/test-utils/dndKit/useDraggable.d.ts +12 -0
  230. package/test-utils/dndKit/useDraggable.js +39 -0
  231. package/test-utils/dndKit/useDroppable.d.ts +4 -0
  232. package/test-utils/dndKit/useDroppable.js +41 -0
  233. package/types/basicTable.d.ts +4 -0
  234. package/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.d.ts +0 -6
  235. package/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.js +0 -23
  236. package/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.d.ts +0 -6
  237. package/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.js +0 -11
  238. package/VerticalHeadingsTable/components/TableColumnDragLayer/index.d.ts +0 -1
  239. package/VerticalHeadingsTable/components/TableColumnDragLayer/index.js +0 -1
  240. package/VerticalHeadingsTable/components/TableColumnDragLayer/styles.js +0 -13
  241. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.d.ts +0 -6
  242. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.js +0 -50
  243. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.d.ts +0 -6
  244. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.js +0 -15
  245. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/index.d.ts +0 -1
  246. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/index.js +0 -5
  247. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/styles.js +0 -16
  248. package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.d.ts +0 -2
  249. package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.js +0 -51
  250. package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +0 -93
  251. package/cjs/features/crosswalks/CrosswalkDragLayer/index.d.ts +0 -1
  252. package/cjs/features/crosswalks/CrosswalkDragLayer/index.js +0 -5
  253. package/cjs/features/crosswalks/CrosswalkDragLayer/styles.js +0 -17
  254. package/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.d.ts +0 -2
  255. package/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.js +0 -25
  256. package/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +0 -65
  257. package/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.js +0 -19
  258. package/features/crosswalks/CrosswalkDragLayer/index.d.ts +0 -1
  259. package/features/crosswalks/CrosswalkDragLayer/index.js +0 -1
  260. package/features/crosswalks/CrosswalkDragLayer/styles.js +0 -14
  261. /package/{cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.d.ts → VerticalHeadingsTable/DndVerticalHeadingsTable.test.d.ts} +0 -0
  262. /package/{features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.d.ts → VerticalHeadingsTable/components/DndComponent/types.js} +0 -0
  263. /package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/CrosswalkDragPreview.d.ts +0 -0
  264. /package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/index.d.ts +0 -0
  265. /package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/index.js +0 -0
  266. /package/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/CrosswalkDragPreview.d.ts +0 -0
  267. /package/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/index.d.ts +0 -0
  268. /package/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/index.js +0 -0
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDroppable = void 0;
4
+ var react_1 = require("react");
5
+ var utilities_1 = require("@dnd-kit/utilities");
6
+ var useDndContext_1 = require("./useDndContext");
7
+ var useDroppable = function (props) {
8
+ var _a = (0, useDndContext_1.useDndContext)(), droppableNodesRef = _a.droppableNodesRef, onDragOver = _a.onDragOver;
9
+ var _b = (0, react_1.useState)(null), element = _b[0], setElement = _b[1];
10
+ var onChangeElem = (0, react_1.useCallback)(function (newElement) {
11
+ if (newElement) {
12
+ newElement.setAttribute('data-test-dnd-drop-id', props.id);
13
+ setElement(newElement);
14
+ }
15
+ }, [props.id]);
16
+ var _c = (0, utilities_1.useNodeRef)(onChangeElem), node = _c[0], setNodeRef = _c[1];
17
+ var data = (0, react_1.useRef)(props.data);
18
+ (0, react_1.useEffect)(function () {
19
+ droppableNodesRef.current.set(props.id, { id: props.id, data: data, node: node });
20
+ return function () {
21
+ var node = droppableNodesRef.current.get(props.id);
22
+ if (node) {
23
+ droppableNodesRef.current.delete(props.id);
24
+ }
25
+ };
26
+ }, [props.id]);
27
+ (0, react_1.useEffect)(function () {
28
+ if (!element) {
29
+ return;
30
+ }
31
+ var onMouseOver = function (event) {
32
+ if (element === event.target) {
33
+ onDragOver(props.id);
34
+ }
35
+ };
36
+ element.addEventListener('mouseover', onMouseOver);
37
+ return function () {
38
+ element.removeEventListener('mouseover', onMouseOver);
39
+ };
40
+ }, [element, onDragOver, props.id]);
41
+ return {
42
+ setNodeRef: setNodeRef
43
+ };
44
+ };
45
+ exports.useDroppable = useDroppable;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DataTypeDefinition, SearchValue, SortOrder } from '@reltio/mdm-sdk';
3
3
  import { useCollapsibleTableRows } from '../hooks/useCollapsibleTableRows';
4
+ import { DraggableAttributes } from '@dnd-kit/core';
4
5
  export type Sorting = {
5
6
  field: string;
6
7
  order: SortOrder;
@@ -89,4 +90,7 @@ export type OnFilter = (event: {
89
90
  columnId: string;
90
91
  filter: ColumnFilter;
91
92
  }) => void;
93
+ export type DraggableProps = DraggableAttributes & {
94
+ ref: (element: HTMLElement | null) => void;
95
+ };
92
96
  export {};
@@ -14,8 +14,8 @@ export declare const useHighlightedCrosswalks: () => any;
14
14
  export declare const useCrosswalkHighlight: (crosswalk?: CrosswalkBase) => {
15
15
  isHighlighted: boolean;
16
16
  isDimmed: boolean;
17
- highlightCrosswalk: () => any;
18
- removeHighlight: () => any;
17
+ highlightCrosswalk: () => void;
18
+ removeHighlight: () => void;
19
19
  };
20
20
  export declare const useCrosswalkFocus: (crosswalk?: CrosswalkBase) => {
21
21
  isFocused: any;
@@ -31,8 +31,12 @@ export var useCrosswalkHighlight = function (crosswalk) {
31
31
  return {
32
32
  isHighlighted: isHighlighted,
33
33
  isDimmed: highlightedCrosswalks.length > 0 && !isHighlighted,
34
- highlightCrosswalk: useCallback(function () { return setCrosswalkHighlighted(crosswalk, true); }, [crosswalk, setCrosswalkHighlighted]),
35
- removeHighlight: useCallback(function () { return setCrosswalkHighlighted(crosswalk, false); }, [crosswalk, setCrosswalkHighlighted])
34
+ highlightCrosswalk: useCallback(function () {
35
+ setCrosswalkHighlighted(crosswalk, true);
36
+ }, [crosswalk, setCrosswalkHighlighted]),
37
+ removeHighlight: useCallback(function () {
38
+ setCrosswalkHighlighted(crosswalk, false);
39
+ }, [crosswalk, setCrosswalkHighlighted])
36
40
  };
37
41
  };
38
42
  export var useCrosswalkFocus = function (crosswalk) {
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { AttributeType, Entity, Relation } from '@reltio/mdm-sdk';
3
3
  import { AddInlineAttributeEvent, DeleteInlineAttributeEvent, EditInlineAttributeEvent, IgnoreInlineAttributeEvent, PinInlineAttributeEvent } from '../../../types/inlineAttributes';
4
+ import { BasicTable } from '../../../BasicTable';
4
5
  import { CrosswalksByOwnerTypeMap } from '../types';
5
6
  type Props = {
6
7
  entity?: Entity | Relation;
@@ -20,6 +21,7 @@ type Props = {
20
21
  additionalHeaderItems?: React.ReactNode;
21
22
  className?: string;
22
23
  activeSurvivorshipGroupUri?: string;
24
+ tableRef?: React.ElementRef<typeof BasicTable>;
23
25
  };
24
- declare const _default: React.MemoExoticComponent<({ entity, isLoading, crosswalksMap, visibleColumns, onChangeVisibleColumns, readOnly, onDelete, onPin, onIgnore, onEdit, onAdd, emptyTempAttributeUris, selectedAttributeTypes, onSelectAttributeTypes, additionalHeaderItems, className, activeSurvivorshipGroupUri }: Props) => React.JSX.Element>;
26
+ declare const _default: React.MemoExoticComponent<({ entity, isLoading, crosswalksMap, visibleColumns, onChangeVisibleColumns, readOnly, onDelete, onPin, onIgnore, onEdit, onAdd, emptyTempAttributeUris, selectedAttributeTypes, onSelectAttributeTypes, additionalHeaderItems, className, activeSurvivorshipGroupUri, tableRef }: Props) => React.JSX.Element>;
25
27
  export default _default;
@@ -32,7 +32,7 @@ var getRowCellKey = function (_a) {
32
32
  return "".concat(id, "[").concat(getIdFromRowValue(rowValue), "][").concat(cellIndex, "]");
33
33
  };
34
34
  var AttributesTable = function (_a) {
35
- var entity = _a.entity, isLoading = _a.isLoading, crosswalksMap = _a.crosswalksMap, _b = _a.visibleColumns, visibleColumns = _b === void 0 ? DEFAULT_VISIBLE_COLUMNS : _b, onChangeVisibleColumns = _a.onChangeVisibleColumns, readOnly = _a.readOnly, _c = _a.onDelete, onDelete = _c === void 0 ? identity : _c, _d = _a.onPin, onPin = _d === void 0 ? identity : _d, _e = _a.onIgnore, onIgnore = _e === void 0 ? identity : _e, _f = _a.onEdit, onEdit = _f === void 0 ? identity : _f, _g = _a.onAdd, onAdd = _g === void 0 ? identity : _g, emptyTempAttributeUris = _a.emptyTempAttributeUris, selectedAttributeTypes = _a.selectedAttributeTypes, _h = _a.onSelectAttributeTypes, onSelectAttributeTypes = _h === void 0 ? identity : _h, additionalHeaderItems = _a.additionalHeaderItems, className = _a.className, activeSurvivorshipGroupUri = _a.activeSurvivorshipGroupUri;
35
+ var entity = _a.entity, isLoading = _a.isLoading, crosswalksMap = _a.crosswalksMap, _b = _a.visibleColumns, visibleColumns = _b === void 0 ? DEFAULT_VISIBLE_COLUMNS : _b, onChangeVisibleColumns = _a.onChangeVisibleColumns, readOnly = _a.readOnly, _c = _a.onDelete, onDelete = _c === void 0 ? identity : _c, _d = _a.onPin, onPin = _d === void 0 ? identity : _d, _e = _a.onIgnore, onIgnore = _e === void 0 ? identity : _e, _f = _a.onEdit, onEdit = _f === void 0 ? identity : _f, _g = _a.onAdd, onAdd = _g === void 0 ? identity : _g, emptyTempAttributeUris = _a.emptyTempAttributeUris, selectedAttributeTypes = _a.selectedAttributeTypes, _h = _a.onSelectAttributeTypes, onSelectAttributeTypes = _h === void 0 ? identity : _h, additionalHeaderItems = _a.additionalHeaderItems, className = _a.className, activeSurvivorshipGroupUri = _a.activeSurvivorshipGroupUri, tableRef = _a.tableRef;
36
36
  var styles = useStyles();
37
37
  var metadata = useMdmMetadata();
38
38
  var visibleColumnsData = useMemo(function () {
@@ -114,7 +114,7 @@ var AttributesTable = function (_a) {
114
114
  React.createElement(ColumnsSettings, { columnsData: COLUMNS_DATA, selectedColumns: visibleColumns, onChangeColumns: onChangeVisibleColumns })),
115
115
  React.createElement("div", { className: styles.tableContent },
116
116
  isLoading && React.createElement(LinearLoadIndicator, null),
117
- React.createElement(BasicTable, { fixFirstColumn: true, headRowHeight: 48, defaultColumnWidth: 250, defaultColumnMinWidth: 200, columnsData: visibleColumnsData, dndRowReorderingEnabled: false, dndRowReorderingHandler: handleReorderAttributeTypes, getIdFromRowValue: getIdFromRowValue, rowsData: rowsData, renderRowCell: renderRowCell, getRowCellHeight: getRowCellHeight, context: tableContext })),
117
+ React.createElement(BasicTable, { ref: tableRef, fixFirstColumn: true, headRowHeight: 48, defaultColumnWidth: 250, defaultColumnMinWidth: 200, columnsData: visibleColumnsData, dndRowReorderingEnabled: false, dndRowReorderingHandler: handleReorderAttributeTypes, getIdFromRowValue: getIdFromRowValue, rowsData: rowsData, renderRowCell: renderRowCell, getRowCellHeight: getRowCellHeight, context: tableContext })),
118
118
  React.createElement(ConfirmDeleteDialog, { open: !!pendingDeletion, onClose: function () { return setPendingDeletion(null); }, onConfirm: handleDelete }),
119
119
  React.createElement(ConfirmEditIgnoredDialog, { open: !!pendingIgnoredEditing, onClose: function () { return setPendingIgnoredEditing(null); }, onConfirmEditWithIgnore: function () { return pendingIgnoredEditing && onEdit(pendingIgnoredEditing); }, onConfirmEditWithoutIgnore: function () {
120
120
  if (pendingIgnoredEditing)
@@ -57,13 +57,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
57
57
  import React from 'react';
58
58
  import { render, fireEvent, within, screen } from '@testing-library/react';
59
59
  import userEvent from '@testing-library/user-event';
60
- import { DndProvider } from 'react-dnd';
61
- import HTML5Backend from 'react-dnd-html5-backend';
62
60
  import { config } from 'react-transition-group';
61
+ import { mockDndKit } from '../../../test-utils/dndKit';
62
+ import { DndContext } from '@dnd-kit/core';
63
63
  import { mockBasicTableSizing } from '../../../test-utils';
64
64
  import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
65
65
  import { createEntity, createMetadata, selectedAttributeTypes } from './AttributesTable.test-data';
66
66
  import AttributesTable from './AttributesTable';
67
+ jest.mock('@dnd-kit/core', function () { return mockDndKit; });
67
68
  jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { debounce: function (x) { return x; } })); });
68
69
  var visibleColumns = ['ovValues', 'values'];
69
70
  var crosswalksMap = {
@@ -116,7 +117,7 @@ var setUp = function (props) {
116
117
  var user = userEvent.setup({ delay: null, skipHover: true });
117
118
  var Providers = function (_a) {
118
119
  var children = _a.children;
119
- return (React.createElement(DndProvider, { backend: HTML5Backend },
120
+ return (React.createElement(DndContext, null,
120
121
  React.createElement(MdmModuleProvider, { values: { metadata: metadata } }, children)));
121
122
  };
122
123
  var renderer = render(React.createElement(AttributesTable, __assign({}, props)), { wrapper: Providers });
@@ -351,23 +352,29 @@ describe('attribute table tests', function () {
351
352
  expect(within(getCellByIndexes(1, 0)).queryByText('Boolean')).toBeInTheDocument();
352
353
  expect(within(getCellByIndexes(1, 1)).queryByText('Yes')).toBeInTheDocument();
353
354
  expect(within(getCellByIndexes(0, 0)).queryByText('text field value')).toBeInTheDocument();
354
- expect(within(getCellByIndexes(0, 0)).queryByText('<h1>String</h1>')).toBeInTheDocument();
355
+ expect(within(getCellByIndexes(0, 0)).queryByText('String Label')).toBeInTheDocument();
355
356
  expect(within(getCellByIndexes(0, 1)).queryByText('text field value')).toBeInTheDocument();
356
357
  var dragIndicator = getCellByIndexes(0, 0).querySelector('.dragIndicator');
357
- fireEvent.dragStart(dragIndicator);
358
+ fireEvent.mouseDown(dragIndicator);
358
359
  jest.runAllTimers();
359
360
  expect(within(getCellByIndexes(1, 0)).queryByText('Yes')).not.toBeInTheDocument();
360
361
  expect(within(getCellByIndexes(1, 0)).queryByText('Boolean')).toBeInTheDocument();
361
362
  expect(within(getCellByIndexes(1, 1)).queryByText('Yes')).not.toBeInTheDocument();
362
363
  expect(within(getCellByIndexes(0, 0)).queryByText('text field value')).not.toBeInTheDocument();
363
- expect(within(getCellByIndexes(0, 0)).queryByText('<h1>String</h1>')).toBeInTheDocument();
364
+ expect(within(getCellByIndexes(0, 0)).queryByText('String Label')).toBeInTheDocument();
364
365
  expect(within(getCellByIndexes(0, 1)).queryByText('text field value')).not.toBeInTheDocument();
365
366
  var dropRow = getCellByIndexes(1, 0);
366
- fireEvent.dragEnter(dropRow);
367
+ fireEvent.mouseOver(dropRow);
367
368
  expect(within(getCellByIndexes(0, 0)).queryByText('Boolean')).toBeInTheDocument();
368
- expect(within(getCellByIndexes(1, 0)).queryByText('<h1>String</h1>')).toBeInTheDocument();
369
- fireEvent.dragEnd(dropRow);
370
- expect(onSelectAttributeTypes).toHaveBeenCalledWith([selectedAttributeTypes[1], selectedAttributeTypes[0]]);
369
+ expect(within(getCellByIndexes(1, 0)).queryByText('String Label')).toBeInTheDocument();
370
+ fireEvent.mouseUp(dragIndicator);
371
+ expect(onSelectAttributeTypes).toHaveBeenCalledWith([
372
+ selectedAttributeTypes[1],
373
+ selectedAttributeTypes[0],
374
+ selectedAttributeTypes[2],
375
+ selectedAttributeTypes[3],
376
+ selectedAttributeTypes[4]
377
+ ]);
371
378
  unmockTableSizing();
372
379
  });
373
380
  it('should pin and ignore attributes', function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { OvValues } from '../../types';
3
+ import { DraggableProps } from '../../../../../types/basicTable';
3
4
  type Props = {
4
5
  value: OvValues;
5
6
  someRowIsDragging?: boolean;
6
- dragRef?: React.Ref<HTMLDivElement>;
7
+ draggableProps?: DraggableProps;
7
8
  };
8
- export declare const OvValuesRenderer: ({ value: { values, attributeType }, someRowIsDragging, dragRef }: Props) => React.JSX.Element;
9
+ export declare const OvValuesRenderer: ({ value: { values, attributeType }, someRowIsDragging, draggableProps }: Props) => React.JSX.Element;
9
10
  export {};
@@ -1,3 +1,14 @@
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
+ };
1
12
  import React from 'react';
2
13
  import classnames from 'classnames';
3
14
  import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
@@ -8,12 +19,12 @@ import { useMdmEntity } from '../../../../../contexts/MdmModuleContext';
8
19
  import { useCommonStyles } from '../../styles';
9
20
  import { useStyles } from './styles';
10
21
  export var OvValuesRenderer = function (_a) {
11
- var _b = _a.value, values = _b.values, attributeType = _b.attributeType, someRowIsDragging = _a.someRowIsDragging, dragRef = _a.dragRef;
22
+ var _b = _a.value, values = _b.values, attributeType = _b.attributeType, someRowIsDragging = _a.someRowIsDragging, draggableProps = _a.draggableProps;
12
23
  var styles = useStyles();
13
24
  var commonStyles = useCommonStyles();
14
25
  var entity = useMdmEntity();
15
26
  return (React.createElement("div", { className: classnames(styles.root, commonStyles.basicCell) },
16
- React.createElement("div", { ref: dragRef, className: styles.dragIndicator },
27
+ React.createElement("div", __assign({}, draggableProps, { className: styles.dragIndicator }),
17
28
  React.createElement(DragIndicatorIcon, { className: styles.dragIndicatorIcon })),
18
29
  React.createElement(AttributeTitle, { className: styles.attributeTitle, label: attributeType.label }),
19
30
  !someRowIsDragging && (React.createElement(EntityContext.Provider, { value: entity },
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { BasicTable } from '../../../BasicTable';
3
+ type Props = {
4
+ tableRef: React.ElementRef<typeof BasicTable>;
5
+ children: React.ReactNode;
6
+ };
7
+ export declare const CrosswalkDndComponent: ({ children, tableRef }: Props) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,24 @@
1
+ import React, { useCallback, useMemo } from 'react';
2
+ import { useDndBasicTableScrollModifier } from '../../../hooks/useDndBasicTableScrollModifier';
3
+ import { useDraggingCrosswalk } from '../hooks/useDraggingCrosswalk';
4
+ import { snapCenterToCursor } from '@dnd-kit/modifiers';
5
+ import { DndContext, DragOverlay, MouseSensor, useSensor, useSensors } from '@dnd-kit/core';
6
+ import { CrosswalkDragPreview } from '../CrosswalkDragPreview';
7
+ export var CrosswalkDndComponent = function (_a) {
8
+ var children = _a.children, tableRef = _a.tableRef;
9
+ var _b = useDndBasicTableScrollModifier({ tableRef: tableRef }), scrollModifier = _b.scrollModifier, stopScroll = _b.stopScroll;
10
+ var dragOverlayStyles = useMemo(function () { return ({ width: 'max-content' }); }, []);
11
+ var _c = useDraggingCrosswalk(), draggingCrosswalk = _c.draggingCrosswalk, onDragEndCrosswalk = _c.onDragEnd, onDragStart = _c.onDragStart;
12
+ var onDragEnd = useCallback(function () {
13
+ onDragEndCrosswalk();
14
+ stopScroll();
15
+ }, [onDragEndCrosswalk, stopScroll]);
16
+ var dndContextModifiers = useMemo(function () { return [scrollModifier]; }, [scrollModifier]);
17
+ var dragOverlayModifiers = useMemo(function () { return [snapCenterToCursor]; }, []);
18
+ var mouseSensor = useSensor(MouseSensor);
19
+ var sensors = useSensors(mouseSensor);
20
+ return (React.createElement(DndContext, { sensors: sensors, modifiers: dndContextModifiers, autoScroll: false, onDragStart: onDragStart, onDragEnd: onDragEnd },
21
+ React.createElement(DragOverlay, { style: dragOverlayStyles, modifiers: dragOverlayModifiers, dropAnimation: null },
22
+ React.createElement(CrosswalkDragPreview, { crosswalk: draggingCrosswalk })),
23
+ children));
24
+ };
@@ -0,0 +1 @@
1
+ export { CrosswalkDndComponent } from './CrosswalkDndComponent';
@@ -0,0 +1 @@
1
+ export { CrosswalkDndComponent } from './CrosswalkDndComponent';
@@ -0,0 +1,30 @@
1
+ import React, { memo, useState } from 'react';
2
+ import classnames from 'classnames';
3
+ import { canAddCrosswalk, getSourceSystemLabel } from '@reltio/mdm-sdk';
4
+ import { useDndMonitor } from '@dnd-kit/core';
5
+ import Typography from '@mui/material/Typography';
6
+ import { useMdmMetadata } from '../../../contexts/MdmModuleContext';
7
+ import { useCrosswalkColor } from '../../../contexts/CrosswalksDisplayContext';
8
+ import { SourceIcon } from '../../../SourceIcon';
9
+ import { ColoredBlock } from '../ColoredBlock';
10
+ import { useStyles } from './styles';
11
+ export var CrosswalkDragPreview = memo(function (_a) {
12
+ var _b;
13
+ var crosswalk = _a.crosswalk;
14
+ var styles = useStyles();
15
+ var metadata = useMdmMetadata();
16
+ var color = useCrosswalkColor(crosswalk);
17
+ var sourceSystemLabel = getSourceSystemLabel(metadata, crosswalk.type);
18
+ var _c = useState(false), canDrop = _c[0], setCanDrop = _c[1];
19
+ useDndMonitor({
20
+ onDragOver: function (event) {
21
+ var _a, _b, _c;
22
+ var attributeType = (_c = (_b = (_a = event.over) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.attributeType;
23
+ setCanDrop(!!attributeType && canAddCrosswalk(crosswalk, attributeType));
24
+ }
25
+ });
26
+ return (React.createElement(ColoredBlock, { color: color, className: classnames(styles.crosswalkPreview, (_b = {}, _b[styles.noDrop] = !canDrop, _b)) },
27
+ React.createElement(SourceIcon, { className: styles.sourceIcon, sourceType: crosswalk.type }),
28
+ React.createElement(Typography, { className: styles.sourceLabel, variant: 'body2' }, sourceSystemLabel)));
29
+ });
30
+ CrosswalkDragPreview.displayName = 'CrosswalkDragPreview';
@@ -0,0 +1,69 @@
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 React from 'react';
13
+ import * as CrosswalksDisplay from '../../../contexts/CrosswalksDisplayContext';
14
+ import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
15
+ import { CrosswalkDragPreview } from './CrosswalkDragPreview';
16
+ import { act, render, screen } from '@testing-library/react';
17
+ import { DndContext, useDndMonitor } from '@dnd-kit/core';
18
+ jest.mock('@dnd-kit/core', function () { return (__assign(__assign({}, jest.requireActual('@dnd-kit/core')), { useDndMonitor: jest.fn() })); });
19
+ jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { canAddCrosswalk: jest.fn().mockReturnValue(true) })); });
20
+ var defaultProps = {
21
+ crosswalk: { uri: 'entities/1/crosswalks/1', type: 'configuration/sources/FB', value: '123' }
22
+ };
23
+ var setUp = function (props) {
24
+ if (props === void 0) { props = defaultProps; }
25
+ var metadata = {
26
+ sources: [
27
+ {
28
+ uri: 'configuration/sources/FB',
29
+ label: 'Facebook'
30
+ }
31
+ ]
32
+ };
33
+ var Providers = function (_a) {
34
+ var children = _a.children;
35
+ return (React.createElement(DndContext, null,
36
+ React.createElement(MdmModuleProvider, { values: { metadata: metadata } }, children)));
37
+ };
38
+ return render(React.createElement(CrosswalkDragPreview, __assign({}, props)), { wrapper: Providers });
39
+ };
40
+ describe('CrosswalkDragPreview tests', function () {
41
+ beforeAll(function () {
42
+ jest.spyOn(CrosswalksDisplay, 'useCrosswalkColor').mockImplementation(function (crosswalks) { return crosswalks === null || crosswalks === void 0 ? void 0 : crosswalks.value; });
43
+ });
44
+ it('should render correctly', function () {
45
+ setUp();
46
+ expect(screen.getByText('Facebook')).toBeInTheDocument();
47
+ expect(screen.getByText('F')).toBeInTheDocument();
48
+ expect(screen.getByTestId('cw-colored-block')).toHaveClass('noDrop');
49
+ });
50
+ it('should able for drop', function () {
51
+ var onDragOver;
52
+ useDndMonitor.mockImplementation(function (listeners) {
53
+ onDragOver = listeners.onDragOver;
54
+ });
55
+ setUp();
56
+ act(function () {
57
+ onDragOver({
58
+ over: {
59
+ data: {
60
+ current: {
61
+ attributeType: 'testAttrTypeUri'
62
+ }
63
+ }
64
+ }
65
+ });
66
+ });
67
+ expect(screen.getByTestId('cw-colored-block')).not.toHaveClass('noDrop');
68
+ });
69
+ });
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"sourceIcon" | "crosswalkPreview" | "sourceLabel">;
1
+ export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"sourceIcon" | "crosswalkPreview" | "sourceLabel" | "noDrop">;
@@ -2,12 +2,14 @@ import { makeStyles } from '@mui/styles';
2
2
  export var useStyles = makeStyles({
3
3
  crosswalkPreview: {
4
4
  height: '28px',
5
+ width: 'max-content',
5
6
  maxWidth: '394px',
6
7
  display: 'flex',
7
8
  overflow: 'hidden',
8
9
  padding: '6px',
9
10
  alignItems: 'center',
10
- boxSizing: 'border-box'
11
+ boxSizing: 'border-box',
12
+ cursor: 'copy'
11
13
  },
12
14
  sourceLabel: {
13
15
  fontSize: '13px',
@@ -19,5 +21,8 @@ export var useStyles = makeStyles({
19
21
  width: '16px',
20
22
  height: '16px',
21
23
  marginRight: '9px'
24
+ },
25
+ noDrop: {
26
+ cursor: 'no-drop'
22
27
  }
23
28
  });
@@ -1,7 +1,17 @@
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
+ };
1
12
  import React, { useEffect, useRef, useState, memo } from 'react';
2
13
  import i18n from 'ui-i18n';
3
- import { useDrag } from 'react-dnd';
4
- import { getEmptyImage } from 'react-dnd-html5-backend';
14
+ import { useDraggable } from '@dnd-kit/core';
5
15
  import { eqCrosswalks, getLastUriPart, getSourceSystemLabel, isCrosswalkDisabled } from '@reltio/mdm-sdk';
6
16
  import Typography from '@mui/material/Typography';
7
17
  import DeleteIcon from '@mui/icons-material/Delete';
@@ -34,17 +44,15 @@ export var CrosswalkRow = memo(function (_a) {
34
44
  var crosswalkId = getLastUriPart(crosswalk.uri);
35
45
  var crosswalkDisabled = isCrosswalkDisabled(crosswalk);
36
46
  var styles = useStyles({ color: color, isOpaque: !isDimmed, isFocused: isFocused });
37
- var _j = useDrag({
38
- item: {
47
+ var _j = useDraggable({
48
+ id: crosswalk.uri,
49
+ data: {
39
50
  type: 'Crosswalk',
40
51
  crosswalk: crosswalk
41
52
  },
42
- canDrag: !crosswalkDisabled
43
- }), drag = _j[1], preview = _j[2];
53
+ disabled: crosswalkDisabled
54
+ }), setNodeRef = _j.setNodeRef, attributes = _j.attributes, listeners = _j.listeners;
44
55
  var canDelete = !crosswalkDisabled && crosswalk.ownerType !== 'relation';
45
- useEffect(function () {
46
- preview(getEmptyImage(), { captureDraggingState: true });
47
- }, []);
48
56
  useEffect(function () {
49
57
  var _a, _b;
50
58
  if (focusable &&
@@ -62,15 +70,16 @@ export var CrosswalkRow = memo(function (_a) {
62
70
  return (React.createElement("div", { className: styles.root, ref: ref },
63
71
  React.createElement(SmallIconButtonWithTooltip, { size: "XXS", className: styles.focusedIcon, icon: focusable && VisibilityIcon, onClick: function () { return toggleCrosswalkFocus(); }, disabled: !focusable, tooltipTitle: focusable && i18n.text('Focus') }),
64
72
  React.createElement("div", { className: styles.crosswalkWrapper },
65
- React.createElement(ColoredBlock, { ref: drag, className: styles.header, color: color, variant: crosswalkDisabled ? 'disabled' : 'standart', onMouseEnter: function () { return highlightCrosswalk(); }, onMouseLeave: function () { return removeHighlight(); } },
73
+ React.createElement(ColoredBlock, { className: styles.header, color: color, variant: crosswalkDisabled ? 'disabled' : 'standart', onMouseEnter: highlightCrosswalk, onMouseLeave: removeHighlight },
66
74
  isDependent && React.createElement(DependentIcon, { className: styles.dependentIcon }),
67
75
  React.createElement(ArrowExpandButton, { onClick: function () { return setExpanded(function (value) { return !value; }); }, expanded: expanded }),
68
- React.createElement(SourceIcon, { className: styles.sourceIcon, sourceType: crosswalk.type }),
69
- React.createElement(ExpandedValueTooltip, { value: sourceSystemLabel },
70
- React.createElement(Typography, { variant: 'body2', noWrap: true }, sourceSystemLabel)),
71
- React.createElement(Spacer, null),
72
- React.createElement(ExpandedValueTooltip, { value: crosswalk.value },
73
- React.createElement(Typography, { variant: 'body2', className: styles.labelValue, noWrap: true }, crosswalk.value))),
76
+ React.createElement("div", __assign({ className: styles.dragWrapper, ref: setNodeRef }, listeners, attributes),
77
+ React.createElement(SourceIcon, { className: styles.sourceIcon, sourceType: crosswalk.type }),
78
+ React.createElement(ExpandedValueTooltip, { value: sourceSystemLabel },
79
+ React.createElement(Typography, { variant: 'body2', noWrap: true }, sourceSystemLabel)),
80
+ React.createElement(Spacer, null),
81
+ React.createElement(ExpandedValueTooltip, { value: crosswalk.value },
82
+ React.createElement(Typography, { variant: 'body2', className: styles.labelValue, noWrap: true }, crosswalk.value)))),
74
83
  expanded && (React.createElement("div", { className: styles.attributesWrapper },
75
84
  canDelete && (React.createElement("div", { className: styles.deleteCrosswalkButton },
76
85
  React.createElement(SmallIconButtonWithTooltip, { icon: DeleteIcon, disabled: disableDelete, onClick: function () { return setDeleteDialogOpen(true); }, size: "XS", tooltipTitle: disableDelete
@@ -52,14 +52,12 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
52
52
  import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
53
53
  import { ThemeProvider } from '@mui/styles';
54
54
  import { createTheme } from '@mui/material/styles';
55
- import * as reactDnd from 'react-dnd';
56
- import { getEmptyImage } from 'react-dnd-html5-backend';
57
55
  import { isCrosswalkDisabled, theme } from '@reltio/mdm-sdk';
58
56
  import * as CrosswalksDisplay from '../../../contexts/CrosswalksDisplayContext';
59
57
  import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
60
58
  import { CrosswalkRow } from './CrosswalkRow';
59
+ import { DndContext } from '@dnd-kit/core';
61
60
  jest.unmock('@mui/styles');
62
- jest.mock('react-dnd', function () { return (__assign(__assign({}, jest.requireActual('react-dnd')), { useDrag: jest.fn() })); });
63
61
  jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { isCrosswalkDisabled: jest.fn() })); });
64
62
  var metadata = {
65
63
  sources: [
@@ -95,14 +93,16 @@ var defaultProps = {
95
93
  onDelete: jest.fn(),
96
94
  onEdit: jest.fn()
97
95
  };
98
- var setUp = function (props) {
96
+ var setUp = function (props, dndProps) {
99
97
  if (props === void 0) { props = defaultProps; }
98
+ if (dndProps === void 0) { dndProps = {}; }
100
99
  var user = userEvent.setup({ delay: null });
101
100
  var Providers = function (_a) {
102
101
  var children = _a.children;
103
- return (React.createElement(MdmModuleProvider, { values: { metadata: metadata } },
104
- React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment },
105
- React.createElement(ThemeProvider, { theme: createTheme(theme) }, children))));
102
+ return (React.createElement(DndContext, __assign({}, dndProps),
103
+ React.createElement(MdmModuleProvider, { values: { metadata: metadata } },
104
+ React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment },
105
+ React.createElement(ThemeProvider, { theme: createTheme(theme) }, children)))));
106
106
  };
107
107
  var renderer = render(React.createElement(CrosswalkRow, __assign({}, props)), { wrapper: Providers });
108
108
  return __assign(__assign({}, renderer), { user: user });
@@ -111,8 +111,6 @@ describe('CrosswalkRow tests', function () {
111
111
  var highlightCrosswalk = jest.fn();
112
112
  var removeHighlight = jest.fn();
113
113
  var toggleCrosswalkFocus = jest.fn();
114
- var preview = jest.fn();
115
- var useDragMock = jest.spyOn(reactDnd, 'useDrag').mockReturnValue([undefined, function () { return null; }, preview]);
116
114
  var useHighlightedCrosswalksMock = jest.spyOn(CrosswalksDisplay, 'useHighlightedCrosswalks').mockReturnValue([]);
117
115
  beforeEach(function () {
118
116
  isCrosswalkDisabled.mockReturnValue(false);
@@ -444,28 +442,4 @@ describe('CrosswalkRow tests', function () {
444
442
  rerender(React.createElement(CrosswalkRow, __assign({}, props, { crosswalk: __assign({}, crosswalk) })));
445
443
  expect(node.scrollIntoView).toHaveBeenCalled();
446
444
  });
447
- describe('dnd', function () {
448
- afterEach(function () {
449
- useDragMock.mockClear();
450
- });
451
- it('should use correct drag item', function () {
452
- setUp();
453
- var _a = useDragMock.mock.calls[0][0], item = _a.item, canDrag = _a.canDrag;
454
- expect(item).toEqual({
455
- type: 'Crosswalk',
456
- crosswalk: defaultProps.crosswalk
457
- });
458
- expect(canDrag).toBe(true);
459
- });
460
- it('should use empty image preview', function () {
461
- setUp();
462
- expect(preview).toHaveBeenCalledWith(getEmptyImage(), { captureDraggingState: true });
463
- });
464
- it('should not allow drag if crosswalk is disabled', function () {
465
- isCrosswalkDisabled.mockReturnValue(true);
466
- setUp();
467
- var canDrag = useDragMock.mock.calls[0][0].canDrag;
468
- expect(canDrag).toBe(false);
469
- });
470
- });
471
445
  });