es-grid-template 1.9.12 → 1.9.14
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/ali-table/Grid.js +3 -1
- package/es/ali-table/InternalTable.js +18 -2
- package/es/ali-table/base-table/header.js +14 -11
- package/es/ali-table/base-table/table.d.ts +2 -2
- package/es/ali-table/base-table/table.js +5 -5
- package/es/ali-table/pipeline/features/columnCustom.d.ts +1 -0
- package/es/ali-table/pipeline/features/columnCustom.js +4 -3
- package/es/grid-component/type.d.ts +1 -0
- package/es/group-component/table/TableWrapper.d.ts +1 -0
- package/es/group-component/table/TableWrapper.js +2 -1
- package/es/table-component/body/EditableCell.js +33 -9
- package/es/table-component/hook/utils.d.ts +1 -0
- package/es/table-component/hook/utils.js +18 -0
- package/es/table-component/table/TableWrapper.d.ts +1 -0
- package/es/table-component/table/TableWrapper.js +2 -1
- package/lib/ali-table/Grid.js +3 -1
- package/lib/ali-table/InternalTable.js +15 -1
- package/lib/ali-table/base-table/header.js +14 -11
- package/lib/ali-table/base-table/table.d.ts +2 -2
- package/lib/ali-table/base-table/table.js +5 -5
- package/lib/ali-table/pipeline/features/columnCustom.d.ts +1 -0
- package/lib/ali-table/pipeline/features/columnCustom.js +4 -3
- package/lib/grid-component/type.d.ts +1 -0
- package/lib/group-component/table/TableWrapper.d.ts +1 -0
- package/lib/group-component/table/TableWrapper.js +2 -1
- package/lib/table-component/body/EditableCell.js +32 -8
- package/lib/table-component/hook/utils.d.ts +1 -0
- package/lib/table-component/hook/utils.js +20 -2
- package/lib/table-component/table/TableWrapper.d.ts +1 -0
- package/lib/table-component/table/TableWrapper.js +2 -1
- package/package.json +1 -1
package/es/ali-table/Grid.js
CHANGED
|
@@ -53,7 +53,8 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
53
53
|
footerDataSource,
|
|
54
54
|
loading,
|
|
55
55
|
useVirtual,
|
|
56
|
-
useOuterBorder = true
|
|
56
|
+
useOuterBorder = true,
|
|
57
|
+
showHeader = true
|
|
57
58
|
|
|
58
59
|
// onRowFooterStyles,
|
|
59
60
|
// onRowHeaderStyles
|
|
@@ -218,6 +219,7 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
218
219
|
}, typeof title === 'function' ? title?.(dataSource) : title)), /*#__PURE__*/React.createElement(WebsiteBaseTable, _extends({
|
|
219
220
|
ref: ref,
|
|
220
221
|
id: id,
|
|
222
|
+
showHeader: showHeader,
|
|
221
223
|
commandClick: commandClick,
|
|
222
224
|
isLoading: loading,
|
|
223
225
|
useVirtual: useVirtual,
|
|
@@ -5,13 +5,17 @@ import { useLocale } from "rc-master-ui/es/locale";
|
|
|
5
5
|
import { faker } from "@faker-js/faker";
|
|
6
6
|
import React from "react";
|
|
7
7
|
import "./base-table/styles.scss";
|
|
8
|
-
import { addRowIdArray, filterDataByColumns,
|
|
8
|
+
import { addRowIdArray, filterDataByColumns,
|
|
9
|
+
// getInvisibleColumns,
|
|
10
|
+
getVisibleFields, groupArrayByColumns, isTreeArray, revertConvertFilters, sortByType, sumFields } from "../table-component/hook/utils";
|
|
9
11
|
import { CustomProvider, ConfigProvider } from 'rc-master-ui';
|
|
10
12
|
import { Modal } from 'antd';
|
|
11
13
|
import { getLocale, getLocales } from "../locale/useLocale";
|
|
12
14
|
import { TableContext } from "./useContext";
|
|
13
15
|
import Grid from "./Grid";
|
|
14
16
|
import { getParentKeysLarge, getRowsByKeysKeepTreeOrder } from "./utils/selected";
|
|
17
|
+
// import { getInvisibleColumns } from "../group-component/hook/utils"
|
|
18
|
+
|
|
15
19
|
const InternalTable = props => {
|
|
16
20
|
const {
|
|
17
21
|
t,
|
|
@@ -19,6 +23,7 @@ const InternalTable = props => {
|
|
|
19
23
|
dataSource,
|
|
20
24
|
allowFiltering,
|
|
21
25
|
allowSortering,
|
|
26
|
+
allowResizing,
|
|
22
27
|
groupAble,
|
|
23
28
|
groupColumns,
|
|
24
29
|
groupSetting,
|
|
@@ -119,6 +124,14 @@ const InternalTable = props => {
|
|
|
119
124
|
}
|
|
120
125
|
return undefined;
|
|
121
126
|
}, [defaultFilter]);
|
|
127
|
+
|
|
128
|
+
// const columnInVisibility = React.useMemo(() => {
|
|
129
|
+
// return getInvisibleColumns(columns)
|
|
130
|
+
// }, [columns])
|
|
131
|
+
|
|
132
|
+
const columnVisibility = React.useMemo(() => {
|
|
133
|
+
return getVisibleFields(columns);
|
|
134
|
+
}, [columns]);
|
|
122
135
|
const pipeline = useTablePipeline({
|
|
123
136
|
components: fusion
|
|
124
137
|
}).input({
|
|
@@ -129,7 +142,9 @@ const InternalTable = props => {
|
|
|
129
142
|
// .snapshot('flat')
|
|
130
143
|
.use(features.hiddenColumns({
|
|
131
144
|
columns,
|
|
132
|
-
visibleKeys
|
|
145
|
+
visibleKeys: visibleKeys ?? columnVisibility
|
|
146
|
+
// visibleKeys: ['name']
|
|
147
|
+
// visibleKeys
|
|
133
148
|
})).use(features.treeSelect({
|
|
134
149
|
tree: mergedData,
|
|
135
150
|
value: selectionSettings?.selectedRowKeys,
|
|
@@ -179,6 +194,7 @@ const InternalTable = props => {
|
|
|
179
194
|
disableUserSelectWhenResizing: true,
|
|
180
195
|
allowFiltering,
|
|
181
196
|
allowSortering,
|
|
197
|
+
allowResizing,
|
|
182
198
|
tableLocal,
|
|
183
199
|
locale,
|
|
184
200
|
prefix,
|
|
@@ -179,7 +179,9 @@ export default function TableHeader({
|
|
|
179
179
|
const leftFlatCount = flat.left.length;
|
|
180
180
|
const rightFlatCount = flat.right.length;
|
|
181
181
|
const thead = headerRenderInfo.leveled.map((wrappedCols, level) => {
|
|
182
|
-
const headerCells =
|
|
182
|
+
const headerCells = [];
|
|
183
|
+
let currentColIndex = 0;
|
|
184
|
+
for (const wrapped of wrappedCols) {
|
|
183
185
|
if (wrapped.type === 'normal') {
|
|
184
186
|
const {
|
|
185
187
|
colIndex,
|
|
@@ -187,42 +189,43 @@ export default function TableHeader({
|
|
|
187
189
|
isLeaf,
|
|
188
190
|
col
|
|
189
191
|
} = wrapped;
|
|
192
|
+
if (currentColIndex > colIndex) continue;
|
|
190
193
|
const headerCellProps = col.headerCellProps ?? {};
|
|
194
|
+
const actualColSpan = headerCellProps.colSpan ?? colSpan;
|
|
191
195
|
const positionStyle = {};
|
|
192
196
|
if (colIndex < leftFlatCount) {
|
|
193
197
|
positionStyle.position = 'sticky';
|
|
194
198
|
positionStyle.left = stickyLeftMap.get(colIndex);
|
|
195
199
|
} else if (colIndex >= fullFlatCount - rightFlatCount) {
|
|
196
200
|
positionStyle.position = 'sticky';
|
|
197
|
-
positionStyle.right = stickyRightMap.get(colIndex +
|
|
201
|
+
positionStyle.right = stickyRightMap.get(colIndex + actualColSpan - 1);
|
|
198
202
|
}
|
|
199
|
-
|
|
203
|
+
headerCells.push( /*#__PURE__*/React.createElement("th", _extends({
|
|
200
204
|
key: colIndex
|
|
201
205
|
}, headerCellProps, {
|
|
202
206
|
className: cx(Classes.tableHeaderCell, headerCellProps.className, {
|
|
203
207
|
first: colIndex === 0,
|
|
204
|
-
last: colIndex +
|
|
208
|
+
last: colIndex + actualColSpan === fullFlatCount,
|
|
205
209
|
'lock-left': colIndex < leftFlatCount,
|
|
206
210
|
'lock-right': colIndex >= fullFlatCount - rightFlatCount
|
|
207
211
|
}),
|
|
208
|
-
colSpan:
|
|
212
|
+
colSpan: actualColSpan,
|
|
209
213
|
rowSpan: isLeaf ? rowCount - level : undefined,
|
|
210
214
|
style: {
|
|
211
215
|
textAlign: col.textAlign,
|
|
212
216
|
...headerCellProps.style,
|
|
213
217
|
...positionStyle
|
|
214
218
|
}
|
|
215
|
-
}), col.title ?? col.headerText);
|
|
219
|
+
}), col.title ?? col.headerText));
|
|
220
|
+
currentColIndex = colIndex + actualColSpan;
|
|
216
221
|
} else {
|
|
217
222
|
if (wrapped.width > 0) {
|
|
218
|
-
|
|
223
|
+
headerCells.push( /*#__PURE__*/React.createElement("th", {
|
|
219
224
|
key: wrapped.blankSide
|
|
220
|
-
});
|
|
221
|
-
} else {
|
|
222
|
-
return null;
|
|
225
|
+
}));
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
|
-
}
|
|
228
|
+
}
|
|
226
229
|
return /*#__PURE__*/React.createElement("tr", {
|
|
227
230
|
key: level,
|
|
228
231
|
className: cx(Classes.tableHeaderRow, {
|
|
@@ -60,7 +60,7 @@ export type BaseTableProps = {
|
|
|
60
60
|
/** Custom inline styles */
|
|
61
61
|
style?: CSSProperties & BaseTableCSSVariables;
|
|
62
62
|
/** Whether the table has a header */
|
|
63
|
-
|
|
63
|
+
showHeader?: boolean;
|
|
64
64
|
/** Whether table has a horizontal sticky scrollbar */
|
|
65
65
|
hasStickyScroll?: boolean;
|
|
66
66
|
/** Height of the sticky horizontal scrollbar */
|
|
@@ -128,7 +128,7 @@ interface BaseTableState {
|
|
|
128
128
|
}
|
|
129
129
|
export declare class BaseTable extends React.Component<BaseTableProps, BaseTableState> {
|
|
130
130
|
static defaultProps: {
|
|
131
|
-
|
|
131
|
+
showHeader: boolean;
|
|
132
132
|
isStickyHeader: boolean;
|
|
133
133
|
stickyTop: number;
|
|
134
134
|
footerDataSource: any[];
|
|
@@ -21,7 +21,7 @@ function warnEmptyContentIsDeprecated() {
|
|
|
21
21
|
}
|
|
22
22
|
export class BaseTable extends React.Component {
|
|
23
23
|
static defaultProps = {
|
|
24
|
-
|
|
24
|
+
showHeader: true,
|
|
25
25
|
isStickyHeader: true,
|
|
26
26
|
stickyTop: 0,
|
|
27
27
|
footerDataSource: [],
|
|
@@ -106,13 +106,13 @@ export class BaseTable extends React.Component {
|
|
|
106
106
|
renderTableHeader(info) {
|
|
107
107
|
const {
|
|
108
108
|
stickyTop,
|
|
109
|
-
|
|
109
|
+
showHeader
|
|
110
110
|
} = this.props;
|
|
111
111
|
return /*#__PURE__*/React.createElement("div", {
|
|
112
112
|
className: cx(Classes.tableHeader, 'no-scrollbar'),
|
|
113
113
|
style: {
|
|
114
114
|
top: stickyTop === 0 ? undefined : stickyTop,
|
|
115
|
-
display:
|
|
115
|
+
display: showHeader ? undefined : 'none'
|
|
116
116
|
}
|
|
117
117
|
}, /*#__PURE__*/React.createElement(TableHeader, {
|
|
118
118
|
info: info
|
|
@@ -334,7 +334,7 @@ export class BaseTable extends React.Component {
|
|
|
334
334
|
dataSource,
|
|
335
335
|
className,
|
|
336
336
|
style,
|
|
337
|
-
|
|
337
|
+
showHeader,
|
|
338
338
|
useOuterBorder,
|
|
339
339
|
// isStickyHead,
|
|
340
340
|
isStickyHeader,
|
|
@@ -347,7 +347,7 @@ export class BaseTable extends React.Component {
|
|
|
347
347
|
'use-outer-border': useOuterBorder,
|
|
348
348
|
empty: dataSource.length === 0,
|
|
349
349
|
lock: info.hasLockColumn,
|
|
350
|
-
'has-header':
|
|
350
|
+
'has-header': showHeader,
|
|
351
351
|
'sticky-header': isStickyHeader,
|
|
352
352
|
'has-footer': footerDataSource && footerDataSource.length > 0,
|
|
353
353
|
'sticky-footer': isStickyFooter
|
|
@@ -28,6 +28,7 @@ export function columnCustom(opts) {
|
|
|
28
28
|
const maxSize = opts.maxSize ?? 1000;
|
|
29
29
|
const allowFiltering = opts.allowFiltering !== false;
|
|
30
30
|
const allowSortering = opts.allowSortering !== false;
|
|
31
|
+
const allowResizing = opts.allowResizing !== false;
|
|
31
32
|
const {
|
|
32
33
|
prefix,
|
|
33
34
|
id,
|
|
@@ -396,7 +397,7 @@ export function columnCustom(opts) {
|
|
|
396
397
|
...col,
|
|
397
398
|
lock: !!col.fixed,
|
|
398
399
|
width: sizes[startIndex],
|
|
399
|
-
title: /*#__PURE__*/React.createElement(React.Fragment, null, col.headerTemplate ? /*#__PURE__*/React.createElement(React.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/React.createElement(React.Fragment, null, prevTitle), /*#__PURE__*/React.createElement(Resizer, {
|
|
400
|
+
title: /*#__PURE__*/React.createElement(React.Fragment, null, col.headerTemplate ? /*#__PURE__*/React.createElement(React.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/React.createElement(React.Fragment, null, prevTitle), allowResizing && /*#__PURE__*/React.createElement(Resizer, {
|
|
400
401
|
width: col.width,
|
|
401
402
|
columnKey: col.field,
|
|
402
403
|
columnIndex: startIndex
|
|
@@ -436,7 +437,7 @@ export function columnCustom(opts) {
|
|
|
436
437
|
...col,
|
|
437
438
|
lock: !!col.fixed,
|
|
438
439
|
width: sizes[startIndex],
|
|
439
|
-
title: /*#__PURE__*/React.createElement(React.Fragment, null, col.headerTemplate ? /*#__PURE__*/React.createElement(React.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/React.createElement(React.Fragment, null, prevTitle), /*#__PURE__*/React.createElement(Resizer, {
|
|
440
|
+
title: /*#__PURE__*/React.createElement(React.Fragment, null, col.headerTemplate ? /*#__PURE__*/React.createElement(React.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/React.createElement(React.Fragment, null, prevTitle), allowResizing && /*#__PURE__*/React.createElement(Resizer, {
|
|
440
441
|
width: col.width,
|
|
441
442
|
columnKey: col.field,
|
|
442
443
|
columnIndex: startIndex
|
|
@@ -517,7 +518,7 @@ export function columnCustom(opts) {
|
|
|
517
518
|
className: classNames(`ui-rc-table-column-sorter-cancel toolbar-icon`, {
|
|
518
519
|
active: true
|
|
519
520
|
})
|
|
520
|
-
})), canFilter && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Dropdown, mergedDropdownProps)))), /*#__PURE__*/React.createElement(Resizer, {
|
|
521
|
+
})), canFilter && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Dropdown, mergedDropdownProps)))), allowResizing && /*#__PURE__*/React.createElement(Resizer, {
|
|
521
522
|
width: col.width,
|
|
522
523
|
columnKey: col.field,
|
|
523
524
|
columnIndex: startIndex
|
|
@@ -233,6 +233,7 @@ export type TableProps<RecordType = AnyObject> = {
|
|
|
233
233
|
color?: string;
|
|
234
234
|
};
|
|
235
235
|
useOuterBorder?: boolean;
|
|
236
|
+
showHeader?: boolean;
|
|
236
237
|
className?: string;
|
|
237
238
|
title?: ReactNode | ((data: RecordType) => ReactNode);
|
|
238
239
|
fullScreenTitle?: ReactNode | (() => ReactNode);
|
|
@@ -11,6 +11,7 @@ const TableWrapper = props => {
|
|
|
11
11
|
const {
|
|
12
12
|
id,
|
|
13
13
|
prefix,
|
|
14
|
+
showHeader = true,
|
|
14
15
|
tableContainerRef,
|
|
15
16
|
height,
|
|
16
17
|
minHeight,
|
|
@@ -209,7 +210,7 @@ const TableWrapper = props => {
|
|
|
209
210
|
display: 'grid',
|
|
210
211
|
minWidth: table.getTotalSize()
|
|
211
212
|
}
|
|
212
|
-
}, /*#__PURE__*/React.createElement(TableHead, {
|
|
213
|
+
}, showHeader && /*#__PURE__*/React.createElement(TableHead, {
|
|
213
214
|
tableContainerRef: tableContainerRef,
|
|
214
215
|
table: table,
|
|
215
216
|
columnVirtualizer: columnVirtualizer,
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import React, { useContext } from "react";
|
|
3
3
|
import { DatePicker, TimePicker } from "rc-master-ui";
|
|
4
4
|
import { Divider, Row, Col, Input, ColorPicker, Button } from "antd";
|
|
5
|
-
import { checkDecimalSeparator, checkThousandSeparator, checkFieldKey, convertArrayWithIndent, convertDateToDayjs, convertLabelToTitle, getDatepickerFormat, isDisable, isEmpty, isNullOrUndefined, customWeekStartEndFormat, convertDayjsToDate, parseBooleanToValue, isColor, genPresets, getFormat } from "../hook/utils";
|
|
5
|
+
import { checkDecimalSeparator, checkThousandSeparator, checkFieldKey, convertArrayWithIndent, convertDateToDayjs, convertLabelToTitle, getDatepickerFormat, isDisable, isEmpty, isNullOrUndefined, customWeekStartEndFormat, convertDayjsToDate, parseBooleanToValue, isColor, genPresets, getFormat, removeVietnameseTones } from "../hook/utils";
|
|
6
6
|
import classNames from "classnames";
|
|
7
7
|
import { NumericFormat } from "react-numeric-component";
|
|
8
8
|
import dayjs from "dayjs";
|
|
@@ -79,6 +79,7 @@ const EditableCell = props => {
|
|
|
79
79
|
fieldNames,
|
|
80
80
|
toolbarItems,
|
|
81
81
|
filterOption,
|
|
82
|
+
filterKey,
|
|
82
83
|
inputKey,
|
|
83
84
|
toolbarClick,
|
|
84
85
|
loadOptions,
|
|
@@ -416,7 +417,14 @@ const EditableCell = props => {
|
|
|
416
417
|
return /*#__PURE__*/React.createElement(React.Fragment, null, " ", menu);
|
|
417
418
|
}
|
|
418
419
|
},
|
|
419
|
-
filterOption:
|
|
420
|
+
filterOption: filterKey ? (input, option) => {
|
|
421
|
+
const searchValue = removeVietnameseTones(input.toLowerCase() ?? '');
|
|
422
|
+
const filterValues = filterKey.some(k => {
|
|
423
|
+
const val = option?.[k];
|
|
424
|
+
return removeVietnameseTones((val ?? '').toString().toLowerCase()).includes(searchValue);
|
|
425
|
+
});
|
|
426
|
+
return filterValues;
|
|
427
|
+
} : filterOption,
|
|
420
428
|
fieldNames: fieldNames ? fieldNames : {
|
|
421
429
|
value: keySelect,
|
|
422
430
|
label: inputKey ?? 'label'
|
|
@@ -517,13 +525,21 @@ const EditableCell = props => {
|
|
|
517
525
|
placeholder: t && column.placeholder ? t(column.placeholder) : tableLocal?.selectPlaceholder,
|
|
518
526
|
allowClear: column.isClearable ?? false,
|
|
519
527
|
maxTagCount: 'responsive',
|
|
520
|
-
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined
|
|
521
|
-
optionFilterProp
|
|
528
|
+
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined
|
|
529
|
+
// optionFilterProp="label"
|
|
530
|
+
,
|
|
522
531
|
popupClassName: 'be-popup-container',
|
|
523
532
|
status: isInvalid ? 'error' : undefined,
|
|
524
|
-
filterOption:
|
|
533
|
+
filterOption: filterKey ? (input, option) => {
|
|
534
|
+
const searchValue = removeVietnameseTones(input.toLowerCase() ?? '');
|
|
535
|
+
const filterValues = filterKey.some(k => {
|
|
536
|
+
const val = option?.[k];
|
|
537
|
+
return removeVietnameseTones((val ?? '').toString().toLowerCase()).includes(searchValue);
|
|
538
|
+
});
|
|
539
|
+
return filterValues;
|
|
540
|
+
} : filterOption,
|
|
525
541
|
optionRender: column.editSelectSettings?.formatOptionLabel,
|
|
526
|
-
fieldNames:
|
|
542
|
+
fieldNames: {
|
|
527
543
|
value: keySelect,
|
|
528
544
|
label: inputKey ?? 'label'
|
|
529
545
|
},
|
|
@@ -648,8 +664,9 @@ const EditableCell = props => {
|
|
|
648
664
|
placeholder: t && column.placeholder ? t(column.placeholder) : tableLocal?.selectPlaceholder,
|
|
649
665
|
allowClear: column.isClearable ?? false,
|
|
650
666
|
maxTagCount: 'responsive',
|
|
651
|
-
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined
|
|
652
|
-
optionFilterProp
|
|
667
|
+
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined
|
|
668
|
+
// optionFilterProp="label"
|
|
669
|
+
,
|
|
653
670
|
popupClassName: 'be-popup-container',
|
|
654
671
|
loadOptions: loadOptions,
|
|
655
672
|
status: isInvalid ? 'error' : undefined,
|
|
@@ -678,7 +695,14 @@ const EditableCell = props => {
|
|
|
678
695
|
}
|
|
679
696
|
},
|
|
680
697
|
optionRender: column.editSelectSettings?.formatOptionLabel,
|
|
681
|
-
filterOption:
|
|
698
|
+
filterOption: filterKey ? (input, option) => {
|
|
699
|
+
const searchValue = removeVietnameseTones(input.toLowerCase() ?? '');
|
|
700
|
+
const filterValues = filterKey.some(k => {
|
|
701
|
+
const val = option?.[k];
|
|
702
|
+
return removeVietnameseTones((val ?? '').toString().toLowerCase()).includes(searchValue);
|
|
703
|
+
});
|
|
704
|
+
return filterValues;
|
|
705
|
+
} : filterOption,
|
|
682
706
|
fieldNames: fieldNames ? fieldNames : {
|
|
683
707
|
value: keySelect,
|
|
684
708
|
label: inputKey ?? 'label'
|
|
@@ -128,6 +128,7 @@ export declare function getHiddenParentKeys(columns: any[], parentKeys?: string[
|
|
|
128
128
|
export declare function getHiddenParentKeys1(columns: ColumnTable[], parentKeys?: string[]): string[];
|
|
129
129
|
export declare const getVisibleColumnKeys: (columns: any[]) => string[];
|
|
130
130
|
export declare const getVisibleColumnKeys1: (columns: any[]) => string[];
|
|
131
|
+
export declare function getVisibleFields(columns: ColumnTable[]): string[];
|
|
131
132
|
export declare function isObjEqual(obj1: any, obj2: any): boolean;
|
|
132
133
|
export declare const sortByType: <T>(arr: ColumnTable<T>[]) => ColumnTable<T>[];
|
|
133
134
|
export declare function convertColumnsToTreeData<T>(columns: ColumnDef<T, any>[], groupColumns?: string[]): TreeDataNode[];
|
|
@@ -1953,6 +1953,24 @@ export const getVisibleColumnKeys1 = columns => {
|
|
|
1953
1953
|
const allParentKeys = getHiddenParentKeys1(columns);
|
|
1954
1954
|
return allKeys.filter(item => !allParentKeys.includes(item));
|
|
1955
1955
|
};
|
|
1956
|
+
export function getVisibleFields(columns) {
|
|
1957
|
+
const result = [];
|
|
1958
|
+
function traverse(nodes) {
|
|
1959
|
+
for (const node of nodes) {
|
|
1960
|
+
// nếu visible không phải false thì lấy field
|
|
1961
|
+
if (node.visible !== false) {
|
|
1962
|
+
result.push(node.field);
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
// nếu có children thì duyệt tiếp
|
|
1966
|
+
if (node.children?.length) {
|
|
1967
|
+
traverse(node.children);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
traverse(columns);
|
|
1972
|
+
return result;
|
|
1973
|
+
}
|
|
1956
1974
|
export function isObjEqual(obj1, obj2) {
|
|
1957
1975
|
// Trường hợp tham chiếu bằng nhau
|
|
1958
1976
|
if (obj1 === obj2) return true;
|
|
@@ -13,6 +13,7 @@ const TableWrapper = props => {
|
|
|
13
13
|
id,
|
|
14
14
|
prefix,
|
|
15
15
|
tableContainerRef,
|
|
16
|
+
showHeader = true,
|
|
16
17
|
height,
|
|
17
18
|
minHeight,
|
|
18
19
|
summary,
|
|
@@ -198,7 +199,7 @@ const TableWrapper = props => {
|
|
|
198
199
|
display: 'grid',
|
|
199
200
|
minWidth: table.getTotalSize()
|
|
200
201
|
}
|
|
201
|
-
}, /*#__PURE__*/React.createElement(TableHead, {
|
|
202
|
+
}, showHeader && /*#__PURE__*/React.createElement(TableHead, {
|
|
202
203
|
tableContainerRef: tableContainerRef,
|
|
203
204
|
table: table,
|
|
204
205
|
columnVirtualizer: columnVirtualizer,
|
package/lib/ali-table/Grid.js
CHANGED
|
@@ -63,7 +63,8 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
63
63
|
footerDataSource,
|
|
64
64
|
loading,
|
|
65
65
|
useVirtual,
|
|
66
|
-
useOuterBorder = true
|
|
66
|
+
useOuterBorder = true,
|
|
67
|
+
showHeader = true
|
|
67
68
|
|
|
68
69
|
// onRowFooterStyles,
|
|
69
70
|
// onRowHeaderStyles
|
|
@@ -228,6 +229,7 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
228
229
|
}, typeof title === 'function' ? title?.(dataSource) : title)), /*#__PURE__*/_react.default.createElement(_WebsiteBaseTable.WebsiteBaseTable, (0, _extends2.default)({
|
|
229
230
|
ref: ref,
|
|
230
231
|
id: id,
|
|
232
|
+
showHeader: showHeader,
|
|
231
233
|
commandClick: commandClick,
|
|
232
234
|
isLoading: loading,
|
|
233
235
|
useVirtual: useVirtual,
|
|
@@ -21,6 +21,8 @@ var _Grid = _interopRequireDefault(require("./Grid"));
|
|
|
21
21
|
var _selected = require("./utils/selected");
|
|
22
22
|
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); }
|
|
23
23
|
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; }
|
|
24
|
+
// import { getInvisibleColumns } from "../group-component/hook/utils"
|
|
25
|
+
|
|
24
26
|
const InternalTable = props => {
|
|
25
27
|
const {
|
|
26
28
|
t,
|
|
@@ -28,6 +30,7 @@ const InternalTable = props => {
|
|
|
28
30
|
dataSource,
|
|
29
31
|
allowFiltering,
|
|
30
32
|
allowSortering,
|
|
33
|
+
allowResizing,
|
|
31
34
|
groupAble,
|
|
32
35
|
groupColumns,
|
|
33
36
|
groupSetting,
|
|
@@ -128,6 +131,14 @@ const InternalTable = props => {
|
|
|
128
131
|
}
|
|
129
132
|
return undefined;
|
|
130
133
|
}, [defaultFilter]);
|
|
134
|
+
|
|
135
|
+
// const columnInVisibility = React.useMemo(() => {
|
|
136
|
+
// return getInvisibleColumns(columns)
|
|
137
|
+
// }, [columns])
|
|
138
|
+
|
|
139
|
+
const columnVisibility = _react.default.useMemo(() => {
|
|
140
|
+
return (0, _utils.getVisibleFields)(columns);
|
|
141
|
+
}, [columns]);
|
|
131
142
|
const pipeline = (0, _pipeline.useTablePipeline)({
|
|
132
143
|
components: fusion
|
|
133
144
|
}).input({
|
|
@@ -138,7 +149,9 @@ const InternalTable = props => {
|
|
|
138
149
|
// .snapshot('flat')
|
|
139
150
|
.use(_pipeline.features.hiddenColumns({
|
|
140
151
|
columns,
|
|
141
|
-
visibleKeys
|
|
152
|
+
visibleKeys: visibleKeys ?? columnVisibility
|
|
153
|
+
// visibleKeys: ['name']
|
|
154
|
+
// visibleKeys
|
|
142
155
|
})).use(_pipeline.features.treeSelect({
|
|
143
156
|
tree: mergedData,
|
|
144
157
|
value: selectionSettings?.selectedRowKeys,
|
|
@@ -188,6 +201,7 @@ const InternalTable = props => {
|
|
|
188
201
|
disableUserSelectWhenResizing: true,
|
|
189
202
|
allowFiltering,
|
|
190
203
|
allowSortering,
|
|
204
|
+
allowResizing,
|
|
191
205
|
tableLocal,
|
|
192
206
|
locale,
|
|
193
207
|
prefix,
|
|
@@ -186,7 +186,9 @@ function TableHeader({
|
|
|
186
186
|
const leftFlatCount = flat.left.length;
|
|
187
187
|
const rightFlatCount = flat.right.length;
|
|
188
188
|
const thead = headerRenderInfo.leveled.map((wrappedCols, level) => {
|
|
189
|
-
const headerCells =
|
|
189
|
+
const headerCells = [];
|
|
190
|
+
let currentColIndex = 0;
|
|
191
|
+
for (const wrapped of wrappedCols) {
|
|
190
192
|
if (wrapped.type === 'normal') {
|
|
191
193
|
const {
|
|
192
194
|
colIndex,
|
|
@@ -194,42 +196,43 @@ function TableHeader({
|
|
|
194
196
|
isLeaf,
|
|
195
197
|
col
|
|
196
198
|
} = wrapped;
|
|
199
|
+
if (currentColIndex > colIndex) continue;
|
|
197
200
|
const headerCellProps = col.headerCellProps ?? {};
|
|
201
|
+
const actualColSpan = headerCellProps.colSpan ?? colSpan;
|
|
198
202
|
const positionStyle = {};
|
|
199
203
|
if (colIndex < leftFlatCount) {
|
|
200
204
|
positionStyle.position = 'sticky';
|
|
201
205
|
positionStyle.left = stickyLeftMap.get(colIndex);
|
|
202
206
|
} else if (colIndex >= fullFlatCount - rightFlatCount) {
|
|
203
207
|
positionStyle.position = 'sticky';
|
|
204
|
-
positionStyle.right = stickyRightMap.get(colIndex +
|
|
208
|
+
positionStyle.right = stickyRightMap.get(colIndex + actualColSpan - 1);
|
|
205
209
|
}
|
|
206
|
-
|
|
210
|
+
headerCells.push( /*#__PURE__*/_react.default.createElement("th", (0, _extends2.default)({
|
|
207
211
|
key: colIndex
|
|
208
212
|
}, headerCellProps, {
|
|
209
213
|
className: (0, _classnames.default)(_styles.Classes.tableHeaderCell, headerCellProps.className, {
|
|
210
214
|
first: colIndex === 0,
|
|
211
|
-
last: colIndex +
|
|
215
|
+
last: colIndex + actualColSpan === fullFlatCount,
|
|
212
216
|
'lock-left': colIndex < leftFlatCount,
|
|
213
217
|
'lock-right': colIndex >= fullFlatCount - rightFlatCount
|
|
214
218
|
}),
|
|
215
|
-
colSpan:
|
|
219
|
+
colSpan: actualColSpan,
|
|
216
220
|
rowSpan: isLeaf ? rowCount - level : undefined,
|
|
217
221
|
style: {
|
|
218
222
|
textAlign: col.textAlign,
|
|
219
223
|
...headerCellProps.style,
|
|
220
224
|
...positionStyle
|
|
221
225
|
}
|
|
222
|
-
}), col.title ?? col.headerText);
|
|
226
|
+
}), col.title ?? col.headerText));
|
|
227
|
+
currentColIndex = colIndex + actualColSpan;
|
|
223
228
|
} else {
|
|
224
229
|
if (wrapped.width > 0) {
|
|
225
|
-
|
|
230
|
+
headerCells.push( /*#__PURE__*/_react.default.createElement("th", {
|
|
226
231
|
key: wrapped.blankSide
|
|
227
|
-
});
|
|
228
|
-
} else {
|
|
229
|
-
return null;
|
|
232
|
+
}));
|
|
230
233
|
}
|
|
231
234
|
}
|
|
232
|
-
}
|
|
235
|
+
}
|
|
233
236
|
return /*#__PURE__*/_react.default.createElement("tr", {
|
|
234
237
|
key: level,
|
|
235
238
|
className: (0, _classnames.default)(_styles.Classes.tableHeaderRow, {
|
|
@@ -60,7 +60,7 @@ export type BaseTableProps = {
|
|
|
60
60
|
/** Custom inline styles */
|
|
61
61
|
style?: CSSProperties & BaseTableCSSVariables;
|
|
62
62
|
/** Whether the table has a header */
|
|
63
|
-
|
|
63
|
+
showHeader?: boolean;
|
|
64
64
|
/** Whether table has a horizontal sticky scrollbar */
|
|
65
65
|
hasStickyScroll?: boolean;
|
|
66
66
|
/** Height of the sticky horizontal scrollbar */
|
|
@@ -128,7 +128,7 @@ interface BaseTableState {
|
|
|
128
128
|
}
|
|
129
129
|
export declare class BaseTable extends React.Component<BaseTableProps, BaseTableState> {
|
|
130
130
|
static defaultProps: {
|
|
131
|
-
|
|
131
|
+
showHeader: boolean;
|
|
132
132
|
isStickyHeader: boolean;
|
|
133
133
|
stickyTop: number;
|
|
134
134
|
footerDataSource: any[];
|
|
@@ -30,7 +30,7 @@ function warnEmptyContentIsDeprecated() {
|
|
|
30
30
|
}
|
|
31
31
|
class BaseTable extends _react.default.Component {
|
|
32
32
|
static defaultProps = {
|
|
33
|
-
|
|
33
|
+
showHeader: true,
|
|
34
34
|
isStickyHeader: true,
|
|
35
35
|
stickyTop: 0,
|
|
36
36
|
footerDataSource: [],
|
|
@@ -115,13 +115,13 @@ class BaseTable extends _react.default.Component {
|
|
|
115
115
|
renderTableHeader(info) {
|
|
116
116
|
const {
|
|
117
117
|
stickyTop,
|
|
118
|
-
|
|
118
|
+
showHeader
|
|
119
119
|
} = this.props;
|
|
120
120
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
121
121
|
className: (0, _classnames.default)(_styles.Classes.tableHeader, 'no-scrollbar'),
|
|
122
122
|
style: {
|
|
123
123
|
top: stickyTop === 0 ? undefined : stickyTop,
|
|
124
|
-
display:
|
|
124
|
+
display: showHeader ? undefined : 'none'
|
|
125
125
|
}
|
|
126
126
|
}, /*#__PURE__*/_react.default.createElement(_header.default, {
|
|
127
127
|
info: info
|
|
@@ -343,7 +343,7 @@ class BaseTable extends _react.default.Component {
|
|
|
343
343
|
dataSource,
|
|
344
344
|
className,
|
|
345
345
|
style,
|
|
346
|
-
|
|
346
|
+
showHeader,
|
|
347
347
|
useOuterBorder,
|
|
348
348
|
// isStickyHead,
|
|
349
349
|
isStickyHeader,
|
|
@@ -356,7 +356,7 @@ class BaseTable extends _react.default.Component {
|
|
|
356
356
|
'use-outer-border': useOuterBorder,
|
|
357
357
|
empty: dataSource.length === 0,
|
|
358
358
|
lock: info.hasLockColumn,
|
|
359
|
-
'has-header':
|
|
359
|
+
'has-header': showHeader,
|
|
360
360
|
'sticky-header': isStickyHeader,
|
|
361
361
|
'has-footer': footerDataSource && footerDataSource.length > 0,
|
|
362
362
|
'sticky-footer': isStickyFooter
|
|
@@ -35,6 +35,7 @@ function columnCustom(opts) {
|
|
|
35
35
|
const maxSize = opts.maxSize ?? 1000;
|
|
36
36
|
const allowFiltering = opts.allowFiltering !== false;
|
|
37
37
|
const allowSortering = opts.allowSortering !== false;
|
|
38
|
+
const allowResizing = opts.allowResizing !== false;
|
|
38
39
|
const {
|
|
39
40
|
prefix,
|
|
40
41
|
id,
|
|
@@ -403,7 +404,7 @@ function columnCustom(opts) {
|
|
|
403
404
|
...col,
|
|
404
405
|
lock: !!col.fixed,
|
|
405
406
|
width: sizes[startIndex],
|
|
406
|
-
title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, col.headerTemplate ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, prevTitle), /*#__PURE__*/_react.default.createElement(_ColumnResizer.default, {
|
|
407
|
+
title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, col.headerTemplate ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, prevTitle), allowResizing && /*#__PURE__*/_react.default.createElement(_ColumnResizer.default, {
|
|
407
408
|
width: col.width,
|
|
408
409
|
columnKey: col.field,
|
|
409
410
|
columnIndex: startIndex
|
|
@@ -443,7 +444,7 @@ function columnCustom(opts) {
|
|
|
443
444
|
...col,
|
|
444
445
|
lock: !!col.fixed,
|
|
445
446
|
width: sizes[startIndex],
|
|
446
|
-
title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, col.headerTemplate ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, prevTitle), /*#__PURE__*/_react.default.createElement(_ColumnResizer.default, {
|
|
447
|
+
title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, col.headerTemplate ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, prevTitle), allowResizing && /*#__PURE__*/_react.default.createElement(_ColumnResizer.default, {
|
|
447
448
|
width: col.width,
|
|
448
449
|
columnKey: col.field,
|
|
449
450
|
columnIndex: startIndex
|
|
@@ -524,7 +525,7 @@ function columnCustom(opts) {
|
|
|
524
525
|
className: (0, _classnames.default)(`ui-rc-table-column-sorter-cancel toolbar-icon`, {
|
|
525
526
|
active: true
|
|
526
527
|
})
|
|
527
|
-
})), canFilter && /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Dropdown, mergedDropdownProps)))), /*#__PURE__*/_react.default.createElement(_ColumnResizer.default, {
|
|
528
|
+
})), canFilter && /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Dropdown, mergedDropdownProps)))), allowResizing && /*#__PURE__*/_react.default.createElement(_ColumnResizer.default, {
|
|
528
529
|
width: col.width,
|
|
529
530
|
columnKey: col.field,
|
|
530
531
|
columnIndex: startIndex
|
|
@@ -233,6 +233,7 @@ export type TableProps<RecordType = AnyObject> = {
|
|
|
233
233
|
color?: string;
|
|
234
234
|
};
|
|
235
235
|
useOuterBorder?: boolean;
|
|
236
|
+
showHeader?: boolean;
|
|
236
237
|
className?: string;
|
|
237
238
|
title?: ReactNode | ((data: RecordType) => ReactNode);
|
|
238
239
|
fullScreenTitle?: ReactNode | (() => ReactNode);
|
|
@@ -20,6 +20,7 @@ const TableWrapper = props => {
|
|
|
20
20
|
const {
|
|
21
21
|
id,
|
|
22
22
|
prefix,
|
|
23
|
+
showHeader = true,
|
|
23
24
|
tableContainerRef,
|
|
24
25
|
height,
|
|
25
26
|
minHeight,
|
|
@@ -218,7 +219,7 @@ const TableWrapper = props => {
|
|
|
218
219
|
display: 'grid',
|
|
219
220
|
minWidth: table.getTotalSize()
|
|
220
221
|
}
|
|
221
|
-
}, /*#__PURE__*/_react.default.createElement(_TableHead.default, {
|
|
222
|
+
}, showHeader && /*#__PURE__*/_react.default.createElement(_TableHead.default, {
|
|
222
223
|
tableContainerRef: tableContainerRef,
|
|
223
224
|
table: table,
|
|
224
225
|
columnVirtualizer: columnVirtualizer,
|
|
@@ -87,6 +87,7 @@ const EditableCell = props => {
|
|
|
87
87
|
fieldNames,
|
|
88
88
|
toolbarItems,
|
|
89
89
|
filterOption,
|
|
90
|
+
filterKey,
|
|
90
91
|
inputKey,
|
|
91
92
|
toolbarClick,
|
|
92
93
|
loadOptions,
|
|
@@ -424,7 +425,14 @@ const EditableCell = props => {
|
|
|
424
425
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, " ", menu);
|
|
425
426
|
}
|
|
426
427
|
},
|
|
427
|
-
filterOption:
|
|
428
|
+
filterOption: filterKey ? (input, option) => {
|
|
429
|
+
const searchValue = (0, _utils.removeVietnameseTones)(input.toLowerCase() ?? '');
|
|
430
|
+
const filterValues = filterKey.some(k => {
|
|
431
|
+
const val = option?.[k];
|
|
432
|
+
return (0, _utils.removeVietnameseTones)((val ?? '').toString().toLowerCase()).includes(searchValue);
|
|
433
|
+
});
|
|
434
|
+
return filterValues;
|
|
435
|
+
} : filterOption,
|
|
428
436
|
fieldNames: fieldNames ? fieldNames : {
|
|
429
437
|
value: keySelect,
|
|
430
438
|
label: inputKey ?? 'label'
|
|
@@ -525,13 +533,21 @@ const EditableCell = props => {
|
|
|
525
533
|
placeholder: t && column.placeholder ? t(column.placeholder) : tableLocal?.selectPlaceholder,
|
|
526
534
|
allowClear: column.isClearable ?? false,
|
|
527
535
|
maxTagCount: 'responsive',
|
|
528
|
-
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined
|
|
529
|
-
optionFilterProp
|
|
536
|
+
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined
|
|
537
|
+
// optionFilterProp="label"
|
|
538
|
+
,
|
|
530
539
|
popupClassName: 'be-popup-container',
|
|
531
540
|
status: isInvalid ? 'error' : undefined,
|
|
532
|
-
filterOption:
|
|
541
|
+
filterOption: filterKey ? (input, option) => {
|
|
542
|
+
const searchValue = (0, _utils.removeVietnameseTones)(input.toLowerCase() ?? '');
|
|
543
|
+
const filterValues = filterKey.some(k => {
|
|
544
|
+
const val = option?.[k];
|
|
545
|
+
return (0, _utils.removeVietnameseTones)((val ?? '').toString().toLowerCase()).includes(searchValue);
|
|
546
|
+
});
|
|
547
|
+
return filterValues;
|
|
548
|
+
} : filterOption,
|
|
533
549
|
optionRender: column.editSelectSettings?.formatOptionLabel,
|
|
534
|
-
fieldNames:
|
|
550
|
+
fieldNames: {
|
|
535
551
|
value: keySelect,
|
|
536
552
|
label: inputKey ?? 'label'
|
|
537
553
|
},
|
|
@@ -656,8 +672,9 @@ const EditableCell = props => {
|
|
|
656
672
|
placeholder: t && column.placeholder ? t(column.placeholder) : tableLocal?.selectPlaceholder,
|
|
657
673
|
allowClear: column.isClearable ?? false,
|
|
658
674
|
maxTagCount: 'responsive',
|
|
659
|
-
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined
|
|
660
|
-
optionFilterProp
|
|
675
|
+
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined
|
|
676
|
+
// optionFilterProp="label"
|
|
677
|
+
,
|
|
661
678
|
popupClassName: 'be-popup-container',
|
|
662
679
|
loadOptions: loadOptions,
|
|
663
680
|
status: isInvalid ? 'error' : undefined,
|
|
@@ -686,7 +703,14 @@ const EditableCell = props => {
|
|
|
686
703
|
}
|
|
687
704
|
},
|
|
688
705
|
optionRender: column.editSelectSettings?.formatOptionLabel,
|
|
689
|
-
filterOption:
|
|
706
|
+
filterOption: filterKey ? (input, option) => {
|
|
707
|
+
const searchValue = (0, _utils.removeVietnameseTones)(input.toLowerCase() ?? '');
|
|
708
|
+
const filterValues = filterKey.some(k => {
|
|
709
|
+
const val = option?.[k];
|
|
710
|
+
return (0, _utils.removeVietnameseTones)((val ?? '').toString().toLowerCase()).includes(searchValue);
|
|
711
|
+
});
|
|
712
|
+
return filterValues;
|
|
713
|
+
} : filterOption,
|
|
690
714
|
fieldNames: fieldNames ? fieldNames : {
|
|
691
715
|
value: keySelect,
|
|
692
716
|
label: inputKey ?? 'label'
|
|
@@ -128,6 +128,7 @@ export declare function getHiddenParentKeys(columns: any[], parentKeys?: string[
|
|
|
128
128
|
export declare function getHiddenParentKeys1(columns: ColumnTable[], parentKeys?: string[]): string[];
|
|
129
129
|
export declare const getVisibleColumnKeys: (columns: any[]) => string[];
|
|
130
130
|
export declare const getVisibleColumnKeys1: (columns: any[]) => string[];
|
|
131
|
+
export declare function getVisibleFields(columns: ColumnTable[]): string[];
|
|
131
132
|
export declare function isObjEqual(obj1: any, obj2: any): boolean;
|
|
132
133
|
export declare const sortByType: <T>(arr: ColumnTable<T>[]) => ColumnTable<T>[];
|
|
133
134
|
export declare function convertColumnsToTreeData<T>(columns: ColumnDef<T, any>[], groupColumns?: string[]): TreeDataNode[];
|
|
@@ -40,6 +40,7 @@ exports.getInvisibleColumns = getInvisibleColumns;
|
|
|
40
40
|
exports.getNewItemsOnly = exports.getLastSelectCell = void 0;
|
|
41
41
|
exports.getRowIdsBetween = getRowIdsBetween;
|
|
42
42
|
exports.getVisibleColumnKeys1 = exports.getVisibleColumnKeys = exports.getTypeFilter = exports.getTableHeight = exports.getSelectedCellMatrix = void 0;
|
|
43
|
+
exports.getVisibleFields = getVisibleFields;
|
|
43
44
|
exports.groupArrayByColumns = groupArrayByColumns;
|
|
44
45
|
exports.isColor = void 0;
|
|
45
46
|
exports.isDateString = isDateString;
|
|
@@ -62,8 +63,7 @@ exports.sumSize = void 0;
|
|
|
62
63
|
exports.toggleRowAndChildren = toggleRowAndChildren;
|
|
63
64
|
exports.updateArrayByKey = exports.unFlattenData = void 0;
|
|
64
65
|
exports.updateColumnWidthsRecursive = updateColumnWidthsRecursive;
|
|
65
|
-
exports.updateColumns1 = void 0;
|
|
66
|
-
exports.updateColumnsByGroup = void 0;
|
|
66
|
+
exports.updateColumnsByGroup = exports.updateColumns1 = void 0;
|
|
67
67
|
exports.updateOrInsert = updateOrInsert;
|
|
68
68
|
exports.updateWidthsByOther = updateWidthsByOther;
|
|
69
69
|
var _uuid = require("uuid");
|
|
@@ -2074,6 +2074,24 @@ const getVisibleColumnKeys1 = columns => {
|
|
|
2074
2074
|
return allKeys.filter(item => !allParentKeys.includes(item));
|
|
2075
2075
|
};
|
|
2076
2076
|
exports.getVisibleColumnKeys1 = getVisibleColumnKeys1;
|
|
2077
|
+
function getVisibleFields(columns) {
|
|
2078
|
+
const result = [];
|
|
2079
|
+
function traverse(nodes) {
|
|
2080
|
+
for (const node of nodes) {
|
|
2081
|
+
// nếu visible không phải false thì lấy field
|
|
2082
|
+
if (node.visible !== false) {
|
|
2083
|
+
result.push(node.field);
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
// nếu có children thì duyệt tiếp
|
|
2087
|
+
if (node.children?.length) {
|
|
2088
|
+
traverse(node.children);
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
traverse(columns);
|
|
2093
|
+
return result;
|
|
2094
|
+
}
|
|
2077
2095
|
function isObjEqual(obj1, obj2) {
|
|
2078
2096
|
// Trường hợp tham chiếu bằng nhau
|
|
2079
2097
|
if (obj1 === obj2) return true;
|
|
@@ -22,6 +22,7 @@ const TableWrapper = props => {
|
|
|
22
22
|
id,
|
|
23
23
|
prefix,
|
|
24
24
|
tableContainerRef,
|
|
25
|
+
showHeader = true,
|
|
25
26
|
height,
|
|
26
27
|
minHeight,
|
|
27
28
|
summary,
|
|
@@ -207,7 +208,7 @@ const TableWrapper = props => {
|
|
|
207
208
|
display: 'grid',
|
|
208
209
|
minWidth: table.getTotalSize()
|
|
209
210
|
}
|
|
210
|
-
}, /*#__PURE__*/_react.default.createElement(_TableHead.default, {
|
|
211
|
+
}, showHeader && /*#__PURE__*/_react.default.createElement(_TableHead.default, {
|
|
211
212
|
tableContainerRef: tableContainerRef,
|
|
212
213
|
table: table,
|
|
213
214
|
columnVirtualizer: columnVirtualizer,
|