@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,39 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { flatColumns } from "./useTableColumns.utils.js";
|
|
3
|
+
import { useTransformColumns } from "../../features/tableRowSelection/hooks/useTransformColumns/useTransformColumns.js";
|
|
4
|
+
import { useTransformColumns as useTransformColumns$1 } from "../../features/tableSort/hooks/useTransformColumns/useTransformColumns.js";
|
|
5
|
+
const emptyColumnKey = "__EMPTY_COLUMN";
|
|
6
|
+
const useTableColumns = (options) => {
|
|
7
|
+
const {
|
|
8
|
+
columns: columnsProp,
|
|
9
|
+
rowSelection
|
|
10
|
+
} = options;
|
|
11
|
+
const {
|
|
12
|
+
transformColumns: rowSelectionTransformColumns
|
|
13
|
+
} = useTransformColumns({
|
|
14
|
+
rowSelection
|
|
15
|
+
});
|
|
16
|
+
const {
|
|
17
|
+
transformColumns: sorterTransformColumns
|
|
18
|
+
} = useTransformColumns$1();
|
|
19
|
+
const columns = useMemo(() => {
|
|
20
|
+
const transformers = [sorterTransformColumns, rowSelectionTransformColumns];
|
|
21
|
+
const resultColumns = transformers.reduce((transformedColumns, transformer) => transformer(transformedColumns), [...columnsProp]);
|
|
22
|
+
if (!resultColumns.length) {
|
|
23
|
+
resultColumns.push({
|
|
24
|
+
key: emptyColumnKey
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return resultColumns;
|
|
28
|
+
}, [columnsProp, rowSelectionTransformColumns, sorterTransformColumns]);
|
|
29
|
+
const flattedColumns = useMemo(() => flatColumns(columns), [columns]);
|
|
30
|
+
const isAllColumnsFixedStart = useMemo(() => flattedColumns.every((col) => col.fixed === "start"), [flattedColumns]);
|
|
31
|
+
return {
|
|
32
|
+
columns,
|
|
33
|
+
flattedColumns,
|
|
34
|
+
isAllColumnsFixedStart
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
useTableColumns
|
|
39
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { UseTransformColumnsOptions } from 'components/Table/features/tableRowSelection';
|
|
2
|
+
import { DefaultRecord, TableProps } from '../../Table.types';
|
|
3
|
+
export interface UseTableColumnsOptions<Record extends DefaultRecord> extends Pick<TableProps<Record>, "columns">, UseTransformColumnsOptions<Record> {
|
|
4
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const flatColumns = (columns) => {
|
|
2
|
+
return columns.reduce((acc, column) => {
|
|
3
|
+
const {
|
|
4
|
+
fixed
|
|
5
|
+
} = column;
|
|
6
|
+
const subColumns = "children" in column ? column.children : [];
|
|
7
|
+
if (subColumns.length > 0) {
|
|
8
|
+
return [...acc, ...flatColumns(subColumns).map((subColumn) => {
|
|
9
|
+
const clonedSubColumn = {
|
|
10
|
+
...subColumn
|
|
11
|
+
};
|
|
12
|
+
const resultFixed = subColumn.fixed ?? fixed;
|
|
13
|
+
if (resultFixed) {
|
|
14
|
+
clonedSubColumn.fixed = resultFixed;
|
|
15
|
+
}
|
|
16
|
+
return clonedSubColumn;
|
|
17
|
+
})];
|
|
18
|
+
}
|
|
19
|
+
return [...acc, column];
|
|
20
|
+
}, []);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
flatColumns
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTableComponents } from './useTableComponents';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropertyPath } from 'lodash-es';
|
|
2
|
+
import { UseTableComponentsOptions } from './useTableComponents.types';
|
|
3
|
+
import { CustomizedComponent } from 'components/Table/interfaces/tableComponents.types';
|
|
4
|
+
export declare const useTableComponents: (options: UseTableComponentsOptions) => {
|
|
5
|
+
getComponent: <T extends CustomizedComponent>(path: PropertyPath, defaultComponent: T) => T;
|
|
6
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { get } from "lodash-es";
|
|
3
|
+
const useTableComponents = (options) => {
|
|
4
|
+
const {
|
|
5
|
+
components
|
|
6
|
+
} = options;
|
|
7
|
+
const getComponent = useCallback((path, defaultComponent) => get(components, path, defaultComponent), [components]);
|
|
8
|
+
return {
|
|
9
|
+
getComponent
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
useTableComponents
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTableVisualParamsChange } from './useTableVisualParamsChange';
|
package/dist/components/Table/hooks/useTableVisualParamsChange/useTableVisualParamsChange.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UIEventHandler } from 'react';
|
|
2
|
+
import { UseTableVisualParamsChangeOptions } from './types';
|
|
3
|
+
import { OnResize } from 'rc-resize-observer';
|
|
4
|
+
import { DefaultRecord } from 'components/Table/Table.types';
|
|
5
|
+
export declare const useTableVisualParamsChange: <Record extends DefaultRecord>(options: UseTableVisualParamsChangeOptions<Record>) => {
|
|
6
|
+
onTableContentScroll: UIEventHandler<HTMLDivElement>;
|
|
7
|
+
onResize: OnResize;
|
|
8
|
+
onTableHeaderScroll: UIEventHandler<HTMLDivElement>;
|
|
9
|
+
onTableBodyScroll: UIEventHandler<HTMLDivElement>;
|
|
10
|
+
scrollableTableSectionRef: import('react').RefObject<HTMLDivElement>;
|
|
11
|
+
tableHeaderRef: import('react').RefObject<HTMLDivElement>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { useRef, useLayoutEffect, useCallback } from "react";
|
|
2
|
+
import { useEvent } from "../../../../hooks/useEvent/useEvent.js";
|
|
3
|
+
import "rc-resize-observer";
|
|
4
|
+
import { getVerticalScrollBarWidth, forceScroll, getHorizontalScrollPositionRange } from "./utils.js";
|
|
5
|
+
import { useTableStaticContext } from "../../features/tableStaticContext/contexts/tableStaticContext/useTableStaticContext/useTableStaticContext.js";
|
|
6
|
+
import { useEmitter } from "../../features/typedEventBus/hooks.js";
|
|
7
|
+
import { updateRefValue, getRefValue } from "../../utils/ref/ref.js";
|
|
8
|
+
const useTableVisualParamsChange = (options) => {
|
|
9
|
+
const {
|
|
10
|
+
fixColumn,
|
|
11
|
+
onScroll
|
|
12
|
+
} = options;
|
|
13
|
+
const staticContextRef = useTableStaticContext();
|
|
14
|
+
const tableHeaderRef = useRef(null);
|
|
15
|
+
const scrollableTableSectionRef = useRef(null);
|
|
16
|
+
const emitTableVisualParamsChange = useEvent(useEmitter("table-visual-params:change"));
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
const scrollableTableSection = scrollableTableSectionRef.current;
|
|
19
|
+
if (!scrollableTableSection) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const horizontalScrollPositionRange = getHorizontalScrollPositionRange(scrollableTableSection);
|
|
23
|
+
const verticalScrollBarWidth = getVerticalScrollBarWidth(scrollableTableSection);
|
|
24
|
+
const {
|
|
25
|
+
clientWidth
|
|
26
|
+
} = scrollableTableSection;
|
|
27
|
+
updateRefValue(staticContextRef, {
|
|
28
|
+
scrollableTableSectionInfo: {
|
|
29
|
+
horizontalScrollPositionRange,
|
|
30
|
+
clientWidth,
|
|
31
|
+
verticalScrollBarWidth
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const measureCellsInfo = getRefValue(staticContextRef, "measureCellsInfo");
|
|
35
|
+
emitTableVisualParamsChange({
|
|
36
|
+
horizontalScrollPositionRange,
|
|
37
|
+
verticalScrollBarWidth,
|
|
38
|
+
clientWidth,
|
|
39
|
+
measureCellsInfo
|
|
40
|
+
});
|
|
41
|
+
}, [emitTableVisualParamsChange, staticContextRef]);
|
|
42
|
+
const handleTableHeaderScroll = useCallback((e) => {
|
|
43
|
+
const {
|
|
44
|
+
scrollLeft
|
|
45
|
+
} = e.currentTarget;
|
|
46
|
+
forceScroll(scrollLeft, scrollableTableSectionRef.current);
|
|
47
|
+
}, []);
|
|
48
|
+
const prevScrollTopRef = useRef(0);
|
|
49
|
+
const handleTableContentScroll = (e) => {
|
|
50
|
+
const {
|
|
51
|
+
currentTarget
|
|
52
|
+
} = e;
|
|
53
|
+
const horizontalScrollPositionRange = getHorizontalScrollPositionRange(currentTarget);
|
|
54
|
+
updateRefValue(staticContextRef, {
|
|
55
|
+
"scrollableTableSectionInfo.horizontalScrollPositionRange": horizontalScrollPositionRange
|
|
56
|
+
});
|
|
57
|
+
const {
|
|
58
|
+
scrollLeft,
|
|
59
|
+
scrollTop
|
|
60
|
+
} = currentTarget;
|
|
61
|
+
if (prevScrollTopRef.current !== scrollTop) {
|
|
62
|
+
prevScrollTopRef.current = scrollTop;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
forceScroll(scrollLeft, tableHeaderRef.current);
|
|
66
|
+
if (!fixColumn) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
emitTableVisualParamsChange({
|
|
70
|
+
horizontalScrollPositionRange
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const firstCallRef = useRef(true);
|
|
74
|
+
const handleResize = useCallback(() => {
|
|
75
|
+
if (firstCallRef.current) {
|
|
76
|
+
firstCallRef.current = false;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const scrollableTableSection = scrollableTableSectionRef.current;
|
|
80
|
+
if (!scrollableTableSection) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const horizontalScrollPositionRange = getHorizontalScrollPositionRange(scrollableTableSection);
|
|
84
|
+
const verticalScrollBarWidth = getVerticalScrollBarWidth(scrollableTableSection);
|
|
85
|
+
const {
|
|
86
|
+
clientWidth
|
|
87
|
+
} = scrollableTableSection;
|
|
88
|
+
updateRefValue(staticContextRef, {
|
|
89
|
+
scrollableTableSectionInfo: {
|
|
90
|
+
horizontalScrollPositionRange,
|
|
91
|
+
clientWidth,
|
|
92
|
+
verticalScrollBarWidth
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
emitTableVisualParamsChange({
|
|
96
|
+
horizontalScrollPositionRange,
|
|
97
|
+
verticalScrollBarWidth,
|
|
98
|
+
clientWidth
|
|
99
|
+
});
|
|
100
|
+
}, [emitTableVisualParamsChange, staticContextRef]);
|
|
101
|
+
const handleTableBodyScroll = (e) => {
|
|
102
|
+
handleTableContentScroll(e);
|
|
103
|
+
onScroll == null ? void 0 : onScroll(e);
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
onTableContentScroll: handleTableContentScroll,
|
|
107
|
+
onResize: handleResize,
|
|
108
|
+
onTableHeaderScroll: handleTableHeaderScroll,
|
|
109
|
+
onTableBodyScroll: handleTableBodyScroll,
|
|
110
|
+
scrollableTableSectionRef,
|
|
111
|
+
tableHeaderRef
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
export {
|
|
115
|
+
useTableVisualParamsChange
|
|
116
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const forceScroll = (scrollLeft, target) => {
|
|
2
|
+
if (!target || target.scrollLeft === scrollLeft) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
target.scrollLeft = scrollLeft;
|
|
6
|
+
if (target.scrollLeft !== scrollLeft) {
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
target.scrollLeft = scrollLeft;
|
|
9
|
+
}, 0);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const getHorizontalScrollPositionRange = (el) => {
|
|
13
|
+
const {
|
|
14
|
+
scrollLeft,
|
|
15
|
+
scrollWidth,
|
|
16
|
+
clientWidth
|
|
17
|
+
} = el;
|
|
18
|
+
return [scrollLeft, scrollWidth - clientWidth];
|
|
19
|
+
};
|
|
20
|
+
const getVerticalScrollBarWidth = (el) => {
|
|
21
|
+
const {
|
|
22
|
+
offsetWidth,
|
|
23
|
+
clientWidth
|
|
24
|
+
} = el;
|
|
25
|
+
const {
|
|
26
|
+
borderLeftWidth,
|
|
27
|
+
borderRightWidth
|
|
28
|
+
} = getComputedStyle(el);
|
|
29
|
+
return offsetWidth - clientWidth - parseInt(borderLeftWidth) - parseInt(borderRightWidth);
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
forceScroll,
|
|
33
|
+
getHorizontalScrollPositionRange,
|
|
34
|
+
getVerticalScrollBarWidth
|
|
35
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { PropertyPath } from 'lodash-es';
|
|
3
|
+
import { GetComponentProps, GetSingleComponentProps } from './tableComponents.types';
|
|
4
|
+
import { Key } from '../Table.types';
|
|
5
|
+
import { CompareFn, SortOrder } from '../features/tableSort';
|
|
6
|
+
export type ColScopeType = "col" | "colgroup";
|
|
7
|
+
export type RowScopeType = "row" | "rowgroup";
|
|
8
|
+
export type ScopeType = ColScopeType | RowScopeType;
|
|
9
|
+
export type AlignType = "start" | "end" | "left" | "right" | "center" | "justify" | "match-parent";
|
|
10
|
+
interface BaseColumn<Record> {
|
|
11
|
+
key: Key;
|
|
12
|
+
dataIndex?: PropertyPath;
|
|
13
|
+
title?: ReactNode;
|
|
14
|
+
fixed?: "start" | "end";
|
|
15
|
+
onHeaderCell?: GetSingleComponentProps<Columns<Record>[number]>;
|
|
16
|
+
rowScope?: RowScopeType;
|
|
17
|
+
align?: CSSProperties["textAlign"];
|
|
18
|
+
ellipsis?: CellEllipsisType;
|
|
19
|
+
render?: (value: any, record: Record, index: number) => ReactNode;
|
|
20
|
+
sorter?: boolean | CompareFn<Record>;
|
|
21
|
+
defaultSortOrder?: SortOrder;
|
|
22
|
+
sortDirections?: SortOrder[];
|
|
23
|
+
colSpan?: number;
|
|
24
|
+
rowSpan?: number;
|
|
25
|
+
}
|
|
26
|
+
export type CellEllipsisType = {
|
|
27
|
+
showTitle?: boolean;
|
|
28
|
+
} | boolean;
|
|
29
|
+
interface ColumnWithChildrenForbidden {
|
|
30
|
+
onCell?: never;
|
|
31
|
+
}
|
|
32
|
+
export interface ColumnWithChildren<Record> extends BaseColumn<Record>, ColumnWithChildrenForbidden {
|
|
33
|
+
children: Columns<Record>;
|
|
34
|
+
}
|
|
35
|
+
export interface Column<Record> extends BaseColumn<Record> {
|
|
36
|
+
onCell?: GetComponentProps<Record>;
|
|
37
|
+
width?: number | string;
|
|
38
|
+
minWidth?: number | string;
|
|
39
|
+
}
|
|
40
|
+
export type Columns<Record> = readonly (ColumnWithChildren<Record> | Column<Record>)[];
|
|
41
|
+
export type Writable<T> = {
|
|
42
|
+
-readonly [P in keyof T]: T[P];
|
|
43
|
+
};
|
|
44
|
+
export type ColumnsTransformer<Record> = (columns: Writable<Columns<Record>>) => Writable<Columns<Record>>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ComponentType, CSSProperties, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from 'react';
|
|
2
|
+
import { CSSInterpolation } from '@emotion/serialize';
|
|
3
|
+
export type CustomizedComponent = keyof JSX.IntrinsicElements | ComponentType;
|
|
4
|
+
export interface TableComponents<C extends CustomizedComponent = CustomizedComponent> {
|
|
5
|
+
table?: C;
|
|
6
|
+
header?: {
|
|
7
|
+
table?: C;
|
|
8
|
+
wrapper?: C;
|
|
9
|
+
row?: C;
|
|
10
|
+
cell?: C;
|
|
11
|
+
};
|
|
12
|
+
body?: {
|
|
13
|
+
wrapper?: C;
|
|
14
|
+
row?: C;
|
|
15
|
+
cell?: C;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
type OverrideAlign<T extends {
|
|
19
|
+
align?: unknown;
|
|
20
|
+
}> = Omit<T, "align"> & {
|
|
21
|
+
align?: CSSProperties["textAlign"];
|
|
22
|
+
};
|
|
23
|
+
type WithCss<T> = T & {
|
|
24
|
+
css?: CSSInterpolation;
|
|
25
|
+
};
|
|
26
|
+
export type GetSingleComponentProps<Data, R extends HTMLAttributes<HTMLElement> = OverrideAlign<ThHTMLAttributes<HTMLTableCellElement>>> = (data: Data) => WithCss<R>;
|
|
27
|
+
export type GetComponentProps<Data, R extends HTMLAttributes<HTMLElement> = OverrideAlign<TdHTMLAttributes<HTMLTableCellElement>>> = (data: Data, index: number) => WithCss<R>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { updateRefValue, getRefValue } from './ref';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { NestedKeyOf, NestedValueOf, Updates } from './types';
|
|
3
|
+
export declare const updateRefValue: <T extends object>(ref: MutableRefObject<T>, updates: Updates<T>) => void;
|
|
4
|
+
export declare function getRefValue<T extends object>(ref: MutableRefObject<T>): T;
|
|
5
|
+
export declare function getRefValue<T extends object, K extends NestedKeyOf<T>>(ref: MutableRefObject<T>, key: K): NestedValueOf<T, K>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { set, isUndefined, get } from "lodash-es";
|
|
2
|
+
const updateRefValue = (ref, updates) => {
|
|
3
|
+
Object.entries(updates).forEach(([key, value]) => {
|
|
4
|
+
set(ref.current, key, value);
|
|
5
|
+
});
|
|
6
|
+
};
|
|
7
|
+
function getRefValue(ref, key) {
|
|
8
|
+
if (isUndefined(key)) {
|
|
9
|
+
return ref.current;
|
|
10
|
+
}
|
|
11
|
+
return get(ref.current, key);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
getRefValue,
|
|
15
|
+
updateRefValue
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Updates<T> = Partial<{
|
|
2
|
+
[K in NestedKeyOf<T>]: NestedValueOf<T, K>;
|
|
3
|
+
}>;
|
|
4
|
+
type Decrement<N extends number> = N extends 0 ? 0 : Tuple<N> extends [unknown, ...infer Rest] ? Rest["length"] : 0;
|
|
5
|
+
type Tuple<N extends number, Acc extends unknown[] = []> = Acc["length"] extends N ? Acc : Tuple<N, [unknown, ...Acc]>;
|
|
6
|
+
export type NestedKeyOf<ObjectType, Depth extends number = 2> = Decrement<Depth> extends infer PrevDepth extends number ? Depth extends 0 ? never : ObjectType extends readonly unknown[] ? never : ObjectType extends object ? {
|
|
7
|
+
[Key in keyof ObjectType]: `${Key & string}` | `${Key & string}.${NestedKeyOf<ObjectType[Key], PrevDepth>}`;
|
|
8
|
+
}[keyof ObjectType] : never : never;
|
|
9
|
+
export type NestedValueOf<ObjectType, Property extends string> = Property extends `${infer Key}.${infer Rest}` ? Key extends keyof ObjectType ? NestedValueOf<ObjectType[Key], Rest> : never : Property extends keyof ObjectType ? ObjectType[Property] : never;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useEvent } from './useEvent';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Callback<Args extends readonly unknown[], Return> = (...args: Args) => Return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFirstMount } from './useFirstMount';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useFirstMount: () => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useStatic } from './useStatic';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStatic: <T>(init: () => T) => T;
|
package/dist/index.d.ts
CHANGED
|
@@ -49,4 +49,5 @@ export { type EmptyProps, Empty } from './components/Empty';
|
|
|
49
49
|
export { type SegmentedProps, type SegmentedLabeledOption, Segmented, } from './components/Segmented';
|
|
50
50
|
export { ContextIsolator } from './components/ContextIsolator';
|
|
51
51
|
export { type SpinProps, Spin } from './components/Spin';
|
|
52
|
+
export { type TableProps, Table } from './components/Table';
|
|
52
53
|
export * from 'react-intersection-observer/test-utils';
|
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ import { Empty } from "./components/Empty/Empty.js";
|
|
|
37
37
|
import { Segmented } from "./components/Segmented/Segmented.js";
|
|
38
38
|
import { ContextIsolator } from "./components/ContextIsolator/ContextIsolator.js";
|
|
39
39
|
import { Spin } from "./components/Spin/Spin.js";
|
|
40
|
+
import { Table } from "./components/Table/Table.js";
|
|
40
41
|
export {
|
|
41
42
|
Alert,
|
|
42
43
|
Avatar,
|
|
@@ -60,6 +61,7 @@ export {
|
|
|
60
61
|
Select,
|
|
61
62
|
Spin,
|
|
62
63
|
Switch,
|
|
64
|
+
Table,
|
|
63
65
|
Tabs,
|
|
64
66
|
Tag,
|
|
65
67
|
ThemeProvider,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EventCallback, EventMap } from './types';
|
|
2
|
+
export declare class EventBus<EM extends EventMap> {
|
|
3
|
+
private subscribers;
|
|
4
|
+
on<K extends keyof EM>(event: K, callback: EventCallback<EM[K]>): () => void;
|
|
5
|
+
off<K extends keyof EM>(event: K, callback: EventCallback<EM[K]>): void;
|
|
6
|
+
emit<K extends keyof EM>(event: K, payload: EM[K]): void;
|
|
7
|
+
subscriberCount<K extends keyof EM>(event: K): number;
|
|
8
|
+
clearEvent<K extends keyof EM>(event: K): void;
|
|
9
|
+
clearAll(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
class EventBus {
|
|
5
|
+
constructor() {
|
|
6
|
+
__publicField(this, "subscribers", {});
|
|
7
|
+
}
|
|
8
|
+
on(event, callback) {
|
|
9
|
+
if (!this.subscribers[event]) {
|
|
10
|
+
this.subscribers[event] = [];
|
|
11
|
+
}
|
|
12
|
+
this.subscribers[event].push(callback);
|
|
13
|
+
return () => this.off(event, callback);
|
|
14
|
+
}
|
|
15
|
+
off(event, callback) {
|
|
16
|
+
if (!this.subscribers[event]) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
this.subscribers[event] = this.subscribers[event].filter((cb) => cb !== callback);
|
|
20
|
+
if (this.subscribers[event].length === 0) {
|
|
21
|
+
delete this.subscribers[event];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
emit(event, payload) {
|
|
25
|
+
var _a;
|
|
26
|
+
(_a = this.subscribers[event]) == null ? void 0 : _a.forEach((callback) => {
|
|
27
|
+
try {
|
|
28
|
+
callback(payload);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.error(`Ошибка в обработчике события для события ${String(event)}:`, error);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
subscriberCount(event) {
|
|
35
|
+
var _a;
|
|
36
|
+
return ((_a = this.subscribers[event]) == null ? void 0 : _a.length) || 0;
|
|
37
|
+
}
|
|
38
|
+
clearEvent(event) {
|
|
39
|
+
delete this.subscribers[event];
|
|
40
|
+
}
|
|
41
|
+
clearAll() {
|
|
42
|
+
this.subscribers = {};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
EventBus
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { withEventBus } from './withEventBus';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useStatic } from "../../../../hooks/useStatic/useStatic.js";
|
|
4
|
+
import { EventBus } from "../../eventBus.js";
|
|
5
|
+
import { EventBusProvider } from "../../provider/EventBusProvider.js";
|
|
6
|
+
const withEventBus = (Component) => {
|
|
7
|
+
const WithEventBus = forwardRef((props, ref) => {
|
|
8
|
+
const eventBus = useStatic(() => new EventBus());
|
|
9
|
+
return /* @__PURE__ */ jsx(EventBusProvider, { bus: eventBus, children: /* @__PURE__ */ jsx(Component, { ref, ...props }) });
|
|
10
|
+
});
|
|
11
|
+
return WithEventBus;
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
withEventBus
|
|
15
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { EventBusContext } from "../../context/EventBusContext.js";
|
|
3
|
+
const useEventBus = () => {
|
|
4
|
+
const context = useContext(EventBusContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error("useEventBus должен использоваться внутри EventBusProvider");
|
|
7
|
+
}
|
|
8
|
+
return context.bus;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
useEventBus
|
|
12
|
+
};
|