@leav/ui 1.12.0-36d55f01 → 1.12.0-38b7d0f2

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 (46) hide show
  1. package/dist/_gqlTypes/index.d.ts +243 -94
  2. package/dist/_gqlTypes/index.js +190 -48
  3. package/dist/_gqlTypes/index.js.map +1 -1
  4. package/dist/components/Explorer/DataView.js +1 -1
  5. package/dist/components/Explorer/DataView.js.map +1 -1
  6. package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.d.ts +4 -9
  7. package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js +3 -11
  8. package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js.map +1 -1
  9. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.d.ts +8 -8
  10. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js +26 -13
  11. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js.map +1 -1
  12. package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.d.ts +7 -0
  13. package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.js +30 -0
  14. package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.js.map +1 -0
  15. package/dist/components/Explorer/actions-mass/edit-attribute/_types.d.ts +23 -0
  16. package/dist/components/Explorer/actions-mass/edit-attribute/_types.js +2 -0
  17. package/dist/components/Explorer/actions-mass/edit-attribute/_types.js.map +1 -0
  18. package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.d.ts +4 -0
  19. package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.js +46 -0
  20. package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.js.map +1 -0
  21. package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.d.ts +12 -0
  22. package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.js +24 -0
  23. package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.js.map +1 -0
  24. package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.d.ts +13 -0
  25. package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.js +28 -0
  26. package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.js.map +1 -0
  27. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.d.ts +8 -2
  28. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +104 -80
  29. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
  30. package/dist/components/Explorer/actions-mass/useMassActions.js +18 -13
  31. package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
  32. package/dist/locales/en/shared.json +4 -4
  33. package/dist/locales/fr/shared.json +5 -5
  34. package/package.json +3 -3
  35. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.d.ts +0 -8
  36. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js +0 -40
  37. package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js.map +0 -1
  38. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.d.ts +0 -17
  39. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js +0 -42
  40. package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js.map +0 -1
  41. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.d.ts +0 -5
  42. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js +0 -20
  43. package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js.map +0 -1
  44. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.d.ts +0 -12
  45. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js +0 -30
  46. package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js.map +0 -1
@@ -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"]}