@leav/ui 1.12.0 → 1.13.0

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 (131) hide show
  1. package/dist/__mocks__/utils.d.ts +3 -0
  2. package/dist/__mocks__/utils.js +2 -0
  3. package/dist/__mocks__/utils.js.map +1 -0
  4. package/dist/_gqlTypes/index.d.ts +361 -116
  5. package/dist/_gqlTypes/index.js +261 -51
  6. package/dist/_gqlTypes/index.js.map +1 -1
  7. package/dist/_queries/attributes/attributeDetailsFragment.js +3 -0
  8. package/dist/_queries/attributes/attributeDetailsFragment.js.map +1 -1
  9. package/dist/components/Explorer/DataView.js +31 -14
  10. package/dist/components/Explorer/DataView.js.map +1 -1
  11. package/dist/components/Explorer/_constants.d.ts +0 -1
  12. package/dist/components/Explorer/_constants.js +0 -1
  13. package/dist/components/Explorer/_constants.js.map +1 -1
  14. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js +5 -9
  15. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -1
  16. package/dist/components/Explorer/actions-mass/ResultsCount.js +2 -2
  17. package/dist/components/Explorer/actions-mass/ResultsCount.js.map +1 -1
  18. package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.d.ts +4 -9
  19. package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js +3 -11
  20. package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js.map +1 -1
  21. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.d.ts +8 -8
  22. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js +26 -13
  23. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js.map +1 -1
  24. package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.d.ts +7 -0
  25. package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.js +30 -0
  26. package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.js.map +1 -0
  27. package/dist/components/Explorer/actions-mass/edit-attribute/_types.d.ts +23 -0
  28. package/dist/components/Explorer/actions-mass/edit-attribute/_types.js +2 -0
  29. package/dist/components/Explorer/actions-mass/edit-attribute/_types.js.map +1 -0
  30. package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.d.ts +4 -0
  31. package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.js +46 -0
  32. package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.js.map +1 -0
  33. package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.d.ts +12 -0
  34. package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.js +24 -0
  35. package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.js.map +1 -0
  36. package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.d.ts +13 -0
  37. package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.js +28 -0
  38. package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.js.map +1 -0
  39. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +6 -10
  40. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
  41. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +5 -8
  42. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
  43. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.d.ts +8 -2
  44. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +104 -72
  45. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
  46. package/dist/components/Explorer/actions-mass/useMassActions.js +30 -19
  47. package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
  48. package/dist/components/Explorer/conditionsHelper.d.ts +2 -1
  49. package/dist/components/Explorer/conditionsHelper.js.map +1 -1
  50. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +6 -4
  51. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
  52. package/dist/components/Filters/_types.d.ts +3 -0
  53. package/dist/components/Filters/_types.js.map +1 -1
  54. package/dist/components/Filters/conditionsHelper.d.ts +2 -1
  55. package/dist/components/Filters/conditionsHelper.js.map +1 -1
  56. package/dist/components/Filters/context/filtersReducer.js +14 -1
  57. package/dist/components/Filters/context/filtersReducer.js.map +1 -1
  58. package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
  59. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
  60. package/dist/components/Filters/useFilters.d.ts +198 -0
  61. package/dist/components/Filters/useTransformFilters.js +4 -2
  62. package/dist/components/Filters/useTransformFilters.js.map +1 -1
  63. package/dist/components/RecordEdition/EditRecord/EditRecord.js +8 -1
  64. package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
  65. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.d.ts +1 -4
  66. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.js +5 -9
  67. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.js.map +1 -1
  68. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.js +4 -8
  69. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.js.map +1 -1
  70. package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +1 -1
  71. package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js.map +1 -1
  72. package/dist/components/RecordEdition/hooks/useCreateCancelConfirm/useCreateCancelConfirm.js +4 -8
  73. package/dist/components/RecordEdition/hooks/useCreateCancelConfirm/useCreateCancelConfirm.js.map +1 -1
  74. package/dist/constants.d.ts +1 -0
  75. package/dist/constants.js +1 -0
  76. package/dist/constants.js.map +1 -1
  77. package/dist/hooks/index.d.ts +4 -0
  78. package/dist/hooks/index.js +4 -0
  79. package/dist/hooks/index.js.map +1 -1
  80. package/dist/hooks/useConfirmModal/__mocks__/index.d.ts +1 -0
  81. package/dist/hooks/useConfirmModal/__mocks__/index.js +5 -0
  82. package/dist/hooks/useConfirmModal/__mocks__/index.js.map +1 -0
  83. package/dist/hooks/useConfirmModal/__mocks__/useConfirmModal.d.ts +3 -0
  84. package/dist/hooks/useConfirmModal/__mocks__/useConfirmModal.js +7 -0
  85. package/dist/hooks/useConfirmModal/__mocks__/useConfirmModal.js.map +1 -0
  86. package/dist/hooks/useConfirmModal/index.d.ts +1 -0
  87. package/dist/hooks/useConfirmModal/index.js +5 -0
  88. package/dist/hooks/useConfirmModal/index.js.map +1 -0
  89. package/dist/hooks/useConfirmModal/useConfirmModal.d.ts +7 -0
  90. package/dist/hooks/useConfirmModal/useConfirmModal.js +25 -0
  91. package/dist/hooks/useConfirmModal/useConfirmModal.js.map +1 -0
  92. package/dist/hooks/useGetRecordIdCard/index.d.ts +1 -0
  93. package/dist/hooks/useGetRecordIdCard/index.js +5 -0
  94. package/dist/hooks/useGetRecordIdCard/index.js.map +1 -0
  95. package/dist/hooks/useGetRecordIdCard/useGetRecordIdCard.d.ts +18 -0
  96. package/dist/hooks/useGetRecordIdCard/useGetRecordIdCard.js +20 -0
  97. package/dist/hooks/useGetRecordIdCard/useGetRecordIdCard.js.map +1 -0
  98. package/dist/hooks/useIFrameMessenger/iFrameMessengerContext.d.ts +6 -0
  99. package/dist/hooks/useIFrameMessenger/iFrameMessengerContext.js +8 -0
  100. package/dist/hooks/useIFrameMessenger/iFrameMessengerContext.js.map +1 -0
  101. package/dist/hooks/useIFrameMessenger/types.d.ts +10 -3
  102. package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
  103. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +11 -2
  104. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +31 -10
  105. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -1
  106. package/dist/hooks/useIFrameMessenger/useIFrameMessengerContext.d.ts +13 -0
  107. package/dist/hooks/useIFrameMessenger/useIFrameMessengerContext.js +59 -0
  108. package/dist/hooks/useIFrameMessenger/useIFrameMessengerContext.js.map +1 -0
  109. package/dist/hooks/useIFrameMessenger/useIFrameMessengerHandlers.d.ts +13 -0
  110. package/dist/hooks/useIFrameMessenger/useIFrameMessengerHandlers.js +29 -0
  111. package/dist/hooks/useIFrameMessenger/useIFrameMessengerHandlers.js.map +1 -0
  112. package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.js +3 -0
  113. package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.js.map +1 -1
  114. package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +1 -0
  115. package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +1 -0
  116. package/dist/hooks/useSharedTranslation/__mocks__/useSharedTranslation.js.map +1 -1
  117. package/dist/locales/en/shared.json +6 -4
  118. package/dist/locales/fr/shared.json +8 -6
  119. package/package.json +17 -17
  120. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.d.ts +0 -8
  121. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js +0 -40
  122. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js.map +0 -1
  123. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.d.ts +0 -17
  124. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js +0 -42
  125. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js.map +0 -1
  126. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.d.ts +0 -5
  127. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js +0 -20
  128. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js.map +0 -1
  129. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.d.ts +0 -12
  130. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js +0 -30
  131. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js.map +0 -1
