@leav/ui 1.6.0-fb9dc9ec → 1.7.0-178015c1

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 (273) hide show
  1. package/README.md +13 -12
  2. package/dist/__mocks__/react-i18next.d.ts +1 -1
  3. package/dist/_gqlTypes/index.d.ts +1006 -686
  4. package/dist/_gqlTypes/index.js +167 -43
  5. package/dist/_gqlTypes/index.js.map +1 -1
  6. package/dist/_queries/attributes/attributeDetailsFragment.js +5 -0
  7. package/dist/_queries/attributes/attributeDetailsFragment.js.map +1 -1
  8. package/dist/_queries/trees/treeNodeChildrenQuery.js +2 -0
  9. package/dist/_queries/trees/treeNodeChildrenQuery.js.map +1 -1
  10. package/dist/_queries/views/viewDetailsFragment.js +1 -0
  11. package/dist/_queries/views/viewDetailsFragment.js.map +1 -1
  12. package/dist/components/AttributesSelectionList/SelectedAttributesList/SelectedAttributesList.js +20 -12
  13. package/dist/components/AttributesSelectionList/SelectedAttributesList/SelectedAttributesList.js.map +1 -1
  14. package/dist/components/AttributesSelectionList/reducer/__mocks__/attributesSelectionListStateContext.d.ts +1 -1
  15. package/dist/components/AttributesSelectionList/sharedComponents.d.ts +159 -153
  16. package/dist/components/Explorer/DataView.d.ts +2 -0
  17. package/dist/components/Explorer/DataView.js +6 -3
  18. package/dist/components/Explorer/DataView.js.map +1 -1
  19. package/dist/components/Explorer/Explorer.d.ts +2 -0
  20. package/dist/components/Explorer/Explorer.js +7 -5
  21. package/dist/components/Explorer/Explorer.js.map +1 -1
  22. package/dist/components/Explorer/ExplorerFiltersAndSorts.js +1 -1
  23. package/dist/components/Explorer/ExplorerFiltersAndSorts.js.map +1 -1
  24. package/dist/components/Explorer/TableCell.js +6 -7
  25. package/dist/components/Explorer/TableCell.js.map +1 -1
  26. package/dist/components/Explorer/TableNameCell.js +3 -2
  27. package/dist/components/Explorer/TableNameCell.js.map +1 -1
  28. package/dist/components/Explorer/_queries/useExplorerData.d.ts +7 -7
  29. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js +3 -2
  30. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -1
  31. package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +2 -1
  32. package/dist/components/Explorer/actions-item/useReplaceItemAction.js +5 -4
  33. package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
  34. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.d.ts +2 -4
  35. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js +18 -16
  36. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js.map +1 -1
  37. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js +2 -2
  38. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js.map +1 -1
  39. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js +9 -1
  40. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js.map +1 -1
  41. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.d.ts +10 -3
  42. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js +16 -6
  43. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js.map +1 -1
  44. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.d.ts +10 -0
  45. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js +46 -0
  46. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js.map +1 -0
  47. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.d.ts +1 -0
  48. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js +17 -0
  49. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js.map +1 -0
  50. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.d.ts +8 -0
  51. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js +49 -0
  52. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js.map +1 -0
  53. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.d.ts +27 -0
  54. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js +48 -0
  55. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js.map +1 -0
  56. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +3 -2
  57. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
  58. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +3 -2
  59. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
  60. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +3 -2
  61. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
  62. package/dist/components/Explorer/actions-mass/useExportMassAction.d.ts +7 -4
  63. package/dist/components/Explorer/actions-mass/useExportMassAction.js +80 -73
  64. package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
  65. package/dist/components/Explorer/actions-mass/useMassActions.js +3 -2
  66. package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
  67. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +3 -2
  68. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
  69. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +2 -1
  70. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +5 -4
  71. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
  72. package/dist/components/Explorer/link-item/LinkModal.d.ts +1 -0
  73. package/dist/components/Explorer/link-item/LinkModal.js +2 -2
  74. package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
  75. package/dist/components/Explorer/list-saved-views/SavedViews.js +4 -3
  76. package/dist/components/Explorer/list-saved-views/SavedViews.js.map +1 -1
  77. package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js +5 -8
  78. package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js.map +1 -1
  79. package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js +3 -2
  80. package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js.map +1 -1
  81. package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +7 -6
  82. package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -1
  83. package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js +3 -2
  84. package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js.map +1 -1
  85. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +4 -3
  86. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
  87. package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js +3 -2
  88. package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js.map +1 -1
  89. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js +3 -2
  90. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js.map +1 -1
  91. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js +3 -2
  92. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js.map +1 -1
  93. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +3 -0
  94. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
  95. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js +3 -2
  96. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js.map +1 -1
  97. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js +4 -3
  98. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js.map +1 -1
  99. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js +3 -2
  100. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js.map +1 -1
  101. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js +3 -2
  102. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js.map +1 -1
  103. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js +3 -2
  104. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js.map +1 -1
  105. package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js +3 -2
  106. package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js.map +1 -1
  107. package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js +7 -6
  108. package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js.map +1 -1
  109. package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js +3 -2
  110. package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js.map +1 -1
  111. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
  112. package/dist/components/Explorer/useSearchInput.js +6 -2
  113. package/dist/components/Explorer/useSearchInput.js.map +1 -1
  114. package/dist/components/Filters/FiltersProvider.d.ts +2 -2
  115. package/dist/components/Filters/FiltersProvider.js.map +1 -1
  116. package/dist/components/Filters/_types.d.ts +3 -0
  117. package/dist/components/Filters/_types.js.map +1 -1
  118. package/dist/components/Filters/context/filtersReducer.js +7 -4
  119. package/dist/components/Filters/context/filtersReducer.js.map +1 -1
  120. package/dist/components/Filters/filter-items/CommonFilterItem.d.ts +1 -0
  121. package/dist/components/Filters/filter-items/CommonFilterItem.js +28 -8
  122. package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
  123. package/dist/components/Filters/filter-items/EmptyValueCheckbox.d.ts +8 -0
  124. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js +16 -0
  125. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js.map +1 -0
  126. package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js +23 -9
  127. package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js.map +1 -1
  128. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js +9 -8
  129. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js.map +1 -1
  130. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js +4 -3
  131. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js.map +1 -1
  132. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js +1 -1
  133. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js.map +1 -1
  134. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.d.ts +0 -1
  135. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js +17 -23
  136. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js.map +1 -1
  137. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js +10 -12
  138. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -1
  139. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js +3 -13
  140. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
  141. package/dist/components/Filters/index.d.ts +1 -0
  142. package/dist/components/Filters/index.js +1 -0
  143. package/dist/components/Filters/index.js.map +1 -1
  144. package/dist/components/Filters/prepareFiltersForRequest.js +36 -3
  145. package/dist/components/Filters/prepareFiltersForRequest.js.map +1 -1
  146. package/dist/components/Filters/useFilters.d.ts +5 -0
  147. package/dist/components/Filters/useTransformFilters.js +4 -0
  148. package/dist/components/Filters/useTransformFilters.js.map +1 -1
  149. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.d.ts +1 -3
  150. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js +6 -2
  151. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js.map +1 -1
  152. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js +1 -8
  153. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js.map +1 -1
  154. package/dist/components/LibraryItemsList/FiltersPanel/FiltersPanel.js +15 -17
  155. package/dist/components/LibraryItemsList/FiltersPanel/FiltersPanel.js.map +1 -1
  156. package/dist/components/LibraryItemsList/LibraryItemsListTable/ChooseTableColumns/ChooseTableColumns.js +0 -6
  157. package/dist/components/LibraryItemsList/LibraryItemsListTable/ChooseTableColumns/ChooseTableColumns.js.map +1 -1
  158. package/dist/components/LibraryItemsList/MenuView/MenuView.js +4 -4
  159. package/dist/components/LibraryItemsList/MenuView/MenuView.js.map +1 -1
  160. package/dist/components/LibraryItemsList/ViewPanel/View/View.d.ts +1 -3
  161. package/dist/components/LibraryItemsList/ViewPanel/View/View.js +9 -4
  162. package/dist/components/LibraryItemsList/ViewPanel/View/View.js.map +1 -1
  163. package/dist/components/LibraryItemsList/ViewPanel/ViewPanel.js +36 -14
  164. package/dist/components/LibraryItemsList/ViewPanel/ViewPanel.js.map +1 -1
  165. package/dist/components/Notifications/hooks/useNotificationSubscription.js +3 -2
  166. package/dist/components/Notifications/hooks/useNotificationSubscription.js.map +1 -1
  167. package/dist/components/RecordEdition/EditRecord/EditRecord.d.ts +1 -0
  168. package/dist/components/RecordEdition/EditRecord/EditRecord.js +3 -3
  169. package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
  170. package/dist/components/RecordEdition/EditRecordContent/antdUtils.js.map +1 -1
  171. package/dist/components/RecordEdition/EditRecordContent/hooks/__mocks__/useDeleteValueMutation.d.ts +1 -1
  172. package/dist/components/RecordEdition/EditRecordContent/hooks/__mocks__/useSaveValueMutation.d.ts +1 -1
  173. package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js +5 -20
  174. package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js.map +1 -1
  175. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.d.ts +1 -11
  176. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +8 -95
  177. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
  178. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/_types.d.ts +8 -0
  179. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/_types.js +2 -0
  180. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/_types.js.map +1 -0
  181. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/LinkFieldExplorer.d.ts +6 -0
  182. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/LinkFieldExplorer.js +77 -0
  183. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/LinkFieldExplorer.js.map +1 -0
  184. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record → explorer/link-record}/useExplorerLinkRecords.d.ts +5 -7
  185. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record → explorer/link-record}/useExplorerLinkRecords.js +3 -10
  186. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/link-record/useExplorerLinkRecords.js.map +1 -0
  187. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record → explorer/link-record}/useLinkRecords.d.ts +5 -6
  188. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/link-record/useLinkRecords.js +98 -0
  189. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/link-record/useLinkRecords.js.map +1 -0
  190. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/{ExplorerWrapper.d.ts → InputExtraAlignLeft.d.ts} +54 -52
  191. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record/ActionButton.js → shared/InputExtraAlignLeft.js} +4 -4
  192. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/InputExtraAlignLeft.js.map +1 -0
  193. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/InputWrapper.d.ts +3 -0
  194. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/InputWrapper.js +31 -0
  195. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/InputWrapper.js.map +1 -0
  196. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/Wrapper.d.ts +3 -0
  197. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/Wrapper.js +8 -0
  198. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/Wrapper.js.map +1 -0
  199. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/LinkFieldTags.d.ts +3 -0
  200. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/LinkFieldTags.js +57 -0
  201. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/LinkFieldTags.js.map +1 -0
  202. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/link-record/useLinkRecord.d.ts +16 -0
  203. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/link-record/useLinkRecord.js +82 -0
  204. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/link-record/useLinkRecord.js.map +1 -0
  205. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.d.ts +19 -0
  206. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.js +43 -0
  207. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.js.map +1 -0
  208. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/unlink-all-records/useUnlinkAllRecords.d.ts +16 -0
  209. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/unlink-all-records/useUnlinkAllRecords.js +27 -0
  210. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/unlink-all-records/useUnlinkAllRecords.js.map +1 -0
  211. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +4 -3
  212. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
  213. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +9 -2
  214. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
  215. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.d.ts +53 -51
  216. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +3 -2
  217. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -1
  218. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +2 -1
  219. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +4 -7
  220. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
  221. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +3 -2
  222. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +2 -2
  223. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -1
  224. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js +3 -2
  225. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -1
  226. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.d.ts +1 -0
  227. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js +2 -2
  228. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js.map +1 -1
  229. package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js +3 -2
  230. package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js.map +1 -1
  231. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +4 -3
  232. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
  233. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js +3 -2
  234. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js.map +1 -1
  235. package/dist/components/RecordEdition/hooks/useGetSubmitButtons.js +2 -2
  236. package/dist/components/RecordEdition/hooks/useGetSubmitButtons.js.map +1 -1
  237. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +1 -0
  238. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +7 -7
  239. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
  240. package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +2 -1
  241. package/dist/components/SelectTreeNode/SelectTreeNode.js +3 -3
  242. package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
  243. package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +2 -1
  244. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +6 -2
  245. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
  246. package/dist/components/SelectTreeNode/TreeNodeTitle.js +3 -2
  247. package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -1
  248. package/dist/constants.d.ts +1 -0
  249. package/dist/constants.js +1 -0
  250. package/dist/constants.js.map +1 -1
  251. package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +3 -1
  252. package/dist/hooks/useIFrameMessenger/messageHandlers.js +16 -0
  253. package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -1
  254. package/dist/hooks/useIFrameMessenger/schema.d.ts +6 -3
  255. package/dist/hooks/useIFrameMessenger/schema.js +2 -1
  256. package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
  257. package/dist/hooks/useIFrameMessenger/types.d.ts +32 -2
  258. package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
  259. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +2 -0
  260. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +16 -2
  261. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -1
  262. package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +2 -0
  263. package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +2 -0
  264. package/dist/locales/en/shared.json +18 -3
  265. package/dist/locales/fr/shared.json +18 -3
  266. package/package.json +40 -42
  267. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.d.ts +0 -3
  268. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.js.map +0 -1
  269. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useExplorerLinkRecords.js.map +0 -1
  270. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js +0 -100
  271. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +0 -1
  272. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.js +0 -13
  273. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TableNameCell.js","sourceRoot":"","sources":["../../../src/components/Explorer/TableNameCell.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,YAAY,EAAqB,MAAM,EAAC,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AAC9D,OAAO,M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E;4BACF,KAAK,EAAE,uBAAuB;iCACzB,KAAK,CAAC,CAAC,CAAC;iCACR,GAAG,CAAC,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAC,EAAE,EAAE,CAAC,CAAC;gCACnD,GAAG,EAAE,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC;gCACvC,MAAM,EAAE,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC;gCAC7C,QAAQ,EAAE,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC;gCAC/C,KAAK,EAAE,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC;gCACzC,IAAI,EAAE,IAAI;oCACN,CAAC,CAAC,YAAY,CAAC,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;wCAC5C,IAAI,EAAE,KAAK;qCACd,CAAC;oCACJ,CAAC,CAAC,IAAI,EAAE,2BAA2B;gCACvC,OAAO,EAAE,QAAQ;6BACpB,CAAC,CAAC;yBACV,YAED,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAC,EACjC,eAAe,EAAE,gCAAgC,YAEjD,KAAC,SAAS,IACN,IAAI,EAAC,GAAG,gBACI,CAAC,CAAC,uBAAuB,CAAC,IAAI,SAAS,EACnD,IAAI,EAAE,KAAC,WAAW,KAAG,EACrB,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,GAC3C,GACO,GACH,CACjB,IACe,IACO,CAClC,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {IdCard} from './IdCard';\nimport {type IItemAction, type IItemData} from './_types';\nimport {cloneElement, type ReactElement, useRef} from 'react';\nimport {KitButton, KitDropDown, KitTooltip} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {FaEllipsisH} from 'react-icons/fa';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {TOOLTIP_DEFAULT_DELAY_IN_SECONDS} from '_ui/constants';\n\nconst StyledTableNameCellContainer = styled.div`\n position: relative;\n display: inline-flex;\n align-items: center;\n width: 100%;\n`;\n\nconst StyledActionsList = styled.div`\n /* Action are displayed when the user hover the table row (CSS in DataView.tsx) */\n display: none;\n gap: calc(var(--general-spacing-xxs) * 1px);\n transition:\n display 0.2s ease-in-out,\n align-items: center;\n justify-content: center;\n margin-left: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst StyledIdCard = styled.div`\n flex: 1;\n`;\n\ntype ResolvedItemActionProp<T> = T extends (item: IItemData) => infer R ? R : T;\n\nconst resolveItemActionProp = <T extends IItemAction[keyof IItemAction]>(\n itemData: IItemData,\n itemActionProp: T,\n): ResolvedItemActionProp<T> =>\n (typeof itemActionProp === 'function' ? itemActionProp(itemData) : itemActionProp) as ResolvedItemActionProp<T>;\n\ninterface ITableNameCellProps {\n item: IItemData;\n itemActions: IItemAction[];\n}\n\nexport const TableNameCell = ({item, itemActions}: ITableNameCellProps) => {\n const {t} = useSharedTranslation();\n const containerRef = useRef<HTMLDivElement>(null);\n\n const itemActionsWithCallback = itemActions.map(action => ({\n ...action,\n callback: () => action.callback(item),\n }));\n\n const isMoreThanThreeActions = itemActionsWithCallback.length > 3;\n\n const itemsActionsWithCallbackToDisplay = isMoreThanThreeActions\n ? itemActionsWithCallback.slice(0, 2)\n : itemActionsWithCallback;\n\n const _handleButtonClick = (event: MouseEvent, callback: () => void) => {\n // Stop event propagation to avoid the row click event to be triggered\n event.stopPropagation();\n callback();\n };\n\n return (\n <StyledTableNameCellContainer ref={containerRef}>\n <StyledIdCard>\n <IdCard item={item.whoAmI} />\n </StyledIdCard>\n <StyledActionsList className=\"actions-list\">\n {itemsActionsWithCallbackToDisplay.map(\n ({label, icon, isDanger, callback, disabled, useItemDeletePermission}, actionIndex) => {\n const disabledButton = useItemDeletePermission\n ? !item.canDelete\n : resolveItemActionProp(item, disabled);\n\n return (\n <KitTooltip\n key={actionIndex}\n title={resolveItemActionProp(item, label)}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <KitButton\n size=\"m\"\n aria-label={resolveItemActionProp(item, label)}\n icon={resolveItemActionProp(item, icon)}\n onClick={event => _handleButtonClick(event, callback)}\n danger={resolveItemActionProp(item, isDanger)}\n disabled={disabledButton}\n />\n </KitTooltip>\n );\n },\n )}\n {isMoreThanThreeActions && (\n <KitDropDown\n placement=\"bottomRight\"\n getPopupContainer={() => containerRef.current || document.body}\n destroyPopupOnHide={true}\n menu={{\n items: itemActionsWithCallback\n .slice(2)\n .map(({callback, icon, label, isDanger, disabled}) => ({\n key: resolveItemActionProp(item, label),\n danger: resolveItemActionProp(item, isDanger),\n disabled: resolveItemActionProp(item, disabled),\n label: resolveItemActionProp(item, label),\n icon: icon\n ? cloneElement(resolveItemActionProp(item, icon), {\n size: '2em',\n })\n : null, // TODO: find better tuning\n onClick: callback,\n })),\n }}\n >\n <KitTooltip\n title={t('explorer.more-actions')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <KitButton\n size=\"m\"\n aria-label={t('explorer.more-actions') ?? undefined}\n icon={<FaEllipsisH />}\n onClick={event => event.stopPropagation()}\n />\n </KitTooltip>\n </KitDropDown>\n )}\n </StyledActionsList>\n </StyledTableNameCellContainer>\n );\n};\n"]}
1
+ {"version":3,"file":"TableNameCell.js","sourceRoot":"","sources":["../../../src/components/Explorer/TableNameCell.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,YAAY,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM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AAC,OAAO,IAAI,QAAQ,CAAC,IAAI,EAC9D,kBAAkB,EAAE,IAAI,EACxB,IAAI,EAAE;4BACF,KAAK,EAAE,uBAAuB;iCACzB,KAAK,CAAC,CAAC,CAAC;iCACR,GAAG,CAAC,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAC,EAAE,EAAE,CAAC,CAAC;gCACnD,GAAG,EAAE,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC;gCACvC,MAAM,EAAE,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC;gCAC7C,QAAQ,EAAE,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC;gCAC/C,KAAK,EAAE,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC;gCACzC,IAAI,EAAE,IAAI;oCACN,CAAC,CAAC,YAAY,CAAC,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;wCAC5C,IAAI,EAAE,KAAK;qCACd,CAAC;oCACJ,CAAC,CAAC,IAAI,EAAE,2BAA2B;gCACvC,OAAO,EAAE,QAAQ;6BACpB,CAAC,CAAC;yBACV,YAED,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAC,EACjC,eAAe,EAAE,gCAAgC,YAEjD,KAAC,SAAS,IACN,IAAI,EAAC,GAAG,gBACI,CAAC,CAAC,uBAAuB,CAAC,IAAI,SAAS,EACnD,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,WAAW,GAAI,EAC5C,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,GAC3C,GACO,GACH,CACjB,IACe,IACO,CAClC,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {IdCard} from './IdCard';\nimport {type IItemAction, type IItemData} from './_types';\nimport {cloneElement, useRef} from 'react';\nimport {KitButton, KitDropDown, KitTooltip} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {TOOLTIP_DEFAULT_DELAY_IN_SECONDS} from '_ui/constants';\nimport {faEllipsisH} from '@fortawesome/free-solid-svg-icons';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\n\nconst StyledTableNameCellContainer = styled.div`\n position: relative;\n display: inline-flex;\n align-items: center;\n width: 100%;\n`;\n\nconst StyledActionsList = styled.div`\n /* Action are displayed when the user hover the table row (CSS in DataView.tsx) */\n display: none;\n gap: calc(var(--general-spacing-xxs) * 1px);\n transition:\n display 0.2s ease-in-out,\n align-items: center;\n justify-content: center;\n margin-left: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst StyledIdCard = styled.div`\n flex: 1;\n`;\n\ntype ResolvedItemActionProp<T> = T extends (item: IItemData) => infer R ? R : T;\n\nconst resolveItemActionProp = <T extends IItemAction[keyof IItemAction]>(\n itemData: IItemData,\n itemActionProp: T,\n): ResolvedItemActionProp<T> =>\n (typeof itemActionProp === 'function' ? itemActionProp(itemData) : itemActionProp) as ResolvedItemActionProp<T>;\n\ninterface ITableNameCellProps {\n item: IItemData;\n itemActions: IItemAction[];\n}\n\nexport const TableNameCell = ({item, itemActions}: ITableNameCellProps) => {\n const {t} = useSharedTranslation();\n const containerRef = useRef<HTMLDivElement>(null);\n\n const itemActionsWithCallback = itemActions.map(action => ({\n ...action,\n callback: () => action.callback(item),\n }));\n\n const isMoreThanThreeActions = itemActionsWithCallback.length > 3;\n\n const itemsActionsWithCallbackToDisplay = isMoreThanThreeActions\n ? itemActionsWithCallback.slice(0, 2)\n : itemActionsWithCallback;\n\n const _handleButtonClick = (event: MouseEvent, callback: () => void) => {\n // Stop event propagation to avoid the row click event to be triggered\n event.stopPropagation();\n callback();\n };\n\n return (\n <StyledTableNameCellContainer ref={containerRef}>\n <StyledIdCard>\n <IdCard item={item.whoAmI} />\n </StyledIdCard>\n <StyledActionsList className=\"actions-list\">\n {itemsActionsWithCallbackToDisplay.map(\n ({label, icon, isDanger, callback, disabled, useItemDeletePermission}, actionIndex) => {\n const disabledButton = useItemDeletePermission\n ? !item.canDelete\n : resolveItemActionProp(item, disabled);\n\n return (\n <KitTooltip\n key={actionIndex}\n title={resolveItemActionProp(item, label)}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <KitButton\n size=\"m\"\n aria-label={resolveItemActionProp(item, label)}\n icon={resolveItemActionProp(item, icon)}\n onClick={event => _handleButtonClick(event, callback)}\n danger={resolveItemActionProp(item, isDanger)}\n disabled={disabledButton}\n />\n </KitTooltip>\n );\n },\n )}\n {isMoreThanThreeActions && (\n <KitDropDown\n placement=\"bottomRight\"\n getPopupContainer={() => containerRef.current || document.body}\n destroyPopupOnHide={true}\n menu={{\n items: itemActionsWithCallback\n .slice(2)\n .map(({callback, icon, label, isDanger, disabled}) => ({\n key: resolveItemActionProp(item, label),\n danger: resolveItemActionProp(item, isDanger),\n disabled: resolveItemActionProp(item, disabled),\n label: resolveItemActionProp(item, label),\n icon: icon\n ? cloneElement(resolveItemActionProp(item, icon), {\n size: '2em',\n })\n : null, // TODO: find better tuning\n onClick: callback,\n })),\n }}\n >\n <KitTooltip\n title={t('explorer.more-actions')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <KitButton\n size=\"m\"\n aria-label={t('explorer.more-actions') ?? undefined}\n icon={<FontAwesomeIcon icon={faEllipsisH} />}\n onClick={event => event.stopPropagation()}\n />\n </KitTooltip>\n </KitDropDown>\n )}\n </StyledActionsList>\n </StyledTableNameCellContainer>\n );\n};\n"]}
@@ -24,16 +24,16 @@ export declare const useExplorerData: ({ entrypoint, libraryId, attributeIds, fu
24
24
  canEditLinkAttributeValues: boolean;
25
25
  loading: boolean;
26
26
  refetch: ((variables?: Partial<import("../../../_gqlTypes").Exact<{
27
- libraryId: import("../../../_gqlTypes").Scalars["ID"];
28
- attributeIds: Array<import("../../../_gqlTypes").Scalars["ID"]> | import("../../../_gqlTypes").Scalars["ID"];
27
+ libraryId: import("../../../_gqlTypes").Scalars["ID"]["input"];
28
+ attributeIds: Array<import("../../../_gqlTypes").Scalars["ID"]["input"]> | import("../../../_gqlTypes").Scalars["ID"]["input"];
29
29
  pagination?: import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").RecordsPagination>;
30
30
  filters?: import("../../../_gqlTypes").InputMaybe<Array<import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").RecordFilterInput>> | import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").RecordFilterInput>>;
31
31
  multipleSort?: import("../../../_gqlTypes").InputMaybe<Array<import("../../../_gqlTypes").RecordSortInput> | import("../../../_gqlTypes").RecordSortInput>;
32
- searchQuery?: import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").Scalars["String"]>;
32
+ searchQuery?: import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").Scalars["String"]["input"]>;
33
33
  }>>) => Promise<import("@apollo/client").ApolloQueryResult<ExplorerLibraryDataQuery>>) | ((variables?: Partial<import("../../../_gqlTypes").Exact<{
34
- attributeIds: Array<import("../../../_gqlTypes").Scalars["ID"]> | import("../../../_gqlTypes").Scalars["ID"];
35
- parentLibraryId: import("../../../_gqlTypes").Scalars["ID"];
36
- parentRecordId?: import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").Scalars["String"]>;
37
- linkAttributeId: import("../../../_gqlTypes").Scalars["ID"];
34
+ attributeIds: Array<import("../../../_gqlTypes").Scalars["ID"]["input"]> | import("../../../_gqlTypes").Scalars["ID"]["input"];
35
+ parentLibraryId: import("../../../_gqlTypes").Scalars["ID"]["input"];
36
+ parentRecordId?: import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").Scalars["String"]["input"]>;
37
+ linkAttributeId: import("../../../_gqlTypes").Scalars["ID"]["input"];
38
38
  }>>) => Promise<import("@apollo/client").ApolloQueryResult<ExplorerLinkDataQuery>>);
39
39
  };
@@ -3,13 +3,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
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 { useMemo } from 'react';
6
- import { FaTrash, FaTrashRestore } from 'react-icons/fa';
7
6
  import { KitModal } from 'aristid-ds';
8
7
  import { useActivateRecordsMutation, useDeactivateRecordsMutation, useDeleteValueMutation, } from '../../../_gqlTypes';
9
8
  import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
10
9
  import { useValuesCacheUpdate } from '../../../hooks/useValuesCacheUpdate';
11
10
  import { ViewSettingsActionTypes } from '../manage-view-settings';
12
11
  import { BREAK_TWO_LINES, MASS_SELECTION_ALL } from '../_constants';
12
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
13
+ import { faTrash, faTrashRestore } from '@fortawesome/free-solid-svg-icons';
13
14
  /**
14
15
  * Hook used to get the action for `<DataView />` component.
15
16
  *
@@ -111,7 +112,7 @@ export const useEditStatusItemAction = ({ isEnabled, canDeleteLinkValues, store:
111
112
  ? t('explorer.deactivate-item')
112
113
  : t('explorer.activate-item')
113
114
  : t('explorer.delete-item'),
114
- icon: (item) => entrypoint.type === 'library' ? item.active ? _jsx(FaTrash, {}) : _jsx(FaTrashRestore, {}) : _jsx(FaTrash, {}),
115
+ icon: (item) => (_jsx(FontAwesomeIcon, { icon: entrypoint.type === 'library' && !item.active ? faTrashRestore : faTrash })),
115
116
  isDanger: true,
116
117
  disabled: (item) => entrypoint.type === 'link' ? !canDeleteLinkValues : item.active ? !item.canDelete : !item.canActivate,
117
118
  callback: item => {
@@ -1 +1 @@
1
- {"version":3,"file":"useEditStatusItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useEditStatusItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AAC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, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type Dispatch, useMemo} from 'react';\nimport {FaTrash, FaTrashRestore} from 'react-icons/fa';\nimport {KitModal} from 'aristid-ds';\nimport {\n type ActivateRecordsMutation,\n type DeactivateRecordsMutation,\n useActivateRecordsMutation,\n useDeactivateRecordsMutation,\n useDeleteValueMutation,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useValuesCacheUpdate} from '_ui/hooks/useValuesCacheUpdate';\nimport {type FeatureHook, type Entrypoint, type IEntrypointLink, type IItemAction, type IItemData} from '../_types';\nimport {type IViewSettingsAction, type IViewSettingsState, ViewSettingsActionTypes} from '../manage-view-settings';\nimport {BREAK_TWO_LINES, MASS_SELECTION_ALL} from '../_constants';\nimport {type FetchResult} from '@apollo/client';\n\n/**\n * Hook used to get the action for `<DataView />` component.\n *\n * When the mutation for removing is done, the Apollo cache will be clean (`Record` and `RecordIdentity`)\n * from removed record.\n *\n * @param isEnabled - whether the action is present\n * @param view - represent the current view\n * @param dispatch - method to change the current view\n * @param entrypoint - represent the current entrypoint\n * @param canDeleteLinkValues - check permission to delete link values\n */\nexport const useEditStatusItemAction = ({\n isEnabled,\n canDeleteLinkValues,\n store: {view, dispatch},\n onRemove,\n entrypoint,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n };\n canDeleteLinkValues: boolean;\n onRemove?: IItemAction['callback'];\n entrypoint: Entrypoint;\n}>) => {\n const {t} = useSharedTranslation();\n const updateValuesCache = useValuesCacheUpdate();\n\n const [deactivateRecordsMutation] = useDeactivateRecordsMutation({\n update(cache, deactivatedRecords) {\n deactivatedRecords.data?.deactivateRecords.forEach(record => {\n cache.evict({\n id: cache.identify(record),\n });\n });\n cache.modify({\n fields: {\n records: prev => ({\n ...prev,\n totalCount: prev.totalCount - 1,\n }),\n },\n broadcast: false,\n });\n cache.gc();\n },\n });\n\n const [activateRecordsMutation] = useActivateRecordsMutation({\n update(cache, activatedRecords) {\n activatedRecords.data?.activateRecords.forEach(record => {\n cache.evict({\n id: cache.identify(record),\n });\n });\n cache.modify({\n fields: {\n records: prev => ({\n ...prev,\n totalCount: prev.totalCount - 1,\n }),\n },\n broadcast: false,\n });\n cache.gc();\n },\n });\n\n const [deleteRecordLinkMutation] = useDeleteValueMutation({\n update: (_, deletedRecord) => {\n const parentRecord = {\n id: (entrypoint as IEntrypointLink).parentRecordId,\n library: {\n id: (entrypoint as IEntrypointLink).parentLibraryId,\n },\n };\n updateValuesCache(parentRecord, deletedRecord.data?.deleteValue ?? []);\n },\n });\n\n const _deactivateItem = async (item: IItemData): Promise<FetchResult<DeactivateRecordsMutation>> => {\n const libRes = await deactivateRecordsMutation({\n variables: {\n libraryId: item.libraryId,\n recordsIds: [item.itemId],\n },\n });\n\n if (view.massSelection !== MASS_SELECTION_ALL) {\n dispatch({\n type: ViewSettingsActionTypes.SET_SELECTED_KEYS,\n payload: view.massSelection.filter(key => key !== item.itemId),\n });\n }\n\n onRemove?.(item);\n\n return libRes;\n };\n\n const _activateItem = async (item: IItemData): Promise<FetchResult<ActivateRecordsMutation>> => {\n const libRes = await activateRecordsMutation({\n variables: {\n libraryId: item.libraryId,\n recordsIds: [item.itemId],\n },\n });\n\n if (view.massSelection !== MASS_SELECTION_ALL) {\n dispatch({\n type: ViewSettingsActionTypes.SET_SELECTED_KEYS,\n payload: view.massSelection.filter(key => key !== item.itemId),\n });\n }\n\n return libRes;\n };\n\n const _editStatusItemAction: IItemAction = useMemo(\n () => ({\n label: (item: IItemData) =>\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate-item')\n : t('explorer.activate-item')\n : t('explorer.delete-item'),\n icon: (item: IItemData) =>\n entrypoint.type === 'library' ? item.active ? <FaTrash /> : <FaTrashRestore /> : <FaTrash />,\n isDanger: true,\n disabled: (item: IItemData) =>\n entrypoint.type === 'link' ? !canDeleteLinkValues : item.active ? !item.canDelete : !item.canActivate,\n callback: item => {\n const {itemId, id_value} = item;\n\n const title =\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate_item_one')\n : t('explorer.activate_item_one')\n : t('explorer.delete_link_one');\n\n const content =\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate_item_description_one')\n : t('explorer.activate_item_description_one')\n : t('explorer.delete_link_description_one');\n\n KitModal.confirm({\n width: '100%',\n style: {content: {width: '90vw', maxWidth: '656px'}},\n type: 'confirm',\n icon: false,\n title,\n content: content + BREAK_TWO_LINES + t('global.are_you_sure'),\n okText: t('global.confirm') ?? undefined,\n cancelText: t('global.cancel') ?? undefined,\n onOk: async () => {\n switch (entrypoint.type) {\n case 'library':\n if (item.active) {\n return _deactivateItem(item);\n }\n\n return _activateItem(item);\n case 'link':\n const linkRes = await deleteRecordLinkMutation({\n variables: {\n library: entrypoint.parentLibraryId,\n attribute: entrypoint.linkAttributeId,\n recordId: entrypoint.parentRecordId,\n value: {\n payload: itemId,\n id_value,\n },\n },\n });\n onRemove?.(item);\n return linkRes;\n default:\n return;\n }\n },\n });\n },\n }),\n [\n t,\n deactivateRecordsMutation,\n deleteRecordLinkMutation,\n activateRecordsMutation,\n canDeleteLinkValues,\n entrypoint.type,\n view.massSelection,\n dispatch,\n ],\n );\n\n return {\n editStatusItemAction: isEnabled ? _editStatusItemAction : null,\n };\n};\n"]}
1
+ {"version":3,"file":"useEditStatusItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useEditStatusItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAGH,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,GACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EA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AC,IAAI,SAAS;gBACxC,UAAU,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI,SAAS;gBAC3C,IAAI,EAAE,KAAK,IAAI,EAAE;oBACb,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;wBACtB,KAAK,SAAS;4BACV,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gCACd,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;4BACjC,CAAC;4BAED,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;wBAC/B,KAAK,MAAM;4BACP,MAAM,OAAO,GAAG,MAAM,wBAAwB,CAAC;gCAC3C,SAAS,EAAE;oCACP,OAAO,EAAE,UAAU,CAAC,eAAe;oCACnC,SAAS,EAAE,UAAU,CAAC,eAAe;oCACrC,QAAQ,EAAE,UAAU,CAAC,cAAc;oCACnC,KAAK,EAAE;wCACH,OAAO,EAAE,MAAM;wCACf,QAAQ;qCACX;iCACJ;6BACJ,CAAC,CAAC;4BACH,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;4BACjB,OAAO,OAAO,CAAC;wBACnB;4BACI,OAAO;oBACf,CAAC;gBACL,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,EACF;QACI,CAAC;QACD,yBAAyB;QACzB,wBAAwB;QACxB,uBAAuB;QACvB,mBAAmB;QACnB,UAAU,CAAC,IAAI;QACf,IAAI,CAAC,aAAa;QAClB,QAAQ;KACX,CACJ,CAAC;IAEF,OAAO;QACH,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI;KACjE,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type Dispatch, useMemo} from 'react';\nimport {KitModal} from 'aristid-ds';\nimport {\n type ActivateRecordsMutation,\n type DeactivateRecordsMutation,\n useActivateRecordsMutation,\n useDeactivateRecordsMutation,\n useDeleteValueMutation,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useValuesCacheUpdate} from '_ui/hooks/useValuesCacheUpdate';\nimport {type FeatureHook, type Entrypoint, type IEntrypointLink, type IItemAction, type IItemData} from '../_types';\nimport {type IViewSettingsAction, type IViewSettingsState, ViewSettingsActionTypes} from '../manage-view-settings';\nimport {BREAK_TWO_LINES, MASS_SELECTION_ALL} from '../_constants';\nimport {type FetchResult} from '@apollo/client';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faTrash, faTrashRestore} from '@fortawesome/free-solid-svg-icons';\n\n/**\n * Hook used to get the action for `<DataView />` component.\n *\n * When the mutation for removing is done, the Apollo cache will be clean (`Record` and `RecordIdentity`)\n * from removed record.\n *\n * @param isEnabled - whether the action is present\n * @param view - represent the current view\n * @param dispatch - method to change the current view\n * @param entrypoint - represent the current entrypoint\n * @param canDeleteLinkValues - check permission to delete link values\n */\nexport const useEditStatusItemAction = ({\n isEnabled,\n canDeleteLinkValues,\n store: {view, dispatch},\n onRemove,\n entrypoint,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n };\n canDeleteLinkValues: boolean;\n onRemove?: IItemAction['callback'];\n entrypoint: Entrypoint;\n}>) => {\n const {t} = useSharedTranslation();\n const updateValuesCache = useValuesCacheUpdate();\n\n const [deactivateRecordsMutation] = useDeactivateRecordsMutation({\n update(cache, deactivatedRecords) {\n deactivatedRecords.data?.deactivateRecords.forEach(record => {\n cache.evict({\n id: cache.identify(record),\n });\n });\n cache.modify({\n fields: {\n records: prev => ({\n ...prev,\n totalCount: prev.totalCount - 1,\n }),\n },\n broadcast: false,\n });\n cache.gc();\n },\n });\n\n const [activateRecordsMutation] = useActivateRecordsMutation({\n update(cache, activatedRecords) {\n activatedRecords.data?.activateRecords.forEach(record => {\n cache.evict({\n id: cache.identify(record),\n });\n });\n cache.modify({\n fields: {\n records: prev => ({\n ...prev,\n totalCount: prev.totalCount - 1,\n }),\n },\n broadcast: false,\n });\n cache.gc();\n },\n });\n\n const [deleteRecordLinkMutation] = useDeleteValueMutation({\n update: (_, deletedRecord) => {\n const parentRecord = {\n id: (entrypoint as IEntrypointLink).parentRecordId,\n library: {\n id: (entrypoint as IEntrypointLink).parentLibraryId,\n },\n };\n updateValuesCache(parentRecord, deletedRecord.data?.deleteValue ?? []);\n },\n });\n\n const _deactivateItem = async (item: IItemData): Promise<FetchResult<DeactivateRecordsMutation>> => {\n const libRes = await deactivateRecordsMutation({\n variables: {\n libraryId: item.libraryId,\n recordsIds: [item.itemId],\n },\n });\n\n if (view.massSelection !== MASS_SELECTION_ALL) {\n dispatch({\n type: ViewSettingsActionTypes.SET_SELECTED_KEYS,\n payload: view.massSelection.filter(key => key !== item.itemId),\n });\n }\n\n onRemove?.(item);\n\n return libRes;\n };\n\n const _activateItem = async (item: IItemData): Promise<FetchResult<ActivateRecordsMutation>> => {\n const libRes = await activateRecordsMutation({\n variables: {\n libraryId: item.libraryId,\n recordsIds: [item.itemId],\n },\n });\n\n if (view.massSelection !== MASS_SELECTION_ALL) {\n dispatch({\n type: ViewSettingsActionTypes.SET_SELECTED_KEYS,\n payload: view.massSelection.filter(key => key !== item.itemId),\n });\n }\n\n return libRes;\n };\n\n const _editStatusItemAction: IItemAction = useMemo(\n () => ({\n label: (item: IItemData) =>\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate-item')\n : t('explorer.activate-item')\n : t('explorer.delete-item'),\n icon: (item: IItemData) => (\n <FontAwesomeIcon icon={entrypoint.type === 'library' && !item.active ? faTrashRestore : faTrash} />\n ),\n isDanger: true,\n disabled: (item: IItemData) =>\n entrypoint.type === 'link' ? !canDeleteLinkValues : item.active ? !item.canDelete : !item.canActivate,\n callback: item => {\n const {itemId, id_value} = item;\n\n const title =\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate_item_one')\n : t('explorer.activate_item_one')\n : t('explorer.delete_link_one');\n\n const content =\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate_item_description_one')\n : t('explorer.activate_item_description_one')\n : t('explorer.delete_link_description_one');\n\n KitModal.confirm({\n width: '100%',\n style: {content: {width: '90vw', maxWidth: '656px'}},\n type: 'confirm',\n icon: false,\n title,\n content: content + BREAK_TWO_LINES + t('global.are_you_sure'),\n okText: t('global.confirm') ?? undefined,\n cancelText: t('global.cancel') ?? undefined,\n onOk: async () => {\n switch (entrypoint.type) {\n case 'library':\n if (item.active) {\n return _deactivateItem(item);\n }\n\n return _activateItem(item);\n case 'link':\n const linkRes = await deleteRecordLinkMutation({\n variables: {\n library: entrypoint.parentLibraryId,\n attribute: entrypoint.linkAttributeId,\n recordId: entrypoint.parentRecordId,\n value: {\n payload: itemId,\n id_value,\n },\n },\n });\n onRemove?.(item);\n return linkRes;\n default:\n return;\n }\n },\n });\n },\n }),\n [\n t,\n deactivateRecordsMutation,\n deleteRecordLinkMutation,\n activateRecordsMutation,\n canDeleteLinkValues,\n entrypoint.type,\n view.massSelection,\n dispatch,\n ],\n );\n\n return {\n editStatusItemAction: isEnabled ? _editStatusItemAction : null,\n };\n};\n"]}
@@ -12,10 +12,11 @@ import { type ISubmitMultipleResult } from '../../../components/RecordEdition/Ed
12
12
  * @param onReplace - callback to let outside world know about replacing feedback
13
13
  * @param canReplaceLinkValues - check permission to delete link values
14
14
  */
15
- export declare const useReplaceItemAction: ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues, }: FeatureHook<{
15
+ export declare const useReplaceItemAction: ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues, columnsToDisplay, }: FeatureHook<{
16
16
  isMultivalue: boolean;
17
17
  onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;
18
18
  canReplaceLinkValues: boolean;
19
+ columnsToDisplay: string[];
19
20
  }>) => {
20
21
  replaceItemAction: IItemAction;
21
22
  replaceItemModal: JSX.Element;
@@ -3,9 +3,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
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 { useMemo, useState } from 'react';
6
- import { FaExchangeAlt } from 'react-icons/fa';
7
6
  import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
8
7
  import { LinkModal } from '../link-item/LinkModal';
8
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9
+ import { faExchangeAlt } from '@fortawesome/free-solid-svg-icons';
9
10
  /**
10
11
  * Hook used to get the action for `<DataView />` component.
11
12
  *
@@ -18,13 +19,13 @@ import { LinkModal } from '../link-item/LinkModal';
18
19
  * @param onReplace - callback to let outside world know about replacing feedback
19
20
  * @param canReplaceLinkValues - check permission to delete link values
20
21
  */
21
- export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues, }) => {
22
+ export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues, columnsToDisplay, }) => {
22
23
  const { t } = useSharedTranslation();
23
24
  const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);
