@leav/ui 0.3.6-7338b86 → 0.3.6-75eae8d
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/__mocks__/common/attribute.d.ts +1 -0
- package/dist/__mocks__/common/attribute.js +8 -1
- package/dist/__mocks__/common/attribute.js.map +1 -1
- package/dist/__mocks__/common/form.d.ts +1 -0
- package/dist/__mocks__/common/form.js +18 -2
- package/dist/__mocks__/common/form.js.map +1 -1
- package/dist/__mocks__/common/value.js +2 -1
- package/dist/__mocks__/common/value.js.map +1 -1
- package/dist/_gqlTypes/index.d.ts +102 -4
- package/dist/_gqlTypes/index.js +83 -2
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/_queries/records/getRecordColumnsValues.d.ts +4 -2
- package/dist/_queries/records/getRecordColumnsValues.js +4 -1
- package/dist/_queries/records/getRecordColumnsValues.js.map +1 -1
- package/dist/_queries/records/recordFormAttributeFragment.js +1 -0
- package/dist/_queries/records/recordFormAttributeFragment.js.map +1 -1
- package/dist/_utils/interleaveElement.d.ts +1 -0
- package/dist/{components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducerContext.js → _utils/interleaveElement.js} +2 -6
- package/dist/_utils/interleaveElement.js.map +1 -0
- package/dist/components/CreateDirectory/CreateDirectory.js +1 -1
- package/dist/components/CreateDirectory/CreateDirectory.js.map +1 -1
- package/dist/components/EditApplication/EditApplication.js +2 -2
- package/dist/components/EditApplication/EditApplication.js.map +1 -1
- package/dist/components/EditApplication/_types.d.ts +2 -2
- package/dist/components/Explorer/DataView.d.ts +8 -0
- package/dist/components/Explorer/DataView.js +33 -7
- package/dist/components/Explorer/DataView.js.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts +3 -3
- package/dist/components/Explorer/Explorer.js +42 -19
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/TableCell.d.ts +1 -1
- package/dist/components/Explorer/TableCell.js +116 -36
- package/dist/components/Explorer/TableCell.js.map +1 -1
- package/dist/components/Explorer/TableTagGroup.d.ts +1 -0
- package/dist/components/Explorer/TableTagGroup.js +9 -1
- package/dist/components/Explorer/TableTagGroup.js.map +1 -1
- package/dist/components/Explorer/_queries/useExplorerData.d.ts +22 -4
- package/dist/components/Explorer/_queries/useExplorerData.js +88 -4
- package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
- package/dist/components/Explorer/_types.d.ts +23 -1
- package/dist/components/Explorer/display-view-filters/ExplorerFilterBar.d.ts +2 -0
- package/dist/components/Explorer/display-view-filters/ExplorerFilterBar.js +37 -0
- package/dist/components/Explorer/display-view-filters/ExplorerFilterBar.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.d.ts +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js +11 -4
- package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.d.ts +5 -0
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.js +12 -0
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/_shared/useAttributeDetailsData.d.ts +11 -0
- package/dist/components/Explorer/manage-view-settings/_shared/useAttributeDetailsData.js +61 -0
- package/dist/components/Explorer/manage-view-settings/_shared/useAttributeDetailsData.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js +19 -52
- 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.d.ts +4 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +76 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.d.ts +9 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js +33 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/BooleanAttributeDropdown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/BooleanAttributeDropdown.js +37 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/BooleanAttributeDropdown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/DateAttributeDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/DateAttributeDropDown.js +89 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/DateAttributeDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js +23 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterValueList.d.ts +10 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterValueList.js +75 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterValueList.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/NumericAttributeDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/NumericAttributeDropDown.js +44 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/NumericAttributeDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/SimpleFilterDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/SimpleFilterDropDown.js +72 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/SimpleFilterDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TextAttributeDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TextAttributeDropDown.js +53 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TextAttributeDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.d.ts +15 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.js +114 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/index.d.ts +4 -4
- package/dist/components/Explorer/manage-view-settings/index.js +3 -3
- package/dist/components/Explorer/manage-view-settings/index.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/SidePanel.js +1 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/SidePanel.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/open-view-settings/{useOpenSettings.js → useOpenViewSettings.js} +5 -3
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.d.ts +1 -1
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js +5 -5
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.d.ts +4 -0
- package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js +109 -0
- package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.d.ts +10 -0
- package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js +32 -0
- package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.d.ts +2 -0
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js +9 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.d.ts +111 -16
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js +161 -24
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
- package/dist/components/Explorer/useDeactivateAction.js +3 -2
- package/dist/components/Explorer/useDeactivateAction.js.map +1 -1
- package/dist/components/Explorer/useEditAction.js +5 -3
- package/dist/components/Explorer/useEditAction.js.map +1 -1
- package/dist/components/Explorer/usePagination.d.ts +7 -0
- package/dist/components/Explorer/usePagination.js +25 -0
- package/dist/components/Explorer/usePagination.js.map +1 -0
- package/dist/components/Explorer/usePrimaryActions.d.ts +1 -9
- package/dist/components/Explorer/usePrimaryActions.js +4 -12
- package/dist/components/Explorer/usePrimaryActions.js.map +1 -1
- package/dist/components/Explorer/useSearchInput.d.ts +10 -0
- package/dist/components/Explorer/useSearchInput.js +31 -0
- package/dist/components/Explorer/useSearchInput.js.map +1 -0
- package/dist/components/Explorer/useTableScrollableHeight.d.ts +5 -0
- package/dist/components/Explorer/useTableScrollableHeight.js +15 -0
- package/dist/components/Explorer/useTableScrollableHeight.js.map +1 -0
- package/dist/components/Explorer/useViewSettingsReducer.d.ts +7 -0
- package/dist/components/Explorer/useViewSettingsReducer.js +60 -0
- package/dist/components/Explorer/useViewSettingsReducer.js.map +1 -0
- package/dist/components/ExportModal/ExportModal.js +2 -2
- package/dist/components/ExportModal/ExportModal.js.map +1 -1
- package/dist/components/ImportModal/ImportModalConfigStep/ImportModalConfigStep.js +5 -5
- package/dist/components/ImportModal/ImportModalConfigStep/ImportModalConfigStep.js.map +1 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js +2 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js +15 -2
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/_types.d.ts +5 -16
- package/dist/components/RecordEdition/EditRecordContent/_types.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.d.ts +5 -1
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.js +15 -8
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.d.ts +3 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.d.ts +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.js +2 -7
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.d.ts +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.js +2 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/ComputeIndicator.d.ts +6 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/ComputeIndicator.js +18 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/ComputeIndicator.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.d.ts +4 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +94 -294
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js +8 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js +28 -22
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js +26 -18
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js +16 -13
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js +22 -19
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js +44 -42
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js +19 -19
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.d.ts +13 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js +25 -402
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/{MonoValueSelect.d.ts → DSListSelect.d.ts} +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/{MonoValueSelect.js → DSListSelect.js} +32 -13
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/_types.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/_types.d.ts +10 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/calculatedInheritedFlags.d.ts +42 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/calculatedInheritedFlags.js +55 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/calculatedInheritedFlags.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.d.ts +12 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.js +37 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +4 -7
- package/dist/components/SelectTreeNode/SelectTreeNode.js +17 -135
- package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +16 -0
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +131 -0
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -0
- package/dist/components/SelectTreeNode/index.d.ts +1 -1
- package/dist/components/SelectTreeNode/index.js +1 -1
- package/dist/components/SelectTreeNode/index.js.map +1 -1
- package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.d.ts +4 -7
- package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.js +10 -10
- package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.js.map +1 -1
- package/dist/components/SelectTreeNodeModal/index.d.ts +1 -2
- package/dist/components/SelectTreeNodeModal/index.js +1 -2
- package/dist/components/SelectTreeNodeModal/index.js.map +1 -1
- package/dist/components/UploadFiles/UploadFiles.js +1 -1
- package/dist/components/UploadFiles/UploadFiles.js.map +1 -1
- package/dist/components/ValuesVersionConfigurator/VersionTree/VersionTree.js +2 -2
- package/dist/components/ValuesVersionConfigurator/VersionTree/VersionTree.js.map +1 -1
- package/dist/hooks/useDebouncedValue/index.d.ts +1 -0
- package/dist/{components/RecordEdition/EditRecordContent/reducers/standardFieldReducer → hooks/useDebouncedValue}/index.js +1 -2
- package/dist/hooks/useDebouncedValue/index.js.map +1 -0
- package/dist/locales/en/shared.json +34 -6
- package/dist/locales/fr/shared.json +34 -6
- package/package.json +5 -2
- package/dist/components/Explorer/manage-view-settings/_shared/useGetLibraryColumns.d.ts +0 -10
- package/dist/components/Explorer/manage-view-settings/_shared/useGetLibraryColumns.js +0 -24
- package/dist/components/Explorer/manage-view-settings/_shared/useGetLibraryColumns.js.map +0 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenSettings.d.ts +0 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenSettings.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.d.ts +0 -138
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.js +0 -361
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducerContext.d.ts +0 -7
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducerContext.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/useStandardFieldReducer.d.ts +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/useStandardFieldReducer.js +0 -7
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/useStandardFieldReducer.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/CheckboxInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/CheckboxInput.js +0 -14
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/CheckboxInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/ColorInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/ColorInput.js +0 -22
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/ColorInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/DateInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/DateInput.js +0 -22
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/DateInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/EncryptedInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/EncryptedInput.js +0 -19
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/EncryptedInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/NumberInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/NumberInput.js +0 -32
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/NumberInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/RichTextEditorInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/RichTextEditorInput.js +0 -51
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/RichTextEditorInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/TextInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/TextInput.js +0 -26
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/TextInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/MonoValueSelect.js.map +0 -1
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { RecordFormAttributeStandardAttributeFragment } from '../../../../../../_gqlTypes';
|
|
2
|
-
import { IProvidedByAntFormItem, StandardValueTypes } from '../../../../../../components/RecordEdition/EditRecordContent/_types';
|
|
3
|
-
import {
|
|
2
|
+
import { IProvidedByAntFormItem, ISubmitMultipleResult, StandardValueTypes } from '../../../../../../components/RecordEdition/EditRecordContent/_types';
|
|
3
|
+
import { CalculatedFlags, InheritedFlags } from '../calculatedInheritedFlags';
|
|
4
4
|
export interface IStandFieldValueContentProps<T> extends IProvidedByAntFormItem<T> {
|
|
5
5
|
presentationValue?: string;
|
|
6
|
-
state: IStandardFieldReducerState;
|
|
7
6
|
attribute?: RecordFormAttributeStandardAttributeFragment;
|
|
8
|
-
|
|
7
|
+
label?: string;
|
|
8
|
+
isLastValueOfMultivalues?: boolean;
|
|
9
|
+
removeLastValueOfMultivalues?: () => void;
|
|
10
|
+
handleSubmit: (value: StandardValueTypes, id?: string) => Promise<void | ISubmitMultipleResult>;
|
|
11
|
+
readonly: boolean;
|
|
12
|
+
required: boolean;
|
|
13
|
+
calculatedFlags: CalculatedFlags;
|
|
14
|
+
inheritedFlags: InheritedFlags;
|
|
9
15
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RecordFormElementsValueStandardValue } from '../../../../../hooks/useGetRecordForm';
|
|
2
|
+
interface IInheritedNotOverride {
|
|
3
|
+
isInheritedValue: true;
|
|
4
|
+
isInheritedOverrideValue: false;
|
|
5
|
+
isInheritedNotOverrideValue: true;
|
|
6
|
+
inheritedValue: RecordFormElementsValueStandardValue;
|
|
7
|
+
}
|
|
8
|
+
interface IInheritedOverride {
|
|
9
|
+
isInheritedValue: true;
|
|
10
|
+
isInheritedOverrideValue: true;
|
|
11
|
+
isInheritedNotOverrideValue: false;
|
|
12
|
+
inheritedValue: RecordFormElementsValueStandardValue;
|
|
13
|
+
}
|
|
14
|
+
interface INotInherited {
|
|
15
|
+
isInheritedValue: false;
|
|
16
|
+
isInheritedOverrideValue: false;
|
|
17
|
+
isInheritedNotOverrideValue: false;
|
|
18
|
+
inheritedValue: null;
|
|
19
|
+
}
|
|
20
|
+
export type InheritedFlags = INotInherited | IInheritedOverride | IInheritedNotOverride;
|
|
21
|
+
export declare const computeInheritedFlags: (fieldValues: RecordFormElementsValueStandardValue[]) => InheritedFlags;
|
|
22
|
+
interface ICalculatedNotOverride {
|
|
23
|
+
isCalculatedValue: true;
|
|
24
|
+
isCalculatedOverrideValue: false;
|
|
25
|
+
isCalculatedNotOverrideValue: true;
|
|
26
|
+
calculatedValue: RecordFormElementsValueStandardValue;
|
|
27
|
+
}
|
|
28
|
+
interface ICalculatedOverride {
|
|
29
|
+
isCalculatedValue: true;
|
|
30
|
+
isCalculatedOverrideValue: true;
|
|
31
|
+
isCalculatedNotOverrideValue: false;
|
|
32
|
+
calculatedValue: RecordFormElementsValueStandardValue;
|
|
33
|
+
}
|
|
34
|
+
interface INotCalculated {
|
|
35
|
+
isCalculatedValue: false;
|
|
36
|
+
isCalculatedOverrideValue: false;
|
|
37
|
+
isCalculatedNotOverrideValue: false;
|
|
38
|
+
calculatedValue: null;
|
|
39
|
+
}
|
|
40
|
+
export type CalculatedFlags = INotCalculated | ICalculatedOverride | ICalculatedNotOverride;
|
|
41
|
+
export declare const computeCalculatedFlags: (fieldValues: RecordFormElementsValueStandardValue[]) => CalculatedFlags;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export const computeInheritedFlags = (fieldValues) => {
|
|
2
|
+
const inheritedValue = fieldValues.find(fieldValue => fieldValue.isInherited);
|
|
3
|
+
const overrideValue = fieldValues.find(fieldValue => !fieldValue.isInherited && !fieldValue.isCalculated);
|
|
4
|
+
if (inheritedValue === undefined) {
|
|
5
|
+
return {
|
|
6
|
+
inheritedValue: null,
|
|
7
|
+
isInheritedValue: false,
|
|
8
|
+
isInheritedOverrideValue: false,
|
|
9
|
+
isInheritedNotOverrideValue: false
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
const isInheritedValue = true;
|
|
13
|
+
if (!overrideValue || overrideValue.payload === null) {
|
|
14
|
+
return {
|
|
15
|
+
inheritedValue,
|
|
16
|
+
isInheritedValue,
|
|
17
|
+
isInheritedNotOverrideValue: true,
|
|
18
|
+
isInheritedOverrideValue: false
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
inheritedValue,
|
|
23
|
+
isInheritedValue,
|
|
24
|
+
isInheritedNotOverrideValue: false,
|
|
25
|
+
isInheritedOverrideValue: true
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export const computeCalculatedFlags = (fieldValues) => {
|
|
29
|
+
const calculatedValue = fieldValues.find(fieldValue => fieldValue.isCalculated);
|
|
30
|
+
const overrideValue = fieldValues.find(fieldValue => !fieldValue.isCalculated && !fieldValue.isInherited);
|
|
31
|
+
if (calculatedValue === undefined) {
|
|
32
|
+
return {
|
|
33
|
+
calculatedValue: null,
|
|
34
|
+
isCalculatedValue: false,
|
|
35
|
+
isCalculatedOverrideValue: false,
|
|
36
|
+
isCalculatedNotOverrideValue: false
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const isCalculatedValue = true;
|
|
40
|
+
if (!overrideValue || overrideValue.payload === null) {
|
|
41
|
+
return {
|
|
42
|
+
calculatedValue,
|
|
43
|
+
isCalculatedValue,
|
|
44
|
+
isCalculatedNotOverrideValue: true,
|
|
45
|
+
isCalculatedOverrideValue: false
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
calculatedValue,
|
|
50
|
+
isCalculatedValue,
|
|
51
|
+
isCalculatedNotOverrideValue: false,
|
|
52
|
+
isCalculatedOverrideValue: true
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=calculatedInheritedFlags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculatedInheritedFlags.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/StandardField/calculatedInheritedFlags.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,WAAmD,EAAkB,EAAE;IACzG,MAA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IACN,CAAC;IAED,MAAM,iBAAiB,GAAG,IAAI,CAAC;IAE/B,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACnD,OAAO;YACH,eAAe;YACf,iBAAiB;YACjB,4BAA4B,EAAE,IAAI;YAClC,yBAAyB,EAAE,KAAK;SACnC,CAAC;IACN,CAAC;IAED,OAAO;QACH,eAAe;QACf,iBAAiB;QACjB,4BAA4B,EAAE,KAAK;QACnC,yBAAyB,EAAE,IAAI;KAClC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AttributeFormat, ValueDetailsValueFragment } from '../../../../../_gqlTypes';
|
|
2
|
+
import { RecordFormElementsValueStandardValue } from '../../../../../hooks/useGetRecordForm';
|
|
3
|
+
interface IUseGetPresentationValues {
|
|
4
|
+
presentationValues: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const useGetPresentationValues: ({ values, format, calculatedValue, inheritedValue }: {
|
|
7
|
+
values: ValueDetailsValueFragment[];
|
|
8
|
+
format: AttributeFormat;
|
|
9
|
+
calculatedValue: RecordFormElementsValueStandardValue;
|
|
10
|
+
inheritedValue: RecordFormElementsValueStandardValue;
|
|
11
|
+
}) => IUseGetPresentationValues;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
2
|
+
// This file is released under LGPL V3
|
|
3
|
+
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
4
|
+
import { AttributeFormat } from '../../../../../_gqlTypes';
|
|
5
|
+
import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
|
|
6
|
+
const _isDateRangeValue = (value) => !!value && typeof value === 'object' && 'from' in value && 'to' in value;
|
|
7
|
+
export const useGetPresentationValues = ({ values, format, calculatedValue, inheritedValue }) => {
|
|
8
|
+
const { t } = useSharedTranslation();
|
|
9
|
+
const presentationValues = values.map(value => {
|
|
10
|
+
let presentationValue = value.payload || calculatedValue?.payload || inheritedValue?.payload || '';
|
|
11
|
+
switch (format) {
|
|
12
|
+
case AttributeFormat.date_range:
|
|
13
|
+
if (_isDateRangeValue(presentationValue)) {
|
|
14
|
+
const { from, to } = presentationValue;
|
|
15
|
+
presentationValue = t('record_edition.date_range_value', {
|
|
16
|
+
from,
|
|
17
|
+
to,
|
|
18
|
+
interpolation: {
|
|
19
|
+
escapeValue: false
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
presentationValue = '';
|
|
25
|
+
}
|
|
26
|
+
break;
|
|
27
|
+
case AttributeFormat.color:
|
|
28
|
+
if (presentationValue) {
|
|
29
|
+
presentationValue = '#' + presentationValue;
|
|
30
|
+
}
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
return presentationValue;
|
|
34
|
+
});
|
|
35
|
+
return { presentationValues };
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=useGetPresentationValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetPresentationValues.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,eAAe,EAA4B,MAAM,eAAe,CAAC;AAEzE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,MAAM,iBAAiB,GAAG,CAAC,KAAU,EAAuC,EAAE,CAC1E,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC;AAM7E,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EACrC,MAAM,EACN,MAAM,EACN,eAAe,EACf,cAAc,EAMjB,EAA6B,EAAE;IAC5B,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAC1C,IAAI,iBAAiB,GAAG,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE,OAAO,IAAI,cAAc,EAAE,OAAO,IAAI,EAAE,CAAC;QAEnG,QAAQ,MAAM,EAAE,CAAC;YACb,KAAK,eAAe,CAAC,UAAU;gBAC3B,IAAI,iBAAiB,CAAC,iBAAiB,CAAC,EAAE,CAAC;oBACvC,MAAM,EAAC,IAAI,EAAE,EAAE,EAAC,GAAG,iBAAiB,CAAC;oBACrC,iBAAiB,GAAG,CAAC,CAAC,iCAAiC,EAAE;wBACrD,IAAI;wBACJ,EAAE;wBACF,aAAa,EAAE;4BACX,WAAW,EAAE,KAAK;yBACrB;qBACJ,CAAC,CAAC;gBACP,CAAC;qBAAM,CAAC;oBACJ,iBAAiB,GAAG,EAAE,CAAC;gBAC3B,CAAC;gBACD,MAAM;YACV,KAAK,eAAe,CAAC,KAAK;gBACtB,IAAI,iBAAiB,EAAE,CAAC;oBACpB,iBAAiB,GAAG,GAAG,GAAG,iBAAiB,CAAC;gBAChD,CAAC;gBACD,MAAM;QACd,CAAC;QAED,OAAO,iBAAiB,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,OAAO,EAAC,kBAAkB,EAAC,CAAC;AAChC,CAAC,CAAC"}
|
package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.js
CHANGED
|
@@ -42,7 +42,7 @@ const BreadcrumbRoot = styled(Breadcrumb) `
|
|
|
42
42
|
function ValuesAdd({ attribute, onAdd, onClose }) {
|
|
43
43
|
const { t } = useSharedTranslation();
|
|
44
44
|
const { lang } = useLang();
|
|
45
|
-
const valuesList = attribute
|
|
45
|
+
const valuesList = attribute.treeValuesList?.enable ? (attribute.treeValuesList.values ?? []) : [];
|
|
46
46
|
const wrapperRef = useRef();
|
|
47
47
|
const [selectedValuesFromTree, setSelectedValuesFromTree] = useState([]);
|
|
48
48
|
const [selectedValuesFromList, setSelectedValuesFromList] = useState([]);
|
|
@@ -100,7 +100,7 @@ function ValuesAdd({ attribute, onAdd, onClose }) {
|
|
|
100
100
|
});
|
|
101
101
|
return (_jsx(BreadcrumbWrapper, { children: _jsx(BreadcrumbRoot, { items: breadcrumbItems, separator: ">" }) }));
|
|
102
102
|
};
|
|
103
|
-
return (_jsx(_Fragment, { children: _jsxs(Wrapper, { "data-testid": "values-add", ref: wrapperRef, children: [_jsxs(SelectionWrapper, { children: [!!valuesList.length && (_jsxs(_Fragment, { children: [_jsx(Divider, { orientation: "left", children: t('record_edition.values_list') }), _jsx(List, { dataSource: valuesList, onItemClick: _handleItemClick, renderItemContent: _renderListItem, selectable: attribute.multiple_values, selectedItems: selectedValuesFromList, onSelectionChange: _handleSelectionChange, pagination: false })] })), _jsx(Divider, { orientation: "left", children: localizedTranslation(attribute.linked_tree.label, lang) }), _jsx(SelectTreeNode, {
|
|
103
|
+
return (_jsx(_Fragment, { children: _jsxs(Wrapper, { "data-testid": "values-add", ref: wrapperRef, children: [_jsxs(SelectionWrapper, { children: [!!valuesList.length && (_jsxs(_Fragment, { children: [_jsx(Divider, { orientation: "left", children: t('record_edition.values_list') }), _jsx(List, { dataSource: valuesList, onItemClick: _handleItemClick, renderItemContent: _renderListItem, selectable: attribute.multiple_values, selectedItems: selectedValuesFromList, onSelectionChange: _handleSelectionChange, pagination: false })] })), _jsx(Divider, { orientation: "left", children: localizedTranslation(attribute.linked_tree.label, lang) }), _jsx(SelectTreeNode, { treeId: attribute.linked_tree.id, onSelect: _handleSelect, onCheck: _handleCheck, multiple: attribute.multiple_values })] }), attribute.multiple_values && (_jsx(FooterWrapper, { children: _jsxs(Space, { children: [_jsx(Button, { size: "small", onClick: _handleClose, children: t('global.cancel') }), _jsx(Button, { type: "primary", size: "small", onClick: _handleSubmit, children: t('global.submit') })] }) }))] }) }));
|
|
104
104
|
}
|
|
105
105
|
export default ValuesAdd;
|
|
106
106
|
//# sourceMappingURL=ValuesAdd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValuesAdd.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,MAAM,CAAC;AACxD,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,IAAI,MAAM,qBAAqB,CAAC;AACvC,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAQ5C,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA;wBACF,SAAS,CAAC,SAAS;;;CAG1C,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIlC,CAAC;AAEF,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;;;kBAId,SAAS,CAAC,OAAO;CAClC,CAAC;AAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAInC,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;;;CAGxC,CAAC;AAIF,SAAS,SAAS,CAAC,EAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAkB;IAC3D,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,EAAC,IAAI,EAAC,GAAG,OAAO,EAAE,CAAC;IACzB,MAAM,UAAU,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"ValuesAdd.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,MAAM,CAAC;AACxD,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,IAAI,MAAM,qBAAqB,CAAC;AACvC,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAQ5C,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA;wBACF,SAAS,CAAC,SAAS;;;CAG1C,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIlC,CA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CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,GAAW,EAC/F,KAAC,cAAc,IACX,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE,EAChC,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,SAAS,CAAC,eAAe,GACrC,IACa,EAClB,SAAS,CAAC,eAAe,IAAI,CAC1B,KAAC,aAAa,cACV,MAAC,KAAK,eACF,KAAC,MAAM,IAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,YAAY,YACrC,CAAC,CAAC,eAAe,CAAC,GACd,EACT,KAAC,MAAM,IAAC,IAAI,EAAC,SAAS,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,aAAa,YACrD,CAAC,CAAC,eAAe,CAAC,GACd,IACL,GACI,CACnB,IACK,GACX,CACN,CAAC;AACN,CAAC;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
2
|
import { ITreeNodeWithRecord } from '../../types/trees';
|
|
3
3
|
interface ISelectTreeNodeProps {
|
|
4
|
-
|
|
5
|
-
id: string;
|
|
6
|
-
label?: SystemTranslation | null;
|
|
7
|
-
};
|
|
4
|
+
treeId: string;
|
|
8
5
|
selectedNode?: string;
|
|
9
6
|
onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;
|
|
10
7
|
onCheck?: (selection: ITreeNodeWithRecord[]) => void;
|
|
@@ -12,5 +9,5 @@ interface ISelectTreeNodeProps {
|
|
|
12
9
|
canSelectRoot?: boolean;
|
|
13
10
|
selectableLibraries?: string[];
|
|
14
11
|
}
|
|
15
|
-
declare
|
|
16
|
-
export
|
|
12
|
+
export declare const SelectTreeNode: FunctionComponent<ISelectTreeNodeProps>;
|
|
13
|
+
export {};
|
|
@@ -2,147 +2,29 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
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
|
-
import { DownOutlined } from '@ant-design/icons';
|
|
6
5
|
import { localizedTranslation } from '@leav/utils';
|
|
7
|
-
import { Spin, Tree } from 'antd';
|
|
8
|
-
import { useEffect, useState } from 'react';
|
|
9
6
|
import { useSharedTranslation } from '../../hooks/useSharedTranslation';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { useTreeDataQueryQuery } from '../../_gqlTypes';
|
|
8
|
+
import { ErrorDisplay } from '../..';
|
|
12
9
|
import useLang from '../../hooks/useLang';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
id: e.id,
|
|
17
|
-
key: e.id,
|
|
18
|
-
isLeaf: !e.childrenCount,
|
|
19
|
-
children: []
|
|
20
|
-
}));
|
|
21
|
-
const _getTreeNodeByKey = (key, treeContent) => {
|
|
22
|
-
for (const node of treeContent) {
|
|
23
|
-
if (key === node.key) {
|
|
24
|
-
return node;
|
|
25
|
-
}
|
|
26
|
-
const n = _getTreeNodeByKey(key, node.children);
|
|
27
|
-
if (!!n) {
|
|
28
|
-
return n;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
function SelectTreeNode({ tree, onSelect, onCheck, selectedNode: initSelectedNode, multiple = false, canSelectRoot = false, selectableLibraries }) {
|
|
10
|
+
import { SelectTreeNodeContent } from './SelectTreeNodeContent';
|
|
11
|
+
import { Skeleton } from 'antd';
|
|
12
|
+
export const SelectTreeNode = ({ treeId, onSelect, onCheck, selectedNode, multiple = false, canSelectRoot = false, selectableLibraries }) => {
|
|
33
13
|
const { lang } = useLang();
|
|
34
14
|
const { t } = useSharedTranslation();
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
record: null,
|
|
38
|
-
id: tree.id,
|
|
39
|
-
key: tree.id,
|
|
40
|
-
isLeaf: false,
|
|
41
|
-
paginationOffset: 0,
|
|
42
|
-
children: []
|
|
43
|
-
};
|
|
44
|
-
// As we'll fetch children when a node is expanded, we store the whole tree content in a hash map
|
|
45
|
-
// to make update easier and more efficient
|
|
46
|
-
const [treeMap, setTreeMap] = useState({
|
|
47
|
-
[tree.id]: rootNode
|
|
15
|
+
const { loading, error, data } = useTreeDataQueryQuery({
|
|
16
|
+
variables: { treeId }
|
|
48
17
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// Retrieve tree content
|
|
52
|
-
const [loadTreeContent, { error, called }] = useTreeNodeChildrenLazyQuery();
|
|
53
|
-
const _fetchTreeContent = async (key, offset = 0) => {
|
|
54
|
-
try {
|
|
55
|
-
const data = await loadTreeContent({
|
|
56
|
-
variables: {
|
|
57
|
-
treeId: tree.id,
|
|
58
|
-
node: key && key !== tree.id ? key : null,
|
|
59
|
-
pagination: {
|
|
60
|
-
limit: defaultPaginationPageSize,
|
|
61
|
-
offset
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
const formattedNodes = _constructTreeContent(data.data.treeNodeChildren.list);
|
|
66
|
-
const parentMapKey = key ?? tree.id;
|
|
67
|
-
const newTreeMap = { ...treeMap };
|
|
68
|
-
const totalCount = data.data.treeNodeChildren.totalCount;
|
|
69
|
-
const parentElement = newTreeMap[parentMapKey];
|
|
70
|
-
const showMoreKey = '__showMore' + parentMapKey + offset;
|
|
71
|
-
parentElement.children = parentElement.children.filter(child => !child.key.match(`__showMore${parentMapKey}`));
|
|
72
|
-
for (const node of formattedNodes) {
|
|
73
|
-
const nodeForTreeMap = { ...node, paginationOffset: 0 };
|
|
74
|
-
newTreeMap[nodeForTreeMap.key] = nodeForTreeMap;
|
|
75
|
-
parentElement.paginationOffset = offset;
|
|
76
|
-
parentElement.children.push(nodeForTreeMap);
|
|
77
|
-
}
|
|
78
|
-
if (totalCount > parentElement.paginationOffset + defaultPaginationPageSize) {
|
|
79
|
-
const showMoreElement = {
|
|
80
|
-
id: parentMapKey,
|
|
81
|
-
key: showMoreKey,
|
|
82
|
-
record: null,
|
|
83
|
-
title: t('tree-node-selection.show_more'),
|
|
84
|
-
isLeaf: false,
|
|
85
|
-
paginationOffset: 0,
|
|
86
|
-
isShowMore: true,
|
|
87
|
-
selectable: false,
|
|
88
|
-
children: []
|
|
89
|
-
};
|
|
90
|
-
parentElement.children.push(showMoreElement);
|
|
91
|
-
}
|
|
92
|
-
setTreeMap(newTreeMap);
|
|
93
|
-
setFetchError(null);
|
|
94
|
-
}
|
|
95
|
-
catch (err) {
|
|
96
|
-
setFetchError(err.message);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
setSelectedNode(initSelectedNode);
|
|
101
|
-
}, [initSelectedNode]);
|
|
102
|
-
useEffect(() => {
|
|
103
|
-
// Load root
|
|
104
|
-
_fetchTreeContent();
|
|
105
|
-
}, []);
|
|
106
|
-
const _handleLoadData = async (nodeData) => {
|
|
107
|
-
const { id, isShowMore } = nodeData;
|
|
108
|
-
// Handle offset if we get here through the "show more" element
|
|
109
|
-
const currentNodeOffset = treeMap[id]?.paginationOffset ?? 0;
|
|
110
|
-
const paginationOffset = isShowMore
|
|
111
|
-
? (treeMap[id]?.paginationOffset ?? 0) + defaultPaginationPageSize
|
|
112
|
-
: currentNodeOffset;
|
|
113
|
-
if (id === tree.id && !isShowMore) {
|
|
114
|
-
// Root has already been loaded
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
await _fetchTreeContent(String(id), paginationOffset);
|
|
118
|
-
};
|
|
119
|
-
const _handleSelect = (_, e) => {
|
|
120
|
-
const node = treeMap[e.node.key];
|
|
121
|
-
const isRoot = node.id === tree.id;
|
|
122
|
-
if ((!canSelectRoot && isRoot) ||
|
|
123
|
-
(!isRoot &&
|
|
124
|
-
typeof selectableLibraries !== 'undefined' &&
|
|
125
|
-
selectableLibraries.indexOf(node.record.whoAmI.library.id) === -1)) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
if (node) {
|
|
129
|
-
onSelect(node, e.selected);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
const _handleCheck = (selection) => {
|
|
133
|
-
const checkedKeys = typeof selection === 'object' ? selection.checked : selection;
|
|
134
|
-
const nodes = checkedKeys.map(key => treeMap[key]);
|
|
135
|
-
onCheck(nodes);
|
|
136
|
-
};
|
|
137
|
-
if (!called) {
|
|
138
|
-
return _jsx(Spin, {});
|
|
18
|
+
if (loading) {
|
|
19
|
+
return _jsx(Skeleton.Input, {}); //TODO: use DS when export of KitSkeleton is fixed
|
|
139
20
|
}
|
|
140
|
-
if (error
|
|
141
|
-
return _jsx(ErrorDisplay, { message: error
|
|
21
|
+
if (error) {
|
|
22
|
+
return _jsx(ErrorDisplay, { message: error.message });
|
|
142
23
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
24
|
+
if (!data?.trees.list[0]) {
|
|
25
|
+
return _jsx(ErrorDisplay, { message: t('error.unknown_tree', { treeId }) });
|
|
26
|
+
}
|
|
27
|
+
const label = localizedTranslation(data.trees.list[0].label, lang) || treeId;
|
|
28
|
+
return (_jsx(SelectTreeNodeContent, { treeData: { id: treeId, label }, onCheck: onCheck, onSelect: onSelect, multiple: multiple, selectedNode: selectedNode, canSelectRoot: canSelectRoot, selectableLibraries: selectableLibraries }));
|
|
29
|
+
};
|
|
148
30
|
//# 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,
|
|
1
|
+
{"version":3,"file":"SelectTreeNode.js","sourceRoot":"","sources":["../../../src/components/SelectTreeNode/SelectTreeNode.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ED,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC;IAE7E,OAAO,CACH,KAAC,qBAAqB,IAClB,QAAQ,EAAE,EAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAC,EAC7B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,mBAAmB,GAC1C,CACL,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ITreeNodeWithRecord } from '../../types/trees';
|
|
3
|
+
interface ISelectTreeNodeContentProps {
|
|
4
|
+
treeData: {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
selectedNode?: string;
|
|
9
|
+
onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;
|
|
10
|
+
onCheck?: (selection: ITreeNodeWithRecord[]) => void;
|
|
11
|
+
multiple?: boolean;
|
|
12
|
+
canSelectRoot?: boolean;
|
|
13
|
+
selectableLibraries?: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare const SelectTreeNodeContent: FunctionComponent<ISelectTreeNodeContentProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
3
|
+
// This file is released under LGPL V3
|
|
4
|
+
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
|
+
import { Spin } from 'antd';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
import { useSharedTranslation } from '../../hooks/useSharedTranslation';
|
|
8
|
+
import { useTreeNodeChildrenLazyQuery } from '../../_gqlTypes';
|
|
9
|
+
import { defaultPaginationPageSize, ErrorDisplay } from '../..';
|
|
10
|
+
import { KitTree } from 'aristid-ds';
|
|
11
|
+
const _isObjectSelection = (selection) => 'checked' in selection && 'halfChecked' in selection;
|
|
12
|
+
const _constructTreeContent = (data) => data.map(e => ({
|
|
13
|
+
record: e.record,
|
|
14
|
+
title: e.record.whoAmI.label || e.record.whoAmI.id,
|
|
15
|
+
id: e.id,
|
|
16
|
+
key: e.id,
|
|
17
|
+
isLeaf: !e.childrenCount,
|
|
18
|
+
children: []
|
|
19
|
+
}));
|
|
20
|
+
export const SelectTreeNodeContent = ({ treeData: tree, onSelect, onCheck, selectedNode: initSelectedNode, multiple = false, canSelectRoot = false, selectableLibraries }) => {
|
|
21
|
+
const { t } = useSharedTranslation();
|
|
22
|
+
const rootNode = {
|
|
23
|
+
title: tree.label,
|
|
24
|
+
record: null,
|
|
25
|
+
id: tree.id,
|
|
26
|
+
key: tree.id,
|
|
27
|
+
isLeaf: false,
|
|
28
|
+
paginationOffset: 0,
|
|
29
|
+
children: []
|
|
30
|
+
};
|
|
31
|
+
// As we'll fetch children when a node is expanded, we store the whole tree content in a hash map
|
|
32
|
+
// to make update easier and more efficient
|
|
33
|
+
const [treeMap, setTreeMap] = useState({
|
|
34
|
+
[tree.id]: rootNode
|
|
35
|
+
});
|
|
36
|
+
const [selectedNode, setSelectedNode] = useState(initSelectedNode);
|
|
37
|
+
const [fetchError, setFetchError] = useState();
|
|
38
|
+
const [loadTreeContent, { error, called }] = useTreeNodeChildrenLazyQuery();
|
|
39
|
+
const _fetchTreeContent = async (parentNodeKey, offset = 0) => {
|
|
40
|
+
try {
|
|
41
|
+
const data = await loadTreeContent({
|
|
42
|
+
variables: {
|
|
43
|
+
treeId: tree.id,
|
|
44
|
+
node: parentNodeKey && parentNodeKey !== tree.id ? parentNodeKey : null,
|
|
45
|
+
pagination: {
|
|
46
|
+
limit: defaultPaginationPageSize,
|
|
47
|
+
offset
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const formattedNodes = _constructTreeContent(data.data.treeNodeChildren.list);
|
|
52
|
+
const parentMapKey = parentNodeKey ?? tree.id;
|
|
53
|
+
const newTreeMap = { ...treeMap };
|
|
54
|
+
const totalCount = data.data.treeNodeChildren.totalCount;
|
|
55
|
+
const parentElement = newTreeMap[parentMapKey];
|
|
56
|
+
const showMoreKey = '__showMore' + parentMapKey + offset;
|
|
57
|
+
parentElement.children = parentElement.children.filter(child => !child.key.match(`__showMore${parentMapKey}`));
|
|
58
|
+
for (const node of formattedNodes) {
|
|
59
|
+
const nodeForTreeMap = { ...node, paginationOffset: 0 };
|
|
60
|
+
newTreeMap[nodeForTreeMap.key] = nodeForTreeMap;
|
|
61
|
+
parentElement.paginationOffset = offset;
|
|
62
|
+
parentElement.children.push(nodeForTreeMap);
|
|
63
|
+
}
|
|
64
|
+
if (totalCount > parentElement.paginationOffset + defaultPaginationPageSize) {
|
|
65
|
+
const showMoreElement = {
|
|
66
|
+
id: parentMapKey,
|
|
67
|
+
key: showMoreKey,
|
|
68
|
+
record: null,
|
|
69
|
+
title: t('tree-node-selection.show_more'),
|
|
70
|
+
isLeaf: false,
|
|
71
|
+
paginationOffset: 0,
|
|
72
|
+
isShowMore: true,
|
|
73
|
+
selectable: false,
|
|
74
|
+
children: []
|
|
75
|
+
};
|
|
76
|
+
parentElement.children.push(showMoreElement);
|
|
77
|
+
}
|
|
78
|
+
setTreeMap(newTreeMap);
|
|
79
|
+
setFetchError(null);
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
setFetchError(err.message);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
setSelectedNode(initSelectedNode);
|
|
87
|
+
}, [initSelectedNode]);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
// Load root
|
|
90
|
+
_fetchTreeContent();
|
|
91
|
+
}, []);
|
|
92
|
+
const _handleLoadData = async (nodeData) => {
|
|
93
|
+
const { id, isShowMore } = nodeData;
|
|
94
|
+
// Handle offset if we get here through the "show more" element
|
|
95
|
+
const currentNodeOffset = treeMap[id]?.paginationOffset ?? 0;
|
|
96
|
+
const paginationOffset = isShowMore
|
|
97
|
+
? (treeMap[id]?.paginationOffset ?? 0) + defaultPaginationPageSize
|
|
98
|
+
: currentNodeOffset;
|
|
99
|
+
if (id === tree.id && !isShowMore) {
|
|
100
|
+
// Root has already been loaded
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
await _fetchTreeContent(id, paginationOffset);
|
|
104
|
+
};
|
|
105
|
+
const _handleSelect = (_, e) => {
|
|
106
|
+
const node = treeMap[e.node.key];
|
|
107
|
+
const isRoot = node.id === tree.id;
|
|
108
|
+
if ((!canSelectRoot && isRoot) || (!isRoot && selectableLibraries?.includes(node.record.whoAmI.library.id))) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (node) {
|
|
112
|
+
onSelect(node, e.selected);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const _handleCheck = selection => {
|
|
116
|
+
const checkedKeys = _isObjectSelection(selection) ? selection.checked : selection;
|
|
117
|
+
const nodes = checkedKeys.map(key => treeMap[key]);
|
|
118
|
+
onCheck(nodes);
|
|
119
|
+
};
|
|
120
|
+
if (!called) {
|
|
121
|
+
return _jsx(Spin, {});
|
|
122
|
+
}
|
|
123
|
+
if (error || fetchError) {
|
|
124
|
+
return _jsx(ErrorDisplay, { message: error?.message ?? fetchError });
|
|
125
|
+
}
|
|
126
|
+
const treeData = [treeMap[rootNode.key]];
|
|
127
|
+
return (_jsx(KitTree, { defaultExpandedKeys: [tree.id], multiple: multiple, selectable: true, selectedKeys: [selectedNode], onSelect: _handleSelect, onCheck: _handleCheck, treeData: treeData, loadData: _handleLoadData, checkStrictly: true, checkable: multiple, showLine: {
|
|
128
|
+
showLeafIcon: false
|
|
129
|
+
} }));
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=SelectTreeNodeContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectTreeNodeContent.js","sourceRoot":"","sources":["../../../src/components/SelectTreeNode/SelectTreeNodeContent.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAE1B,OAAO,EAAyC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClF,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAwB,4BAA4B,EAAC,MAAM,eAAe,CAAC;AAClF,OAAO,EAAC,yBAAyB,EAAE,YAAY,EAAC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAanC,MAAM,kBAAkB,GAAG,CAAC,SAA4B,EAAkD,EAAE,CACxG,SAAS,IAAI,SAAS,IAAI,aAAa,IAAI,SAAS,CAAC;AAEzD,MAAM,qBAAqB,GAAG,CAAC,IAA6B,EAAyB,EAAE,CACnF,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACX,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;IAClD,EAAE,EAAE,CAAC,CAAC,EAAE;IACR,GAAG,EAAE,CAAC,CAAC,EAAE;IACT,MAAM,EAAE,CAAC,CAAC,CAAC,aAAa;IACxB,QAAQ,EAAE,EAAE;CACf,CAAC,CAAC,CAAC;AAcR,MAAM,CAAC,MAAM,qBAAqB,GAAmD,CAAC,EAClF,QAAQ,EAAE,IAAI,EACd,QAAQ,EACR,OAAO,EACP,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,GAAG,K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AAQ,EACnB,QAAQ,EAAE;YACN,YAAY,EAAE,KAAK;SACtB,GACH,CACL,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { SelectTreeNode } from './SelectTreeNode';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
2
2
|
// This file is released under LGPL V3
|
|
3
3
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
4
|
-
export {
|
|
4
|
+
export { SelectTreeNode } from './SelectTreeNode';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SelectTreeNode/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SelectTreeNode/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC"}
|