@reltio/components 1.4.2018 → 1.4.2020

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 (276) 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/HierarchyNodeTitle/useEntityDetails.js +3 -0
  5. package/HierarchyNodeTitle/useEntityDetails.test.js +28 -0
  6. package/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +2 -5
  7. package/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.js +33 -22
  8. package/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.test.js +120 -112
  9. package/InlineSimpleAttribute/InlineSimpleAttribute.js +1 -1
  10. package/LineChart/helpers.d.ts +2 -2
  11. package/PieChart/PieChart.test.js +4 -0
  12. package/ProfileBandNavigation/useSearchNavigation.js +11 -3
  13. package/ProfileBandNavigation/useSearchNavigation.test.js +176 -0
  14. package/UploadImageDialog/UploadImageDialog.specs.js +1 -4
  15. package/UploadImageDialog/components/TargetBox/TargetBox.js +31 -20
  16. package/UploadImageDialog/components/TargetBox/TargetBox.specs.d.ts +1 -1
  17. package/UploadImageDialog/components/TargetBox/TargetBox.specs.js +57 -16
  18. package/UploadImageDialog/components/TargetBox/styles.js +2 -1
  19. package/VerticalHeadingsTable/DndVerticalHeadingsTable.test.js +114 -0
  20. package/VerticalHeadingsTable/VerticalHeadingsTable.d.ts +2 -1
  21. package/VerticalHeadingsTable/VerticalHeadingsTable.js +10 -13
  22. package/VerticalHeadingsTable/VerticalHeadingsTable.test.js +74 -269
  23. package/VerticalHeadingsTable/components/DndComponent/DndComponent.d.ts +14 -0
  24. package/VerticalHeadingsTable/components/DndComponent/DndComponent.js +96 -0
  25. package/VerticalHeadingsTable/components/DndComponent/helpers.d.ts +3 -0
  26. package/VerticalHeadingsTable/components/DndComponent/helpers.js +35 -0
  27. package/VerticalHeadingsTable/components/DndComponent/index.d.ts +1 -0
  28. package/VerticalHeadingsTable/components/DndComponent/index.js +1 -0
  29. package/VerticalHeadingsTable/components/{TableColumnDragLayer → DndComponent}/styles.d.ts +1 -1
  30. package/VerticalHeadingsTable/components/DndComponent/styles.js +10 -0
  31. package/VerticalHeadingsTable/components/DndComponent/types.d.ts +14 -0
  32. package/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.d.ts +7 -0
  33. package/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.js +13 -0
  34. package/VerticalHeadingsTable/components/DndMeasurer/index.d.ts +1 -0
  35. package/VerticalHeadingsTable/components/DndMeasurer/index.js +1 -0
  36. package/VerticalHeadingsTable/components/TableCell/TableCell.d.ts +2 -2
  37. package/VerticalHeadingsTable/components/TableCell/TableCell.js +2 -2
  38. package/VerticalHeadingsTable/components/TableCell/TableCell.test.js +101 -43
  39. package/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.d.ts +10 -0
  40. package/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.js +32 -0
  41. package/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.d.ts +2 -4
  42. package/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.js +30 -59
  43. package/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.test.js +126 -56
  44. package/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.d.ts +3 -3
  45. package/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.js +16 -6
  46. package/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.d.ts +9 -0
  47. package/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.js +30 -0
  48. package/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.d.ts +4 -4
  49. package/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.js +3 -4
  50. package/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.test.js +44 -29
  51. package/VerticalHeadingsTable/components/TableRow/TableRow.d.ts +4 -5
  52. package/VerticalHeadingsTable/components/TableRow/TableRow.js +3 -3
  53. package/VerticalHeadingsTable/components/TableRow/TableRow.test.js +35 -57
  54. package/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.d.ts +12 -0
  55. package/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.js +16 -0
  56. package/VerticalHeadingsTable/components/TableRowDragPreview/index.d.ts +1 -0
  57. package/VerticalHeadingsTable/components/TableRowDragPreview/index.js +1 -0
  58. package/{cjs/VerticalHeadingsTable/components/TableColumnDragLayer → VerticalHeadingsTable/components/TableRowDragPreview}/styles.d.ts +1 -1
  59. package/VerticalHeadingsTable/components/TableRowDragPreview/styles.js +8 -0
  60. package/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.d.ts +2 -8
  61. package/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.js +22 -53
  62. package/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.test.js +53 -83
  63. package/cjs/BarChart/helpers.d.ts +2 -2
  64. package/cjs/BasicTable/IntegrationBasicTable.test.js +6 -18
  65. package/cjs/EditModeAttributesView/IntegrationEditModeAttributesView.test.js +2 -5
  66. package/cjs/HierarchyNodeTitle/useEntityDetails.js +3 -0
  67. package/cjs/HierarchyNodeTitle/useEntityDetails.test.js +28 -0
  68. package/cjs/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +2 -5
  69. package/cjs/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.js +55 -21
  70. package/cjs/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.test.js +120 -135
  71. package/cjs/InlineSimpleAttribute/InlineSimpleAttribute.js +1 -1
  72. package/cjs/LineChart/helpers.d.ts +2 -2
  73. package/cjs/PieChart/PieChart.test.js +4 -0
  74. package/cjs/ProfileBandNavigation/useSearchNavigation.js +11 -3
  75. package/cjs/ProfileBandNavigation/useSearchNavigation.test.js +176 -0
  76. package/cjs/UploadImageDialog/UploadImageDialog.specs.js +1 -4
  77. package/cjs/UploadImageDialog/components/TargetBox/TargetBox.js +54 -20
  78. package/cjs/UploadImageDialog/components/TargetBox/TargetBox.specs.d.ts +1 -1
  79. package/cjs/UploadImageDialog/components/TargetBox/TargetBox.specs.js +57 -16
  80. package/cjs/UploadImageDialog/components/TargetBox/styles.js +2 -1
  81. package/cjs/VerticalHeadingsTable/DndVerticalHeadingsTable.test.d.ts +1 -0
  82. package/cjs/VerticalHeadingsTable/DndVerticalHeadingsTable.test.js +119 -0
  83. package/cjs/VerticalHeadingsTable/VerticalHeadingsTable.d.ts +2 -1
  84. package/cjs/VerticalHeadingsTable/VerticalHeadingsTable.js +9 -12
  85. package/cjs/VerticalHeadingsTable/VerticalHeadingsTable.test.js +74 -269
  86. package/cjs/VerticalHeadingsTable/components/DndComponent/DndComponent.d.ts +14 -0
  87. package/cjs/VerticalHeadingsTable/components/DndComponent/DndComponent.js +123 -0
  88. package/cjs/VerticalHeadingsTable/components/DndComponent/helpers.d.ts +3 -0
  89. package/cjs/VerticalHeadingsTable/components/DndComponent/helpers.js +40 -0
  90. package/cjs/VerticalHeadingsTable/components/DndComponent/index.d.ts +1 -0
  91. package/cjs/VerticalHeadingsTable/components/DndComponent/index.js +5 -0
  92. package/{features/crosswalks/CrosswalkDragLayer → cjs/VerticalHeadingsTable/components/DndComponent}/styles.d.ts +1 -1
  93. package/cjs/VerticalHeadingsTable/components/DndComponent/styles.js +13 -0
  94. package/cjs/VerticalHeadingsTable/components/DndComponent/types.d.ts +14 -0
  95. package/cjs/VerticalHeadingsTable/components/DndComponent/types.js +2 -0
  96. package/cjs/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.d.ts +7 -0
  97. package/cjs/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.js +40 -0
  98. package/cjs/VerticalHeadingsTable/components/DndMeasurer/index.d.ts +1 -0
  99. package/cjs/VerticalHeadingsTable/components/DndMeasurer/index.js +5 -0
  100. package/cjs/VerticalHeadingsTable/components/TableCell/TableCell.d.ts +2 -2
  101. package/cjs/VerticalHeadingsTable/components/TableCell/TableCell.js +2 -2
  102. package/cjs/VerticalHeadingsTable/components/TableCell/TableCell.test.js +101 -43
  103. package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.d.ts +10 -0
  104. package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.js +39 -0
  105. package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.d.ts +2 -4
  106. package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.js +29 -58
  107. package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.test.js +128 -58
  108. package/cjs/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.d.ts +3 -3
  109. package/cjs/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.js +38 -9
  110. package/cjs/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.d.ts +9 -0
  111. package/cjs/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.js +37 -0
  112. package/cjs/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.d.ts +4 -4
  113. package/cjs/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.js +3 -4
  114. package/cjs/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.test.js +43 -51
  115. package/cjs/VerticalHeadingsTable/components/TableRow/TableRow.d.ts +4 -5
  116. package/cjs/VerticalHeadingsTable/components/TableRow/TableRow.js +3 -3
  117. package/cjs/VerticalHeadingsTable/components/TableRow/TableRow.test.js +35 -57
  118. package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.d.ts +12 -0
  119. package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.js +42 -0
  120. package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/index.d.ts +1 -0
  121. package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/index.js +5 -0
  122. package/cjs/{features/crosswalks/CrosswalkDragLayer → VerticalHeadingsTable/components/TableRowDragPreview}/styles.d.ts +1 -1
  123. package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/styles.js +11 -0
  124. package/cjs/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.d.ts +2 -8
  125. package/cjs/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.js +21 -52
  126. package/cjs/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.test.js +55 -85
  127. package/cjs/contexts/CrosswalksDisplayContext/index.d.ts +2 -2
  128. package/cjs/contexts/CrosswalksDisplayContext/index.js +6 -2
  129. package/cjs/features/crosswalks/AttributesTable/AttributesTable.d.ts +3 -1
  130. package/cjs/features/crosswalks/AttributesTable/AttributesTable.js +2 -2
  131. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +17 -10
  132. package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.d.ts +3 -2
  133. package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +13 -2
  134. package/cjs/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.d.ts +8 -0
  135. package/cjs/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.js +51 -0
  136. package/cjs/features/crosswalks/CrosswalkDndComponent/index.d.ts +1 -0
  137. package/cjs/features/crosswalks/CrosswalkDndComponent/index.js +5 -0
  138. package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/CrosswalkDragPreview.js +16 -5
  139. package/cjs/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +1 -0
  140. package/cjs/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.js +97 -0
  141. package/{features/crosswalks/CrosswalkDragLayer/components → cjs/features/crosswalks}/CrosswalkDragPreview/styles.d.ts +1 -1
  142. package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/styles.js +6 -1
  143. package/cjs/features/crosswalks/CrosswalkRow/CrosswalkRow.js +25 -16
  144. package/cjs/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +7 -33
  145. package/cjs/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.d.ts +1 -0
  146. package/cjs/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.js +134 -0
  147. package/cjs/features/crosswalks/CrosswalkRow/styles.d.ts +1 -1
  148. package/cjs/features/crosswalks/CrosswalkRow/styles.js +10 -1
  149. package/cjs/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +0 -1
  150. package/cjs/features/crosswalks/hooks/useDraggingCrosswalk.d.ts +6 -0
  151. package/cjs/features/crosswalks/hooks/useDraggingCrosswalk.js +19 -0
  152. package/cjs/features/crosswalks/hooks/useModifiedEntity.js +6 -6
  153. package/cjs/features/crosswalks/index.d.ts +1 -1
  154. package/cjs/features/crosswalks/index.js +3 -3
  155. package/cjs/hooks/useDndBasicTableScrollModifier/index.d.ts +1 -0
  156. package/cjs/hooks/useDndBasicTableScrollModifier/index.js +5 -0
  157. package/cjs/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.d.ts +10 -0
  158. package/cjs/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.js +57 -0
  159. package/cjs/index.d.ts +2 -1
  160. package/cjs/index.js +3 -1
  161. package/cjs/test-utils/dndKit/DndContext.d.ts +12 -0
  162. package/cjs/test-utils/dndKit/DndContext.js +5 -0
  163. package/cjs/test-utils/dndKit/DndContextComponent.d.ts +5 -0
  164. package/cjs/test-utils/dndKit/DndContextComponent.js +97 -0
  165. package/cjs/test-utils/dndKit/DndMonitorContext.d.ts +2 -0
  166. package/cjs/test-utils/dndKit/DndMonitorContext.js +5 -0
  167. package/cjs/test-utils/dndKit/DragOverlay.d.ts +5 -0
  168. package/cjs/test-utils/dndKit/DragOverlay.js +14 -0
  169. package/cjs/test-utils/dndKit/index.d.ts +32 -0
  170. package/cjs/test-utils/dndKit/index.js +22 -0
  171. package/cjs/test-utils/dndKit/type.d.ts +17 -0
  172. package/cjs/test-utils/dndKit/type.js +2 -0
  173. package/cjs/test-utils/dndKit/useDndContext.d.ts +8 -0
  174. package/cjs/test-utils/dndKit/useDndContext.js +13 -0
  175. package/cjs/test-utils/dndKit/useDndMonitor.d.ts +2 -0
  176. package/cjs/test-utils/dndKit/useDndMonitor.js +13 -0
  177. package/cjs/test-utils/dndKit/useDndMonitorProvider.d.ts +1 -0
  178. package/cjs/test-utils/dndKit/useDndMonitorProvider.js +17 -0
  179. package/cjs/test-utils/dndKit/useDraggable.d.ts +12 -0
  180. package/cjs/test-utils/dndKit/useDraggable.js +43 -0
  181. package/cjs/test-utils/dndKit/useDroppable.d.ts +4 -0
  182. package/cjs/test-utils/dndKit/useDroppable.js +45 -0
  183. package/cjs/types/basicTable.d.ts +4 -0
  184. package/contexts/CrosswalksDisplayContext/index.d.ts +2 -2
  185. package/contexts/CrosswalksDisplayContext/index.js +6 -2
  186. package/features/crosswalks/AttributesTable/AttributesTable.d.ts +3 -1
  187. package/features/crosswalks/AttributesTable/AttributesTable.js +2 -2
  188. package/features/crosswalks/AttributesTable/AttributesTable.test.js +17 -10
  189. package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.d.ts +3 -2
  190. package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +13 -2
  191. package/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.d.ts +8 -0
  192. package/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.js +24 -0
  193. package/features/crosswalks/CrosswalkDndComponent/index.d.ts +1 -0
  194. package/features/crosswalks/CrosswalkDndComponent/index.js +1 -0
  195. package/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.js +30 -0
  196. package/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +1 -0
  197. package/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.js +69 -0
  198. package/{cjs/features/crosswalks/CrosswalkDragLayer/components → features/crosswalks}/CrosswalkDragPreview/styles.d.ts +1 -1
  199. package/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/styles.js +6 -1
  200. package/features/crosswalks/CrosswalkRow/CrosswalkRow.js +25 -16
  201. package/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +7 -33
  202. package/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.d.ts +1 -0
  203. package/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.js +129 -0
  204. package/features/crosswalks/CrosswalkRow/styles.d.ts +1 -1
  205. package/features/crosswalks/CrosswalkRow/styles.js +10 -1
  206. package/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +0 -1
  207. package/features/crosswalks/hooks/useDraggingCrosswalk.d.ts +6 -0
  208. package/features/crosswalks/hooks/useDraggingCrosswalk.js +15 -0
  209. package/features/crosswalks/hooks/useModifiedEntity.js +6 -6
  210. package/features/crosswalks/index.d.ts +1 -1
  211. package/features/crosswalks/index.js +1 -1
  212. package/hooks/useDndBasicTableScrollModifier/index.d.ts +1 -0
  213. package/hooks/useDndBasicTableScrollModifier/index.js +1 -0
  214. package/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.d.ts +10 -0
  215. package/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.js +53 -0
  216. package/index.d.ts +2 -1
  217. package/index.js +1 -0
  218. package/package.json +3 -3
  219. package/test-utils/dndKit/DndContext.d.ts +12 -0
  220. package/test-utils/dndKit/DndContext.js +2 -0
  221. package/test-utils/dndKit/DndContextComponent.d.ts +5 -0
  222. package/test-utils/dndKit/DndContextComponent.js +70 -0
  223. package/test-utils/dndKit/DndMonitorContext.d.ts +2 -0
  224. package/test-utils/dndKit/DndMonitorContext.js +2 -0
  225. package/test-utils/dndKit/DragOverlay.d.ts +5 -0
  226. package/test-utils/dndKit/DragOverlay.js +7 -0
  227. package/test-utils/dndKit/index.d.ts +32 -0
  228. package/test-utils/dndKit/index.js +19 -0
  229. package/test-utils/dndKit/type.d.ts +17 -0
  230. package/test-utils/dndKit/type.js +1 -0
  231. package/test-utils/dndKit/useDndContext.d.ts +8 -0
  232. package/test-utils/dndKit/useDndContext.js +9 -0
  233. package/test-utils/dndKit/useDndMonitor.d.ts +2 -0
  234. package/test-utils/dndKit/useDndMonitor.js +9 -0
  235. package/test-utils/dndKit/useDndMonitorProvider.d.ts +1 -0
  236. package/test-utils/dndKit/useDndMonitorProvider.js +13 -0
  237. package/test-utils/dndKit/useDraggable.d.ts +12 -0
  238. package/test-utils/dndKit/useDraggable.js +39 -0
  239. package/test-utils/dndKit/useDroppable.d.ts +4 -0
  240. package/test-utils/dndKit/useDroppable.js +41 -0
  241. package/types/basicTable.d.ts +4 -0
  242. package/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.d.ts +0 -6
  243. package/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.js +0 -23
  244. package/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.d.ts +0 -6
  245. package/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.js +0 -11
  246. package/VerticalHeadingsTable/components/TableColumnDragLayer/index.d.ts +0 -1
  247. package/VerticalHeadingsTable/components/TableColumnDragLayer/index.js +0 -1
  248. package/VerticalHeadingsTable/components/TableColumnDragLayer/styles.js +0 -13
  249. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.d.ts +0 -6
  250. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.js +0 -50
  251. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.d.ts +0 -6
  252. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.js +0 -15
  253. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/index.d.ts +0 -1
  254. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/index.js +0 -5
  255. package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/styles.js +0 -16
  256. package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.d.ts +0 -2
  257. package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.js +0 -51
  258. package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +0 -93
  259. package/cjs/features/crosswalks/CrosswalkDragLayer/index.d.ts +0 -1
  260. package/cjs/features/crosswalks/CrosswalkDragLayer/index.js +0 -5
  261. package/cjs/features/crosswalks/CrosswalkDragLayer/styles.js +0 -17
  262. package/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.d.ts +0 -2
  263. package/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.js +0 -25
  264. package/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +0 -65
  265. package/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.js +0 -19
  266. package/features/crosswalks/CrosswalkDragLayer/index.d.ts +0 -1
  267. package/features/crosswalks/CrosswalkDragLayer/index.js +0 -1
  268. package/features/crosswalks/CrosswalkDragLayer/styles.js +0 -14
  269. /package/{cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.d.ts → VerticalHeadingsTable/DndVerticalHeadingsTable.test.d.ts} +0 -0
  270. /package/{features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.d.ts → VerticalHeadingsTable/components/DndComponent/types.js} +0 -0
  271. /package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/CrosswalkDragPreview.d.ts +0 -0
  272. /package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/index.d.ts +0 -0
  273. /package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/index.js +0 -0
  274. /package/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/CrosswalkDragPreview.d.ts +0 -0
  275. /package/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/index.d.ts +0 -0
  276. /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
  };
