Skip to content

Releases: komarovalexander/ka-table

Group panel

18 Mar 12:24
7a1e321
Compare
Choose a tag to compare

image

Allowing end-users to group by columns in UI #255
demo: https://komarovalexander.github.io/ka-table/#/grouping

groupPanel: {
    public enabled?: boolean;
    public text?: string;
    public deep?: number;
}

new action creators have been added: moveColumnBefore, insertColumn(#233), moveColumnToIndex, groupColumn, ungroupColumn

new childComponents: emptyCell, groupPanel, groupPanelCell

extendedSort

16 Mar 22:08
9358d23
Compare
Choose a tag to compare

#241
extendedSort allows fully customize sort logic, as a result you can use any extended sorting library, to implements different sort cases, such as MultipleSorting and others..

      extendedSort={(data, columns) => {
        let sortedColumns = columns.filter(c => c.sortDirection);
        if (sortedColumns.length === 0){
          return data;
        }
        sortedColumns = orderBy(sortedColumns, ['sortIndex'], ['asc']);
        const iteratee = sortedColumns.map(c => c.key);
        const order = sortedColumns.map(c => c.sortDirection === SortDirection.Ascend ? 'asc' : 'desc');
        return orderBy(data, iteratee, order);
      }}
      sortingMode={SortingMode.MultipleTripleStateRemote}

demo: https://komarovalexander.github.io/ka-table/#/sorting-extended

Add noData setting

06 Mar 18:02
0b8d48e
Compare
Choose a tag to compare
      noData={{
          text?: string;
          hideHeader?: boolean; // hide table header in case of no data
      }}

childComponents.noDataCell

14 Feb 22:06
a592cce
Compare
Choose a tag to compare

#281

childComponents: {
  noDataCell: {
    elementAttributes: () => ({
      colSpan: 1
    }),
  }
}

Add childComponents.detailsCell options

12 Feb 18:12
53d4bad
Compare
Choose a tag to compare

#281

childComponents: {
  detailsCell: {
    elementAttributes: () => ({
      colSpan: 1
    }),
  }
}

controlledPropsKeys

12 Feb 17:47
254b091
Compare
Choose a tag to compare

controlledPropsKeys is used to specify controlled properties in uncontrolled mode
default: ['searchText', 'loading'] if loading is enabled, ['searchText', 'loading', 'data', 'paging'] if loading is disabled

Uncontrolled mode

13 Jan 18:32
2273ae2
Compare
Choose a tag to compare

uncontrolled mode:

import React from 'react';

import { Table } from 'ka-table';
import { DataType, EditingMode, SortingMode } from 'ka-table/enums';

const OverviewDemo: React.FC = () => {
  return (
    <Table
      columns={[
        { key: 'column1', title: 'Column 1', dataType: DataType.String },
        { key: 'column2', title: 'Column 2', dataType: DataType.String },
        { key: 'column3', title: 'Column 3', dataType: DataType.String },
        { key: 'column4', title: 'Column 4', dataType: DataType.String },
      ]}
      data={dataArray}
      editingMode={EditingMode.Cell}
      rowKeyField={'id'}
      sortingMode={SortingMode.Single}
    />
  );
};

export default OverviewDemo;

controlled mode approach is the same as it was:

import React, { useState } from 'react';

import { ITableProps, kaReducer, Table } from 'ka-table';
import { DataType, EditingMode, SortingMode } from 'ka-table/enums';
import { DispatchFunc } from 'ka-table/types';

const tablePropsInit: ITableProps = {
  columns: [
    { key: 'column1', title: 'Column 1', dataType: DataType.String },
    { key: 'column2', title: 'Column 2', dataType: DataType.String },
    { key: 'column3', title: 'Column 3', dataType: DataType.String },
    { key: 'column4', title: 'Column 4', dataType: DataType.String }
  ],
  data: dataArray,
  editingMode: EditingMode.Cell,
  rowKeyField: 'id',
  sortingMode: SortingMode.Single
};

const OverviewDemo: React.FC = () => {
  const [tableProps, changeTableProps] = useState(tablePropsInit);
  const dispatch: DispatchFunc = action => {
    changeTableProps((prevState: ITableProps) => kaReducer(prevState, action));
  };

  return <Table {...tableProps} dispatch={dispatch} />;
};

export default OverviewDemo;

Just increased minor version as there are no breaking changes

Add treeExpandButtonColumnKey option to specify the column where tree button should be shown

03 Jan 10:09
748bd7e
Compare
Choose a tag to compare

#262
example:

const tablePropsInit: ITableProps = {
  columns: [
    { key: 'name', title: 'Name', dataType: DataType.String },
    { key: 'productivity', title: 'Productivity', dataType: DataType.Number },
  ],
  //...
  treeExpandButtonColumnKey: 'productivity',
  //...
};

Add column.isSortable & childComponents.sortIcon

10 Sep 11:00
654b92a
Compare
Choose a tag to compare

column.isSortable - disable sorting for specific column
childComponents.sortIcon - gives ability to customize sortIcon component

  columns: [{
      ...
      isSortable: false,
      ...
    }],
  childComponents={{
        sortIcon: {
           ...
        }
  }}

Demo: https://komarovalexander.github.io/ka-table/#/sorting
Docs: http://ka-table.com/docs_props.html#toc1

Loading panel customization

21 Aug 16:24
faf4bb3
Compare
Choose a tag to compare
        childComponents={{
          loading: {
            content: ({ text }) => (
              <>
                <img src='...'/>
                <div className='ka-loading-text'>{text}</div>
              </>
            )
          }
        }}