@leav/ui 1.6.0-4fe8c6ba → 1.6.0-638134f7

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 (91) hide show
  1. package/dist/components/Explorer/TableCell.js +5 -7
  2. package/dist/components/Explorer/TableCell.js.map +1 -1
  3. package/dist/components/Explorer/TableNameCell.js +3 -2
  4. package/dist/components/Explorer/TableNameCell.js.map +1 -1
  5. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js +3 -2
  6. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -1
  7. package/dist/components/Explorer/actions-item/useReplaceItemAction.js +3 -2
  8. package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
  9. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +3 -2
  10. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
  11. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +3 -2
  12. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
  13. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +3 -2
  14. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
  15. package/dist/components/Explorer/actions-mass/useExportMassAction.js +3 -2
  16. package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
  17. package/dist/components/Explorer/actions-mass/useMassActions.js +3 -2
  18. package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
  19. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +3 -2
  20. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
  21. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +3 -2
  22. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
  23. package/dist/components/Explorer/list-saved-views/SavedViews.js +4 -3
  24. package/dist/components/Explorer/list-saved-views/SavedViews.js.map +1 -1
  25. package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js +5 -8
  26. package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js.map +1 -1
  27. package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js +3 -2
  28. package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js.map +1 -1
  29. package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +7 -6
  30. package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -1
  31. package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js +3 -2
  32. package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js.map +1 -1
  33. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +4 -3
  34. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
  35. package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js +3 -2
  36. package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js.map +1 -1
  37. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js +3 -2
  38. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js.map +1 -1
  39. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js +3 -2
  40. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js.map +1 -1
  41. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js +3 -2
  42. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js.map +1 -1
  43. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js +4 -3
  44. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js.map +1 -1
  45. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js +3 -2
  46. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js.map +1 -1
  47. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js +3 -2
  48. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js.map +1 -1
  49. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js +3 -2
  50. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js.map +1 -1
  51. package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js +3 -2
  52. package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js.map +1 -1
  53. package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js +7 -6
  54. package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js.map +1 -1
  55. package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js +3 -2
  56. package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js.map +1 -1
  57. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js +3 -2
  58. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js.map +1 -1
  59. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js +4 -3
  60. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js.map +1 -1
  61. package/dist/components/LibraryItemsList/MenuView/MenuView.js +4 -4
  62. package/dist/components/LibraryItemsList/MenuView/MenuView.js.map +1 -1
  63. package/dist/components/LibraryItemsList/ViewPanel/View/View.js +3 -2
  64. package/dist/components/LibraryItemsList/ViewPanel/View/View.js.map +1 -1
  65. package/dist/components/Notifications/hooks/useNotificationSubscription.js +3 -2
  66. package/dist/components/Notifications/hooks/useNotificationSubscription.js.map +1 -1
  67. package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js +5 -20
  68. package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js.map +1 -1
  69. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js +4 -3
  70. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +1 -1
  71. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +4 -3
  72. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
  73. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +3 -2
  74. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
  75. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +3 -2
  76. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -1
  77. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +2 -5
  78. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
  79. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js +3 -2
  80. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -1
  81. package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js +3 -2
  82. package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js.map +1 -1
  83. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +4 -3
  84. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
  85. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js +3 -2
  86. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js.map +1 -1
  87. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +3 -5
  88. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
  89. package/dist/components/SelectTreeNode/TreeNodeTitle.js +3 -2
  90. package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -1
  91. package/package.json +5 -3
@@ -1 +1 @@
1
- {"version":3,"file":"TreeField.js","sourceRoot":"","sources":["../../../../../../src/components/Record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oB,GAAG,SAAS,CAAC,EAAE,iBAC3B,YAAY,EACxB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAC5B,QAAQ,QACR,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAC5C,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,yBACtC,UAAU,EAC/B,KAAK,EACD,8BACI,KAAC,yBAAyB,cACtB,KAAC,gBAAgB,IAAC,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,GAAI,GAC9D,EAC3B,kBAAkB,IACpB,aAGP,KAAC,YAAY,IACT,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,GACxB,EACD,CAAC,UAAU,IAAI,CACZ,KAAC,0BAA0B,IACvB,IAAI,EAAE,KAAC,MAAM,KAAG,EAChB,OAAO,EAAE,SAAS,EAClB,IAAI,EAAC,GAAG,iBACK,CAAC,aAAa,EAAE,MAAM,YAElC,iBAAiB,GACO,CAChC,EACA,mBAAmB,IACA,GACb,GACA,CACtB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,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, useEffect, useState} from 'react';\nimport styled, {css} from 'styled-components';\nimport {type ICommonFieldsSettings, localizedTranslation} from '@leav/utils';\nimport {AntForm, KitButton, KitInputWrapper} from 'aristid-ds';\nimport {FaList} from 'react-icons/fa';\nimport {useLang} from '_ui/hooks';\nimport {type IFormElementProps} from '../../_types';\nimport {\n type ChildrenAsRecordValuePermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n RecordPermissionsActions,\n} from '_ui/_gqlTypes';\nimport {TREE_FIELD_ID_PREFIX} from '_ui/constants';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {TreeNodeList} from './display-tree-node/TreeNodeList';\nimport {useManageTreeNodeSelection} from './manage-tree-node-selection/useManageTreeNodeSelection';\nimport {useOutsideInteractionDetector} from '../shared/useOutsideInteractionDetector';\nimport {useEditRecordReducer} from '_ui/components/RecordEdition/editRecordReducer/useEditRecordReducer';\nimport {EditRecordReducerActionsTypes} from '_ui/components/RecordEdition/editRecordReducer/editRecordReducer';\nimport {computeCalculatedFlags, computeInheritedFlags} from '../shared/calculatedInheritedFlags';\nimport {ComputeIndicator} from '../shared/ComputeIndicator';\n\nconst StyledWrapperDiv = styled.div<{$metadataEdit: boolean}>`\n margin-bottom: ${props => (props.$metadataEdit ? 0 : '1.5em')};\n`;\n\nconst KitInputExtraAlignLeftDiv = styled.div`\n margin-right: auto;\n line-height: 12px;\n`;\n\nconst StyledFieldFooterKitButton = styled(KitButton)<{$hasNoValue: boolean}>`\n margin-top: ${props => (props.$hasNoValue ? 0 : 'calc((var(--general-spacing-xs)) * 1px)')};\n`;\n\nconst KitInputWrapperStyled = styled(KitInputWrapper)<{$readonlyBackground: boolean}>`\n .kit-input-wrapper-content {\n min-height: 48px;\n }\n\n ${props =>\n props.$readonlyBackground &&\n css`\n .kit-input-wrapper-content {\n background-color: var(--general-utilities-neutral-light);\n }\n `}\n`;\n\ntype TreeFieldProps = IFormElementProps<ICommonFieldsSettings>;\n\nconst TreeField: FunctionComponent<TreeFieldProps> = ({\n element,\n readonly,\n isFormCreationMode,\n onDeleteMultipleValues,\n onValueSubmit,\n onValueDelete,\n metadataEdit = false,\n}) => {\n const {state, dispatch} = useEditRecordReducer();\n const {lang} = useLang();\n const {\n settings,\n attribute,\n values,\n }: {\n settings: typeof element.settings;\n attribute?: RecordFormAttributeTreeAttributeFragment;\n values?: RecordFormElementsValueTreeValue[];\n } = element;\n\n const [backendValues, setBackendValues] = useState<RecordFormElementsValueTreeValue[]>(values);\n\n const calculatedFlags = computeCalculatedFlags(backendValues);\n const inheritedFlags = computeInheritedFlags(backendValues);\n const label = localizedTranslation(settings.label, lang);\n const form = AntForm.useFormInstance();\n const fieldErrors = form.getFieldError(attribute.id);\n\n // TODO: Temporary const that should be removed (and all it's usages) when we will have a proper way to override multiple values\n const tmpCantOverrideValues =\n attribute.multiple_values &&\n (calculatedFlags.calculatedValues?.length > 1 || inheritedFlags.inheritedValues?.length > 1);\n\n const isReadOnly = attribute.readonly || !attribute.permissions.edit_value || readonly || tmpCantOverrideValues;\n const isFieldInError = fieldErrors.length > 0;\n\n useEffect(() => {\n if (state.activeAttribute?.attribute.id === attribute.id) {\n dispatch({\n type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,\n values: backendValues,\n });\n }\n }, [backendValues]);\n\n useOutsideInteractionDetector({\n attribute,\n activeAttribute: state.activeAttribute,\n attributePrefix: TREE_FIELD_ID_PREFIX,\n dispatch,\n backendValues,\n allowedSelectors: ['.kit-modal-wrapper'],\n });\n\n const childrenAsRecordValuePermissionFilter: ChildrenAsRecordValuePermissionFilterInput = {\n libraryId: state.libraryId,\n attributeId: state.activeAttribute?.attribute?.id,\n action: RecordPermissionsActions.create_record,\n };\n\n const {openModal, removeTreeNode, actionButtonLabel, SelectTreeNodeModal, RemoveAllTreeNodes} =\n useManageTreeNodeSelection({\n modaleTitle: label,\n attribute,\n isFormCreationMode,\n backendValues,\n setBackendValues,\n onValueSubmit,\n onValueDelete,\n onDeleteMultipleValues,\n isReadOnly,\n isFieldInError,\n childrenAsRecordValuePermissionFilter,\n });\n\n return (\n <StyledWrapperDiv $metadataEdit={metadataEdit}>\n <AntForm.Item name={attribute.id} noStyle>\n <KitInputWrapperStyled\n id={TREE_FIELD_ID_PREFIX + attribute.id}\n data-testid=\"tree-field\"\n label={label}\n required={attribute.required}\n bordered\n status={isFieldInError ? 'error' : undefined}\n helper={isFieldInError ? String(fieldErrors[0]) : undefined}\n $readonlyBackground={isReadOnly}\n extra={\n <>\n <KitInputExtraAlignLeftDiv>\n <ComputeIndicator calculatedFlags={calculatedFlags} inheritedFlags={inheritedFlags} />\n </KitInputExtraAlignLeftDiv>\n {RemoveAllTreeNodes}\n </>\n }\n >\n <TreeNodeList\n attribute={attribute}\n backendValues={backendValues}\n removeTreeNode={removeTreeNode}\n isReadOnly={isReadOnly}\n />\n {!isReadOnly && (\n <StyledFieldFooterKitButton\n icon={<FaList />}\n onClick={openModal}\n size=\"m\"\n $hasNoValue={!backendValues?.length}\n >\n {actionButtonLabel}\n </StyledFieldFooterKitButton>\n )}\n {SelectTreeNodeModal}\n </KitInputWrapperStyled>\n </AntForm.Item>\n </StyledWrapperDiv>\n );\n};\n\nexport default TreeField;\n"]}
1
+ {"version":3,"file":"TreeField.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClE,OAAO,MAAM,EAAE,EAAC,GAAG,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAA6B,oBAAoB,EAAC,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;AACzD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,OAAO,EAGH,wBAAwB,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAC,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAC,0B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vB,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,MAAM,GAAI,EACvC,OAAO,EAAE,SAAS,EAClB,IAAI,EAAC,GAAG,iBACK,CAAC,aAAa,EAAE,MAAM,YAElC,iBAAiB,GACO,CAChC,EACA,mBAAmB,IACA,GACb,GACA,CACtB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,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, useEffect, useState} from 'react';\nimport styled, {css} from 'styled-components';\nimport {type ICommonFieldsSettings, localizedTranslation} from '@leav/utils';\nimport {AntForm, KitButton, KitInputWrapper} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faList} from '@fortawesome/free-solid-svg-icons';\nimport {useLang} from '_ui/hooks';\nimport {type IFormElementProps} from '../../_types';\nimport {\n type ChildrenAsRecordValuePermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n RecordPermissionsActions,\n} from '_ui/_gqlTypes';\nimport {TREE_FIELD_ID_PREFIX} from '_ui/constants';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {TreeNodeList} from './display-tree-node/TreeNodeList';\nimport {useManageTreeNodeSelection} from './manage-tree-node-selection/useManageTreeNodeSelection';\nimport {useOutsideInteractionDetector} from '../shared/useOutsideInteractionDetector';\nimport {useEditRecordReducer} from '_ui/components/RecordEdition/editRecordReducer/useEditRecordReducer';\nimport {EditRecordReducerActionsTypes} from '_ui/components/RecordEdition/editRecordReducer/editRecordReducer';\nimport {computeCalculatedFlags, computeInheritedFlags} from '../shared/calculatedInheritedFlags';\nimport {ComputeIndicator} from '../shared/ComputeIndicator';\n\nconst StyledWrapperDiv = styled.div<{$metadataEdit: boolean}>`\n margin-bottom: ${props => (props.$metadataEdit ? 0 : '1.5em')};\n`;\n\nconst KitInputExtraAlignLeftDiv = styled.div`\n margin-right: auto;\n line-height: 12px;\n`;\n\nconst StyledFieldFooterKitButton = styled(KitButton)<{$hasNoValue: boolean}>`\n margin-top: ${props => (props.$hasNoValue ? 0 : 'calc((var(--general-spacing-xs)) * 1px)')};\n`;\n\nconst KitInputWrapperStyled = styled(KitInputWrapper)<{$readonlyBackground: boolean}>`\n .kit-input-wrapper-content {\n min-height: 48px;\n }\n\n ${props =>\n props.$readonlyBackground &&\n css`\n .kit-input-wrapper-content {\n background-color: var(--general-utilities-neutral-light);\n }\n `}\n`;\n\ntype TreeFieldProps = IFormElementProps<ICommonFieldsSettings>;\n\nconst TreeField: FunctionComponent<TreeFieldProps> = ({\n element,\n readonly,\n isFormCreationMode,\n onDeleteMultipleValues,\n onValueSubmit,\n onValueDelete,\n metadataEdit = false,\n}) => {\n const {state, dispatch} = useEditRecordReducer();\n const {lang} = useLang();\n const {\n settings,\n attribute,\n values,\n }: {\n settings: typeof element.settings;\n attribute?: RecordFormAttributeTreeAttributeFragment;\n values?: RecordFormElementsValueTreeValue[];\n } = element;\n\n const [backendValues, setBackendValues] = useState<RecordFormElementsValueTreeValue[]>(values);\n\n const calculatedFlags = computeCalculatedFlags(backendValues);\n const inheritedFlags = computeInheritedFlags(backendValues);\n const label = localizedTranslation(settings.label, lang);\n const form = AntForm.useFormInstance();\n const fieldErrors = form.getFieldError(attribute.id);\n\n // TODO: Temporary const that should be removed (and all it's usages) when we will have a proper way to override multiple values\n const tmpCantOverrideValues =\n attribute.multiple_values &&\n (calculatedFlags.calculatedValues?.length > 1 || inheritedFlags.inheritedValues?.length > 1);\n\n const isReadOnly = attribute.readonly || !attribute.permissions.edit_value || readonly || tmpCantOverrideValues;\n const isFieldInError = fieldErrors.length > 0;\n\n useEffect(() => {\n if (state.activeAttribute?.attribute.id === attribute.id) {\n dispatch({\n type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,\n values: backendValues,\n });\n }\n }, [backendValues]);\n\n useOutsideInteractionDetector({\n attribute,\n activeAttribute: state.activeAttribute,\n attributePrefix: TREE_FIELD_ID_PREFIX,\n dispatch,\n backendValues,\n allowedSelectors: ['.kit-modal-wrapper'],\n });\n\n const childrenAsRecordValuePermissionFilter: ChildrenAsRecordValuePermissionFilterInput = {\n libraryId: state.libraryId,\n attributeId: state.activeAttribute?.attribute?.id,\n action: RecordPermissionsActions.create_record,\n };\n\n const {openModal, removeTreeNode, actionButtonLabel, SelectTreeNodeModal, RemoveAllTreeNodes} =\n useManageTreeNodeSelection({\n modaleTitle: label,\n attribute,\n isFormCreationMode,\n backendValues,\n setBackendValues,\n onValueSubmit,\n onValueDelete,\n onDeleteMultipleValues,\n isReadOnly,\n isFieldInError,\n childrenAsRecordValuePermissionFilter,\n });\n\n return (\n <StyledWrapperDiv $metadataEdit={metadataEdit}>\n <AntForm.Item name={attribute.id} noStyle>\n <KitInputWrapperStyled\n id={TREE_FIELD_ID_PREFIX + attribute.id}\n data-testid=\"tree-field\"\n label={label}\n required={attribute.required}\n bordered\n status={isFieldInError ? 'error' : undefined}\n helper={isFieldInError ? String(fieldErrors[0]) : undefined}\n $readonlyBackground={isReadOnly}\n extra={\n <>\n <KitInputExtraAlignLeftDiv>\n <ComputeIndicator calculatedFlags={calculatedFlags} inheritedFlags={inheritedFlags} />\n </KitInputExtraAlignLeftDiv>\n {RemoveAllTreeNodes}\n </>\n }\n >\n <TreeNodeList\n attribute={attribute}\n backendValues={backendValues}\n removeTreeNode={removeTreeNode}\n isReadOnly={isReadOnly}\n />\n {!isReadOnly && (\n <StyledFieldFooterKitButton\n icon={<FontAwesomeIcon icon={faList} />}\n onClick={openModal}\n size=\"m\"\n $hasNoValue={!backendValues?.length}\n >\n {actionButtonLabel}\n </StyledFieldFooterKitButton>\n )}\n {SelectTreeNodeModal}\n </KitInputWrapperStyled>\n </AntForm.Item>\n </StyledWrapperDiv>\n );\n};\n\nexport default TreeField;\n"]}
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
3
3
  import { KitAvatar, KitBreadcrumb, KitIdCard, KitItemList, KitSpace } from 'aristid-ds';
