@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
@@ -1,103 +1,111 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
3
3
  // This file is released under LGPL V3
4
4
  // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
5
  import { localizedTranslation } from '@leav/utils';
6
- import { useContext, useEffect, useReducer } from 'react';
7
- import CreationErrorContext from '../../../../../components/RecordEdition/EditRecord/creationErrorContext';
6
+ import { useEffect, useState } from 'react';
8
7
  import { useEditRecordReducer } from '../../../../../components/RecordEdition/editRecordReducer/useEditRecordReducer';
9
- import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
10
- import { arrayValueVersionToObject } from '../../../../../_utils';
11
- import getActiveFieldValues from '../../helpers/getActiveFieldValues';
12
- import { useRecordEditionContext } from '../../hooks/useRecordEditionContext';
13
- import linkFieldReducer from '../../reducers/linkFieldReducer';
14
- import { computeInitialState, LinkFieldReducerActionsType } from '../../reducers/linkFieldReducer/linkFieldReducer';
15
- import { APICallStatus } from '../../_types';
16
- import { MonoValueSelect } from '../../../../../components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect';
17
- import { AntForm } from 'aristid-ds';
18
- import { MultiValueSelect } from './MultiValueSelect/MultiValueSelect';
8
+ import { AntForm, KitInputWrapper } from 'aristid-ds';
19
9
  import { useLang } from '../../../../../hooks';
