@leav/ui 0.4.0-80a4e22 → 0.4.0-8a31349

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 (350) hide show
  1. package/dist/__mocks__/common/form.js +5 -1
  2. package/dist/__mocks__/common/form.js.map +1 -1
  3. package/dist/__mocks__/common/value.d.ts +1 -2
  4. package/dist/__mocks__/common/value.js +0 -11
  5. package/dist/__mocks__/common/value.js.map +1 -1
  6. package/dist/_gqlTypes/index.d.ts +200 -0
  7. package/dist/_gqlTypes/index.js +93 -0
  8. package/dist/_gqlTypes/index.js.map +1 -1
  9. package/dist/_queries/records/getRecordFormQuery.js +4 -0
  10. package/dist/_queries/records/getRecordFormQuery.js.map +1 -1
  11. package/dist/components/CreateDirectory/CreateDirectory.js +4 -4
  12. package/dist/components/CreateDirectory/CreateDirectory.js.map +1 -1
  13. package/dist/components/EditLibraryModal/EditLibrary/EditLibraryAttributes/AttributesList/DeleteButton/DeleteButton.js +3 -2
  14. package/dist/components/EditLibraryModal/EditLibrary/EditLibraryAttributes/AttributesList/DeleteButton/DeleteButton.js.map +1 -1
  15. package/dist/components/EditTreeModal/EditTree/EditTreeInfo/EditTreeInfoForm/TreeLibrariesForm/TreeLibrariesForm.js +8 -1
  16. package/dist/components/EditTreeModal/EditTree/EditTreeInfo/EditTreeInfoForm/TreeLibrariesForm/TreeLibrariesForm.js.map +1 -1
  17. package/dist/components/ErrorBoundary/ErrorBoundaryContent/ErrorBoundaryContent.d.ts +2 -2
  18. package/dist/components/ErrorBoundary/ErrorBoundaryContent/ErrorBoundaryContent.js +4 -3
  19. package/dist/components/ErrorBoundary/ErrorBoundaryContent/ErrorBoundaryContent.js.map +1 -1
  20. package/dist/components/Explorer/DataView.js +24 -7
  21. package/dist/components/Explorer/DataView.js.map +1 -1
  22. package/dist/components/Explorer/Explorer.d.ts +3 -1
  23. package/dist/components/Explorer/Explorer.js +21 -8
  24. package/dist/components/Explorer/Explorer.js.map +1 -1
  25. package/dist/components/Explorer/IdCard.js +1 -1
  26. package/dist/components/Explorer/IdCard.js.map +1 -1
  27. package/dist/components/Explorer/TableCell.js +3 -3
  28. package/dist/components/Explorer/TableCell.js.map +1 -1
  29. package/dist/components/Explorer/TableTagGroup.d.ts +0 -1
  30. package/dist/components/Explorer/TableTagGroup.js +3 -16
  31. package/dist/components/Explorer/TableTagGroup.js.map +1 -1
  32. package/dist/components/Explorer/_constants.d.ts +3 -0
  33. package/dist/components/Explorer/_constants.js +3 -0
  34. package/dist/components/Explorer/_constants.js.map +1 -1
  35. package/dist/components/Explorer/_queries/useExplorerData.d.ts +1 -0
  36. package/dist/components/Explorer/_queries/useExplorerData.js +16 -10
  37. package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
  38. package/dist/components/Explorer/_types.d.ts +7 -1
  39. package/dist/components/Explorer/_types.js.map +1 -1
  40. package/dist/components/Explorer/actions-item/useEditItemAction.d.ts +2 -1
  41. package/dist/components/Explorer/actions-item/useEditItemAction.js +6 -4
  42. package/dist/components/Explorer/actions-item/useEditItemAction.js.map +1 -1
  43. package/dist/components/Explorer/actions-item/useRemoveItemAction.d.ts +3 -1
  44. package/dist/components/Explorer/actions-item/useRemoveItemAction.js +12 -2
  45. package/dist/components/Explorer/actions-item/useRemoveItemAction.js.map +1 -1
  46. package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +21 -0
  47. package/dist/components/Explorer/actions-item/useReplaceItemAction.js +42 -0
  48. package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -0
  49. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.d.ts +2 -1
  50. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +12 -3
  51. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
  52. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +5 -5
  53. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
  54. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.d.ts +2 -1
  55. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +10 -3
  56. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
  57. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +5 -2
  58. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +20 -4
  59. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
  60. package/dist/components/Explorer/link-item/LinkModal.d.ts +2 -0
  61. package/dist/components/Explorer/link-item/LinkModal.js +14 -4
  62. package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
  63. package/dist/components/Explorer/link-item/{useLinkMassAction.d.ts → useAddLinkMassAction.d.ts} +1 -1
  64. package/dist/components/Explorer/link-item/{useLinkMassAction.js → useAddLinkMassAction.js} +2 -2
  65. package/dist/components/Explorer/link-item/useAddLinkMassAction.js.map +1 -0
  66. package/dist/components/Explorer/link-item/useReplaceLinkMassAction.d.ts +23 -0
  67. package/dist/components/Explorer/link-item/useReplaceLinkMassAction.js +35 -0
  68. package/dist/components/Explorer/link-item/useReplaceLinkMassAction.js.map +1 -0
  69. package/dist/components/Explorer/list-saved-views/SavedViews.js +32 -42
  70. package/dist/components/Explorer/list-saved-views/SavedViews.js.map +1 -1
  71. package/dist/components/Explorer/manage-view-settings/_shared/useAttributeDetailsData.js +11 -9
  72. package/dist/components/Explorer/manage-view-settings/_shared/useAttributeDetailsData.js.map +1 -1
  73. package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.d.ts +4 -0
  74. package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.js.map +1 -1
  75. package/dist/components/Explorer/manage-view-settings/open-view-settings/EditSettingsContext.d.ts +1 -1
  76. package/dist/components/Explorer/manage-view-settings/open-view-settings/EditSettingsContext.js.map +1 -1
  77. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +2 -2
  78. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
  79. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js +1 -1
  80. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js.map +1 -1
  81. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js +1 -1
  82. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js.map +1 -1
  83. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js +1 -1
  84. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js.map +1 -1
  85. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.d.ts +5 -0
  86. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js +47 -0
  87. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js.map +1 -0
  88. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.d.ts +5 -0
  89. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js +48 -0
  90. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js.map +1 -0
  91. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js +1 -1
  92. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js.map +1 -1
  93. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js +1 -1
  94. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js.map +1 -1
  95. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.d.ts +1 -0
  96. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js +3 -2
  97. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js.map +1 -1
  98. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.d.ts +8 -1
  99. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js +30 -0
  100. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
  101. package/dist/components/Explorer/useColumnWidth.js +2 -1
  102. package/dist/components/Explorer/useColumnWidth.js.map +1 -1
  103. package/dist/components/Explorer/useLoadView.js +4 -2
  104. package/dist/components/Explorer/useLoadView.js.map +1 -1
  105. package/dist/components/Explorer/usePagination.d.ts +2 -1
  106. package/dist/components/Explorer/usePagination.js.map +1 -1
  107. package/dist/components/Explorer/useSearchInput.d.ts +3 -1
  108. package/dist/components/Explorer/useSearchInput.js +2 -1
  109. package/dist/components/Explorer/useSearchInput.js.map +1 -1
  110. package/dist/components/Explorer/useViewSettingsReducer.d.ts +1 -1
  111. package/dist/components/Explorer/useViewSettingsReducer.js +37 -17
  112. package/dist/components/Explorer/useViewSettingsReducer.js.map +1 -1
  113. package/dist/components/ImportModal/ImportModalConfigStep/ImportModalConfigStep.js +1 -1
  114. package/dist/components/ImportModal/ImportModalConfigStep/ImportModalConfigStep.js.map +1 -1
  115. package/dist/components/LibraryItemsList/CreateNewRecordButton/CreateNewRecordButton.js +1 -0
  116. package/dist/components/LibraryItemsList/CreateNewRecordButton/CreateNewRecordButton.js.map +1 -1
  117. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js +2 -2
  118. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js.map +1 -1
  119. package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.d.ts +4 -0
  120. package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.js +4 -1
  121. package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.js.map +1 -1
  122. package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/DeactivateRecordBtn.js +3 -3
  123. package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/DeactivateRecordBtn.js.map +1 -1
  124. package/dist/components/RecordEdition/EditRecord/EditRecord.d.ts +2 -4
  125. package/dist/components/RecordEdition/EditRecord/EditRecord.js +37 -39
  126. package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
  127. package/dist/components/RecordEdition/EditRecordButtons/EditRecordButtons.d.ts +2 -0
  128. package/dist/components/RecordEdition/EditRecordButtons/EditRecordButtons.js +43 -0
  129. package/dist/components/RecordEdition/EditRecordButtons/EditRecordButtons.js.map +1 -0
  130. package/dist/components/RecordEdition/EditRecordButtons/SidebarButton.d.ts +2 -0
  131. package/dist/components/RecordEdition/EditRecordButtons/SidebarButton.js +25 -0
  132. package/dist/components/RecordEdition/EditRecordButtons/SidebarButton.js.map +1 -0
  133. package/dist/components/RecordEdition/EditRecordButtons/index.d.ts +2 -0
  134. package/dist/components/RecordEdition/{EditRecordContent/uiElements/TreeField/TreeFieldValue → EditRecordButtons}/index.js +2 -2
  135. package/dist/components/RecordEdition/EditRecordButtons/index.js.map +1 -0
  136. package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.d.ts +3 -1
  137. package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js +12 -3
  138. package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js.map +1 -1
  139. package/dist/components/RecordEdition/EditRecordContent/_types.d.ts +5 -0
  140. package/dist/components/RecordEdition/EditRecordContent/_types.js.map +1 -1
  141. package/dist/components/RecordEdition/EditRecordContent/formConstants.d.ts +1 -0
  142. package/dist/components/RecordEdition/EditRecordContent/formConstants.js +1 -0
  143. package/dist/components/RecordEdition/EditRecordContent/formConstants.js.map +1 -1
  144. package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.d.ts +1 -1
  145. package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js +2 -2
  146. package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js.map +1 -1
  147. package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.d.ts +1 -1
  148. package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js +39 -11
  149. package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js.map +1 -1
  150. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.d.ts +7 -1
  151. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +100 -92
  152. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
  153. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.d.ts +5 -0
  154. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js +39 -0
  155. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js.map +1 -0
  156. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.d.ts +8 -0
  157. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js +23 -0
  158. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js.map +1 -0
  159. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.d.ts +9 -0
  160. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js +23 -0
  161. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js.map +1 -0
  162. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.d.ts +8 -0
  163. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js +26 -0
  164. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js.map +1 -0
  165. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.d.ts +12 -0
  166. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js +24 -0
  167. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js.map +1 -0
  168. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.d.ts +19 -0
  169. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js +103 -0
  170. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js.map +1 -0
  171. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.d.ts +22 -0
  172. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js +104 -0
  173. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js.map +1 -0
  174. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.d.ts +22 -0
  175. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.js +85 -0
  176. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.js.map +1 -0
  177. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.d.ts +26 -0
  178. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js +105 -0
  179. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js.map +1 -0
  180. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.d.ts +265 -0
  181. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.js +13 -0
  182. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.js.map +1 -0
  183. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.d.ts +9 -0
  184. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js +15 -0
  185. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js.map +1 -0
  186. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.d.ts +4 -0
  187. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js +22 -0
  188. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js.map +1 -0
  189. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +34 -47
  190. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
  191. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js +1 -2
  192. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js.map +1 -1
  193. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js +1 -2
  194. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js.map +1 -1
  195. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js +1 -2
  196. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js.map +1 -1
  197. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.js +2 -5
  198. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.js.map +1 -1
  199. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js +1 -2
  200. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js.map +1 -1
  201. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js +1 -2
  202. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js.map +1 -1
  203. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js +1 -2
  204. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js.map +1 -1
  205. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js +1 -2
  206. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js.map +1 -1
  207. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.d.ts +2 -3
  208. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js +2 -3
  209. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js.map +1 -1
  210. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js +2 -5
  211. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js.map +1 -1
  212. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/_types.d.ts +1 -2
  213. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.d.ts +4 -2
  214. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +67 -215
  215. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
  216. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.d.ts +265 -0
  217. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.js +13 -0
  218. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.js.map +1 -0
  219. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.d.ts +10 -0
  220. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +51 -0
  221. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -0
  222. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.d.ts +11 -0
  223. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.js +8 -0
  224. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.js.map +1 -0
  225. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +15 -0
  226. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +44 -0
  227. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -0
  228. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +23 -0
  229. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +145 -0
  230. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -0
  231. package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/ComputeIndicator.d.ts +4 -2
  232. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -0
  233. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.d.ts +8 -0
  234. package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/DeleteAllValuesButton.js +2 -2
  235. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.js.map +1 -0
  236. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.js.map +1 -0
  237. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.d.ts +17 -0
  238. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.js +76 -0
  239. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.js.map +1 -0
  240. package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.d.ts +3 -0
  241. package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +51 -51
  242. package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js.map +1 -1
  243. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.d.ts +2 -1
  244. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js +9 -7
  245. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js.map +1 -1
  246. package/dist/components/RecordEdition/EditRecordSidebar/Breacrumb/Breadcrumb.js +2 -2
  247. package/dist/components/RecordEdition/EditRecordSidebar/Breacrumb/Breadcrumb.js.map +1 -1
  248. package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.d.ts +0 -1
  249. package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js +18 -12
  250. package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js.map +1 -1
  251. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +3 -0
  252. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
  253. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js +2 -2
  254. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js.map +1 -1
  255. package/dist/components/RecordEdition/constants.d.ts +2 -0
  256. package/dist/components/RecordEdition/constants.js +6 -0
  257. package/dist/components/RecordEdition/constants.js.map +1 -0
  258. package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.d.ts +29 -3
  259. package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js +65 -5
  260. package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js.map +1 -1
  261. package/dist/components/RecordEdition/hooks/useGetSubmitButtons.d.ts +1 -1
  262. package/dist/components/RecordEdition/hooks/useGetSubmitButtons.js +3 -3
  263. package/dist/components/RecordEdition/hooks/useGetSubmitButtons.js.map +1 -1
  264. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +2 -0
  265. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +8 -6
  266. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
  267. package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +3 -1
  268. package/dist/components/SelectTreeNode/SelectTreeNode.js +4 -4
  269. package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
  270. package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +3 -1
  271. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +14 -6
  272. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
  273. package/dist/components/SelectTreeNode/SelectTreeNodeContentSkeleton.d.ts +2 -0
  274. package/dist/components/SelectTreeNode/SelectTreeNodeContentSkeleton.js +17 -0
  275. package/dist/components/SelectTreeNode/SelectTreeNodeContentSkeleton.js.map +1 -0
  276. package/dist/components/SelectTreeNode/TreeNodeTitle.d.ts +9 -0
  277. package/dist/components/SelectTreeNode/TreeNodeTitle.js +8 -0
  278. package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -0
  279. package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.js +1 -1
  280. package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.js.map +1 -1
  281. package/dist/components/SimpleErrorBoundary/SimpleErrorBoundary.d.ts +1 -1
  282. package/dist/components/SimpleErrorBoundary/SimpleErrorBoundary.js.map +1 -1
  283. package/dist/components/SimpleErrorBoundary/SimpleErrorBoundaryContent/SimpleErrorBoundaryContent.d.ts +2 -2
  284. package/dist/components/SimpleErrorBoundary/SimpleErrorBoundaryContent/SimpleErrorBoundaryContent.js +6 -3
  285. package/dist/components/SimpleErrorBoundary/SimpleErrorBoundaryContent/SimpleErrorBoundaryContent.js.map +1 -1
  286. package/dist/components/UploadFiles/UploadFiles.js +4 -4
  287. package/dist/components/UploadFiles/UploadFiles.js.map +1 -1
  288. package/dist/constants.d.ts +3 -1
  289. package/dist/constants.js +3 -1
  290. package/dist/constants.js.map +1 -1
  291. package/dist/hooks/useAppLang/useAppLang.js.map +1 -1
  292. package/dist/locales/en/shared.json +27 -12
  293. package/dist/locales/fr/shared.json +27 -12
  294. package/dist/types/trees.d.ts +1 -0
  295. package/package.json +4 -4
  296. package/dist/components/Explorer/link-item/useLinkMassAction.js.map +0 -1
  297. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/FloatingMenuHandler.d.ts +0 -14
  298. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/FloatingMenuHandler.js +0 -29
  299. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/FloatingMenuHandler.js.map +0 -1
  300. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/index.d.ts +0 -2
  301. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/index.js +0 -6
  302. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/index.js.map +0 -1
  303. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.d.ts +0 -20
  304. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.js +0 -53
  305. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.js.map +0 -1
  306. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/useGetOptionsQuery.d.ts +0 -19
  307. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/useGetOptionsQuery.js +0 -111
  308. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/useGetOptionsQuery.js.map +0 -1
  309. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.d.ts +0 -20
  310. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.js +0 -71
  311. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.js.map +0 -1
  312. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/useGetOptionsQuery.d.ts +0 -14
  313. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/useGetOptionsQuery.js +0 -58
  314. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/useGetOptionsQuery.js.map +0 -1
  315. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/RecordIdentityCell.d.ts +0 -6
  316. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/RecordIdentityCell.js +0 -11
  317. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/RecordIdentityCell.js.map +0 -1
  318. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/index.d.ts +0 -2
  319. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/index.js +0 -6
  320. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/index.js.map +0 -1
  321. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/QuickSearch.d.ts +0 -13
  322. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/QuickSearch.js +0 -50
  323. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/QuickSearch.js.map +0 -1
  324. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/index.d.ts +0 -2
  325. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/index.js +0 -6
  326. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/index.js.map +0 -1
  327. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/ValuesAdd.d.ts +0 -9
  328. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/ValuesAdd.js +0 -215
  329. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/ValuesAdd.js.map +0 -1
  330. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/index.d.ts +0 -2
  331. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/index.js +0 -6
  332. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/index.js.map +0 -1
  333. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/ComputeIndicator.js.map +0 -1
  334. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/DeleteAllValuesButton.d.ts +0 -4
  335. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/DeleteAllValuesButton.js.map +0 -1
  336. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/calculatedInheritedFlags.js.map +0 -1
  337. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeFieldValue/TreeFieldValue.d.ts +0 -10
  338. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeFieldValue/TreeFieldValue.js +0 -50
  339. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeFieldValue/TreeFieldValue.js.map +0 -1
  340. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeFieldValue/index.d.ts +0 -2
  341. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeFieldValue/index.js.map +0 -1
  342. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.d.ts +0 -9
  343. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.js +0 -106
  344. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.js.map +0 -1
  345. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/index.d.ts +0 -2
  346. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/index.js +0 -6
  347. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/index.js.map +0 -1
  348. /package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/ComputeIndicator.js +0 -0
  349. /package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/calculatedInheritedFlags.d.ts +0 -0
  350. /package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/calculatedInheritedFlags.js +0 -0
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
3
+ // This file is released under LGPL V3
4
+ // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
+ import { useMemo, useState } from 'react';
6
+ import { FaExchangeAlt } from 'react-icons/fa';
7
+ import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
8
+ import { LinkModal } from '../link-item/LinkModal';
9
+ /**
10
+ * Hook used to get the action for `<DataView />` component.
11
+ *
12
+ * When the mutation for replaceing is done, the Apollo cache will be refreshed (`Record` and `RecordIdentity`)
13
+ * from only replaceed record.
14
+ *
15
+ * It returns also two parts : one for the action button call - one for displaying the modal required by the action.
16
+ *
17
+ * @param isEnabled - whether the action is present
18
+ * @param onReplace - callback to let outside world know about replacing feedback
19
+ * @param canReplaceLinkValues - check permission to delete link values
20
+ */
21
+ export const useReplaceItemAction = ({ isEnabled, onReplace, canReplaceLinkValues }) => {
22
+ const { t } = useSharedTranslation();
23
+ const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);
24
+ const [linkIdSelected, setLinkIdSelected] = useState();
25
+ const _replaceItemAction = useMemo(() => ({
26
+ label: t('explorer.replace-item'),
27
+ icon: _jsx(FaExchangeAlt, {}),
28
+ disabled: !canReplaceLinkValues,
29
+ callback: item => {
30
+ setLinkIdSelected(item.id_value);
31
+ setIsReplaceModalOpen(!isReplaceModalOpen);
32
+ }
33
+ }), [canReplaceLinkValues]);
34
+ const replaceAction = useMemo(() => ({
35
+ replaceItemAction: isEnabled ? _replaceItemAction : null,
36
+ replaceItemModal: isEnabled && isReplaceModalOpen ? (_jsx(LinkModal, { open: true, linkId: linkIdSelected, onReplace: onReplace, onClose: () => {
37
+ setIsReplaceModalOpen(false);
38
+ } })) : null
39
+ }), [isEnabled, isReplaceModalOpen, _replaceItemAction]);
40
+ return replaceAction;
41
+ };
42
+ //# sourceMappingURL=useReplaceItemAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReplaceItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useReplaceItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,oBAAoB,EAItB,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAAsB,CAAC;IAE3E,MAAM,kBAAkB,GAAgB,OAAO,CAC3C,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAC;QACjC,IAAI,EAAE,KAAC,aAAa,KAAG;QACvB,QAAQ,EAAE,CAAC,oBAAoB;QAC/B,QAAQ,EAAE,IAAI,CAAC,EAAE;YACb,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,qBAAqB,CAAC,CAAC,kBAAkB,CAAC,CAAC;QAC/C,CAAC;KACJ,CAAC,EACF,CAAC,oBAAoB,CAAC,CACzB,CAAC;IAEF,MAAM,aAAa,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,CAAC;QACH,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QACxD,gBAAgB,EACZ,SAAS,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAC9B,KAAC,SAAS,IACN,IAAI,QACJ,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC,EACF,CAAC,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CACtD,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC"}
@@ -15,12 +15,13 @@ import type { useExplorerData } from '../_queries/useExplorerData';
15
15
  * @param allVisibleKeys - list of all visible keys used to know if we need to change page