24
25
  const [linkIdSelected, setLinkIdSelected] = useState();
25
26
  const _replaceItemAction = useMemo(() => ({
26
27
  label: t('explorer.replace-item'),
27
- icon: _jsx(FaExchangeAlt, {}),
28
+ icon: _jsx(FontAwesomeIcon, { icon: faExchangeAlt }),
28
29
  disabled: !canReplaceLinkValues,
29
30
  callback: item => {
30
31
  setLinkIdSelected(item.id_value);
@@ -35,7 +36,7 @@ export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canRe
35
36
  replaceItemAction: isEnabled ? _replaceItemAction : null,
36
37
  replaceItemModal: isEnabled && isReplaceModalOpen ? (_jsx(LinkModal, { open: true, linkId: linkIdSelected, isMultivalue: isMultivalue, onReplace: onReplace, onClose: () => {
37
38
  setIsReplaceModalOpen(false);
38
- } })) : null,
39
+ }, columnsToDisplay: columnsToDisplay })) : null,
39
40
  }), [isEnabled, isReplaceModalOpen, _replaceItemAction]);
40
41
  return replaceAction;
41
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useReplaceItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useReplaceItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,YAAY,EACZ,oBAAoB,GAKtB,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAAsB,CAAC;IAE3E,MAAM,kBAAkB,GAAgB,OAAO,CAC3C,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAE;QAClC,IAAI,EAAE,KAAC,aAAa,KAAG;QACvB,QAAQ,EAAE,CAAC,oBAAoB;QAC/B,QAAQ,EAAE,IAAI,CAAC,EAAE;YACb,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,qBAAqB,CAAC,CAAC,kBAAkB,CAAC,CAAC;QAC/C,CAAC;KACJ,CAAC,EACF,CAAC,oBAAoB,CAAC,CACzB,CAAC;IAEF,MAAM,aAAa,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,CAAC;QACH,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QACxD,gBAAgB,EACZ,SAAS,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAC9B,KAAC,SAAS,IACN,IAAI,QACJ,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC,EACF,CAAC,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CACtD,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useMemo, useState} from 'react';\nimport {FaExchangeAlt} from 'react-icons/fa';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type FeatureHook, type IItemAction} from '../_types';\nimport {LinkModal} from '../link-item/LinkModal';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\n\n/**\n * Hook used to get the action for `<DataView />` component.\n *\n * When the mutation for replaceing is done, the Apollo cache will be refreshed (`Record` and `RecordIdentity`)\n * from only replaceed record.\n *\n * It returns also two parts : one for the action button call - one for displaying the modal required by the action.\n *\n * @param isEnabled - whether the action is present\n * @param onReplace - callback to let outside world know about replacing feedback\n * @param canReplaceLinkValues - check permission to delete link values\n */\nexport const useReplaceItemAction = ({\n isEnabled,\n onReplace,\n isMultivalue,\n canReplaceLinkValues,\n}: FeatureHook<{\n isMultivalue: boolean;\n onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;\n canReplaceLinkValues: boolean;\n}>) => {\n const {t} = useSharedTranslation();\n const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);\n const [linkIdSelected, setLinkIdSelected] = useState<string | undefined>();\n\n const _replaceItemAction: IItemAction = useMemo(\n () => ({\n label: t('explorer.replace-item')!,\n icon: <FaExchangeAlt />,\n disabled: !canReplaceLinkValues,\n callback: item => {\n setLinkIdSelected(item.id_value);\n setIsReplaceModalOpen(!isReplaceModalOpen);\n },\n }),\n [canReplaceLinkValues],\n );\n\n const replaceAction = useMemo(\n () => ({\n replaceItemAction: isEnabled ? _replaceItemAction : null,\n replaceItemModal:\n isEnabled && isReplaceModalOpen ? (\n <LinkModal\n open\n linkId={linkIdSelected}\n isMultivalue={isMultivalue}\n onReplace={onReplace}\n onClose={() => {\n setIsReplaceModalOpen(false);\n }}\n />\n ) : null,\n }),\n [isEnabled, isReplaceModalOpen, _replaceItemAction],\n );\n\n return replaceAction;\n};\n"]}
1
+ {"version":3,"file":"useReplaceItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useReplaceItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,aAAa,EAAC,MAAM,mCAAmC,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,GAMlB,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAAsB,CAAC;IAE3E,MAAM,kBAAkB,GAAgB,OAAO,CAC3C,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAE;QAClC,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,aAAa,GAAI;QAC9C,QAAQ,EAAE,CAAC,oBAAoB;QAC/B,QAAQ,EAAE,IAAI,CAAC,EAAE;YACb,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,qBAAqB,CAAC,CAAC,kBAAkB,CAAC,CAAC;QAC/C,CAAC;KACJ,CAAC,EACF,CAAC,oBAAoB,CAAC,CACzB,CAAC;IAEF,MAAM,aAAa,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,CAAC;QACH,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QACxD,gBAAgB,EACZ,SAAS,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAC9B,KAAC,SAAS,IACN,IAAI,QACJ,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,EACD,gBAAgB,EAAE,gBAAgB,GACpC,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC,EACF,CAAC,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CACtD,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useMemo, useState} from 'react';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type FeatureHook, type IItemAction} from '../_types';\nimport {LinkModal} from '../link-item/LinkModal';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faExchangeAlt} from '@fortawesome/free-solid-svg-icons';\n\n/**\n * Hook used to get the action for `<DataView />` component.\n *\n * When the mutation for replaceing is done, the Apollo cache will be refreshed (`Record` and `RecordIdentity`)\n * from only replaceed record.\n *\n * It returns also two parts : one for the action button call - one for displaying the modal required by the action.\n *\n * @param isEnabled - whether the action is present\n * @param onReplace - callback to let outside world know about replacing feedback\n * @param canReplaceLinkValues - check permission to delete link values\n */\nexport const useReplaceItemAction = ({\n isEnabled,\n onReplace,\n isMultivalue,\n canReplaceLinkValues,\n columnsToDisplay,\n}: FeatureHook<{\n isMultivalue: boolean;\n onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;\n canReplaceLinkValues: boolean;\n columnsToDisplay: string[];\n}>) => {\n const {t} = useSharedTranslation();\n const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);\n const [linkIdSelected, setLinkIdSelected] = useState<string | undefined>();\n\n const _replaceItemAction: IItemAction = useMemo(\n () => ({\n label: t('explorer.replace-item')!,\n icon: <FontAwesomeIcon icon={faExchangeAlt} />,\n disabled: !canReplaceLinkValues,\n callback: item => {\n setLinkIdSelected(item.id_value);\n setIsReplaceModalOpen(!isReplaceModalOpen);\n },\n }),\n [canReplaceLinkValues],\n );\n\n const replaceAction = useMemo(\n () => ({\n replaceItemAction: isEnabled ? _replaceItemAction : null,\n replaceItemModal:\n isEnabled && isReplaceModalOpen ? (\n <LinkModal\n open\n linkId={linkIdSelected}\n isMultivalue={isMultivalue}\n onReplace={onReplace}\n onClose={() => {\n setIsReplaceModalOpen(false);\n }}\n columnsToDisplay={columnsToDisplay}\n />\n ) : null,\n }),\n [isEnabled, isReplaceModalOpen, _replaceItemAction],\n );\n\n return replaceAction;\n};\n"]}
@@ -1,9 +1,7 @@
1
- import { type AttributeDetailsTreeAttributeFragment } from '../../../../_gqlTypes';
2
1
  import { type FunctionComponent } from 'react';
