es-grid-template 1.8.62 → 1.8.63
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.
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import React, { createContext, Fragment, useCallback, useContext, useState } from 'react';
|
|
3
3
|
import 'react-resizable/css/styles.css';
|
|
4
4
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
5
|
-
import { addRowIdArray, booleanOperator, convertFilters, convertFlatColumn, filterDataByColumns4, findItemByKey, findItemPath, flattenArray, getAllRowKey, getFormat, getTypeFilter, groupArrayByColumns, isNullOrUndefined, numberOperator, removeColumns, removeInvisibleColumns, stringOperator, sumByField, translateOption, unFlattenData, updateArrayByKey, updateColumnsByGroup,
|
|
5
|
+
import { addRowIdArray, booleanOperator, checkDecimalSeparator, checkThousandSeparator, convertFilters, convertFlatColumn, filterDataByColumns4, findItemByKey, findItemPath, flattenArray, getAllRowKey, getFormat, getTypeFilter, groupArrayByColumns, isNullOrUndefined, numberOperator, removeColumns, removeInvisibleColumns, stringOperator, sumByField, translateOption, unFlattenData, updateArrayByKey, updateColumnsByGroup,
|
|
6
6
|
// updateData,
|
|
7
7
|
updateOrInsert } from "./hooks";
|
|
8
8
|
import ReactDOMServer from 'react-dom/server';
|
|
@@ -33,7 +33,7 @@ import classNames from "classnames";
|
|
|
33
33
|
import HeaderContent from "./hooks/content/HeaderContent";
|
|
34
34
|
import { ArrowDown, ArrowUp, FilterFill, SortCancel } from "becoxy-icons";
|
|
35
35
|
import { Select } from "rc-master-ui";
|
|
36
|
-
import { Button,
|
|
36
|
+
import { Button, Modal, Space } from "antd";
|
|
37
37
|
import { SearchOutlined } from "@ant-design/icons";
|
|
38
38
|
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
39
39
|
import { closestCenter, DndContext, DragOverlay, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
|
@@ -42,6 +42,9 @@ import { arrayMove, horizontalListSortingStrategy, SortableContext, useSortable
|
|
|
42
42
|
import { Resizable } from "react-resizable";
|
|
43
43
|
import { faker } from "@faker-js/faker";
|
|
44
44
|
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
45
|
+
import { numericFormatter } from 'react-numeric-component';
|
|
46
|
+
// import Modal from 'antd/es/modal/Modal'
|
|
47
|
+
|
|
45
48
|
dayjs.extend(customParseFormat);
|
|
46
49
|
const MySwal = withReactContent(Swal);
|
|
47
50
|
const ASCEND = 'ascend';
|
|
@@ -80,9 +83,6 @@ const ResizableTitle = props => {
|
|
|
80
83
|
...restProps
|
|
81
84
|
} = props;
|
|
82
85
|
const dragState = useContext(DragIndexContext);
|
|
83
|
-
|
|
84
|
-
// const { attributes, listeners, setNodeRef, isDragging } = useSortable({ id: props.id });
|
|
85
|
-
|
|
86
86
|
const style = {
|
|
87
87
|
...props.style,
|
|
88
88
|
borderBottom: '1px solid #e0e0e0',
|
|
@@ -263,10 +263,10 @@ const InternalTable = props => {
|
|
|
263
263
|
if (totalHeight) {
|
|
264
264
|
const table = document.querySelector(`#${id}`);
|
|
265
265
|
const title = table?.querySelector(`.ui-rc-table-title`);
|
|
266
|
+
const tableScrollRight = table?.querySelector(`.ui-rc-table-ping-right`);
|
|
266
267
|
const paginationE = table?.querySelector(`.ui-rc-pagination`);
|
|
267
268
|
const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
|
|
268
269
|
const summaryE = table?.querySelector(`.ui-rc-table-summary`);
|
|
269
|
-
const tableScrollRight = table?.querySelector(`.ui-rc-table-ping-right`);
|
|
270
270
|
const hhh = (totalHeight ?? 0) - (title ? title.offsetHeight : 0) - (theadRef ? theadRef.current.clientHeight : 0) - (paginationE ? paginationE.offsetHeight : 0) - (toolbar ? toolbar.offsetHeight : 0) - (summaryE ? 40 : 0) - (tableScrollRight ? 10 : 0);
|
|
271
271
|
setHeight(hhh > 0 ? hhh : 0);
|
|
272
272
|
}
|
|
@@ -423,26 +423,28 @@ const InternalTable = props => {
|
|
|
423
423
|
dataIndex: column.field ?? column.dataIndex,
|
|
424
424
|
key: column.field ?? column.key,
|
|
425
425
|
// title: () => (<HeaderContent column={{...column} as any} t={t}/>),
|
|
426
|
-
title:
|
|
427
|
-
|
|
428
|
-
|
|
426
|
+
title:
|
|
427
|
+
/*#__PURE__*/
|
|
428
|
+
// <SortableHeaderCell columnKey={column.field}>
|
|
429
|
+
React.createElement(HeaderContent, {
|
|
429
430
|
column: {
|
|
430
431
|
...column
|
|
431
432
|
},
|
|
432
433
|
t: t,
|
|
433
434
|
id: id,
|
|
434
435
|
wrapSettings: wrapSettings
|
|
435
|
-
})
|
|
436
|
+
})
|
|
437
|
+
// </SortableHeaderCell>
|
|
438
|
+
,
|
|
436
439
|
// ellipsis: editAble || column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
437
|
-
ellipsis: column.ellipsis !== false || wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
438
|
-
|
|
439
|
-
// ellipsis: column.ellipsis !== false,
|
|
440
|
-
|
|
440
|
+
// ellipsis: column.ellipsis !== false || (wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both'),
|
|
441
|
+
ellipsis: false,
|
|
441
442
|
align: column.textAlign ?? column.align,
|
|
442
443
|
fixed: column.fixedType ?? column.fixed,
|
|
443
444
|
isSummary: column.isSummary ?? column.haveSum,
|
|
444
445
|
hidden: column.hidden ?? column.visible === false
|
|
445
446
|
};
|
|
447
|
+
const headerTooltip = t ? t?.(column.headerTooltip ?? column.columnGroupText ?? column.headerText) : column.headerTooltip ?? column.columnGroupText ?? column.headerText;
|
|
446
448
|
if (transformedColumn.field === '#') {
|
|
447
449
|
return {
|
|
448
450
|
...transformedColumn,
|
|
@@ -544,10 +546,18 @@ const InternalTable = props => {
|
|
|
544
546
|
},
|
|
545
547
|
onHeaderCell: () => ({
|
|
546
548
|
id: `${column.field}`,
|
|
547
|
-
width: column.width,
|
|
549
|
+
// width: column.width,
|
|
550
|
+
|
|
551
|
+
'data-tooltip-id': `${id}-tooltip-header`,
|
|
552
|
+
'data-tooltip-content': headerTooltip,
|
|
548
553
|
onResize: handleResize?.(column),
|
|
549
|
-
className:
|
|
550
|
-
|
|
554
|
+
className: classNames('', {
|
|
555
|
+
'head-align-center': column.headerTextAlign === 'center',
|
|
556
|
+
'head-align-right': column.headerTextAlign === 'right',
|
|
557
|
+
'ui-rc-table-cell-ellipsis': !wrapSettings || !!(wrapSettings && wrapSettings.wrapMode === 'Content'),
|
|
558
|
+
// mặc định = true
|
|
559
|
+
'ui-rc-table-cell-wrap': wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')
|
|
560
|
+
})
|
|
551
561
|
}),
|
|
552
562
|
onCell: (data, index) => {
|
|
553
563
|
const tooltipContent = isOpenTooltip === false ? '' : column?.tooltipDescription ? typeof column.tooltipDescription === 'function' ? column.tooltipDescription({
|
|
@@ -556,14 +566,16 @@ const InternalTable = props => {
|
|
|
556
566
|
}) : column.tooltipDescription : column.template && typeof column.template !== 'function' ? column.template : data[column.field ?? ''];
|
|
557
567
|
return {
|
|
558
568
|
id: `${column.field}`,
|
|
559
|
-
colSpan: groupColumns && data.children && column.field === firstNonGroupColumn?.field ?
|
|
569
|
+
colSpan: groupColumns && data.children && column.field === firstNonGroupColumn?.field ? groupSetting?.groupColumnSpan ?? 2 : groupColumns && data.children && nonGroupColumns[1].field === column.field ? 0 : 1,
|
|
560
570
|
// 'z-index': data?.children && column.field === firstNonGroupColumn?.field ? 11 : undefined,
|
|
561
571
|
...transformedColumn?.onCell?.(data, index),
|
|
562
572
|
className: classNames(transformedColumn?.onCell?.(data, index).className ?? '', {
|
|
563
573
|
'cell-group': groupColumns && data.children,
|
|
564
|
-
'cell-group-fixed': groupColumns && data.children && column.field === firstNonGroupColumn?.field
|
|
574
|
+
'cell-group-fixed': groupColumns && data.children && column.field === firstNonGroupColumn?.field,
|
|
575
|
+
'ui-rc-table-cell-ellipsis': !wrapSettings || wrapSettings && (wrapSettings.wrapMode === 'Header' || wrapSettings.wrapMode !== 'Both'),
|
|
576
|
+
// mặc định = true
|
|
577
|
+
'ui-rc-table-cell-wrap': wrapSettings && (wrapSettings.wrapMode === 'Content' || wrapSettings.wrapMode === 'Both')
|
|
565
578
|
}),
|
|
566
|
-
// 'data-tooltip-id': "tooltip-cell-content"
|
|
567
579
|
'data-tooltip-id': `${id}-tooltip-cell-content`,
|
|
568
580
|
"data-tooltip-html": ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, tooltipContent)),
|
|
569
581
|
onMouseEnter: e => {
|
|
@@ -603,8 +615,20 @@ const InternalTable = props => {
|
|
|
603
615
|
return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ": ", renderContent(currentGroupColumn, record[record.field], record, rowIndex, colIndex, false, cellFormat));
|
|
604
616
|
}
|
|
605
617
|
if (groupAble && record.children && column.sumGroup === true && column.type === 'number') {
|
|
618
|
+
const thousandSeparator = cellFormat?.thousandSeparator;
|
|
619
|
+
const decimalSeparator = cellFormat?.decimalSeparator;
|
|
620
|
+
const dec = cellFormat?.decimalScale;
|
|
621
|
+
const numericFormatProps = {
|
|
622
|
+
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
623
|
+
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
624
|
+
allowNegative: cellFormat?.allowNegative ?? true,
|
|
625
|
+
prefix: cellFormat?.prefix,
|
|
626
|
+
suffix: cellFormat?.suffix,
|
|
627
|
+
decimalScale: dec,
|
|
628
|
+
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
|
|
629
|
+
};
|
|
606
630
|
const sumValue = sumByField(filterDataByColumns4(record.children, [], []), column?.field);
|
|
607
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, sumValue);
|
|
631
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, numericFormatter(sumValue.toString(), numericFormatProps));
|
|
608
632
|
}
|
|
609
633
|
return renderContent(column, value, record, rowIndex, colIndex, false, cellFormat);
|
|
610
634
|
},
|
|
@@ -634,13 +658,14 @@ const InternalTable = props => {
|
|
|
634
658
|
id: id,
|
|
635
659
|
wrapSettings: wrapSettings
|
|
636
660
|
})),
|
|
637
|
-
|
|
638
|
-
ellipsis: editAble || column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
661
|
+
ellipsis: false,
|
|
662
|
+
// ellipsis: editAble || column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
663
|
+
|
|
639
664
|
align: column.textAlign ?? column.align,
|
|
640
665
|
fixed: column.fixedType ?? column.fixed,
|
|
641
666
|
isSummary: column.isSummary ?? column.haveSum,
|
|
642
|
-
hidden: column.hidden ?? column.visible === false
|
|
643
|
-
defaultSortOrder: 'ascend'
|
|
667
|
+
hidden: column.hidden ?? column.visible === false
|
|
668
|
+
// defaultSortOrder: 'ascend'
|
|
644
669
|
};
|
|
645
670
|
|
|
646
671
|
// Xử lý đệ quy cho children
|
|
@@ -927,12 +952,14 @@ const InternalTable = props => {
|
|
|
927
952
|
const handleFullScreen = () => {
|
|
928
953
|
setIsFullScreen(!isFullScreen);
|
|
929
954
|
};
|
|
930
|
-
const CustomThead =
|
|
955
|
+
const CustomThead = headerProps => {
|
|
931
956
|
const {
|
|
932
|
-
children
|
|
933
|
-
|
|
957
|
+
children,
|
|
958
|
+
className
|
|
959
|
+
} = headerProps;
|
|
934
960
|
return /*#__PURE__*/React.createElement("thead", {
|
|
935
|
-
ref: theadRef
|
|
961
|
+
ref: theadRef,
|
|
962
|
+
className: className
|
|
936
963
|
}, children);
|
|
937
964
|
};
|
|
938
965
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DndContext, {
|
|
@@ -958,7 +985,10 @@ const InternalTable = props => {
|
|
|
958
985
|
,
|
|
959
986
|
dataSource: filterDataByColumns4(mergedData, filterStates, mergedFilterKeys),
|
|
960
987
|
format: format,
|
|
961
|
-
columns: mergedColumns
|
|
988
|
+
columns: mergedColumns
|
|
989
|
+
|
|
990
|
+
// showSorterTooltip={false}
|
|
991
|
+
,
|
|
962
992
|
showSorterTooltip: {
|
|
963
993
|
target: 'sorter-icon'
|
|
964
994
|
},
|
|
@@ -314,6 +314,7 @@ export interface CommandItem {
|
|
|
314
314
|
export type IGroupSetting = {
|
|
315
315
|
client?: boolean;
|
|
316
316
|
onGroup?: (props: IOnGroup) => void;
|
|
317
|
+
groupColumnSpan?: number;
|
|
317
318
|
hiddenColumnGroup?: boolean;
|
|
318
319
|
showGroupIcon?: boolean;
|
|
319
320
|
unClearableLevel?: 1 | 2 | 3 | undefined;
|
|
@@ -36,6 +36,7 @@ var _sortable = require("@dnd-kit/sortable");
|
|
|
36
36
|
var _reactResizable = require("react-resizable");
|
|
37
37
|
var _faker = require("@faker-js/faker");
|
|
38
38
|
var _useMergedState = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
|
39
|
+
var _reactNumericComponent = require("react-numeric-component");
|
|
39
40
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
40
41
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
41
42
|
// import GridEdit from "./table/GridEdit"
|
|
@@ -50,6 +51,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
50
51
|
|
|
51
52
|
// import {CSS} from "@dnd-kit/utilities";
|
|
52
53
|
|
|
54
|
+
// import Modal from 'antd/es/modal/Modal'
|
|
55
|
+
|
|
53
56
|
_dayjs.default.extend(_customParseFormat.default);
|
|
54
57
|
const MySwal = (0, _sweetalert2ReactContent.default)(_sweetalert.default);
|
|
55
58
|
const ASCEND = 'ascend';
|
|
@@ -88,9 +91,6 @@ const ResizableTitle = props => {
|
|
|
88
91
|
...restProps
|
|
89
92
|
} = props;
|
|
90
93
|
const dragState = (0, _react.useContext)(DragIndexContext);
|
|
91
|
-
|
|
92
|
-
// const { attributes, listeners, setNodeRef, isDragging } = useSortable({ id: props.id });
|
|
93
|
-
|
|
94
94
|
const style = {
|
|
95
95
|
...props.style,
|
|
96
96
|
borderBottom: '1px solid #e0e0e0',
|
|
@@ -271,10 +271,10 @@ const InternalTable = props => {
|
|
|
271
271
|
if (totalHeight) {
|
|
272
272
|
const table = document.querySelector(`#${id}`);
|
|
273
273
|
const title = table?.querySelector(`.ui-rc-table-title`);
|
|
274
|
+
const tableScrollRight = table?.querySelector(`.ui-rc-table-ping-right`);
|
|
274
275
|
const paginationE = table?.querySelector(`.ui-rc-pagination`);
|
|
275
276
|
const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
|
|
276
277
|
const summaryE = table?.querySelector(`.ui-rc-table-summary`);
|
|
277
|
-
const tableScrollRight = table?.querySelector(`.ui-rc-table-ping-right`);
|
|
278
278
|
const hhh = (totalHeight ?? 0) - (title ? title.offsetHeight : 0) - (theadRef ? theadRef.current.clientHeight : 0) - (paginationE ? paginationE.offsetHeight : 0) - (toolbar ? toolbar.offsetHeight : 0) - (summaryE ? 40 : 0) - (tableScrollRight ? 10 : 0);
|
|
279
279
|
setHeight(hhh > 0 ? hhh : 0);
|
|
280
280
|
}
|
|
@@ -431,26 +431,28 @@ const InternalTable = props => {
|
|
|
431
431
|
dataIndex: column.field ?? column.dataIndex,
|
|
432
432
|
key: column.field ?? column.key,
|
|
433
433
|
// title: () => (<HeaderContent column={{...column} as any} t={t}/>),
|
|
434
|
-
title:
|
|
435
|
-
|
|
436
|
-
|
|
434
|
+
title:
|
|
435
|
+
/*#__PURE__*/
|
|
436
|
+
// <SortableHeaderCell columnKey={column.field}>
|
|
437
|
+
_react.default.createElement(_HeaderContent.default, {
|
|
437
438
|
column: {
|
|
438
439
|
...column
|
|
439
440
|
},
|
|
440
441
|
t: t,
|
|
441
442
|
id: id,
|
|
442
443
|
wrapSettings: wrapSettings
|
|
443
|
-
})
|
|
444
|
+
})
|
|
445
|
+
// </SortableHeaderCell>
|
|
446
|
+
,
|
|
444
447
|
// ellipsis: editAble || column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
445
|
-
ellipsis: column.ellipsis !== false || wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
446
|
-
|
|
447
|
-
// ellipsis: column.ellipsis !== false,
|
|
448
|
-
|
|
448
|
+
// ellipsis: column.ellipsis !== false || (wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both'),
|
|
449
|
+
ellipsis: false,
|
|
449
450
|
align: column.textAlign ?? column.align,
|
|
450
451
|
fixed: column.fixedType ?? column.fixed,
|
|
451
452
|
isSummary: column.isSummary ?? column.haveSum,
|
|
452
453
|
hidden: column.hidden ?? column.visible === false
|
|
453
454
|
};
|
|
455
|
+
const headerTooltip = t ? t?.(column.headerTooltip ?? column.columnGroupText ?? column.headerText) : column.headerTooltip ?? column.columnGroupText ?? column.headerText;
|
|
454
456
|
if (transformedColumn.field === '#') {
|
|
455
457
|
return {
|
|
456
458
|
...transformedColumn,
|
|
@@ -552,10 +554,18 @@ const InternalTable = props => {
|
|
|
552
554
|
},
|
|
553
555
|
onHeaderCell: () => ({
|
|
554
556
|
id: `${column.field}`,
|
|
555
|
-
width: column.width,
|
|
557
|
+
// width: column.width,
|
|
558
|
+
|
|
559
|
+
'data-tooltip-id': `${id}-tooltip-header`,
|
|
560
|
+
'data-tooltip-content': headerTooltip,
|
|
556
561
|
onResize: handleResize?.(column),
|
|
557
|
-
className:
|
|
558
|
-
|
|
562
|
+
className: (0, _classnames.default)('', {
|
|
563
|
+
'head-align-center': column.headerTextAlign === 'center',
|
|
564
|
+
'head-align-right': column.headerTextAlign === 'right',
|
|
565
|
+
'ui-rc-table-cell-ellipsis': !wrapSettings || !!(wrapSettings && wrapSettings.wrapMode === 'Content'),
|
|
566
|
+
// mặc định = true
|
|
567
|
+
'ui-rc-table-cell-wrap': wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')
|
|
568
|
+
})
|
|
559
569
|
}),
|
|
560
570
|
onCell: (data, index) => {
|
|
561
571
|
const tooltipContent = isOpenTooltip === false ? '' : column?.tooltipDescription ? typeof column.tooltipDescription === 'function' ? column.tooltipDescription({
|
|
@@ -564,14 +574,16 @@ const InternalTable = props => {
|
|
|
564
574
|
}) : column.tooltipDescription : column.template && typeof column.template !== 'function' ? column.template : data[column.field ?? ''];
|
|
565
575
|
return {
|
|
566
576
|
id: `${column.field}`,
|
|
567
|
-
colSpan: groupColumns && data.children && column.field === firstNonGroupColumn?.field ?
|
|
577
|
+
colSpan: groupColumns && data.children && column.field === firstNonGroupColumn?.field ? groupSetting?.groupColumnSpan ?? 2 : groupColumns && data.children && nonGroupColumns[1].field === column.field ? 0 : 1,
|
|
568
578
|
// 'z-index': data?.children && column.field === firstNonGroupColumn?.field ? 11 : undefined,
|
|
569
579
|
...transformedColumn?.onCell?.(data, index),
|
|
570
580
|
className: (0, _classnames.default)(transformedColumn?.onCell?.(data, index).className ?? '', {
|
|
571
581
|
'cell-group': groupColumns && data.children,
|
|
572
|
-
'cell-group-fixed': groupColumns && data.children && column.field === firstNonGroupColumn?.field
|
|
582
|
+
'cell-group-fixed': groupColumns && data.children && column.field === firstNonGroupColumn?.field,
|
|
583
|
+
'ui-rc-table-cell-ellipsis': !wrapSettings || wrapSettings && (wrapSettings.wrapMode === 'Header' || wrapSettings.wrapMode !== 'Both'),
|
|
584
|
+
// mặc định = true
|
|
585
|
+
'ui-rc-table-cell-wrap': wrapSettings && (wrapSettings.wrapMode === 'Content' || wrapSettings.wrapMode === 'Both')
|
|
573
586
|
}),
|
|
574
|
-
// 'data-tooltip-id': "tooltip-cell-content"
|
|
575
587
|
'data-tooltip-id': `${id}-tooltip-cell-content`,
|
|
576
588
|
"data-tooltip-html": _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipContent)),
|
|
577
589
|
onMouseEnter: e => {
|
|
@@ -611,8 +623,20 @@ const InternalTable = props => {
|
|
|
611
623
|
return /*#__PURE__*/_react.default.createElement("span", null, currentGroupColumn?.headerText, ": ", (0, _columns.renderContent)(currentGroupColumn, record[record.field], record, rowIndex, colIndex, false, cellFormat));
|
|
612
624
|
}
|
|
613
625
|
if (groupAble && record.children && column.sumGroup === true && column.type === 'number') {
|
|
626
|
+
const thousandSeparator = cellFormat?.thousandSeparator;
|
|
627
|
+
const decimalSeparator = cellFormat?.decimalSeparator;
|
|
628
|
+
const dec = cellFormat?.decimalScale;
|
|
629
|
+
const numericFormatProps = {
|
|
630
|
+
thousandSeparator: (0, _hooks.checkThousandSeparator)(thousandSeparator, decimalSeparator),
|
|
631
|
+
decimalSeparator: (0, _hooks.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
|
|
632
|
+
allowNegative: cellFormat?.allowNegative ?? true,
|
|
633
|
+
prefix: cellFormat?.prefix,
|
|
634
|
+
suffix: cellFormat?.suffix,
|
|
635
|
+
decimalScale: dec,
|
|
636
|
+
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
|
|
637
|
+
};
|
|
614
638
|
const sumValue = (0, _hooks.sumByField)((0, _hooks.filterDataByColumns4)(record.children, [], []), column?.field);
|
|
615
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, sumValue);
|
|
639
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _reactNumericComponent.numericFormatter)(sumValue.toString(), numericFormatProps));
|
|
616
640
|
}
|
|
617
641
|
return (0, _columns.renderContent)(column, value, record, rowIndex, colIndex, false, cellFormat);
|
|
618
642
|
},
|
|
@@ -642,13 +666,14 @@ const InternalTable = props => {
|
|
|
642
666
|
id: id,
|
|
643
667
|
wrapSettings: wrapSettings
|
|
644
668
|
})),
|
|
645
|
-
|
|
646
|
-
ellipsis: editAble || column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
669
|
+
ellipsis: false,
|
|
670
|
+
// ellipsis: editAble || column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
671
|
+
|
|
647
672
|
align: column.textAlign ?? column.align,
|
|
648
673
|
fixed: column.fixedType ?? column.fixed,
|
|
649
674
|
isSummary: column.isSummary ?? column.haveSum,
|
|
650
|
-
hidden: column.hidden ?? column.visible === false
|
|
651
|
-
defaultSortOrder: 'ascend'
|
|
675
|
+
hidden: column.hidden ?? column.visible === false
|
|
676
|
+
// defaultSortOrder: 'ascend'
|
|
652
677
|
};
|
|
653
678
|
|
|
654
679
|
// Xử lý đệ quy cho children
|
|
@@ -935,12 +960,14 @@ const InternalTable = props => {
|
|
|
935
960
|
const handleFullScreen = () => {
|
|
936
961
|
setIsFullScreen(!isFullScreen);
|
|
937
962
|
};
|
|
938
|
-
const CustomThead =
|
|
963
|
+
const CustomThead = headerProps => {
|
|
939
964
|
const {
|
|
940
|
-
children
|
|
941
|
-
|
|
965
|
+
children,
|
|
966
|
+
className
|
|
967
|
+
} = headerProps;
|
|
942
968
|
return /*#__PURE__*/_react.default.createElement("thead", {
|
|
943
|
-
ref: theadRef
|
|
969
|
+
ref: theadRef,
|
|
970
|
+
className: className
|
|
944
971
|
}, children);
|
|
945
972
|
};
|
|
946
973
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.DndContext, {
|
|
@@ -966,7 +993,10 @@ const InternalTable = props => {
|
|
|
966
993
|
,
|
|
967
994
|
dataSource: (0, _hooks.filterDataByColumns4)(mergedData, filterStates, mergedFilterKeys),
|
|
968
995
|
format: format,
|
|
969
|
-
columns: mergedColumns
|
|
996
|
+
columns: mergedColumns
|
|
997
|
+
|
|
998
|
+
// showSorterTooltip={false}
|
|
999
|
+
,
|
|
970
1000
|
showSorterTooltip: {
|
|
971
1001
|
target: 'sorter-icon'
|
|
972
1002
|
},
|
|
@@ -314,6 +314,7 @@ export interface CommandItem {
|
|
|
314
314
|
export type IGroupSetting = {
|
|
315
315
|
client?: boolean;
|
|
316
316
|
onGroup?: (props: IOnGroup) => void;
|
|
317
|
+
groupColumnSpan?: number;
|
|
317
318
|
hiddenColumnGroup?: boolean;
|
|
318
319
|
showGroupIcon?: boolean;
|
|
319
320
|
unClearableLevel?: 1 | 2 | 3 | undefined;
|