@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
@@ -4,8 +4,8 @@ import { BarChartOptions } from '@reltio/mdm-sdk';
4
4
  type BarChartSettings = {
5
5
  barChart: React.ComponentProps<typeof BarChart>;
6
6
  bar: Omit<BarProps, 'ref'>;
7
- xAxis: XAxisProps;
8
- yAxis: YAxisProps;
7
+ xAxis: Omit<XAxisProps, 'ref'>;
8
+ yAxis: Omit<YAxisProps, 'ref'>;
9
9
  cartesianGrid: Omit<CartesianGridProps, 'ref'>;
10
10
  tooltip: TooltipProps<number, string>;
11
11
  };
@@ -48,16 +48,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  import React from 'react';
49
49
  import { screen, render, within, fireEvent, act } from '@testing-library/react';
50
50
  import userEvent from '@testing-library/user-event';
51
- import HTML5Backend from 'react-dnd-html5-backend';
52
- import { DndProvider } from 'react-dnd';
51
+ import { mockDndKit } from '../test-utils/dndKit';
52
+ jest.mock('@dnd-kit/core', function () { return mockDndKit; });
53
53
  import { BasicTable } from './BasicTable';
54
54
  import { CollapseRowButton } from '../CollapseRowButton';
55
55
  import { mockBasicTableSizing } from '../test-utils';
56
56
  var FirstColumnRenderer = function (_a) {
57
- var value = _a.value, rowValue = _a.rowValue, rowIndex = _a.rowIndex, dragRef = _a.dragRef;
57
+ var value = _a.value, rowValue = _a.rowValue, rowIndex = _a.rowIndex, draggableProps = _a.draggableProps;
58
58
  return (React.createElement("div", null,
59
59
  React.createElement(CollapseRowButton, { rowIndex: rowIndex, rowValue: rowValue }),
60
- React.createElement("div", { ref: dragRef }, "drag el"),
60
+ React.createElement("div", __assign({}, draggableProps), "drag el"),
61
61
  React.createElement("div", null, value.name)));
62
62
  };
63
63
  var SecondColumnRenderer = function (_a) {
@@ -117,11 +117,7 @@ var defaultProps = {
117
117
  };
118
118
  var setUp = function (props) {
119
119
  var user = userEvent.setup();
120
- var Providers = function (_a) {
121
- var children = _a.children;
122
- return React.createElement(DndProvider, { backend: HTML5Backend }, children);
123
- };
124
- return __assign(__assign({}, render(React.createElement(BasicTable, __assign({}, props)), { wrapper: Providers })), { user: user });
120
+ return __assign(__assign({}, render(React.createElement(BasicTable, __assign({}, props)))), { user: user });
125
121
  };
126
122
  describe('basic table tests', function () {
127
123
  it('should collapse all rows after start dragging', function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -153,7 +149,7 @@ describe('basic table tests', function () {
153
149
  dragIndicator = within(getCellByIndexes(1, 0)).queryByText('drag el');
154
150
  return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
155
151
  return __generator(this, function (_a) {
156
- fireEvent.dragStart(dragIndicator);
152
+ fireEvent.mouseDown(dragIndicator);
157
153
  return [2 /*return*/];
158
154
  });
159
155
  }); })];
@@ -164,14 +160,6 @@ describe('basic table tests', function () {
164
160
  expect(within(getCellByIndexes(0, 1)).queryByText('row 1 value 3')).not.toBeInTheDocument();
165
161
  expect(within(getCellByIndexes(1, 1)).queryByText('row 2 value 1')).toBeInTheDocument();
166
162
  expect(within(getCellByIndexes(1, 1)).queryByText('row 2 value 2')).not.toBeInTheDocument();
167
- return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
168
- return __generator(this, function (_a) {
169
- fireEvent.dragEnd(getCellByIndexes(1, 0));
170
- return [2 /*return*/];
171
- });
172
- }); })];
173
- case 4:
174
- _a.sent();
175
163
  unmockTableSizing();
176
164
  return [2 /*return*/];
177
165
  }
