@astral/ui 4.113.3 → 4.115.0
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/components/ActionGroup/ActionGroup.js +2 -2
- package/components/ActionGroup/SecondaryActions/SecondaryActions.d.ts +1 -1
- package/components/ActionGroup/SecondaryActions/SecondaryActions.js +2 -2
- package/components/ActionGroup/types.d.ts +9 -0
- package/components/DataGrid/Body/Body.d.ts +1 -1
- package/components/DataGrid/Body/Body.js +7 -3
- package/components/DataGrid/Body/types.d.ts +11 -3
- package/components/DataGrid/DataGrid.js +13 -6
- package/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.d.ts +3 -2
- package/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.js +3 -2
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionContext.d.ts +25 -0
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionContext.js +13 -0
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/DataGridSelectionProvider.d.ts +7 -0
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/DataGridSelectionProvider.js +8 -0
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/index.d.ts +1 -0
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/index.js +1 -0
- package/components/DataGrid/DataGridSelectionContext/index.d.ts +2 -0
- package/components/DataGrid/DataGridSelectionContext/index.js +2 -0
- package/components/DataGrid/PinnedSections/PinnedSections.js +2 -2
- package/components/DataGrid/PinnedSections/useLogic/useLogic.d.ts +1 -0
- package/components/DataGrid/PinnedSections/useLogic/useLogic.js +4 -3
- package/components/DataGrid/Row/Row.js +13 -9
- package/components/DataGrid/Row/RowContext/RowContext.d.ts +15 -4
- package/components/DataGrid/Row/RowContext/RowContext.js +3 -3
- package/components/DataGrid/Row/RowContext/RowProvider/RowProvider.d.ts +10 -1
- package/components/DataGrid/Row/RowContext/RowProvider/RowProvider.js +23 -17
- package/components/DataGrid/Row/types.d.ts +7 -3
- package/components/DataGrid/Row/useLogic/useLogic.d.ts +6 -4
- package/components/DataGrid/Row/useLogic/useLogic.js +21 -12
- package/components/DataGrid/RowBase/RowBase.js +5 -2
- package/components/DataGrid/RowBase/types.d.ts +9 -5
- package/components/DataGrid/RowBase/useLogic/useLogic.d.ts +5 -4
- package/components/DataGrid/RowBase/useLogic/useLogic.js +16 -10
- package/components/DataGrid/RowCheckbox/RowCheckbox.d.ts +5 -0
- package/components/DataGrid/RowCheckbox/RowCheckbox.js +13 -0
- package/components/DataGrid/RowCheckbox/constants.d.ts +4 -0
- package/components/DataGrid/RowCheckbox/constants.js +4 -0
- package/components/DataGrid/RowCheckbox/index.d.ts +1 -0
- package/components/DataGrid/RowCheckbox/index.js +1 -0
- package/components/DataGrid/RowCheckbox/types.d.ts +7 -0
- package/components/DataGrid/RowCheckbox/types.js +1 -0
- package/components/DataGrid/constants.d.ts +2 -0
- package/components/DataGrid/constants.js +2 -0
- package/components/DataGrid/hooks/index.d.ts +1 -0
- package/components/DataGrid/hooks/index.js +1 -0
- package/components/DataGrid/hooks/useWarnRowsWithoutDisabledReason/index.d.ts +1 -0
- package/components/DataGrid/hooks/useWarnRowsWithoutDisabledReason/index.js +1 -0
- package/components/DataGrid/hooks/useWarnRowsWithoutDisabledReason/useWarnRowsWithoutDisabledReason.d.ts +5 -0
- package/components/DataGrid/hooks/useWarnRowsWithoutDisabledReason/useWarnRowsWithoutDisabledReason.js +17 -0
- package/components/DataGrid/index.d.ts +1 -1
- package/components/DataGrid/public.d.ts +1 -1
- package/components/DataGrid/styles.d.ts +4 -0
- package/components/DataGrid/styles.js +26 -0
- package/components/DataGrid/tests/performance/testDataGridPerformance.d.ts +3 -1
- package/components/DataGrid/tests/performance/testDataGridPerformance.js +234 -2
- package/components/DataGrid/tests/selection/testDataGridSelection.d.ts +14 -0
- package/components/DataGrid/tests/selection/testDataGridSelection.js +562 -0
- package/components/DataGrid/types.d.ts +41 -1
- package/components/DataGrid/useLogic/useLogic.d.ts +8 -3
- package/components/DataGrid/useLogic/useLogic.js +23 -10
- package/components/DataGrid/utils/checkIsMassActionsOpen/checkIsMassActionsOpen.d.ts +10 -0
- package/components/DataGrid/utils/checkIsMassActionsOpen/checkIsMassActionsOpen.js +4 -0
- package/components/DataGrid/utils/checkIsMassActionsOpen/index.d.ts +1 -0
- package/components/DataGrid/utils/checkIsMassActionsOpen/index.js +1 -0
- package/components/DataGrid/utils/getRowDisabledState/getRowDisabledState.d.ts +31 -0
- package/components/DataGrid/utils/getRowDisabledState/getRowDisabledState.js +20 -0
- package/components/DataGrid/utils/getRowDisabledState/index.d.ts +1 -0
- package/components/DataGrid/utils/getRowDisabledState/index.js +1 -0
- package/components/DataGrid/utils/index.d.ts +4 -0
- package/components/DataGrid/utils/index.js +4 -0
- package/components/DataGrid/utils/resolveRowDisabled/index.d.ts +1 -0
- package/components/DataGrid/utils/resolveRowDisabled/index.js +1 -0
- package/components/DataGrid/utils/resolveRowDisabled/resolveRowDisabled.d.ts +5 -0
- package/components/DataGrid/utils/resolveRowDisabled/resolveRowDisabled.js +17 -0
- package/components/DataGrid/utils/resolveRowsDisabled/index.d.ts +1 -0
- package/components/DataGrid/utils/resolveRowsDisabled/index.js +1 -0
- package/components/DataGrid/utils/resolveRowsDisabled/resolveRowsDisabled.d.ts +16 -0
- package/components/DataGrid/utils/resolveRowsDisabled/resolveRowsDisabled.js +17 -0
- package/components/DataGridActionCell/hooks/useBlockingActions/useBlockingActions.js +3 -3
- package/components/DataGridCollapsibleRow/useLogic/useLogic.d.ts +3 -2
- package/components/DataGridCollapsibleRow/useLogic/useLogic.js +4 -3
- package/components/DataGridInfinite/DataGridInfinite.js +18 -14
- package/components/DataGridInfinite/DataGridInfiniteContext/DataGridInfiniteContext.d.ts +1 -1
- package/components/DataGridInfinite/DataGridInfiniteContext/DataGridInfiniteContext.js +1 -1
- package/components/DataGridInfinite/Footer/Footer.d.ts +6 -0
- package/components/DataGridInfinite/Footer/Footer.js +25 -0
- package/components/DataGridInfinite/Footer/index.d.ts +2 -0
- package/components/DataGridInfinite/Footer/index.js +1 -0
- package/components/DataGridInfinite/Footer/types.d.ts +26 -0
- package/components/DataGridInfinite/Footer/types.js +1 -0
- package/components/DataGridInfinite/Row/Row.js +2 -2
- package/components/DataGridInfinite/Row/index.d.ts +1 -0
- package/components/DataGridInfinite/Row/types.d.ts +17 -2
- package/components/DataGridInfinite/Row/useLogic/useLogic.d.ts +4 -2
- package/components/DataGridInfinite/Row/useLogic/useLogic.js +12 -4
- package/components/DataGridInfinite/constants.d.ts +3 -0
- package/components/DataGridInfinite/constants.js +3 -0
- package/components/DataGridInfinite/faker.d.ts +1 -5
- package/components/DataGridInfinite/faker.js +1 -2
- package/components/DataGridInfinite/styles.d.ts +4 -0
- package/components/DataGridInfinite/styles.js +24 -0
- package/components/DataGridInfinite/useLogic/useLogic.d.ts +7 -3
- package/components/DataGridInfinite/useLogic/useLogic.js +52 -16
- package/components/DataGridMassActions/DataGridMassActions.d.ts +15 -0
- package/components/DataGridMassActions/DataGridMassActions.js +32 -0
- package/components/DataGridMassActions/constants.d.ts +4 -0
- package/components/DataGridMassActions/constants.js +5 -0
- package/components/DataGridMassActions/index.d.ts +2 -0
- package/components/DataGridMassActions/index.js +1 -0
- package/components/DataGridMassActions/public.d.ts +2 -0
- package/components/DataGridMassActions/public.js +1 -0
- package/components/DataGridMassActions/styles.d.ts +8 -0
- package/components/DataGridMassActions/styles.js +49 -0
- package/components/DataGridMassActions/tests/testDataGridMassActions.d.ts +23 -0
- package/components/DataGridMassActions/tests/testDataGridMassActions.js +77 -0
- package/components/DataGridMassActions/types.d.ts +2 -0
- package/components/DataGridMassActions/types.js +1 -0
- package/components/DataGridMassActions/useLogic/index.d.ts +1 -0
- package/components/DataGridMassActions/useLogic/index.js +1 -0
- package/components/DataGridMassActions/useLogic/useLogic.d.ts +6 -0
- package/components/DataGridMassActions/useLogic/useLogic.js +21 -0
- package/components/IconDropdownButton/IconDropdownButton.d.ts +5 -0
- package/components/IconDropdownButton/IconDropdownButton.js +2 -2
- package/components/MassActions/MassActions.d.ts +5 -0
- package/components/MassActions/MassActions.js +17 -0
- package/components/MassActions/constants.d.ts +6 -0
- package/components/MassActions/constants.js +12 -0
- package/components/MassActions/index.d.ts +2 -0
- package/components/MassActions/index.js +1 -0
- package/components/MassActions/styles.d.ts +34 -0
- package/components/MassActions/styles.js +43 -0
- package/components/MassActions/types.d.ts +20 -0
- package/components/MassActions/types.js +1 -0
- package/components/MassActions/useLogic/index.d.ts +1 -0
- package/components/MassActions/useLogic/index.js +1 -0
- package/components/MassActions/useLogic/useLogic.d.ts +7 -0
- package/components/MassActions/useLogic/useLogic.js +9 -0
- package/components/PageHeader/PageActions/SecondaryActions/styles.d.ts +1 -1
- package/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/index.d.ts +0 -1
- package/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/index.js +0 -1
- package/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/useLogic.js +2 -1
- package/components/index.d.ts +1 -1
- package/node/components/ActionGroup/ActionGroup.js +2 -2
- package/node/components/ActionGroup/SecondaryActions/SecondaryActions.d.ts +1 -1
- package/node/components/ActionGroup/SecondaryActions/SecondaryActions.js +2 -2
- package/node/components/ActionGroup/types.d.ts +9 -0
- package/node/components/DataGrid/Body/Body.d.ts +1 -1
- package/node/components/DataGrid/Body/Body.js +7 -3
- package/node/components/DataGrid/Body/types.d.ts +11 -3
- package/node/components/DataGrid/DataGrid.js +12 -5
- package/node/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.d.ts +3 -2
- package/node/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.js +3 -2
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionContext.d.ts +25 -0
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionContext.js +16 -0
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/DataGridSelectionProvider.d.ts +7 -0
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/DataGridSelectionProvider.js +12 -0
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/index.d.ts +1 -0
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/index.js +17 -0
- package/node/components/DataGrid/DataGridSelectionContext/index.d.ts +2 -0
- package/node/components/DataGrid/DataGridSelectionContext/index.js +18 -0
- package/node/components/DataGrid/PinnedSections/PinnedSections.js +2 -2
- package/node/components/DataGrid/PinnedSections/useLogic/useLogic.d.ts +1 -0
- package/node/components/DataGrid/PinnedSections/useLogic/useLogic.js +4 -3
- package/node/components/DataGrid/Row/Row.js +13 -9
- package/node/components/DataGrid/Row/RowContext/RowContext.d.ts +15 -4
- package/node/components/DataGrid/Row/RowContext/RowContext.js +3 -3
- package/node/components/DataGrid/Row/RowContext/RowProvider/RowProvider.d.ts +10 -1
- package/node/components/DataGrid/Row/RowContext/RowProvider/RowProvider.js +23 -17
- package/node/components/DataGrid/Row/types.d.ts +7 -3
- package/node/components/DataGrid/Row/useLogic/useLogic.d.ts +6 -4
- package/node/components/DataGrid/Row/useLogic/useLogic.js +23 -14
- package/node/components/DataGrid/RowBase/RowBase.js +5 -2
- package/node/components/DataGrid/RowBase/types.d.ts +9 -5
- package/node/components/DataGrid/RowBase/useLogic/useLogic.d.ts +5 -4
- package/node/components/DataGrid/RowBase/useLogic/useLogic.js +16 -10
- package/node/components/DataGrid/RowCheckbox/RowCheckbox.d.ts +5 -0
- package/node/components/DataGrid/RowCheckbox/RowCheckbox.js +17 -0
- package/node/components/DataGrid/RowCheckbox/constants.d.ts +4 -0
- package/node/components/DataGrid/RowCheckbox/constants.js +7 -0
- package/node/components/DataGrid/RowCheckbox/index.d.ts +1 -0
- package/node/components/DataGrid/RowCheckbox/index.js +17 -0
- package/node/components/DataGrid/RowCheckbox/types.d.ts +7 -0
- package/node/components/DataGrid/RowCheckbox/types.js +2 -0
- package/node/components/DataGrid/constants.d.ts +2 -0
- package/node/components/DataGrid/constants.js +2 -0
- package/node/components/DataGrid/hooks/index.d.ts +1 -0
- package/node/components/DataGrid/hooks/index.js +1 -0
- package/node/components/DataGrid/hooks/useWarnRowsWithoutDisabledReason/index.d.ts +1 -0
- package/node/components/DataGrid/hooks/useWarnRowsWithoutDisabledReason/index.js +17 -0
- package/node/components/DataGrid/hooks/useWarnRowsWithoutDisabledReason/useWarnRowsWithoutDisabledReason.d.ts +5 -0
- package/node/components/DataGrid/hooks/useWarnRowsWithoutDisabledReason/useWarnRowsWithoutDisabledReason.js +21 -0
- package/node/components/DataGrid/index.d.ts +1 -1
- package/node/components/DataGrid/public.d.ts +1 -1
- package/node/components/DataGrid/styles.d.ts +4 -0
- package/node/components/DataGrid/styles.js +27 -1
- package/node/components/DataGrid/tests/performance/testDataGridPerformance.d.ts +3 -1
- package/node/components/DataGrid/tests/performance/testDataGridPerformance.js +232 -0
- package/node/components/DataGrid/tests/selection/testDataGridSelection.d.ts +14 -0
- package/node/components/DataGrid/tests/selection/testDataGridSelection.js +566 -0
- package/node/components/DataGrid/types.d.ts +41 -1
- package/node/components/DataGrid/useLogic/useLogic.d.ts +8 -3
- package/node/components/DataGrid/useLogic/useLogic.js +25 -12
- package/node/components/DataGrid/utils/checkIsMassActionsOpen/checkIsMassActionsOpen.d.ts +10 -0
- package/node/components/DataGrid/utils/checkIsMassActionsOpen/checkIsMassActionsOpen.js +8 -0
- package/node/components/DataGrid/utils/checkIsMassActionsOpen/index.d.ts +1 -0
- package/node/components/DataGrid/utils/checkIsMassActionsOpen/index.js +5 -0
- package/node/components/DataGrid/utils/getRowDisabledState/getRowDisabledState.d.ts +31 -0
- package/node/components/DataGrid/utils/getRowDisabledState/getRowDisabledState.js +24 -0
- package/node/components/DataGrid/utils/getRowDisabledState/index.d.ts +1 -0
- package/node/components/DataGrid/utils/getRowDisabledState/index.js +5 -0
- package/node/components/DataGrid/utils/index.d.ts +4 -0
- package/node/components/DataGrid/utils/index.js +9 -1
- package/node/components/DataGrid/utils/resolveRowDisabled/index.d.ts +1 -0
- package/node/components/DataGrid/utils/resolveRowDisabled/index.js +5 -0
- package/node/components/DataGrid/utils/resolveRowDisabled/resolveRowDisabled.d.ts +5 -0
- package/node/components/DataGrid/utils/resolveRowDisabled/resolveRowDisabled.js +21 -0
- package/node/components/DataGrid/utils/resolveRowsDisabled/index.d.ts +1 -0
- package/node/components/DataGrid/utils/resolveRowsDisabled/index.js +5 -0
- package/node/components/DataGrid/utils/resolveRowsDisabled/resolveRowsDisabled.d.ts +16 -0
- package/node/components/DataGrid/utils/resolveRowsDisabled/resolveRowsDisabled.js +21 -0
- package/node/components/DataGridActionCell/hooks/useBlockingActions/useBlockingActions.js +3 -3
- package/node/components/DataGridCollapsibleRow/useLogic/useLogic.d.ts +3 -2
- package/node/components/DataGridCollapsibleRow/useLogic/useLogic.js +4 -3
- package/node/components/DataGridInfinite/DataGridInfinite.js +19 -15
- package/node/components/DataGridInfinite/DataGridInfiniteContext/DataGridInfiniteContext.d.ts +1 -1
- package/node/components/DataGridInfinite/DataGridInfiniteContext/DataGridInfiniteContext.js +1 -1
- package/node/components/DataGridInfinite/Footer/Footer.d.ts +6 -0
- package/node/components/DataGridInfinite/Footer/Footer.js +29 -0
- package/node/components/DataGridInfinite/Footer/index.d.ts +2 -0
- package/node/components/DataGridInfinite/Footer/index.js +17 -0
- package/node/components/DataGridInfinite/Footer/types.d.ts +26 -0
- package/node/components/DataGridInfinite/Footer/types.js +2 -0
- package/node/components/DataGridInfinite/Row/Row.js +2 -2
- package/node/components/DataGridInfinite/Row/index.d.ts +1 -0
- package/node/components/DataGridInfinite/Row/types.d.ts +17 -2
- package/node/components/DataGridInfinite/Row/useLogic/useLogic.d.ts +4 -2
- package/node/components/DataGridInfinite/Row/useLogic/useLogic.js +12 -4
- package/node/components/DataGridInfinite/constants.d.ts +3 -0
- package/node/components/DataGridInfinite/constants.js +3 -0
- package/node/components/DataGridInfinite/faker.d.ts +1 -5
- package/node/components/DataGridInfinite/faker.js +1 -2
- package/node/components/DataGridInfinite/styles.d.ts +4 -0
- package/node/components/DataGridInfinite/styles.js +27 -3
- package/node/components/DataGridInfinite/useLogic/useLogic.d.ts +7 -3
- package/node/components/DataGridInfinite/useLogic/useLogic.js +52 -16
- package/node/components/DataGridMassActions/DataGridMassActions.d.ts +15 -0
- package/node/components/DataGridMassActions/DataGridMassActions.js +36 -0
- package/node/components/DataGridMassActions/constants.d.ts +4 -0
- package/node/components/DataGridMassActions/constants.js +8 -0
- package/node/components/DataGridMassActions/index.d.ts +2 -0
- package/node/components/DataGridMassActions/index.js +5 -0
- package/node/components/DataGridMassActions/public.d.ts +2 -0
- package/node/components/DataGridMassActions/public.js +5 -0
- package/node/components/DataGridMassActions/styles.d.ts +8 -0
- package/node/components/DataGridMassActions/styles.js +52 -0
- package/node/components/DataGridMassActions/tests/testDataGridMassActions.d.ts +23 -0
- package/node/components/DataGridMassActions/tests/testDataGridMassActions.js +81 -0
- package/node/components/DataGridMassActions/types.d.ts +2 -0
- package/node/components/DataGridMassActions/types.js +2 -0
- package/node/components/DataGridMassActions/useLogic/index.d.ts +1 -0
- package/node/components/DataGridMassActions/useLogic/index.js +17 -0
- package/node/components/DataGridMassActions/useLogic/useLogic.d.ts +6 -0
- package/node/components/DataGridMassActions/useLogic/useLogic.js +25 -0
- package/node/components/IconDropdownButton/IconDropdownButton.d.ts +5 -0
- package/node/components/IconDropdownButton/IconDropdownButton.js +2 -2
- package/node/components/MassActions/MassActions.d.ts +5 -0
- package/node/components/MassActions/MassActions.js +21 -0
- package/node/components/MassActions/constants.d.ts +6 -0
- package/node/components/MassActions/constants.js +15 -0
- package/node/components/MassActions/index.d.ts +2 -0
- package/node/components/MassActions/index.js +5 -0
- package/node/components/MassActions/styles.d.ts +34 -0
- package/node/components/MassActions/styles.js +46 -0
- package/node/components/MassActions/types.d.ts +20 -0
- package/node/components/MassActions/types.js +2 -0
- package/node/components/MassActions/useLogic/index.d.ts +1 -0
- package/node/components/MassActions/useLogic/index.js +17 -0
- package/node/components/MassActions/useLogic/useLogic.d.ts +7 -0
- package/node/components/MassActions/useLogic/useLogic.js +13 -0
- package/node/components/PageHeader/PageActions/SecondaryActions/styles.d.ts +1 -1
- package/node/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/index.d.ts +0 -1
- package/node/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/index.js +0 -1
- package/node/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/useLogic.js +2 -1
- package/node/components/index.d.ts +1 -1
- package/package.json +1 -1
- /package/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/index.d.ts +0 -0
- /package/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/index.js +0 -0
- /package/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/useDelayedUnmount.d.ts +0 -0
- /package/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/useDelayedUnmount.js +0 -0
- /package/node/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/index.d.ts +0 -0
- /package/node/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/index.js +0 -0
- /package/node/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/useDelayedUnmount.d.ts +0 -0
- /package/node/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/useDelayedUnmount.js +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useCallback, useContext, useEffect, useMemo, useRef, } from 'react';
|
|
2
2
|
import { ConfigContext } from '../../ConfigProvider';
|
|
3
3
|
import { useFirstMountState } from '../../useFirstMountState';
|
|
4
|
-
import { prop } from '../../utils/prop';
|
|
5
4
|
import { uniqueBy } from '../../utils/uniqueBy';
|
|
6
5
|
import { dataGridClassnames, EXPANDED_LEVEL_BY_DEFAULT, INITIAL_OPENED_NESTED_CHILDREN_COUNT_ON_MOBILE_BY_DEFAULT, } from '../constants';
|
|
7
6
|
import { Variant } from '../enums';
|
|
8
|
-
import {
|
|
7
|
+
import { useWarnRowsWithoutDisabledReason } from '../hooks';
|
|
8
|
+
import { checkIsMassActionsOpen, getDataGridCssVars, getFlattenColumns, getGridTemplateColumns, isGroupColumns, resolveRowsDisabled, } from '../utils';
|
|
9
9
|
import { useDataGridMobileLogic, usePinnedColumns } from './hooks';
|
|
10
10
|
import { getIsAllowHorizontalScroll } from './utils';
|
|
11
|
-
export const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedRows = [], isLoading, isDisabled, mobileDisplayVariant = variant === 'subrows' ? 'cards' : 'list', onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData = false, sorting, className, onSort, maxHeight, gridViewMode: gridViewModeProp = 'standard', }) => {
|
|
11
|
+
export const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedRows = [], isLoading, isDisabled, getRowDisabled, mobileDisplayVariant = variant === 'subrows' ? 'cards' : 'list', onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData = false, sorting, className, onSort, maxHeight, gridViewMode: gridViewModeProp = 'standard', massActions, }) => {
|
|
12
12
|
const isFirstRender = useFirstMountState();
|
|
13
13
|
const isSelectable = Boolean(onSelectRow);
|
|
14
14
|
const isDataGridDisabled = isLoading || isDisabled;
|
|
@@ -57,22 +57,24 @@ export const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, se
|
|
|
57
57
|
}
|
|
58
58
|
return config;
|
|
59
59
|
}, [variant, subrows, tree, isMobile]);
|
|
60
|
-
|
|
60
|
+
// Блокировки строк: getRowDisabled вызывается один раз на строку
|
|
61
|
+
const { rowsDisabled, idsWithoutReason } = useMemo(() => resolveRowsDisabled(renderRows, keyId, getRowDisabled), [renderRows, keyId, getRowDisabled]);
|
|
62
|
+
useWarnRowsWithoutDisabledReason(idsWithoutReason);
|
|
63
|
+
const selectedIds = useMemo(() => new Set(selectedRows.map((row) => row[keyId])), [selectedRows, keyId]);
|
|
64
|
+
const availableRows = useMemo(() => renderRows.filter((row) => !row.options?.isNotSelectable && !rowsDisabled.get(row[keyId])), [renderRows, rowsDisabled, keyId]);
|
|
61
65
|
const gridColumns = useMemo(() => getGridTemplateColumns(getFlattenColumns(columns)), [columns]);
|
|
62
66
|
const isAllowHorizontalScroll = getIsAllowHorizontalScroll(getFlattenColumns(columns));
|
|
63
|
-
const uncheckedRowsCount = useMemo(() =>
|
|
64
|
-
return availableRows.filter((row) => !selectedRows.find((selectedRow) => selectedRow[keyId] === row[keyId])).length;
|
|
65
|
-
}, [availableRows, selectedRows, keyId]);
|
|
67
|
+
const uncheckedRowsCount = useMemo(() => availableRows.filter((row) => !selectedIds.has(row[keyId])).length, [availableRows, selectedIds, keyId]);
|
|
66
68
|
const handleSelectAllRows = (event) => {
|
|
67
69
|
if (!onSelectRow) {
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
72
|
if (event.target.checked) {
|
|
71
|
-
const mergedSelectedRows = uniqueBy([...
|
|
73
|
+
const mergedSelectedRows = uniqueBy([...selectedRowsRef.current, ...availableRows], (row) => row[keyId]);
|
|
72
74
|
return onSelectRow(mergedSelectedRows);
|
|
73
75
|
}
|
|
74
|
-
const
|
|
75
|
-
onSelectRow(
|
|
76
|
+
const renderRowsIds = new Set(renderRows.map((row) => row[keyId]));
|
|
77
|
+
onSelectRow(selectedRowsRef.current.filter((selectedRow) => !renderRowsIds.has(selectedRow[keyId])));
|
|
76
78
|
};
|
|
77
79
|
const handleSelectRow = useCallback((row) => (event) => {
|
|
78
80
|
if (!onSelectRow) {
|
|
@@ -102,7 +104,15 @@ export const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, se
|
|
|
102
104
|
};
|
|
103
105
|
}, [isLoading, isError, isNoData, errorMsg, onRetry, imagesMap]);
|
|
104
106
|
const containerCssVars = getDataGridCssVars(maxHeight);
|
|
107
|
+
const hasMassActions = Boolean(massActions);
|
|
108
|
+
const isMassActionsOpen = checkIsMassActionsOpen({
|
|
109
|
+
hasMassActions,
|
|
110
|
+
selectedRowsCount: selectedRows.length,
|
|
111
|
+
isMobile,
|
|
112
|
+
});
|
|
105
113
|
return {
|
|
114
|
+
hasMassActions,
|
|
115
|
+
isMassActionsOpen,
|
|
106
116
|
dataGridClassName: className,
|
|
107
117
|
containerCssVars,
|
|
108
118
|
isDataGridDisabled,
|
|
@@ -133,6 +143,9 @@ export const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, se
|
|
|
133
143
|
},
|
|
134
144
|
bodyProps: {
|
|
135
145
|
isSelectable,
|
|
146
|
+
selectedIds,
|
|
147
|
+
rowsDisabled,
|
|
148
|
+
getRowDisabled,
|
|
136
149
|
onSelectRow: handleSelectRow,
|
|
137
150
|
},
|
|
138
151
|
mobileDisplayVariant,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type CheckIsMassActionsOpenParams = {
|
|
2
|
+
hasMassActions: boolean;
|
|
3
|
+
selectedRowsCount: number;
|
|
4
|
+
isMobile: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Панель массовых действий открыта, если она передана, выбрана хотя бы одна строка и это не мобильное разрешение
|
|
8
|
+
*/
|
|
9
|
+
export declare const checkIsMassActionsOpen: ({ hasMassActions, selectedRowsCount, isMobile, }: CheckIsMassActionsOpenParams) => boolean;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { checkIsMassActionsOpen } from './checkIsMassActionsOpen';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { checkIsMassActionsOpen } from './checkIsMassActionsOpen';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DataGridRowDisabled } from '../../types';
|
|
2
|
+
type GetRowDisabledStateParams = {
|
|
3
|
+
/**
|
|
4
|
+
* Итоговая блокировка строки, рассчитанная resolveRowDisabled
|
|
5
|
+
*/
|
|
6
|
+
rowDisabled?: DataGridRowDisabled;
|
|
7
|
+
/**
|
|
8
|
+
* Если true, в строке выполняется блокирующее действие DataGridActionCell
|
|
9
|
+
*/
|
|
10
|
+
hasBlockingAction?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Причина блокировки от блокирующего действия
|
|
13
|
+
*/
|
|
14
|
+
blockingActionReason?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Значение options.isDisabledLastCell. Влияет только на блокировку от DataGridActionCell:
|
|
17
|
+
* options.isDisabled уже преобразован в mode в resolveRowDisabled
|
|
18
|
+
*/
|
|
19
|
+
isDisabledLastCellOption?: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Вычисляет доступность строки и её checkbox по режиму блокировки и блокирующему действию
|
|
23
|
+
*/
|
|
24
|
+
export declare const getRowDisabledState: ({ rowDisabled, hasBlockingAction, blockingActionReason, isDisabledLastCellOption, }: GetRowDisabledStateParams) => {
|
|
25
|
+
isDisabled: boolean;
|
|
26
|
+
isDisabledLastCell: boolean;
|
|
27
|
+
disabledReason: string | undefined;
|
|
28
|
+
isCheckboxDisabled: boolean;
|
|
29
|
+
checkboxDisabledReason: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Вычисляет доступность строки и её checkbox по режиму блокировки и блокирующему действию
|
|
3
|
+
*/
|
|
4
|
+
export const getRowDisabledState = ({ rowDisabled, hasBlockingAction = false, blockingActionReason, isDisabledLastCellOption = true, }) => {
|
|
5
|
+
const mode = rowDisabled?.mode;
|
|
6
|
+
const isSelectionDisabled = mode === 'selection';
|
|
7
|
+
const isDisabled = hasBlockingAction || mode === 'row' || mode === 'row-except-last-cell';
|
|
8
|
+
const disabledReason = rowDisabled?.reason || blockingActionReason;
|
|
9
|
+
return {
|
|
10
|
+
isDisabled,
|
|
11
|
+
// Без режима сохраняется прежнее поведение: isDisabledLastCell действует и при блокирующем действии
|
|
12
|
+
isDisabledLastCell: mode
|
|
13
|
+
? mode !== 'row-except-last-cell'
|
|
14
|
+
: isDisabledLastCellOption,
|
|
15
|
+
disabledReason,
|
|
16
|
+
isCheckboxDisabled: isDisabled || isSelectionDisabled,
|
|
17
|
+
// У полностью заблокированной строки причину показывает tooltip строки
|
|
18
|
+
checkboxDisabledReason: isSelectionDisabled ? disabledReason : undefined,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getRowDisabledState } from './getRowDisabledState';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getRowDisabledState } from './getRowDisabledState';
|
|
@@ -2,3 +2,7 @@ export { getDataGridCssVars } from './getDataGridCssVars';
|
|
|
2
2
|
export { getGridTemplateColumns } from './getGridTemplateColumns';
|
|
3
3
|
export { isGroupColumns } from './isGroupColumns';
|
|
4
4
|
export { getFlattenColumns } from './getFlattenColumns';
|
|
5
|
+
export { checkIsMassActionsOpen } from './checkIsMassActionsOpen';
|
|
6
|
+
export { getRowDisabledState } from './getRowDisabledState';
|
|
7
|
+
export { resolveRowDisabled } from './resolveRowDisabled';
|
|
8
|
+
export { resolveRowsDisabled } from './resolveRowsDisabled';
|
|
@@ -2,3 +2,7 @@ export { getDataGridCssVars } from './getDataGridCssVars';
|
|
|
2
2
|
export { getGridTemplateColumns } from './getGridTemplateColumns';
|
|
3
3
|
export { isGroupColumns } from './isGroupColumns';
|
|
4
4
|
export { getFlattenColumns } from './getFlattenColumns';
|
|
5
|
+
export { checkIsMassActionsOpen } from './checkIsMassActionsOpen';
|
|
6
|
+
export { getRowDisabledState } from './getRowDisabledState';
|
|
7
|
+
export { resolveRowDisabled } from './resolveRowDisabled';
|
|
8
|
+
export { resolveRowsDisabled } from './resolveRowsDisabled';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveRowDisabled } from './resolveRowDisabled';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveRowDisabled } from './resolveRowDisabled';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DataGridProps, DataGridRowDisabled, DataGridRowWithOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Возвращает блокировку строки: результат getRowDisabled, а если его нет — блокировку из deprecated-полей options (isDisabled, isDisabledLastCell, disabledReason)
|
|
4
|
+
*/
|
|
5
|
+
export declare const resolveRowDisabled: <TData extends Record<string, unknown>>(row: DataGridRowWithOptions<TData>, getRowDisabled?: ((row: TData) => DataGridRowDisabled | undefined) | undefined) => DataGridRowDisabled | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Возвращает блокировку строки: результат getRowDisabled, а если его нет — блокировку из deprecated-полей options (isDisabled, isDisabledLastCell, disabledReason)
|
|
3
|
+
*/
|
|
4
|
+
export const resolveRowDisabled = (row, getRowDisabled) => {
|
|
5
|
+
const rowDisabled = getRowDisabled?.(row);
|
|
6
|
+
if (rowDisabled) {
|
|
7
|
+
return rowDisabled;
|
|
8
|
+
}
|
|
9
|
+
const { isDisabled, isDisabledLastCell = true, disabledReason = '', } = row.options ?? {};
|
|
10
|
+
if (!isDisabled) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
mode: isDisabledLastCell ? 'row' : 'row-except-last-cell',
|
|
15
|
+
reason: disabledReason,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveRowsDisabled } from './resolveRowsDisabled';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveRowsDisabled } from './resolveRowsDisabled';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DataGridProps, DataGridRowDisabled, DataGridRowWithOptions } from '../../types';
|
|
2
|
+
type ResolveRowsDisabledResult = {
|
|
3
|
+
/**
|
|
4
|
+
* Блокировки строк по row[keyId]
|
|
5
|
+
*/
|
|
6
|
+
rowsDisabled: Map<unknown, DataGridRowDisabled | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* Идентификаторы строк, для которых getRowDisabled вернул блокировку без причины
|
|
9
|
+
*/
|
|
10
|
+
idsWithoutReason: unknown[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Вычисляет блокировки строк
|
|
14
|
+
*/
|
|
15
|
+
export declare const resolveRowsDisabled: <TData extends Record<string, unknown>>(rows: DataGridRowWithOptions<TData>[], keyId: keyof TData, getRowDisabled?: ((row: TData) => DataGridRowDisabled | undefined) | undefined) => ResolveRowsDisabledResult;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { resolveRowDisabled } from '../resolveRowDisabled';
|
|
2
|
+
/**
|
|
3
|
+
* Вычисляет блокировки строк
|
|
4
|
+
*/
|
|
5
|
+
export const resolveRowsDisabled = (rows, keyId, getRowDisabled) => {
|
|
6
|
+
const rowsDisabled = new Map();
|
|
7
|
+
const idsWithoutReason = [];
|
|
8
|
+
rows.forEach((row) => {
|
|
9
|
+
const rowId = row[keyId];
|
|
10
|
+
const rowDisabled = getRowDisabled?.(row);
|
|
11
|
+
if (rowDisabled && !rowDisabled.reason) {
|
|
12
|
+
idsWithoutReason.push(rowId);
|
|
13
|
+
}
|
|
14
|
+
rowsDisabled.set(rowId, rowDisabled ?? resolveRowDisabled(row));
|
|
15
|
+
});
|
|
16
|
+
return { rowsDisabled, idsWithoutReason };
|
|
17
|
+
};
|
|
@@ -5,16 +5,16 @@ import { ActionCellContext, } from '../../ActionCellContext';
|
|
|
5
5
|
* хук позволяющий подписаться на событие блокировки действий
|
|
6
6
|
*/
|
|
7
7
|
export const useBlockingActions = (actions) => {
|
|
8
|
-
const {
|
|
8
|
+
const { addBlockingAction, removeBlockingAction } = useContext(RowContext);
|
|
9
9
|
const { addDisabledCell, removeDisabledCell, isDisabled, onActionClick } = useContext(ActionCellContext);
|
|
10
10
|
const blockingAction = [...(actions || [])].find((action) => action.isBlockingOperation && action.loading);
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
if (blockingAction) {
|
|
13
|
-
|
|
13
|
+
addBlockingAction(blockingAction?.loadingNote);
|
|
14
14
|
addDisabledCell(blockingAction?.loadingNote);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
removeBlockingAction();
|
|
18
18
|
removeDisabledCell();
|
|
19
19
|
}, [blockingAction]);
|
|
20
20
|
return {
|
|
@@ -12,8 +12,9 @@ export declare const useLogic: ({ initialOpen, onOpen, onClose }: UseLogicParams
|
|
|
12
12
|
keyId: unknown;
|
|
13
13
|
columns: import("../..").DataGridColumns<Record<string, unknown>>[];
|
|
14
14
|
rowId: string;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
hasBlockingAction: boolean;
|
|
16
|
+
blockingActionReason: string | undefined;
|
|
17
|
+
rowDisabled: import("../..").DataGridRowDisabled | undefined;
|
|
17
18
|
onSelectRow: (row: Record<string, unknown>) => (event: import("react").ChangeEvent<HTMLInputElement, Element>) => void;
|
|
18
19
|
onRowEnter: ((rowId: string) => void) | undefined;
|
|
19
20
|
onRowLeave: ((rowId: string, event: PointerEvent) => void) | undefined;
|
|
@@ -5,7 +5,7 @@ import { RowContext } from '../../DataGrid/Row/RowContext';
|
|
|
5
5
|
import { STORAGE_KEY_PREFIX } from '../constants';
|
|
6
6
|
export const useLogic = ({ initialOpen, onOpen, onClose }) => {
|
|
7
7
|
const { keyId, columns, gridColumns, activeRowId, emptyCellValue, onRowClick, mobileDisplayVariant, } = useContext(DataGridContext);
|
|
8
|
-
const { row, onSelectRow,
|
|
8
|
+
const { row, onSelectRow, hasBlockingAction, blockingActionReason, onRowEnter, onRowLeave, registerRowElement, unregisterRowElement, isSelectable, itemProps, isSelected, rowDisabled, } = useContext(RowContext);
|
|
9
9
|
const rowId = row[keyId];
|
|
10
10
|
/**
|
|
11
11
|
* Используется локальное хранилище DataGridStorageContext. Для сохранения состояния раскрытия строки на время жизни DataGrid.
|
|
@@ -46,8 +46,9 @@ export const useLogic = ({ initialOpen, onOpen, onClose }) => {
|
|
|
46
46
|
keyId,
|
|
47
47
|
columns,
|
|
48
48
|
rowId,
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
hasBlockingAction,
|
|
50
|
+
blockingActionReason,
|
|
51
|
+
rowDisabled,
|
|
51
52
|
onSelectRow,
|
|
52
53
|
onRowEnter,
|
|
53
54
|
onRowLeave,
|
|
@@ -9,21 +9,28 @@ import { dataGridClassnames, EXPANDED_LEVEL_BY_DEFAULT, INITIAL_OPENED_NESTED_CH
|
|
|
9
9
|
import { DataGridContextProvider } from '../DataGrid/DataGridContext';
|
|
10
10
|
import { Variant } from '../DataGrid/enums';
|
|
11
11
|
import { Head } from '../DataGrid/Head';
|
|
12
|
+
import { MassActionsAnchor } from '../DataGrid/styles';
|
|
12
13
|
import { Loader } from '../Loader';
|
|
13
14
|
import { cn } from '../utils/cn';
|
|
14
15
|
import { cva } from '../utils/cva';
|
|
15
16
|
import { getInertProps } from '../utils/getInertProps';
|
|
16
17
|
import { dataGridInfiniteClassnames, OVERSCAN_COUNT } from './constants';
|
|
17
18
|
import { DataGridInfiniteContextProvider } from './DataGridInfiniteContext';
|
|
18
|
-
import { EndData } from './EndData';
|
|
19
19
|
import { ErrorMessage } from './ErrorMessage';
|
|
20
|
+
import { Footer } from './Footer';
|
|
20
21
|
import { List } from './List';
|
|
21
22
|
import { NoData } from './NoData';
|
|
22
23
|
import { Row } from './Row';
|
|
23
|
-
import { Backdrop, DataGridWrapper, DisabledDataGridWrapper,
|
|
24
|
+
import { Backdrop, DataGridWrapper, DisabledDataGridWrapper, HeaderRow, StyledContainer, StyledScrollToTopButton, } from './styles';
|
|
24
25
|
import { useLogic } from './useLogic';
|
|
25
26
|
const dataGridInfiniteCva = cva(dataGridClassnames.root, {
|
|
26
27
|
variants: {
|
|
28
|
+
hasMassActions: {
|
|
29
|
+
true: dataGridClassnames.hasMassActions,
|
|
30
|
+
},
|
|
31
|
+
isMassActionsOpen: {
|
|
32
|
+
true: dataGridClassnames.massActionsOpen,
|
|
33
|
+
},
|
|
27
34
|
hasGroupedColumns: {
|
|
28
35
|
true: dataGridClassnames.hasGroupedColumns,
|
|
29
36
|
},
|
|
@@ -42,17 +49,19 @@ const dataGridInfiniteCva = cva(dataGridClassnames.root, {
|
|
|
42
49
|
});
|
|
43
50
|
export const DataGridInfinite = (props) => {
|
|
44
51
|
const { imagesMap, emptySymbol } = useContext(ConfigContext);
|
|
45
|
-
const { isNoData, isDataGridDisabled, treeRenderConfig, virtuosoProps, headProps, rowProps, scrollToTopButtonProps,
|
|
46
|
-
const { columns, rows = [], selectedRows = [], sorting, isLoading, isDisabled, keyId, emptyCellValue = emptySymbol, variant = Variant.Tree, subrows, className, isError,
|
|
52
|
+
const { isNoData, isDataGridDisabled, treeRenderConfig, virtuosoProps, headProps, rowProps, scrollToTopButtonProps, isHideHead, containerCssVars, isMobile, mobileSkeletonProps, hasGroupedColumns, gridViewMode, gridColumns, handleSelectRow, mobileDisplayVariant, isSelfContained, isNotRenderHeader, initialTopMostItemIndex, hasMassActions, isMassActionsOpen, virtuosoContext, } = useLogic(props);
|
|
53
|
+
const { columns, rows = [], selectedRows = [], onSelectRow, sorting, isLoading, isDisabled, keyId, emptyCellValue = emptySymbol, variant = Variant.Tree, subrows, className, isError, errorMsg, noDataPlaceholder, onRowClick, onSort, onRetry, headPreAddon, activeRowId, isTabularNums, renderRow, renderLink, massActions, } = props;
|
|
47
54
|
const { moreButtonColumnPosition = 1, isVisibleCollapseButton = true } = subrows || {};
|
|
48
55
|
const { isInitialExpanded = false, expandedLevel = EXPANDED_LEVEL_BY_DEFAULT, initialVisibleChildrenCount = INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT, } = treeRenderConfig || {};
|
|
49
56
|
const { isSelectable } = rowProps;
|
|
50
57
|
const TableContainer = isDisabled ? DisabledDataGridWrapper : DataGridWrapper;
|
|
51
|
-
return (_jsx(DataGridInfiniteContextProvider, { renderRow: renderRow, onSelectRow: handleSelectRow, variant: variant, isInitialExpanded: isInitialExpanded, expandedLevel: expandedLevel, initialVisibleChildrenCount: initialVisibleChildrenCount, isSelectable: isSelectable,
|
|
58
|
+
return (_jsx(DataGridInfiniteContextProvider, { renderRow: renderRow, onSelectRow: handleSelectRow, variant: variant, isInitialExpanded: isInitialExpanded, expandedLevel: expandedLevel, initialVisibleChildrenCount: initialVisibleChildrenCount, isSelectable: isSelectable, moreButtonColumnPosition: moreButtonColumnPosition, isVisibleCollapseButton: isVisibleCollapseButton, children: _jsx(DataGridContextProvider, { gridColumns: gridColumns, emptyCellValue: emptyCellValue, activeRowId: activeRowId, columns: columns, keyId: keyId, isTabularNums: isTabularNums, onRowClick: onRowClick, mobileDisplayVariant: mobileDisplayVariant, renderLink: renderLink, selectedRows: selectedRows, onSelectRow: onSelectRow, isMassActionsOpen: isMassActionsOpen, children: _jsxs(StyledContainer, { style: containerCssVars, className: cn(dataGridInfiniteCva({
|
|
52
59
|
hasGroupedColumns,
|
|
53
60
|
gridViewMode,
|
|
54
61
|
mobileDisplayVariant,
|
|
55
62
|
isSelfContained,
|
|
63
|
+
hasMassActions,
|
|
64
|
+
isMassActionsOpen,
|
|
56
65
|
}), className), children: [headPreAddon, _jsxs(TableContainer, { ...getInertProps(isDataGridDisabled), children: [!isHideHead && (_jsx(Head, { ...headProps, onSort: onSort, sorting: sorting, columns: columns })), _jsx(ContentState, { isLoading: isLoading && !isNoData, loadingTitle: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u0430\u043D\u043D\u044B\u0445", isError: isError && !isNoData, loadingContent: isMobile && _jsx(MobileSkeleton, { ...mobileSkeletonProps }), errorState: {
|
|
57
66
|
imgAlt: 'Что-то пошло не так',
|
|
58
67
|
errorList: [errorMsg || ''],
|
|
@@ -60,23 +69,18 @@ export const DataGridInfinite = (props) => {
|
|
|
60
69
|
onRetry,
|
|
61
70
|
}, children: _jsx(Virtuoso, { ...virtuosoProps, ...(initialTopMostItemIndex && {
|
|
62
71
|
initialTopMostItemIndex,
|
|
63
|
-
}), style: { height: '100%' }, overscan: OVERSCAN_COUNT, data: rows, components: {
|
|
72
|
+
}), style: { height: '100%' }, overscan: OVERSCAN_COUNT, data: rows, context: virtuosoContext, components: {
|
|
64
73
|
// biome-ignore lint/suspicious/noTsIgnore: Требует HTMLDivElement, а для элемента списка используем HTMLUListElement (https://github.com/petyosi/react-virtuoso/issues/864)
|
|
65
74
|
// @ts-ignore
|
|
66
75
|
List,
|
|
67
76
|
Item: Row,
|
|
68
77
|
EmptyPlaceholder: () => (_jsx(_Fragment, { children: noDataPlaceholder || _jsx(NoData, {}) })),
|
|
69
|
-
Footer
|
|
70
|
-
if (!isLoading && !isError && !isEndReached) {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
return (_jsxs(FooterRow, { children: [isLoading && _jsx(Loader, {}), isError && _jsx(ErrorMessage, { onRetry: onRetry }), isEndReached && (_jsx(EndData, { endOfScrollMsg: endOfScrollMsg }))] }));
|
|
74
|
-
},
|
|
78
|
+
Footer,
|
|
75
79
|
Header: () => {
|
|
76
80
|
if (isNotRenderHeader) {
|
|
77
81
|
return null;
|
|
78
82
|
}
|
|
79
|
-
return (_jsxs(HeaderRow, { children: [isLoading && _jsx(Loader, {}), isError && _jsx(ErrorMessage, { onRetry: onRetry })] }));
|
|
83
|
+
return (_jsxs(HeaderRow, { className: dataGridInfiniteClassnames.header, children: [isLoading && _jsx(Loader, {}), isError && _jsx(ErrorMessage, { onRetry: onRetry })] }));
|
|
80
84
|
},
|
|
81
|
-
} }) }), _jsx(StyledScrollToTopButton, { ...scrollToTopButtonProps, className: dataGridInfiniteClassnames.scrollToTopButton }), isDisabled && _jsx(Backdrop, {})] })] }) }) }));
|
|
85
|
+
} }) }), massActions && (_jsx(MassActionsAnchor, { children: massActions })), _jsx(StyledScrollToTopButton, { ...scrollToTopButtonProps, className: dataGridInfiniteClassnames.scrollToTopButton }), isDisabled && _jsx(Backdrop, {})] })] }) }) }));
|
|
82
86
|
};
|
|
@@ -9,7 +9,6 @@ export type DataGridInfiniteContextProps = {
|
|
|
9
9
|
moreButtonColumnPosition?: number;
|
|
10
10
|
isVisibleCollapseButton?: boolean;
|
|
11
11
|
isSelectable?: boolean;
|
|
12
|
-
selectedRows?: Record<string, unknown>[];
|
|
13
12
|
};
|
|
14
13
|
/**
|
|
15
14
|
* Контекст общих параметров для компонента `Item` внутри `DataGridInfinite`.
|
|
@@ -19,5 +18,6 @@ export type DataGridInfiniteContextProps = {
|
|
|
19
18
|
* лишние перерисовки виртуализированного списка.
|
|
20
19
|
*
|
|
21
20
|
* Поскольку `Virtuoso` сам управляет параметрами `Item`, общие настройки передаются через контекст.
|
|
21
|
+
* Состояние строк передаётся отдельно, см. `DataGridInfiniteItemContext` в `Row/types.ts`.
|
|
22
22
|
*/
|
|
23
23
|
export declare const DataGridInfiniteContext: import("react").Context<DataGridInfiniteContextProps>;
|
|
@@ -7,6 +7,7 @@ import { createContext } from 'react';
|
|
|
7
7
|
* лишние перерисовки виртуализированного списка.
|
|
8
8
|
*
|
|
9
9
|
* Поскольку `Virtuoso` сам управляет параметрами `Item`, общие настройки передаются через контекст.
|
|
10
|
+
* Состояние строк передаётся отдельно, см. `DataGridInfiniteItemContext` в `Row/types.ts`.
|
|
10
11
|
*/
|
|
11
12
|
export const DataGridInfiniteContext = createContext({
|
|
12
13
|
renderRow: () => null,
|
|
@@ -17,5 +18,4 @@ export const DataGridInfiniteContext = createContext({
|
|
|
17
18
|
initialVisibleChildrenCount: 0,
|
|
18
19
|
moreButtonColumnPosition: 0,
|
|
19
20
|
isVisibleCollapseButton: true,
|
|
20
|
-
selectedRows: [],
|
|
21
21
|
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Loader } from '../../Loader';
|
|
3
|
+
import { dataGridInfiniteClassnames } from '../constants';
|
|
4
|
+
import { EndData } from '../EndData';
|
|
5
|
+
import { ErrorMessage } from '../ErrorMessage';
|
|
6
|
+
import { FooterRow, MassActionsSpacer } from '../styles';
|
|
7
|
+
/**
|
|
8
|
+
* Футер списка для Virtuoso.
|
|
9
|
+
*/
|
|
10
|
+
export const Footer = ({ context }) => {
|
|
11
|
+
const { isLoading, isError, isEndReached, endOfScrollMsg, onRetry, hasMassActions, } = context;
|
|
12
|
+
const renderStatus = () => {
|
|
13
|
+
if (isLoading) {
|
|
14
|
+
return (_jsx(FooterRow, { children: _jsx(Loader, {}) }));
|
|
15
|
+
}
|
|
16
|
+
if (isError) {
|
|
17
|
+
return (_jsx(FooterRow, { children: _jsx(ErrorMessage, { onRetry: onRetry }) }));
|
|
18
|
+
}
|
|
19
|
+
if (isEndReached) {
|
|
20
|
+
return (_jsx(FooterRow, { children: _jsx(EndData, { endOfScrollMsg: endOfScrollMsg }) }));
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
return (_jsxs("div", { className: dataGridInfiniteClassnames.footer, children: [renderStatus(), hasMassActions && (_jsx(MassActionsSpacer, { className: dataGridInfiniteClassnames.massActionsSpacer }))] }));
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Footer';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type FooterContext = {
|
|
2
|
+
/**
|
|
3
|
+
* Флаг состояния загрузки
|
|
4
|
+
*/
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Флаг состояния ошибки
|
|
8
|
+
*/
|
|
9
|
+
isError?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Флаг достижения конца списка
|
|
12
|
+
*/
|
|
13
|
+
isEndReached?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Текст достижения конца списка
|
|
16
|
+
*/
|
|
17
|
+
endOfScrollMsg?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Обработчик повторной загрузки при ошибке
|
|
20
|
+
*/
|
|
21
|
+
onRetry: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Флаг наличия массовых действий
|
|
24
|
+
*/
|
|
25
|
+
hasMassActions: boolean;
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,6 +5,6 @@ import { RowContextProvider } from '../../DataGrid/Row/RowContext';
|
|
|
5
5
|
import { useLogic } from './useLogic';
|
|
6
6
|
const INITIAL_LEVEL = 0;
|
|
7
7
|
export const Row = ({ children, ...props }) => {
|
|
8
|
-
const { item, memoizedItemProps, onSelectRow, renderRow, flattenColumns, gridColumns, options, keyId, variant, isSelectable, isSelected, nestedChildren, isInitialExpanded, expandedLevel, initialVisibleChildrenCount, moreButtonColumnPosition, isVisibleCollapseButton, emptyCellValue, activeRowId, onRowClick, } = useLogic(props);
|
|
9
|
-
return (_jsx(RowContextProvider, { row: item, itemProps: memoizedItemProps, onSelectRow: onSelectRow, isSelectable: isSelectable, isSelected: isSelected, children: renderRow ? (_jsx(CustomRowWrapper, { index: memoizedItemProps['data-index'], renderRow: renderRow, row: item })) : (_jsx(RowComponent, { ...memoizedItemProps, row: item, columns: flattenColumns, gridColumns: gridColumns, options: options, keyId: keyId, variant: variant, isSelectable: isSelectable, isSelected: isSelected, level: INITIAL_LEVEL, nestedChildren: nestedChildren, isInitialExpanded: isInitialExpanded || false, expandedLevel: expandedLevel || 1, initialVisibleChildrenCount: initialVisibleChildrenCount || 2, activeRowId: activeRowId, moreButtonColumnPosition: moreButtonColumnPosition || 1, isVisibleCollapseButton: isVisibleCollapseButton || true, emptyCellValue: emptyCellValue, onRowClick: onRowClick, onSelectRow: onSelectRow })) }));
|
|
8
|
+
const { item, memoizedItemProps, onSelectRow, renderRow, flattenColumns, gridColumns, options, keyId, variant, isSelectable, isSelected, disabledMode, disabledReason, getRowDisabled, nestedChildren, isInitialExpanded, expandedLevel, initialVisibleChildrenCount, moreButtonColumnPosition, isVisibleCollapseButton, emptyCellValue, activeRowId, onRowClick, } = useLogic(props);
|
|
9
|
+
return (_jsx(RowContextProvider, { row: item, itemProps: memoizedItemProps, onSelectRow: onSelectRow, isSelectable: isSelectable, isSelected: isSelected, disabledMode: disabledMode, disabledReason: disabledReason, children: renderRow ? (_jsx(CustomRowWrapper, { index: memoizedItemProps['data-index'], renderRow: renderRow, row: item })) : (_jsx(RowComponent, { ...memoizedItemProps, row: item, columns: flattenColumns, gridColumns: gridColumns, options: options, keyId: keyId, variant: variant, isSelectable: isSelectable, isSelected: isSelected, getRowDisabled: getRowDisabled, level: INITIAL_LEVEL, nestedChildren: nestedChildren, isInitialExpanded: isInitialExpanded || false, expandedLevel: expandedLevel || 1, initialVisibleChildrenCount: initialVisibleChildrenCount || 2, activeRowId: activeRowId, moreButtonColumnPosition: moreButtonColumnPosition || 1, isVisibleCollapseButton: isVisibleCollapseButton || true, emptyCellValue: emptyCellValue, onRowClick: onRowClick, onSelectRow: onSelectRow })) }));
|
|
10
10
|
};
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
import type { ItemProps as VirtuosoItemProps } from 'react-virtuoso';
|
|
2
|
-
|
|
1
|
+
import type { ContextProp, ItemProps as VirtuosoItemProps } from 'react-virtuoso';
|
|
2
|
+
import { type DataGridProps, type DataGridRowDisabled } from '../../DataGrid/types';
|
|
3
|
+
type ContextGetRowDisabled = DataGridProps<Record<string, unknown>>['getRowDisabled'];
|
|
4
|
+
/**
|
|
5
|
+
* Состояние строк.
|
|
6
|
+
*
|
|
7
|
+
* Передаётся через `context` `Virtuoso`, а не через React-контекст: `Virtuoso` отдаёт `Item` новые данные
|
|
8
|
+
* на рендер позже родителя. Состояние из React-контекста приходило бы раньше данных, и строка
|
|
9
|
+
* перерисовывалась бы дважды — сначала со старыми данными и новым состоянием, затем с новыми данными.
|
|
10
|
+
*/
|
|
11
|
+
export type DataGridInfiniteItemContext = {
|
|
12
|
+
selectedIds: Set<unknown>;
|
|
13
|
+
rowsDisabled: Map<unknown, DataGridRowDisabled | undefined>;
|
|
14
|
+
getRowDisabled?: ContextGetRowDisabled;
|
|
15
|
+
};
|
|
16
|
+
export type RowProps = VirtuosoItemProps<Record<string, unknown>> & ContextProp<DataGridInfiniteItemContext>;
|
|
17
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type RowProps } from '../types';
|
|
3
3
|
type UseLogicParams = Omit<RowProps, 'children'>;
|
|
4
|
-
export declare const useLogic: ({ item, ...itemProps }: UseLogicParams) => {
|
|
4
|
+
export declare const useLogic: ({ item, context, ...itemProps }: UseLogicParams) => {
|
|
5
5
|
item: Record<string, unknown>;
|
|
6
6
|
renderRow: (row: Record<string, unknown>, index: number) => import("react").ReactNode;
|
|
7
7
|
isSelected: boolean;
|
|
@@ -21,7 +21,9 @@ export declare const useLogic: ({ item, ...itemProps }: UseLogicParams) => {
|
|
|
21
21
|
moreButtonColumnPosition: number | undefined;
|
|
22
22
|
isVisibleCollapseButton: boolean | undefined;
|
|
23
23
|
isSelectable: boolean | undefined;
|
|
24
|
-
|
|
24
|
+
disabledMode: "row" | "selection" | "row-except-last-cell" | undefined;
|
|
25
|
+
disabledReason: string | undefined;
|
|
26
|
+
getRowDisabled: ((row: Record<string, unknown>) => import("../../..").DataGridRowDisabled | undefined) | undefined;
|
|
25
27
|
memoizedItemProps: {
|
|
26
28
|
style?: import("react").CSSProperties | undefined;
|
|
27
29
|
'data-index': number;
|
|
@@ -2,13 +2,18 @@ import { useContext, useMemo } from 'react';
|
|
|
2
2
|
import { DataGridContext } from '../../../DataGrid/DataGridContext';
|
|
3
3
|
import { getFlattenColumns } from '../../../DataGrid/utils';
|
|
4
4
|
import { DataGridInfiniteContext } from '../../DataGridInfiniteContext';
|
|
5
|
-
export const useLogic = ({ item, ...itemProps }) => {
|
|
6
|
-
const { renderRow, onSelectRow, variant, isInitialExpanded, expandedLevel, initialVisibleChildrenCount, moreButtonColumnPosition, isVisibleCollapseButton, isSelectable,
|
|
5
|
+
export const useLogic = ({ item, context, ...itemProps }) => {
|
|
6
|
+
const { renderRow, onSelectRow, variant, isInitialExpanded, expandedLevel, initialVisibleChildrenCount, moreButtonColumnPosition, isVisibleCollapseButton, isSelectable, } = useContext(DataGridInfiniteContext);
|
|
7
|
+
// Состояние строки приходит от Virtuoso вместе с item, см. DataGridInfiniteItemContext
|
|
8
|
+
const { selectedIds, rowsDisabled, getRowDisabled } = context;
|
|
7
9
|
const { activeRowId, columns, emptyCellValue, onRowClick, keyId, gridColumns, } = useContext(DataGridContext);
|
|
8
10
|
const memoizedItemProps = useMemo(() => itemProps, [itemProps.style]);
|
|
9
11
|
const flattenColumns = useMemo(() => getFlattenColumns(columns), [columns]);
|
|
10
12
|
const { children: nestedChildren, options } = item;
|
|
11
|
-
const
|
|
13
|
+
const rowId = item[keyId];
|
|
14
|
+
const isSelected = selectedIds.has(rowId);
|
|
15
|
+
const rowDisabled = rowsDisabled.get(rowId);
|
|
16
|
+
const hasNestedChildren = Array.isArray(nestedChildren) && nestedChildren.length > 0;
|
|
12
17
|
return {
|
|
13
18
|
item,
|
|
14
19
|
renderRow,
|
|
@@ -29,7 +34,10 @@ export const useLogic = ({ item, ...itemProps }) => {
|
|
|
29
34
|
moreButtonColumnPosition,
|
|
30
35
|
isVisibleCollapseButton,
|
|
31
36
|
isSelectable,
|
|
32
|
-
|
|
37
|
+
disabledMode: rowDisabled?.mode,
|
|
38
|
+
disabledReason: rowDisabled?.reason,
|
|
39
|
+
// Функция нужна только для расчёта блокировки вложенных строк, остальным не передаём, чтобы не сбрасывать memo
|
|
40
|
+
getRowDisabled: hasNestedChildren ? getRowDisabled : undefined,
|
|
33
41
|
memoizedItemProps,
|
|
34
42
|
};
|
|
35
43
|
};
|
|
@@ -6,4 +6,7 @@ export const VIRTUOSO_LIST_ID = 'virtuoso-list';
|
|
|
6
6
|
export const dataGridInfiniteClassnames = {
|
|
7
7
|
scrollToTopButton: createUIKitClassname('data-grid-infinite__scroll-to-top-button'),
|
|
8
8
|
visibleScrollToTopButton: createUIKitClassname('data-grid-infinite__scroll-to-top-button_visible'),
|
|
9
|
+
massActionsSpacer: createUIKitClassname('data-grid-infinite__mass-actions-spacer'),
|
|
10
|
+
header: createUIKitClassname('data-grid-infinite__header'),
|
|
11
|
+
footer: createUIKitClassname('data-grid-infinite__footer'),
|
|
9
12
|
};
|