3
- import { type TreeAttributeNodeValue } from './useListTreeAttributeValuesHook';
2
+ import { type ITreeAttributeNodeValue } from './useListTreeAttributeValuesHook';
4
3
  export declare const EditTreeAttributeValueLine: FunctionComponent<{
5
- treeNodeValues: TreeAttributeNodeValue[];
6
- selectedAttribute: AttributeDetailsTreeAttributeFragment;
4
+ treeNodeValues: ITreeAttributeNodeValue[];
7
5
  valueOccurrenceNodeId: string | null;
8
6
  valueOccurrenceCount: number;
9
7
  setAttributeMapping: (before: string | null, after: string | null) => void;
@@ -10,26 +10,28 @@ const DivContainer = styled.div `
10
10
  `;
11
11
  const UNDEFINED_VALUE = '__null__';
12
12
  const DEFAULT_ID_CARD_COLOR = 'rgba(200, 200, 200, 1)';
13
- export const EditTreeAttributeValueLine = ({ selectedAttribute, treeNodeValues, valueOccurrenceNodeId, valueOccurrenceCount, setAttributeMapping }) => {
13
+ export const EditTreeAttributeValueLine = ({ treeNodeValues, valueOccurrenceNodeId, valueOccurrenceCount, setAttributeMapping }) => {
14
14
  const { t } = useSharedTranslation();
15
- const treeNodeValueOfOccurrence = valueOccurrenceNodeId
16
- ? treeNodeValues.find(node => node.id === valueOccurrenceNodeId)
17
- : null;
15
+ const treeNodeValueOfOccurrence = treeNodeValues.find(node => node.id === valueOccurrenceNodeId);
16
+ if (!treeNodeValueOfOccurrence) {
17
+ return null;
18
+ }
19
+ const allowedDependentValues = treeNodeValueOfOccurrence ? treeNodeValueOfOccurrence.allowedDependentValues : null;
18
20
  const selectOptions = treeNodeValues
19
21
  .filter(treeNode => treeNode.id !== valueOccurrenceNodeId)
22
+ .filter(treeNode => allowedDependentValues == null || // if no allowedDependentValues, all values are allowed
23
+ !!allowedDependentValues.find(dv => dv.nodeId === treeNode.id))
20
24
  .map(treeNode => ({
21
- label: treeNode.record.whoAmI.label || treeNode.record.whoAmI.id,
22
- value: treeNode.id,
23
- }))
24
- .concat(selectedAttribute.required || !treeNodeValueOfOccurrence
25
- ? []
26
- : [
27
- {
28
- label: t('explorer.massAction.editAttribute_value_undefined'),
29
- value: UNDEFINED_VALUE,
30
- },
31
- ]);
32
- return (_jsxs(DivContainer, { children: [treeNodeValueOfOccurrence ? (_jsx(KitIdCard, { title: treeNodeValueOfOccurrence.record.whoAmI.label, color: treeNodeValueOfOccurrence.record.whoAmI.color || DEFAULT_ID_CARD_COLOR })) : (_jsx(KitIdCard, { title: t('explorer.massAction.editAttribute_value_undefined'), color: DEFAULT_ID_CARD_COLOR })), _jsx(KitTypography.Text, { children: t('explorer.massAction.editAttribute_value_occurrences_to_edit', {
25
+ label: treeNode.label,
26
+ value: treeNode.id || UNDEFINED_VALUE,
27
+ }));
28
+ if (selectOptions.length === 0 && valueOccurrenceNodeId) {
29
+ selectOptions.push({
30
+ label: t('explorer.massAction.editAttribute_value_do_not_change'),
31
+ value: valueOccurrenceNodeId,
32
+ });
33
+ }
34
+ return (_jsxs(DivContainer, { children: [_jsx(KitIdCard, { title: treeNodeValueOfOccurrence.label, color: treeNodeValueOfOccurrence.color || DEFAULT_ID_CARD_COLOR }), _jsx(KitTypography.Text, { children: t('explorer.massAction.editAttribute_value_occurrences_to_edit', {
33
35
  count: valueOccurrenceCount,
34
36
  }) }), _jsx(KitSelect, { options: selectOptions, size: "middle", allowClear: false, placeholder: t('explorer.massAction.editAttribute_value_select_placeholder'), onChange: value => {
35
37
  setAttributeMapping(valueOccurrenceNodeId, value === UNDEFINED_VALUE ? null : value || null);
@@ -1 +1 @@
1
- {"version":3,"file":"EditTreeAttributeValueLine.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAE/D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,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AI,qBAAqB,GAC/E,CACL,CAAC,CAAC,CAAC,CACA,KAAC,SAAS,IACN,KAAK,EAAE,CAAC,CAAC,mDAAmD,CAAC,EAC7D,KAAK,EAAE,qBAAqB,GAC9B,CACL,EACD,KAAC,aAAa,CAAC,IAAI,cACd,CAAC,CAAC,6DAA6D,EAAE;oBAC9D,KAAK,EAAE,oBAAoB;iBAC9B,CAAC,GACe,EACrB,KAAC,SAAS,IACN,OAAO,EAAE,aAAa,EACtB,IAAI,EAAC,QAAQ,EACb,UAAU,EAAE,KAAK,EACjB,WAAW,EAAE,CAAC,CAAC,4DAA4D,CAAC,EAC5E,QAAQ,EAAE,KAAK,CAAC,EAAE;oBACd,mBAAmB,CAAC,qBAAqB,EAAE,KAAK,KAAK,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;gBACjG,CAAC,GACH,IACS,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type AttributeDetailsTreeAttributeFragment} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitIdCard, KitSelect, KitTypography} from 'aristid-ds';\nimport {type FunctionComponent} from 'react';\nimport styled from 'styled-components';\nimport {type TreeAttributeNodeValue} from './useListTreeAttributeValuesHook';\n\nconst DivContainer = styled.div`\n display: grid;\n align-items: center;\n grid-template-columns: repeat(3, 1fr);\n grid-column-gap: calc(var(--general-spacing-l) * 1px);\n`;\n\nconst UNDEFINED_VALUE = '__null__';\nconst DEFAULT_ID_CARD_COLOR = 'rgba(200, 200, 200, 1)';\n\nexport const EditTreeAttributeValueLine: FunctionComponent<{\n treeNodeValues: TreeAttributeNodeValue[];\n selectedAttribute: AttributeDetailsTreeAttributeFragment;\n valueOccurrenceNodeId: string | null;\n valueOccurrenceCount: number;\n setAttributeMapping: (before: string | null, after: string | null) => void;\n}> = ({selectedAttribute, treeNodeValues, valueOccurrenceNodeId, valueOccurrenceCount, setAttributeMapping}) => {\n const {t} = useSharedTranslation();\n\n const treeNodeValueOfOccurrence = valueOccurrenceNodeId\n ? treeNodeValues.find(node => node.id === valueOccurrenceNodeId)\n : null;\n\n const selectOptions = treeNodeValues\n .filter(treeNode => treeNode.id !== valueOccurrenceNodeId)\n .map(treeNode => ({\n label: treeNode.record.whoAmI.label || treeNode.record.whoAmI.id,\n value: treeNode.id,\n }))\n .concat(\n selectedAttribute.required || !treeNodeValueOfOccurrence\n ? []\n : [\n {\n label: t('explorer.massAction.editAttribute_value_undefined'),\n value: UNDEFINED_VALUE,\n },\n ],\n );\n\n return (\n <DivContainer>\n {treeNodeValueOfOccurrence ? (\n <KitIdCard\n title={treeNodeValueOfOccurrence.record.whoAmI.label}\n color={treeNodeValueOfOccurrence.record.whoAmI.color || DEFAULT_ID_CARD_COLOR}\n />\n ) : (\n <KitIdCard\n title={t('explorer.massAction.editAttribute_value_undefined')}\n color={DEFAULT_ID_CARD_COLOR}\n />\n )}\n <KitTypography.Text>\n {t('explorer.massAction.editAttribute_value_occurrences_to_edit', {\n count: valueOccurrenceCount,\n })}\n </KitTypography.Text>\n <KitSelect\n options={selectOptions}\n size=\"middle\"\n allowClear={false}\n placeholder={t('explorer.massAction.editAttribute_value_select_placeholder')}\n onChange={value => {\n setAttributeMapping(valueOccurrenceNodeId, value === UNDEFINED_VALUE ? null : value || null);\n }}\n />\n </DivContainer>\n );\n};\n"]}
1
+ {"version":3,"file":"EditTreeAttributeValueLine.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;A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ACf,KAAK,EAAE,CAAC,CAAC,uDAAuD,CAAC;YACjE,KAAK,EAAE,qBAAqB;SAC/B,CAAC,CAAC;IACP,CAAC;IAED,OAAO,CACH,MAAC,YAAY,eACT,KAAC,SAAS,IACN,KAAK,EAAE,yBAAyB,CAAC,KAAK,EACtC,KAAK,EAAE,yBAAyB,CAAC,KAAK,IAAI,qBAAqB,GACjE,EACF,KAAC,aAAa,CAAC,IAAI,cACd,CAAC,CAAC,6DAA6D,EAAE;oBAC9D,KAAK,EAAE,oBAAoB;iBAC9B,CAAC,GACe,EACrB,KAAC,SAAS,IACN,OAAO,EAAE,aAAa,EACtB,IAAI,EAAC,QAAQ,EACb,UAAU,EAAE,KAAK,EACjB,WAAW,EAAE,CAAC,CAAC,4DAA4D,CAAC,EAC5E,QAAQ,EAAE,KAAK,CAAC,EAAE;oBACd,mBAAmB,CAAC,qBAAqB,EAAE,KAAK,KAAK,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;gBACjG,CAAC,GACH,IACS,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type AttributeDetailsTreeAttributeFragment} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitIdCard, KitSelect, KitTypography} from 'aristid-ds';\nimport {type FunctionComponent} from 'react';\nimport styled from 'styled-components';\nimport {type ITreeAttributeNodeValue} from './useListTreeAttributeValuesHook';\n\nconst DivContainer = styled.div`\n display: grid;\n align-items: center;\n grid-template-columns: repeat(3, 1fr);\n grid-column-gap: calc(var(--general-spacing-l) * 1px);\n`;\n\nconst UNDEFINED_VALUE = '__null__';\nconst DEFAULT_ID_CARD_COLOR = 'rgba(200, 200, 200, 1)';\n\nexport const EditTreeAttributeValueLine: FunctionComponent<{\n treeNodeValues: ITreeAttributeNodeValue[];\n valueOccurrenceNodeId: string | null;\n valueOccurrenceCount: number;\n setAttributeMapping: (before: string | null, after: string | null) => void;\n}> = ({treeNodeValues, valueOccurrenceNodeId, valueOccurrenceCount, setAttributeMapping}) => {\n const {t} = useSharedTranslation();\n\n const treeNodeValueOfOccurrence = treeNodeValues.find(node => node.id === valueOccurrenceNodeId);\n if (!treeNodeValueOfOccurrence) {\n return null;\n }\n\n const allowedDependentValues = treeNodeValueOfOccurrence ? treeNodeValueOfOccurrence.allowedDependentValues : null;\n\n const selectOptions = treeNodeValues\n .filter(treeNode => treeNode.id !== valueOccurrenceNodeId)\n .filter(\n treeNode =>\n allowedDependentValues == null || // if no allowedDependentValues, all values are allowed\n !!allowedDependentValues.find(dv => dv.nodeId === treeNode.id),\n )\n .map(treeNode => ({\n label: treeNode.label,\n value: treeNode.id || UNDEFINED_VALUE,\n }));\n\n if (selectOptions.length === 0 && valueOccurrenceNodeId) {\n selectOptions.push({\n label: t('explorer.massAction.editAttribute_value_do_not_change'),\n value: valueOccurrenceNodeId,\n });\n }\n\n return (\n <DivContainer>\n <KitIdCard\n title={treeNodeValueOfOccurrence.label}\n color={treeNodeValueOfOccurrence.color || DEFAULT_ID_CARD_COLOR}\n />\n <KitTypography.Text>\n {t('explorer.massAction.editAttribute_value_occurrences_to_edit', {\n count: valueOccurrenceCount,\n })}\n </KitTypography.Text>\n <KitSelect\n options={selectOptions}\n size=\"middle\"\n allowClear={false}\n placeholder={t('explorer.massAction.editAttribute_value_select_placeholder')}\n onChange={value => {\n setAttributeMapping(valueOccurrenceNodeId, value === UNDEFINED_VALUE ? null : value || null);\n }}\n />\n </DivContainer>\n );\n};\n"]}
@@ -10,7 +10,7 @@ export const EditTreeAttributeValuesMapping = ({ selectedAttribute, valuesOccurr
10
10
  if (!occurrence) {
11
11
  return null;
12
12
  }
13
- return (_jsx(EditTreeAttributeValueLine, { treeNodeValues: treeAttributeValues, selectedAttribute: selectedAttribute, valueOccurrenceNodeId: occurrence.value.id, valueOccurrenceCount: occurrence.count, setAttributeMapping: setAttributeMapping }, index));
14
- }), noValueCount > 0 && (_jsx(EditTreeAttributeValueLine, { treeNodeValues: treeAttributeValues, selectedAttribute: selectedAttribute, valueOccurrenceNodeId: null, valueOccurrenceCount: noValueCount, setAttributeMapping: setAttributeMapping }))] }));
13
+ return (_jsx(EditTreeAttributeValueLine, { treeNodeValues: treeAttributeValues, valueOccurrenceNodeId: occurrence.value.id, valueOccurrenceCount: occurrence.count, setAttributeMapping: setAttributeMapping }, index));
14
+ }), noValueCount > 0 && (_jsx(EditTreeAttributeValueLine, { treeNodeValues: treeAttributeValues, valueOccurrenceNodeId: null, valueOccurrenceCount: noValueCount, setAttributeMapping: setAttributeMapping }))] }));
15
15
  };
16
16
  //# sourceMappingURL=EditTreeAttributeValuesMapping.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditTreeAttributeValuesMapping.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAC,8BAA8B,EAAC,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAC,0BAA0B,EAAC,MAAM,8BAA8B,CAAC;AAExE,MAAM,CAAC,MAAM,8BAA8B,GAItC,CAAC,EAAC,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAC,EAAE,EAAE;IACjE,MAAM,mBAAmB,GAAG,8BAA8B,CAAC,EAAC,aAAa,EAAE,iBAAiB,EAAC,CAAC,CAAC;IAC/F,MAAM,EAAC,WAAW,EAAE,YAAY,EAAC,GAAG,iBAAiB,CAAC;IAEtD,OAAO,CACH,MAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,aAC5D,mBAAmB,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,KAAK,EAAE,EAAE;gBAClD,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,iBAAiB,CAAC,EAAE,CAAC,CAAC;gBAClF,IAAI,CAAC,UAAU,EAAE,CAAC;oBACd,OAAO,IAAI,CAAC;gBAChB,CAAC;gBACD,OAAO,CACH,KAAC,0BAA0B,IAEvB,cAAc,EAAE,mBAAmB,EACnC,iBAAiB,EAAE,iBAAiB,EACpC,qBAAqB,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,EAC1C,oBAAoB,EAAE,UAAU,CAAC,KAAK,EACtC,mBAAmB,EAAE,mBAAmB,IALnC,KAAK,CAMZ,CACL,CAAC;YACN,CAAC,CAAC,EACD,YAAY,GAAG,CAAC,IAAI,CACjB,KAAC,0BAA0B,IACvB,cAAc,EAAE,mBAAmB,EACnC,iBAAiB,EAAE,iBAAiB,EACpC,qBAAqB,EAAE,IAAI,EAC3B,oBAAoB,EAAE,YAAY,EAClC,mBAAmB,EAAE,mBAAmB,GAC1C,CACL,IACM,CACd,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type AttributeDetailsTreeAttributeFragment} from '_ui/_gqlTypes';\nimport {KitSpace} from 'aristid-ds';\nimport {type FunctionComponent} from 'react';\nimport {type ValuesOccurrences} from './useCountValuesOccurrencesHook';\nimport {useListTreeAttributeValuesHook} from './useListTreeAttributeValuesHook';\nimport {EditTreeAttributeValueLine} from './EditTreeAttributeValueLine';\n\nexport const EditTreeAttributeValuesMapping: FunctionComponent<{\n selectedAttribute: AttributeDetailsTreeAttributeFragment;\n valuesOccurrences: ValuesOccurrences;\n setAttributeMapping: (before: string | null, after: string | null) => void;\n}> = ({selectedAttribute, valuesOccurrences, setAttributeMapping}) => {\n const treeAttributeValues = useListTreeAttributeValuesHook({treeAttribute: selectedAttribute});\n const {occurrences, noValueCount} = valuesOccurrences;\n\n return (\n <KitSpace direction=\"vertical\" size=\"xs\" style={{display: 'flex'}}>\n {treeAttributeValues.map((nodeForOccurrence, index) => {\n const occurrence = occurrences.find(occ => occ.value.id === nodeForOccurrence.id);\n if (!occurrence) {\n return null;\n }\n return (\n <EditTreeAttributeValueLine\n key={index}\n treeNodeValues={treeAttributeValues}\n selectedAttribute={selectedAttribute}\n valueOccurrenceNodeId={occurrence.value.id}\n valueOccurrenceCount={occurrence.count}\n setAttributeMapping={setAttributeMapping}\n />\n );\n })}\n {noValueCount > 0 && (\n <EditTreeAttributeValueLine\n treeNodeValues={treeAttributeValues}\n selectedAttribute={selectedAttribute}\n valueOccurrenceNodeId={null}\n valueOccurrenceCount={noValueCount}\n setAttributeMapping={setAttributeMapping}\n />\n )}\n </KitSpace>\n );\n};\n"]}
1
+ {"version":3,"file":"EditTreeAttributeValuesMapping.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAC,8BAA8B,EAAC,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAC,0BAA0B,EAAC,MAAM,8BAA8B,CAAC;AAExE,MAAM,CAAC,MAAM,8BAA8B,GAItC,CAAC,EAAC,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAC,EAAE,EAAE;IACjE,MAAM,mBAAmB,GAAG,8BAA8B,CAAC,EAAC,aAAa,EAAE,iBAAiB,EAAC,CAAC,CAAC;IAC/F,MAAM,EAAC,WAAW,EAAE,YAAY,EAAC,GAAG,iBAAiB,CAAC;IAEtD,OAAO,CACH,MAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,aAC5D,mBAAmB,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,KAAK,EAAE,EAAE;gBAClD,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,iBAAiB,CAAC,EAAE,CAAC,CAAC;gBAClF,IAAI,CAAC,UAAU,EAAE,CAAC;oBACd,OAAO,IAAI,CAAC;gBAChB,CAAC;gBACD,OAAO,CACH,KAAC,0BAA0B,IAEvB,cAAc,EAAE,mBAAmB,EACnC,qBAAqB,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,EAC1C,oBAAoB,EAAE,UAAU,CAAC,KAAK,EACtC,mBAAmB,EAAE,mBAAmB,IAJnC,KAAK,CAKZ,CACL,CAAC;YACN,CAAC,CAAC,EACD,YAAY,GAAG,CAAC,IAAI,CACjB,KAAC,0BAA0B,IACvB,cAAc,EAAE,mBAAmB,EACnC,qBAAqB,EAAE,IAAI,EAC3B,oBAAoB,EAAE,YAAY,EAClC,mBAAmB,EAAE,mBAAmB,GAC1C,CACL,IACM,CACd,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type AttributeDetailsTreeAttributeFragment} from '_ui/_gqlTypes';\nimport {KitSpace} from 'aristid-ds';\nimport {type FunctionComponent} from 'react';\nimport {type ValuesOccurrences} from './useCountValuesOccurrencesHook';\nimport {useListTreeAttributeValuesHook} from './useListTreeAttributeValuesHook';\nimport {EditTreeAttributeValueLine} from './EditTreeAttributeValueLine';\n\nexport const EditTreeAttributeValuesMapping: FunctionComponent<{\n selectedAttribute: AttributeDetailsTreeAttributeFragment;\n valuesOccurrences: ValuesOccurrences;\n setAttributeMapping: (before: string | null, after: string | null) => void;\n}> = ({selectedAttribute, valuesOccurrences, setAttributeMapping}) => {\n const treeAttributeValues = useListTreeAttributeValuesHook({treeAttribute: selectedAttribute});\n const {occurrences, noValueCount} = valuesOccurrences;\n\n return (\n <KitSpace direction=\"vertical\" size=\"xs\" style={{display: 'flex'}}>\n {treeAttributeValues.map((nodeForOccurrence, index) => {\n const occurrence = occurrences.find(occ => occ.value.id === nodeForOccurrence.id);\n if (!occurrence) {\n return null;\n }\n return (\n <EditTreeAttributeValueLine\n key={index}\n treeNodeValues={treeAttributeValues}\n valueOccurrenceNodeId={occurrence.value.id}\n valueOccurrenceCount={occurrence.count}\n setAttributeMapping={setAttributeMapping}\n />\n );\n })}\n {noValueCount > 0 && (\n <EditTreeAttributeValueLine\n treeNodeValues={treeAttributeValues}\n valueOccurrenceNodeId={null}\n valueOccurrenceCount={noValueCount}\n setAttributeMapping={setAttributeMapping}\n />\n )}\n </KitSpace>\n );\n};\n"]}
@@ -6,7 +6,15 @@ import { useMemo } from 'react';
6
6
  import { useAttributeDetailsData } from '../../manage-view-settings/_shared/useAttributeDetailsData';
7
7
  export const useListEditableAttributeHook = ({ libraryId }) => {
8
8
  const { attributeDetailsById } = useAttributeDetailsData(libraryId);
9
- const treeMonoValuedAttributes = useMemo(() => Object.values(attributeDetailsById).filter(attr => attr.type === AttributeType.tree && !attr.multiple_values), [attributeDetailsById]);
9
+ const treeMonoValuedAttributes = useMemo(() => Object.values(attributeDetailsById).filter(attr => {
10
+ const dependenciesTreeAttributes = ('permissions_conf_dependent_values' in attr &&
11
+ attr.permissions_conf_dependent_values?.dependenciesTreeAttributes) ||
12
+ [];
13
+ const dependentOnItself = dependenciesTreeAttributes.length === 1 && dependenciesTreeAttributes[0].id === attr.id;
14
+ return (attr.type === AttributeType.tree &&
15
+ !attr.multiple_values &&
16
+ (dependenciesTreeAttributes.length === 0 || dependentOnItself));
17
+ }), [attributeDetailsById]);
10
18
  return treeMonoValuedAttributes;
11
19
  };
12
20
  //# sourceMappingURL=useListEditableAttributeHook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useListEditableAttributeHook.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA6C,aAAa,EAAC,MAAM,eAAe,CAAC;AACxF,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,uBAAuB,EAAC,MAAM,4DAA4D,CAAC;AAGnG,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAAC,SAAS,EAAsB,EAAsB,EAAE;IACjG,MAAM,EAAC,oBAAoB,EAAC,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAClE,MAAM,wBAAwB,GAA4C,OAAO,CAC7E,GAAG,EAAE,CACD,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,MAAM,CACtC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,CACpE,EACL,CAAC,oBAAoB,CAAC,CACzB,CAAC;IAEF,OAAO,wBAAwB,CAAC;AACpC,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type AttributeDetailsTreeAttributeFragment, AttributeType} from '_ui/_gqlTypes';\nimport {useMemo} from 'react';\nimport {useAttributeDetailsData} from '../../manage-view-settings/_shared/useAttributeDetailsData';\n\nexport type EditableAttributes = AttributeDetailsTreeAttributeFragment[];\nexport const useListEditableAttributeHook = ({libraryId}: {libraryId: string}): EditableAttributes => {\n const {attributeDetailsById} = useAttributeDetailsData(libraryId);\n const treeMonoValuedAttributes: AttributeDetailsTreeAttributeFragment[] = useMemo(\n () =>\n Object.values(attributeDetailsById).filter(\n attr => attr.type === AttributeType.tree && !attr.multiple_values,\n ),\n [attributeDetailsById],\n );\n\n return treeMonoValuedAttributes;\n};\n"]}
1
+ {"version":3,"file":"useListEditableAttributeHook.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA6C,aAAa,EAAC,MAAM,eAAe,CAAC;AACxF,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,uBAAuB,EAAC,MAAM,4DAA4D,CAAC;AAGnG,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAAC,SAAS,EAAsB,EAAsB,EAAE;IACjG,MAAM,EAAC,oBAAoB,EAAC,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAClE,MAAM,wBAAwB,GAA4C,OAAO,CAC7E,GAAG,EAAE,CACD,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC9C,MAAM,0BAA0B,GAC5B,CAAC,mCAAmC,IAAI,IAAI;YACxC,IAAI,CAAC,iCAAiC,EAAE,0BAA0B,CAAC;YACvE,EAAE,CAAC;QACP,MAAM,iBAAiB,GACnB,0BAA0B,CAAC,MAAM,KAAK,CAAC,IAAI,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC5F,OAAO,CACH,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI;YAChC,CAAC,IAAI,CAAC,eAAe;YACrB,CAAC,0BAA0B,CAAC,MAAM,KAAK,CAAC,IAAI,iBAAiB,CAAC,CACjE,CAAC;IACN,CAAC,CAAC,EACN,CAAC,oBAAoB,CAAC,CACzB,CAAC;IAEF,OAAO,wBAAwB,CAAC;AACpC,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type AttributeDetailsTreeAttributeFragment, AttributeType} from '_ui/_gqlTypes';\nimport {useMemo} from 'react';\nimport {useAttributeDetailsData} from '../../manage-view-settings/_shared/useAttributeDetailsData';\n\nexport type EditableAttributes = AttributeDetailsTreeAttributeFragment[];\nexport const useListEditableAttributeHook = ({libraryId}: {libraryId: string}): EditableAttributes => {\n const {attributeDetailsById} = useAttributeDetailsData(libraryId);\n const treeMonoValuedAttributes: AttributeDetailsTreeAttributeFragment[] = useMemo(\n () =>\n Object.values(attributeDetailsById).filter(attr => {\n const dependenciesTreeAttributes =\n ('permissions_conf_dependent_values' in attr &&\n attr.permissions_conf_dependent_values?.dependenciesTreeAttributes) ||\n [];\n const dependentOnItself =\n dependenciesTreeAttributes.length === 1 && dependenciesTreeAttributes[0].id === attr.id;\n return (\n attr.type === AttributeType.tree &&\n !attr.multiple_values &&\n (dependenciesTreeAttributes.length === 0 || dependentOnItself)\n );\n }),\n [attributeDetailsById],\n );\n\n return treeMonoValuedAttributes;\n};\n"]}
@@ -1,5 +1,12 @@
1
- import { type AttributeDetailsTreeAttributeFragment, type TreeNodeChildrenQuery } from '../../../../_gqlTypes';
2
- export type TreeAttributeNodeValue = TreeNodeChildrenQuery['treeNodeChildren']['list'][0];
1
+ import { type AttributeDetailsTreeAttributeFragment } from '../../../../_gqlTypes';
2
+ export interface ITreeAttributeNodeValue {
3
+ id: string | null;
4
+ label: string;
5
+ color?: string | null;
6
+ allowedDependentValues?: Array<{
7
+ nodeId?: string | null;
8
+ }> | null;
9
+ }
3
10
  export declare const useListTreeAttributeValuesHook: ({ treeAttribute: treeAttribute, }: {
4
11
  treeAttribute: AttributeDetailsTreeAttributeFragment;
5
- }) => TreeAttributeNodeValue[];
12
+ }) => ITreeAttributeNodeValue[];
@@ -1,20 +1,30 @@
1
1
  // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