4
- import { FaTrash } from 'react-icons/fa';
4
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
+ import { faTrash } from '@fortawesome/free-solid-svg-icons';
5
6
  import styled from 'styled-components';
6
7
  const KitItemListStyled = styled(KitItemList) `
7
8
  border: none;
@@ -39,7 +40,7 @@ const TreeNodeItem = ({ color, label, ancestors, canDelete, onClickToDelete, isR
39
40
  ? [
40
41
  {
41
42
  key: 'delete',
42
- icon: _jsx(FaTrash, {}),
43
+ icon: _jsx(FontAwesomeIcon, { icon: faTrash }),
43
44
  label: t('global.delete'),
44
45
  title: t('global.delete'),
45
46
  onClick: onClickToDelete,
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeItem.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AACtF,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;;;;;;;CAO5C,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;;;;;;;;;;;;;;;;CAiBhD,CAAC;AAEF,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC;AAWzB,MAAM,YAAY,GAAG,CAAC,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAwB,EAAE,EAAE;IAC9G,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,OAAO,CACH,KAAC,iBAAiB,IACd,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,UAAU,EACpB,gBAAgB,EACZ,MAAC,QAAQ,IAAC,SAAS,EAAC,YAAY,aAC5B,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,QAAQ,GAAG,EACxD,MAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,MAAM,aACtC,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,GAAI,EAC3B,KAAC,mBAAmB,IAChB,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gCAC/B,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK;6BACtC,CAAC,CAAC,EACH,SAAS,EAAE,oBAAoB,GACjC,IACK,IACJ,EAEf,OAAO,EACH,SAAS;YACL,CAAC,CAAC;gBACI;oBACI,GAAG,EAAE,QAAQ;oBACb,IAAI,EAAE,KAAC,OAAO,KAAG;oBACjB,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC;oBACzB,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC;oBACzB,OAAO,EAAE,eAAe;iBAC3B;aACJ;YACH,CAAC,CAAC,SAAS,GAErB,CACL,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,YAAY,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 RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitAvatar, KitBreadcrumb, KitIdCard, KitItemList, KitSpace} from 'aristid-ds';\nimport {FaTrash} from 'react-icons/fa';\nimport styled from 'styled-components';\n\nconst KitItemListStyled = styled(KitItemList)`\n border: none;\n padding: 0;\n\n &:hover:not(.kit-item-list-disabled) {\n box-shadow: none;\n }\n`;\n\nconst KitBreadcrumbStyled = styled(KitBreadcrumb)`\n &.ant-breadcrumb {\n li:last-child .ant-breadcrumb-link {\n color: var(--general-utilities-text-primary);\n }\n\n a {\n cursor: initial;\n pointer-events: none;\n\n &:hover {\n background-color: initial;\n cursor: initial;\n pointer-events: none;\n }\n }\n }\n`;\n\nconst BREADCRUMB_SEPARATOR = '>';\n\nconst NOT_FOCUSABLE = -1;\n\ninterface IUseTreeNodeItemProps {\n color?: RecordFormElementsValueTreeValue['treeValue']['record']['whoAmI']['color'];\n label?: RecordFormElementsValueTreeValue['treeValue']['record']['whoAmI']['label'];\n ancestors?: RecordFormElementsValueTreeValue['treeValue']['ancestors'];\n canDelete?: boolean;\n onClickToDelete?: (node: RecordFormElementsValueTreeValue) => void;\n isReadOnly?: boolean;\n}\n\nconst TreeNodeItem = ({color, label, ancestors, canDelete, onClickToDelete, isReadOnly}: IUseTreeNodeItemProps) => {\n const {t} = useSharedTranslation();\n\n return (\n <KitItemListStyled\n tabIndex={NOT_FOCUSABLE} // We don't want ItemList to be focusable\n disabled={isReadOnly}\n idCardSubstitute={\n <KitSpace direction=\"horizontal\">\n <KitAvatar color={color} label={label} shape=\"square\" />\n <KitSpace direction=\"vertical\" size=\"none\">\n <KitIdCard title={label} />\n <KitBreadcrumbStyled\n items={ancestors?.map(ancestor => ({\n title: ancestor.record.whoAmI.label,\n }))}\n separator={BREADCRUMB_SEPARATOR}\n />\n </KitSpace>\n </KitSpace>\n }\n actions={\n canDelete\n ? [\n {\n key: 'delete',\n icon: <FaTrash />,\n label: t('global.delete'),\n title: t('global.delete'),\n onClick: onClickToDelete,\n },\n ]\n : undefined\n }\n />\n );\n};\n\nexport default TreeNodeItem;\n"]}
1
+ {"version":3,"file":"TreeNodeItem.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AACtF,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAC,MAAM,mCAAmC,CAAC;AAC1D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;;;;;;;CAO5C,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;;;;;;;;;;;;;;;;CAiBhD,CAAC;AAEF,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC;AAWzB,MAAM,YAAY,GAAG,CAAC,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAwB,EAAE,EAAE;IAC9G,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,OAAO,CACH,KAAC,iBAAiB,IACd,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,UAAU,EACpB,gBAAgB,EACZ,MAAC,QAAQ,IAAC,SAAS,EAAC,YAAY,aAC5B,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,QAAQ,GAAG,EACxD,MAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,MAAM,aACtC,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,GAAI,EAC3B,KAAC,mBAAmB,IAChB,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gCAC/B,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK;6BACtC,CAAC,CAAC,EACH,SAAS,EAAE,oBAAoB,GACjC,IACK,IACJ,EAEf,OAAO,EACH,SAAS;YACL,CAAC,CAAC;gBACI;oBACI,GAAG,EAAE,QAAQ;oBACb,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI;oBACxC,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC;oBACzB,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC;oBACzB,OAAO,EAAE,eAAe;iBAC3B;aACJ;YACH,CAAC,CAAC,SAAS,GAErB,CACL,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,YAAY,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 RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitAvatar, KitBreadcrumb, KitIdCard, KitItemList, KitSpace} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faTrash} from '@fortawesome/free-solid-svg-icons';\nimport styled from 'styled-components';\n\nconst KitItemListStyled = styled(KitItemList)`\n border: none;\n padding: 0;\n\n &:hover:not(.kit-item-list-disabled) {\n box-shadow: none;\n }\n`;\n\nconst KitBreadcrumbStyled = styled(KitBreadcrumb)`\n &.ant-breadcrumb {\n li:last-child .ant-breadcrumb-link {\n color: var(--general-utilities-text-primary);\n }\n\n a {\n cursor: initial;\n pointer-events: none;\n\n &:hover {\n background-color: initial;\n cursor: initial;\n pointer-events: none;\n }\n }\n }\n`;\n\nconst BREADCRUMB_SEPARATOR = '>';\n\nconst NOT_FOCUSABLE = -1;\n\ninterface IUseTreeNodeItemProps {\n color?: RecordFormElementsValueTreeValue['treeValue']['record']['whoAmI']['color'];\n label?: RecordFormElementsValueTreeValue['treeValue']['record']['whoAmI']['label'];\n ancestors?: RecordFormElementsValueTreeValue['treeValue']['ancestors'];\n canDelete?: boolean;\n onClickToDelete?: (node: RecordFormElementsValueTreeValue) => void;\n isReadOnly?: boolean;\n}\n\nconst TreeNodeItem = ({color, label, ancestors, canDelete, onClickToDelete, isReadOnly}: IUseTreeNodeItemProps) => {\n const {t} = useSharedTranslation();\n\n return (\n <KitItemListStyled\n tabIndex={NOT_FOCUSABLE} // We don't want ItemList to be focusable\n disabled={isReadOnly}\n idCardSubstitute={\n <KitSpace direction=\"horizontal\">\n <KitAvatar color={color} label={label} shape=\"square\" />\n <KitSpace direction=\"vertical\" size=\"none\">\n <KitIdCard title={label} />\n <KitBreadcrumbStyled\n items={ancestors?.map(ancestor => ({\n title: ancestor.record.whoAmI.label,\n }))}\n separator={BREADCRUMB_SEPARATOR}\n />\n </KitSpace>\n </KitSpace>\n }\n actions={\n canDelete\n ? [\n {\n key: 'delete',\n icon: <FontAwesomeIcon icon={faTrash} />,\n label: t('global.delete'),\n title: t('global.delete'),\n onClick: onClickToDelete,\n },\n ]\n : undefined\n }\n />\n );\n};\n\nexport default TreeNodeItem;\n"]}
@@ -3,9 +3,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
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 { FaCheck } from 'react-icons/fa';
7
- import { faXmark } from '@fortawesome/free-solid-svg-icons';
8
6
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
7
+ import { faCheck, faXmark } from '@fortawesome/free-solid-svg-icons';
9
8
  import { KitButton, KitModal } from 'aristid-ds';
10
9
  import { SelectTreeNode } from '../../../../../../components/SelectTreeNode';
11
10
  import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
@@ -31,9 +30,7 @@ export const SelectTreeNodeModal = ({ title, open, attribute, backendValues, onC
31
30
  onConfirm(selectedNodes);
32
31
  onClose();
33
32
  };
34
- return (_jsx(KitModal, { appElement: document.getElementById('root'), className: className, showCloseIcon: true, width: SELECT_TREE_NODE_MODAL_WIDTH, height: SELECT_TREE_NODE_MODAL_HEIGHT, title: title, isOpen: open, close: onClose, footer: _jsxs(_Fragment, { children: [_jsx(KitButton, { icon:
35
- // We can't used react-icons here because it's doesn't have the faXmark icon
36
- _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: onClose, children: t('global.close') }), attribute.multiple_values && (_jsx(KitButton, { type: "primary", icon: _jsx(FaCheck, {}), disabled: selectedNodes.length === 0, onClick: _handleOnConfirm, children: t('global.confirm') }))] }), children: _jsx(SelectTreeNode, { treeId: attribute.linked_tree.id, multiple // We want to be able to set as selected in the tree components, the nodes that are already selected and the disabled nodes
33
+ return (_jsx(KitModal, { appElement: document.getElementById('root'), className: className, showCloseIcon: true, width: SELECT_TREE_NODE_MODAL_WIDTH, height: SELECT_TREE_NODE_MODAL_HEIGHT, title: title, isOpen: open, close: onClose, footer: _jsxs(_Fragment, { children: [_jsx(KitButton, { icon: _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: onClose, children: t('global.close') }), attribute.multiple_values && (_jsx(KitButton, { type: "primary", icon: _jsx(FontAwesomeIcon, { icon: faCheck }), disabled: selectedNodes.length === 0, onClick: _handleOnConfirm, children: t('global.confirm') }))] }), children: _jsx(SelectTreeNode, { treeId: attribute.linked_tree.id, multiple // We want to be able to set as selected in the tree components, the nodes that are already selected and the disabled nodes
37
34
  : true, selectedNodes: [
38
35
  ...selectedNodes.map(node => node.id),
39
36
  ...backendValues.map(value => value.treeValue.id),
@@ -1 +1 @@
1
- {"version":3,"file":"SelectTreeNodeModal.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree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,EAAE,CAAC;aACpD,EACD,qCAAqC,EAAE,qCAAqC,EAC5E,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,EAC9F,QAAQ,EAAE,eAAe,GAC3B,GACK,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 ComponentProps, type FunctionComponent, useState} from 'react';\nimport {FaCheck} from 'react-icons/fa';\nimport {faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {KitButton, KitModal} from 'aristid-ds';\nimport {\n type ChildrenAsRecordValuePermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n} from '_ui/_gqlTypes';\nimport {SelectTreeNode} from '_ui/components/SelectTreeNode';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ITreeNodeWithRecord} from '_ui/types';\n\nconst SELECT_TREE_NODE_MODAL_HEIGHT = '563px';\nconst SELECT_TREE_NODE_MODAL_WIDTH = '656px';\n\ntype SelectTreeNodeModalBackendValue =\n | RecordFormElementsValueTreeValue\n | {\n treeValue: {\n id: string;\n };\n };\n\ntype SelectTreeNodeModalAttribute =\n | RecordFormAttributeTreeAttributeFragment\n | {\n multiple_values: boolean;\n linked_tree: {\n id: string;\n };\n };\n\ninterface ISelectTreeNodeModalProps {\n title: string;\n open: boolean;\n attribute: SelectTreeNodeModalAttribute;\n backendValues: SelectTreeNodeModalBackendValue[];\n onConfirm: (selectedNodes: ITreeNodeWithRecord[]) => void;\n onClose: () => void;\n childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;\n className?: string;\n}\n\nexport const SelectTreeNodeModal: FunctionComponent<ISelectTreeNodeModalProps> = ({\n title,\n open,\n attribute,\n backendValues,\n onConfirm,\n onClose,\n childrenAsRecordValuePermissionFilter,\n className,\n}) => {\n const {t} = useSharedTranslation();\n\n const [selectedNodes, setSelectedNodes] = useState<ITreeNodeWithRecord[]>([]);\n\n const _handleOnSelect: ComponentProps<typeof SelectTreeNode>['onSelect'] = (node, selected) => {\n if (!attribute.multiple_values) {\n onConfirm(selected ? [node] : []);\n onClose();\n return;\n }\n\n if (selected) {\n setSelectedNodes(prev => [...prev, node]);\n } else {\n setSelectedNodes(prev => prev.filter(selectedValue => selectedValue.id !== node.id));\n }\n };\n\n const _handleOnConfirm: ComponentProps<typeof KitButton>['onClick'] = () => {\n onConfirm(selectedNodes);\n onClose();\n };\n\n return (\n <KitModal\n appElement={document.getElementById('root')}\n className={className}\n showCloseIcon\n width={SELECT_TREE_NODE_MODAL_WIDTH}\n height={SELECT_TREE_NODE_MODAL_HEIGHT}\n title={title}\n isOpen={open}\n close={onClose}\n footer={\n <>\n <KitButton\n icon={\n // We can't used react-icons here because it's doesn't have the faXmark icon\n <FontAwesomeIcon icon={faXmark} />\n }\n onClick={onClose}\n >\n {t('global.close')}\n </KitButton>\n {attribute.multiple_values && (\n <KitButton\n type=\"primary\"\n icon={<FaCheck />}\n disabled={selectedNodes.length === 0}\n onClick={_handleOnConfirm}\n >\n {t('global.confirm')}\n </KitButton>\n )}\n </>\n }\n >\n <SelectTreeNode\n treeId={attribute.linked_tree.id}\n multiple // We want to be able to set as selected in the tree components, the nodes that are already selected and the disabled nodes\n selectedNodes={[\n ...selectedNodes.map(node => node.id),\n ...backendValues.map(value => value.treeValue.id),\n ]}\n childrenAsRecordValuePermissionFilter={childrenAsRecordValuePermissionFilter}\n disabledNodes={backendValues.map(value => value.treeValue.id).concat(attribute.linked_tree.id)}\n onSelect={_handleOnSelect}\n />\n </KitModal>\n );\n};\n"]}
1
+ {"version":3,"file":"SelectTreeNodeModal.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA8C,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAK/C,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,MAAM,6BAA6B,GAAG,OAAO,CAAC;AAC9C,MAAM,4BAA4B,GAAG,OAAO,CAAC;AA8B7C,MAAM,CAAC,MAAM,mBAAmB,GAAiD,CAAC,EAC9E,KAAK,EACL,IAAI,EACJ,SAAS,EACT,aAAa,EACb,SAAS,EACT,OAAO,EACP,qCAAqC,EACrC,SAAS,GACZ,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAwB,EAAE,CAAC,CAAC;IAE9E,MAAM,eAAe,GAAsD,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;QAC1F,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;YAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAClC,OAAO,EAAE,CAAC;YACV,OAAO;QACX,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACX,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAA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AG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;aACpD,EACD,qCAAqC,EAAE,qCAAqC,EAC5E,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,EAC9F,QAAQ,EAAE,eAAe,GAC3B,GACK,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 ComponentProps, type FunctionComponent, useState} from 'react';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faCheck, faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {KitButton, KitModal} from 'aristid-ds';\nimport {\n type ChildrenAsRecordValuePermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n} from '_ui/_gqlTypes';\nimport {SelectTreeNode} from '_ui/components/SelectTreeNode';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ITreeNodeWithRecord} from '_ui/types';\n\nconst SELECT_TREE_NODE_MODAL_HEIGHT = '563px';\nconst SELECT_TREE_NODE_MODAL_WIDTH = '656px';\n\ntype SelectTreeNodeModalBackendValue =\n | RecordFormElementsValueTreeValue\n | {\n treeValue: {\n id: string;\n };\n };\n\ntype SelectTreeNodeModalAttribute =\n | RecordFormAttributeTreeAttributeFragment\n | {\n multiple_values: boolean;\n linked_tree: {\n id: string;\n };\n };\n\ninterface ISelectTreeNodeModalProps {\n title: string;\n open: boolean;\n attribute: SelectTreeNodeModalAttribute;\n backendValues: SelectTreeNodeModalBackendValue[];\n onConfirm: (selectedNodes: ITreeNodeWithRecord[]) => void;\n onClose: () => void;\n childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;\n className?: string;\n}\n\nexport const SelectTreeNodeModal: FunctionComponent<ISelectTreeNodeModalProps> = ({\n title,\n open,\n attribute,\n backendValues,\n onConfirm,\n onClose,\n childrenAsRecordValuePermissionFilter,\n className,\n}) => {\n const {t} = useSharedTranslation();\n\n const [selectedNodes, setSelectedNodes] = useState<ITreeNodeWithRecord[]>([]);\n\n const _handleOnSelect: ComponentProps<typeof SelectTreeNode>['onSelect'] = (node, selected) => {\n if (!attribute.multiple_values) {\n onConfirm(selected ? [node] : []);\n onClose();\n return;\n }\n\n if (selected) {\n setSelectedNodes(prev => [...prev, node]);\n } else {\n setSelectedNodes(prev => prev.filter(selectedValue => selectedValue.id !== node.id));\n }\n };\n\n const _handleOnConfirm: ComponentProps<typeof KitButton>['onClick'] = () => {\n onConfirm(selectedNodes);\n onClose();\n };\n\n return (\n <KitModal\n appElement={document.getElementById('root')}\n className={className}\n showCloseIcon\n width={SELECT_TREE_NODE_MODAL_WIDTH}\n height={SELECT_TREE_NODE_MODAL_HEIGHT}\n title={title}\n isOpen={open}\n close={onClose}\n footer={\n <>\n <KitButton icon={<FontAwesomeIcon icon={faXmark} />} onClick={onClose}>\n {t('global.close')}\n </KitButton>\n {attribute.multiple_values && (\n <KitButton\n type=\"primary\"\n icon={<FontAwesomeIcon icon={faCheck} />}\n disabled={selectedNodes.length === 0}\n onClick={_handleOnConfirm}\n >\n {t('global.confirm')}\n </KitButton>\n )}\n </>\n }\n >\n <SelectTreeNode\n treeId={attribute.linked_tree.id}\n multiple // We want to be able to set as selected in the tree components, the nodes that are already selected and the disabled nodes\n selectedNodes={[\n ...selectedNodes.map(node => node.id),\n ...backendValues.map(value => value.treeValue.id),\n ]}\n childrenAsRecordValuePermissionFilter={childrenAsRecordValuePermissionFilter}\n disabledNodes={backendValues.map(value => value.treeValue.id).concat(attribute.linked_tree.id)}\n onSelect={_handleOnSelect}\n />\n </KitModal>\n );\n};\n"]}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { KitTooltip } from 'aristid-ds';
3
- import { FaLayerGroup, FaSquareRootAlt } from 'react-icons/fa';
3
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
+ import { faLayerGroup, faSquareRootAlt } from '@fortawesome/free-solid-svg-icons';
4
5
  import styled from 'styled-components';
5
6
  import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
6
7
  import { TOOLTIP_DEFAULT_DELAY_IN_SECONDS } from '../../../../../constants';
@@ -11,6 +12,6 @@ export const ComputeIndicator = ({ calculatedFlags, inheritedFlags }) => {
11
12
  const { t } = useSharedTranslation();
12
13
  const shouldDisplayComputedIcon = calculatedFlags.isCalculatedNotOverrideValues || inheritedFlags.isInheritedNotOverrideValues;
13
14
  const shouldDisplayOverridedIcon = calculatedFlags.isCalculatedOverrideValues || inheritedFlags.isInheritedOverrideValues;
14
- return (_jsxs(ComputeIndicatorWrapper, { children: [shouldDisplayComputedIcon && (_jsx(KitTooltip, { title: t('record_edition.calculated_value'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(FaSquareRootAlt, {}) })), shouldDisplayOverridedIcon && (_jsx(KitTooltip, { title: t('record_edition.overrided_value'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(FaLayerGroup, {}) }))] }));
15
+ return (_jsxs(ComputeIndicatorWrapper, { children: [shouldDisplayComputedIcon && (_jsx(KitTooltip, { title: t('record_edition.calculated_value'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(FontAwesomeIcon, { icon: faSquareRootAlt }) })), shouldDisplayOverridedIcon && (_jsx(KitTooltip, { title: t('record_edition.overrided_value'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(FontAwesomeIcon, { icon: faLayerGroup }) }))] }));
15
16
  };
16
17
  //# sourceMappingURL=ComputeIndicator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComputeIndicator.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,gCAAgC,EAAC,MAAM,eAAe,CAAC;AAE/D,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEzC,CAAC;AAOF,MAAM,CAAC,MAAM,gBAAgB,GAA8C,CAAC,EAAC,eAAe,EAAE,cAAc,EAAC,EAAE,EAAE;IAC7G,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,yBAAyB,GAC3B,eAAe,CAAC,6BAA6B,IAAI,cAAc,CAAC,4BAA4B,CAAC;IACjG,MAAM,0BAA0B,GAC5B,eAAe,CAAC,0BAA0B,IAAI,cAAc,CAAC,yBAAyB,CAAC;IAE3F,OAAO,CACH,MAAC,uBAAuB,eACnB,yBAAyB,IAAI,CAC1B,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,iCAAiC,CAAC,EAC3C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,eAAe,KAAG,GACV,CAChB,EACA,0BAA0B,IAAI,CAC3B,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,gCAAgC,CAAC,EAC1C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,YAAY,KAAG,GACP,CAChB,IACqB,CAC7B,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 CalculatedFlags, type InheritedFlags} from './calculatedInheritedFlags';\nimport {KitTooltip} from 'aristid-ds';\nimport {FaLayerGroup, FaSquareRootAlt} from 'react-icons/fa';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {TOOLTIP_DEFAULT_DELAY_IN_SECONDS} from '_ui/constants';\n\nconst ComputeIndicatorWrapper = styled.div`\n font-size: calc(var(--general-typography-fontSize7) * 1px);\n`;\n\ninterface IComputeIndicatorProps {\n calculatedFlags: CalculatedFlags;\n inheritedFlags: InheritedFlags;\n}\n\nexport const ComputeIndicator: FunctionComponent<IComputeIndicatorProps> = ({calculatedFlags, inheritedFlags}) => {\n const {t} = useSharedTranslation();\n\n const shouldDisplayComputedIcon =\n calculatedFlags.isCalculatedNotOverrideValues || inheritedFlags.isInheritedNotOverrideValues;\n const shouldDisplayOverridedIcon =\n calculatedFlags.isCalculatedOverrideValues || inheritedFlags.isInheritedOverrideValues;\n\n return (\n <ComputeIndicatorWrapper>\n {shouldDisplayComputedIcon && (\n <KitTooltip\n title={t('record_edition.calculated_value')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <FaSquareRootAlt />\n </KitTooltip>\n )}\n {shouldDisplayOverridedIcon && (\n <KitTooltip\n title={t('record_edition.overrided_value')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <FaLayerGroup />\n </KitTooltip>\n )}\n </ComputeIndicatorWrapper>\n );\n};\n"]}
1
+ {"version":3,"file":"ComputeIndicator.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,mCAAmC,CAAC;AAChF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,gCAAgC,EAAC,MAAM,eAAe,CAAC;AAE/D,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEzC,CAAC;AAOF,MAAM,CAAC,MAAM,gBAAgB,GAA8C,CAAC,EAAC,eAAe,EAAE,cAAc,EAAC,EAAE,EAAE;IAC7G,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,yBAAyB,GAC3B,eAAe,CAAC,6BAA6B,IAAI,cAAc,CAAC,4BAA4B,CAAC;IACjG,MAAM,0BAA0B,GAC5B,eAAe,CAAC,0BAA0B,IAAI,cAAc,CAAC,yBAAyB,CAAC;IAE3F,OAAO,CACH,MAAC,uBAAuB,eACnB,yBAAyB,IAAI,CAC1B,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,iCAAiC,CAAC,EAC3C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,eAAe,IAAC,IAAI,EAAE,eAAe,GAAI,GACjC,CAChB,EACA,0BAA0B,IAAI,CAC3B,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,gCAAgC,CAAC,EAC1C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,eAAe,IAAC,IAAI,EAAE,YAAY,GAAI,GAC9B,CAChB,IACqB,CAC7B,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 CalculatedFlags, type InheritedFlags} from './calculatedInheritedFlags';\nimport {KitTooltip} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faLayerGroup, faSquareRootAlt} from '@fortawesome/free-solid-svg-icons';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {TOOLTIP_DEFAULT_DELAY_IN_SECONDS} from '_ui/constants';\n\nconst ComputeIndicatorWrapper = styled.div`\n font-size: calc(var(--general-typography-fontSize7) * 1px);\n`;\n\ninterface IComputeIndicatorProps {\n calculatedFlags: CalculatedFlags;\n inheritedFlags: InheritedFlags;\n}\n\nexport const ComputeIndicator: FunctionComponent<IComputeIndicatorProps> = ({calculatedFlags, inheritedFlags}) => {\n const {t} = useSharedTranslation();\n\n const shouldDisplayComputedIcon =\n calculatedFlags.isCalculatedNotOverrideValues || inheritedFlags.isInheritedNotOverrideValues;\n const shouldDisplayOverridedIcon =\n calculatedFlags.isCalculatedOverrideValues || inheritedFlags.isInheritedOverrideValues;\n\n return (\n <ComputeIndicatorWrapper>\n {shouldDisplayComputedIcon && (\n <KitTooltip\n title={t('record_edition.calculated_value')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <FontAwesomeIcon icon={faSquareRootAlt} />\n </KitTooltip>\n )}\n {shouldDisplayOverridedIcon && (\n <KitTooltip\n title={t('record_edition.overrided_value')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <FontAwesomeIcon icon={faLayerGroup} />\n </KitTooltip>\n )}\n </ComputeIndicatorWrapper>\n );\n};\n"]}
@@ -5,7 +5,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { useState } from 'react';
6
6
  import styled from 'styled-components';
7
7
  import { KitButton, KitTooltip } from 'aristid-ds';
8
- import { FaExpand } from 'react-icons/fa';
8
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9
+ import { faExpand } from '@fortawesome/free-solid-svg-icons';
9
10
  import PropertiesList from '../../PropertiesList';
10
11
  import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
11
12
  import { useRecordInformations } from './useRecordInformations';
@@ -37,6 +38,6 @@ export const RecordInformations = ({ record, recordData }) => {
37
38
  const [isFilePreviewModalOpen, setFilePreviewModalOpen] = useState(false);
38
39
  const previewFile = record?.preview?.file;
39
40
  const preview = record?.preview?.medium ? String(record?.preview?.medium) : null;
40
- return (_jsxs(InformationsWrapper, { children: [_jsxs(PreviewWrapper, { children: [_jsx(EntityPreview, { label: record?.label ?? record?.id, color: record?.color, image: preview, imageStyle: { border: 'none' }, placeholderStyle: { height: '100%', width: 'fit-content', margin: 'auto', borderRadius: '0' }, style: { height: '100%', background: 'initial' }, tile: true }), previewFile !== undefined && (_jsx(KitTooltip, { title: t('record_summary.open_preview_modal'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(ExpandImageButton, { "aria-label": t('record_summary.open_preview_modal'), type: "tertiary", icon: _jsx(FaExpand, {}), onClick: () => setFilePreviewModalOpen(true) }) }))] }), isFilePreviewModalOpen && (_jsx(FileModal, { open: isFilePreviewModalOpen, fileId: previewFile?.id, libraryId: previewFile?.library, onClose: () => setFilePreviewModalOpen(false) })), _jsx(ContentWrapper, { children: _jsx(PropertiesList, { items: recordInformations }) })] }));
41
+ return (_jsxs(InformationsWrapper, { children: [_jsxs(PreviewWrapper, { children: [_jsx(EntityPreview, { label: record?.label ?? record?.id, color: record?.color, image: preview, imageStyle: { border: 'none' }, placeholderStyle: { height: '100%', width: 'fit-content', margin: 'auto', borderRadius: '0' }, style: { height: '100%', background: 'initial' }, tile: true }), previewFile !== undefined && (_jsx(KitTooltip, { title: t('record_summary.open_preview_modal'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(ExpandImageButton, { "aria-label": t('record_summary.open_preview_modal'), type: "tertiary", icon: _jsx(FontAwesomeIcon, { icon: faExpand }), onClick: () => setFilePreviewModalOpen(true) }) }))] }), isFilePreviewModalOpen && (_jsx(FileModal, { open: isFilePreviewModalOpen, fileId: previewFile?.id, libraryId: previewFile?.library, onClose: () => setFilePreviewModalOpen(false) })), _jsx(ContentWrapper, { children: _jsx(PropertiesList, { items: recordInformations }) })] }));
41
42
  };
42
43
  //# sourceMappingURL=RecordInformations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RecordInformations.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEvD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,SAAS,MAAM,iDAAiD,CAAC;AACxE,OAAO,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAC,gCAAgC,EAAC,MAAM,eAAe,CAAC;AAO/D,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAErC,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;CAOhC,CAAC;AAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;;;;CAI1C,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEhC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA0C,CAAC,EAAC,MAAM,EAAE,UAAU,EAAC,EAAE,EAAE;IAC9F,MAAM,EAAC,CAAC,EAAC,GAA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AM,EAAE,WAAW,EAAE,EAAE,EACvB,SAAS,EAAE,WAAW,EAAE,OAAO,EAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,GAC/C,CACL,EACD,KAAC,cAAc,cACX,KAAC,cAAc,IAAC,KAAK,EAAE,kBAAkB,GAAI,GAChC,IACC,CACzB,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, useState} from 'react';\nimport {type IRecordIdentityWhoAmI} from '_ui/types';\nimport styled from 'styled-components';\nimport {KitButton, KitTooltip} from 'aristid-ds';\nimport {FaExpand} from 'react-icons/fa';\nimport PropertiesList from '../../PropertiesList';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type GetRecordColumnsValuesRecord} from '_ui/_queries/records/getRecordColumnsValues';\nimport {useRecordInformations} from './useRecordInformations';\nimport FileModal from '_ui/components/RecordPreviewWithModal/FileModal';\nimport {EntityPreview} from '_ui/components/EntityPreview';\nimport {TOOLTIP_DEFAULT_DELAY_IN_SECONDS} from '_ui/constants';\n\ninterface IInformationsProps {\n record: IRecordIdentityWhoAmI;\n recordData: GetRecordColumnsValuesRecord;\n}\n\nconst InformationsWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nconst PreviewWrapper = styled.div`\n position: relative;\n width: 100%;\n height: 162px;\n background-color: var(--general-colors-primary-50);\n border-radius: calc(var(--general-border-radius-s) * 1px);\n padding: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst ExpandImageButton = styled(KitButton)`\n position: absolute;\n right: 0;\n top: 0;\n`;\n\nconst ContentWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nexport const RecordInformations: FunctionComponent<IInformationsProps> = ({record, recordData}) => {\n const {t} = useSharedTranslation();\n const recordInformations = useRecordInformations(record, recordData);\n const [isFilePreviewModalOpen, setFilePreviewModalOpen] = useState(false);\n\n const previewFile = record?.preview?.file;\n const preview = record?.preview?.medium ? String(record?.preview?.medium) : null;\n\n return (\n <InformationsWrapper>\n <PreviewWrapper>\n <EntityPreview\n label={record?.label ?? record?.id}\n color={record?.color}\n image={preview}\n imageStyle={{border: 'none'}}\n placeholderStyle={{height: '100%', width: 'fit-content', margin: 'auto', borderRadius: '0'}}\n style={{height: '100%', background: 'initial'}}\n tile\n />\n {previewFile !== undefined && (\n <KitTooltip\n title={t('record_summary.open_preview_modal')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <ExpandImageButton\n aria-label={t('record_summary.open_preview_modal')}\n type=\"tertiary\"\n icon={<FaExpand />}\n onClick={() => setFilePreviewModalOpen(true)}\n />\n </KitTooltip>\n )}\n </PreviewWrapper>\n {isFilePreviewModalOpen && (\n <FileModal\n open={isFilePreviewModalOpen}\n fileId={previewFile?.id}\n libraryId={previewFile?.library}\n onClose={() => setFilePreviewModalOpen(false)}\n />\n )}\n <ContentWrapper>\n <PropertiesList items={recordInformations} />\n </ContentWrapper>\n </InformationsWrapper>\n );\n};\n"]}
1
+ {"version":3,"file":"RecordInformations.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEvD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAC;AAC3D,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,E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M,EAAE,MAAM,EAAC,EAC5B,gBAAgB,EAAE,EAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAC,EAC3F,KAAK,EAAE,EAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAC,EAC9C,IAAI,SACN,EACD,WAAW,KAAK,SAAS,IAAI,CAC1B,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,mCAAmC,CAAC,EAC7C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,iBAAiB,kBACF,CAAC,CAAC,mCAAmC,CAAC,EAClD,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,QAAQ,GAAI,EACzC,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,GAC9C,GACO,CAChB,IACY,EAChB,sBAAsB,IAAI,CACvB,KAAC,SAAS,IACN,IAAI,EAAE,sBAAsB,EAC5B,MAAM,EAAE,WAAW,EAAE,EAAE,EACvB,SAAS,EAAE,WAAW,EAAE,OAAO,EAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,GAC/C,CACL,EACD,KAAC,cAAc,cACX,KAAC,cAAc,IAAC,KAAK,EAAE,kBAAkB,GAAI,GAChC,IACC,CACzB,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, useState} from 'react';\nimport {type IRecordIdentityWhoAmI} from '_ui/types';\nimport styled from 'styled-components';\nimport {KitButton, KitTooltip} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faExpand} from '@fortawesome/free-solid-svg-icons';\nimport PropertiesList from '../../PropertiesList';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type GetRecordColumnsValuesRecord} from '_ui/_queries/records/getRecordColumnsValues';\nimport {useRecordInformations} from './useRecordInformations';\nimport FileModal from '_ui/components/RecordPreviewWithModal/FileModal';\nimport {EntityPreview} from '_ui/components/EntityPreview';\nimport {TOOLTIP_DEFAULT_DELAY_IN_SECONDS} from '_ui/constants';\n\ninterface IInformationsProps {\n record: IRecordIdentityWhoAmI;\n recordData: GetRecordColumnsValuesRecord;\n}\n\nconst InformationsWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nconst PreviewWrapper = styled.div`\n position: relative;\n width: 100%;\n height: 162px;\n background-color: var(--general-colors-primary-50);\n border-radius: calc(var(--general-border-radius-s) * 1px);\n padding: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst ExpandImageButton = styled(KitButton)`\n position: absolute;\n right: 0;\n top: 0;\n`;\n\nconst ContentWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nexport const RecordInformations: FunctionComponent<IInformationsProps> = ({record, recordData}) => {\n const {t} = useSharedTranslation();\n const recordInformations = useRecordInformations(record, recordData);\n const [isFilePreviewModalOpen, setFilePreviewModalOpen] = useState(false);\n\n const previewFile = record?.preview?.file;\n const preview = record?.preview?.medium ? String(record?.preview?.medium) : null;\n\n return (\n <InformationsWrapper>\n <PreviewWrapper>\n <EntityPreview\n label={record?.label ?? record?.id}\n color={record?.color}\n image={preview}\n imageStyle={{border: 'none'}}\n placeholderStyle={{height: '100%', width: 'fit-content', margin: 'auto', borderRadius: '0'}}\n style={{height: '100%', background: 'initial'}}\n tile\n />\n {previewFile !== undefined && (\n <KitTooltip\n title={t('record_summary.open_preview_modal')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <ExpandImageButton\n aria-label={t('record_summary.open_preview_modal')}\n type=\"tertiary\"\n icon={<FontAwesomeIcon icon={faExpand} />}\n onClick={() => setFilePreviewModalOpen(true)}\n />\n </KitTooltip>\n )}\n </PreviewWrapper>\n {isFilePreviewModalOpen && (\n <FileModal\n open={isFilePreviewModalOpen}\n fileId={previewFile?.id}\n libraryId={previewFile?.library}\n onClose={() => setFilePreviewModalOpen(false)}\n />\n )}\n <ContentWrapper>\n <PropertiesList items={recordInformations} />\n </ContentWrapper>\n </InformationsWrapper>\n );\n};\n"]}
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { KitBadge, KitTabs, KitTree } from 'aristid-ds';
3
3
  import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
4
- import { FaLayerGroup, FaSquareRootAlt } from 'react-icons/fa';
4
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
+ import { faLayerGroup, faSquareRootAlt } from '@fortawesome/free-solid-svg-icons';
5
6
  import styled from 'styled-components';
6
7
  import { RecordHistory } from '../../../RecordHistory/RecordHistory';
7
8
  const InformationsWrapper = styled.div `
@@ -55,7 +56,7 @@ export const ValuesSummary = ({ record, attributeId, globalValues = [], calculat
55
56
  display: 'flex',
56
57
  alignItems: 'center',
57
58
  justifyContent: 'space-between',
58
- }, children: [_jsxs("span", { children: [_jsx(FaSquareRootAlt, {}), " ", t('record_summary.calculated_value')] }), _jsx(KitBadge, { count: stripedCalculatedValues.length, color: "primary" })] })),
59
+ }, children: [_jsxs("span", { children: [_jsx(FontAwesomeIcon, { icon: faSquareRootAlt }), ' ', t('record_summary.calculated_value')] }), _jsx(KitBadge, { count: stripedCalculatedValues.length, color: "primary" })] })),
59
60
  children: stripedCalculatedValues.length > 0
60
61
  ? stripedCalculatedValues.map((calculatedValue, index) => ({
61
62
  key: `${calculatedValueKey}-${index}`,
@@ -74,7 +75,7 @@ export const ValuesSummary = ({ record, attributeId, globalValues = [], calculat
74
75
  display: 'flex',
75
76
  alignItems: 'center',
76
77
  justifyContent: 'space-between',
77
- }, children: [_jsxs("span", { children: [_jsx(FaLayerGroup, {}), " ", t('record_summary.global')] }), _jsx(KitBadge, { count: stripedGlobalValues.length, color: "primary" })] })),
78
+ }, children: [_jsxs("span", { children: [_jsx(FontAwesomeIcon, { icon: faLayerGroup }), ' ', t('record_summary.global')] }), _jsx(KitBadge, { count: stripedGlobalValues.length, color: "primary" })] })),
78
79
  children: stripedGlobalValues.length > 0
79
80
  ? stripedGlobalValues.map((value, index) => ({
80
81
  key: `${globalValueKey}-${index}`,
@@ -1 +1 @@
1
- {"version":3,"file":"ValuesSummary.js","sourceRoot":"","sources":["../../../../../src/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,aAAa,EAAC,MAAM,sCAAsC,CAAC;AAEnE,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAErC,CAAC;AAEF,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIzC,CAAC;AASF,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,8FAA8F;AAC9F,MAAM,SAAS,GAAG,CAAC,IAAY,EAAU,EAAE;IACvC,MAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC/D,OAAO,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC;AACtC,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,KAAU,EAAuC,EAAE,CAC1E,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,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,CAAC,MAAM,GAAG,CAAC;wCAC1B,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;4CACvC,GAAG,EAAE,GAAG,cAAc,IAAI,KAAK,EAAE;4CACjC,KAAK,EAAE,KAAK;yCACf,CAAC,CAAC;wCACL,CAAC,CAAC;4CACI;gDACI,GAAG,EAAE,GAAG,cAAc,IAAI,CAAC,EAAE;gDAC7B,KAAK,EAAE,sBAAI,CAAC,CAAC,yBAAyB,CAAC,GAAK;6CAC/C;yCACJ;iCACd;6BACJ,GACH,GACgB,CACzB;iBACJ;gBACD;oBACI,GAAG,EAAE,SAAS;oBACd,KAAK,EAAE,CAAC,CAAC,wBAAwB,CAAC;oBAClC,UAAU,EAAE,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAI;iBAC1E;aACJ,GACH,GACoB,CAC7B,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,aAAa,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 RecordFormElementsValueStandardValue} from '_ui/hooks/useGetRecordForm';\nimport {KitBadge, KitTabs, KitTree} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {FaLayerGroup, FaSquareRootAlt} from 'react-icons/fa';\nimport styled from 'styled-components';\nimport {type IRecordIdentityWhoAmI} from '_ui/types';\nimport {RecordHistory} from '../../../RecordHistory/RecordHistory';\n\nconst InformationsWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nconst StyledDivContentWrapper = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n`;\n\ninterface IValuesSummaryProps {\n record: IRecordIdentityWhoAmI | null;\n attributeId: string;\n globalValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n calculatedValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n}\n\nconst calculatedValueKey = '0';\nconst globalValueKey = '1';\n\n// https://stackoverflow.com/questions/822452/strip-html-tags-from-text-using-plain-javascript\nconst stripHtml = (html: string): string => {\n const doc = new DOMParser().parseFromString(html, 'text/html');\n return doc.body.textContent || '';\n};\n\nconst _isDateRangeValue = (value: any): value is {from: string; to: string} =>\n !!value && typeof value === 'object' && 'from' in value && 'to' in value;\n\nexport const ValuesSummary: FunctionComponent<IValuesSummaryProps> = ({\n record,\n attributeId,\n globalValues = [],\n calculatedValues = [],\n}) => {\n const {t} = useSharedTranslation();\n\n const stringifyValue = (value: RecordFormElementsValueStandardValue['payload']): string => {\n if (typeof value === 'string') {\n return stripHtml(value);\n }\n\n if (typeof value === 'boolean') {\n return value ? t('global.yes') : t('global.no');\n }\n\n if (_isDateRangeValue(value)) {\n return t('record_edition.date_range_value', {\n from: value.from,\n to: value.to,\n interpolation: {\n escapeValue: false,\n },\n });\n }\n\n return value;\n };\n\n const stripedGlobalValues = globalValues.map(stringifyValue);\n const stripedCalculatedValues = calculatedValues.map(stringifyValue);\n\n return (\n <StyledDivContentWrapper>\n <KitTabs\n items={[\n {\n key: 'version_values',\n label: t('record_summary.values_version'),\n tabContent: (\n <InformationsWrapper>\n <KitTree\n defaultExpandAll\n selectedKeys={\n calculatedValues.length > 0 && globalValues.length === 0\n ? [calculatedValueKey]\n : [globalValueKey]\n }\n treeData={[\n {\n key: calculatedValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FaSquareRootAlt /> {t('record_summary.calculated_value')}\n </span>\n <KitBadge count={stripedCalculatedValues.length} color=\"primary\" />\n </div>\n ),\n children:\n stripedCalculatedValues.length > 0\n ? stripedCalculatedValues.map((calculatedValue, index) => ({\n key: `${calculatedValueKey}-${index}`,\n title: calculatedValue,\n }))\n : [\n {\n key: `${calculatedValueKey}-${0}`,\n title: <i>{t('record_summary.no_value')}</i>,\n },\n ],\n },\n {\n key: globalValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FaLayerGroup /> {t('record_summary.global')}\n </span>\n <KitBadge count={stripedGlobalValues.length} color=\"primary\" />\n </div>\n ),\n children:\n stripedGlobalValues.length > 0\n ? stripedGlobalValues.map((value, index) => ({\n key: `${globalValueKey}-${index}`,\n title: value,\n }))\n : [\n {\n key: `${globalValueKey}-${0}`,\n title: <i>{t('record_summary.no_value')}</i>,\n },\n ],\n },\n ]}\n />\n </InformationsWrapper>\n ),\n },\n {\n key: 'history',\n label: t('record_summary.history'),\n tabContent: <RecordHistory record={record} attributeId={attributeId} />,\n },\n ]}\n />\n </StyledDivContentWrapper>\n );\n};\n\nexport default ValuesSummary;\n"]}
1
+ {"version":3,"file":"ValuesSummary.js","sourceRoot":"","sources":["../../../../../src/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,mCAAmC,CAAC;AAChF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,aAAa,EAAC,MAAM,sCAAsC,CAAC;AAEnE,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAErC,CAAC;AAEF,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIzC,CAAC;AASF,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,8FAA8F;AAC9F,MAAM,SA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D;oCACI,GAAG,EAAE,cAAc;oCACnB,KAAK,EAAE,CACH,eACI,KAAK,EAAE;4CACH,OAAO,EAAE,MAAM;4CACf,UAAU,EAAE,QAAQ;4CACpB,cAAc,EAAE,eAAe;yCAClC,aAED,2BACI,KAAC,eAAe,IAAC,IAAI,EAAE,YAAY,GAAI,EAAC,GAAG,EAC1C,CAAC,CAAC,uBAAuB,CAAC,IACxB,EACP,KAAC,QAAQ,IAAC,KAAK,EAAE,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAC,SAAS,GAAG,IAC7D,CACT;oCACD,QAAQ,EACJ,mBAAmB,CAAC,MAAM,GAAG,CAAC;wCAC1B,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;4CACvC,GAAG,EAAE,GAAG,cAAc,IAAI,KAAK,EAAE;4CACjC,KAAK,EAAE,KAAK;yCACf,CAAC,CAAC;wCACL,CAAC,CAAC;4CACI;gDACI,GAAG,EAAE,GAAG,cAAc,IAAI,CAAC,EAAE;gDAC7B,KAAK,EAAE,sBAAI,CAAC,CAAC,yBAAyB,CAAC,GAAK;6CAC/C;yCACJ;iCACd;6BACJ,GACH,GACgB,CACzB;iBACJ;gBACD;oBACI,GAAG,EAAE,SAAS;oBACd,KAAK,EAAE,CAAC,CAAC,wBAAwB,CAAC;oBAClC,UAAU,EAAE,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAI;iBAC1E;aACJ,GACH,GACoB,CAC7B,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,aAAa,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 RecordFormElementsValueStandardValue} from '_ui/hooks/useGetRecordForm';\nimport {KitBadge, KitTabs, KitTree} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faLayerGroup, faSquareRootAlt} from '@fortawesome/free-solid-svg-icons';\nimport styled from 'styled-components';\nimport {type IRecordIdentityWhoAmI} from '_ui/types';\nimport {RecordHistory} from '../../../RecordHistory/RecordHistory';\n\nconst InformationsWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nconst StyledDivContentWrapper = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n`;\n\ninterface IValuesSummaryProps {\n record: IRecordIdentityWhoAmI | null;\n attributeId: string;\n globalValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n calculatedValues?: Array<RecordFormElementsValueStandardValue['payload']>;\n}\n\nconst calculatedValueKey = '0';\nconst globalValueKey = '1';\n\n// https://stackoverflow.com/questions/822452/strip-html-tags-from-text-using-plain-javascript\nconst stripHtml = (html: string): string => {\n const doc = new DOMParser().parseFromString(html, 'text/html');\n return doc.body.textContent || '';\n};\n\nconst _isDateRangeValue = (value: any): value is {from: string; to: string} =>\n !!value && typeof value === 'object' && 'from' in value && 'to' in value;\n\nexport const ValuesSummary: FunctionComponent<IValuesSummaryProps> = ({\n record,\n attributeId,\n globalValues = [],\n calculatedValues = [],\n}) => {\n const {t} = useSharedTranslation();\n\n const stringifyValue = (value: RecordFormElementsValueStandardValue['payload']): string => {\n if (typeof value === 'string') {\n return stripHtml(value);\n }\n\n if (typeof value === 'boolean') {\n return value ? t('global.yes') : t('global.no');\n }\n\n if (_isDateRangeValue(value)) {\n return t('record_edition.date_range_value', {\n from: value.from,\n to: value.to,\n interpolation: {\n escapeValue: false,\n },\n });\n }\n\n return value;\n };\n\n const stripedGlobalValues = globalValues.map(stringifyValue);\n const stripedCalculatedValues = calculatedValues.map(stringifyValue);\n\n return (\n <StyledDivContentWrapper>\n <KitTabs\n items={[\n {\n key: 'version_values',\n label: t('record_summary.values_version'),\n tabContent: (\n <InformationsWrapper>\n <KitTree\n defaultExpandAll\n selectedKeys={\n calculatedValues.length > 0 && globalValues.length === 0\n ? [calculatedValueKey]\n : [globalValueKey]\n }\n treeData={[\n {\n key: calculatedValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FontAwesomeIcon icon={faSquareRootAlt} />{' '}\n {t('record_summary.calculated_value')}\n </span>\n <KitBadge count={stripedCalculatedValues.length} color=\"primary\" />\n </div>\n ),\n children:\n stripedCalculatedValues.length > 0\n ? stripedCalculatedValues.map((calculatedValue, index) => ({\n key: `${calculatedValueKey}-${index}`,\n title: calculatedValue,\n }))\n : [\n {\n key: `${calculatedValueKey}-${0}`,\n title: <i>{t('record_summary.no_value')}</i>,\n },\n ],\n },\n {\n key: globalValueKey,\n title: (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <span>\n <FontAwesomeIcon icon={faLayerGroup} />{' '}\n {t('record_summary.global')}\n </span>\n <KitBadge count={stripedGlobalValues.length} color=\"primary\" />\n </div>\n ),\n children:\n stripedGlobalValues.length > 0\n ? stripedGlobalValues.map((value, index) => ({\n key: `${globalValueKey}-${index}`,\n title: value,\n }))\n : [\n {\n key: `${globalValueKey}-${0}`,\n title: <i>{t('record_summary.no_value')}</i>,\n },\n ],\n },\n ]}\n />\n </InformationsWrapper>\n ),\n },\n {\n key: 'history',\n label: t('record_summary.history'),\n tabContent: <RecordHistory record={record} attributeId={attributeId} />,\n },\n ]}\n />\n </StyledDivContentWrapper>\n );\n};\n\nexport default ValuesSummary;\n"]}
@@ -3,7 +3,8 @@ 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 { CloseOutlined } from '@ant-design/icons';
6
- import { GrUndo } from 'react-icons/gr';
6
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
7
+ import { faUndo } from '@fortawesome/free-solid-svg-icons';
7
8
  import styled from 'styled-components';
8
9
  import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
9
10
  import { themeVars } from '../../../../antdTheme';
@@ -53,7 +54,7 @@ function ValuesVersions() {
53
54
  valuesVersion: state.originValuesVersion,
54
55
  });
55
56
  };
