@leav/ui 1.6.0 → 1.7.0-67b86ab9

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 (275) 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/_queries/useExplorerData.js +19 -7
  30. package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
  31. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js +3 -2
  32. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -1
  33. package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +2 -1
  34. package/dist/components/Explorer/actions-item/useReplaceItemAction.js +5 -4
  35. package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
  36. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.d.ts +2 -4
  37. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js +18 -16
  38. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js.map +1 -1
  39. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js +2 -2
  40. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js.map +1 -1
  41. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js +9 -1
  42. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js.map +1 -1
  43. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.d.ts +10 -3
  44. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js +16 -6
  45. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js.map +1 -1
  46. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.d.ts +10 -0
  47. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js +46 -0
  48. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js.map +1 -0
  49. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.d.ts +1 -0
  50. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js +17 -0
  51. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js.map +1 -0
  52. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.d.ts +8 -0
  53. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js +49 -0
  54. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js.map +1 -0
  55. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.d.ts +27 -0
  56. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js +48 -0
  57. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js.map +1 -0
  58. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +3 -2
  59. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
  60. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +3 -2
  61. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
  62. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +3 -2
  63. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
  64. package/dist/components/Explorer/actions-mass/useExportMassAction.d.ts +7 -4
  65. package/dist/components/Explorer/actions-mass/useExportMassAction.js +80 -73
  66. package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
  67. package/dist/components/Explorer/actions-mass/useMassActions.js +3 -2
  68. package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
  69. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +3 -2
  70. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
  71. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +2 -1
  72. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +5 -4
  73. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
  74. package/dist/components/Explorer/link-item/LinkModal.d.ts +1 -0
  75. package/dist/components/Explorer/link-item/LinkModal.js +2 -2
  76. package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
  77. package/dist/components/Explorer/list-saved-views/SavedViews.js +4 -3
  78. package/dist/components/Explorer/list-saved-views/SavedViews.js.map +1 -1
  79. package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js +5 -8
  80. package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js.map +1 -1
  81. package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js +3 -2
  82. package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js.map +1 -1
  83. package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +7 -6
  84. package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -1
  85. package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js +3 -2
  86. package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js.map +1 -1
  87. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +4 -3
  88. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
  89. package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js +3 -2
  90. package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js.map +1 -1
  91. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js +3 -2
  92. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js.map +1 -1
  93. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js +3 -2
  94. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js.map +1 -1
  95. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +3 -0
  96. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
  97. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js +3 -2
  98. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js.map +1 -1
  99. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js +4 -3
  100. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js.map +1 -1
  101. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js +3 -2
  102. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js.map +1 -1
  103. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js +3 -2
  104. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js.map +1 -1
  105. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js +3 -2
  106. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js.map +1 -1
  107. package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js +3 -2
  108. package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js.map +1 -1
  109. package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js +7 -6
  110. package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js.map +1 -1
  111. package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js +3 -2
  112. package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js.map +1 -1
  113. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
  114. package/dist/components/Explorer/useSearchInput.js +6 -2
  115. package/dist/components/Explorer/useSearchInput.js.map +1 -1
  116. package/dist/components/Filters/FiltersProvider.d.ts +2 -2
  117. package/dist/components/Filters/FiltersProvider.js.map +1 -1
  118. package/dist/components/Filters/_types.d.ts +3 -0
  119. package/dist/components/Filters/_types.js.map +1 -1
  120. package/dist/components/Filters/context/filtersReducer.js +7 -4
  121. package/dist/components/Filters/context/filtersReducer.js.map +1 -1
  122. package/dist/components/Filters/filter-items/CommonFilterItem.d.ts +1 -0
  123. package/dist/components/Filters/filter-items/CommonFilterItem.js +28 -8
  124. package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
  125. package/dist/components/Filters/filter-items/EmptyValueCheckbox.d.ts +8 -0
  126. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js +16 -0
  127. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js.map +1 -0
  128. package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js +23 -9
  129. package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js.map +1 -1
  130. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js +9 -8
  131. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js.map +1 -1
  132. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js +4 -3
  133. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js.map +1 -1
  134. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js +1 -1
  135. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js.map +1 -1
  136. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.d.ts +0 -1
  137. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js +17 -23
  138. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js.map +1 -1
  139. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js +10 -12
  140. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -1
  141. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js +3 -13
  142. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
  143. package/dist/components/Filters/index.d.ts +1 -0
  144. package/dist/components/Filters/index.js +1 -0
  145. package/dist/components/Filters/index.js.map +1 -1
  146. package/dist/components/Filters/prepareFiltersForRequest.js +36 -3
  147. package/dist/components/Filters/prepareFiltersForRequest.js.map +1 -1
  148. package/dist/components/Filters/useFilters.d.ts +5 -0
  149. package/dist/components/Filters/useTransformFilters.js +4 -0
  150. package/dist/components/Filters/useTransformFilters.js.map +1 -1
  151. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.d.ts +1 -3
  152. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js +6 -2
  153. package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js.map +1 -1
  154. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js +1 -8
  155. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js.map +1 -1
  156. package/dist/components/LibraryItemsList/FiltersPanel/FiltersPanel.js +15 -17
  157. package/dist/components/LibraryItemsList/FiltersPanel/FiltersPanel.js.map +1 -1
  158. package/dist/components/LibraryItemsList/LibraryItemsListTable/ChooseTableColumns/ChooseTableColumns.js +0 -6
  159. package/dist/components/LibraryItemsList/LibraryItemsListTable/ChooseTableColumns/ChooseTableColumns.js.map +1 -1
  160. package/dist/components/LibraryItemsList/MenuView/MenuView.js +4 -4
  161. package/dist/components/LibraryItemsList/MenuView/MenuView.js.map +1 -1
  162. package/dist/components/LibraryItemsList/ViewPanel/View/View.d.ts +1 -3
  163. package/dist/components/LibraryItemsList/ViewPanel/View/View.js +9 -4
  164. package/dist/components/LibraryItemsList/ViewPanel/View/View.js.map +1 -1
  165. package/dist/components/LibraryItemsList/ViewPanel/ViewPanel.js +36 -14
  166. package/dist/components/LibraryItemsList/ViewPanel/ViewPanel.js.map +1 -1
  167. package/dist/components/Notifications/hooks/useNotificationSubscription.js +3 -2
  168. package/dist/components/Notifications/hooks/useNotificationSubscription.js.map +1 -1
  169. package/dist/components/RecordEdition/EditRecord/EditRecord.d.ts +1 -0
  170. package/dist/components/RecordEdition/EditRecord/EditRecord.js +3 -3
  171. package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
  172. package/dist/components/RecordEdition/EditRecordContent/antdUtils.js.map +1 -1
  173. package/dist/components/RecordEdition/EditRecordContent/hooks/__mocks__/useDeleteValueMutation.d.ts +1 -1
  174. package/dist/components/RecordEdition/EditRecordContent/hooks/__mocks__/useSaveValueMutation.d.ts +1 -1
  175. package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js +5 -20
  176. package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js.map +1 -1
  177. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.d.ts +1 -11
  178. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +8 -95
  179. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
  180. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/_types.d.ts +8 -0
  181. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/_types.js +2 -0
  182. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/_types.js.map +1 -0
  183. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/LinkFieldExplorer.d.ts +6 -0
  184. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/LinkFieldExplorer.js +77 -0
  185. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/LinkFieldExplorer.js.map +1 -0
  186. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record → explorer/link-record}/useExplorerLinkRecords.d.ts +5 -7
  187. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record → explorer/link-record}/useExplorerLinkRecords.js +3 -10
  188. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/link-record/useExplorerLinkRecords.js.map +1 -0
  189. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record → explorer/link-record}/useLinkRecords.d.ts +5 -6
  190. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/link-record/useLinkRecords.js +98 -0
  191. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/link-record/useLinkRecords.js.map +1 -0
  192. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/{ExplorerWrapper.d.ts → InputExtraAlignLeft.d.ts} +54 -52
  193. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record/ActionButton.js → shared/InputExtraAlignLeft.js} +4 -4
  194. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/InputExtraAlignLeft.js.map +1 -0
  195. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/InputWrapper.d.ts +3 -0
  196. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/InputWrapper.js +31 -0
  197. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/InputWrapper.js.map +1 -0
  198. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/Wrapper.d.ts +3 -0
  199. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/Wrapper.js +8 -0
  200. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/Wrapper.js.map +1 -0
  201. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/LinkFieldTags.d.ts +3 -0
  202. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/LinkFieldTags.js +57 -0
  203. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/LinkFieldTags.js.map +1 -0
  204. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/link-record/useLinkRecord.d.ts +16 -0
  205. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/link-record/useLinkRecord.js +85 -0
  206. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/link-record/useLinkRecord.js.map +1 -0
  207. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.d.ts +19 -0
  208. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.js +43 -0
  209. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.js.map +1 -0
  210. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/unlink-all-records/useUnlinkAllRecords.d.ts +16 -0
  211. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/unlink-all-records/useUnlinkAllRecords.js +27 -0
  212. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/unlink-all-records/useUnlinkAllRecords.js.map +1 -0
  213. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +4 -3
  214. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
  215. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +9 -2
  216. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
  217. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.d.ts +53 -51
  218. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +3 -2
  219. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -1
  220. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +2 -1
  221. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +4 -7
  222. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
  223. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +3 -2
  224. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +2 -2
  225. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -1
  226. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js +3 -2
  227. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -1
  228. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.d.ts +1 -0
  229. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js +2 -2
  230. package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js.map +1 -1
  231. package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js +3 -2
  232. package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js.map +1 -1
  233. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +4 -3
  234. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
  235. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js +3 -2
  236. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js.map +1 -1
  237. package/dist/components/RecordEdition/hooks/useGetSubmitButtons.js +2 -2
  238. package/dist/components/RecordEdition/hooks/useGetSubmitButtons.js.map +1 -1
  239. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +1 -0
  240. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +7 -7
  241. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
  242. package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +2 -1
  243. package/dist/components/SelectTreeNode/SelectTreeNode.js +3 -3
  244. package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
  245. package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +2 -1
  246. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +6 -2
  247. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
  248. package/dist/components/SelectTreeNode/TreeNodeTitle.js +3 -2
  249. package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -1
  250. package/dist/constants.d.ts +1 -0
  251. package/dist/constants.js +1 -0
  252. package/dist/constants.js.map +1 -1
  253. package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +3 -1
  254. package/dist/hooks/useIFrameMessenger/messageHandlers.js +16 -0
  255. package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -1
  256. package/dist/hooks/useIFrameMessenger/schema.d.ts +6 -3
  257. package/dist/hooks/useIFrameMessenger/schema.js +2 -1
  258. package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
  259. package/dist/hooks/useIFrameMessenger/types.d.ts +32 -2
  260. package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
  261. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +2 -0
  262. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +16 -2
  263. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -1
  264. package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +2 -0
  265. package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +2 -0
  266. package/dist/locales/en/shared.json +18 -3
  267. package/dist/locales/fr/shared.json +18 -3
  268. package/package.json +40 -42
  269. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.d.ts +0 -3
  270. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.js.map +0 -1
  271. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useExplorerLinkRecords.js.map +0 -1
  272. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js +0 -100
  273. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +0 -1
  274. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.js +0 -13
  275. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/hooks/useIFrameMessenger/schema.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,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AAC;IAC5C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,OAAO,EAAE,iBAAiB;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC1C,SAAS,EAAE,eAAe;IAC1B,aAAa,EAAE,mBAAmB,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAEH,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,aAAa,EAAE,mBAAmB,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,GAAG,CACnD,CAAC,CAAC,KAAK,CAAC,CAAC,4BAA4B,EAAE,0BAA0B,CAAC,CAAC,CACtE,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,GAAG,CAC1C,CAAC,CAAC,KAAK,CAAC,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,CAAC,CAC7F,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC,GAAG,CAAC,iBAAiB,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 * as z from 'zod/v4';\n\nexport const FONT_AWESOME_ICON_REGEX = /^fa-/;\n\nexport const PanelIdSchema = z.string();\nexport const LanguageSchema = z.string();\nexport const LibraryIdSchema = z.string();\nexport const FontAwesomeIconSchema = z.string().regex(FONT_AWESOME_ICON_REGEX).optional();\n\nexport const WhereSchema = z.union([z.literal('popup'), z.literal('slider'), z.literal('fullpage')]);\n\nexport const FlapPanelIdSchema = z.union([z.literal('info-history'), z.literal('thread')]);\n\nexport const ExplorerPropsSchema = z.object({\n showSearch: z.boolean().optional(),\n showFilters: z.boolean().optional(),\n showSorts: z.boolean().optional(),\n freezeView: z.boolean().optional(),\n showAttributeLabels: z.boolean().optional(),\n creationFormId: z.string().optional(),\n noPagination: z.literal(true).optional(),\n showActionsLabels: z.boolean().optional(),\n defaultPrimaryActions: z.array(z.union([z.literal('create')])).optional(),\n defaultMassActions: z\n .array(z.union([z.literal('deactivate'), z.literal('export'), z.literal('editAttribute')]))\n .optional(),\n defaultActionsForItem: z\n .array(z.union([z.literal('replaceLink'), z.literal('remove'), z.literal('activate')]))\n .optional(),\n});\n\nexport const ItemActionsSchema = z\n .array(\n z.object({\n where: WhereSchema,\n what: z.literal('record'),\n targetPanelId: PanelIdSchema.optional(),\n targetFlapPanelId: FlapPanelIdSchema.optional(),\n icon: FontAwesomeIconSchema,\n label: z.record(LanguageSchema, z.string()),\n onRowClick: z.boolean().optional(),\n }),\n )\n .refine(actions => actions.reduce((acc, action) => (action.onRowClick ? acc + 1 : acc), 0) <= 1, {\n message: 'At most one action must have onRowClick set to true',\n });\n\nexport const basePanelSchema = z.object({\n id: PanelIdSchema,\n icon: FontAwesomeIconSchema,\n name: z.record(LanguageSchema, z.string()).optional(),\n isStandalone: z.boolean().optional(),\n hideInSlider: z.boolean().optional(),\n});\n\nexport const iframePanelSchema = z.object({\n type: z.literal('custom'),\n iframeSource: z.string(),\n isSelfContaining: z.boolean().optional(),\n});\n\nconst editionPanelSchema = z.object({\n type: z.literal('editionForm'),\n formId: z.string(),\n});\n\nexport const creationPanelSchema = z.object({\n type: z.literal('creationForm'),\n formId: z.string(),\n attributeSource: z.string(),\n isStandalone: z.literal(true),\n});\n\nexport const baseExplorerPanelSchema = z.object({\n type: z.literal('explorer'),\n viewId: z.string().optional(),\n actions: ItemActionsSchema,\n});\n\nexport const attributeExplorerPanelSchema = z.object({\n attributeSource: z.string(),\n deactivateOnUnlink: z.boolean().optional(),\n libraryId: LibraryIdSchema,\n explorerProps: ExplorerPropsSchema.optional(),\n});\n\nconst libraryExplorerPanelSchema = z.object({\n explorerProps: ExplorerPropsSchema.optional(),\n});\n\nconst explorerPanelSchema = baseExplorerPanelSchema.and(\n z.union([attributeExplorerPanelSchema, libraryExplorerPanelSchema]),\n);\n\nexport const PanelSchema = basePanelSchema.and(\n z.union([explorerPanelSchema, iframePanelSchema, editionPanelSchema, creationPanelSchema]),\n);\n\nexport const PanelIFrameSchema = basePanelSchema.and(iframePanelSchema);\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/hooks/useIFrameMessenger/schema.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AAC1C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,QAAQ,EAAE,CAAC;AAE1F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAErG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,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,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,GAAG,CACnD,CAAC,CAAC,KAAK,CAAC,CAAC,4BAA4B,EAAE,0BAA0B,CAAC,CAAC,CACtE,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,GAAG,CAC1C,CAAC,CAAC,KAAK,CAAC,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,CAAC,CAC7F,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC,GAAG,CAAC,iBAAiB,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 * as z from 'zod/v4';\n\nexport const FONT_AWESOME_ICON_REGEX = /^fa-/;\n\nexport const PanelIdSchema = z.string();\nexport const LanguageSchema = z.string();\nexport const LibraryIdSchema = z.string();\nexport const FontAwesomeIconSchema = z.string().regex(FONT_AWESOME_ICON_REGEX).optional();\n\nexport const WhereSchema = z.union([z.literal('popup'), z.literal('slider'), z.literal('fullpage')]);\n\nexport const FlapPanelIdSchema = z.union([z.literal('info-history'), z.literal('thread')]);\n\nexport const ExplorerPropsSchema = z.object({\n showSearch: z.boolean().optional(),\n showFilters: z.boolean().optional(),\n showSorts: z.boolean().optional(),\n freezeView: z.boolean().optional(),\n showAttributeLabels: z.boolean().optional(),\n creationFormId: z.string().optional(),\n noPagination: z.literal(true).optional(),\n showActionsLabels: z.boolean().optional(),\n defaultPrimaryActions: z.array(z.union([z.literal('create')])).optional(),\n defaultMassActions: z\n .array(z.union([z.literal('deactivate'), z.literal('export'), z.literal('editAttribute')]))\n .optional(),\n defaultActionsForItem: z\n .array(z.union([z.literal('replaceLink'), z.literal('remove'), z.literal('activate')]))\n .optional(),\n});\n\nexport const ItemActionsSchema = z\n .array(\n z.object({\n where: WhereSchema,\n what: z.literal('record'),\n targetPanelId: PanelIdSchema.optional(),\n targetFlapPanelId: FlapPanelIdSchema.optional(),\n icon: FontAwesomeIconSchema,\n label: z.record(LanguageSchema, z.string()),\n onRowClick: z.boolean().optional(),\n }),\n )\n .refine(actions => actions.reduce((acc, action) => (action.onRowClick ? acc + 1 : acc), 0) <= 1, {\n message: 'At most one action must have onRowClick set to true',\n });\n\nexport const basePanelSchema = z.object({\n id: PanelIdSchema,\n icon: FontAwesomeIconSchema,\n name: z.record(LanguageSchema, z.string()).optional(),\n isStandalone: z.boolean().optional(),\n hideInCompactMode: z.boolean().optional(),\n});\n\nexport const iframePanelSchema = z.object({\n type: z.literal('custom'),\n iframeSource: z.string(),\n viewId: z.string().optional(),\n isSelfContaining: z.boolean().optional(),\n});\n\nconst editionPanelSchema = z.object({\n type: z.literal('editionForm'),\n formId: z.string(),\n});\n\nexport const creationPanelSchema = z.object({\n type: z.literal('creationForm'),\n formId: z.string(),\n attributeSource: z.string(),\n isStandalone: z.literal(true),\n});\n\nexport const baseExplorerPanelSchema = z.object({\n type: z.literal('explorer'),\n viewId: z.string().optional(),\n actions: ItemActionsSchema,\n});\n\nexport const attributeExplorerPanelSchema = z.object({\n attributeSource: z.string(),\n deactivateOnUnlink: z.boolean().optional(),\n libraryId: LibraryIdSchema,\n explorerProps: ExplorerPropsSchema.optional(),\n});\n\nconst libraryExplorerPanelSchema = z.object({\n explorerProps: ExplorerPropsSchema.optional(),\n});\n\nconst explorerPanelSchema = baseExplorerPanelSchema.and(\n z.union([attributeExplorerPanelSchema, libraryExplorerPanelSchema]),\n);\n\nexport const PanelSchema = basePanelSchema.and(\n z.union([explorerPanelSchema, iframePanelSchema, editionPanelSchema, creationPanelSchema]),\n);\n\nexport const PanelIFrameSchema = basePanelSchema.and(iframePanelSchema);\n"]}
