@reltio/profile 1.4.1585 → 1.4.1586-mui5

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 (335) hide show
  1. package/.DS_Store +0 -0
  2. package/index.ts +4 -0
  3. package/package.json +40 -23
  4. package/public/bundle.js +205 -0
  5. package/{bundle.js.LICENSE.txt → public/bundle.js.LICENSE.txt} +44 -16
  6. package/public/package.json +24 -0
  7. package/scripts/build/index.js +20 -0
  8. package/src/.DS_Store +0 -0
  9. package/src/components/.DS_Store +0 -0
  10. package/src/components/BackgroundProcessIndicator/BackgroundProcessIndicator.tsx +101 -0
  11. package/src/components/BackgroundProcessIndicator/styles.ts +50 -0
  12. package/src/components/DCRReviewPerspectiveView/DCRReviewPerspectiveView.tsx +77 -0
  13. package/src/components/DCRReviewPerspectiveView/__tests__/DCRReviewPerspectiveView.test.tsx +156 -0
  14. package/src/components/DCRReviewPerspectiveView/components/DCRProfileBand/DCRProfileBand.tsx +22 -0
  15. package/src/components/DCRReviewPerspectiveView/components/DCRProfileBand/__tests__/DCRProfileBand.test.tsx +92 -0
  16. package/src/components/DCRReviewPerspectiveView/components/DCRProfileBand/styles.ts +11 -0
  17. package/src/components/DCRReviewPerspectiveView/hooks/useWorkflowTasks.ts +31 -0
  18. package/src/components/DCRReviewPerspectiveView/index.ts +1 -0
  19. package/src/components/DCRReviewPerspectiveView/styles.ts +33 -0
  20. package/src/components/EntityMapView/EntityMapView.tsx +64 -0
  21. package/src/components/EntityMapView/__tests__/EntityMapView.spec.js +121 -0
  22. package/src/components/EntityMapView/styles.ts +20 -0
  23. package/src/components/EntityMapView/useMarkers.ts +27 -0
  24. package/src/components/HierarchyPathsView/ConfigContext.ts +4 -0
  25. package/src/components/HierarchyPathsView/HierarchyPathsHeader.tsx +32 -0
  26. package/src/components/HierarchyPathsView/HierarchyPathsView.tsx +90 -0
  27. package/src/components/HierarchyPathsView/Node.tsx +62 -0
  28. package/src/components/HierarchyPathsView/__tests__/HierarchyPathsView.test.tsx +547 -0
  29. package/src/components/HierarchyPathsView/__tests__/IntegrationHierarchyPathsView.test.tsx +47 -0
  30. package/src/components/HierarchyPathsView/__tests__/Node.test.tsx +152 -0
  31. package/src/components/HierarchyPathsView/__tests__/data/metadata.data.ts +33 -0
  32. package/src/components/HierarchyPathsView/__tests__/data/store.data.ts +37 -0
  33. package/src/components/HierarchyPathsView/__tests__/data/treePaths.data.ts +63 -0
  34. package/src/components/HierarchyPathsView/defaultTypeIcon.png +0 -0
  35. package/src/components/HierarchyPathsView/helpers.ts +3 -0
  36. package/src/components/HierarchyPathsView/hooks/useDynamicNodesHeights.ts +33 -0
  37. package/src/components/HierarchyPathsView/hooks/useLoadPaths.ts +76 -0
  38. package/src/components/HierarchyPathsView/icons/ShowGraph.svg +10 -0
  39. package/src/components/HierarchyPathsView/index.ts +1 -0
  40. package/src/components/HierarchyPathsView/styles.ts +60 -0
  41. package/src/components/HierarchyPathsView/theme/__tests__/node-content-renderer.test.tsx +78 -0
  42. package/src/components/HierarchyPathsView/theme/__tests__/tree-node-data-renderer.test.tsx +72 -0
  43. package/src/components/HierarchyPathsView/theme/index.ts +8 -0
  44. package/src/components/HierarchyPathsView/theme/node-content-renderer.tsx +84 -0
  45. package/src/components/HierarchyPathsView/theme/styles.ts +102 -0
  46. package/src/components/HierarchyPathsView/theme/tree-node-data-renderer.tsx +70 -0
  47. package/src/components/HierarchyPathsView/types.ts +17 -0
  48. package/src/components/ImageAttributeView/ImageAttributeView.tsx +87 -0
  49. package/src/components/ImageAttributeView/ImageAttributeViewEditableContent/ImageAttributeViewEditableContent.tsx +52 -0
  50. package/src/components/ImageAttributeView/ImageAttributeViewEditableContent/__tests__/ImageAttributeViewEditableContent.test.tsx +136 -0
  51. package/src/components/ImageAttributeView/ImageLineCaption/ImageLineCaption.tsx +18 -0
  52. package/src/components/ImageAttributeView/ImageLineCaption/__tests__/ImageLineCaption.test.tsx +15 -0
  53. package/src/components/ImageAttributeView/ImageLineCaption/styles.ts +10 -0
  54. package/src/components/ImageAttributeView/__tests__/ImageAttributeView.test.tsx +151 -0
  55. package/src/components/ImageAttributeView/__tests__/IntegrationImageAttributeView.test.tsx +36 -0
  56. package/src/components/ImageAttributeView/__tests__/data/store.data.ts +22 -0
  57. package/src/components/ImageAttributeView/styles.ts +13 -0
  58. package/src/components/Notifications/Notification.tsx +98 -0
  59. package/src/components/Notifications/Notifications.tsx +17 -0
  60. package/src/components/Notifications/__tests__/Notification.spec.tsx +230 -0
  61. package/src/components/Notifications/__tests__/Notifications.spec.tsx +37 -0
  62. package/src/components/Notifications/index.ts +1 -0
  63. package/src/components/Notifications/styles.ts +17 -0
  64. package/src/components/Notifications/types.ts +21 -0
  65. package/src/components/PerspectiveProfileBand/PerspectiveProfileBand.tsx +304 -0
  66. package/src/components/PerspectiveProfileBand/__tests__/PerspectiveProfileBand.specs.tsx +526 -0
  67. package/src/components/PerspectiveProfileBand/__tests__/data/collaboration.data.ts +23 -0
  68. package/src/components/PerspectiveProfileBand/__tests__/data/store.data.ts +162 -0
  69. package/src/components/PerspectiveProfileBand/copy.svg +14 -0
  70. package/src/components/PerspectiveProfileBand/hooks/useCloneAction.ts +94 -0
  71. package/src/components/PerspectiveProfileBand/index.ts +1 -0
  72. package/src/components/PerspectiveProfileBand/styles.ts +27 -0
  73. package/src/components/PerspectiveProfileBand/suggest.svg +16 -0
  74. package/src/components/ProfileAttributesView/ProfileAttributesView.tsx +21 -0
  75. package/src/components/ProfileAttributesView/__tests__/ProfileAttributesView.test.tsx +70 -0
  76. package/src/components/ProfileErrorsPanel/ProfileErrorsPanel.tsx +70 -0
  77. package/src/components/ProfileErrorsPanel/__tests__/ProfileErrorsPanel.specs.tsx +140 -0
  78. package/src/components/ProfileErrorsPanel/components/Error.tsx +50 -0
  79. package/src/components/ProfileErrorsPanel/components/ErrorsPanel.tsx +65 -0
  80. package/src/components/ProfileErrorsPanel/components/__tests__/Error.specs.tsx +264 -0
  81. package/src/components/ProfileErrorsPanel/components/__tests__/ErrorsPanel.specs.tsx +93 -0
  82. package/src/components/ProfileErrorsPanel/helpers.ts +45 -0
  83. package/src/components/ProfileErrorsPanel/icons/hyperlink.svg +4 -0
  84. package/src/components/ProfileErrorsPanel/index.ts +1 -0
  85. package/src/components/ProfileErrorsPanel/styles.ts +100 -0
  86. package/src/components/ProfileErrorsPanel/useCachedErrors.ts +11 -0
  87. package/src/components/ProfileLayout/ProfileLayout.tsx +56 -0
  88. package/src/components/ProfileLayout/__tests__/ProfileLayout.specs.tsx +56 -0
  89. package/src/components/ProfileLayout/index.ts +1 -0
  90. package/src/components/ProfileLayout/styles.ts +19 -0
  91. package/src/components/ProfileLayoutItem/ProfileLayoutItem.tsx +89 -0
  92. package/src/components/ProfileLayoutItem/__tests__/ProfileLayoutItem.test.tsx +165 -0
  93. package/src/components/ProfileLayoutItem/__tests__/data/store.data.ts +29 -0
  94. package/src/components/ProfileLayoutItem/index.ts +1 -0
  95. package/src/components/ProfileLayoutItem/styles.ts +13 -0
  96. package/src/components/ProfilePerspectiveResizablePanes/ProfilePerspectiveResizablePanes.tsx +34 -0
  97. package/src/components/ProfilePerspectiveResizablePanes/styles.ts +9 -0
  98. package/src/components/ProfilePerspectiveView/ProfilePerspectiveView.tsx +193 -0
  99. package/src/components/ProfilePerspectiveView/__tests__/IntegrationProfilePerspective.test.tsx +417 -0
  100. package/src/components/ProfilePerspectiveView/__tests__/ProfilePerspectiveView.specs.tsx +1503 -0
  101. package/src/components/ProfilePerspectiveView/__tests__/data/entities.data.ts +19 -0
  102. package/src/components/ProfilePerspectiveView/__tests__/data/entity.data.ts +25 -0
  103. package/src/components/ProfilePerspectiveView/__tests__/data/metadata.data.ts +33 -0
  104. package/src/components/ProfilePerspectiveView/__tests__/data/profile.data.ts +22 -0
  105. package/src/components/ProfilePerspectiveView/__tests__/data/store.data.ts +51 -0
  106. package/src/components/ProfilePerspectiveView/hooks/data/backgroundUpdateDalay.ts +2 -0
  107. package/src/components/ProfilePerspectiveView/hooks/useBackgroundProcessIndicator.ts +121 -0
  108. package/src/components/ProfilePerspectiveView/hooks/useProfileLayout.ts +101 -0
  109. package/src/components/ProfilePerspectiveView/hooks/useProfileRightSidePanelElements.tsx +167 -0
  110. package/src/components/ProfilePerspectiveView/hooks/useWorkflowTasks.ts +15 -0
  111. package/src/components/ProfilePerspectiveView/index.ts +1 -0
  112. package/src/components/ProfilePerspectiveView/styles.ts +38 -0
  113. package/src/components/ProfilePotentialMatchesView/ActionButtons.tsx +39 -0
  114. package/src/components/ProfilePotentialMatchesView/MatchCard.tsx +53 -0
  115. package/src/components/ProfilePotentialMatchesView/ProfilePotentialMatchesView.tsx +137 -0
  116. package/src/components/ProfilePotentialMatchesView/__tests__/ActionButtons.specs.tsx +89 -0
  117. package/src/components/ProfilePotentialMatchesView/__tests__/MatchCard.specs.tsx +62 -0
  118. package/src/components/ProfilePotentialMatchesView/__tests__/ProfilePotentialMatchesView.specs.tsx +267 -0
  119. package/src/components/ProfilePotentialMatchesView/__tests__/commonData.ts +91 -0
  120. package/src/components/ProfilePotentialMatchesView/styles.ts +30 -0
  121. package/src/components/ProfileRelationsView/ProfileRelationsView.tsx +24 -0
  122. package/src/components/ProfileRelationsView/__tests__/ProfileRelationsView.test.tsx +112 -0
  123. package/src/components/ProfileRelationsView/components/EditableRelationItem/EditableRelationItem.tsx +133 -0
  124. package/src/components/ProfileRelationsView/components/EditableRelationItem/__tests__/EditableRelationItem.specs.tsx +222 -0
  125. package/src/components/ProfileRelationsView/components/EditableRelationItem/styles.ts +59 -0
  126. package/src/components/ProfileRelationsView/components/RelationArrowButton/RelationArrowButton.tsx +29 -0
  127. package/src/components/ProfileRelationsView/components/RelationArrowButton/__tests__/RelationArrowButton.specs.tsx +99 -0
  128. package/src/components/ProfileRelationsView/components/RelationArrowButton/styles.ts +8 -0
  129. package/src/components/ProfileRelationsView/components/RelationTooltip/RelationTooltip.tsx +83 -0
  130. package/src/components/ProfileRelationsView/components/RelationTooltip/__tests__/RelationTooltip.test.tsx +155 -0
  131. package/src/components/ProfileRelationsView/components/RelationTooltip/styles.ts +27 -0
  132. package/src/components/ProfileRelationsView/components/RelationsContent/RelationsContent.tsx +62 -0
  133. package/src/components/ProfileRelationsView/components/RelationsContent/__tests__/RelationsContent.specs.tsx +148 -0
  134. package/src/components/ProfileRelationsView/components/RelationsContent/styles.ts +15 -0
  135. package/src/components/ProfileRelationsView/components/RelationsEditableContent/RelationsEditableContent.tsx +153 -0
  136. package/src/components/ProfileRelationsView/components/RelationsEditableContent/__tests__/RelationsEditableContent.specs.tsx +367 -0
  137. package/src/components/ProfileRelationsView/components/RelationsEditableContent/styles.ts +28 -0
  138. package/src/components/ProfileRelationsView/components/RelationsHeader/FilterButton/FilterButton.tsx +113 -0
  139. package/src/components/ProfileRelationsView/components/RelationsHeader/FilterButton/styles.ts +43 -0
  140. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/ImportFromDT.tsx +65 -0
  141. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/MultipleImportIcon.tsx +23 -0
  142. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/__tests__/ImportFromDT.test.tsx +500 -0
  143. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/__tests__/MultipleImportIcon.test.tsx +20 -0
  144. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/hooks/useImportFromDTLoader.ts +84 -0
  145. package/src/components/ProfileRelationsView/components/RelationsHeader/ImportFromDT/styles.ts +37 -0
  146. package/src/components/ProfileRelationsView/components/RelationsHeader/RelationsHeader.tsx +39 -0
  147. package/src/components/ProfileRelationsView/components/RelationsHeader/__tests__/RelationsHeader.test.tsx +82 -0
  148. package/src/components/ProfileRelationsView/components/RelationsHeader/styles.ts +18 -0
  149. package/src/components/ProfileRelationsView/components/RelationsList/Ratings/Ratings.tsx +60 -0
  150. package/src/components/ProfileRelationsView/components/RelationsList/Ratings/__tests__/Ratings.test.tsx +64 -0
  151. package/src/components/ProfileRelationsView/components/RelationsList/Ratings/styles.ts +48 -0
  152. package/src/components/ProfileRelationsView/components/RelationsList/RatingsButtons/RatingsButtons.tsx +74 -0
  153. package/src/components/ProfileRelationsView/components/RelationsList/RatingsButtons/__tests__/RatingsButtons.test.tsx +72 -0
  154. package/src/components/ProfileRelationsView/components/RelationsList/RatingsButtons/styles.ts +20 -0
  155. package/src/components/ProfileRelationsView/components/RelationsList/RatingsPopup/RatingsPopup.tsx +109 -0
  156. package/src/components/ProfileRelationsView/components/RelationsList/RatingsPopup/__tests__/RatingsPopup.test.tsx +106 -0
  157. package/src/components/ProfileRelationsView/components/RelationsList/RatingsPopup/styles.ts +133 -0
  158. package/src/components/ProfileRelationsView/components/RelationsList/RelationAttributes/RelationAttributes.tsx +81 -0
  159. package/src/components/ProfileRelationsView/components/RelationsList/RelationAttributes/__tests__/RelationAttributes.test.tsx +218 -0
  160. package/src/components/ProfileRelationsView/components/RelationsList/RelationAttributes/styles.ts +12 -0
  161. package/src/components/ProfileRelationsView/components/RelationsList/RelationCompexItem/RelationComplexItem.tsx +129 -0
  162. package/src/components/ProfileRelationsView/components/RelationsList/RelationCompexItem/__tests__/RelationComplexItem.test.tsx +303 -0
  163. package/src/components/ProfileRelationsView/components/RelationsList/RelationCompexItem/styles.ts +51 -0
  164. package/src/components/ProfileRelationsView/components/RelationsList/RelationItem/RelationItem.tsx +103 -0
  165. package/src/components/ProfileRelationsView/components/RelationsList/RelationItem/__tests__/RelationItem.test.tsx +222 -0
  166. package/src/components/ProfileRelationsView/components/RelationsList/RelationItem/styles.ts +72 -0
  167. package/src/components/ProfileRelationsView/components/RelationsList/RelationsList.tsx +69 -0
  168. package/src/components/ProfileRelationsView/components/RelationsList/ShowDetailsButton/ShowDetailsButton.tsx +28 -0
  169. package/src/components/ProfileRelationsView/components/RelationsList/ShowDetailsButton/__tests__/ShowDetailsButton.test.tsx +33 -0
  170. package/src/components/ProfileRelationsView/components/RelationsList/__tests__/RelationsList.test.tsx +143 -0
  171. package/src/components/ProfileRelationsView/components/RelationsView/RelationsView.tsx +108 -0
  172. package/src/components/ProfileRelationsView/components/RelationsView/__tests__/RelationsView.test.tsx +183 -0
  173. package/src/components/ProfileRelationsView/components/RelationsView/index.ts +1 -0
  174. package/src/components/ProfileRelationsView/components/RelationsView/styles.ts +22 -0
  175. package/src/components/ProfileRelationsView/components/SecondLevelWrapper/SecondLevelWrapper.tsx +66 -0
  176. package/src/components/ProfileRelationsView/components/SecondLevelWrapper/__tests__/SecondLevelWrapper.test.tsx +234 -0
  177. package/src/components/ProfileRelationsView/components/SecondLevelWrapper/styles.ts +12 -0
  178. package/src/components/ProfileRelationsView/components/SuggestedButtons/SuggestedButtons.tsx +23 -0
  179. package/src/components/ProfileRelationsView/components/SuggestedButtons/__tests__/SuggestedButtons.test.tsx +33 -0
  180. package/src/components/ProfileRelationsView/components/SuggestedButtons/styles.ts +7 -0
  181. package/src/components/ProfileRelationsView/contexts/ImportDTContext.ts +7 -0
  182. package/src/components/ProfileRelationsView/contexts/RelationsViewStateContext.ts +6 -0
  183. package/src/components/ProfileRelationsView/helpers/__tests__/filters.test.tsx +10 -0
  184. package/src/components/ProfileRelationsView/helpers/__tests__/ratings.test.ts +92 -0
  185. package/src/components/ProfileRelationsView/helpers/__tests__/relation.test.tsx +27 -0
  186. package/src/components/ProfileRelationsView/helpers/filters.ts +17 -0
  187. package/src/components/ProfileRelationsView/helpers/permissions.ts +17 -0
  188. package/src/components/ProfileRelationsView/helpers/ratings.ts +35 -0
  189. package/src/components/ProfileRelationsView/helpers/relation.ts +15 -0
  190. package/src/components/ProfileRelationsView/hooks/useRelationInfo.ts +25 -0
  191. package/src/components/ProfileRelationsView/hooks/useRelationsState.ts +92 -0
  192. package/src/components/ProfileRelationsView/hooks/useSecondLevelConnections.ts +76 -0
  193. package/src/components/ProfileRelationsView/hooks/useSuggestedRelations.ts +54 -0
  194. package/src/components/ProfileSingleAttributeView/ProfileSingleAttributeView.tsx +20 -0
  195. package/src/components/ProfileSingleAttributeView/__tests__/IntegrationProfileSingleAttribute.test.tsx +368 -0
  196. package/src/components/ProfileSingleAttributeView/__tests__/ProfileSingleAttributeView.test.tsx +933 -0
  197. package/src/components/ProfileSingleAttributeView/__tests__/data/metadata.data.ts +103 -0
  198. package/src/components/ProfileSingleAttributeView/__tests__/data/store.data.ts +42 -0
  199. package/src/components/ProfileSingleAttributeView/components/FilterButton/FilterButton.tsx +63 -0
  200. package/src/components/ProfileSingleAttributeView/components/FilterButton/__tests__/FilterButton.spec.tsx +93 -0
  201. package/src/components/ProfileSingleAttributeView/components/FilterButton/styles.ts +27 -0
  202. package/src/components/ProfileSingleAttributeView/components/SingleAttributeEditableContent/SingleAttributeEditableContent.tsx +204 -0
  203. package/src/components/ProfileSingleAttributeView/components/SingleAttributeEditableContent/__tests__/SingleAttributeEditableContent.specs.tsx +559 -0
  204. package/src/components/ProfileSingleAttributeView/components/SingleAttributeEditableContent/styles.ts +28 -0
  205. package/src/components/ProfileSingleAttributeView/components/SingleAttributeHeader/SingleAttributeHeader.tsx +58 -0
  206. package/src/components/ProfileSingleAttributeView/components/SingleAttributeHeader/__tests__/SingleAttributeHeader.test.tsx +188 -0
  207. package/src/components/ProfileSingleAttributeView/components/SingleAttributeHeader/styles.ts +21 -0
  208. package/src/components/ProfileSingleAttributeView/components/SingleAttributeReadableContent/SingleAttributeReadableContent.tsx +31 -0
  209. package/src/components/ProfileSingleAttributeView/components/SingleAttributeReadableContent/__tests__/SingleAttributeReadableContent.spec.tsx +42 -0
  210. package/src/components/ProfileSingleAttributeView/components/SingleAttributeReadableContent/styles.ts +9 -0
  211. package/src/components/ProfileSingleAttributeView/components/SingleAttributeView/SingleAttributeView.tsx +90 -0
  212. package/src/components/ProfileSingleAttributeView/components/SingleAttributeView/__tests__/SingleAttributeView.test.tsx +346 -0
  213. package/src/components/ProfileSingleAttributeView/components/SingleAttributeView/styles.ts +22 -0
  214. package/src/components/ProfileSingleAttributeView/contexts/SingleAttributeContext.ts +20 -0
  215. package/src/components/ProfileSingleAttributeView/hooks/useSingleAttribute.ts +25 -0
  216. package/src/components/ProfileSingleAttributeView/styles.ts +26 -0
  217. package/src/components/ProfileTableAttributeView/ProfileTableAttributeView.tsx +20 -0
  218. package/src/components/ProfileTableAttributeView/__tests__/IntegrationProfileTableAttributeView.test.tsx +278 -0
  219. package/src/components/ProfileTableAttributeView/__tests__/ProfileTableAttributeView.test.tsx +744 -0
  220. package/src/components/ProfileTableAttributeView/__tests__/data/metadata.data.ts +141 -0
  221. package/src/components/ProfileTableAttributeView/__tests__/data/store.data.ts +48 -0
  222. package/src/components/ProfileTableAttributeView/components/AttributeEditing/AttributeEditing.tsx +97 -0
  223. package/src/components/ProfileTableAttributeView/components/AttributeEditing/__tests__/AttributeEditing.test.tsx +409 -0
  224. package/src/components/ProfileTableAttributeView/components/AttributeEditing/styles.ts +17 -0
  225. package/src/components/ProfileTableAttributeView/components/AttributeTable/AttributeTable.tsx +171 -0
  226. package/src/components/ProfileTableAttributeView/components/AttributeTable/EditButtons.tsx +28 -0
  227. package/src/components/ProfileTableAttributeView/components/AttributeTable/__tests__/AttributeTable.test.tsx +431 -0
  228. package/src/components/ProfileTableAttributeView/components/AttributeTable/__tests__/EditButtons.test.tsx +54 -0
  229. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/BlobRenderer.tsx +20 -0
  230. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/DefaultCellValueRenderer.tsx +43 -0
  231. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/HeadCellRenderer.tsx +19 -0
  232. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/RowCellRenderer.tsx +33 -0
  233. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/__tests__/BlobRenderer.test.tsx +29 -0
  234. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/__tests__/DefaultCellValueRenderer.test.tsx +149 -0
  235. package/src/components/ProfileTableAttributeView/components/AttributeTable/cell-renderers/styles.ts +61 -0
  236. package/src/components/ProfileTableAttributeView/components/AttributeTable/styles.ts +21 -0
  237. package/src/components/ProfileTableAttributeView/components/AttributeTableHeader/AttributeTableHeader.tsx +53 -0
  238. package/src/components/ProfileTableAttributeView/components/AttributeTableHeader/__tests__/AttributeTableHeader.test.tsx +96 -0
  239. package/src/components/ProfileTableAttributeView/components/AttributeTableHeader/styles.ts +7 -0
  240. package/src/components/ProfileTableAttributeView/components/TableAttributeContent/TableAttributeContent.tsx +123 -0
  241. package/src/components/ProfileTableAttributeView/components/TableAttributeContent/__tests__/TableAttributeContent.test.tsx +600 -0
  242. package/src/components/ProfileTableAttributeView/components/TableAttributeContent/hooks/useEditableAttribute.ts +212 -0
  243. package/src/components/ProfileTableAttributeView/components/TableAttributeEditableContent/TableAttributeEditableContent.tsx +96 -0
  244. package/src/components/ProfileTableAttributeView/components/TableAttributeEditableContent/__tests__/TableAttributeEditableContent.test.tsx +450 -0
  245. package/src/components/ProfileTableAttributeView/components/TableAttributeEditableContent/hooks/__tests__/useExpandAttributes.test.tsx +92 -0
  246. package/src/components/ProfileTableAttributeView/components/TableAttributeEditableContent/hooks/useExpandAttributes.ts +88 -0
  247. package/src/components/ProfileTableAttributeView/components/TableAttributeEditableContent/styles.ts +21 -0
  248. package/src/components/ProfileTableAttributeView/components/TableAttributeView/TableAttributeView.tsx +64 -0
  249. package/src/components/ProfileTableAttributeView/components/TableAttributeView/__tests__/TableAttributeView.test.tsx +139 -0
  250. package/src/components/ProfileTableAttributeView/components/TableAttributeView/styles.ts +20 -0
  251. package/src/components/ProfileTableAttributeView/components/types.ts +16 -0
  252. package/src/components/ProfileTableAttributeView/contexts/TableAttributeContext.tsx +34 -0
  253. package/src/components/ProfileTableAttributeView/helpers/tableAttributeHelpers.ts +72 -0
  254. package/src/components/ProfileTableAttributeView/hooks/__tests__/helpers.test.ts +97 -0
  255. package/src/components/ProfileTableAttributeView/hooks/helpers.ts +13 -0
  256. package/src/components/ProfileTableAttributeView/hooks/reducer.ts +19 -0
  257. package/src/components/ProfileTableAttributeView/hooks/useTableAttribute.ts +77 -0
  258. package/src/components/RightSidePanel/RightSidePanel.tsx +43 -0
  259. package/src/components/RightSidePanel/__tests__/RightSidePanel.spec.tsx +149 -0
  260. package/src/components/RightSidePanel/components/CollaborationButton/CollaborationButton.tsx +22 -0
  261. package/src/components/RightSidePanel/components/CollaborationButton/__tests__/CollaborationButton.spec.tsx +24 -0
  262. package/src/components/RightSidePanel/components/CollaborationList/CollaborationList.tsx +56 -0
  263. package/src/components/RightSidePanel/components/CollaborationList/__tests__/CollaborationList.spec.tsx +104 -0
  264. package/src/components/RightSidePanel/components/CollaborationList/styles.ts +15 -0
  265. package/src/components/RightSidePanel/components/CollaborationPanelEmptyState/CollaborationPanelEmptyState.tsx +14 -0
  266. package/src/components/RightSidePanel/components/CollaborationPanelEmptyState/__tests__/CollaborationPanelEmptyState.specs.tsx +16 -0
  267. package/src/components/RightSidePanel/components/DBConnectorsList/DBConnectorsList.tsx +19 -0
  268. package/src/components/RightSidePanel/components/DBConnectorsList/__tests__/DBConnectorsList.spec.tsx +42 -0
  269. package/src/components/RightSidePanel/components/DBConnectorsList/styles.ts +12 -0
  270. package/src/components/RightSidePanel/components/WorkflowButton/WorkflowButton.tsx +21 -0
  271. package/src/components/RightSidePanel/components/WorkflowButton/__tests__/WorkflowButton.spec.tsx +23 -0
  272. package/src/components/RightSidePanel/components/WorkflowList/WorkflowList.tsx +18 -0
  273. package/src/components/RightSidePanel/components/WorkflowList/__tests__/WorkflowList.spec.tsx +46 -0
  274. package/src/components/RightSidePanel/components/WorkflowList/styles.ts +9 -0
  275. package/src/components/RightSidePanel/components/WorkflowPanelEmptyState/WorkflowPanelEmptyState.tsx +14 -0
  276. package/src/components/RightSidePanel/components/WorkflowPanelEmptyState/__tests__/WorkflowPanelEmptyState.specs.tsx +17 -0
  277. package/src/components/RightSidePanel/icons/CollaborationIcon.svg +18 -0
  278. package/src/components/RightSidePanel/icons/ConnectorsIcon.svg +3 -0
  279. package/src/components/RightSidePanel/styles.ts +21 -0
  280. package/src/components/Sandbox/CustomView.tsx +59 -0
  281. package/src/components/Sandbox/__tests__/CustomView.test.tsx +294 -0
  282. package/src/components/Sandbox/styles.ts +10 -0
  283. package/src/components/TagPerspectiveView/TagPerspectiveView.tsx +79 -0
  284. package/src/components/TagPerspectiveView/__tests__/TagPerspectiveView.test.tsx +146 -0
  285. package/src/components/TagPerspectiveView/components/TagListHeader/TagListHeader.tsx +48 -0
  286. package/src/components/TagPerspectiveView/components/TagListHeader/__tests__/TagListHeader.test.tsx +60 -0
  287. package/src/components/TagPerspectiveView/components/TagListHeader/index.ts +1 -0
  288. package/src/components/TagPerspectiveView/components/TagListHeader/styles.ts +36 -0
  289. package/src/components/TagPerspectiveView/components/TagProfileBand/TagProfileBand.tsx +21 -0
  290. package/src/components/TagPerspectiveView/components/TagProfileBand/__tests__/TagProfileBand.test.tsx +14 -0
  291. package/src/components/TagPerspectiveView/components/TagProfileBand/index.ts +1 -0
  292. package/src/components/TagPerspectiveView/components/TagProfileBand/styles.ts +24 -0
  293. package/src/components/TagPerspectiveView/hooks/__tests__/useTag.test.tsx +166 -0
  294. package/src/components/TagPerspectiveView/hooks/__tests__/useTagsProvider.test.tsx +208 -0
  295. package/src/components/TagPerspectiveView/hooks/useTag.ts +48 -0
  296. package/src/components/TagPerspectiveView/hooks/useTagsProvider.ts +83 -0
  297. package/src/components/TagPerspectiveView/index.ts +1 -0
  298. package/src/components/TagPerspectiveView/styles.ts +43 -0
  299. package/src/components/hooks/helpers/__tests__/helpers.test.ts +688 -0
  300. package/src/components/hooks/helpers/index.ts +77 -0
  301. package/src/components/hooks/useProfileValidation.ts +30 -0
  302. package/src/components/hooks/useSingleAttributeLoader.ts +164 -0
  303. package/src/components/views/HOCs/styles.ts +37 -0
  304. package/src/components/views/HOCs/withDragHandle.tsx +26 -0
  305. package/src/components/views/HOCs/withErrorBoundary.tsx +27 -0
  306. package/src/components/views/StubView.tsx +18 -0
  307. package/src/components/views/ViewComponent.tsx +25 -0
  308. package/src/components/views/ViewsFactory.tsx +143 -0
  309. package/src/components/views/__tests__/ViewComponent.specs.tsx +47 -0
  310. package/src/components/views/__tests__/ViewsFactory.specs.tsx +256 -0
  311. package/src/components/views/styles.ts +16 -0
  312. package/src/perspectives/DCRReviewPerspective.tsx +51 -0
  313. package/src/perspectives/ProfilePerspective.tsx +104 -0
  314. package/src/perspectives/TagPerspective.tsx +42 -0
  315. package/src/perspectives/__tests__/DCRReviewPerspective.spec.tsx +54 -0
  316. package/src/perspectives/__tests__/ProfilePerspective.spec.tsx +76 -0
  317. package/src/perspectives/__tests__/helpers.spec.ts +131 -0
  318. package/src/perspectives/helpers.ts +29 -0
  319. package/src/types/index.ts +9 -0
  320. package/stories/Profile.stories.tsx +35 -0
  321. package/stories/utils/entity.ts +80 -0
  322. package/stories/utils/hierarchyTree/config.ts +13 -0
  323. package/stories/utils/hierarchyTree/hopsResponse.ts +182 -0
  324. package/stories/utils/hierarchyTree/treeResponse.ts +412 -0
  325. package/stories/utils/mdmStore.ts +64 -0
  326. package/stories/utils/metadata.ts +701 -0
  327. package/stories/utils/profilePerspectiveConfig.ts +95 -0
  328. package/stories/utils/relationsTableView/config.ts +18 -0
  329. package/stories/utils/relationsTableView/connections.ts +647 -0
  330. package/stories/utils/responses.ts +62 -0
  331. package/tsconfig.json +4 -0
  332. package/webpack.config.js +10 -0
  333. package/bundle.js +0 -2
  334. /package/{5271a9e7b6651c852e93.png → public/5271a9e7b6651c852e93.png} +0 -0
  335. /package/{main.css → public/main.css} +0 -0
