@infomaximum/ui-kit 0.15.8 → 0.16.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/dist/components/BaseTooltip/BaseTooltip.js +4 -4
- package/dist/components/ConfigProvider/ConfigProvider.js +4 -2
- package/dist/components/ConfigProvider/ConfigProvider.types.d.ts +2 -3
- package/dist/components/ConfigProvider/contexts/ConfigContext.d.ts +2 -2
- package/dist/components/ConfigProvider/contexts/ConfigContext.types.d.ts +3 -1
- package/dist/components/ConfigProvider/contexts/index.d.ts +2 -1
- package/dist/components/ConfigProvider/hooks/useConfig/useConfig.d.ts +2 -2
- package/dist/components/ConfigProvider/index.d.ts +1 -1
- package/dist/components/Empty/Empty.js +3 -1
- package/dist/components/Empty/Empty.types.d.ts +5 -0
- package/dist/components/Radio/components/RadioInternal/RadioInternal.types.d.ts +1 -1
- package/dist/components/Table/Table.d.ts +7 -0
- package/dist/components/Table/Table.js +218 -0
- package/dist/components/Table/Table.styles.d.ts +12 -0
- package/dist/components/Table/Table.styles.js +62 -0
- package/dist/components/Table/Table.tokens.d.ts +19 -0
- package/dist/components/Table/Table.tokens.js +20 -0
- package/dist/components/Table/Table.types.d.ts +48 -0
- package/dist/components/Table/components/Body/Body.d.ts +5 -0
- package/dist/components/Table/components/Body/Body.js +56 -0
- package/dist/components/Table/components/Body/Body.styles.d.ts +4 -0
- package/dist/components/Table/components/Body/Body.styles.js +6 -0
- package/dist/components/Table/components/Body/Body.types.d.ts +6 -0
- package/dist/components/Table/components/Body/components/BodyCell/BodyCell.d.ts +3 -0
- package/dist/components/Table/components/Body/components/BodyCell/BodyCell.js +117 -0
- package/dist/components/Table/components/Body/components/BodyCell/BodyCell.styles.d.ts +27 -0
- package/dist/components/Table/components/Body/components/BodyCell/BodyCell.styles.js +32 -0
- package/dist/components/Table/components/Body/components/BodyCell/BodyCell.types.d.ts +12 -0
- package/dist/components/Table/components/Body/components/BodyColGroup/BodyColGroup.d.ts +3 -0
- package/dist/components/Table/components/Body/components/BodyColGroup/BodyColGroup.js +35 -0
- package/dist/components/Table/components/Body/components/BodyColGroup/BodyColGroup.types.d.ts +2 -0
- package/dist/components/Table/components/Body/components/BodyRow/BodyRow.d.ts +3 -0
- package/dist/components/Table/components/Body/components/BodyRow/BodyRow.js +41 -0
- package/dist/components/Table/components/Body/components/BodyRow/BodyRow.types.d.ts +8 -0
- package/dist/components/Table/components/Body/components/MeasureCell/MeasureCell.d.ts +3 -0
- package/dist/components/Table/components/Body/components/MeasureCell/MeasureCell.js +33 -0
- package/dist/components/Table/components/Body/components/MeasureCell/MeasureCell.styles.d.ts +10 -0
- package/dist/components/Table/components/Body/components/MeasureCell/MeasureCell.styles.js +14 -0
- package/dist/components/Table/components/Body/components/MeasureCell/MeasureCell.types.d.ts +6 -0
- package/dist/components/Table/components/Body/components/MeasureRow/MeasureRow.d.ts +5 -0
- package/dist/components/Table/components/Body/components/MeasureRow/MeasureRow.js +87 -0
- package/dist/components/Table/components/Body/components/MeasureRow/MeasureRow.types.d.ts +2 -0
- package/dist/components/Table/components/Body/components/MeasureRow/MeasureRow.utils.d.ts +4 -0
- package/dist/components/Table/components/Body/components/MeasureRow/MeasureRow.utils.js +13 -0
- package/dist/components/Table/components/Cell/Cell.d.ts +3 -0
- package/dist/components/Table/components/Cell/Cell.js +25 -0
- package/dist/components/Table/components/Cell/Cell.styles.d.ts +28 -0
- package/dist/components/Table/components/Cell/Cell.styles.js +31 -0
- package/dist/components/Table/components/Cell/Cell.types.d.ts +16 -0
- package/dist/components/Table/components/EmptyDataRow/EmptyDataRow.d.ts +3 -0
- package/dist/components/Table/components/EmptyDataRow/EmptyDataRow.js +69 -0
- package/dist/components/Table/components/EmptyDataRow/EmptyDataRow.styles.d.ts +15 -0
- package/dist/components/Table/components/EmptyDataRow/EmptyDataRow.styles.js +26 -0
- package/dist/components/Table/components/EmptyDataRow/EmptyDataRow.types.d.ts +2 -0
- package/dist/components/Table/components/EmptyDataRow/EmptyDataRow.utils.d.ts +7 -0
- package/dist/components/Table/components/EmptyDataRow/EmptyDataRow.utils.js +17 -0
- package/dist/components/Table/components/FixedHeader/FixedHeader.d.ts +2 -0
- package/dist/components/Table/components/FixedHeader/FixedHeader.js +25 -0
- package/dist/components/Table/components/FixedHeader/FixedHeader.types.d.ts +6 -0
- package/dist/components/Table/components/FixedHeader/components/FixedHeaderColGroup/FixedHeaderColGroup.d.ts +3 -0
- package/dist/components/Table/components/FixedHeader/components/FixedHeaderColGroup/FixedHeaderColGroup.js +33 -0
- package/dist/components/Table/components/FixedHeader/components/FixedHeaderColGroup/FixedHeaderColGroup.types.d.ts +2 -0
- package/dist/components/Table/components/Header/Header.d.ts +3 -0
- package/dist/components/Table/components/Header/Header.js +23 -0
- package/dist/components/Table/components/Header/Header.styles.d.ts +4 -0
- package/dist/components/Table/components/Header/Header.styles.js +6 -0
- package/dist/components/Table/components/Header/Header.types.d.ts +15 -0
- package/dist/components/Table/components/Header/components/HeaderCell/HeaderCell.d.ts +3 -0
- package/dist/components/Table/components/Header/components/HeaderCell/HeaderCell.js +63 -0
- package/dist/components/Table/components/Header/components/HeaderCell/HeaderCell.styles.d.ts +21 -0
- package/dist/components/Table/components/Header/components/HeaderCell/HeaderCell.styles.js +25 -0
- package/dist/components/Table/components/Header/components/HeaderCell/HeaderCell.types.d.ts +6 -0
- package/dist/components/Table/components/Header/components/HeaderCell/HeaderCell.utils.d.ts +2 -0
- package/dist/components/Table/components/Header/components/HeaderCell/HeaderCell.utils.js +4 -0
- package/dist/components/Table/components/Header/components/HeaderRow/HeaderRow.d.ts +3 -0
- package/dist/components/Table/components/Header/components/HeaderRow/HeaderRow.js +34 -0
- package/dist/components/Table/components/Header/components/HeaderRow/HeaderRow.styles.d.ts +6 -0
- package/dist/components/Table/components/Header/components/HeaderRow/HeaderRow.styles.js +8 -0
- package/dist/components/Table/components/Header/components/HeaderRow/HeaderRow.types.d.ts +6 -0
- package/dist/components/Table/components/Header/utils/index.d.ts +1 -0
- package/dist/components/Table/components/Header/utils/parseHeaderRows/parseHeaderRows.d.ts +4 -0
- package/dist/components/Table/components/Header/utils/parseHeaderRows/parseHeaderRows.js +50 -0
- package/dist/components/Table/contexts/index.d.ts +3 -0
- package/dist/components/Table/contexts/tableContext/TableContext.d.ts +3 -0
- package/dist/components/Table/contexts/tableContext/TableContext.js +21 -0
- package/dist/components/Table/contexts/tableContext/TableContext.types.d.ts +27 -0
- package/dist/components/Table/contexts/tableContext/useTableContext/useTableContext.d.ts +2 -0
- package/dist/components/Table/contexts/tableContext/useTableContext/useTableContext.js +8 -0
- package/dist/components/Table/features/tableExpand/components/DefaultExpandIcon/DefaultExpandIcon.d.ts +3 -0
- package/dist/components/Table/features/tableExpand/components/DefaultExpandIcon/DefaultExpandIcon.js +23 -0
- package/dist/components/Table/features/tableExpand/components/DefaultExpandIcon/DefaultExpandIcon.styles.d.ts +19 -0
- package/dist/components/Table/features/tableExpand/components/DefaultExpandIcon/DefaultExpandIcon.styles.js +22 -0
- package/dist/components/Table/features/tableExpand/components/DefaultExpandIcon/DefaultExpandIcon.types.d.ts +3 -0
- package/dist/components/Table/features/tableExpand/components/ExpandIconWrapper/ExpandIconWrapper.d.ts +3 -0
- package/dist/components/Table/features/tableExpand/components/ExpandIconWrapper/ExpandIconWrapper.js +24 -0
- package/dist/components/Table/features/tableExpand/components/ExpandIconWrapper/ExpandIconWrapper.types.d.ts +5 -0
- package/dist/components/Table/features/tableExpand/contexts/index.d.ts +3 -0
- package/dist/components/Table/features/tableExpand/contexts/tableExpandedContext/TableExpandedContext.d.ts +2 -0
- package/dist/components/Table/features/tableExpand/contexts/tableExpandedContext/TableExpandedContext.js +9 -0
- package/dist/components/Table/features/tableExpand/contexts/tableExpandedContext/TableExpandedContext.types.d.ts +7 -0
- package/dist/components/Table/features/tableExpand/contexts/tableExpandedContext/useTableExpandedContext/useTableExpandedContext.d.ts +1 -0
- package/dist/components/Table/features/tableExpand/contexts/tableExpandedContext/useTableExpandedContext/useTableExpandedContext.js +8 -0
- package/dist/components/Table/features/tableExpand/hooks/index.d.ts +2 -0
- package/dist/components/Table/features/tableExpand/hooks/useBodyExpand/useBodyExpand.d.ts +6 -0
- package/dist/components/Table/features/tableExpand/hooks/useBodyExpand/useBodyExpand.js +38 -0
- package/dist/components/Table/features/tableExpand/hooks/useBodyExpand/useBodyExpand.types.d.ts +3 -0
- package/dist/components/Table/features/tableExpand/hooks/useTableExpand/useTableExpand.d.ts +8 -0
- package/dist/components/Table/features/tableExpand/hooks/useTableExpand/useTableExpand.js +26 -0
- package/dist/components/Table/features/tableExpand/hooks/useTableExpand/useTableExpand.types.d.ts +3 -0
- package/dist/components/Table/features/tableExpand/index.d.ts +4 -0
- package/dist/components/Table/features/tableExpand/types.d.ts +16 -0
- package/dist/components/Table/features/tableRowSelection/components/CheckboxCellContentWrapper/CheckboxCellContentWrapper.d.ts +3 -0
- package/dist/components/Table/features/tableRowSelection/components/CheckboxCellContentWrapper/CheckboxCellContentWrapper.js +78 -0
- package/dist/components/Table/features/tableRowSelection/components/CheckboxCellContentWrapper/CheckboxCellContentWrapper.types.d.ts +4 -0
- package/dist/components/Table/features/tableRowSelection/components/CheckboxCellContentWrapper/CheckboxCellContentWrapper.utils.d.ts +3 -0
- package/dist/components/Table/features/tableRowSelection/components/CheckboxCellContentWrapper/CheckboxCellContentWrapper.utils.js +20 -0
- package/dist/components/Table/features/tableRowSelection/components/HeaderCheckboxCellContentWrapper/HeaderCheckboxCellContentWrapper.d.ts +2 -0
- package/dist/components/Table/features/tableRowSelection/components/HeaderCheckboxCellContentWrapper/HeaderCheckboxCellContentWrapper.js +73 -0
- package/dist/components/Table/features/tableRowSelection/components/HeaderCheckboxCellContentWrapper/HeaderCheckboxCellContentWrapper.types.d.ts +5 -0
- package/dist/components/Table/features/tableRowSelection/components/RadioCellContentWrapper/RadioCellContentWrapper.d.ts +3 -0
- package/dist/components/Table/features/tableRowSelection/components/RadioCellContentWrapper/RadioCellContentWrapper.js +43 -0
- package/dist/components/Table/features/tableRowSelection/components/RadioCellContentWrapper/RadioCellContentWrapper.types.d.ts +4 -0
- package/dist/components/Table/features/tableRowSelection/contexts/index.d.ts +3 -0
- package/dist/components/Table/features/tableRowSelection/contexts/tableRowSelectionContext/TableRowSelectionContext.d.ts +2 -0
- package/dist/components/Table/features/tableRowSelection/contexts/tableRowSelectionContext/TableRowSelectionContext.js +20 -0
- package/dist/components/Table/features/tableRowSelection/contexts/tableRowSelectionContext/TableRowSelectionContext.types.d.ts +18 -0
- package/dist/components/Table/features/tableRowSelection/contexts/tableRowSelectionContext/useTableRowSelectionContext/useTableRowSelectionContext.d.ts +1 -0
- package/dist/components/Table/features/tableRowSelection/contexts/tableRowSelectionContext/useTableRowSelectionContext/useTableRowSelectionContext.js +8 -0
- package/dist/components/Table/features/tableRowSelection/hooks/index.d.ts +4 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useMultipleSelect/useMultipleSelect.d.ts +2 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useMultipleSelect/useMultipleSelect.js +32 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useMultipleSelect/useMultipleSelect.types.d.ts +4 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useTableRowSelection/useTableRowSelection.d.ts +19 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useTableRowSelection/useTableRowSelection.js +126 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useTableRowSelection/useTableRowSelection.types.d.ts +8 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useTableRowSelection/useTableRowSelection.utils.d.ts +2 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useTableRowSelection/useTableRowSelection.utils.js +13 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useTransformColumns/useTransformColumns.d.ts +6 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useTransformColumns/useTransformColumns.js +59 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useTransformColumns/useTransformColumns.types.d.ts +3 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useTransformColumns/useTransformColumns.utils.d.ts +1 -0
- package/dist/components/Table/features/tableRowSelection/hooks/useTransformColumns/useTransformColumns.utils.js +12 -0
- package/dist/components/Table/features/tableRowSelection/index.d.ts +5 -0
- package/dist/components/Table/features/tableRowSelection/styles.d.ts +16 -0
- package/dist/components/Table/features/tableRowSelection/styles.js +25 -0
- package/dist/components/Table/features/tableRowSelection/types.d.ts +24 -0
- package/dist/components/Table/features/tableRowSelection/utils/const.d.ts +1 -0
- package/dist/components/Table/features/tableRowSelection/utils/const.js +4 -0
- package/dist/components/Table/features/tableRowSelection/utils/index.d.ts +1 -0
- package/dist/components/Table/features/tableSort/components/HeaderCellWithSort/HeaderCellWithSort.d.ts +3 -0
- package/dist/components/Table/features/tableSort/components/HeaderCellWithSort/HeaderCellWithSort.js +75 -0
- package/dist/components/Table/features/tableSort/components/HeaderCellWithSort/HeaderCellWithSort.styles.d.ts +7 -0
- package/dist/components/Table/features/tableSort/components/HeaderCellWithSort/HeaderCellWithSort.styles.js +9 -0
- package/dist/components/Table/features/tableSort/components/HeaderCellWithSort/HeaderCellWithSort.types.d.ts +6 -0
- package/dist/components/Table/features/tableSort/components/SortButton/SortButton.d.ts +2 -0
- package/dist/components/Table/features/tableSort/components/SortButton/SortButton.js +27 -0
- package/dist/components/Table/features/tableSort/components/SortButton/SortButton.styles.d.ts +17 -0
- package/dist/components/Table/features/tableSort/components/SortButton/SortButton.styles.js +20 -0
- package/dist/components/Table/features/tableSort/components/SortButton/SortButton.types.d.ts +4 -0
- package/dist/components/Table/features/tableSort/hooks/index.d.ts +5 -0
- package/dist/components/Table/features/tableSort/hooks/useHeaderCellSort/useHeaderCellSort.d.ts +6 -0
- package/dist/components/Table/features/tableSort/hooks/useHeaderCellSort/useHeaderCellSort.js +47 -0
- package/dist/components/Table/features/tableSort/hooks/useHeaderCellSort/useHeaderCellSort.types.d.ts +7 -0
- package/dist/components/Table/features/tableSort/hooks/useHeaderCellSort/useHeaderCellSort.utils.d.ts +2 -0
- package/dist/components/Table/features/tableSort/hooks/useHeaderCellSort/useHeaderCellSort.utils.js +9 -0
- package/dist/components/Table/features/tableSort/hooks/useSortState/useSortState.d.ts +5 -0
- package/dist/components/Table/features/tableSort/hooks/useSortState/useSortState.js +39 -0
- package/dist/components/Table/features/tableSort/hooks/useSortState/useSortState.types.d.ts +4 -0
- package/dist/components/Table/features/tableSort/hooks/useTableSort/useTableSort.d.ts +9 -0
- package/dist/components/Table/features/tableSort/hooks/useTableSort/useTableSort.js +54 -0
- package/dist/components/Table/features/tableSort/hooks/useTableSort/useTableSort.types.d.ts +14 -0
- package/dist/components/Table/features/tableSort/hooks/useTransformColumns/useTransformColumns.d.ts +5 -0
- package/dist/components/Table/features/tableSort/hooks/useTransformColumns/useTransformColumns.js +47 -0
- package/dist/components/Table/features/tableSort/hooks/useTransformColumns/useTransformColumns.styles.d.ts +6 -0
- package/dist/components/Table/features/tableSort/hooks/useTransformColumns/useTransformColumns.styles.js +8 -0
- package/dist/components/Table/features/tableSort/icons/ArrowFilled.d.ts +2 -0
- package/dist/components/Table/features/tableSort/icons/ArrowFilled.js +12 -0
- package/dist/components/Table/features/tableSort/icons/index.d.ts +1 -0
- package/dist/components/Table/features/tableSort/index.d.ts +5 -0
- package/dist/components/Table/features/tableSort/types.d.ts +10 -0
- package/dist/components/Table/features/tableSort/utils/const.d.ts +4 -0
- package/dist/components/Table/features/tableSort/utils/const.js +8 -0
- package/dist/components/Table/features/tableSort/utils/getSortFunction/getSortFunction.d.ts +2 -0
- package/dist/components/Table/features/tableSort/utils/getSortFunction/getSortFunction.js +9 -0
- package/dist/components/Table/features/tableSort/utils/getSortFunction/index.d.ts +1 -0
- package/dist/components/Table/features/tableSort/utils/getSortedData/getSortedData.d.ts +3 -0
- package/dist/components/Table/features/tableSort/utils/getSortedData/getSortedData.js +48 -0
- package/dist/components/Table/features/tableSort/utils/getSortedData/index.d.ts +1 -0
- package/dist/components/Table/features/tableSort/utils/index.d.ts +2 -0
- package/dist/components/Table/features/tableStaticContext/contexts/index.d.ts +1 -0
- package/dist/components/Table/features/tableStaticContext/contexts/tableStaticContext/TableStaticContext.d.ts +21 -0
- package/dist/components/Table/features/tableStaticContext/contexts/tableStaticContext/TableStaticContext.js +29 -0
- package/dist/components/Table/features/tableStaticContext/contexts/tableStaticContext/TableStaticContext.types.d.ts +24 -0
- package/dist/components/Table/features/tableStaticContext/contexts/tableStaticContext/useTableStaticContext/useTableStaticContext.d.ts +2 -0
- package/dist/components/Table/features/tableStaticContext/contexts/tableStaticContext/useTableStaticContext/useTableStaticContext.js +8 -0
- package/dist/components/Table/features/tableStaticContext/hocs/index.d.ts +1 -0
- package/dist/components/Table/features/tableStaticContext/hocs/withTableStaticContext.d.ts +3 -0
- package/dist/components/Table/features/tableStaticContext/hocs/withTableStaticContext.js +15 -0
- package/dist/components/Table/features/tableStaticContext/index.d.ts +2 -0
- package/dist/components/Table/features/typedEventBus/hooks.d.ts +3 -0
- package/dist/components/Table/features/typedEventBus/hooks.js +8 -0
- package/dist/components/Table/features/typedEventBus/index.d.ts +2 -0
- package/dist/components/Table/features/typedEventBus/types.d.ts +22 -0
- package/dist/components/Table/forStories/components.d.ts +2 -0
- package/dist/components/Table/forStories/example_1.d.ts +11 -0
- package/dist/components/Table/forStories/example_2.d.ts +11 -0
- package/dist/components/Table/forStories/example_3.d.ts +10 -0
- package/dist/components/Table/forStories/example_4.d.ts +10 -0
- package/dist/components/Table/forStories/example_5.d.ts +9 -0
- package/dist/components/Table/forStories/example_6.d.ts +9 -0
- package/dist/components/Table/forStories/example_7.d.ts +9 -0
- package/dist/components/Table/forStories/index.d.ts +7 -0
- package/dist/components/Table/hooks/useBodyCellRender/index.d.ts +1 -0
- package/dist/components/Table/hooks/useBodyCellRender/useBodyCellRender.d.ts +4 -0
- package/dist/components/Table/hooks/useBodyCellRender/useBodyCellRender.js +27 -0
- package/dist/components/Table/hooks/useBodyCellRender/useBodyCellRender.types.d.ts +7 -0
- package/dist/components/Table/hooks/useBodyFlattenData/index.d.ts +1 -0
- package/dist/components/Table/hooks/useBodyFlattenData/useBodyFlattenData.d.ts +5 -0
- package/dist/components/Table/hooks/useBodyFlattenData/useBodyFlattenData.js +31 -0
- package/dist/components/Table/hooks/useBodyFlattenData/useBodyFlattenData.types.d.ts +11 -0
- package/dist/components/Table/hooks/useBodyFlattenData/useBodyFlattenData.utils.d.ts +3 -0
- package/dist/components/Table/hooks/useBodyFlattenData/useBodyFlattenData.utils.js +19 -0
- package/dist/components/Table/hooks/useCellFixedInfo/index.d.ts +3 -0
- package/dist/components/Table/hooks/useCellFixedInfo/useCellFixedInfo.d.ts +12 -0
- package/dist/components/Table/hooks/useCellFixedInfo/useCellFixedInfo.js +117 -0
- package/dist/components/Table/hooks/useCellFixedInfo/useCellFixedInfo.styles.d.ts +26 -0
- package/dist/components/Table/hooks/useCellFixedInfo/useCellFixedInfo.styles.js +33 -0
- package/dist/components/Table/hooks/useCellFixedInfo/useCellFixedInfo.types.d.ts +19 -0
- package/dist/components/Table/hooks/useCellFixedInfo/useCellFixedInfo.utils.d.ts +9 -0
- package/dist/components/Table/hooks/useCellFixedInfo/useCellFixedInfo.utils.js +75 -0
- package/dist/components/Table/hooks/useCellHover/index.d.ts +1 -0
- package/dist/components/Table/hooks/useCellHover/useCellHover.d.ts +8 -0
- package/dist/components/Table/hooks/useCellHover/useCellHover.js +34 -0
- package/dist/components/Table/hooks/useCellHover/useCellHover.types.d.ts +5 -0
- package/dist/components/Table/hooks/useCellHover/useCellHover.utils.d.ts +1 -0
- package/dist/components/Table/hooks/useCellHover/useCellHover.utils.js +7 -0
- package/dist/components/Table/hooks/useTableColumns/index.d.ts +1 -0
- package/dist/components/Table/hooks/useTableColumns/useTableColumns.d.ts +7 -0
- package/dist/components/Table/hooks/useTableColumns/useTableColumns.js +39 -0
- package/dist/components/Table/hooks/useTableColumns/useTableColumns.types.d.ts +4 -0
- package/dist/components/Table/hooks/useTableColumns/useTableColumns.utils.d.ts +2 -0
- package/dist/components/Table/hooks/useTableColumns/useTableColumns.utils.js +24 -0
- package/dist/components/Table/hooks/useTableComponents/index.d.ts +1 -0
- package/dist/components/Table/hooks/useTableComponents/useTableComponents.d.ts +6 -0
- package/dist/components/Table/hooks/useTableComponents/useTableComponents.js +14 -0
- package/dist/components/Table/hooks/useTableComponents/useTableComponents.types.d.ts +3 -0
- package/dist/components/Table/hooks/useTableVisualParamsChange/index.d.ts +1 -0
- package/dist/components/Table/hooks/useTableVisualParamsChange/types.d.ts +4 -0
- package/dist/components/Table/hooks/useTableVisualParamsChange/useTableVisualParamsChange.d.ts +12 -0
- package/dist/components/Table/hooks/useTableVisualParamsChange/useTableVisualParamsChange.js +116 -0
- package/dist/components/Table/hooks/useTableVisualParamsChange/utils.d.ts +3 -0
- package/dist/components/Table/hooks/useTableVisualParamsChange/utils.js +35 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/interfaces/tableColumns.types.d.ts +45 -0
- package/dist/components/Table/interfaces/tableComponents.types.d.ts +28 -0
- package/dist/components/Table/utils/getRowKey/getRowKey.d.ts +2 -0
- package/dist/components/Table/utils/getRowKey/getRowKey.js +4 -0
- package/dist/components/Table/utils/getRowKey/index.d.ts +2 -0
- package/dist/components/Table/utils/getRowKey/types.d.ts +2 -0
- package/dist/components/Table/utils/index.d.ts +2 -0
- package/dist/components/Table/utils/ref/index.d.ts +1 -0
- package/dist/components/Table/utils/ref/ref.d.ts +5 -0
- package/dist/components/Table/utils/ref/ref.js +16 -0
- package/dist/components/Table/utils/ref/types.d.ts +10 -0
- package/dist/hooks/useEvent/index.d.ts +1 -0
- package/dist/hooks/useEvent/useEvent.d.ts +2 -0
- package/dist/hooks/useEvent/useEvent.js +9 -0
- package/dist/hooks/useEvent/useEvent.types.d.ts +1 -0
- package/dist/hooks/useFirstMount/index.d.ts +1 -0
- package/dist/hooks/useFirstMount/useFirstMount.d.ts +1 -0
- package/dist/hooks/useFirstMount/useFirstMount.js +12 -0
- package/dist/hooks/useStatic/index.d.ts +1 -0
- package/dist/hooks/useStatic/useStatic.d.ts +1 -0
- package/dist/hooks/useStatic/useStatic.js +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/utils/eventBus/context/EventBusContext.d.ts +2 -0
- package/dist/utils/eventBus/context/EventBusContext.js +5 -0
- package/dist/utils/eventBus/context/EventBusContext.types.d.ts +5 -0
- package/dist/utils/eventBus/eventBus.d.ts +10 -0
- package/dist/utils/eventBus/eventBus.js +47 -0
- package/dist/utils/eventBus/hocs/withEventBus/index.d.ts +1 -0
- package/dist/utils/eventBus/hocs/withEventBus/withEventBus.d.ts +2 -0
- package/dist/utils/eventBus/hocs/withEventBus/withEventBus.js +15 -0
- package/dist/utils/eventBus/hooks/useEmitter/useEmitter.d.ts +2 -0
- package/dist/utils/eventBus/hooks/useEmitter/useEmitter.js +8 -0
- package/dist/utils/eventBus/hooks/useEventBus/useEventBus.d.ts +3 -0
- package/dist/utils/eventBus/hooks/useEventBus/useEventBus.js +12 -0
- package/dist/utils/eventBus/hooks/useSubscribe/useSubscribe.d.ts +3 -0
- package/dist/utils/eventBus/hooks/useSubscribe/useSubscribe.js +18 -0
- package/dist/utils/eventBus/index.d.ts +6 -0
- package/dist/utils/eventBus/provider/EventBusProvider.d.ts +3 -0
- package/dist/utils/eventBus/provider/EventBusProvider.js +16 -0
- package/dist/utils/eventBus/provider/EventBusProvider.types.d.ts +6 -0
- package/dist/utils/eventBus/types.d.ts +6 -0
- package/package.json +7 -6
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { DefaultRecord } from 'components/Table/Table.types';
|
|
3
|
+
import { HeaderCell } from 'components/Table/components/Header/Header.types';
|
|
4
|
+
export interface HeaderCellWithSortProps<Record extends DefaultRecord> extends PropsWithChildren {
|
|
5
|
+
cell: HeaderCell<Record>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsxs, jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { sortButtonStyle, getAscendArrowStyle, getDescendArrowStyle } from "./SortButton.styles.js";
|
|
3
|
+
import { useTheme } from "../../../../../../hooks/useTheme/useTheme.js";
|
|
4
|
+
import { useSortState } from "../../hooks/useSortState/useSortState.js";
|
|
5
|
+
import { ArrowFilled } from "../../icons/ArrowFilled.js";
|
|
6
|
+
const SortButtonComponent = (props) => {
|
|
7
|
+
const {
|
|
8
|
+
column
|
|
9
|
+
} = props;
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
const {
|
|
12
|
+
sortOrder,
|
|
13
|
+
sortDirections
|
|
14
|
+
} = useSortState({
|
|
15
|
+
column
|
|
16
|
+
});
|
|
17
|
+
const hasAscendOrder = sortDirections.includes("ascend");
|
|
18
|
+
const hasDescendOrder = sortDirections.includes("descend");
|
|
19
|
+
return /* @__PURE__ */ jsxs("span", { className: "column-sorter-inner", "aria-hidden": "true", css: sortButtonStyle(theme), children: [
|
|
20
|
+
hasAscendOrder && /* @__PURE__ */ jsx(ArrowFilled, { css: getAscendArrowStyle(sortOrder)(theme) }),
|
|
21
|
+
hasDescendOrder && /* @__PURE__ */ jsx(ArrowFilled, { css: getDescendArrowStyle(sortOrder)(theme) })
|
|
22
|
+
] });
|
|
23
|
+
};
|
|
24
|
+
const SortButton = SortButtonComponent;
|
|
25
|
+
export {
|
|
26
|
+
SortButton
|
|
27
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Theme } from 'themes';
|
|
2
|
+
import { SortOrder } from '../../types';
|
|
3
|
+
export declare const sortButtonStyle: (theme: Theme) => {
|
|
4
|
+
readonly display: "inline-flex";
|
|
5
|
+
readonly flexDirection: "column";
|
|
6
|
+
readonly rowGap: 2;
|
|
7
|
+
readonly paddingInline: 3.5;
|
|
8
|
+
readonly paddingBlock: 4;
|
|
9
|
+
readonly color: `rgba(${number}, ${number}, ${number}, 0.3)`;
|
|
10
|
+
};
|
|
11
|
+
export declare const getAscendArrowStyle: (sortOrder: SortOrder) => (theme: Theme) => {
|
|
12
|
+
color: "#0CB3B3" | undefined;
|
|
13
|
+
};
|
|
14
|
+
export declare const getDescendArrowStyle: (sortOrder: SortOrder) => (theme: Theme) => {
|
|
15
|
+
color: "#0CB3B3" | undefined;
|
|
16
|
+
transform: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sortButtonStyle = (theme) => ({
|
|
2
|
+
display: "inline-flex",
|
|
3
|
+
flexDirection: "column",
|
|
4
|
+
rowGap: theme.x05,
|
|
5
|
+
paddingInline: 3.5,
|
|
6
|
+
paddingBlock: theme.paddingXS,
|
|
7
|
+
color: theme.textIcon
|
|
8
|
+
});
|
|
9
|
+
const getAscendArrowStyle = (sortOrder) => (theme) => ({
|
|
10
|
+
color: sortOrder === "ascend" ? theme.primaryBase : void 0
|
|
11
|
+
});
|
|
12
|
+
const getDescendArrowStyle = (sortOrder) => (theme) => ({
|
|
13
|
+
color: sortOrder === "descend" ? theme.primaryBase : void 0,
|
|
14
|
+
transform: "rotate(180deg)"
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
getAscendArrowStyle,
|
|
18
|
+
getDescendArrowStyle,
|
|
19
|
+
sortButtonStyle
|
|
20
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useTableSort } from './useTableSort/useTableSort';
|
|
2
|
+
export type { SorterResult } from './useTableSort/useTableSort.types';
|
|
3
|
+
export { useTransformColumns } from './useTransformColumns/useTransformColumns';
|
|
4
|
+
export { useHeaderCellSort } from './useHeaderCellSort/useHeaderCellSort';
|
|
5
|
+
export { useSortState } from './useSortState/useSortState';
|
package/dist/components/Table/features/tableSort/hooks/useHeaderCellSort/useHeaderCellSort.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseHeaderCellSortOptions } from './useHeaderCellSort.types';
|
|
2
|
+
import { DefaultRecord } from 'components/Table/Table.types';
|
|
3
|
+
export declare const useHeaderCellSort: <Record extends DefaultRecord>(options: UseHeaderCellSortOptions<Record>) => {
|
|
4
|
+
onClick: import('react').MouseEventHandler<HTMLTableCellElement>;
|
|
5
|
+
onKeyDown: import('react').KeyboardEventHandler<HTMLTableCellElement>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { nextSortDirection } from "./useHeaderCellSort.utils.js";
|
|
2
|
+
import { useSortState } from "../useSortState/useSortState.js";
|
|
3
|
+
import { useTableStaticContext } from "../../../tableStaticContext/contexts/tableStaticContext/useTableStaticContext/useTableStaticContext.js";
|
|
4
|
+
import { getRefValue } from "../../../../utils/ref/ref.js";
|
|
5
|
+
const useHeaderCellSort = (options) => {
|
|
6
|
+
const {
|
|
7
|
+
column,
|
|
8
|
+
onClick,
|
|
9
|
+
onKeyDown
|
|
10
|
+
} = options;
|
|
11
|
+
const staticContextRef = useTableStaticContext();
|
|
12
|
+
const columnKey = column.key;
|
|
13
|
+
const {
|
|
14
|
+
sortOrder,
|
|
15
|
+
sortDirections
|
|
16
|
+
} = useSortState({
|
|
17
|
+
column
|
|
18
|
+
});
|
|
19
|
+
const nextSortOrder = nextSortDirection(sortDirections, sortOrder);
|
|
20
|
+
const handleClick = (e) => {
|
|
21
|
+
const triggerSorter = getRefValue(staticContextRef, "triggerSorter");
|
|
22
|
+
triggerSorter({
|
|
23
|
+
column,
|
|
24
|
+
key: columnKey,
|
|
25
|
+
sortOrder: nextSortOrder
|
|
26
|
+
});
|
|
27
|
+
onClick == null ? void 0 : onClick(e);
|
|
28
|
+
};
|
|
29
|
+
const handleKeyDown = (e) => {
|
|
30
|
+
if (e.code === "Enter") {
|
|
31
|
+
const triggerSorter = getRefValue(staticContextRef, "triggerSorter");
|
|
32
|
+
triggerSorter({
|
|
33
|
+
column,
|
|
34
|
+
key: columnKey,
|
|
35
|
+
sortOrder: nextSortOrder
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
onClick: handleClick,
|
|
42
|
+
onKeyDown: handleKeyDown
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
useHeaderCellSort
|
|
47
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Column } from 'components/Table/interfaces/tableColumns.types';
|
|
2
|
+
import { KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
3
|
+
export interface UseHeaderCellSortOptions<Record> {
|
|
4
|
+
column: Column<Record>;
|
|
5
|
+
onClick: MouseEventHandler<HTMLTableCellElement> | undefined;
|
|
6
|
+
onKeyDown: KeyboardEventHandler<HTMLTableCellElement> | undefined;
|
|
7
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { useTableContext } from "../../../../contexts/tableContext/useTableContext/useTableContext.js";
|
|
3
|
+
import { useTableStaticContext } from "../../../tableStaticContext/contexts/tableStaticContext/useTableStaticContext/useTableStaticContext.js";
|
|
4
|
+
import { getRefValue } from "../../../../utils/ref/ref.js";
|
|
5
|
+
import { useSubscribe } from "../../../typedEventBus/hooks.js";
|
|
6
|
+
const useSortState = (options) => {
|
|
7
|
+
const {
|
|
8
|
+
column
|
|
9
|
+
} = options;
|
|
10
|
+
const {
|
|
11
|
+
sortDirections: columnSortDirections,
|
|
12
|
+
key: columnKey
|
|
13
|
+
} = column;
|
|
14
|
+
const {
|
|
15
|
+
sortDirections: tableSortDirections
|
|
16
|
+
} = useTableContext();
|
|
17
|
+
const sortDirections = columnSortDirections || tableSortDirections;
|
|
18
|
+
const staticContextRef = useTableStaticContext();
|
|
19
|
+
const [sortOrder, setSortOrder] = useState(() => {
|
|
20
|
+
const sortState = getRefValue(staticContextRef, "sortState");
|
|
21
|
+
if (!sortState) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
return sortState.key === columnKey ? sortState.sortOrder : void 0;
|
|
25
|
+
});
|
|
26
|
+
useSubscribe("sort", (value) => {
|
|
27
|
+
const {
|
|
28
|
+
sortState
|
|
29
|
+
} = value;
|
|
30
|
+
setSortOrder(sortState ? sortState.key === columnKey ? sortState.sortOrder : void 0 : void 0);
|
|
31
|
+
}, false, [columnKey]);
|
|
32
|
+
return {
|
|
33
|
+
sortOrder,
|
|
34
|
+
sortDirections
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
useSortState
|
|
39
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UseTableSortOptions } from './useTableSort.types';
|
|
2
|
+
import { DefaultRecord } from 'components/Table/Table.types';
|
|
3
|
+
import { SortState } from '../../types';
|
|
4
|
+
export declare const useTableSort: <Record extends DefaultRecord>(options: UseTableSortOptions<Record>) => {
|
|
5
|
+
triggerSorter: (sortState: SortState<Record>) => void;
|
|
6
|
+
sortState: SortState<Record> | undefined;
|
|
7
|
+
sortedData: Record[];
|
|
8
|
+
hasData: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useState, useMemo } from "react";
|
|
2
|
+
import { useEvent } from "../../../../../../hooks/useEvent/useEvent.js";
|
|
3
|
+
import { useTableStaticContext } from "../../../tableStaticContext/contexts/tableStaticContext/useTableStaticContext/useTableStaticContext.js";
|
|
4
|
+
import { getRefValue } from "../../../../utils/ref/ref.js";
|
|
5
|
+
import { useEmitter } from "../../../typedEventBus/hooks.js";
|
|
6
|
+
import { useFirstMountLayoutEffect } from "../../../../../../hooks/useFirstMountLayoutEffect/useFirstMountLayoutEffect.js";
|
|
7
|
+
import { getSortedData } from "../../utils/getSortedData/getSortedData.js";
|
|
8
|
+
const useTableSort = (options) => {
|
|
9
|
+
const {
|
|
10
|
+
onChange,
|
|
11
|
+
dataSource
|
|
12
|
+
} = options;
|
|
13
|
+
const staticContextRef = useTableStaticContext();
|
|
14
|
+
const [sortState, setSortState] = useState(() => getRefValue(staticContextRef, "initialSortState"));
|
|
15
|
+
const emitSort = useEvent(useEmitter("sort"));
|
|
16
|
+
useFirstMountLayoutEffect((firstMount) => {
|
|
17
|
+
if (firstMount) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
emitSort({
|
|
21
|
+
sortState
|
|
22
|
+
});
|
|
23
|
+
}, [emitSort, sortState]);
|
|
24
|
+
const sortedData = useMemo(() => getSortedData(dataSource, sortState), [dataSource, sortState]);
|
|
25
|
+
const hasData = Boolean(sortedData.length);
|
|
26
|
+
const triggerSorter = (sortState2) => {
|
|
27
|
+
setSortState(sortState2);
|
|
28
|
+
const {
|
|
29
|
+
key,
|
|
30
|
+
column,
|
|
31
|
+
sortOrder
|
|
32
|
+
} = sortState2;
|
|
33
|
+
onChange == null ? void 0 : onChange(sortOrder ? {
|
|
34
|
+
columnKey: key,
|
|
35
|
+
column,
|
|
36
|
+
field: column.dataIndex,
|
|
37
|
+
order: sortOrder
|
|
38
|
+
} : {
|
|
39
|
+
columnKey: void 0,
|
|
40
|
+
column: void 0,
|
|
41
|
+
field: void 0,
|
|
42
|
+
order: void 0
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
triggerSorter,
|
|
47
|
+
sortState,
|
|
48
|
+
sortedData,
|
|
49
|
+
hasData
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
useTableSort
|
|
54
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Column } from 'components/Table/interfaces/tableColumns.types';
|
|
2
|
+
import { DefaultRecord, Key, TableProps } from 'components/Table/Table.types';
|
|
3
|
+
import { SortOrder } from '../../types';
|
|
4
|
+
import { PropertyPath } from 'lodash-es';
|
|
5
|
+
export interface UseTableSortOptions<Record extends DefaultRecord> {
|
|
6
|
+
onChange: TableProps<Record>["onChange"];
|
|
7
|
+
dataSource: TableProps<Record>["dataSource"];
|
|
8
|
+
}
|
|
9
|
+
export interface SorterResult<Record> {
|
|
10
|
+
column?: Column<Record>;
|
|
11
|
+
order?: SortOrder;
|
|
12
|
+
field?: PropertyPath;
|
|
13
|
+
columnKey?: Key;
|
|
14
|
+
}
|
package/dist/components/Table/features/tableSort/hooks/useTransformColumns/useTransformColumns.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DefaultRecord } from 'components/Table/Table.types';
|
|
2
|
+
import { ColumnsTransformer } from 'components/Table/interfaces/tableColumns.types';
|
|
3
|
+
export declare const useTransformColumns: <Record extends DefaultRecord>() => {
|
|
4
|
+
transformColumns: ColumnsTransformer<Record>;
|
|
5
|
+
};
|
package/dist/components/Table/features/tableSort/hooks/useTransformColumns/useTransformColumns.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsxs, jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { SortButton } from "../../components/SortButton/SortButton.js";
|
|
4
|
+
import { sorterTitleWrapperStyle } from "./useTransformColumns.styles.js";
|
|
5
|
+
import { useTheme } from "../../../../../../hooks/useTheme/useTheme.js";
|
|
6
|
+
import { useTableStaticContext } from "../../../tableStaticContext/contexts/tableStaticContext/useTableStaticContext/useTableStaticContext.js";
|
|
7
|
+
import { getRefValue, updateRefValue } from "../../../../utils/ref/ref.js";
|
|
8
|
+
const useTransformColumns = () => {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const staticContextRef = useTableStaticContext();
|
|
11
|
+
const transformColumns = useCallback((columns) => {
|
|
12
|
+
function processColumns(columns2) {
|
|
13
|
+
return columns2.map((_column) => {
|
|
14
|
+
const column = {
|
|
15
|
+
..._column
|
|
16
|
+
};
|
|
17
|
+
if (column.sorter) {
|
|
18
|
+
column.title = /* @__PURE__ */ jsxs("div", { css: sorterTitleWrapperStyle(theme), children: [
|
|
19
|
+
column.title,
|
|
20
|
+
/* @__PURE__ */ jsx(SortButton, { column })
|
|
21
|
+
] });
|
|
22
|
+
const initialSortState = getRefValue(staticContextRef, "initialSortState");
|
|
23
|
+
if (!initialSortState && column.defaultSortOrder) {
|
|
24
|
+
updateRefValue(staticContextRef, {
|
|
25
|
+
initialSortState: {
|
|
26
|
+
column,
|
|
27
|
+
key: column.key,
|
|
28
|
+
sortOrder: column.defaultSortOrder
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if ("children" in column) {
|
|
34
|
+
column.children = processColumns(column.children);
|
|
35
|
+
}
|
|
36
|
+
return column;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return processColumns(columns);
|
|
40
|
+
}, [staticContextRef, theme]);
|
|
41
|
+
return {
|
|
42
|
+
transformColumns
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
useTransformColumns
|
|
47
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Icon } from "@infomaximum/icons";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
const Arrow = (props) => {
|
|
5
|
+
return /* @__PURE__ */ jsx("svg", { ...props, width: "9", height: "5", viewBox: "0 0 9 5", children: /* @__PURE__ */ jsx("path", { d: "M7.9,5 H1.1 C0.7,5,0.5,4.5,0.8,4.2 l3.4,-3.8 c0.2,-0.2,0.5,-0.2,0.7,0 l3.4,3.8 C8.5,4.5,8.3,5,7.9,5 Z" }) });
|
|
6
|
+
};
|
|
7
|
+
const ArrowFilled = forwardRef((props, ref) => {
|
|
8
|
+
return /* @__PURE__ */ jsx(Icon, { component: Arrow, name: "arrow", ref, ...props });
|
|
9
|
+
});
|
|
10
|
+
export {
|
|
11
|
+
ArrowFilled
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ArrowFilled } from './ArrowFilled';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { defaultSortDirections, defaultRowSelectionColumnWidth, defaultIndentSize, getSortFunction, } from './utils';
|
|
2
|
+
export { useTableSort, useTransformColumns, type SorterResult, useHeaderCellSort, useSortState, } from './hooks';
|
|
3
|
+
export type { SortState, SortOrder, CompareFn } from './types';
|
|
4
|
+
export { ArrowFilled } from './icons';
|
|
5
|
+
export { HeaderCellWithSort } from './components/HeaderCellWithSort/HeaderCellWithSort';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Column } from 'components/Table/interfaces/tableColumns.types';
|
|
2
|
+
import { Key } from 'components/Table/Table.types';
|
|
3
|
+
export type SortOrder = "descend" | "ascend" | undefined;
|
|
4
|
+
export type CompareFn<Record> = (a: Record, b: Record, sortOrder?: SortOrder) => number;
|
|
5
|
+
export type Sorter<Record> = boolean | CompareFn<Record>;
|
|
6
|
+
export interface SortState<Record> {
|
|
7
|
+
column: Column<Record>;
|
|
8
|
+
key: Key;
|
|
9
|
+
sortOrder: SortOrder;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getSortFunction } from './getSortFunction';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { getSortFunction } from "../getSortFunction/getSortFunction.js";
|
|
2
|
+
const getSortedData = (data, sortState) => {
|
|
3
|
+
const innerSorterStates = sortState ? [sortState] : [];
|
|
4
|
+
const cloneData = data.slice();
|
|
5
|
+
const runningSorters = innerSorterStates.filter(({
|
|
6
|
+
column: {
|
|
7
|
+
sorter
|
|
8
|
+
},
|
|
9
|
+
sortOrder
|
|
10
|
+
}) => {
|
|
11
|
+
const sortFn = getSortFunction(sorter);
|
|
12
|
+
return sortFn && sortOrder;
|
|
13
|
+
});
|
|
14
|
+
if (!runningSorters.length) {
|
|
15
|
+
return cloneData;
|
|
16
|
+
}
|
|
17
|
+
return cloneData.sort((record1, record2) => {
|
|
18
|
+
for (let i = 0; i < runningSorters.length; i += 1) {
|
|
19
|
+
const sorterState = runningSorters[i];
|
|
20
|
+
const {
|
|
21
|
+
column: {
|
|
22
|
+
sorter
|
|
23
|
+
},
|
|
24
|
+
sortOrder
|
|
25
|
+
} = sorterState;
|
|
26
|
+
const compareFn = getSortFunction(sorter);
|
|
27
|
+
if (compareFn && sortOrder) {
|
|
28
|
+
const compareResult = compareFn(record1, record2, sortOrder);
|
|
29
|
+
if (compareResult !== 0) {
|
|
30
|
+
return sortOrder === "ascend" ? compareResult : -compareResult;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return 0;
|
|
35
|
+
}).map((record) => {
|
|
36
|
+
const subRecords = record.children;
|
|
37
|
+
if (subRecords) {
|
|
38
|
+
return {
|
|
39
|
+
...record,
|
|
40
|
+
children: getSortedData(subRecords, sortState)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return record;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
getSortedData
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getSortedData } from './getSortedData';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTableStaticContext } from './tableStaticContext/useTableStaticContext/useTableStaticContext';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TableStaticContextValue } from './TableStaticContext.types';
|
|
2
|
+
import { DefaultRecord } from 'components/Table/Table.types';
|
|
3
|
+
export declare const initialTableStaticContextValue: {
|
|
4
|
+
readonly staticSelectedKeySet: Set<import('react').Key>;
|
|
5
|
+
readonly triggerSorter: (...args: any[]) => void;
|
|
6
|
+
readonly sortState: undefined;
|
|
7
|
+
readonly colsWidthsMap: Map<any, any>;
|
|
8
|
+
readonly isTableFirstMount: true;
|
|
9
|
+
readonly measureCellsInfo: {
|
|
10
|
+
readonly start: readonly [];
|
|
11
|
+
readonly end: readonly [];
|
|
12
|
+
readonly widths: readonly [];
|
|
13
|
+
};
|
|
14
|
+
readonly scrollableTableSectionInfo: {
|
|
15
|
+
readonly clientWidth: 0;
|
|
16
|
+
readonly horizontalScrollPositionRange: readonly [0, 0];
|
|
17
|
+
readonly verticalScrollBarWidth: 0;
|
|
18
|
+
};
|
|
19
|
+
readonly initialSortState: undefined;
|
|
20
|
+
};
|
|
21
|
+
export declare const createTableStaticContext: <Record extends DefaultRecord>() => import('react').Context<TableStaticContextValue<Record>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
import { noop, once } from "lodash-es";
|
|
3
|
+
const initialTableStaticContextValue = {
|
|
4
|
+
staticSelectedKeySet: /* @__PURE__ */ new Set(),
|
|
5
|
+
triggerSorter: noop,
|
|
6
|
+
sortState: void 0,
|
|
7
|
+
colsWidthsMap: /* @__PURE__ */ new Map(),
|
|
8
|
+
isTableFirstMount: true,
|
|
9
|
+
measureCellsInfo: {
|
|
10
|
+
start: [],
|
|
11
|
+
end: [],
|
|
12
|
+
widths: []
|
|
13
|
+
},
|
|
14
|
+
scrollableTableSectionInfo: {
|
|
15
|
+
clientWidth: 0,
|
|
16
|
+
horizontalScrollPositionRange: [0, 0],
|
|
17
|
+
verticalScrollBarWidth: 0
|
|
18
|
+
},
|
|
19
|
+
initialSortState: void 0
|
|
20
|
+
};
|
|
21
|
+
const createTableStaticContext = once(() => {
|
|
22
|
+
return createContext({
|
|
23
|
+
current: initialTableStaticContextValue
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
export {
|
|
27
|
+
createTableStaticContext,
|
|
28
|
+
initialTableStaticContextValue
|
|
29
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { DefaultRecord, Key } from 'components/Table/Table.types';
|
|
3
|
+
import { ColumnKey, OffsetWidth } from 'components/Table/components/Body/components/MeasureRow/MeasureRow';
|
|
4
|
+
import { SortState } from 'components/Table/features/tableSort';
|
|
5
|
+
export type TableStaticValue<Record extends DefaultRecord> = {
|
|
6
|
+
staticSelectedKeySet: Set<Key>;
|
|
7
|
+
scrollableTableSectionInfo: {
|
|
8
|
+
horizontalScrollPositionRange: readonly [number, number];
|
|
9
|
+
verticalScrollBarWidth: number;
|
|
10
|
+
clientWidth: number;
|
|
11
|
+
};
|
|
12
|
+
measureCellsInfo: {
|
|
13
|
+
start: readonly number[];
|
|
14
|
+
end: readonly number[];
|
|
15
|
+
widths: readonly number[];
|
|
16
|
+
};
|
|
17
|
+
colsWidthsMap: Map<ColumnKey, OffsetWidth>;
|
|
18
|
+
isTableFirstMount: boolean;
|
|
19
|
+
initialSortState: SortState<Record> | undefined;
|
|
20
|
+
sortState: SortState<Record> | undefined;
|
|
21
|
+
triggerSorter: (sortState: SortState<Record>) => void;
|
|
22
|
+
};
|
|
23
|
+
export interface TableStaticContextValue<Record extends DefaultRecord> extends MutableRefObject<TableStaticValue<Record>> {
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { withTableStaticContext } from './withTableStaticContext';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DefaultRecord } from 'components/Table/Table.types';
|
|
3
|
+
export declare const withTableStaticContext: <T extends FC<any>, Record extends DefaultRecord>(Component: T) => import('react').ForwardRefExoticComponent<Omit<any, "ref"> & import('react').RefAttributes<unknown>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useRef } from "react";
|
|
3
|
+
import { useStatic } from "../../../../../hooks/useStatic/useStatic.js";
|
|
4
|
+
import { initialTableStaticContextValue, createTableStaticContext } from "../contexts/tableStaticContext/TableStaticContext.js";
|
|
5
|
+
const withTableStaticContext = (Component) => {
|
|
6
|
+
const WithTableStaticContext = forwardRef((props, ref) => {
|
|
7
|
+
const TableStaticContext = useStatic(() => createTableStaticContext());
|
|
8
|
+
const tableStaticContextValueRef = useRef(initialTableStaticContextValue);
|
|
9
|
+
return /* @__PURE__ */ jsx(TableStaticContext.Provider, { value: tableStaticContextValueRef, children: /* @__PURE__ */ jsx(Component, { ref, ...props }) });
|
|
10
|
+
});
|
|
11
|
+
return WithTableStaticContext;
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
withTableStaticContext
|
|
15
|
+
};
|