20
- const LinkField = ({ element, onValueSubmit, onValueDelete }) => {
21
- const { t } = useSharedTranslation();
22
- const { lang } = useLang();
23
- const { readOnly: isRecordReadOnly, record } = useRecordEditionContext();
24
- const { state: editRecordState } = useEditRecordReducer();
25
- const creationErrors = useContext(CreationErrorContext);
26
- const [state, dispatch] = useReducer(linkFieldReducer, computeInitialState({
27
- element,
28
- formVersion: editRecordState.valuesVersion,
29
- isRecordReadOnly,
30
- record
31
- }));
32
- const attribute = state.attribute;
33
- const activeValues = getActiveFieldValues(state);
34
- const activeVersion = state.values[state.activeScope].version;
35
- useEffect(() => {
36
- if (creationErrors[attribute.id]) {
37
- dispatch({
38
- type: LinkFieldReducerActionsType.SET_ERROR_MESSAGE,
39
- errorMessage: creationErrors[attribute.id].map(err => err.message).join(' ')
40
- });
41
- }
42
- }, [creationErrors, attribute.id]);
43
- const _handleDeleteValue = async (value) => {
44
- const deleteRes = await onValueDelete({ payload: value.linkValue.id, id_value: value.id_value }, attribute.id);
45
- if (deleteRes.status === APICallStatus.SUCCESS) {
46
- dispatch({
47
- type: LinkFieldReducerActionsType.DELETE_VALUE,
48
- idValue: value.id_value
49
- });
50
- }
51
- };
52
- const _handleUpdateValueSubmit = async (values) => {
53
- const valuesToSave = values.map(value => ({
54
- attribute,
55
- idValue: value.idValue,
56
- value: value.value
57
- }));
58
- const res = await onValueSubmit(valuesToSave, activeVersion);
59
- if (res.status === APICallStatus.ERROR) {
60
- dispatch({
61
- type: LinkFieldReducerActionsType.SET_ERROR_MESSAGE,
62
- errorMessage: res.error
63
- });
10
+ import styled from 'styled-components';
11
+ import { LINK_FIELD_ID_PREFIX } from '../../../../../constants';
12
+ import { computeCalculatedFlags, computeInheritedFlags } from '../shared/calculatedInheritedFlags';
13
+ import { ComputeIndicator } from '../shared/ComputeIndicator';
14
+ import { useOutsideInteractionDetector } from '../shared/useOutsideInteractionDetector';
15
+ import { useLinkRecordsInCreation } from './link-record-in-creation/useLinkRecordsInCreation';
16
+ import { useLinkRecordsInEdition } from './link-record-in-edition/useLinkRecordsInEdition';
17
+ import { CREATE_RECORD_MODAL_CLASSNAME, EDIT_RECORD_MODAL_CLASSNAME, LINK_RECORDS_MODAL_CLASSNAME } from '../../../../../components/Explorer/_constants';
18
+ const Wrapper = styled.div `
19
+ margin-bottom: ${props => (props.$metadataEdit ? 0 : '1.5em')};
20
+ `;
21
+ const KitInputExtraAlignLeft = styled.div `
22
+ margin-right: auto;
23
+ line-height: 12px;
24
+ `;
25
+ const KitInputWrapperStyled = styled(KitInputWrapper) `
26
+ &.disabled {
27
+ .kit-input-wrapper-content {
28
+ background-color: var(--general-utilities-neutral-light);
64
29
  }
65
- else if (res.values) {
66
- const formattedValues = res.values.map(v => ({
67
- ...v,
68
- version: arrayValueVersionToObject(v.version),
69
- metadata: v.metadata?.map(metadata => ({
70
- ...metadata,
71
- value: {
72
- ...metadata.value,
73
- version: arrayValueVersionToObject(metadata.value?.version ?? [])
74
- }
75
- }))
76
- }));
77
- dispatch({
78
- type: LinkFieldReducerActionsType.ADD_VALUES,
79
- values: formattedValues
80
- });
30
+ }
31
+
32
+ &.error:not(.disabled) {
33
+ .kit-input-wrapper-content {
34
+ background-color: var(--general-utilities-error-light);
81
35
  }
82
- if (res?.errors?.length) {
83
- const selectedRecordsById = values.reduce((acc, cur) => ({ ...acc, [cur.value.id]: cur.value }), {});
84
- const errorsMessage = res.errors.map(err => {
85
- const linkedRecordLabel = selectedRecordsById[err.input].label || selectedRecordsById[err.input].id;
86
- return `${linkedRecordLabel}: ${err.message}`;
87
- });
88
- dispatch({
89
- type: LinkFieldReducerActionsType.SET_ERROR_MESSAGE,
90
- errorMessage: errorsMessage
91
- });
92
- }
93
- };
94
- const label = localizedTranslation(state.formElement.settings.label, lang);
95
- return (_jsx(AntForm.Item, { name: attribute.id, rules: [
96
- {
97
- required: state.formElement.attribute.required,
98
- message: t('errors.standard_field_required')
99
- }
100
- ], children: attribute.multiple_values === true ? (_jsx(MultiValueSelect, { activeValues: activeValues, attribute: attribute, label: label, required: state.formElement.attribute.required, onValueDeselect: _handleDeleteValue, onSelectChange: _handleUpdateValueSubmit })) : (_jsx(MonoValueSelect, { activeValue: activeValues[0], attribute: attribute, label: label, required: state.formElement.attribute.required, onSelectClear: _handleDeleteValue, onSelectChange: _handleUpdateValueSubmit })) }));
36
+ }
37
+
38
+ .ant-empty-image,
39
+ .ant-empty-description {
40
+ display: none;
41
+ }
42
+ `;
43
+ const LinkField = ({ element, readonly, formIdToLoad, pendingValues, onDeleteMultipleValues, onValueSubmit, onValueDelete, metadataEdit = false }) => {
44
+ const { state, dispatch } = useEditRecordReducer();
45
+ const { lang } = useLang();
46
+ const { settings, attribute } = element;
47
+ const attributesPendingDefaultValues = pendingValues?.[attribute.id]
48
+ ? Object.values(pendingValues?.[attribute.id])
49
+ : [];
50
+ const [attributePendingValues, setAttributePendingValues] = useState(attributesPendingDefaultValues);
51
+ const [backendValues, setBackendValues] = useState(element.values);
52
+ const calculatedFlags = computeCalculatedFlags(backendValues);
53
+ const inheritedFlags = computeInheritedFlags(backendValues);
54
+ const form = AntForm.useFormInstance();
55
+ const label = localizedTranslation(settings.label, lang);
56
+ const fieldErrors = form.getFieldError(attribute.id);
57
+ const columnsToDisplay = settings.columns?.map(({ id }) => id);
58
+ const isReadOnly = attribute.readonly || readonly;
59
+ const isFieldInError = fieldErrors.length > 0;
60
+ useEffect(() => {
61
+ setAttributePendingValues(pendingValues?.[attribute.id]
62
+ ? Object.values(pendingValues?.[attribute.id])
63
+ : []);
64
+ }, [pendingValues, attribute.id]);
65
+ useOutsideInteractionDetector({
66
+ attribute,
67
+ activeAttribute: state.activeAttribute,
68
+ attributePrefix: LINK_FIELD_ID_PREFIX,
69
+ dispatch,
70
+ formIdToLoad,
71
+ backendValues,
72
+ pendingValues: attributePendingValues,
73
+ allowedSelectors: [
74
+ 'div[role="status"]:has(.kit-snackbar-message)',
75
+ '.kit-modal-wrapper',
76
+ `.${CREATE_RECORD_MODAL_CLASSNAME}`,
77
+ `.${LINK_RECORDS_MODAL_CLASSNAME}`,
78
+ `.${EDIT_RECORD_MODAL_CLASSNAME}`
79
+ ]
80
+ });
81
+ const { UnlinkAllRecordsInCreation, LinkRecordsInCreation } = useLinkRecordsInCreation({
82
+ attribute,
83
+ libraryId: attribute.linked_library.id,
84
+ pendingValues: attributePendingValues,
85
+ activeAttribute: state.activeAttribute,
86
+ dispatch,
87
+ isHookUsed: formIdToLoad === 'creation',
88
+ isReadOnly,
89
+ isFieldInError,
90
+ onValueSubmit,
91
+ onValueDelete
92
+ });
93
+ const { UnlinkAllRecordsInEdition, LinkRecordsInEditionExplorer } = useLinkRecordsInEdition({
94
+ libraryId: state.libraryId,
95
+ recordId: state.record?.id,
96
+ attribute,
97
+ columnsToDisplay,
98
+ backendValues,
99
+ setBackendValues,
100
+ activeAttribute: state.activeAttribute,
101
+ dispatch,
102
+ isHookUsed: formIdToLoad !== 'creation',
103
+ isReadOnly,
104
+ isFieldInError,
105
+ hasNoValue: backendValues.length === 0,
106
+ onDeleteMultipleValues
107
+ });
108
+ return (_jsx(Wrapper, { "$metadataEdit": metadataEdit, children: _jsx(AntForm.Item, { name: attribute.id, noStyle: true, children: _jsx(KitInputWrapperStyled, { id: LINK_FIELD_ID_PREFIX + attribute.id, label: label, required: attribute.required, bordered: true, disabled: isReadOnly, status: isFieldInError ? 'error' : undefined, helper: isFieldInError ? String(fieldErrors[0]) : undefined, extra: _jsxs(_Fragment, { children: [_jsx(KitInputExtraAlignLeft, { children: _jsx(ComputeIndicator, { calculatedFlags: calculatedFlags, inheritedFlags: inheritedFlags }) }), formIdToLoad === 'creation' ? UnlinkAllRecordsInCreation : UnlinkAllRecordsInEdition] }), children: formIdToLoad === 'creation' ? LinkRecordsInCreation : LinkRecordsInEditionExplorer }) }) }));
101
109
  };
102
110
  export default LinkField;
103
111
  //# sourceMappingURL=LinkField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinkField.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAwB,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACxE,OAAO,EAA6B,UAAU,EAAE,SAAS,EAAE,UAAU,EAAC,MAAM,OAAO,CAAC;AACpF,OAAO,oBAAoB,MAAM,8DAA8D,CAAC;AAChG,OAAO,EAAC,oBAAoB,EAAC,MAAM,qEAAqE,CAAC;AAEzG,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAIpE,OAAO,EAAC,yBAAyB,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,oBAAoB,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,uBAAuB,EAAC,MAAM,qCAAqC,CAAC;AAC5E,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACH,mBAAmB,EAGnB,2BAA2B,EAC9B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAoB,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAC,eAAe,EAAC,MAAM,qGAAqG,CAAC;AACpI,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAKlC,MAAM,SAAS,GAAgE,CAAC,EAC5E,OAAO,EACP,aAAa,EAC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9C,OAAO,EAAE,CAAC,CAAC,gCAAgC,CAAC;aAC/C;SACJ,YAEA,SAAS,CAAC,eAAe,KAAK,IAAI,CAAC,CAAC,CAAC,CAClC,KAAC,gBAAgB,IACb,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,EAC9C,eAAe,EAAE,kBAAkB,EACnC,cAAc,EAAE,wBAAwB,GAC1C,CACL,CAAC,CAAC,CAAC,CACA,KAAC,eAAe,IACZ,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC,EAC5B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,EAC9C,aAAa,EAAE,kBAAkB,EACjC,cAAc,EAAE,wBAAwB,GAC1C,CACL,GACU,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"LinkField.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAwB,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACxE,OAAO,EAAoB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,qEAAqE,CAAC;AAKzG,OAAO,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;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K,EACD,8BACI,KAAC,sBAAsB,cACnB,KAAC,gBAAgB,IAAC,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,GAAI,GACjE,EACxB,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,yBAAyB,IACtF,YAGN,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,4BAA4B,GAC/D,GACb,GACT,CACb,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { IItemData } from '../../../../../../components/Explorer/_types';
2
+ export declare const useEditRecord: () => {
3
+ openModal: (item: IItemData) => void;
4
+ EditRecordModal: JSX.Element;
5
+ };
@@ -0,0 +1,39 @@
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 { useState } from 'react';
6
+ import { EditRecordModal } from '../../../../../../components/RecordEdition/EditRecordModal';
7
+ import { RecordFilterCondition, useExplorerLibraryDataLazyQuery } from '../../../../../../_gqlTypes';
8
+ import { EDIT_RECORD_MODAL_CLASSNAME } from '../../../../../../components/Explorer/_constants';
9
+ export const useEditRecord = () => {
10
+ const [editingItem, setEditingItem] = useState(null);
11
+ const [isModalVisible, setIsModalVisible] = useState(false);
12
+ const [refreshItem] = useExplorerLibraryDataLazyQuery({ fetchPolicy: 'network-only' });
13
+ const openModal = (item) => {
14
+ setEditingItem(item);
15
+ setIsModalVisible(true);
16
+ };
17
+ const _handleEditModalClose = (item) => {
18
+ refreshItem({
19
+ variables: {
20
+ libraryId: item.libraryId,
21
+ attributeIds: ['id'],
22
+ pagination: { limit: 1 },
23
+ filters: [
24
+ {
25
+ condition: RecordFilterCondition.EQUAL,
26
+ field: 'id',
27
+ value: item.itemId
28
+ }
29
+ ]
30
+ }
31
+ });
32
+ setEditingItem(null);
33
+ };
34
+ return {
35
+ openModal,
36
+ EditRecordModal: isModalVisible && editingItem !== null ? (_jsx(EditRecordModal, { className: EDIT_RECORD_MODAL_CLASSNAME, open: true, record: editingItem.whoAmI, library: editingItem.libraryId, onClose: () => _handleEditModalClose(editingItem) })) : null
37
+ };
38
+ };
39
+ //# sourceMappingURL=useEditRecord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEditRecord.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,eAAe,EAAC,MAAM,8CAA8C,CAAC;AAE7E,OAAO,EAAC,qBAAqB,EAAE,+BAA+B,EAAC,MAAM,eAAe,CAAC;AACrF,OAAO,EAAC,2BAA2B,EAAC,MAAM,oCAAoC,CAAC;AAE/E,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAC9B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAmB,IAAI,CAAC,CAAC;IACvE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,CAAC,WAAW,CAAC,GAAG,+BAA+B,CAAC,EAAC,WAAW,EAAE,cAAc,EAAC,CAAC,CAAC;IAErF,MAAM,SAAS,GAAG,CAAC,IAAe,EAAE,EAAE;QAClC,cAAc,CAAC,IAAI,CAAC,CAAC;QACrB,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,MAAM,qBAAqB,GAAG,CAAC,IAAe,EAAE,EAAE;QAC9C,WAAW,CAAC;YACR,SAAS,EAAE;gBACP,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,YAAY,EAAE,CAAC,IAAI,CAAC;gBACpB,UAAU,EAAE,EAAC,KAAK,EAAE,CAAC,EAAC;gBACtB,OAAO,EAAE;oBACL;wBACI,SAAS,EAAE,qBAAqB,CAAC,KAAK;wBACtC,KAAK,EAAE,IAAI;wBACX,KAAK,EAAE,IAAI,CAAC,MAAM;qBACrB;iBACJ;aACJ;SACJ,CAAC,CAAC;QACH,cAAc,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO;QACH,SAAS;QACT,eAAe,EACX,cAAc,IAAI,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,CACrC,KAAC,eAAe,IACZ,SAAS,EAAE,2BAA2B,EACtC,IAAI,QACJ,MAAM,EAAE,WAAW,CAAC,MAAM,EAC1B,OAAO,EAAE,WAAW,CAAC,SAAS,EAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,WAAW,CAAC,GACnD,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { IItemData } from '../../../../../../components/Explorer/_types';
2
+ interface IUnselectRecordProps {
3
+ unlinkRecords: (recordIds: string[]) => void;
4
+ }
5
+ export declare const useUnselectRecord: ({ unlinkRecords }: IUnselectRecordProps) => {
6
+ callback: (item: IItemData) => void;
7
+ };
8
+ export {};
@@ -0,0 +1,23 @@
1
+ // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
2
+ // This file is released under LGPL V3
3
+ // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
4
+ import { KitModal } from 'aristid-ds';
5
+ import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
6
+ export const useUnselectRecord = ({ unlinkRecords }) => {
7
+ const { t } = useSharedTranslation();
8
+ return {
9
+ callback: (item) => {
10
+ KitModal.confirm({
11
+ type: 'confirm',
12
+ dangerConfirm: true,
13
+ content: t('record_edition.delete_link_confirm'),
14
+ okText: t('global.submit') ?? undefined,
15
+ cancelText: t('global.cancel') ?? undefined,
16
+ onOk: async () => {
17
+ unlinkRecords([item.itemId]);
18
+ }
19
+ });
20
+ }
21
+ };
22
+ };
23
+ //# sourceMappingURL=useUnselectRecord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUnselectRecord.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAOpE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAC,aAAa,EAAuB,EAAE,EAAE;IACvE,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,OAAO;QACH,QAAQ,EAAE,CAAC,IAAe,EAAE,EAAE;YAC1B,QAAQ,CAAC,OAAO,CAAC;gBACb,IAAI,EAAE,SAAS;gBACf,aAAa,EAAE,IAAI;gBACnB,OAAO,EAAE,CAAC,CAAC,oCAAoC,CAAC;gBAChD,MAAM,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI,SAAS;gBACvC,UAAU,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI,SAAS;gBAC3C,IAAI,EAAE,KAAK,IAAI,EAAE;oBACb,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBACjC,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { MassSelection } from '../../../../../../components/Explorer/_types';
2
+ import { RecordFilterInput } from '../../../../../../_gqlTypes';
3
+ interface IUnselectAllRecordsProps {
4
+ unlinkRecords: (recordIds: string[]) => void;
5
+ }
6
+ export declare const useUnselectAllRecords: ({ unlinkRecords }: IUnselectAllRecordsProps) => {
7
+ callback: (massSelectionFilter: RecordFilterInput[], _massSelection: MassSelection) => void;
8
+ };
9
+ export {};
@@ -0,0 +1,23 @@
1
+ // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
2
+ // This file is released under LGPL V3
3
+ // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
4
+ import { KitModal } from 'aristid-ds';
5
+ import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
6
+ export const useUnselectAllRecords = ({ unlinkRecords }) => {
7
+ const { t } = useSharedTranslation();
8
+ return {
9
+ callback: (massSelectionFilter, _massSelection) => {
10
+ KitModal.confirm({
11
+ type: 'confirm',
12
+ dangerConfirm: true,
13
+ content: t('record_edition.delete_links_confirm'),
14
+ okText: t('global.submit') ?? undefined,
15
+ cancelText: t('global.cancel') ?? undefined,
16
+ onOk: async () => {
17
+ unlinkRecords(massSelectionFilter.map(filter => filter.value));
18
+ }
19
+ });
20
+ }
21
+ };
22
+ };
23
+ //# sourceMappingURL=useUnselectAllRecords.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUnselectAllRecords.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAQpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAC,aAAa,EAA2B,EAAE,EAAE;IAC/E,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,OAAO;QACH,QAAQ,EAAE,CAAC,mBAAwC,EAAE,cAA6B,EAAE,EAAE;YAClF,QAAQ,CAAC,OAAO,CAAC;gBACb,IAAI,EAAE,SAAS;gBACf,aAAa,EAAE,IAAI;gBACnB,OAAO,EAAE,CAAC,CAAC,qCAAqC,CAAC;gBACjD,MAAM,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI,SAAS;gBACvC,UAAU,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI,SAAS;gBAC3C,IAAI,EAAE,KAAK,IAAI,EAAE;oBACb,aAAa,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBACnE,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ interface IUseCreateRecordProps {
2
+ linkRecords: (recordIds: string[]) => void;
3
+ }
4
+ export declare const useCreateRecord: ({ linkRecords }: IUseCreateRecordProps) => {
5
+ openModal: (libraryIdParam: string) => void;
6
+ CreateRecordModal: JSX.Element;
7
+ };
8
+ export {};
@@ -0,0 +1,26 @@
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 { useState } from 'react';
6
+ import { EditRecordModal } from '../../../../../../components/RecordEdition/EditRecordModal';
7
+ import { CREATE_RECORD_MODAL_CLASSNAME } from '../../../../../../components/Explorer/_constants';
8
+ export const useCreateRecord = ({ linkRecords }) => {
9
+ const [libraryId, setLibraryId] = useState(null);
10
+ const [isModalVisible, setIsModalVisible] = useState(false);
11
+ const openModal = (libraryIdParam) => {
12
+ setLibraryId(libraryIdParam);
13
+ setIsModalVisible(true);
14
+ };
15
+ const closeModal = () => {
16
+ setIsModalVisible(false);
17
+ };
18
+ return {
19
+ openModal,
20
+ CreateRecordModal: isModalVisible && libraryId !== null ? (_jsx(EditRecordModal, { className: CREATE_RECORD_MODAL_CLASSNAME, open: true, record: null, library: libraryId, onClose: closeModal, onCreate: newRecord => {
21
+ linkRecords([newRecord.id]);
22
+ closeModal();
23
+ }, submitButtons: ['create'] })) : null
24
+ };
25
+ };
26
+ //# sourceMappingURL=useCreateRecord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateRecord.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,eAAe,EAAC,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAC,6BAA6B,EAAC,MAAM,oCAAoC,CAAC;AAMjF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAC,WAAW,EAAwB,EAAE,EAAE;IACpE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAChE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5D,MAAM,SAAS,GAAG,CAAC,cAAsB,EAAE,EAAE;QACzC,YAAY,CAAC,cAAc,CAAC,CAAC;QAC7B,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,GAAG,EAAE;QACpB,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,OAAO;QACH,SAAS;QACT,iBAAiB,EACb,cAAc,IAAI,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,CACnC,KAAC,eAAe,IACZ,SAAS,EAAE,6BAA6B,EACxC,IAAI,QACJ,MAAM,EAAE,IAAI,EACZ,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,SAAS,CAAC,EAAE;gBAClB,WAAW,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC5B,UAAU,EAAE,CAAC;YACjB,CAAC,EACD,aAAa,EAAE,CAAC,QAAQ,CAAC,GAC3B,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ type SelectionMode = 'simple' | 'multiple';
2
+ interface IUseRecordSelectorProps {
3
+ libraryId: string;
4
+ selectionMode: SelectionMode;
5
+ isReplacementMode: boolean;
6
+ linkRecords: (recordIds: string[]) => void;
7
+ }
8
+ export declare const useRecordSelector: ({ libraryId, selectionMode, isReplacementMode, linkRecords }: IUseRecordSelectorProps) => {
9
+ openModal: () => void;
10
+ RecordSelectorModal: JSX.Element;
11
+ };
12
+ export {};
@@ -0,0 +1,24 @@
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 { useState } from 'react';
6
+ import { SelectRecordForLinkModal } from '../../../../../../components/SelectRecordForLinkModal';
7
+ import { LINK_RECORDS_MODAL_CLASSNAME } from '../../../../../../components/Explorer/_constants';
8
+ export const useRecordSelector = ({ libraryId, selectionMode, isReplacementMode, linkRecords }) => {
9
+ const [isModalVisible, setIsModalVisible] = useState(false);
10
+ const openModal = () => {
11
+ setIsModalVisible(true);
12
+ };
13
+ const closeModal = () => {
14
+ setIsModalVisible(false);
15
+ };
16
+ return {
17
+ openModal,
18
+ RecordSelectorModal: isModalVisible ? (_jsx(SelectRecordForLinkModal, { className: LINK_RECORDS_MODAL_CLASSNAME, open: true, replacementMode: isReplacementMode, childLibraryId: libraryId, selectionMode: selectionMode, hideSelectAllAction: selectionMode !== 'multiple', onSelectionCompleted: data => {
19
+ linkRecords(data.records.list.map(record => record.id));
20
+ closeModal();
21
+ }, onClose: closeModal })) : null
22
+ };
23
+ };
24
+ //# sourceMappingURL=useRecordSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRecordSelector.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAC,4BAA4B,EAAC,MAAM,oCAAoC,CAAC;AAWhF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAC9B,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,WAAW,EACW,EAAE,EAAE;IAC1B,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5D,MAAM,SAAS,GAAG,GAAG,EAAE;QACnB,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,GAAG,EAAE;QACpB,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,OAAO;QACH,SAAS;QACT,mBAAmB,EAAE,cAAc,CAAC,CAAC,CAAC,CAClC,KAAC,wBAAwB,IACrB,SAAS,EAAE,4BAA4B,EACvC,IAAI,QACJ,eAAe,EAAE,iBAAiB,EAClC,cAAc,EAAE,SAAS,EACzB,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,aAAa,KAAK,UAAU,EACjD,oBAAoB,EAAE,IAAI,CAAC,EAAE;gBACzB,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;gBACxD,UAAU,EAAE,CAAC;YACjB,CAAC,EACD,OAAO,EAAE,UAAU,GACrB,CACL,CAAC,CAAC,CAAC,IAAI;KACX,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { RecordFormAttributeFragment } from '../../../../../../_gqlTypes';
2
+ import { DeleteValueFunc, SubmitValueFunc } from '../../../_types';
3
+ import { IExplorerFilterStandard } from '../../../../../../components/Explorer/_types';
4
+ interface IUseLinkRecordsProps {
5
+ attribute: RecordFormAttributeFragment;
6
+ libraryId: string;
7
+ onValueSubmit: SubmitValueFunc;
8
+ onValueDelete: DeleteValueFunc;
9
+ }
10
+ export declare const useLinkRecords: ({ attribute, libraryId, onValueSubmit, onValueDelete }: IUseLinkRecordsProps) => {
11
+ explorerFilters: IExplorerFilterStandard[];
12
+ explorerKey: number;
13
+ selectedRecordIds: string[];
14
+ linkRecords: (recordIds: string[]) => void;
15
+ unlinkRecords: (recordIds?: string[]) => void;
16
+ hasNoSelectedRecord: boolean;
17
+ canDeleteAllValues: boolean;
18
+ };
19
+ export {};
@@ -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,GAA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Aa;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 {};