es-grid-template 1.1.7 → 1.2.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.
Files changed (31) hide show
  1. package/es/grid-component/ColumnsChoose.js +1 -1
  2. package/es/grid-component/GridStyle.js +1 -1
  3. package/es/grid-component/InternalTable.js +94 -107
  4. package/es/grid-component/TableGrid.d.ts +4 -2
  5. package/es/grid-component/TableGrid.js +17 -7
  6. package/es/grid-component/hooks/constant.js +14 -14
  7. package/es/grid-component/hooks/useColumns/index.d.ts +5 -3
  8. package/es/grid-component/hooks/useColumns/index.js +29 -1
  9. package/es/grid-component/hooks/utils.d.ts +6 -2
  10. package/es/grid-component/hooks/utils.js +44 -2
  11. package/es/grid-component/styles.scss +766 -701
  12. package/es/grid-component/table/Grid.d.ts +3 -0
  13. package/es/grid-component/table/Grid.js +3 -3
  14. package/es/grid-component/table/GridEdit.js +234 -168
  15. package/es/grid-component/type.d.ts +6 -2
  16. package/lib/grid-component/ColumnsChoose.js +1 -1
  17. package/lib/grid-component/GridStyle.js +1 -1
  18. package/lib/grid-component/InternalTable.js +92 -103
  19. package/lib/grid-component/TableGrid.d.ts +4 -2
  20. package/lib/grid-component/TableGrid.js +17 -7
  21. package/lib/grid-component/hooks/constant.js +14 -14
  22. package/lib/grid-component/hooks/useColumns/index.d.ts +5 -3
  23. package/lib/grid-component/hooks/useColumns/index.js +30 -1
  24. package/lib/grid-component/hooks/utils.d.ts +6 -2
  25. package/lib/grid-component/hooks/utils.js +51 -5
  26. package/lib/grid-component/styles.scss +766 -701
  27. package/lib/grid-component/table/Grid.d.ts +3 -0
  28. package/lib/grid-component/table/Grid.js +3 -3
  29. package/lib/grid-component/table/GridEdit.js +228 -164
  30. package/lib/grid-component/type.d.ts +6 -2
  31. package/package.json +105 -105
@@ -1,8 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { ColumnsTable, GridTableProps } from "../type";
3
+ import type { GetRowKey } from "../type";
3
4
  type Props<T> = GridTableProps<T> & {
4
5
  tableRef: any;
5
6
  triggerChangeColumns?: (columns: ColumnsTable<T>, type: string) => void;
7
+ triggerChangeData?: (newData: T[], type: string) => void;
8
+ getRowKey: GetRowKey<T>;
6
9
  };
7
10
  declare const Grid: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
8
11
  export default Grid;
@@ -4,12 +4,11 @@ import { GridStyle } from "../GridStyle";
4
4
  import TableGrid from "../TableGrid";
5
5
  // import type {ColumnsTable} from "../type";
6
6
 
7
- // import {renderContent} from "../hooks/useColumns";
8
-
9
7
  const Grid = props => {
10
8
  const {
11
9
  height,
12
10
  style,
11
+ rowHoverable,
13
12
  ...rest
14
13
  } = props;
15
14
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
@@ -21,7 +20,8 @@ const Grid = props => {
21
20
  style: {
22
21
  ...style,
23
22
  minHeight: height
24
- }
23
+ },
24
+ rowHoverable: rowHoverable ?? true
25
25
  }))));
26
26
  };
27
27
  export default Grid;