@@ -10,6 +10,9 @@ export var useEntityDetails = function (entityUri) {
10
10
  setIsLoading(true);
11
11
  safePromise(getEntity(entityUri))
12
12
  .then(setEntityDetails)
13
+ .catch(function (error) {
14
+ console.warn('Failed to load entity', error);
15
+ })
13
16
  .finally(function () { return setIsLoading(false); });
14
17
  }, 1000), [entityUri, safePromise]);
15
18
  var hideEntityDetails = useCallback(function () {
@@ -194,4 +194,32 @@ describe('useEntityDetails', function () {
194
194
  }
195
195
  });
196
196
  }); });
197
+ it('should catch and handle error when getEntity returns error', function () { return __awaiter(void 0, void 0, void 0, function () {
198
+ var warnSpy, result;
199
+ return __generator(this, function (_a) {
200
+ switch (_a.label) {
201
+ case 0:
202
+ warnSpy = jest.spyOn(global.console, 'warn');
203
+ getEntity.mockRejectedValue({ errorCode: 403, errorMessage: 'Access is denied' });
204
+ result = renderHook(useEntityDetails, { initialProps: entity.uri }).result;
205
+ act(function () {
206
+ result.current.showEntityDetails();
207
+ jest.runAllTimers();
208
+ });
209
+ expect(getEntity).toHaveBeenCalled();
210
+ return [4 /*yield*/, act(function () {
211
+ return Promise.resolve();
212
+ })];
213
+ case 1:
214
+ _a.sent();
215
+ expect(result.current.isLoading).toBe(false);
216
+ expect(warnSpy).toHaveBeenCalledWith('Failed to load entity', {
217
+ errorCode: 403,
218
+ errorMessage: 'Access is denied'
219
+ });
220
+ warnSpy.mockRestore();
221
+ return [2 /*return*/];
222
+ }
223
+ });
224
+ }); });
197
225
  });