@@ -730,17 +730,17 @@
730
730
  "deactivate_message": "Elements deleted",
731
731
  "deactivate_description": "{{count, number}}/{{total, number}} element for which you have permissions have been deleted. Others remain unchanged.",
732
732
  "editAttribute": "Edit an attribute",
733
- "editAttribute_description_one": "{{count, number}} element will be updated.",
734
- "editAttribute_description_other": "{{total, number}} elements will be updated.",
733
+ "editAttribute_description_one": "{{count, number}} element selected",
734
+ "editAttribute_description_other": "{{count, number}} elements selected",
735
735
  "editAttribute_attribute_select_title": "Attribute to edit",
736
736
  "editAttribute_attribute_select_placeholder": "Select an attribute",
737
- "editAttribute_value_select_placeholder": "Select a value",
738
737
  "editAttribute_value_occurrences_to_edit_one": "{{count, number}} element to edit",
739
738
  "editAttribute_value_occurrences_to_edit_other": "{{count, number}} elements to edit",
740
739
  "editAttribute_value_undefined": "Undefined",
741
740
  "editAttribute_value_do_not_change": "Do not change",
742
741
  "editAttribute_submit_notification_title": "Bulk edit request",
743
- "editAttribute_submit_notification_description": "Your request to edit {{counter, number}} items has been received. You will be notified once the operation is complete.",
742
+ "editAttribute_submit_notification_description_one": "Your request to edit {{count, number}} item has been received. You will be notified once the operation is complete.",
743
+ "editAttribute_submit_notification_description_other": "Your request to edit {{count, number}} items has been received. You will be notified once the operation is complete.",
744
744
  "editAttribute_submit_error": "An error occurred while requesting a bulk edit. Please contact an administrator.",
745
745
  "export": "Export",
746
746
  "export_message": "Export request",
@@ -756,6 +756,8 @@
756
756
  "toggle_selection": {
757
757
  "select_page_one": "Select visible item ({{count, number}})",
758
758
  "select_page_other": "Select visible items ({{count, number}})",
759
+ "deselect_page_one": "Deselect visible item ({{count, number}})",
760
+ "deselect_page_other": "Deselect visible items ({{count, number}})",
759
761
  "select_all": "Select all items ({{count, number}})",
760
762
  "deselect_all": "Deselect all items"
761
763
  },
