@leav/ui 1.6.0-e2820b2f → 1.6.0-e751f378

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 (188) hide show
  1. package/dist/_gqlTypes/index.d.ts +889 -686
  2. package/dist/_gqlTypes/index.js +98 -43
  3. package/dist/_gqlTypes/index.js.map +1 -1
  4. package/dist/_queries/trees/treeNodeChildrenQuery.js +2 -0
  5. package/dist/_queries/trees/treeNodeChildrenQuery.js.map +1 -1
  6. package/dist/_queries/views/viewDetailsFragment.js +1 -0
  7. package/dist/_queries/views/viewDetailsFragment.js.map +1 -1
  8. package/dist/components/AttributesSelectionList/sharedComponents.d.ts +159 -153
  9. package/dist/components/Explorer/Explorer.js +5 -3
  10. package/dist/components/Explorer/Explorer.js.map +1 -1
  11. package/dist/components/Explorer/ExplorerFiltersAndSorts.js +1 -1
  12. package/dist/components/Explorer/ExplorerFiltersAndSorts.js.map +1 -1
  13. package/dist/components/Explorer/TableCell.js +6 -7
  14. package/dist/components/Explorer/TableCell.js.map +1 -1
  15. package/dist/components/Explorer/TableNameCell.js +3 -2
  16. package/dist/components/Explorer/TableNameCell.js.map +1 -1
  17. package/dist/components/Explorer/_queries/useExplorerData.d.ts +7 -7
  18. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js +3 -2
  19. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -1
  20. package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +2 -1
  21. package/dist/components/Explorer/actions-item/useReplaceItemAction.js +5 -4
  22. package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
  23. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.d.ts +10 -0
  24. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js +46 -0
  25. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js.map +1 -0
  26. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.d.ts +1 -0
  27. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js +17 -0
  28. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js.map +1 -0
  29. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.d.ts +8 -0
  30. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js +49 -0
  31. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js.map +1 -0
  32. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.d.ts +27 -0
  33. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js +48 -0
  34. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js.map +1 -0
  35. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +3 -2
  36. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
  37. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +3 -2
  38. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
  39. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +3 -2
  40. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
  41. package/dist/components/Explorer/actions-mass/useExportMassAction.d.ts +7 -4
  42. package/dist/components/Explorer/actions-mass/useExportMassAction.js +80 -73
  43. package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
  44. package/dist/components/Explorer/actions-mass/useMassActions.js +3 -2
  45. package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
  46. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +3 -2
  47. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
  48. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +2 -1
  49. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +5 -4
  50. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
  51. package/dist/components/Explorer/link-item/LinkModal.d.ts +1 -0
  52. package/dist/components/Explorer/link-item/LinkModal.js +2 -2
  53. package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
  54. package/dist/components/Explorer/list-saved-views/SavedViews.js +4 -3
  55. package/dist/components/Explorer/list-saved-views/SavedViews.js.map +1 -1
  56. package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js +5 -8
  57. package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js.map +1 -1
  58. package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js +3 -2
  59. package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js.map +1 -1
  60. package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +7 -6
  61. package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -1
  62. package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js +3 -2
  63. package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js.map +1 -1
  64. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +4 -3
  65. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
  66. package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js +3 -2
  67. package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js.map +1 -1
  68. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js +3 -2
  69. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js.map +1 -1
  70. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js +3 -2
  71. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js.map +1 -1
  72. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +3 -0
  73. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
  74. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js +3 -2
  75. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js.map +1 -1
  76. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js +4 -3
  77. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js.map +1 -1
  78. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js +3 -2
  79. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js.map +1 -1
  80. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js +3 -2
  81. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js.map +1 -1
  82. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js +3 -2
  83. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js.map +1 -1
  84. package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js +3 -2
  85. package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js.map +1 -1
  86. package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js +7 -6
  87. package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js.map +1 -1
  88. package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js +3 -2
  89. package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js.map +1 -1
  90. package/dist/components/Filters/FiltersProvider.d.ts +2 -2
  91. package/dist/components/Filters/FiltersProvider.js.map +1 -1
  92. package/dist/components/Filters/_types.d.ts +3 -0
  93. package/dist/components/Filters/_types.js.map +1 -1
  94. package/dist/components/Filters/context/filtersReducer.js +5 -1
  95. package/dist/components/Filters/context/filtersReducer.js.map +1 -1
  96. package/dist/components/Filters/filter-items/CommonFilterItem.d.ts +1 -0
  97. package/dist/components/Filters/filter-items/CommonFilterItem.js +28 -8
  98. package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
  99. package/dist/components/Filters/filter-items/EmptyValueCheckbox.d.ts +8 -0
  100. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js +16 -0
  101. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js.map +1 -0
  102. package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js +23 -9
  103. package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js.map +1 -1
  104. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js +9 -8
  105. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js.map +1 -1
  106. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js +4 -3
  107. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js.map +1 -1
  108. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js +1 -1
  109. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js.map +1 -1
  110. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.d.ts +0 -1
  111. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js +17 -23
  112. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js.map +1 -1
  113. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js +10 -12
  114. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -1
  115. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js +3 -13
  116. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
  117. package/dist/components/Filters/index.d.ts +1 -0
  118. package/dist/components/Filters/index.js +1 -0
  119. package/dist/components/Filters/index.js.map +1 -1
  120. package/dist/components/Filters/prepareFiltersForRequest.js +36 -3
  121. package/dist/components/Filters/prepareFiltersForRequest.js.map +1 -1
  122. package/dist/components/Filters/useFilters.d.ts +5 -0
  123. package/dist/components/Filters/useTransformFilters.js +4 -0
  124. package/dist/components/Filters/useTransformFilters.js.map +1 -1
  125. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js +1 -8
  126. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js.map +1 -1
  127. package/dist/components/LibraryItemsList/MenuView/MenuView.js +4 -4
  128. package/dist/components/LibraryItemsList/MenuView/MenuView.js.map +1 -1
  129. package/dist/components/LibraryItemsList/ViewPanel/View/View.js +3 -2
  130. package/dist/components/LibraryItemsList/ViewPanel/View/View.js.map +1 -1
  131. package/dist/components/Notifications/hooks/useNotificationSubscription.js +3 -2
  132. package/dist/components/Notifications/hooks/useNotificationSubscription.js.map +1 -1
  133. package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js +5 -20
  134. package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js.map +1 -1
  135. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js +4 -3
  136. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +1 -1
  137. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.d.ts +53 -51
  138. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +4 -3
  139. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
  140. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +9 -2
  141. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
  142. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.d.ts +53 -51
  143. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +3 -2
  144. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -1
  145. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +2 -1
  146. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +4 -7
  147. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
  148. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +3 -2
  149. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +2 -2
  150. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -1
  151. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js +3 -2
  152. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -1
  153. package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js +3 -2
  154. package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js.map +1 -1
  155. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +4 -3
  156. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
  157. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js +3 -2
  158. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js.map +1 -1
  159. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +1 -0
  160. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +7 -7
  161. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
  162. package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +2 -1
  163. package/dist/components/SelectTreeNode/SelectTreeNode.js +3 -3
  164. package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
  165. package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +2 -1
  166. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +6 -2
  167. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
  168. package/dist/components/SelectTreeNode/TreeNodeTitle.js +3 -2
  169. package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -1
  170. package/dist/constants.d.ts +1 -0
  171. package/dist/constants.js +1 -0
  172. package/dist/constants.js.map +1 -1
  173. package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +2 -1
  174. package/dist/hooks/useIFrameMessenger/messageHandlers.js +8 -0
  175. package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -1
  176. package/dist/hooks/useIFrameMessenger/schema.d.ts +3 -0
  177. package/dist/hooks/useIFrameMessenger/schema.js +1 -0
  178. package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
  179. package/dist/hooks/useIFrameMessenger/types.d.ts +12 -2
  180. package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
  181. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +1 -0
  182. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +15 -0
  183. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -1
  184. package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +1 -0
  185. package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +1 -0
  186. package/dist/locales/en/shared.json +15 -3
  187. package/dist/locales/fr/shared.json +15 -3
  188. package/package.json +12 -9
@@ -2,10 +2,11 @@ export declare const TreeFieldWrapper: import("styled-components").IStyledCompon
2
2
  ref?: import("react").LegacyRef<HTMLDivElement>;
3
3
  key?: import("react").Key | null | undefined;
4
4
  defaultChecked?: boolean | undefined;
5
- defaultValue?: string | number | ReadonlyArray<string> | undefined;
5
+ defaultValue?: string | number | readonly string[] | undefined;
6
6
  suppressContentEditableWarning?: boolean | undefined;
7
7
  suppressHydrationWarning?: boolean | undefined;
8
8
  accessKey?: string | undefined;
9
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
9
10
  autoFocus?: boolean | undefined;
10
11
  className?: string | undefined;
11
12
  contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
@@ -36,7 +37,6 @@ export declare const TreeFieldWrapper: import("styled-components").IStyledCompon
36
37
  rev?: string | undefined;
37
38
  typeof?: string | undefined;
38
39
  vocab?: string | undefined;
39
- autoCapitalize?: string | undefined;
40
40
  autoCorrect?: string | undefined;
41
41
  autoSave?: string | undefined;
42
42
  color?: string | undefined;
@@ -50,55 +50,57 @@ export declare const TreeFieldWrapper: import("styled-components").IStyledCompon
50
50
  unselectable?: "on" | "off" | undefined;
51
51
  inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
52
52
  is?: string | undefined;
53
+ exportparts?: string | undefined;
54
+ part?: string | undefined;
53
55
  children?: import("react").ReactNode;
