es-grid-template 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid-component/AdvanceFilter.d.ts +11 -7
- package/es/grid-component/AdvanceFilter.js +419 -509
- package/es/grid-component/ColumnsChoose.js +2 -1
- package/es/grid-component/ContextMenu.js +2 -1
- package/es/grid-component/EditableCell.d.ts +2 -2
- package/es/grid-component/EditableCell.js +16 -11
- package/es/grid-component/InternalTable.js +128 -2
- package/es/grid-component/TableGrid.js +11 -2
- package/es/grid-component/checkbox-control/index.d.ts +13 -0
- package/es/grid-component/checkbox-control/index.js +40 -0
- package/es/grid-component/hooks/columns/index.d.ts +2 -2
- package/es/grid-component/hooks/columns/index.js +8 -2
- package/es/grid-component/hooks/useColumns.js +5 -2
- package/es/grid-component/hooks/utils.d.ts +6 -5
- package/es/grid-component/hooks/utils.js +8 -2
- package/es/grid-component/styles.scss +13 -3
- package/es/grid-component/table/GridEdit.js +36 -18
- package/es/grid-component/type.d.ts +26 -13
- package/lib/grid-component/AdvanceFilter.d.ts +11 -7
- package/lib/grid-component/AdvanceFilter.js +415 -506
- package/lib/grid-component/ColumnsChoose.js +2 -1
- package/lib/grid-component/ContextMenu.js +2 -1
- package/lib/grid-component/EditableCell.d.ts +2 -2
- package/lib/grid-component/EditableCell.js +16 -11
- package/lib/grid-component/InternalTable.js +127 -1
- package/lib/grid-component/TableGrid.js +11 -2
- package/lib/grid-component/checkbox-control/index.d.ts +13 -0
- package/lib/grid-component/checkbox-control/index.js +48 -0
- package/lib/grid-component/hooks/columns/index.d.ts +2 -2
- package/lib/grid-component/hooks/columns/index.js +8 -2
- package/lib/grid-component/hooks/useColumns.js +5 -2
- package/lib/grid-component/hooks/utils.d.ts +6 -5
- package/lib/grid-component/hooks/utils.js +11 -4
- package/lib/grid-component/styles.scss +13 -3
- package/lib/grid-component/table/GridEdit.js +36 -18
- package/lib/grid-component/type.d.ts +26 -13
- package/package.json +4 -2
|
@@ -536,7 +536,8 @@ export const ColumnsChoose = props => {
|
|
|
536
536
|
trigger: "click",
|
|
537
537
|
open: clicked,
|
|
538
538
|
onOpenChange: handleClickChange,
|
|
539
|
-
arrow: false
|
|
539
|
+
arrow: false,
|
|
540
|
+
zIndex: 1065
|
|
540
541
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
541
542
|
arrow: false,
|
|
542
543
|
title: 'Cài đặt'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ColumnTable, IFormat } from "./type";
|
|
3
3
|
import type { EditType } from "rc-master-ui";
|
|
4
4
|
interface EditableCellProps<DataType> extends React.HTMLAttributes<HTMLElement> {
|
|
5
5
|
t?: any;
|
|
@@ -10,7 +10,7 @@ interface EditableCellProps<DataType> extends React.HTMLAttributes<HTMLElement>
|
|
|
10
10
|
record: DataType;
|
|
11
11
|
index: number;
|
|
12
12
|
format?: IFormat;
|
|
13
|
-
column:
|
|
13
|
+
column: ColumnTable<DataType>;
|
|
14
14
|
indexRow: number;
|
|
15
15
|
indexCol: number;
|
|
16
16
|
rowKey: any;
|
|
@@ -267,15 +267,15 @@ const EditableCell = props => {
|
|
|
267
267
|
const columnsTable = rr.map(colSelect => {
|
|
268
268
|
return {
|
|
269
269
|
title: colSelect.headerTemplate ? colSelect.headerTemplate : t ? t(colSelect.headerText) : colSelect.headerText,
|
|
270
|
-
dataIndex: colSelect.dataIndex,
|
|
270
|
+
dataIndex: colSelect.field ?? colSelect.dataIndex,
|
|
271
271
|
key: colSelect.dataIndex,
|
|
272
272
|
render: colSelect.template ? (text, recd, ind) => /*#__PURE__*/React.createElement(React.Fragment, null, colSelect.template?.({
|
|
273
273
|
value: text,
|
|
274
274
|
rowData: recd,
|
|
275
275
|
column: colSelect,
|
|
276
|
-
field: colSelect.
|
|
276
|
+
field: colSelect.field,
|
|
277
277
|
index: ind,
|
|
278
|
-
[colSelect.
|
|
278
|
+
[colSelect.field]: text
|
|
279
279
|
})) : undefined,
|
|
280
280
|
width: colSelect.width,
|
|
281
281
|
ellipsis: true,
|
|
@@ -323,8 +323,9 @@ const EditableCell = props => {
|
|
|
323
323
|
width: '100%',
|
|
324
324
|
height: '100%'
|
|
325
325
|
},
|
|
326
|
-
defaultOpen: column.field === cellEditing?.column.field
|
|
327
|
-
autoFocus
|
|
326
|
+
defaultOpen: column.field === cellEditing?.column.field
|
|
327
|
+
// autoFocus={true}
|
|
328
|
+
,
|
|
328
329
|
placeholder: t ? t('Select') : 'Select',
|
|
329
330
|
allowClear: column.isClearable ?? false,
|
|
330
331
|
maxTagCount: 'responsive',
|
|
@@ -397,8 +398,10 @@ const EditableCell = props => {
|
|
|
397
398
|
showSearch: true,
|
|
398
399
|
mode: isMulti || selectMode === 'checkbox' ? 'multiple' : undefined,
|
|
399
400
|
valueSelectAble: true,
|
|
400
|
-
defaultOpen: column.field === cellEditing?.column.field
|
|
401
|
-
autoFocus
|
|
401
|
+
defaultOpen: column.field === cellEditing?.column.field
|
|
402
|
+
// autoFocus={true}
|
|
403
|
+
,
|
|
404
|
+
|
|
402
405
|
style: {
|
|
403
406
|
width: '100%',
|
|
404
407
|
height: '100%'
|
|
@@ -448,8 +451,9 @@ const EditableCell = props => {
|
|
|
448
451
|
});
|
|
449
452
|
},
|
|
450
453
|
showSearch: true,
|
|
451
|
-
defaultOpen: column.field === cellEditing?.column.field
|
|
452
|
-
autoFocus
|
|
454
|
+
defaultOpen: column.field === cellEditing?.column.field
|
|
455
|
+
// autoFocus={true}
|
|
456
|
+
,
|
|
453
457
|
mode: isMulti || selectMode === 'checkbox' ? 'multiple' : undefined,
|
|
454
458
|
valueSelectAble: true,
|
|
455
459
|
style: {
|
|
@@ -528,8 +532,9 @@ const EditableCell = props => {
|
|
|
528
532
|
treeData: newTreeData,
|
|
529
533
|
placeholder: t ? t('Select') : 'Select',
|
|
530
534
|
treeDefaultExpandAll: true,
|
|
531
|
-
defaultOpen: column.field === cellEditing?.column.field
|
|
532
|
-
autoFocus
|
|
535
|
+
defaultOpen: column.field === cellEditing?.column.field
|
|
536
|
+
// autoFocus={true}
|
|
537
|
+
,
|
|
533
538
|
virtual: true,
|
|
534
539
|
allowClear: true
|
|
535
540
|
// maxTagTextLength={column?.editSelectSettings?.showItems}
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { Resizable } from "react-resizable";
|
|
4
4
|
import 'react-resizable/css/styles.css';
|
|
5
5
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
6
|
-
import { addRowIdArray,
|
|
6
|
+
import { addRowIdArray, findItemByKey,
|
|
7
7
|
// convertFlatColumn,
|
|
8
8
|
removeColumns,
|
|
9
9
|
// addRowIdArray,
|
|
@@ -19,7 +19,10 @@ import useColumns from "./hooks/useColumns";
|
|
|
19
19
|
import "./styles.scss";
|
|
20
20
|
import { flatColumns2 } from "./hooks/columns";
|
|
21
21
|
import Group from "./table/Group";
|
|
22
|
+
import Swal from "sweetalert2";
|
|
23
|
+
import withReactContent from "sweetalert2-react-content";
|
|
22
24
|
dayjs.extend(customParseFormat);
|
|
25
|
+
const MySwal = withReactContent(Swal);
|
|
23
26
|
|
|
24
27
|
// const ASCEND = 'ascend';
|
|
25
28
|
// const DESCEND = 'descend';
|
|
@@ -77,6 +80,8 @@ const InternalTable = props => {
|
|
|
77
80
|
groupAble,
|
|
78
81
|
groupSetting,
|
|
79
82
|
groupColumns,
|
|
83
|
+
commandClick,
|
|
84
|
+
commandSettings,
|
|
80
85
|
...rest
|
|
81
86
|
} = props;
|
|
82
87
|
const rowKey = React.useMemo(() => {
|
|
@@ -202,6 +207,126 @@ const InternalTable = props => {
|
|
|
202
207
|
// setMergedData(newData)
|
|
203
208
|
onDataChange?.(newData);
|
|
204
209
|
};
|
|
210
|
+
const triggerCommandClick = args => {
|
|
211
|
+
const {
|
|
212
|
+
id,
|
|
213
|
+
rowId,
|
|
214
|
+
rowData,
|
|
215
|
+
index
|
|
216
|
+
} = args;
|
|
217
|
+
const tmpData = [...dataSource];
|
|
218
|
+
if (id === 'DELETE') {
|
|
219
|
+
// bật modal confirm
|
|
220
|
+
if (commandSettings && commandSettings.confirmDialog) {
|
|
221
|
+
MySwal.fire({
|
|
222
|
+
title: t ? t('Confirm') : 'Confirm',
|
|
223
|
+
text: t ? t('Do you want to delete item?') : 'Do you want to delete item?',
|
|
224
|
+
// icon: 'warning',
|
|
225
|
+
allowOutsideClick: false,
|
|
226
|
+
showCancelButton: true,
|
|
227
|
+
confirmButtonText: t ? t('Delete') : 'Delete',
|
|
228
|
+
cancelButtonText: t ? t('Cancel') : 'Cancel',
|
|
229
|
+
customClass: {
|
|
230
|
+
confirmButton: 'be-button btn-primary',
|
|
231
|
+
cancelButton: 'be-button btn-danger ms-1'
|
|
232
|
+
},
|
|
233
|
+
buttonsStyling: false
|
|
234
|
+
}).then(async result => {
|
|
235
|
+
if (result.value) {
|
|
236
|
+
if (!commandSettings || commandSettings && commandSettings.client !== false) {
|
|
237
|
+
// client
|
|
238
|
+
|
|
239
|
+
// kiểm tra dòng hiện tại có parent
|
|
240
|
+
|
|
241
|
+
let newData = [];
|
|
242
|
+
if (rowData?.parentId) {
|
|
243
|
+
const parent = findItemByKey(dataSource, rowKey, rowData.parentId);
|
|
244
|
+
const childData = parent?.children ? [...parent.children] : [];
|
|
245
|
+
const findIndex = childData.findIndex(obj => obj[rowKey] === rowData[rowKey]);
|
|
246
|
+
childData.splice(Number(findIndex), 1);
|
|
247
|
+
const newRowData = {
|
|
248
|
+
...parent,
|
|
249
|
+
children: childData
|
|
250
|
+
};
|
|
251
|
+
// const newDataSource = updateArrayByKey(tmpData, newRowData, rowKey as string)
|
|
252
|
+
newData = updateArrayByKey(tmpData, newRowData, rowKey);
|
|
253
|
+
} else {
|
|
254
|
+
tmpData.splice(Number(index), 1);
|
|
255
|
+
newData = [...tmpData];
|
|
256
|
+
}
|
|
257
|
+
if (commandClick) {
|
|
258
|
+
commandClick({
|
|
259
|
+
id,
|
|
260
|
+
rowId: rowData.rowId,
|
|
261
|
+
rowData,
|
|
262
|
+
index,
|
|
263
|
+
// rows: [...tmpData]
|
|
264
|
+
rows: [...newData]
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
} else {
|
|
268
|
+
// server ~~ không làm gì
|
|
269
|
+
if (commandClick) {
|
|
270
|
+
commandClick({
|
|
271
|
+
id,
|
|
272
|
+
rowId: rowData.rowId,
|
|
273
|
+
rowData,
|
|
274
|
+
index,
|
|
275
|
+
rows: [...dataSource]
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
} else if (result.dismiss === MySwal.DismissReason.cancel) {}
|
|
280
|
+
});
|
|
281
|
+
} else {
|
|
282
|
+
// -------------------
|
|
283
|
+
|
|
284
|
+
if (!commandSettings || commandSettings && commandSettings.client !== false) {
|
|
285
|
+
// client
|
|
286
|
+
|
|
287
|
+
let newData2 = [];
|
|
288
|
+
if (rowData?.parentId) {
|
|
289
|
+
const parent = findItemByKey(dataSource, rowKey, rowData.parentId);
|
|
290
|
+
const childData = parent?.children ? [...parent.children] : [];
|
|
291
|
+
const findIndex = childData.findIndex(obj => obj[rowKey] === rowData[rowKey]);
|
|
292
|
+
childData.splice(Number(findIndex), 1);
|
|
293
|
+
const newRowData = {
|
|
294
|
+
...parent,
|
|
295
|
+
children: childData
|
|
296
|
+
};
|
|
297
|
+
newData2 = updateArrayByKey(tmpData, newRowData, rowKey);
|
|
298
|
+
} else {
|
|
299
|
+
tmpData.splice(Number(index), 1);
|
|
300
|
+
newData2 = [...tmpData];
|
|
301
|
+
}
|
|
302
|
+
if (commandClick) {
|
|
303
|
+
commandClick({
|
|
304
|
+
id,
|
|
305
|
+
rowId,
|
|
306
|
+
rowData,
|
|
307
|
+
index,
|
|
308
|
+
rows: [...newData2]
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
} else {
|
|
312
|
+
// server
|
|
313
|
+
if (commandClick) {
|
|
314
|
+
commandClick({
|
|
315
|
+
id,
|
|
316
|
+
rowId,
|
|
317
|
+
rowData,
|
|
318
|
+
index,
|
|
319
|
+
rows: [...dataSource]
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
if (commandClick) {
|
|
326
|
+
commandClick(args);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
};
|
|
205
330
|
const triggerPaste = (pastedRows, pastedColumnsArray, newData) => {
|
|
206
331
|
const handlePasteCallback = callbackData => {
|
|
207
332
|
const newDataUpdate = updateData(dataSource, callbackData, rowKey);
|
|
@@ -257,7 +382,8 @@ const InternalTable = props => {
|
|
|
257
382
|
clickHeaderToSort: clickHeaderToSort,
|
|
258
383
|
groupSetting: groupSetting,
|
|
259
384
|
groupAble: groupAble,
|
|
260
|
-
groupColumns: groupColumns
|
|
385
|
+
groupColumns: groupColumns,
|
|
386
|
+
commandClick: triggerCommandClick
|
|
261
387
|
}));
|
|
262
388
|
};
|
|
263
389
|
export default InternalTable;
|
|
@@ -20,6 +20,7 @@ import Pagination from "rc-master-ui/es/pagination";
|
|
|
20
20
|
import ComponentSpinner from "./LoadingSpinner";
|
|
21
21
|
import { ColumnsChoose } from "./ColumnsChoose";
|
|
22
22
|
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
23
|
+
import AdvanceFilter from "./AdvanceFilter";
|
|
23
24
|
const convertFilters = filters => {
|
|
24
25
|
const result = [];
|
|
25
26
|
filters.forEach(({
|
|
@@ -108,6 +109,7 @@ const TableGrid = props => {
|
|
|
108
109
|
recordDoubleClick,
|
|
109
110
|
toolbarItems,
|
|
110
111
|
showColumnChoose,
|
|
112
|
+
showAdvanceFilter,
|
|
111
113
|
onFilter,
|
|
112
114
|
selectionSettings,
|
|
113
115
|
rowSelection,
|
|
@@ -399,7 +401,8 @@ const TableGrid = props => {
|
|
|
399
401
|
style: {
|
|
400
402
|
display: 'flex',
|
|
401
403
|
justifyContent: 'space-between',
|
|
402
|
-
alignItems: 'center'
|
|
404
|
+
alignItems: 'center',
|
|
405
|
+
gap: '.75rem'
|
|
403
406
|
}
|
|
404
407
|
}, groupAble && groupToolbar?.(), toolbarItems && toolbarItems?.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
405
408
|
style: {
|
|
@@ -416,7 +419,8 @@ const TableGrid = props => {
|
|
|
416
419
|
style: {
|
|
417
420
|
display: 'flex',
|
|
418
421
|
justifyContent: 'space-between',
|
|
419
|
-
alignItems: 'center'
|
|
422
|
+
alignItems: 'center',
|
|
423
|
+
gap: '.75rem'
|
|
420
424
|
}
|
|
421
425
|
}, pagination && pagination.onChange && pagination?.position && pagination?.position[0] === 'topRight' && /*#__PURE__*/React.createElement(Pagination, _extends({
|
|
422
426
|
showSizeChanger: true,
|
|
@@ -431,6 +435,11 @@ const TableGrid = props => {
|
|
|
431
435
|
t: t,
|
|
432
436
|
columnsGroup: groupColumns,
|
|
433
437
|
triggerChangeColumns: triggerChangeColumns
|
|
438
|
+
}), showAdvanceFilter && /*#__PURE__*/React.createElement(AdvanceFilter, {
|
|
439
|
+
columns: columns,
|
|
440
|
+
t: t
|
|
441
|
+
// columnsGroup={groupColumns}
|
|
442
|
+
// triggerChangeColumns={triggerChangeColumns}
|
|
434
443
|
}))));
|
|
435
444
|
},
|
|
436
445
|
expandable: {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type OptionType = {
|
|
3
|
+
value: any;
|
|
4
|
+
label: string;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
type Props<T> = {
|
|
8
|
+
options: T[];
|
|
9
|
+
value: any[];
|
|
10
|
+
onChange?: (value: any[]) => void;
|
|
11
|
+
};
|
|
12
|
+
declare const CheckboxControl: <T extends OptionType>(props: Props<T>) => React.JSX.Element;
|
|
13
|
+
export default CheckboxControl;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { Checkbox } from "rc-master-ui";
|
|
3
|
+
const CheckboxControl = props => {
|
|
4
|
+
const {
|
|
5
|
+
options,
|
|
6
|
+
value,
|
|
7
|
+
onChange
|
|
8
|
+
} = props;
|
|
9
|
+
const selected = useMemo(() => {
|
|
10
|
+
return value ? value : [];
|
|
11
|
+
}, [value]);
|
|
12
|
+
const list = useMemo(() => {
|
|
13
|
+
return options ? options : [];
|
|
14
|
+
}, [options]);
|
|
15
|
+
const onChangeValue = val => {
|
|
16
|
+
const findIndex = selected.findIndex(it => it === val);
|
|
17
|
+
if (findIndex > -1) {
|
|
18
|
+
const newVal = selected.filter(it => it !== val);
|
|
19
|
+
onChange?.(newVal);
|
|
20
|
+
} else {
|
|
21
|
+
const newVal = [...selected, val];
|
|
22
|
+
onChange?.(newVal);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: "d-flex flex-column gap-50",
|
|
27
|
+
style: {}
|
|
28
|
+
}, list.map((it, index) => {
|
|
29
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
key: index,
|
|
31
|
+
className: "d-flex align-items-center"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
33
|
+
checked: selected.includes(it.value),
|
|
34
|
+
type: "checkbox",
|
|
35
|
+
className: "cursor-pointer me-50",
|
|
36
|
+
onChange: () => onChangeValue(it.value)
|
|
37
|
+
}), /*#__PURE__*/React.createElement("span", null, it.label));
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
export default CheckboxControl;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ColumnType, IFormat } from "../../type";
|
|
1
|
+
import type { ColumnTable, ColumnType, IFormat } from "../../type";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { TableLocale } from "rc-master-ui/lib/table/interface";
|
|
4
4
|
import type { ColumnsTable } from "../../type";
|
|
5
5
|
export declare function flatColumns<RecordType>(columns: ColumnsTable<RecordType>, parentKey?: string): ColumnsTable<RecordType>;
|
|
6
6
|
export declare function flatColumns2<RecordType>(columns: ColumnsTable<RecordType>): ColumnsTable<RecordType>;
|
|
7
7
|
export declare const getValueCell: <T>(column: ColumnType<T>, value: any, format?: IFormat) => any;
|
|
8
|
-
export declare const renderContent: (column:
|
|
8
|
+
export declare const renderContent: (column: ColumnTable, value: any, record: any, index: number, format?: IFormat) => React.JSX.Element;
|
|
9
9
|
export declare const renderFilter: <RecordType>(column: ColumnType<RecordType>, selectedKeys: string[], setSelectedKeys: any, confirm: any, visible: boolean, searchValue: string, setSearchValue: any, dataSourceFilter: any[], buddhistLocale: any, locale?: TableLocale, t?: any) => React.JSX.Element;
|
|
@@ -118,7 +118,12 @@ export const getValueCell = (column, value, format) => {
|
|
|
118
118
|
export const renderContent = (column, value, record, index, format) => {
|
|
119
119
|
const cellValue = value instanceof Date ? getDateString(column, value) : value;
|
|
120
120
|
const content = getValueCell(column, cellValue, format);
|
|
121
|
-
return /*#__PURE__*/React.createElement(Fragment, null, column?.template ? typeof column.template === "function" ? column.template(
|
|
121
|
+
return /*#__PURE__*/React.createElement(Fragment, null, column?.template ? typeof column.template === "function" ? column.template({
|
|
122
|
+
value,
|
|
123
|
+
index,
|
|
124
|
+
rowData: record,
|
|
125
|
+
field: column.field
|
|
126
|
+
}) : column.template : content);
|
|
122
127
|
};
|
|
123
128
|
export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale, locale, t) => {
|
|
124
129
|
const type = getTypeFilter(column);
|
|
@@ -364,8 +369,9 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
364
369
|
className: 'mb-1'
|
|
365
370
|
}, /*#__PURE__*/React.createElement(Select
|
|
366
371
|
// options={translateOption(numberOperator, t)}
|
|
372
|
+
// options={find ? options : column.source ?? []}
|
|
367
373
|
, {
|
|
368
|
-
options:
|
|
374
|
+
options: column.source ? column.source : options ?? [],
|
|
369
375
|
style: {
|
|
370
376
|
width: '100%',
|
|
371
377
|
marginBottom: 8
|
|
@@ -164,7 +164,10 @@ const useColumns = config => {
|
|
|
164
164
|
// title: () => (<span>{t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title}</span>),
|
|
165
165
|
ellipsis: col.ellipsis !== false,
|
|
166
166
|
align: col.textAlign ?? col.align,
|
|
167
|
-
fixed: col.
|
|
167
|
+
fixed: col.fixedType ?? col.fixed,
|
|
168
|
+
isSummary: col.isSummary ?? col.haveSum,
|
|
169
|
+
hidden: col.hidden ?? col.visible === false
|
|
170
|
+
// hidden: true
|
|
168
171
|
};
|
|
169
172
|
if (transformedColumn.children && transformedColumn.children?.length) {
|
|
170
173
|
return {
|
|
@@ -269,7 +272,7 @@ const useColumns = config => {
|
|
|
269
272
|
}
|
|
270
273
|
return renderContent(col, value, record, rowIndex, format);
|
|
271
274
|
},
|
|
272
|
-
hidden: groupSetting && groupSetting.hiddenColumnGroup === false ?
|
|
275
|
+
hidden: groupSetting && groupSetting.hiddenColumnGroup === false ? transformedColumn.hidden : groupAble && groupColumns && groupColumns.includes(col.field) ? true : transformedColumn.hidden
|
|
273
276
|
};
|
|
274
277
|
});
|
|
275
278
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import type { EditType, IColumnType, TypeFilter } from "rc-master-ui";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ColumnsType, ColumnTable, GetRowKey } from "../type";
|
|
5
5
|
import type { SelectionSettings } from "../type";
|
|
6
6
|
import type { AnyObject } from "../type";
|
|
7
7
|
import type { Key } from "react";
|
|
@@ -26,8 +26,8 @@ export declare const customWeekStartEndFormat: (value: any, weekFormat: string)
|
|
|
26
26
|
export declare const getTypeFilter: (col: ColumnTable<any>) => TypeFilter;
|
|
27
27
|
export declare const updateArrayByKey: (arr: any[], element: any, key: string) => any[];
|
|
28
28
|
export declare const getDateString: <T>(column: ColumnTable<T>, value: any) => string;
|
|
29
|
-
export declare const getEditType: <T>(column:
|
|
30
|
-
export declare const isDisable: <T>(column:
|
|
29
|
+
export declare const getEditType: <T>(column: ColumnTable<T>, rowData?: any) => EditType;
|
|
30
|
+
export declare const isDisable: <T>(column: ColumnTable<T>, rowData?: any) => boolean;
|
|
31
31
|
export declare const checkFieldKey: (key: string | undefined) => string;
|
|
32
32
|
export declare const convertLabelToTitle: (data: any[]) => any[];
|
|
33
33
|
export declare const convertArrayWithIndent: (inputArray: any[], parentIndent?: number) => any[];
|
|
@@ -64,8 +64,9 @@ export declare function addRows8(arr: any, n: number): {
|
|
|
64
64
|
};
|
|
65
65
|
export declare const transformColumns: <RecordType>(cols: ColumnsTable<RecordType>, convertColumns: any[], t?: any) => ColumnsTable<RecordType>;
|
|
66
66
|
export declare const transformColumns1: <RecordType>(cols: ColumnsTable<RecordType>, sortMultiple?: boolean) => ColumnsTable<RecordType>;
|
|
67
|
-
export declare const removeColumns: <RecordType>(columns:
|
|
67
|
+
export declare const removeColumns: <RecordType>(columns: ColumnTable<RecordType>[], groupColumns: string[]) => ColumnsTable<RecordType>;
|
|
68
68
|
export declare const convertFlatColumn: (array: ColumnsTable) => ColumnsTable[];
|
|
69
69
|
export declare const convertColumns: <RecordType>(cols: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
|
|
70
70
|
export declare const checkChild: (inputArray: any[]) => boolean;
|
|
71
|
-
export declare const isEditable: <RecordType>(column:
|
|
71
|
+
export declare const isEditable: <RecordType>(column: ColumnTable, rowData: RecordType) => boolean | ((rowData: any) => boolean);
|
|
72
|
+
export declare const isArraysEqual: (arr1: any[], arr2: any[]) => boolean;
|
|
@@ -704,7 +704,7 @@ export const removeColumns = (columns, groupColumns) => {
|
|
|
704
704
|
const newCol = {
|
|
705
705
|
...column
|
|
706
706
|
};
|
|
707
|
-
if (newCol.
|
|
707
|
+
if (newCol?.children && newCol?.children.length > 0) {
|
|
708
708
|
newCol.children = removeColumns(newCol.children, groupColumns);
|
|
709
709
|
}
|
|
710
710
|
return newCol;
|
|
@@ -737,7 +737,7 @@ export const convertColumns = cols => {
|
|
|
737
737
|
// title: () => (<span>{t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title}</span>),
|
|
738
738
|
ellipsis: col.ellipsis !== false,
|
|
739
739
|
align: col.textAlign ?? col.align,
|
|
740
|
-
fixed: col.
|
|
740
|
+
fixed: col.fixedType ?? col.fixed
|
|
741
741
|
};
|
|
742
742
|
if (transformedColumn.children && transformedColumn.children?.length) {
|
|
743
743
|
return {
|
|
@@ -778,4 +778,10 @@ export const isEditable = (column, rowData) => {
|
|
|
778
778
|
return column.editEnable(rowData);
|
|
779
779
|
}
|
|
780
780
|
return column?.editEnable;
|
|
781
|
+
};
|
|
782
|
+
export const isArraysEqual = (arr1, arr2) => {
|
|
783
|
+
if (arr1.length !== arr2.length) {
|
|
784
|
+
return false;
|
|
785
|
+
}
|
|
786
|
+
return arr1.every((element, index) => element === arr2[index]);
|
|
781
787
|
};
|
|
@@ -205,6 +205,8 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
205
205
|
border-bottom: 1px solid $tableBorderColor;
|
|
206
206
|
//background: #fff;
|
|
207
207
|
font-weight: 500;
|
|
208
|
+
//line-height: 23px;
|
|
209
|
+
//height: 40px;
|
|
208
210
|
}
|
|
209
211
|
}
|
|
210
212
|
|
|
@@ -336,10 +338,18 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
336
338
|
.#{$prefix}-table-wrapper {
|
|
337
339
|
|
|
338
340
|
.#{$prefix}-table.#{$prefix}-table-small {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
341
|
+
.ui-rc-table-thead {
|
|
342
|
+
>tr >th.#{$prefix}-table-selection-column{
|
|
343
|
+
//padding-block: 7px;
|
|
344
|
+
padding: 0;
|
|
345
|
+
//padding: 6px 8px;
|
|
346
|
+
}
|
|
342
347
|
}
|
|
348
|
+
//.#{$prefix}-table-selection-column{
|
|
349
|
+
// padding-block: 7px;
|
|
350
|
+
// padding: 0;
|
|
351
|
+
// //padding: 6px 8px;
|
|
352
|
+
//}
|
|
343
353
|
}
|
|
344
354
|
|
|
345
355
|
&.grid-editable {
|