@@ -1,11 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import React, { Fragment, useEffect, useRef, useState } from 'react';
2
+ import React, { Fragment, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import customParseFormat from 'dayjs/plugin/customParseFormat';
4
4
  import classNames from "classnames";
5
- import { Form } from "antd";
5
+ import { Button, Dropdown, Form } from "antd";
6
6
  import { useForm } from 'react-hook-form';
7
7
  import { Toaster } from "react-hot-toast";
8
- import { renderContent } from "../hooks/useColumns";
8
+ import { flatColumns, renderContent } from "../hooks/useColumns";
9
9
  import EditableCell from "../EditableCell";
10
10
  import { GridStyle } from "../GridStyle";
11
11
  import { TableContext } from "../useContext";
@@ -13,9 +13,13 @@ import dayjs from "dayjs";
13
13
  import 'dayjs/locale/es';
14
14
  import 'dayjs/locale/vi';
15
15
  import TableGrid from "../TableGrid";
16
- import { getEditType, isObjEmpty, totalFixedWidth } from "../hooks";
16
+ import { getEditType, getRowNumber, isObjEmpty, totalFixedWidth } from "../hooks";
17
17
  import Message from "../../Message/Message";
18
- import Command from "../Command";
18
+
19
+ // import Command from "../Command";
20
+
21
+ import { Toolbar } from "rc-master-ui";
22
+ import classnames from "classnames";
19
23
  dayjs.extend(customParseFormat);
20
24
  const toast = 'top-right';
21
25
  const GridEdit = props => {
@@ -37,6 +41,7 @@ const GridEdit = props => {
37
41
  style,
38
42
  getRowKey,
39
43
  className,
44
+ toolbarItems,
40
45
  ...rest
41
46
  } = props;
42
47
 
@@ -47,11 +52,78 @@ const GridEdit = props => {
47
52
  const startCell = useRef(null);
48
53
  const isSelectingRow = useRef(false);
49
54
  const rowStart = useRef(null);
55
+ const itemsAdd = [{
56
+ key: '10',
57
+ label: '10 rows'
58
+ }, {
59
+ key: '50',
60
+ label: '50 rows'
61
+ }, {
62
+ key: '100',
63
+ label: '100 rows'
64
+ }];
50
65
  const [form] = Form.useForm();
51
66
  const [editingKey, setEditingKey] = useState('');
52
67
  const [selectedCells, setSelectedCells] = useState(new Set());
53
68
  const [rowsSelected, setRowsSelected] = useState(new Set());
54
69
  const [selectedCell, setSelectedCell] = useState(null);
70
+ const handleAdd = item => {
71
+ console.log(item);
72
+ if (item.onClick) {
73
+ console.log('cccccccccccccccc');
74
+ } else {
75
+ console.log('bbbbbbbbbbbbb');
76
+ }
77
+ };
78
+ const handleDuplicate = () => {};
79
+ const handleInsertBefore = () => {};
80
+ const handleInsertAfter = () => {};
81
+ const handleDeleteAll = () => {};
82
+ const toolbarItemsBottom = useMemo(() => {
83
+ return toolbarItems?.filter(it => it.position === 'Bottom').map(item => {
84
+ return {
85
+ ...item,
86
+ template: () => {
87
+ return /*#__PURE__*/React.createElement(Fragment, null, item.key === 'ADD' && /*#__PURE__*/React.createElement("div", {
88
+ className: classnames(`be-toolbar-item ${item.className}`)
89
+ }, /*#__PURE__*/React.createElement(Dropdown.Button, {
90
+ menu: {
91
+ items: itemsAdd,
92
+ onClick: () => handleAdd(item)
93
+ }
94
+ }, item.title ? t ? t(item.title) : item.title : t ? t('Add item') : 'Add item')), item.key === 'DUPLICATE' && item.visible !== false && editingKey && /*#__PURE__*/React.createElement("div", {
95
+ className: classnames(`be-toolbar-item ${item.className}`)
96
+ }, /*#__PURE__*/React.createElement(Button, {
97
+ color: "green",
98
+ variant: 'outlined',
99
+ onClick: handleDuplicate,
100
+ className: "d-flex be-button"
101
+ }, item.title ? t ? t(item.title) : item.title : t ? t('Duplicate') : 'Duplicate')), item.key === 'INSERT_BEFORE' && item.visible !== false && editingKey && /*#__PURE__*/React.createElement("div", {
102
+ className: classnames(`be-toolbar-item ${item.className}`)
103
+ }, /*#__PURE__*/React.createElement(Button, {
104
+ color: "green",
105
+ variant: 'outlined',
106
+ onClick: handleInsertBefore,
107
+ className: "d-flex be-button"
108
+ }, item.title ? t ? t(item.title) : item.title : t ? t('Insert item before') : 'Insert item before')), item.key === 'INSERT_AFTER' && item.visible !== false && editingKey && /*#__PURE__*/React.createElement("div", {
109
+ className: classnames(`be-toolbar-item ${item.className}`)
110
+ }, /*#__PURE__*/React.createElement(Button, {
111
+ color: "green",
112
+ variant: 'outlined',
113
+ onClick: handleInsertAfter,
114
+ className: "d-flex be-button"
115
+ }, item.title ? t ? t(item.title) : item.title : t ? t('Insert item after') : 'Insert item after')), item.key === 'DELETE' && item.visible !== false && /*#__PURE__*/React.createElement("div", {
116
+ className: classnames(`be-toolbar-item ${item.className}`)
117
+ }, /*#__PURE__*/React.createElement(Button, {
118
+ color: "primary",
119
+ variant: 'outlined',
120
+ onClick: handleDeleteAll,
121
+ className: "d-flex be-button"
122
+ }, item.title ? t ? t(item.title) : item.title : t ? t('Delete all item') : 'Delete all item')));
123
+ }
124
+ };
125
+ });
126
+ }, [toolbarItems]);
55
127
  const {
56
128
  control,
57
129
  handleSubmit,
@@ -83,9 +155,10 @@ const GridEdit = props => {
83
155
 
84
156
  if (!tableBody.contains(event.target)) {
85
157
  setEditingKey('');
86
- // isSelecting.current = false;
87
- // startCell.current = null;
158
+ isSelecting.current = false;
159
+ startCell.current = null;
88
160
  setSelectedCells(new Set());
161
+ setRowsSelected(new Set());
89
162
  } else {}
90
163
  }
91
164
  };
@@ -574,175 +647,166 @@ const GridEdit = props => {
574
647
  }
575
648
  }
576
649
  };
577
- const addResizeHandlers = (cols, parentPath = []) => {
578
- return cols.map((col, colIndex) => {
579
- const currentPath = [...parentPath, colIndex];
580
- if (!col?.dataIndex && !col.key) {
581
- return col;
582
- }
583
- if (col.children) {
584
- return {
585
- ...col,
586
- children: addResizeHandlers(col.children, currentPath)
587
- };
588
- }
589
- if (col.dataIndex === 'index' || col.field === 'index' || col.dataIndex === '#' || col.dataIndex === '#') {
590
- return {
591
- ...col,
592
- className: 'rc-ui-cell-editable',
593
- render: (value, record, rowIndex) => {
594
- return /*#__PURE__*/React.createElement("div", {
595
- className: classNames('ui-rc_cell-content ui-rc_cell-content--index', {
596
- selected: rowsSelected.has(`${rowIndex}-${colIndex}`),
597
- focus: selectedCells && Array.from(selectedCells).some(item => item.startsWith(`${rowIndex}-`))
598
- }),
599
- onMouseDown: event => handleMouseDownColIndex(rowIndex, colIndex, event),
600
- onMouseEnter: event => handleMouseEnterColIndex(rowIndex, colIndex, event),
601
- onClick: () => handleClickRowHeader(rowIndex, colIndex)
602
- }, /*#__PURE__*/React.createElement("div", {
603
- className: 'ui-rc_content'
604
- }, rowIndex + 1));
605
- }
606
- };
607
- }
608
- if (col.dataIndex === 'command' || col.field === 'command') {
609
- return {
610
- ...col,
611
- title: col.headerText ?? col.title,
612
- ellipsis: col.ellipsis !== false,
613
- onCell: () => ({
614
- className: 'ui-rc-cell-command'
615
- }),
616
- // render: (value: any, record: any, rowIndex: number) => {
617
- render: () => {
618
- return /*#__PURE__*/React.createElement("div", {
619
- className: classNames('ui-rc-cell-command__content', {})
620
- }, col.commandItems && col.commandItems?.map((item, indexComm) => {
621
- if (item.visible !== false) {
622
- // return (
623
- // <span>{item.title}</span>
624
- // )
625
-
626
- return /*#__PURE__*/React.createElement(Command, {
627
- key: `command-${indexComm}`,
628
- item: item,
629
- onClick: e => {
630
- e.preventDefault();
631
- // handleCommandClick({command: item, rowData: record, index: rowIndex})
632
- }
633
- });
634
- }
635
- }));
636
- }
637
- };
638
- }
650
+ const convertColumns = flatColumns(columns).map((column, colIndex) => {
651
+ if (!column?.field && !column?.key) {
652
+ return column;
653
+ }
654
+ if (column.dataIndex === 'index' || column.field === 'index' || column.dataIndex === '#' || column.dataIndex === '#') {
639
655
  return {
640
- ...col,
641
- onCell: (record, rowIndex) => ({
642
- onKeyDown: event => {
643
- if (event.key.length === 1 && !event.ctrlKey && !event.metaKey || event.key === 'Enter') {
644
- if (!isEditing(record) && record[rowKey] !== editingKey) {
645
- handleEdit(record, col, col.editType, event);
646
- }
647
- if (editingKey && editingKey !== '' && (rowIndex ?? 0) + 1 < dataSource.length && event.key === 'Enter') {
648
- handleFocusCell((rowIndex ?? 0) + 1, colIndex, col, 'vertical', event);
649
- }
650
- }
651
- if (event.key === 'Tab') {
652
- if (colIndex + 1 !== cols.length) {
653
- handleFocusCell(rowIndex, colIndex + 1, col, 'horizontal', event);
654
- } else {
655
- event.stopPropagation();
656
- event.preventDefault();
657
- }
658
- }
659
- if (event.key === 'ArrowRight' && colIndex + 1 !== cols.length) {
660
- if (editingKey !== '') {} else {
661
- handleFocusCell(rowIndex, colIndex + 1, col, 'horizontal', event);
662
- }
663
- }
664
- if (event.key === 'ArrowLeft' && colIndex > 0) {
665
- if (!col.dataIndex && !col.key || col.field === 'index' || col.field === '#' || col.dataIndex === 'index' || col.dataIndex === '#') {
666
- event.stopPropagation();
667
- event.preventDefault();
668
- } else {
669
- if (editingKey !== '') {} else {
670
- handleFocusCell(rowIndex, colIndex - 1, col, 'horizontal', event);
671
- }
672
- }
673
- }
674
- if (event.key === 'ArrowDown' && (rowIndex ?? 0) + 1 < dataSource.length) {
675
- handleFocusCell((rowIndex ?? 0) + 1, colIndex, col, 'vertical', event);
676
- }
677
- if (event.key === 'ArrowUp' && (rowIndex ?? 0) > 0) {
678
- handleFocusCell((rowIndex ?? 0) - 1, colIndex, col, 'vertical', event);
679
- }
680
- },
681
- onPaste: event => {
682
- if (editingKey === '') {
683
- handlePaste(event, colIndex, rowIndex);
684
- event.preventDefault();
685
- }
686
- },
687
- onCopy: e => {
688
- if (editingKey === '') {
689
- handleCopy(e);
690
- e.preventDefault();
691
- }
692
- },
693
- onDoubleClick: event => {
694
- if (!isEditing(record) && record[rowKey] !== editingKey) {
695
- handleEdit(record, col, col.editType, event);
696
- }
697
- },
698
- // onMouseDown: (event) => {
699
- // handleMouseDown(rowIndex, colIndex, event)
700
- // },
701
- //
702
- // onMouseEnter: () => {
703
- // handleMouseEnter(rowIndex, colIndex)
704
- // },
705
-
706
- onClick: () => {
707
- if (record[rowKey] !== editingKey && editingKey !== '') {
708
- setEditingKey('');
709
- }
710
- },
711
- className: isEditing(record) ? 'rc-ui-cell-editable cell-editing' : 'rc-ui-cell-editable cell-editable',
712
- record,
713
- column: col,
714
- editType: getEditType(col, record),
715
- dataIndex: col.dataIndex,
716
- title: col.title,
717
- 'data-col-index': colIndex,
718
- 'data-row-index': rowIndex,
719
- // colIndex: colIndex,
720
- indexCol: colIndex,
721
- indexRow: rowIndex,
722
- editing: isEditing(record),
723
- tabIndex: (rowIndex ?? 0) * columns.length + colIndex
724
- }),
725
- // onHeaderCell: (data) => ({
726
- // ...col.onHeaderCell(),
727
- // onClick: () => {
728
- // handleClickColHeader(data as ColumnTable, colIndex)
729
- // }
730
- // }),
656
+ ...column,
657
+ className: 'rc-ui-cell-editable',
731
658
  render: (value, record, rowIndex) => {
659
+ const rowNumber = getRowNumber(dataSource, record[rowKey], rowKey);
732
660
  return /*#__PURE__*/React.createElement("div", {
733
- className: classNames('ui-rc_cell-content', {
734
- selected: selectedCells.has(`${rowIndex}-${colIndex}`)
661
+ className: classNames('ui-rc_cell-content ui-rc_cell-content--index', {
662
+ selected: rowsSelected.has(`${rowNumber}-${colIndex}`),
663
+ focus: selectedCells && Array.from(selectedCells).some(item => item.startsWith(`${rowNumber}-`))
735
664
  }),
736
- onMouseDown: event => handleMouseDown(rowIndex, colIndex, event),
737
- onMouseEnter: () => handleMouseEnter(rowIndex, colIndex)
665
+ onMouseDown: event => handleMouseDownColIndex(rowNumber, colIndex, event),
666
+ onMouseEnter: event => handleMouseEnterColIndex(rowNumber, colIndex, event),
667
+ onClick: () => handleClickRowHeader(rowNumber, colIndex)
738
668
  }, /*#__PURE__*/React.createElement("div", {
739
669
  className: 'ui-rc_content'
740
- }, renderContent(col, value, record, rowIndex, format)));
670
+ }, rowIndex + 1));
741
671
  }
742
672
  };
673
+ }
674
+ if ((column.key || column.field) === 'command') {
675
+ return {
676
+ ...column
677
+ };
678
+ }
679
+ return {
680
+ ...column,
681
+ // editType: getEditType(column, record),
682
+ onCell: (record, rowIndex) => ({
683
+ onKeyDown: event => {
684
+ if (event.key.length === 1 && !event.ctrlKey && !event.metaKey || event.key === 'Enter') {
685
+ if (!isEditing(record) && record[rowKey] !== editingKey) {
686
+ handleEdit(record, column, column.editType, event);
687
+ }
688
+ if (editingKey && editingKey !== '' && (rowIndex ?? 0) + 1 < dataSource.length && event.key === 'Enter') {
689
+ handleFocusCell((rowIndex ?? 0) + 1, colIndex, column, 'vertical', event);
690
+ }
691
+ }
692
+ if (event.key === 'Tab') {
693
+ if (colIndex + 1 !== columns.length) {
694
+ handleFocusCell(rowIndex, colIndex + 1, column, 'horizontal', event);
695
+ } else {
696
+ event.stopPropagation();
697
+ event.preventDefault();
698
+ }
699
+ }
700
+ if (event.key === 'ArrowRight' && colIndex + 1 !== columns.length) {
701
+ if (editingKey !== '') {} else {
702
+ handleFocusCell(rowIndex, colIndex + 1, column, 'horizontal', event);
703
+ }
704
+ }
705
+ if (event.key === 'ArrowLeft' && colIndex > 0) {
706
+ if (!column.dataIndex && !column.key || column.field === 'index' || column.field === '#' || column.dataIndex === 'index' || column.dataIndex === '#') {
707
+ event.stopPropagation();
708
+ event.preventDefault();
709
+ } else {
710
+ if (editingKey !== '') {} else {
711
+ handleFocusCell(rowIndex, colIndex - 1, column, 'horizontal', event);
712
+ }
713
+ }
714
+ }
715
+ if (event.key === 'ArrowDown' && (rowIndex ?? 0) + 1 < dataSource.length) {
716
+ handleFocusCell((rowIndex ?? 0) + 1, colIndex, column, 'vertical', event);
717
+ }
718
+ if (event.key === 'ArrowUp' && (rowIndex ?? 0) > 0) {
719
+ handleFocusCell((rowIndex ?? 0) - 1, colIndex, column, 'vertical', event);
720
+ }
721
+ },
722
+ onPaste: event => {
723
+ if (editingKey === '') {
724
+ handlePaste(event, colIndex, rowIndex);
725
+ event.preventDefault();
726
+ }
727
+ },
728
+ onCopy: e => {
729
+ if (editingKey === '') {
730
+ handleCopy(e);
731
+ e.preventDefault();
732
+ }
733
+ },
734
+ onDoubleClick: event => {
735
+ if (!isEditing(record) && record[rowKey] !== editingKey) {
736
+ handleEdit(record, column, getEditType(column, record), event);
737
+ }
738
+ },
739
+ onClick: () => {
740
+ if (record[rowKey] !== editingKey && editingKey !== '') {
741
+ setEditingKey('');
742
+ }
743
+ },
744
+ className: isEditing(record) ? 'rc-ui-cell-editable cell-editing' : 'rc-ui-cell-editable cell-editable',
745
+ record,
746
+ column: column,
747
+ editType: getEditType(column, record),
748
+ dataIndex: column.dataIndex,
749
+ title: column.title,
750
+ 'data-col-index': colIndex,
751
+ 'data-row-index': rowIndex,
752
+ // colIndex: colIndex,
753
+ indexCol: colIndex,
754
+ indexRow: rowIndex,
755
+ editing: isEditing(record),
756
+ tabIndex: (rowIndex ?? 0) * columns.length + colIndex
757
+ }),
758
+ render: (value, record, rowIndex) => {
759
+ const rowNumber = getRowNumber(dataSource, record[rowKey], rowKey);
760
+ return /*#__PURE__*/React.createElement("div", {
761
+ className: classNames('ui-rc_cell-content', {
762
+ // selected: selectedCells.has(`${record[rowKey]}-${colIndex}`)
763
+ selected: selectedCells.has(`${rowNumber}-${colIndex}`)
764
+ }),
765
+ onMouseDown: event => handleMouseDown(rowNumber, colIndex, event)
766
+ // onMouseEnter={() => handleMouseEnter(record[rowKey], colIndex)}
767
+ ,
768
+ onMouseEnter: () => handleMouseEnter(rowNumber, colIndex)
769
+ }, /*#__PURE__*/React.createElement("div", {
770
+ className: 'ui-rc_content'
771
+ }, renderContent(column, value, record, rowIndex, format)));
772
+ }
773
+ };
774
+ });
775
+ const transformColumns = React.useCallback(cols => {
776
+ // @ts-ignore
777
+ return cols.map(column => {
778
+ const find = convertColumns.find(it => it.key === column.key);
779
+ if (!column?.field && !column?.key) {
780
+ return column;
781
+ }
782
+ if (find) {
783
+ return {
784
+ ...find
785
+ };
786
+ }
787
+
788
+ // Xử lý đệ quy cho children
789
+ if (column.children?.length) {
790
+ return {
791
+ ...column,
792
+ children: transformColumns(column.children)
793
+ };
794
+ }
743
795
  });
796
+ }, [convertColumns]);
797
+ const mergedColumns = React.useMemo(() => transformColumns(columns ?? []), [transformColumns, columns]);
798
+ const bottomToolbar = () => {
799
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Toolbar, {
800
+ style: {
801
+ width: '100%'
802
+ },
803
+ items: toolbarItemsBottom ?? [],
804
+ mode: 'scroll'
805
+ // onClick={({ item }) => {
806
+ // console.log('item', item)
807
+ // }}
808
+ }));
744
809
  };
745
- const resizableColumns = addResizeHandlers(columns);
746
810
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
747
811
  heightTable: height,
748
812
  style: {
@@ -774,11 +838,12 @@ const GridEdit = props => {
774
838
  },
775
839
  className: classNames(className, 'grid-editable'),
776
840
  rowKey: rowKey,
777
- columns: resizableColumns,
841
+ columns: mergedColumns,
778
842
  showSorterTooltip: {
779
843
  target: 'sorter-icon'
780
844
  },
781
845
  format: format,
846
+ toolbarItems: toolbarItems,
782
847
  selectionSettings: selectionSettings ? {
783
848
  ...selectionSettings,
784
849
  checkboxOnly: true
@@ -787,7 +852,8 @@ const GridEdit = props => {
787
852
  ...style,
788
853
  minHeight: height
789
854
  },
790
- rowHoverable: false
855
+ rowHoverable: false,
856
+ bottomToolbar: bottomToolbar
791
857
  }))))), /*#__PURE__*/React.createElement(Toaster, {
792
858
  position: toast,
793
859
  toastOptions: {
@@ -3,12 +3,16 @@ import type React from "react";
3
3
  import type { IOperator } from "./hooks";
4
4
  import type { TypeFilter, TableProps as RcTableProps, TableColumnType as RcColumnType, EditType } from "rc-master-ui";
5
5
  import type { FilterOperator, TableRowSelection } from "rc-master-ui/es/table/interface";
6
- import type { ToolbarItem } from "rc-master-ui/es/toolbar";
6
+ import type { ToolbarItem as RcToolbarItem } from "rc-master-ui/es/toolbar";
7
7
  import type { ItemType } from "rc-master-ui/es/menu/interface";
8
8
  import type { FieldNames, FilterFunc } from "rc-select/es/Select";
9
9
  import type { ColorPickerProps } from "antd";
10
10
  export type IColumnType = "number" | "time" | "date" | "week" | "month" | "file" | "quarter" | "year" | "datetime" | "string" | "boolean" | "checkbox" | "color" | null | undefined;
11
11
  export type AnyObject = Record<PropertyKey, any>;
12
+ export type ToolbarItem = Omit<RcToolbarItem, 'position'> & {
13
+ position?: 'Top' | 'Bottom';
14
+ onClick?: (args: any) => void;
15
+ };
12
16
  export type SelectMode = 'checkbox' | 'radio' | undefined;
13
17
  export type ITextAlign = 'center' | 'left' | 'right';
14
18
  export type Frozen = 'left' | 'right' | 'Left' | 'Right';
@@ -104,7 +108,7 @@ export type ColumnType<RecordType> = Omit<RcColumnType<RecordType>, 'headerTempl
104
108
  children?: ColumnType<RecordType>[];
105
109
  };
106
110
  export type ColumnEditType<RecordType> = Omit<ColumnType<RecordType>, 'children'> & {
107
- editType?: EditType | ((rowData?: any) => EditType);
111
+ editType?: EditType | ((rowData?: RecordType) => EditType);
108
112
  disable?: boolean | ((rowData: any) => boolean);
109
113
  isClearable?: boolean;
110
114
  maxDate?: any;
@@ -163,7 +163,7 @@ const ColumnsChoose = props => {
163
163
  style: {
164
164
  marginBottom: 8
165
165
  },
166
- placeholder: "Search",
166
+ placeholder: t ? t("Search") : 'Search',
167
167
  prefix: /*#__PURE__*/_react.default.createElement(_SearchOutlined.default, null),
168
168
  onChange: onChange
169
169
  }), /*#__PURE__*/_react.default.createElement(_tree.default, {
@@ -9,4 +9,4 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
  const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
10
10
  displayName: "GridStyle",
11
11
  componentId: "es-grid-template__sc-sueu2e-0"
12
- })([".ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:", ";bottom:0;left:0;z-index:-1;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:", ";bottom:0;visibility:visible;right:0;z-index:-1;}}.react-resizable{position:relative;background-clip:padding-box;}.react-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.heightTable ? typeof props.heightTable === 'string' ? props.heightTable : `${props.heightTable}px` : undefined, props => props.heightTable ? `${props.heightTable}px` : undefined);
12
+ })([".ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;z-index:-1;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;z-index:-1;}&.pagination-template{&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:", ";bottom:0;left:0;z-index:-1;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:", ";bottom:0;visibility:visible;right:0;z-index:-1;}}}.react-resizable{position:relative;background-clip:padding-box;}.react-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.heightTable ? typeof props.heightTable === 'string' ? props.heightTable : `${props.heightTable}px` : '50px', props => props.heightTable ? `${props.heightTable}px` : '50px');