@leav/ui 1.5.1 → 1.5.2-3483df5d

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 (108) hide show
  1. package/dist/__mocks__/common/attribute.js +1 -0
  2. package/dist/__mocks__/common/attribute.js.map +1 -1
  3. package/dist/_gqlTypes/index.d.ts +117 -18
  4. package/dist/_gqlTypes/index.js +88 -0
  5. package/dist/_gqlTypes/index.js.map +1 -1
  6. package/dist/_queries/attributes/attributeDetailsFragment.js +1 -0
  7. package/dist/_queries/attributes/attributeDetailsFragment.js.map +1 -1
  8. package/dist/components/Explorer/DataView.d.ts +1 -0
  9. package/dist/components/Explorer/DataView.js +9 -3
  10. package/dist/components/Explorer/DataView.js.map +1 -1
  11. package/dist/components/Explorer/Explorer.d.ts +2 -1
  12. package/dist/components/Explorer/Explorer.js +19 -4
  13. package/dist/components/Explorer/Explorer.js.map +1 -1
  14. package/dist/components/Explorer/TableNameCell.js +1 -1
  15. package/dist/components/Explorer/TableNameCell.js.map +1 -1
  16. package/dist/components/Explorer/_queries/useExplorerData.js +13 -2
  17. package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
  18. package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.d.ts +13 -0
  19. package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js +20 -0
  20. package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js.map +1 -0
  21. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.d.ts +10 -0
  22. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js +38 -0
  23. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js.map +1 -0
  24. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.d.ts +8 -0
  25. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js +16 -0
  26. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js.map +1 -0
  27. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.d.ts +10 -0
  28. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js +28 -0
  29. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js.map +1 -0
  30. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.d.ts +5 -0
  31. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js +12 -0
  32. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js.map +1 -0
  33. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.d.ts +5 -0
  34. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js +20 -0
  35. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js.map +1 -0
  36. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.d.ts +11 -0
  37. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +106 -0
  38. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -0
  39. package/dist/components/Explorer/actions-mass/useExportMassAction.js +11 -13
  40. package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
  41. package/dist/components/Explorer/link-item/LinkModal.js +1 -1
  42. package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
  43. package/dist/components/Filters/context/filtersReducer.js +0 -1
  44. package/dist/components/Filters/context/filtersReducer.js.map +1 -1
  45. package/dist/components/Filters/filter-items/filter-type/TextAttributeDropDown.js +24 -7
  46. package/dist/components/Filters/filter-items/filter-type/TextAttributeDropDown.js.map +1 -1
  47. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js +15 -17
  48. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -1
  49. package/dist/components/Filters/prepareFiltersForRequest.js +1 -1
  50. package/dist/components/Filters/prepareFiltersForRequest.js.map +1 -1
  51. package/dist/components/RecordEdition/EditRecordContent/antdUtils.js +12 -3
  52. package/dist/components/RecordEdition/EditRecordContent/antdUtils.js.map +1 -1
  53. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +4 -1
  54. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
  55. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +6 -3
  56. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
  57. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js +6 -5
  58. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js.map +1 -1
  59. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js +9 -8
  60. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js.map +1 -1
  61. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js +8 -7
  62. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js.map +1 -1
  63. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js +6 -5
  64. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js.map +1 -1
  65. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js +6 -5
  66. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js.map +1 -1
  67. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js +12 -11
  68. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js.map +1 -1
  69. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js +16 -7
  70. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js.map +1 -1
  71. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js +6 -5
  72. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js.map +1 -1
  73. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.d.ts +3 -3
  74. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.js +10 -4
  75. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.js.map +1 -1
  76. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +4 -1
  77. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
  78. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +4 -5
  79. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
  80. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js +2 -2
  81. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -1
  82. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.d.ts +24 -24
  83. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.js +34 -35
  84. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.js.map +1 -1
  85. package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js +1 -1
  86. package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js.map +1 -1
  87. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.d.ts +1 -1
  88. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +15 -10
  89. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
  90. package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.d.ts +1 -1
  91. package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js +4 -3
  92. package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js.map +1 -1
  93. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +1 -0
  94. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +40 -19
  95. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
  96. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +3 -0
  97. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
  98. package/dist/constants.d.ts +1 -0
  99. package/dist/constants.js +1 -0
  100. package/dist/constants.js.map +1 -1
  101. package/dist/hooks/useIFrameMessenger/schema.d.ts +43 -4
  102. package/dist/hooks/useIFrameMessenger/schema.js +11 -5
  103. package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
  104. package/dist/hooks/useIFrameMessenger/types.d.ts +2 -1
  105. package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
  106. package/dist/locales/en/shared.json +20 -7
  107. package/dist/locales/fr/shared.json +20 -7
  108. package/package.json +4 -4
