@leav/ui 1.6.0-dfb71145 → 1.6.0-eb8e0390
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.
- package/dist/_gqlTypes/index.d.ts +640 -701
- package/dist/_gqlTypes/index.js +50 -167
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/_queries/trees/treeNodeChildrenQuery.js +2 -0
- package/dist/_queries/trees/treeNodeChildrenQuery.js.map +1 -1
- package/dist/_queries/views/viewDetailsFragment.js +1 -0
- package/dist/_queries/views/viewDetailsFragment.js.map +1 -1
- package/dist/components/AttributesSelectionList/sharedComponents.d.ts +159 -153
- package/dist/components/Explorer/Explorer.js +5 -3
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/TableCell.js +6 -7
- package/dist/components/Explorer/TableCell.js.map +1 -1
- package/dist/components/Explorer/TableNameCell.js +3 -2
- package/dist/components/Explorer/TableNameCell.js.map +1 -1
- package/dist/components/Explorer/_queries/useExplorerData.d.ts +7 -7
- package/dist/components/Explorer/actions-item/useEditStatusItemAction.js +3 -2
- package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +2 -1
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js +5 -4
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.d.ts +10 -0
- package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js +46 -0
- package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js.map +1 -0
- package/dist/components/Explorer/actions-mass/export/content/NoProfiles.d.ts +1 -0
- package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js +17 -0
- package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js.map +1 -0
- package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.d.ts +8 -0
- package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js +49 -0
- package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js.map +1 -0
- package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.d.ts +27 -0
- package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js +48 -0
- package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js.map +1 -0
- package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +3 -2
- package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +3 -2
- package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +3 -2
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useExportMassAction.d.ts +7 -4
- package/dist/components/Explorer/actions-mass/useExportMassAction.js +80 -73
- package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useMassActions.js +3 -2
- package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +3 -2
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +2 -1
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +5 -4
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
- package/dist/components/Explorer/link-item/LinkModal.d.ts +1 -0
- package/dist/components/Explorer/link-item/LinkModal.js +2 -2
- package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
- package/dist/components/Explorer/list-saved-views/SavedViews.js +4 -3
- package/dist/components/Explorer/list-saved-views/SavedViews.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js +5 -8
- package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js +3 -2
- package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +7 -6
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js +3 -2
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +4 -3
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js +3 -2
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js +3 -2
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +3 -0
- package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js +4 -3
- package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js +7 -6
- package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js +3 -2
- package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js.map +1 -1
- package/dist/components/Filters/_types.d.ts +2 -0
- package/dist/components/Filters/_types.js.map +1 -1
- package/dist/components/Filters/context/filtersReducer.js +1 -1
- package/dist/components/Filters/context/filtersReducer.js.map +1 -1
- package/dist/components/Filters/filter-items/CommonFilterItem.js +10 -3
- package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
- package/dist/components/Filters/filter-items/EmptyValueCheckbox.d.ts +8 -0
- package/dist/components/Filters/filter-items/EmptyValueCheckbox.js +16 -0
- package/dist/components/Filters/filter-items/EmptyValueCheckbox.js.map +1 -0
- package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js +23 -9
- package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js +9 -8
- package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js +3 -2
- package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js +1 -1
- package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.d.ts +0 -1
- package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js +17 -23
- package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js +10 -12
- package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js +3 -13
- package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
- package/dist/components/Filters/prepareFiltersForRequest.js +36 -3
- package/dist/components/Filters/prepareFiltersForRequest.js.map +1 -1
- package/dist/components/Filters/useFilters.d.ts +5 -0
- package/dist/components/Filters/useTransformFilters.js +4 -0
- package/dist/components/Filters/useTransformFilters.js.map +1 -1
- package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js +1 -8
- package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js.map +1 -1
- package/dist/components/LibraryItemsList/MenuView/MenuView.js +4 -4
- package/dist/components/LibraryItemsList/MenuView/MenuView.js.map +1 -1
- package/dist/components/LibraryItemsList/ViewPanel/View/View.js +3 -2
- package/dist/components/LibraryItemsList/ViewPanel/View/View.js.map +1 -1
- package/dist/components/Notifications/hooks/useNotificationSubscription.js +3 -2
- package/dist/components/Notifications/hooks/useNotificationSubscription.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js +5 -20
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js +4 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.d.ts +53 -51
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +4 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +9 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.d.ts +53 -51
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +3 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +4 -7
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +3 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js +3 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js +3 -2
- package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +4 -3
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js +3 -2
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js.map +1 -1
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +1 -0
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +7 -7
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +2 -1
- package/dist/components/SelectTreeNode/SelectTreeNode.js +3 -3
- package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +2 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +6 -2
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
- package/dist/components/SelectTreeNode/TreeNodeTitle.js +3 -2
- package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -1
- package/dist/locales/en/shared.json +15 -3
- package/dist/locales/fr/shared.json +15 -3
- package/package.json +8 -9
|
@@ -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,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAGH,qBAAqB,EACrB,gCAAgC,GACnC,MAA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// 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,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,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,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 columnsToDisplay: string[];\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 columnsToDisplay,\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 defaultViewSettings={{\n attributesIds: columnsToDisplay,\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"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type FunctionComponent } from 'react';
|
|
2
|
-
import { type ChildrenAsRecordValuePermissionFilterInput } from '../../_gqlTypes';
|
|
2
|
+
import { type ChildrenAsRecordValuePermissionFilterInput, type DependentValuesPermissionFilterInput } from '../../_gqlTypes';
|
|
3
3
|
import { type ITreeNodeWithRecord } from '../../types/trees';
|
|
4
4
|
interface ISelectTreeNodeProps {
|
|
5
5
|
treeId: string;
|
|
6
6
|
childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;
|
|
7
|
+
dependentValuesPermissionFilter?: DependentValuesPermissionFilterInput;
|
|
7
8
|
onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;
|
|
8
9
|
onCheck?: (selection: ITreeNodeWithRecord[]) => void;
|
|
9
10
|
selectedNodes?: string[];
|
|
@@ -4,12 +4,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
5
|
import { localizedTranslation } from '@leav/utils';
|
|
6
6
|
import { useSharedTranslation } from '../../hooks/useSharedTranslation';
|
|
7
|
-
import { useTreeDataQueryQuery } from '../../_gqlTypes';
|
|
7
|
+
import { useTreeDataQueryQuery, } from '../../_gqlTypes';
|
|
8
8
|
import { ErrorDisplay } from '../..';
|
|
9
9
|
import useLang from '../../hooks/useLang';
|
|
10
10
|
import { SelectTreeNodeContent } from './SelectTreeNodeContent';
|
|
11
11
|
import { SelectTreeNodeContentSkeleton } from './SelectTreeNodeContentSkeleton';
|
|
12
|
-
export const SelectTreeNode = ({ treeId, childrenAsRecordValuePermissionFilter, onSelect, onCheck, selectedNodes, disabledNodes, selectableLibraries, multiple = false, checkStrictly = true, checkable = false, canSelectRoot = false, loadRecursively = true, noPagination = false, showSelectChildrenButton = false, }) => {
|
|
12
|
+
export const SelectTreeNode = ({ treeId, childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter, onSelect, onCheck, selectedNodes, disabledNodes, selectableLibraries, multiple = false, checkStrictly = true, checkable = false, canSelectRoot = false, loadRecursively = true, noPagination = false, showSelectChildrenButton = false, }) => {
|
|
13
13
|
const { lang } = useLang();
|
|
14
14
|
const { t } = useSharedTranslation();
|
|
15
15
|
const { loading, error, data } = useTreeDataQueryQuery({
|
|
@@ -24,6 +24,6 @@ export const SelectTreeNode = ({ treeId, childrenAsRecordValuePermissionFilter,
|
|
|
24
24
|
if (!data?.trees.list[0]) {
|
|
25
25
|
return _jsx(ErrorDisplay, { message: t('error.unknown_tree', { treeId }) });
|
|
26
26
|
}
|
|
27
|
-
return (_jsx(SelectTreeNodeContent, { treeData: { id: treeId, label: localizedTranslation(data.trees.list[0].label, lang) || treeId }, childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter, onCheck: onCheck, onSelect: onSelect, multiple: multiple, checkable: checkable, checkStrictly: checkStrictly, selectedNodes: selectedNodes, disabledNodes: disabledNodes, canSelectRoot: canSelectRoot, selectableLibraries: selectableLibraries, loadRecursively: loadRecursively, noPagination: noPagination, showSelectChildrenButton: showSelectChildrenButton }));
|
|
27
|
+
return (_jsx(SelectTreeNodeContent, { treeData: { id: treeId, label: localizedTranslation(data.trees.list[0].label, lang) || treeId }, childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter: dependentValuesPermissionFilter, onCheck: onCheck, onSelect: onSelect, multiple: multiple, checkable: checkable, checkStrictly: checkStrictly, selectedNodes: selectedNodes, disabledNodes: disabledNodes, canSelectRoot: canSelectRoot, selectableLibraries: selectableLibraries, loadRecursively: loadRecursively, noPagination: noPagination, showSelectChildrenButton: showSelectChildrenButton }));
|
|
28
28
|
};
|
|
29
29
|
//# sourceMappingURL=SelectTreeNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectTreeNode.js","sourceRoot":"","sources":["../../../src/components/SelectTreeNode/SelectTreeNode.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,
|
|
1
|
+
{"version":3,"file":"SelectTreeNode.js","sourceRoot":"","sources":["../../../src/components/SelectTreeNode/SelectTreeNode.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAGH,qBAAqB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,YAAY,EAAC,MAAM,OAAO,CAAC;AACnC,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAC,6BAA6B,EAAC,MAAM,iCAAiC,CAAC;AAoB9E,MAAM,CAAC,MAAM,cAAc,GAA4C,CAAC,EACpE,MAAM,EACN,qCAAqC,EACrC,+BAA+B,EAC/B,QAAQ,EACR,OAAO,EACP,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,QAAQ,GAAG,KAAK,EAChB,aAAa,GAAG,IAAI,EACpB,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,eAAe,GAAG,IAAI,EACtB,YAAY,GAAG,KAAK,EACpB,wBAAwB,GAAG,KAAK,GACnC,EAAE,EAAE;IACD,MAAM,EAAC,IAAI,EAAC,GAAG,OAAO,EAAE,CAAC;IACzB,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,EAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAC,GAAG,qBAAqB,CAAC;QACjD,SAAS,EAAE,EAAC,MAAM,EAAC;KACtB,CAAC,CAAC;IAEH,IAAI,OAAO,EAAE,CAAC;QACV,OAAO,KAAC,6BAA6B,KAAG,CAAC;IAC7C,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACR,OAAO,KAAC,YAAY,IAAC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAI,CAAC;IACpD,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACvB,OAAO,KAAC,YAAY,IAAC,OAAO,EAAE,CAAC,CAAC,oBAAoB,EAAE,EAAC,MAAM,EAAC,CAAC,GAAI,CAAC;IACxE,CAAC;IAED,OAAO,CACH,KAAC,qBAAqB,IAClB,QAAQ,EAAE,EAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,MAAM,EAAC,EAC7F,qCAAqC,EAAE,qCAAqC,EAC5E,+BAA+B,EAAE,+BAA+B,EAChE,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,wBAAwB,EAAE,wBAAwB,GACpD,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {localizedTranslation} from '@leav/utils';\nimport {type FunctionComponent} from 'react';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {\n type ChildrenAsRecordValuePermissionFilterInput,\n type DependentValuesPermissionFilterInput,\n useTreeDataQueryQuery,\n} from '_ui/_gqlTypes';\nimport {ErrorDisplay} from '../..';\nimport useLang from '../../hooks/useLang';\nimport {type ITreeNodeWithRecord} from '../../types/trees';\nimport {SelectTreeNodeContent} from './SelectTreeNodeContent';\nimport {SelectTreeNodeContentSkeleton} from './SelectTreeNodeContentSkeleton';\n\ninterface ISelectTreeNodeProps {\n treeId: string;\n childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;\n dependentValuesPermissionFilter?: DependentValuesPermissionFilterInput;\n onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;\n onCheck?: (selection: ITreeNodeWithRecord[]) => void;\n selectedNodes?: string[];\n disabledNodes?: string[];\n selectableLibraries?: string[]; // all by default\n multiple?: boolean;\n checkStrictly?: boolean;\n checkable?: boolean;\n canSelectRoot?: boolean;\n loadRecursively?: boolean;\n noPagination?: boolean;\n showSelectChildrenButton?: boolean;\n}\n\nexport const SelectTreeNode: FunctionComponent<ISelectTreeNodeProps> = ({\n treeId,\n childrenAsRecordValuePermissionFilter,\n dependentValuesPermissionFilter,\n onSelect,\n onCheck,\n selectedNodes,\n disabledNodes,\n selectableLibraries,\n multiple = false,\n checkStrictly = true,\n checkable = false,\n canSelectRoot = false,\n loadRecursively = true,\n noPagination = false,\n showSelectChildrenButton = false,\n}) => {\n const {lang} = useLang();\n const {t} = useSharedTranslation();\n const {loading, error, data} = useTreeDataQueryQuery({\n variables: {treeId},\n });\n\n if (loading) {\n return <SelectTreeNodeContentSkeleton />;\n }\n\n if (error) {\n return <ErrorDisplay message={error.message} />;\n }\n\n if (!data?.trees.list[0]) {\n return <ErrorDisplay message={t('error.unknown_tree', {treeId})} />;\n }\n\n return (\n <SelectTreeNodeContent\n treeData={{id: treeId, label: localizedTranslation(data.trees.list[0].label, lang) || treeId}}\n childrenAsRecordValuePermissionFilter={childrenAsRecordValuePermissionFilter}\n dependentValuesPermissionFilter={dependentValuesPermissionFilter}\n onCheck={onCheck}\n onSelect={onSelect}\n multiple={multiple}\n checkable={checkable}\n checkStrictly={checkStrictly}\n selectedNodes={selectedNodes}\n disabledNodes={disabledNodes}\n canSelectRoot={canSelectRoot}\n selectableLibraries={selectableLibraries}\n loadRecursively={loadRecursively}\n noPagination={noPagination}\n showSelectChildrenButton={showSelectChildrenButton}\n />\n );\n};\n"]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type FunctionComponent } from 'react';
|
|
2
2
|
import { type ITreeNodeWithRecord } from '../../types';
|
|
3
|
-
import { type ChildrenAsRecordValuePermissionFilterInput } from '../../_gqlTypes';
|
|
3
|
+
import { type ChildrenAsRecordValuePermissionFilterInput, type DependentValuesPermissionFilterInput } from '../../_gqlTypes';
|
|
4
4
|
interface ISelectTreeNodeContentProps {
|
|
5
5
|
treeData: {
|
|
6
6
|
id: string;
|
|
7
7
|
label: string;
|
|
8
8
|
};
|
|
9
9
|
childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;
|
|
10
|
+
dependentValuesPermissionFilter?: DependentValuesPermissionFilterInput;
|
|
10
11
|
selectedNodes?: string[];
|
|
11
12
|
disabledNodes?: string[];
|
|
12
13
|
onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;
|
|
@@ -5,12 +5,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
import { KitTree } from 'aristid-ds';
|
|
7
7
|
import { Spin } from 'antd';
|
|
8
|
-
import { useTreeNodeChildrenLazyQuery } from '../../_gqlTypes';
|
|
8
|
+
import { useTreeNodeChildrenLazyQuery, } from '../../_gqlTypes';
|
|
9
9
|
import { defaultPaginationPageSize, ErrorDisplay } from '../../index';
|
|
10
10
|
import { TreeNodeTitle } from './TreeNodeTitle';
|
|
11
11
|
import { _isObjectSelection } from './_types';
|
|
12
12
|
import { useSharedTranslation } from '../../hooks/useSharedTranslation';
|
|
13
|
-
export const SelectTreeNodeContent = ({ treeData: tree, childrenAsRecordValuePermissionFilter, onSelect, onCheck, selectedNodes = [], disabledNodes = [], multiple = false, checkable = false, checkStrictly = true, canSelectRoot = false, selectableLibraries, loadRecursively = true, noPagination = false, showSelectChildrenButton = false, }) => {
|
|
13
|
+
export const SelectTreeNodeContent = ({ treeData: tree, childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter, onSelect, onCheck, selectedNodes = [], disabledNodes = [], multiple = false, checkable = false, checkStrictly = true, canSelectRoot = false, selectableLibraries, loadRecursively = true, noPagination = false, showSelectChildrenButton = false, }) => {
|
|
14
14
|
const { t } = useSharedTranslation();
|
|
15
15
|
const rootNode = {
|
|
16
16
|
title: tree.label,
|
|
@@ -32,6 +32,9 @@ export const SelectTreeNodeContent = ({ treeData: tree, childrenAsRecordValuePer
|
|
|
32
32
|
const _fetchTreeContent = async (parentNodeKey, offset = 0, currentTreeMap = { ...treeMap }) => {
|
|
33
33
|
try {
|
|
34
34
|
const { data: { treeNodeChildren }, } = await loadTreeContent({
|
|
35
|
+
// If dependentValuesPermissionFilter is set, we need to bypass the cache to get up-to-date data,
|
|
36
|
+
// because tree content depends on record values that may have changed
|
|
37
|
+
fetchPolicy: dependentValuesPermissionFilter ? 'no-cache' : undefined,
|
|
35
38
|
variables: {
|
|
36
39
|
treeId: tree.id,
|
|
37
40
|
node: parentNodeKey && parentNodeKey !== tree.id ? parentNodeKey : null,
|
|
@@ -42,6 +45,7 @@ export const SelectTreeNodeContent = ({ treeData: tree, childrenAsRecordValuePer
|
|
|
42
45
|
offset,
|
|
43
46
|
},
|
|
44
47
|
childrenAsRecordValuePermissionFilter,
|
|
48
|
+
dependentValuesPermissionFilter,
|
|
45
49
|
},
|
|
46
50
|
});
|
|
47
51
|
const parentMapKey = parentNodeKey ?? tree.id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectTreeNodeContent.js","sourceRoot":"","sources":["../../../src/components/SelectTreeNode/SelectTreeNodeCont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,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,IAAuB,EAC7B,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,wBAAwB,EAAE,wBAAwB,GACpD,CACL,EACD,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,YAAY,GACvB,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type ComponentProps, type FunctionComponent, useEffect, useState} from 'react';\nimport {KitTree} from 'aristid-ds';\nimport {Spin} from 'antd';\nimport {type EventDataNode} from 'antd/lib/tree';\nimport {type ITreeNodeWithRecord} from '_ui/types';\nimport {type ChildrenAsRecordValuePermissionFilterInput, useTreeNodeChildrenLazyQuery} from '_ui/_gqlTypes';\nimport {defaultPaginationPageSize, ErrorDisplay} from '../../index';\nimport {TreeNodeTitle} from './TreeNodeTitle';\nimport {_isObjectSelection, type ITreeMap, type ITreeMapElement} from './_types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\n\ninterface ISelectTreeNodeContentProps {\n treeData: {id: string; label: string};\n childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;\n selectedNodes?: string[];\n disabledNodes?: string[];\n onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;\n onCheck?: (selection: ITreeNodeWithRecord[]) => void;\n multiple?: boolean;\n checkable?: boolean;\n checkStrictly?: boolean;\n canSelectRoot?: boolean;\n selectableLibraries?: string[]; // all by default\n loadRecursively?: boolean;\n noPagination?: boolean;\n showSelectChildrenButton?: boolean;\n}\n\nexport const SelectTreeNodeContent: FunctionComponent<ISelectTreeNodeContentProps> = ({\n treeData: tree,\n childrenAsRecordValuePermissionFilter,\n onSelect,\n onCheck,\n selectedNodes = [],\n disabledNodes = [],\n multiple = false,\n checkable = false,\n checkStrictly = true,\n canSelectRoot = false,\n selectableLibraries,\n loadRecursively = true,\n noPagination = false,\n showSelectChildrenButton = false,\n}) => {\n const {t} = useSharedTranslation();\n\n const rootNode: ITreeMapElement = {\n title: tree.label,\n record: null,\n id: tree.id,\n key: tree.id,\n isLeaf: false,\n parents: [],\n paginationOffset: 0,\n children: [],\n };\n\n // As we'll fetch children when a node is expanded, we store the whole tree content in a hash map\n // to make update easier and more efficient\n const [treeMap, setTreeMap] = useState<ITreeMap>({\n [tree.id]: rootNode,\n });\n\n const [fetchError, setFetchError] = useState<string | undefined>();\n const [loadTreeContent, {error, called}] = useTreeNodeChildrenLazyQuery();\n\n const _fetchTreeContent = async (parentNodeKey?: string, offset = 0, currentTreeMap = {...treeMap}) => {\n try {\n const {\n data: {treeNodeChildren},\n } = await loadTreeContent({\n variables: {\n treeId: tree.id,\n node: parentNodeKey && parentNodeKey !== tree.id ? parentNodeKey : null,\n pagination: noPagination\n ? undefined\n : {\n limit: defaultPaginationPageSize,\n offset,\n },\n childrenAsRecordValuePermissionFilter,\n },\n });\n\n const parentMapKey = parentNodeKey ?? tree.id;\n const totalCount = treeNodeChildren.totalCount;\n const parentElement = currentTreeMap[parentMapKey];\n const showMoreKey = '__showMore' + parentMapKey + offset;\n\n const parentPath = parentElement?.parents ?? [];\n const currentParents = [...parentPath, parentMapKey];\n\n const formattedNodes = treeNodeChildren.list.map(e => ({\n record: e.record,\n title: e.record.whoAmI.label || e.record.whoAmI.id,\n id: e.id,\n key: e.id,\n isLeaf: !e.childrenCount,\n children: [],\n parents: currentParents,\n paginationOffset: 0,\n disabled: disabledNodes.includes(e.id),\n }));\n\n const existingKeys = new Set(parentElement.children.map(child => child.key));\n const newNodes = formattedNodes.filter(node => !existingKeys.has(node.key));\n parentElement.children = [\n ...parentElement.children.filter(child => !child.key.startsWith(`__showMore${parentMapKey}`)),\n ...newNodes,\n ];\n\n for (const node of formattedNodes) {\n currentTreeMap[node.key] = node as ITreeMapElement;\n parentElement.paginationOffset = offset;\n }\n\n if (!noPagination && totalCount > parentElement.paginationOffset + defaultPaginationPageSize) {\n const showMoreElement: ITreeMapElement = {\n isShowMore: true,\n record: null,\n title: t('tree-node-selection.show_more'),\n id: parentMapKey,\n key: showMoreKey,\n isLeaf: false,\n children: [],\n paginationOffset: 0,\n };\n parentElement.children.push(showMoreElement);\n }\n\n const newOffset = offset + defaultPaginationPageSize;\n if (treeNodeChildren.totalCount > newOffset) {\n await _fetchTreeContent(parentNodeKey, newOffset, currentTreeMap);\n }\n\n if (loadRecursively) {\n for (const node of formattedNodes) {\n if (!node.isLeaf) {\n await _fetchTreeContent(node.key, 0, currentTreeMap);\n }\n }\n }\n\n setTreeMap(currentTreeMap);\n setFetchError(undefined);\n } catch (err) {\n setFetchError((err as Error).message);\n }\n };\n\n useEffect(() => {\n _fetchTreeContent(undefined, 0);\n }, []);\n\n /**\n * In strict mode, loadData handler is called twice\n * https://github.com/ant-design/ant-design/issues/54497\n */\n const _handleLoadData: ComponentProps<typeof KitTree>['loadData'] = async nodeData => {\n const {id, isShowMore} = nodeData as EventDataNode<ITreeMapElement>;\n\n // Handle offset if we get here through the \"show more\" element\n const currentNodeOffset = treeMap[id]?.paginationOffset ?? 0;\n const paginationOffset = isShowMore\n ? (treeMap[id]?.paginationOffset ?? 0) + defaultPaginationPageSize\n : currentNodeOffset;\n\n if (id === tree.id && !isShowMore) {\n // Root has already been loaded\n return;\n }\n\n await _fetchTreeContent(id, paginationOffset);\n };\n\n const _handleSelect: ComponentProps<typeof KitTree>['onSelect'] = (_, e) => {\n // Prevent selecting when clicking on select all children button\n if (e.nativeEvent.target instanceof HTMLButtonElement) {\n return;\n }\n // If user clicked on the text \"show more\", we load more children instead of selecting the node\n if ('isShowMore' in e.node && e.node.isShowMore) {\n _handleLoadData(e.node);\n return;\n }\n\n const node = treeMap[e.node.key];\n const isRoot = node.id === tree.id;\n\n if (\n (!canSelectRoot && isRoot) ||\n (!isRoot && selectableLibraries && !selectableLibraries.includes(node.record.whoAmI.library.id))\n ) {\n return;\n }\n\n const getAllDescendants = (nodeId: string): string[] =>\n treeMap[nodeId].children.reduce<string[]>(\n (acc, child) => [...acc, child.id, ...getAllDescendants(child.id)],\n [],\n );\n\n if (node) {\n if (checkable) {\n const isDeselecting = selectedNodes.includes(node.id);\n\n if (isDeselecting && isRoot) {\n _handleCheck([], null);\n } else if (isDeselecting) {\n const nodeToDeselect = [node.id, ...node.parents, ...getAllDescendants(node.id)];\n const selectionToKeep = selectedNodes.filter(\n selectedNode => !nodeToDeselect.includes(selectedNode),\n );\n\n _handleCheck(selectionToKeep, null);\n } else if (isRoot) {\n _handleCheck([...getAllDescendants(tree.id), tree.id], null);\n } else {\n _handleCheck([...selectedNodes, node.id], null);\n }\n } else {\n onSelect(node, e.selected);\n }\n }\n };\n\n const _handleCheck: ComponentProps<typeof KitTree>['onCheck'] = selection => {\n if (!canSelectRoot && Array.isArray(selection) && selection.includes(tree.id)) {\n return;\n }\n\n const checkedKeys = _isObjectSelection(selection) ? selection.checked : selection;\n const nodes = checkedKeys.map(key => treeMap[key]);\n\n onCheck(nodes);\n };\n\n if (!called) {\n return <Spin />;\n }\n\n if (error || fetchError) {\n return <ErrorDisplay message={error?.message ?? fetchError} />;\n }\n\n return (\n <KitTree\n checkStrictly={checkStrictly}\n treeData={[treeMap[rootNode.key]]}\n loadData={loadRecursively ? undefined : _handleLoadData}\n multiple={multiple}\n checkable={checkable}\n defaultExpandedKeys={selectedNodes.length > 0 ? [...selectedNodes, tree.id] : [tree.id]}\n selectedKeys={selectedNodes}\n checkedKeys={selectedNodes}\n titleRender={node => (\n <TreeNodeTitle\n checkable={checkable}\n disabledNodes={disabledNodes}\n loadRecursively={loadRecursively}\n node={node as ITreeMapElement}\n onSelect={onSelect}\n selectedNodes={selectedNodes}\n showSelectChildrenButton={showSelectChildrenButton}\n />\n )}\n onSelect={_handleSelect}\n onCheck={_handleCheck}\n />\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"SelectTreeNodeContent.js","sourceR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AAC,IAAI,CAAC,EAAE,CAAC,EACvF,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,aAAa,EAC1B,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,CACjB,KAAC,aAAa,IACV,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,IAAuB,EAC7B,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,wBAAwB,EAAE,wBAAwB,GACpD,CACL,EACD,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,YAAY,GACvB,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type ComponentProps, type FunctionComponent, useEffect, useState} from 'react';\nimport {KitTree} from 'aristid-ds';\nimport {Spin} from 'antd';\nimport {type EventDataNode} from 'antd/lib/tree';\nimport {type ITreeNodeWithRecord} from '_ui/types';\nimport {\n type ChildrenAsRecordValuePermissionFilterInput,\n type DependentValuesPermissionFilterInput,\n useTreeNodeChildrenLazyQuery,\n} from '_ui/_gqlTypes';\nimport {defaultPaginationPageSize, ErrorDisplay} from '../../index';\nimport {TreeNodeTitle} from './TreeNodeTitle';\nimport {_isObjectSelection, type ITreeMap, type ITreeMapElement} from './_types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\n\ninterface ISelectTreeNodeContentProps {\n treeData: {id: string; label: string};\n childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;\n dependentValuesPermissionFilter?: DependentValuesPermissionFilterInput;\n selectedNodes?: string[];\n disabledNodes?: string[];\n onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;\n onCheck?: (selection: ITreeNodeWithRecord[]) => void;\n multiple?: boolean;\n checkable?: boolean;\n checkStrictly?: boolean;\n canSelectRoot?: boolean;\n selectableLibraries?: string[]; // all by default\n loadRecursively?: boolean;\n noPagination?: boolean;\n showSelectChildrenButton?: boolean;\n}\n\nexport const SelectTreeNodeContent: FunctionComponent<ISelectTreeNodeContentProps> = ({\n treeData: tree,\n childrenAsRecordValuePermissionFilter,\n dependentValuesPermissionFilter,\n onSelect,\n onCheck,\n selectedNodes = [],\n disabledNodes = [],\n multiple = false,\n checkable = false,\n checkStrictly = true,\n canSelectRoot = false,\n selectableLibraries,\n loadRecursively = true,\n noPagination = false,\n showSelectChildrenButton = false,\n}) => {\n const {t} = useSharedTranslation();\n\n const rootNode: ITreeMapElement = {\n title: tree.label,\n record: null,\n id: tree.id,\n key: tree.id,\n isLeaf: false,\n parents: [],\n paginationOffset: 0,\n children: [],\n };\n\n // As we'll fetch children when a node is expanded, we store the whole tree content in a hash map\n // to make update easier and more efficient\n const [treeMap, setTreeMap] = useState<ITreeMap>({\n [tree.id]: rootNode,\n });\n\n const [fetchError, setFetchError] = useState<string | undefined>();\n const [loadTreeContent, {error, called}] = useTreeNodeChildrenLazyQuery();\n\n const _fetchTreeContent = async (parentNodeKey?: string, offset = 0, currentTreeMap = {...treeMap}) => {\n try {\n const {\n data: {treeNodeChildren},\n } = await loadTreeContent({\n // If dependentValuesPermissionFilter is set, we need to bypass the cache to get up-to-date data,\n // because tree content depends on record values that may have changed\n fetchPolicy: dependentValuesPermissionFilter ? 'no-cache' : undefined,\n variables: {\n treeId: tree.id,\n node: parentNodeKey && parentNodeKey !== tree.id ? parentNodeKey : null,\n pagination: noPagination\n ? undefined\n : {\n limit: defaultPaginationPageSize,\n offset,\n },\n childrenAsRecordValuePermissionFilter,\n dependentValuesPermissionFilter,\n },\n });\n\n const parentMapKey = parentNodeKey ?? tree.id;\n const totalCount = treeNodeChildren.totalCount;\n const parentElement = currentTreeMap[parentMapKey];\n const showMoreKey = '__showMore' + parentMapKey + offset;\n\n const parentPath = parentElement?.parents ?? [];\n const currentParents = [...parentPath, parentMapKey];\n\n const formattedNodes = treeNodeChildren.list.map(e => ({\n record: e.record,\n title: e.record.whoAmI.label || e.record.whoAmI.id,\n id: e.id,\n key: e.id,\n isLeaf: !e.childrenCount,\n children: [],\n parents: currentParents,\n paginationOffset: 0,\n disabled: disabledNodes.includes(e.id),\n }));\n\n const existingKeys = new Set(parentElement.children.map(child => child.key));\n const newNodes = formattedNodes.filter(node => !existingKeys.has(node.key));\n parentElement.children = [\n ...parentElement.children.filter(child => !child.key.startsWith(`__showMore${parentMapKey}`)),\n ...newNodes,\n ];\n\n for (const node of formattedNodes) {\n currentTreeMap[node.key] = node as ITreeMapElement;\n parentElement.paginationOffset = offset;\n }\n\n if (!noPagination && totalCount > parentElement.paginationOffset + defaultPaginationPageSize) {\n const showMoreElement: ITreeMapElement = {\n isShowMore: true,\n record: null,\n title: t('tree-node-selection.show_more'),\n id: parentMapKey,\n key: showMoreKey,\n isLeaf: false,\n children: [],\n paginationOffset: 0,\n };\n parentElement.children.push(showMoreElement);\n }\n\n const newOffset = offset + defaultPaginationPageSize;\n if (treeNodeChildren.totalCount > newOffset) {\n await _fetchTreeContent(parentNodeKey, newOffset, currentTreeMap);\n }\n\n if (loadRecursively) {\n for (const node of formattedNodes) {\n if (!node.isLeaf) {\n await _fetchTreeContent(node.key, 0, currentTreeMap);\n }\n }\n }\n\n setTreeMap(currentTreeMap);\n setFetchError(undefined);\n } catch (err) {\n setFetchError((err as Error).message);\n }\n };\n\n useEffect(() => {\n _fetchTreeContent(undefined, 0);\n }, []);\n\n /**\n * In strict mode, loadData handler is called twice\n * https://github.com/ant-design/ant-design/issues/54497\n */\n const _handleLoadData: ComponentProps<typeof KitTree>['loadData'] = async nodeData => {\n const {id, isShowMore} = nodeData as EventDataNode<ITreeMapElement>;\n\n // Handle offset if we get here through the \"show more\" element\n const currentNodeOffset = treeMap[id]?.paginationOffset ?? 0;\n const paginationOffset = isShowMore\n ? (treeMap[id]?.paginationOffset ?? 0) + defaultPaginationPageSize\n : currentNodeOffset;\n\n if (id === tree.id && !isShowMore) {\n // Root has already been loaded\n return;\n }\n\n await _fetchTreeContent(id, paginationOffset);\n };\n\n const _handleSelect: ComponentProps<typeof KitTree>['onSelect'] = (_, e) => {\n // Prevent selecting when clicking on select all children button\n if (e.nativeEvent.target instanceof HTMLButtonElement) {\n return;\n }\n // If user clicked on the text \"show more\", we load more children instead of selecting the node\n if ('isShowMore' in e.node && e.node.isShowMore) {\n _handleLoadData(e.node);\n return;\n }\n\n const node = treeMap[e.node.key];\n const isRoot = node.id === tree.id;\n\n if (\n (!canSelectRoot && isRoot) ||\n (!isRoot && selectableLibraries && !selectableLibraries.includes(node.record.whoAmI.library.id))\n ) {\n return;\n }\n\n const getAllDescendants = (nodeId: string): string[] =>\n treeMap[nodeId].children.reduce<string[]>(\n (acc, child) => [...acc, child.id, ...getAllDescendants(child.id)],\n [],\n );\n\n if (node) {\n if (checkable) {\n const isDeselecting = selectedNodes.includes(node.id);\n\n if (isDeselecting && isRoot) {\n _handleCheck([], null);\n } else if (isDeselecting) {\n const nodeToDeselect = [node.id, ...node.parents, ...getAllDescendants(node.id)];\n const selectionToKeep = selectedNodes.filter(\n selectedNode => !nodeToDeselect.includes(selectedNode),\n );\n\n _handleCheck(selectionToKeep, null);\n } else if (isRoot) {\n _handleCheck([...getAllDescendants(tree.id), tree.id], null);\n } else {\n _handleCheck([...selectedNodes, node.id], null);\n }\n } else {\n onSelect(node, e.selected);\n }\n }\n };\n\n const _handleCheck: ComponentProps<typeof KitTree>['onCheck'] = selection => {\n if (!canSelectRoot && Array.isArray(selection) && selection.includes(tree.id)) {\n return;\n }\n\n const checkedKeys = _isObjectSelection(selection) ? selection.checked : selection;\n const nodes = checkedKeys.map(key => treeMap[key]);\n\n onCheck(nodes);\n };\n\n if (!called) {\n return <Spin />;\n }\n\n if (error || fetchError) {\n return <ErrorDisplay message={error?.message ?? fetchError} />;\n }\n\n return (\n <KitTree\n checkStrictly={checkStrictly}\n treeData={[treeMap[rootNode.key]]}\n loadData={loadRecursively ? undefined : _handleLoadData}\n multiple={multiple}\n checkable={checkable}\n defaultExpandedKeys={selectedNodes.length > 0 ? [...selectedNodes, tree.id] : [tree.id]}\n selectedKeys={selectedNodes}\n checkedKeys={selectedNodes}\n titleRender={node => (\n <TreeNodeTitle\n checkable={checkable}\n disabledNodes={disabledNodes}\n loadRecursively={loadRecursively}\n node={node as ITreeMapElement}\n onSelect={onSelect}\n selectedNodes={selectedNodes}\n showSelectChildrenButton={showSelectChildrenButton}\n />\n )}\n onSelect={_handleSelect}\n onCheck={_handleCheck}\n />\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 {
|
|
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(
|
|
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,
|
|
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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AAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAEtE,OAAO,qBAAqB,GAAG,CAAC,CAAC,CAAC,CAAC,KAAC,MAAM,IAAC,WAAW,EAAE,EAAC,WAAW,EAAE,qBAAqB,EAAC,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5G,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,IAAqB,EAAE,aAAuB,EAAU,EAAE,CAClF,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;IACnC,IAAI,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACxD,KAAK,IAAI,CAAC,CAAC;IACf,CAAC;IACD,KAAK,IAAI,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC;AACjB,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useState, type FunctionComponent} from 'react';\nimport {type ITreeMapElement} from './_types';\nimport {KitButton, KitTag, KitTypography} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faCheck} from '@fortawesome/free-solid-svg-icons';\nimport {type ITreeNodeWithRecord} from '_ui/types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport styled from 'styled-components';\n\nconst TreeNodeLine = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n`;\nconst TreeNodeLineSection = styled.div`\n display: flex;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n`;\ninterface ITreeNodeTitleProps {\n checkable: boolean;\n disabledNodes: string[];\n loadRecursively: boolean;\n node: ITreeMapElement;\n onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;\n selectedNodes: string[];\n showSelectChildrenButton: boolean;\n}\n\nexport const TreeNodeTitle: FunctionComponent<ITreeNodeTitleProps> = ({\n checkable,\n disabledNodes,\n loadRecursively,\n node,\n onSelect,\n selectedNodes,\n showSelectChildrenButton,\n}) => {\n const {t} = useSharedTranslation();\n\n const [hover, setHover] = useState(false);\n\n const isSelected = selectedNodes.includes(node.id) && !node.isShowMore;\n const isDisabled = disabledNodes.includes(node.id);\n\n const buttonInSelectMode = node.children\n .filter(child => !child.isShowMore && !disabledNodes.includes(child.id))\n .every(child => !selectedNodes.includes(child.id));\n\n const handleChildrenSelection = (event: React.MouseEvent) => {\n event.stopPropagation();\n node.children.forEach(child => {\n if (node.disabled || child.isShowMore) {\n return;\n }\n onSelect(child, buttonInSelectMode);\n });\n };\n\n return (\n <TreeNodeLine onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}>\n <TreeNodeLineSection>\n <KitTypography.Text size=\"fontSize5\" disabled={isDisabled}>\n {node.title}\n </KitTypography.Text>\n <SelectedChildrenCount node={node} selectedNodes={selectedNodes} loadRecursively={loadRecursively} />\n </TreeNodeLineSection>\n <TreeNodeLineSection>\n {showSelectChildrenButton && node.children.length > 0 && hover && (\n <KitButton size=\"s\" onClick={e => handleChildrenSelection(e)}>\n {t(`tree-node-selection.${buttonInSelectMode ? 'select_children' : 'unselect_children'}`)}\n </KitButton>\n )}\n {!checkable && isSelected && (\n <FontAwesomeIcon\n icon={faCheck}\n color={\n isDisabled ? 'var(--general-utilities-text-disabled)' : 'var(--general-utilities-text-blue)'\n }\n />\n )}\n </TreeNodeLineSection>\n </TreeNodeLine>\n );\n};\n\nconst SelectedChildrenCount: FunctionComponent<{\n node: ITreeMapElement;\n selectedNodes: string[];\n loadRecursively: boolean;\n}> = ({node, selectedNodes, loadRecursively}) => {\n // it can work only if all children are loaded\n if (!loadRecursively) {\n return null;\n }\n\n const selectedChildrenCount = countSelectedNodes(node, selectedNodes);\n\n return selectedChildrenCount > 0 ? <KitTag idCardProps={{description: selectedChildrenCount}} /> : null;\n};\n\nconst countSelectedNodes = (node: ITreeMapElement, selectedNodes: string[]): number =>\n node.children?.reduce((count, child) => {\n if (selectedNodes.includes(child.id) && !child.isShowMore) {\n count += 1;\n }\n count += countSelectedNodes(child, selectedNodes);\n return count;\n }, 0) ?? 0;\n"]}
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"max_length": "Max length",
|
|
38
38
|
"confirm": "Confirm",
|
|
39
39
|
"loading": "Loading",
|
|
40
|
-
"are_you_sure": "Are you sure?"
|
|
40
|
+
"are_you_sure": "Are you sure?",
|
|
41
|
+
"reset": "Reset"
|
|
41
42
|
},
|
|
42
43
|
"errors": {
|
|
43
44
|
"default_language_required": "The default language is required",
|
|
@@ -699,7 +700,6 @@
|
|
|
699
700
|
"inactive": "Inactive sorts"
|
|
700
701
|
},
|
|
701
702
|
"toolbar": "Toolbar",
|
|
702
|
-
"reset-filter": "Reset filter",
|
|
703
703
|
"reset-view": "Reset view",
|
|
704
704
|
"empty-data": "No items found.",
|
|
705
705
|
"available-attributes": "Other available attributes",
|
|
@@ -776,6 +776,17 @@
|
|
|
776
776
|
"deselect_all": "Deselect all items"
|
|
777
777
|
}
|
|
778
778
|
},
|
|
779
|
+
"export_profile_modal": {
|
|
780
|
+
"title": "Export",
|
|
781
|
+
"profile_label": "Choose an export profile",
|
|
782
|
+
"preview_label": "Preview of exported attributes",
|
|
783
|
+
"search_placeholder": "Search...",
|
|
784
|
+
"no_profiles": "No export profiles configured for this library",
|
|
785
|
+
"contact_admin": "Please contact an administrator to configure export profiles.",
|
|
786
|
+
"empty_columns": "(empty column)",
|
|
787
|
+
"export_button": "Export",
|
|
788
|
+
"error_title": "Export profile error"
|
|
789
|
+
},
|
|
779
790
|
"add-existing-item": "Add existing item",
|
|
780
791
|
"activate_item_one": "Activate this item?",
|
|
781
792
|
"activate_item_other": "Activate these items?",
|
|
@@ -792,6 +803,7 @@
|
|
|
792
803
|
"delete_link_one": "Delete this link?",
|
|
793
804
|
"delete_link_other": "Delete these links?",
|
|
794
805
|
"delete_link_description_one": "You are about to delete this link.",
|
|
795
|
-
"delete_link_description_other": "You are about to delete these links."
|
|
806
|
+
"delete_link_description_other": "You are about to delete these links.",
|
|
807
|
+
"empty_value": "Undefined"
|
|
796
808
|
}
|
|
797
809
|
}
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"max_length": "Longueur maximale",
|
|
38
38
|
"confirm": "Confirmer",
|
|
39
39
|
"loading": "Chargement",
|
|
40
|
-
"are_you_sure": "Êtes-vous sûr ?"
|
|
40
|
+
"are_you_sure": "Êtes-vous sûr ?",
|
|
41
|
+
"reset": "Réinitialiser"
|
|
41
42
|
},
|
|
42
43
|
"errors": {
|
|
43
44
|
"default_language_required": "La langue par défaut est requise",
|
|
@@ -697,7 +698,6 @@
|
|
|
697
698
|
"inactive": "Tris inactifs"
|
|
698
699
|
},
|
|
699
700
|
"toolbar": "Barre d’outils",
|
|
700
|
-
"reset-filter": "Réinitialiser le filtre",
|
|
701
701
|
"reset-view": "Réinitialiser la vue",
|
|
702
702
|
"empty-data": "Aucun élément trouvé.",
|
|
703
703
|
"sort-ascending": "Ascendant",
|
|
@@ -776,6 +776,17 @@
|
|
|
776
776
|
"deselect_all": "Tout désélectionner"
|
|
777
777
|
}
|
|
778
778
|
},
|
|
779
|
+
"export_profile_modal": {
|
|
780
|
+
"title": "Export",
|
|
781
|
+
"profile_label": "Choisir un profil d'export",
|
|
782
|
+
"preview_label": "Aperçu des attributs exportés",
|
|
783
|
+
"search_placeholder": "Rechercher...",
|
|
784
|
+
"no_profiles": "Aucun profil d'export configuré pour cette librairie",
|
|
785
|
+
"contact_admin": "Veuillez contacter un administrateur pour configurer les profils d'export.",
|
|
786
|
+
"empty_columns": "(colonne vide)",
|
|
787
|
+
"export_button": "Exporter",
|
|
788
|
+
"error_title": "Erreur de profil d'export"
|
|
789
|
+
},
|
|
779
790
|
"add-existing-item": "Ajouter un élément existant",
|
|
780
791
|
"activate_item_one": "Activer cet élément ?",
|
|
781
792
|
"activate_item_other": "Activer ces éléments ?",
|
|
@@ -792,6 +803,7 @@
|
|
|
792
803
|
"delete_link_one": "Supprimer cette liaison ?",
|
|
793
804
|
"delete_link_other": "Supprimer ces liaisons ?",
|
|
794
805
|
"delete_link_description_one": "Vous êtes sur le point de supprimer cette liaison.",
|
|
795
|
-
"delete_link_description_other": "Vous êtes sur le point de supprimer ces liaisons."
|
|
806
|
+
"delete_link_description_other": "Vous êtes sur le point de supprimer ces liaisons.",
|
|
807
|
+
"empty_value": "Non défini"
|
|
796
808
|
}
|
|
797
809
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leav/ui",
|
|
3
|
-
"version": "1.6.0-
|
|
3
|
+
"version": "1.6.0-eb8e0390",
|
|
4
4
|
"description": "Shared React components and hooks",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepublishOnly": "yarn build",
|
|
@@ -42,15 +42,13 @@
|
|
|
42
42
|
"@types/react-beautiful-dnd": "13.1.8",
|
|
43
43
|
"@types/react-dom": "18.2.6",
|
|
44
44
|
"@types/react-table": "7.7.20",
|
|
45
|
-
"
|
|
46
|
-
"aristid-ds": "14.0.0-c13d6a5",
|
|
45
|
+
"aristid-ds": "14.0.0-fd68c13",
|
|
47
46
|
"babel-jest": "29.3.1",
|
|
48
|
-
"commander": "9.5.0",
|
|
49
47
|
"graphql": "16.12.0",
|
|
50
48
|
"i18next": "22.5.1",
|
|
51
49
|
"jest": "29.0.3",
|
|
52
50
|
"jest-environment-jsdom": "29.3.1",
|
|
53
|
-
"jest-styled-components": "7.
|
|
51
|
+
"jest-styled-components": "7.2.0",
|
|
54
52
|
"react": "18.2.0",
|
|
55
53
|
"react-dom": "18.2.0",
|
|
56
54
|
"react-i18next": "12",
|
|
@@ -64,14 +62,12 @@
|
|
|
64
62
|
"peerDependencies": {
|
|
65
63
|
"@ant-design/icons": ">=5.2",
|
|
66
64
|
"@apollo/client": ">=3.8.1",
|
|
67
|
-
"
|
|
68
|
-
"aristid-ds": "14.0.0-c13d6a5",
|
|
65
|
+
"aristid-ds": "14.0.0-fd68c13",
|
|
69
66
|
"dayjs": "^1.11.13",
|
|
70
67
|
"i18next": "22.5",
|
|
71
68
|
"react": "18.2.0",
|
|
72
69
|
"react-dom": "18.2.0",
|
|
73
70
|
"react-i18next": "12",
|
|
74
|
-
"react-icons": ">=4",
|
|
75
71
|
"react-router-dom": "6.22.0",
|
|
76
72
|
"styled-components": ">=5.3"
|
|
77
73
|
},
|
|
@@ -80,6 +76,10 @@
|
|
|
80
76
|
"@ckeditor/ckeditor5-react": "6.1.0",
|
|
81
77
|
"@dnd-kit/core": "6.1.0",
|
|
82
78
|
"@dnd-kit/sortable": "8.0.0",
|
|
79
|
+
"@fortawesome/fontawesome-svg-core": "7.0.1",
|
|
80
|
+
"@fortawesome/free-regular-svg-icons": "7.0.1",
|
|
81
|
+
"@fortawesome/free-solid-svg-icons": "7.0.1",
|
|
82
|
+
"@fortawesome/react-fontawesome": "3.0.2",
|
|
83
83
|
"@leav/utils": "1.6.0",
|
|
84
84
|
"@uidotdev/usehooks": "2.4.1",
|
|
85
85
|
"dompurify": "3.2.4",
|
|
@@ -88,7 +88,6 @@
|
|
|
88
88
|
"lodash.isequal": "4.5.0",
|
|
89
89
|
"object-path": "0.11.8",
|
|
90
90
|
"react-beautiful-dnd": "13.1.1",
|
|
91
|
-
"react-icons": "4.7.1",
|
|
92
91
|
"react-markdown": "5.0.3",
|
|
93
92
|
"react-table": "7.8.0",
|
|
94
93
|
"react-table-sticky": "1.1.3",
|