56
- return (_jsxs(Wrapper, { children: [_jsxs(Header, { children: [_jsx("span", { children: t('values_version.title') }), _jsxs("span", { children: [!isInCreation && (_jsx(BasicButton, { title: t('values_version.reset'), shape: "circle", centered: true, icon: _jsx(GrUndo, {}), onClick: _handleClickReset })), _jsx(CloseButton, { onClick: _handleClosePanel })] })] }), _jsx(ValuesVersionConfigurator, { libraryId: state.libraryId, selectedVersion: state.valuesVersion, onVersionChange: _handleVersionChange, readOnly: isInCreation })] }));
57
+ return (_jsxs(Wrapper, { children: [_jsxs(Header, { children: [_jsx("span", { children: t('values_version.title') }), _jsxs("span", { children: [!isInCreation && (_jsx(BasicButton, { title: t('values_version.reset'), shape: "circle", centered: true, icon: _jsx(FontAwesomeIcon, { icon: faUndo }), onClick: _handleClickReset })), _jsx(CloseButton, { onClick: _handleClosePanel })] })] }), _jsx(ValuesVersionConfigurator, { libraryId: state.libraryId, selectedVersion: state.valuesVersion, onVersionChange: _handleVersionChange, readOnly: isInCreation })] }));
57
58
  }
