es-grid-template 1.6.7 → 1.6.9
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/EditableCell.js +6 -3
- package/es/grid-component/GridStyle.js +1 -1
- package/es/grid-component/InternalTable.js +40 -9
- package/es/grid-component/TableGrid.d.ts +2 -0
- package/es/grid-component/TableGrid.js +16 -0
- package/es/grid-component/styles.scss +4 -0
- package/es/grid-component/table/Grid.d.ts +2 -0
- package/es/grid-component/table/GridEdit.d.ts +2 -0
- package/es/grid-component/table/Group.d.ts +2 -0
- package/es/grid-component/table/InfiniteTable.d.ts +2 -0
- package/es/grid-component/type.d.ts +1 -0
- package/lib/grid-component/EditableCell.js +6 -3
- package/lib/grid-component/GridStyle.js +1 -1
- package/lib/grid-component/InternalTable.js +40 -9
- package/lib/grid-component/TableGrid.d.ts +2 -0
- package/lib/grid-component/TableGrid.js +16 -0
- package/lib/grid-component/styles.scss +4 -0
- package/lib/grid-component/table/Grid.d.ts +2 -0
- package/lib/grid-component/table/GridEdit.d.ts +2 -0
- package/lib/grid-component/table/Group.d.ts +2 -0
- package/lib/grid-component/table/InfiniteTable.d.ts +2 -0
- package/lib/grid-component/type.d.ts +1 -0
- package/package.json +2 -1
|
@@ -415,7 +415,8 @@ const EditableCell = props => {
|
|
|
415
415
|
newState,
|
|
416
416
|
option: {
|
|
417
417
|
value: val,
|
|
418
|
-
label: val
|
|
418
|
+
label: val,
|
|
419
|
+
searchTextAsValue: true
|
|
419
420
|
},
|
|
420
421
|
indexCol,
|
|
421
422
|
indexRow,
|
|
@@ -498,7 +499,8 @@ const EditableCell = props => {
|
|
|
498
499
|
newState,
|
|
499
500
|
option: {
|
|
500
501
|
value: val,
|
|
501
|
-
label: val
|
|
502
|
+
label: val,
|
|
503
|
+
searchTextAsValue: true
|
|
502
504
|
},
|
|
503
505
|
indexCol,
|
|
504
506
|
indexRow,
|
|
@@ -620,7 +622,8 @@ const EditableCell = props => {
|
|
|
620
622
|
newState,
|
|
621
623
|
option: {
|
|
622
624
|
value: val,
|
|
623
|
-
label: val
|
|
625
|
+
label: val,
|
|
626
|
+
searchTextAsValue: true
|
|
624
627
|
},
|
|
625
628
|
indexCol,
|
|
626
629
|
indexRow,
|
|
@@ -2,4 +2,4 @@ import styled from "styled-components";
|
|
|
2
2
|
export const GridStyle = styled.div.withConfig({
|
|
3
3
|
displayName: "GridStyle",
|
|
4
4
|
componentId: "es-grid-template__sc-sueu2e-0"
|
|
5
|
-
})(["height:", ";.ui-rc-table.ui-rc-table-virtual.ui-rc-table-scroll-horizontal{.ui-rc-table-container{&:has(.ui-rc-table-tbody-virtual-scrollbar-horizontal){padding-bottom:8px;border-bottom:1px solid #e0e0e0;}}}.ui-rc-table-container{.ui-rc-table-tbody-virtual.ui-rc-table-tbody{min-height:", ";}.ui-rc-table-body{&:has(.ui-rc-table-placeholder){height:", ";}table{height:100%;.ui-rc-table-placeholder{vertical-align:top;}}}.ui-rc-table-placeholder{}}.ui-rc-toolbar-bottom{position:relative;padding:.25rem 1rem;background-color:#ffffff;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}.toolbar-button{border-radius:0;.ant-btn{border-radius:0;}}}.ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;background-color:#ffffff;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;}&.pagination-template{position:relative;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}}}.react-resizable{position:relative;background-clip:padding-box;}.rc-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.$heightTable ? `${props.$heightTable}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll - 1}px` : undefined);
|
|
5
|
+
})(["height:", ";padding:12px;.ui-rc-table.ui-rc-table-virtual.ui-rc-table-scroll-horizontal{.ui-rc-table-container{&:has(.ui-rc-table-tbody-virtual-scrollbar-horizontal){padding-bottom:8px;border-bottom:1px solid #e0e0e0;}}}.ui-rc-table-container{.ui-rc-table-tbody-virtual.ui-rc-table-tbody{min-height:", ";}.ui-rc-table-body{&:has(.ui-rc-table-placeholder){height:", ";}table{height:100%;.ui-rc-table-placeholder{vertical-align:top;}}}.ui-rc-table-placeholder{}}.ui-rc-toolbar-bottom{position:relative;padding:.25rem 1rem;background-color:#ffffff;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}.toolbar-button{border-radius:0;.ant-btn{border-radius:0;}}}.ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;background-color:#ffffff;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;}&.pagination-template{position:relative;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}}}.react-resizable{position:relative;background-clip:padding-box;}.rc-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.$heightTable ? `${props.$heightTable}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll - 1}px` : undefined);
|
|
@@ -6,6 +6,7 @@ import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
|
6
6
|
import { addRowIdArray, booleanOperator, convertFilters, convertFlatColumn, filterDataByColumns4, findItemByKey, findItemPath, flattenArray, getAllRowKey, getFormat, getTypeFilter, groupArrayByColumns, numberOperator, removeColumns, removeInvisibleColumns, stringOperator, translateOption, unFlattenData, updateArrayByKey, updateColumnsByGroup,
|
|
7
7
|
// updateData,
|
|
8
8
|
updateOrInsert } from "./hooks";
|
|
9
|
+
import { FullScreen, useFullScreenHandle } from "react-full-screen";
|
|
9
10
|
import dayjs from "dayjs";
|
|
10
11
|
import 'dayjs/locale/es';
|
|
11
12
|
import 'dayjs/locale/vi';
|
|
@@ -187,6 +188,7 @@ const InternalTable = props => {
|
|
|
187
188
|
onSorter,
|
|
188
189
|
...rest
|
|
189
190
|
} = props;
|
|
191
|
+
const handle = useFullScreenHandle();
|
|
190
192
|
const id = React.useMemo(() => {
|
|
191
193
|
return tableId ?? faker.string.alpha(20);
|
|
192
194
|
// return tableId ?? newGuid()
|
|
@@ -197,6 +199,26 @@ const InternalTable = props => {
|
|
|
197
199
|
// }, [propRowKey])
|
|
198
200
|
|
|
199
201
|
const rowKey = 'rowId';
|
|
202
|
+
const getWindowSize = () => {
|
|
203
|
+
const {
|
|
204
|
+
innerWidth,
|
|
205
|
+
innerHeight
|
|
206
|
+
} = window;
|
|
207
|
+
return {
|
|
208
|
+
innerWidth,
|
|
209
|
+
innerHeight
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
const [windowSize, setWindowSize] = useState(getWindowSize());
|
|
213
|
+
React.useEffect(() => {
|
|
214
|
+
const handleWindowResize = () => {
|
|
215
|
+
setWindowSize(getWindowSize());
|
|
216
|
+
};
|
|
217
|
+
window.addEventListener("resize", handleWindowResize);
|
|
218
|
+
return () => {
|
|
219
|
+
window.removeEventListener("resize", handleWindowResize);
|
|
220
|
+
};
|
|
221
|
+
}, []);
|
|
200
222
|
const [scrollHeight, setHeight] = useState(0);
|
|
201
223
|
const local = lang && lang === 'en' ? en : vi;
|
|
202
224
|
const dateRangeLocale = lang && lang === 'en' ? enDr : viDr;
|
|
@@ -217,8 +239,7 @@ const InternalTable = props => {
|
|
|
217
239
|
});
|
|
218
240
|
const [tooltipContent, setTooltipContent] = useState('');
|
|
219
241
|
const [filterStates, setFilterState] = React.useState(null);
|
|
220
|
-
|
|
221
|
-
|
|
242
|
+
const [isFullScreen, setIsFullScreen] = React.useState(false);
|
|
222
243
|
const mergedData = React.useMemo(() => {
|
|
223
244
|
if (groupAble && groupSetting && groupSetting.client !== false) {
|
|
224
245
|
return groupArrayByColumns(dataSource, groupColumns);
|
|
@@ -242,7 +263,8 @@ const InternalTable = props => {
|
|
|
242
263
|
|
|
243
264
|
const [columns, setColumns] = React.useState([]);
|
|
244
265
|
React.useEffect(() => {
|
|
245
|
-
|
|
266
|
+
const totalHeight = isFullScreen ? windowSize.innerHeight - 24 : propsHeight;
|
|
267
|
+
if (totalHeight) {
|
|
246
268
|
const table = document.querySelector(`#${id}`);
|
|
247
269
|
const title = table?.querySelector(`.ui-rc-table-title`);
|
|
248
270
|
const header = table?.querySelector(`.ui-rc-table-header`);
|
|
@@ -250,10 +272,10 @@ const InternalTable = props => {
|
|
|
250
272
|
const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
|
|
251
273
|
const summaryE = table?.querySelector(`.ui-rc-table-summary`);
|
|
252
274
|
const scrollbar = table?.querySelector(`.ui-rc-table-tbody-virtual-scrollbar.ui-rc-table-tbody-virtual-scrollbar-horizontal`);
|
|
253
|
-
const hhh = (
|
|
275
|
+
const hhh = (totalHeight ?? 0) - (title ? title.offsetHeight : 0) - (header ? header.offsetHeight : 0) - (paginationE ? paginationE.offsetHeight : 0) - (toolbar ? toolbar.offsetHeight : 0) - (summaryE ? summaryE.offsetHeight : 0) - (scrollbar ? scrollbar.offsetHeight : 0);
|
|
254
276
|
setHeight(hhh > 0 ? hhh : 0);
|
|
255
277
|
}
|
|
256
|
-
}, [id, propsHeight, columns, editAble]);
|
|
278
|
+
}, [id, propsHeight, columns, editAble, isFullScreen]);
|
|
257
279
|
const tableRef = React.useRef(null);
|
|
258
280
|
React.useEffect(() => {
|
|
259
281
|
setColumns(propsColumns);
|
|
@@ -869,8 +891,15 @@ const InternalTable = props => {
|
|
|
869
891
|
const handleChange = (paging, filters, sorter) => {
|
|
870
892
|
onSorter?.(sorter);
|
|
871
893
|
};
|
|
894
|
+
const fullScreenChange = state => {
|
|
895
|
+
setIsFullScreen(state);
|
|
896
|
+
};
|
|
872
897
|
const TableComponent = infiniteScroll ? InfiniteTable : groupAble ? Group : editAble ? GridEdit : Grid;
|
|
873
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(
|
|
898
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FullScreen, {
|
|
899
|
+
handle: handle,
|
|
900
|
+
onChange: fullScreenChange,
|
|
901
|
+
className: "rc-fullscreen"
|
|
902
|
+
}, /*#__PURE__*/React.createElement(DndContext, {
|
|
874
903
|
sensors: sensors,
|
|
875
904
|
modifiers: [restrictToHorizontalAxis],
|
|
876
905
|
onDragEnd: onDragEnd,
|
|
@@ -921,7 +950,7 @@ const InternalTable = props => {
|
|
|
921
950
|
} // scroll height auto, không quá 600
|
|
922
951
|
,
|
|
923
952
|
|
|
924
|
-
height: propsHeight,
|
|
953
|
+
height: isFullScreen ? windowSize.innerHeight - 24 : propsHeight,
|
|
925
954
|
scrollHeight: scrollHeight,
|
|
926
955
|
components: {
|
|
927
956
|
header: {
|
|
@@ -940,7 +969,9 @@ const InternalTable = props => {
|
|
|
940
969
|
setMergedFilterKeys: setMergedFilterKeys,
|
|
941
970
|
mergedFilterKeys: mergedFilterKeys,
|
|
942
971
|
wrapSettings: wrapSettings,
|
|
943
|
-
onChange: handleChange
|
|
972
|
+
onChange: handleChange,
|
|
973
|
+
handleFullScreen: handle,
|
|
974
|
+
isFullScreen: isFullScreen
|
|
944
975
|
|
|
945
976
|
// onChange={(paging, filters, sorter) => {
|
|
946
977
|
// handleChange(sorter)
|
|
@@ -957,7 +988,7 @@ const InternalTable = props => {
|
|
|
957
988
|
borderRadius: 6,
|
|
958
989
|
fontWeight: 500
|
|
959
990
|
}
|
|
960
|
-
}, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
991
|
+
}, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText)))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
961
992
|
id: `${id}-tooltip-form-error`,
|
|
962
993
|
style: {
|
|
963
994
|
zIndex: 1999
|
|
@@ -14,6 +14,8 @@ type GridProps<T> = GridTableProps<T> & {
|
|
|
14
14
|
groupToolbar?: () => React.ReactNode;
|
|
15
15
|
isFilter?: boolean;
|
|
16
16
|
setIsFilter?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
17
|
+
handleFullScreen?: any;
|
|
18
|
+
isFullScreen?: boolean;
|
|
17
19
|
};
|
|
18
20
|
declare const TableGrid: <RecordType extends object>(props: GridProps<RecordType>) => React.JSX.Element;
|
|
19
21
|
export default TableGrid;
|
|
@@ -28,6 +28,7 @@ import { ColumnsChoose } from "./ColumnsChoose";
|
|
|
28
28
|
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
29
29
|
import AdvanceFilter from "./AdvanceFilter";
|
|
30
30
|
import { Tooltip } from "react-tooltip";
|
|
31
|
+
import { Maximize, Minimize } from 'becoxy-icons';
|
|
31
32
|
const useStyle = createStyles(({
|
|
32
33
|
css
|
|
33
34
|
}) => {
|
|
@@ -98,6 +99,9 @@ const TableGrid = props => {
|
|
|
98
99
|
showEmptyText,
|
|
99
100
|
// setIsFilter,
|
|
100
101
|
actionTemplate,
|
|
102
|
+
handleFullScreen,
|
|
103
|
+
fullScreen,
|
|
104
|
+
isFullScreen,
|
|
101
105
|
...rest
|
|
102
106
|
} = props;
|
|
103
107
|
const {
|
|
@@ -380,6 +384,16 @@ const TableGrid = props => {
|
|
|
380
384
|
, {
|
|
381
385
|
items: (toolbarItems ?? []).filter(it => it.position !== 'Bottom'),
|
|
382
386
|
mode: 'scroll'
|
|
387
|
+
})), fullScreen && (isFullScreen ? /*#__PURE__*/React.createElement(Minimize, {
|
|
388
|
+
fontSize: 16,
|
|
389
|
+
onClick: handleFullScreen.exit,
|
|
390
|
+
"data-tooltip-id": "tooltip-icon",
|
|
391
|
+
"data-tooltip-content": t ? t('Full Screen') : 'Full screen'
|
|
392
|
+
}) : /*#__PURE__*/React.createElement(Maximize, {
|
|
393
|
+
fontSize: 16,
|
|
394
|
+
onClick: handleFullScreen.enter,
|
|
395
|
+
"data-tooltip-id": "tooltip-icon",
|
|
396
|
+
"data-tooltip-content": t ? t('Minimized') : 'Minimized'
|
|
383
397
|
})), /*#__PURE__*/React.createElement("div", {
|
|
384
398
|
style: {
|
|
385
399
|
display: 'flex',
|
|
@@ -472,6 +486,8 @@ const TableGrid = props => {
|
|
|
472
486
|
zIndex: 1999,
|
|
473
487
|
maxWidth: 350
|
|
474
488
|
}
|
|
489
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
490
|
+
id: "tooltip-icon"
|
|
475
491
|
}));
|
|
476
492
|
};
|
|
477
493
|
export default TableGrid;
|
|
@@ -16,6 +16,8 @@ type Props<T> = GridTableProps<T> & {
|
|
|
16
16
|
originData: T[];
|
|
17
17
|
mergedFilterKeys?: any;
|
|
18
18
|
setMergedFilterKeys?: any;
|
|
19
|
+
handleFullScreen?: any;
|
|
20
|
+
isFullScreen?: boolean;
|
|
19
21
|
};
|
|
20
22
|
declare const Grid: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
21
23
|
export default Grid;
|
|
@@ -16,6 +16,8 @@ type Props<RecordType> = TableProps<RecordType> & {
|
|
|
16
16
|
originData: RecordType[];
|
|
17
17
|
mergedFilterKeys?: any;
|
|
18
18
|
setMergedFilterKeys?: any;
|
|
19
|
+
handleFullScreen?: any;
|
|
20
|
+
isFullScreen?: boolean;
|
|
19
21
|
};
|
|
20
22
|
declare const GridEdit: <RecordType extends AnyObject = AnyObject>(props: Props<RecordType>) => React.JSX.Element;
|
|
21
23
|
export default GridEdit;
|
|
@@ -14,6 +14,8 @@ type Props<T> = GridTableProps<T> & {
|
|
|
14
14
|
originData: T[];
|
|
15
15
|
mergedFilterKeys?: any;
|
|
16
16
|
setMergedFilterKeys?: any;
|
|
17
|
+
handleFullScreen?: any;
|
|
18
|
+
isFullScreen?: boolean;
|
|
17
19
|
};
|
|
18
20
|
declare const Group: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
19
21
|
export default Group;
|
|
@@ -16,6 +16,8 @@ type Props<T> = TableProps<T> & {
|
|
|
16
16
|
originData: T[];
|
|
17
17
|
mergedFilterKeys?: any;
|
|
18
18
|
setMergedFilterKeys?: any;
|
|
19
|
+
handleFullScreen?: any;
|
|
20
|
+
isFullScreen?: boolean;
|
|
19
21
|
};
|
|
20
22
|
declare const InfiniteTable: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
21
23
|
export default InfiniteTable;
|
|
@@ -256,6 +256,7 @@ export interface TableProps<RecordType = AnyObject> extends Omit<RcTableProps<Re
|
|
|
256
256
|
}) => void;
|
|
257
257
|
wrapSettings?: IWrapSettings;
|
|
258
258
|
actionTemplate?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
|
|
259
|
+
fullScreen?: boolean;
|
|
259
260
|
}
|
|
260
261
|
export type PaginationConfig = TablePaginationConfig & {
|
|
261
262
|
currentPage?: number;
|
|
@@ -417,7 +417,8 @@ const EditableCell = props => {
|
|
|
417
417
|
newState,
|
|
418
418
|
option: {
|
|
419
419
|
value: val,
|
|
420
|
-
label: val
|
|
420
|
+
label: val,
|
|
421
|
+
searchTextAsValue: true
|
|
421
422
|
},
|
|
422
423
|
indexCol,
|
|
423
424
|
indexRow,
|
|
@@ -500,7 +501,8 @@ const EditableCell = props => {
|
|
|
500
501
|
newState,
|
|
501
502
|
option: {
|
|
502
503
|
value: val,
|
|
503
|
-
label: val
|
|
504
|
+
label: val,
|
|
505
|
+
searchTextAsValue: true
|
|
504
506
|
},
|
|
505
507
|
indexCol,
|
|
506
508
|
indexRow,
|
|
@@ -622,7 +624,8 @@ const EditableCell = props => {
|
|
|
622
624
|
newState,
|
|
623
625
|
option: {
|
|
624
626
|
value: val,
|
|
625
|
-
label: val
|
|
627
|
+
label: val,
|
|
628
|
+
searchTextAsValue: true
|
|
626
629
|
},
|
|
627
630
|
indexCol,
|
|
628
631
|
indexRow,
|
|
@@ -9,4 +9,4 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
9
9
|
const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
|
|
10
10
|
displayName: "GridStyle",
|
|
11
11
|
componentId: "es-grid-template__sc-sueu2e-0"
|
|
12
|
-
})(["height:", ";.ui-rc-table.ui-rc-table-virtual.ui-rc-table-scroll-horizontal{.ui-rc-table-container{&:has(.ui-rc-table-tbody-virtual-scrollbar-horizontal){padding-bottom:8px;border-bottom:1px solid #e0e0e0;}}}.ui-rc-table-container{.ui-rc-table-tbody-virtual.ui-rc-table-tbody{min-height:", ";}.ui-rc-table-body{&:has(.ui-rc-table-placeholder){height:", ";}table{height:100%;.ui-rc-table-placeholder{vertical-align:top;}}}.ui-rc-table-placeholder{}}.ui-rc-toolbar-bottom{position:relative;padding:.25rem 1rem;background-color:#ffffff;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}.toolbar-button{border-radius:0;.ant-btn{border-radius:0;}}}.ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;background-color:#ffffff;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;}&.pagination-template{position:relative;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}}}.react-resizable{position:relative;background-clip:padding-box;}.rc-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.$heightTable ? `${props.$heightTable}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll - 1}px` : undefined);
|
|
12
|
+
})(["height:", ";padding:12px;.ui-rc-table.ui-rc-table-virtual.ui-rc-table-scroll-horizontal{.ui-rc-table-container{&:has(.ui-rc-table-tbody-virtual-scrollbar-horizontal){padding-bottom:8px;border-bottom:1px solid #e0e0e0;}}}.ui-rc-table-container{.ui-rc-table-tbody-virtual.ui-rc-table-tbody{min-height:", ";}.ui-rc-table-body{&:has(.ui-rc-table-placeholder){height:", ";}table{height:100%;.ui-rc-table-placeholder{vertical-align:top;}}}.ui-rc-table-placeholder{}}.ui-rc-toolbar-bottom{position:relative;padding:.25rem 1rem;background-color:#ffffff;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}.toolbar-button{border-radius:0;.ant-btn{border-radius:0;}}}.ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;background-color:#ffffff;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;}&.pagination-template{position:relative;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}}}.react-resizable{position:relative;background-clip:padding-box;}.rc-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.$heightTable ? `${props.$heightTable}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll - 1}px` : undefined);
|
|
@@ -10,6 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
require("react-resizable/css/styles.css");
|
|
11
11
|
var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
|
|
12
12
|
var _hooks = require("./hooks");
|
|
13
|
+
var _reactFullScreen = require("react-full-screen");
|
|
13
14
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
14
15
|
require("dayjs/locale/es");
|
|
15
16
|
require("dayjs/locale/vi");
|
|
@@ -196,6 +197,7 @@ const InternalTable = props => {
|
|
|
196
197
|
onSorter,
|
|
197
198
|
...rest
|
|
198
199
|
} = props;
|
|
200
|
+
const handle = (0, _reactFullScreen.useFullScreenHandle)();
|
|
199
201
|
const id = _react.default.useMemo(() => {
|
|
200
202
|
return tableId ?? _faker.faker.string.alpha(20);
|
|
201
203
|
// return tableId ?? newGuid()
|
|
@@ -206,6 +208,26 @@ const InternalTable = props => {
|
|
|
206
208
|
// }, [propRowKey])
|
|
207
209
|
|
|
208
210
|
const rowKey = 'rowId';
|
|
211
|
+
const getWindowSize = () => {
|
|
212
|
+
const {
|
|
213
|
+
innerWidth,
|
|
214
|
+
innerHeight
|
|
215
|
+
} = window;
|
|
216
|
+
return {
|
|
217
|
+
innerWidth,
|
|
218
|
+
innerHeight
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
const [windowSize, setWindowSize] = (0, _react.useState)(getWindowSize());
|
|
222
|
+
_react.default.useEffect(() => {
|
|
223
|
+
const handleWindowResize = () => {
|
|
224
|
+
setWindowSize(getWindowSize());
|
|
225
|
+
};
|
|
226
|
+
window.addEventListener("resize", handleWindowResize);
|
|
227
|
+
return () => {
|
|
228
|
+
window.removeEventListener("resize", handleWindowResize);
|
|
229
|
+
};
|
|
230
|
+
}, []);
|
|
209
231
|
const [scrollHeight, setHeight] = (0, _react.useState)(0);
|
|
210
232
|
const local = lang && lang === 'en' ? _en_US.default : _vi_VN.default;
|
|
211
233
|
const dateRangeLocale = lang && lang === 'en' ? _en_US2.default : _vi_VN2.default;
|
|
@@ -226,8 +248,7 @@ const InternalTable = props => {
|
|
|
226
248
|
});
|
|
227
249
|
const [tooltipContent, setTooltipContent] = (0, _react.useState)('');
|
|
228
250
|
const [filterStates, setFilterState] = _react.default.useState(null);
|
|
229
|
-
|
|
230
|
-
|
|
251
|
+
const [isFullScreen, setIsFullScreen] = _react.default.useState(false);
|
|
231
252
|
const mergedData = _react.default.useMemo(() => {
|
|
232
253
|
if (groupAble && groupSetting && groupSetting.client !== false) {
|
|
233
254
|
return (0, _hooks.groupArrayByColumns)(dataSource, groupColumns);
|
|
@@ -251,7 +272,8 @@ const InternalTable = props => {
|
|
|
251
272
|
|
|
252
273
|
const [columns, setColumns] = _react.default.useState([]);
|
|
253
274
|
_react.default.useEffect(() => {
|
|
254
|
-
|
|
275
|
+
const totalHeight = isFullScreen ? windowSize.innerHeight - 24 : propsHeight;
|
|
276
|
+
if (totalHeight) {
|
|
255
277
|
const table = document.querySelector(`#${id}`);
|
|
256
278
|
const title = table?.querySelector(`.ui-rc-table-title`);
|
|
257
279
|
const header = table?.querySelector(`.ui-rc-table-header`);
|
|
@@ -259,10 +281,10 @@ const InternalTable = props => {
|
|
|
259
281
|
const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
|
|
260
282
|
const summaryE = table?.querySelector(`.ui-rc-table-summary`);
|
|
261
283
|
const scrollbar = table?.querySelector(`.ui-rc-table-tbody-virtual-scrollbar.ui-rc-table-tbody-virtual-scrollbar-horizontal`);
|
|
262
|
-
const hhh = (
|
|
284
|
+
const hhh = (totalHeight ?? 0) - (title ? title.offsetHeight : 0) - (header ? header.offsetHeight : 0) - (paginationE ? paginationE.offsetHeight : 0) - (toolbar ? toolbar.offsetHeight : 0) - (summaryE ? summaryE.offsetHeight : 0) - (scrollbar ? scrollbar.offsetHeight : 0);
|
|
263
285
|
setHeight(hhh > 0 ? hhh : 0);
|
|
264
286
|
}
|
|
265
|
-
}, [id, propsHeight, columns, editAble]);
|
|
287
|
+
}, [id, propsHeight, columns, editAble, isFullScreen]);
|
|
266
288
|
const tableRef = _react.default.useRef(null);
|
|
267
289
|
_react.default.useEffect(() => {
|
|
268
290
|
setColumns(propsColumns);
|
|
@@ -878,8 +900,15 @@ const InternalTable = props => {
|
|
|
878
900
|
const handleChange = (paging, filters, sorter) => {
|
|
879
901
|
onSorter?.(sorter);
|
|
880
902
|
};
|
|
903
|
+
const fullScreenChange = state => {
|
|
904
|
+
setIsFullScreen(state);
|
|
905
|
+
};
|
|
881
906
|
const TableComponent = infiniteScroll ? _InfiniteTable.default : groupAble ? _Group.default : editAble ? _GridEdit.default : _Grid.default;
|
|
882
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
907
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactFullScreen.FullScreen, {
|
|
908
|
+
handle: handle,
|
|
909
|
+
onChange: fullScreenChange,
|
|
910
|
+
className: "rc-fullscreen"
|
|
911
|
+
}, /*#__PURE__*/_react.default.createElement(_core.DndContext, {
|
|
883
912
|
sensors: sensors,
|
|
884
913
|
modifiers: [_modifiers.restrictToHorizontalAxis],
|
|
885
914
|
onDragEnd: onDragEnd,
|
|
@@ -930,7 +959,7 @@ const InternalTable = props => {
|
|
|
930
959
|
} // scroll height auto, không quá 600
|
|
931
960
|
,
|
|
932
961
|
|
|
933
|
-
height: propsHeight,
|
|
962
|
+
height: isFullScreen ? windowSize.innerHeight - 24 : propsHeight,
|
|
934
963
|
scrollHeight: scrollHeight,
|
|
935
964
|
components: {
|
|
936
965
|
header: {
|
|
@@ -949,7 +978,9 @@ const InternalTable = props => {
|
|
|
949
978
|
setMergedFilterKeys: setMergedFilterKeys,
|
|
950
979
|
mergedFilterKeys: mergedFilterKeys,
|
|
951
980
|
wrapSettings: wrapSettings,
|
|
952
|
-
onChange: handleChange
|
|
981
|
+
onChange: handleChange,
|
|
982
|
+
handleFullScreen: handle,
|
|
983
|
+
isFullScreen: isFullScreen
|
|
953
984
|
|
|
954
985
|
// onChange={(paging, filters, sorter) => {
|
|
955
986
|
// handleChange(sorter)
|
|
@@ -966,7 +997,7 @@ const InternalTable = props => {
|
|
|
966
997
|
borderRadius: 6,
|
|
967
998
|
fontWeight: 500
|
|
968
999
|
}
|
|
969
|
-
}, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText))), /*#__PURE__*/_react.default.createElement(_reactTooltip.Tooltip, {
|
|
1000
|
+
}, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText)))), /*#__PURE__*/_react.default.createElement(_reactTooltip.Tooltip, {
|
|
970
1001
|
id: `${id}-tooltip-form-error`,
|
|
971
1002
|
style: {
|
|
972
1003
|
zIndex: 1999
|
|
@@ -14,6 +14,8 @@ type GridProps<T> = GridTableProps<T> & {
|
|
|
14
14
|
groupToolbar?: () => React.ReactNode;
|
|
15
15
|
isFilter?: boolean;
|
|
16
16
|
setIsFilter?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
17
|
+
handleFullScreen?: any;
|
|
18
|
+
isFullScreen?: boolean;
|
|
17
19
|
};
|
|
18
20
|
declare const TableGrid: <RecordType extends object>(props: GridProps<RecordType>) => React.JSX.Element;
|
|
19
21
|
export default TableGrid;
|
|
@@ -22,6 +22,7 @@ var _ColumnsChoose = require("./ColumnsChoose");
|
|
|
22
22
|
var _useMergedState = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
|
23
23
|
var _AdvanceFilter = _interopRequireDefault(require("./AdvanceFilter"));
|
|
24
24
|
var _reactTooltip = require("react-tooltip");
|
|
25
|
+
var _becoxyIcons = require("becoxy-icons");
|
|
25
26
|
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); }
|
|
26
27
|
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; }
|
|
27
28
|
// import Table from "../../core/table"
|
|
@@ -98,6 +99,9 @@ const TableGrid = props => {
|
|
|
98
99
|
showEmptyText,
|
|
99
100
|
// setIsFilter,
|
|
100
101
|
actionTemplate,
|
|
102
|
+
handleFullScreen,
|
|
103
|
+
fullScreen,
|
|
104
|
+
isFullScreen,
|
|
101
105
|
...rest
|
|
102
106
|
} = props;
|
|
103
107
|
const {
|
|
@@ -380,6 +384,16 @@ const TableGrid = props => {
|
|
|
380
384
|
, {
|
|
381
385
|
items: (toolbarItems ?? []).filter(it => it.position !== 'Bottom'),
|
|
382
386
|
mode: 'scroll'
|
|
387
|
+
})), fullScreen && (isFullScreen ? /*#__PURE__*/_react.default.createElement(_becoxyIcons.Minimize, {
|
|
388
|
+
fontSize: 16,
|
|
389
|
+
onClick: handleFullScreen.exit,
|
|
390
|
+
"data-tooltip-id": "tooltip-icon",
|
|
391
|
+
"data-tooltip-content": t ? t('Full Screen') : 'Full screen'
|
|
392
|
+
}) : /*#__PURE__*/_react.default.createElement(_becoxyIcons.Maximize, {
|
|
393
|
+
fontSize: 16,
|
|
394
|
+
onClick: handleFullScreen.enter,
|
|
395
|
+
"data-tooltip-id": "tooltip-icon",
|
|
396
|
+
"data-tooltip-content": t ? t('Minimized') : 'Minimized'
|
|
383
397
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
384
398
|
style: {
|
|
385
399
|
display: 'flex',
|
|
@@ -472,6 +486,8 @@ const TableGrid = props => {
|
|
|
472
486
|
zIndex: 1999,
|
|
473
487
|
maxWidth: 350
|
|
474
488
|
}
|
|
489
|
+
}), /*#__PURE__*/_react.default.createElement(_reactTooltip.Tooltip, {
|
|
490
|
+
id: "tooltip-icon"
|
|
475
491
|
}));
|
|
476
492
|
};
|
|
477
493
|
var _default = exports.default = TableGrid;
|
|
@@ -16,6 +16,8 @@ type Props<T> = GridTableProps<T> & {
|
|
|
16
16
|
originData: T[];
|
|
17
17
|
mergedFilterKeys?: any;
|
|
18
18
|
setMergedFilterKeys?: any;
|
|
19
|
+
handleFullScreen?: any;
|
|
20
|
+
isFullScreen?: boolean;
|
|
19
21
|
};
|
|
20
22
|
declare const Grid: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
21
23
|
export default Grid;
|
|
@@ -16,6 +16,8 @@ type Props<RecordType> = TableProps<RecordType> & {
|
|
|
16
16
|
originData: RecordType[];
|
|
17
17
|
mergedFilterKeys?: any;
|
|
18
18
|
setMergedFilterKeys?: any;
|
|
19
|
+
handleFullScreen?: any;
|
|
20
|
+
isFullScreen?: boolean;
|
|
19
21
|
};
|
|
20
22
|
declare const GridEdit: <RecordType extends AnyObject = AnyObject>(props: Props<RecordType>) => React.JSX.Element;
|
|
21
23
|
export default GridEdit;
|
|
@@ -14,6 +14,8 @@ type Props<T> = GridTableProps<T> & {
|
|
|
14
14
|
originData: T[];
|
|
15
15
|
mergedFilterKeys?: any;
|
|
16
16
|
setMergedFilterKeys?: any;
|
|
17
|
+
handleFullScreen?: any;
|
|
18
|
+
isFullScreen?: boolean;
|
|
17
19
|
};
|
|
18
20
|
declare const Group: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
19
21
|
export default Group;
|
|
@@ -16,6 +16,8 @@ type Props<T> = TableProps<T> & {
|
|
|
16
16
|
originData: T[];
|
|
17
17
|
mergedFilterKeys?: any;
|
|
18
18
|
setMergedFilterKeys?: any;
|
|
19
|
+
handleFullScreen?: any;
|
|
20
|
+
isFullScreen?: boolean;
|
|
19
21
|
};
|
|
20
22
|
declare const InfiniteTable: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
21
23
|
export default InfiniteTable;
|
|
@@ -256,6 +256,7 @@ export interface TableProps<RecordType = AnyObject> extends Omit<RcTableProps<Re
|
|
|
256
256
|
}) => void;
|
|
257
257
|
wrapSettings?: IWrapSettings;
|
|
258
258
|
actionTemplate?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
|
|
259
|
+
fullScreen?: boolean;
|
|
259
260
|
}
|
|
260
261
|
export type PaginationConfig = TablePaginationConfig & {
|
|
261
262
|
currentPage?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-grid-template",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.9",
|
|
4
4
|
"description": "es-grid-template",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
"rc-test": "^7.0.9",
|
|
102
102
|
"react": "^18.2.0",
|
|
103
103
|
"react-dom": "^18.2.0",
|
|
104
|
+
"react-full-screen": "^1.1.1",
|
|
104
105
|
"typescript": "^4.0.5"
|
|
105
106
|
},
|
|
106
107
|
"peerDependencies": {
|