@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
|
@@ -8,7 +8,7 @@ const RowContext_1 = require("../../DataGrid/Row/RowContext");
|
|
|
8
8
|
const useLogic_1 = require("./useLogic");
|
|
9
9
|
const INITIAL_LEVEL = 0;
|
|
10
10
|
const Row = ({ children, ...props }) => {
|
|
11
|
-
const { item, memoizedItemProps, onSelectRow, renderRow, flattenColumns, gridColumns, options, keyId, variant, isSelectable, isSelected, nestedChildren, isInitialExpanded, expandedLevel, initialVisibleChildrenCount, moreButtonColumnPosition, isVisibleCollapseButton, emptyCellValue, activeRowId, onRowClick, } = (0, useLogic_1.useLogic)(props);
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(RowContext_1.RowContextProvider, { row: item, itemProps: memoizedItemProps, onSelectRow: onSelectRow, isSelectable: isSelectable, isSelected: isSelected, children: renderRow ? ((0, jsx_runtime_1.jsx)(CustomRowWrapper_1.CustomRowWrapper, { index: memoizedItemProps['data-index'], renderRow: renderRow, row: item })) : ((0, jsx_runtime_1.jsx)(Row_1.Row, { ...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 })) }));
|
|
11
|
+
const { item, memoizedItemProps, onSelectRow, renderRow, flattenColumns, gridColumns, options, keyId, variant, isSelectable, isSelected, disabledMode, disabledReason, getRowDisabled, nestedChildren, isInitialExpanded, expandedLevel, initialVisibleChildrenCount, moreButtonColumnPosition, isVisibleCollapseButton, emptyCellValue, activeRowId, onRowClick, } = (0, useLogic_1.useLogic)(props);
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(RowContext_1.RowContextProvider, { row: item, itemProps: memoizedItemProps, onSelectRow: onSelectRow, isSelectable: isSelectable, isSelected: isSelected, disabledMode: disabledMode, disabledReason: disabledReason, children: renderRow ? ((0, jsx_runtime_1.jsx)(CustomRowWrapper_1.CustomRowWrapper, { index: memoizedItemProps['data-index'], renderRow: renderRow, row: item })) : ((0, jsx_runtime_1.jsx)(Row_1.Row, { ...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 })) }));
|
|
13
13
|
};
|
|
14
14
|
exports.Row = Row;
|
|
@@ -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;
|
|
@@ -5,13 +5,18 @@ const react_1 = require("react");
|
|
|
5
5
|
const DataGridContext_1 = require("../../../DataGrid/DataGridContext");
|
|
6
6
|
const utils_1 = require("../../../DataGrid/utils");
|
|
7
7
|
const DataGridInfiniteContext_1 = require("../../DataGridInfiniteContext");
|
|
8
|
-
const useLogic = ({ item, ...itemProps }) => {
|
|
9
|
-
const { renderRow, onSelectRow, variant, isInitialExpanded, expandedLevel, initialVisibleChildrenCount, moreButtonColumnPosition, isVisibleCollapseButton, isSelectable,
|
|
8
|
+
const useLogic = ({ item, context, ...itemProps }) => {
|
|
9
|
+
const { renderRow, onSelectRow, variant, isInitialExpanded, expandedLevel, initialVisibleChildrenCount, moreButtonColumnPosition, isVisibleCollapseButton, isSelectable, } = (0, react_1.useContext)(DataGridInfiniteContext_1.DataGridInfiniteContext);
|
|
10
|
+
// Состояние строки приходит от Virtuoso вместе с item, см. DataGridInfiniteItemContext
|
|
11
|
+
const { selectedIds, rowsDisabled, getRowDisabled } = context;
|
|
10
12
|
const { activeRowId, columns, emptyCellValue, onRowClick, keyId, gridColumns, } = (0, react_1.useContext)(DataGridContext_1.DataGridContext);
|
|
11
13
|
const memoizedItemProps = (0, react_1.useMemo)(() => itemProps, [itemProps.style]);
|
|
12
14
|
const flattenColumns = (0, react_1.useMemo)(() => (0, utils_1.getFlattenColumns)(columns), [columns]);
|
|
13
15
|
const { children: nestedChildren, options } = item;
|
|
14
|
-
const
|
|
16
|
+
const rowId = item[keyId];
|
|
17
|
+
const isSelected = selectedIds.has(rowId);
|
|
18
|
+
const rowDisabled = rowsDisabled.get(rowId);
|
|
19
|
+
const hasNestedChildren = Array.isArray(nestedChildren) && nestedChildren.length > 0;
|
|
15
20
|
return {
|
|
16
21
|
item,
|
|
17
22
|
renderRow,
|
|
@@ -32,7 +37,10 @@ const useLogic = ({ item, ...itemProps }) => {
|
|
|
32
37
|
moreButtonColumnPosition,
|
|
33
38
|
isVisibleCollapseButton,
|
|
34
39
|
isSelectable,
|
|
35
|
-
|
|
40
|
+
disabledMode: rowDisabled?.mode,
|
|
41
|
+
disabledReason: rowDisabled?.reason,
|
|
42
|
+
// Функция нужна только для расчёта блокировки вложенных строк, остальным не передаём, чтобы не сбрасывать memo
|
|
43
|
+
getRowDisabled: hasNestedChildren ? getRowDisabled : undefined,
|
|
36
44
|
memoizedItemProps,
|
|
37
45
|
};
|
|
38
46
|
};
|
|
@@ -9,4 +9,7 @@ exports.VIRTUOSO_LIST_ID = 'virtuoso-list';
|
|
|
9
9
|
exports.dataGridInfiniteClassnames = {
|
|
10
10
|
scrollToTopButton: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-infinite__scroll-to-top-button'),
|
|
11
11
|
visibleScrollToTopButton: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-infinite__scroll-to-top-button_visible'),
|
|
12
|
+
massActionsSpacer: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-infinite__mass-actions-spacer'),
|
|
13
|
+
header: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-infinite__header'),
|
|
14
|
+
footer: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-infinite__footer'),
|
|
12
15
|
};
|
|
@@ -7,11 +7,7 @@ type DataType = {
|
|
|
7
7
|
actions?: object;
|
|
8
8
|
};
|
|
9
9
|
export declare const makeRandomDate: () => string;
|
|
10
|
-
export declare const makeDataList: (length?: number
|
|
11
|
-
isDisabled?: boolean;
|
|
12
|
-
isDisabledLastCell?: boolean;
|
|
13
|
-
disabledReason?: string;
|
|
14
|
-
}) => DataType[];
|
|
10
|
+
export declare const makeDataList: (length?: number) => DataType[];
|
|
15
11
|
export declare const makeDataListWithTree: (length?: number, options?: {
|
|
16
12
|
isNotSelectable?: boolean;
|
|
17
13
|
childrenCount?: number;
|
|
@@ -15,13 +15,12 @@ const makeRandomDate = () => {
|
|
|
15
15
|
return randomDate.toISOString();
|
|
16
16
|
};
|
|
17
17
|
exports.makeRandomDate = makeRandomDate;
|
|
18
|
-
const makeDataList = (length = 10
|
|
18
|
+
const makeDataList = (length = 10) => {
|
|
19
19
|
return Array.from({ length }).map((_, i) => ({
|
|
20
20
|
id: i.toString(),
|
|
21
21
|
documentName: `Договор №${i + 1}`,
|
|
22
22
|
recipient: RECIPIENTS[faker_1.faker.number.int({ min: 0, max: RECIPIENTS.length })],
|
|
23
23
|
createDate: (0, exports.makeRandomDate)(),
|
|
24
|
-
options: Math.random() < 0.4 ? options : {},
|
|
25
24
|
}));
|
|
26
25
|
};
|
|
27
26
|
exports.makeDataList = makeDataList;
|
|
@@ -30,3 +30,7 @@ export declare const StyledContainer: import("@emotion/styled/dist/declarations/
|
|
|
30
30
|
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
31
31
|
theme?: import("@emotion/react").Theme | undefined;
|
|
32
32
|
}, {}, {}>;
|
|
33
|
+
export declare const MassActionsSpacer: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
34
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
35
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
36
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StyledContainer = exports.StyledScrollToTopButton = exports.Backdrop = exports.HeaderRow = exports.FooterRow = exports.DisabledDataGridWrapper = exports.DataGridWrapper = void 0;
|
|
3
|
+
exports.MassActionsSpacer = exports.StyledContainer = exports.StyledScrollToTopButton = exports.Backdrop = exports.HeaderRow = exports.FooterRow = exports.DisabledDataGridWrapper = exports.DataGridWrapper = void 0;
|
|
4
|
+
const constants_1 = require("../DataGrid/constants");
|
|
4
5
|
const styles_1 = require("../DataGrid/styles");
|
|
5
6
|
const ScrollToTopButton_1 = require("../ScrollToTopButton");
|
|
6
7
|
const styled_1 = require("../styled");
|
|
7
|
-
const
|
|
8
|
+
const constants_2 = require("./constants");
|
|
8
9
|
const List_1 = require("./List");
|
|
9
10
|
exports.DataGridWrapper = styled_1.styled.div `
|
|
10
11
|
position: relative;
|
|
@@ -50,11 +51,31 @@ exports.Backdrop = styled_1.styled.div `
|
|
|
50
51
|
exports.StyledScrollToTopButton = (0, styled_1.styled)(ScrollToTopButton_1.ScrollToTopButton) `
|
|
51
52
|
display: none;
|
|
52
53
|
|
|
53
|
-
&.${
|
|
54
|
+
&.${constants_2.dataGridInfiniteClassnames.visibleScrollToTopButton} {
|
|
54
55
|
display: inline-flex;
|
|
55
56
|
}
|
|
56
57
|
`;
|
|
57
58
|
exports.StyledContainer = (0, styled_1.styled)(styles_1.Container) `
|
|
59
|
+
&.${constants_1.dataGridClassnames.hasMassActions} {
|
|
60
|
+
/* Резерв места под панель массовых действий убирается одновременно с анимацией её скрытия, чтобы строки не прыгали */
|
|
61
|
+
& .${constants_2.dataGridInfiniteClassnames.massActionsSpacer} {
|
|
62
|
+
transition: height
|
|
63
|
+
${({ theme }) => theme.transitions.duration.leavingScreen}ms
|
|
64
|
+
${({ theme }) => theme.transitions.easing.easeIn};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.${constants_1.dataGridClassnames.massActionsOpen} {
|
|
68
|
+
& .${constants_2.dataGridInfiniteClassnames.massActionsSpacer} {
|
|
69
|
+
height: var(--mass-actions-reserved-space);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Кнопка «Наверх» скрыта при открытой панели, чтобы не перегружать интерфейс */
|
|
73
|
+
& .${constants_2.dataGridInfiniteClassnames.scrollToTopButton} {
|
|
74
|
+
display: none;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
58
79
|
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
59
80
|
& .${List_1.dataGridInfiniteListClassnames.root} {
|
|
60
81
|
display: flex;
|
|
@@ -63,3 +84,6 @@ exports.StyledContainer = (0, styled_1.styled)(styles_1.Container) `
|
|
|
63
84
|
}
|
|
64
85
|
}
|
|
65
86
|
`;
|
|
87
|
+
exports.MassActionsSpacer = styled_1.styled.div `
|
|
88
|
+
height: 0;
|
|
89
|
+
`;
|
|
@@ -2,9 +2,14 @@ import { type ChangeEvent } from 'react';
|
|
|
2
2
|
import type { ListRange } from 'react-virtuoso';
|
|
3
3
|
import { type DataGridRow } from '../../DataGrid';
|
|
4
4
|
import { type CellValue } from '../../DataGrid/types';
|
|
5
|
+
import { type FooterContext } from '../Footer';
|
|
6
|
+
import { type DataGridInfiniteItemContext } from '../Row';
|
|
5
7
|
import { type DataGridInfiniteProps, type DataGridInfiniteVirtuosoHandle } from '../types';
|
|
6
8
|
type UseLogicParams<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = DataGridInfiniteProps<TData, TSortField>;
|
|
7
|
-
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, maxHeight, isLoading, isError, isDisabled, isEndReached, onEndReached, onStartReached, isStartReached, onSelectRow, isHideSelectAll, initialVisibleItemIndex, isHideHeaderIfNoData, gridViewMode: gridViewModeProp, mobileDisplayVariant, virtuosoRef, }: UseLogicParams<TData, TSortField>) => {
|
|
9
|
+
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, maxHeight, isLoading, isError, isDisabled, getRowDisabled, isEndReached, endOfScrollMsg, onRetry, onEndReached, onStartReached, isStartReached, onSelectRow, isHideSelectAll, initialVisibleItemIndex, isHideHeaderIfNoData, gridViewMode: gridViewModeProp, massActions, mobileDisplayVariant, virtuosoRef, }: UseLogicParams<TData, TSortField>) => {
|
|
10
|
+
virtuosoContext: DataGridInfiniteItemContext & FooterContext;
|
|
11
|
+
hasMassActions: boolean;
|
|
12
|
+
isMassActionsOpen: boolean;
|
|
8
13
|
containerCssVars: import("react").CSSProperties;
|
|
9
14
|
mobileSkeletonProps: {
|
|
10
15
|
cellsCount: number;
|
|
@@ -19,7 +24,6 @@ export declare const useLogic: <TData extends Record<string, unknown> = DataGrid
|
|
|
19
24
|
expandedLevel?: number | undefined;
|
|
20
25
|
initialVisibleChildrenCount?: number | undefined;
|
|
21
26
|
} | undefined;
|
|
22
|
-
isEndReached: boolean | undefined;
|
|
23
27
|
isHideHead: boolean;
|
|
24
28
|
hasGroupedColumns: boolean;
|
|
25
29
|
gridViewMode: "standard" | "full";
|
|
@@ -32,7 +36,7 @@ export declare const useLogic: <TData extends Record<string, unknown> = DataGrid
|
|
|
32
36
|
ref: (node: DataGridInfiniteVirtuosoHandle | null) => void;
|
|
33
37
|
endReached: () => void;
|
|
34
38
|
rangeChanged: (range: ListRange) => void;
|
|
35
|
-
totalListHeightChanged: () => void;
|
|
39
|
+
totalListHeightChanged: (listHeight: number) => void;
|
|
36
40
|
startReached: () => void;
|
|
37
41
|
firstItemIndex: number;
|
|
38
42
|
};
|
|
@@ -4,13 +4,13 @@ exports.useLogic = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const constants_1 = require("../../DataGrid/constants");
|
|
6
6
|
const enums_1 = require("../../DataGrid/enums");
|
|
7
|
-
const hooks_1 = require("../../DataGrid/
|
|
7
|
+
const hooks_1 = require("../../DataGrid/hooks");
|
|
8
|
+
const hooks_2 = require("../../DataGrid/useLogic/hooks");
|
|
8
9
|
const utils_1 = require("../../DataGrid/utils");
|
|
9
10
|
const useViewportType_1 = require("../../useViewportType");
|
|
10
|
-
const prop_1 = require("../../utils/prop");
|
|
11
11
|
const uniqueBy_1 = require("../../utils/uniqueBy");
|
|
12
12
|
const constants_2 = require("../constants");
|
|
13
|
-
const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows = [], maxHeight, isLoading, isError, isDisabled, isEndReached, onEndReached, onStartReached, isStartReached, onSelectRow, isHideSelectAll, initialVisibleItemIndex, isHideHeaderIfNoData = false, gridViewMode: gridViewModeProp = 'standard', mobileDisplayVariant = variant === 'subrows' ? 'cards' : 'list', virtuosoRef, }) => {
|
|
13
|
+
const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows = [], maxHeight, isLoading, isError, isDisabled, getRowDisabled, isEndReached, endOfScrollMsg, onRetry, onEndReached, onStartReached, isStartReached, onSelectRow, isHideSelectAll, initialVisibleItemIndex, isHideHeaderIfNoData = false, gridViewMode: gridViewModeProp = 'standard', massActions, mobileDisplayVariant = variant === 'subrows' ? 'cards' : 'list', virtuosoRef, }) => {
|
|
14
14
|
const virtuoso = (0, react_1.useRef)(null);
|
|
15
15
|
const handleVirtuosoRef = (0, react_1.useCallback)((node) => {
|
|
16
16
|
virtuoso.current = node;
|
|
@@ -69,7 +69,16 @@ const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows =
|
|
|
69
69
|
}
|
|
70
70
|
return config;
|
|
71
71
|
}, [variant, subrows, tree, isMobile]);
|
|
72
|
-
|
|
72
|
+
// Блокировки строк: getRowDisabled вызывается один раз на строку
|
|
73
|
+
const { rowsDisabled, idsWithoutReason } = (0, react_1.useMemo)(() => (0, utils_1.resolveRowsDisabled)(rows, keyId, getRowDisabled), [rows, keyId, getRowDisabled]);
|
|
74
|
+
(0, hooks_1.useWarnRowsWithoutDisabledReason)(idsWithoutReason);
|
|
75
|
+
const selectedIds = (0, react_1.useMemo)(() => new Set(selectedRows.map((row) => row[keyId])), [selectedRows, keyId]);
|
|
76
|
+
const itemContext = (0, react_1.useMemo)(() => ({
|
|
77
|
+
selectedIds,
|
|
78
|
+
rowsDisabled,
|
|
79
|
+
getRowDisabled: getRowDisabled,
|
|
80
|
+
}), [selectedIds, rowsDisabled, getRowDisabled]);
|
|
81
|
+
const availableRows = (0, react_1.useMemo)(() => rows.filter((row) => !row.options?.isNotSelectable && !rowsDisabled.get(row[keyId])), [rows, rowsDisabled, keyId]);
|
|
73
82
|
const flattenColumns = (0, react_1.useMemo)(() => (0, utils_1.getFlattenColumns)(columns), [columns]);
|
|
74
83
|
const hasGroupedColumns = columns.some(utils_1.isGroupColumns);
|
|
75
84
|
const gridViewMode = hasGroupedColumns ? 'full' : gridViewModeProp;
|
|
@@ -84,9 +93,7 @@ const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows =
|
|
|
84
93
|
onStartReached();
|
|
85
94
|
}
|
|
86
95
|
}, [isStartReached, onStartReached]);
|
|
87
|
-
const uncheckedRowsCount = (0, react_1.useMemo)(() =>
|
|
88
|
-
return availableRows.filter((row) => !selectedRows.find((selectedRow) => selectedRow[keyId] === row[keyId])).length;
|
|
89
|
-
}, [availableRows, selectedRows, keyId]);
|
|
96
|
+
const uncheckedRowsCount = (0, react_1.useMemo)(() => availableRows.filter((row) => !selectedIds.has(row[keyId])).length, [availableRows, selectedIds, keyId]);
|
|
90
97
|
const handleRangeChanged = (0, react_1.useCallback)((range) => {
|
|
91
98
|
if (scrollToTopButtonRef.current) {
|
|
92
99
|
scrollToTopButtonRef.current.classList.toggle(constants_2.dataGridInfiniteClassnames.visibleScrollToTopButton, range.startIndex > baseIndex.current + 2);
|
|
@@ -97,11 +104,11 @@ const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows =
|
|
|
97
104
|
return;
|
|
98
105
|
}
|
|
99
106
|
if (event.target.checked) {
|
|
100
|
-
const mergedSelectedRows = (0, uniqueBy_1.uniqueBy)([...
|
|
107
|
+
const mergedSelectedRows = (0, uniqueBy_1.uniqueBy)([...selectedRowsRef.current, ...availableRows], (row) => row[keyId]);
|
|
101
108
|
return onSelectRow(mergedSelectedRows);
|
|
102
109
|
}
|
|
103
|
-
const
|
|
104
|
-
onSelectRow(
|
|
110
|
+
const rowsIds = new Set(rows.map((row) => row[keyId]));
|
|
111
|
+
onSelectRow(selectedRowsRef.current.filter((selectedRow) => !rowsIds.has(selectedRow[keyId])));
|
|
105
112
|
};
|
|
106
113
|
const handleSelectRow = (0, react_1.useCallback)((row) => (event) => {
|
|
107
114
|
if (!onSelectRow) {
|
|
@@ -115,15 +122,19 @@ const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows =
|
|
|
115
122
|
const handleScrollToTop = () => {
|
|
116
123
|
virtuoso.current?.scrollIntoView({ index: 0, behavior: 'smooth' });
|
|
117
124
|
};
|
|
118
|
-
const recalculateVerticalScroll = () => {
|
|
125
|
+
const recalculateVerticalScroll = (listHeight) => {
|
|
119
126
|
const container = document.getElementById(constants_2.VIRTUOSO_CONTAINER_ID);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
127
|
+
if (container) {
|
|
128
|
+
// listHeight включает header и footer
|
|
129
|
+
const getHeight = (className) => container.querySelector(`.${className}`)?.clientHeight ?? 0;
|
|
130
|
+
const rowsHeight = listHeight -
|
|
131
|
+
getHeight(constants_2.dataGridInfiniteClassnames.header) -
|
|
132
|
+
getHeight(constants_2.dataGridInfiniteClassnames.footer);
|
|
133
|
+
setHasVerticalScroll(rowsHeight > container.clientHeight);
|
|
123
134
|
}
|
|
124
135
|
};
|
|
125
136
|
const isHideHead = isHideHeaderIfNoData && rows.length === 0;
|
|
126
|
-
const { mobileSkeletonProps } = (0,
|
|
137
|
+
const { mobileSkeletonProps } = (0, hooks_2.useDataGridMobileLogic)({
|
|
127
138
|
columns: flattenColumns,
|
|
128
139
|
mobileDisplayVariant,
|
|
129
140
|
});
|
|
@@ -133,14 +144,39 @@ const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows =
|
|
|
133
144
|
const isNotRenderHeader = (!isLoading && !isError && !isStartReached) ||
|
|
134
145
|
!onStartReached ||
|
|
135
146
|
isStartReached;
|
|
147
|
+
const hasMassActions = Boolean(massActions);
|
|
148
|
+
const isMassActionsOpen = (0, utils_1.checkIsMassActionsOpen)({
|
|
149
|
+
hasMassActions,
|
|
150
|
+
selectedRowsCount: selectedRows.length,
|
|
151
|
+
isMobile,
|
|
152
|
+
});
|
|
153
|
+
const footerContext = (0, react_1.useMemo)(() => ({
|
|
154
|
+
isLoading,
|
|
155
|
+
isError,
|
|
156
|
+
isEndReached: isEndReached && hasVerticalScroll,
|
|
157
|
+
endOfScrollMsg,
|
|
158
|
+
onRetry,
|
|
159
|
+
hasMassActions,
|
|
160
|
+
}), [
|
|
161
|
+
isLoading,
|
|
162
|
+
isError,
|
|
163
|
+
isEndReached,
|
|
164
|
+
hasVerticalScroll,
|
|
165
|
+
endOfScrollMsg,
|
|
166
|
+
onRetry,
|
|
167
|
+
hasMassActions,
|
|
168
|
+
]);
|
|
169
|
+
const virtuosoContext = (0, react_1.useMemo)(() => ({ ...itemContext, ...footerContext }), [itemContext, footerContext]);
|
|
136
170
|
return {
|
|
171
|
+
virtuosoContext,
|
|
172
|
+
hasMassActions,
|
|
173
|
+
isMassActionsOpen,
|
|
137
174
|
containerCssVars,
|
|
138
175
|
mobileSkeletonProps,
|
|
139
176
|
isNoData,
|
|
140
177
|
isMobile,
|
|
141
178
|
isDataGridDisabled,
|
|
142
179
|
treeRenderConfig,
|
|
143
|
-
isEndReached: isEndReached && hasVerticalScroll,
|
|
144
180
|
isHideHead,
|
|
145
181
|
hasGroupedColumns,
|
|
146
182
|
gridViewMode,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type DataGridMassActionsProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Панель массовых действий над выбранными строками `DataGrid` и `DataGridInfinite`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <DataGrid
|
|
7
|
+
* massActions={
|
|
8
|
+
* <DataGridMassActions
|
|
9
|
+
* entityDeclension={['документ', 'документа', 'документов']}
|
|
10
|
+
* main={[{ text: 'Отправить', onClick: handleSend }]}
|
|
11
|
+
* />
|
|
12
|
+
* }
|
|
13
|
+
* />
|
|
14
|
+
*/
|
|
15
|
+
export declare const DataGridMassActions: ({ className, ...props }: DataGridMassActionsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGridMassActions = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const cva_1 = require("../utils/cva");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const styles_1 = require("./styles");
|
|
8
|
+
const useLogic_1 = require("./useLogic");
|
|
9
|
+
const rootCva = (0, cva_1.cva)(constants_1.dataGridMassActionsClassnames.root, {
|
|
10
|
+
variants: {
|
|
11
|
+
isOpen: {
|
|
12
|
+
true: constants_1.dataGridMassActionsClassnames.open,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Панель массовых действий над выбранными строками `DataGrid` и `DataGridInfinite`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <DataGrid
|
|
21
|
+
* massActions={
|
|
22
|
+
* <DataGridMassActions
|
|
23
|
+
* entityDeclension={['документ', 'документа', 'документов']}
|
|
24
|
+
* main={[{ text: 'Отправить', onClick: handleSend }]}
|
|
25
|
+
* />
|
|
26
|
+
* }
|
|
27
|
+
* />
|
|
28
|
+
*/
|
|
29
|
+
const DataGridMassActions = ({ className, ...props }) => {
|
|
30
|
+
const { isOpen, isMounted, selectedCount, handleClose } = (0, useLogic_1.useLogic)();
|
|
31
|
+
if (!isOpen && !isMounted) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.StyledMassActions, { ...props, className: rootCva({ isOpen, className }), selectedCount: selectedCount, onClose: handleClose }));
|
|
35
|
+
};
|
|
36
|
+
exports.DataGridMassActions = DataGridMassActions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dataGridMassActionsClassnames = void 0;
|
|
4
|
+
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
|
+
exports.dataGridMassActionsClassnames = {
|
|
6
|
+
root: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-mass-actions'),
|
|
7
|
+
open: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-mass-actions_open'),
|
|
8
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGridMassActions = void 0;
|
|
4
|
+
var DataGridMassActions_1 = require("./DataGridMassActions");
|
|
5
|
+
Object.defineProperty(exports, "DataGridMassActions", { enumerable: true, get: function () { return DataGridMassActions_1.DataGridMassActions; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGridMassActions = void 0;
|
|
4
|
+
var DataGridMassActions_1 = require("./DataGridMassActions");
|
|
5
|
+
Object.defineProperty(exports, "DataGridMassActions", { enumerable: true, get: function () { return DataGridMassActions_1.DataGridMassActions; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const StyledMassActions: import("@emotion/styled/dist/declarations/src/types").StyledComponent<Pick<import("..").ActionGroupProps, "main" | "secondary"> & {
|
|
2
|
+
selectedCount: number;
|
|
3
|
+
entityDeclension: [string, string, string];
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
className?: string | undefined;
|
|
6
|
+
} & {
|
|
7
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
8
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StyledMassActions = void 0;
|
|
4
|
+
const MassActions_1 = require("../MassActions");
|
|
5
|
+
const styled_1 = require("../styled");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const slideIn = (0, styled_1.keyframes) `
|
|
8
|
+
from {
|
|
9
|
+
transform: translateY(100%);
|
|
10
|
+
|
|
11
|
+
opacity: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
to {
|
|
15
|
+
transform: translateY(0);
|
|
16
|
+
|
|
17
|
+
opacity: 1;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const slideOut = (0, styled_1.keyframes) `
|
|
21
|
+
from {
|
|
22
|
+
transform: translateY(0);
|
|
23
|
+
|
|
24
|
+
opacity: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
to {
|
|
28
|
+
transform: translateY(100%);
|
|
29
|
+
|
|
30
|
+
opacity: 0;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
exports.StyledMassActions = (0, styled_1.styled)(MassActions_1.MassActions) `
|
|
34
|
+
position: absolute;
|
|
35
|
+
z-index: ${({ theme }) => theme.zIndex.appBar};
|
|
36
|
+
right: 0;
|
|
37
|
+
bottom: ${({ theme }) => theme.spacing(3)};
|
|
38
|
+
left: 0;
|
|
39
|
+
|
|
40
|
+
max-width: calc(100% - ${({ theme }) => theme.spacing(8)});
|
|
41
|
+
margin-inline: auto;
|
|
42
|
+
|
|
43
|
+
animation: ${slideOut}
|
|
44
|
+
${({ theme }) => theme.transitions.duration.leavingScreen}ms
|
|
45
|
+
${({ theme }) => theme.transitions.easing.easeIn} forwards;
|
|
46
|
+
|
|
47
|
+
&.${constants_1.dataGridMassActionsClassnames.open} {
|
|
48
|
+
animation: ${slideIn}
|
|
49
|
+
${({ theme }) => theme.transitions.duration.standard}ms
|
|
50
|
+
${({ theme }) => theme.transitions.easing.easeOut} forwards;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { type DataGridColumns } from '../../DataGrid/types';
|
|
3
|
+
type DataItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
type GridRenderProps = {
|
|
8
|
+
rows: DataItem[];
|
|
9
|
+
columns: DataGridColumns<DataItem>[];
|
|
10
|
+
selectedRows: DataItem[];
|
|
11
|
+
onSelectRow: (rows: DataItem[]) => void;
|
|
12
|
+
massActions: ReactNode;
|
|
13
|
+
onRetry: () => void;
|
|
14
|
+
};
|
|
15
|
+
type TestDataGridMassActionsParams = {
|
|
16
|
+
render: (ui: ReactElement) => void;
|
|
17
|
+
renderGrid: (props: GridRenderProps) => ReactNode;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Общие тесты связки таблицы и DataGridMassActions для DataGrid и DataGridInfinite
|
|
21
|
+
*/
|
|
22
|
+
export declare const testDataGridMassActions: ({ render, renderGrid, }: TestDataGridMassActionsParams) => void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testDataGridMassActions = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const tests_1 = require("@ui/dev/tests");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const vitest_1 = require("vitest");
|
|
8
|
+
const DataGridMassActions_1 = require("../DataGridMassActions");
|
|
9
|
+
const TEST_ROWS = [
|
|
10
|
+
{ id: '1', name: 'Договор поставки' },
|
|
11
|
+
{ id: '2', name: 'Счёт-фактура' },
|
|
12
|
+
];
|
|
13
|
+
const TEST_COLUMNS = [
|
|
14
|
+
{
|
|
15
|
+
field: 'name',
|
|
16
|
+
label: 'Наименование',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Общие тесты связки таблицы и DataGridMassActions для DataGrid и DataGridInfinite
|
|
21
|
+
*/
|
|
22
|
+
const testDataGridMassActions = ({ render, renderGrid, }) => {
|
|
23
|
+
const TestComponent = ({ initialSelectedRows, }) => {
|
|
24
|
+
const [selectedRows, setSelectedRows] = (0, react_1.useState)(initialSelectedRows);
|
|
25
|
+
return renderGrid({
|
|
26
|
+
rows: TEST_ROWS,
|
|
27
|
+
columns: TEST_COLUMNS,
|
|
28
|
+
selectedRows,
|
|
29
|
+
onSelectRow: setSelectedRows,
|
|
30
|
+
massActions: ((0, jsx_runtime_1.jsx)(DataGridMassActions_1.DataGridMassActions, { entityDeclension: ['документ', 'документа', 'документов'], main: [{ text: 'Отправить' }] })),
|
|
31
|
+
onRetry: () => { },
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const setup = ({ initialSelectedRows = [], } = {}) => {
|
|
35
|
+
render((0, jsx_runtime_1.jsx)(TestComponent, { initialSelectedRows: initialSelectedRows }));
|
|
36
|
+
};
|
|
37
|
+
(0, vitest_1.beforeEach)(() => {
|
|
38
|
+
(0, tests_1.setWindowWidth)(tests_1.viewportSize.desktop.default.width);
|
|
39
|
+
});
|
|
40
|
+
(0, vitest_1.it)('Панель не отображается при пустом выборе', () => {
|
|
41
|
+
setup();
|
|
42
|
+
const closeButton = tests_1.screen.queryByRole('button', {
|
|
43
|
+
name: 'Снять выделение',
|
|
44
|
+
});
|
|
45
|
+
(0, vitest_1.expect)(closeButton).toBeNull();
|
|
46
|
+
});
|
|
47
|
+
(0, vitest_1.it)('Панель отображается при выборе строки', async () => {
|
|
48
|
+
setup();
|
|
49
|
+
// 0 - "Выбрать все", 1 - первая строка
|
|
50
|
+
await tests_1.userEvents.click(tests_1.screen.getAllByRole('checkbox')[1]);
|
|
51
|
+
(0, vitest_1.expect)(tests_1.screen.getByText('Выбрано: 1 документ')).toBeVisible();
|
|
52
|
+
});
|
|
53
|
+
(0, vitest_1.it)('Панель остаётся открытой после нажатия на действие, если выбор не очищен', async () => {
|
|
54
|
+
setup({ initialSelectedRows: TEST_ROWS });
|
|
55
|
+
await tests_1.userEvents.click(tests_1.screen.getByRole('button', { name: 'Отправить' }));
|
|
56
|
+
(0, vitest_1.expect)(tests_1.screen.getByText('Выбрано: 2 документа')).toBeVisible();
|
|
57
|
+
});
|
|
58
|
+
(0, vitest_1.it)('Выбор строк снимается при закрытии панели', async () => {
|
|
59
|
+
setup({ initialSelectedRows: TEST_ROWS });
|
|
60
|
+
await tests_1.userEvents.click(tests_1.screen.getByRole('button', { name: 'Снять выделение' }));
|
|
61
|
+
const checkedCheckboxes = tests_1.screen.queryAllByRole('checkbox', {
|
|
62
|
+
checked: true,
|
|
63
|
+
});
|
|
64
|
+
(0, vitest_1.expect)(checkedCheckboxes).toHaveLength(0);
|
|
65
|
+
});
|
|
66
|
+
(0, vitest_1.it)('Панель скрывается при закрытии', async () => {
|
|
67
|
+
setup({ initialSelectedRows: TEST_ROWS });
|
|
68
|
+
await tests_1.userEvents.click(tests_1.screen.getByRole('button', { name: 'Снять выделение' }));
|
|
69
|
+
// Панель размонтируется после анимации скрытия
|
|
70
|
+
await (0, vitest_1.expect)((0, tests_1.waitForElementToBeRemoved)(() => tests_1.screen.queryByRole('button', { name: 'Снять выделение' }))).resolves.toBeUndefined();
|
|
71
|
+
});
|
|
72
|
+
(0, vitest_1.it)('Панель не отображается на мобильных разрешениях', () => {
|
|
73
|
+
(0, tests_1.setWindowWidth)(tests_1.viewportSize.mobile.default.width);
|
|
74
|
+
setup({ initialSelectedRows: TEST_ROWS });
|
|
75
|
+
const closeButton = tests_1.screen.queryByRole('button', {
|
|
76
|
+
name: 'Снять выделение',
|
|
77
|
+
});
|
|
78
|
+
(0, vitest_1.expect)(closeButton).toBeNull();
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
exports.testDataGridMassActions = testDataGridMassActions;
|