es-grid-template 1.9.27 → 1.9.28
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/type.d.ts +4 -1
- package/es/group-component/hook/utils.d.ts +3 -3
- package/es/table-component/InternalTable.js +31 -1
- package/es/table-component/TableContainerEdit.js +59 -23
- package/es/table-component/body/EditableCell.js +68 -27
- package/es/table-component/body/TableBodyCell.js +3 -0
- package/es/table-component/body/TableBodyCellEdit.js +3 -1
- package/es/table-component/header/TableHeadCell2.js +2 -1
- package/es/table-component/style.scss +42 -10
- package/es/table-virtuoso/body/TableBodyCell.js +4 -1
- package/es/table-virtuoso/body/TableBodyRow.js +6 -7
- package/es/table-virtuoso/style.js +1 -1
- package/es/table-virtuoso/table/TableWrapper.js +3 -1
- package/lib/grid-component/type.d.ts +4 -1
- package/lib/table-component/InternalTable.js +31 -1
- package/lib/table-component/TableContainerEdit.js +84 -48
- package/lib/table-component/body/EditableCell.js +68 -27
- package/lib/table-component/body/TableBodyCell.js +3 -0
- package/lib/table-component/body/TableBodyCellEdit.js +3 -1
- package/lib/table-component/header/TableHeadCell2.js +3 -2
- package/lib/table-component/style.scss +42 -10
- package/lib/table-virtuoso/body/TableBodyCell.js +4 -1
- package/lib/table-virtuoso/body/TableBodyRow.js +6 -7
- package/lib/table-virtuoso/style.js +1 -1
- package/lib/table-virtuoso/table/TableWrapper.js +3 -1
- package/package.json +1 -1
|
@@ -491,7 +491,10 @@ export type TableProps<RecordType = AnyObject> = {
|
|
|
491
491
|
/** Cho phép chỉnh sửa dữ liệu */
|
|
492
492
|
editAble?: boolean;
|
|
493
493
|
/** Callback khi data thay đổi */
|
|
494
|
-
onDataChange?: (data: RecordType[]
|
|
494
|
+
onDataChange?: (data: RecordType[], args?: {
|
|
495
|
+
type: string;
|
|
496
|
+
row?: number;
|
|
497
|
+
}) => void;
|
|
495
498
|
/** Giá trị mặc định khi thêm mới */
|
|
496
499
|
defaultValue?: AnyObject | (() => AnyObject);
|
|
497
500
|
/** Callback xử lý paste dữ liệu */
|
|
@@ -194,10 +194,10 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
194
194
|
value: any;
|
|
195
195
|
rowData: RecordType;
|
|
196
196
|
}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
197
|
-
onCellStyles?: Omit<CSSProperties, "position" | "
|
|
198
|
-
onCellHeaderStyles?: Omit<CSSProperties, "position" | "
|
|
197
|
+
onCellStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
|
|
198
|
+
onCellHeaderStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
|
|
199
199
|
onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
|
|
200
|
-
onCellFooterStyles?: Omit<CSSProperties, "position" | "
|
|
200
|
+
onCellFooterStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
|
|
201
201
|
getValue?: (row: any, rowIndex: number) => any;
|
|
202
202
|
getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
|
|
203
203
|
headerCellProps?: import("./../../grid-component/type").CellProps;
|
|
@@ -167,7 +167,37 @@ const InternalTable = props => {
|
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
169
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
170
|
-
locale: language
|
|
170
|
+
locale: language,
|
|
171
|
+
theme: {
|
|
172
|
+
token: {
|
|
173
|
+
colorPrimary: '#eb4619',
|
|
174
|
+
colorLink: '#eb4619'
|
|
175
|
+
},
|
|
176
|
+
components: {
|
|
177
|
+
Input: {
|
|
178
|
+
activeBorderColor: '#1677ff',
|
|
179
|
+
hoverBorderColor: '#1677ff'
|
|
180
|
+
},
|
|
181
|
+
Button: {
|
|
182
|
+
colorLink: '#eb4619',
|
|
183
|
+
colorLinkHover: '#eb4619'
|
|
184
|
+
},
|
|
185
|
+
Select: {
|
|
186
|
+
activeBorderColor: '#1677ff',
|
|
187
|
+
hoverBorderColor: '#1677ff'
|
|
188
|
+
// colorPrimary: '#eb4619',
|
|
189
|
+
// colorBgBase: 'red'
|
|
190
|
+
},
|
|
191
|
+
DatePicker: {
|
|
192
|
+
colorPrimary: '#eb4619',
|
|
193
|
+
activeBorderColor: '#1677ff',
|
|
194
|
+
hoverBorderColor: '#1677ff'
|
|
195
|
+
},
|
|
196
|
+
Pagination: {
|
|
197
|
+
fontSize: 12
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
171
201
|
}, /*#__PURE__*/React.createElement(CustomProvider, {
|
|
172
202
|
locale: languages
|
|
173
203
|
}, /*#__PURE__*/React.createElement(Grid, _extends({}, rest, {
|
|
@@ -8,7 +8,9 @@ sumSize,
|
|
|
8
8
|
unFlattenData, updateArrayByKey, updateColumnWidthsRecursive, updateOrInsert } from "./hook/utils";
|
|
9
9
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
10
10
|
import { useForm } from 'react-hook-form';
|
|
11
|
-
import {
|
|
11
|
+
import { Modal, Typography } from "antd";
|
|
12
|
+
import Button from "rc-master-ui/es/button";
|
|
13
|
+
import Dropdown from "rc-master-ui/es/dropdown";
|
|
12
14
|
import Pagination from "rc-master-ui/es/pagination";
|
|
13
15
|
import { numericFormatter, removeNumericFormat } from "react-numeric-component";
|
|
14
16
|
import { TableContext } from "./useContext";
|
|
@@ -76,19 +78,15 @@ const TableContainerEdit = props => {
|
|
|
76
78
|
expandable,
|
|
77
79
|
wrapSettings,
|
|
78
80
|
recordDoubleClick,
|
|
79
|
-
// triggerFilter,
|
|
80
81
|
selectionSettings,
|
|
81
82
|
isSelectionChange,
|
|
82
83
|
setIsSelectionChange,
|
|
83
|
-
// onContextMenu,
|
|
84
84
|
contextMenuItems,
|
|
85
85
|
setSorterChange,
|
|
86
86
|
setFilterChange,
|
|
87
87
|
defaultFilter,
|
|
88
88
|
onCellPaste,
|
|
89
|
-
// triggerPaste,
|
|
90
89
|
validate,
|
|
91
|
-
// triggerChangeData,
|
|
92
90
|
onCellChange,
|
|
93
91
|
onDataChange,
|
|
94
92
|
defaultValue,
|
|
@@ -286,14 +284,16 @@ const TableContainerEdit = props => {
|
|
|
286
284
|
|
|
287
285
|
copy(tsv).then(() => {}).catch(() => {});
|
|
288
286
|
}, [startCell, endCell, table]);
|
|
289
|
-
const triggerChangeData = React.useCallback(newData => {
|
|
290
|
-
onDataChange?.(newData);
|
|
287
|
+
const triggerChangeData = React.useCallback((newData, args) => {
|
|
288
|
+
onDataChange?.(newData, args);
|
|
291
289
|
}, [onDataChange, dataSource]);
|
|
292
290
|
const triggerPaste = React.useCallback((pastedRows, pastedColumnsArray, newData, copyRows) => {
|
|
293
291
|
const handlePasteCallback = callbackData => {
|
|
294
292
|
const rsFilterData = updateOrInsert(flattenArray([...originData]), flattenArray([...callbackData]));
|
|
295
293
|
const rs = unFlattenData(rsFilterData);
|
|
296
|
-
triggerChangeData(rs
|
|
294
|
+
triggerChangeData(rs, {
|
|
295
|
+
type: 'OnPaste'
|
|
296
|
+
});
|
|
297
297
|
};
|
|
298
298
|
if (onCellPaste && onCellPaste.onPasted) {
|
|
299
299
|
if (onCellPaste.onPasted.length > 1) {
|
|
@@ -314,10 +314,14 @@ const TableContainerEdit = props => {
|
|
|
314
314
|
data: originData,
|
|
315
315
|
pastedColumns: pastedColumnsArray
|
|
316
316
|
}, handlePasteCallback);
|
|
317
|
-
triggerChangeData(newData
|
|
317
|
+
triggerChangeData(newData, {
|
|
318
|
+
type: 'OnPaste'
|
|
319
|
+
});
|
|
318
320
|
}
|
|
319
321
|
} else {
|
|
320
|
-
triggerChangeData(newData
|
|
322
|
+
triggerChangeData(newData, {
|
|
323
|
+
type: 'OnPaste'
|
|
324
|
+
});
|
|
321
325
|
}
|
|
322
326
|
}, [onCellPaste, originData, triggerChangeData]);
|
|
323
327
|
const handlePasted = React.useCallback(pasteData => {
|
|
@@ -745,7 +749,9 @@ const TableContainerEdit = props => {
|
|
|
745
749
|
const index = flattenData(childrenColumnName, newData).findIndex(item => formData[rowKey] === item[rowKey]);
|
|
746
750
|
const rs = updateArrayByKey(newData, row, rowKey);
|
|
747
751
|
if (index > -1) {
|
|
748
|
-
triggerChangeData?.(rs
|
|
752
|
+
triggerChangeData?.(rs, {
|
|
753
|
+
type: 'CellChange'
|
|
754
|
+
});
|
|
749
755
|
}
|
|
750
756
|
} catch (errInfo) {
|
|
751
757
|
console.log('Validate Failed:', errInfo);
|
|
@@ -765,7 +771,9 @@ const TableContainerEdit = props => {
|
|
|
765
771
|
const index = flattenData(childrenColumnName, newData).findIndex(item => formData[rowKey] === item[rowKey]);
|
|
766
772
|
const rs = updateArrayByKey(newData, row, rowKey);
|
|
767
773
|
if (index > -1) {
|
|
768
|
-
triggerChangeData?.(rs
|
|
774
|
+
triggerChangeData?.(rs, {
|
|
775
|
+
type: 'CellChange'
|
|
776
|
+
});
|
|
769
777
|
}
|
|
770
778
|
} catch (errInfo) {
|
|
771
779
|
console.log('Validate Failed:', errInfo);
|
|
@@ -965,7 +973,9 @@ const TableContainerEdit = props => {
|
|
|
965
973
|
const rs = updateOrInsert(originData, rsFilter);
|
|
966
974
|
// const rs2 = mergeWithFilter(originData, rsFilter)
|
|
967
975
|
|
|
968
|
-
triggerChangeData?.(rs
|
|
976
|
+
triggerChangeData?.(rs, {
|
|
977
|
+
type: 'DUPLICATE'
|
|
978
|
+
});
|
|
969
979
|
}, [dataSource, focusedCell, originData, rowKey, table, triggerChangeData]);
|
|
970
980
|
|
|
971
981
|
// thêm n dòng bên trên
|
|
@@ -1001,7 +1011,10 @@ const TableContainerEdit = props => {
|
|
|
1001
1011
|
setMergedFilterKeys?.(rs);
|
|
1002
1012
|
const index = newData.findIndex(obj => obj[rowKey] === record[rowKey]);
|
|
1003
1013
|
newData.splice(index, 0, ...newRows);
|
|
1004
|
-
triggerChangeData?.(newData
|
|
1014
|
+
triggerChangeData?.(newData, {
|
|
1015
|
+
type: 'INSERT_BEFORE',
|
|
1016
|
+
row: n
|
|
1017
|
+
});
|
|
1005
1018
|
} else {
|
|
1006
1019
|
const newData = [...originData];
|
|
1007
1020
|
const parent = findItemByKey(newData, rowKey, record.parentId);
|
|
@@ -1027,7 +1040,10 @@ const TableContainerEdit = props => {
|
|
|
1027
1040
|
children: childData
|
|
1028
1041
|
};
|
|
1029
1042
|
const newDataSource = updateArrayByKey(newData, newRowData, rowKey);
|
|
1030
|
-
triggerChangeData?.(newDataSource
|
|
1043
|
+
triggerChangeData?.(newDataSource, {
|
|
1044
|
+
type: 'INSERT_BEFORE',
|
|
1045
|
+
row: n
|
|
1046
|
+
});
|
|
1031
1047
|
}
|
|
1032
1048
|
}
|
|
1033
1049
|
}, [defaultValue, focusedCell, mergedFilterKeys, originData, rowKey, rowsFocus, setMergedFilterKeys, table, triggerChangeData]);
|
|
@@ -1065,7 +1081,10 @@ const TableContainerEdit = props => {
|
|
|
1065
1081
|
setMergedFilterKeys?.(rs);
|
|
1066
1082
|
const index = newData.findIndex(obj => obj[rowKey] === record[rowKey]);
|
|
1067
1083
|
newData.splice(index + 1, 0, ...newRows);
|
|
1068
|
-
triggerChangeData?.(newData
|
|
1084
|
+
triggerChangeData?.(newData, {
|
|
1085
|
+
type: 'INSERT_AFTER',
|
|
1086
|
+
row: n
|
|
1087
|
+
});
|
|
1069
1088
|
} else {
|
|
1070
1089
|
const newData = [...originData];
|
|
1071
1090
|
const parent = findItemByKey(newData, rowKey, record.parentId);
|
|
@@ -1094,7 +1113,10 @@ const TableContainerEdit = props => {
|
|
|
1094
1113
|
children: childData
|
|
1095
1114
|
};
|
|
1096
1115
|
const newDataSource = updateArrayByKey(newData, newRowData, rowKey);
|
|
1097
|
-
triggerChangeData?.(newDataSource
|
|
1116
|
+
triggerChangeData?.(newDataSource, {
|
|
1117
|
+
type: 'INSERT_AFTER',
|
|
1118
|
+
row: n
|
|
1119
|
+
});
|
|
1098
1120
|
}
|
|
1099
1121
|
}
|
|
1100
1122
|
}, [defaultValue, table, focusedCell?.rowId, originData, mergedFilterKeys, setMergedFilterKeys, triggerChangeData, rowKey]);
|
|
@@ -1132,7 +1154,9 @@ const TableContainerEdit = props => {
|
|
|
1132
1154
|
const rs = mergedFilterKeys ? [...mergedFilterKeys, rowId] : [rowId];
|
|
1133
1155
|
setMergedFilterKeys?.(rs);
|
|
1134
1156
|
const newDataSource = updateArrayByKey(newData, newElement, rowKey);
|
|
1135
|
-
triggerChangeData?.(newDataSource
|
|
1157
|
+
triggerChangeData?.(newDataSource, {
|
|
1158
|
+
type: 'INSERT_CHILDREN'
|
|
1159
|
+
});
|
|
1136
1160
|
}
|
|
1137
1161
|
setTimeout(() => {
|
|
1138
1162
|
const row = table.getRowModel().rows.find(it => it.id === focusedCell?.rowId);
|
|
@@ -1175,12 +1199,18 @@ const TableContainerEdit = props => {
|
|
|
1175
1199
|
buttonsStyling: false
|
|
1176
1200
|
}).then(async result => {
|
|
1177
1201
|
if (result.value) {
|
|
1178
|
-
triggerChangeData?.([...newDaa]
|
|
1202
|
+
triggerChangeData?.([...newDaa], {
|
|
1203
|
+
type: 'DELETE_ROWS',
|
|
1204
|
+
row: rowsFocus.length
|
|
1205
|
+
});
|
|
1179
1206
|
} else if (result.dismiss === MySwal.DismissReason.cancel) {}
|
|
1180
1207
|
});
|
|
1181
1208
|
} else {
|
|
1182
1209
|
// không hiện dialog
|
|
1183
|
-
triggerChangeData?.([...newDaa]
|
|
1210
|
+
triggerChangeData?.([...newDaa], {
|
|
1211
|
+
type: 'DELETE_ROWS',
|
|
1212
|
+
row: rowsFocus.length
|
|
1213
|
+
});
|
|
1184
1214
|
}
|
|
1185
1215
|
}
|
|
1186
1216
|
}, [commandSettings, originData, rowKey, rowsFocus, t, triggerChangeData]);
|
|
@@ -1206,11 +1236,15 @@ const TableContainerEdit = props => {
|
|
|
1206
1236
|
buttonsStyling: false
|
|
1207
1237
|
}).then(async result => {
|
|
1208
1238
|
if (result.value) {
|
|
1209
|
-
triggerChangeData?.([]
|
|
1239
|
+
triggerChangeData?.([], {
|
|
1240
|
+
type: 'DELETE'
|
|
1241
|
+
});
|
|
1210
1242
|
} else if (result.dismiss === MySwal.DismissReason.cancel) {}
|
|
1211
1243
|
});
|
|
1212
1244
|
} else {
|
|
1213
|
-
triggerChangeData?.([]
|
|
1245
|
+
triggerChangeData?.([], {
|
|
1246
|
+
type: 'DELETE'
|
|
1247
|
+
});
|
|
1214
1248
|
}
|
|
1215
1249
|
}
|
|
1216
1250
|
}, [commandSettings, t, triggerChangeData]);
|
|
@@ -1256,7 +1290,9 @@ const TableContainerEdit = props => {
|
|
|
1256
1290
|
return updatedRow;
|
|
1257
1291
|
});
|
|
1258
1292
|
const newData = unFlattenData(rs);
|
|
1259
|
-
triggerChangeData?.([...newData]
|
|
1293
|
+
triggerChangeData?.([...newData], {
|
|
1294
|
+
type: 'DELETE_CONTENT'
|
|
1295
|
+
});
|
|
1260
1296
|
}
|
|
1261
1297
|
};
|
|
1262
1298
|
const toolbarItemsBottom = React.useMemo(() => {
|
|
@@ -176,8 +176,53 @@ const EditableCell = props => {
|
|
|
176
176
|
placeholder: t && column.placeholder ? t(column.placeholder) : undefined,
|
|
177
177
|
disabled: isDisable(column, record) ?? false,
|
|
178
178
|
maxDate: maxDate,
|
|
179
|
-
minDate: minDate
|
|
180
|
-
|
|
179
|
+
minDate: minDate
|
|
180
|
+
// mode="date"
|
|
181
|
+
|
|
182
|
+
// onChange={(newDate, dateString) => {
|
|
183
|
+
|
|
184
|
+
// const newDateValue = dateString ? moment(convertDayjsToDate(dateString as string, dateFormat)).format() : null
|
|
185
|
+
|
|
186
|
+
// onChange(newDateValue)
|
|
187
|
+
|
|
188
|
+
// setTimeout(() => {
|
|
189
|
+
// // @ts-ignore
|
|
190
|
+
// dateTimePickerRef.current?.focus()
|
|
191
|
+
// }, 0)
|
|
192
|
+
|
|
193
|
+
// }}
|
|
194
|
+
|
|
195
|
+
// onBlur={() => {
|
|
196
|
+
// const formState = getValues()
|
|
197
|
+
// const itemState = getValues(dataIndex)
|
|
198
|
+
// // @ts-ignore
|
|
199
|
+
// const prevState = record[dataIndex]
|
|
200
|
+
// const newState = itemState
|
|
201
|
+
|
|
202
|
+
// if (prevState !== newState) {
|
|
203
|
+
// handleCellChange?.({
|
|
204
|
+
// key: key as any,
|
|
205
|
+
// field: column.field ?? column.field as any,
|
|
206
|
+
// record: formState,
|
|
207
|
+
// prevState,
|
|
208
|
+
// newState,
|
|
209
|
+
// option: newState,
|
|
210
|
+
// indexCol,
|
|
211
|
+
// indexRow,
|
|
212
|
+
// type: 'blur'
|
|
213
|
+
// })
|
|
214
|
+
// }
|
|
215
|
+
// }}
|
|
216
|
+
,
|
|
217
|
+
|
|
218
|
+
popupClassName: 'be-popup-container',
|
|
219
|
+
status: isInvalid ? 'error' : undefined,
|
|
220
|
+
"data-tooltip-content": message,
|
|
221
|
+
"data-tooltip-id": `${id}-tooltip-error`,
|
|
222
|
+
autoFocus: column.field === startCell?.colId,
|
|
223
|
+
defaultOpen: column.field === startCell?.colId,
|
|
224
|
+
needConfirm: false,
|
|
225
|
+
onCalendarChange: (newDate, dateString) => {
|
|
181
226
|
const newDateValue = dateString ? moment(convertDayjsToDate(dateString, dateFormat)).format() : null;
|
|
182
227
|
onChange(newDateValue);
|
|
183
228
|
setTimeout(() => {
|
|
@@ -185,32 +230,28 @@ const EditableCell = props => {
|
|
|
185
230
|
dateTimePickerRef.current?.focus();
|
|
186
231
|
}, 0);
|
|
187
232
|
},
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
233
|
+
onOpenChange: open => {
|
|
234
|
+
if (!open) {
|
|
235
|
+
const formState = getValues();
|
|
236
|
+
const itemState = getValues(dataIndex);
|
|
237
|
+
// @ts-ignore
|
|
238
|
+
const prevState = record[dataIndex];
|
|
239
|
+
const newState = itemState;
|
|
240
|
+
if (prevState !== newState) {
|
|
241
|
+
handleCellChange?.({
|
|
242
|
+
key: key,
|
|
243
|
+
field: column.field ?? column.field,
|
|
244
|
+
record: formState,
|
|
245
|
+
prevState,
|
|
246
|
+
newState,
|
|
247
|
+
option: newState,
|
|
248
|
+
indexCol,
|
|
249
|
+
indexRow,
|
|
250
|
+
type: 'blur'
|
|
251
|
+
});
|
|
252
|
+
}
|
|
206
253
|
}
|
|
207
|
-
}
|
|
208
|
-
popupClassName: 'be-popup-container',
|
|
209
|
-
status: isInvalid ? 'error' : undefined,
|
|
210
|
-
"data-tooltip-content": message,
|
|
211
|
-
"data-tooltip-id": `${id}-tooltip-error`,
|
|
212
|
-
autoFocus: column.field === startCell?.colId,
|
|
213
|
-
defaultOpen: column.field === startCell?.colId
|
|
254
|
+
}
|
|
214
255
|
});
|
|
215
256
|
case 'month':
|
|
216
257
|
case 'quarter':
|
|
@@ -536,7 +536,8 @@ const TableBodyCellEdit = props => {
|
|
|
536
536
|
setEditingKey?.(record[rowKey]);
|
|
537
537
|
// setTooltipContent('')
|
|
538
538
|
|
|
539
|
-
handleCellClick?.(rowNumber, record, columnMeta, record[rowKey], record[columnMeta.field ?? ''])
|
|
539
|
+
// handleCellClick?.(rowNumber, record, columnMeta as any, record[rowKey], record[columnMeta.field ?? ''])
|
|
540
|
+
|
|
540
541
|
reset?.();
|
|
541
542
|
|
|
542
543
|
// const formattedRecord = { ...record };
|
|
@@ -1150,6 +1151,7 @@ const TableBodyCellEdit = props => {
|
|
|
1150
1151
|
}),
|
|
1151
1152
|
style: {
|
|
1152
1153
|
display: 'flex',
|
|
1154
|
+
alignItems: 'center',
|
|
1153
1155
|
width: cell.column.getSize(),
|
|
1154
1156
|
minWidth: cell.column.getSize(),
|
|
1155
1157
|
// flex: 1,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Space } from 'antd';
|
|
3
|
+
import Button from 'rc-master-ui/es/button';
|
|
3
4
|
import { ArrowDown, ArrowUp, FilterFill, SortCancel } from 'becoxy-icons';
|
|
4
5
|
import classNames from 'classnames';
|
|
5
6
|
import { Checkbox, Dropdown, Select } from 'rc-master-ui';
|
|
@@ -9,10 +9,12 @@ $primary: #eb4619 !default;
|
|
|
9
9
|
$rowHoverBg: #FBDED6 !default;
|
|
10
10
|
$rowSelectedBg: #FEF2EF !default;
|
|
11
11
|
$tableBorderColor: #e0e0e0 !default;
|
|
12
|
-
$border-selected-color: #
|
|
12
|
+
$border-selected-color: #e63706 !default;
|
|
13
13
|
$body-color: #ffffff !default;
|
|
14
|
-
$cell-selected-bg: #F3F8FF !default;
|
|
15
|
-
$cell-
|
|
14
|
+
// $cell-selected-bg: #F3F8FF !default;
|
|
15
|
+
$cell-selected-bg: #fcf5f2 !default;
|
|
16
|
+
// $cell-index-selected-bg: #1869E6 !default;
|
|
17
|
+
$cell-index-selected-bg: #eb4619 !default;
|
|
16
18
|
$cell-index-focus-bg: #E6EFFD !default;
|
|
17
19
|
|
|
18
20
|
// 404071
|
|
@@ -37,11 +39,36 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
37
39
|
box-sizing: border-box;
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
.rs-picker-daterange-panel {
|
|
43
|
+
--rs-input-focus-border: #eb4619;
|
|
44
|
+
--rs-btn-link-text: #f0552b;
|
|
45
|
+
--rs-btn-link-hover-text: #eb4619;
|
|
46
|
+
--rs-btn-primary-bg: #e47253;
|
|
47
|
+
--rs-text-active: #eb4619;
|
|
48
|
+
--rs-listbox-option-hover-text: #eb4619;
|
|
49
|
+
--rs-bg-active: #f06842;
|
|
50
|
+
--rs-calendar-cell-selected-hover-bg: #eb4619;
|
|
51
|
+
--rs-btn-primary-hover-bg: #eb4619;
|
|
52
|
+
--rs-calendar-range-bg: #faf2ef;
|
|
53
|
+
--rs-listbox-option-hover-bg: #faf2ef;
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ui-rc-picker-now {
|
|
58
|
+
--bs-link-color-rgb: 235, 70, 25;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ui-rc-pagination-options {
|
|
62
|
+
.ui-rc-select-selection-item {
|
|
63
|
+
font-size: 12px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
40
66
|
|
|
41
67
|
.#{$prefix}-grid {
|
|
42
68
|
|
|
43
69
|
.toolbar-icon {
|
|
44
70
|
cursor: pointer;
|
|
71
|
+
|
|
45
72
|
&:focus {
|
|
46
73
|
outline: none;
|
|
47
74
|
}
|
|
@@ -110,7 +137,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
110
137
|
|
|
111
138
|
&.#{$prefix}-grid-cell-text-wrap {
|
|
112
139
|
.ui-rc_cell-content {
|
|
113
|
-
|
|
140
|
+
word-break: break-word;
|
|
114
141
|
}
|
|
115
142
|
|
|
116
143
|
}
|
|
@@ -448,7 +475,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
448
475
|
|
|
449
476
|
|
|
450
477
|
&.cell-border-top {
|
|
451
|
-
|
|
478
|
+
|
|
452
479
|
&.ui-rc-grid-cell-fix-left-last {
|
|
453
480
|
&::after {
|
|
454
481
|
left: -100%;
|
|
@@ -600,15 +627,20 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
600
627
|
border-left: 1px solid #e0e0e0;
|
|
601
628
|
|
|
602
629
|
.be-toolbar-item {
|
|
630
|
+
.ui-rc-btn {
|
|
631
|
+
font-size: 12px;
|
|
632
|
+
}
|
|
633
|
+
|
|
603
634
|
.toolbar-dropdown-button {
|
|
604
|
-
|
|
635
|
+
font-size: 12px;
|
|
636
|
+
.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-first-item {
|
|
605
637
|
border-color: #28c76f;
|
|
606
638
|
}
|
|
607
639
|
|
|
608
|
-
.
|
|
640
|
+
.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-last-item {
|
|
609
641
|
border-color: #28c76f;
|
|
610
642
|
|
|
611
|
-
.
|
|
643
|
+
.ui-rc-btn-icon {
|
|
612
644
|
color: #28c76f;
|
|
613
645
|
}
|
|
614
646
|
}
|
|
@@ -689,7 +721,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
689
721
|
.#{$prefix}-grid {
|
|
690
722
|
|
|
691
723
|
.#{$prefix}-pagination {
|
|
692
|
-
|
|
724
|
+
|
|
693
725
|
|
|
694
726
|
&.top-pagination {
|
|
695
727
|
border: none;
|
|
@@ -701,7 +733,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
701
733
|
}
|
|
702
734
|
}
|
|
703
735
|
|
|
704
|
-
padding:
|
|
736
|
+
padding: 5px;
|
|
705
737
|
|
|
706
738
|
border-bottom: 1px solid $tableBorderColor;
|
|
707
739
|
border-inline: 1px solid $tableBorderColor;
|
|
@@ -349,7 +349,7 @@ const TableBodyCell = props => {
|
|
|
349
349
|
// display: 'flex',
|
|
350
350
|
width: cell.column.getSize(),
|
|
351
351
|
minWidth: cell.column.getSize(),
|
|
352
|
-
minHeight:
|
|
352
|
+
minHeight: 32,
|
|
353
353
|
...getCommonPinningStyles(cell.column)
|
|
354
354
|
},
|
|
355
355
|
onMouseEnter: e => {
|
|
@@ -403,6 +403,9 @@ const TableBodyCell = props => {
|
|
|
403
403
|
}
|
|
404
404
|
},
|
|
405
405
|
onClick: e => {
|
|
406
|
+
if (e.detail === 2) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
406
409
|
const selection = window.getSelection();
|
|
407
410
|
const text = selection ? selection.toString() : "";
|
|
408
411
|
if (text.length > 0 || enableClick === false) {} else {
|
|
@@ -115,7 +115,7 @@ const TableBodyRow = ({
|
|
|
115
115
|
rowData: row.original,
|
|
116
116
|
value: cellValue
|
|
117
117
|
}) : /*#__PURE__*/React.createElement(React.Fragment, null, headertext, headertext ? ': ' : '', " ", cellContent);
|
|
118
|
-
return /*#__PURE__*/React.createElement(TableBodyCell, _extends({
|
|
118
|
+
return /*#__PURE__*/React.createElement(TableBodyCell, _extends({}, otherCellAttributes, {
|
|
119
119
|
table: table,
|
|
120
120
|
tableId: tableId,
|
|
121
121
|
key: cell.id,
|
|
@@ -124,8 +124,7 @@ const TableBodyRow = ({
|
|
|
124
124
|
virtualRow: virtualRow,
|
|
125
125
|
isEditing: false,
|
|
126
126
|
colSpan: colSpanGroup ?? 1,
|
|
127
|
-
rowSpan: 1
|
|
128
|
-
}, otherCellAttributes, {
|
|
127
|
+
rowSpan: 1,
|
|
129
128
|
groupValue: groupValue
|
|
130
129
|
}));
|
|
131
130
|
}
|
|
@@ -149,7 +148,7 @@ const TableBodyRow = ({
|
|
|
149
148
|
const childrenData = row.subRows.map(it => it.original);
|
|
150
149
|
const sumValue = sumByField(childrenData, cell.column.id);
|
|
151
150
|
const sumValueFormat = numericFormatter(sumValue.toString(), numericFormatProps);
|
|
152
|
-
return /*#__PURE__*/React.createElement(TableBodyCellRowGroup, _extends({
|
|
151
|
+
return /*#__PURE__*/React.createElement(TableBodyCellRowGroup, _extends({}, otherCellAttributes, {
|
|
153
152
|
table: table,
|
|
154
153
|
tableId: tableId,
|
|
155
154
|
key: cell.id,
|
|
@@ -160,9 +159,9 @@ const TableBodyRow = ({
|
|
|
160
159
|
colSpan: onCellColSpan ?? 1,
|
|
161
160
|
rowSpan: onCellRowSpan ?? 1,
|
|
162
161
|
sumValue: sumValueFormat
|
|
163
|
-
}
|
|
162
|
+
}));
|
|
164
163
|
}
|
|
165
|
-
return /*#__PURE__*/React.createElement(TableBodyCell, _extends({
|
|
164
|
+
return /*#__PURE__*/React.createElement(TableBodyCell, _extends({}, otherCellAttributes, {
|
|
166
165
|
table: table,
|
|
167
166
|
tableId: tableId,
|
|
168
167
|
key: cell.id,
|
|
@@ -172,7 +171,7 @@ const TableBodyRow = ({
|
|
|
172
171
|
isEditing: false,
|
|
173
172
|
colSpan: onCellColSpan ?? 1,
|
|
174
173
|
rowSpan: onCellRowSpan ?? 1
|
|
175
|
-
}
|
|
174
|
+
}));
|
|
176
175
|
}));
|
|
177
176
|
};
|
|
178
177
|
export default TableBodyRow;
|
|
@@ -11,4 +11,4 @@ const colorDark = "#e6e4f3e6";
|
|
|
11
11
|
export const GridStyle = styled.div.withConfig({
|
|
12
12
|
displayName: "GridStyle",
|
|
13
13
|
componentId: "es-grid-template__sc-rs980s-0"
|
|
14
|
-
})(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";.", "-grid-thead{&:has(.resizer.isResizing){.", "-grid-cell{touch-action:none;user-select:none;}}.", "-grid-cell{background-color:#ffffff;&:has(.resizer.isResizing){touch-action:none;user-select:none;}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;touch-action:none;user-select:none;width:5px;}}}tbody{.", "-grid-row{&.", "-grid-row-parent{.", "-grid-cell{font-weight:600;background-color:#f5f5f5;}}}}.", "-grid-tfoot{z-index:3 !important;.ui-rc-grid-footer-row{.ui-rc-grid-cell{border-top:1px solid ", ";border-bottom:1px solid ", ";font-weight:500;}}}.", "-grid-cell{padding:
|
|
14
|
+
})(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";.", "-grid-thead{&:has(.resizer.isResizing){.", "-grid-cell{touch-action:none;user-select:none;}}.", "-grid-cell{background-color:#ffffff;&:has(.resizer.isResizing){touch-action:none;user-select:none;}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;touch-action:none;user-select:none;width:5px;}}}tbody{.", "-grid-row{&.", "-grid-row-parent{.", "-grid-cell{font-weight:600;background-color:#f5f5f5;}}}}.", "-grid-tfoot{z-index:3 !important;.ui-rc-grid-footer-row{.ui-rc-grid-cell{border-top:1px solid ", ";border-bottom:1px solid ", ";font-weight:500;}}}.", "-grid-cell{padding:5px 8px;.class-content:has(*){background:lightblue;}.class-content:not(:has(*)){background:lightgreen;}&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-righ{text-align:right;justify-content:flex-end;}}.", "-grid-cell:not(:has(*)){&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{text-align:right;justify-content:flex-end;}&.", "-grid-cell-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{z-index:3 !important;background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:#ffffff;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";}}tbody{background-color:", ";color:", ";.", "-grid-row{&.ui-rc-grid-row-selected{.", "-grid-cell{background-color:", ";}}}.", "-grid-cell{outline:none;background-color:#ffffff;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-selected{background-color:", " !important;}&.disable{background-color:#f0f0f0;}&.cell-editable{user-select:none;&.cell-border-top{&::after{content:\"\";position:absolute;top:0px;left:0;height:1px;width:100%;border-top:1px solid ", ";pointer-events:none;z-index:1;}}&.cell-border-bottom{border-bottom:1px solid ", ";}&.cell-border-left{&::before{content:\"\";position:absolute;top:0;left:0;height:102%;width:1px;border-left:1px solid ", ";pointer-events:none;z-index:1;}}&.cell-border-right{border-inline-end:1px solid ", ";}&.cell-paste-border-top{&::after{content:\"\";position:absolute;top:0px;left:0;height:1px;width:100%;border-top:1px dashed #949494;pointer-events:none;z-index:1;}&.ui-rc-grid-cell-fix-left-last{&::after{left:-100%;}}&.ui-rc-grid-cell-fix-right-first{&::after{left:100%;}}}&.cell-paste-border-bottom{border-bottom:1px dashed #949494;}&.cell-paste-border-left{&::before{content:\"\";position:absolute;top:0;left:0;height:102%;width:1px;border-left:1px dashed #949494;pointer-events:none;z-index:1;}}&.cell-paste-border-right{border-inline-end:1px dashed #949494;}.dragging-point{width:6px;height:6px;position:absolute;cursor:crosshair;right:0px;bottom:0px;&.hidden{display:none;}.dot-point{position:absolute;width:6px;height:6px;border-radius:0px;background-color:", ";bottom:0;right:0;}}}&.cell-editing{padding:0;&:focus-visible{outline:none;}.ant-form-item,.ant-row.ant-form-item-row,.ant-col.ant-form-item-control,.ant-form-item-control-input,.ant-form-item-control-input-content,.ant-input{height:100% !important;&:focus-visible{outline:none;}}textarea.ant-input{line-height:1.8;height:36px !important;min-height:36px !important;}input.be-cell-editing,.ant-picker,.ui-rc-select-selector,.ui-rc-table-select-selector{padding-inline:7px;}.", "-checkbox-wrapper{.", "-checkbox{background-color:red;}.", "-checkbox-input{&:focus-visible{outline:none;}}}.ant-input,.ant-picker{border-radius:0;}.ant-color-picker-trigger{height:100%;border-radius:0;.ant-color-picker-color-block{height:100%;width:100%;}}.", "-table-select-single .", "-table-select-selector,.", "-select-single .", "-select-selector,.ui-rc-table-select-selector{border-radius:0 !important;}.", "-table-select-single:not(.", "-table-select-customize-input){.", "-table-select-selector{.", "-table-select-selection-search-input{height:auto;}}}}}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}}"], props => props.$prefix, color, BgColor, props => props.$prefix, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, rowSelectedBg, props => props.$prefix, tableBorderColor, tableBorderColor, cellSelectedBg, borderSelectedColor, borderSelectedColor, borderSelectedColor, borderSelectedColor, borderSelectedColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
@@ -124,7 +124,9 @@ const TableWrapper = props => {
|
|
|
124
124
|
}
|
|
125
125
|
}, /*#__PURE__*/React.createElement(TableVirtuoso, {
|
|
126
126
|
data: table.getRowModel().rows,
|
|
127
|
-
totalCount: rows.length
|
|
127
|
+
totalCount: rows.length
|
|
128
|
+
// isScrolling={}
|
|
129
|
+
,
|
|
128
130
|
components: {
|
|
129
131
|
Table: ({
|
|
130
132
|
style,
|