@@ -0,0 +1,559 @@
1
+ import React from 'react';
2
+ import {mount} from 'enzyme';
3
+ import * as reactReduxImports from 'react-redux';
4
+ import * as componentsImport from '@reltio/components';
5
+ import Button from '@mui/material/Button';
6
+ import Divider from '@mui/material/Divider';
7
+ import {AttributeError, AttributeItem, ErrorType, Mode} from '@reltio/mdm-sdk';
8
+ import {profile} from '@reltio/mdm-module';
9
+ import {
10
+ CardinalityMessage,
11
+ EditableAttribute,
12
+ ErrorMessage,
13
+ ScrollType,
14
+ ScrollToElementContext
15
+ } from '@reltio/components';
16
+ import SingleAttributeEditableContent from '../SingleAttributeEditableContent';
17
+
18
+ jest.mock('@reltio/components', () => ({
19
+ ...(jest.requireActual('@reltio/components') as Record<string, unknown>),
20
+ EditableAttribute: () => null,
21
+ useScrollToAttributeError: jest.fn()
22
+ }));
23
+
24
+ describe('SingleAttributeEditableContent tests', () => {
25
+ let store;
26
+ const dispatch = jest.fn();
27
+ const attributeType = {
28
+ uri: 'configuration/entityTypes/HCP/attributes/Simple',
29
+ type: 'String',
30
+ name: 'Simple',
31
+ label: 'Simple label'
32
+ };
33
+ const values = [
34
+ {
35
+ type: attributeType.uri,
36
+ uri: 'entities/sIeHttl/attributes/Simple/u123',
37
+ value: '123',
38
+ ov: true
39
+ },
40
+ {
41
+ type: attributeType.uri,
42
+ uri: 'entities/sIeHttl/attributes/Simple/u456',
43
+ value: '456',
44
+ ov: false
45
+ }
46
+ ];
47
+
48
+ const entityUri = 'entities/sIeHttl';
49
+ const defaultProps = {
50
+ attributeType,
51
+ values,
52
+ parentUri: entityUri,
53
+ showInactive: false,
54
+ noDataText: 'No data found'
55
+ };
56
+ const crosswalks = [{}];
57
+
58
+ const scrollToAttributeError = {
59
+ ref: React.createRef() as React.MutableRefObject<HTMLDivElement>,
60
+ errorClassName: 'errorClassName',
61
+ path: []
62
+ };
63
+ const useScrollToAttributeErrorSpy = jest.spyOn(componentsImport, 'useScrollToAttributeError');
64
+
65
+ beforeEach(() => {
66
+ store = {
67
+ tenant: {
68
+ id: 't1'
69
+ },
70
+ metadata: {
71
+ t1: {
72
+ entityTypes: [],
73
+ relationTypes: [
74
+ {
75
+ uri: 'configuration/relationTypes/relation',
76
+ label: 'Relation'
77
+ }
78
+ ]
79
+ }
80
+ },
81
+ profile: {
82
+ mode: Mode.Editing,
83
+ entity: {
84
+ uri: entityUri,
85
+ attributes: {
86
+ Simple: [...values]
87
+ },
88
+ crosswalks
89
+ },
90
+ modifiedEntities: {
91
+ [entityUri]: {
92
+ uri: entityUri,
93
+ attributes: {
94
+ Simple: [...values]
95
+ },
96
+ crosswalks
97
+ }
98
+ },
99
+ errors: []
100
+ }
101
+ };
102
+ jest.spyOn(reactReduxImports, 'useSelector').mockImplementation((selector) => selector(store));
103
+ jest.spyOn(reactReduxImports, 'useDispatch').mockImplementation(() => dispatch);
104
+ useScrollToAttributeErrorSpy.mockReturnValue(scrollToAttributeError);
105
+ });
106
+
107
+ afterEach(() => {
108
+ jest.clearAllMocks();
109
+ });
110
+
111
+ const findAddButton = (component) => component.find(Button).filterWhere((button) => button.text() === 'Add');
112
+
113
+ const highlightErrorSpy = jest.fn();
114
+ const scrollIntoRefSpy = jest.fn();
115
+
116
+ const setUp = (props, error: AttributeError | null = null) => {
117
+ return mount(
118
+ <ScrollToElementContext.Provider
119
+ value={{
120
+ element: error,
121
+ highlightError: highlightErrorSpy,
122
+ scrollIntoRef: scrollIntoRefSpy,
123
+ type: ScrollType.Error
124
+ }}
125
+ >
126
+ <SingleAttributeEditableContent {...props} />
127
+ </ScrollToElementContext.Provider>
128
+ );
129
+ };
130
+
131
+ it('should render main parts', () => {
132
+ const component = setUp(defaultProps);
133
+ expect(component.find(CardinalityMessage).length).toBe(1);
134
+ expect(component.find(ErrorMessage).length).toBe(1);
135
+ expect(findAddButton(component).length).toBe(1);
136
+ expect(component.find(Divider).length).toBe(0);
137
+ expect(component.find(EditableAttribute).length).toBe(2);
138
+ });
139
+
140
+ it('should render Divider if there are both existing and new values', () => {
141
+ store.profile.modifiedEntities[entityUri].attributes.Simple = [
142
+ {
143
+ type: attributeType.uri,
144
+ uri: 'entities/sIeHttl/attributes/Simple/uri$$123',
145
+ value: '123',
146
+ ov: true
147
+ }
148
+ ];
149
+ const component = setUp(defaultProps);
150
+ expect(component.find(CardinalityMessage).length).toBe(1);
151
+ expect(component.find(ErrorMessage).length).toBe(1);
152
+ expect(findAddButton(component).length).toBe(1);
153
+ expect(component.find(Divider).length).toBe(1);
154
+ expect(component.find(EditableAttribute).length).toBe(3);
155
+ });
156
+
157
+ it('should set correct props for EditableAttribute component (new attributes section)', () => {
158
+ const newVales = [
159
+ {
160
+ type: attributeType.uri,
161
+ uri: 'entities/sIeHttl/attributes/Simple/uri$$123',
162
+ value: '123',
163
+ ov: true
164
+ },
165
+ {
166
+ type: attributeType.uri,
167
+ uri: 'entities/sIeHttl/attributes/Simple/uri$$456',
168
+ value: '456',
169
+ ov: true
170
+ }
171
+ ];
172
+ store.profile.modifiedEntities[entityUri].attributes.Simple = newVales;
173
+ store.profile.errors = [
174
+ {
175
+ parentUri: defaultProps.parentUri,
176
+ uri: newVales[1].uri,
177
+ attributeTypeUri: attributeType.uri,
178
+ message: 'Attribute is invalid',
179
+ type: ErrorType.invalid
180
+ }
181
+ ];
182
+ const props = {
183
+ ...defaultProps,
184
+ values: []
185
+ };
186
+ const component = setUp(props);
187
+ expect(component.find(Divider).length).toBe(0);
188
+ const attributes = component.find(EditableAttribute);
189
+ expect(attributes.length).toBe(2);
190
+ attributes.forEach((attribute, i) => {
191
+ expect(attribute.prop('attributeValue')).toBe(newVales[i]);
192
+ expect(attribute.prop('attributeType')).toBe(props.attributeType);
193
+ expect(attribute.prop('lazy')).toBeFalsy();
194
+ expect(attribute.prop('showEmptyEditors')).toBeFalsy();
195
+ expect(attribute.prop('mode')).toBe(store.profile.mode);
196
+ expect(attribute.prop('crosswalks')).toBe(crosswalks);
197
+ expect(attribute.prop('errors')).toEqual(store.profile.errors);
198
+ expect(attribute.prop('ownError')).toBe(i === 1 ? store.profile.errors[0] : undefined);
199
+ expect(attribute.prop('state')).toBeUndefined();
200
+ expect(attribute.prop('onDeleteAttribute')).toEqual(expect.any(Function));
201
+ expect(attribute.prop('onAddAttributes')).toEqual(expect.any(Function));
202
+ expect(attribute.prop('onChangeAttribute')).toEqual(expect.any(Function));
203
+ expect(attribute.prop('onDeactivateError')).toEqual(expect.any(Function));
204
+ });
205
+ });
206
+
207
+ it('should set correct props for EditableAttribute component (existing attributes section)', () => {
208
+ store.profile.errors = [
209
+ {
210
+ parentUri: defaultProps.parentUri,
211
+ uri: values[1].uri,
212
+ attributeTypeUri: attributeType.uri,
213
+ message: 'Attribute is invalid',
214
+ type: ErrorType.invalid
215
+ }
216
+ ];
217
+ const component = setUp(defaultProps);
218
+ const attributes = component.find(EditableAttribute);
219
+ expect(attributes.length).toBe(2);
220
+ attributes.forEach((attribute, i) => {
221
+ expect(attribute.prop('attributeValue')).toBe(defaultProps.values[i]);
222
+ expect(attribute.prop('attributeType')).toBe(defaultProps.attributeType);
223
+ expect(attribute.prop('lazy')).toBeFalsy();
224
+ expect(attribute.prop('showEmptyEditors')).toBeFalsy();
225
+ expect(attribute.prop('mode')).toBe(store.profile.mode);
226
+ expect(attribute.prop('crosswalks')).toBe(crosswalks);
227
+ expect(attribute.prop('errors')).toEqual(store.profile.errors);
228
+ expect(attribute.prop('ownError')).toBe(i === 1 ? store.profile.errors[0] : undefined);
229
+ expect(attribute.prop('state')).toBeUndefined();
230
+ expect(attribute.prop('onDeleteAttribute')).toEqual(expect.any(Function));
231
+ expect(attribute.prop('onAddAttributes')).toEqual(expect.any(Function));
232
+ expect(attribute.prop('onChangeAttribute')).toEqual(expect.any(Function));
233
+ expect(attribute.prop('onDeactivateError')).toEqual(expect.any(Function));
234
+ });
235
+ });
236
+
237
+ it('should set correct "state" (edited/deleted) prop for EditableAttribute component (existing attributes section)', () => {
238
+ store.profile.modifiedEntities[entityUri].attributes.Simple[1] = {
239
+ ...store.profile.modifiedEntities[entityUri].attributes.Simple[1],
240
+ value: '42'
241
+ };
242
+ store.profile.modifiedEntities[entityUri].attributes.Simple =
243
+ store.profile.modifiedEntities[entityUri].attributes.Simple.slice(1);
244
+
245
+ const component = setUp(defaultProps);
246
+ const attributes = component.find(EditableAttribute);
247
+ expect(attributes.length).toBe(2);
248
+ attributes.forEach((attribute, i) => {
249
+ expect(attribute.prop('state')).toBe(i === 0 ? 'deleted' : 'edited');
250
+ });
251
+ });
252
+
253
+ it('should dispatch correct actions on EditableAttribute component callback props calling (existing attributes section)', () => {
254
+ const component = setUp(defaultProps);
255
+ const attributes = component.find(EditableAttribute);
256
+ expect(attributes.length).toBe(2);
257
+ attributes.forEach((attribute, i) => {
258
+ const onDeleteAttribute = attribute.prop('onDeleteAttribute') as (param: AttributeItem) => void;
259
+ onDeleteAttribute({
260
+ attributeType,
261
+ uri: values[i].uri
262
+ });
263
+ expect(dispatch).toHaveBeenCalledWith(
264
+ profile.actions.removeAttribute({
265
+ attributeType,
266
+ uri: values[i].uri,
267
+ viewId: null
268
+ })
269
+ );
270
+
271
+ const onChangeAttribute = attribute.prop('onChangeAttribute') as (param: AttributeItem) => void;
272
+ onChangeAttribute({
273
+ attributeType,
274
+ uri: values[i].uri,
275
+ value: '12345'
276
+ });
277
+ expect(dispatch).toHaveBeenCalledWith(
278
+ profile.actions.modifyAttribute({
279
+ attributeType,
280
+ uri: values[i].uri,
281
+ value: '12345',
282
+ viewId: null
283
+ })
284
+ );
285
+
286
+ const onAddAttributes = attribute.prop('onAddAttributes') as (params: AttributeItem[]) => void;
287
+ onAddAttributes([
288
+ {
289
+ attributeType,
290
+ parentUri: entityUri
291
+ }
292
+ ]);
293
+ expect(dispatch).toHaveBeenCalledWith(
294
+ profile.actions.addAttributes([
295
+ {
296
+ attributeType,
297
+ parentUri: entityUri,
298
+ viewId: null
299
+ }
300
+ ])
301
+ );
302
+
303
+ const onDeactivateError = attribute.prop('onDeactivateError') as (param: string) => void;
304
+ onDeactivateError('id');
305
+ expect(dispatch).toHaveBeenCalledWith(profile.errors.actions.errorDeactivated('id'));
306
+ });
307
+ });
308
+
309
+ it('should display type-related error inside ErrorMessage component', () => {
310
+ store.profile.errors = [
311
+ {
312
+ parentUri: defaultProps.parentUri,
313
+ uri: '',
314
+ attributeTypeUri: attributeType.uri,
315
+ message: 'Cardinality error',
316
+ type: 'invalid'
317
+ }
318
+ ];
319
+ const component = setUp(defaultProps);
320
+ expect(component.find(ErrorMessage).prop('message')).toBe('Cardinality error');
321
+ });
322
+
323
+ it('should map "missed" error with appropriate attributeTypeUri to first special "empty" attribute value (new attributes section)', () => {
324
+ const attributeType = {
325
+ uri: 'configuration/entityTypes/HCP/attributes/Simple',
326
+ type: 'String',
327
+ name: 'Simple',
328
+ label: 'Simple label',
329
+ required: true
330
+ };
331
+ const entityUri = 'entities/uri$$e1';
332
+ store.profile.entity = {
333
+ ...store.profile.entity,
334
+ uri: entityUri,
335
+ attributes: {}
336
+ };
337
+ store.profile.modifiedEntities[entityUri] = {
338
+ attributes: {}
339
+ };
340
+ store.profile.errors = [
341
+ {
342
+ parentUri: entityUri,
343
+ uri: '',
344
+ attributeTypeUri: attributeType.uri,
345
+ message: 'Attribute is invalid',
346
+ type: ErrorType.invalid
347
+ },
348
+ {
349
+ parentUri: entityUri,
350
+ uri: '',
351
+ attributeTypeUri: attributeType.uri,
352
+ message: 'Attribute is required',
353
+ type: ErrorType.missed
354
+ }
355
+ ];
356
+ const props = {
357
+ ...defaultProps,
358
+ values: [],
359
+ parentUri: entityUri,
360
+ attributeType
361
+ };
362
+ const component = setUp(props);
363
+ expect(component.find(EditableAttribute).prop('ownError')).toBe(store.profile.errors[1]);
364
+ });
365
+
366
+ it('should not render special "empty" attribute if there are no values in modified entity and entity is temporary', () => {
367
+ const entityUri = 'entities/uri$$e1';
368
+ store.profile.entity = {
369
+ ...store.profile.entity,
370
+ uri: entityUri,
371
+ attributes: {}
372
+ };
373
+ store.profile.modifiedEntities[entityUri] = {
374
+ attributes: {}
375
+ };
376
+ const props = {
377
+ ...defaultProps,
378
+ values: [],
379
+ parentUri: entityUri,
380
+ attributeType
381
+ };
382
+ const component = setUp(props);
383
+ const attribute = component.find(EditableAttribute);
384
+ expect(attribute.length).toBe(0);
385
+ });
386
+
387
+ it('should render special "empty" attribute if there are no values in modified entity and attribute is required', () => {
388
+ const props = {
389
+ ...defaultProps,
390
+ attributeType: {
391
+ ...attributeType,
392
+ required: true
393
+ },
394
+ values: []
395
+ };
396
+ store.profile.modifiedEntities[entityUri] = {
397
+ attributes: {}
398
+ };
399
+ const component = setUp(props);
400
+ const attribute = component.find(EditableAttribute);
401
+ expect(attribute.length).toBe(1);
402
+ expect(attribute.prop('attributeValue')).toEqual({
403
+ type: attributeType.uri,
404
+ uri: expect.stringContaining(`${entityUri}/attributes/Simple/uri$$`),
405
+ value: '',
406
+ ov: true
407
+ });
408
+ });
409
+
410
+ it('should not render Add button if there is no CREATE permission', () => {
411
+ const props = {
412
+ ...defaultProps,
413
+ attributeType: {
414
+ ...attributeType,
415
+ access: ['READ', 'UPDATE']
416
+ },
417
+ values: []
418
+ };
419
+ const component = setUp(props);
420
+ expect(findAddButton(component).length).toBe(0);
421
+ });
422
+
423
+ it('should add 2 attributes on Add button click if there is simple "empty" attribute value', () => {
424
+ const props = {
425
+ ...defaultProps,
426
+ attributeType: {
427
+ ...attributeType,
428
+ required: true
429
+ },
430
+ values: []
431
+ };
432
+ store.profile.modifiedEntities[entityUri] = {
433
+ attributes: {}
434
+ };
435
+ const component = setUp(props);
436
+ expect(component.find(EditableAttribute).length).toBe(1);
437
+ findAddButton(component).prop('onClick')();
438
+ expect(dispatch).toHaveBeenCalledTimes(1);
439
+ expect(dispatch).toHaveBeenCalledWith(
440
+ profile.actions.addAttributes([
441
+ {
442
+ parentUri: props.parentUri,
443
+ attributeType: props.attributeType,
444
+ viewId: null
445
+ },
446
+ {
447
+ parentUri: props.parentUri,
448
+ attributeType: props.attributeType,
449
+ viewId: null
450
+ }
451
+ ])
452
+ );
453
+ });
454
+
455
+ it('should add 1 attribute on Add button click if there are no values', () => {
456
+ const props = {
457
+ ...defaultProps,
458
+ values: []
459
+ };
460
+ store.profile.modifiedEntities[entityUri] = {
461
+ attributes: {}
462
+ };
463
+ const component = setUp(props);
464
+ expect(component.find(EditableAttribute).length).toBe(0);
465
+ findAddButton(component).prop('onClick')();
466
+ expect(dispatch).toHaveBeenCalledTimes(1);
467
+ expect(dispatch).toHaveBeenCalledWith(
468
+ profile.actions.addAttributes([
469
+ {
470
+ parentUri: props.parentUri,
471
+ attributeType: props.attributeType,
472
+ viewId: null
473
+ }
474
+ ])
475
+ );
476
+ });
477
+
478
+ it('should add 1 attribute on Add button click if there is Nested "empty" attribute value', () => {
479
+ const props = {
480
+ ...defaultProps,
481
+ attributeType: {
482
+ ...attributeType,
483
+ type: 'Nested',
484
+ required: true
485
+ },
486
+ values: []
487
+ };
488
+ store.profile.modifiedEntities[entityUri] = {
489
+ attributes: {}
490
+ };
491
+ const component = setUp(props);
492
+ expect(component.find(EditableAttribute).length).toBe(1);
493
+ findAddButton(component).prop('onClick')();
494
+ expect(dispatch).toHaveBeenCalledTimes(1);
495
+ expect(dispatch).toHaveBeenCalledWith(
496
+ profile.actions.addAttributes([
497
+ {
498
+ parentUri: props.parentUri,
499
+ attributeType: props.attributeType,
500
+ viewId: null
501
+ }
502
+ ])
503
+ );
504
+ });
505
+
506
+ it('should set correct class name for attribute wrapper if ov:false', () => {
507
+ const component = setUp(defaultProps);
508
+ expect(component.find('div.ovFalse').length).toBe(1);
509
+ });
510
+
511
+ it('should render "No data found" if there are no values and new values', () => {
512
+ const props = {
513
+ ...defaultProps,
514
+ values: []
515
+ };
516
+ const component = setUp(props);
517
+ const attributes = component.find(EditableAttribute);
518
+ expect(attributes.length).toBe(0);
519
+ expect(component.find('p.noData').text()).toBe('No data found');
520
+ });
521
+
522
+ describe('useScrollToAttributeError tests', () => {
523
+ const fullError = {
524
+ type: 'invalid',
525
+ attributeTypeUri: attributeType.uri,
526
+ parentUri: defaultProps.parentUri,
527
+ uri: 'entities/sIeHttl/attributes/Address',
528
+ source: 'validationService',
529
+ severity: 'ERROR'
530
+ } as AttributeError;
531
+ it('should not highlight error if it have uri', () => {
532
+ const component = setUp(defaultProps, fullError);
533
+ expect(component.find('SingleAttributeEditableContent').prop('highlightedError')).toBe(null);
534
+ expect(useScrollToAttributeErrorSpy.mock.calls[0][0]).toMatchObject({
535
+ highlightedError: null
536
+ });
537
+ });
538
+ it('should highlight error if it have same parent uri, empty uri, and attribute type uri', () => {
539
+ const error = {...fullError, uri: ''};
540
+ const component = setUp(defaultProps, error);
541
+ const highlightedError = {
542
+ element: error,
543
+ highlightError: highlightErrorSpy,
544
+ scrollIntoRef: scrollIntoRefSpy,
545
+ type: ScrollType.Error
546
+ };
547
+ expect(component.find('SingleAttributeEditableContent').prop('highlightedError')).toMatchObject(
548
+ highlightedError
549
+ );
550
+ expect(useScrollToAttributeErrorSpy.mock.calls[0][0]).toMatchObject({highlightedError});
551
+ });
552
+ });
553
+
554
+ it('should render nothing if there is no modified entity in store', () => {
555
+ store.profile.modifiedEntities = {};
556
+ const component = setUp(defaultProps);
557
+ expect(component.find('SingleAttributeEditableContent').children()).toHaveLength(0);
558
+ });
559
+ });
@@ -0,0 +1,28 @@
1
+ import {makeStyles} from '@mui/styles';
2
+
3
+ export const useStyles = makeStyles((theme) => ({
4
+ moreButton: {
5
+ padding: '9px 16px 9px 12px',
6
+ backgroundColor: 'rgba(98, 2, 238, 0)',
7
+ marginBottom: '4px'
8
+ },
9
+ buttonLabel: {
10
+ fontSize: '14px',
11
+ fontWeight: 500,
12
+ lineHeight: '16px'
13
+ },
14
+ icon: {
15
+ fontSize: '18px',
16
+ marginRight: '8px'
17
+ },
18
+ divider: {
19
+ margin: '0 -16px 8px',
20
+ borderColor: 'rgba(0,0,0,0.12)'
21
+ },
22
+ ovFalse: theme.inactive,
23
+ noData: {
24
+ fontSize: '13px',
25
+ color: theme.palette.text.secondary,
26
+ padding: '8px 16px 8px 0'
27
+ }
28
+ }));
@@ -0,0 +1,58 @@
1
+ import React, {useContext} from 'react';
2
+ import i18n from 'ui-i18n';
3
+ import {
4
+ FacetViewHeader,
5
+ HideOnShrink,
6
+ ExpandableSearchInput,
7
+ VerticalDivider,
8
+ OvIcon,
9
+ DescriptionIcon,
10
+ RequiredMark
11
+ } from '@reltio/components';
12
+ import Typography from '@mui/material/Typography';
13
+ import {SingleAttributeContext} from '../../contexts/SingleAttributeContext';
14
+ import FilterButton from '../FilterButton/FilterButton';
15
+ import {useStyles} from './styles';
16
+
17
+ type Props = {
18
+ caption: string;
19
+ totalVisibleValues: number;
20
+ showInactiveValuesMenu: boolean;
21
+ isEditableMode: boolean;
22
+ };
23
+
24
+ export const SingleAttributeHeader = ({caption, totalVisibleValues, showInactiveValuesMenu, isEditableMode}: Props) => {
25
+ const styles = useStyles();
26
+
27
+ const {searchQuery, setSearchQuery, setPage, totalNonVisibleValues, nonVisibleValues, attributeType} =
28
+ useContext(SingleAttributeContext);
29
+
30
+ const handleChangeSearchQuery = (query: string) => {
31
+ setSearchQuery(query);
32
+ setPage(0);
33
+ };
34
+ const showRequiredMark = isEditableMode && attributeType?.required;
35
+ return (
36
+ <FacetViewHeader title={caption} className={styles.root}>
37
+ {showRequiredMark && <RequiredMark />}
38
+ <DescriptionIcon description={attributeType?.description} />
39
+ <HideOnShrink widthToHide={500}>
40
+ <VerticalDivider height={24} margin={16} />
41
+ <Typography className={styles.totalCaption} variant="caption">
42
+ {i18n.number(totalVisibleValues)}{' '}
43
+ {totalVisibleValues === 1 ? i18n.text('item') : i18n.text('items')}
44
+ </Typography>
45
+ </HideOnShrink>
46
+ {
47
+ <OvIcon
48
+ nonOvTotal={totalNonVisibleValues}
49
+ className={styles.ovIcon}
50
+ nonOvValues={nonVisibleValues}
51
+ attributeType={attributeType}
52
+ />
53
+ }
54
+ <ExpandableSearchInput query={searchQuery} onChange={handleChangeSearchQuery} />
55
+ {showInactiveValuesMenu && <FilterButton />}
56
+ </FacetViewHeader>
57
+ );
58
+ };