@@ -730,18 +730,18 @@
730
730
  "deactivate_message": "Élements supprimés",
731
731
  "deactivate_description": "{{count, number}}/{{total, number}} éléments pour lesquels vous disposez des permissions nécessaires ont été supprimés. Les autres éléments restent inchangés.",
732
732
  "editAttribute": "Modifier un attribut",
733
- "editAttribute_description_one": "{{count, number}} élément à modifier",
734
- "editAttribute_description_other": "{{count, number}} éléments à modifier",
733
+ "editAttribute_description_one": "{{count, number}} élément sélectionné",
734
+ "editAttribute_description_other": "{{count, number}} éléments sélectionnés",
735
735
  "editAttribute_attribute_select_title": "Attribut à modifier",
736
736
  "editAttribute_attribute_select_placeholder": "Sélectionnez un attribut",
737
- "editAttribute_value_select_placeholder": "Sélectionnez une valeur",
738
737
  "editAttribute_value_occurrences_to_edit_one": "{{count, number}} élément à traiter",
739
738
  "editAttribute_value_occurrences_to_edit_other": "{{count, number}} éléments à traiter",
740
739
  "editAttribute_value_undefined": "Non défini",
741
740
  "editAttribute_value_do_not_change": "Ne pas changer",
742
741
  "editAttribute_submit_notification_title": "Demande de modification en masse",
743
- "editAttribute_submit_notification_description": "Votre demande de modification de {{counter, number}} éléments a bien été prise en compte. Vous serez notifié une fois l'opération terminée.",
744
- "editAttribute_submit_error": "Une erreur est survenue lors de la demande d'une modification en masse. Veuillez contacter un administrateur.",
742
+ "editAttribute_submit_notification_description_one": "Votre demande de modification de {{count, number}} élément a bien été prise en compte. Vous serez notifié une fois lopération terminée.",
743
+ "editAttribute_submit_notification_description_other": "Votre demande de modification de {{count, number}} éléments a bien été prise en compte. Vous serez notifié une fois l’opération terminée.",
744
+ "editAttribute_submit_error": "Une erreur est survenue lors de la demande d’une modification en masse. Veuillez contacter un administrateur.",
745
745
  "export": "Exporter",
746
746
  "export_message": "Demande d'export",
747
747
  "export_description_one": "Votre demande d’export de {{total, number}} élément a bien été prise en compte. Vous recevrez une notification dès que le fichier sera prêt.",
@@ -754,8 +754,10 @@
754
754
  "add-link": "Ajouter",
755
755
  "replace-link": "Remplacer",
