@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,7 +1,9 @@
|
|
|
1
1
|
import { type ChangeEvent } from 'react';
|
|
2
|
-
import type { CellValue, DataGridProps, DataGridRow } from '../types';
|
|
2
|
+
import type { CellValue, DataGridProps, DataGridRow, DataGridRowWithOptions } from '../types';
|
|
3
3
|
type UseLogicParams<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = DataGridProps<TData, TSortField>;
|
|
4
|
-
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, isLoading, isDisabled, mobileDisplayVariant, onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData, sorting, className, onSort, maxHeight, gridViewMode: gridViewModeProp, }: UseLogicParams<TData, TSortField>) => {
|
|
4
|
+
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, isLoading, isDisabled, getRowDisabled, mobileDisplayVariant, onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData, sorting, className, onSort, maxHeight, gridViewMode: gridViewModeProp, massActions, }: UseLogicParams<TData, TSortField>) => {
|
|
5
|
+
hasMassActions: boolean;
|
|
6
|
+
isMassActionsOpen: boolean;
|
|
5
7
|
dataGridClassName: string | undefined;
|
|
6
8
|
containerCssVars: import("react").CSSProperties;
|
|
7
9
|
isDataGridDisabled: boolean | undefined;
|
|
@@ -10,7 +12,7 @@ export declare const useLogic: <TData extends Record<string, unknown> = DataGrid
|
|
|
10
12
|
expandedLevel?: number | undefined;
|
|
11
13
|
initialVisibleChildrenCount?: number | undefined;
|
|
12
14
|
} | undefined;
|
|
13
|
-
renderRows: TData[];
|
|
15
|
+
renderRows: DataGridRowWithOptions<TData>[];
|
|
14
16
|
isAllowHorizontalScroll: boolean;
|
|
15
17
|
isHideHead: boolean;
|
|
16
18
|
hasPinnedColumns: boolean;
|
|
@@ -57,6 +59,9 @@ export declare const useLogic: <TData extends Record<string, unknown> = DataGrid
|
|
|
57
59
|
};
|
|
58
60
|
bodyProps: {
|
|
59
61
|
isSelectable: boolean;
|
|
62
|
+
selectedIds: Set<TData[keyof TData]>;
|
|
63
|
+
rowsDisabled: Map<unknown, import("../types").DataGridRowDisabled | undefined>;
|
|
64
|
+
getRowDisabled: ((row: TData) => import("../types").DataGridRowDisabled | undefined) | undefined;
|
|
60
65
|
onSelectRow: (row: TData) => (event: ChangeEvent<HTMLInputElement>) => void;
|
|
61
66
|
};
|
|
62
67
|
mobileDisplayVariant: "list" | "cards";
|
|
@@ -4,14 +4,14 @@ exports.useLogic = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const ConfigProvider_1 = require("../../ConfigProvider");
|
|
6
6
|
const useFirstMountState_1 = require("../../useFirstMountState");
|
|
7
|
-
const prop_1 = require("../../utils/prop");
|
|
8
7
|
const uniqueBy_1 = require("../../utils/uniqueBy");
|
|
9
8
|
const constants_1 = require("../constants");
|
|
10
9
|
const enums_1 = require("../enums");
|
|
10
|
+
const hooks_1 = require("../hooks");
|
|
11
11
|
const utils_1 = require("../utils");
|
|
12
|
-
const
|
|
12
|
+
const hooks_2 = require("./hooks");
|
|
13
13
|
const utils_2 = require("./utils");
|
|
14
|
-
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', }) => {
|
|
14
|
+
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, }) => {
|
|
15
15
|
const isFirstRender = (0, useFirstMountState_1.useFirstMountState)();
|
|
16
16
|
const isSelectable = Boolean(onSelectRow);
|
|
17
17
|
const isDataGridDisabled = isLoading || isDisabled;
|
|
@@ -35,11 +35,11 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
35
35
|
}, [columns, rows]);
|
|
36
36
|
const renderRows = isLoading ? prevRowsRef.current : rows;
|
|
37
37
|
const isNoData = !renderRows.length;
|
|
38
|
-
const { containerRef, rowHoverProps, sections, hasPinnedColumns } = (0,
|
|
38
|
+
const { containerRef, rowHoverProps, sections, hasPinnedColumns } = (0, hooks_2.usePinnedColumns)({
|
|
39
39
|
isLoading,
|
|
40
40
|
columns: processedColumns(),
|
|
41
41
|
});
|
|
42
|
-
const { isMobile, mobileSkeletonProps } = (0,
|
|
42
|
+
const { isMobile, mobileSkeletonProps } = (0, hooks_2.useDataGridMobileLogic)({
|
|
43
43
|
containerRef,
|
|
44
44
|
isLoading,
|
|
45
45
|
columns: (0, utils_1.getFlattenColumns)(processedColumns()),
|
|
@@ -60,22 +60,24 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
60
60
|
}
|
|
61
61
|
return config;
|
|
62
62
|
}, [variant, subrows, tree, isMobile]);
|
|
63
|
-
|
|
63
|
+
// Блокировки строк: getRowDisabled вызывается один раз на строку
|
|
64
|
+
const { rowsDisabled, idsWithoutReason } = (0, react_1.useMemo)(() => (0, utils_1.resolveRowsDisabled)(renderRows, keyId, getRowDisabled), [renderRows, keyId, getRowDisabled]);
|
|
65
|
+
(0, hooks_1.useWarnRowsWithoutDisabledReason)(idsWithoutReason);
|
|
66
|
+
const selectedIds = (0, react_1.useMemo)(() => new Set(selectedRows.map((row) => row[keyId])), [selectedRows, keyId]);
|
|
67
|
+
const availableRows = (0, react_1.useMemo)(() => renderRows.filter((row) => !row.options?.isNotSelectable && !rowsDisabled.get(row[keyId])), [renderRows, rowsDisabled, keyId]);
|
|
64
68
|
const gridColumns = (0, react_1.useMemo)(() => (0, utils_1.getGridTemplateColumns)((0, utils_1.getFlattenColumns)(columns)), [columns]);
|
|
65
69
|
const isAllowHorizontalScroll = (0, utils_2.getIsAllowHorizontalScroll)((0, utils_1.getFlattenColumns)(columns));
|
|
66
|
-
const uncheckedRowsCount = (0, react_1.useMemo)(() =>
|
|
67
|
-
return availableRows.filter((row) => !selectedRows.find((selectedRow) => selectedRow[keyId] === row[keyId])).length;
|
|
68
|
-
}, [availableRows, selectedRows, keyId]);
|
|
70
|
+
const uncheckedRowsCount = (0, react_1.useMemo)(() => availableRows.filter((row) => !selectedIds.has(row[keyId])).length, [availableRows, selectedIds, keyId]);
|
|
69
71
|
const handleSelectAllRows = (event) => {
|
|
70
72
|
if (!onSelectRow) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
73
75
|
if (event.target.checked) {
|
|
74
|
-
const mergedSelectedRows = (0, uniqueBy_1.uniqueBy)([...
|
|
76
|
+
const mergedSelectedRows = (0, uniqueBy_1.uniqueBy)([...selectedRowsRef.current, ...availableRows], (row) => row[keyId]);
|
|
75
77
|
return onSelectRow(mergedSelectedRows);
|
|
76
78
|
}
|
|
77
|
-
const
|
|
78
|
-
onSelectRow(
|
|
79
|
+
const renderRowsIds = new Set(renderRows.map((row) => row[keyId]));
|
|
80
|
+
onSelectRow(selectedRowsRef.current.filter((selectedRow) => !renderRowsIds.has(selectedRow[keyId])));
|
|
79
81
|
};
|
|
80
82
|
const handleSelectRow = (0, react_1.useCallback)((row) => (event) => {
|
|
81
83
|
if (!onSelectRow) {
|
|
@@ -105,7 +107,15 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
105
107
|
};
|
|
106
108
|
}, [isLoading, isError, isNoData, errorMsg, onRetry, imagesMap]);
|
|
107
109
|
const containerCssVars = (0, utils_1.getDataGridCssVars)(maxHeight);
|
|
110
|
+
const hasMassActions = Boolean(massActions);
|
|
111
|
+
const isMassActionsOpen = (0, utils_1.checkIsMassActionsOpen)({
|
|
112
|
+
hasMassActions,
|
|
113
|
+
selectedRowsCount: selectedRows.length,
|
|
114
|
+
isMobile,
|
|
115
|
+
});
|
|
108
116
|
return {
|
|
117
|
+
hasMassActions,
|
|
118
|
+
isMassActionsOpen,
|
|
109
119
|
dataGridClassName: className,
|
|
110
120
|
containerCssVars,
|
|
111
121
|
isDataGridDisabled,
|
|
@@ -136,6 +146,9 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
136
146
|
},
|
|
137
147
|
bodyProps: {
|
|
138
148
|
isSelectable,
|
|
149
|
+
selectedIds,
|
|
150
|
+
rowsDisabled,
|
|
151
|
+
getRowDisabled,
|
|
139
152
|
onSelectRow: handleSelectRow,
|
|
140
153
|
},
|
|
141
154
|
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,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkIsMassActionsOpen = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Панель массовых действий открыта, если она передана, выбрана хотя бы одна строка и это не мобильное разрешение
|
|
6
|
+
*/
|
|
7
|
+
const checkIsMassActionsOpen = ({ hasMassActions, selectedRowsCount, isMobile, }) => hasMassActions && selectedRowsCount > 0 && !isMobile;
|
|
8
|
+
exports.checkIsMassActionsOpen = checkIsMassActionsOpen;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { checkIsMassActionsOpen } from './checkIsMassActionsOpen';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkIsMassActionsOpen = void 0;
|
|
4
|
+
var checkIsMassActionsOpen_1 = require("./checkIsMassActionsOpen");
|
|
5
|
+
Object.defineProperty(exports, "checkIsMassActionsOpen", { enumerable: true, get: function () { return checkIsMassActionsOpen_1.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,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRowDisabledState = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Вычисляет доступность строки и её checkbox по режиму блокировки и блокирующему действию
|
|
6
|
+
*/
|
|
7
|
+
const getRowDisabledState = ({ rowDisabled, hasBlockingAction = false, blockingActionReason, isDisabledLastCellOption = true, }) => {
|
|
8
|
+
const mode = rowDisabled?.mode;
|
|
9
|
+
const isSelectionDisabled = mode === 'selection';
|
|
10
|
+
const isDisabled = hasBlockingAction || mode === 'row' || mode === 'row-except-last-cell';
|
|
11
|
+
const disabledReason = rowDisabled?.reason || blockingActionReason;
|
|
12
|
+
return {
|
|
13
|
+
isDisabled,
|
|
14
|
+
// Без режима сохраняется прежнее поведение: isDisabledLastCell действует и при блокирующем действии
|
|
15
|
+
isDisabledLastCell: mode
|
|
16
|
+
? mode !== 'row-except-last-cell'
|
|
17
|
+
: isDisabledLastCellOption,
|
|
18
|
+
disabledReason,
|
|
19
|
+
isCheckboxDisabled: isDisabled || isSelectionDisabled,
|
|
20
|
+
// У полностью заблокированной строки причину показывает tooltip строки
|
|
21
|
+
checkboxDisabledReason: isSelectionDisabled ? disabledReason : undefined,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.getRowDisabledState = getRowDisabledState;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getRowDisabledState } from './getRowDisabledState';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRowDisabledState = void 0;
|
|
4
|
+
var getRowDisabledState_1 = require("./getRowDisabledState");
|
|
5
|
+
Object.defineProperty(exports, "getRowDisabledState", { enumerable: true, get: function () { return getRowDisabledState_1.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';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFlattenColumns = exports.isGroupColumns = exports.getGridTemplateColumns = exports.getDataGridCssVars = void 0;
|
|
3
|
+
exports.resolveRowsDisabled = exports.resolveRowDisabled = exports.getRowDisabledState = exports.checkIsMassActionsOpen = exports.getFlattenColumns = exports.isGroupColumns = exports.getGridTemplateColumns = exports.getDataGridCssVars = void 0;
|
|
4
4
|
var getDataGridCssVars_1 = require("./getDataGridCssVars");
|
|
5
5
|
Object.defineProperty(exports, "getDataGridCssVars", { enumerable: true, get: function () { return getDataGridCssVars_1.getDataGridCssVars; } });
|
|
6
6
|
var getGridTemplateColumns_1 = require("./getGridTemplateColumns");
|
|
@@ -9,3 +9,11 @@ var isGroupColumns_1 = require("./isGroupColumns");
|
|
|
9
9
|
Object.defineProperty(exports, "isGroupColumns", { enumerable: true, get: function () { return isGroupColumns_1.isGroupColumns; } });
|
|
10
10
|
var getFlattenColumns_1 = require("./getFlattenColumns");
|
|
11
11
|
Object.defineProperty(exports, "getFlattenColumns", { enumerable: true, get: function () { return getFlattenColumns_1.getFlattenColumns; } });
|
|
12
|
+
var checkIsMassActionsOpen_1 = require("./checkIsMassActionsOpen");
|
|
13
|
+
Object.defineProperty(exports, "checkIsMassActionsOpen", { enumerable: true, get: function () { return checkIsMassActionsOpen_1.checkIsMassActionsOpen; } });
|
|
14
|
+
var getRowDisabledState_1 = require("./getRowDisabledState");
|
|
15
|
+
Object.defineProperty(exports, "getRowDisabledState", { enumerable: true, get: function () { return getRowDisabledState_1.getRowDisabledState; } });
|
|
16
|
+
var resolveRowDisabled_1 = require("./resolveRowDisabled");
|
|
17
|
+
Object.defineProperty(exports, "resolveRowDisabled", { enumerable: true, get: function () { return resolveRowDisabled_1.resolveRowDisabled; } });
|
|
18
|
+
var resolveRowsDisabled_1 = require("./resolveRowsDisabled");
|
|
19
|
+
Object.defineProperty(exports, "resolveRowsDisabled", { enumerable: true, get: function () { return resolveRowsDisabled_1.resolveRowsDisabled; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveRowDisabled } from './resolveRowDisabled';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRowDisabled = void 0;
|
|
4
|
+
var resolveRowDisabled_1 = require("./resolveRowDisabled");
|
|
5
|
+
Object.defineProperty(exports, "resolveRowDisabled", { enumerable: true, get: function () { return resolveRowDisabled_1.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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRowDisabled = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Возвращает блокировку строки: результат getRowDisabled, а если его нет — блокировку из deprecated-полей options (isDisabled, isDisabledLastCell, disabledReason)
|
|
6
|
+
*/
|
|
7
|
+
const resolveRowDisabled = (row, getRowDisabled) => {
|
|
8
|
+
const rowDisabled = getRowDisabled?.(row);
|
|
9
|
+
if (rowDisabled) {
|
|
10
|
+
return rowDisabled;
|
|
11
|
+
}
|
|
12
|
+
const { isDisabled, isDisabledLastCell = true, disabledReason = '', } = row.options ?? {};
|
|
13
|
+
if (!isDisabled) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
mode: isDisabledLastCell ? 'row' : 'row-except-last-cell',
|
|
18
|
+
reason: disabledReason,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.resolveRowDisabled = resolveRowDisabled;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveRowsDisabled } from './resolveRowsDisabled';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRowsDisabled = void 0;
|
|
4
|
+
var resolveRowsDisabled_1 = require("./resolveRowsDisabled");
|
|
5
|
+
Object.defineProperty(exports, "resolveRowsDisabled", { enumerable: true, get: function () { return resolveRowsDisabled_1.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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRowsDisabled = void 0;
|
|
4
|
+
const resolveRowDisabled_1 = require("../resolveRowDisabled");
|
|
5
|
+
/**
|
|
6
|
+
* Вычисляет блокировки строк
|
|
7
|
+
*/
|
|
8
|
+
const resolveRowsDisabled = (rows, keyId, getRowDisabled) => {
|
|
9
|
+
const rowsDisabled = new Map();
|
|
10
|
+
const idsWithoutReason = [];
|
|
11
|
+
rows.forEach((row) => {
|
|
12
|
+
const rowId = row[keyId];
|
|
13
|
+
const rowDisabled = getRowDisabled?.(row);
|
|
14
|
+
if (rowDisabled && !rowDisabled.reason) {
|
|
15
|
+
idsWithoutReason.push(rowId);
|
|
16
|
+
}
|
|
17
|
+
rowsDisabled.set(rowId, rowDisabled ?? (0, resolveRowDisabled_1.resolveRowDisabled)(row));
|
|
18
|
+
});
|
|
19
|
+
return { rowsDisabled, idsWithoutReason };
|
|
20
|
+
};
|
|
21
|
+
exports.resolveRowsDisabled = resolveRowsDisabled;
|
|
@@ -8,16 +8,16 @@ const ActionCellContext_1 = require("../../ActionCellContext");
|
|
|
8
8
|
* хук позволяющий подписаться на событие блокировки действий
|
|
9
9
|
*/
|
|
10
10
|
const useBlockingActions = (actions) => {
|
|
11
|
-
const {
|
|
11
|
+
const { addBlockingAction, removeBlockingAction } = (0, react_1.useContext)(Row_1.RowContext);
|
|
12
12
|
const { addDisabledCell, removeDisabledCell, isDisabled, onActionClick } = (0, react_1.useContext)(ActionCellContext_1.ActionCellContext);
|
|
13
13
|
const blockingAction = [...(actions || [])].find((action) => action.isBlockingOperation && action.loading);
|
|
14
14
|
(0, react_1.useEffect)(() => {
|
|
15
15
|
if (blockingAction) {
|
|
16
|
-
|
|
16
|
+
addBlockingAction(blockingAction?.loadingNote);
|
|
17
17
|
addDisabledCell(blockingAction?.loadingNote);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
removeBlockingAction();
|
|
21
21
|
removeDisabledCell();
|
|
22
22
|
}, [blockingAction]);
|
|
23
23
|
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;
|
|
@@ -8,7 +8,7 @@ const RowContext_1 = require("../../DataGrid/Row/RowContext");
|
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
const useLogic = ({ initialOpen, onOpen, onClose }) => {
|
|
10
10
|
const { keyId, columns, gridColumns, activeRowId, emptyCellValue, onRowClick, mobileDisplayVariant, } = (0, react_1.useContext)(DataGridContext_1.DataGridContext);
|
|
11
|
-
const { row, onSelectRow,
|
|
11
|
+
const { row, onSelectRow, hasBlockingAction, blockingActionReason, onRowEnter, onRowLeave, registerRowElement, unregisterRowElement, isSelectable, itemProps, isSelected, rowDisabled, } = (0, react_1.useContext)(RowContext_1.RowContext);
|
|
12
12
|
const rowId = row[keyId];
|
|
13
13
|
/**
|
|
14
14
|
* Используется локальное хранилище DataGridStorageContext. Для сохранения состояния раскрытия строки на время жизни DataGrid.
|
|
@@ -49,8 +49,9 @@ const useLogic = ({ initialOpen, onOpen, onClose }) => {
|
|
|
49
49
|
keyId,
|
|
50
50
|
columns,
|
|
51
51
|
rowId,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
hasBlockingAction,
|
|
53
|
+
blockingActionReason,
|
|
54
|
+
rowDisabled,
|
|
54
55
|
onSelectRow,
|
|
55
56
|
onRowEnter,
|
|
56
57
|
onRowLeave,
|
|
@@ -12,21 +12,28 @@ const constants_2 = require("../DataGrid/constants");
|
|
|
12
12
|
const DataGridContext_1 = require("../DataGrid/DataGridContext");
|
|
13
13
|
const enums_1 = require("../DataGrid/enums");
|
|
14
14
|
const Head_1 = require("../DataGrid/Head");
|
|
15
|
+
const styles_1 = require("../DataGrid/styles");
|
|
15
16
|
const Loader_1 = require("../Loader");
|
|
16
17
|
const cn_1 = require("../utils/cn");
|
|
17
18
|
const cva_1 = require("../utils/cva");
|
|
18
19
|
const getInertProps_1 = require("../utils/getInertProps");
|
|
19
20
|
const constants_3 = require("./constants");
|
|
20
21
|
const DataGridInfiniteContext_1 = require("./DataGridInfiniteContext");
|
|
21
|
-
const EndData_1 = require("./EndData");
|
|
22
22
|
const ErrorMessage_1 = require("./ErrorMessage");
|
|
23
|
+
const Footer_1 = require("./Footer");
|
|
23
24
|
const List_1 = require("./List");
|
|
24
25
|
const NoData_1 = require("./NoData");
|
|
25
26
|
const Row_1 = require("./Row");
|
|
26
|
-
const
|
|
27
|
+
const styles_2 = require("./styles");
|
|
27
28
|
const useLogic_1 = require("./useLogic");
|
|
28
29
|
const dataGridInfiniteCva = (0, cva_1.cva)(constants_2.dataGridClassnames.root, {
|
|
29
30
|
variants: {
|
|
31
|
+
hasMassActions: {
|
|
32
|
+
true: constants_2.dataGridClassnames.hasMassActions,
|
|
33
|
+
},
|
|
34
|
+
isMassActionsOpen: {
|
|
35
|
+
true: constants_2.dataGridClassnames.massActionsOpen,
|
|
36
|
+
},
|
|
30
37
|
hasGroupedColumns: {
|
|
31
38
|
true: constants_2.dataGridClassnames.hasGroupedColumns,
|
|
32
39
|
},
|
|
@@ -45,17 +52,19 @@ const dataGridInfiniteCva = (0, cva_1.cva)(constants_2.dataGridClassnames.root,
|
|
|
45
52
|
});
|
|
46
53
|
const DataGridInfinite = (props) => {
|
|
47
54
|
const { imagesMap, emptySymbol } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
|
|
48
|
-
const { isNoData, isDataGridDisabled, treeRenderConfig, virtuosoProps, headProps, rowProps, scrollToTopButtonProps,
|
|
49
|
-
const { columns, rows = [], selectedRows = [], sorting, isLoading, isDisabled, keyId, emptyCellValue = emptySymbol, variant = enums_1.Variant.Tree, subrows, className, isError,
|
|
55
|
+
const { isNoData, isDataGridDisabled, treeRenderConfig, virtuosoProps, headProps, rowProps, scrollToTopButtonProps, isHideHead, containerCssVars, isMobile, mobileSkeletonProps, hasGroupedColumns, gridViewMode, gridColumns, handleSelectRow, mobileDisplayVariant, isSelfContained, isNotRenderHeader, initialTopMostItemIndex, hasMassActions, isMassActionsOpen, virtuosoContext, } = (0, useLogic_1.useLogic)(props);
|
|
56
|
+
const { columns, rows = [], selectedRows = [], onSelectRow, sorting, isLoading, isDisabled, keyId, emptyCellValue = emptySymbol, variant = enums_1.Variant.Tree, subrows, className, isError, errorMsg, noDataPlaceholder, onRowClick, onSort, onRetry, headPreAddon, activeRowId, isTabularNums, renderRow, renderLink, massActions, } = props;
|
|
50
57
|
const { moreButtonColumnPosition = 1, isVisibleCollapseButton = true } = subrows || {};
|
|
51
58
|
const { isInitialExpanded = false, expandedLevel = constants_2.EXPANDED_LEVEL_BY_DEFAULT, initialVisibleChildrenCount = constants_2.INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT, } = treeRenderConfig || {};
|
|
52
59
|
const { isSelectable } = rowProps;
|
|
53
|
-
const TableContainer = isDisabled ?
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)(DataGridInfiniteContext_1.DataGridInfiniteContextProvider, { renderRow: renderRow, onSelectRow: handleSelectRow, variant: variant, isInitialExpanded: isInitialExpanded, expandedLevel: expandedLevel, initialVisibleChildrenCount: initialVisibleChildrenCount, isSelectable: isSelectable,
|
|
60
|
+
const TableContainer = isDisabled ? styles_2.DisabledDataGridWrapper : styles_2.DataGridWrapper;
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(DataGridInfiniteContext_1.DataGridInfiniteContextProvider, { renderRow: renderRow, onSelectRow: handleSelectRow, variant: variant, isInitialExpanded: isInitialExpanded, expandedLevel: expandedLevel, initialVisibleChildrenCount: initialVisibleChildrenCount, isSelectable: isSelectable, moreButtonColumnPosition: moreButtonColumnPosition, isVisibleCollapseButton: isVisibleCollapseButton, children: (0, jsx_runtime_1.jsx)(DataGridContext_1.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: (0, jsx_runtime_1.jsxs)(styles_2.StyledContainer, { style: containerCssVars, className: (0, cn_1.cn)(dataGridInfiniteCva({
|
|
55
62
|
hasGroupedColumns,
|
|
56
63
|
gridViewMode,
|
|
57
64
|
mobileDisplayVariant,
|
|
58
65
|
isSelfContained,
|
|
66
|
+
hasMassActions,
|
|
67
|
+
isMassActionsOpen,
|
|
59
68
|
}), className), children: [headPreAddon, (0, jsx_runtime_1.jsxs)(TableContainer, { ...(0, getInertProps_1.getInertProps)(isDataGridDisabled), children: [!isHideHead && ((0, jsx_runtime_1.jsx)(Head_1.Head, { ...headProps, onSort: onSort, sorting: sorting, columns: columns })), (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { isLoading: isLoading && !isNoData, loadingTitle: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u0430\u043D\u043D\u044B\u0445", isError: isError && !isNoData, loadingContent: isMobile && (0, jsx_runtime_1.jsx)(DataGrid_1.MobileSkeleton, { ...mobileSkeletonProps }), errorState: {
|
|
60
69
|
imgAlt: 'Что-то пошло не так',
|
|
61
70
|
errorList: [errorMsg || ''],
|
|
@@ -63,24 +72,19 @@ const DataGridInfinite = (props) => {
|
|
|
63
72
|
onRetry,
|
|
64
73
|
}, children: (0, jsx_runtime_1.jsx)(react_virtuoso_1.Virtuoso, { ...virtuosoProps, ...(initialTopMostItemIndex && {
|
|
65
74
|
initialTopMostItemIndex,
|
|
66
|
-
}), style: { height: '100%' }, overscan: constants_3.OVERSCAN_COUNT, data: rows, components: {
|
|
75
|
+
}), style: { height: '100%' }, overscan: constants_3.OVERSCAN_COUNT, data: rows, context: virtuosoContext, components: {
|
|
67
76
|
// biome-ignore lint/suspicious/noTsIgnore: Требует HTMLDivElement, а для элемента списка используем HTMLUListElement (https://github.com/petyosi/react-virtuoso/issues/864)
|
|
68
77
|
// @ts-ignore
|
|
69
78
|
List: List_1.List,
|
|
70
79
|
Item: Row_1.Row,
|
|
71
80
|
EmptyPlaceholder: () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: noDataPlaceholder || (0, jsx_runtime_1.jsx)(NoData_1.NoData, {}) })),
|
|
72
|
-
Footer:
|
|
73
|
-
if (!isLoading && !isError && !isEndReached) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
return ((0, jsx_runtime_1.jsxs)(styles_1.FooterRow, { children: [isLoading && (0, jsx_runtime_1.jsx)(Loader_1.Loader, {}), isError && (0, jsx_runtime_1.jsx)(ErrorMessage_1.ErrorMessage, { onRetry: onRetry }), isEndReached && ((0, jsx_runtime_1.jsx)(EndData_1.EndData, { endOfScrollMsg: endOfScrollMsg }))] }));
|
|
77
|
-
},
|
|
81
|
+
Footer: Footer_1.Footer,
|
|
78
82
|
Header: () => {
|
|
79
83
|
if (isNotRenderHeader) {
|
|
80
84
|
return null;
|
|
81
85
|
}
|
|
82
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
86
|
+
return ((0, jsx_runtime_1.jsxs)(styles_2.HeaderRow, { className: constants_3.dataGridInfiniteClassnames.header, children: [isLoading && (0, jsx_runtime_1.jsx)(Loader_1.Loader, {}), isError && (0, jsx_runtime_1.jsx)(ErrorMessage_1.ErrorMessage, { onRetry: onRetry })] }));
|
|
83
87
|
},
|
|
84
|
-
} }) }), (0, jsx_runtime_1.jsx)(styles_1.StyledScrollToTopButton, { ...scrollToTopButtonProps, className: constants_3.dataGridInfiniteClassnames.scrollToTopButton }), isDisabled && (0, jsx_runtime_1.jsx)(
|
|
88
|
+
} }) }), massActions && ((0, jsx_runtime_1.jsx)(styles_1.MassActionsAnchor, { children: massActions })), (0, jsx_runtime_1.jsx)(styles_2.StyledScrollToTopButton, { ...scrollToTopButtonProps, className: constants_3.dataGridInfiniteClassnames.scrollToTopButton }), isDisabled && (0, jsx_runtime_1.jsx)(styles_2.Backdrop, {})] })] }) }) }));
|
|
85
89
|
};
|
|
86
90
|
exports.DataGridInfinite = DataGridInfinite;
|
package/node/components/DataGridInfinite/DataGridInfiniteContext/DataGridInfiniteContext.d.ts
CHANGED
|
@@ -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>;
|
|
@@ -10,6 +10,7 @@ const react_1 = require("react");
|
|
|
10
10
|
* лишние перерисовки виртуализированного списка.
|
|
11
11
|
*
|
|
12
12
|
* Поскольку `Virtuoso` сам управляет параметрами `Item`, общие настройки передаются через контекст.
|
|
13
|
+
* Состояние строк передаётся отдельно, см. `DataGridInfiniteItemContext` в `Row/types.ts`.
|
|
13
14
|
*/
|
|
14
15
|
exports.DataGridInfiniteContext = (0, react_1.createContext)({
|
|
15
16
|
renderRow: () => null,
|
|
@@ -20,5 +21,4 @@ exports.DataGridInfiniteContext = (0, react_1.createContext)({
|
|
|
20
21
|
initialVisibleChildrenCount: 0,
|
|
21
22
|
moreButtonColumnPosition: 0,
|
|
22
23
|
isVisibleCollapseButton: true,
|
|
23
|
-
selectedRows: [],
|
|
24
24
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Footer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Loader_1 = require("../../Loader");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
const EndData_1 = require("../EndData");
|
|
8
|
+
const ErrorMessage_1 = require("../ErrorMessage");
|
|
9
|
+
const styles_1 = require("../styles");
|
|
10
|
+
/**
|
|
11
|
+
* Футер списка для Virtuoso.
|
|
12
|
+
*/
|
|
13
|
+
const Footer = ({ context }) => {
|
|
14
|
+
const { isLoading, isError, isEndReached, endOfScrollMsg, onRetry, hasMassActions, } = context;
|
|
15
|
+
const renderStatus = () => {
|
|
16
|
+
if (isLoading) {
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.FooterRow, { children: (0, jsx_runtime_1.jsx)(Loader_1.Loader, {}) }));
|
|
18
|
+
}
|
|
19
|
+
if (isError) {
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.FooterRow, { children: (0, jsx_runtime_1.jsx)(ErrorMessage_1.ErrorMessage, { onRetry: onRetry }) }));
|
|
21
|
+
}
|
|
22
|
+
if (isEndReached) {
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.FooterRow, { children: (0, jsx_runtime_1.jsx)(EndData_1.EndData, { endOfScrollMsg: endOfScrollMsg }) }));
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: constants_1.dataGridInfiniteClassnames.footer, children: [renderStatus(), hasMassActions && ((0, jsx_runtime_1.jsx)(styles_1.MassActionsSpacer, { className: constants_1.dataGridInfiniteClassnames.massActionsSpacer }))] }));
|
|
28
|
+
};
|
|
29
|
+
exports.Footer = Footer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Footer"), exports);
|
|
@@ -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
|
+
};
|