54
- 'aria-activedescendant'?: string | undefined;
55
- 'aria-atomic'?: boolean | "false" | "true" | undefined;
56
- 'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
57
- 'aria-busy'?: boolean | "false" | "true" | undefined;
58
- 'aria-checked'?: boolean | "false" | "mixed" | "true" | undefined;
59
- 'aria-colcount'?: number | undefined;
60
- 'aria-colindex'?: number | undefined;
61
- 'aria-colspan'?: number | undefined;
62
- 'aria-controls'?: string | undefined;
63
- 'aria-current'?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
64
- 'aria-describedby'?: string | undefined;
65
- 'aria-details'?: string | undefined;
66
- 'aria-disabled'?: boolean | "false" | "true" | undefined;
67
- 'aria-dropeffect'?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
68
- 'aria-errormessage'?: string | undefined;
69
- 'aria-expanded'?: boolean | "false" | "true" | undefined;
70
- 'aria-flowto'?: string | undefined;
71
- 'aria-grabbed'?: boolean | "false" | "true" | undefined;
72
- 'aria-haspopup'?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
73
- 'aria-hidden'?: boolean | "false" | "true" | undefined;
74
- 'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
75
- 'aria-keyshortcuts'?: string | undefined;
76
- 'aria-label'?: string | undefined;
77
- 'aria-labelledby'?: string | undefined;
78
- 'aria-level'?: number | undefined;
79
- 'aria-live'?: "off" | "assertive" | "polite" | undefined;
80
- 'aria-modal'?: boolean | "false" | "true" | undefined;
81
- 'aria-multiline'?: boolean | "false" | "true" | undefined;
82
- 'aria-multiselectable'?: boolean | "false" | "true" | undefined;
83
- 'aria-orientation'?: "horizontal" | "vertical" | undefined;
84
- 'aria-owns'?: string | undefined;
85
- 'aria-placeholder'?: string | undefined;
86
- 'aria-posinset'?: number | undefined;
87
- 'aria-pressed'?: boolean | "false" | "mixed" | "true" | undefined;
88
- 'aria-readonly'?: boolean | "false" | "true" | undefined;
89
- 'aria-relevant'?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
90
- 'aria-required'?: boolean | "false" | "true" | undefined;
91
- 'aria-roledescription'?: string | undefined;
92
- 'aria-rowcount'?: number | undefined;
93
- 'aria-rowindex'?: number | undefined;
94
- 'aria-rowspan'?: number | undefined;
95
- 'aria-selected'?: boolean | "false" | "true" | undefined;
96
- 'aria-setsize'?: number | undefined;
97
- 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
98
- 'aria-valuemax'?: number | undefined;
99
- 'aria-valuemin'?: number | undefined;
100
- 'aria-valuenow'?: number | undefined;
101
- 'aria-valuetext'?: string | undefined;
56
+ "aria-activedescendant"?: string | undefined;
57
+ "aria-atomic"?: boolean | "false" | "true" | undefined;
58
+ "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
59
+ "aria-busy"?: boolean | "false" | "true" | undefined;
60
+ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
61
+ "aria-colcount"?: number | undefined;
62
+ "aria-colindex"?: number | undefined;
63
+ "aria-colspan"?: number | undefined;
64
+ "aria-controls"?: string | undefined;
65
+ "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
66
+ "aria-describedby"?: string | undefined;
67
+ "aria-details"?: string | undefined;
68
+ "aria-disabled"?: boolean | "false" | "true" | undefined;
69
+ "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
70
+ "aria-errormessage"?: string | undefined;
71
+ "aria-expanded"?: boolean | "false" | "true" | undefined;
72
+ "aria-flowto"?: string | undefined;
73
+ "aria-grabbed"?: boolean | "false" | "true" | undefined;
74
+ "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
75
+ "aria-hidden"?: boolean | "false" | "true" | undefined;
76
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
77
+ "aria-keyshortcuts"?: string | undefined;
78
+ "aria-label"?: string | undefined;
79
+ "aria-labelledby"?: string | undefined;
80
+ "aria-level"?: number | undefined;
81
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
82
+ "aria-modal"?: boolean | "false" | "true" | undefined;
83
+ "aria-multiline"?: boolean | "false" | "true" | undefined;
84
+ "aria-multiselectable"?: boolean | "false" | "true" | undefined;
85
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
86
+ "aria-owns"?: string | undefined;
87
+ "aria-placeholder"?: string | undefined;
88
+ "aria-posinset"?: number | undefined;
89
+ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
90
+ "aria-readonly"?: boolean | "false" | "true" | undefined;
91
+ "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
92
+ "aria-required"?: boolean | "false" | "true" | undefined;
93
+ "aria-roledescription"?: string | undefined;
94
+ "aria-rowcount"?: number | undefined;
95
+ "aria-rowindex"?: number | undefined;
96
+ "aria-rowspan"?: number | undefined;
97
+ "aria-selected"?: boolean | "false" | "true" | undefined;
98
+ "aria-setsize"?: number | undefined;
99
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
100
+ "aria-valuemax"?: number | undefined;
101
+ "aria-valuemin"?: number | undefined;
102
+ "aria-valuenow"?: number | undefined;
103
+ "aria-valuetext"?: string | undefined;
102
104
  dangerouslySetInnerHTML?: {
103
105
  __html: string | TrustedHTML;
104
106
  } | undefined;
@@ -120,7 +122,7 @@ export declare const TreeFieldWrapper: import("styled-components").IStyledCompon
120
122
  onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement>;
121
123
  onChange?: import("react").FormEventHandler<HTMLDivElement>;
122
124
  onChangeCapture?: import("react").FormEventHandler<HTMLDivElement>;
123
- onBeforeInput?: import("react").FormEventHandler<HTMLDivElement>;
125
+ onBeforeInput?: import("react").InputEventHandler<HTMLDivElement>;
124
126
  onBeforeInputCapture?: import("react").FormEventHandler<HTMLDivElement>;
125
127
  onInput?: import("react").FormEventHandler<HTMLDivElement>;
126
128
  onInputCapture?: import("react").FormEventHandler<HTMLDivElement>;
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
3
3
  import { KitAvatar, KitBreadcrumb, KitIdCard, KitItemList, KitSpace } from 'aristid-ds';
4
- import { FaTrash } from 'react-icons/fa';
4
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
+ import { faTrash } from '@fortawesome/free-solid-svg-icons';
5
6
  import styled from 'styled-components';
