aio-table 11.0.1 → 11.0.2

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.
Files changed (2) hide show
  1. package/index.js +9 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -34,6 +34,9 @@ const AIOTable = (props) => {
34
34
  propsRef.current = props;
35
35
  const pagingHook = UT.usePaging({ rows: props.value, paging: props.paging, onChange: props.onChangePaging });
36
36
  const getColumnOption = (key, cellDetails) => {
37
+ if (key === 'id') {
38
+ return cellDetails.column.id;
39
+ }
37
40
  const columnValue = cellDetails.column[key];
38
41
  if (columnValue !== undefined) {
39
42
  const { getValue = {} } = props;
@@ -62,7 +65,7 @@ const AIOTable = (props) => {
62
65
  if (props.onChangeColumns) {
63
66
  props.onChangeColumns(newColumns);
64
67
  }
65
- }, 'aio-table-title', 'aio-table-unit');
68
+ }, 'aio-table-title');
66
69
  const getGetValue = (sort, column) => {
67
70
  if (sort.getValue) {
68
71
  return sort.getValue;
@@ -309,7 +312,7 @@ const TableRows = () => {
309
312
  };
310
313
  const TableToolbar = () => {
311
314
  let { add, exportToExcel, search, rootProps, excelColumns, toggleColumns, getIcon, sortHook, getColumnOption, tableHook } = useProvider();
312
- let { toolbarAttrs, toolbar, onAdd, onSearch, value, onChangeColumns, columns } = rootProps;
315
+ let { toolbarAttrs, toolbar, onAdd, onSearch, value, onChangeColumns, columns = [] } = rootProps;
313
316
  const columnsRef = useRef(columns);
314
317
  columnsRef.current = columns;
315
318
  toolbarAttrs = UT.AddToAttrs(toolbarAttrs, { className: 'aio-table-toolbar' });
@@ -329,8 +332,8 @@ const TableToolbar = () => {
329
332
  return getColumnOption(key, tableHook.getCellDetail({ column }));
330
333
  };
331
334
  return (_jsxs("div", Object.assign({}, toolbarAttrs, { children: [toolbar && _jsx("div", { className: 'aio-table-toolbar-content', children: typeof toolbar === 'function' ? toolbar() : toolbar }), !!onSearch &&
332
- _jsx("div", { className: 'aio-table-search', children: _jsx(AIOInput, { type: 'text', onChange: (value) => search(value), after: getIcon('mdiMagnify', 0.7) }) }), sortHook.renderSortButton(), !!excelColumns.length && _jsx("div", { className: 'aio-table-toolbar-button', onClick: () => exportToExcel(), children: getIcon('mdiFileExcel', 0.8) }), !!toggleColumns.length &&
333
- _jsx("div", { className: 'aio-table-toolbar-button', children: _jsx(AISelect, { text: getIcon('mdiEye', 0.8), hideTags: true, options: toggleColumns, caret: false, option: {
335
+ _jsx("div", { className: 'aio-table-search', children: _jsx(AIOInput, { type: 'text', onChange: (value) => search(value), after: getIcon('mdiMagnify', 0.7) }) }), sortHook.renderSortButton(), !!excelColumns.length && _jsx("div", { className: 'aio-table-toolbar-button aio-table-excel-button', onClick: () => exportToExcel(), children: getIcon('mdiFileExcel', 0.8) }), !!toggleColumns.length &&
336
+ _jsx("div", { className: 'aio-table-toolbar-button aio-table-toggle-button', children: _jsx(AISelect, { text: getIcon('mdiEye', 0.8), hideTags: true, options: toggleColumns, caret: false, option: {
334
337
  text: (column) => getColumnOptionWrapper(column.id, 'title'),
335
338
  checked: (column) => getColumnOptionWrapper(column.id, 'show'),
336
339
  onClick: (column) => {
@@ -341,7 +344,7 @@ const TableToolbar = () => {
341
344
  onChangeColumns(columns.map((o) => column.id === o.id ? Object.assign(Object.assign({}, o), { show: !getColumnOptionWrapper(o.id, 'show') }) : o));
342
345
  },
343
346
  close: () => false
344
- } }) }), !!onAdd && _jsx("div", { className: 'aio-table-toolbar-button', onClick: () => add(), children: getAddText() })] })));
347
+ } }) }), !!onAdd && _jsx("div", { className: 'aio-table-toolbar-button aio-table-add-button', onClick: () => add(), children: getAddText() })] })));
345
348
  };
346
349
  const TableHeader = () => {
347
350
  let { rootProps, getColumnOption, tableHook } = useProvider();
@@ -439,7 +442,7 @@ const useTable = (getProps, getPaging, getColumnOption) => {
439
442
  else if (onChange) {
440
443
  onChange(newRows);
441
444
  }
442
- }, 'aio-table-row', 'aio-table-rows');
445
+ }, 'aio-table-row');
443
446
  const getCellValue = (cellDetail, cellValue, def) => {
444
447
  const { getValue = {} } = getProps();
445
448
  const paging = getPaging();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aio-table",
3
- "version": "11.0.1",
3
+ "version": "11.0.2",
4
4
  "description": "all in one table. tree mode , simple mode , tree mode, gantt mode , groupby mode, freeze mode.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",