@@ -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 = [
@@ -65,7 +65,11 @@ export var useSearchNavigation = function () {
65
65
  }, [listenToActions, updateNavigationData, searchNavigationListener]);
66
66
  var requestNextPage = useCallback(function (cache, total, index) {
67
67
  setLoading(true);
68
- safeRequestTotalPromise(searchProvider.requestTotal()).then(function (total) { return updateNavigationData({ total: total }); });
68
+ safeRequestTotalPromise(searchProvider.requestTotal())
69
+ .then(function (total) { return updateNavigationData({ total: total }); })
70
+ .catch(function (error) {
71
+ console.warn('Failed to load total count of entities', error);
72
+ });
69
73
  var newIndex = index + 1;
70
74
  return safeRequestEntitiesPromise(searchProvider.requestEntities(REQUEST_PAGE_SIZE, newIndex))
71
75
  .then(function (entities) {
@@ -97,7 +101,11 @@ export var useSearchNavigation = function () {
97
101
  }, [searchProvider, updateNavigationData, openEntity]);
98
102
  var requestPrevPage = useCallback(function (cache, index) {
99
103
  setLoading(true);
100
- safeRequestTotalPromise(searchProvider.requestTotal()).then(function (total) { return updateNavigationData({ total: total }); });
104
+ safeRequestTotalPromise(searchProvider.requestTotal())
105
+ .then(function (total) { return updateNavigationData({ total: total }); })
106
+ .catch(function (error) {
107
+ console.warn('Failed to load total count of entities', error);
108
+ });
101
109
  var newIndex = index - 1;
102
110
  var offset = Math.max(0, index - REQUEST_PAGE_SIZE);
103
111
  var max = REQUEST_PAGE_SIZE + Math.min(0, index - REQUEST_PAGE_SIZE);
@@ -207,7 +215,7 @@ export var useSearchNavigation = function () {
207
215
  if (cache && uri) {
208
216
  var cacheIndex = cache.indexOf(uri) - 1;
209
217
  stepBackWithCheck(cache, cacheIndex, total, index).catch(function (error) {
210
- console.warn("Can't load prev page of search", error);
218
+ console.warn("Can't load previous page of search", error);
211
219
  });
212
220
  }
213
221
  }, [stepBackWithCheck, cache, uri, total, index]);