es-grid-template 1.7.36 → 1.7.38
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/LICENSE +21 -21
- package/README.md +1 -1
- package/es/grid-component/ContextMenu.d.ts +2 -3
- package/es/grid-component/ContextMenu.js +2 -2
- package/es/grid-component/InternalTable.d.ts +1 -1
- package/es/grid-component/InternalTable.js +31 -39
- package/es/grid-component/hooks/constant.js +6 -6
- package/es/grid-component/hooks/content/TooltipContent.d.ts +2 -1
- package/es/grid-component/hooks/useColumns.d.ts +3 -1
- package/es/grid-component/hooks/utils.d.ts +1 -1
- package/es/grid-component/styles.scss +1437 -1437
- package/es/table-component/ContextMenu.d.ts +2 -3
- package/es/table-component/ContextMenu.js +2 -2
- package/es/table-component/InternalTable.d.ts +6 -6
- package/es/table-component/InternalTable.js +32 -29
- package/es/table-component/TableContainer.d.ts +5 -5
- package/es/table-component/TableContainer.js +31 -32
- package/es/table-component/TableContainerEdit.d.ts +1 -1
- package/es/table-component/TableContainerEdit.js +248 -217
- package/es/table-component/body/EditableCell.js +154 -157
- package/es/table-component/body/TableBody.d.ts +1 -1
- package/es/table-component/body/TableBody.js +5 -5
- package/es/table-component/body/TableBodyCell.js +37 -18
- package/es/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/es/table-component/body/TableBodyCellEdit.js +61 -53
- package/es/table-component/body/TableBodyRow.js +0 -1
- package/es/table-component/footer/TableFooterCell.d.ts +3 -3
- package/es/table-component/footer/TableFooterCell.js +8 -6
- package/es/table-component/header/TableHead.d.ts +5 -5
- package/es/table-component/header/TableHead.js +2 -2
- package/es/table-component/hook/constant.js +6 -6
- package/es/table-component/hook/useFilterOperator.d.ts +1 -1
- package/es/table-component/hook/utils.d.ts +2 -2
- package/es/table-component/hook/utils.js +202 -154
- package/es/table-component/style.scss +1197 -1197
- package/es/table-component/table/Grid.js +1 -1
- package/es/table-component/table/TableWrapper.d.ts +4 -4
- package/es/table-component/table/TableWrapper.js +23 -20
- package/es/table-component/type.d.ts +40 -40
- package/es/table-component/useContext.d.ts +4 -3
- package/es/table-component/useContext.js +4 -4
- package/lib/grid-component/ContextMenu.d.ts +2 -3
- package/lib/grid-component/InternalTable.d.ts +1 -1
- package/lib/grid-component/InternalTable.js +25 -33
- package/lib/grid-component/hooks/constant.js +6 -6
- package/lib/grid-component/hooks/content/TooltipContent.d.ts +2 -1
- package/lib/grid-component/hooks/useColumns.d.ts +3 -1
- package/lib/grid-component/hooks/utils.d.ts +1 -1
- package/lib/grid-component/styles.scss +1437 -1437
- package/lib/table-component/ContextMenu.d.ts +2 -3
- package/lib/table-component/InternalTable.d.ts +6 -6
- package/lib/table-component/InternalTable.js +23 -22
- package/lib/table-component/TableContainer.d.ts +5 -5
- package/lib/table-component/TableContainer.js +24 -26
- package/lib/table-component/TableContainerEdit.d.ts +1 -1
- package/lib/table-component/TableContainerEdit.js +247 -216
- package/lib/table-component/body/EditableCell.js +153 -156
- package/lib/table-component/body/TableBody.d.ts +1 -1
- package/lib/table-component/body/TableBody.js +5 -5
- package/lib/table-component/body/TableBodyCell.js +36 -17
- package/lib/table-component/body/TableBodyCellEdit.d.ts +4 -4
- package/lib/table-component/body/TableBodyCellEdit.js +58 -50
- package/lib/table-component/body/TableBodyRow.js +0 -1
- package/lib/table-component/footer/TableFooterCell.d.ts +3 -3
- package/lib/table-component/footer/TableFooterCell.js +7 -5
- package/lib/table-component/header/TableHead.d.ts +5 -5
- package/lib/table-component/header/TableHead.js +1 -1
- package/lib/table-component/hook/constant.js +6 -6
- package/lib/table-component/hook/useFilterOperator.d.ts +1 -1
- package/lib/table-component/hook/utils.d.ts +2 -2
- package/lib/table-component/hook/utils.js +201 -153
- package/lib/table-component/style.scss +1197 -1197
- package/lib/table-component/table/Grid.js +1 -1
- package/lib/table-component/table/TableWrapper.d.ts +4 -4
- package/lib/table-component/table/TableWrapper.js +23 -20
- package/lib/table-component/type.d.ts +40 -40
- package/lib/table-component/useContext.d.ts +4 -3
- package/lib/table-component/useContext.js +3 -3
- package/package.json +2 -2
- package/CHANGELOG.md +0 -6
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 taonv
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 taonv
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# es-grid-template
|
|
1
|
+
# es-grid-template
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import type { ContextInfo } from
|
|
3
|
-
import type { ContextMenuItem } from "./type";
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ContextInfo, ContextMenuItem } from './type';
|
|
4
3
|
export declare const findItemByKey: (array: any[], key: string, value: any) => any;
|
|
5
4
|
type Props<RecordType> = {
|
|
6
5
|
rowData: RecordType | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
// import type { MenuProps } from "antd";
|
|
3
|
-
import { Dropdown, Menu } from
|
|
3
|
+
import { Dropdown, Menu } from 'antd';
|
|
4
4
|
export const findItemByKey = (array, key, value) => {
|
|
5
5
|
for (let i = 0; i < array.length; i++) {
|
|
6
6
|
const item = array[i];
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
2
3
|
import React, { createContext, Fragment, useCallback, useContext, useState } from 'react';
|
|
3
4
|
import 'react-resizable/css/styles.css';
|
|
4
|
-
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
5
5
|
import { addRowIdArray, booleanOperator, convertFilters, convertFlatColumn, filterDataByColumns4, findItemByKey, findItemPath, flattenArray, getAllRowKey, getFormat, getTypeFilter, groupArrayByColumns, isNullOrUndefined, numberOperator, removeColumns, removeInvisibleColumns, stringOperator, translateOption, unFlattenData, updateArrayByKey, updateColumnsByGroup,
|
|
6
6
|
// updateData,
|
|
7
7
|
updateOrInsert } from "./hooks";
|
|
8
|
-
import dayjs from
|
|
8
|
+
import dayjs from 'dayjs';
|
|
9
9
|
import 'dayjs/locale/es';
|
|
10
10
|
import 'dayjs/locale/vi';
|
|
11
|
-
import
|
|
11
|
+
import en from 'rc-master-ui/es/date-picker/locale/en_US';
|
|
12
|
+
import vi from 'rc-master-ui/es/date-picker/locale/vi_VN';
|
|
12
13
|
import Grid from "./table/Grid";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import viDr from "rc-master-ui/es/locales/vi_VN";
|
|
14
|
+
import GridEdit from "./table/GridEdit";
|
|
15
|
+
import enDr from 'rc-master-ui/es/locales/en_US';
|
|
16
|
+
import viDr from 'rc-master-ui/es/locales/vi_VN';
|
|
17
17
|
// import useColumns from "./hooks/useColumns";
|
|
18
18
|
|
|
19
19
|
import "./styles.scss";
|
|
20
20
|
// import 'rc-master-ui/es/date-range-picker/styles/index.less'
|
|
21
21
|
// import 'rc-master-ui/assets/index.css'
|
|
22
22
|
|
|
23
|
+
import { SearchOutlined } from '@ant-design/icons';
|
|
24
|
+
import { closestCenter, DndContext, DragOverlay, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
|
|
25
|
+
import { restrictToHorizontalAxis } from '@dnd-kit/modifiers';
|
|
26
|
+
import { arrayMove, horizontalListSortingStrategy, SortableContext, useSortable } from '@dnd-kit/sortable';
|
|
27
|
+
import { Button, Space } from 'antd';
|
|
28
|
+
import { ArrowDown, ArrowUp, FilterFill, SortCancel } from 'becoxy-icons';
|
|
29
|
+
import classNames from 'classnames';
|
|
30
|
+
import { Select } from 'rc-master-ui';
|
|
31
|
+
import { Tooltip } from 'react-tooltip';
|
|
32
|
+
import Swal from 'sweetalert2';
|
|
33
|
+
import withReactContent from 'sweetalert2-react-content';
|
|
23
34
|
import { flatColumns2, renderContent, renderFilter } from "./hooks/columns";
|
|
24
|
-
import Group from "./table/Group";
|
|
25
|
-
import Swal from "sweetalert2";
|
|
26
|
-
import withReactContent from "sweetalert2-react-content";
|
|
27
|
-
import { Tooltip } from "react-tooltip";
|
|
28
|
-
import classNames from "classnames";
|
|
29
35
|
import HeaderContent from "./hooks/content/HeaderContent";
|
|
30
|
-
import
|
|
31
|
-
import { Select } from "rc-master-ui";
|
|
32
|
-
import { Button, Space } from "antd";
|
|
33
|
-
import { SearchOutlined } from "@ant-design/icons";
|
|
34
|
-
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
35
|
-
import { closestCenter, DndContext, DragOverlay, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
|
36
|
-
import { arrayMove, horizontalListSortingStrategy, SortableContext, useSortable } from "@dnd-kit/sortable";
|
|
36
|
+
import Group from "./table/Group";
|
|
37
37
|
// import {CSS} from "@dnd-kit/utilities";
|
|
38
|
-
import {
|
|
39
|
-
import { faker } from "@faker-js/faker";
|
|
40
|
-
import InfiniteTable from "./table/InfiniteTable";
|
|
41
|
-
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
38
|
+
import { faker } from '@faker-js/faker';
|
|
42
39
|
import Modal from 'antd/es/modal/Modal';
|
|
40
|
+
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
41
|
+
import { Resizable } from 'react-resizable';
|
|
42
|
+
import InfiniteTable from "./table/InfiniteTable";
|
|
43
43
|
dayjs.extend(customParseFormat);
|
|
44
44
|
const MySwal = withReactContent(Swal);
|
|
45
45
|
const ASCEND = 'ascend';
|
|
@@ -213,9 +213,9 @@ const InternalTable = props => {
|
|
|
213
213
|
const handleWindowResize = () => {
|
|
214
214
|
setWindowSize(getWindowSize());
|
|
215
215
|
};
|
|
216
|
-
window.addEventListener(
|
|
216
|
+
window.addEventListener('resize', handleWindowResize);
|
|
217
217
|
return () => {
|
|
218
|
-
window.removeEventListener(
|
|
218
|
+
window.removeEventListener('resize', handleWindowResize);
|
|
219
219
|
};
|
|
220
220
|
}, []);
|
|
221
221
|
const [scrollHeight, setHeight] = useState(0);
|
|
@@ -401,7 +401,7 @@ const InternalTable = props => {
|
|
|
401
401
|
// handleSearch()
|
|
402
402
|
// close()
|
|
403
403
|
}
|
|
404
|
-
}, t ? t(
|
|
404
|
+
}, t ? t('Clear') : 'Clear')));
|
|
405
405
|
},
|
|
406
406
|
filterIcon: filtered => /*#__PURE__*/React.createElement(FilterFill, {
|
|
407
407
|
fontSize: 12
|
|
@@ -586,7 +586,7 @@ const InternalTable = props => {
|
|
|
586
586
|
if (currentGroupColumn?.template) {
|
|
587
587
|
return renderContent(currentGroupColumn, record[record.field], record, rowIndex, colIndex, false, cellFormat);
|
|
588
588
|
}
|
|
589
|
-
return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ":
|
|
589
|
+
return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ":", ' ', renderContent(currentGroupColumn, record[record.field], record, rowIndex, colIndex, false, cellFormat));
|
|
590
590
|
}
|
|
591
591
|
return renderContent(column, value, record, rowIndex, colIndex, false, cellFormat);
|
|
592
592
|
},
|
|
@@ -658,7 +658,7 @@ const InternalTable = props => {
|
|
|
658
658
|
if (tableRef.current && type === 'columnChoose') {
|
|
659
659
|
tableRef.current.scrollTo({
|
|
660
660
|
left: 0.1,
|
|
661
|
-
behavior:
|
|
661
|
+
behavior: 'smooth'
|
|
662
662
|
});
|
|
663
663
|
}
|
|
664
664
|
onChooseColumns?.({
|
|
@@ -699,17 +699,11 @@ const InternalTable = props => {
|
|
|
699
699
|
setColumns(updateColumnsByGroup(mergedColumns, groupedColumns));
|
|
700
700
|
if (groupSetting) {
|
|
701
701
|
if (groupSetting.client === false) {
|
|
702
|
-
|
|
703
702
|
// setIsTree(true)
|
|
704
|
-
|
|
705
703
|
// setGroupOpen([])
|
|
706
|
-
|
|
707
704
|
// const dt = ungroupArray(dataSource)
|
|
708
|
-
|
|
709
705
|
// const rs = groupArrayByColumns2(dt, [...value])
|
|
710
|
-
|
|
711
706
|
// setResource([...rs])
|
|
712
|
-
|
|
713
707
|
// if (groupSetting.onGroup) {
|
|
714
708
|
// groupSetting.onGroup({
|
|
715
709
|
// columnGrouped: value,
|
|
@@ -958,7 +952,6 @@ const InternalTable = props => {
|
|
|
958
952
|
} : {
|
|
959
953
|
y: scrollHeight - (summary ? 1 : 1)
|
|
960
954
|
} // scroll height auto, không quá 600
|
|
961
|
-
|
|
962
955
|
// height={isFullScreen ? windowSize.innerHeight - 100 : propsHeight}
|
|
963
956
|
,
|
|
964
957
|
height: propsHeight,
|
|
@@ -1008,10 +1001,10 @@ const InternalTable = props => {
|
|
|
1008
1001
|
style: {
|
|
1009
1002
|
maxWidth: '100%',
|
|
1010
1003
|
height: '100%'
|
|
1011
|
-
}
|
|
1012
|
-
onClose
|
|
1004
|
+
}
|
|
1005
|
+
// onClose={() => setIsFullScreen(false)}
|
|
1006
|
+
,
|
|
1013
1007
|
onCancel: () => setIsFullScreen(false)
|
|
1014
|
-
|
|
1015
1008
|
// destroyOnClose
|
|
1016
1009
|
,
|
|
1017
1010
|
styles: {
|
|
@@ -1073,7 +1066,6 @@ const InternalTable = props => {
|
|
|
1073
1066
|
y: scrollHeight1 - (summary ? 1 : 1)
|
|
1074
1067
|
} // scroll height auto, không quá 600
|
|
1075
1068
|
,
|
|
1076
|
-
|
|
1077
1069
|
height: windowSize.innerHeight - 35,
|
|
1078
1070
|
scrollHeight: scrollHeight1,
|
|
1079
1071
|
components: {
|
|
@@ -213,16 +213,16 @@ export const optionFontSize = [{
|
|
|
213
213
|
label: '48'
|
|
214
214
|
}];
|
|
215
215
|
|
|
216
|
-
/**
|
|
217
|
-
* Sort order for BaseTable
|
|
216
|
+
/**
|
|
217
|
+
* Sort order for BaseTable
|
|
218
218
|
*/
|
|
219
219
|
const SortOrder = {
|
|
220
|
-
/**
|
|
221
|
-
* Sort data in ascending order
|
|
220
|
+
/**
|
|
221
|
+
* Sort data in ascending order
|
|
222
222
|
*/
|
|
223
223
|
ascend: 'Ascending',
|
|
224
|
-
/**
|
|
225
|
-
* Sort data in descending order
|
|
224
|
+
/**
|
|
225
|
+
* Sort data in descending order
|
|
226
226
|
*/
|
|
227
227
|
descend: 'Descending'
|
|
228
228
|
};
|
|
@@ -15,5 +15,7 @@ interface UseColumnsConfig<RecordType> {
|
|
|
15
15
|
rowKey?: any;
|
|
16
16
|
onMouseHover?: any;
|
|
17
17
|
}
|
|
18
|
-
declare const useColumns: <RecordType extends AnyObject = AnyObject>(config: UseColumnsConfig<RecordType>) => readonly [
|
|
18
|
+
declare const useColumns: <RecordType extends AnyObject = AnyObject>(config: UseColumnsConfig<RecordType>) => readonly [
|
|
19
|
+
any
|
|
20
|
+
];
|
|
19
21
|
export default useColumns;
|
|
@@ -53,7 +53,7 @@ export declare const getTemplate: (template: any, column?: ColumnTable) => React
|
|
|
53
53
|
export declare const totalFixedWidth: <T>(columns: ColumnsTable<T>, type: 'left' | 'right', selectionSettings?: SelectionSettings) => number;
|
|
54
54
|
export declare const isObjEmpty: (obj: any) => boolean;
|
|
55
55
|
export declare const getColumnsVisible: <T>(columns: ColumnsTable<T>, index: number) => ColumnTable<T>[];
|
|
56
|
-
export declare const updateData: <
|
|
56
|
+
export declare const updateData: <Record = AnyObject>(initData: Record[], rows: Record[], key: keyof Record) => Record[];
|
|
57
57
|
export declare const parseBooleanToValue: (value: boolean, type: 'boolean' | 'number') => number | boolean;
|
|
58
58
|
export declare const genPresets: (presets?: import("@ant-design/colors").PalettesProps) => import("antd/es/color-picker/interface").PresetsItem[];
|
|
59
59
|
export declare function findAllChildrenKeys<RecordType>(data: readonly RecordType[], getRowKey: GetRowKey<RecordType>, childrenColumnName: string): Key[];
|