@leav/ui 1.7.0-68370392 → 1.7.0-a16d0bd7

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 (73) hide show
  1. package/dist/__mocks__/common/library.d.ts +1 -0
  2. package/dist/_gqlTypes/index.d.ts +163 -71
  3. package/dist/_gqlTypes/index.js +100 -53
  4. package/dist/_gqlTypes/index.js.map +1 -1
  5. package/dist/_queries/libraries/libraryDetailsFragment.js +1 -0
  6. package/dist/_queries/libraries/libraryDetailsFragment.js.map +1 -1
  7. package/dist/components/AttributePicker/AttributesList/AttributesList.js +3 -7
  8. package/dist/components/AttributePicker/AttributesList/AttributesList.js.map +1 -1
  9. package/dist/components/EditLibraryModal/EditLibrary/EditLibraryAttributes/AttributesList/AttributesList.js +3 -7
  10. package/dist/components/EditLibraryModal/EditLibrary/EditLibraryAttributes/AttributesList/AttributesList.js.map +1 -1
  11. package/dist/components/Explorer/TableCell.js +9 -16
  12. package/dist/components/Explorer/TableCell.js.map +1 -1
  13. package/dist/components/Explorer/manage-view-settings/configure-display/view-type/SelectViewType.js +2 -2
  14. package/dist/components/Explorer/manage-view-settings/configure-display/view-type/SelectViewType.js.map +1 -1
  15. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +2 -2
  16. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
  17. package/dist/components/Filters/context/useGetTreeFilters.d.ts +8 -6
  18. package/dist/components/Filters/context/useGetTreeFilters.js +41 -18
  19. package/dist/components/Filters/context/useGetTreeFilters.js.map +1 -1
  20. package/dist/components/Filters/filter-items/CommonFilterItem.js +1 -1
  21. package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
  22. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js +1 -1
  23. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js.map +1 -1
  24. package/dist/components/Filters/filter-items/SelectAllCheckbox.d.ts +8 -0
  25. package/dist/components/Filters/filter-items/SelectAllCheckbox.js +22 -0
  26. package/dist/components/Filters/filter-items/SelectAllCheckbox.js.map +1 -0
  27. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js +1 -1
  28. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js.map +1 -1
  29. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js +2 -2
  30. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js.map +1 -1
  31. package/dist/components/Filters/filter-items/filter-type/{TreeAttributeDropDown.d.ts → tree/TreeAttributeDropDown.d.ts} +1 -1
  32. package/dist/components/Filters/filter-items/filter-type/tree/TreeAttributeDropDown.js +130 -0
  33. package/dist/components/Filters/filter-items/filter-type/tree/TreeAttributeDropDown.js.map +1 -0
  34. package/dist/components/Filters/filter-items/filter-type/tree/useGetTreeData.d.ts +20 -0
  35. package/dist/components/Filters/filter-items/filter-type/tree/useGetTreeData.js +72 -0
  36. package/dist/components/Filters/filter-items/filter-type/tree/useGetTreeData.js.map +1 -0
  37. package/dist/components/Filters/filter-items/filter-type/tree/useTreesSearch.d.ts +7 -0
  38. package/dist/components/Filters/filter-items/filter-type/tree/useTreesSearch.js +36 -0
  39. package/dist/components/Filters/filter-items/filter-type/tree/useTreesSearch.js.map +1 -0
  40. package/dist/components/Filters/filter-items/filter-type/tree/utils/buildFlattenTreeMap.d.ts +2 -0
  41. package/dist/components/Filters/filter-items/filter-type/tree/utils/buildFlattenTreeMap.js +14 -0
  42. package/dist/components/Filters/filter-items/filter-type/tree/utils/buildFlattenTreeMap.js.map +1 -0
  43. package/dist/components/Filters/filter-items/filter-type/tree/utils/filterTreeByPermission.d.ts +2 -0
  44. package/dist/components/Filters/filter-items/filter-type/tree/utils/filterTreeByPermission.js +15 -0
  45. package/dist/components/Filters/filter-items/filter-type/tree/utils/filterTreeByPermission.js.map +1 -0
  46. package/dist/components/Filters/filter-items/filter-type/tree/utils/getSelectAllState.d.ts +5 -0
  47. package/dist/components/Filters/filter-items/filter-type/tree/utils/getSelectAllState.js +17 -0
  48. package/dist/components/Filters/filter-items/filter-type/tree/utils/getSelectAllState.js.map +1 -0
  49. package/dist/components/RecordEdition/EditRecordContent/antdUtils.js +2 -0
  50. package/dist/components/RecordEdition/EditRecordContent/antdUtils.js.map +1 -1
  51. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js +1 -1
  52. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js.map +1 -1
  53. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js +2 -0
  54. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js.map +1 -1
  55. package/dist/components/RecordHistory/RecordHistoryLogEntry.js +10 -2
  56. package/dist/components/RecordHistory/RecordHistoryLogEntry.js.map +1 -1
  57. package/dist/components/RecordHistory/_queries/recordHistoryQuery.d.ts +7 -0
  58. package/dist/components/RecordHistory/_queries/recordHistoryQuery.js +64 -0
  59. package/dist/components/RecordHistory/_queries/recordHistoryQuery.js.map +1 -0
  60. package/dist/components/RecordHistory/hooks/useFetchRecordHistory.js +5 -2
  61. package/dist/components/RecordHistory/hooks/useFetchRecordHistory.js.map +1 -1
  62. package/dist/components/RecordHistory/utils/extendedAttribute.d.ts +11 -0
  63. package/dist/components/RecordHistory/utils/extendedAttribute.js +40 -0
  64. package/dist/components/RecordHistory/utils/extendedAttribute.js.map +1 -0
  65. package/dist/components/SelectTreeNode/TreeNodeTitle.js +2 -2
  66. package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -1
  67. package/dist/locales/en/shared.json +6 -2
  68. package/dist/locales/fr/shared.json +6 -2
  69. package/dist/types/records.d.ts +1 -0
  70. package/dist/types/records.js.map +1 -1
  71. package/package.json +2 -2
  72. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js +0 -71
  73. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useFetchRecordHistory.js","sourceRoot":"","sources":["../../../../src/components/RecordHistory/hooks/useFetchRecordHistory.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAE,wBAAwB,EAAC,MAAM,eAAe,CAAC;AAElE,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAgBvD,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC;AAChD,MAAM,aAAa,GAAG,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAClC,MAAM,EACN,WAAW,GACe,EAA8B,EAAE;IAC1D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAa,EAAE,CAAC,CAAC;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAC;IAC9C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAEvD,MAAM,EACF,OAAO,EACP,KAAK,EACL,IAAI,EAAE,OAAO,EACb,OAAO,GACV,GAAG,wBAAwB,CAAC;QACzB,WAAW,EAAE,cAAc;QAC3B,SAAS,EAAE;YACP,MAAM,EAAE;gBACJ,EAAE,EAAE,MAAM,CAAC,EAAE;gBACb,SAAS,EAAE,MAAM,CAAC,SAAS;aAC9B;YACD,WAAW;YACX,OAAO,EAAE,aAAa;YACtB,UAAU,EAAE,EAAC,KAAK,EAAE,8BAA8B,EAAE,MAAM,EAAE,CAAC,EAAC;SACjE;KACJ,CAAC,CAAC;IAEH,SAAS,CAA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P,SAAS;KACZ,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 {LogAction, useGetRecordHistoryQuery} from '_ui/_gqlTypes';\nimport {type LogEntry} from '../_types';\nimport {useCallback, useEffect, useState} from 'react';\n\nexport interface IUseFetchRecordHistoryHook {\n loading: boolean;\n inError: boolean;\n logs: LogEntry[];\n total: number;\n hasMore: boolean;\n fetchMore: () => void;\n}\n\nexport interface IUseFetchRecordHistoryProps {\n record: {id: string; libraryId: string};\n attributeId?: string;\n}\n\nexport const RECORD_HISTORY_LOGS_PAGE = 50;\nexport const RECORD_HISTORY_LOGS_FIRST_PAGE = 1;\nconst eventsToFetch = [LogAction.VALUE_SAVE, LogAction.VALUE_DELETE];\n\nexport const useFetchRecordHistory = ({\n record,\n attributeId,\n}: IUseFetchRecordHistoryProps): IUseFetchRecordHistoryHook => {\n const [logs, setLogs] = useState<LogEntry[]>([]);\n const [total, setTotal] = useState<number>(0);\n const [hasMore, setHasMore] = useState<boolean>(false);\n\n const {\n loading,\n error,\n data: history,\n refetch,\n } = useGetRecordHistoryQuery({\n fetchPolicy: 'network-only',\n variables: {\n record: {\n id: record.id,\n libraryId: record.libraryId,\n },\n attributeId,\n actions: eventsToFetch,\n pagination: {limit: RECORD_HISTORY_LOGS_FIRST_PAGE, offset: 0},\n },\n });\n\n useEffect(() => {\n // Reset if record or attribute change\n setLogs([]);\n setTotal(0);\n setHasMore(false);\n }, [record.id, record.libraryId, attributeId]);\n\n const fetchMore = useCallback(() => {\n refetch({\n record: {\n id: record.id,\n libraryId: record.libraryId,\n },\n attributeId,\n actions: eventsToFetch,\n pagination: {limit: RECORD_HISTORY_LOGS_PAGE, offset: logs.length},\n });\n }, [logs.length, refetch, record.id, record.libraryId, attributeId]);\n\n useEffect(() => {\n if (loading || !history) {\n return;\n }\n const newLogs = [...logs, ...history.logs.logs];\n const newTotal = history.logs.total || 0;\n setLogs(newLogs);\n setTotal(newTotal);\n setHasMore(newLogs.length < newTotal);\n }, [history, loading]);\n\n return {\n loading,\n inError: !!error,\n logs,\n total,\n hasMore,\n fetchMore,\n };\n};\n"]}
1
+ {"version":3,"file":"useFetchRecordHistory.js","sourceRoot":"","sources":["../../../../src/components/RecordHistory/hooks/useFetchRecordHistory.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACvD,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAC,qBAAqB,EAAC,MAAM,0DAA0D,CAAC;AAgB/F,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC;AAChD,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,MAAM,aAAa,GAAG,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAClC,MAAM,EACN,WAAW,GACe,EAA8B,EAAE;IAC1D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAa,EAAE,CAAC,CAAC;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAC;IAC9C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAEvD,MAAM,EACF,OAAO,EACP,KAAK,EACL,IAAI,EAAE,OAAO,EACb,OAAO,GACV,GAAG,QAAQ,CAAC,qBAAqB,CAAC,qBAAqB,CAAC,EAAE;QACvD,WAA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AC,OAAO,CAAC,CAAC;QACjB,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,UAAU,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC;IAC1C,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvB,OAAO;QACH,OAAO;QACP,OAAO,EAAE,CAAC,CAAC,KAAK;QAChB,IAAI;QACJ,KAAK;QACL,OAAO;QACP,SAAS;KACZ,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 {LogAction} from '_ui/_gqlTypes';\nimport {type LogEntry} from '../_types';\nimport {useCallback, useEffect, useState} from 'react';\nimport {useQuery} from '@apollo/client';\nimport {getRecordHistoryQuery} from '_ui/components/RecordHistory/_queries/recordHistoryQuery';\n\nexport interface IUseFetchRecordHistoryHook {\n loading: boolean;\n inError: boolean;\n logs: LogEntry[];\n total: number;\n hasMore: boolean;\n fetchMore: () => void;\n}\n\nexport interface IUseFetchRecordHistoryProps {\n record: {id: string; libraryId: string};\n attributeId?: string;\n}\n\nexport const RECORD_HISTORY_LOGS_PAGE = 50;\nexport const RECORD_HISTORY_LOGS_FIRST_PAGE = 1;\nconst DEPTH_EMBEDDED_FIELDS = 100;\n\nconst eventsToFetch = [LogAction.VALUE_SAVE, LogAction.VALUE_DELETE];\n\nexport const useFetchRecordHistory = ({\n record,\n attributeId,\n}: IUseFetchRecordHistoryProps): IUseFetchRecordHistoryHook => {\n const [logs, setLogs] = useState<LogEntry[]>([]);\n const [total, setTotal] = useState<number>(0);\n const [hasMore, setHasMore] = useState<boolean>(false);\n\n const {\n loading,\n error,\n data: history,\n refetch,\n } = useQuery(getRecordHistoryQuery(DEPTH_EMBEDDED_FIELDS), {\n fetchPolicy: 'network-only',\n variables: {\n record: {\n id: record.id,\n libraryId: record.libraryId,\n },\n attributeId,\n actions: eventsToFetch,\n pagination: {limit: RECORD_HISTORY_LOGS_FIRST_PAGE, offset: 0},\n },\n });\n\n useEffect(() => {\n // Reset if record or attribute change\n setLogs([]);\n setTotal(0);\n setHasMore(false);\n }, [record.id, record.libraryId, attributeId]);\n\n const fetchMore = useCallback(() => {\n refetch({\n record: {\n id: record.id,\n libraryId: record.libraryId,\n },\n attributeId,\n actions: eventsToFetch,\n pagination: {limit: RECORD_HISTORY_LOGS_PAGE, offset: logs.length},\n });\n }, [logs.length, refetch, record.id, record.libraryId, attributeId]);\n\n useEffect(() => {\n if (loading || !history) {\n return;\n }\n const newLogs = [...logs, ...history.logs.logs];\n const newTotal = history.logs.total || 0;\n setLogs(newLogs);\n setTotal(newTotal);\n setHasMore(newLogs.length < newTotal);\n }, [history, loading]);\n\n return {\n loading,\n inError: !!error,\n logs,\n total,\n hasMore,\n fetchMore,\n };\n};\n"]}
@@ -0,0 +1,11 @@
1
+ import { type IEmbeddedField } from '../../../components/RecordHistory/_queries/recordHistoryQuery';
2
+ export declare const getExtendedAttributeDiffs: (extendedValueBefore: unknown | undefined, extendedValueAfter: unknown | undefined, path?: string[], diffs?: Array<{
3
+ path: string;
4
+ before: string | null;
5
+ after: string | null;
6
+ }>) => Array<{
7
+ path: string;
8
+ before: string | null;
9
+ after: string | null;
10
+ }>;
11
+ export declare const getExtendedAttributeLabels: (path: string, embeddedFields: IEmbeddedField[], lang: string[], unknownAttributeLabel: string) => string[];
@@ -0,0 +1,40 @@
1
+ import { localizedTranslation } from '@leav/utils';
2
+ // This function compares two extended attribute values and returns the differences
3
+ export const getExtendedAttributeDiffs = (extendedValueBefore, extendedValueAfter, path = [], diffs = []) => {
4
+ if ((typeof extendedValueBefore !== 'object' || extendedValueBefore === null) &&
5
+ (typeof extendedValueAfter !== 'object' || extendedValueAfter === null)) {
6
+ if (extendedValueBefore !== extendedValueAfter) {
7
+ diffs.push({
8
+ path: path.join('.'),
9
+ before: extendedValueBefore === null || extendedValueBefore === undefined
10
+ ? null
11
+ : String(extendedValueBefore),
12
+ after: extendedValueAfter === null || extendedValueAfter === undefined ? null : String(extendedValueAfter),
13
+ });
14
+ }
15
+ return diffs;
16
+ }
17
+ const keys = new Set([...Object.keys(extendedValueBefore || {}), ...Object.keys(extendedValueAfter || {})]);
18
+ for (const key of keys) {
19
+ getExtendedAttributeDiffs(extendedValueBefore?.[key], extendedValueAfter?.[key], [...path, key], diffs);
20
+ }
21
+ return diffs;
22
+ };
23
+ // This function retrieves the labels for each part of the dot-separated path
24
+ export const getExtendedAttributeLabels = (path, // dot separated path
25
+ embeddedFields, // root embedded fields
26
+ lang, unknownAttributeLabel) => {
27
+ let nestedEmbeddedFields = [...embeddedFields];
28
+ let current = null;
29
+ const labels = [];
30
+ for (const id of path.split('.')) {
31
+ current = nestedEmbeddedFields.find(attr => attr.id === id);
32
+ if (!current) {
33
+ break;
34
+ }
35
+ labels.push(localizedTranslation(current?.label, lang) || current?.id || unknownAttributeLabel);
36
+ nestedEmbeddedFields = current.embedded_fields ?? [];
37
+ }
38
+ return labels;
39
+ };
40
+ //# sourceMappingURL=extendedAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extendedAttribute.js","sourceRoot":"","sources":["../../../../src/components/RecordHistory/utils/extendedAttribute.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AAEjD,mFAAmF;AACnF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACrC,mBAAwC,EACxC,kBAAuC,EACvC,OAAiB,EAAE,EACnB,QAA4E,EAAE,EACZ,EAAE;IACpE,IACI,CAAC,OAAO,mBAAmB,KAAK,QAAQ,IAAI,mBAAmB,KAAK,IAAI,CAAC;QACzE,CAAC,OAAO,kBAAkB,KAAK,QAAQ,IAAI,kBAAkB,KAAK,IAAI,CAAC,EACzE,CAAC;QACC,IAAI,mBAAmB,KAAK,kBAAkB,EAAE,CAAC;YAC7C,KAAK,CAAC,IAA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AAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,MAAM;QACV,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,OAAO,EAAE,EAAE,IAAI,qBAAqB,CAAC,CAAC;QAChG,oBAAoB,GAAG,OAAO,CAAC,eAAe,IAAI,EAAE,CAAC;IACzD,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,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 IEmbeddedField} from '_ui/components/RecordHistory/_queries/recordHistoryQuery';\nimport {localizedTranslation} from '@leav/utils';\n\n// This function compares two extended attribute values and returns the differences\nexport const getExtendedAttributeDiffs = (\n extendedValueBefore: unknown | undefined,\n extendedValueAfter: unknown | undefined,\n path: string[] = [],\n diffs: Array<{path: string; before: string | null; after: string | null}> = [],\n): Array<{path: string; before: string | null; after: string | null}> => {\n if (\n (typeof extendedValueBefore !== 'object' || extendedValueBefore === null) &&\n (typeof extendedValueAfter !== 'object' || extendedValueAfter === null)\n ) {\n if (extendedValueBefore !== extendedValueAfter) {\n diffs.push({\n path: path.join('.'),\n before:\n extendedValueBefore === null || extendedValueBefore === undefined\n ? null\n : String(extendedValueBefore),\n after:\n extendedValueAfter === null || extendedValueAfter === undefined ? null : String(extendedValueAfter),\n });\n }\n\n return diffs;\n }\n\n const keys = new Set([...Object.keys(extendedValueBefore || {}), ...Object.keys(extendedValueAfter || {})]);\n for (const key of keys) {\n getExtendedAttributeDiffs(extendedValueBefore?.[key], extendedValueAfter?.[key], [...path, key], diffs);\n }\n\n return diffs;\n};\n\n// This function retrieves the labels for each part of the dot-separated path\nexport const getExtendedAttributeLabels = (\n path: string, // dot separated path\n embeddedFields: IEmbeddedField[], // root embedded fields\n lang: string[],\n unknownAttributeLabel: string,\n): string[] => {\n let nestedEmbeddedFields = [...embeddedFields];\n let current: IEmbeddedField = null;\n const labels: string[] = [];\n\n for (const id of path.split('.')) {\n current = nestedEmbeddedFields.find(attr => attr.id === id);\n if (!current) {\n break;\n }\n labels.push(localizedTranslation(current?.label, lang) || current?.id || unknownAttributeLabel);\n nestedEmbeddedFields = current.embedded_fields ?? [];\n }\n\n return labels;\n};\n"]}
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // This file is released under LGPL V3
4
4
  // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
5
  import { useState } from 'react';
6
- import { KitButton, KitTag, KitTypography } from 'aristid-ds';
6
+ import { KitButton, KitIdCard, KitTag, KitTypography } from 'aristid-ds';
7
7
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
8
  import { faCheck } from '@fortawesome/free-solid-svg-icons';
9
9
  import { useSharedTranslation } from '../../hooks/useSharedTranslation';
@@ -43,7 +43,7 @@ const SelectedChildrenCount = ({ node, selectedNodes, loadRecursively }) => {
43
43
  return null;
44
44
  }
45
45
  const selectedChildrenCount = countSelectedNodes(node, selectedNodes);
46
- return selectedChildrenCount > 0 ? _jsx(KitTag, { idCardProps: { description: selectedChildrenCount } }) : null;
46
+ return selectedChildrenCount > 0 ? (_jsx(KitTag, { children: _jsx(KitIdCard, { description: selectedChildrenCount }) })) : null;
47
47
  };
48
48
  const countSelectedNodes = (node, selectedNodes) => node.children?.reduce((count, child) => {
49
49
  if (selectedNodes.includes(child.id) && !child.isShowMore) {
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeTitle.js","sourceRoot":"","sources":["../../../src/components/SelectTreeNode/TreeNodeTitle.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAyB,MA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AAI,EAAE,aAAa,EAAE,eAAe,EAAC,EAAE,EAAE;IAC5C,8CAA8C;IAC9C,IAAI,CAAC,eAAe,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAEtE,OAAO,qBAAqB,GAAG,CAAC,CAAC,CAAC,CAAC,KAAC,MAAM,IAAC,WAAW,EAAE,EAAC,WAAW,EAAE,qBAAqB,EAAC,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5G,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,IAAqB,EAAE,aAAuB,EAAU,EAAE,CAClF,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;IACnC,IAAI,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACxD,KAAK,IAAI,CAAC,CAAC;IACf,CAAC;IACD,KAAK,IAAI,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC;AACjB,CAAC,EAAE,CAAC,CAAC,IAAI,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 {useState, type FunctionComponent} from 'react';\nimport {type ITreeMapElement} from './_types';\nimport {KitButton, KitTag, KitTypography} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faCheck} from '@fortawesome/free-solid-svg-icons';\nimport {type ITreeNodeWithRecord} from '_ui/types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport styled from 'styled-components';\n\nconst TreeNodeLine = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n`;\nconst TreeNodeLineSection = styled.div`\n display: flex;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n`;\ninterface ITreeNodeTitleProps {\n checkable: boolean;\n disabledNodes: string[];\n loadRecursively: boolean;\n node: ITreeMapElement;\n onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;\n selectedNodes: string[];\n showSelectChildrenButton: boolean;\n}\n\nexport const TreeNodeTitle: FunctionComponent<ITreeNodeTitleProps> = ({\n checkable,\n disabledNodes,\n loadRecursively,\n node,\n onSelect,\n selectedNodes,\n showSelectChildrenButton,\n}) => {\n const {t} = useSharedTranslation();\n\n const [hover, setHover] = useState(false);\n\n const isSelected = selectedNodes.includes(node.id) && !node.isShowMore;\n const isDisabled = disabledNodes.includes(node.id);\n\n const buttonInSelectMode = node.children\n .filter(child => !child.isShowMore && !disabledNodes.includes(child.id))\n .every(child => !selectedNodes.includes(child.id));\n\n const handleChildrenSelection = (event: React.MouseEvent) => {\n event.stopPropagation();\n node.children.forEach(child => {\n if (node.disabled || child.isShowMore) {\n return;\n }\n onSelect(child, buttonInSelectMode);\n });\n };\n\n return (\n <TreeNodeLine onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}>\n <TreeNodeLineSection>\n <KitTypography.Text size=\"fontSize5\" disabled={isDisabled}>\n {node.title}\n </KitTypography.Text>\n <SelectedChildrenCount node={node} selectedNodes={selectedNodes} loadRecursively={loadRecursively} />\n </TreeNodeLineSection>\n <TreeNodeLineSection>\n {showSelectChildrenButton && node.children.length > 0 && hover && (\n <KitButton size=\"s\" onClick={e => handleChildrenSelection(e)}>\n {t(`tree-node-selection.${buttonInSelectMode ? 'select_children' : 'unselect_children'}`)}\n </KitButton>\n )}\n {!checkable && isSelected && (\n <FontAwesomeIcon\n icon={faCheck}\n color={\n isDisabled ? 'var(--general-utilities-text-disabled)' : 'var(--general-utilities-text-blue)'\n }\n />\n )}\n </TreeNodeLineSection>\n </TreeNodeLine>\n );\n};\n\nconst SelectedChildrenCount: FunctionComponent<{\n node: ITreeMapElement;\n selectedNodes: string[];\n loadRecursively: boolean;\n}> = ({node, selectedNodes, loadRecursively}) => {\n // it can work only if all children are loaded\n if (!loadRecursively) {\n return null;\n }\n\n const selectedChildrenCount = countSelectedNodes(node, selectedNodes);\n\n return selectedChildrenCount > 0 ? <KitTag idCardProps={{description: selectedChildrenCount}} /> : null;\n};\n\nconst countSelectedNodes = (node: ITreeMapElement, selectedNodes: string[]): number =>\n node.children?.reduce((count, child) => {\n if (selectedNodes.includes(child.id) && !child.isShowMore) {\n count += 1;\n }\n count += countSelectedNodes(child, selectedNodes);\n return count;\n }, 0) ?? 0;\n"]}
1
+ {"version":3,"file":"TreeNodeTitle.js","sourceRoot":"","sources":["../../../src/components/SelectTreeNode/TreeNodeTitle.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAyB,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACvE,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAC,MAAM,mCAAmC,CAAC;AAE1D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAI9B,CAAC;AACF,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIrC,CAAC;AAWF,MAAM,CAAC,MAAM,aAAa,GAA2C,CAAC,EAClE,SAAS,EACT,aAAa,EACb,eAAe,EACf,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,wBAAwB,GAC3B,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,CAAC,KAAK,EAAE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AAI,CAAC,CAAC;IACf,CAAC;IACD,KAAK,IAAI,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC;AACjB,CAAC,EAAE,CAAC,CAAC,IAAI,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 {useState, type FunctionComponent} from 'react';\nimport {type ITreeMapElement} from './_types';\nimport {KitButton, KitIdCard, KitTag, KitTypography} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faCheck} from '@fortawesome/free-solid-svg-icons';\nimport {type ITreeNodeWithRecord} from '_ui/types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport styled from 'styled-components';\n\nconst TreeNodeLine = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n`;\nconst TreeNodeLineSection = styled.div`\n display: flex;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n`;\ninterface ITreeNodeTitleProps {\n checkable: boolean;\n disabledNodes: string[];\n loadRecursively: boolean;\n node: ITreeMapElement;\n onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;\n selectedNodes: string[];\n showSelectChildrenButton: boolean;\n}\n\nexport const TreeNodeTitle: FunctionComponent<ITreeNodeTitleProps> = ({\n checkable,\n disabledNodes,\n loadRecursively,\n node,\n onSelect,\n selectedNodes,\n showSelectChildrenButton,\n}) => {\n const {t} = useSharedTranslation();\n\n const [hover, setHover] = useState(false);\n\n const isSelected = selectedNodes.includes(node.id) && !node.isShowMore;\n const isDisabled = disabledNodes.includes(node.id);\n\n const buttonInSelectMode = node.children\n .filter(child => !child.isShowMore && !disabledNodes.includes(child.id))\n .every(child => !selectedNodes.includes(child.id));\n\n const handleChildrenSelection = (event: React.MouseEvent) => {\n event.stopPropagation();\n node.children.forEach(child => {\n if (node.disabled || child.isShowMore) {\n return;\n }\n onSelect(child, buttonInSelectMode);\n });\n };\n\n return (\n <TreeNodeLine onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}>\n <TreeNodeLineSection>\n <KitTypography.Text size=\"fontSize5\" disabled={isDisabled}>\n {node.title}\n </KitTypography.Text>\n <SelectedChildrenCount node={node} selectedNodes={selectedNodes} loadRecursively={loadRecursively} />\n </TreeNodeLineSection>\n <TreeNodeLineSection>\n {showSelectChildrenButton && node.children.length > 0 && hover && (\n <KitButton size=\"s\" onClick={e => handleChildrenSelection(e)}>\n {t(`tree-node-selection.${buttonInSelectMode ? 'select_children' : 'unselect_children'}`)}\n </KitButton>\n )}\n {!checkable && isSelected && (\n <FontAwesomeIcon\n icon={faCheck}\n color={\n isDisabled ? 'var(--general-utilities-text-disabled)' : 'var(--general-utilities-text-blue)'\n }\n />\n )}\n </TreeNodeLineSection>\n </TreeNodeLine>\n );\n};\n\nconst SelectedChildrenCount: FunctionComponent<{\n node: ITreeMapElement;\n selectedNodes: string[];\n loadRecursively: boolean;\n}> = ({node, selectedNodes, loadRecursively}) => {\n // it can work only if all children are loaded\n if (!loadRecursively) {\n return null;\n }\n\n const selectedChildrenCount = countSelectedNodes(node, selectedNodes);\n\n return selectedChildrenCount > 0 ? (\n <KitTag>\n <KitIdCard description={selectedChildrenCount} />\n </KitTag>\n ) : null;\n};\n\nconst countSelectedNodes = (node: ITreeMapElement, selectedNodes: string[]): number =>\n node.children?.reduce((count, child) => {\n if (selectedNodes.includes(child.id) && !child.isShowMore) {\n count += 1;\n }\n count += countSelectedNodes(child, selectedNodes);\n return count;\n }, 0) ?? 0;\n"]}
@@ -310,7 +310,10 @@
310
310
  "activate": "Activate",
311
311
  "add": "Add",
312
312
  "add-condition": "Add condition",
313
- "empty-value": "Undefined"
313
+ "empty-value": "Undefined",
314
+ "visible-by-default": "Value(s) visible by default",
315
+ "hidden-by-default": "Value(s) hidden by default",
316
+ "select-all": "Select All"
314
317
  },
315
318
  "filter-item": {
316
319
  "no-operator": "If"
@@ -542,7 +545,8 @@
542
545
  "unknown_attribute": "unknown attribute",
543
546
  "unknown_user": "unknown user",
544
547
  "show_history": "See full history ({{total}} entries)",
545
- "hide_history": "Hide history ({{total}} entries)"
548
+ "hide_history": "Hide history ({{total}} entries)",
549
+ "of": "of"
546
550
  },
547
551
  "view": {
548
552
  "views": "Views",
@@ -310,7 +310,10 @@
310
310
  "activate": "Activer",
311
311
  "add": "Ajouter",
312
312
  "add-condition": "Ajouter une condition",
313
- "empty-value": "Non défini"
313
+ "empty-value": "Non défini",
314
+ "visible-by-default": "Valeurs affichée(s) par défaut",
315
+ "hidden-by-default": "Valeurs masquée(s) par défaut",
316
+ "select-all": "Tout sélectionner"
314
317
  },
315
318
  "filter-item": {
316
319
  "no-operator": "Si"
@@ -542,7 +545,8 @@
542
545
  "unknown_attribute": "Attribut inconnu",
543
546
  "unknown_user": "Utilisateur inconnu",
544
547
  "show_history": "Voir tout l'historique ({{total}} événements)",
545
- "hide_history": "Masquer l'historique ({{total}} événements)"
548
+ "hide_history": "Masquer l'historique ({{total}} événements)",
549
+ "of": "de"
546
550
  },
547
551
  "view": {
548
552
  "views": "Vues",
@@ -18,6 +18,7 @@ export interface IRecordIdentityWhoAmI {
18
18
  color?: string | null;
19
19
  library: IRecordIdentityLibrary;
20
20
  preview?: IPreviewScalar | null;
21
+ parentContext?: IRecordIdentityWhoAmI[] | null;
21
22
  }
22
23
  export interface IRecordIdentity {
23
24
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/types/records.ts"],"names":[],"mappings":"","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 IPreviewScalar} from '@leav/utils';\nimport {type SystemTranslation} from './scalars';\n\nexport interface IRecordIdentityLibrary {\n id: string;\n label?: SystemTranslation | null;\n}\n\nexport interface IRecordIdentityPreview {\n tiny: string | null;\n small: string | null;\n medium: string | null;\n big: string | null;\n huge: string | null;\n}\n\nexport interface IRecordIdentityWhoAmI {\n id: string;\n label?: string | null;\n subLabel?: string | null;\n color?: string | null;\n library: IRecordIdentityLibrary;\n preview?: IPreviewScalar | null;\n}\n\nexport interface IRecordIdentity {\n id: string;\n whoAmI: IRecordIdentityWhoAmI;\n}\n"]}
1
+ {"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/types/records.ts"],"names":[],"mappings":"","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 IPreviewScalar} from '@leav/utils';\nimport {type SystemTranslation} from './scalars';\n\nexport interface IRecordIdentityLibrary {\n id: string;\n label?: SystemTranslation | null;\n}\n\nexport interface IRecordIdentityPreview {\n tiny: string | null;\n small: string | null;\n medium: string | null;\n big: string | null;\n huge: string | null;\n}\n\nexport interface IRecordIdentityWhoAmI {\n id: string;\n label?: string | null;\n subLabel?: string | null;\n color?: string | null;\n library: IRecordIdentityLibrary;\n preview?: IPreviewScalar | null;\n parentContext?: IRecordIdentityWhoAmI[] | null;\n}\n\nexport interface IRecordIdentity {\n id: string;\n whoAmI: IRecordIdentityWhoAmI;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leav/ui",
3
- "version": "1.7.0-68370392",
3
+ "version": "1.7.0-a16d0bd7",
4
4
  "description": "Shared React components and hooks",
5
5
  "scripts": {
6
6
  "prepublishOnly": "yarn build",
@@ -70,7 +70,7 @@
70
70
  "react-router-dom": "^6.22.0"
71
71
  },
72
72
  "dependencies": {
73
- "@ant-design/icons": "5.2.6",
73
+ "@ant-design/icons": "5.6.1",
74
74
  "@ckeditor/ckeditor5-build-inline": "39.0.2",
75
75
  "@ckeditor/ckeditor5-react": "6.1.0",
76
76
  "@dnd-kit/core": "6.1.0",
@@ -1,71 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { RecordFilterCondition } from '../../../../_gqlTypes';
3
- import { SelectTreeNode } from '../../../../components/SelectTreeNode';
4
- import styled from 'styled-components';
5
- import { EmptyValueCheckbox } from '../EmptyValueCheckbox';
6
- const DivStyled = styled.div `
7
- max-height: 30rem;
8
- overflow: auto;
9
- `;
10
- export const TreeAttributeDropDown = ({ filter, onFilterChange, }) => {
11
- const selectedNodesIds = (filter.nodes ?? []).map(node => node.nodeId);
12
- const _handleOnCheckEmptyValue = (selected) => {
13
- onFilterChange({
14
- ...filter,
15
- withEmptyValues: selected,
16
- });
17
- };
18
- const _handleOnSelect = (node, selected) => {
19
- let newSelectedIds;
20
- if (selected) {
21
- newSelectedIds = [...selectedNodesIds, node.id];
22
- }
23
- else {
24
- newSelectedIds = selectedNodesIds.filter(selectedValue => selectedValue !== node.id);
25
- }
26
- onFilterChange({
27
- ...filter,
28
- nodes: newSelectedIds.map(id => ({ nodeId: id, libraryId: node.record.whoAmI.library.id })),
29
- });
30
- };
31
- const _getRecursiveChildrenRecord = (nodes) => {
32
- const records = [];
33
- const collectRecordIdsRecursively = (nodeList) => {
34
- for (const node of nodeList) {
35
- if (node.id === filter.attribute.linkedTree?.id) {
36
- continue;
37
- }
38
- if (node.record) {
39
- records.push(node.record);
40
- }
41
- if (node.children && node.children.length > 0) {
42
- collectRecordIdsRecursively(node.children);
43
- }
44
- }
45
- };
46
- collectRecordIdsRecursively(nodes);
47
- // Delete duplicates
48
- return Array.from(new Set(records));
49
- };
50
- const _getRecursiveFieldsFromLibraries = (nodes) => nodes
51
- .filter(node => !!node.record?.whoAmI?.library?.id)
52
- .map(node => `${filter.attribute.id}.${node.record?.whoAmI?.library?.id}.id`);
53
- const _handleOnCheck = (selection) => {
54
- const newSelectedNodes = selection.filter(node => !node?.disabled);
55
- const records = _getRecursiveChildrenRecord(selection);
56
- const fields = _getRecursiveFieldsFromLibraries(selection);
57
- onFilterChange({
58
- ...filter,
59
- nodes: newSelectedNodes.map(node => ({
60
- nodeId: node.id,
61
- libraryId: node.record?.whoAmI.library.id ?? records[0]?.whoAmI.library.id ?? '',
62
- })),
63
- value: records.map(record => record.id),
64
- formattedValue: records.map(record => record.whoAmI.label).filter(Boolean),
65
- condition: RecordFilterCondition.EQUAL,
66
- field: fields,
67
- });
68
- };
69
- return (_jsxs(DivStyled, { children: [_jsx(EmptyValueCheckbox, { onSelect: _handleOnCheckEmptyValue, filter: filter }), _jsx(SelectTreeNode, { treeId: filter.attribute.linkedTree?.id ?? '', selectedNodes: selectedNodesIds, onSelect: _handleOnSelect, onCheck: _handleOnCheck, multiple: true, canSelectRoot: true, checkStrictly: false, checkable: true, loadRecursively: true, noPagination: true })] }));
70
- };
71
- //# sourceMappingURL=TreeAttributeDropDown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TreeAttributeDropDown.js","sourceRoot":"","sources":["../../../../../src/components/Filters/filter-items/filter-type/TreeAttributeDropDown.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,qBAAqB,EAAC,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAC7D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AAEzD,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAG3B,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAwD,CAAC,EACvF,MAAM,EACN,cAAc,GACjB,EAAE,EAAE;IACD,MAAM,gBAAgB,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEvE,MAAM,wBAAwB,GAAG,CAAC,QAAiB,EAAE,EAAE;QACnD,cAAc,CAAC;YACX,GAAG,MAAM;Y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AG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;YAC1E,SAAS,EAAE,qBAAqB,CAAC,KAAK;YACtC,KAAK,EAAE,MAAM;SAChB,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,CACH,MAAC,SAAS,eACN,KAAC,kBAAkB,IAAC,QAAQ,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,GAAI,EAC1E,KAAC,cAAc,IACX,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,EAC7C,aAAa,EAAE,gBAAgB,EAC/B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,cAAc,EACvB,QAAQ,QACR,aAAa,EAAE,IAAI,EACnB,aAAa,EAAE,KAAK,EACpB,SAAS,QACT,eAAe,EAAE,IAAI,EACrB,YAAY,EAAE,IAAI,GACpB,IACM,CACf,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent} from 'react';\nimport {type IRecordIdentity, type ITreeNodeWithRecord} from '_ui/types';\nimport {RecordFilterCondition} from '_ui/_gqlTypes';\nimport {type IFilterChildrenTreeDropDownProps} from './_types';\nimport {SelectTreeNode} from '_ui/components/SelectTreeNode';\nimport styled from 'styled-components';\nimport {EmptyValueCheckbox} from '../EmptyValueCheckbox';\n\nconst DivStyled = styled.div`\n max-height: 30rem;\n overflow: auto;\n`;\n\nexport const TreeAttributeDropDown: FunctionComponent<IFilterChildrenTreeDropDownProps> = ({\n filter,\n onFilterChange,\n}) => {\n const selectedNodesIds = (filter.nodes ?? []).map(node => node.nodeId);\n\n const _handleOnCheckEmptyValue = (selected: boolean) => {\n onFilterChange({\n ...filter,\n withEmptyValues: selected,\n });\n };\n\n const _handleOnSelect = (node: ITreeNodeWithRecord, selected: boolean) => {\n let newSelectedIds: string[];\n if (selected) {\n newSelectedIds = [...selectedNodesIds, node.id];\n } else {\n newSelectedIds = selectedNodesIds.filter(selectedValue => selectedValue !== node.id);\n }\n onFilterChange({\n ...filter,\n nodes: newSelectedIds.map(id => ({nodeId: id, libraryId: node.record.whoAmI.library.id})),\n });\n };\n\n const _getRecursiveChildrenRecord = (nodes: ITreeNodeWithRecord[]): IRecordIdentity[] => {\n const records: IRecordIdentity[] = [];\n const collectRecordIdsRecursively = (nodeList: ITreeNodeWithRecord[]) => {\n for (const node of nodeList) {\n if (node.id === filter.attribute.linkedTree?.id) {\n continue;\n }\n if (node.record) {\n records.push(node.record);\n }\n if (node.children && node.children.length > 0) {\n collectRecordIdsRecursively(node.children);\n }\n }\n };\n collectRecordIdsRecursively(nodes);\n // Delete duplicates\n return Array.from(new Set(records));\n };\n const _getRecursiveFieldsFromLibraries = (nodes: ITreeNodeWithRecord[]): string[] =>\n nodes\n .filter(node => !!node.record?.whoAmI?.library?.id)\n .map(node => `${filter.attribute.id}.${node.record?.whoAmI?.library?.id}.id`);\n\n const _handleOnCheck = (selection: ITreeNodeWithRecord[]) => {\n const newSelectedNodes = selection.filter(node => !node?.disabled);\n\n const records = _getRecursiveChildrenRecord(selection);\n const fields = _getRecursiveFieldsFromLibraries(selection);\n\n onFilterChange({\n ...filter,\n nodes: newSelectedNodes.map(node => ({\n nodeId: node.id,\n libraryId: node.record?.whoAmI.library.id ?? records[0]?.whoAmI.library.id ?? '',\n })),\n value: records.map(record => record.id),\n formattedValue: records.map(record => record.whoAmI.label).filter(Boolean),\n condition: RecordFilterCondition.EQUAL,\n field: fields,\n });\n };\n\n return (\n <DivStyled>\n <EmptyValueCheckbox onSelect={_handleOnCheckEmptyValue} filter={filter} />\n <SelectTreeNode\n treeId={filter.attribute.linkedTree?.id ?? ''}\n selectedNodes={selectedNodesIds}\n onSelect={_handleOnSelect}\n onCheck={_handleOnCheck}\n multiple\n canSelectRoot={true}\n checkStrictly={false}\n checkable\n loadRecursively={true}\n noPagination={true}\n />\n </DivStyled>\n );\n};\n"]}