@leav/ui 1.12.0-8d8706f0 → 1.12.0-a3cb7513

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 (97) 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 +243 -94
  5. package/dist/_gqlTypes/index.js +190 -48
  6. package/dist/_gqlTypes/index.js.map +1 -1
  7. package/dist/components/CreateDirectory/CreateDirectory.js +1 -2
  8. package/dist/components/CreateDirectory/CreateDirectory.js.map +1 -1
  9. package/dist/components/Explorer/DataView.js +1 -1
  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/edit-attribute/EditAttributeMassActionModal.d.ts +4 -9
  17. package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js +3 -11
  18. package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js.map +1 -1
  19. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.d.ts +8 -8
  20. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js +26 -13
  21. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js.map +1 -1
  22. package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.d.ts +7 -0
  23. package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.js +30 -0
  24. package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.js.map +1 -0
  25. package/dist/components/Explorer/actions-mass/edit-attribute/_types.d.ts +23 -0
  26. package/dist/components/Explorer/actions-mass/edit-attribute/_types.js +2 -0
  27. package/dist/components/Explorer/actions-mass/edit-attribute/_types.js.map +1 -0
  28. package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.d.ts +4 -0
  29. package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.js +46 -0
  30. package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.js.map +1 -0
  31. package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.d.ts +12 -0
  32. package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.js +24 -0
  33. package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.js.map +1 -0
  34. package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.d.ts +13 -0
  35. package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.js +28 -0
  36. package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.js.map +1 -0
  37. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +6 -10
  38. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
  39. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +5 -8
  40. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
  41. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.d.ts +8 -2
  42. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +104 -80
  43. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
  44. package/dist/components/Explorer/actions-mass/useMassActions.js +18 -13
  45. package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
  46. package/dist/components/Explorer/conditionsHelper.d.ts +2 -1
  47. package/dist/components/Explorer/conditionsHelper.js.map +1 -1
  48. package/dist/components/Filters/conditionsHelper.d.ts +2 -1
  49. package/dist/components/Filters/conditionsHelper.js.map +1 -1
  50. package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
  51. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
  52. package/dist/components/Filters/useTransformFilters.js.map +1 -1
  53. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.d.ts +1 -4
  54. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.js +5 -9
  55. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.js.map +1 -1
  56. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.js +4 -8
  57. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.js.map +1 -1
  58. package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +2 -3
  59. package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js.map +1 -1
  60. package/dist/components/RecordEdition/hooks/useCreateCancelConfirm/useCreateCancelConfirm.js +4 -8
  61. package/dist/components/RecordEdition/hooks/useCreateCancelConfirm/useCreateCancelConfirm.js.map +1 -1
  62. package/dist/components/UploadFiles/UploadFiles.js +1 -2
  63. package/dist/components/UploadFiles/UploadFiles.js.map +1 -1
  64. package/dist/constants.d.ts +1 -6
  65. package/dist/constants.js +1 -6
  66. package/dist/constants.js.map +1 -1
  67. package/dist/hooks/index.d.ts +1 -0
  68. package/dist/hooks/index.js +1 -0
  69. package/dist/hooks/index.js.map +1 -1
  70. package/dist/hooks/useConfirmModal/__mocks__/index.d.ts +1 -0
  71. package/dist/hooks/useConfirmModal/__mocks__/index.js +5 -0
  72. package/dist/hooks/useConfirmModal/__mocks__/index.js.map +1 -0
  73. package/dist/hooks/useConfirmModal/__mocks__/useConfirmModal.d.ts +3 -0
  74. package/dist/hooks/useConfirmModal/__mocks__/useConfirmModal.js +7 -0
  75. package/dist/hooks/useConfirmModal/__mocks__/useConfirmModal.js.map +1 -0
  76. package/dist/hooks/useConfirmModal/index.d.ts +1 -0
  77. package/dist/hooks/useConfirmModal/index.js +5 -0
  78. package/dist/hooks/useConfirmModal/index.js.map +1 -0
  79. package/dist/hooks/useConfirmModal/useConfirmModal.d.ts +7 -0
  80. package/dist/hooks/useConfirmModal/useConfirmModal.js +25 -0
  81. package/dist/hooks/useConfirmModal/useConfirmModal.js.map +1 -0
  82. package/dist/hooks/useSharedTranslation/__mocks__/useSharedTranslation.js.map +1 -1
  83. package/dist/locales/en/shared.json +4 -4
  84. package/dist/locales/fr/shared.json +5 -5
  85. package/package.json +8 -8
  86. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.d.ts +0 -8
  87. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js +0 -40
  88. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js.map +0 -1
  89. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.d.ts +0 -17
  90. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js +0 -42
  91. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js.map +0 -1
  92. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.d.ts +0 -5
  93. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js +0 -20
  94. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js.map +0 -1
  95. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.d.ts +0 -12
  96. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js +0 -30
  97. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js.map +0 -1
@@ -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"]}