58
59
  export default ValuesVersions;
59
60
  //# sourceMappingURL=ValuesVersions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ValuesVersions.js","sourceRoot":"","sources":["../../../../../src/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAA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,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,CACH,MAAC,OAAO,eACJ,MAAC,MAAM,eACH,yBAAO,CAAC,CAAC,sBAAsB,CAAC,GAAQ,EACxC,2BACK,CAAC,YAAY,IAAI,CACd,KAAC,WAAW,IACR,KAAK,EAAE,CAAC,CAAC,sBAAsB,CAAC,EAChC,KAAK,EAAC,QAAQ,EACd,QAAQ,QACR,IAAI,EAAE,KAAC,MAAM,KAAG,EAChB,OAAO,EAAE,iBAAiB,GAC5B,CACL,EACD,KAAC,WAAW,IAAC,OAAO,EAAE,iBAAiB,GAAI,IACxC,IACF,EACT,KAAC,yBAAyB,IACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,eAAe,EAAE,KAAK,CAAC,aAAa,EACpC,eAAe,EAAE,oBAAoB,EACrC,QAAQ,EAAE,YAAY,GACxB,IACI,CACb,CAAC;AACN,CAAC;AAED,eAAe,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 {CloseOutlined} from '@ant-design/icons';\nimport {GrUndo} from 'react-icons/gr';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {themeVars} from '../../../../antdTheme';\nimport {type IValueVersion} from '../../../../types/values';\nimport {BasicButton} from '../../../BasicButton';\nimport ValuesVersionConfigurator from '../../../ValuesVersionConfigurator';\nimport {EditRecordReducerActionsTypes} from '../../editRecordReducer/editRecordReducer';\nimport {useEditRecordReducer} from '../../editRecordReducer/useEditRecordReducer';\n\nconst Wrapper = styled.div`\n display: grid;\n grid-template-rows: 3em 1fr 3em;\n height: 100%;\n`;\n\nconst Header = styled.div`\n background-color: ${themeVars.headerBg};\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0.3rem 0.3rem 0.3rem 1rem;\n font-weight: 700;\n border-bottom: 1px solid ${themeVars.borderLightColor};\n`;\n\nconst CloseButton = styled(CloseOutlined)`\n cursor: pointer;\n background: none;\n box-shadow: none;\n margin: 0.5rem;\n`;\n\nfunction ValuesVersions(): JSX.Element {\n const {t} = useSharedTranslation();\n const {state, dispatch} = useEditRecordReducer();\n const isInCreation = !state?.record;\n\n const _handleVersionChange = (version: IValueVersion) => {\n dispatch({\n type: EditRecordReducerActionsTypes.SET_VALUES_VERSION,\n valuesVersion: version,\n });\n };\n\n const _handleClosePanel = () => {\n dispatch({\n type: EditRecordReducerActionsTypes.SET_SIDEBAR_IS_OPEN,\n isOpen: !state.isOpenSidebar,\n });\n };\n\n const _handleClickReset = () => {\n dispatch({\n type: EditRecordReducerActionsTypes.SET_VALUES_VERSION,\n valuesVersion: state.originValuesVersion,\n });\n };\n\n return (\n <Wrapper>\n <Header>\n <span>{t('values_version.title')}</span>\n <span>\n {!isInCreation && (\n <BasicButton\n title={t('values_version.reset')}\n shape=\"circle\"\n centered\n icon={<GrUndo />}\n onClick={_handleClickReset}\n />\n )}\n <CloseButton onClick={_handleClosePanel} />\n </span>\n </Header>\n <ValuesVersionConfigurator\n libraryId={state.libraryId}\n selectedVersion={state.valuesVersion}\n onVersionChange={_handleVersionChange}\n readOnly={isInCreation}\n />\n </Wrapper>\n );\n}\n\nexport default ValuesVersions;\n"]}
