@leav/ui 0.4.0-fbdf247 → 0.4.0-fd9dcf3f

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 (422) hide show
  1. package/README.md +1 -0
  2. package/dist/__mocks__/common/form.js +5 -1
  3. package/dist/__mocks__/common/form.js.map +1 -1
  4. package/dist/__mocks__/common/value.d.ts +1 -2
  5. package/dist/__mocks__/common/value.js +0 -11
  6. package/dist/__mocks__/common/value.js.map +1 -1
  7. package/dist/_gqlTypes/index.d.ts +1377 -20
  8. package/dist/_gqlTypes/index.js +411 -3
  9. package/dist/_gqlTypes/index.js.map +1 -1
  10. package/dist/_queries/attributes/attributeDetailsFragment.js +1 -0
  11. package/dist/_queries/attributes/attributeDetailsFragment.js.map +1 -1
  12. package/dist/_queries/records/activateRecordsMutation.d.ts +1 -0
  13. package/dist/_queries/records/activateRecordsMutation.js +15 -0
  14. package/dist/_queries/records/activateRecordsMutation.js.map +1 -0
  15. package/dist/_queries/records/getRecordFormQuery.js +13 -0
  16. package/dist/_queries/records/getRecordFormQuery.js.map +1 -1
  17. package/dist/_queries/trees/treeNodeChildrenQuery.js +12 -2
  18. package/dist/_queries/trees/treeNodeChildrenQuery.js.map +1 -1
  19. package/dist/components/CreateDirectory/CreateDirectory.js +4 -4
  20. package/dist/components/CreateDirectory/CreateDirectory.js.map +1 -1
  21. package/dist/components/EditLibraryModal/EditLibrary/EditLibraryAttributes/AttributesList/DeleteButton/DeleteButton.js +3 -2
  22. package/dist/components/EditLibraryModal/EditLibrary/EditLibraryAttributes/AttributesList/DeleteButton/DeleteButton.js.map +1 -1
  23. package/dist/components/EditTreeModal/EditTree/EditTreeInfo/EditTreeInfoForm/TreeLibrariesForm/TreeLibrariesForm.js +8 -1
  24. package/dist/components/EditTreeModal/EditTree/EditTreeInfo/EditTreeInfoForm/TreeLibrariesForm/TreeLibrariesForm.js.map +1 -1
  25. package/dist/components/ErrorBoundary/ErrorBoundaryContent/ErrorBoundaryContent.d.ts +2 -2
  26. package/dist/components/ErrorBoundary/ErrorBoundaryContent/ErrorBoundaryContent.js +4 -3
  27. package/dist/components/ErrorBoundary/ErrorBoundaryContent/ErrorBoundaryContent.js.map +1 -1
  28. package/dist/components/Explorer/DataView.d.ts +2 -1
  29. package/dist/components/Explorer/DataView.js +31 -11
  30. package/dist/components/Explorer/DataView.js.map +1 -1
  31. package/dist/components/Explorer/Explorer.d.ts +9 -5
  32. package/dist/components/Explorer/Explorer.js +28 -12
  33. package/dist/components/Explorer/Explorer.js.map +1 -1
  34. package/dist/components/Explorer/ExplorerToolbar.d.ts +2 -1
  35. package/dist/components/Explorer/ExplorerToolbar.js +5 -4
  36. package/dist/components/Explorer/ExplorerToolbar.js.map +1 -1
  37. package/dist/components/Explorer/IdCard.js +1 -1
  38. package/dist/components/Explorer/IdCard.js.map +1 -1
  39. package/dist/components/Explorer/TableCell.js +22 -11
  40. package/dist/components/Explorer/TableCell.js.map +1 -1
  41. package/dist/components/Explorer/TableTagGroup.d.ts +0 -1
  42. package/dist/components/Explorer/TableTagGroup.js +3 -16
  43. package/dist/components/Explorer/TableTagGroup.js.map +1 -1
  44. package/dist/components/Explorer/_constants.d.ts +3 -0
  45. package/dist/components/Explorer/_constants.js +3 -0
  46. package/dist/components/Explorer/_constants.js.map +1 -1
  47. package/dist/components/Explorer/_queries/prepareFiltersForRequest.d.ts +2 -2
  48. package/dist/components/Explorer/_queries/prepareFiltersForRequest.js +1 -1
  49. package/dist/components/Explorer/_queries/prepareFiltersForRequest.js.map +1 -1
  50. package/dist/components/Explorer/_queries/useExplorerData.d.ts +4 -2
  51. package/dist/components/Explorer/_queries/useExplorerData.js +24 -14
  52. package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
  53. package/dist/components/Explorer/_types.d.ts +15 -3
  54. package/dist/components/Explorer/_types.js.map +1 -1
  55. package/dist/components/Explorer/actions-item/useEditItemAction.d.ts +2 -1
  56. package/dist/components/Explorer/actions-item/useEditItemAction.js +6 -4
  57. package/dist/components/Explorer/actions-item/useEditItemAction.js.map +1 -1
  58. package/dist/components/Explorer/actions-item/{useRemoveItemAction.d.ts → useEditStatusItemAction.d.ts} +4 -2
  59. package/dist/components/Explorer/actions-item/{useRemoveItemAction.js → useEditStatusItemAction.js} +81 -24
  60. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -0
  61. package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +21 -0
  62. package/dist/components/Explorer/actions-item/useReplaceItemAction.js +42 -0
  63. package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -0
  64. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.d.ts +2 -1
  65. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +12 -3
  66. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
  67. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +6 -5
  68. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
  69. package/dist/components/Explorer/actions-mass/useMassActions.js +1 -1
  70. package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
  71. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.d.ts +4 -1
  72. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +22 -7
  73. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
  74. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +5 -2
  75. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +20 -4
  76. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
  77. package/dist/components/Explorer/link-item/LinkModal.d.ts +2 -0
  78. package/dist/components/Explorer/link-item/LinkModal.js +14 -4
  79. package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
  80. package/dist/components/Explorer/link-item/{useLinkMassAction.d.ts → useAddLinkMassAction.d.ts} +1 -1
  81. package/dist/components/Explorer/link-item/{useLinkMassAction.js → useAddLinkMassAction.js} +2 -2
  82. package/dist/components/Explorer/link-item/useAddLinkMassAction.js.map +1 -0
  83. package/dist/components/Explorer/link-item/useReplaceLinkMassAction.d.ts +23 -0
  84. package/dist/components/Explorer/link-item/useReplaceLinkMassAction.js +35 -0
  85. package/dist/components/Explorer/link-item/useReplaceLinkMassAction.js.map +1 -0
  86. package/dist/components/Explorer/list-saved-views/SavedViews.js +32 -42
  87. package/dist/components/Explorer/list-saved-views/SavedViews.js.map +1 -1
  88. package/dist/components/Explorer/manage-view-settings/_shared/useAttributeDetailsData.js +11 -9
  89. package/dist/components/Explorer/manage-view-settings/_shared/useAttributeDetailsData.js.map +1 -1
  90. package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.d.ts +4 -0
  91. package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.js +4 -0
  92. package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.js.map +1 -1
  93. package/dist/components/Explorer/manage-view-settings/open-view-settings/EditSettingsContext.d.ts +1 -1
  94. package/dist/components/Explorer/manage-view-settings/open-view-settings/EditSettingsContext.js.map +1 -1
  95. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +2 -2
  96. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
  97. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js +1 -1
  98. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js.map +1 -1
  99. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js +1 -1
  100. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js.map +1 -1
  101. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js +1 -1
  102. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js.map +1 -1
  103. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.d.ts +5 -0
  104. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js +47 -0
  105. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js.map +1 -0
  106. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.d.ts +5 -0
  107. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js +48 -0
  108. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js.map +1 -0
  109. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js +1 -1
  110. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js.map +1 -1
  111. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js +1 -1
  112. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js.map +1 -1
  113. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.d.ts +1 -0
  114. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js +4 -2
  115. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js.map +1 -1
  116. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.d.ts +9 -1
  117. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js +30 -0
  118. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
  119. package/dist/components/Explorer/useColumnWidth.js +2 -1
  120. package/dist/components/Explorer/useColumnWidth.js.map +1 -1
  121. package/dist/components/Explorer/useLoadView.js +4 -2
  122. package/dist/components/Explorer/useLoadView.js.map +1 -1
  123. package/dist/components/Explorer/usePagination.d.ts +2 -1
  124. package/dist/components/Explorer/usePagination.js.map +1 -1
  125. package/dist/components/Explorer/useSearchInput.d.ts +3 -1
  126. package/dist/components/Explorer/useSearchInput.js +2 -1
  127. package/dist/components/Explorer/useSearchInput.js.map +1 -1
  128. package/dist/components/Explorer/useViewSettingsReducer.d.ts +1 -1
  129. package/dist/components/Explorer/useViewSettingsReducer.js +44 -19
  130. package/dist/components/Explorer/useViewSettingsReducer.js.map +1 -1
  131. package/dist/components/ImportModal/ImportModalConfigStep/ImportModalConfigStep.js +1 -1
  132. package/dist/components/ImportModal/ImportModalConfigStep/ImportModalConfigStep.js.map +1 -1
  133. package/dist/components/LibraryItemsList/CreateNewRecordButton/CreateNewRecordButton.js +1 -0
  134. package/dist/components/LibraryItemsList/CreateNewRecordButton/CreateNewRecordButton.js.map +1 -1
  135. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js +3 -3
  136. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js.map +1 -1
  137. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.utils.js +2 -2
  138. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.utils.js.map +1 -1
  139. package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.d.ts +4 -0
  140. package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.js +4 -1
  141. package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.js.map +1 -1
  142. package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/DeactivateRecordBtn.js +3 -3
  143. package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/DeactivateRecordBtn.js.map +1 -1
  144. package/dist/components/LinkSelect/LinkSelect.d.ts +15 -0
  145. package/dist/components/LinkSelect/LinkSelect.js +88 -0
  146. package/dist/components/LinkSelect/LinkSelect.js.map +1 -0
  147. package/dist/components/LinkSelect/index.d.ts +2 -0
  148. package/dist/components/{SelectTreeNodeModal → LinkSelect}/index.js +2 -1
  149. package/dist/components/LinkSelect/index.js.map +1 -0
  150. package/dist/components/RecordEdition/EditRecord/EditRecord.d.ts +2 -4
  151. package/dist/components/RecordEdition/EditRecord/EditRecord.js +37 -39
  152. package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
  153. package/dist/components/RecordEdition/EditRecordButtons/EditRecordButtons.d.ts +2 -0
  154. package/dist/components/RecordEdition/EditRecordButtons/EditRecordButtons.js +43 -0
  155. package/dist/components/RecordEdition/EditRecordButtons/EditRecordButtons.js.map +1 -0
  156. package/dist/components/RecordEdition/EditRecordButtons/SidebarButton.d.ts +2 -0
  157. package/dist/components/RecordEdition/EditRecordButtons/SidebarButton.js +25 -0
  158. package/dist/components/RecordEdition/EditRecordButtons/SidebarButton.js.map +1 -0
  159. package/dist/components/RecordEdition/EditRecordButtons/index.d.ts +2 -0
  160. package/dist/components/RecordEdition/{EditRecordContent/uiElements/TreeField/TreeFieldValue → EditRecordButtons}/index.js +2 -2
  161. package/dist/components/RecordEdition/EditRecordButtons/index.js.map +1 -0
  162. package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.d.ts +3 -1
  163. package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js +12 -3
  164. package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js.map +1 -1
  165. package/dist/components/RecordEdition/EditRecordContent/_types.d.ts +5 -0
  166. package/dist/components/RecordEdition/EditRecordContent/_types.js.map +1 -1
  167. package/dist/components/RecordEdition/EditRecordContent/formConstants.d.ts +1 -0
  168. package/dist/components/RecordEdition/EditRecordContent/formConstants.js +1 -0
  169. package/dist/components/RecordEdition/EditRecordContent/formConstants.js.map +1 -1
  170. package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.d.ts +1 -1
  171. package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js +2 -2
  172. package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js.map +1 -1
  173. package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.d.ts +1 -1
  174. package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js +39 -11
  175. package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js.map +1 -1
  176. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.d.ts +8 -2
  177. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +103 -92
  178. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
  179. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.d.ts +5 -0
  180. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js +39 -0
  181. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js.map +1 -0
  182. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.d.ts +8 -0
  183. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js +23 -0
  184. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js.map +1 -0
  185. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.d.ts +9 -0
  186. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js +23 -0
  187. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js.map +1 -0
  188. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.d.ts +8 -0
  189. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js +26 -0
  190. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js.map +1 -0
  191. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.d.ts +12 -0
  192. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js +24 -0
  193. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js.map +1 -0
  194. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.d.ts +19 -0
  195. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js +103 -0
  196. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js.map +1 -0
  197. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.d.ts +22 -0
  198. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js +104 -0
  199. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js.map +1 -0
  200. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.d.ts +22 -0
  201. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.js +85 -0
  202. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.js.map +1 -0
  203. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.d.ts +28 -0
  204. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js +311 -0
  205. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js.map +1 -0
  206. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.d.ts +265 -0
  207. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.js +13 -0
  208. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.js.map +1 -0
  209. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.d.ts +9 -0
  210. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js +15 -0
  211. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js.map +1 -0
  212. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.d.ts +4 -0
  213. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js +22 -0
  214. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js.map +1 -0
  215. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +35 -48
  216. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
  217. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js +1 -2
  218. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js.map +1 -1
  219. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js +1 -2
  220. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js.map +1 -1
  221. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js +1 -2
  222. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js.map +1 -1
  223. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.js +2 -5
  224. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.js.map +1 -1
  225. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js +1 -2
  226. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js.map +1 -1
  227. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js +1 -2
  228. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js.map +1 -1
  229. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js +1 -2
  230. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js.map +1 -1
  231. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js +1 -2
  232. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js.map +1 -1
  233. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.d.ts +2 -3
  234. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js +2 -3
  235. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js.map +1 -1
  236. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js +5 -8
  237. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js.map +1 -1
  238. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/_types.d.ts +1 -2
  239. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.d.ts +4 -2
  240. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +74 -214
  241. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
  242. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.d.ts +265 -0
  243. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.js +13 -0
  244. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.js.map +1 -0
  245. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.d.ts +11 -0
  246. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +51 -0
  247. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -0
  248. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.d.ts +12 -0
  249. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.js +8 -0
  250. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.js.map +1 -0
  251. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +35 -0
  252. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +47 -0
  253. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -0
  254. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +24 -0
  255. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +145 -0
  256. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -0
  257. package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/ComputeIndicator.d.ts +4 -2
  258. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -0
  259. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.d.ts +8 -0
  260. package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/DeleteAllValuesButton.js +2 -2
  261. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.js.map +1 -0
  262. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.js.map +1 -0
  263. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.d.ts +17 -0
  264. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.js +76 -0
  265. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.js.map +1 -0
  266. package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.d.ts +4 -0
  267. package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +51 -51
  268. package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js.map +1 -1
  269. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.d.ts +3 -1
  270. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js +9 -7
  271. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js.map +1 -1
  272. package/dist/components/RecordEdition/EditRecordSidebar/Breacrumb/Breadcrumb.js +2 -2
  273. package/dist/components/RecordEdition/EditRecordSidebar/Breacrumb/Breadcrumb.js.map +1 -1
  274. package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.d.ts +0 -1
  275. package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js +18 -12
  276. package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js.map +1 -1
  277. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +3 -0
  278. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
  279. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js +2 -2
  280. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js.map +1 -1
  281. package/dist/components/RecordEdition/constants.d.ts +2 -0
  282. package/dist/components/RecordEdition/constants.js +6 -0
  283. package/dist/components/RecordEdition/constants.js.map +1 -0
  284. package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.d.ts +29 -3
  285. package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js +65 -5
  286. package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js.map +1 -1
  287. package/dist/components/RecordEdition/hooks/useGetSubmitButtons.d.ts +1 -1
  288. package/dist/components/RecordEdition/hooks/useGetSubmitButtons.js +3 -3
  289. package/dist/components/RecordEdition/hooks/useGetSubmitButtons.js.map +1 -1
  290. package/dist/components/RecordEdition/index.d.ts +3 -0
  291. package/dist/components/RecordEdition/index.js +3 -0
  292. package/dist/components/RecordEdition/index.js.map +1 -1
  293. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +4 -1
  294. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +8 -6
  295. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
  296. package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +5 -1
  297. package/dist/components/SelectTreeNode/SelectTreeNode.js +4 -4
  298. package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
  299. package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +5 -1
  300. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +16 -7
  301. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
  302. package/dist/components/SelectTreeNode/SelectTreeNodeContentSkeleton.d.ts +2 -0
  303. package/dist/components/SelectTreeNode/SelectTreeNodeContentSkeleton.js +17 -0
  304. package/dist/components/SelectTreeNode/SelectTreeNodeContentSkeleton.js.map +1 -0
  305. package/dist/components/SelectTreeNode/TreeNodeTitle.d.ts +9 -0
  306. package/dist/components/SelectTreeNode/TreeNodeTitle.js +8 -0
  307. package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -0
  308. package/dist/components/{SelectTreeNodeModal/SelectTreeNodeModal.d.ts → SelectTreeNodeModalOld/SelectTreeNodeModalOld.d.ts} +1 -1
  309. package/dist/components/{SelectTreeNodeModal/SelectTreeNodeModal.js → SelectTreeNodeModalOld/SelectTreeNodeModalOld.js} +5 -3
  310. package/dist/components/SelectTreeNodeModalOld/SelectTreeNodeModalOld.js.map +1 -0
  311. package/dist/components/SelectTreeNodeModalOld/index.d.ts +1 -0
  312. package/dist/components/{RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd → SelectTreeNodeModalOld}/index.js +1 -2
  313. package/dist/components/SelectTreeNodeModalOld/index.js.map +1 -0
  314. package/dist/components/SimpleErrorBoundary/SimpleErrorBoundary.d.ts +1 -1
  315. package/dist/components/SimpleErrorBoundary/SimpleErrorBoundary.js.map +1 -1
  316. package/dist/components/SimpleErrorBoundary/SimpleErrorBoundaryContent/SimpleErrorBoundaryContent.d.ts +2 -2
  317. package/dist/components/SimpleErrorBoundary/SimpleErrorBoundaryContent/SimpleErrorBoundaryContent.js +6 -3
  318. package/dist/components/SimpleErrorBoundary/SimpleErrorBoundaryContent/SimpleErrorBoundaryContent.js.map +1 -1
  319. package/dist/components/UploadFiles/UploadFiles.js +4 -4
  320. package/dist/components/UploadFiles/UploadFiles.js.map +1 -1
  321. package/dist/components/ValuesVersionConfigurator/VersionTree/VersionTree.js +2 -2
  322. package/dist/components/ValuesVersionConfigurator/VersionTree/VersionTree.js.map +1 -1
  323. package/dist/components/index.d.ts +1 -2
  324. package/dist/components/index.js +1 -2
  325. package/dist/components/index.js.map +1 -1
  326. package/dist/constants.d.ts +3 -1
  327. package/dist/constants.js +3 -1
  328. package/dist/constants.js.map +1 -1
  329. package/dist/contexts/LangContext/LangContext.d.ts +1 -2
  330. package/dist/contexts/LangContext/LangContext.js +2 -2
  331. package/dist/contexts/LangContext/LangContext.js.map +1 -1
  332. package/dist/hooks/index.d.ts +3 -0
  333. package/dist/hooks/index.js +3 -0
  334. package/dist/hooks/index.js.map +1 -1
  335. package/dist/hooks/useAppLang/useAppLang.js.map +1 -1
  336. package/dist/hooks/useGetRecordForm/useGetRecordForm.js +1 -1
  337. package/dist/hooks/useGetRecordForm/useGetRecordForm.js.map +1 -1
  338. package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +15 -0
  339. package/dist/hooks/useIFrameMessenger/messageHandlers.js +121 -0
  340. package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -0
  341. package/dist/hooks/useIFrameMessenger/schema.d.ts +21 -0
  342. package/dist/hooks/useIFrameMessenger/schema.js +76 -0
  343. package/dist/hooks/useIFrameMessenger/schema.js.map +1 -0
  344. package/dist/hooks/useIFrameMessenger/types.d.ts +118 -0
  345. package/dist/hooks/useIFrameMessenger/types.js +2 -0
  346. package/dist/hooks/useIFrameMessenger/types.js.map +1 -0
  347. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +19 -0
  348. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +104 -0
  349. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -0
  350. package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.d.ts +4 -0
  351. package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.js +15 -0
  352. package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.js.map +1 -0
  353. package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +13 -0
  354. package/dist/{components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/index.js → hooks/useIFrameMessengerClient/iFrameMessengerClientContext.js} +3 -3
  355. package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.js.map +1 -0
  356. package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +13 -0
  357. package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.js +13 -0
  358. package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.js.map +1 -0
  359. package/dist/hooks/useRedirectToLogin/useRedirectToLogin.js +1 -1
  360. package/dist/hooks/useRedirectToLogin/useRedirectToLogin.js.map +1 -1
  361. package/dist/locales/en/shared.json +32 -12
  362. package/dist/locales/fr/shared.json +32 -12
  363. package/dist/types/attributes.d.ts +2 -1
  364. package/dist/types/trees.d.ts +1 -0
  365. package/package.json +10 -8
  366. package/dist/components/Explorer/actions-item/useRemoveItemAction.js.map +0 -1
  367. package/dist/components/Explorer/link-item/useLinkMassAction.js.map +0 -1
  368. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/FloatingMenuHandler.d.ts +0 -14
  369. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/FloatingMenuHandler.js +0 -29
  370. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/FloatingMenuHandler.js.map +0 -1
  371. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/index.d.ts +0 -2
  372. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/index.js.map +0 -1
  373. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.d.ts +0 -20
  374. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.js +0 -53
  375. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.js.map +0 -1
  376. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/useGetOptionsQuery.d.ts +0 -19
  377. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/useGetOptionsQuery.js +0 -111
  378. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/useGetOptionsQuery.js.map +0 -1
  379. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.d.ts +0 -20
  380. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.js +0 -71
  381. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.js.map +0 -1
  382. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/useGetOptionsQuery.d.ts +0 -14
  383. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/useGetOptionsQuery.js +0 -58
  384. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/useGetOptionsQuery.js.map +0 -1
  385. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/RecordIdentityCell.d.ts +0 -6
  386. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/RecordIdentityCell.js +0 -11
  387. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/RecordIdentityCell.js.map +0 -1
  388. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/index.d.ts +0 -2
  389. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/index.js +0 -6
  390. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/index.js.map +0 -1
  391. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/QuickSearch.d.ts +0 -13
  392. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/QuickSearch.js +0 -50
  393. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/QuickSearch.js.map +0 -1
  394. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/index.d.ts +0 -2
  395. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/index.js +0 -6
  396. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/index.js.map +0 -1
  397. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/ValuesAdd.d.ts +0 -9
  398. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/ValuesAdd.js +0 -215
  399. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/ValuesAdd.js.map +0 -1
  400. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/index.d.ts +0 -2
  401. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/index.js.map +0 -1
  402. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/ComputeIndicator.js.map +0 -1
  403. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/DeleteAllValuesButton.d.ts +0 -4
  404. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/DeleteAllValuesButton.js.map +0 -1
  405. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/calculatedInheritedFlags.js.map +0 -1
  406. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeFieldValue/TreeFieldValue.d.ts +0 -10
  407. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeFieldValue/TreeFieldValue.js +0 -50
  408. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeFieldValue/TreeFieldValue.js.map +0 -1
  409. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeFieldValue/index.d.ts +0 -2
  410. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeFieldValue/index.js.map +0 -1
  411. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.d.ts +0 -9
  412. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.js +0 -106
  413. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.js.map +0 -1
  414. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/index.d.ts +0 -2
  415. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/index.js +0 -6
  416. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/index.js.map +0 -1
  417. package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.js.map +0 -1
  418. package/dist/components/SelectTreeNodeModal/index.d.ts +0 -1
  419. package/dist/components/SelectTreeNodeModal/index.js.map +0 -1
  420. /package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/ComputeIndicator.js +0 -0
  421. /package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/calculatedInheritedFlags.d.ts +0 -0
  422. /package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/calculatedInheritedFlags.js +0 -0
