diff --git a/package.json b/package.json index 70cef8a1..dcfafe19 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ka-table", - "version": "8.0.1", + "version": "8.1.2", "license": "MIT", "repository": "github:komarovalexander/ka-table", "homepage": "https://komarovalexander.github.io/ka-table/#/overview", diff --git a/src/Demos/SelectionDemo/SelectionDemo.tsx b/src/Demos/SelectionDemo/SelectionDemo.tsx index 5c0d0d3f..06a3318c 100644 --- a/src/Demos/SelectionDemo/SelectionDemo.tsx +++ b/src/Demos/SelectionDemo/SelectionDemo.tsx @@ -62,6 +62,7 @@ const SelectionDemo: React.FC = () => { columns={[ { key: 'selection-cell', + isFilterable: false, }, { key: 'column1', title: 'Column 1', dataType: DataType.String }, { key: 'column2', title: 'Column 2', dataType: DataType.String }, @@ -84,13 +85,6 @@ const SelectionDemo: React.FC = () => { } }, }, - filterRowCell: { - content: (props) => { - if (props.column.key === 'selection-cell') { - return <>; - } - }, - }, headCell: { content: (props) => { if (props.column.key === 'selection-cell') { diff --git a/src/lib/Components/FilterCell/FilterCell.tsx b/src/lib/Components/FilterCell/FilterCell.tsx index ed6da09b..a6de86f2 100644 --- a/src/lib/Components/FilterCell/FilterCell.tsx +++ b/src/lib/Components/FilterCell/FilterCell.tsx @@ -1,29 +1,32 @@ import * as React from 'react'; -import defaultOptions from '../../defaultOptions'; +import FilterRowDataType from '../FilterRowDataType/FilterRowDataType'; import { IFilterRowEditorProps } from '../../props'; +import defaultOptions from '../../defaultOptions'; import { getElementCustomization } from '../../Utils/ComponentUtils'; -import FilterRowDataType from '../FilterRowDataType/FilterRowDataType'; const FilterCell: React.FunctionComponent = (props) => { const { childComponents, - column: { style }, + column, } = props; const { elementAttributes, content } = getElementCustomization({ className: `${defaultOptions.css.theadCell} ka-filter-row-cell ${defaultOptions.css.theadBackground} ${defaultOptions.css.theadFixed}`, - style + style: column.style }, props, childComponents.filterRowCell); return ( { - content ? content : - ( - - ) + column.isFilterable === false + ? <> + : content + ? content + : ( + + ) } ); diff --git a/src/lib/Models/Column.ts b/src/lib/Models/Column.ts index dce7c97e..1e746a85 100644 --- a/src/lib/Models/Column.ts +++ b/src/lib/Models/Column.ts @@ -1,4 +1,5 @@ import { DataType, SortDirection } from '../enums'; + import { Field } from '../types'; import { PopupPosition } from './PopupPosition'; @@ -12,6 +13,7 @@ export class Column { public headerFilterPopupPosition?: PopupPosition; public isHeaderFilterPopupShown?: boolean; public isEditable?: boolean; + public isFilterable?: boolean; public isResizable?: boolean; public isSortable?: boolean; public key!: string; diff --git a/src/lib/Utils/HeadRowUtils.ts b/src/lib/Utils/HeadRowUtils.ts index c31280ec..f81fedce 100644 --- a/src/lib/Utils/HeadRowUtils.ts +++ b/src/lib/Utils/HeadRowUtils.ts @@ -1,10 +1,10 @@ import { SortDirection, SortingMode } from '../enums'; -import { isMultipleSorting, isSortingEnabled, isTripleStateSorting, sortColumns } from './SortUtils'; +import { isMultipleSorting, isTripleStateSorting, sortColumns } from './SortUtils'; import { Column } from '../Models/Column'; import defaultOptions from '../defaultOptions'; -export const getHeadCellClassName = (sortingMode: SortingMode, isGrouped?: boolean) => `${defaultOptions.css.theadCell} ${defaultOptions.css.theadCellHeight} ${defaultOptions.css.theadFixed} ${defaultOptions.css.theadBackground} ${isSortingEnabled(sortingMode) ? 'ka-pointer' : ''} ${isGrouped ? 'ka-thead-grouped-cell' : ''}` +export const getHeadCellClassName = (sortingMode: SortingMode, isGrouped?: boolean) => `${defaultOptions.css.theadCell} ${defaultOptions.css.theadCellHeight} ${defaultOptions.css.theadFixed} ${defaultOptions.css.theadBackground} ${isGrouped ? 'ka-thead-grouped-cell' : ''}` export const getUpdatedSortedColumns = ( columns: Column[],