1
+ {"version":3,"file":"ValuesVersions.js","sourceRoot":"","sources":["../../../../../src/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;AACzD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,S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AO,eACJ,MAAC,MAAM,eACH,yBAAO,CAAC,CAAC,sBAAsB,CAAC,GAAQ,EACxC,2BACK,CAAC,YAAY,IAAI,CACd,KAAC,WAAW,IACR,KAAK,EAAE,CAAC,CAAC,sBAAsB,CAAC,EAChC,KAAK,EAAC,QAAQ,EACd,QAAQ,QACR,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,MAAM,GAAI,EACvC,OAAO,EAAE,iBAAiB,GAC5B,CACL,EACD,KAAC,WAAW,IAAC,OAAO,EAAE,iBAAiB,GAAI,IACxC,IACF,EACT,KAAC,yBAAyB,IACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,eAAe,EAAE,KAAK,CAAC,aAAa,EACpC,eAAe,EAAE,oBAAoB,EACrC,QAAQ,EAAE,YAAY,GACxB,IACI,CACb,CAAC;AACN,CAAC;AAED,eAAe,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 {CloseOutlined} from '@ant-design/icons';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faUndo} from '@fortawesome/free-solid-svg-icons';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {themeVars} from '../../../../antdTheme';\nimport {type IValueVersion} from '../../../../types/values';\nimport {BasicButton} from '../../../BasicButton';\nimport ValuesVersionConfigurator from '../../../ValuesVersionConfigurator';\nimport {EditRecordReducerActionsTypes} from '../../editRecordReducer/editRecordReducer';\nimport {useEditRecordReducer} from '../../editRecordReducer/useEditRecordReducer';\n\nconst Wrapper = styled.div`\n display: grid;\n grid-template-rows: 3em 1fr 3em;\n height: 100%;\n`;\n\nconst Header = styled.div`\n background-color: ${themeVars.headerBg};\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0.3rem 0.3rem 0.3rem 1rem;\n font-weight: 700;\n border-bottom: 1px solid ${themeVars.borderLightColor};\n`;\n\nconst CloseButton = styled(CloseOutlined)`\n cursor: pointer;\n background: none;\n box-shadow: none;\n margin: 0.5rem;\n`;\n\nfunction ValuesVersions(): JSX.Element {\n const {t} = useSharedTranslation();\n const {state, dispatch} = useEditRecordReducer();\n const isInCreation = !state?.record;\n\n const _handleVersionChange = (version: IValueVersion) => {\n dispatch({\n type: EditRecordReducerActionsTypes.SET_VALUES_VERSION,\n valuesVersion: version,\n });\n };\n\n const _handleClosePanel = () => {\n dispatch({\n type: EditRecordReducerActionsTypes.SET_SIDEBAR_IS_OPEN,\n isOpen: !state.isOpenSidebar,\n });\n };\n\n const _handleClickReset = () => {\n dispatch({\n type: EditRecordReducerActionsTypes.SET_VALUES_VERSION,\n valuesVersion: state.originValuesVersion,\n });\n };\n\n return (\n <Wrapper>\n <Header>\n <span>{t('values_version.title')}</span>\n <span>\n {!isInCreation && (\n <BasicButton\n title={t('values_version.reset')}\n shape=\"circle\"\n centered\n icon={<FontAwesomeIcon icon={faUndo} />}\n onClick={_handleClickReset}\n />\n )}\n <CloseButton onClick={_handleClosePanel} />\n </span>\n </Header>\n <ValuesVersionConfigurator\n libraryId={state.libraryId}\n selectedVersion={state.valuesVersion}\n onVersionChange={_handleVersionChange}\n readOnly={isInCreation}\n />\n </Wrapper>\n );\n}\n\nexport default ValuesVersions;\n"]}
@@ -5,10 +5,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { useRef } from 'react';
6
6
  import styled from 'styled-components';