@@ -0,0 +1,103 @@
1
+ import { useState } from 'react';
2
+ import { FILTER_ON_ID_DEFAULT_FIELDS, NO_RECORD_FILTERS } from '../shared/utils';
3
+ import { AntForm } from 'aristid-ds';
4
+ import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
5
+ export const useLinkRecords = ({ attribute, libraryId, onValueSubmit, onValueDelete }) => {
6
+ const { t } = useSharedTranslation();
7
+ const [selectedRecordIds, setSelectedRecordIds] = useState([]);
8
+ const [explorerFilters, setExplorerFilters] = useState(NO_RECORD_FILTERS);
9
+ const [explorerKey, setExplorerKey] = useState(0);
10
+ const updateExplorerKey = () => setExplorerKey(explorerKey + 1);
11
+ const form = AntForm.useFormInstance();
12
+ const linkRecords = (recordIds) => {
13
+ if (!attribute.multiple_values) {
14
+ selectedRecordIds.forEach(id => {
15
+ const originalIndex = selectedRecordIds.indexOf(id);
16
+ // In Create mode, we don't really delete the value, we just remove them from the pending values
17
+ onValueDelete({
18
+ id_value: `pending_${originalIndex + 1}`
19
+ }, attribute.id);
20
+ });
21
+ }
22
+ const newSelectedRecordIds = attribute.multiple_values ? [...selectedRecordIds, ...recordIds] : [...recordIds];
23
+ setSelectedRecordIds(newSelectedRecordIds);
24
+ form.setFieldValue(attribute.id, newSelectedRecordIds);
25
+ const newFilters = newSelectedRecordIds.map(id => ({
26
+ ...FILTER_ON_ID_DEFAULT_FIELDS,
27
+ value: id
28
+ }));
29
+ setExplorerFilters(newFilters.length > 0 ? newFilters : NO_RECORD_FILTERS);
30
+ const valuesToAddInPending = recordIds.map(id => ({
31
+ attribute,
32
+ idValue: null,
33
+ value: {
34
+ id,
35
+ whoAmI: {
36
+ id,
37
+ library: {
38
+ id: libraryId
39
+ }
40
+ }
41
+ }
42
+ }));
43
+ form.setFields([
44
+ {
45
+ name: attribute.id,
46
+ errors: attribute.required && newSelectedRecordIds.length === 0 ? [t('errors.standard_field_required')] : []
47
+ }
48
+ ]);
49
+ // In Create mode, we don't really submit the values, we just add them to the pending values
50
+ onValueSubmit(valuesToAddInPending, null);
51
+ updateExplorerKey();
52
+ };
53
+ const unlinkRecords = (recordIds) => {
54
+ selectedRecordIds
55
+ .filter(id => (recordIds ? recordIds.includes(id) : true))
56
+ .forEach(id => {
57
+ const originalIndex = selectedRecordIds.indexOf(id);
58
+ // In Create mode, we don't really delete the value, we just remove them from the pending values
59
+ onValueDelete({
60
+ id_value: `pending_${originalIndex + 1}`
61
+ }, attribute.id);
62
+ });
63
+ if (!recordIds) {
64
+ setSelectedRecordIds([]);
65
+ setExplorerFilters(NO_RECORD_FILTERS);
66
+ form.setFieldValue(attribute.id, []);
67
+ updateExplorerKey();
68
+ if (attribute.required) {
69
+ form.setFields([
70
+ {
71
+ name: attribute.id,
72
+ errors: [t('errors.standard_field_required')]
73
+ }
74
+ ]);
75
+ }
76
+ return;
77
+ }
78
+ const newSelectedRecordIds = selectedRecordIds.filter(id => !recordIds.includes(id));
79
+ setSelectedRecordIds(newSelectedRecordIds);
80
+ form.setFieldValue(attribute.id, newSelectedRecordIds);
81
+ form.setFields([
82
+ {
83
+ name: attribute.id,
84
+ errors: attribute.required && newSelectedRecordIds.length === 0 ? [t('errors.standard_field_required')] : []
85
+ }
86
+ ]);
87
+ const newExplorerFilters = explorerFilters.filter(filter => !recordIds.includes(filter.value));
88
+ setExplorerFilters(newExplorerFilters.length > 0 ? newExplorerFilters : NO_RECORD_FILTERS);
89
+ updateExplorerKey();
90
+ };
91
+ const hasNoSelectedRecord = selectedRecordIds.length === 0;
92
+ const canDeleteAllValues = selectedRecordIds.length > 1 && attribute.multiple_values && !attribute.required;
93
+ return {
94
+ explorerFilters,
95
+ explorerKey,
96
+ selectedRecordIds,
97
+ linkRecords,
98
+ unlinkRecords,
99
+ hasNoSelectedRecord,
100
+ canDeleteAllValues
101
+ };
102
+ };
103
+ //# sourceMappingURL=useLinkRecords.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLinkRecords.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,2BAA2B,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AASpE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAuB,EAAE,EAAE;IACzG,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAC;IACzE,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAA4B,iBAAiB,CAAC,CAAC;IACrG,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAElD,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;IAEhE,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAEvC,MAAM,WAAW,GAAG,CAAC,SAAmB,EAAE,EAAE;QACxC,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;YAC7B,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;gBAC3B,MAAM,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;gBAEpD,gGAAgG;gBAChG,a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D,IAAI,CAAC,SAAS,CAAC;YACX;gBACI,IAAI,EAAE,SAAS,CAAC,EAAE;gBAClB,MAAM,EACF,SAAS,CAAC,QAAQ,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;aAC3G;SACJ,CAAC,CAAC;QAEH,MAAM,kBAAkB,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/F,kBAAkB,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;QAE3F,iBAAiB,EAAE,CAAC;IACxB,CAAC,CAAC;IAEF,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,MAAM,KAAK,CAAC,CAAC;IAE3D,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;IAE5G,OAAO;QACH,eAAe;QACf,WAAW;QACX,iBAAiB;QACjB,WAAW;QACX,aAAa;QACb,mBAAmB;QACnB,kBAAkB;KACrB,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { RecordFormAttributeFragment } from '../../../../../../_gqlTypes';
2
+ import { DeleteValueFunc, SubmitValueFunc } from '../../../_types';
3
+ import { Dispatch } from 'react';
4
+ import { RecordFormElementsValueLinkValue } from '../../../../../../hooks/useGetRecordForm';
5
+ import { IEditRecordReducerActions, IRecordPropertyWithAttribute } from '../../../../../../components/RecordEdition/editRecordReducer/editRecordReducer';
6
+ interface IUseLinkRecordsInCreationProps {
7
+ attribute: RecordFormAttributeFragment;
8
+ libraryId: string;
9
+ pendingValues: RecordFormElementsValueLinkValue[];
10
+ activeAttribute: IRecordPropertyWithAttribute | null;
11
+ dispatch: Dispatch<IEditRecordReducerActions>;
12
+ isHookUsed: boolean;
13
+ isReadOnly: boolean;
14
+ isFieldInError: boolean;
15
+ onValueSubmit: SubmitValueFunc;
16
+ onValueDelete: DeleteValueFunc;
17
+ }
18
+ export declare const useLinkRecordsInCreation: ({ attribute, libraryId, pendingValues, activeAttribute, dispatch, isHookUsed, isReadOnly, isFieldInError, onValueSubmit, onValueDelete }: IUseLinkRecordsInCreationProps) => {
19
+ UnlinkAllRecordsInCreation: JSX.Element;
20
+ LinkRecordsInCreation: JSX.Element;
21
+ };
22
+ export {};
@@ -0,0 +1,104 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } 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 { FaEye, FaList, FaPlus, FaTrash } from 'react-icons/fa';
6
+ import { Explorer } from '../../../../../../components/Explorer';
7
+ import { ExplorerWrapper } from '../shared/ExplorerWrapper';
8
+ import { LinkActionsButtons } from '../shared/LinkActionsButtons';
9
+ import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
10
+ import { useRecordSelector } from '../action-primary/useRecordSelector';
11
+ import { useEditRecord } from '../action-item/useEditRecord';
12
+ import { useUnselectRecord } from '../action-item/useUnselectRecord';
13
+ import { ACTION_ITEM_EMPTY_LABEL } from '../shared/utils';
14
+ import { useCreateRecord } from '../action-primary/useCreateRecord';
15
+ import { RecordFilterOperator } from '../../../../../../_gqlTypes';
16
+ import { useUnselectAllRecords } from '../action-mass/useUnselectAllRecords';
17
+ import { useLinkRecords } from './useLinkRecords';
18
+ import { DeleteAllValuesButton } from '../../shared/DeleteAllValuesButton';
19
+ import { useEffect } from 'react';
20
+ import { AntForm } from 'aristid-ds';
21
+ import { EditRecordReducerActionsTypes } from '../../../../../../components/RecordEdition/editRecordReducer/editRecordReducer';
22
+ export const useLinkRecordsInCreation = ({ attribute, libraryId, pendingValues, activeAttribute, dispatch, isHookUsed, isReadOnly, isFieldInError, onValueSubmit, onValueDelete }) => {
23
+ const { t } = useSharedTranslation();
24
+ const form = AntForm.useFormInstance();
25
+ const { explorerFilters, explorerKey, linkRecords, unlinkRecords, hasNoSelectedRecord, canDeleteAllValues } = useLinkRecords({
26
+ attribute,
27
+ libraryId,
28
+ onValueSubmit,
29
+ onValueDelete
30
+ });
31
+ const { openModal: openCreateRecordModal, CreateRecordModal } = useCreateRecord({
32
+ linkRecords
33
+ });
34
+ const { openModal: openRecordSelectorModal, RecordSelectorModal } = useRecordSelector({
35
+ libraryId,
36
+ isReplacementMode: !attribute.multiple_values && !hasNoSelectedRecord,
37
+ selectionMode: attribute.multiple_values ? 'multiple' : 'simple',
38
+ linkRecords
39
+ });
40
+ const { openModal: openEditRecordModal, EditRecordModal } = useEditRecord();
41
+ const { callback: unselectRecordCallback } = useUnselectRecord({
42
+ unlinkRecords
43
+ });
44
+ const { callback: unselectAllRecordsCallback } = useUnselectAllRecords({
45
+ unlinkRecords
46
+ });
47
+ useEffect(() => {
48
+ if (isHookUsed && pendingValues.length === 0 && attribute.required) {
49
+ // Set field in error when LinkField is displayed for the first time. Otherwise, errors will be handled by useLinkRecords
50
+ form.setFields([
51
+ {
52
+ name: attribute.id,
53
+ errors: [t('errors.standard_field_required')]
54
+ }
55
+ ]);
56
+ }
57
+ }, []);
58
+ useEffect(() => {
59
+ if (isHookUsed && activeAttribute?.attribute.id === attribute.id) {
60
+ // Update active value used in the sidebar when pendingValues change
61
+ dispatch({
62
+ type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,
63
+ values: pendingValues
64
+ });
65
+ }
66
+ }, [pendingValues]);
67
+ return {
68
+ UnlinkAllRecordsInCreation: isHookUsed && canDeleteAllValues && (_jsx(DeleteAllValuesButton, { handleDelete: unlinkRecords, disabled: isReadOnly, danger: isFieldInError })),
69
+ LinkRecordsInCreation: isHookUsed && (_jsxs(_Fragment, { children: [_jsx(ExplorerWrapper, { children: _jsx(Explorer, { defaultViewSettings: {
70
+ filters: explorerFilters,
71
+ filtersOperator: RecordFilterOperator.OR
72
+ }, entrypoint: {
73
+ type: 'library',
74
+ libraryId
75
+ }, showTitle: false, showSearch: false, selectionMode: attribute.multiple_values ? 'multiple' : 'simple', hideSelectAllAction: !attribute.multiple_values, disableSelection: isReadOnly || !attribute.multiple_values, defaultActionsForItem: [], itemActions: [
76
+ { label: ACTION_ITEM_EMPTY_LABEL, icon: _jsx(FaEye, {}), callback: openEditRecordModal },
77
+ ...(attribute.multiple_values
78
+ ? [
79
+ {
80
+ label: ACTION_ITEM_EMPTY_LABEL,
81
+ icon: _jsx(FaTrash, {}),
82
+ callback: unselectRecordCallback,
83
+ isDanger: true
84
+ }
85
+ ]
86
+ : [])
87
+ ], defaultMassActions: [], massActions: attribute.multiple_values
88
+ ? [{ icon: _jsx(FaTrash, {}), label: t('global.delete'), callback: unselectAllRecordsCallback }]
89
+ : [], hidePrimaryActions: true, hideTableHeader: true, iconsOnlyItemActions: true, noPagination: true }, explorerKey) }), _jsx(LinkActionsButtons, { createButtonProps: {
90
+ icon: _jsx(FaPlus, {}),
91
+ label: t('explorer.create-one'),
92
+ callback: () => openCreateRecordModal(libraryId),
93
+ disabled: isReadOnly
94
+ }, linkButtonProps: {
95
+ icon: _jsx(FaList, {}),
96
+ label: attribute.multiple_values || hasNoSelectedRecord
97
+ ? t('explorer.add-existing-item')
98
+ : t('record_edition.replace-by-existing-item'),
99
+ callback: openRecordSelectorModal,
100
+ disabled: isReadOnly
101
+ }, hasNoValue: hasNoSelectedRecord }), CreateRecordModal, RecordSelectorModal, EditRecordModal] }))
102
+ };
103
+ };
104
+ //# sourceMappingURL=useLinkRecordsInCreation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLinkRecordsInCreation.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEd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AE,sBAAsB;wCAChC,QAAQ,EAAE,IAAI;qCACjB;iCACJ;gCACH,CAAC,CAAC,EAAE,CAAC;yBACZ,EACD,kBAAkB,EAAE,EAAE,EACtB,WAAW,EACP,SAAS,CAAC,eAAe;4BACrB,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,KAAC,OAAO,KAAG,EAAE,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,0BAA0B,EAAC,CAAC;4BACxF,CAAC,CAAC,EAAE,EAEZ,kBAAkB,QAClB,eAAe,QACf,oBAAoB,QACpB,YAAY,UArCP,WAAW,CAsClB,GACY,EAClB,KAAC,kBAAkB,IACf,iBAAiB,EAAE;wBACf,IAAI,EAAE,KAAC,MAAM,KAAG;wBAChB,KAAK,EAAE,CAAC,CAAC,qBAAqB,CAAC;wBAC/B,QAAQ,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,SAAS,CAAC;wBAChD,QAAQ,EAAE,UAAU;qBACvB,EACD,eAAe,EAAE;wBACb,IAAI,EAAE,KAAC,MAAM,KAAG;wBAChB,KAAK,EACD,SAAS,CAAC,eAAe,IAAI,mBAAmB;4BAC5C,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC;4BACjC,CAAC,CAAC,CAAC,CAAC,yCAAyC,CAAC;wBACtD,QAAQ,EAAE,uBAAuB;wBACjC,QAAQ,EAAE,UAAU;qBACvB,EACD,UAAU,EAAE,mBAAmB,GACjC,EACD,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,IACjB,CACN;KACJ,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { RecordFilterInput, RecordFormAttributeLinkAttributeFragment } from '../../../../../../_gqlTypes';
2
+ import { DeleteMultipleValuesFunc, ISubmitMultipleResult } from '../../../_types';
3
+ import { Dispatch, SetStateAction } from 'react';
4
+ import { IItemData, MassSelection } from '../../../../../../components/Explorer/_types';
5
+ import { RecordFormElementsValueLinkValue } from '../../../../../../hooks/useGetRecordForm';
6
+ interface IUseLinkRecordsProps {
7
+ attribute: RecordFormAttributeLinkAttributeFragment;
8
+ backendValues: RecordFormElementsValueLinkValue[];
9
+ setBackendValues: Dispatch<SetStateAction<RecordFormElementsValueLinkValue[]>>;
10
+ onDeleteMultipleValues: DeleteMultipleValuesFunc;
11
+ }
12
+ export declare const useLinkRecords: ({ attribute, backendValues, setBackendValues, onDeleteMultipleValues }: IUseLinkRecordsProps) => {
13
+ handleDeleteAllValues: () => Promise<void>;
14
+ handleExplorerRemoveValue: (item: IItemData) => void;
15
+ handleExplorerMassDeactivateValues: (_massSelectedFilter: RecordFilterInput[], massSelection: MassSelection) => void;
16
+ handleExplorerLinkValue: (saveValuesResult: ISubmitMultipleResult) => void;
17
+ handleExplorerCreateValue: ({ recordIdCreated, saveValuesResultOnLink }: {
18
+ recordIdCreated: string;
19
+ saveValuesResultOnLink?: ISubmitMultipleResult;
20
+ }) => void;
21
+ };
22
+ export {};
@@ -0,0 +1,85 @@
1
+ import { APICallStatus } from '../../../_types';
2
+ import { AntForm } from 'aristid-ds';
3
+ import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
4
+ import { ErrorTypes } from '@leav/utils';
5
+ export const useLinkRecords = ({ attribute, backendValues, setBackendValues, onDeleteMultipleValues }) => {
6
+ const { t } = useSharedTranslation();
7
+ const form = AntForm.useFormInstance();
8
+ const removeValues = (filterFn, useIdValue = false) => {
9
+ if (!filterFn) {
10
+ form.setFieldValue(attribute.id, []);
11
+ form.setFields([
12
+ {
13
+ name: attribute.id,
14
+ errors: attribute.required ? [t('errors.standard_field_required')] : []
15
+ }
16
+ ]);
17
+ setBackendValues([]);
18
+ return;
19
+ }
20
+ const newBackendValues = backendValues.filter(backendValue => filterFn(useIdValue ? backendValue.id_value : backendValue.linkValue.id));
21
+ form.setFieldValue(attribute.id, newBackendValues.map(({ linkValue }) => linkValue.id));
22
+ form.setFields([
23
+ {
24
+ name: attribute.id,
25
+ errors: attribute.required && newBackendValues.length === 0 ? [t('errors.standard_field_required')] : []
26
+ }
27
+ ]);
28
+ setBackendValues(previousBackendValues => previousBackendValues.filter(backendValue => filterFn(useIdValue ? backendValue.id_value : backendValue.linkValue.id)));
29
+ };
30
+ const handleDeleteAllValues = async () => {
31
+ const deleteRes = await onDeleteMultipleValues(attribute.id, backendValues.filter(backendValue => backendValue.id_value), null);
32
+ if (deleteRes.status === APICallStatus.SUCCESS) {
33
+ removeValues();
34
+ }
35
+ };
36
+ const handleExplorerRemoveValue = (item) => {
37
+ removeValues(id => id !== item.itemId);
38
+ };
39
+ const handleExplorerMassDeactivateValues = (_massSelectedFilter, massSelection) => {
40
+ removeValues(idValue => !massSelection.includes(idValue), true);
41
+ };
42
+ const handleExplorerLinkValue = (saveValuesResult) => {
43
+ if (saveValuesResult.status === APICallStatus.SUCCESS) {
44
+ const saveLinkValues = saveValuesResult.values;
45
+ form.setFieldValue(attribute.id, [
46
+ ...backendValues.map(({ linkValue }) => linkValue.id),
47
+ ...saveLinkValues.map(({ linkValue }) => linkValue.id)
48
+ ]);
49
+ form.setFields([
50
+ {
51
+ name: attribute.id,
52
+ errors: []
53
+ }
54
+ ]);
55
+ setBackendValues([...backendValues, ...saveLinkValues]);
56
+ }
57
+ if (saveValuesResult.status === APICallStatus.ERROR && saveValuesResult.errors) {
58
+ const attributeError = saveValuesResult.errors.filter(err => err.attribute === attribute.id)?.[0];
59
+ if (attributeError) {
60
+ const errorMessage = attributeError.type === ErrorTypes.VALIDATION_ERROR
61
+ ? attributeError.message
62
+ : t(`errors.${attributeError.type}`);
63
+ form.setFields([
64
+ {
65
+ name: attribute.id,
66
+ errors: [errorMessage]
67
+ }
68
+ ]);
69
+ }
70
+ }
71
+ };
72
+ const handleExplorerCreateValue = ({ recordIdCreated, saveValuesResultOnLink }) => {
73
+ if (saveValuesResultOnLink) {
74
+ handleExplorerLinkValue(saveValuesResultOnLink);
75
+ }
76
+ };
77
+ return {
78
+ handleDeleteAllValues,
79
+ handleExplorerRemoveValue,
80
+ handleExplorerMassDeactivateValues,
81
+ handleExplorerLinkValue,
82
+ handleExplorerCreateValue
83
+ };
84
+ };
85
+ //# sourceMappingURL=useLinkRecords.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLinkRecords.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,aAAa,EAAkD,MAAM,iBAAiB,CAAC;AAG/F,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AASvC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC3B,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACH,EAAE,EAAE;IACvB,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAEvC,MAAM,YAAY,GAAG,CAAC,QAAkC,EAAE,aAAsB,KAAK,EAAE,EAAE;QACrF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACrC,IAAI,CAAC,SAAS,CAAC;gBACX;oBACI,IAAI,EAAE,SAAS,CAAC,EAAE;oBAClB,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;iBAC1E;aACJ,CAAC,CAAC;YACH,gBAAgB,CAAC,EAAE,CAAC,CAAC;YACrB,OAAO;QACX,CAAC;QAED,MAAM,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CACzD,QAAQ,CAAC,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AgB;oBAC/C,CAAC,CAAC,cAAc,CAAC,OAAO;oBACxB,CAAC,CAAC,CAAC,CAAC,UAAU,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC;gBAE7C,IAAI,CAAC,SAAS,CAAC;oBACX;wBACI,IAAI,EAAE,SAAS,CAAC,EAAE;wBAClB,MAAM,EAAE,CAAC,YAAY,CAAC;qBACzB;iBACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,yBAAyB,GAAG,CAAC,EAC/B,eAAe,EACf,sBAAsB,EAIzB,EAAE,EAAE;QACD,IAAI,sBAAsB,EAAE,CAAC;YACzB,uBAAuB,CAAC,sBAAsB,CAAC,CAAC;QACpD,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACH,qBAAqB;QACrB,yBAAyB;QACzB,kCAAkC;QAClC,uBAAuB;QACvB,yBAAyB;KAC5B,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { Explorer } from '../../../../../../components/Explorer';
2
+ import { ComponentProps, Dispatch, SetStateAction } from 'react';
3
+ import { DeleteMultipleValuesFunc } from '../../../_types';
4
+ import { JoinLibraryContextFragment, RecordFormAttributeLinkAttributeFragment } from '../../../../../../_gqlTypes';
5
+ import { RecordFormElementsValueLinkValue } from '../../../../../../hooks/useGetRecordForm';
6
+ import { IEditRecordReducerActions, IRecordPropertyWithAttribute } from '../../../../../../components/RecordEdition/editRecordReducer/editRecordReducer';
7
+ interface ILinkRecordsInCreationProps {
8
+ libraryId: string;
9
+ recordId: string;
10
+ attribute: RecordFormAttributeLinkAttributeFragment;
11
+ joinLibraryContext: JoinLibraryContextFragment;
12
+ columnsToDisplay: ComponentProps<typeof Explorer>['defaultViewSettings']['attributesIds'];
13
+ backendValues: RecordFormElementsValueLinkValue[];
14
+ setBackendValues: Dispatch<SetStateAction<RecordFormElementsValueLinkValue[]>>;
15
+ activeAttribute: IRecordPropertyWithAttribute | null;
16
+ dispatch: Dispatch<IEditRecordReducerActions>;
17
+ isHookUsed: boolean;
18
+ isReadOnly: boolean;
19
+ isFieldInError: boolean;
20
+ tagDisplayMode: boolean;
21
+ hasNoValue: boolean;
22
+ onDeleteMultipleValues: DeleteMultipleValuesFunc;
23
+ }
24
+ export declare const useLinkRecordsInEdition: ({ libraryId, recordId, attribute, joinLibraryContext, columnsToDisplay, backendValues, setBackendValues, activeAttribute, dispatch, isHookUsed, isReadOnly, isFieldInError, tagDisplayMode, onDeleteMultipleValues }: ILinkRecordsInCreationProps) => {
25
+ UnlinkAllRecordsInEdition: JSX.Element;
26
+ LinkRecordsInEditionExplorer: JSX.Element;
27
+ };
28
+ export {};