@@ -0,0 +1,38 @@
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 = ({ selectedAttribute, treeNodeValues, valueOccurrenceNodeId, valueOccurrenceCount, setAttributeMapping }) => {
14
+ const { t } = useSharedTranslation();
15
+ const treeNodeValueOfOccurrence = valueOccurrenceNodeId
16
+ ? treeNodeValues.find(node => node.id === valueOccurrenceNodeId)
17
+ : null;
18
+ const selectOptions = treeNodeValues
19
+ .filter(treeNode => treeNode.id !== valueOccurrenceNodeId)
20
+ .map(treeNode => ({
21
+ label: treeNode.record.whoAmI.label || treeNode.record.whoAmI.id,
22
+ value: treeNode.id,
23
+ }))
24
+ .concat(selectedAttribute.required || !treeNodeValueOfOccurrence
25
+ ? []
26
+ : [
27
+ {
28
+ label: t('explorer.massAction.editAttribute_value_undefined'),
29
+ value: UNDEFINED_VALUE,
30
+ },
31
+ ]);
32
+ return (_jsxs(DivContainer, { children: [treeNodeValueOfOccurrence ? (_jsx(KitIdCard, { title: treeNodeValueOfOccurrence.record.whoAmI.label, color: treeNodeValueOfOccurrence.record.whoAmI.color || DEFAULT_ID_CARD_COLOR })) : (_jsx(KitIdCard, { title: t('explorer.massAction.editAttribute_value_undefined'), color: DEFAULT_ID_CARD_COLOR })), _jsx(KitTypography.Text, { children: t('explorer.massAction.editAttribute_value_occurrences_to_edit', {
33
+ count: valueOccurrenceCount,
34
+ }) }), _jsx(KitSelect, { options: selectOptions, size: "middle", allowClear: false, placeholder: t('explorer.massAction.editAttribute_value_select_placeholder'), onChange: value => {
35
+ setAttributeMapping(valueOccurrenceNodeId, value === UNDEFINED_VALUE ? null : value || null);
36
+ } })] }));
37
+ };
38
+ //# sourceMappingURL=EditTreeAttributeValueLine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditTreeAttributeValueLine.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/E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C;IAEN,OAAO,CACH,MAAC,YAAY,eACR,yBAAyB,CAAC,CAAC,CAAC,CACzB,KAAC,SAAS,IACN,KAAK,EAAE,yBAAyB,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EACpD,KAAK,EAAE,yBAAyB,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,qBAAqB,GAC/E,CACL,CAAC,CAAC,CAAC,CACA,KAAC,SAAS,IACN,KAAK,EAAE,CAAC,CAAC,mDAAmD,CAAC,EAC7D,KAAK,EAAE,qBAAqB,GAC9B,CACL,EACD,KAAC,aAAa,CAAC,IAAI,cACd,CAAC,CAAC,6DAA6D,EAAE;oBAC9D,KAAK,EAAE,oBAAoB;iBAC9B,CAAC,GACe,EACrB,KAAC,SAAS,IACN,OAAO,EAAE,aAAa,EACtB,IAAI,EAAC,QAAQ,EACb,UAAU,EAAE,KAAK,EACjB,WAAW,EAAE,CAAC,CAAC,4DAA4D,CAAC,EAC5E,QAAQ,EAAE,KAAK,CAAC,EAAE;oBACd,mBAAmB,CAAC,qBAAqB,EAAE,KAAK,KAAK,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;gBACjG,CAAC,GACH,IACS,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type AttributeDetailsTreeAttributeFragment} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitIdCard, KitSelect, KitTypography} from 'aristid-ds';\nimport {type FunctionComponent} from 'react';\nimport styled from 'styled-components';\nimport {type TreeAttributeNodeValue} from './useListTreeAttributeValuesHook';\n\nconst DivContainer = styled.div`\n display: grid;\n align-items: center;\n grid-template-columns: repeat(3, 1fr);\n grid-column-gap: calc(var(--general-spacing-l) * 1px);\n`;\n\nconst UNDEFINED_VALUE = '__null__';\nconst DEFAULT_ID_CARD_COLOR = 'rgba(200, 200, 200, 1)';\n\nexport const EditTreeAttributeValueLine: FunctionComponent<{\n treeNodeValues: TreeAttributeNodeValue[];\n selectedAttribute: AttributeDetailsTreeAttributeFragment;\n valueOccurrenceNodeId: string | null;\n valueOccurrenceCount: number;\n setAttributeMapping: (before: string | null, after: string | null) => void;\n}> = ({selectedAttribute, treeNodeValues, valueOccurrenceNodeId, valueOccurrenceCount, setAttributeMapping}) => {\n const {t} = useSharedTranslation();\n\n const treeNodeValueOfOccurrence = valueOccurrenceNodeId\n ? treeNodeValues.find(node => node.id === valueOccurrenceNodeId)\n : null;\n\n const selectOptions = treeNodeValues\n .filter(treeNode => treeNode.id !== valueOccurrenceNodeId)\n .map(treeNode => ({\n label: treeNode.record.whoAmI.label || treeNode.record.whoAmI.id,\n value: treeNode.id,\n }))\n .concat(\n selectedAttribute.required || !treeNodeValueOfOccurrence\n ? []\n : [\n {\n label: t('explorer.massAction.editAttribute_value_undefined'),\n value: UNDEFINED_VALUE,\n },\n ],\n );\n\n return (\n <DivContainer>\n {treeNodeValueOfOccurrence ? (\n <KitIdCard\n title={treeNodeValueOfOccurrence.record.whoAmI.label}\n color={treeNodeValueOfOccurrence.record.whoAmI.color || DEFAULT_ID_CARD_COLOR}\n />\n ) : (\n <KitIdCard\n title={t('explorer.massAction.editAttribute_value_undefined')}\n color={DEFAULT_ID_CARD_COLOR}\n />\n )}\n <KitTypography.Text>\n {t('explorer.massAction.editAttribute_value_occurrences_to_edit', {\n count: valueOccurrenceCount,\n })}\n </KitTypography.Text>\n <KitSelect\n options={selectOptions}\n size=\"middle\"\n allowClear={false}\n placeholder={t('explorer.massAction.editAttribute_value_select_placeholder')}\n onChange={value => {\n setAttributeMapping(valueOccurrenceNodeId, value === UNDEFINED_VALUE ? null : value || null);\n }}\n />\n </DivContainer>\n );\n};\n"]}
@@ -0,0 +1,8 @@
1
+ import { type AttributeDetailsTreeAttributeFragment } from '../../../../_gqlTypes';
2
+ import { type FunctionComponent } from 'react';
3
+ import { type ValuesOccurrences } from './useCountValuesOccurrencesHook';
4
+ export declare const EditTreeAttributeValuesMapping: FunctionComponent<{
5
+ selectedAttribute: AttributeDetailsTreeAttributeFragment;
6
+ valuesOccurrences: ValuesOccurrences;
7
+ setAttributeMapping: (before: string | null, after: string | null) => void;
8
+ }>;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { KitSpace } from 'aristid-ds';
3
+ import { useListTreeAttributeValuesHook } from './useListTreeAttributeValuesHook';
4
+ import { EditTreeAttributeValueLine } from './EditTreeAttributeValueLine';
5
+ export const EditTreeAttributeValuesMapping = ({ selectedAttribute, valuesOccurrences, setAttributeMapping }) => {
6
+ const treeAttributeValues = useListTreeAttributeValuesHook({ treeAttribute: selectedAttribute });
7
+ const { occurrences, noValueCount } = valuesOccurrences;
8
+ return (_jsxs(KitSpace, { direction: "vertical", size: "xs", style: { display: 'flex' }, children: [treeAttributeValues.map((nodeForOccurrence, index) => {
9
+ const occurrence = occurrences.find(occ => occ.value.id === nodeForOccurrence.id);
10
+ if (!occurrence) {
11
+ return null;
12
+ }
13
+ return (_jsx(EditTreeAttributeValueLine, { treeNodeValues: treeAttributeValues, selectedAttribute: selectedAttribute, valueOccurrenceNodeId: occurrence.value.id, valueOccurrenceCount: occurrence.count, setAttributeMapping: setAttributeMapping }, index));
14
+ }), noValueCount > 0 && (_jsx(EditTreeAttributeValueLine, { treeNodeValues: treeAttributeValues, selectedAttribute: selectedAttribute, valueOccurrenceNodeId: null, valueOccurrenceCount: noValueCount, setAttributeMapping: setAttributeMapping }))] }));
15
+ };
16
+ //# sourceMappingURL=EditTreeAttributeValuesMapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditTreeAttributeValuesMapping.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.ts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C3B,oBAAoB,EAAE,YAAY,EAClC,mBAAmB,EAAE,mBAAmB,GAC1C,CACL,IACM,CACd,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type AttributeDetailsTreeAttributeFragment} from '_ui/_gqlTypes';\nimport {KitSpace} from 'aristid-ds';\nimport {type FunctionComponent} from 'react';\nimport {type ValuesOccurrences} from './useCountValuesOccurrencesHook';\nimport {useListTreeAttributeValuesHook} from './useListTreeAttributeValuesHook';\nimport {EditTreeAttributeValueLine} from './EditTreeAttributeValueLine';\n\nexport const EditTreeAttributeValuesMapping: FunctionComponent<{\n selectedAttribute: AttributeDetailsTreeAttributeFragment;\n valuesOccurrences: ValuesOccurrences;\n setAttributeMapping: (before: string | null, after: string | null) => void;\n}> = ({selectedAttribute, valuesOccurrences, setAttributeMapping}) => {\n const treeAttributeValues = useListTreeAttributeValuesHook({treeAttribute: selectedAttribute});\n const {occurrences, noValueCount} = valuesOccurrences;\n\n return (\n <KitSpace direction=\"vertical\" size=\"xs\" style={{display: 'flex'}}>\n {treeAttributeValues.map((nodeForOccurrence, index) => {\n const occurrence = occurrences.find(occ => occ.value.id === nodeForOccurrence.id);\n if (!occurrence) {\n return null;\n }\n return (\n <EditTreeAttributeValueLine\n key={index}\n treeNodeValues={treeAttributeValues}\n selectedAttribute={selectedAttribute}\n valueOccurrenceNodeId={occurrence.value.id}\n valueOccurrenceCount={occurrence.count}\n setAttributeMapping={setAttributeMapping}\n />\n );\n })}\n {noValueCount > 0 && (\n <EditTreeAttributeValueLine\n treeNodeValues={treeAttributeValues}\n selectedAttribute={selectedAttribute}\n valueOccurrenceNodeId={null}\n valueOccurrenceCount={noValueCount}\n setAttributeMapping={setAttributeMapping}\n />\n )}\n </KitSpace>\n );\n};\n"]}
@@ -0,0 +1,10 @@
1
+ import { type CountValuesOccurrencesQuery, type RecordFilterInput } from '../../../../_gqlTypes';
2
+ export type ValuesOccurrences = NonNullable<CountValuesOccurrencesQuery['countValuesOccurrences']> & {
3
+ loading?: boolean;
4
+ };
5
+ export type ValueOccurrence = ValuesOccurrences['occurrences'][0];
6
+ export declare const useCountValuesOccurrencesHook: ({ attributeId, libraryId, recordFilters, }: {
7
+ attributeId?: string;
8
+ libraryId: string;
9
+ recordFilters: RecordFilterInput[];
10
+ }) => ValuesOccurrences;
@@ -0,0 +1,28 @@
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 } 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
+ return {
23
+ occurrences: valuesOccurrences?.countValuesOccurrences?.occurrences || [],
24
+ noValueCount: valuesOccurrences?.countValuesOccurrences?.noValueCount || 0,
25
+ loading,
26
+ };
27
+ };
28
+ //# sourceMappingURL=useCountValuesOccurrencesHook.js.map
@@ -0,0 +1 @@
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,EAGH,kCAAkC,GACrC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAMhC,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,OAAO;QACH,WAAW,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,WAAW,IAAI,EAAE;QACzE,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,YAAY,IAAI,CAAC;QAC1E,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 {\n type CountValuesOccurrencesQuery,\n type RecordFilterInput,\n useCountValuesOccurrencesLazyQuery,\n} from '_ui/_gqlTypes';\nimport {useEffect} from 'react';\n\nexport type ValuesOccurrences = NonNullable<CountValuesOccurrencesQuery['countValuesOccurrences']> & {\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 return {\n occurrences: valuesOccurrences?.countValuesOccurrences?.occurrences || [],\n noValueCount: valuesOccurrences?.countValuesOccurrences?.noValueCount || 0,\n loading,\n };\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import { type AttributeDetailsTreeAttributeFragment } from '../../../../_gqlTypes';
2
+ export type EditableAttributes = AttributeDetailsTreeAttributeFragment[];
3
+ export declare const useListEditableAttributeHook: ({ libraryId }: {
4
+ libraryId: string;
5
+ }) => EditableAttributes;
@@ -0,0 +1,12 @@
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 => attr.type === AttributeType.tree && !attr.multiple_values), [attributeDetailsById]);
10
+ return treeMonoValuedAttributes;
11
+ };
12
+ //# sourceMappingURL=useListEditableAttributeHook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useListEditableAttributeHook.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA6C,aAAa,EAAC,MAAM,eAAe,CAAC;AACxF,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,uBAAuB,EAAC,MAAM,4DAA4D,CAAC;AAGnG,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAAC,SAAS,EAAsB,EAAsB,EAAE;IACjG,MAAM,EAAC,oBAAoB,EAAC,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAClE,MAAM,wBAAwB,GAA4C,OAAO,CAC7E,GAAG,EAAE,CACD,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,MAAM,CACtC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,CACpE,EACL,CAAC,oBAAoB,CAAC,CACzB,CAAC;IAEF,OAAO,wBAAwB,CAAC;AACpC,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type AttributeDetailsTreeAttributeFragment, AttributeType} from '_ui/_gqlTypes';\nimport {useMemo} from 'react';\nimport {useAttributeDetailsData} from '../../manage-view-settings/_shared/useAttributeDetailsData';\n\nexport type EditableAttributes = AttributeDetailsTreeAttributeFragment[];\nexport const useListEditableAttributeHook = ({libraryId}: {libraryId: string}): EditableAttributes => {\n const {attributeDetailsById} = useAttributeDetailsData(libraryId);\n const treeMonoValuedAttributes: AttributeDetailsTreeAttributeFragment[] = useMemo(\n () =>\n Object.values(attributeDetailsById).filter(\n attr => attr.type === AttributeType.tree && !attr.multiple_values,\n ),\n [attributeDetailsById],\n );\n\n return treeMonoValuedAttributes;\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import { type AttributeDetailsTreeAttributeFragment, type TreeNodeChildrenQuery } from '../../../../_gqlTypes';
2
+ export type TreeAttributeNodeValue = TreeNodeChildrenQuery['treeNodeChildren']['list'][0];
3
+ export declare const useListTreeAttributeValuesHook: ({ treeAttribute: treeAttribute, }: {
4
+ treeAttribute: AttributeDetailsTreeAttributeFragment;
5
+ }) => TreeAttributeNodeValue[];
@@ -0,0 +1,20 @@
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 { useTreeNodeChildrenLazyQuery, } from '../../../../_gqlTypes';
5
+ import { useEffect } from 'react';
6
+ export const useListTreeAttributeValuesHook = ({ treeAttribute: treeAttribute, }) => {
7
+ const [loadTreeContent, { data: treeContent }] = useTreeNodeChildrenLazyQuery();
8
+ useEffect(() => {
9
+ if (!treeAttribute.linked_tree) {
10
+ throw new Error('Fatal: selected attribute not found');
11
+ }
12
+ loadTreeContent({
13
+ variables: {
14
+ treeId: treeAttribute.linked_tree.id,
15
+ },
16
+ });
17
+ }, [treeAttribute]);
18
+ return treeContent?.treeNodeChildren.list || [];
19
+ };
20
+ //# sourceMappingURL=useListTreeAttributeValuesHook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useListTreeAttributeValuesHook.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAGH,4BAA4B,GAC/B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAGhC,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,EAC3C,aAAa,EAAE,aAAa,GAG/B,EAA4B,EAAE;IAC3B,MAAM,CAAC,eAAe,EAAE,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,GAAG,4BAA4B,EAAE,CAAC;IAC9E,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC3D,CAAC;QACD,eAAe,CAAC;YACZ,SAAS,EAAE;gBACP,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,EAAE;aACvC;SACJ,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,WAAW,EAAE,gBAAgB,CAAC,IAAI,IAAI,EAAE,CAAC;AACpD,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {\n type AttributeDetailsTreeAttributeFragment,\n type TreeNodeChildrenQuery,\n useTreeNodeChildrenLazyQuery,\n} from '_ui/_gqlTypes';\nimport {useEffect} from 'react';\n\nexport type TreeAttributeNodeValue = TreeNodeChildrenQuery['treeNodeChildren']['list'][0];\nexport const useListTreeAttributeValuesHook = ({\n treeAttribute: treeAttribute,\n}: {\n treeAttribute: AttributeDetailsTreeAttributeFragment;\n}): TreeAttributeNodeValue[] => {\n const [loadTreeContent, {data: treeContent}] = useTreeNodeChildrenLazyQuery();\n useEffect(() => {\n if (!treeAttribute.linked_tree) {\n throw new Error('Fatal: selected attribute not found');\n }\n loadTreeContent({\n variables: {\n treeId: treeAttribute.linked_tree.id,\n },\n });\n }, [treeAttribute]);\n\n return treeContent?.treeNodeChildren.list || [];\n};\n"]}
@@ -0,0 +1,11 @@
1
+ import { type FeatureHook, type IMassActions } from '../_types';
2
+ import { type IViewSettingsState } from '../manage-view-settings';
3
+ export declare const useEditAttributeMassAction: ({ isEnabled, store: { view }, totalCount, }: FeatureHook<{
4
+ store: {
5
+ view: IViewSettingsState;
6
+ };
7
+ totalCount: number;
8
+ }>) => {
9
+ editAttributeMassAction: IMassActions;
10
+ editAttributeMassActionModal: JSX.Element;
11
+ };
@@ -0,0 +1,106 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
3
+ // This file is released under LGPL V3
4
+ // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
+ import { AttributeType, useSaveValueBulkMutation, } from '../../../_gqlTypes';
6
+ import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
7
+ import { useEffect, useMemo, useState } from 'react';
8
+ import { FaEdit } from 'react-icons/fa';
9
+ import { MASS_SELECTION_ALL } from '../_constants';
10
+ import { EditTreeAttributeValuesMapping } from './edit-attribute/EditTreeAttributeValuesMapping';
11
+ import { EditAttributeMassActionModal } from './edit-attribute/EditAttributeMassActionModal';
12
+ import { useListEditableAttributeHook } from './edit-attribute/useListEditableAttributeHook';
13
+ import { useCountValuesOccurrencesHook } from './edit-attribute/useCountValuesOccurrencesHook';
14
+ import { KitAlert, useKitNotification } from 'aristid-ds';
15
+ import { ERROR_ALERT_DURATION, INFO_NOTIFICATION_DURATION_SECONDS } from '../../../constants';
16
+ import { Loading } from '../../../components/Loading';
17
+ export const useEditAttributeMassAction = ({ isEnabled, store: { view }, totalCount, }) => {
18
+ if (!isEnabled) {
19
+ return {
20
+ editAttributeMassAction: null,
21
+ editAttributeMassActionModal: null,
22
+ };
23
+ }
24
+ const { t } = useSharedTranslation();
25
+ const { kitNotification } = useKitNotification();
26
+ const [selectedAttribute, setSelectedAttribute] = useState(undefined);
27
+ const [massSelectionFilter, setMassSelectionFilter] = useState([]);
28
+ const [openModal, setOpenModal] = useState(false);
29
+ const [editionMapping, setEditionMapping] = useState([]);
30
+ const editableAttributes = useListEditableAttributeHook({ libraryId: view.libraryId });
31
+ const valuesOccurrences = useCountValuesOccurrencesHook({
32
+ attributeId: selectedAttribute?.id,
33
+ libraryId: view.libraryId,
34
+ recordFilters: massSelectionFilter,
35
+ });
36
+ const [executeSaveValueBulk] = useSaveValueBulkMutation();
37
+ useEffect(() => {
38
+ setEditionMapping([]);
39
+ }, [selectedAttribute]);
40
+ const _editAttributeMassAction = useMemo(() => ({
41
+ label: t('explorer.massAction.editAttribute'),
42
+ icon: _jsx(FaEdit, {}),
43
+ deselectAll: false,
44
+ callback: _massSelectionFilter => {
45
+ setMassSelectionFilter(_massSelectionFilter);
46
+ setEditionMapping([]);
47
+ setOpenModal(true);
48
+ },
49
+ }), [t, view.massSelection]);
50
+ const closeModal = () => {
51
+ setOpenModal(false);
52
+ setMassSelectionFilter([]);
53
+ setSelectedAttribute(undefined);
54
+ setEditionMapping([]);
55
+ };
56
+ const isMappingCompleted = useMemo(() => valuesOccurrences.noValueCount === 0
57
+ ? editionMapping.length === valuesOccurrences.occurrences.length
58
+ : editionMapping.length === valuesOccurrences.occurrences.length + 1, // for undefined values
59
+ [editionMapping, valuesOccurrences]);
60
+ const bulkCounter = useMemo(() => (view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length), [view.massSelection, totalCount]);
61
+ const onOkButtonClick = async () => {
62
+ if (!selectedAttribute || !isMappingCompleted) {
63
+ return;
64
+ }
65
+ try {
66
+ await executeSaveValueBulk({
67
+ variables: {
68
+ libraryId: view.libraryId,
69
+ recordsFilters: massSelectionFilter,
70
+ attributeId: selectedAttribute.id,
71
+ mapValues: editionMapping,
72
+ },
73
+ });
74
+ closeModal();
75
+ kitNotification.info({
76
+ message: t('explorer.massAction.editAttribute_submit_notification_title'),
77
+ description: t('explorer.massAction.editAttribute_submit_notification_description', {
78
+ counter: bulkCounter,
79
+ }),
80
+ duration: INFO_NOTIFICATION_DURATION_SECONDS,
81
+ });
82
+ }
83
+ catch (error) {
84
+ KitAlert.error({
85
+ showIcon: true,
86
+ duration: ERROR_ALERT_DURATION,
87
+ message: t('error.error_occurred'),
88
+ description: t('explorer.massAction.editAttribute_submit_error'),
89
+ closable: true,
90
+ });
91
+ }
92
+ };
93
+ if (editableAttributes.length === 0) {
94
+ return {
95
+ editAttributeMassAction: null,
96
+ editAttributeMassActionModal: null,
97
+ };
98
+ }
99
+ return {
100
+ editAttributeMassAction: _editAttributeMassAction,
101
+ editAttributeMassActionModal: (_jsxs(EditAttributeMassActionModal, { isOpen: openModal, attributes: editableAttributes, setSelectedAttribute: setSelectedAttribute, massSelectionFilter: massSelectionFilter, elementsCount: bulkCounter, disableOkButton: !isMappingCompleted, onOkButtonClick: onOkButtonClick, onCancelButtonClick: closeModal, children: [selectedAttribute != null && valuesOccurrences.loading ? _jsx(Loading, {}) : null, selectedAttribute?.type === AttributeType.tree && (_jsx(EditTreeAttributeValuesMapping, { selectedAttribute: selectedAttribute, valuesOccurrences: valuesOccurrences, setAttributeMapping: (before, after) => {
102
+ setEditionMapping(editionMapping.filter(mapping => mapping.before !== before).concat([{ before, after }]));
103
+ } }))] })),
104
+ };
105
+ };
106
+ //# sourceMappingURL=useEditAttributeMassAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEditAttributeMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useEditAttributeMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAEH,aAAa,EAEb,wBAAwB,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACnD,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAC,8BAA8B,EAAC,MAAM,iDAAiD,CAAC;AAC/F,OAAO,EAAC,4BAA4B,EAAC,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAC,4BAA4B,EAAC,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAC,6BAA6B,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAC,QAAQ,EAAE,kBAAkB,EAAC,MAAM,YAAY,CA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C,mBAAmB,EAAE,UAAU,aAE9B,iBAAiB,IAAI,IAAI,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAC,OAAO,KAAG,CAAC,CAAC,CAAC,IAAI,EAC3E,iBAAiB,EAAE,IAAI,KAAK,aAAa,CAAC,IAAI,IAAI,CAC/C,KAAC,8BAA8B,IAC3B,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,mBAAmB,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;wBACnC,iBAAiB,CACb,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC,CACxF,CAAC;oBACN,CAAC,GACH,CACL,IAC0B,CAClC;KACJ,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 {\n type AttributeDetailsFragment,\n AttributeType,\n type RecordFilterInput,\n useSaveValueBulkMutation,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useEffect, useMemo, useState} from 'react';\nimport {FaEdit} from 'react-icons/fa';\nimport {MASS_SELECTION_ALL} from '../_constants';\nimport {type FeatureHook, type IMassActions} from '../_types';\nimport {type IViewSettingsState} from '../manage-view-settings';\nimport {EditTreeAttributeValuesMapping} from './edit-attribute/EditTreeAttributeValuesMapping';\nimport {EditAttributeMassActionModal} from './edit-attribute/EditAttributeMassActionModal';\nimport {useListEditableAttributeHook} from './edit-attribute/useListEditableAttributeHook';\nimport {useCountValuesOccurrencesHook} from './edit-attribute/useCountValuesOccurrencesHook';\nimport {KitAlert, useKitNotification} from 'aristid-ds';\nimport {ERROR_ALERT_DURATION, INFO_NOTIFICATION_DURATION_SECONDS} from '_ui/constants';\nimport {Loading} from '_ui/components/Loading';\n\nexport const useEditAttributeMassAction = ({\n isEnabled,\n store: {view},\n totalCount,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n };\n totalCount: number;\n}>) => {\n if (!isEnabled) {\n return {\n editAttributeMassAction: null,\n editAttributeMassActionModal: null,\n };\n }\n\n const {t} = useSharedTranslation();\n const {kitNotification} = useKitNotification();\n\n const [selectedAttribute, setSelectedAttribute] = useState<AttributeDetailsFragment | undefined>(undefined);\n const [massSelectionFilter, setMassSelectionFilter] = useState<RecordFilterInput[]>([]);\n const [openModal, setOpenModal] = useState<boolean>(false);\n const [editionMapping, setEditionMapping] = useState<Array<{before: string | null; after: string | null}>>([]);\n\n const editableAttributes = useListEditableAttributeHook({libraryId: view.libraryId});\n const valuesOccurrences = useCountValuesOccurrencesHook({\n attributeId: selectedAttribute?.id,\n libraryId: view.libraryId,\n recordFilters: massSelectionFilter,\n });\n\n const [executeSaveValueBulk] = useSaveValueBulkMutation();\n\n useEffect(() => {\n setEditionMapping([]);\n }, [selectedAttribute]);\n\n const _editAttributeMassAction: IMassActions = useMemo(\n () => ({\n label: t('explorer.massAction.editAttribute'),\n icon: <FaEdit />,\n deselectAll: false,\n callback: _massSelectionFilter => {\n setMassSelectionFilter(_massSelectionFilter);\n setEditionMapping([]);\n setOpenModal(true);\n },\n }),\n [t, view.massSelection],\n );\n\n const closeModal = () => {\n setOpenModal(false);\n setMassSelectionFilter([]);\n setSelectedAttribute(undefined);\n setEditionMapping([]);\n };\n\n const isMappingCompleted = useMemo(\n () =>\n valuesOccurrences.noValueCount === 0\n ? editionMapping.length === valuesOccurrences.occurrences.length\n : editionMapping.length === valuesOccurrences.occurrences.length + 1, // for undefined values\n [editionMapping, valuesOccurrences],\n );\n\n const bulkCounter = useMemo(\n () => (view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length),\n [view.massSelection, totalCount],\n );\n\n const onOkButtonClick = async () => {\n if (!selectedAttribute || !isMappingCompleted) {\n return;\n }\n try {\n await executeSaveValueBulk({\n variables: {\n libraryId: view.libraryId,\n recordsFilters: massSelectionFilter,\n attributeId: selectedAttribute.id,\n mapValues: editionMapping,\n },\n });\n\n closeModal();\n kitNotification.info({\n message: t('explorer.massAction.editAttribute_submit_notification_title'),\n description: t('explorer.massAction.editAttribute_submit_notification_description', {\n counter: bulkCounter,\n }),\n duration: INFO_NOTIFICATION_DURATION_SECONDS,\n });\n } catch (error) {\n KitAlert.error({\n showIcon: true,\n duration: ERROR_ALERT_DURATION,\n message: t('error.error_occurred'),\n description: t('explorer.massAction.editAttribute_submit_error'),\n closable: true,\n });\n }\n };\n\n if (editableAttributes.length === 0) {\n return {\n editAttributeMassAction: null,\n editAttributeMassActionModal: null,\n };\n }\n\n return {\n editAttributeMassAction: _editAttributeMassAction,\n editAttributeMassActionModal: (\n <EditAttributeMassActionModal\n isOpen={openModal}\n attributes={editableAttributes}\n setSelectedAttribute={setSelectedAttribute}\n massSelectionFilter={massSelectionFilter}\n elementsCount={bulkCounter}\n disableOkButton={!isMappingCompleted}\n onOkButtonClick={onOkButtonClick}\n onCancelButtonClick={closeModal}\n >\n {selectedAttribute != null && valuesOccurrences.loading ? <Loading /> : null}\n {selectedAttribute?.type === AttributeType.tree && (\n <EditTreeAttributeValuesMapping\n selectedAttribute={selectedAttribute}\n valuesOccurrences={valuesOccurrences}\n setAttributeMapping={(before, after) => {\n setEditionMapping(\n editionMapping.filter(mapping => mapping.before !== before).concat([{before, after}]),\n );\n }}\n />\n )}\n </EditAttributeMassActionModal>\n ),\n };\n};\n"]}
@@ -4,17 +4,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
5
  import { useMemo } from 'react';