2
2
  // This file is released under LGPL V3
3
3
  // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
4
- import { useTreeNodeChildrenLazyQuery, } from '../../../../_gqlTypes';
5
- import { useEffect } from 'react';
4
+ import { useAttributeWithValuesForMassEditionLazyQuery } from '../../../../_gqlTypes';
5
+ import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
6
+ import { useEffect, useMemo } from 'react';
6
7
  export const useListTreeAttributeValuesHook = ({ treeAttribute: treeAttribute, }) => {
7
- const [loadTreeContent, { data: treeContent }] = useTreeNodeChildrenLazyQuery();
8
+ const { t } = useSharedTranslation();
9
+ const [loadValues, { data: treeContent }] = useAttributeWithValuesForMassEditionLazyQuery();
8
10
  useEffect(() => {
9
11
  if (!treeAttribute.linked_tree) {
10
12
  throw new Error('Fatal: selected attribute not found');
11
13
  }
12
- loadTreeContent({
14
+ loadValues({
15
+ fetchPolicy: 'no-cache',
13
16
  variables: {
14
- treeId: treeAttribute.linked_tree.id,
17
+ attributeId: treeAttribute.id,
15
18
  },
16
19
  });
17
20
  }, [treeAttribute]);
18
- return treeContent?.treeNodeChildren.list || [];
21
+ return useMemo(() => treeContent?.attributes?.list[0]?.tree_values?.map(treeValue => ({
22
+ id: treeValue.node?.id || null,
23
+ label: treeValue.node?.record.whoAmI.label ||
24
+ treeValue.node?.record.whoAmI.id ||
25
+ t('explorer.massAction.editAttribute_value_undefined'),
26
+ color: treeValue.node?.record.whoAmI.color,
27
+ allowedDependentValues: treeValue.allowedDependentValues || null,
28
+ })) || [], [treeContent]);
19
29
  };
20
30
  //# sourceMappingURL=useListTreeAttributeValuesHook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useListTreeAttributeValuesHook.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAGH,4BAA4B,GAC/B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAGhC,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,EAC3C,aAAa,EAAE,aAAa,GAG/B,EAA4B,EAAE;IAC3B,MAAM,CAAC,eAAe,EAAE,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,GAAG,4BAA4B,EAAE,CAAC;IAC9E,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC3D,CAAC;QACD,eAAe,CAAC;YACZ,SAAS,EAAE;gBACP,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,EAAE;aACvC;SACJ,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,WAAW,EAAE,gBAAgB,CAAC,IAAI,IAAI,EAAE,CAAC;AACpD,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {\n type AttributeDetailsTreeAttributeFragment,\n type TreeNodeChildrenQuery,\n useTreeNodeChildrenLazyQuery,\n} from '_ui/_gqlTypes';\nimport {useEffect} from 'react';\n\nexport type TreeAttributeNodeValue = TreeNodeChildrenQuery['treeNodeChildren']['list'][0];\nexport const useListTreeAttributeValuesHook = ({\n treeAttribute: treeAttribute,\n}: {\n treeAttribute: AttributeDetailsTreeAttributeFragment;\n}): TreeAttributeNodeValue[] => {\n const [loadTreeContent, {data: treeContent}] = useTreeNodeChildrenLazyQuery();\n useEffect(() => {\n if (!treeAttribute.linked_tree) {\n throw new Error('Fatal: selected attribute not found');\n }\n loadTreeContent({\n variables: {\n treeId: treeAttribute.linked_tree.id,\n },\n });\n }, [treeAttribute]);\n\n return treeContent?.treeNodeChildren.list || [];\n};\n"]}
1
+ {"version":3,"file":"useListTreeAttributeValuesHook.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,6CAA6C,EAA6C,MAAM,eAAe,CAAC;AACxH,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AASzC,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,EAC3C,aAAa,EAAE,aAAa,GAG/B,EAA6B,EAAE;IAC5B,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,UAAU,EAAE,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,GAAG,6CAA6C,EAAE,CAAC;IAE1F,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC3D,CAAC;QACD,UAAU,CAAC;YACP,WAAW,EAAE,UAAU;YACvB,SAAS,EAAE;gBACP,WAAW,EAAE,aAAa,CAAC,EAAE;aAChC;SACJ,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,OAAO,CACV,GAAG,EAAE,CACD,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC7D,EAAE,EAAE,SAAS,CAAC,IAAI,EAAE,EAAE,IAAI,IAAI;QAC9B,KAAK,EACD,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;YACnC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;YAChC,CAAC,CAAC,mDAAmD,CAAC;QAC1D,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;QAC1C,sBAAsB,EAAE,SAAS,CAAC,sBAAsB,IAAI,IAAI;KACnE,CAAC,CAAC,IAAI,EAAE,EACb,CAAC,WAAW,CAAC,CAChB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useAttributeWithValuesForMassEditionLazyQuery, type AttributeDetailsTreeAttributeFragment} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useEffect, useMemo} from 'react';\n\nexport interface ITreeAttributeNodeValue {\n id: string | null;\n label: string;\n color?: string | null;\n allowedDependentValues?: Array<{nodeId?: string | null}> | null;\n}\n\nexport const useListTreeAttributeValuesHook = ({\n treeAttribute: treeAttribute,\n}: {\n treeAttribute: AttributeDetailsTreeAttributeFragment;\n}): ITreeAttributeNodeValue[] => {\n const {t} = useSharedTranslation();\n const [loadValues, {data: treeContent}] = useAttributeWithValuesForMassEditionLazyQuery();\n\n useEffect(() => {\n if (!treeAttribute.linked_tree) {\n throw new Error('Fatal: selected attribute not found');\n }\n loadValues({\n fetchPolicy: 'no-cache',\n variables: {\n attributeId: treeAttribute.id,\n },\n });\n }, [treeAttribute]);\n\n return useMemo(\n () =>\n treeContent?.attributes?.list[0]?.tree_values?.map(treeValue => ({\n id: treeValue.node?.id || null,\n label:\n treeValue.node?.record.whoAmI.label ||\n treeValue.node?.record.whoAmI.id ||\n t('explorer.massAction.editAttribute_value_undefined'),\n color: treeValue.node?.record.whoAmI.color,\n allowedDependentValues: treeValue.allowedDependentValues || null,\n })) || [],\n [treeContent],\n );\n};\n"]}
@@ -0,0 +1,10 @@
1
+ import { type FunctionComponent } from 'react';
2
+ interface IExportProfileSelectionModalProps {
3
+ open: boolean;
4
+ libraryId: string;
5
+ isLoading?: boolean;
6
+ onClose: () => void;
7
+ onConfirm: (profileLabel: string) => void;
8
+ }
9
+ export declare const ExportProfileSelectionModal: FunctionComponent<IExportProfileSelectionModalProps>;
10
+ export {};
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, 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 { useEffect, useState } from 'react';
6
+ import { KitButton, KitSpace, KitModal, KitLoader } from 'aristid-ds';
7
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
+ import { faXmark, faPlay } from '@fortawesome/free-solid-svg-icons';
9
+ import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
10
+ import { useGetLibraryExportProfiles } from './useGetLibraryExportProfiles';
11
+ import styled from 'styled-components';
12
+ import { NoProfiles } from './content/NoProfiles';
13
+ import { ProfilesSelection } from './content/ProfilesSelection';
14
+ const LoaderWrapper = styled.div `
15
+ display: flex;
16
+ justify-content: center;
17
+ align-items: center;
18
+ height: 100%;
19
+ `;
20
+ export const ExportProfileSelectionModal = ({ open, libraryId, isLoading = false, onClose, onConfirm, }) => {
21
+ const { t } = useSharedTranslation();
22
+ const [selectedProfile, setSelectedProfile] = useState('');
23
+ const { profiles, defaultProfile, loading: queryLoading, } = useGetLibraryExportProfiles({
24
+ libraryId,
25
+ skip: !open,
26
+ });
27
+ useEffect(() => {
28
+ if (profiles.length > 0) {
29
+ setSelectedProfile(defaultProfile || profiles[0]?.label || '');
30
+ }
31
+ }, [profiles, defaultProfile]);
32
+ const _handleConfirm = () => {
33
+ if (selectedProfile) {
34
+ onConfirm(selectedProfile);
35
+ onClose();
36
+ }
37
+ };
38
+ const _handleClose = () => {
39
+ onClose();
40
+ };
41
+ const selectedProfileData = profiles.find(p => p.label === selectedProfile);
42
+ const noProfiles = !queryLoading && !profiles?.length;
43
+ const hasProfiles = !queryLoading && profiles?.length;
44
+ return (_jsxs(KitModal, { appElement: document.getElementById('root'), isOpen: open, close: _handleClose, title: t('explorer.export_profile_modal.title'), height: "60vh", width: "70vw", closeIcon: _jsx(FontAwesomeIcon, { icon: faXmark }), showCloseIcon: true, destroyOnClose: true, footer: _jsxs(KitSpace, { children: [_jsx(KitButton, { size: "m", icon: _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: _handleClose, children: t('global.cancel') }), _jsx(KitButton, { type: "primary", size: "m", icon: _jsx(FontAwesomeIcon, { icon: faPlay }), loading: isLoading, disabled: !selectedProfile || !!selectedProfileData?.error || isLoading, onClick: _handleConfirm, children: t('explorer.export_profile_modal.export_button') })] }), children: [queryLoading && (_jsx(LoaderWrapper, { children: _jsx(KitLoader, {}) })), noProfiles && _jsx(NoProfiles, {}), hasProfiles && (_jsx(ProfilesSelection, { profiles: profiles, selectedProfile: selectedProfile, setSelectedProfile: setSelectedProfile }))] }));
45
+ };
46
+ //# sourceMappingURL=ExportProfileSelectionModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExportProfileSelectionModal.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/export/ExportProfileSelectionModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClE,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,2BAA2B,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esContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, useEffect, useState} from 'react';\nimport {KitButton, KitSpace, KitModal, KitLoader} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faXmark, faPlay} from '@fortawesome/free-solid-svg-icons';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useGetLibraryExportProfiles} from './useGetLibraryExportProfiles';\nimport styled from 'styled-components';\nimport {NoProfiles} from './content/NoProfiles';\nimport {ProfilesSelection} from './content/ProfilesSelection';\n\ninterface IExportProfileSelectionModalProps {\n open: boolean;\n libraryId: string;\n isLoading?: boolean;\n onClose: () => void;\n onConfirm: (profileLabel: string) => void;\n}\n\nconst LoaderWrapper = styled.div`\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n`;\n\nexport const ExportProfileSelectionModal: FunctionComponent<IExportProfileSelectionModalProps> = ({\n open,\n libraryId,\n isLoading = false,\n onClose,\n onConfirm,\n}) => {\n const {t} = useSharedTranslation();\n const [selectedProfile, setSelectedProfile] = useState('');\n\n const {\n profiles,\n defaultProfile,\n loading: queryLoading,\n } = useGetLibraryExportProfiles({\n libraryId,\n skip: !open,\n });\n\n useEffect(() => {\n if (profiles.length > 0) {\n setSelectedProfile(defaultProfile || profiles[0]?.label || '');\n }\n }, [profiles, defaultProfile]);\n\n const _handleConfirm = () => {\n if (selectedProfile) {\n onConfirm(selectedProfile);\n onClose();\n }\n };\n\n const _handleClose = () => {\n onClose();\n };\n\n const selectedProfileData = profiles.find(p => p.label === selectedProfile);\n\n const noProfiles = !queryLoading && !profiles?.length;\n const hasProfiles = !queryLoading && profiles?.length;\n\n return (\n <KitModal\n appElement={document.getElementById('root')}\n isOpen={open}\n close={_handleClose}\n title={t('explorer.export_profile_modal.title')}\n height=\"60vh\"\n width=\"70vw\"\n closeIcon={<FontAwesomeIcon icon={faXmark} />}\n showCloseIcon\n destroyOnClose\n footer={\n <KitSpace>\n <KitButton size=\"m\" icon={<FontAwesomeIcon icon={faXmark} />} onClick={_handleClose}>\n {t('global.cancel')}\n </KitButton>\n <KitButton\n type=\"primary\"\n size=\"m\"\n icon={<FontAwesomeIcon icon={faPlay} />}\n loading={isLoading}\n disabled={!selectedProfile || !!selectedProfileData?.error || isLoading}\n onClick={_handleConfirm}\n >\n {t('explorer.export_profile_modal.export_button')}\n </KitButton>\n </KitSpace>\n }\n >\n {queryLoading && (\n <LoaderWrapper>\n <KitLoader />\n </LoaderWrapper>\n )}\n {noProfiles && <NoProfiles />}\n {hasProfiles && (\n <ProfilesSelection\n profiles={profiles}\n selectedProfile={selectedProfile}\n setSelectedProfile={setSelectedProfile}\n />\n )}\n </KitModal>\n );\n};\n"]}
@@ -0,0 +1 @@
1
+ export declare const NoProfiles: () => JSX.Element;
@@ -0,0 +1,17 @@
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 { KitEmpty, KitSpace } from 'aristid-ds';
6
+ import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
7
+ import styled from 'styled-components';
8
+ const NoProfilesSpacer = styled(KitSpace) `
9
+ justify-content: center;
10
+ width: 100%;
11
+ height: 100%;
12
+ `;
13
+ export const NoProfiles = () => {
14
+ const { t } = useSharedTranslation();
15
+ return (_jsx(NoProfilesSpacer, { direction: "vertical", size: "m", children: _jsx(KitEmpty, { image: KitEmpty.ASSET_LIST, title: t('explorer.export_profile_modal.no_profiles'), description: t('explorer.export_profile_modal.contact_admin') }) }));
16
+ };
17
+ //# sourceMappingURL=NoProfiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoProfiles.js","sourceRoot":"","sources":["../../../../../../src/components/Explorer/actions-mass/export/content/NoProfiles.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;;;;CAIxC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC3B,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,OAAO,CACH,KAAC,gBAAgB,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,GAAG,YAC3C,KAAC,QAAQ,IACL,KAAK,EAAE,QAAQ,CAAC,UAAU,EAC1B,KAAK,EAAE,CAAC,CAAC,2CAA2C,CAAC,EACrD,WAAW,EAAE,CAAC,CAAC,6CAA6C,CAAC,GAC/D,GACa,CACtB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {KitEmpty, KitSpace} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport styled from 'styled-components';\n\nconst NoProfilesSpacer = styled(KitSpace)`\n justify-content: center;\n width: 100%;\n height: 100%;\n`;\n\nexport const NoProfiles = () => {\n const {t} = useSharedTranslation();\n\n return (\n <NoProfilesSpacer direction=\"vertical\" size=\"m\">\n <KitEmpty\n image={KitEmpty.ASSET_LIST}\n title={t('explorer.export_profile_modal.no_profiles')}\n description={t('explorer.export_profile_modal.contact_admin')}\n />\n </NoProfilesSpacer>\n );\n};\n"]}