7
7
  import { closeKitSnackBar, KitButton, KitSpace, AntModal } from 'aristid-ds';
8
- // TODO: harmonize icon sources
9
8
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
10
- import { faXmark } from '@fortawesome/free-solid-svg-icons';
11
- import { FaExchangeAlt, FaEye, FaPlus } from 'react-icons/fa';
9
+ import { faExchangeAlt, faEye, faPlus, faXmark } from '@fortawesome/free-solid-svg-icons';
12
10
  import { useSharedTranslation } from '../../hooks/useSharedTranslation';
13
11
  import { RecordFilterCondition, useExplorerSelectionIdsLazyQuery, } from '../../_gqlTypes';
14
12
  import { Explorer } from '../../components/Explorer';
@@ -74,7 +72,7 @@ export const SelectRecordForLinkModal = ({ className, open, childLibraryId, repl
74
72
  ? t('explorer.massAction.replace-link')
75
73
  : t('explorer.massAction.add-link'),
76
74
  deselectAll: true,
77
- icon: replacementMode ? _jsx(FaExchangeAlt, {}) : _jsx(FaPlus, {}),
75
+ icon: replacementMode ? (_jsx(FontAwesomeIcon, { icon: faExchangeAlt })) : (_jsx(FontAwesomeIcon, { icon: faPlus })),
78
76
  callback: async (massSelectionFilter) => {
79
77
  await getRecordIdsFromFilters({
80
78
  variables: {
@@ -107,7 +105,7 @@ export const SelectRecordForLinkModal = ({ className, open, childLibraryId, repl
107
105
  : {}, primaryActions: [], defaultActionsForItem: [], defaultMassActions: [], itemActions: [
108
106
  {
109
107
  label: t('explorer.edit-item'),
110
- icon: _jsx(FaEye, {}),
108
+ icon: _jsx(FontAwesomeIcon, { icon: faEye }),
111
109
  useItemActionOnRowClick: true,
112
110
  callback: item => {
113
111
  openEditRecordModal({
@@ -1 +1 @@
1
- {"version":3,"file":"SelectRecordForLinkModal.js","sourceRoot":"","sources":["../../../src/components/SelectRecordForLinkModal/SelectRecordForLinkModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA8C,MAAM,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAE3E,+BAA+B;AAC/B,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAC,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAE,KAAK,EAAE,MAAM,EAAC,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jC,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,QACV,mBAAmB,SACrB,EACD,eAAe,IAEmB,GACtB,GACX,CACjB,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 ComponentProps, type FunctionComponent, useRef} from 'react';\nimport styled from 'styled-components';\nimport {closeKitSnackBar, KitButton, KitSpace, AntModal} from 'aristid-ds';\n\n// TODO: harmonize icon sources\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {FaExchangeAlt, FaEye, FaPlus} from 'react-icons/fa';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {\n type ExplorerSelectionIdsQuery,\n type JoinLibraryContextFragment,\n RecordFilterCondition,\n useExplorerSelectionIdsLazyQuery,\n} from '_ui/_gqlTypes';\nimport {Explorer} from '_ui/components/Explorer';\nimport {useEditRecordModal} from '../RecordEdition/EditRecordModal/useEditRecordModal';\n\nconst modalMaxWidth = 1_200;\n\nconst StyledModal = styled(AntModal)`\n && {\n width: 90vw;\n max-width: ${modalMaxWidth}px;\n\n .ant-modal-body {\n height: 80vh;\n overflow-y: auto;\n }\n\n .ant-modal-content {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n padding: 0;\n }\n\n .ant-modal-footer {\n flex: 0 0 auto;\n margin-top: 0;\n }\n }\n`;\n\nconst ModalFooterStyledDiv = styled.div`\n display: flex;\n justify-content: flex-end;\n padding: calc(var(--general-spacing-xs) * 1px) calc(var(--general-spacing-s) * 1px);\n border-top: 1px solid var(--general-utilities-border);\n`;\n\nconst ModalMainStyledDiv = styled.div`\n padding: calc(var(--general-spacing-m) * 1px);\n height: 100%;\n position: relative;\n`;\n\ninterface ISelectRecordForLinkModalProps {\n className?: string;\n open: boolean;\n childLibraryId: string;\n replacementMode: boolean;\n valuesList?: string[];\n allowFreeEntry: boolean;\n joinLibraryContext?: JoinLibraryContextFragment;\n selectionMode: ComponentProps<typeof Explorer>['selectionMode'];\n hideSelectAllAction: ComponentProps<typeof Explorer>['hideSelectAllAction'];\n isMultivalue: boolean;\n onSelectionCompleted: (data: ExplorerSelectionIdsQuery) => void;\n onClose: () => void;\n}\n\nexport const SelectRecordForLinkModal: FunctionComponent<ISelectRecordForLinkModalProps> = ({\n className,\n open,\n childLibraryId,\n replacementMode,\n valuesList,\n allowFreeEntry,\n selectionMode,\n joinLibraryContext,\n hideSelectAllAction,\n isMultivalue,\n onSelectionCompleted,\n onClose,\n}) => {\n const {t} = useSharedTranslation();\n const explorerContainerRef = useRef<HTMLDivElement>(null);\n\n const _handleClose: ComponentProps<typeof KitButton>['onClick'] = () => {\n closeKitSnackBar();\n onClose();\n };\n\n const _closeButtonLabel: ComponentProps<typeof KitButton>['aria-label'] = String(t('global.close'));\n\n const _footer: ComponentProps<typeof AntModal>['footer'] = (\n <ModalFooterStyledDiv>\n <KitSpace>\n <KitButton\n aria-label={_closeButtonLabel}\n key=\"close\"\n icon={<FontAwesomeIcon icon={faXmark} />}\n onClick={_handleClose}\n >\n {_closeButtonLabel}\n </KitButton>\n </KitSpace>\n </ModalFooterStyledDiv>\n );\n\n const [getRecordIdsFromFilters] = useExplorerSelectionIdsLazyQuery({\n fetchPolicy: 'no-cache',\n onCompleted: onSelectionCompleted,\n });\n\n const {EditRecordModal, openEditRecordModal} = useEditRecordModal();\n\n return (\n <StyledModal\n className={className}\n open={open}\n onCancel={_handleClose}\n destroyOnClose\n closable={false}\n cancelText={t('global.cancel')}\n width=\"90vw\"\n centered\n footer={_footer}\n >\n <ModalMainStyledDiv ref={explorerContainerRef}>\n <Explorer.EditSettingsContextProvider\n panelElement={() => explorerContainerRef.current ?? document.body}\n >\n <Explorer\n title=\"SelectRecordForLinkModal\"\n entrypoint={{\n type: 'library',\n libraryId: childLibraryId,\n valuesList,\n allowFreeEntry,\n }}\n showCreateOnNoResultOnly\n selectionMode={selectionMode}\n hideSelectAllAction={hideSelectAllAction}\n massActions={\n isMultivalue\n ? [\n {\n label: replacementMode\n ? t('explorer.massAction.replace-link')\n : t('explorer.massAction.add-link'),\n deselectAll: true,\n icon: replacementMode ? <FaExchangeAlt /> : <FaPlus />,\n callback: async massSelectionFilter => {\n await getRecordIdsFromFilters({\n variables: {\n libraryId: childLibraryId,\n filters: massSelectionFilter,\n },\n });\n },\n },\n ]\n : []\n }\n defaultCallbacks={\n !isMultivalue\n ? {\n item: {\n select: async items => {\n await getRecordIdsFromFilters({\n variables: {\n libraryId: childLibraryId,\n filters: [\n {\n field: 'id',\n condition: RecordFilterCondition.EQUAL,\n value: items.itemId,\n },\n ],\n },\n });\n },\n },\n }\n : {}\n }\n primaryActions={[]}\n defaultActionsForItem={[]}\n defaultMassActions={[]}\n itemActions={[\n {\n label: t('explorer.edit-item'),\n icon: <FaEye />,\n useItemActionOnRowClick: true,\n callback: item => {\n openEditRecordModal({\n library: item.libraryId,\n record: {\n id: item.itemId,\n label: item.whoAmI?.label,\n subLabel: item.whoAmI?.subLabel,\n color: item.whoAmI?.color,\n library: {id: item.libraryId},\n },\n editionFormId: 'edition',\n });\n },\n },\n ]}\n defaultPrimaryActions={['create']}\n joinLibraryContext={joinLibraryContext}\n showSearch\n ignoreViewByDefault\n />\n {EditRecordModal}\n {/* TODO: avoid getting last view for user */}\n </Explorer.EditSettingsContextProvider>\n </ModalMainStyledDiv>\n </StyledModal>\n );\n};\n"]}
1
+ {"version":3,"file":"SelectRecordForLinkModal.js","sourceRoot":"","sources":["../../../src/components/SelectRecordForLinkModal/SelectRecordForLinkModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA8C,MAAM,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAA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AAI,CAAC,MAAM,EAAE,QAAQ;4CAC/B,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK;4CACzB,OAAO,EAAE,EAAC,EAAE,EAAE,IAAI,CAAC,SAAS,EAAC;yCAChC;wCACD,aAAa,EAAE,SAAS;qCAC3B,CAAC,CAAC;gCACP,CAAC;6BACJ;yBACJ,EACD,qBAAqB,EAAE,CAAC,QAAQ,CAAC,EACjC,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,QACV,mBAAmB,SACrB,EACD,eAAe,IAEmB,GACtB,GACX,CACjB,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 ComponentProps, type FunctionComponent, useRef} from 'react';\nimport styled from 'styled-components';\nimport {closeKitSnackBar, KitButton, KitSpace, AntModal} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faExchangeAlt, faEye, faPlus, faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {\n type ExplorerSelectionIdsQuery,\n type JoinLibraryContextFragment,\n RecordFilterCondition,\n useExplorerSelectionIdsLazyQuery,\n} from '_ui/_gqlTypes';\nimport {Explorer} from '_ui/components/Explorer';\nimport {useEditRecordModal} from '../RecordEdition/EditRecordModal/useEditRecordModal';\n\nconst modalMaxWidth = 1_200;\n\nconst StyledModal = styled(AntModal)`\n && {\n width: 90vw;\n max-width: ${modalMaxWidth}px;\n\n .ant-modal-body {\n height: 80vh;\n overflow-y: auto;\n }\n\n .ant-modal-content {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n padding: 0;\n }\n\n .ant-modal-footer {\n flex: 0 0 auto;\n margin-top: 0;\n }\n }\n`;\n\nconst ModalFooterStyledDiv = styled.div`\n display: flex;\n justify-content: flex-end;\n padding: calc(var(--general-spacing-xs) * 1px) calc(var(--general-spacing-s) * 1px);\n border-top: 1px solid var(--general-utilities-border);\n`;\n\nconst ModalMainStyledDiv = styled.div`\n padding: calc(var(--general-spacing-m) * 1px);\n height: 100%;\n position: relative;\n`;\n\ninterface ISelectRecordForLinkModalProps {\n className?: string;\n open: boolean;\n childLibraryId: string;\n replacementMode: boolean;\n valuesList?: string[];\n allowFreeEntry: boolean;\n joinLibraryContext?: JoinLibraryContextFragment;\n selectionMode: ComponentProps<typeof Explorer>['selectionMode'];\n hideSelectAllAction: ComponentProps<typeof Explorer>['hideSelectAllAction'];\n isMultivalue: boolean;\n onSelectionCompleted: (data: ExplorerSelectionIdsQuery) => void;\n onClose: () => void;\n}\n\nexport const SelectRecordForLinkModal: FunctionComponent<ISelectRecordForLinkModalProps> = ({\n className,\n open,\n childLibraryId,\n replacementMode,\n valuesList,\n allowFreeEntry,\n selectionMode,\n joinLibraryContext,\n hideSelectAllAction,\n isMultivalue,\n onSelectionCompleted,\n onClose,\n}) => {\n const {t} = useSharedTranslation();\n const explorerContainerRef = useRef<HTMLDivElement>(null);\n\n const _handleClose: ComponentProps<typeof KitButton>['onClick'] = () => {\n closeKitSnackBar();\n onClose();\n };\n\n const _closeButtonLabel: ComponentProps<typeof KitButton>['aria-label'] = String(t('global.close'));\n\n const _footer: ComponentProps<typeof AntModal>['footer'] = (\n <ModalFooterStyledDiv>\n <KitSpace>\n <KitButton\n aria-label={_closeButtonLabel}\n key=\"close\"\n icon={<FontAwesomeIcon icon={faXmark} />}\n onClick={_handleClose}\n >\n {_closeButtonLabel}\n </KitButton>\n </KitSpace>\n </ModalFooterStyledDiv>\n );\n\n const [getRecordIdsFromFilters] = useExplorerSelectionIdsLazyQuery({\n fetchPolicy: 'no-cache',\n onCompleted: onSelectionCompleted,\n });\n\n const {EditRecordModal, openEditRecordModal} = useEditRecordModal();\n\n return (\n <StyledModal\n className={className}\n open={open}\n onCancel={_handleClose}\n destroyOnClose\n closable={false}\n cancelText={t('global.cancel')}\n width=\"90vw\"\n centered\n footer={_footer}\n >\n <ModalMainStyledDiv ref={explorerContainerRef}>\n <Explorer.EditSettingsContextProvider\n panelElement={() => explorerContainerRef.current ?? document.body}\n >\n <Explorer\n title=\"SelectRecordForLinkModal\"\n entrypoint={{\n type: 'library',\n libraryId: childLibraryId,\n valuesList,\n allowFreeEntry,\n }}\n showCreateOnNoResultOnly\n selectionMode={selectionMode}\n hideSelectAllAction={hideSelectAllAction}\n massActions={\n isMultivalue\n ? [\n {\n label: replacementMode\n ? t('explorer.massAction.replace-link')\n : t('explorer.massAction.add-link'),\n deselectAll: true,\n icon: replacementMode ? (\n <FontAwesomeIcon icon={faExchangeAlt} />\n ) : (\n <FontAwesomeIcon icon={faPlus} />\n ),\n callback: async massSelectionFilter => {\n await getRecordIdsFromFilters({\n variables: {\n libraryId: childLibraryId,\n filters: massSelectionFilter,\n },\n });\n },\n },\n ]\n : []\n }\n defaultCallbacks={\n !isMultivalue\n ? {\n item: {\n select: async items => {\n await getRecordIdsFromFilters({\n variables: {\n libraryId: childLibraryId,\n filters: [\n {\n field: 'id',\n condition: RecordFilterCondition.EQUAL,\n value: items.itemId,\n },\n ],\n },\n });\n },\n },\n }\n : {}\n }\n primaryActions={[]}\n defaultActionsForItem={[]}\n defaultMassActions={[]}\n itemActions={[\n {\n label: t('explorer.edit-item'),\n icon: <FontAwesomeIcon icon={faEye} />,\n useItemActionOnRowClick: true,\n callback: item => {\n openEditRecordModal({\n library: item.libraryId,\n record: {\n id: item.itemId,\n label: item.whoAmI?.label,\n subLabel: item.whoAmI?.subLabel,\n color: item.whoAmI?.color,\n library: {id: item.libraryId},\n },\n editionFormId: 'edition',\n });\n },\n },\n ]}\n defaultPrimaryActions={['create']}\n joinLibraryContext={joinLibraryContext}\n showSearch\n ignoreViewByDefault\n />\n {EditRecordModal}\n {/* TODO: avoid getting last view for user */}\n </Explorer.EditSettingsContextProvider>\n </ModalMainStyledDiv>\n </StyledModal>\n );\n};\n"]}
@@ -4,7 +4,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
5
  import { useState } from 'react';
6
6
  import { KitButton, KitTag, KitTypography } from 'aristid-ds';
7
- import { FaCheck } from 'react-icons/fa';
7
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
+ import { faCheck } from '@fortawesome/free-solid-svg-icons';
8
9
  import { useSharedTranslation } from '../../hooks/useSharedTranslation';
9
10
  import styled from 'styled-components';
10
11
  const TreeNodeLine = styled.div `
@@ -34,7 +35,7 @@ export const TreeNodeTitle = ({ checkable, disabledNodes, loadRecursively, node,
34
35
  onSelect(child, buttonInSelectMode);
35
36
  });
36
37
  };
37
- return (_jsxs(TreeNodeLine, { onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), children: [_jsxs(TreeNodeLineSection, { children: [_jsx(KitTypography.Text, { size: "fontSize5", disabled: isDisabled, children: node.title }), _jsx(SelectedChildrenCount, { node: node, selectedNodes: selectedNodes, loadRecursively: loadRecursively })] }), _jsxs(TreeNodeLineSection, { children: [showSelectChildrenButton && node.children.length > 0 && hover && (_jsx(KitButton, { size: "s", onClick: e => handleChildrenSelection(e), children: t(`tree-node-selection.${buttonInSelectMode ? 'select_children' : 'unselect_children'}`) })), !checkable && isSelected && (_jsx(FaCheck, { color: isDisabled ? 'var(--general-utilities-text-disabled)' : 'var(--general-utilities-text-blue)' }))] })] }));
38
+ return (_jsxs(TreeNodeLine, { onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), children: [_jsxs(TreeNodeLineSection, { children: [_jsx(KitTypography.Text, { size: "fontSize5", disabled: isDisabled, children: node.title }), _jsx(SelectedChildrenCount, { node: node, selectedNodes: selectedNodes, loadRecursively: loadRecursively })] }), _jsxs(TreeNodeLineSection, { children: [showSelectChildrenButton && node.children.length > 0 && hover && (_jsx(KitButton, { size: "s", onClick: e => handleChildrenSelection(e), children: t(`tree-node-selection.${buttonInSelectMode ? 'select_children' : 'unselect_children'}`) })), !checkable && isSelected && (_jsx(FontAwesomeIcon, { icon: faCheck, color: isDisabled ? 'var(--general-utilities-text-disabled)' : 'var(--general-utilities-text-blue)' }))] })] }));
38
39
  };
39
40
  const SelectedChildrenCount = ({ node, selectedNodes, loadRecursively }) => {
40
41
  // it can work only if all children are loaded
@@ -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,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAEvC,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,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1C,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;IACvE,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,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C,YACvD,CAAC,CAAC,uBAAuB,kBAAkB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,mBAAmB,EAAE,CAAC,GACjF,CACf,EACA,CAAC,SAAS,IAAI,UAAU,IAAI,CACzB,KAAC,OAAO,IACJ,KAAK,EACD,UAAU,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,oCAAoC,GAElG,CACL,IACiB,IACX,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAItB,CAAC,EAAC,IAAI,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 {FaCheck} from 'react-icons/fa';\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 <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,MAAM,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAC5D,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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B,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"]}