756
756
  "toggle_selection": {
757
- "select_page_one": "Sélectionner l’éléments visible ({{count, number}})",
757
+ "select_page_one": "Sélectionner l’élément visible ({{count, number}})",
758
758
  "select_page_other": "Sélectionner les éléments visibles ({{count, number}})",
759
+ "deselect_page_one": "Désélectionner l’élément visible ({{count, number}})",
760
+ "deselect_page_other": "Désélectionner les éléments visibles ({{count, number}})",
759
761
  "select_all": "Tout sélectionner ({{count, number}})",
760
762
  "deselect_all": "Tout désélectionner"
761
763
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leav/ui",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Shared React components and hooks",
5
5
  "scripts": {
6
6
  "prepublishOnly": "yarn build",
@@ -24,14 +24,14 @@
24
24
  "license": "LGPL3",
25
25
  "repository": "https://github.com/leav-solutions/leav-engine",
26
26
  "devDependencies": {
27
- "@apollo/client": "3.14.0",
28
- "@babel/preset-env": "7.29.0",
27
+ "@apollo/client": "3.14.1",
28
+ "@babel/preset-env": "7.29.3",
29
29
  "@babel/preset-react": "7.28.5",
30
30
  "@graphql-codegen/add": "5.0.3",
31
- "@graphql-codegen/cli": "6.2.1",
32
- "@graphql-codegen/typescript": "5.0.9",
33
- "@graphql-codegen/typescript-operations": "5.0.9",
34
- "@graphql-codegen/typescript-react-apollo": "4.4.1",
31
+ "@graphql-codegen/cli": "6.3.1",
32
+ "@graphql-codegen/typescript": "5.0.10",
33
+ "@graphql-codegen/typescript-operations": "5.1.0",
34
+ "@graphql-codegen/typescript-react-apollo": "4.4.2",
35
35
  "@testing-library/jest-dom": "5.17.0",
36
36
  "@testing-library/react": "14.3.1",
37
37
  "@testing-library/react-hooks": "8.0.1",
@@ -42,25 +42,25 @@
42
42
  "@types/lodash.isequal": "^4",
43
43
  "@types/react": "18.2.14",
44
44
  "@types/react-dom": "18.2.6",
45
- "aristid-ds": "15.2.0-e049fb9",
45
+ "aristid-ds": "15.3.1-3917c51",
46
46
  "babel-jest": "29.7.0",
47
- "graphql": "16.12.0",
47
+ "graphql": "16.13.2",
48
48
  "i18next": "22.5.1",
49
49
  "jest": "29.7.0",
50
50
  "jest-environment-jsdom": "29.7.0",
51
- "jest-styled-components": "7.3.1",
51
+ "jest-styled-components": "7.4.0",
52
52
  "react": "18.2.0",
53
53
  "react-dom": "18.2.0",
54
54
  "react-i18next": "12",
55
55
  "react-router-dom": "6.22.0",
56
- "ts-jest": "29.4.6",
57
- "tsc-alias": "1.8.16",
56
+ "ts-jest": "29.4.9",
57
+ "tsc-alias": "1.8.17",
58
58
  "typescript": "5.9.3",
59
- "vite": "7.3.1"
59
+ "vite": "7.3.2"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "@apollo/client": ">=3.8.1",
63
- "aristid-ds": "15.2.0-e049fb9",
63
+ "aristid-ds": "15.3.1-3917c51",
64
64
  "i18next": ">=22.5.1",
65
65
  "react": "^18.2.0",
66
66
  "react-dom": "^18.2.0",
@@ -74,12 +74,12 @@
74
74
  "@dnd-kit/core": "6.3.1",
75
75
  "@dnd-kit/sortable": "8.0.0",
76
76
  "@dnd-kit/utilities": "3.2.2",
77
- "@leav/utils": "1.12.0",
77
+ "@leav/utils": "1.13.0",
78
78
  "@uidotdev/usehooks": "2.4.1",
79
79
  "dayjs": "^1.11.13",
80
- "dompurify": "3.3.2",
80
+ "dompurify": "3.4.2",
81
81
  "html-react-parser": "4.2.10",
82
- "i18next-resources-to-backend": "1.1.4",
82
+ "i18next-resources-to-backend": "1.2.1",
83
83
  "lodash.isequal": "4.5.0",
84
84
  "react-markdown": "5.0.3",
85
85
  "styled-components": "6.0.8",
@@ -1,8 +0,0 @@
1
- import { type FunctionComponent } from 'react';
2
- import { type ITreeAttributeNodeValue } from './useListTreeAttributeValuesHook';
3
- export declare const EditTreeAttributeValueLine: FunctionComponent<{
4
- treeNodeValues: ITreeAttributeNodeValue[];
5
- valueOccurrenceNodeId: string | null;
6
- valueOccurrenceCount: number;
7
- setAttributeMapping: (before: string | null, after: string | null) => void;
8
- }>;
@@ -1,40 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
3
- import { KitIdCard, KitSelect, KitTypography } from 'aristid-ds';
4
- import styled from 'styled-components';
5
- const DivContainer = styled.div `
6
- display: grid;
7
- align-items: center;
8
- grid-template-columns: repeat(3, 1fr);
9
- grid-column-gap: calc(var(--general-spacing-l) * 1px);
10
- `;
11
- const UNDEFINED_VALUE = '__null__';
12
- const DEFAULT_ID_CARD_COLOR = 'rgba(200, 200, 200, 1)';
13
- export const EditTreeAttributeValueLine = ({ treeNodeValues, valueOccurrenceNodeId, valueOccurrenceCount, setAttributeMapping }) => {
14
- const { t } = useSharedTranslation();
15
- const treeNodeValueOfOccurrence = treeNodeValues.find(node => node.id === valueOccurrenceNodeId);
16
- if (!treeNodeValueOfOccurrence) {
17
- return null;
18
- }
19
- const allowedDependentValues = treeNodeValueOfOccurrence ? treeNodeValueOfOccurrence.allowedDependentValues : null;
20
- const selectOptions = treeNodeValues
21
- .filter(treeNode => treeNode.id !== valueOccurrenceNodeId)
22
- .filter(treeNode => allowedDependentValues == null || // if no allowedDependentValues, all values are allowed
23
- !!allowedDependentValues.find(dv => dv.nodeId === treeNode.id))
24
- .map(treeNode => ({
25
- label: treeNode.label,
26
- value: treeNode.id || UNDEFINED_VALUE,
27
- }));
28
- if (selectOptions.length === 0 && valueOccurrenceNodeId) {
29
- selectOptions.push({
30
- label: t('explorer.massAction.editAttribute_value_do_not_change'),
31
- value: valueOccurrenceNodeId,
32
- });
33
- }
34
- return (_jsxs(DivContainer, { children: [_jsx(KitIdCard, { title: treeNodeValueOfOccurrence.label, color: treeNodeValueOfOccurrence.color || DEFAULT_ID_CARD_COLOR }), _jsx(KitTypography.Text, { children: t('explorer.massAction.editAttribute_value_occurrences_to_edit', {
35
- count: valueOccurrenceCount,
36
- }) }), _jsx(KitSelect, { options: selectOptions, size: "middle", allowClear: false, placeholder: t('explorer.massAction.editAttribute_value_select_placeholder'), onChange: value => {
37
- setAttributeMapping(valueOccurrenceNodeId, value === UNDEFINED_VALUE ? null : value || null);
38
- } })] }));
39
- };
40
- //# sourceMappingURL=EditTreeAttributeValueLine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditTreeAttributeValueLine.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAE/D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAK9B,CAAC;AAEF,MAAM,eAAe,GAAG,UAAU,CAAC;AACnC,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAEvD,MAAM,CAAC,MAAM,0BAA0B,GAKlC,CAAC,EAAC,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,mBAAmB,EAAC,EAAE,EAAE;IACxF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,yBAAyB,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,qBAAqB,CAAC,CAAC;IACjG,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,sBAAsB,GAAG,yBAAyB,CAAC,CAAC,CAAC,yBAAyB,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC;IAEnH,MAAM,aAAa,GAAG,cAAc;SAC/B,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,qBAAqB,CAAC;SACzD,MAAM,CACH,QAAQ,CAAC,EAAE,CACP,sBAAsB,IAAI,IAAI,IAAI,uDAAuD;QACzF,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,KAAK,QAAQ,CAAC,EAAE,CAAC,CACrE;SACA,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACd,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,KAAK,EAAE,QAAQ,CAAC,EAAE,IAAI,eAAe;KACxC,CAAC,CAAC,CAAC;IAER,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,qBAAqB,EAAE,CAAC;QACtD,aAAa,CAAC,IAAI,CAAC;YACf,KAAK,EAAE,CAAC,CAAC,uDAAuD,CAAC;YACjE,KAAK,EAAE,qBAAqB;SAC/B,CAAC,CAAC;IACP,CAAC;IAED,OAAO,CACH,MAAC,YAAY,eACT,KAAC,SAAS,IACN,KAAK,EAAE,yBAAyB,CAAC,KAAK,EACtC,KAAK,EAAE,yBAAyB,CAAC,KAAK,IAAI,qBAAqB,GACjE,EACF,KAAC,aAAa,CAAC,IAAI,cACd,CAAC,CAAC,6DAA6D,EAAE;oBAC9D,KAAK,EAAE,oBAAoB;iBAC9B,CAAC,GACe,EACrB,KAAC,SAAS,IACN,OAAO,EAAE,aAAa,EACtB,IAAI,EAAC,QAAQ,EACb,UAAU,EAAE,KAAK,EACjB,WAAW,EAAE,CAAC,CAAC,4DAA4D,CAAC,EAC5E,QAAQ,EAAE,KAAK,CAAC,EAAE;oBACd,mBAAmB,CAAC,qBAAqB,EAAE,KAAK,KAAK,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;gBACjG,CAAC,GACH,IACS,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type AttributeDetailsTreeAttributeFragment} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitIdCard, KitSelect, KitTypography} from 'aristid-ds';\nimport {type FunctionComponent} from 'react';\nimport styled from 'styled-components';\nimport {type ITreeAttributeNodeValue} from './useListTreeAttributeValuesHook';\n\nconst DivContainer = styled.div`\n display: grid;\n align-items: center;\n grid-template-columns: repeat(3, 1fr);\n grid-column-gap: calc(var(--general-spacing-l) * 1px);\n`;\n\nconst UNDEFINED_VALUE = '__null__';\nconst DEFAULT_ID_CARD_COLOR = 'rgba(200, 200, 200, 1)';\n\nexport const EditTreeAttributeValueLine: FunctionComponent<{\n treeNodeValues: ITreeAttributeNodeValue[];\n valueOccurrenceNodeId: string | null;\n valueOccurrenceCount: number;\n setAttributeMapping: (before: string | null, after: string | null) => void;\n}> = ({treeNodeValues, valueOccurrenceNodeId, valueOccurrenceCount, setAttributeMapping}) => {\n const {t} = useSharedTranslation();\n\n const treeNodeValueOfOccurrence = treeNodeValues.find(node => node.id === valueOccurrenceNodeId);\n if (!treeNodeValueOfOccurrence) {\n return null;\n }\n\n const allowedDependentValues = treeNodeValueOfOccurrence ? treeNodeValueOfOccurrence.allowedDependentValues : null;\n\n const selectOptions = treeNodeValues\n .filter(treeNode => treeNode.id !== valueOccurrenceNodeId)\n .filter(\n treeNode =>\n allowedDependentValues == null || // if no allowedDependentValues, all values are allowed\n !!allowedDependentValues.find(dv => dv.nodeId === treeNode.id),\n )\n .map(treeNode => ({\n label: treeNode.label,\n value: treeNode.id || UNDEFINED_VALUE,\n }));\n\n if (selectOptions.length === 0 && valueOccurrenceNodeId) {\n selectOptions.push({\n label: t('explorer.massAction.editAttribute_value_do_not_change'),\n value: valueOccurrenceNodeId,\n });\n }\n\n return (\n <DivContainer>\n <KitIdCard\n title={treeNodeValueOfOccurrence.label}\n color={treeNodeValueOfOccurrence.color || DEFAULT_ID_CARD_COLOR}\n />\n <KitTypography.Text>\n {t('explorer.massAction.editAttribute_value_occurrences_to_edit', {\n count: valueOccurrenceCount,\n })}\n </KitTypography.Text>\n <KitSelect\n options={selectOptions}\n size=\"middle\"\n allowClear={false}\n placeholder={t('explorer.massAction.editAttribute_value_select_placeholder')}\n onChange={value => {\n setAttributeMapping(valueOccurrenceNodeId, value === UNDEFINED_VALUE ? null : value || null);\n }}\n />\n </DivContainer>\n );\n};\n"]}
@@ -1,17 +0,0 @@
1
- import { type RecordFilterInput } from '../../../../_gqlTypes';
2
- export type ValuesOccurrences = {
3
- noValueCount: number;
4
- occurrences: Array<{
5
- count: number;
6
- value: {
7
- id: string;
8
- };
9
- }>;
10
- loading?: boolean;
11
- };
12
- export type ValueOccurrence = ValuesOccurrences['occurrences'][0];
13
- export declare const useCountValuesOccurrencesHook: ({ attributeId, libraryId, recordFilters, }: {
14
- attributeId?: string;
15
- libraryId: string;
16
- recordFilters: RecordFilterInput[];
17
- }) => ValuesOccurrences;
@@ -1,42 +0,0 @@
1
- // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
2
- // This file is released under LGPL V3
3
- // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
4
- import { useCountValuesOccurrencesLazyQuery } from '../../../../_gqlTypes';
5
- import { useEffect, useMemo } from 'react';
6
- export const useCountValuesOccurrencesHook = ({ attributeId, libraryId, recordFilters, }) => {
7
- const [countValuesOccurrences, { data: valuesOccurrences, loading }] = useCountValuesOccurrencesLazyQuery({
8
- fetchPolicy: 'no-cache',
9
- nextFetchPolicy: 'no-cache',
10
- });
11
- useEffect(() => {
12
- if (attributeId) {
13
- countValuesOccurrences({
14
- variables: {
15
- attribute: attributeId,
16
- library: libraryId,
17
- recordFilters,
18
- },
19
- });
20
- }
21
- }, [attributeId, libraryId, recordFilters]);
22
- const noValueCount = useMemo(() => {
23
- if (!valuesOccurrences) {
24
- return 0;
25
- }
26
- return valuesOccurrences.listDistinctValues?.find(v => !('treeNode' in v) || v.treeNode === null)?.count || 0;
27
- }, [valuesOccurrences]);
28
- const occurrences = useMemo(() => {
29
- if (!valuesOccurrences) {
30
- return [];
31
- }
32
- return (valuesOccurrences.listDistinctValues
33
- ?.filter(v => 'treeNode' in v && v.treeNode !== null)
34
- .map(v => ({ count: v.count, value: { id: v.treeNode.id } })) || []);
35
- }, [valuesOccurrences]);
36
- return {
37
- occurrences,
38
- noValueCount,
39
- loading,
40
- };
41
- };
42
- //# sourceMappingURL=useCountValuesOccurrencesHook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCountValuesOccurrencesHook.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,kCAAkC,EAAC,MAAM,eAAe,CAAC;AACzF,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAQzC,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,EAC1C,WAAW,EACX,SAAS,EACT,aAAa,GAKhB,EAAqB,EAAE;IACpB,MAAM,CAAC,sBAAsB,EAAE,EAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAC,CAAC,GAAG,kCAAkC,CAAC;QACpG,WAAW,EAAE,UAAU;QACvB,eAAe,EAAE,UAAU;KAC9B,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,WAAW,EAAE,CAAC;YACd,sBAAsB,CAAC;gBACnB,SAAS,EAAE;oBACP,SAAS,EAAE,WAAW;oBACtB,OAAO,EAAE,SAAS;oBAClB,aAAa;iBAChB;aACJ,CAAC,CAAC;QACP,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;IAE5C,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE;QAC9B,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACrB,OAAO,CAAC,CAAC;QACb,CAAC;QACD,OAAO,iBAAiB,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;IAClH,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE;QAC7B,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACrB,OAAO,EAAE,CAAC;QACd,CAAC;QACD,OAAO,CACH,iBAAiB,CAAC,kBAAkB;YAChC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC;aACpD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAC,EAAE,EAAG,CAA8B,CAAC,QAAQ,CAAC,EAAE,EAAC,EAAC,CAAC,CAAC,IAAI,EAAE,CACpG,CAAC;IACN,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,OAAO;QACH,WAAW;QACX,YAAY;QACZ,OAAO;KACV,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type RecordFilterInput, useCountValuesOccurrencesLazyQuery} from '_ui/_gqlTypes';\nimport {useEffect, useMemo} from 'react';\n\nexport type ValuesOccurrences = {\n noValueCount: number;\n occurrences: Array<{count: number; value: {id: string}}>;\n loading?: boolean;\n};\nexport type ValueOccurrence = ValuesOccurrences['occurrences'][0];\nexport const useCountValuesOccurrencesHook = ({\n attributeId,\n libraryId,\n recordFilters,\n}: {\n attributeId?: string;\n libraryId: string;\n recordFilters: RecordFilterInput[];\n}): ValuesOccurrences => {\n const [countValuesOccurrences, {data: valuesOccurrences, loading}] = useCountValuesOccurrencesLazyQuery({\n fetchPolicy: 'no-cache',\n nextFetchPolicy: 'no-cache',\n });\n\n useEffect(() => {\n if (attributeId) {\n countValuesOccurrences({\n variables: {\n attribute: attributeId,\n library: libraryId,\n recordFilters,\n },\n });\n }\n }, [attributeId, libraryId, recordFilters]);\n\n const noValueCount = useMemo(() => {\n if (!valuesOccurrences) {\n return 0;\n }\n return valuesOccurrences.listDistinctValues?.find(v => !('treeNode' in v) || v.treeNode === null)?.count || 0;\n }, [valuesOccurrences]);\n\n const occurrences = useMemo(() => {\n if (!valuesOccurrences) {\n return [];\n }\n return (\n valuesOccurrences.listDistinctValues\n ?.filter(v => 'treeNode' in v && v.treeNode !== null)\n .map(v => ({count: v.count, value: {id: (v as {treeNode: {id: string}}).treeNode.id}})) || []\n );\n }, [valuesOccurrences]);\n\n return {\n occurrences,\n noValueCount,\n loading,\n };\n};\n"]}
@@ -1,5 +0,0 @@
1
- import { type AttributeDetailsTreeAttributeFragment } from '../../../../_gqlTypes';
2
- export type EditableAttributes = AttributeDetailsTreeAttributeFragment[];
3
- export declare const useListEditableAttributeHook: ({ libraryId }: {
4
- libraryId: string;
5
- }) => EditableAttributes;
@@ -1,20 +0,0 @@
1
- // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
2
- // This file is released under LGPL V3
3
- // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
4
- import { AttributeType } from '../../../../_gqlTypes';
5
- import { useMemo } from 'react';
6
- import { useAttributeDetailsData } from '../../manage-view-settings/_shared/useAttributeDetailsData';
7
- export const useListEditableAttributeHook = ({ libraryId }) => {
8
- const { attributeDetailsById } = useAttributeDetailsData(libraryId);
9
- const treeMonoValuedAttributes = useMemo(() => Object.values(attributeDetailsById).filter(attr => {
10
- const dependenciesTreeAttributes = ('permissions_conf_dependent_values' in attr &&
11
- attr.permissions_conf_dependent_values?.dependenciesTreeAttributes) ||
12
- [];
13
- const dependentOnItself = dependenciesTreeAttributes.length === 1 && dependenciesTreeAttributes[0].id === attr.id;
14
- return (attr.type === AttributeType.tree &&
15
- !attr.multiple_values &&
16
- (dependenciesTreeAttributes.length === 0 || dependentOnItself));
17
- }), [attributeDetailsById]);
18
- return treeMonoValuedAttributes;
19
- };
20
- //# sourceMappingURL=useListEditableAttributeHook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useListEditableAttributeHook.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA6C,aAAa,EAAC,MAAM,eAAe,CAAC;AACxF,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,uBAAuB,EAAC,MAAM,4DAA4D,CAAC;AAGnG,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAAC,SAAS,EAAsB,EAAsB,EAAE;IACjG,MAAM,EAAC,oBAAoB,EAAC,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAClE,MAAM,wBAAwB,GAA4C,OAAO,CAC7E,GAAG,EAAE,CACD,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC9C,MAAM,0BAA0B,GAC5B,CAAC,mCAAmC,IAAI,IAAI;YACxC,IAAI,CAAC,iCAAiC,EAAE,0BAA0B,CAAC;YACvE,EAAE,CAAC;QACP,MAAM,iBAAiB,GACnB,0BAA0B,CAAC,MAAM,KAAK,CAAC,IAAI,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC5F,OAAO,CACH,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI;YAChC,CAAC,IAAI,CAAC,eAAe;YACrB,CAAC,0BAA0B,CAAC,MAAM,KAAK,CAAC,IAAI,iBAAiB,CAAC,CACjE,CAAC;IACN,CAAC,CAAC,EACN,CAAC,oBAAoB,CAAC,CACzB,CAAC;IAEF,OAAO,wBAAwB,CAAC;AACpC,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type AttributeDetailsTreeAttributeFragment, AttributeType} from '_ui/_gqlTypes';\nimport {useMemo} from 'react';\nimport {useAttributeDetailsData} from '../../manage-view-settings/_shared/useAttributeDetailsData';\n\nexport type EditableAttributes = AttributeDetailsTreeAttributeFragment[];\nexport const useListEditableAttributeHook = ({libraryId}: {libraryId: string}): EditableAttributes => {\n const {attributeDetailsById} = useAttributeDetailsData(libraryId);\n const treeMonoValuedAttributes: AttributeDetailsTreeAttributeFragment[] = useMemo(\n () =>\n Object.values(attributeDetailsById).filter(attr => {\n const dependenciesTreeAttributes =\n ('permissions_conf_dependent_values' in attr &&\n attr.permissions_conf_dependent_values?.dependenciesTreeAttributes) ||\n [];\n const dependentOnItself =\n dependenciesTreeAttributes.length === 1 && dependenciesTreeAttributes[0].id === attr.id;\n return (\n attr.type === AttributeType.tree &&\n !attr.multiple_values &&\n (dependenciesTreeAttributes.length === 0 || dependentOnItself)\n );\n }),\n [attributeDetailsById],\n );\n\n return treeMonoValuedAttributes;\n};\n"]}
@@ -1,12 +0,0 @@
1
- import { type AttributeDetailsTreeAttributeFragment } from '../../../../_gqlTypes';
2
- export interface ITreeAttributeNodeValue {
3
- id: string | null;
4
- label: string;
5
- color?: string | null;
6
- allowedDependentValues?: Array<{
7
- nodeId?: string | null;
8
- }> | null;
9
- }
10
- export declare const useListTreeAttributeValuesHook: ({ treeAttribute: treeAttribute, }: {
11
- treeAttribute: AttributeDetailsTreeAttributeFragment;
12
- }) => ITreeAttributeNodeValue[];
@@ -1,30 +0,0 @@
1
- // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
2
- // This file is released under LGPL V3
3
- // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
4
- import { useAttributeWithValuesForMassEditionLazyQuery } from '../../../../_gqlTypes';
5
- import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
6
- import { useEffect, useMemo } from 'react';
7
- export const useListTreeAttributeValuesHook = ({ treeAttribute: treeAttribute, }) => {
8
- const { t } = useSharedTranslation();
9
- const [loadValues, { data: treeContent }] = useAttributeWithValuesForMassEditionLazyQuery();
10
- useEffect(() => {
11
- if (!treeAttribute.linked_tree) {
12
- throw new Error('Fatal: selected attribute not found');
13
- }
14
- loadValues({
15
- fetchPolicy: 'no-cache',
16
- variables: {
17
- attributeId: treeAttribute.id,
18
- },
19
- });
20
- }, [treeAttribute]);
21
- return useMemo(() => treeContent?.attributes?.list[0]?.tree_values?.map(treeValue => ({
22
- id: treeValue.node?.id || null,
23
- label: treeValue.node?.record.whoAmI.label ||
24
- treeValue.node?.record.whoAmI.id ||
25
- t('explorer.massAction.editAttribute_value_undefined'),
26
- color: treeValue.node?.record.whoAmI.color,
27
- allowedDependentValues: treeValue.allowedDependentValues || null,
28
- })) || [], [treeContent]);
29
- };
30
- //# sourceMappingURL=useListTreeAttributeValuesHook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useListTreeAttributeValuesHook.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,6CAA6C,EAA6C,MAAM,eAAe,CAAC;AACxH,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AASzC,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,EAC3C,aAAa,EAAE,aAAa,GAG/B,EAA6B,EAAE;IAC5B,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,UAAU,EAAE,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,GAAG,6CAA6C,EAAE,CAAC;IAE1F,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC3D,CAAC;QACD,UAAU,CAAC;YACP,WAAW,EAAE,UAAU;YACvB,SAAS,EAAE;gBACP,WAAW,EAAE,aAAa,CAAC,EAAE;aAChC;SACJ,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,OAAO,CACV,GAAG,EAAE,CACD,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC7D,EAAE,EAAE,SAAS,CAAC,IAAI,EAAE,EAAE,IAAI,IAAI;QAC9B,KAAK,EACD,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;YACnC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;YAChC,CAAC,CAAC,mDAAmD,CAAC;QAC1D,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;QAC1C,sBAAsB,EAAE,SAAS,CAAC,sBAAsB,IAAI,IAAI;KACnE,CAAC,CAAC,IAAI,EAAE,EACb,CAAC,WAAW,CAAC,CAChB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useAttributeWithValuesForMassEditionLazyQuery, type AttributeDetailsTreeAttributeFragment} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useEffect, useMemo} from 'react';\n\nexport interface ITreeAttributeNodeValue {\n id: string | null;\n label: string;\n color?: string | null;\n allowedDependentValues?: Array<{nodeId?: string | null}> | null;\n}\n\nexport const useListTreeAttributeValuesHook = ({\n treeAttribute: treeAttribute,\n}: {\n treeAttribute: AttributeDetailsTreeAttributeFragment;\n}): ITreeAttributeNodeValue[] => {\n const {t} = useSharedTranslation();\n const [loadValues, {data: treeContent}] = useAttributeWithValuesForMassEditionLazyQuery();\n\n useEffect(() => {\n if (!treeAttribute.linked_tree) {\n throw new Error('Fatal: selected attribute not found');\n }\n loadValues({\n fetchPolicy: 'no-cache',\n variables: {\n attributeId: treeAttribute.id,\n },\n });\n }, [treeAttribute]);\n\n return useMemo(\n () =>\n treeContent?.attributes?.list[0]?.tree_values?.map(treeValue => ({\n id: treeValue.node?.id || null,\n label:\n treeValue.node?.record.whoAmI.label ||\n treeValue.node?.record.whoAmI.id ||\n t('explorer.massAction.editAttribute_value_undefined'),\n color: treeValue.node?.record.whoAmI.color,\n allowedDependentValues: treeValue.allowedDependentValues || null,\n })) || [],\n [treeContent],\n );\n};\n"]}