es-grid-template 1.2.7 → 1.2.9
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.
- package/es/grid-component/AdvanceFilter.d.ts +11 -7
- package/es/grid-component/AdvanceFilter.js +419 -509
- package/es/grid-component/EditableCell.d.ts +2 -2
- package/es/grid-component/TableGrid.js +11 -2
- package/es/grid-component/checkbox-control/index.d.ts +13 -0
- package/es/grid-component/checkbox-control/index.js +40 -0
- package/es/grid-component/hooks/columns/index.d.ts +4 -4
- package/es/grid-component/hooks/columns/index.js +6 -1
- package/es/grid-component/hooks/useColumns.js +3 -2
- package/es/grid-component/hooks/utils.d.ts +9 -7
- package/es/grid-component/hooks/utils.js +10 -1
- package/es/grid-component/table/GridEdit.d.ts +2 -3
- package/es/grid-component/table/GridEdit.js +35 -11
- package/es/grid-component/type.d.ts +8 -27
- package/lib/grid-component/AdvanceFilter.d.ts +11 -7
- package/lib/grid-component/AdvanceFilter.js +415 -506
- package/lib/grid-component/EditableCell.d.ts +2 -2
- package/lib/grid-component/TableGrid.js +11 -2
- package/lib/grid-component/checkbox-control/index.d.ts +13 -0
- package/lib/grid-component/checkbox-control/index.js +48 -0
- package/lib/grid-component/hooks/columns/index.d.ts +4 -4
- package/lib/grid-component/hooks/columns/index.js +6 -1
- package/lib/grid-component/hooks/useColumns.js +3 -2
- package/lib/grid-component/hooks/utils.d.ts +9 -7
- package/lib/grid-component/hooks/utils.js +15 -4
- package/lib/grid-component/table/GridEdit.d.ts +2 -3
- package/lib/grid-component/table/GridEdit.js +34 -9
- package/lib/grid-component/type.d.ts +8 -27
- package/package.json +108 -108
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ColumnTable, IFormat } from "./type";
|
|
3
3
|
import type { EditType } from "rc-master-ui";
|
|
4
4
|
interface EditableCellProps<DataType> extends React.HTMLAttributes<HTMLElement> {
|
|
5
5
|
t?: any;
|
|
@@ -10,7 +10,7 @@ interface EditableCellProps<DataType> extends React.HTMLAttributes<HTMLElement>
|
|
|
10
10
|
record: DataType;
|
|
11
11
|
index: number;
|
|
12
12
|
format?: IFormat;
|
|
13
|
-
column:
|
|
13
|
+
column: ColumnTable<DataType>;
|
|
14
14
|
indexRow: number;
|
|
15
15
|
indexCol: number;
|
|
16
16
|
rowKey: any;
|
|
@@ -20,6 +20,7 @@ import Pagination from "rc-master-ui/es/pagination";
|
|
|
20
20
|
import ComponentSpinner from "./LoadingSpinner";
|
|
21
21
|
import { ColumnsChoose } from "./ColumnsChoose";
|
|
22
22
|
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
23
|
+
import AdvanceFilter from "./AdvanceFilter";
|
|
23
24
|
const convertFilters = filters => {
|
|
24
25
|
const result = [];
|
|
25
26
|
filters.forEach(({
|
|
@@ -108,6 +109,7 @@ const TableGrid = props => {
|
|
|
108
109
|
recordDoubleClick,
|
|
109
110
|
toolbarItems,
|
|
110
111
|
showColumnChoose,
|
|
112
|
+
showAdvanceFilter,
|
|
111
113
|
onFilter,
|
|
112
114
|
selectionSettings,
|
|
113
115
|
rowSelection,
|
|
@@ -399,7 +401,8 @@ const TableGrid = props => {
|
|
|
399
401
|
style: {
|
|
400
402
|
display: 'flex',
|
|
401
403
|
justifyContent: 'space-between',
|
|
402
|
-
alignItems: 'center'
|
|
404
|
+
alignItems: 'center',
|
|
405
|
+
gap: '.75rem'
|
|
403
406
|
}
|
|
404
407
|
}, groupAble && groupToolbar?.(), toolbarItems && toolbarItems?.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
405
408
|
style: {
|
|
@@ -416,7 +419,8 @@ const TableGrid = props => {
|
|
|
416
419
|
style: {
|
|
417
420
|
display: 'flex',
|
|
418
421
|
justifyContent: 'space-between',
|
|
419
|
-
alignItems: 'center'
|
|
422
|
+
alignItems: 'center',
|
|
423
|
+
gap: '.75rem'
|
|
420
424
|
}
|
|
421
425
|
}, pagination && pagination.onChange && pagination?.position && pagination?.position[0] === 'topRight' && /*#__PURE__*/React.createElement(Pagination, _extends({
|
|
422
426
|
showSizeChanger: true,
|
|
@@ -431,6 +435,11 @@ const TableGrid = props => {
|
|
|
431
435
|
t: t,
|
|
432
436
|
columnsGroup: groupColumns,
|
|
433
437
|
triggerChangeColumns: triggerChangeColumns
|
|
438
|
+
}), showAdvanceFilter && /*#__PURE__*/React.createElement(AdvanceFilter, {
|
|
439
|
+
columns: columns,
|
|
440
|
+
t: t
|
|
441
|
+
// columnsGroup={groupColumns}
|
|
442
|
+
// triggerChangeColumns={triggerChangeColumns}
|
|
434
443
|
}))));
|
|
435
444
|
},
|
|
436
445
|
expandable: {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type OptionType = {
|
|
3
|
+
value: any;
|
|
4
|
+
label: string;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
type Props<T> = {
|
|
8
|
+
options: T[];
|
|
9
|
+
value: any[];
|
|
10
|
+
onChange?: (value: any[]) => void;
|
|
11
|
+
};
|
|
12
|
+
declare const CheckboxControl: <T extends OptionType>(props: Props<T>) => React.JSX.Element;
|
|
13
|
+
export default CheckboxControl;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { Checkbox } from "rc-master-ui";
|
|
3
|
+
const CheckboxControl = props => {
|
|
4
|
+
const {
|
|
5
|
+
options,
|
|
6
|
+
value,
|
|
7
|
+
onChange
|
|
8
|
+
} = props;
|
|
9
|
+
const selected = useMemo(() => {
|
|
10
|
+
return value ? value : [];
|
|
11
|
+
}, [value]);
|
|
12
|
+
const list = useMemo(() => {
|
|
13
|
+
return options ? options : [];
|
|
14
|
+
}, [options]);
|
|
15
|
+
const onChangeValue = val => {
|
|
16
|
+
const findIndex = selected.findIndex(it => it === val);
|
|
17
|
+
if (findIndex > -1) {
|
|
18
|
+
const newVal = selected.filter(it => it !== val);
|
|
19
|
+
onChange?.(newVal);
|
|
20
|
+
} else {
|
|
21
|
+
const newVal = [...selected, val];
|
|
22
|
+
onChange?.(newVal);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: "d-flex flex-column gap-50",
|
|
27
|
+
style: {}
|
|
28
|
+
}, list.map((it, index) => {
|
|
29
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
key: index,
|
|
31
|
+
className: "d-flex align-items-center"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
33
|
+
checked: selected.includes(it.value),
|
|
34
|
+
type: "checkbox",
|
|
35
|
+
className: "cursor-pointer me-50",
|
|
36
|
+
onChange: () => onChangeValue(it.value)
|
|
37
|
+
}), /*#__PURE__*/React.createElement("span", null, it.label));
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
export default CheckboxControl;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ColumnTable, IFormat } from "../../type";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { TableLocale } from "rc-master-ui/lib/table/interface";
|
|
4
4
|
import type { ColumnsTable } from "../../type";
|
|
5
5
|
export declare function flatColumns<RecordType>(columns: ColumnsTable<RecordType>, parentKey?: string): ColumnsTable<RecordType>;
|
|
6
6
|
export declare function flatColumns2<RecordType>(columns: ColumnsTable<RecordType>): ColumnsTable<RecordType>;
|
|
7
|
-
export declare const getValueCell: <T>(column:
|
|
8
|
-
export declare const renderContent: (column:
|
|
9
|
-
export declare const renderFilter: <RecordType>(column:
|
|
7
|
+
export declare const getValueCell: <T>(column: ColumnTable<T>, value: any, format?: IFormat) => any;
|
|
8
|
+
export declare const renderContent: <T>(column: ColumnTable<T>, value: any, record: any, index: number, format?: IFormat) => React.JSX.Element;
|
|
9
|
+
export declare const renderFilter: <RecordType>(column: ColumnTable<RecordType>, selectedKeys: string[], setSelectedKeys: any, confirm: any, visible: boolean, searchValue: string, setSearchValue: any, dataSourceFilter: any[], buddhistLocale: any, locale?: TableLocale, t?: any) => React.JSX.Element;
|
|
@@ -118,7 +118,12 @@ export const getValueCell = (column, value, format) => {
|
|
|
118
118
|
export const renderContent = (column, value, record, index, format) => {
|
|
119
119
|
const cellValue = value instanceof Date ? getDateString(column, value) : value;
|
|
120
120
|
const content = getValueCell(column, cellValue, format);
|
|
121
|
-
return /*#__PURE__*/React.createElement(Fragment, null, column?.template ? typeof column.template === "function" ? column.template(
|
|
121
|
+
return /*#__PURE__*/React.createElement(Fragment, null, column?.template ? typeof column.template === "function" ? column.template({
|
|
122
|
+
value,
|
|
123
|
+
index,
|
|
124
|
+
rowData: record,
|
|
125
|
+
field: column.field
|
|
126
|
+
}) : column.template : content);
|
|
122
127
|
};
|
|
123
128
|
export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale, locale, t) => {
|
|
124
129
|
const type = getTypeFilter(column);
|
|
@@ -246,11 +246,12 @@ const useColumns = config => {
|
|
|
246
246
|
width: col.width,
|
|
247
247
|
onResize: handleResize?.(col)
|
|
248
248
|
}),
|
|
249
|
-
onCell: data => {
|
|
249
|
+
onCell: (data, index) => {
|
|
250
250
|
return {
|
|
251
251
|
colSpan: groupColumns && data.children && col.field === firstNonGroupColumn?.field ? 2 : groupColumns && data.children && nonGroupColumns[1].field === col.field ? 0 : 1,
|
|
252
252
|
zIndex: data.children && col.field === firstNonGroupColumn?.field ? 11 : undefined,
|
|
253
|
-
|
|
253
|
+
...transformedColumn?.onCell?.(data, index),
|
|
254
|
+
className: classNames(transformedColumn?.onCell?.(data, index).className ?? '', {
|
|
254
255
|
'cell-group': groupColumns && data.children,
|
|
255
256
|
'cell-group-fixed': groupColumns && data.children && col.field === firstNonGroupColumn?.field
|
|
256
257
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import type { EditType, IColumnType, TypeFilter } from "rc-master-ui";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ColumnTable, GetRowKey } from "../type";
|
|
5
5
|
import type { SelectionSettings } from "../type";
|
|
6
6
|
import type { AnyObject } from "../type";
|
|
7
7
|
import type { Key } from "react";
|
|
@@ -26,15 +26,15 @@ export declare const customWeekStartEndFormat: (value: any, weekFormat: string)
|
|
|
26
26
|
export declare const getTypeFilter: (col: ColumnTable<any>) => TypeFilter;
|
|
27
27
|
export declare const updateArrayByKey: (arr: any[], element: any, key: string) => any[];
|
|
28
28
|
export declare const getDateString: <T>(column: ColumnTable<T>, value: any) => string;
|
|
29
|
-
export declare const getEditType: <T>(column:
|
|
30
|
-
export declare const isDisable: <T>(column:
|
|
29
|
+
export declare const getEditType: <T>(column: ColumnTable<T>, rowData?: any) => EditType;
|
|
30
|
+
export declare const isDisable: <T>(column: ColumnTable<T>, rowData?: any) => boolean;
|
|
31
31
|
export declare const checkFieldKey: (key: string | undefined) => string;
|
|
32
32
|
export declare const convertLabelToTitle: (data: any[]) => any[];
|
|
33
33
|
export declare const convertArrayWithIndent: (inputArray: any[], parentIndent?: number) => any[];
|
|
34
34
|
export declare const getTemplate: (template: any) => React.ReactNode | React.ReactElement;
|
|
35
|
-
export declare const totalFixedWidth: <T>(columns:
|
|
35
|
+
export declare const totalFixedWidth: <T>(columns: ColumnsTable<T>, type: 'left' | 'right', selectionSettings?: SelectionSettings) => number;
|
|
36
36
|
export declare const isObjEmpty: (obj: any) => boolean;
|
|
37
|
-
export declare const getColumnsVisible: <T>(columns:
|
|
37
|
+
export declare const getColumnsVisible: <T>(columns: ColumnsTable<T>, index: number) => ColumnTable<T>[];
|
|
38
38
|
export declare const updateData: <Record_1 = AnyObject>(initData: Record_1[], rows: Record_1[], key: keyof Record_1) => Record_1[];
|
|
39
39
|
export declare const parseBooleanToValue: (value: boolean, type: 'boolean' | 'number') => number | boolean;
|
|
40
40
|
export declare const genPresets: (presets?: import("@ant-design/colors").PalettesProps) => import("antd/es/color-picker/interface").PresetsItem[];
|
|
@@ -64,8 +64,10 @@ export declare function addRows8(arr: any, n: number): {
|
|
|
64
64
|
};
|
|
65
65
|
export declare const transformColumns: <RecordType>(cols: ColumnsTable<RecordType>, convertColumns: any[], t?: any) => ColumnsTable<RecordType>;
|
|
66
66
|
export declare const transformColumns1: <RecordType>(cols: ColumnsTable<RecordType>, sortMultiple?: boolean) => ColumnsTable<RecordType>;
|
|
67
|
-
export declare const removeColumns: <RecordType>(columns:
|
|
67
|
+
export declare const removeColumns: <RecordType>(columns: ColumnTable<RecordType>[], groupColumns: string[]) => ColumnsTable<RecordType>;
|
|
68
68
|
export declare const convertFlatColumn: (array: ColumnsTable) => ColumnsTable[];
|
|
69
69
|
export declare const convertColumns: <RecordType>(cols: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
|
|
70
70
|
export declare const checkChild: (inputArray: any[]) => boolean;
|
|
71
|
-
export declare const isEditable: <RecordType>(column:
|
|
71
|
+
export declare const isEditable: <RecordType>(column: ColumnTable, rowData: RecordType) => boolean | ((rowData: any) => boolean);
|
|
72
|
+
export declare const isArraysEqual: (arr1: any[], arr2: any[]) => boolean;
|
|
73
|
+
export declare const editAbleColumns: <T>(columns: ColumnsTable<T>) => ColumnTable<T>[];
|
|
@@ -704,7 +704,7 @@ export const removeColumns = (columns, groupColumns) => {
|
|
|
704
704
|
const newCol = {
|
|
705
705
|
...column
|
|
706
706
|
};
|
|
707
|
-
if (newCol.
|
|
707
|
+
if (newCol?.children && newCol?.children.length > 0) {
|
|
708
708
|
newCol.children = removeColumns(newCol.children, groupColumns);
|
|
709
709
|
}
|
|
710
710
|
return newCol;
|
|
@@ -778,4 +778,13 @@ export const isEditable = (column, rowData) => {
|
|
|
778
778
|
return column.editEnable(rowData);
|
|
779
779
|
}
|
|
780
780
|
return column?.editEnable;
|
|
781
|
+
};
|
|
782
|
+
export const isArraysEqual = (arr1, arr2) => {
|
|
783
|
+
if (arr1.length !== arr2.length) {
|
|
784
|
+
return false;
|
|
785
|
+
}
|
|
786
|
+
return arr1.every((element, index) => element === arr2[index]);
|
|
787
|
+
};
|
|
788
|
+
export const editAbleColumns = columns => {
|
|
789
|
+
return columns.filter(col => col.field !== '#' && col.field !== 'index' && col.field !== 'command' && col.visible !== false);
|
|
781
790
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import 'dayjs/locale/es';
|
|
3
3
|
import 'dayjs/locale/vi';
|
|
4
|
-
import type { AnyObject } from "../type";
|
|
5
|
-
import type { TableEditProps } from "../type";
|
|
4
|
+
import type { AnyObject, TableProps } from "../type";
|
|
6
5
|
import type { ColumnsTable } from "../type";
|
|
7
6
|
import type { GetRowKey } from "../type";
|
|
8
|
-
type Props<RecordType> =
|
|
7
|
+
type Props<RecordType> = TableProps<RecordType> & {
|
|
9
8
|
tableRef: any;
|
|
10
9
|
triggerChangeColumns?: (columns: ColumnsTable<RecordType>, type: string) => void;
|
|
11
10
|
triggerChangeData?: (newData: RecordType[], type: string) => void;
|
|
@@ -13,9 +13,8 @@ import dayjs from "dayjs";
|
|
|
13
13
|
import 'dayjs/locale/es';
|
|
14
14
|
import 'dayjs/locale/vi';
|
|
15
15
|
import TableGrid from "../TableGrid";
|
|
16
|
-
import { addRows8, checkChild, findAllChildrenKeys, findItemByKey, flattenArray, flattenData, getDefaultValue, getEditType, getFirstSelectCell, getLastSelectCell, getRowNumber, getRowsPasteIndex, isEditable, isObjEmpty, newGuid, totalFixedWidth, updateArrayByKey } from "../hooks";
|
|
16
|
+
import { addRows8, checkChild, editAbleColumns, findAllChildrenKeys, findItemByKey, flattenArray, flattenData, getDefaultValue, getEditType, getFirstSelectCell, getLastSelectCell, getRowNumber, getRowsPasteIndex, isEditable, isObjEmpty, newGuid, totalFixedWidth, updateArrayByKey } from "../hooks";
|
|
17
17
|
import Message from "../../Message/Message";
|
|
18
|
-
|
|
19
18
|
// import Command from "../Command";
|
|
20
19
|
|
|
21
20
|
import { Toolbar, ConfigProvider } from "rc-master-ui";
|
|
@@ -757,8 +756,9 @@ const GridEdit = props => {
|
|
|
757
756
|
};
|
|
758
757
|
const handleClickRowHeader = (row, col) => {
|
|
759
758
|
const newSelectedCells = new Set();
|
|
759
|
+
const tCols = editAbleColumns(columns);
|
|
760
760
|
for (let r = Math.min(row, row); r <= Math.max(row, row); r++) {
|
|
761
|
-
for (let c = Math.min(
|
|
761
|
+
for (let c = Math.min(tCols.length, col) + 1; c <= Math.max(tCols.length, col); c++) {
|
|
762
762
|
newSelectedCells.add(`${r}-${c}`);
|
|
763
763
|
}
|
|
764
764
|
}
|
|
@@ -1265,6 +1265,29 @@ const GridEdit = props => {
|
|
|
1265
1265
|
return {
|
|
1266
1266
|
...column,
|
|
1267
1267
|
className: 'rc-ui-cell-editable',
|
|
1268
|
+
onCell: (record, rowIndex) => {
|
|
1269
|
+
const rowNumber = getRowNumber(dataSource, record[rowKey], rowKey);
|
|
1270
|
+
return {
|
|
1271
|
+
onPaste: event => {
|
|
1272
|
+
if (editingKey === '') {
|
|
1273
|
+
handlePaste(record, colIndex + 1, rowNumber, event);
|
|
1274
|
+
event.preventDefault();
|
|
1275
|
+
}
|
|
1276
|
+
},
|
|
1277
|
+
onCopy: e => {
|
|
1278
|
+
if (editingKey === '') {
|
|
1279
|
+
handleCopy(e);
|
|
1280
|
+
e.preventDefault();
|
|
1281
|
+
}
|
|
1282
|
+
},
|
|
1283
|
+
onClick: () => {
|
|
1284
|
+
if (record[rowKey] !== editingKey && editingKey !== '') {
|
|
1285
|
+
setEditingKey('');
|
|
1286
|
+
}
|
|
1287
|
+
},
|
|
1288
|
+
tabIndex: (rowIndex ?? 0) * columns.length + colIndex
|
|
1289
|
+
};
|
|
1290
|
+
},
|
|
1268
1291
|
render: (value, record, rowIndex) => {
|
|
1269
1292
|
const rowNumber = getRowNumber(dataSource, record[rowKey], rowKey);
|
|
1270
1293
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1294,7 +1317,7 @@ const GridEdit = props => {
|
|
|
1294
1317
|
onKeyDown: event => {
|
|
1295
1318
|
const key = getRowKey(record, dataSource.indexOf(record));
|
|
1296
1319
|
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey || event.key === 'Enter') {
|
|
1297
|
-
if (record[rowKey] !== editingKey) {
|
|
1320
|
+
if (record[rowKey] !== editingKey && isEditable(column, record)) {
|
|
1298
1321
|
// ~~ khi editingKey = ''
|
|
1299
1322
|
event.preventDefault();
|
|
1300
1323
|
event.stopPropagation();
|
|
@@ -1370,14 +1393,14 @@ const GridEdit = props => {
|
|
|
1370
1393
|
}
|
|
1371
1394
|
},
|
|
1372
1395
|
onDoubleClick: event => {
|
|
1373
|
-
if (!isEditing(record) && record[rowKey] !== editingKey) {
|
|
1396
|
+
if (!isEditing(record) && record[rowKey] !== editingKey && isEditable(column, record)) {
|
|
1374
1397
|
handleEdit(record, column, getEditType(column, record), event);
|
|
1375
1398
|
handleCellClick(rowNumber, record, column);
|
|
1376
1399
|
}
|
|
1377
1400
|
},
|
|
1378
1401
|
onClick: () => {
|
|
1379
1402
|
if (record[rowKey] !== editingKey && editingKey !== '') {
|
|
1380
|
-
|
|
1403
|
+
setEditingKey('');
|
|
1381
1404
|
}
|
|
1382
1405
|
},
|
|
1383
1406
|
// className: isEditing(record) ? 'rc-ui-cell-editable cell-editing' : 'rc-ui-cell-editable cell-editable',
|
|
@@ -1389,8 +1412,9 @@ const GridEdit = props => {
|
|
|
1389
1412
|
title: getValueCell(column, record[column.field], format),
|
|
1390
1413
|
'data-col-index': colIndex,
|
|
1391
1414
|
'data-row-index': rowNumber,
|
|
1392
|
-
editing: isEditing(record) && rowEditable?.(record) !== false && isEditable(column, record)
|
|
1415
|
+
editing: isEditing(record) && rowEditable?.(record) !== false && isEditable(column, record),
|
|
1393
1416
|
cellEditing,
|
|
1417
|
+
t,
|
|
1394
1418
|
// editing: isEditing(record) && rowEditable?.(record) !== false,
|
|
1395
1419
|
tabIndex: (rowIndex ?? 0) * columns.length + colIndex,
|
|
1396
1420
|
style: isPasteDragging ? {
|
|
@@ -1462,10 +1486,10 @@ const GridEdit = props => {
|
|
|
1462
1486
|
width: '100%'
|
|
1463
1487
|
},
|
|
1464
1488
|
items: toolbarItemsBottom ?? [],
|
|
1465
|
-
mode: 'scroll'
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1489
|
+
mode: 'scroll',
|
|
1490
|
+
onClick: ({}) => {
|
|
1491
|
+
setEditingKey('');
|
|
1492
|
+
}
|
|
1469
1493
|
}));
|
|
1470
1494
|
};
|
|
1471
1495
|
const onSelectChange = keys => {
|
|
@@ -84,7 +84,7 @@ export type ToolbarClick = {
|
|
|
84
84
|
item: any;
|
|
85
85
|
column: any;
|
|
86
86
|
};
|
|
87
|
-
export type
|
|
87
|
+
export type ColumnTable<RecordType = AnyObject> = Omit<RcColumnType<RecordType>, 'headerTemplate' | 'title'> & {
|
|
88
88
|
field?: string;
|
|
89
89
|
key?: any;
|
|
90
90
|
type?: IColumnType;
|
|
@@ -111,9 +111,9 @@ export type ColumnType<RecordType> = Omit<RcColumnType<RecordType>, 'headerTempl
|
|
|
111
111
|
template?: ReactNode | ReactElement | ((args: ColumnTemplate<RecordType>) => ReactNode | ReactElement);
|
|
112
112
|
showTooltip?: boolean;
|
|
113
113
|
tooltipDescription?: ReactNode | ReactElement | ((value: any, record: RecordType, index: number) => ReactNode | ReactElement);
|
|
114
|
-
headerTemplate?: React.ReactNode | React.ReactElement | ((column:
|
|
114
|
+
headerTemplate?: React.ReactNode | React.ReactElement | ((column: ColumnTable<RecordType>) => React.ReactNode | React.ReactElement);
|
|
115
115
|
commandItems?: CommandItem[];
|
|
116
|
-
children?:
|
|
116
|
+
children?: ColumnTable<RecordType>[];
|
|
117
117
|
editType?: EditType | ((rowData?: RecordType) => EditType);
|
|
118
118
|
disable?: boolean | ((rowData: any) => boolean);
|
|
119
119
|
editEnable?: boolean | ((rowData: any) => boolean);
|
|
@@ -133,25 +133,8 @@ export type ColumnTemplate<RecordType> = {
|
|
|
133
133
|
index: number;
|
|
134
134
|
field: string;
|
|
135
135
|
};
|
|
136
|
-
export type
|
|
137
|
-
|
|
138
|
-
disable?: boolean | ((rowData: any) => boolean);
|
|
139
|
-
editEnable?: boolean | ((rowData: any) => boolean);
|
|
140
|
-
isClearable?: boolean;
|
|
141
|
-
maxDate?: any;
|
|
142
|
-
minDate?: any;
|
|
143
|
-
maxTime?: any;
|
|
144
|
-
minTime?: any;
|
|
145
|
-
max?: number;
|
|
146
|
-
min?: number;
|
|
147
|
-
editSelectSettings?: IEditSelectSettings;
|
|
148
|
-
children?: ColumnEditType<RecordType>[];
|
|
149
|
-
};
|
|
150
|
-
export type ColumnsType<RecordType = AnyObject> = ColumnType<RecordType>[];
|
|
151
|
-
export type ColumnsEditType<RecordType = AnyObject> = ColumnEditType<RecordType>[];
|
|
152
|
-
export type ColumnTable<RecordType = AnyObject> = ColumnEditType<RecordType> | ColumnType<RecordType>;
|
|
153
|
-
export type ColumnsTable<RecordType = AnyObject> = (ColumnType<RecordType> | ColumnEditType<RecordType>)[];
|
|
154
|
-
export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource' | 'summary'> {
|
|
136
|
+
export type ColumnsTable<RecordType = AnyObject> = ColumnTable<RecordType>[];
|
|
137
|
+
export interface TableProps<RecordType = AnyObject> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource' | 'summary'> {
|
|
155
138
|
editAble?: boolean;
|
|
156
139
|
groupAble?: boolean;
|
|
157
140
|
groupColumns?: string[];
|
|
@@ -172,6 +155,7 @@ export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, '
|
|
|
172
155
|
recordDoubleClick?: (args: RecordDoubleClickEventArgs<RecordType>) => void;
|
|
173
156
|
toolbarItems?: ToolbarItem[];
|
|
174
157
|
showColumnChoose?: boolean;
|
|
158
|
+
showAdvanceFilter?: boolean;
|
|
175
159
|
onFilter?: (query: {
|
|
176
160
|
field: string;
|
|
177
161
|
key: string;
|
|
@@ -180,7 +164,7 @@ export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, '
|
|
|
180
164
|
value: any;
|
|
181
165
|
}[]) => void;
|
|
182
166
|
onSorter?: (args: {
|
|
183
|
-
column:
|
|
167
|
+
column: ColumnTable<RecordType>;
|
|
184
168
|
columnKey: string;
|
|
185
169
|
field: string;
|
|
186
170
|
direction: 'Ascending' | 'Descending' | null;
|
|
@@ -203,9 +187,6 @@ export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, '
|
|
|
203
187
|
summary?: boolean | ((data: readonly RecordType[]) => React.ReactNode);
|
|
204
188
|
showEmptyText?: boolean;
|
|
205
189
|
commandSettings?: CommandSettings;
|
|
206
|
-
}
|
|
207
|
-
export interface TableEditProps<RecordType = AnyObject> extends Omit<TableProps<RecordType>, 'columns'> {
|
|
208
|
-
columns: ColumnsTable<RecordType>;
|
|
209
190
|
onCellPaste?: ICellPasteModel<RecordType>;
|
|
210
191
|
onCellChange?: (args: CellChangeArgs<RecordType>, handleCallback: (rowData: any, index: any, value?: any) => void) => void;
|
|
211
192
|
onCellClick?: (args: ICellClick, callback?: any) => void;
|
|
@@ -220,7 +201,7 @@ export type ICellClick = {
|
|
|
220
201
|
cellValue: any;
|
|
221
202
|
rowData: any;
|
|
222
203
|
};
|
|
223
|
-
export type GridTableProps<RecordType = AnyObject> = TableProps<RecordType
|
|
204
|
+
export type GridTableProps<RecordType = AnyObject> = TableProps<RecordType>;
|
|
224
205
|
export interface CommandItem {
|
|
225
206
|
id: string;
|
|
226
207
|
type?: string;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
columns:
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import type { IFormat } from "./type";
|
|
3
|
+
type Props = {
|
|
4
|
+
columns: any[];
|
|
5
|
+
dataSourceFilter?: any[];
|
|
6
|
+
onFilter?: (query: any, col?: any[]) => void;
|
|
7
|
+
mode?: 'sidebar' | 'dropdown';
|
|
8
|
+
defaultFilter?: any[];
|
|
9
|
+
leftFilterWidth?: number;
|
|
10
|
+
format?: IFormat;
|
|
7
11
|
t?: any;
|
|
8
|
-
triggerChangeKeys?: any;
|
|
9
12
|
};
|
|
10
|
-
|
|
13
|
+
declare const AdvanceFilter: (props: Props) => React.JSX.Element;
|
|
14
|
+
export default AdvanceFilter;
|