6
6
  import { FaFileExport } from 'react-icons/fa';
7
- import { KitAlert, KitModal } from 'aristid-ds';
7
+ import { KitAlert, KitModal, useKitNotification } from 'aristid-ds';
8
8
  import { useExportLazyQuery } from '../../../_gqlTypes';
9
9
  import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
10
10
  import { BREAK_TWO_LINES, MASS_SELECTION_ALL } from '../_constants';
11
- import { ERROR_ALERT_DURATION, SUCCESS_ALERT_DURATION } from '../../../constants';
11
+ import { ERROR_ALERT_DURATION, INFO_NOTIFICATION_DURATION_SECONDS } from '../../../constants';
12
12
  /**
13
13
  * Hook that provides a mass action configuration for exporting selected or all items
14
14
  * from a view/data set
15
15
  */
16
16
  export const useExportMassAction = ({ isEnabled, store: { view, dispatch }, totalCount, onExport, }) => {
17
17
  const { t } = useSharedTranslation();
18
+ const { kitNotification } = useKitNotification();
18
19
  const [exportQuery] = useExportLazyQuery();
19
20
  const _exportMassAction = useMemo(() => ({
20
21
  label: t('explorer.massAction.export'),
@@ -39,7 +40,8 @@ export const useExportMassAction = ({ isEnabled, store: { view, dispatch }, tota
39
40
  onOk: async () => {
40
41
  const total = view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length;
41
42
  try {
42
- const { data, error } = await exportQuery({
43
+ const { error } = await exportQuery({
44
+ fetchPolicy: 'no-cache',
43
45
  variables: {
44
46
  library: view.libraryId,
45
47
  filters: massSelectionFilter,
@@ -53,15 +55,13 @@ export const useExportMassAction = ({ isEnabled, store: { view, dispatch }, tota
53
55
  errorWithExtensions.extensions = graphQLError?.extensions;
54
56
  throw errorWithExtensions;
55
57
  }
56
- KitAlert.success({
57
- showIcon: true,
58
- duration: SUCCESS_ALERT_DURATION,
59
- message: t('explorer.massAction.export_message', { count: total }),
58
+ kitNotification.info({
59
+ message: t('explorer.massAction.export_message'),
60
60
  description: t('explorer.massAction.export_description', {
61
61
  count: total,
62
62
  total,
63
63
  }),
64
- closable: true,
64
+ duration: INFO_NOTIFICATION_DURATION_SECONDS,
65
65
  });
66
66
  onExport?.(massSelectionFilter, view.massSelection);
67
67
  }
@@ -70,10 +70,8 @@ export const useExportMassAction = ({ isEnabled, store: { view, dispatch }, tota
70
70
  KitAlert.error({
71
71
  showIcon: true,
72
72
  duration: ERROR_ALERT_DURATION,
73
- message: t('error.error_occurred', { count: total }),
74
- description: t('explorer.massAction.export_config_error_description', {
75
- library: view.libraryId,
76
- }),
73
+ message: t('explorer.massAction.export_config_error_message'),
74
+ description: t('explorer.massAction.export_config_error_description'),
77
75
  closable: true,
78
76
  });
79
77
  }
@@ -81,7 +79,7 @@ export const useExportMassAction = ({ isEnabled, store: { view, dispatch }, tota
81
79
  KitAlert.error({
82
80
  showIcon: true,
83
81
  duration: ERROR_ALERT_DURATION,
84
- message: t('error.error_occurred'),
82
+ message: t('explorer.massAction.export_error_message'),
85
83
  description: t('explorer.massAction.export_error_description', { count: total }),
86
84
  closable: true,
87
85
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useExportMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useExportMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAE,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAChC,SAAS,EACT,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EACvB,UAAU,EACV,QAAQ,GAQV,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;I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C;gCACF,QAAQ,EAAE,IAAI;6BACjB,CAAC,CAAC;wBACP,CAAC;6BAAM,CAAC;4BACJ,QAAQ,CAAC,KAAK,CAAC;gCACX,QAAQ,EAAE,IAAI;gCACd,QAAQ,EAAE,oBAAoB;gCAC9B,OAAO,EAAE,CAAC,CAAC,sBAAsB,CAAC;gCAClC,WAAW,EAAE,CAAC,CAAC,8CAA8C,EAAE,EAAC,KAAK,EAAE,KAAK,EAAC,CAAC;gCAC9E,QAAQ,EAAE,IAAI;6BACjB,CAAC,CAAC;wBACP,CAAC;oBACL,CAAC;gBACL,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,EACF,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CACjE,CAAC;IAEF,OAAO;QACH,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI;KACzD,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type Dispatch, useMemo} from 'react';\nimport {FaFileExport} from 'react-icons/fa';\nimport {KitAlert, KitModal} from 'aristid-ds';\nimport {useExportLazyQuery} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type FeatureHook, type IMassActions} from '../_types';\nimport {type IViewSettingsAction, type IViewSettingsState, ViewSettingsActionTypes} from '../manage-view-settings';\nimport {BREAK_TWO_LINES, MASS_SELECTION_ALL} from '../_constants';\nimport {ERROR_ALERT_DURATION, SUCCESS_ALERT_DURATION} from '_ui/constants';\n\n/**\n * Hook that provides a mass action configuration for exporting selected or all items\n * from a view/data set\n */\nexport const useExportMassAction = ({\n isEnabled,\n store: {view, dispatch},\n totalCount,\n onExport,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n };\n totalCount: number;\n onExport?: IMassActions['callback'];\n}>) => {\n const {t} = useSharedTranslation();\n\n const [exportQuery] = useExportLazyQuery();\n\n const _exportMassAction: IMassActions = useMemo(\n () => ({\n label: t('explorer.massAction.export'),\n icon: <FaFileExport />,\n deselectAll: false,\n callback: massSelectionFilter => {\n KitModal.confirm({\n width: '100%',\n style: {content: {width: '90vw', maxWidth: '656px'}},\n icon: false,\n type: 'confirm',\n title:\n t('explorer.export_item', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) ?? undefined,\n content:\n t('explorer.export_item_description', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) +\n BREAK_TWO_LINES +\n t('global.are_you_sure'),\n okText: t('global.confirm') ?? undefined,\n cancelText: t('global.cancel') ?? undefined,\n onOk: async () => {\n const total =\n view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length;\n try {\n const {data, error} = await exportQuery({\n variables: {\n library: view.libraryId,\n filters: massSelectionFilter,\n profile: 'default', // Set 'default' by default, it'll change when we can select a profile from the UI\n },\n });\n if (error) {\n // Preserve the extensions property which contains the error code\n const graphQLError = error.graphQLErrors?.[0];\n const errorWithExtensions = new Error(error.message);\n (errorWithExtensions as any).extensions = graphQLError?.extensions;\n throw errorWithExtensions;\n }\n\n KitAlert.success({\n showIcon: true,\n duration: SUCCESS_ALERT_DURATION,\n message: t('explorer.massAction.export_message', {count: total}),\n description: t('explorer.massAction.export_description', {\n count: total,\n total,\n }),\n closable: true,\n });\n onExport?.(massSelectionFilter, view.massSelection);\n } catch (e) {\n if (e.extensions?.code === 'CUSTOM_CONFIG_ERROR') {\n KitAlert.error({\n showIcon: true,\n duration: ERROR_ALERT_DURATION,\n message: t('error.error_occurred', {count: total}),\n description: t('explorer.massAction.export_config_error_description', {\n library: view.libraryId,\n }),\n closable: true,\n });\n } else {\n KitAlert.error({\n showIcon: true,\n duration: ERROR_ALERT_DURATION,\n message: t('error.error_occurred'),\n description: t('explorer.massAction.export_error_description', {count: total}),\n closable: true,\n });\n }\n }\n },\n });\n },\n }),\n [t, exportQuery, view.massSelection, dispatch, view.libraryId],\n );\n\n return {\n exportMassAction: isEnabled ? _exportMassAction : null,\n };\n};\n"]}
1
+ {"version":3,"file":"useExportMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useExportMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAE,kCAAkC,EAAC,MAAM,eAAe,CAAC;AAEvF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAChC,SAAS,EACT,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EACvB,UAAU,EACV,QAAQ,GAQV,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,EAAC,eAAe,EAAC,GAAG,kBAAkB,EAAE,CAAC;IAE/C,MAAM,CAAC,WAAW,CAAC,GAAG,kBAAkB,EAAE,CAAC;IAE3C,MAAM,iBAAiB,GAAiB,OAAO,CAC3C,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,CAAC,CAAC,4BAA4B,CAAC;QACtC,IAAI,EAAE,KAAC,YAAY,K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AC;gBACL,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,EACF,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CACjE,CAAC;IAEF,OAAO;QACH,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI;KACzD,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type Dispatch, useMemo} from 'react';\nimport {FaFileExport} from 'react-icons/fa';\nimport {KitAlert, KitModal, useKitNotification} from 'aristid-ds';\nimport {useExportLazyQuery} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type FeatureHook, type IMassActions} from '../_types';\nimport {type IViewSettingsAction, type IViewSettingsState} from '../manage-view-settings';\nimport {BREAK_TWO_LINES, MASS_SELECTION_ALL} from '../_constants';\nimport {ERROR_ALERT_DURATION, INFO_NOTIFICATION_DURATION_SECONDS} from '_ui/constants';\n\n/**\n * Hook that provides a mass action configuration for exporting selected or all items\n * from a view/data set\n */\nexport const useExportMassAction = ({\n isEnabled,\n store: {view, dispatch},\n totalCount,\n onExport,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n };\n totalCount: number;\n onExport?: IMassActions['callback'];\n}>) => {\n const {t} = useSharedTranslation();\n const {kitNotification} = useKitNotification();\n\n const [exportQuery] = useExportLazyQuery();\n\n const _exportMassAction: IMassActions = useMemo(\n () => ({\n label: t('explorer.massAction.export'),\n icon: <FaFileExport />,\n deselectAll: false,\n callback: massSelectionFilter => {\n KitModal.confirm({\n width: '100%',\n style: {content: {width: '90vw', maxWidth: '656px'}},\n icon: false,\n type: 'confirm',\n title:\n t('explorer.export_item', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) ?? undefined,\n content:\n t('explorer.export_item_description', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) +\n BREAK_TWO_LINES +\n t('global.are_you_sure'),\n okText: t('global.confirm') ?? undefined,\n cancelText: t('global.cancel') ?? undefined,\n onOk: async () => {\n const total =\n view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length;\n try {\n const {error} = await exportQuery({\n fetchPolicy: 'no-cache',\n variables: {\n library: view.libraryId,\n filters: massSelectionFilter,\n profile: 'default', // Set 'default' by default, it'll change when we can select a profile from the UI\n },\n });\n if (error) {\n // Preserve the extensions property which contains the error code\n const graphQLError = error.graphQLErrors?.[0];\n const errorWithExtensions = new Error(error.message);\n (errorWithExtensions as any).extensions = graphQLError?.extensions;\n throw errorWithExtensions;\n }\n\n kitNotification.info({\n message: t('explorer.massAction.export_message'),\n description: t('explorer.massAction.export_description', {\n count: total,\n total,\n }),\n duration: INFO_NOTIFICATION_DURATION_SECONDS,\n });\n\n onExport?.(massSelectionFilter, view.massSelection);\n } catch (e) {\n if (e.extensions?.code === 'CUSTOM_CONFIG_ERROR') {\n KitAlert.error({\n showIcon: true,\n duration: ERROR_ALERT_DURATION,\n message: t('explorer.massAction.export_config_error_message'),\n description: t('explorer.massAction.export_config_error_description'),\n closable: true,\n });\n } else {\n KitAlert.error({\n showIcon: true,\n duration: ERROR_ALERT_DURATION,\n message: t('explorer.massAction.export_error_message'),\n description: t('explorer.massAction.export_error_description', {count: total}),\n closable: true,\n });\n }\n }\n },\n });\n },\n }),\n [t, exportQuery, view.massSelection, dispatch, view.libraryId],\n );\n\n return {\n exportMassAction: isEnabled ? _exportMassAction : null,\n };\n};\n"]}
@@ -68,6 +68,6 @@ export const LinkModal = ({ open, linkId, joinLibraryContext, isMultivalue, onLi
68
68
  },
69
69
  });
70
70
  }
71
- } })) : (_jsx(SelectRecordForLinkModal, { className: LINK_RECORDS_MODAL_CLASSNAME, open: open, childLibraryId: linkedLibraryId || view.libraryId, onSelectionCompleted: isReplacement ? replaceLink : createLinks, replacementMode: isReplacement, selectionMode: isReplacement || !isMultivalue ? 'simple' : 'multiple', hideSelectAllAction: (isReplacement || !isMultivalue) && view.entrypoint.type === 'link', valuesList: valuesList, allowFreeEntry: allowFreeEntry, onClose: onClose }));
71
+ } })) : (_jsx(SelectRecordForLinkModal, { className: LINK_RECORDS_MODAL_CLASSNAME, open: open, childLibraryId: linkedLibraryId || view.libraryId, onSelectionCompleted: isReplacement ? replaceLink : createLinks, replacementMode: isReplacement, selectionMode: isReplacement || !isMultivalue ? 'simple' : 'multiple', hideSelectAllAction: (isReplacement || !isMultivalue) && view.entrypoint.type === 'link', valuesList: valuesList, allowFreeEntry: allowFreeEntry, isMultivalue: isMultivalue, onClose: onClose }));
72
72
  };
73
73
  //# sourceMappingURL=LinkModal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinkModal.js","sourceRoot":"","sources":["../../../../src/components/Explorer/link-item/LinkModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,OAAO,EAAC,MAAM,OAAO,CAAC;AACtD,OAAO,EAAkC,6BAA6B,EAAC,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAC,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAEjF,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,sBAAsB,EAAC,MAAM,oEAAoE,CAAC;AAC1G,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAC,4BAA4B,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAYpE,MAAM,CAAC,MAAM,SAAS,GAA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AAC;qBAClC;iBACJ,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACJ,WAAW,CAAC;oBACR,OAAO,EAAE;wBACL,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAC,EAAE,EAAC,CAAC,CAAC;qBAClC;iBACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC,GACH,CACL,CAAC,CAAC,CAAC,CACA,KAAC,wBAAwB,IACrB,SAAS,EAAE,4BAA4B,EACvC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,eAAe,IAAI,IAAI,CAAC,SAAS,EACjD,oBAAoB,EAAE,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,EAC/D,eAAe,EAAE,aAAa,EAC9B,aAAa,EAAE,aAAa,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,EACrE,mBAAmB,EAAE,CAAC,aAAa,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,MAAM,EACxF,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,GAClB,CACL,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, useMemo} from 'react';\nimport {type JoinLibraryContextFragment, useExplorerLinkAttributeQuery} from '_ui/_gqlTypes';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {SelectRecordForLinkModal} from '_ui/components/SelectRecordForLinkModal';\nimport {type IEntrypointLink} from '../_types';\nimport {useAddLinkMassAction} from './useAddLinkMassAction';\nimport {useViewSettingsContext} from '../manage-view-settings/store-view-settings/useViewSettingsContext';\nimport {useReplaceLinkMassAction} from './useReplaceLinkMassAction';\nimport {LINK_RECORDS_MODAL_CLASSNAME} from '../_constants';\nimport {SelectTreeNodeModal} from '_ui/components';\nimport {ITreeNodeWithRecord} from '_ui/types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\n\ninterface ILinkModalProps {\n open: boolean;\n linkId?: string;\n joinLibraryContext?: JoinLibraryContextFragment;\n isMultivalue: boolean;\n onClose: () => void;\n onLink?: (saveValuesResult: ISubmitMultipleResult) => void;\n onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;\n}\n\nexport const LinkModal: FunctionComponent<ILinkModalProps> = ({\n open,\n linkId,\n joinLibraryContext,\n isMultivalue,\n onLink,\n onReplace,\n onClose,\n}) => {\n const {t} = useSharedTranslation();\n const {view} = useViewSettingsContext();\n const linkedLibraryId =\n joinLibraryContext &&\n 'linked_library' in joinLibraryContext.mandatoryAttribute &&\n joinLibraryContext.mandatoryAttribute.linked_library?.id;\n const linkedTreeId =\n joinLibraryContext &&\n 'linked_tree' in joinLibraryContext.mandatoryAttribute &&\n joinLibraryContext.mandatoryAttribute.linked_tree?.id;\n\n const isReplacement = !!linkId;\n\n const {data: attributeData} = useExplorerLinkAttributeQuery({\n skip: view.entrypoint.type !== 'link',\n variables: {\n id: (view.entrypoint as IEntrypointLink).linkAttributeId,\n },\n });\n\n const {createLinks} = useAddLinkMassAction({\n store: {view},\n linkAttributeId: (view.entrypoint as IEntrypointLink).linkAttributeId,\n onLink,\n closeModal: onClose,\n });\n\n const {replaceLink} = useReplaceLinkMassAction({\n store: {view},\n linkAttributeId: (view.entrypoint as IEntrypointLink).linkAttributeId,\n linkId,\n onReplace,\n closeModal: onClose,\n });\n\n const linkAttributeData = attributeData?.attributes?.list[0];\n const isValuesListEnabled =\n linkAttributeData && 'valuesList' in linkAttributeData && linkAttributeData.valuesList?.enable;\n\n const valuesList = useMemo(\n () => (isValuesListEnabled ? linkAttributeData.valuesList?.linkedValues?.map(value => value.id) : undefined),\n [isValuesListEnabled, linkAttributeData],\n );\n const allowFreeEntry = useMemo(\n () => (isValuesListEnabled ? Boolean(linkAttributeData.valuesList?.allowFreeEntry) : true),\n [isValuesListEnabled, linkAttributeData],\n );\n\n return linkedTreeId ? (\n <SelectTreeNodeModal\n open\n attribute={{\n multiple_values: isMultivalue,\n linked_tree: {\n id: linkedTreeId,\n },\n }}\n title={t(isMultivalue ? 'tree-node-selection.title_many' : 'tree-node-selection.title')}\n // We can select new node(s), ignoring current value(s).\n // Selected element might be duplicated in link attribute in backend for now.\n backendValues={[]}\n onClose={onClose}\n onConfirm={selectedNodes => {\n const nodeIds = selectedNodes.map(node => node.id);\n if (isReplacement) {\n replaceLink({\n records: {\n list: nodeIds.map(id => ({id})),\n },\n });\n } else {\n createLinks({\n records: {\n list: nodeIds.map(id => ({id})),\n },\n });\n }\n }}\n />\n ) : (\n <SelectRecordForLinkModal\n className={LINK_RECORDS_MODAL_CLASSNAME}\n open={open}\n childLibraryId={linkedLibraryId || view.libraryId}\n onSelectionCompleted={isReplacement ? replaceLink : createLinks}\n replacementMode={isReplacement}\n selectionMode={isReplacement || !isMultivalue ? 'simple' : 'multiple'}\n hideSelectAllAction={(isReplacement || !isMultivalue) && view.entrypoint.type === 'link'}\n valuesList={valuesList}\n allowFreeEntry={allowFreeEntry}\n onClose={onClose}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"LinkModal.js","sourceRoot":"","sources":["../../../../src/components/Explorer/link-item/LinkModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,OAAO,EAAC,MAAM,OAAO,CAAC;AACtD,OAAO,EAAkC,6BAA6B,EAAC,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAC,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAEjF,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,sBAAsB,EAAC,MAAM,oEAAoE,CAAC;AAC1G,OAAO,E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C,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACnD,IAAI,aAAa,EAAE,CAAC;gBAChB,WAAW,CAAC;oBACR,OAAO,EAAE;wBACL,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAC,EAAE,EAAC,CAAC,CAAC;qBAClC;iBACJ,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACJ,WAAW,CAAC;oBACR,OAAO,EAAE;wBACL,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAC,EAAE,EAAC,CAAC,CAAC;qBAClC;iBACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC,GACH,CACL,CAAC,CAAC,CAAC,CACA,KAAC,wBAAwB,IACrB,SAAS,EAAE,4BAA4B,EACvC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,eAAe,IAAI,IAAI,CAAC,SAAS,EACjD,oBAAoB,EAAE,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,EAC/D,eAAe,EAAE,aAAa,EAC9B,aAAa,EAAE,aAAa,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,EACrE,mBAAmB,EAAE,CAAC,aAAa,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,MAAM,EACxF,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,GAClB,CACL,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, useMemo} from 'react';\nimport {type JoinLibraryContextFragment, useExplorerLinkAttributeQuery} from '_ui/_gqlTypes';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {SelectRecordForLinkModal} from '_ui/components/SelectRecordForLinkModal';\nimport {type IEntrypointLink} from '../_types';\nimport {useAddLinkMassAction} from './useAddLinkMassAction';\nimport {useViewSettingsContext} from '../manage-view-settings/store-view-settings/useViewSettingsContext';\nimport {useReplaceLinkMassAction} from './useReplaceLinkMassAction';\nimport {LINK_RECORDS_MODAL_CLASSNAME} from '../_constants';\nimport {SelectTreeNodeModal} from '_ui/components';\nimport {ITreeNodeWithRecord} from '_ui/types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\n\ninterface ILinkModalProps {\n open: boolean;\n linkId?: string;\n joinLibraryContext?: JoinLibraryContextFragment;\n isMultivalue: boolean;\n onClose: () => void;\n onLink?: (saveValuesResult: ISubmitMultipleResult) => void;\n onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;\n}\n\nexport const LinkModal: FunctionComponent<ILinkModalProps> = ({\n open,\n linkId,\n joinLibraryContext,\n isMultivalue,\n onLink,\n onReplace,\n onClose,\n}) => {\n const {t} = useSharedTranslation();\n const {view} = useViewSettingsContext();\n const linkedLibraryId =\n joinLibraryContext &&\n 'linked_library' in joinLibraryContext.mandatoryAttribute &&\n joinLibraryContext.mandatoryAttribute.linked_library?.id;\n const linkedTreeId =\n joinLibraryContext &&\n 'linked_tree' in joinLibraryContext.mandatoryAttribute &&\n joinLibraryContext.mandatoryAttribute.linked_tree?.id;\n\n const isReplacement = !!linkId;\n\n const {data: attributeData} = useExplorerLinkAttributeQuery({\n skip: view.entrypoint.type !== 'link',\n variables: {\n id: (view.entrypoint as IEntrypointLink).linkAttributeId,\n },\n });\n\n const {createLinks} = useAddLinkMassAction({\n store: {view},\n linkAttributeId: (view.entrypoint as IEntrypointLink).linkAttributeId,\n onLink,\n closeModal: onClose,\n });\n\n const {replaceLink} = useReplaceLinkMassAction({\n store: {view},\n linkAttributeId: (view.entrypoint as IEntrypointLink).linkAttributeId,\n linkId,\n onReplace,\n closeModal: onClose,\n });\n\n const linkAttributeData = attributeData?.attributes?.list[0];\n const isValuesListEnabled =\n linkAttributeData && 'valuesList' in linkAttributeData && linkAttributeData.valuesList?.enable;\n\n const valuesList = useMemo(\n () => (isValuesListEnabled ? linkAttributeData.valuesList?.linkedValues?.map(value => value.id) : undefined),\n [isValuesListEnabled, linkAttributeData],\n );\n const allowFreeEntry = useMemo(\n () => (isValuesListEnabled ? Boolean(linkAttributeData.valuesList?.allowFreeEntry) : true),\n [isValuesListEnabled, linkAttributeData],\n );\n\n return linkedTreeId ? (\n <SelectTreeNodeModal\n open\n attribute={{\n multiple_values: isMultivalue,\n linked_tree: {\n id: linkedTreeId,\n },\n }}\n title={t(isMultivalue ? 'tree-node-selection.title_many' : 'tree-node-selection.title')}\n // We can select new node(s), ignoring current value(s).\n // Selected element might be duplicated in link attribute in backend for now.\n backendValues={[]}\n onClose={onClose}\n onConfirm={selectedNodes => {\n const nodeIds = selectedNodes.map(node => node.id);\n if (isReplacement) {\n replaceLink({\n records: {\n list: nodeIds.map(id => ({id})),\n },\n });\n } else {\n createLinks({\n records: {\n list: nodeIds.map(id => ({id})),\n },\n });\n }\n }}\n />\n ) : (\n <SelectRecordForLinkModal\n className={LINK_RECORDS_MODAL_CLASSNAME}\n open={open}\n childLibraryId={linkedLibraryId || view.libraryId}\n onSelectionCompleted={isReplacement ? replaceLink : createLinks}\n replacementMode={isReplacement}\n selectionMode={isReplacement || !isMultivalue ? 'simple' : 'multiple'}\n hideSelectAllAction={(isReplacement || !isMultivalue) && view.entrypoint.type === 'link'}\n valuesList={valuesList}\n allowFreeEntry={allowFreeEntry}\n isMultivalue={isMultivalue}\n onClose={onClose}\n />\n );\n};\n"]}
@@ -65,7 +65,6 @@ const resetFilter = (state, payload) => ({
65
65
  ...state,
66
66
  filters: state.filters.map(filter => {
67
67
  if (filter.id === payload.id) {
68
- // TODO Add initial Filters State
69
68
  const initialFilter = state.initialFilters.find(({ id }) => id === payload.id);
70
69
  if (initialFilter) {
71
70
  return initialFilter;