16
16
  * @param refetch - method to get fresh data when we delete last page
17
17
  */
18
- export declare const useDeactivateMassAction: ({ isEnabled, store: { view, dispatch }, allVisibleKeys, onDeactivate, refetch }: FeatureHook<{
18
+ export declare const useDeactivateMassAction: ({ isEnabled, store: { view, dispatch }, allVisibleKeys, totalCount, onDeactivate, refetch }: FeatureHook<{
19
19
  store: {
20
20
  view: IViewSettingsState;
21
21
  dispatch: Dispatch<IViewSettingsAction>;
22
22
  };
23
23
  allVisibleKeys: string[];
24
+ totalCount: number;
24
25
  onDeactivate?: IMassActions["callback"];
25
26
  refetch: ReturnType<typeof useExplorerData>["refetch"];
26
27
  }>) => {
@@ -4,7 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
5
  import { useMemo } from 'react';
6
6
  import { FaTrash } from 'react-icons/fa';
7
- import { KitModal } from 'aristid-ds';
7
+ import { KitModal, useKitNotification } from 'aristid-ds';
8
8
  import { useDeactivateRecordsMutation } from '../../../_gqlTypes';
9
9
  import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
10
10
  import { ViewSettingsActionTypes } from '../manage-view-settings';
@@ -22,8 +22,9 @@ import { MASS_SELECTION_ALL } from '../_constants';
22
22
  * @param allVisibleKeys - list of all visible keys used to know if we need to change page
23
23
  * @param refetch - method to get fresh data when we delete last page
24
24
  */
25
- export const useDeactivateMassAction = ({ isEnabled, store: { view, dispatch }, allVisibleKeys, onDeactivate, refetch }) => {
25
+ export const useDeactivateMassAction = ({ isEnabled, store: { view, dispatch }, allVisibleKeys, totalCount, onDeactivate, refetch }) => {
26
26
  const { t } = useSharedTranslation();
27
+ const { kitNotification } = useKitNotification();
27
28
  const [deactivateRecordsMutation] = useDeactivateRecordsMutation();
28
29
  const _deactivateMassAction = useMemo(() => ({
29
30
  label: t('explorer.massAction.deactivate'),
@@ -38,12 +39,20 @@ export const useDeactivateMassAction = ({ isEnabled, store: { view, dispatch },
38
39
  okText: t('global.submit') ?? undefined,
39
40
  cancelText: t('global.cancel') ?? undefined,
40
41
  onOk: async () => {
41
- await deactivateRecordsMutation({
42
+ const { data } = await deactivateRecordsMutation({
42
43
  variables: {
43
44
  libraryId: view.libraryId,
44
45
  filters: massSelectionFilter
45
46
  }
46
47
  });
48
+ const total = view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length;
49
+ kitNotification.info({
50
+ message: t('explorer.massAction.deactivate_message', {
51
+ count: data?.deactivateRecords.length,
52
+ total
53
+ }),
54
+ description: null
55
+ });
47
56
  if (view.massSelection === MASS_SELECTION_ALL ||
48
57
  allVisibleKeys.every(key => view.massSelection.includes(key))) {
49
58
  await refetch({
@@ -1 +1 @@
1
- {"version":3,"file":"useDeactivateMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useDeactivateMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAW,OAAO,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,4BAA4B,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAA0C,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AACzG,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAGjD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACpC,SAAS,EACT,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EACvB,cAAc,EACd,YAAY,EACZ,OAAO,EAST,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,CAAC,yBAAyB,CAAC,GAAG,4BAA4B,EAAE,CAAC;IAEnE,MAAM,qBAAqB,GAAiB,OAAO,CAC/C,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,CAAC,CAAC,gCAAgC,CAAC;QAC1C,IAAI,EAAE,KAAC,OAAO,KAAG;QACjB,QAAQ,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AE,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,CAAC,CACxG,CAAC;IAEF,OAAO;QACH,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI;KACjE,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"file":"useDeactivateMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useDeactivateMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAW,OAAO,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAE,kBAAkB,EAAC,MAAM,YAAY,CAAC;AACxD,OAAO,EAAC,4BAA4B,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAA0C,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AACzG,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAGjD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACpC,SAAS,EACT,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EACvB,cAAc,EACd,UAAU,EACV,YAAY,EACZ,OAAO,EAUT,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,EAAC,eAAe,EAAC,GAAG,kBAAkB,EAAE,CAAC;IAE/C,MAAM,CAAC,yBAAyB,CAAC,GAAG,4BAA4B,EAAE,CAAC;IAEnE,MAAM,qBAAqB,GAAiB,OAAO,CAC/C,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,CAAC,CAAC,gCAAgC,CAAC;QAC1C,IAAI,EAAE,KAAC,OAAO,KAAG;QACj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ACJ,CAAC,CAAC;oBACP,CAAC;yBAAM,CAAC;wBACJ,MAAM,OAAO,EAAE,CAAC;oBACpB,CAAC;oBACD,YAAY,EAAE,CAAC,mBAAmB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;oBACxD,QAAQ,CAAC;wBACL,IAAI,EAAE,uBAAuB,CAAC,iBAAiB;wBAC/C,OAAO,EAAE,EAAE;qBACd,CAAC,CAAC;gBACP,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,EACF,CAAC,CAAC,EAAE,yBAAyB,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,CAAC,CACxG,CAAC;IAEF,OAAO;QACH,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI;KACjE,CAAC;AACN,CAAC,CAAC"}
@@ -14,7 +14,7 @@ export const useDeleteLinkValues = ({ isEnabled, store: { view, dispatch }, pagi
14
14
  const { t } = useSharedTranslation();
15
15
  const { saveValues } = useSaveValueBatchMutation();
16
16
  const isLink = view.entrypoint.type === 'link';
17
- const { data: linkData } = useExplorerData({
17
+ const { data: linkData, canEditLinkAttributeValues: canUnlinkValues } = useExplorerData({
18
18
  entrypoint: view.entrypoint,
19
19
  libraryId: view.libraryId,
20
20
  attributeIds: view.attributesIds,
@@ -50,8 +50,8 @@ export const useDeleteLinkValues = ({ isEnabled, store: { view, dispatch }, pagi
50
50
  })) ?? [];
51
51
  }
52
52
  else {
53
- values = (linkData?.records ?? []).reduce((acc, { id_value, itemId }) => {
54
- if (view.massSelection.includes(itemId)) {
53
+ values = (linkData?.records ?? []).reduce((acc, { id_value, key }) => {
54
+ if (view.massSelection.includes(key)) {
55
55
  acc.push({
56
56
  attribute: entrypoint.linkAttributeId,
57
57
  idValue: id_value ?? null,
@@ -68,7 +68,7 @@ export const useDeleteLinkValues = ({ isEnabled, store: { view, dispatch }, pagi
68
68
  id: entrypoint.parentLibraryId
69
69
  }
70
70
  }, values, undefined, true);
71
- onDelete?.(massSelectionFilter, view.massSelection);
71
+ onDelete?.(massSelectionFilter, values.map(({ idValue }) => idValue));
72
72
  await refetch();
73
73
  }
74
74
  dispatch({
@@ -80,7 +80,7 @@ export const useDeleteLinkValues = ({ isEnabled, store: { view, dispatch }, pagi
80
80
  }
81
81
  }), [t, saveValues, view.massSelection, dispatch, view.libraryId, allVisibleKeys]);
82
82
  return {
83
- unlinkMassAction: isEnabled ? _unlinkMassAction : null
83
+ unlinkMassAction: isEnabled && canUnlinkValues ? _unlinkMassAction : null
84
84
  };
85
85
  };
86
86
  //# sourceMappingURL=useDeleteLinkValues.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDeleteLinkValues.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useDeleteLinkValues.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,yBAAyB,MAAM,uFAAuF,CAAC;AAE9H,OAAO,EAA0C,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AACzG,OAAO,EAAW,OAAO,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAGjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAChC,SAAS,EACT,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EACvB,UAAU,EACV,cAAc,EACd,QAAQ,EACR,OAAO,EAUT,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAA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AAE,uBAAuB,CAAC,iBAAiB;wBAC/C,OAAO,EAAE,EAAE;qBACd,CAAC,CAAC;gBACP,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,EACF,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAChF,CAAC;IAEF,OAAO;QACH,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI;KACzD,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"file":"useDeleteLinkValues.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useDeleteLinkValues.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,yBAAyB,MAAM,uFAAuF,CAAC;AAE9H,OAAO,EAA0C,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AACzG,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAGjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAChC,SAAS,EACT,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EACvB,UAAU,EACV,cAAc,EACd,QAAQ,EACR,OAAO,EAUT,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,EAAC,UAAU,EAAC,GAAG,yBAAyB,EAAE,CAAC;IAEjD,MAAM,MAAM,GAAG,IAAI,CAAC,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EAAE,uBAAuB,CAAC,iBAAiB;wBAC/C,OAAO,EAAE,EAAE;qBACd,CAAC,CAAC;gBACP,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,EACF,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAChF,CAAC;IAEF,OAAO;QACH,gBAAgB,EAAE,SAAS,IAAI,eAAe,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI;KAC5E,CAAC;AACN,CAAC,CAAC"}
@@ -15,10 +15,11 @@ import { FeatureHook, Entrypoint, IPrimaryAction } from '../_types';
15
15
  * @param onCreate - callback to let outside world known about creating item (and linking)
16
16
  * @param refetch - method to call to refresh the list. New item will be visible if it matches filters and sorts
17
17
  */
18
- export declare const useCreatePrimaryAction: ({ isEnabled, libraryId, entrypoint, totalCount, onCreate, formId, refetch }: FeatureHook<{
18
+ export declare const useCreatePrimaryAction: ({ isEnabled, libraryId, entrypoint, totalCount, canCreateAndLinkValue, onCreate, formId, refetch }: FeatureHook<{
19
19
  libraryId: string;
20
20
  entrypoint: Entrypoint;
21
21
  totalCount: number;
22
+ canCreateAndLinkValue: boolean;
22
23
  onCreate?: ({ recordIdCreated, saveValuesResultOnLink }: {
23
24
  recordIdCreated: string;
24
25
  saveValuesResultOnLink?: ISubmitMultipleResult;
@@ -9,6 +9,7 @@ import { CreateDirectory, EditRecordModal, UploadFiles } from '../../../componen
9
9
  import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
10
10
  import useSaveValueBatchMutation from '../../../components/RecordEdition/EditRecordContent/hooks/useExecuteSaveValueBatchMutation';
11
11
  import { LibraryBehavior, useExplorerLibraryDetailsQuery, useExplorerLinkAttributeQuery } from '../../../_gqlTypes';
12
+ import { CREATE_RECORD_MODAL_CLASSNAME } from '../_constants';
12
13
  /**
13
14
  * Hook used to get the action for `<DataView />` component.
14
15
  *
@@ -23,7 +24,7 @@ import { LibraryBehavior, useExplorerLibraryDetailsQuery, useExplorerLinkAttribu
23
24
  * @param onCreate - callback to let outside world known about creating item (and linking)
24
25
  * @param refetch - method to call to refresh the list. New item will be visible if it matches filters and sorts
25
26
  */
26
- export const useCreatePrimaryAction = ({ isEnabled, libraryId, entrypoint, totalCount, onCreate, formId, refetch }) => {
27
+ export const useCreatePrimaryAction = ({ isEnabled, libraryId, entrypoint, totalCount, canCreateAndLinkValue, onCreate, formId, refetch }) => {
27
28
  const { t } = useSharedTranslation();
28
29
  const [isModalCreationVisible, setIsModalCreationVisible] = useState(false);
29
30
  const [multipleValues, setIsMultivalues] = useState(false);
@@ -46,7 +47,13 @@ export const useCreatePrimaryAction = ({ isEnabled, libraryId, entrypoint, total
46
47
  if (error || loading) {
47
48
  return { createPrimaryAction: null, createModal: null };
48
49
  }
49
- const canCreateRecord = entrypoint.type === 'library' ? true : multipleValues || totalCount === 0;
50
+ let canCreateRecord;
51
+ if (entrypoint.type === 'library') {
52
+ canCreateRecord = true;
53
+ }
54
+ else {
55
+ canCreateRecord = canCreateAndLinkValue && (multipleValues || totalCount === 0);
56
+ }
50
57
  const _createPrimaryAction = {
51
58
  callback: () => {
52
59
  setIsModalCreationVisible(true);
@@ -78,7 +85,7 @@ export const useCreatePrimaryAction = ({ isEnabled, libraryId, entrypoint, total
78
85
  } }));
79
86
  break;
80
87
  case LibraryBehavior.standard:
81
- _createModal = (_jsx(EditRecordModal, { open: true, record: null, library: libraryId, creationFormId: formId, onClose: () => {
88
+ _createModal = (_jsx(EditRecordModal, { className: CREATE_RECORD_MODAL_CLASSNAME, open: true, record: null, library: libraryId, creationFormId: formId, onClose: () => {
82
89
  setIsModalCreationVisible(false);
83
90
  }, onCreate: newRecord => {
84
91
  refetch();
@@ -1 +1 @@
1
- {"version":3,"file":"useCreatePrimaryAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-primary/useCreatePrimaryAction.tsx"],"names":[],"mappings":";AAAA,oFA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C,eAAe,EAAE,SAAS,CAAC,EAAE,EAAE,sBAAsB,EAAE,gBAAgB,EAAC,CAAC,CAAC;wBAC1F,CAAC,CAAC,CAAC;oBACP,CAAC;yBAAM,CAAC;wBACJ,QAAQ,EAAE,CAAC,EAAC,eAAe,EAAE,SAAS,CAAC,EAAE,EAAC,CAAC,CAAC;oBAChD,CAAC;gBACL,CAAC,EACD,aAAa,EAAE,CAAC,QAAQ,CAAC,GAC3B,CACL,CAAC;YACF,MAAM;IACd,CAAC;IAED,OAAO;QACH,mBAAmB,EAAE,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI;QAC5D,WAAW,EAAE,sBAAsB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI;KAC5D,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"file":"useCreatePrimaryAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-primary/useCreatePrimaryAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAe,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAE,eAAe,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,yBAAyB,MAAM,uFAAuF,CAAC;AAE9H,OAAO,EAAC,eAAe,EAAE,8BAA8B,EAAE,6BAA6B,EAAC,MAAM,eAAe,CAAC;AAE7G,OAAO,EAAC,6BAA6B,EAAC,MAAM,eAAe,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACnC,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,EACV,qB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sB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI;KAC5D,CAAC;AACN,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { ISubmitMultipleResult } from '../../../components/RecordEdition/EditRecordContent/_types';
2
- import { FeatureHook, IPrimaryAction } from '../_types';
2
+ import { Entrypoint, FeatureHook, IPrimaryAction } from '../_types';
3
3
  /**
4
4
  * Hook used to get the action for `<DataView />` component.
5
5
  *
@@ -11,8 +11,11 @@ import { FeatureHook, IPrimaryAction } from '../_types';
11
11
  * @param maxItemsLeft - the number of items that can be added
12
12
  * @param onLink - callback to let outside world know about linking feedback
13
13
  */
14
- export declare const useLinkPrimaryAction: ({ isEnabled, maxItemsLeft, onLink }: FeatureHook<{
14
+ export declare const useLinkPrimaryAction: ({ isEnabled, maxItemsLeft, entrypoint, linkId, canAddLinkValue, onLink }: FeatureHook<{
15
+ entrypoint: Entrypoint;
16
+ linkId?: string;
15
17
  maxItemsLeft: number | null;
18
+ canAddLinkValue: boolean;
16
19
  onLink?: (saveValuesResult: ISubmitMultipleResult) => void;
17
20
  }>) => {
18
21
  linkPrimaryAction: IPrimaryAction;
@@ -6,6 +6,7 @@ import { useState } from 'react';
6
6
  import { FaPlus } from 'react-icons/fa';
7
7
  import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
8
8
  import { LinkModal } from '../link-item/LinkModal';
9
+ import { useExplorerLinkAttributeQuery } from '../../../_gqlTypes';
9
10
  /**
10
11
  * Hook used to get the action for `<DataView />` component.
11
12
  *
@@ -17,21 +18,36 @@ import { LinkModal } from '../link-item/LinkModal';
17
18
  * @param maxItemsLeft - the number of items that can be added
18
19
  * @param onLink - callback to let outside world know about linking feedback
19
20
  */
20
- export const useLinkPrimaryAction = ({ isEnabled, maxItemsLeft, onLink }) => {
21
+ export const useLinkPrimaryAction = ({ isEnabled, maxItemsLeft, entrypoint, linkId, canAddLinkValue, onLink }) => {
21
22
  const { t } = useSharedTranslation();
22
23
  const [isLinkModalVisible, setIsLinkModalVisible] = useState(false);
23
- const disableAddItemAction = maxItemsLeft === 0;
24
+ const [multipleValues, setIsMultivalues] = useState(false);
25
+ const disableAddItemAction = maxItemsLeft === 0 || !canAddLinkValue;
26
+ useExplorerLinkAttributeQuery({
27
+ skip: entrypoint.type !== 'link',
28
+ variables: {
29
+ id: entrypoint.linkAttributeId
30
+ },
31
+ onCompleted: data => {
32
+ const attributeData = data?.attributes?.list?.[0];
33
+ if (!attributeData) {
34
+ throw new Error('Unknown link attribute');
35
+ }
36
+ setIsMultivalues(attributeData.multiple_values);
37
+ }
38
+ });
39
+ const replacementMode = linkId && !multipleValues;
24
40
  const _linkPrimaryAction = {
25
41
  callback: () => {
26
42
  setIsLinkModalVisible(true);
27
43
  },
28
44
  icon: _jsx(FaPlus, {}),
29
45
  disabled: disableAddItemAction,
30
- label: t('explorer.add-existing-item')
46
+ label: replacementMode ? t('record_edition.replace-by-existing-item') : t('explorer.add-existing-item')
31
47
  };
32
48
  return {
33
49
  linkPrimaryAction: isEnabled ? _linkPrimaryAction : null,
34
- linkModal: isLinkModalVisible ? (_jsx(LinkModal, { open: true, onLink: onLink, onClose: () => {
50
+ linkModal: isLinkModalVisible ? (_jsx(LinkModal, { open: true, onLink: onLink, linkId: replacementMode ? linkId : undefined, onClose: () => {
35
51
  setIsLinkModalVisible(false);
36
52
  } })) : null
37
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useLinkPrimaryAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-primary/useLinkPrimaryAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,YAAY,EACZ,MAAM,EAIR,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpE,MAAM,oBAAoB,GAAG,YAAY,KAAK,CAAC,CAAC;IAEhD,MAAM,kBAAkB,GAAmB;QACvC,QAAQ,EAAE,GAAG,EAAE;YACX,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,EAAE,KAAC,MAAM,KAAG;QAChB,QAAQ,EAAE,oBAAoB;QAC9B,KAAK,EAAE,CAAC,CAAC,4BAA4B,CAAC;KACzC,CAAC;IAEF,OAAO;QACH,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QACxD,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAC5B,KAAC,SAAS,IACN,IAAI,QACJ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;KACX,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"file":"useLinkPrimaryAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-primary/useLinkPrimaryAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAC,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,4BAA4B,CAAC;KAC1G,CAAC;IAEF,OAAO;QACH,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QACxD,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAC5B,KAAC,SAAS,IACN,IAAI,QACJ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC5C,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;KACX,CAAC;AACN,CAAC,CAAC"}
@@ -2,8 +2,10 @@ import { FunctionComponent } from 'react';
2
2
  import { ISubmitMultipleResult } from '../../../components/RecordEdition/EditRecordContent/_types';
3
3
  interface ILinkModalProps {
4
4
  open: boolean;
5
+ linkId?: string;
5
6
  onClose: () => void;
6
7
  onLink?: (saveValuesResult: ISubmitMultipleResult) => void;
8
+ onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;
7
9
  }
8
10
  export declare const LinkModal: FunctionComponent<ILinkModalProps>;
9
11
  export {};
@@ -1,9 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useExplorerLinkAttributeQuery } from '../../../_gqlTypes';
3
3
  import { SelectRecordForLinkModal } from '../../../components/SelectRecordForLinkModal';
4
- import { useLinkMassAction } from './useLinkMassAction';
4
+ import { useAddLinkMassAction } from './useAddLinkMassAction';
5
5
  import { useViewSettingsContext } from '../manage-view-settings/store-view-settings/useViewSettingsContext';
6
- export const LinkModal = ({ open, onLink, onClose }) => {
6
+ import { useReplaceLinkMassAction } from './useReplaceLinkMassAction';
7
+ import { LINK_RECORDS_MODAL_CLASSNAME } from '../_constants';
8
+ export const LinkModal = ({ open, linkId, onLink, onReplace, onClose }) => {
7
9
  const { view } = useViewSettingsContext();
8
10
  const { data: attributeData } = useExplorerLinkAttributeQuery({
9
11
  skip: view.entrypoint.type !== 'link',
@@ -12,12 +14,20 @@ export const LinkModal = ({ open, onLink, onClose }) => {
12
14
  }
13
15
  });
14
16
  const isMultiple = attributeData?.attributes?.list?.[0]?.multiple_values;
15
- const { createLinks } = useLinkMassAction({
17
+ const isReplacement = !!linkId;
18
+ const { createLinks } = useAddLinkMassAction({
16
19
  store: { view },
17
20
  linkAttributeId: view.entrypoint.linkAttributeId,
18
21
  onLink,
19
22
  closeModal: onClose
20
23
  });
21
- return (_jsx(SelectRecordForLinkModal, { open: open, childLibraryId: view.libraryId, onSelectionCompleted: createLinks, selectionMode: isMultiple ? 'multiple' : 'simple', hideSelectAllAction: !isMultiple && view.entrypoint.type === 'link', onClose: onClose }));
24
+ const { replaceLink } = useReplaceLinkMassAction({
25
+ store: { view },
26
+ linkAttributeId: view.entrypoint.linkAttributeId,
27
+ linkId,
28
+ onReplace,
29
+ closeModal: onClose
30
+ });
31
+ return (_jsx(SelectRecordForLinkModal, { className: LINK_RECORDS_MODAL_CLASSNAME, open: open, childLibraryId: view.libraryId, onSelectionCompleted: isReplacement ? replaceLink : createLinks, replacementMode: isReplacement, selectionMode: isReplacement || !isMultiple ? 'simple' : 'multiple', hideSelectAllAction: (isReplacement || !isMultiple) && view.entrypoint.type === 'link', onClose: onClose }));
22
32
  };
23
33
  //# sourceMappingURL=LinkModal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinkModal.js","sourceRoot":"","sources":["../../../../src/components/Explorer/link-item/LinkModal.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,6BAA6B,EAAC,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAC,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAEjF,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,sBAAsB,EAAC,MAAM,oEAAoE,CAAC;AAQ1G,MAAM,CAAC,MAAM,SAAS,GAAuC,CAAC,EAAC,IAAI,EAAE,MAAM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,aAAa,EAC9B,aAAa,EAAE,aAAa,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,EACnE,mBAAmB,EAAE,CAAC,aAAa,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,MAAM,EACtF,OAAO,EAAE,OAAO,GAClB,CACL,CAAC;AACN,CAAC,CAAC"}
@@ -9,7 +9,7 @@ import { IViewSettingsState } from '../manage-view-settings';
9
9
  * @param onLink - callback to let outside world know about linking feedback
10
10
  * @param closeModal - callback to close the link modal
11
11
  */
12
- export declare const useLinkMassAction: ({ store: { view }, linkAttributeId, onLink, closeModal }: {
12
+ export declare const useAddLinkMassAction: ({ store: { view }, linkAttributeId, onLink, closeModal }: {
13
13
  store: {
14
14
  view: IViewSettingsState;
15
15
  };
@@ -10,7 +10,7 @@ import useSaveValueBatchMutation from '../../../components/RecordEdition/EditRec
10
10
  * @param onLink - callback to let outside world know about linking feedback
11
11
  * @param closeModal - callback to close the link modal
12
12
  */
13
- export const useLinkMassAction = ({ store: { view }, linkAttributeId, onLink, closeModal }) => {
13
+ export const useAddLinkMassAction = ({ store: { view }, linkAttributeId, onLink, closeModal }) => {
14
14
  const { saveValues } = useSaveValueBatchMutation();
15
15
  return {
16
16
  createLinks: async (data) => {
@@ -31,4 +31,4 @@ export const useLinkMassAction = ({ store: { view }, linkAttributeId, onLink, cl
31
31
  }
32
32
  };
33
33
  };
34
- //# sourceMappingURL=useLinkMassAction.js.map
34
+ //# sourceMappingURL=useAddLinkMassAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAddLinkMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/link-item/useAddLinkMassAction.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,yBAAyB,MAAM,uFAAuF,CAAC;AAM9H;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,KAAK,EAAE,EAAC,IAAI,EAAC,EACb,eAAe,EACf,MAAM,EACN,UAAU,EAQb,EAAE,EAAE;IACD,MAAM,EAAC,UAAU,EAAC,GAAG,yBAAyB,EAAE,CAAC;IAEjD,OAAO;QACH,WAAW,EAAE,KAAK,EAAE,IAA+B,EAAE,EAAE;YACnD,MAAM,UAAU,GAAG,IAAI,CAAC,UAA6B,CAAC;YACtD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE,CAAC,CAAC;gBAC5C,SAAS,EAAE,eAAe;gBAC1B,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,EAAE;aACZ,CAAC,CAAC,CAAC;YAEJ,MAAM,gBAAgB,GAAG,MAAM,UAAU,CACrC;gBACI,EAAE,EAAE,UAAU,CAAC,cAAc;gBAC7B,OAAO,EAAE;oBACL,EAAE,EAAE,UAAU,CAAC,eAAe;iBACjC;aACJ,EACD,MAAM,CACT,CAAC;YACF,MAAM,EAAE,CAAC,gBAAgB,CAAC,CAAC;YAC3B,UAAU,EAAE,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { ExplorerSelectionIdsQuery } from '../../../_gqlTypes';
2
+ import { ISubmitMultipleResult } from '../../../components/RecordEdition/EditRecordContent/_types';
3
+ import { IViewSettingsState } from '../manage-view-settings';
4
+ /**
5
+ * Hook used to replace link
6
+ *
7
+ * @param view - represent the current view
8
+ * @param linkAttributeId - attribute that represent the link
9
+ * @param linkId - concerned link item
10
+ * @param onReplace - callback to let outside world know about replacing feedback
11
+ * @param closeModal - callback to close the link modal
12
+ */
13
+ export declare const useReplaceLinkMassAction: ({ store: { view }, linkAttributeId, linkId, onReplace, closeModal }: {
14
+ store: {
15
+ view: IViewSettingsState;
16
+ };
17
+ linkAttributeId: string;
18
+ linkId?: string;
19
+ onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;
20
+ closeModal: () => void;
21
+ }) => {
22
+ replaceLink: (data: ExplorerSelectionIdsQuery) => Promise<void>;
23
+ };
@@ -0,0 +1,35 @@
1
+ import useSaveValueBatchMutation from '../../../components/RecordEdition/EditRecordContent/hooks/useExecuteSaveValueBatchMutation';
2
+ /**
3
+ * Hook used to replace link
4
+ *
5
+ * @param view - represent the current view
6
+ * @param linkAttributeId - attribute that represent the link
7
+ * @param linkId - concerned link item
8
+ * @param onReplace - callback to let outside world know about replacing feedback
9
+ * @param closeModal - callback to close the link modal
10
+ */
11
+ export const useReplaceLinkMassAction = ({ store: { view }, linkAttributeId, linkId, onReplace, closeModal }) => {
12
+ const { saveValues } = useSaveValueBatchMutation();
13
+ return {
14
+ replaceLink: async (data) => {
15
+ if (!linkId) {
16
+ return;
17
+ }
18
+ const entrypoint = view.entrypoint;
19
+ const values = data.records.list.map(({ id }) => ({
20
+ attribute: linkAttributeId,
21
+ idValue: linkId,
22
+ value: id
23
+ }));
24
+ const replaceValuesResult = await saveValues({
25
+ id: entrypoint.parentRecordId,
26
+ library: {
27
+ id: entrypoint.parentLibraryId
28
+ }
29
+ }, values);
30
+ onReplace?.(replaceValuesResult);
31
+ closeModal();
32
+ }
33
+ };
34
+ };
35
+ //# sourceMappingURL=useReplaceLinkMassAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReplaceLinkMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/link-item/useReplaceLinkMassAction.tsx"],"names":[],"mappings":"AAIA,OAAO,yBAAyB,MAAM,uFAAuF,CAAC;AAK9H;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EACrC,KAAK,EAAE,EAAC,IAAI,EAAC,EACb,eAAe,EACf,MAAM,EACN,SAAS,EACT,UAAU,EASb,EAAE,EAAE;IACD,MAAM,EAAC,UAAU,EAAC,GAAG,yBAAyB,EAAE,CAAC;IAEjD,OAAO;QACH,WAAW,EAAE,KAAK,EAAE,IAA+B,EAAE,EAAE;YACnD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,OAAO;YACX,CAAC;YACD,MAAM,UAAU,GAAG,IAAI,CAAC,UAA6B,CAAC;YACtD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE,CAAC,CAAC;gBAC5C,SAAS,EAAE,eAAe;gBAC1B,OAAO,EAAE,MAAM;gBACf,KAAK,EAAE,EAAE;aACZ,CAAC,CAAC,CAAC;YAEJ,MAAM,mBAAmB,GAAG,MAAM,UAAU,CACxC;gBACI,EAAE,EAAE,UAAU,CAAC,cAAc;gBAC7B,OAAO,EAAE;oBACL,EAAE,EAAE,UAAU,CAAC,eAAe;iBACjC;aACJ,EACD,MAAM,CACT,CAAC;YACF,SAAS,EAAE,CAAC,mBAAmB,CAAC,CAAC;YACjC,UAAU,EAAE,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC,CAAC"}
@@ -4,18 +4,18 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
4
4
  // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
5
  import { useEffect, useState } from 'react';
6
6
  import styled from 'styled-components';
7
- import { KitRadio, KitTypography } from 'aristid-ds';
7
+ import { KitRadio, KitSpace, KitTypography } from 'aristid-ds';
8
8
  import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
9
9
  import { useViewSettingsContext } from '../manage-view-settings/store-view-settings/useViewSettingsContext';
10
10
  import { localizedTranslation } from '@leav/utils';
11
11
  import { useLang } from '../../../hooks';
12
- import { FaEdit } from 'react-icons/fa';
13
12
  import { ViewActionsButtons } from '../manage-view-settings/save-view/ViewActionsButtons';
14
13
  import { useLoadView } from '../useLoadView';
15
14
  import { useMeQuery } from '../../../_gqlTypes';
16
- import { LabelViewFormModal } from '../manage-view-settings/save-view/LabelViewFormModal';
17
- import { ViewSettingsActionTypes } from '../manage-view-settings';
18
- import useExecuteUpdateViewMutation from '../_queries/useExecuteUpdateViewMutation';
15
+ import { useDeleteView } from '../manage-view-settings/save-view/useDeleteView';
16
+ import { useEditLabelView } from '../manage-view-settings/save-view/useEditLabelView';
17
+ import classNames from 'classnames';
18
+ import { DefaultViewId } from '../manage-view-settings/store-view-settings/viewSettingsInitialState';
19
19
  const ContentWrapperStyledDiv = styled.div `
20
20
  display: flex;
21
21
  flex-direction: column;
@@ -36,63 +36,53 @@ const StyledViewDiv = styled.div `
36
36
  display: flex;
37
37
  align-items: center;
38
38
  justify-content: space-between;
39
- padding: calc(var(--general-spacing-xs) * 1px) 0;
39
+ padding: calc(var(--general-spacing-xs) * 1px);
40
+ border-radius: calc(var(--general-border-radius-xs) * 1px);
40
41
 
41
- .edit {
42
- color: var(--general-utilities-main-default);
42
+ &.selected,
43
+ &:has(label:hover),
44
+ &:has(svg:hover) {
45
+ background: var(--general-utilities-main-light);
46
+ }
47
+ `;
48
+ const StyledIconsDiv = styled.div `
49
+ .edit,
50
+ .delete {
43
51
  font-size: calc(var(--general-typography-fontSize5) * 1px);
44
52
  flex: 0 0 auto;
45
53
  cursor: pointer;
46
54
  display: inline-block;
47
55
  }
56
+
57
+ .edit {
58
+ color: var(--general-utilities-main-default);
59
+ }
60
+
61
+ .delete {
62
+ color: var(--general-utilities-error-default);
63
+ }
48
64
  `;
49
65
  export const SavedViews = () => {
50
66
  const { t } = useSharedTranslation();
51
67
  const { availableLangs } = useLang();
52
- const { view, dispatch } = useViewSettingsContext();
53
- const { updateView } = useExecuteUpdateViewMutation();
68
+ const { view } = useViewSettingsContext();
54
69
  const { loadView } = useLoadView();
55
- const [isModalOpen, setIsModalOpen] = useState(false);
56
- const [dataViewToEdit, setDataViewToEdit] = useState({ id: null, label: null });
70
+ const { iconDelete, deleteModal } = useDeleteView();
71
+ const { iconEditLabel, editViewModal } = useEditLabelView();
57
72
  const [currentView, setCurrentView] = useState(view.savedViews.find(viewItem => view.viewId === viewItem.id) ?? undefined);
58
73
  const { data: userData } = useMeQuery();
59
74
  const isOwnerView = (ownerId) => ownerId === userData?.me?.whoAmI?.id;
60
75
  const sharedViews = view.savedViews.filter(viewItem => viewItem.shared);
61
76
  const myViews = view.savedViews.filter(viewItem => !viewItem.shared);
77
+ const _selectedViewClass = (viewId) => classNames({
78
+ selected: view.viewId === viewId
79
+ });
62
80
  useEffect(() => {
63
81
  setCurrentView(view.savedViews.find(viewItem => view.viewId === viewItem.id) ?? undefined);
64
82
  }, [view.viewId]);
65
- const _handleViewClick = (e) => {
83
+ const _onClickLoadView = e => {
66
84
  loadView(e.target.value);
67
85
  };
68
- const _onClickEdit = (id, label) => {
69
- setDataViewToEdit({ id, label });
70
- _toggleModal();
71
- };
72
- const _toggleModal = () => {
73
- setIsModalOpen(!isModalOpen);
74
- };
75
- const _onEditName = async (label) => {
76
- if (!dataViewToEdit.id) {
77
- return;
78
- }
79
- const mappedView = {
80
- id: dataViewToEdit.id,
81
- label
82
- };
83
- const { data } = await updateView({
84
- view: mappedView
85
- });
86
- if (data) {
87
- dispatch({
88
- type: ViewSettingsActionTypes.RENAME_VIEW,
89
- payload: {
90
- id: data.updateView.id,
91
- label: data.updateView.label
92
- }
93
- });
94
- }
95
- };
96
- return (_jsxs(_Fragment, { children: [isModalOpen && (_jsx(LabelViewFormModal, { viewData: dataViewToEdit.label, isOpen: true, onSubmit: _onEditName, onClose: _toggleModal })), _jsxs(ContentWrapperStyledDiv, { children: [_jsxs(StyledListViewsDiv, { children: [_jsxs(StyleKitRadioGroup, { onChange: _handleViewClick, value: currentView?.id, children: [_jsx(KitTypography.Title, { level: "h4", children: t('explorer.my-views') }), _jsx(StyledViewDiv, { children: _jsx(KitRadio, { value: undefined, children: t('explorer.default-view') }) }), myViews.map(viewItem => (_jsxs(StyledViewDiv, { children: [_jsx(KitRadio, { value: viewItem.id, children: localizedTranslation(viewItem.label, availableLangs) }), _jsx(FaEdit, { className: "edit", onClick: () => _onClickEdit(viewItem.id, viewItem.label) })] }, viewItem.id)))] }), _jsxs(StyleKitRadioGroup, { onChange: _handleViewClick, value: currentView?.id, children: [_jsx(KitTypography.Title, { level: "h4", children: t('explorer.shared-views') }), sharedViews.length === 0 ? (_jsx(KitTypography.Text, { size: "fontSize5", children: t('explorer.no-shared-views') })) : (sharedViews.map(viewItem => (_jsxs(StyledViewDiv, { children: [_jsx(KitRadio, { value: viewItem.id, children: localizedTranslation(viewItem.label, availableLangs) }), isOwnerView(viewItem.ownerId) ? (_jsx(FaEdit, { className: "edit", onClick: () => _onClickEdit(viewItem.id, viewItem.label) })) : null] }, viewItem.id))))] })] }), _jsx(ViewActionsButtons, {})] })] }));
86
+ return (_jsxs(_Fragment, { children: [editViewModal, deleteModal, _jsxs(ContentWrapperStyledDiv, { children: [_jsxs(StyledListViewsDiv, { children: [_jsxs(StyleKitRadioGroup, { onChange: _onClickLoadView, value: currentView?.id, children: [_jsx(KitTypography.Title, { level: "h4", children: t('explorer.viewList.my-views') }), _jsx(StyledViewDiv, { className: _selectedViewClass(DefaultViewId), children: _jsx(KitRadio, { value: undefined, children: t('explorer.viewList.default-view') }) }), myViews.map(viewItem => (_jsxs(StyledViewDiv, { className: _selectedViewClass(viewItem.id), children: [_jsx(KitRadio, { value: viewItem.id, children: localizedTranslation(viewItem.label, availableLangs) }), _jsx(StyledIconsDiv, { children: _jsxs(KitSpace, { children: [iconEditLabel(viewItem), iconDelete(viewItem)] }) })] }, viewItem.id)))] }), _jsxs(StyleKitRadioGroup, { onChange: _onClickLoadView, value: currentView?.id, children: [_jsx(KitTypography.Title, { level: "h4", children: t('explorer.viewList.shared-views') }), sharedViews.length === 0 ? (_jsx(KitTypography.Text, { size: "fontSize5", children: t('explorer.viewList.no-shared-views') })) : (sharedViews.map(viewItem => (_jsxs(StyledViewDiv, { className: _selectedViewClass(viewItem.id), children: [_jsx(KitRadio, { value: viewItem.id, children: localizedTranslation(viewItem.label, availableLangs) }), isOwnerView(viewItem.ownerId) ? (_jsx(StyledIconsDiv, { children: _jsxs(KitSpace, { children: [iconEditLabel(viewItem), iconDelete(viewItem)] }) })) : null] }, viewItem.id))))] })] }), _jsx(ViewActionsButtons, {})] })] }));
97
87
  };
98
88
  //# sourceMappingURL=SavedViews.js.map