@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,50 @@
|
|
|
1
|
+
import { isNumber } from "lodash-es";
|
|
2
|
+
function parseHeaderRows(rootColumns) {
|
|
3
|
+
const rows = [];
|
|
4
|
+
function fillRowCells(columns, colIndex, rowIndex = 0) {
|
|
5
|
+
rows[rowIndex] = rows[rowIndex] || [];
|
|
6
|
+
let currentColIndex = colIndex;
|
|
7
|
+
const colSpans = columns.map((column) => {
|
|
8
|
+
const cell = {
|
|
9
|
+
key: column.key,
|
|
10
|
+
column,
|
|
11
|
+
colStart: currentColIndex
|
|
12
|
+
};
|
|
13
|
+
if (column.title) {
|
|
14
|
+
cell.children = column.title;
|
|
15
|
+
}
|
|
16
|
+
let colSpan = 1;
|
|
17
|
+
const subColumns = "children" in column ? column.children : [];
|
|
18
|
+
if (subColumns.length > 0) {
|
|
19
|
+
colSpan = fillRowCells(subColumns, currentColIndex, rowIndex + 1).reduce((total, count) => total + count, 0);
|
|
20
|
+
cell.hasSubColumns = true;
|
|
21
|
+
}
|
|
22
|
+
if (isNumber(column.colSpan)) {
|
|
23
|
+
colSpan = column.colSpan;
|
|
24
|
+
}
|
|
25
|
+
if (isNumber(column.rowSpan)) {
|
|
26
|
+
cell.rowSpan = column.rowSpan;
|
|
27
|
+
}
|
|
28
|
+
cell.colSpan = colSpan;
|
|
29
|
+
cell.colEnd = cell.colStart + colSpan - 1;
|
|
30
|
+
rows[rowIndex].push(cell);
|
|
31
|
+
currentColIndex += colSpan;
|
|
32
|
+
return colSpan;
|
|
33
|
+
});
|
|
34
|
+
return colSpans;
|
|
35
|
+
}
|
|
36
|
+
fillRowCells(rootColumns, 0);
|
|
37
|
+
const rowCount = rows.length;
|
|
38
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex += 1) {
|
|
39
|
+
rows[rowIndex].forEach((cell) => {
|
|
40
|
+
if (isNumber(cell.rowSpan) || cell.hasSubColumns) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
cell.rowSpan = rowCount - rowIndex;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return rows;
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
parseHeaderRows
|
|
50
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
import { once, identity } from "lodash-es";
|
|
3
|
+
const createTableContext = once(() => {
|
|
4
|
+
return createContext({
|
|
5
|
+
getComponent: identity,
|
|
6
|
+
columns: [],
|
|
7
|
+
flattedColumns: [],
|
|
8
|
+
isAllColumnsFixedStart: false,
|
|
9
|
+
expandIconColumnIndex: 0,
|
|
10
|
+
ExpandIcon: identity,
|
|
11
|
+
indentSize: 0,
|
|
12
|
+
isSomeRecordHasChildren: false,
|
|
13
|
+
sortDirections: [],
|
|
14
|
+
tableLayout: "auto",
|
|
15
|
+
tableTokens: {},
|
|
16
|
+
showHeader: true
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
createTableContext
|
|
21
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TableTokens } from 'components/Table/Table.tokens';
|
|
2
|
+
import { useTableExpand } from '../../features/tableExpand';
|
|
3
|
+
import { useTableColumns } from '../../hooks/useTableColumns';
|
|
4
|
+
import { useTableComponents } from '../../hooks/useTableComponents';
|
|
5
|
+
import { BorderedConfig, DefaultRecord, TableProps } from 'components/Table/Table.types';
|
|
6
|
+
type UseTableComponentsReturnType = ReturnType<typeof useTableComponents>;
|
|
7
|
+
type UseTableColumnsReturnType<Record extends DefaultRecord> = ReturnType<typeof useTableColumns<Record>>;
|
|
8
|
+
type UseTableExpandReturnType<Record extends DefaultRecord> = ReturnType<typeof useTableExpand<Record>>;
|
|
9
|
+
export interface TableContextValue<Record extends DefaultRecord> {
|
|
10
|
+
showHeader: TableProps<Record>["showHeader"];
|
|
11
|
+
tableTokens: TableTokens;
|
|
12
|
+
getComponent: UseTableComponentsReturnType["getComponent"];
|
|
13
|
+
columns: UseTableColumnsReturnType<Record>["columns"];
|
|
14
|
+
flattedColumns: UseTableColumnsReturnType<Record>["flattedColumns"];
|
|
15
|
+
isAllColumnsFixedStart: UseTableColumnsReturnType<Record>["isAllColumnsFixedStart"];
|
|
16
|
+
expandIconColumnIndex: UseTableExpandReturnType<Record>["expandIconColumnIndex"];
|
|
17
|
+
ExpandIcon: UseTableExpandReturnType<Record>["ExpandIcon"];
|
|
18
|
+
indentSize: UseTableExpandReturnType<Record>["indentSize"];
|
|
19
|
+
isSomeRecordHasChildren: UseTableExpandReturnType<Record>["isSomeRecordHasChildren"];
|
|
20
|
+
sortDirections: Exclude<TableProps["sortDirections"], undefined>;
|
|
21
|
+
tableLayout: Exclude<TableProps["tableLayout"], undefined>;
|
|
22
|
+
onHeaderRow?: TableProps<Record>["onHeaderRow"];
|
|
23
|
+
onRow?: TableProps<Record>["onRow"];
|
|
24
|
+
bordered?: false | Required<BorderedConfig>;
|
|
25
|
+
horizonScroll?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DefaultExpandIconProps } from './DefaultExpandIcon.types';
|
|
2
|
+
import { DefaultRecord } from 'components/Table/Table.types';
|
|
3
|
+
export declare const DefaultExpandIcon: import('react').MemoExoticComponent<(<Record extends DefaultRecord>(props: DefaultExpandIconProps<Record>) => import("@emotion/react/jsx-runtime").JSX.Element)>;
|
package/dist/components/Table/features/tableExpand/components/DefaultExpandIcon/DefaultExpandIcon.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { CaretRightOutlined } from "@infomaximum/icons";
|
|
4
|
+
import { expandIconWrapperStyle, nonExpandableExpandIconWrapperStyle } from "./DefaultExpandIcon.styles.js";
|
|
5
|
+
import { useTheme } from "../../../../../../hooks/useTheme/useTheme.js";
|
|
6
|
+
const DefaultExpandIconComponent = (props) => {
|
|
7
|
+
const {
|
|
8
|
+
record,
|
|
9
|
+
onExpand,
|
|
10
|
+
expanded,
|
|
11
|
+
expandable
|
|
12
|
+
} = props;
|
|
13
|
+
const theme = useTheme();
|
|
14
|
+
const handleClick = (event) => {
|
|
15
|
+
onExpand(record, event);
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ jsx("button", { onClick: handleClick, css: [expandIconWrapperStyle(theme), expandable ? void 0 : nonExpandableExpandIconWrapperStyle, process.env.NODE_ENV === "production" ? "" : ";label:DefaultExpandIconComponent;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9idWlsZHMvZnJvbnRlbmQvbGlicy91aS1raXQvc3JjL2NvbXBvbmVudHMvVGFibGUvZmVhdHVyZXMvdGFibGVFeHBhbmQvY29tcG9uZW50cy9EZWZhdWx0RXhwYW5kSWNvbi9EZWZhdWx0RXhwYW5kSWNvbi50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBd0JNIiwiZmlsZSI6Ii9idWlsZHMvZnJvbnRlbmQvbGlicy91aS1raXQvc3JjL2NvbXBvbmVudHMvVGFibGUvZmVhdHVyZXMvdGFibGVFeHBhbmQvY29tcG9uZW50cy9EZWZhdWx0RXhwYW5kSWNvbi9EZWZhdWx0RXhwYW5kSWNvbi50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBtZW1vIH0gZnJvbSBcInJlYWN0XCI7XG5pbXBvcnQgdHlwZSB7IERlZmF1bHRFeHBhbmRJY29uUHJvcHMgfSBmcm9tIFwiLi9EZWZhdWx0RXhwYW5kSWNvbi50eXBlc1wiO1xuaW1wb3J0IHR5cGUgeyBEZWZhdWx0UmVjb3JkIH0gZnJvbSBcImNvbXBvbmVudHMvVGFibGUvVGFibGUudHlwZXNcIjtcbmltcG9ydCB7IENhcmV0UmlnaHRPdXRsaW5lZCB9IGZyb20gXCJAaW5mb21heGltdW0vaWNvbnNcIjtcbmltcG9ydCB7IHVzZVRoZW1lIH0gZnJvbSBcImhvb2tzL3VzZVRoZW1lXCI7XG5pbXBvcnQge1xuICBleHBhbmRJY29uV3JhcHBlclN0eWxlLFxuICBub25FeHBhbmRhYmxlRXhwYW5kSWNvbldyYXBwZXJTdHlsZSxcbn0gZnJvbSBcIi4vRGVmYXVsdEV4cGFuZEljb24uc3R5bGVzXCI7XG5cbmNvbnN0IERlZmF1bHRFeHBhbmRJY29uQ29tcG9uZW50ID0gPFJlY29yZCBleHRlbmRzIERlZmF1bHRSZWNvcmQ+KFxuICBwcm9wczogRGVmYXVsdEV4cGFuZEljb25Qcm9wczxSZWNvcmQ+XG4pID0+IHtcbiAgY29uc3QgeyByZWNvcmQsIG9uRXhwYW5kLCBleHBhbmRlZCwgZXhwYW5kYWJsZSB9ID0gcHJvcHM7XG4gIGNvbnN0IHRoZW1lID0gdXNlVGhlbWUoKTtcblxuICBjb25zdCBoYW5kbGVDbGljazogUmVhY3QuTW91c2VFdmVudEhhbmRsZXI8SFRNTEVsZW1lbnQ+ID0gKGV2ZW50KSA9PiB7XG4gICAgb25FeHBhbmQocmVjb3JkLCBldmVudCk7XG4gICAgZXZlbnQuc3RvcFByb3BhZ2F0aW9uKCk7XG4gIH07XG5cbiAgcmV0dXJuIChcbiAgICA8YnV0dG9uXG4gICAgICBvbkNsaWNrPXtoYW5kbGVDbGlja31cbiAgICAgIGNzcz17W1xuICAgICAgICBleHBhbmRJY29uV3JhcHBlclN0eWxlKHRoZW1lKSxcbiAgICAgICAgZXhwYW5kYWJsZSA/IHVuZGVmaW5lZCA6IG5vbkV4cGFuZGFibGVFeHBhbmRJY29uV3JhcHBlclN0eWxlLFxuICAgICAgXX1cbiAgICA+XG4gICAgICA8Q2FyZXRSaWdodE91dGxpbmVkIHJvdGF0ZT17ZXhwYW5kZWQgPyA5MCA6IHVuZGVmaW5lZH0gLz5cbiAgICA8L2J1dHRvbj5cbiAgKTtcbn07XG5cbmV4cG9ydCBjb25zdCBEZWZhdWx0RXhwYW5kSWNvbiA9IG1lbW8oRGVmYXVsdEV4cGFuZEljb25Db21wb25lbnQpO1xuIl19 */"], children: /* @__PURE__ */ jsx(CaretRightOutlined, { rotate: expanded ? 90 : void 0 }) });
|
|
19
|
+
};
|
|
20
|
+
const DefaultExpandIcon = memo(DefaultExpandIconComponent);
|
|
21
|
+
export {
|
|
22
|
+
DefaultExpandIcon
|
|
23
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Theme } from 'themes';
|
|
2
|
+
export declare const expandIconWrapperStyle: (theme: Theme) => {
|
|
3
|
+
readonly cursor: "pointer";
|
|
4
|
+
readonly appearance: "none";
|
|
5
|
+
readonly display: "inline-flex";
|
|
6
|
+
readonly fontSize: 12;
|
|
7
|
+
readonly border: 0;
|
|
8
|
+
readonly padding: 4;
|
|
9
|
+
readonly borderRadius: 4;
|
|
10
|
+
readonly backgroundColor: "transparent";
|
|
11
|
+
readonly color: `rgba(${number}, ${number}, ${number}, 0.3)`;
|
|
12
|
+
readonly ":hover": {
|
|
13
|
+
readonly color: `rgba(${number}, ${number}, ${number}, 0.7)`;
|
|
14
|
+
readonly backgroundColor: `rgba(${number}, ${number}, ${number}, 0.08)`;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare const nonExpandableExpandIconWrapperStyle: {
|
|
18
|
+
readonly visibility: "hidden";
|
|
19
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const expandIconWrapperStyle = (theme) => ({
|
|
2
|
+
cursor: "pointer",
|
|
3
|
+
appearance: "none",
|
|
4
|
+
display: "inline-flex",
|
|
5
|
+
fontSize: theme.iconS,
|
|
6
|
+
border: 0,
|
|
7
|
+
padding: theme.paddingXS,
|
|
8
|
+
borderRadius: theme.borderRadiusM,
|
|
9
|
+
backgroundColor: "transparent",
|
|
10
|
+
color: theme.textIcon,
|
|
11
|
+
":hover": {
|
|
12
|
+
color: theme.textIconHover,
|
|
13
|
+
backgroundColor: theme.bgIconHover
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const nonExpandableExpandIconWrapperStyle = {
|
|
17
|
+
visibility: "hidden"
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
expandIconWrapperStyle,
|
|
21
|
+
nonExpandableExpandIconWrapperStyle
|
|
22
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ExpandIconWrapperProps } from './ExpandIconWrapper.types';
|
|
2
|
+
import { DefaultRecord } from 'components/Table/Table.types';
|
|
3
|
+
export declare const ExpandIconWrapper: <Record extends DefaultRecord>(props: ExpandIconWrapperProps<Record>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
package/dist/components/Table/features/tableExpand/components/ExpandIconWrapper/ExpandIconWrapper.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useEvent } from "../../../../../../hooks/useEvent/useEvent.js";
|
|
3
|
+
import { useTableContext } from "../../../../contexts/tableContext/useTableContext/useTableContext.js";
|
|
4
|
+
import { useTableExpandedContext } from "../../contexts/tableExpandedContext/useTableExpandedContext/useTableExpandedContext.js";
|
|
5
|
+
const ExpandIconWrapperComponent = (props) => {
|
|
6
|
+
const {
|
|
7
|
+
expandable,
|
|
8
|
+
record,
|
|
9
|
+
rowKey
|
|
10
|
+
} = props;
|
|
11
|
+
const {
|
|
12
|
+
ExpandIcon
|
|
13
|
+
} = useTableContext();
|
|
14
|
+
const {
|
|
15
|
+
expandedKeys,
|
|
16
|
+
onTriggerExpand: onTriggerExpandProp
|
|
17
|
+
} = useTableExpandedContext();
|
|
18
|
+
const onTriggerExpand = useEvent(onTriggerExpandProp);
|
|
19
|
+
return /* @__PURE__ */ jsx(ExpandIcon, { expanded: expandedKeys.has(rowKey), record, expandable, onExpand: onTriggerExpand });
|
|
20
|
+
};
|
|
21
|
+
const ExpandIconWrapper = ExpandIconWrapperComponent;
|
|
22
|
+
export {
|
|
23
|
+
ExpandIconWrapper
|
|
24
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { TableExpandedContext } from './tableExpandedContext/TableExpandedContext';
|
|
2
|
+
export { useTableExpandedContext } from './tableExpandedContext/useTableExpandedContext/useTableExpandedContext';
|
|
3
|
+
export type { TableExpandedContextValue } from './tableExpandedContext/TableExpandedContext.types';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useBodyExpand } from '../../hooks';
|
|
2
|
+
type UseBodyExpandReturnType = ReturnType<typeof useBodyExpand>;
|
|
3
|
+
export interface TableExpandedContextValue {
|
|
4
|
+
expandedKeys: UseBodyExpandReturnType["expandedKeys"];
|
|
5
|
+
onTriggerExpand: UseBodyExpandReturnType["onTriggerExpand"];
|
|
6
|
+
}
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useTableExpandedContext: () => import('../TableExpandedContext.types').TableExpandedContextValue;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DefaultRecord } from 'components/Table/Table.types';
|
|
2
|
+
import { UseBodyExpandOptions } from './useBodyExpand.types';
|
|
3
|
+
export declare const useBodyExpand: <Record extends DefaultRecord>(options: UseBodyExpandOptions<Record>) => {
|
|
4
|
+
expandedKeys: Set<import('react').Key>;
|
|
5
|
+
onTriggerExpand: <Record_1 extends DefaultRecord>(record: Record_1) => void;
|
|
6
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useState, useMemo, useCallback } from "react";
|
|
2
|
+
import { getRowKey } from "../../../../utils/getRowKey/getRowKey.js";
|
|
3
|
+
const useBodyExpand = (options) => {
|
|
4
|
+
const {
|
|
5
|
+
expandable
|
|
6
|
+
} = options;
|
|
7
|
+
const {
|
|
8
|
+
defaultExpandedRowKeys,
|
|
9
|
+
expandedRowKeys,
|
|
10
|
+
onExpandedRowsChange
|
|
11
|
+
} = expandable || {};
|
|
12
|
+
const [innerExpandedKeys, setInnerExpandedKeys] = useState(() => defaultExpandedRowKeys || []);
|
|
13
|
+
const expandedKeys = useMemo(() => {
|
|
14
|
+
return new Set(expandedRowKeys || innerExpandedKeys || []);
|
|
15
|
+
}, [expandedRowKeys, innerExpandedKeys]);
|
|
16
|
+
const handleTriggerExpand = useCallback((record) => {
|
|
17
|
+
const key = getRowKey(record);
|
|
18
|
+
let newExpandedKeys;
|
|
19
|
+
const hasKey = expandedKeys.has(key);
|
|
20
|
+
if (hasKey) {
|
|
21
|
+
expandedKeys.delete(key);
|
|
22
|
+
newExpandedKeys = [...expandedKeys];
|
|
23
|
+
} else {
|
|
24
|
+
newExpandedKeys = [...expandedKeys, key];
|
|
25
|
+
}
|
|
26
|
+
setInnerExpandedKeys(newExpandedKeys);
|
|
27
|
+
if (onExpandedRowsChange) {
|
|
28
|
+
onExpandedRowsChange(newExpandedKeys);
|
|
29
|
+
}
|
|
30
|
+
}, [expandedKeys, onExpandedRowsChange]);
|
|
31
|
+
return {
|
|
32
|
+
expandedKeys,
|
|
33
|
+
onTriggerExpand: handleTriggerExpand
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
useBodyExpand
|
|
38
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseTableExpandOptions } from './useTableExpand.types';
|
|
2
|
+
import { DefaultRecord } from '../../../../Table.types';
|
|
3
|
+
export declare const useTableExpand: <Record extends DefaultRecord>(options: UseTableExpandOptions<Record>) => {
|
|
4
|
+
expandIconColumnIndex: number;
|
|
5
|
+
isSomeRecordHasChildren: boolean;
|
|
6
|
+
indentSize: number;
|
|
7
|
+
ExpandIcon: import('react').MemoExoticComponent<(<Record_1 extends DefaultRecord>(props: import('../../components/DefaultExpandIcon/DefaultExpandIcon.types').DefaultExpandIconProps<Record_1>) => import("@emotion/react/jsx-runtime").JSX.Element)> | import('react').ComponentType<import('../..').ExpandIconProps<Record>>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { DefaultExpandIcon } from "../../components/DefaultExpandIcon/DefaultExpandIcon.js";
|
|
3
|
+
import { defaultIndentSize } from "../../../tableSort/utils/const.js";
|
|
4
|
+
const useTableExpand = (options) => {
|
|
5
|
+
const {
|
|
6
|
+
expandable,
|
|
7
|
+
dataSource,
|
|
8
|
+
rowSelection
|
|
9
|
+
} = options;
|
|
10
|
+
const {
|
|
11
|
+
indentSize = defaultIndentSize,
|
|
12
|
+
expandIcon: ExpandIconProp
|
|
13
|
+
} = expandable || {};
|
|
14
|
+
const expandIconColumnIndex = rowSelection ? 1 : 0;
|
|
15
|
+
const ExpandIcon = ExpandIconProp || DefaultExpandIcon;
|
|
16
|
+
const isSomeRecordHasChildren = useMemo(() => dataSource.some((record) => "children" in record && Array.isArray(record.children)), [dataSource]);
|
|
17
|
+
return {
|
|
18
|
+
expandIconColumnIndex,
|
|
19
|
+
isSomeRecordHasChildren,
|
|
20
|
+
indentSize,
|
|
21
|
+
ExpandIcon
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
useTableExpand
|
|
26
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { useBodyExpand, useTableExpand } from './hooks';
|
|
2
|
+
export { TableExpandedContext, useTableExpandedContext, type TableExpandedContextValue, } from './contexts';
|
|
3
|
+
export type { ExpandIconProps, ExpandableConfig } from './types';
|
|
4
|
+
export { ExpandIconWrapper } from './components/ExpandIconWrapper/ExpandIconWrapper';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Key } from 'components/Table/Table.types';
|
|
2
|
+
import { MouseEvent, ComponentType } from 'react';
|
|
3
|
+
export type TriggerEventHandler<Record> = (record: Record, event: MouseEvent<HTMLElement>) => void;
|
|
4
|
+
export interface ExpandIconProps<Record> {
|
|
5
|
+
expanded: boolean;
|
|
6
|
+
record: Record;
|
|
7
|
+
expandable: boolean;
|
|
8
|
+
onExpand: TriggerEventHandler<Record>;
|
|
9
|
+
}
|
|
10
|
+
export interface ExpandableConfig<Record> {
|
|
11
|
+
defaultExpandedRowKeys?: readonly Key[];
|
|
12
|
+
expandedRowKeys?: readonly Key[];
|
|
13
|
+
expandIcon?: ComponentType<ExpandIconProps<Record>>;
|
|
14
|
+
onExpandedRowsChange?: (expandedKeys: readonly Key[]) => void;
|
|
15
|
+
indentSize?: number;
|
|
16
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CheckboxCellContentWrapperProps } from './CheckboxCellContentWrapper.types';
|
|
2
|
+
import { DefaultRecord } from 'components/Table/Table.types';
|
|
3
|
+
export declare const CheckboxCellContentWrapper: <Record extends DefaultRecord>(props: CheckboxCellContentWrapperProps<Record>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { useEvent } from "../../../../../../hooks/useEvent/useEvent.js";
|
|
4
|
+
import { arrDel, arrAdd } from "./CheckboxCellContentWrapper.utils.js";
|
|
5
|
+
import { Checkbox } from "../../../../../Checkbox/index.js";
|
|
6
|
+
import { selectionItemContainerStyle, getBorderedSelectionItemContainerStyle } from "../../styles.js";
|
|
7
|
+
import { useTableRowSelectionContext } from "../../contexts/tableRowSelectionContext/useTableRowSelectionContext/useTableRowSelectionContext.js";
|
|
8
|
+
import { useTableContext } from "../../../../contexts/tableContext/useTableContext/useTableContext.js";
|
|
9
|
+
import { getRowKey } from "../../../../utils/getRowKey/getRowKey.js";
|
|
10
|
+
const CheckboxCellContentWrapperComponent = (props) => {
|
|
11
|
+
const {
|
|
12
|
+
renderCell: RenderCell,
|
|
13
|
+
record
|
|
14
|
+
} = props;
|
|
15
|
+
const {
|
|
16
|
+
checkboxPropsMap,
|
|
17
|
+
derivedSelectedKeySet,
|
|
18
|
+
derivedSelectedKeys,
|
|
19
|
+
derivedHalfSelectedKeySet,
|
|
20
|
+
recordKeys,
|
|
21
|
+
setSelectedKeys,
|
|
22
|
+
triggerSingleSelection,
|
|
23
|
+
multipleSelect,
|
|
24
|
+
updatePrevSelectedIndex
|
|
25
|
+
} = useTableRowSelectionContext();
|
|
26
|
+
const {
|
|
27
|
+
isSomeRecordHasChildren,
|
|
28
|
+
bordered
|
|
29
|
+
} = useTableContext();
|
|
30
|
+
const key = getRowKey(record);
|
|
31
|
+
const checked = derivedSelectedKeySet.has(key);
|
|
32
|
+
const indeterminate = derivedHalfSelectedKeySet.has(key);
|
|
33
|
+
const checkboxProps = checkboxPropsMap.get(key);
|
|
34
|
+
let mergedIndeterminate;
|
|
35
|
+
if (isSomeRecordHasChildren) {
|
|
36
|
+
mergedIndeterminate = indeterminate;
|
|
37
|
+
} else {
|
|
38
|
+
mergedIndeterminate = (checkboxProps == null ? void 0 : checkboxProps.indeterminate) ?? indeterminate;
|
|
39
|
+
}
|
|
40
|
+
const handleClick = useEvent((e) => {
|
|
41
|
+
var _a;
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
(_a = checkboxProps == null ? void 0 : checkboxProps.onClick) == null ? void 0 : _a.call(checkboxProps, e);
|
|
44
|
+
});
|
|
45
|
+
const handleChange = useEvent((event) => {
|
|
46
|
+
var _a;
|
|
47
|
+
const {
|
|
48
|
+
nativeEvent
|
|
49
|
+
} = event;
|
|
50
|
+
const {
|
|
51
|
+
shiftKey
|
|
52
|
+
} = nativeEvent;
|
|
53
|
+
const currentSelectedIndex = recordKeys.indexOf(key);
|
|
54
|
+
const isMultiple = derivedSelectedKeys.some((item) => recordKeys.includes(item));
|
|
55
|
+
if (shiftKey && isMultiple) {
|
|
56
|
+
const keySet = new Set(derivedSelectedKeySet);
|
|
57
|
+
multipleSelect(currentSelectedIndex, recordKeys, keySet);
|
|
58
|
+
const keys = Array.from(keySet);
|
|
59
|
+
setSelectedKeys(keys, "multiple");
|
|
60
|
+
} else {
|
|
61
|
+
const originCheckedKeys = derivedSelectedKeys;
|
|
62
|
+
const checkedKeys = checked ? arrDel(originCheckedKeys, key) : arrAdd(originCheckedKeys, key);
|
|
63
|
+
triggerSingleSelection(key, !checked, checkedKeys, nativeEvent);
|
|
64
|
+
}
|
|
65
|
+
if (checked) {
|
|
66
|
+
updatePrevSelectedIndex(null);
|
|
67
|
+
} else {
|
|
68
|
+
updatePrevSelectedIndex(currentSelectedIndex);
|
|
69
|
+
}
|
|
70
|
+
(_a = checkboxProps == null ? void 0 : checkboxProps.onChange) == null ? void 0 : _a.call(checkboxProps, event);
|
|
71
|
+
});
|
|
72
|
+
const Wrapper = RenderCell ?? Fragment;
|
|
73
|
+
return /* @__PURE__ */ jsx("div", { css: [selectionItemContainerStyle, bordered ? getBorderedSelectionItemContainerStyle() : void 0, process.env.NODE_ENV === "production" ? "" : ";label:CheckboxCellContentWrapperComponent;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9idWlsZHMvZnJvbnRlbmQvbGlicy91aS1raXQvc3JjL2NvbXBvbmVudHMvVGFibGUvZmVhdHVyZXMvdGFibGVSb3dTZWxlY3Rpb24vY29tcG9uZW50cy9DaGVja2JveENlbGxDb250ZW50V3JhcHBlci9DaGVja2JveENlbGxDb250ZW50V3JhcHBlci50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBaUZNIiwiZmlsZSI6Ii9idWlsZHMvZnJvbnRlbmQvbGlicy91aS1raXQvc3JjL2NvbXBvbmVudHMvVGFibGUvZmVhdHVyZXMvdGFibGVSb3dTZWxlY3Rpb24vY29tcG9uZW50cy9DaGVja2JveENlbGxDb250ZW50V3JhcHBlci9DaGVja2JveENlbGxDb250ZW50V3JhcHBlci50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBGcmFnbWVudCB9IGZyb20gXCJyZWFjdFwiO1xuaW1wb3J0IHR5cGUgeyBDaGVja2JveENlbGxDb250ZW50V3JhcHBlclByb3BzIH0gZnJvbSBcIi4vQ2hlY2tib3hDZWxsQ29udGVudFdyYXBwZXIudHlwZXNcIjtcbmltcG9ydCB7IHVzZVRhYmxlQ29udGV4dCB9IGZyb20gXCJjb21wb25lbnRzL1RhYmxlL2NvbnRleHRzXCI7XG5pbXBvcnQgeyB1c2VFdmVudCB9IGZyb20gXCJob29rcy91c2VFdmVudFwiO1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biAgICB9XG5cbiAgICBjaGVja2JveFByb3BzPy5vbkNoYW5nZT8uKGV2ZW50KTtcbiAgfSkgc2F0aXNmaWVzIENoZWNrYm94UHJvcHNbXCJvbkNoYW5nZVwiXSk7XG5cbiAgY29uc3QgV3JhcHBlciA9IFJlbmRlckNlbGwgPz8gRnJhZ21lbnQ7XG5cbiAgcmV0dXJuIChcbiAgICA8ZGl2XG4gICAgICBjc3M9e1tcbiAgICAgICAgc2VsZWN0aW9uSXRlbUNvbnRhaW5lclN0eWxlLFxuICAgICAgICBib3JkZXJlZCA/IGdldEJvcmRlcmVkU2VsZWN0aW9uSXRlbUNvbnRhaW5lclN0eWxlKCkgOiB1bmRlZmluZWQsXG4gICAgICBdfVxuICAgID5cbiAgICAgIDxXcmFwcGVyPlxuICAgICAgICA8Q2hlY2tib3hcbiAgICAgICAgICB7Li4uY2hlY2tib3hQcm9wc31cbiAgICAgICAgICBjaGVja2VkPXtjaGVja2VkfVxuICAgICAgICAgIGluZGV0ZXJtaW5hdGU9e21lcmdlZEluZGV0ZXJtaW5hdGV9XG4gICAgICAgICAgb25DbGljaz17aGFuZGxlQ2xpY2t9XG4gICAgICAgICAgb25DaGFuZ2U9e2hhbmRsZUNoYW5nZX1cbiAgICAgICAgLz5cbiAgICAgIDwvV3JhcHBlcj5cbiAgICA8L2Rpdj5cbiAgKTtcbn07XG5cbmV4cG9ydCBjb25zdCBDaGVja2JveENlbGxDb250ZW50V3JhcHBlciA9IENoZWNrYm94Q2VsbENvbnRlbnRXcmFwcGVyQ29tcG9uZW50O1xuIl19 */"], children: /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(Checkbox, { ...checkboxProps, checked, indeterminate: mergedIndeterminate, onClick: handleClick, onChange: handleChange }) }) });
|
|
74
|
+
};
|
|
75
|
+
const CheckboxCellContentWrapper = CheckboxCellContentWrapperComponent;
|
|
76
|
+
export {
|
|
77
|
+
CheckboxCellContentWrapper
|
|
78
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function arrDel(list, value) {
|
|
2
|
+
if (!list) return [];
|
|
3
|
+
const clone = list.slice();
|
|
4
|
+
const index = clone.indexOf(value);
|
|
5
|
+
if (index >= 0) {
|
|
6
|
+
clone.splice(index, 1);
|
|
7
|
+
}
|
|
8
|
+
return clone;
|
|
9
|
+
}
|
|
10
|
+
function arrAdd(list, value) {
|
|
11
|
+
const clone = (list || []).slice();
|
|
12
|
+
if (clone.indexOf(value) === -1) {
|
|
13
|
+
clone.push(value);
|
|
14
|
+
}
|
|
15
|
+
return clone;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
arrAdd,
|
|
19
|
+
arrDel
|
|
20
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { Checkbox } from "../../../../../Checkbox/index.js";
|
|
4
|
+
import { selectionItemContainerStyle, getBorderedSelectionItemContainerStyle } from "../../styles.js";
|
|
5
|
+
import { useTableContext } from "../../../../contexts/tableContext/useTableContext/useTableContext.js";
|
|
6
|
+
import { useTableRowSelectionContext } from "../../contexts/tableRowSelectionContext/useTableRowSelectionContext/useTableRowSelectionContext.js";
|
|
7
|
+
import { getRowKey } from "../../../../utils/getRowKey/getRowKey.js";
|
|
8
|
+
const HeaderCheckboxCellContentWrapperComponent = (props) => {
|
|
9
|
+
const {
|
|
10
|
+
columnTitle: ColumnTitle,
|
|
11
|
+
getTitleCheckboxProps
|
|
12
|
+
} = props;
|
|
13
|
+
const {
|
|
14
|
+
bordered
|
|
15
|
+
} = useTableContext();
|
|
16
|
+
const {
|
|
17
|
+
checkboxPropsMap,
|
|
18
|
+
flattedData,
|
|
19
|
+
checkedCurrentAll,
|
|
20
|
+
checkedCurrentSome,
|
|
21
|
+
keySet,
|
|
22
|
+
recordKeys,
|
|
23
|
+
setSelectedKeys,
|
|
24
|
+
updatePrevSelectedIndex
|
|
25
|
+
} = useTableRowSelectionContext();
|
|
26
|
+
const allDisabledData = flattedData.map((record) => {
|
|
27
|
+
const key = getRowKey(record);
|
|
28
|
+
const checkboxProps = checkboxPropsMap.get(key) || {};
|
|
29
|
+
return {
|
|
30
|
+
checked: keySet.has(key),
|
|
31
|
+
...checkboxProps
|
|
32
|
+
};
|
|
33
|
+
}).filter(({
|
|
34
|
+
disabled: disabled2
|
|
35
|
+
}) => disabled2);
|
|
36
|
+
const allDisabled = !!allDisabledData.length && allDisabledData.length === flattedData.length;
|
|
37
|
+
const allDisabledAndChecked = allDisabled && allDisabledData.every(({
|
|
38
|
+
checked
|
|
39
|
+
}) => checked);
|
|
40
|
+
const allDisabledSomeChecked = allDisabled && allDisabledData.some(({
|
|
41
|
+
checked
|
|
42
|
+
}) => checked);
|
|
43
|
+
const customCheckboxProps = (getTitleCheckboxProps == null ? void 0 : getTitleCheckboxProps()) || {};
|
|
44
|
+
const {
|
|
45
|
+
onChange,
|
|
46
|
+
disabled
|
|
47
|
+
} = customCheckboxProps;
|
|
48
|
+
const onSelectAllChange = () => {
|
|
49
|
+
if (checkedCurrentAll) {
|
|
50
|
+
recordKeys.forEach((key) => {
|
|
51
|
+
keySet.delete(key);
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
recordKeys.forEach((key) => {
|
|
55
|
+
if (!keySet.has(key)) {
|
|
56
|
+
keySet.add(key);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const keys = Array.from(keySet);
|
|
61
|
+
setSelectedKeys(keys, "all");
|
|
62
|
+
updatePrevSelectedIndex(null);
|
|
63
|
+
};
|
|
64
|
+
const Wrapper = ColumnTitle ?? Fragment;
|
|
65
|
+
return /* @__PURE__ */ jsx("div", { css: [selectionItemContainerStyle, bordered ? getBorderedSelectionItemContainerStyle(true) : void 0, process.env.NODE_ENV === "production" ? "" : ";label:HeaderCheckboxCellContentWrapperComponent;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9idWlsZHMvZnJvbnRlbmQvbGlicy91aS1raXQvc3JjL2NvbXBvbmVudHMvVGFibGUvZmVhdHVyZXMvdGFibGVSb3dTZWxlY3Rpb24vY29tcG9uZW50cy9IZWFkZXJDaGVja2JveENlbGxDb250ZW50V3JhcHBlci9IZWFkZXJDaGVja2JveENlbGxDb250ZW50V3JhcHBlci50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBb0VNIiwiZmlsZSI6Ii9idWlsZHMvZnJvbnRlbmQvbGlicy91aS1raXQvc3JjL2NvbXBvbmVudHMvVGFibGUvZmVhdHVyZXMvdGFibGVSb3dTZWxlY3Rpb24vY29tcG9uZW50cy9IZWFkZXJDaGVja2JveENlbGxDb250ZW50V3JhcHBlci9IZWFkZXJDaGVja2JveENlbGxDb250ZW50V3JhcHBlci50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBGcmFnbWVudCB9IGZyb20gXCJyZWFjdFwiO1xuaW1wb3J0IHR5cGUgeyBIZWFkZXJDaGVja2JveENlbGxDb250ZW50V3JhcHBlclByb3BzIH0gZnJvbSBcIi4vSGVhZGVyQ2hlY2tib3hDZWxsQ29udGVudFdyYXBwZXIudHlwZXNcIjtcbmltcG9ydCB0eXBlIHsgS2V5IH0gZnJvbSBcImNvbXBvbmVudHMvVGFibGUvVGFibGUudHlwZXNcIjtcbmltcG9ydCB7IHVzZVRhYmxlQ29udGV4dCB9IGZyb20gXCJjb21wb25lbnRzL1RhYmxlL2NvbnRleHRzXCI7XG5pbXBvcnQgeyBnZXRSb3dLZXkgfSBmcm9tIFwiY29tcG9uZW50cy9UYWJsZS91dGlsc1wiO1xuaW1wb3J0IHsgQ2hlY2tib3ggfSBmcm9tIFwiY29tcG9uZW50cy9DaGVja2JveFwiO1xuaW1wb3J0IHsgZ2V0Qm9yZGVyZWRTZWxlY3Rpb25JdGVtQ29ud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UoKTtcbiAgICAgICAgICAgIG9uQ2hhbmdlPy4oZSk7XG4gICAgICAgICAgfX1cbiAgICAgICAgICBkaXNhYmxlZD17ZGlzYWJsZWQgPz8gKGZsYXR0ZWREYXRhLmxlbmd0aCA9PT0gMCB8fCBhbGxEaXNhYmxlZCl9XG4gICAgICAgIC8+XG4gICAgICA8L1dyYXBwZXI+XG4gICAgPC9kaXY+XG4gICk7XG59O1xuXG5leHBvcnQgY29uc3QgSGVhZGVyQ2hlY2tib3hDZWxsQ29udGVudFdyYXBwZXIgPSBIZWFkZXJDaGVja2JveENlbGxDb250ZW50V3JhcHBlckNvbXBvbmVudDtcbiJdfQ== */"], children: /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(Checkbox, { "aria-label": "Select all", ...customCheckboxProps, checked: !allDisabled ? !!flattedData.length && checkedCurrentAll : allDisabledAndChecked, indeterminate: !allDisabled ? !checkedCurrentAll && checkedCurrentSome : !allDisabledAndChecked && allDisabledSomeChecked, onChange: (e) => {
|
|
66
|
+
onSelectAllChange();
|
|
67
|
+
onChange == null ? void 0 : onChange(e);
|
|
68
|
+
}, disabled: disabled ?? (flattedData.length === 0 || allDisabled) }) }) });
|
|
69
|
+
};
|
|
70
|
+
const HeaderCheckboxCellContentWrapper = HeaderCheckboxCellContentWrapperComponent;
|
|
71
|
+
export {
|
|
72
|
+
HeaderCheckboxCellContentWrapper
|
|
73
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { TableRowSelection } from '../../types';
|
|
3
|
+
export interface HeaderCheckboxCellContentWrapperProps<Record> extends Pick<TableRowSelection<Record>, "getTitleCheckboxProps"> {
|
|
4
|
+
columnTitle?: Extract<TableRowSelection<Record>["columnTitle"], ComponentType>;
|
|
5
|
+
}
|