6
7
  const KitItemListStyled = styled(KitItemList) `
7
8
  border: none;
@@ -39,7 +40,7 @@ const TreeNodeItem = ({ color, label, ancestors, canDelete, onClickToDelete, isR
39
40
  ? [
40
41
  {
41
42
  key: 'delete',
42
- icon: _jsx(FaTrash, {}),
43
+ icon: _jsx(FontAwesomeIcon, { icon: faTrash }),
43
44
  label: t('global.delete'),
44
45
  title: t('global.delete'),
45
46
  onClick: onClickToDelete,
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeItem.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,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,CAAC,CAAC;gBACI;oBACI,GAAG,EAAE,QAAQ;oBACb,IAAI,EAAE,KAAC,OAAO,KAAG;oBACjB,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC;oBACzB,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC;oBACzB,OAAO,EAAE,eAAe;iBAC3B;aACJ;YACH,CAAC,CAAC,SAAS,GAErB,CACL,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,YAAY,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 RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitAvatar, KitBreadcrumb, KitIdCard, KitItemList, KitSpace} from 'aristid-ds';\nimport {FaTrash} from 'react-icons/fa';\nimport styled from 'styled-components';\n\nconst KitItemListStyled = styled(KitItemList)`\n border: none;\n padding: 0;\n\n &:hover:not(.kit-item-list-disabled) {\n box-shadow: none;\n }\n`;\n\nconst KitBreadcrumbStyled = styled(KitBreadcrumb)`\n &.ant-breadcrumb {\n li:last-child .ant-breadcrumb-link {\n color: var(--general-utilities-text-primary);\n }\n\n a {\n cursor: initial;\n pointer-events: none;\n\n &:hover {\n background-color: initial;\n cursor: initial;\n pointer-events: none;\n }\n }\n }\n`;\n\nconst BREADCRUMB_SEPARATOR = '>';\n\nconst NOT_FOCUSABLE = -1;\n\ninterface IUseTreeNodeItemProps {\n color?: RecordFormElementsValueTreeValue['treeValue']['record']['whoAmI']['color'];\n label?: RecordFormElementsValueTreeValue['treeValue']['record']['whoAmI']['label'];\n ancestors?: RecordFormElementsValueTreeValue['treeValue']['ancestors'];\n canDelete?: boolean;\n onClickToDelete?: (node: RecordFormElementsValueTreeValue) => void;\n isReadOnly?: boolean;\n}\n\nconst TreeNodeItem = ({color, label, ancestors, canDelete, onClickToDelete, isReadOnly}: IUseTreeNodeItemProps) => {\n const {t} = useSharedTranslation();\n\n return (\n <KitItemListStyled\n tabIndex={NOT_FOCUSABLE} // We don't want ItemList to be focusable\n disabled={isReadOnly}\n idCardSubstitute={\n <KitSpace direction=\"horizontal\">\n <KitAvatar color={color} label={label} shape=\"square\" />\n <KitSpace direction=\"vertical\" size=\"none\">\n <KitIdCard title={label} />\n <KitBreadcrumbStyled\n items={ancestors?.map(ancestor => ({\n title: ancestor.record.whoAmI.label,\n }))}\n separator={BREADCRUMB_SEPARATOR}\n />\n </KitSpace>\n </KitSpace>\n }\n actions={\n canDelete\n ? [\n {\n key: 'delete',\n icon: <FaTrash />,\n label: t('global.delete'),\n title: t('global.delete'),\n onClick: onClickToDelete,\n },\n ]\n : undefined\n }\n />\n );\n};\n\nexport default TreeNodeItem;\n"]}
1
+ {"version":3,"file":"TreeNodeItem.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AACtF,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAC,MAAM,mCAAmC,CAAC;AAC1D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;;;;;;;CAO5C,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;;;;;;;;;;;;;;;;CAiBhD,CAAC;AAEF,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC;AAWzB,MAAM,YAAY,GAAG,CAAC,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAwB,EAAE,EAAE;IAC9G,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,OAAO,CACH,KAAC,iBAAiB,IACd,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,UAAU,EACpB,gBAAgB,EACZ,MAAC,QAAQ,IAAC,SAAS,EAAC,YAAY,aAC5B,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,QAAQ,GAAG,EACxD,MAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,MAAM,aACtC,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,GAAI,EAC3B,KAAC,mBAAmB,IAChB,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gCAC/B,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK;6BACtC,CAAC,CAAC,EACH,SAAS,EAAE,oBAAoB,GACjC,IACK,IACJ,EAEf,OAAO,EACH,SAAS;YACL,CAAC,CAAC;gBACI;oBACI,GAAG,EAAE,QAAQ;oBACb,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI;oBACxC,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC;oBACzB,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC;oBACzB,OAAO,EAAE,eAAe;iBAC3B;aACJ;YACH,CAAC,CAAC,SAAS,GAErB,CACL,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,YAAY,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 RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitAvatar, KitBreadcrumb, KitIdCard, KitItemList, KitSpace} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faTrash} from '@fortawesome/free-solid-svg-icons';\nimport styled from 'styled-components';\n\nconst KitItemListStyled = styled(KitItemList)`\n border: none;\n padding: 0;\n\n &:hover:not(.kit-item-list-disabled) {\n box-shadow: none;\n }\n`;\n\nconst KitBreadcrumbStyled = styled(KitBreadcrumb)`\n &.ant-breadcrumb {\n li:last-child .ant-breadcrumb-link {\n color: var(--general-utilities-text-primary);\n }\n\n a {\n cursor: initial;\n pointer-events: none;\n\n &:hover {\n background-color: initial;\n cursor: initial;\n pointer-events: none;\n }\n }\n }\n`;\n\nconst BREADCRUMB_SEPARATOR = '>';\n\nconst NOT_FOCUSABLE = -1;\n\ninterface IUseTreeNodeItemProps {\n color?: RecordFormElementsValueTreeValue['treeValue']['record']['whoAmI']['color'];\n label?: RecordFormElementsValueTreeValue['treeValue']['record']['whoAmI']['label'];\n ancestors?: RecordFormElementsValueTreeValue['treeValue']['ancestors'];\n canDelete?: boolean;\n onClickToDelete?: (node: RecordFormElementsValueTreeValue) => void;\n isReadOnly?: boolean;\n}\n\nconst TreeNodeItem = ({color, label, ancestors, canDelete, onClickToDelete, isReadOnly}: IUseTreeNodeItemProps) => {\n const {t} = useSharedTranslation();\n\n return (\n <KitItemListStyled\n tabIndex={NOT_FOCUSABLE} // We don't want ItemList to be focusable\n disabled={isReadOnly}\n idCardSubstitute={\n <KitSpace direction=\"horizontal\">\n <KitAvatar color={color} label={label} shape=\"square\" />\n <KitSpace direction=\"vertical\" size=\"none\">\n <KitIdCard title={label} />\n <KitBreadcrumbStyled\n items={ancestors?.map(ancestor => ({\n title: ancestor.record.whoAmI.label,\n }))}\n separator={BREADCRUMB_SEPARATOR}\n />\n </KitSpace>\n </KitSpace>\n }\n actions={\n canDelete\n ? [\n {\n key: 'delete',\n icon: <FontAwesomeIcon icon={faTrash} />,\n label: t('global.delete'),\n title: t('global.delete'),\n onClick: onClickToDelete,\n },\n ]\n : undefined\n }\n />\n );\n};\n\nexport default TreeNodeItem;\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type FunctionComponent } from 'react';
2
- import { type ChildrenAsRecordValuePermissionFilterInput, type RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
2
+ import { type DependentValuesPermissionFilterInput, type ChildrenAsRecordValuePermissionFilterInput, type RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
3
3
  import { type RecordFormElementsValueTreeValue } from '../../../../../../hooks/useGetRecordForm';
4
4
  import { type ITreeNodeWithRecord } from '../../../../../../types';
5
5
  type SelectTreeNodeModalBackendValue = RecordFormElementsValueTreeValue | {
@@ -21,6 +21,7 @@ interface ISelectTreeNodeModalProps {
21
21
  onConfirm: (selectedNodes: ITreeNodeWithRecord[]) => void;
22
22
  onClose: () => void;
23
23
  childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;
24
+ dependentValuesPermissionFilter?: DependentValuesPermissionFilterInput;
24
25
  className?: string;
25
26
  }
26
27
  export declare const SelectTreeNodeModal: FunctionComponent<ISelectTreeNodeModalProps>;
@@ -3,15 +3,14 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
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 { useState } from 'react';
6
- import { FaCheck } from 'react-icons/fa';
7
- import { faXmark } from '@fortawesome/free-solid-svg-icons';
8
6
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
7
+ import { faCheck, faXmark } from '@fortawesome/free-solid-svg-icons';
9
8
  import { KitButton, KitModal } from 'aristid-ds';
10
9
  import { SelectTreeNode } from '../../../../../../components/SelectTreeNode';
11
10
  import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
12
11
  const SELECT_TREE_NODE_MODAL_HEIGHT = '563px';
13
12
  const SELECT_TREE_NODE_MODAL_WIDTH = '656px';
14
- export const SelectTreeNodeModal = ({ title, open, attribute, backendValues, onConfirm, onClose, childrenAsRecordValuePermissionFilter, className, }) => {
13
+ export const SelectTreeNodeModal = ({ title, open, attribute, backendValues, onConfirm, onClose, childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter, className, }) => {
15
14
  const { t } = useSharedTranslation();
16
15
  const [selectedNodes, setSelectedNodes] = useState([]);
17
16
  const _handleOnSelect = (node, selected) => {
@@ -31,12 +30,10 @@ export const SelectTreeNodeModal = ({ title, open, attribute, backendValues, onC
31
30
  onConfirm(selectedNodes);
32
31
  onClose();
33
32
  };
34
- return (_jsx(KitModal, { appElement: document.getElementById('root'), className: className, showCloseIcon: true, width: SELECT_TREE_NODE_MODAL_WIDTH, height: SELECT_TREE_NODE_MODAL_HEIGHT, title: title, isOpen: open, close: onClose, footer: _jsxs(_Fragment, { children: [_jsx(KitButton, { icon:
35
- // We can't used react-icons here because it's doesn't have the faXmark icon
36
- _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: onClose, children: t('global.close') }), attribute.multiple_values && (_jsx(KitButton, { type: "primary", icon: _jsx(FaCheck, {}), disabled: selectedNodes.length === 0, onClick: _handleOnConfirm, children: t('global.confirm') }))] }), children: _jsx(SelectTreeNode, { treeId: attribute.linked_tree.id, multiple // We want to be able to set as selected in the tree components, the nodes that are already selected and the disabled nodes
33
+ return (_jsx(KitModal, { appElement: document.getElementById('root'), className: className, showCloseIcon: true, width: SELECT_TREE_NODE_MODAL_WIDTH, height: SELECT_TREE_NODE_MODAL_HEIGHT, title: title, isOpen: open, close: onClose, footer: _jsxs(_Fragment, { children: [_jsx(KitButton, { icon: _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: onClose, children: t('global.close') }), attribute.multiple_values && (_jsx(KitButton, { type: "primary", icon: _jsx(FontAwesomeIcon, { icon: faCheck }), disabled: selectedNodes.length === 0, onClick: _handleOnConfirm, children: t('global.confirm') }))] }), children: _jsx(SelectTreeNode, { treeId: attribute.linked_tree.id, multiple // We want to be able to set as selected in the tree components, the nodes that are already selected and the disabled nodes
37
34
  : true, selectedNodes: [
38
35
  ...selectedNodes.map(node => node.id),
39
36
  ...backendValues.map(value => value.treeValue.id),
40
- ], childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter, disabledNodes: backendValues.map(value => value.treeValue.id).concat(attribute.linked_tree.id), onSelect: _handleOnSelect }) }));
37
+ ], childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter: dependentValuesPermissionFilter, disabledNodes: backendValues.map(value => value.treeValue.id).concat(attribute.linked_tree.id), onSelect: _handleOnSelect }) }));
41
38
  };
42
39
  //# sourceMappingURL=SelectTreeNodeModal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectTreeNodeModal.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA8C,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAK/C,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,MAAM,6BAA6B,GAAG,OAAO,CAAC;AAC9C,MAAM,4BAA4B,GAAG,OAAO,CAAC;AA8B7C,MAAM,CAAC,MAAM,mBAAmB,GAAiD,CAAC,EAC9E,KAAK,EACL,IAAI,EACJ,SAAS,EACT,aAAa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,IAAC,IAAI,EAAE,OAAO,GAAI,EAEtC,OAAO,EAAE,OAAO,YAEf,CAAC,CAAC,cAAc,CAAC,GACV,EACX,SAAS,CAAC,eAAe,IAAI,CAC1B,KAAC,SAAS,IACN,IAAI,EAAC,SAAS,EACd,IAAI,EAAE,KAAC,OAAO,KAAG,EACjB,QAAQ,EAAE,aAAa,CAAC,MAAM,KAAK,CAAC,EACpC,OAAO,EAAE,gBAAgB,YAExB,CAAC,CAAC,gBAAgB,CAAC,GACZ,CACf,IACF,YAGP,KAAC,cAAc,IACX,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE,EAChC,QAAQ,CAAC,2HAA2H;oBACpI,aAAa,EAAE;gBACX,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrC,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;aACpD,EACD,qCAAqC,EAAE,qCAAqC,EAC5E,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,EAC9F,QAAQ,EAAE,eAAe,GAC3B,GACK,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 ComponentProps, type FunctionComponent, useState} from 'react';\nimport {FaCheck} from 'react-icons/fa';\nimport {faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {KitButton, KitModal} from 'aristid-ds';\nimport {\n type ChildrenAsRecordValuePermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n} from '_ui/_gqlTypes';\nimport {SelectTreeNode} from '_ui/components/SelectTreeNode';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ITreeNodeWithRecord} from '_ui/types';\n\nconst SELECT_TREE_NODE_MODAL_HEIGHT = '563px';\nconst SELECT_TREE_NODE_MODAL_WIDTH = '656px';\n\ntype SelectTreeNodeModalBackendValue =\n | RecordFormElementsValueTreeValue\n | {\n treeValue: {\n id: string;\n };\n };\n\ntype SelectTreeNodeModalAttribute =\n | RecordFormAttributeTreeAttributeFragment\n | {\n multiple_values: boolean;\n linked_tree: {\n id: string;\n };\n };\n\ninterface ISelectTreeNodeModalProps {\n title: string;\n open: boolean;\n attribute: SelectTreeNodeModalAttribute;\n backendValues: SelectTreeNodeModalBackendValue[];\n onConfirm: (selectedNodes: ITreeNodeWithRecord[]) => void;\n onClose: () => void;\n childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;\n className?: string;\n}\n\nexport const SelectTreeNodeModal: FunctionComponent<ISelectTreeNodeModalProps> = ({\n title,\n open,\n attribute,\n backendValues,\n onConfirm,\n onClose,\n childrenAsRecordValuePermissionFilter,\n className,\n}) => {\n const {t} = useSharedTranslation();\n\n const [selectedNodes, setSelectedNodes] = useState<ITreeNodeWithRecord[]>([]);\n\n const _handleOnSelect: ComponentProps<typeof SelectTreeNode>['onSelect'] = (node, selected) => {\n if (!attribute.multiple_values) {\n onConfirm(selected ? [node] : []);\n onClose();\n return;\n }\n\n if (selected) {\n setSelectedNodes(prev => [...prev, node]);\n } else {\n setSelectedNodes(prev => prev.filter(selectedValue => selectedValue.id !== node.id));\n }\n };\n\n const _handleOnConfirm: ComponentProps<typeof KitButton>['onClick'] = () => {\n onConfirm(selectedNodes);\n onClose();\n };\n\n return (\n <KitModal\n appElement={document.getElementById('root')}\n className={className}\n showCloseIcon\n width={SELECT_TREE_NODE_MODAL_WIDTH}\n height={SELECT_TREE_NODE_MODAL_HEIGHT}\n title={title}\n isOpen={open}\n close={onClose}\n footer={\n <>\n <KitButton\n icon={\n // We can't used react-icons here because it's doesn't have the faXmark icon\n <FontAwesomeIcon icon={faXmark} />\n }\n onClick={onClose}\n >\n {t('global.close')}\n </KitButton>\n {attribute.multiple_values && (\n <KitButton\n type=\"primary\"\n icon={<FaCheck />}\n disabled={selectedNodes.length === 0}\n onClick={_handleOnConfirm}\n >\n {t('global.confirm')}\n </KitButton>\n )}\n </>\n }\n >\n <SelectTreeNode\n treeId={attribute.linked_tree.id}\n multiple // We want to be able to set as selected in the tree components, the nodes that are already selected and the disabled nodes\n selectedNodes={[\n ...selectedNodes.map(node => node.id),\n ...backendValues.map(value => value.treeValue.id),\n ]}\n childrenAsRecordValuePermissionFilter={childrenAsRecordValuePermissionFilter}\n disabledNodes={backendValues.map(value => value.treeValue.id).concat(attribute.linked_tree.id)}\n onSelect={_handleOnSelect}\n />\n </KitModal>\n );\n};\n"]}
1
+ {"version":3,"file":"SelectTreeNodeModal.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA8C,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAM/C,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,MAAM,6BAA6B,GAAG,OAAO,CAAC;AAC9C,MAAM,4BAA4B,GAAG,OAAO,CAAC;AA+B7C,MAAM,CAAC,MAAM,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AAO,EACd,MAAM,EACF,8BACI,KAAC,SAAS,IAAC,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI,EAAE,OAAO,EAAE,OAAO,YAChE,CAAC,CAAC,cAAc,CAAC,GACV,EACX,SAAS,CAAC,eAAe,IAAI,CAC1B,KAAC,SAAS,IACN,IAAI,EAAC,SAAS,EACd,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI,EACxC,QAAQ,EAAE,aAAa,CAAC,MAAM,KAAK,CAAC,EACpC,OAAO,EAAE,gBAAgB,YAExB,CAAC,CAAC,gBAAgB,CAAC,GACZ,CACf,IACF,YAGP,KAAC,cAAc,IACX,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE,EAChC,QAAQ,CAAC,2HAA2H;oBACpI,aAAa,EAAE;gBACX,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrC,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;aACpD,EACD,qCAAqC,EAAE,qCAAqC,EAC5E,+BAA+B,EAAE,+BAA+B,EAChE,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,EAC9F,QAAQ,EAAE,eAAe,GAC3B,GACK,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 ComponentProps, type FunctionComponent, useState} from 'react';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faCheck, faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {KitButton, KitModal} from 'aristid-ds';\nimport {\n type DependentValuesPermissionFilterInput,\n type ChildrenAsRecordValuePermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n} from '_ui/_gqlTypes';\nimport {SelectTreeNode} from '_ui/components/SelectTreeNode';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ITreeNodeWithRecord} from '_ui/types';\n\nconst SELECT_TREE_NODE_MODAL_HEIGHT = '563px';\nconst SELECT_TREE_NODE_MODAL_WIDTH = '656px';\n\ntype SelectTreeNodeModalBackendValue =\n | RecordFormElementsValueTreeValue\n | {\n treeValue: {\n id: string;\n };\n };\n\ntype SelectTreeNodeModalAttribute =\n | RecordFormAttributeTreeAttributeFragment\n | {\n multiple_values: boolean;\n linked_tree: {\n id: string;\n };\n };\n\ninterface ISelectTreeNodeModalProps {\n title: string;\n open: boolean;\n attribute: SelectTreeNodeModalAttribute;\n backendValues: SelectTreeNodeModalBackendValue[];\n onConfirm: (selectedNodes: ITreeNodeWithRecord[]) => void;\n onClose: () => void;\n childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;\n dependentValuesPermissionFilter?: DependentValuesPermissionFilterInput;\n className?: string;\n}\n\nexport const SelectTreeNodeModal: FunctionComponent<ISelectTreeNodeModalProps> = ({\n title,\n open,\n attribute,\n backendValues,\n onConfirm,\n onClose,\n childrenAsRecordValuePermissionFilter,\n dependentValuesPermissionFilter,\n className,\n}) => {\n const {t} = useSharedTranslation();\n\n const [selectedNodes, setSelectedNodes] = useState<ITreeNodeWithRecord[]>([]);\n\n const _handleOnSelect: ComponentProps<typeof SelectTreeNode>['onSelect'] = (node, selected) => {\n if (!attribute.multiple_values) {\n onConfirm(selected ? [node] : []);\n onClose();\n return;\n }\n\n if (selected) {\n setSelectedNodes(prev => [...prev, node]);\n } else {\n setSelectedNodes(prev => prev.filter(selectedValue => selectedValue.id !== node.id));\n }\n };\n\n const _handleOnConfirm: ComponentProps<typeof KitButton>['onClick'] = () => {\n onConfirm(selectedNodes);\n onClose();\n };\n\n return (\n <KitModal\n appElement={document.getElementById('root')}\n className={className}\n showCloseIcon\n width={SELECT_TREE_NODE_MODAL_WIDTH}\n height={SELECT_TREE_NODE_MODAL_HEIGHT}\n title={title}\n isOpen={open}\n close={onClose}\n footer={\n <>\n <KitButton icon={<FontAwesomeIcon icon={faXmark} />} onClick={onClose}>\n {t('global.close')}\n </KitButton>\n {attribute.multiple_values && (\n <KitButton\n type=\"primary\"\n icon={<FontAwesomeIcon icon={faCheck} />}\n disabled={selectedNodes.length === 0}\n onClick={_handleOnConfirm}\n >\n {t('global.confirm')}\n </KitButton>\n )}\n </>\n }\n >\n <SelectTreeNode\n treeId={attribute.linked_tree.id}\n multiple // We want to be able to set as selected in the tree components, the nodes that are already selected and the disabled nodes\n selectedNodes={[\n ...selectedNodes.map(node => node.id),\n ...backendValues.map(value => value.treeValue.id),\n ]}\n childrenAsRecordValuePermissionFilter={childrenAsRecordValuePermissionFilter}\n dependentValuesPermissionFilter={dependentValuesPermissionFilter}\n disabledNodes={backendValues.map(value => value.treeValue.id).concat(attribute.linked_tree.id)}\n onSelect={_handleOnSelect}\n />\n </KitModal>\n );\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type Dispatch, type SetStateAction } from 'react';
2
- import { type ChildrenAsRecordValuePermissionFilterInput, type RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
2
+ import { type DependentValuesPermissionFilterInput, type ChildrenAsRecordValuePermissionFilterInput, type RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
3
3
  import { type RecordFormElementsValueTreeValue } from '../../../../../../hooks/useGetRecordForm';
4
4
  import { type DeleteMultipleValuesFunc, type DeleteValueFunc, type SubmitValueFunc } from '../../../_types';
5
5
  interface IUseManageTreeNodeSelectionProps {
@@ -14,8 +14,9 @@ interface IUseManageTreeNodeSelectionProps {
14
14
  isReadOnly: boolean;
15
15
  isFieldInError: boolean;
16
16
  childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;
17
+ dependentValuesPermissionFilter?: DependentValuesPermissionFilterInput;
17
18
  }
18
- export declare const useManageTreeNodeSelection: ({ modaleTitle, attribute, isFormCreationMode, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter, }: IUseManageTreeNodeSelectionProps) => {
19
+ export declare const useManageTreeNodeSelection: ({ modaleTitle, attribute, isFormCreationMode, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter, }: IUseManageTreeNodeSelectionProps) => {
19
20
  openModal: () => void;
20
21
  removeTreeNode: (nodeValue: RecordFormElementsValueTreeValue, skipAfterRemove?: boolean) => Promise<void>;
21
22
  actionButtonLabel: string;
@@ -9,7 +9,7 @@ import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslati
9
9
  import { APICallStatus, } from '../../../_types';
10
10
  import { DeleteAllValuesButton } from '../../shared/DeleteAllValuesButton';
11
11
  import { SelectTreeNodeModal } from './SelectTreeNodeModal';
12
- export const useManageTreeNodeSelection = ({ modaleTitle, attribute, isFormCreationMode, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter, }) => {
12
+ export const useManageTreeNodeSelection = ({ modaleTitle, attribute, isFormCreationMode, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter, }) => {
13
13
  const { t } = useSharedTranslation();
14
14
  const form = AntForm.useFormInstance();
15
15
  const [isModalHidden, setIsModalHidden] = useState(true);
@@ -126,7 +126,7 @@ export const useManageTreeNodeSelection = ({ modaleTitle, attribute, isFormCreat
126
126
  }
127
127
  },
128
128
  actionButtonLabel: label,
129
- SelectTreeNodeModal: isModalHidden ? null : (_jsx(SelectTreeNodeModal, { open: true, title: label, attribute: attribute, backendValues: backendValues, onConfirm: _addTreeNodes, onClose: _closeModal, childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter })),
129
+ SelectTreeNodeModal: isModalHidden ? null : (_jsx(SelectTreeNodeModal, { open: true, title: label, attribute: attribute, backendValues: backendValues, onConfirm: _addTreeNodes, onClose: _closeModal, childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter: dependentValuesPermissionFilter })),
130
130
  RemoveAllTreeNodes: !isReadOnly && backendValues.length > 1 && attribute.multiple_values && !attribute.required ? (_jsx(DeleteAllValuesButton, { handleDelete: _removeAllTreeNodes, disabled: isReadOnly, danger: isFieldInError })) : null,
131
131
  };
132
132
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useManageTreeNodeSelection.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA0D,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACnG,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAMnC,OAAO,EAAC,yBAAyB,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EACH,aAAa,GAIhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAgB1D,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACvC,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,aAAa,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;wBACI,IAAI,EAAE,SAAS,CAAC,EAAE;wBAClB,MAAM,EACF,SAAS,CAAC,QAAQ,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;4BAC/C,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC;4BACvC,CAAC,CAAC,EAAE;qBACf;iBACJ,CAAC,CAAC;gBAEH,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;YACvC,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,KAAK,aAAa,CAAC,KAAK,EAAE,CAAC;gBACxC,IAAI,CAAC,SAAS,CAAC;oBACX;wBACI,IAAI,EAAE,SAAS,CAAC,EAAE;wBAClB,MAAM,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC;qBACtC;iBACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QACD,iBAAiB,EAAE,KAAK;QACxB,mBAAmB,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACxC,KAAC,mBAAmB,IAChB,IAAI,QACJ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,WAAW,EACpB,qCAAqC,EAAE,qCAAqC,GAC9E,CACL;QACD,kBAAkB,EACd,CAAC,UAAU,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC1F,KAAC,qBAAqB,IAClB,YAAY,EAAE,mBAAmB,EACjC,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,cAAc,GACxB,CACL,CAAC,CAAC,CAAC,IAAI;KACf,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 ComponentProps, type Dispatch, type SetStateAction, useEffect, useState} from 'react';\nimport {AntForm} from 'aristid-ds';\nimport {\n type ChildrenAsRecordValuePermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n} from '_ui/_gqlTypes';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {arrayValueVersionToObject} from '_ui/_utils';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {\n APICallStatus,\n type DeleteMultipleValuesFunc,\n type DeleteValueFunc,\n type SubmitValueFunc,\n} from '../../../_types';\nimport {DeleteAllValuesButton} from '../../shared/DeleteAllValuesButton';\nimport {SelectTreeNodeModal} from './SelectTreeNodeModal';\n\ninterface IUseManageTreeNodeSelectionProps {\n modaleTitle: string;\n attribute: RecordFormAttributeTreeAttributeFragment;\n isFormCreationMode: boolean;\n backendValues: RecordFormElementsValueTreeValue[];\n setBackendValues: Dispatch<SetStateAction<RecordFormElementsValueTreeValue[]>>;\n onValueSubmit: SubmitValueFunc;\n onValueDelete: DeleteValueFunc;\n onDeleteMultipleValues: DeleteMultipleValuesFunc;\n isReadOnly: boolean;\n isFieldInError: boolean;\n childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;\n}\n\nexport const useManageTreeNodeSelection = ({\n modaleTitle,\n attribute,\n isFormCreationMode,\n backendValues,\n setBackendValues,\n onValueSubmit,\n onValueDelete,\n onDeleteMultipleValues,\n isReadOnly,\n isFieldInError,\n childrenAsRecordValuePermissionFilter,\n}: IUseManageTreeNodeSelectionProps) => {\n const {t} = useSharedTranslation();\n const form = AntForm.useFormInstance();\n\n const [isModalHidden, setIsModalHidden] = useState(true);\n\n // Used to force the input error display when a value is set\n AntForm.useWatch(attribute.id, form);\n\n useEffect(() => {\n if (!isFormCreationMode && backendValues.length === 0 && attribute.required) {\n form.setFields([{name: attribute.id, errors: [t('errors.standard_field_required')]}]);\n }\n }, []);\n\n const _closeModal: ComponentProps<typeof SelectTreeNodeModal>['onClose'] = () => {\n setIsModalHidden(true);\n };\n\n const _addTreeNodes: ComponentProps<typeof SelectTreeNodeModal>['onConfirm'] = async selectedNodes => {\n const valuesToSave = selectedNodes.map(node => ({\n attribute,\n idValue: !attribute.multiple_values && backendValues.length > 0 ? backendValues[0].id_value : null,\n value: node,\n }));\n\n // When we will handle computed values, we will need to passe the active version (if still needed)\n const result = await onValueSubmit(valuesToSave, null);\n\n if (result.status === APICallStatus.SUCCESS) {\n const formattedValues: RecordFormElementsValueTreeValue[] = result.values.map(value => ({\n ...value,\n version: arrayValueVersionToObject(value.version),\n metadata: value.metadata?.map(metadata => ({\n ...metadata,\n value: {\n ...metadata.value,\n version: arrayValueVersionToObject(metadata.value.version ?? []),\n },\n })),\n }));\n\n const updatedValues = attribute.multiple_values\n ? [...backendValues, ...formattedValues]\n : [...formattedValues];\n\n form.setFieldValue(attribute.id, [...updatedValues.map(({treeValue}) => treeValue.id)]);\n\n form.setFields([\n {\n name: attribute.id,\n errors: [],\n touched: true, // necessary for isFieldsTouched to work properly (only for tree fields)\n },\n ]);\n\n setBackendValues(updatedValues);\n }\n\n if (result.status === APICallStatus.ERROR) {\n const selectedNodesById = selectedNodes.reduce((acc, cur) => ({...acc, [cur.id]: cur}), {});\n\n const errorsMessage = result.errors?.map(err => {\n const linkedRecordLabel = selectedNodesById[err.input].title || selectedNodesById[err.input].id;\n\n return `${linkedRecordLabel}: ${err.message}`;\n });\n\n form.setFields([\n {\n name: attribute.id,\n errors: errorsMessage ?? [t('error.error_occurred')],\n },\n ]);\n }\n };\n\n const _removeAllTreeNodes: ComponentProps<typeof DeleteAllValuesButton>['handleDelete'] = async () => {\n // When we will handle computed values, we will need to passe the active version (if still needed)\n const result = await onDeleteMultipleValues(attribute.id, backendValues, null);\n\n if (result.status === APICallStatus.SUCCESS) {\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 }\n\n if (result.status === APICallStatus.ERROR) {\n const errorsMessage = result.errors?.map(err => err.message);\n\n form.setFields([\n {\n name: attribute.id,\n errors: errorsMessage ?? [t('error.error_occurred')],\n },\n ]);\n }\n };\n\n const label = `${t(!attribute.multiple_values && backendValues.length > 0 ? 'global.replace' : 'global.add')} ${modaleTitle}`;\n\n return {\n openModal: () => {\n setIsModalHidden(false);\n },\n removeTreeNode: async (nodeValue: RecordFormElementsValueTreeValue, skipAfterRemove: boolean = false) => {\n const result = await onValueDelete({id_value: nodeValue.id_value}, attribute.id);\n\n if (skipAfterRemove) {\n return;\n }\n\n if (result.status === APICallStatus.SUCCESS) {\n const newBackendValues = backendValues.filter(value => value.id_value !== nodeValue.id_value);\n\n form.setFieldValue(\n attribute.id,\n newBackendValues.map(({treeValue}) => treeValue.id),\n );\n\n form.setFields([\n {\n name: attribute.id,\n errors:\n attribute.required && newBackendValues.length === 0\n ? [t('errors.standard_field_required')]\n : [],\n },\n ]);\n\n setBackendValues(newBackendValues);\n }\n\n if (result.status === APICallStatus.ERROR) {\n form.setFields([\n {\n name: attribute.id,\n errors: [t('error.error_occurred')],\n },\n ]);\n }\n },\n actionButtonLabel: label,\n SelectTreeNodeModal: isModalHidden ? null : (\n <SelectTreeNodeModal\n open\n title={label}\n attribute={attribute}\n backendValues={backendValues}\n onConfirm={_addTreeNodes}\n onClose={_closeModal}\n childrenAsRecordValuePermissionFilter={childrenAsRecordValuePermissionFilter}\n />\n ),\n RemoveAllTreeNodes:\n !isReadOnly && backendValues.length > 1 && attribute.multiple_values && !attribute.required ? (\n <DeleteAllValuesButton\n handleDelete={_removeAllTreeNodes}\n disabled={isReadOnly}\n danger={isFieldInError}\n />\n ) : null,\n };\n};\n"]}
1
+ {"version":3,"file":"useManageTreeNodeSelection.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,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AAa,EAAE,aAAa,EAC5B,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,WAAW,EACpB,qCAAqC,EAAE,qCAAqC,EAC5E,+BAA+B,EAAE,+BAA+B,GAClE,CACL;QACD,kBAAkB,EACd,CAAC,UAAU,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC1F,KAAC,qBAAqB,IAClB,YAAY,EAAE,mBAAmB,EACjC,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,cAAc,GACxB,CACL,CAAC,CAAC,CAAC,IAAI;KACf,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 ComponentProps, type Dispatch, type SetStateAction, useEffect, useState} from 'react';\nimport {AntForm} from 'aristid-ds';\nimport {\n type DependentValuesPermissionFilterInput,\n type ChildrenAsRecordValuePermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n} from '_ui/_gqlTypes';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {arrayValueVersionToObject} from '_ui/_utils';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {\n APICallStatus,\n type DeleteMultipleValuesFunc,\n type DeleteValueFunc,\n type SubmitValueFunc,\n} from '../../../_types';\nimport {DeleteAllValuesButton} from '../../shared/DeleteAllValuesButton';\nimport {SelectTreeNodeModal} from './SelectTreeNodeModal';\n\ninterface IUseManageTreeNodeSelectionProps {\n modaleTitle: string;\n attribute: RecordFormAttributeTreeAttributeFragment;\n isFormCreationMode: boolean;\n backendValues: RecordFormElementsValueTreeValue[];\n setBackendValues: Dispatch<SetStateAction<RecordFormElementsValueTreeValue[]>>;\n onValueSubmit: SubmitValueFunc;\n onValueDelete: DeleteValueFunc;\n onDeleteMultipleValues: DeleteMultipleValuesFunc;\n isReadOnly: boolean;\n isFieldInError: boolean;\n childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;\n dependentValuesPermissionFilter?: DependentValuesPermissionFilterInput;\n}\n\nexport const useManageTreeNodeSelection = ({\n modaleTitle,\n attribute,\n isFormCreationMode,\n backendValues,\n setBackendValues,\n onValueSubmit,\n onValueDelete,\n onDeleteMultipleValues,\n isReadOnly,\n isFieldInError,\n childrenAsRecordValuePermissionFilter,\n dependentValuesPermissionFilter,\n}: IUseManageTreeNodeSelectionProps) => {\n const {t} = useSharedTranslation();\n const form = AntForm.useFormInstance();\n\n const [isModalHidden, setIsModalHidden] = useState(true);\n\n // Used to force the input error display when a value is set\n AntForm.useWatch(attribute.id, form);\n\n useEffect(() => {\n if (!isFormCreationMode && backendValues.length === 0 && attribute.required) {\n form.setFields([{name: attribute.id, errors: [t('errors.standard_field_required')]}]);\n }\n }, []);\n\n const _closeModal: ComponentProps<typeof SelectTreeNodeModal>['onClose'] = () => {\n setIsModalHidden(true);\n };\n\n const _addTreeNodes: ComponentProps<typeof SelectTreeNodeModal>['onConfirm'] = async selectedNodes => {\n const valuesToSave = selectedNodes.map(node => ({\n attribute,\n idValue: !attribute.multiple_values && backendValues.length > 0 ? backendValues[0].id_value : null,\n value: node,\n }));\n\n // When we will handle computed values, we will need to passe the active version (if still needed)\n const result = await onValueSubmit(valuesToSave, null);\n\n if (result.status === APICallStatus.SUCCESS) {\n const formattedValues: RecordFormElementsValueTreeValue[] = result.values.map(value => ({\n ...value,\n version: arrayValueVersionToObject(value.version),\n metadata: value.metadata?.map(metadata => ({\n ...metadata,\n value: {\n ...metadata.value,\n version: arrayValueVersionToObject(metadata.value.version ?? []),\n },\n })),\n }));\n\n const updatedValues = attribute.multiple_values\n ? [...backendValues, ...formattedValues]\n : [...formattedValues];\n\n form.setFieldValue(attribute.id, [...updatedValues.map(({treeValue}) => treeValue.id)]);\n\n form.setFields([\n {\n name: attribute.id,\n errors: [],\n touched: true, // necessary for isFieldsTouched to work properly (only for tree fields)\n },\n ]);\n\n setBackendValues(updatedValues);\n }\n\n if (result.status === APICallStatus.ERROR) {\n const selectedNodesById = selectedNodes.reduce((acc, cur) => ({...acc, [cur.id]: cur}), {});\n\n const errorsMessage = result.errors?.map(err => {\n const linkedRecordLabel = selectedNodesById[err.input].title || selectedNodesById[err.input].id;\n\n return `${linkedRecordLabel}: ${err.message}`;\n });\n\n form.setFields([\n {\n name: attribute.id,\n errors: errorsMessage ?? [t('error.error_occurred')],\n },\n ]);\n }\n };\n\n const _removeAllTreeNodes: ComponentProps<typeof DeleteAllValuesButton>['handleDelete'] = async () => {\n // When we will handle computed values, we will need to passe the active version (if still needed)\n const result = await onDeleteMultipleValues(attribute.id, backendValues, null);\n\n if (result.status === APICallStatus.SUCCESS) {\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 }\n\n if (result.status === APICallStatus.ERROR) {\n const errorsMessage = result.errors?.map(err => err.message);\n\n form.setFields([\n {\n name: attribute.id,\n errors: errorsMessage ?? [t('error.error_occurred')],\n },\n ]);\n }\n };\n\n const label = `${t(!attribute.multiple_values && backendValues.length > 0 ? 'global.replace' : 'global.add')} ${modaleTitle}`;\n\n return {\n openModal: () => {\n setIsModalHidden(false);\n },\n removeTreeNode: async (nodeValue: RecordFormElementsValueTreeValue, skipAfterRemove: boolean = false) => {\n const result = await onValueDelete({id_value: nodeValue.id_value}, attribute.id);\n\n if (skipAfterRemove) {\n return;\n }\n\n if (result.status === APICallStatus.SUCCESS) {\n const newBackendValues = backendValues.filter(value => value.id_value !== nodeValue.id_value);\n\n form.setFieldValue(\n attribute.id,\n newBackendValues.map(({treeValue}) => treeValue.id),\n );\n\n form.setFields([\n {\n name: attribute.id,\n errors:\n attribute.required && newBackendValues.length === 0\n ? [t('errors.standard_field_required')]\n : [],\n },\n ]);\n\n setBackendValues(newBackendValues);\n }\n\n if (result.status === APICallStatus.ERROR) {\n form.setFields([\n {\n name: attribute.id,\n errors: [t('error.error_occurred')],\n },\n ]);\n }\n },\n actionButtonLabel: label,\n SelectTreeNodeModal: isModalHidden ? null : (\n <SelectTreeNodeModal\n open\n title={label}\n attribute={attribute}\n backendValues={backendValues}\n onConfirm={_addTreeNodes}\n onClose={_closeModal}\n childrenAsRecordValuePermissionFilter={childrenAsRecordValuePermissionFilter}\n dependentValuesPermissionFilter={dependentValuesPermissionFilter}\n />\n ),\n RemoveAllTreeNodes:\n !isReadOnly && backendValues.length > 1 && attribute.multiple_values && !attribute.required ? (\n <DeleteAllValuesButton\n handleDelete={_removeAllTreeNodes}\n disabled={isReadOnly}\n danger={isFieldInError}\n />\n ) : null,\n };\n};\n"]}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { KitTooltip } from 'aristid-ds';
3
- import { FaLayerGroup, FaSquareRootAlt } from 'react-icons/fa';
3
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
+ import { faLayerGroup, faSquareRootAlt } from '@fortawesome/free-solid-svg-icons';
4
5
  import styled from 'styled-components';
5
6
  import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
6
7
  import { TOOLTIP_DEFAULT_DELAY_IN_SECONDS } from '../../../../../constants';
@@ -11,6 +12,6 @@ export const ComputeIndicator = ({ calculatedFlags, inheritedFlags }) => {
11
12
  const { t } = useSharedTranslation();
12
13
  const shouldDisplayComputedIcon = calculatedFlags.isCalculatedNotOverrideValues || inheritedFlags.isInheritedNotOverrideValues;
13
14
  const shouldDisplayOverridedIcon = calculatedFlags.isCalculatedOverrideValues || inheritedFlags.isInheritedOverrideValues;
14
- return (_jsxs(ComputeIndicatorWrapper, { children: [shouldDisplayComputedIcon && (_jsx(KitTooltip, { title: t('record_edition.calculated_value'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(FaSquareRootAlt, {}) })), shouldDisplayOverridedIcon && (_jsx(KitTooltip, { title: t('record_edition.overrided_value'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(FaLayerGroup, {}) }))] }));
15
+ return (_jsxs(ComputeIndicatorWrapper, { children: [shouldDisplayComputedIcon && (_jsx(KitTooltip, { title: t('record_edition.calculated_value'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(FontAwesomeIcon, { icon: faSquareRootAlt }) })), shouldDisplayOverridedIcon && (_jsx(KitTooltip, { title: t('record_edition.overrided_value'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(FontAwesomeIcon, { icon: faLayerGroup }) }))] }));
15
16
  };
16
17
  //# sourceMappingURL=ComputeIndicator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComputeIndicator.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,gCAAgC,EAAC,MAAM,eAAe,CAAC;AAE/D,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEzC,CAAC;AAOF,MAAM,CAAC,MAAM,gBAAgB,GAA8C,CAAC,EAAC,eAAe,EAAE,cAAc,EAAC,EAAE,EAAE;IAC7G,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,yBAAyB,GAC3B,eAAe,CAAC,6BAA6B,IAAI,cAAc,CAAC,4BAA4B,CAAC;IACjG,MAAM,0BAA0B,GAC5B,eAAe,CAAC,0BAA0B,IAAI,cAAc,CAAC,yBAAyB,CAAC;IAE3F,OAAO,CACH,MAAC,uBAAuB,eACnB,yBAAyB,IAAI,CAC1B,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,iCAAiC,CAAC,EAC3C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,eAAe,KAAG,GACV,CAChB,EACA,0BAA0B,IAAI,CAC3B,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,gCAAgC,CAAC,EAC1C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,YAAY,KAAG,GACP,CAChB,IACqB,CAC7B,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 FunctionComponent} from 'react';\nimport {type CalculatedFlags, type InheritedFlags} from './calculatedInheritedFlags';\nimport {KitTooltip} from 'aristid-ds';\nimport {FaLayerGroup, FaSquareRootAlt} from 'react-icons/fa';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {TOOLTIP_DEFAULT_DELAY_IN_SECONDS} from '_ui/constants';\n\nconst ComputeIndicatorWrapper = styled.div`\n font-size: calc(var(--general-typography-fontSize7) * 1px);\n`;\n\ninterface IComputeIndicatorProps {\n calculatedFlags: CalculatedFlags;\n inheritedFlags: InheritedFlags;\n}\n\nexport const ComputeIndicator: FunctionComponent<IComputeIndicatorProps> = ({calculatedFlags, inheritedFlags}) => {\n const {t} = useSharedTranslation();\n\n const shouldDisplayComputedIcon =\n calculatedFlags.isCalculatedNotOverrideValues || inheritedFlags.isInheritedNotOverrideValues;\n const shouldDisplayOverridedIcon =\n calculatedFlags.isCalculatedOverrideValues || inheritedFlags.isInheritedOverrideValues;\n\n return (\n <ComputeIndicatorWrapper>\n {shouldDisplayComputedIcon && (\n <KitTooltip\n title={t('record_edition.calculated_value')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <FaSquareRootAlt />\n </KitTooltip>\n )}\n {shouldDisplayOverridedIcon && (\n <KitTooltip\n title={t('record_edition.overrided_value')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <FaLayerGroup />\n </KitTooltip>\n )}\n </ComputeIndicatorWrapper>\n );\n};\n"]}
1
+ {"version":3,"file":"ComputeIndicator.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,mCAAmC,CAAC;AAChF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,gCAAgC,EAAC,MAAM,eAAe,CAAC;AAE/D,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEzC,CAAC;AAOF,MAAM,CAAC,MAAM,gBAAgB,GAA8C,CAAC,EAAC,eAAe,EAAE,cAAc,EAAC,EAAE,EAAE;IAC7G,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,yBAAyB,GAC3B,eAAe,CAAC,6BAA6B,IAAI,cAAc,CAAC,4BAA4B,CAAC;IACjG,MAAM,0BAA0B,GAC5B,eAAe,CAAC,0BAA0B,IAAI,cAAc,CAAC,yBAAyB,CAAC;IAE3F,OAAO,CACH,MAAC,uBAAuB,eACnB,yBAAyB,IAAI,CAC1B,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,iCAAiC,CAAC,EAC3C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,eAAe,IAAC,IAAI,EAAE,eAAe,GAAI,GACjC,CAChB,EACA,0BAA0B,IAAI,CAC3B,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,gCAAgC,CAAC,EAC1C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,eAAe,IAAC,IAAI,EAAE,YAAY,GAAI,GAC9B,CAChB,IACqB,CAC7B,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 FunctionComponent} from 'react';\nimport {type CalculatedFlags, type InheritedFlags} from './calculatedInheritedFlags';\nimport {KitTooltip} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faLayerGroup, faSquareRootAlt} from '@fortawesome/free-solid-svg-icons';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {TOOLTIP_DEFAULT_DELAY_IN_SECONDS} from '_ui/constants';\n\nconst ComputeIndicatorWrapper = styled.div`\n font-size: calc(var(--general-typography-fontSize7) * 1px);\n`;\n\ninterface IComputeIndicatorProps {\n calculatedFlags: CalculatedFlags;\n inheritedFlags: InheritedFlags;\n}\n\nexport const ComputeIndicator: FunctionComponent<IComputeIndicatorProps> = ({calculatedFlags, inheritedFlags}) => {\n const {t} = useSharedTranslation();\n\n const shouldDisplayComputedIcon =\n calculatedFlags.isCalculatedNotOverrideValues || inheritedFlags.isInheritedNotOverrideValues;\n const shouldDisplayOverridedIcon =\n calculatedFlags.isCalculatedOverrideValues || inheritedFlags.isInheritedOverrideValues;\n\n return (\n <ComputeIndicatorWrapper>\n {shouldDisplayComputedIcon && (\n <KitTooltip\n title={t('record_edition.calculated_value')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <FontAwesomeIcon icon={faSquareRootAlt} />\n </KitTooltip>\n )}\n {shouldDisplayOverridedIcon && (\n <KitTooltip\n title={t('record_edition.overrided_value')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <FontAwesomeIcon icon={faLayerGroup} />\n </KitTooltip>\n )}\n </ComputeIndicatorWrapper>\n );\n};\n"]}
@@ -5,7 +5,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { useState } from 'react';
6
6
  import styled from 'styled-components';
7
7
  import { KitButton, KitTooltip } from 'aristid-ds';
8
- import { FaExpand } from 'react-icons/fa';
8
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9
+ import { faExpand } from '@fortawesome/free-solid-svg-icons';
9
10
  import PropertiesList from '../../PropertiesList';
10
11
  import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
11
12
  import { useRecordInformations } from './useRecordInformations';
@@ -37,6 +38,6 @@ export const RecordInformations = ({ record, recordData }) => {
37
38
  const [isFilePreviewModalOpen, setFilePreviewModalOpen] = useState(false);
38
39
  const previewFile = record?.preview?.file;
39
40
  const preview = record?.preview?.medium ? String(record?.preview?.medium) : null;
40
- return (_jsxs(InformationsWrapper, { children: [_jsxs(PreviewWrapper, { children: [_jsx(EntityPreview, { label: record?.label ?? record?.id, color: record?.color, image: preview, imageStyle: { border: 'none' }, placeholderStyle: { height: '100%', width: 'fit-content', margin: 'auto', borderRadius: '0' }, style: { height: '100%', background: 'initial' }, tile: true }), previewFile !== undefined && (_jsx(KitTooltip, { title: t('record_summary.open_preview_modal'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(ExpandImageButton, { "aria-label": t('record_summary.open_preview_modal'), type: "tertiary", icon: _jsx(FaExpand, {}), onClick: () => setFilePreviewModalOpen(true) }) }))] }), isFilePreviewModalOpen && (_jsx(FileModal, { open: isFilePreviewModalOpen, fileId: previewFile?.id, libraryId: previewFile?.library, onClose: () => setFilePreviewModalOpen(false) })), _jsx(ContentWrapper, { children: _jsx(PropertiesList, { items: recordInformations }) })] }));
41
+ return (_jsxs(InformationsWrapper, { children: [_jsxs(PreviewWrapper, { children: [_jsx(EntityPreview, { label: record?.label ?? record?.id, color: record?.color, image: preview, imageStyle: { border: 'none' }, placeholderStyle: { height: '100%', width: 'fit-content', margin: 'auto', borderRadius: '0' }, style: { height: '100%', background: 'initial' }, tile: true }), previewFile !== undefined && (_jsx(KitTooltip, { title: t('record_summary.open_preview_modal'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(ExpandImageButton, { "aria-label": t('record_summary.open_preview_modal'), type: "tertiary", icon: _jsx(FontAwesomeIcon, { icon: faExpand }), onClick: () => setFilePreviewModalOpen(true) }) }))] }), isFilePreviewModalOpen && (_jsx(FileModal, { open: isFilePreviewModalOpen, fileId: previewFile?.id, libraryId: previewFile?.library, onClose: () => setFilePreviewModalOpen(false) })), _jsx(ContentWrapper, { children: _jsx(PropertiesList, { items: recordInformations }) })] }));
41
42
  };
42
43
  //# sourceMappingURL=RecordInformations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RecordInformations.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEvD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,SAAS,MAAM,iDAAiD,CAAC;AACxE,OAAO,EA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3F,KAAK,EAAE,EAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAC,EAC9C,IAAI,SACN,EACD,WAAW,KAAK,SAAS,IAAI,CAC1B,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,mCAAmC,CAAC,EAC7C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,iBAAiB,kBACF,CAAC,CAAC,mCAAmC,CAAC,EAClD,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,KAAC,QAAQ,KAAG,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,GAC9C,GACO,CAChB,IACY,EAChB,sBAAsB,IAAI,CACvB,KAAC,SAAS,IACN,IAAI,EAAE,sBAAsB,EAC5B,MAAM,EAAE,WAAW,EAAE,EAAE,EACvB,SAAS,EAAE,WAAW,EAAE,OAAO,EAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,GAC/C,CACL,EACD,KAAC,cAAc,cACX,KAAC,cAAc,IAAC,KAAK,EAAE,kBAAkB,GAAI,GAChC,IACC,CACzB,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 FunctionComponent, useState} from 'react';\nimport {type IRecordIdentityWhoAmI} from '_ui/types';\nimport styled from 'styled-components';\nimport {KitButton, KitTooltip} from 'aristid-ds';\nimport {FaExpand} from 'react-icons/fa';\nimport PropertiesList from '../../PropertiesList';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type GetRecordColumnsValuesRecord} from '_ui/_queries/records/getRecordColumnsValues';\nimport {useRecordInformations} from './useRecordInformations';\nimport FileModal from '_ui/components/RecordPreviewWithModal/FileModal';\nimport {EntityPreview} from '_ui/components/EntityPreview';\nimport {TOOLTIP_DEFAULT_DELAY_IN_SECONDS} from '_ui/constants';\n\ninterface IInformationsProps {\n record: IRecordIdentityWhoAmI;\n recordData: GetRecordColumnsValuesRecord;\n}\n\nconst InformationsWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nconst PreviewWrapper = styled.div`\n position: relative;\n width: 100%;\n height: 162px;\n background-color: var(--general-colors-primary-50);\n border-radius: calc(var(--general-border-radius-s) * 1px);\n padding: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst ExpandImageButton = styled(KitButton)`\n position: absolute;\n right: 0;\n top: 0;\n`;\n\nconst ContentWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nexport const RecordInformations: FunctionComponent<IInformationsProps> = ({record, recordData}) => {\n const {t} = useSharedTranslation();\n const recordInformations = useRecordInformations(record, recordData);\n const [isFilePreviewModalOpen, setFilePreviewModalOpen] = useState(false);\n\n const previewFile = record?.preview?.file;\n const preview = record?.preview?.medium ? String(record?.preview?.medium) : null;\n\n return (\n <InformationsWrapper>\n <PreviewWrapper>\n <EntityPreview\n label={record?.label ?? record?.id}\n color={record?.color}\n image={preview}\n imageStyle={{border: 'none'}}\n placeholderStyle={{height: '100%', width: 'fit-content', margin: 'auto', borderRadius: '0'}}\n style={{height: '100%', background: 'initial'}}\n tile\n />\n {previewFile !== undefined && (\n <KitTooltip\n title={t('record_summary.open_preview_modal')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <ExpandImageButton\n aria-label={t('record_summary.open_preview_modal')}\n type=\"tertiary\"\n icon={<FaExpand />}\n onClick={() => setFilePreviewModalOpen(true)}\n />\n </KitTooltip>\n )}\n </PreviewWrapper>\n {isFilePreviewModalOpen && (\n <FileModal\n open={isFilePreviewModalOpen}\n fileId={previewFile?.id}\n libraryId={previewFile?.library}\n onClose={() => setFilePreviewModalOpen(false)}\n />\n )}\n <ContentWrapper>\n <PropertiesList items={recordInformations} />\n </ContentWrapper>\n </InformationsWrapper>\n );\n};\n"]}
1
+ {"version":3,"file":"RecordInformations.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEvD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAC;AAC3D,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,SAAS,MAAM,iDAAiD,CAAC;AACxE,OAAO,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAC,gCAAgC,EAAC,MAAM,eAAe,CAAC;AAO/D,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAErC,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;CAOhC,CAAC;AAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;;;;CAI1C,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEhC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA0C,CAAC,EAAC,MAAM,EAAE,UAAU,EAAC,EAAE,EAAE;IAC9F,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACrE,MAAM,CAAC,sBAAsB,EAA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,uBAAuB,CAAC,KAAK,CAAC,GAC/C,CACL,EACD,KAAC,cAAc,cACX,KAAC,cAAc,IAAC,KAAK,EAAE,kBAAkB,GAAI,GAChC,IACC,CACzB,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 FunctionComponent, useState} from 'react';\nimport {type IRecordIdentityWhoAmI} from '_ui/types';\nimport styled from 'styled-components';\nimport {KitButton, KitTooltip} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faExpand} from '@fortawesome/free-solid-svg-icons';\nimport PropertiesList from '../../PropertiesList';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type GetRecordColumnsValuesRecord} from '_ui/_queries/records/getRecordColumnsValues';\nimport {useRecordInformations} from './useRecordInformations';\nimport FileModal from '_ui/components/RecordPreviewWithModal/FileModal';\nimport {EntityPreview} from '_ui/components/EntityPreview';\nimport {TOOLTIP_DEFAULT_DELAY_IN_SECONDS} from '_ui/constants';\n\ninterface IInformationsProps {\n record: IRecordIdentityWhoAmI;\n recordData: GetRecordColumnsValuesRecord;\n}\n\nconst InformationsWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nconst PreviewWrapper = styled.div`\n position: relative;\n width: 100%;\n height: 162px;\n background-color: var(--general-colors-primary-50);\n border-radius: calc(var(--general-border-radius-s) * 1px);\n padding: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst ExpandImageButton = styled(KitButton)`\n position: absolute;\n right: 0;\n top: 0;\n`;\n\nconst ContentWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nexport const RecordInformations: FunctionComponent<IInformationsProps> = ({record, recordData}) => {\n const {t} = useSharedTranslation();\n const recordInformations = useRecordInformations(record, recordData);\n const [isFilePreviewModalOpen, setFilePreviewModalOpen] = useState(false);\n\n const previewFile = record?.preview?.file;\n const preview = record?.preview?.medium ? String(record?.preview?.medium) : null;\n\n return (\n <InformationsWrapper>\n <PreviewWrapper>\n <EntityPreview\n label={record?.label ?? record?.id}\n color={record?.color}\n image={preview}\n imageStyle={{border: 'none'}}\n placeholderStyle={{height: '100%', width: 'fit-content', margin: 'auto', borderRadius: '0'}}\n style={{height: '100%', background: 'initial'}}\n tile\n />\n {previewFile !== undefined && (\n <KitTooltip\n title={t('record_summary.open_preview_modal')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <ExpandImageButton\n aria-label={t('record_summary.open_preview_modal')}\n type=\"tertiary\"\n icon={<FontAwesomeIcon icon={faExpand} />}\n onClick={() => setFilePreviewModalOpen(true)}\n />\n </KitTooltip>\n )}\n </PreviewWrapper>\n {isFilePreviewModalOpen && (\n <FileModal\n open={isFilePreviewModalOpen}\n fileId={previewFile?.id}\n libraryId={previewFile?.library}\n onClose={() => setFilePreviewModalOpen(false)}\n />\n )}\n <ContentWrapper>\n <PropertiesList items={recordInformations} />\n </ContentWrapper>\n </InformationsWrapper>\n );\n};\n"]}
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { KitBadge, KitTabs, KitTree } from 'aristid-ds';
3
3
  import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
4
- import { FaLayerGroup, FaSquareRootAlt } from 'react-icons/fa';
4
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
+ import { faLayerGroup, faSquareRootAlt } from '@fortawesome/free-solid-svg-icons';
5
6
  import styled from 'styled-components';
6
7
  import { RecordHistory } from '../../../RecordHistory/RecordHistory';
7
8
  const InformationsWrapper = styled.div `
@@ -55,7 +56,7 @@ export const ValuesSummary = ({ record, attributeId, globalValues = [], calculat
55
56
  display: 'flex',
56
57
  alignItems: 'center',
57
58
  justifyContent: 'space-between',
58
- }, children: [_jsxs("span", { children: [_jsx(FaSquareRootAlt, {}), " ", t('record_summary.calculated_value')] }), _jsx(KitBadge, { count: stripedCalculatedValues.length, color: "primary" })] })),
59
+ }, children: [_jsxs("span", { children: [_jsx(FontAwesomeIcon, { icon: faSquareRootAlt }), ' ', t('record_summary.calculated_value')] }), _jsx(KitBadge, { count: stripedCalculatedValues.length, color: "primary" })] })),
59
60
  children: stripedCalculatedValues.length > 0
60
61
  ? stripedCalculatedValues.map((calculatedValue, index) => ({
61
62
  key: `${calculatedValueKey}-${index}`,
@@ -74,7 +75,7 @@ export const ValuesSummary = ({ record, attributeId, globalValues = [], calculat
74
75
  display: 'flex',
75
76
  alignItems: 'center',
76
77
  justifyContent: 'space-between',
77
- }, children: [_jsxs("span", { children: [_jsx(FaLayerGroup, {}), " ", t('record_summary.global')] }), _jsx(KitBadge, { count: stripedGlobalValues.length, color: "primary" })] })),
78
+ }, children: [_jsxs("span", { children: [_jsx(FontAwesomeIcon, { icon: faLayerGroup }), ' ', t('record_summary.global')] }), _jsx(KitBadge, { count: stripedGlobalValues.length, color: "primary" })] })),
78
79
  children: stripedGlobalValues.length > 0
79
80
  ? stripedGlobalValues.map((value, index) => ({
80
81
  key: `${globalValueKey}-${index}`,
@@ -1 +1 @@
1
- {"version":3,"file":"ValuesSummary.js","sourceRoot":"","sources":["../../../../../src/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,aAAa,EAAC,MAAM,sCAAsC,CAAC;AAEnE,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAErC,CAA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ACI;gDACI,GAAG,EAAE,GAAG,kBAAkB,IAAI,CAAC,EAAE;gDACjC,KAAK,EAAE,sBAAI,CAAC,CAAC,yBAAyB,CAAC,GAAK;6CAC/C;yCACJ;iCACd;gCACD;oCACI,GAAG,EAAE,cAAc;oCACnB,KAAK,EAAE,CACH,eACI,KAAK,EAAE;4CACH,OAAO,EAAE,MAAM;4CACf,UAAU,EAAE,QAAQ;4CACpB,cAAc,EAAE,eAAe;yCAClC,aAED,2BACI,KAAC,YAAY,KAAG,OAAE,CAAC,CAAC,uBAAuB,CAAC,IACzC,EACP,KAAC,QAAQ,IAAC,KAAK,EAAE,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAC,SAAS,GAAG,IAC7D,CACT;oCACD,QAAQ,EACJ,mBAAmB,CAAC,MAAM,GAAG,CAAC;wCAC1B,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;4CACvC,GAAG,EAAE,GAAG,cAAc,IAAI,KAAK,EAAE;4CACjC,KAAK,EAAE,KAAK;yCACf,CAAC,CAAC;wCACL,CAAC,CAAC;4CACI;gDACI,GAAG,EAAE,GAAG,cAAc,IAAI,CAAC,EAAE;gDAC7B,KAAK,EAAE,sBAAI,CAAC,CAAC,yBAAyB,CAAC,GAAK;6CAC/C;yCACJ;iCACd;6BACJ,GACH,GACgB,CACzB;iBACJ;gBACD;oBACI,GAAG,EAAE,SAAS;oBACd,KAAK,EAAE,CAAC,CAAC,wBAAwB,CAAC;oBAClC,UAAU,EAAE,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAI;iBAC1E;aACJ,GACH,GACoB,CAC7B,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,aAAa,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 FunctionComponent} from 'react';\nimport {type RecordFormElementsValueStandardValue} from '_ui/hooks/useGetRecordForm';\nimport {KitBadge, KitTabs, KitTree} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {FaLayerGroup, FaSquareRootAlt} from 'react-icons/fa';\nimport styled from 'styled-components';\nimport {type IRecordIdentityWhoAmI} from '_ui/types';\nimport {RecordHistory} from '../../../RecordHistory/RecordHistory';\n\nconst InformationsWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nconst StyledDivContentWrapper = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n`;\n\ninterface IValuesSummaryProps {\n record: IRecordIdentityWhoAmI | null;\n attributeId: string;\n globalValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n calculatedValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n}\n\nconst calculatedValueKey = '0';\nconst globalValueKey = '1';\n\n// https://stackoverflow.com/questions/822452/strip-html-tags-from-text-using-plain-javascript\nconst stripHtml = (html: string): string => {\n const doc = new DOMParser().parseFromString(html, 'text/html');\n return doc.body.textContent || '';\n};\n\nconst _isDateRangeValue = (value: any): value is {from: string; to: string} =>\n !!value && typeof value === 'object' && 'from' in value && 'to' in value;\n\nexport const ValuesSummary: FunctionComponent<IValuesSummaryProps> = ({\n record,\n attributeId,\n globalValues = [],\n calculatedValues = [],\n}) => {\n const {t} = useSharedTranslation();\n\n const stringifyValue = (value: RecordFormElementsValueStandardValue['payload']): string => {\n if (typeof value === 'string') {\n return stripHtml(value);\n }\n\n if (typeof value === 'boolean') {\n return value ? t('global.yes') : t('global.no');\n }\n\n if (_isDateRangeValue(value)) {\n return t('record_edition.date_range_value', {\n from: value.from,\n to: value.to,\n interpolation: {\n escapeValue: false,\n },\n });\n }\n\n return value;\n };\n\n const stripedGlobalValues = globalValues.map(stringifyValue);\n const stripedCalculatedValues = calculatedValues.map(stringifyValue);\n\n return (\n <StyledDivContentWrapper>\n <KitTabs\n items={[\n {\n key: 'version_values',\n label: t('record_summary.values_version'),\n tabContent: (\n <InformationsWrapper>\n <KitTree\n defaultExpandAll\n selectedKeys={\n calculatedValues.length > 0 && globalValues.length === 0\n ? [calculatedValueKey]\n : [globalValueKey]\n }\n treeData={[\n {\n key: calculatedValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FaSquareRootAlt /> {t('record_summary.calculated_value')}\n </span>\n <KitBadge count={stripedCalculatedValues.length} color=\"primary\" />\n </div>\n ),\n children:\n stripedCalculatedValues.length > 0\n ? stripedCalculatedValues.map((calculatedValue, index) => ({\n key: `${calculatedValueKey}-${index}`,\n title: calculatedValue,\n }))\n : [\n {\n key: `${calculatedValueKey}-${0}`,\n title: <i>{t('record_summary.no_value')}</i>,\n },\n ],\n },\n {\n key: globalValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FaLayerGroup /> {t('record_summary.global')}\n </span>\n <KitBadge count={stripedGlobalValues.length} color=\"primary\" />\n </div>\n ),\n children:\n stripedGlobalValues.length > 0\n ? stripedGlobalValues.map((value, index) => ({\n key: `${globalValueKey}-${index}`,\n title: value,\n }))\n : [\n {\n key: `${globalValueKey}-${0}`,\n title: <i>{t('record_summary.no_value')}</i>,\n },\n ],\n },\n ]}\n />\n </InformationsWrapper>\n ),\n },\n {\n key: 'history',\n label: t('record_summary.history'),\n tabContent: <RecordHistory record={record} attributeId={attributeId} />,\n },\n ]}\n />\n </StyledDivContentWrapper>\n );\n};\n\nexport default ValuesSummary;\n"]}
1
+ {"version":3,"file":"ValuesSummary.js","sourceRoot":"","sources":["../../../../../src/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAA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,GACH,GACgB,CACzB;iBACJ;gBACD;oBACI,GAAG,EAAE,SAAS;oBACd,KAAK,EAAE,CAAC,CAAC,wBAAwB,CAAC;oBAClC,UAAU,EAAE,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAI;iBAC1E;aACJ,GACH,GACoB,CAC7B,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,aAAa,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 FunctionComponent} from 'react';\nimport {type RecordFormElementsValueStandardValue} from '_ui/hooks/useGetRecordForm';\nimport {KitBadge, KitTabs, KitTree} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faLayerGroup, faSquareRootAlt} from '@fortawesome/free-solid-svg-icons';\nimport styled from 'styled-components';\nimport {type IRecordIdentityWhoAmI} from '_ui/types';\nimport {RecordHistory} from '../../../RecordHistory/RecordHistory';\n\nconst InformationsWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nconst StyledDivContentWrapper = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n`;\n\ninterface IValuesSummaryProps {\n record: IRecordIdentityWhoAmI | null;\n attributeId: string;\n globalValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n calculatedValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n}\n\nconst calculatedValueKey = '0';\nconst globalValueKey = '1';\n\n// https://stackoverflow.com/questions/822452/strip-html-tags-from-text-using-plain-javascript\nconst stripHtml = (html: string): string => {\n const doc = new DOMParser().parseFromString(html, 'text/html');\n return doc.body.textContent || '';\n};\n\nconst _isDateRangeValue = (value: any): value is {from: string; to: string} =>\n !!value && typeof value === 'object' && 'from' in value && 'to' in value;\n\nexport const ValuesSummary: FunctionComponent<IValuesSummaryProps> = ({\n record,\n attributeId,\n globalValues = [],\n calculatedValues = [],\n}) => {\n const {t} = useSharedTranslation();\n\n const stringifyValue = (value: RecordFormElementsValueStandardValue['payload']): string => {\n if (typeof value === 'string') {\n return stripHtml(value);\n }\n\n if (typeof value === 'boolean') {\n return value ? t('global.yes') : t('global.no');\n }\n\n if (_isDateRangeValue(value)) {\n return t('record_edition.date_range_value', {\n from: value.from,\n to: value.to,\n interpolation: {\n escapeValue: false,\n },\n });\n }\n\n return value;\n };\n\n const stripedGlobalValues = globalValues.map(stringifyValue);\n const stripedCalculatedValues = calculatedValues.map(stringifyValue);\n\n return (\n <StyledDivContentWrapper>\n <KitTabs\n items={[\n {\n key: 'version_values',\n label: t('record_summary.values_version'),\n tabContent: (\n <InformationsWrapper>\n <KitTree\n defaultExpandAll\n selectedKeys={\n calculatedValues.length > 0 && globalValues.length === 0\n ? [calculatedValueKey]\n : [globalValueKey]\n }\n treeData={[\n {\n key: calculatedValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FontAwesomeIcon icon={faSquareRootAlt} />{' '}\n {t('record_summary.calculated_value')}\n </span>\n <KitBadge count={stripedCalculatedValues.length} color=\"primary\" />\n </div>\n ),\n children:\n stripedCalculatedValues.length > 0\n ? stripedCalculatedValues.map((calculatedValue, index) => ({\n key: `${calculatedValueKey}-${index}`,\n title: calculatedValue,\n }))\n : [\n {\n key: `${calculatedValueKey}-${0}`,\n title: <i>{t('record_summary.no_value')}</i>,\n },\n ],\n },\n {\n key: globalValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FontAwesomeIcon icon={faLayerGroup} />{' '}\n {t('record_summary.global')}\n </span>\n <KitBadge count={stripedGlobalValues.length} color=\"primary\" />\n </div>\n ),\n children:\n stripedGlobalValues.length > 0\n ? stripedGlobalValues.map((value, index) => ({\n key: `${globalValueKey}-${index}`,\n title: value,\n }))\n : [\n {\n key: `${globalValueKey}-${0}`,\n title: <i>{t('record_summary.no_value')}</i>,\n },\n ],\n },\n ]}\n />\n </InformationsWrapper>\n ),\n },\n {\n key: 'history',\n label: t('record_summary.history'),\n tabContent: <RecordHistory record={record} attributeId={attributeId} />,\n },\n ]}\n />\n </StyledDivContentWrapper>\n );\n};\n\nexport default ValuesSummary;\n"]}