@@ -55,7 +55,7 @@ export type AttributeExplorerPanel = Panel & z.infer<typeof baseExplorerPanelSch
55
55
  export type LibraryId = z.infer<typeof LibraryIdSchema>;
56
56
  export type PanelId = z.infer<typeof PanelIdSchema>;
57
57
  export type Where = z.infer<typeof WhereSchema>;
58
- type PanelIFrame = z.infer<typeof PanelIFrameSchema>;
58
+ export type PanelIFrame = z.infer<typeof PanelIFrameSchema>;
59
59
  type FlapPanelId = z.infer<typeof FlapPanelIdSchema>;
60
60
  export type NavigateToPanelMessage = IMessageBase & {
61
61
  type: 'navigate-to-panel';
@@ -103,12 +103,40 @@ export type OpenFlapPanelMessage = IMessageBase & {
103
103
  flapRecordId: string;
104
104
  flapLibraryId: LibraryId;
105
105
  flapPanelId: FlapPanelId;
106
+ redirectUrl?: string;
106
107
  };
107
108
  };
108
109
  export type CloseFlapPanelMessage = IMessageBase & {
109
110
  type: 'close-flap-panel';
110
111
  };
111
- export type MessageToParent = ModalConfirmMessage | AlertMessage | NotificationMessage | SimpleMessage | RegisterMessage | UnregisterMessage | NavigateToPanelMessage | ClosePanelMessage | NavigateToIframeMessage | MessageToPanelMessage | OpenFlapPanelMessage | CloseFlapPanelMessage;
112
+ export type GetUrlMessage = IMessageBase & {
113
+ type: 'get-url';
114
+ id: string;
115
+ data: {
116
+ onGetUrl: (url: string) => void;
117
+ flapParams?: {
118
+ flapRecordId: string;
119
+ flapLibraryId: LibraryId;
120
+ flapPanelId: FlapPanelId;
121
+ };
122
+ panelParams?: {
123
+ recordId: string;
124
+ where: Where;
125
+ recordPanelId: PanelId;
126
+ };
127
+ };
128
+ overrides?: string[];
129
+ };
130
+ export type GetPanelConfigMessage = IMessageBase & {
131
+ type: 'get-panel-config';
132
+ id: string;
133
+ data: {
134
+ panelId?: string;
135
+ onGetPanelConfig: (data: PanelIFrame) => void;
136
+ };
137
+ overrides?: string[];
138
+ };
139
+ export type MessageToParent = ModalConfirmMessage | AlertMessage | NotificationMessage | SimpleMessage | RegisterMessage | UnregisterMessage | NavigateToPanelMessage | ClosePanelMessage | NavigateToIframeMessage | MessageToPanelMessage | OpenFlapPanelMessage | CloseFlapPanelMessage | GetUrlMessage | GetPanelConfigMessage;
112
140
  export type MessageFromParent = (IMessageBase & {
113
141
  type: 'on-call-callback';
114
142
  path: string;
@@ -134,6 +162,8 @@ export interface IUseIFrameMessengerOptions {
134
162
  onClosePanel?: (data: ClosePanelMessage['data']) => void;
135
163
  onNavigateToIframe?: (data: NavigateToIframeMessage['data']) => void;
136
164
  onOpenFlapPanel?: (data: OpenFlapPanelMessage['data']) => void;
165
+ onGetUrl?: (data: GetUrlMessage['data']) => void;
166
+ onGetPanelConfig?: (data: GetPanelConfigMessage['data'], id: string, dispatch: MessageDispatcher, callCb: CallCbFunction) => void;
137
167
  onCloseFlapPanel?: () => void;
138
168
  };
139
169
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/hooks/useIFrameMessenger/types.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,MAAM,QAAQ,GAAG,uBAAuB,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 RefObject, type ComponentProps, type Key, type JSXElementConstructor} from 'react';\nimport type * as z from 'zod/v4';\nimport {type KitNotification} from 'aristid-ds';\nimport {type IKitConfirmDialog} from 'aristid-ds/dist/Kit/Feedback/Modal/types';\nimport {type ToastedAlertProps} from 'aristid-ds/dist/Kit/Feedback/Alert/types';\nimport {\n type LibraryIdSchema,\n type WhereSchema,\n type PanelIdSchema,\n type PanelSchema,\n type PanelIFrameSchema,\n type FlapPanelIdSchema,\n type attributeExplorerPanelSchema,\n type baseExplorerPanelSchema,\n} from '_ui/hooks/useIFrameMessenger/schema';\n\nexport const packetId = '__fromIframeMessenger';\n\nexport interface IEncodedMessage {\n payload: string;\n [packetId]: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ComponentPropsWithKey<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> =\n ComponentProps<T> & {\n key?: Key;\n };\n\nexport interface IMessageBase {\n __frameId?: string;\n}\n\nexport type ModalConfirmMessage = IMessageBase & {\n type: 'modal-confirm';\n id: string;\n data: IKitConfirmDialog;\n overrides?: string[];\n};\n\nexport type AlertMessage = IMessageBase & {\n type: 'alert';\n id: string;\n data: ToastedAlertProps;\n overrides?: string[];\n};\n\nexport type NotificationMessage = IMessageBase & {\n type: 'notification';\n id: string;\n data: ComponentPropsWithKey<typeof KitNotification>;\n overrides?: string[];\n};\n\nexport type ChangeLanguageMessage = IMessageBase & {\n type: 'change-language';\n language: string;\n};\n\nexport type SimpleMessage = IMessageBase & {\n type: 'message';\n id: string;\n data: unknown;\n};\n\nexport type RegisterMessage = IMessageBase & {\n type: 'register';\n id: string;\n};\n\nexport type UnregisterMessage = IMessageBase & {\n type: 'unregister';\n id: string;\n};\n\nexport type Panel = z.infer<typeof PanelSchema>;\n\nexport type AttributeExplorerPanel = Panel &\n z.infer<typeof baseExplorerPanelSchema> &\n z.infer<typeof attributeExplorerPanelSchema>;\n\nexport type LibraryId = z.infer<typeof LibraryIdSchema>;\n\nexport type PanelId = z.infer<typeof PanelIdSchema>;\n\nexport type Where = z.infer<typeof WhereSchema>;\n\ntype PanelIFrame = z.infer<typeof PanelIFrameSchema>;\n\ntype FlapPanelId = z.infer<typeof FlapPanelIdSchema>;\n\nexport type NavigateToPanelMessage = IMessageBase & {\n type: 'navigate-to-panel';\n data: {\n where: Where;\n libraryId: LibraryId;\n panelId?: PanelId;\n recordId?: string;\n flapRecordId?: string;\n flapLibraryId?: LibraryId;\n flapPanelId?: FlapPanelId;\n };\n};\n\nexport type ClosePanelMessage = IMessageBase & {\n type: 'close-panel';\n data: {\n recordId: string;\n where: string;\n recordPanelId: string;\n };\n};\n\nexport type NavigateToIframeMessage = IMessageBase & {\n type: 'navigate-to-iframe';\n data: {\n panel: PanelIFrame;\n destination: {libraryId: LibraryId};\n where: Where;\n recordId: string;\n recordPanelId: string;\n };\n};\n\nexport type MessageToPanelMessage = IMessageBase & {\n type: 'message-to-panel';\n data: {\n type: string;\n target?: string;\n payload: unknown;\n };\n};\n\nexport type OpenFlapPanelMessage = IMessageBase & {\n type: 'open-flap-panel';\n data: {\n flapRecordId: string;\n flapLibraryId: LibraryId;\n flapPanelId: FlapPanelId;\n };\n};\n\nexport type CloseFlapPanelMessage = IMessageBase & {\n type: 'close-flap-panel';\n};\n\nexport type MessageToParent =\n | ModalConfirmMessage\n | AlertMessage\n | NotificationMessage\n | SimpleMessage\n | RegisterMessage\n | UnregisterMessage\n | NavigateToPanelMessage\n | ClosePanelMessage\n | NavigateToIframeMessage\n | MessageToPanelMessage\n | OpenFlapPanelMessage\n | CloseFlapPanelMessage;\n\nexport type MessageFromParent =\n | (IMessageBase & {\n type: 'on-call-callback';\n path: string;\n data: unknown;\n })\n | ChangeLanguageMessage;\n\nexport type Message = MessageToParent | MessageFromParent;\n\nexport type MessageHandler<T = Message> = (message: T, dispatch: MessageDispatcher<T>) => void;\nexport type MessageDispatcher<T = Message> = (message: T, frameId?: string) => void;\n\nexport type CallCbFunction = (path: string, data: unknown, frameId: string) => void;\n\nexport type CallbackFunction = (...args: never[]) => void;\nexport type Callbacks = Record<string, Record<string, CallbackFunction>>;\n\nexport type MessageToPanelMessageHandler = (data: MessageToPanelMessage['data']['payload']) => void;\nexport type AddMessageToPanelMessageHandler = (type: string, handler: MessageToPanelMessageHandler) => void;\n\nexport interface IUseIFrameMessengerOptions {\n ref?: RefObject<HTMLIFrameElement>;\n id?: string;\n handlers?: {\n onModalConfirm?: (\n data: ModalConfirmMessage['data'],\n id: string,\n dispatch: MessageDispatcher,\n callCb: CallCbFunction,\n ) => void;\n onAlert?: (data: AlertMessage['data'], id: string, dispatch: MessageDispatcher, callCb: CallCbFunction) => void;\n onNotification?: (\n data: NotificationMessage['data'],\n id: string,\n dispatch: MessageDispatcher,\n callCb: CallCbFunction,\n ) => void;\n onMessage?: (data: unknown, id: string, dispatch: MessageDispatcher, callCb: CallCbFunction) => void;\n onNavigateToPanel?: (data: NavigateToPanelMessage['data']) => void;\n onClosePanel?: (data: ClosePanelMessage['data']) => void;\n onNavigateToIframe?: (data: NavigateToIframeMessage['data']) => void;\n onOpenFlapPanel?: (data: OpenFlapPanelMessage['data']) => void;\n onCloseFlapPanel?: () => void;\n };\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/hooks/useIFrameMessenger/types.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,MAAM,QAAQ,GAAG,uBAAuB,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 RefObject, type ComponentProps, type Key, type JSXElementConstructor} from 'react';\nimport type * as z from 'zod/v4';\nimport {type KitNotification} from 'aristid-ds';\nimport {type IKitConfirmDialog} from 'aristid-ds/dist/Kit/Feedback/Modal/types';\nimport {type ToastedAlertProps} from 'aristid-ds/dist/Kit/Feedback/Alert/types';\nimport {\n type LibraryIdSchema,\n type WhereSchema,\n type PanelIdSchema,\n type PanelSchema,\n type PanelIFrameSchema,\n type FlapPanelIdSchema,\n type attributeExplorerPanelSchema,\n type baseExplorerPanelSchema,\n} from '_ui/hooks/useIFrameMessenger/schema';\n\nexport const packetId = '__fromIframeMessenger';\n\nexport interface IEncodedMessage {\n payload: string;\n [packetId]: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ComponentPropsWithKey<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> =\n ComponentProps<T> & {\n key?: Key;\n };\n\nexport interface IMessageBase {\n __frameId?: string;\n}\n\nexport type ModalConfirmMessage = IMessageBase & {\n type: 'modal-confirm';\n id: string;\n data: IKitConfirmDialog;\n overrides?: string[];\n};\n\nexport type AlertMessage = IMessageBase & {\n type: 'alert';\n id: string;\n data: ToastedAlertProps;\n overrides?: string[];\n};\n\nexport type NotificationMessage = IMessageBase & {\n type: 'notification';\n id: string;\n data: ComponentPropsWithKey<typeof KitNotification>;\n overrides?: string[];\n};\n\nexport type ChangeLanguageMessage = IMessageBase & {\n type: 'change-language';\n language: string;\n};\n\nexport type SimpleMessage = IMessageBase & {\n type: 'message';\n id: string;\n data: unknown;\n};\n\nexport type RegisterMessage = IMessageBase & {\n type: 'register';\n id: string;\n};\n\nexport type UnregisterMessage = IMessageBase & {\n type: 'unregister';\n id: string;\n};\n\nexport type Panel = z.infer<typeof PanelSchema>;\n\nexport type AttributeExplorerPanel = Panel &\n z.infer<typeof baseExplorerPanelSchema> &\n z.infer<typeof attributeExplorerPanelSchema>;\n\nexport type LibraryId = z.infer<typeof LibraryIdSchema>;\n\nexport type PanelId = z.infer<typeof PanelIdSchema>;\n\nexport type Where = z.infer<typeof WhereSchema>;\n\nexport type PanelIFrame = z.infer<typeof PanelIFrameSchema>;\n\ntype FlapPanelId = z.infer<typeof FlapPanelIdSchema>;\n\nexport type NavigateToPanelMessage = IMessageBase & {\n type: 'navigate-to-panel';\n data: {\n where: Where;\n libraryId: LibraryId;\n panelId?: PanelId;\n recordId?: string;\n flapRecordId?: string;\n flapLibraryId?: LibraryId;\n flapPanelId?: FlapPanelId;\n };\n};\n\nexport type ClosePanelMessage = IMessageBase & {\n type: 'close-panel';\n data: {\n recordId: string;\n where: string;\n recordPanelId: string;\n };\n};\n\nexport type NavigateToIframeMessage = IMessageBase & {\n type: 'navigate-to-iframe';\n data: {\n panel: PanelIFrame;\n destination: {libraryId: LibraryId};\n where: Where;\n recordId: string;\n recordPanelId: string;\n };\n};\n\nexport type MessageToPanelMessage = IMessageBase & {\n type: 'message-to-panel';\n data: {\n type: string;\n target?: string;\n payload: unknown;\n };\n};\n\nexport type OpenFlapPanelMessage = IMessageBase & {\n type: 'open-flap-panel';\n data: {\n flapRecordId: string;\n flapLibraryId: LibraryId;\n flapPanelId: FlapPanelId;\n redirectUrl?: string;\n };\n};\n\nexport type CloseFlapPanelMessage = IMessageBase & {\n type: 'close-flap-panel';\n};\n\nexport type GetUrlMessage = IMessageBase & {\n type: 'get-url';\n id: string;\n data: {\n onGetUrl: (url: string) => void;\n flapParams?: {\n flapRecordId: string;\n flapLibraryId: LibraryId;\n flapPanelId: FlapPanelId;\n };\n panelParams?: {\n recordId: string;\n where: Where;\n recordPanelId: PanelId;\n };\n };\n overrides?: string[];\n};\n\nexport type GetPanelConfigMessage = IMessageBase & {\n type: 'get-panel-config';\n id: string;\n data: {\n panelId?: string;\n onGetPanelConfig: (data: PanelIFrame) => void;\n };\n overrides?: string[];\n};\n\nexport type MessageToParent =\n | ModalConfirmMessage\n | AlertMessage\n | NotificationMessage\n | SimpleMessage\n | RegisterMessage\n | UnregisterMessage\n | NavigateToPanelMessage\n | ClosePanelMessage\n | NavigateToIframeMessage\n | MessageToPanelMessage\n | OpenFlapPanelMessage\n | CloseFlapPanelMessage\n | GetUrlMessage\n | GetPanelConfigMessage;\n\nexport type MessageFromParent =\n | (IMessageBase & {\n type: 'on-call-callback';\n path: string;\n data: unknown;\n })\n | ChangeLanguageMessage;\n\nexport type Message = MessageToParent | MessageFromParent;\n\nexport type MessageHandler<T = Message> = (message: T, dispatch: MessageDispatcher<T>) => void;\nexport type MessageDispatcher<T = Message> = (message: T, frameId?: string) => void;\n\nexport type CallCbFunction = (path: string, data: unknown, frameId: string) => void;\n\nexport type CallbackFunction = (...args: never[]) => void;\nexport type Callbacks = Record<string, Record<string, CallbackFunction>>;\n\nexport type MessageToPanelMessageHandler = (data: MessageToPanelMessage['data']['payload']) => void;\nexport type AddMessageToPanelMessageHandler = (type: string, handler: MessageToPanelMessageHandler) => void;\n\nexport interface IUseIFrameMessengerOptions {\n ref?: RefObject<HTMLIFrameElement>;\n id?: string;\n handlers?: {\n onModalConfirm?: (\n data: ModalConfirmMessage['data'],\n id: string,\n dispatch: MessageDispatcher,\n callCb: CallCbFunction,\n ) => void;\n onAlert?: (data: AlertMessage['data'], id: string, dispatch: MessageDispatcher, callCb: CallCbFunction) => void;\n onNotification?: (\n data: NotificationMessage['data'],\n id: string,\n dispatch: MessageDispatcher,\n callCb: CallCbFunction,\n ) => void;\n onMessage?: (data: unknown, id: string, dispatch: MessageDispatcher, callCb: CallCbFunction) => void;\n onNavigateToPanel?: (data: NavigateToPanelMessage['data']) => void;\n onClosePanel?: (data: ClosePanelMessage['data']) => void;\n onNavigateToIframe?: (data: NavigateToIframeMessage['data']) => void;\n onOpenFlapPanel?: (data: OpenFlapPanelMessage['data']) => void;\n onGetUrl?: (data: GetUrlMessage['data']) => void;\n onGetPanelConfig?: (\n data: GetPanelConfigMessage['data'],\n id: string,\n dispatch: MessageDispatcher,\n callCb: CallCbFunction,\n ) => void;\n onCloseFlapPanel?: () => void;\n };\n}\n"]}
@@ -18,4 +18,6 @@ export declare const useIFrameMessenger: (options?: IUseIFrameMessengerOptions)
18
18
  messageToPanel: (data: import("./types").MessageToPanelMessage["data"]) => void;
19
19
  openFlapPanel: (data: import("./types").OpenFlapPanelMessage["data"]) => void;
20
20
  closeFlapPanel: () => void;
21
+ getPanelConfig: (data: import("./types").GetPanelConfigMessage["data"]) => void;
22
+ getUrl: (data: import("./types").GetUrlMessage["data"]) => void;
21
23
  };
@@ -2,7 +2,6 @@
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
4
  import { useCallback, useContext, useEffect, useRef } from 'react';
5
- import { v4 as uuid } from 'uuid';
6
5
  import { LangContext } from '../../contexts';
7
6
  import { encodeMessage, decodeMessage, getExposedMethods, initClientHandlers } from './messageHandlers';
8
7
  /**
@@ -11,7 +10,7 @@ import { encodeMessage, decodeMessage, getExposedMethods, initClientHandlers } f
11
10
  */
12
11
  export const useIFrameMessenger = (options) => {
13
12
  const registry = useRef({});
14
- const selfId = useRef(options?.id ?? uuid());
13
+ const selfId = useRef(options?.id ?? window.crypto.randomUUID());
15
14
  const { setLang } = useContext(LangContext);
16
15
  const changeLangInAllFrames = (newLanguage) => {
17
16
  dispatch({
@@ -54,6 +53,16 @@ export const useIFrameMessenger = (options) => {
54
53
  changeLangInAllFrames,
55
54
  addPanelMessageHandler,
56
55
  });
56
+ const getPanelIdFromEvent = (event) => {
57
+ const iFrames = window.document.getElementsByTagName('iframe');
58
+ // eslint-disable-next-line @typescript-eslint/prefer-for-of
59
+ for (let i = 0; i < iFrames.length; i++) {
60
+ if (event.source === iFrames[i].contentWindow) {
61
+ return iFrames[i].name;
62
+ }
63
+ }
64
+ return null;
65
+ };
57
66
  useEffect(() => {
58
67
  const clientHandlers = initClientHandlers(callCb, { ...options, id: selfId.current }, callbacksStore);
59
68
  const onMessage = (event) => {
@@ -84,6 +93,11 @@ export const useIFrameMessenger = (options) => {
84
93
  dispatch(message, target);
85
94
  }
86
95
  break;
96
+ case 'get-panel-config':
97
+ clientHandlers({
98
+ ...message,
99
+ data: { ...message.data, panelId: getPanelIdFromEvent(event) },
100
+ }, dispatch);
87
101
  default:
88
102
  if (message.type === 'change-language') {
89
103
  setLang(message.language);
@@ -1 +1 @@
1
- {"version":3,"file":"useIFrameMessenger.js","sourceRoot":"","sources":["../../../src/hooks/useIFrameMessenger/useIFrameMessenger.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AACjE,OAAO,EAAC,EAAE,IAAI,IAAI,EAAC,MAAM,MAAM,CAAC;AAChC,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AASzC,OAAO,EAAC,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAItG;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAoC,EAAE,EAAE;IACvE,MAAM,QAAQ,GAAG,MAAM,CAAyB,EAAE,CAAC,CAAC;IACpD,MAAM,MA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AAC;oBACtC,CAAC;oBACD,MAAM;YACd,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAE9C,IAAI,MAAM,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC;YACxB,qDAAqD;YACrD,QAAQ,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,OAAO,EAAC,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,GAAG,EAAE;YACR,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACrD,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC,OAAO,CAAC;AAC3B,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 {useCallback, useContext, useEffect, useRef} from 'react';\nimport {v4 as uuid} from 'uuid';\nimport {LangContext} from '_ui/contexts';\nimport {\n type AddMessageToPanelMessageHandler,\n type MessageToPanelMessageHandler,\n type Callbacks,\n type CallCbFunction,\n type IUseIFrameMessengerOptions,\n type MessageDispatcher,\n} from './types';\nimport {encodeMessage, decodeMessage, getExposedMethods, initClientHandlers} from './messageHandlers';\n\nexport {IUseIFrameMessengerOptions};\n\n/**\n * This is the core of `useIFrameMessenger`. Should be used for top-level apps, such as **app-studio**.\n * For client apps (apps that need to consume the messenger), please use the `useIFrameMessengerClient`\n */\nexport const useIFrameMessenger = (options?: IUseIFrameMessengerOptions) => {\n const registry = useRef<Record<string, Window>>({});\n const selfId = useRef(options?.id ?? uuid());\n\n const {setLang} = useContext(LangContext);\n\n const changeLangInAllFrames = (newLanguage: string) => {\n dispatch(\n {\n type: 'change-language',\n language: newLanguage,\n },\n 'all',\n );\n };\n\n const panelMessageHandlerRegistry = useRef<Record<string, MessageToPanelMessageHandler>>({});\n const addPanelMessageHandler: AddMessageToPanelMessageHandler = (\n type: string,\n handler: MessageToPanelMessageHandler,\n ) => {\n panelMessageHandlerRegistry.current[type] = handler;\n };\n\n const dispatch = useCallback<MessageDispatcher>(\n (message, frameId) => {\n if (window !== window.top) {\n window.parent.postMessage(encodeMessage({...message, __frameId: selfId.current}), '*');\n } else if (frameId && registry.current[frameId]) {\n (registry.current[frameId] as Window).postMessage(\n encodeMessage({...message, __frameId: selfId.current}),\n '*',\n );\n } else if (frameId === 'all') {\n Object.entries(registry.current).forEach(([id, frame]) => {\n if (id !== message.__frameId) {\n // DO not send the message to the sender\n frame.postMessage(encodeMessage({...message, __frameId: selfId.current}), '*');\n }\n });\n }\n },\n [registry.current],\n );\n\n const callCb = useCallback<CallCbFunction>(\n (path, data, frameId) => {\n dispatch({type: 'on-call-callback', path, data}, frameId);\n },\n [dispatch],\n );\n\n const unregister = () => {\n if (window !== window.top) {\n dispatch({type: 'unregister', id: selfId.current});\n }\n };\n\n const callbacksStore = useRef<Callbacks>({});\n const methods = useRef({\n ...getExposedMethods(callbacksStore, dispatch),\n unregister,\n changeLangInAllFrames,\n addPanelMessageHandler,\n });\n\n useEffect(() => {\n const clientHandlers = initClientHandlers(callCb, {...options, id: selfId.current}, callbacksStore);\n const onMessage = (event: MessageEvent) => {\n const message = decodeMessage(event.data);\n if (message === undefined) {\n return;\n }\n switch (message.type) {\n case 'register':\n const frames = window.frames;\n // Due to weak typing on Window, we cannot iterate directly on window.frames\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < frames.length; i++) {\n if (event.source === frames[i]) {\n registry.current[message.id] = frames[i];\n }\n }\n break;\n case 'unregister':\n if (registry.current[message.id]) {\n delete registry.current[message.id];\n }\n break;\n case 'message-to-panel':\n panelMessageHandlerRegistry.current[message.data.type]?.(message.data.payload);\n if (window === window.top) {\n const target = message.data.target ?? 'all';\n dispatch(message, target);\n }\n break;\n default:\n if (message.type === 'change-language') {\n setLang(message.language);\n } else {\n clientHandlers(message, dispatch);\n }\n break;\n }\n };\n\n window.addEventListener('message', onMessage);\n\n if (window !== window.top) {\n // Register the message handler for the parent window\n dispatch({type: 'register', id: selfId.current});\n }\n\n return () => {\n window.removeEventListener('message', onMessage);\n };\n }, []);\n\n return methods.current;\n};\n"]}
1
+ {"version":3,"file":"useIFrameMessenger.js","sourceRoot":"","sources":["../../../src/hooks/useIFrameMessenger/useIFrameMessenger.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AASzC,OAAO,EAAC,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAItG;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAoC,EAAE,EAAE;IACvE,MAAM,QAAQ,GAAG,MAAM,CAAyB,EAAE,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,EAAE,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAEjE,MAAM,EAAC,OAAO,EAAC,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAE1C,MAAM,qBAAqB,GAAG,CAAC,WAAmB,EAAE,EAAE;QAClD,QAAQ,CACJ;YACI,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE,WAAW;SACxB,EACD,KAAK,CACR,CAAC;IACN,CAAC,CAAC;IAEF,MAAM,2BAA2B,GAAG,MAAM,CAA+C,EAAE,CAAC,CAAC;IAC7F,MAAM,sBAAsB,GAAoC,CAC5D,IAAY,EACZ,OAAqC,EACvC,EAAE;QACA,2BAA2B,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;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AAI,KAAK,iBAAiB,EAAE,CAAC;wBACrC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAC9B,CAAC;yBAAM,CAAC;wBACJ,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;oBACtC,CAAC;oBACD,MAAM;YACd,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAE9C,IAAI,MAAM,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC;YACxB,qDAAqD;YACrD,QAAQ,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,OAAO,EAAC,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,GAAG,EAAE;YACR,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACrD,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC,OAAO,CAAC;AAC3B,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 {useCallback, useContext, useEffect, useRef} from 'react';\nimport {LangContext} from '_ui/contexts';\nimport {\n type AddMessageToPanelMessageHandler,\n type MessageToPanelMessageHandler,\n type Callbacks,\n type CallCbFunction,\n type IUseIFrameMessengerOptions,\n type MessageDispatcher,\n} from './types';\nimport {encodeMessage, decodeMessage, getExposedMethods, initClientHandlers} from './messageHandlers';\n\nexport {IUseIFrameMessengerOptions};\n\n/**\n * This is the core of `useIFrameMessenger`. Should be used for top-level apps, such as **app-studio**.\n * For client apps (apps that need to consume the messenger), please use the `useIFrameMessengerClient`\n */\nexport const useIFrameMessenger = (options?: IUseIFrameMessengerOptions) => {\n const registry = useRef<Record<string, Window>>({});\n const selfId = useRef(options?.id ?? window.crypto.randomUUID());\n\n const {setLang} = useContext(LangContext);\n\n const changeLangInAllFrames = (newLanguage: string) => {\n dispatch(\n {\n type: 'change-language',\n language: newLanguage,\n },\n 'all',\n );\n };\n\n const panelMessageHandlerRegistry = useRef<Record<string, MessageToPanelMessageHandler>>({});\n const addPanelMessageHandler: AddMessageToPanelMessageHandler = (\n type: string,\n handler: MessageToPanelMessageHandler,\n ) => {\n panelMessageHandlerRegistry.current[type] = handler;\n };\n\n const dispatch = useCallback<MessageDispatcher>(\n (message, frameId) => {\n if (window !== window.top) {\n window.parent.postMessage(encodeMessage({...message, __frameId: selfId.current}), '*');\n } else if (frameId && registry.current[frameId]) {\n (registry.current[frameId] as Window).postMessage(\n encodeMessage({...message, __frameId: selfId.current}),\n '*',\n );\n } else if (frameId === 'all') {\n Object.entries(registry.current).forEach(([id, frame]) => {\n if (id !== message.__frameId) {\n // DO not send the message to the sender\n frame.postMessage(encodeMessage({...message, __frameId: selfId.current}), '*');\n }\n });\n }\n },\n [registry.current],\n );\n\n const callCb = useCallback<CallCbFunction>(\n (path, data, frameId) => {\n dispatch({type: 'on-call-callback', path, data}, frameId);\n },\n [dispatch],\n );\n\n const unregister = () => {\n if (window !== window.top) {\n dispatch({type: 'unregister', id: selfId.current});\n }\n };\n\n const callbacksStore = useRef<Callbacks>({});\n const methods = useRef({\n ...getExposedMethods(callbacksStore, dispatch),\n unregister,\n changeLangInAllFrames,\n addPanelMessageHandler,\n });\n\n const getPanelIdFromEvent = (event: MessageEvent) => {\n const iFrames = window.document.getElementsByTagName('iframe');\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < iFrames.length; i++) {\n if (event.source === iFrames[i].contentWindow) {\n return iFrames[i].name;\n }\n }\n return null;\n };\n\n useEffect(() => {\n const clientHandlers = initClientHandlers(callCb, {...options, id: selfId.current}, callbacksStore);\n const onMessage = (event: MessageEvent) => {\n const message = decodeMessage(event.data);\n if (message === undefined) {\n return;\n }\n switch (message.type) {\n case 'register':\n const frames = window.frames;\n // Due to weak typing on Window, we cannot iterate directly on window.frames\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < frames.length; i++) {\n if (event.source === frames[i]) {\n registry.current[message.id] = frames[i];\n }\n }\n break;\n case 'unregister':\n if (registry.current[message.id]) {\n delete registry.current[message.id];\n }\n break;\n case 'message-to-panel':\n panelMessageHandlerRegistry.current[message.data.type]?.(message.data.payload);\n if (window === window.top) {\n const target = message.data.target ?? 'all';\n dispatch(message, target);\n }\n break;\n case 'get-panel-config':\n clientHandlers(\n {\n ...message,\n data: {...message.data, panelId: getPanelIdFromEvent(event)},\n },\n dispatch,\n );\n default:\n if (message.type === 'change-language') {\n setLang(message.language);\n } else {\n clientHandlers(message, dispatch);\n }\n break;\n }\n };\n\n window.addEventListener('message', onMessage);\n\n if (window !== window.top) {\n // Register the message handler for the parent window\n dispatch({type: 'register', id: selfId.current});\n }\n\n return () => {\n window.removeEventListener('message', onMessage);\n };\n }, []);\n\n return methods.current;\n};\n"]}
@@ -12,4 +12,6 @@ export declare const IframeMessengerClientContext: import("react").Context<{
12
12
  messageToPanel: (data: import("../useIFrameMessenger/types").MessageToPanelMessage["data"]) => void;
13
13
  openFlapPanel: (data: import("../useIFrameMessenger/types").OpenFlapPanelMessage["data"]) => void;
14
14
  closeFlapPanel: () => void;
15
+ getPanelConfig: (data: import("../useIFrameMessenger/types").GetPanelConfigMessage["data"]) => void;
16
+ getUrl: (data: import("../useIFrameMessenger/types").GetUrlMessage["data"]) => void;
15
17
  }>;
@@ -12,4 +12,6 @@ export declare const useIFrameMessengerClient: () => {
12
12
  messageToPanel: (data: import("../useIFrameMessenger/types").MessageToPanelMessage["data"]) => void;
13
13
  openFlapPanel: (data: import("../useIFrameMessenger/types").OpenFlapPanelMessage["data"]) => void;
14
14
  closeFlapPanel: () => void;
15
+ getPanelConfig: (data: import("../useIFrameMessenger/types").GetPanelConfigMessage["data"]) => void;
16
+ getUrl: (data: import("../useIFrameMessenger/types").GetUrlMessage["data"]) => void;
15
17
  };
@@ -37,7 +37,8 @@
37
37
  "max_length": "Max length",
38
38
  "confirm": "Confirm",
39
39
  "loading": "Loading",
40
- "are_you_sure": "Are you sure?"
40
+ "are_you_sure": "Are you sure?",
41
+ "reset": "Reset"
41
42
  },
42
43
  "errors": {
43
44
  "default_language_required": "The default language is required",
@@ -308,7 +309,8 @@
308
309
  "deactivate": "Deactivate",
309
310
  "activate": "Activate",
310
311
  "add": "Add",
311
- "add-condition": "Add condition"
312
+ "add-condition": "Add condition",
313
+ "empty-value": "Undefined"
312
314
  },
313
315
  "filter-item": {
314
316
  "no-operator": "If"
@@ -439,6 +441,8 @@
439
441
  "delete_all": "Delete all",
440
442
  "delete_all_values": "Delete all values",
441
443
  "delete_all_values_confirm": "Do you really want to delete all values?",
444
+ "delete_link": "Delete link",
445
+ "delete_link_description": "Do you really want to delete the link?",
442
446
  "value_details_tooltip": "More details",
443
447
  "attribute": {
444
448
  "id": "Identifier",
@@ -699,7 +703,6 @@
699
703
  "inactive": "Inactive sorts"
700
704
  },
701
705
  "toolbar": "Toolbar",
702
- "reset-filter": "Reset filter",
703
706
  "reset-view": "Reset view",
704
707
  "empty-data": "No items found.",
705
708
  "available-attributes": "Other available attributes",
@@ -755,6 +758,7 @@
755
758
  "editAttribute_value_occurrences_to_edit_one": "{{count, number}} element to edit",
756
759
  "editAttribute_value_occurrences_to_edit_other": "{{count, number}} elements to edit",
757
760
  "editAttribute_value_undefined": "Undefined",
761
+ "editAttribute_value_do_not_change": "Do not change",
758
762
  "editAttribute_submit_notification_title": "Bulk edit request",
759
763
  "editAttribute_submit_notification_description": "Your request to edit {{counter, number}} items has been received. You will be notified once the operation is complete.",
760
764
  "editAttribute_submit_error": "An error occurred while requesting a bulk edit. Please contact an administrator.",
@@ -776,6 +780,17 @@
776
780
  "deselect_all": "Deselect all items"
777
781
  }
778
782
  },
783
+ "export_profile_modal": {
784
+ "title": "Export",
785
+ "profile_label": "Choose an export profile",
786
+ "preview_label": "Preview of exported attributes",
787
+ "search_placeholder": "Search...",
788
+ "no_profiles": "No export profiles configured for this library",
789
+ "contact_admin": "Please contact an administrator to configure export profiles.",
790
+ "empty_columns": "(empty column)",
791
+ "export_button": "Export",
792
+ "error_title": "Export profile error"
793
+ },
779
794
  "add-existing-item": "Add existing item",
780
795
  "activate_item_one": "Activate this item?",
781
796
  "activate_item_other": "Activate these items?",
@@ -37,7 +37,8 @@
37
37
  "max_length": "Longueur maximale",
38
38
  "confirm": "Confirmer",
39
39
  "loading": "Chargement",
40
- "are_you_sure": "Êtes-vous sûr ?"
40
+ "are_you_sure": "Êtes-vous sûr(e) ?",
41
+ "reset": "Réinitialiser"
41
42
  },
42
43
  "errors": {
43
44
  "default_language_required": "La langue par défaut est requise",
@@ -308,7 +309,8 @@
308
309
  "deactivate": "Désactiver",
309
310
  "activate": "Activer",
310
311
  "add": "Ajouter",
311
- "add-condition": "Ajouter une condition"
312
+ "add-condition": "Ajouter une condition",
313
+ "empty-value": "Non défini"
312
314
  },
313
315
  "filter-item": {
314
316
  "no-operator": "Si"
@@ -439,6 +441,8 @@
439
441
  "delete_all": "Tout supprimer",
440
442
  "delete_all_values": "Supprimer toutes les valeurs",
441
443
  "delete_all_values_confirm": "Êtes-vous sûr de vouloir supprimer toutes les valeurs?",
444
+ "delete_link": "Supprimer la liaison",
445
+ "delete_link_description": "Êtes-vous sûr de vouloir supprimer la liaison?",
442
446
  "value_details_tooltip": "Plus d'informations",
443
447
  "attribute": {
444
448
  "id": "Identifiant",
@@ -697,7 +701,6 @@
697
701
  "inactive": "Tris inactifs"
698
702
  },
699
703
  "toolbar": "Barre d’outils",
700
- "reset-filter": "Réinitialiser le filtre",
701
704
  "reset-view": "Réinitialiser la vue",
702
705
  "empty-data": "Aucun élément trouvé.",
703
706
  "sort-ascending": "Ascendant",
@@ -755,6 +758,7 @@
755
758
  "editAttribute_value_occurrences_to_edit_one": "{{count, number}} élément à traiter",
756
759
  "editAttribute_value_occurrences_to_edit_other": "{{count, number}} éléments à traiter",
757
760
  "editAttribute_value_undefined": "Non défini",
761
+ "editAttribute_value_do_not_change": "Ne pas changer",
758
762
  "editAttribute_submit_notification_title": "Demande de modification en masse",
759
763
  "editAttribute_submit_notification_description": "Votre demande de modification de {{counter, number}} éléments a bien été prise en compte. Vous serez notifié une fois l'opération terminée.",
760
764
  "editAttribute_submit_error": "Une erreur est survenue lors de la demande d'une modification en masse. Veuillez contacter un administrateur.",
@@ -776,6 +780,17 @@
776
780
  "deselect_all": "Tout désélectionner"
777
781
  }
778
782
  },
783
+ "export_profile_modal": {
784
+ "title": "Export",
785
+ "profile_label": "Choisir un profil d'export",
786
+ "preview_label": "Aperçu des attributs exportés",
787
+ "search_placeholder": "Rechercher...",
788
+ "no_profiles": "Aucun profil d'export configuré pour cette librairie",
789
+ "contact_admin": "Veuillez contacter un administrateur pour configurer les profils d'export.",
790
+ "empty_columns": "(colonne vide)",
791
+ "export_button": "Exporter",
792
+ "error_title": "Erreur de profil d'export"
793
+ },
779
794
  "add-existing-item": "Ajouter un élément existant",
780
795
  "activate_item_one": "Activer cet élément ?",
781
796
  "activate_item_other": "Activer ces éléments ?",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leav/ui",
3
- "version": "1.6.0",
3
+ "version": "1.7.0-67b86ab9",
4
4
  "description": "Shared React components and hooks",
5
5
  "scripts": {
6
6
  "prepublishOnly": "yarn build",
@@ -25,76 +25,74 @@
25
25
  "repository": "https://github.com/leav-solutions/leav-engine",
26
26
  "devDependencies": {
27
27
  "@apollo/client": "3.8.1",
28
- "@babel/preset-env": "7.28.5",
28
+ "@babel/preset-env": "7.28.6",
29
29
  "@babel/preset-react": "7.28.5",
30
- "@graphql-codegen/add": "5.0.0",
31
- "@graphql-codegen/cli": "5.0.0",
32
- "@testing-library/jest-dom": "5.16.5",
33
- "@testing-library/react": "14.0.0",
30
+ "@graphql-codegen/add": "5.0.3",
31
+ "@graphql-codegen/cli": "6.1.1",
32
+ "@graphql-codegen/typescript": "5.0.7",
33
+ "@graphql-codegen/typescript-operations": "5.0.7",
34
+ "@graphql-codegen/typescript-react-apollo": "4.4.0",
35
+ "@testing-library/jest-dom": "5.17.0",
36
+ "@testing-library/react": "14.3.1",
34
37
  "@testing-library/react-hooks": "8.0.1",
35
- "@testing-library/user-event": "14.4.3",
38
+ "@testing-library/user-event": "14.6.1",
36
39
  "@total-typescript/ts-reset": "0.6.1",
37
40
  "@types/dompurify": "3.0.3",
38
- "@types/jest": "29.0.2",
41
+ "@types/jest": "29.5.14",
39
42
  "@types/lodash.isequal": "^4",
40
- "@types/object-path": "0.11.1",
43
+ "@types/object-path": "0.11.4",
41
44
  "@types/react": "18.2.14",
42
- "@types/react-beautiful-dnd": "13.1.2",
43
45
  "@types/react-dom": "18.2.6",
44
- "@types/react-table": "7.7.12",
45
- "@types/uuid": "^9",
46
- "antd": "5.22.2",
47
- "aristid-ds": "14.0.0-c13d6a5",
48
- "babel-jest": "29.3.1",
49
- "commander": "9.5.0",
46
+ "@types/react-table": "7.7.20",
47
+ "aristid-ds": "14.0.0-ee1e09c",
48
+ "babel-jest": "29.7.0",
50
49
  "graphql": "16.12.0",
51
- "i18next": "22.5.0",
52
- "jest": "29.0.3",
53
- "jest-environment-jsdom": "29.3.1",
54
- "jest-styled-components": "7.1.1",
50
+ "i18next": "22.5.1",
51
+ "jest": "29.7.0",
52
+ "jest-environment-jsdom": "29.7.0",
53
+ "jest-styled-components": "7.2.0",
55
54
  "react": "18.2.0",
56
55
  "react-dom": "18.2.0",
57
56
  "react-i18next": "12",
58
57
  "react-router-dom": "6.22.0",
59
- "styled-components": "6.0.8",
60
- "ts-jest": "29.0.1",
61
- "tsc-alias": "1.8.8",
58
+ "ts-jest": "29.4.6",
59
+ "tsc-alias": "1.8.16",
62
60
  "typescript": "5.5.3",
63
- "vite": "7.2.2"
61
+ "vite": "7.3.1"
64
62
  },
65
63
  "peerDependencies": {
66
- "@ant-design/icons": ">=5.2",
67
64
  "@apollo/client": ">=3.8.1",
68
- "antd": "5.22.2",
69
- "aristid-ds": "14.0.0-c13d6a5",
70
- "dayjs": "^1.11.13",
71
- "i18next": "22.5",
72
- "react": "18.2.0",
73
- "react-dom": "18.2.0",
74
- "react-i18next": "12",
75
- "react-icons": ">=4",
76
- "react-router-dom": "6.22.0",
77
- "styled-components": ">=5.3"
65
+ "aristid-ds": "^14.0.0-ee1e09c",
66
+ "i18next": ">=22.5.1",
67
+ "react": "^18.2.0",
68
+ "react-dom": "^18.2.0",
69
+ "react-i18next": ">=12",
70
+ "react-router-dom": "^6.22.0"
78
71
  },
79
72
  "dependencies": {
80
- "@ckeditor/ckeditor5-build-inline": "39.0.1",
73
+ "@ant-design/icons": "5.2.6",
74
+ "@ckeditor/ckeditor5-build-inline": "39.0.2",
81
75
  "@ckeditor/ckeditor5-react": "6.1.0",
82
76
  "@dnd-kit/core": "6.1.0",
83
77
  "@dnd-kit/sortable": "8.0.0",
84
- "@leav/utils": "1.6.0",
78
+ "@dnd-kit/utilities": "3.2.2",
79
+ "@fortawesome/fontawesome-svg-core": "7.0.1",
80
+ "@fortawesome/free-regular-svg-icons": "7.0.1",
81
+ "@fortawesome/free-solid-svg-icons": "7.0.1",
82
+ "@fortawesome/react-fontawesome": "3.0.2",
83
+ "@leav/utils": "1.7.0",
85
84
  "@uidotdev/usehooks": "2.4.1",
85
+ "dayjs": "^1.11.13",
86
86
  "dompurify": "3.2.4",
87
- "html-react-parser": "4.2.2",
87
+ "html-react-parser": "4.2.10",
88
88
  "i18next-resources-to-backend": "1.1.4",
89
89
  "lodash.isequal": "4.5.0",
90
90
  "object-path": "0.11.8",
91
- "react-beautiful-dnd": "13.1.1",
92
- "react-icons": "4.7.1",
93
91
  "react-markdown": "5.0.3",
94
92
  "react-table": "7.8.0",
95
93
  "react-table-sticky": "1.1.3",
96
- "uuid": "9.0.1",
94
+ "styled-components": "6.0.8",
97
95
  "xlsx": "0.18.5",
98
- "zod": "3.25.67"
96
+ "zod": "3.25.76"
99
97
  }
100
98
  }
@@ -1,3 +0,0 @@
1
- export declare const ActionButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("aristid-ds/dist/Kit/General/Button/types").IKitButton & import("react").RefAttributes<HTMLElement>, {
2
- $hasNoValue: boolean;
3
- }>> & import("aristid-ds/dist/Kit/General/Button/types").KitButtonCompoundedComponent;
@@ -1 +0,0 @@
1
- {"version":3,"file":"ActionButton.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,CAAwB;kBACnD,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC,CAAC;CAC7F,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 {KitButton} from 'aristid-ds';\nimport styled from 'styled-components';\n\nexport const ActionButton = styled(KitButton)<{$hasNoValue: boolean}>`\n margin-top: ${props => (props.$hasNoValue ? 0 : 'calc((var(--general-spacing-xs)) * 1px)')};\n`;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useExplorerLinkRecords.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useExplorerLinkRecords.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,aAAa,EAA4D,MAAM,iBAAiB,CAAC;AAGzG,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,oBAAoB,EAAC,MA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E;QACD,IAAI,sBAAsB,EAAE,CAAC;YACzB,uBAAuB,CAAC,sBAAsB,CAAC,CAAC;QACpD,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACH,qBAAqB;QACrB,yBAAyB;QACzB,kCAAkC;QAClC,uBAAuB;QACvB,yBAAyB;KAC5B,CAAC;AACN,CAAC,CAAC","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 RecordFilterInput, type RecordFormAttributeLinkAttributeFragment} from '_ui/_gqlTypes';\nimport {APICallStatus, type DeleteMultipleValuesFunc, type ISubmitMultipleResult} from '../../../_types';\nimport {type Dispatch, type SetStateAction} from 'react';\nimport {type IItemData, type MassSelection} from '_ui/components/Explorer/_types';\nimport {AntForm} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type RecordFormElementsValueLinkValue} from '_ui/hooks/useGetRecordForm';\nimport {ErrorTypes} from '@leav/utils';\n\ninterface IUseExplorerLinkRecordsProps {\n attribute: RecordFormAttributeLinkAttributeFragment;\n backendValues: RecordFormElementsValueLinkValue[];\n setBackendValues: Dispatch<SetStateAction<RecordFormElementsValueLinkValue[]>>;\n onDeleteMultipleValues: DeleteMultipleValuesFunc;\n}\n\nexport const useExplorerLinkRecords = ({\n attribute,\n backendValues,\n setBackendValues,\n onDeleteMultipleValues,\n}: IUseExplorerLinkRecordsProps) => {\n const {t} = useSharedTranslation();\n\n const form = AntForm.useFormInstance();\n\n const removeValues = (filterFn?: (id: string) => boolean, useIdValue: boolean = false) => {\n if (!filterFn) {\n form.setFieldValue(attribute.id, []);\n form.setFields([\n {\n name: attribute.id,\n errors: attribute.required ? [t('errors.standard_field_required')] : [],\n },\n ]);\n setBackendValues([]);\n return;\n }\n\n const newBackendValues = backendValues.filter(backendValue =>\n filterFn(useIdValue ? backendValue.id_value : backendValue.linkValue.id),\n );\n\n form.setFieldValue(\n attribute.id,\n newBackendValues.map(({linkValue}) => linkValue.id),\n );\n\n form.setFields([\n {\n name: attribute.id,\n errors:\n attribute.required && newBackendValues.length === 0 ? [t('errors.standard_field_required')] : [],\n },\n ]);\n\n setBackendValues(previousBackendValues =>\n previousBackendValues.filter(backendValue =>\n filterFn(useIdValue ? backendValue.id_value : backendValue.linkValue.id),\n ),\n );\n };\n\n const handleDeleteAllValues = async () => {\n const deleteRes = await onDeleteMultipleValues(\n attribute.id,\n backendValues.filter(backendValue => backendValue.id_value),\n null,\n );\n\n if (deleteRes.status === APICallStatus.SUCCESS) {\n removeValues();\n }\n };\n\n const handleExplorerRemoveValue = (item: IItemData) => {\n removeValues(id => id !== item.itemId);\n };\n\n const handleExplorerMassDeactivateValues = (\n _massSelectedFilter: RecordFilterInput[],\n massSelection: MassSelection,\n ) => {\n removeValues(idValue => !massSelection.includes(idValue), true);\n };\n\n const handleExplorerLinkValue = (saveValuesResult: ISubmitMultipleResult) => {\n if (saveValuesResult.status === APICallStatus.SUCCESS) {\n const saveLinkValues = saveValuesResult.values as unknown as RecordFormElementsValueLinkValue[];\n\n form.setFieldValue(attribute.id, [\n ...backendValues.map(({linkValue}) => linkValue.id),\n ...saveLinkValues.map(({linkValue}) => linkValue.id),\n ]);\n\n form.setFields([\n {\n name: attribute.id,\n errors: [],\n },\n ]);\n\n setBackendValues(previousBackendValues => [...previousBackendValues, ...saveLinkValues]);\n }\n\n if (saveValuesResult.status === APICallStatus.ERROR && saveValuesResult.errors) {\n const attributeError = saveValuesResult.errors.filter(err => err.attribute === attribute.id)?.[0];\n\n if (attributeError) {\n const errorMessage =\n attributeError.type === ErrorTypes.VALIDATION_ERROR\n ? attributeError.message\n : t(`errors.${attributeError.type}`);\n\n form.setFields([\n {\n name: attribute.id,\n errors: [errorMessage],\n },\n ]);\n }\n }\n };\n\n const handleExplorerCreateValue = ({\n recordIdCreated,\n saveValuesResultOnLink,\n }: {\n recordIdCreated: string;\n saveValuesResultOnLink?: ISubmitMultipleResult;\n }) => {\n if (saveValuesResultOnLink) {\n handleExplorerLinkValue(saveValuesResultOnLink);\n }\n };\n\n return {\n handleDeleteAllValues,\n handleExplorerRemoveValue,\n handleExplorerMassDeactivateValues,\n handleExplorerLinkValue,\n handleExplorerCreateValue,\n };\n};\n"]}