@@ -48,8 +48,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  import React from 'react';
49
49
  import userEvent from '@testing-library/user-event';
50
50
  import { render, screen, act, waitFor } from '@testing-library/react';
51
- import { DndProvider } from 'react-dnd';
52
- import HTML5Backend from 'react-dnd-html5-backend';
53
51
  import { ErrorType, Mode, getAttributesListForEditMode, uploadImage } from '@reltio/mdm-sdk';
54
52
  import { EditModeAttributesView } from './EditModeAttributesView';
55
53
  import { MdmModuleProvider } from '../contexts/MdmModuleContext';
@@ -106,9 +104,8 @@ describe('EditModeAttributesView tests', function () {
106
104
  var user = userEvent.setup(userOptions);
107
105
  var Providers = function (_a) {
108
106
  var children = _a.children;
109
- return (React.createElement(DndProvider, { backend: HTML5Backend },
110
- React.createElement(MdmModuleProvider, { values: mdmValues, actions: mdmActions },
111
- React.createElement(ScrollToElementProvider, null, children))));
107
+ return (React.createElement(MdmModuleProvider, { values: mdmValues, actions: mdmActions },
108
+ React.createElement(ScrollToElementProvider, null, children)));
112
109
  };
113
110
  return __assign({ user: user }, render(React.createElement(EditModeAttributesView, __assign({}, props)), { wrapper: Providers }));
114
111
  };
@@ -13,8 +13,6 @@ import React from 'react';
13
13
  import { act } from 'react-dom/test-utils';
14
14
  import ReactResizeDetector from 'react-resize-detector';
15
15
  import { mount } from 'enzyme';
16
- import { DndProvider } from 'react-dnd';
17
- import HTML5Backend from 'react-dnd-html5-backend';
18
16
  import { Mode, insertDefaultImageByAttrUri } from '@reltio/mdm-sdk';
19
17
  import { Image } from '../Image';
20
18
  import { EmptyStub } from '../EmptyStub';
@@ -91,9 +89,8 @@ var defaultProps = {
91
89
  };
92
90
  var setUp = function (_a) {
93
91
  var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d, _e = _b.mdmActions, mdmActions = _e === void 0 ? defaultMdmActions : _e;
94
- return mount(React.createElement(DndProvider, { backend: HTML5Backend },
95
- React.createElement(MdmModuleProvider, { values: mdmValues, actions: mdmActions },
96
- React.createElement(ImageAttributesLineEditor, __assign({}, props)))));
92
+ return mount(React.createElement(MdmModuleProvider, { values: mdmValues, actions: mdmActions },
93
+ React.createElement(ImageAttributesLineEditor, __assign({}, props))));
97
94
  };
98
95
  describe('ImageAttributesLineEditor edit tests', function () {
99
96
  beforeAll(function () {
@@ -20,37 +20,48 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import React from 'react';
23
+ import React, { useCallback, useState } from 'react';
24
24
  import i18n from 'ui-i18n';
25
- import { useDrop } from 'react-dnd';
26
- import { checkMetadataForCreate, isEntityTypeUri, isEntityUri, isRelationTypeUri, isRelationUri, Mode } from '@reltio/mdm-sdk';
25
+ import { useDndMonitor, useDroppable } from '@dnd-kit/core';
26
+ import { canAddCrosswalk } from '@reltio/mdm-sdk';
27
27
  import { InlineSimpleAttribute } from '../../../InlineSimpleAttribute';
28
28
  import { useStyles } from './styles';
29
29
  export var InlineSimpleAttributesBlock = function (_a) {
30
30
  var attributeValues = _a.attributeValues, attributeType = _a.attributeType, parentUri = _a.parentUri, disableEdit = _a.disableEdit, crosswalksMap = _a.crosswalksMap, onAdd = _a.onAdd, emptyTempAttributeUris = _a.emptyTempAttributeUris, props = __rest(_a, ["attributeValues", "attributeType", "parentUri", "disableEdit", "crosswalksMap", "onAdd", "emptyTempAttributeUris"]);
31
31
  var styles = useStyles();
32
- var _b = useDrop({
33
- accept: 'Crosswalk',
34
- canDrop: function (_a) {
35
- var crosswalk = _a.crosswalk;
36
- var isRelationCrosswalk = isRelationUri(crosswalk.uri) || crosswalk.ownerType === 'relation';
37
- var isEntityCrosswalk = isEntityUri(crosswalk.uri) && crosswalk.ownerType === 'entity';
38
- return (checkMetadataForCreate(Mode.Editing, attributeType) &&
39
- !disableEdit &&
40
- ((isRelationCrosswalk && isRelationTypeUri(attributeType.uri)) ||
41
- (isEntityCrosswalk && isEntityTypeUri(attributeType.uri))));
32
+ var _b = useState(false), isDragItemOver = _b[0], setIsDragItemOver = _b[1];
33
+ var checkCanAddCrosswalk = useCallback(function (event) {
34
+ var _a;
35
+ var draggingData = event.active.data.current;
36
+ var crosswalk = draggingData === null || draggingData === void 0 ? void 0 : draggingData.crosswalk;
37
+ return (!disableEdit &&
38
+ (draggingData === null || draggingData === void 0 ? void 0 : draggingData.type) === 'Crosswalk' &&
39
+ attributeType.uri === ((_a = event.over) === null || _a === void 0 ? void 0 : _a.id) &&
40
+ crosswalk &&
41
+ canAddCrosswalk(crosswalk, attributeType));
42
+ }, [disableEdit, attributeType]);
43
+ useDndMonitor({
44
+ onDragOver: function (event) {
45
+ setIsDragItemOver(checkCanAddCrosswalk(event));
42
46
  },
43
- collect: function (monitor) { return ({
44
- isDragItemOver: monitor.isOver() && monitor.canDrop()
45
- }); },
46
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
47
- drop: function (_a, monitor) {
48
- var crosswalk = _a.crosswalk;
49
- onAdd({ attributeType: attributeType, crosswalk: crosswalk, parentUri: parentUri, index: attributeValues.length });
47
+ onDragEnd: function (event) {
48
+ var draggingData = event.active.data.current;
49
+ var crosswalk = draggingData === null || draggingData === void 0 ? void 0 : draggingData.crosswalk;
50
+ if (checkCanAddCrosswalk(event)) {
51
+ onAdd({ attributeType: attributeType, crosswalk: crosswalk, parentUri: parentUri, index: attributeValues.length });
52
+ }
53
+ setIsDragItemOver(false);
50
54
  }
51
- }), isDragItemOver = _b[0].isDragItemOver, drop = _b[1];
55
+ });
56
+ var setNodeRef = useDroppable({
57
+ id: attributeType.uri,
58
+ data: {
59
+ type: 'Crosswalk',
60
+ attributeType: attributeType
61
+ }
62
+ }).setNodeRef;
52
63
  var attributeIndex = 0;
53
- return (React.createElement("div", { ref: drop, className: styles.simpleAttributesWrapper, "data-reltio-id": 'simple-attributes-wrapper' },
64
+ return (React.createElement("div", { ref: setNodeRef, className: styles.simpleAttributesWrapper, "data-reltio-id": 'simple-attributes-wrapper' },
54
65
  attributeValues.map(function (value) {
55
66
  var _a;
56
67
  return (_a = crosswalksMap[value.uri]) === null || _a === void 0 ? void 0 : _a.map(function (crosswalk) { return (React.createElement(InlineSimpleAttribute, __assign({ key: value.uri + crosswalk.uri, attributeType: attributeType, attributeValue: value, crosswalk: crosswalk, disableEdit: disableEdit, isEmpty: emptyTempAttributeUris.includes(value.uri), dataReltioId: "value-index-".concat(attributeIndex++) }, props))); });
@@ -10,10 +10,10 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import React from 'react';
13
- import { shallow } from 'enzyme';
14
13
  import { InlineSimpleAttributesBlock } from './InlineSimpleAttributesBlock';
15
- import * as reactDnd from 'react-dnd';
16
- jest.mock('react-dnd', function () { return (__assign(__assign({}, jest.requireActual('react-dnd')), { useDrop: jest.fn() })); });
14
+ import { DndContext, useDndMonitor } from '@dnd-kit/core';
15
+ import { act, render, screen } from '@testing-library/react';
16
+ jest.mock('@dnd-kit/core', function () { return (__assign(__assign({}, jest.requireActual('@dnd-kit/core')), { useDndMonitor: jest.fn() })); });
17
17
  describe('InlineSimpleAttributesBlock tests', function () {
18
18
  var attributeType = {
19
19
  uri: 'configuration/entityTypes/HCP/attributes/Simple',
@@ -73,43 +73,52 @@ describe('InlineSimpleAttributesBlock tests', function () {
73
73
  onEdit: jest.fn(),
74
74
  onDelete: jest.fn()
75
75
  };
76
- var props = __assign({ attributeValues: attributeValues, crosswalksMap: crosswalksMap, parentUri: 'entities/1', onAdd: jest.fn(), emptyTempAttributeUris: [] }, commonProps);
77
- var useDropMock = jest.spyOn(reactDnd, 'useDrop').mockReturnValue([{}, function () { return null; }]);
76
+ var defaultProps = __assign({ attributeValues: attributeValues, crosswalksMap: crosswalksMap, parentUri: 'entities/1', onAdd: jest.fn(), emptyTempAttributeUris: [] }, commonProps);
77
+ var getDragEvent = function (draggingData, attributeType) { return ({
78
+ active: {
79
+ data: {
80
+ current: __assign({}, draggingData)
81
+ }
82
+ },
83
+ over: {
84
+ id: attributeType.uri
85
+ }
86
+ }); };
87
+ var setUp = function (props) {
88
+ if (props === void 0) { props = defaultProps; }
89
+ var Providers = function (_a) {
90
+ var children = _a.children;
91
+ return React.createElement(DndContext, null, children);
92
+ };
93
+ return render(React.createElement(InlineSimpleAttributesBlock, __assign({}, props)), { wrapper: Providers });
94
+ };
78
95
  it('should render values for each crosswalk', function () {
79
- var wrapper = shallow(React.createElement(InlineSimpleAttributesBlock, __assign({}, props)));
80
- var attributes = wrapper.find('InlineSimpleAttribute');
81
- expect(attributes.length).toBe(3);
82
- attributes.forEach(function (attribute) {
83
- expect(attribute.props()).toMatchObject(commonProps);
84
- });
85
- expect(attributes.at(0).prop('attributeValue')).toBe(attributeValues[0]);
86
- expect(attributes.at(0).prop('crosswalk')).toBe(crosswalks[0]);
87
- expect(attributes.at(1).prop('attributeValue')).toBe(attributeValues[1]);
88
- expect(attributes.at(1).prop('crosswalk')).toBe(crosswalks[0]);
89
- expect(attributes.at(2).prop('attributeValue')).toBe(attributeValues[1]);
90
- expect(attributes.at(2).prop('crosswalk')).toBe(crosswalks[1]);
96
+ setUp();
97
+ expect(screen.getByText(attributeValues[0].value)).toBeInTheDocument();
98
+ expect(screen.getAllByText(attributeValues[1].value)).toHaveLength(2);
91
99
  });
92
- describe('dnd', function () {
93
- afterEach(function () {
94
- useDropMock.mockClear();
95
- });
96
- it('should accept Crosswalk drag items', function () {
97
- shallow(React.createElement(InlineSimpleAttributesBlock, __assign({}, props)));
98
- var accept = useDropMock.mock.calls[0][0].accept;
99
- expect(accept).toEqual('Crosswalk');
100
+ describe('dnd behavior', function () {
101
+ var onDragOver, onDragEnd;
102
+ beforeAll(function () {
103
+ useDndMonitor.mockImplementation(function (listeners) {
104
+ onDragOver = listeners.onDragOver;
105
+ onDragEnd = listeners.onDragEnd;
106
+ });
100
107
  });
101
108
  it('should not allow drop relation crosswalk on entity attribute', function () {
102
- shallow(React.createElement(InlineSimpleAttributesBlock, __assign({}, props)));
103
- var canDrop = useDropMock.mock.calls[0][0].canDrop;
104
- expect(canDrop({
105
- type: 'Crosswalk',
106
- crosswalk: {
107
- uri: 'entities/1/crosswalks/1',
108
- ownerType: 'relation',
109
- type: 'configuration/sources/FB',
110
- value: '123'
111
- }
112
- }, {})).toBe(false);
109
+ setUp();
110
+ act(function () {
111
+ onDragOver(getDragEvent({
112
+ type: 'Crosswalk',
113
+ crosswalk: {
114
+ uri: 'entities/1/crosswalks/1',
115
+ ownerType: 'relation',
116
+ type: 'configuration/sources/FB',
117
+ value: '123'
118
+ }
119
+ }, defaultProps.attributeType));
120
+ });
121
+ expect(screen.queryByText('Drop here')).not.toBeInTheDocument();
113
122
  });
114
123
  it('should allow drop relation crosswalk on relation attribute', function () {
115
124
  var attributeType = {
@@ -132,26 +141,31 @@ describe('InlineSimpleAttributesBlock tests', function () {
132
141
  ov: false
133
142
  }
134
143
  ];
135
- shallow(React.createElement(InlineSimpleAttributesBlock, __assign({}, props, { attributeType: attributeType, attributeValues: attributeValues })));
136
- var canDrop = useDropMock.mock.calls[0][0].canDrop;
137
- expect(canDrop({
138
- type: 'Crosswalk',
139
- crosswalk: {
140
- uri: 'relations/1/crosswalks/1',
141
- ownerType: 'entity',
142
- type: 'configuration/sources/FB',
143
- value: '123'
144
- }
145
- }, {})).toBe(true);
146
- expect(canDrop({
147
- type: 'Crosswalk',
148
- crosswalk: {
149
- uri: 'entities/1/crosswalks/1',
150
- ownerType: 'relation',
151
- type: 'configuration/sources/FB',
152
- value: '123'
153
- }
154
- }, {})).toBe(true);
144
+ setUp(__assign(__assign({}, defaultProps), { attributeType: attributeType, attributeValues: attributeValues }));
145
+ act(function () {
146
+ onDragOver(getDragEvent({
147
+ type: 'Crosswalk',
148
+ crosswalk: {
149
+ uri: 'relations/1/crosswalks/1',
150
+ ownerType: 'entity',
151
+ type: 'configuration/sources/FB',
152
+ value: '123'
153
+ }
154
+ }, attributeType));
155
+ });
156
+ expect(screen.getByText('Drop here')).toBeInTheDocument();
157
+ act(function () {
158
+ onDragOver(getDragEvent({
159
+ type: 'Crosswalk',
160
+ crosswalk: {
161
+ uri: 'entities/1/crosswalks/1',
162
+ ownerType: 'relation',
163
+ type: 'configuration/sources/FB',
164
+ value: '123'
165
+ }
166
+ }, attributeType));
167
+ });
168
+ expect(screen.getByText('Drop here')).toBeInTheDocument();
155
169
  });
156
170
  it('should not allow drop entity crosswalk on relation attribute', function () {
157
171
  var attributeType = {
@@ -174,76 +188,70 @@ describe('InlineSimpleAttributesBlock tests', function () {
174
188
  ov: false
175
189
  }
176
190
  ];
177
- shallow(React.createElement(InlineSimpleAttributesBlock, __assign({}, props, { attributeType: attributeType, attributeValues: attributeValues })));
178
- var canDrop = useDropMock.mock.calls[0][0].canDrop;
179
- expect(canDrop({
180
- type: 'Crosswalk',
181
- crosswalk: {
182
- uri: 'entities/1/crosswalks/1',
183
- ownerType: 'entity',
184
- type: 'configuration/sources/FB',
185
- value: '123'
186
- }
187
- }, {})).toBe(false);
191
+ setUp(__assign(__assign({}, defaultProps), { attributeType: attributeType, attributeValues: attributeValues }));
192
+ act(function () {
193
+ onDragOver(getDragEvent({
194
+ type: 'Crosswalk',
195
+ crosswalk: {
196
+ uri: 'entities/1/crosswalks/1',
197
+ ownerType: 'entity',
198
+ type: 'configuration/sources/FB',
199
+ value: '123'
200
+ }
201
+ }, attributeType));
202
+ });
203
+ expect(screen.queryByText('Drop here')).not.toBeInTheDocument();
188
204
  });
189
205
  it('should not allow drop crosswalk on entity attribute without permission to create', function () {
190
206
  var readOnlyAttrType = __assign(__assign({}, attributeType), { access: ['READ'] });
191
- shallow(React.createElement(InlineSimpleAttributesBlock, __assign({}, props, { attributeType: readOnlyAttrType })));
192
- var canDrop = useDropMock.mock.calls[0][0].canDrop;
193
- expect(canDrop({
194
- type: 'Crosswalk',
195
- crosswalk: {
196
- uri: 'entities/1/crosswalks/1',
197
- ownerType: 'entity',
198
- type: 'configuration/sources/FB',
199
- value: '123'
200
- }
201
- }, {})).toBe(false);
207
+ setUp(__assign(__assign({}, defaultProps), { attributeType: readOnlyAttrType, attributeValues: attributeValues }));
208
+ act(function () {
209
+ onDragOver(getDragEvent({
210
+ type: 'Crosswalk',
211
+ crosswalk: {
212
+ uri: 'entities/1/crosswalks/1',
213
+ ownerType: 'entity',
214
+ type: 'configuration/sources/FB',
215
+ value: '123'
216
+ }
217
+ }, readOnlyAttrType));
218
+ });
219
+ expect(screen.queryByText('Drop here')).not.toBeInTheDocument();
202
220
  });
203
221
  it('should not allow drop crosswalk on attribute if parent attribute can not be edited', function () {
204
- shallow(React.createElement(InlineSimpleAttributesBlock, __assign({}, props, { disableEdit: true })));
205
- var canDrop = useDropMock.mock.calls[0][0].canDrop;
206
- expect(canDrop({
207
- type: 'Crosswalk',
208
- crosswalk: {
209
- uri: 'entities/1/crosswalks/1',
210
- ownerType: 'entity',
211
- type: 'configuration/sources/FB',
212
- value: '123'
213
- }
214
- }, {})).toBe(false);
215
- });
216
- it('should render drop indicator if crosswalks is over and can be dropped', function () {
217
- var wrapper = shallow(React.createElement(InlineSimpleAttributesBlock, __assign({}, props)));
218
- var _a = useDropMock.mock.calls[0][0], canDrop = _a.canDrop, collect = _a.collect;
219
- expect(canDrop({
220
- type: 'Crosswalk',
221
- crosswalk: {
222
- uri: 'entities/1/crosswalks/1',
223
- ownerType: 'entity',
224
- type: 'configuration/sources/FB',
225
- value: '123'
226
- }
227
- }, {})).toBe(true);
228
- expect(wrapper.find('.dropIndicator')).toHaveLength(0);
229
- collect({ isOver: function () { return true; }, canDrop: function () { return true; } });
230
- expect(wrapper.find('.dropIndicator')).toHaveLength(0);
222
+ setUp(__assign(__assign({}, defaultProps), { disableEdit: true }));
223
+ act(function () {
224
+ onDragOver(getDragEvent({
225
+ type: 'Crosswalk',
226
+ crosswalk: {
227
+ uri: 'entities/1/crosswalks/1',
228
+ ownerType: 'entity',
229
+ type: 'configuration/sources/FB',
230
+ value: '123'
231
+ }
232
+ }, defaultProps.attributeType));
233
+ });
234
+ expect(screen.queryByText('Drop here')).not.toBeInTheDocument();
231
235
  });
232
236
  it('should call props.onAdd on crosswalk drop', function () {
233
- shallow(React.createElement(InlineSimpleAttributesBlock, __assign({}, props)));
234
- var drop = useDropMock.mock.calls[0][0].drop;
237
+ setUp();
235
238
  var crosswalk = {
236
239
  uri: 'entities/1/crosswalks/1',
237
240
  ownerType: 'entity',
238
241
  type: 'configuration/sources/FB',
239
242
  value: '123'
240
243
  };
241
- drop({ crosswalk: crosswalk, type: 'Crosswalk' }, {});
242
- expect(props.onAdd).toHaveBeenCalledWith({
243
- parentUri: props.parentUri,
244
- attributeType: props.attributeType,
244
+ act(function () {
245
+ onDragEnd(getDragEvent({
246
+ type: 'Crosswalk',
247
+ crosswalk: crosswalk
248
+ }, defaultProps.attributeType));
249
+ });
250
+ expect(defaultProps.onAdd).toHaveBeenCalledWith({
251
+ parentUri: defaultProps.parentUri,
252
+ attributeType: defaultProps.attributeType,
245
253
  crosswalk: crosswalk,
246
- index: props.attributeValues.length
254
+ index: defaultProps.attributeValues.length
247
255
  });
248
256
  });
249
257
  });
@@ -36,7 +36,7 @@ export var InlineSimpleAttribute = function (_a) {
36
36
  var showIgnore = !isTemporary && ((!isReadingMode && hasBasicPermission) || attributeValue.ignored);
37
37
  var showMaskingSwitcher = (isUnmaskingNeeded && !isTemporary && !isReadingMode) || isUnmasking;
38
38
  useEffect(function () {
39
- if (isTemporary && !isEmpty) {
39
+ if (isTemporary && isEmpty) {
40
40
  setEditingMode();
41
41
  }
42
42
  }, [isEmpty]);
@@ -3,8 +3,8 @@ import { LineChartOptions } from '@reltio/mdm-sdk';
3
3
  import { CartesianGridProps, LineChart, LineProps, TooltipProps, XAxisProps, YAxisProps } from 'recharts';
4
4
  type LineChartSettings = {
5
5
  lineChart: React.ComponentProps<typeof LineChart>;
6
- xAxis: XAxisProps;
7
- yAxis: YAxisProps;
6
+ xAxis: Omit<XAxisProps, 'ref'>;
7
+ yAxis: Omit<YAxisProps, 'ref'>;
8
8
  cartesianGrid: Omit<CartesianGridProps, 'ref'>;
9
9
  tooltip: TooltipProps<number, string>;
10
10
  line: Omit<LineProps, 'ref'>;
@@ -86,11 +86,15 @@ describe('PieChart', function () {
86
86
  expect(wrapper.find(Pie).prop('innerRadius')).toBe('50%');
87
87
  });
88
88
  it('should call props.onItemClick on sector click', function () {
89
+ jest.useFakeTimers();
89
90
  var onItemClick = jest.fn();
90
91
  var wrapper = mount(React.createElement(PieChart, { width: 600, height: 300, data: data, onItemClick: onItemClick }));
92
+ jest.runAllTimers();
93
+ wrapper.update();
91
94
  var sector = wrapper.find('.recharts-pie-sector').first();
92
95
  sector.simulate('click');
93
96
  expect(onItemClick).toHaveBeenCalledWith('1');
97
+ jest.useRealTimers();
94
98
  });
95
99
  it('should render chart legend with percents correctly', function () {
96
100
  var legendPayload = [
@@ -48,8 +48,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  import React from 'react';
49
49
  import { render, screen, act } from '@testing-library/react';
50
50
  import userEvent from '@testing-library/user-event';
51
- import TestBackend from 'react-dnd-test-backend';
52
- import { DndProvider } from 'react-dnd';
53
51
  import { uploadImage } from '@reltio/mdm-sdk';
54
52
  import { MAX_IMAGE_SIZE } from './constants';
55
53
  import { UploadImageDialog } from './UploadImageDialog';
@@ -68,8 +66,7 @@ describe('UploadImageDialog tests', function () {
68
66
  var props = { onClose: onClose, onUpload: onUpload, open: true };
69
67
  var Providers = function (_a) {
70
68
  var children = _a.children;
71
- return (React.createElement(MdmModuleProvider, { values: { imageServicePath: imageServicePath, environment: environment, tenant: tenant } },
72
- React.createElement(DndProvider, { backend: TestBackend }, children)));
69
+ return (React.createElement(MdmModuleProvider, { values: { imageServicePath: imageServicePath, environment: environment, tenant: tenant } }, children));
73
70
  };
74
71
  return __assign({ user: user }, render(React.createElement(UploadImageDialog, __assign({}, props)), { wrapper: Providers }));
75
72
  };
@@ -1,34 +1,45 @@
1
- import React from 'react';
1
+ import React, { useCallback, useState } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import i18n from 'ui-i18n';
4
- import { useDrop } from 'react-dnd';
5
- import { NativeTypes } from 'react-dnd-html5-backend';
6
4
  import Typography from '@mui/material/Typography';
7
5
  import { SelectImageButton } from '../SelectImageButton';
8
6
  import UploadIcon from '../../../icons/UploadIcon';
9
7
  import { MAX_IMAGE_SIZE } from '../../constants';
10
8
  import { useStyles } from './styles';
9
+ var ACCEPTABLE_FILE_TYPE = 'Files';
11
10
  export var TargetBox = function (_a) {
12
11
  var _b;
13
12
  var onAppendFile = _a.onAppendFile, className = _a.className;
14
13
  var styles = useStyles();
15
- var _c = useDrop({
16
- accept: [NativeTypes.FILE],
17
- drop: function (item) {
18
- if (item) {
19
- // TODO remove after update react-dnd
20
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
21
- // @ts-ignore
22
- onAppendFile(item.files[0]);
23
- }
24
- },
25
- collect: function (monitor) { return ({
26
- isOver: monitor.isOver(),
27
- canDrop: monitor.canDrop()
28
- }); }
29
- }), _d = _c[0], canDrop = _d.canDrop, isOver = _d.isOver, drop = _c[1];
30
- var isActive = canDrop && isOver;
31
- return (React.createElement("div", { ref: drop, className: classnames(styles.root, (_b = {}, _b[styles.isActive] = isActive, _b), className) },
14
+ var _c = useState(false), isActive = _c[0], setIsActive = _c[1];
15
+ var handleDragOver = useCallback(function (e) {
16
+ e.preventDefault();
17
+ e.stopPropagation();
18
+ var filesType = e.dataTransfer.types[0];
19
+ var isValidType = filesType === ACCEPTABLE_FILE_TYPE;
20
+ e.dataTransfer.dropEffect = isValidType ? 'copy' : 'none';
21
+ setIsActive(isValidType);
22
+ }, []);
23
+ var handleDragLeave = useCallback(function (e) {
24
+ e.preventDefault();
25
+ e.stopPropagation();
26
+ var relatedTarget = e.relatedTarget;
27
+ var isLeave = relatedTarget && !e.currentTarget.contains(relatedTarget);
28
+ if (isLeave || !relatedTarget) {
29
+ setIsActive(false);
30
+ }
31
+ }, []);
32
+ var handleDrop = useCallback(function (e) {
33
+ e.preventDefault();
34
+ e.stopPropagation();
35
+ setIsActive(false);
36
+ var filesType = e.dataTransfer.types[0];
37
+ if (filesType === ACCEPTABLE_FILE_TYPE) {
38
+ var file = e.dataTransfer.files[0];
39
+ onAppendFile(file);
40
+ }
41
+ }, [onAppendFile]);
42
+ return (React.createElement("div", { className: classnames(styles.root, (_b = {}, _b[styles.isActive] = isActive, _b), className), onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop },
32
43
  React.createElement(UploadIcon, { className: styles.icon }),
33
44
  React.createElement(Typography, { className: styles.title }, i18n.text('Drag an image here')),
34
45
  React.createElement(Typography, { className: styles.description }, i18n.text('Acceptable image types would include JPG, PNG, TIFF, GIF, BMP. Maximum image size: ${MAX_IMAGE_SIZE}Mb', {
@@ -1 +1 @@
1
- export {};
1
+ import '@testing-library/jest-dom';