diff --git a/package.json b/package.json index 9b96d4bb..c59610fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ka-table", - "version": "7.10.1", + "version": "7.11.0", "license": "MIT", "repository": "github:komarovalexander/ka-table", "homepage": "https://komarovalexander.github.io/ka-table/#/overview", diff --git a/src/lib/Components/NoDataRow/NoDataRow.test.tsx b/src/lib/Components/NoDataRow/NoDataRow.test.tsx index a0baa8bc..e36bc85a 100644 --- a/src/lib/Components/NoDataRow/NoDataRow.test.tsx +++ b/src/lib/Components/NoDataRow/NoDataRow.test.tsx @@ -1,8 +1,13 @@ +import Enzyme, { mount } from 'enzyme'; + +import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; import { INoDataRowProps } from '../../props'; import NoDataRow from './NoDataRow'; import React from 'react'; import ReactDOM from 'react-dom'; +Enzyme.configure({ adapter: new Adapter() }); + const props: INoDataRowProps = { childComponents: {}, columns: [], @@ -14,3 +19,17 @@ it('renders without crashing', () => { ReactDOM.render(, div); ReactDOM.unmountComponentAtNode(div); }); + +it('custom colspan for cell', () => { + const wrapper = mount( ({ + colSpan: 100 + }) + } + }}/>, { + attachTo: document.createElement('tbody') + }); + expect(wrapper.find('.ka-no-data-cell').exists()).toBeTruthy(); + expect(wrapper.find('.ka-no-data-cell').prop('colSpan')).toBe(100); +}); diff --git a/src/lib/Components/NoDataRow/NoDataRow.tsx b/src/lib/Components/NoDataRow/NoDataRow.tsx index f98e6014..26c56a76 100644 --- a/src/lib/Components/NoDataRow/NoDataRow.tsx +++ b/src/lib/Components/NoDataRow/NoDataRow.tsx @@ -1,6 +1,5 @@ -import React from 'react'; - import { INoDataRowProps } from '../../props'; +import React from 'react'; import { getElementCustomization } from '../../Utils/ComponentUtils'; const NoDataRow: React.FunctionComponent = (props) => { @@ -12,10 +11,13 @@ const NoDataRow: React.FunctionComponent = (props) => { const { elementAttributes, content } = getElementCustomization({ className: 'ka-tr ka-no-data-row' }, props, childComponents.noDataRow); + const { elementAttributes: cellElementAttributes, content: cellContent } = getElementCustomization({ + className: 'ka-no-data-cell' + }, props, childComponents.noDataCell); return ( - - {content} + + {content || cellContent} ); diff --git a/src/lib/Models/ChildComponents.ts b/src/lib/Models/ChildComponents.ts index 0ab5f2b5..afb8519c 100644 --- a/src/lib/Models/ChildComponents.ts +++ b/src/lib/Models/ChildComponents.ts @@ -29,6 +29,7 @@ export class ChildComponents { public headRow?: ChildComponent; public loading?: ChildComponent; public noDataRow?: ChildComponent; + public noDataCell?: ChildComponent; public paging?: ChildComponent; public pagingIndex?: ChildComponent; public pagingPages?: ChildComponent;