es-grid-template 1.7.1 → 1.7.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@
2
2
  interface GridProps {
3
3
  $heightTable?: number;
4
4
  $heightScroll?: number;
5
+ $isFullScreen?: boolean;
5
6
  }
6
7
  export declare const GridStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, GridProps>> & string;
7
8
  export {};
@@ -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:", ";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);
5
+ })(["height:", ";padding-top:", ";.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.$isFullScreen ? `20px` : undefined, props => props.$heightScroll ? `${props.$heightScroll}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll - 1}px` : undefined);
@@ -1,12 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import React, { createContext, Fragment, useCallback, useContext, useState } from 'react';
3
- // import {Resizable} from "react-resizable";
4
3
  import 'react-resizable/css/styles.css';
5
4
  import customParseFormat from 'dayjs/plugin/customParseFormat';
6
5
  import { addRowIdArray, booleanOperator, convertFilters, convertFlatColumn, filterDataByColumns4, findItemByKey, findItemPath, flattenArray, getAllRowKey, getFormat, getTypeFilter, groupArrayByColumns, numberOperator, removeColumns, removeInvisibleColumns, stringOperator, translateOption, unFlattenData, updateArrayByKey, updateColumnsByGroup,
7
6
  // updateData,
8
7
  updateOrInsert } from "./hooks";
9
- import { FullScreen, useFullScreenHandle } from "react-full-screen";
10
8
  import dayjs from "dayjs";
11
9
  import 'dayjs/locale/es';
12
10
  import 'dayjs/locale/vi';
@@ -41,6 +39,7 @@ import { Resizable } from "react-resizable";
41
39
  import { faker } from "@faker-js/faker";
42
40
  import InfiniteTable from "./table/InfiniteTable";
43
41
  import useMergedState from "rc-util/es/hooks/useMergedState";
42
+ import Modal from 'antd/es/modal/Modal';
44
43
  dayjs.extend(customParseFormat);
45
44
  const MySwal = withReactContent(Swal);
46
45
  const ASCEND = 'ascend';
@@ -188,7 +187,6 @@ const InternalTable = props => {
188
187
  onSorter,
189
188
  ...rest
190
189
  } = props;
191
- const handle = useFullScreenHandle();
192
190
  const id = React.useMemo(() => {
193
191
  return tableId ?? faker.string.alpha(20);
194
192
  // return tableId ?? newGuid()
@@ -220,6 +218,10 @@ const InternalTable = props => {
220
218
  };
221
219
  }, []);
222
220
  const [scrollHeight, setHeight] = useState(0);
221
+ const [scrollHeight1, setHeight1] = useState(0);
222
+
223
+ // const [isModalOpen, setIsModalOpen] = useState(false)
224
+
223
225
  const local = lang && lang === 'en' ? en : vi;
224
226
  const dateRangeLocale = lang && lang === 'en' ? enDr : viDr;
225
227
  const buddhistLocale = {
@@ -263,7 +265,7 @@ const InternalTable = props => {
263
265
 
264
266
  const [columns, setColumns] = React.useState([]);
265
267
  React.useEffect(() => {
266
- const totalHeight = isFullScreen ? windowSize.innerHeight - 24 : propsHeight;
268
+ const totalHeight = propsHeight;
267
269
  if (totalHeight) {
268
270
  const table = document.querySelector(`#${id}`);
269
271
  const title = table?.querySelector(`.ui-rc-table-title`);
@@ -275,7 +277,22 @@ const InternalTable = props => {
275
277
  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);
276
278
  setHeight(hhh > 0 ? hhh : 0);
277
279
  }
278
- }, [id, propsHeight, columns, editAble, isFullScreen]);
280
+ }, [id, propsHeight, columns, editAble]);
281
+ React.useEffect(() => {
282
+ // const totalHeight = isFullScreen ? windowSize.innerHeight - 50 : propsHeight
283
+ const totalHeight = windowSize.innerHeight - 60;
284
+ if (totalHeight && isFullScreen) {
285
+ const table = document.querySelector(`#${id}`);
286
+ const title = table?.querySelector(`.ui-rc-table-title`);
287
+ const header = table?.querySelector(`.ui-rc-table-header`);
288
+ const paginationE = table?.querySelector(`.ui-rc-pagination`);
289
+ const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
290
+ const summaryE = table?.querySelector(`.ui-rc-table-summary`);
291
+ const scrollbar = table?.querySelector(`.ui-rc-table-tbody-virtual-scrollbar.ui-rc-table-tbody-virtual-scrollbar-horizontal`);
292
+ 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);
293
+ setHeight1(hhh > 0 ? hhh : 0);
294
+ }
295
+ }, [id, isFullScreen, windowSize.innerHeight]);
279
296
  const tableRef = React.useRef(null);
280
297
  React.useEffect(() => {
281
298
  setColumns(propsColumns);
@@ -891,15 +908,18 @@ const InternalTable = props => {
891
908
  const handleChange = (paging, filters, sorter) => {
892
909
  onSorter?.(sorter);
893
910
  };
894
- const fullScreenChange = state => {
895
- setIsFullScreen(state);
911
+
912
+ // const fullScreenChange = (state: boolean) => {
913
+
914
+ // setIsFullScreen(state)
915
+
916
+ // }
917
+
918
+ const handleFullScreen = () => {
919
+ setIsFullScreen(!isFullScreen);
896
920
  };
897
921
  const TableComponent = infiniteScroll ? InfiniteTable : groupAble ? Group : editAble ? GridEdit : Grid;
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, {
922
+ return /*#__PURE__*/React.createElement(Fragment, null, true && /*#__PURE__*/React.createElement(DndContext, {
903
923
  sensors: sensors,
904
924
  modifiers: [restrictToHorizontalAxis],
905
925
  onDragEnd: onDragEnd,
@@ -948,9 +968,10 @@ const InternalTable = props => {
948
968
  } : {
949
969
  y: scrollHeight - (summary ? 1 : 1)
950
970
  } // scroll height auto, không quá 600
951
- ,
952
971
 
953
- height: isFullScreen ? windowSize.innerHeight - 24 : propsHeight,
972
+ // height={isFullScreen ? windowSize.innerHeight - 100 : propsHeight}
973
+ ,
974
+ height: propsHeight,
954
975
  scrollHeight: scrollHeight,
955
976
  components: {
956
977
  header: {
@@ -970,7 +991,116 @@ const InternalTable = props => {
970
991
  mergedFilterKeys: mergedFilterKeys,
971
992
  wrapSettings: wrapSettings,
972
993
  onChange: handleChange,
973
- handleFullScreen: handle,
994
+ handleFullScreen: handleFullScreen,
995
+ isFullScreen: isFullScreen
996
+
997
+ // onChange={(paging, filters, sorter) => {
998
+ // handleChange(sorter)
999
+ // }}
1000
+ })))), /*#__PURE__*/React.createElement(DragOverlay, {
1001
+ style: {
1002
+ minWidth: 100,
1003
+ width: columns[columns.findIndex(i => i.field === dragIndex.active)]?.width
1004
+ }
1005
+ }, /*#__PURE__*/React.createElement("th", {
1006
+ style: {
1007
+ backgroundColor: '#f0f0f0',
1008
+ padding: 6,
1009
+ borderRadius: 6,
1010
+ fontWeight: 500
1011
+ }
1012
+ }, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText))), /*#__PURE__*/React.createElement(Modal, {
1013
+ open: isFullScreen,
1014
+ footer: null,
1015
+ centered: true,
1016
+ closable: true,
1017
+ width: '100%',
1018
+ style: {
1019
+ maxWidth: '100%',
1020
+ height: '100%'
1021
+ },
1022
+ onClose: () => setIsFullScreen(false),
1023
+ onCancel: () => setIsFullScreen(false)
1024
+
1025
+ // destroyOnClose
1026
+ ,
1027
+ styles: {
1028
+ content: {
1029
+ height: '100vh',
1030
+ borderRadius: 0
1031
+ },
1032
+ wrapper: {
1033
+ zIndex: 1060
1034
+ }
1035
+ }
1036
+ }, /*#__PURE__*/React.createElement(DndContext, {
1037
+ sensors: sensors,
1038
+ modifiers: [restrictToHorizontalAxis],
1039
+ onDragEnd: onDragEnd,
1040
+ onDragOver: onDragOver,
1041
+ collisionDetection: closestCenter
1042
+ }, /*#__PURE__*/React.createElement(SortableContext, {
1043
+ items: columns.map(i => i.field),
1044
+ strategy: horizontalListSortingStrategy
1045
+ }, /*#__PURE__*/React.createElement(DragIndexContext.Provider, {
1046
+ value: dragIndex
1047
+ }, /*#__PURE__*/React.createElement(TableComponent, _extends({}, rest, {
1048
+ t: t,
1049
+ id: faker.string.alpha(20),
1050
+ locale: locale,
1051
+ tableRef: tableRef
1052
+ // dataSource={mergedData}
1053
+ ,
1054
+ originData: mergedData
1055
+ // dataSource={filterStates && filterStates.length ? filterData : mergedData}
1056
+ ,
1057
+ dataSource: filterDataByColumns4(mergedData, filterStates, mergedFilterKeys),
1058
+ format: format,
1059
+ columns: mergedColumns,
1060
+ showSorterTooltip: {
1061
+ target: 'sorter-icon'
1062
+ },
1063
+ triggerChangeColumns: triggerChangeColumns,
1064
+ triggerChangeData: triggerChangeData,
1065
+ triggerGroupColumns: triggerGroupColumns,
1066
+ rowKey: rowKey,
1067
+ getRowKey: getRowKey,
1068
+ triggerPaste: triggerPaste,
1069
+ clickHeaderToSort: clickHeaderToSort,
1070
+ groupSetting: groupSetting,
1071
+ groupAble: groupAble,
1072
+ groupColumns: groupColumns,
1073
+ commandClick: triggerCommandClick,
1074
+ summary: summary,
1075
+ pagination: pagination,
1076
+ scroll: scrollHeight1 - (summary ? 1 : 1) < 0 ? {
1077
+ y: 500
1078
+ } : {
1079
+ y: scrollHeight1 - (summary ? 1 : 1)
1080
+ } // scroll height auto, không quá 600
1081
+ ,
1082
+
1083
+ height: windowSize.innerHeight - 35,
1084
+ scrollHeight: scrollHeight1,
1085
+ components: {
1086
+ header: {
1087
+ cell: ResizableTitle
1088
+ },
1089
+ body: {
1090
+ cell: TableBodyCell
1091
+ }
1092
+ },
1093
+ setTooltipContent: setTooltipContent,
1094
+ onFilter: val => {
1095
+ handleOnFilter(val);
1096
+ // triggerFilter?.(convertFilters(val))
1097
+ // onFilter?.(convertFilters(val))
1098
+ },
1099
+ setMergedFilterKeys: setMergedFilterKeys,
1100
+ mergedFilterKeys: mergedFilterKeys,
1101
+ wrapSettings: wrapSettings,
1102
+ onChange: handleChange,
1103
+ handleFullScreen: handleFullScreen,
974
1104
  isFullScreen: isFullScreen
975
1105
 
976
1106
  // onChange={(paging, filters, sorter) => {
@@ -384,16 +384,16 @@ const TableGrid = props => {
384
384
  , {
385
385
  items: (toolbarItems ?? []).filter(it => it.position !== 'Bottom'),
386
386
  mode: 'scroll'
387
- })), fullScreen && (isFullScreen ? /*#__PURE__*/React.createElement(Minimize, {
387
+ })), fullScreen !== false && (isFullScreen ? /*#__PURE__*/React.createElement(Minimize, {
388
388
  fontSize: 16,
389
- onClick: handleFullScreen.exit,
389
+ onClick: () => handleFullScreen?.(),
390
390
  "data-tooltip-id": "tooltip-icon",
391
- "data-tooltip-content": t ? t('Full Screen') : 'Full screen'
391
+ "data-tooltip-content": t ? t('Minimized') : 'Minimized'
392
392
  }) : /*#__PURE__*/React.createElement(Maximize, {
393
393
  fontSize: 16,
394
- onClick: handleFullScreen.enter,
394
+ onClick: () => handleFullScreen?.(),
395
395
  "data-tooltip-id": "tooltip-icon",
396
- "data-tooltip-content": t ? t('Minimized') : 'Minimized'
396
+ "data-tooltip-content": t ? t('Full screen') : 'Full screen'
397
397
  })), /*#__PURE__*/React.createElement("div", {
398
398
  style: {
399
399
  display: 'flex',
@@ -13,11 +13,13 @@ const Grid = props => {
13
13
  height,
14
14
  scrollHeight,
15
15
  rowHoverable,
16
+ isFullScreen,
16
17
  ...rest
17
18
  } = props;
18
19
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
19
20
  $heightTable: height,
20
21
  $heightScroll: scrollHeight,
22
+ $isFullScreen: isFullScreen,
21
23
  style: {
22
24
  position: 'relative'
23
25
  },
@@ -37,6 +39,7 @@ const Grid = props => {
37
39
  }
38
40
  }
39
41
  }, /*#__PURE__*/React.createElement(TableGrid, _extends({}, rest, {
42
+ isFullScreen: isFullScreen,
40
43
  id: id
41
44
  // style={{...style, minHeight: height}}
42
45
  ,
@@ -255,6 +255,7 @@ const GridEdit = props => {
255
255
  mergedFilterKeys,
256
256
  setMergedFilterKeys,
257
257
  wrapSettings,
258
+ isFullScreen,
258
259
  ...rest
259
260
  } = props;
260
261
  const ref = useRef(null);
@@ -2552,6 +2553,7 @@ const GridEdit = props => {
2552
2553
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
2553
2554
  $heightTable: height,
2554
2555
  $heightScroll: scrollHeight,
2556
+ $isFullScreen: isFullScreen,
2555
2557
  style: {
2556
2558
  position: 'relative'
2557
2559
  },
@@ -2673,7 +2675,8 @@ const GridEdit = props => {
2673
2675
  if (rowsSelected && rowsSelected.current.size > 0) {
2674
2676
  addClassCellIndexSelected(rowsSelected.current, id);
2675
2677
  }
2676
- }
2678
+ },
2679
+ isFullScreen: isFullScreen
2677
2680
  })))))), /*#__PURE__*/React.createElement(Toaster, {
2678
2681
  position: toast,
2679
2682
  toastOptions: {
@@ -24,6 +24,7 @@ const Group = props => {
24
24
  groupColumns,
25
25
  triggerGroupColumns,
26
26
  onExpandClick,
27
+ isFullScreen,
27
28
  ...rest
28
29
  } = props;
29
30
  const {
@@ -107,6 +108,7 @@ const Group = props => {
107
108
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
108
109
  $heightTable: height,
109
110
  $heightScroll: scrollHeight,
111
+ $isFullScreen: isFullScreen,
110
112
  style: {
111
113
  position: 'relative'
112
114
  },
@@ -170,7 +172,8 @@ const Group = props => {
170
172
  ...expandable
171
173
  },
172
174
  groupToolbar: groupToolbar,
173
- groupColumns: groupColumns
175
+ groupColumns: groupColumns,
176
+ isFullScreen: isFullScreen
174
177
  }))));
175
178
  };
176
179
  export default Group;
@@ -26,6 +26,7 @@ const InfiniteTable = props => {
26
26
  rowHoverable,
27
27
  pagination,
28
28
  dataSource,
29
+ isFullScreen,
29
30
  ...rest
30
31
  } = props;
31
32
  const {
@@ -68,6 +69,7 @@ const InfiniteTable = props => {
68
69
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
69
70
  $heightTable: height,
70
71
  $heightScroll: scrollHeight,
72
+ $isFullScreen: isFullScreen,
71
73
  style: {
72
74
  position: 'relative'
73
75
  },
@@ -92,7 +94,8 @@ const InfiniteTable = props => {
92
94
  pagination: false,
93
95
  virtual: true,
94
96
  onScroll: handleScroll,
95
- loading: loading
97
+ loading: loading,
98
+ isFullScreen: isFullScreen
96
99
  })))));
97
100
  };
98
101
  export default InfiniteTable;
@@ -2,6 +2,7 @@
2
2
  interface GridProps {
3
3
  $heightTable?: number;
4
4
  $heightScroll?: number;
5
+ $isFullScreen?: boolean;
5
6
  }
6
7
  export declare const GridStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, GridProps>> & string;
7
8
  export {};
@@ -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:", ";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);
12
+ })(["height:", ";padding-top:", ";.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.$isFullScreen ? `20px` : undefined, props => props.$heightScroll ? `${props.$heightScroll}px` : undefined, props => props.$heightScroll ? `${props.$heightScroll - 1}px` : undefined);
@@ -10,7 +10,6 @@ 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");
14
13
  var _dayjs = _interopRequireDefault(require("dayjs"));
15
14
  require("dayjs/locale/es");
16
15
  require("dayjs/locale/vi");
@@ -39,10 +38,9 @@ var _reactResizable = require("react-resizable");
39
38
  var _faker = require("@faker-js/faker");
40
39
  var _InfiniteTable = _interopRequireDefault(require("./table/InfiniteTable"));
41
40
  var _useMergedState = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
41
+ var _Modal = _interopRequireDefault(require("antd/es/modal/Modal"));
42
42
  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); }
43
43
  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; }
44
- // import {Resizable} from "react-resizable";
45
-
46
44
  // import useColumns from "./hooks/useColumns";
47
45
 
48
46
  // import 'rc-master-ui/es/date-range-picker/styles/index.less'
@@ -197,7 +195,6 @@ const InternalTable = props => {
197
195
  onSorter,
198
196
  ...rest
199
197
  } = props;
200
- const handle = (0, _reactFullScreen.useFullScreenHandle)();
201
198
  const id = _react.default.useMemo(() => {
202
199
  return tableId ?? _faker.faker.string.alpha(20);
203
200
  // return tableId ?? newGuid()
@@ -229,6 +226,10 @@ const InternalTable = props => {
229
226
  };
230
227
  }, []);
231
228
  const [scrollHeight, setHeight] = (0, _react.useState)(0);
229
+ const [scrollHeight1, setHeight1] = (0, _react.useState)(0);
230
+
231
+ // const [isModalOpen, setIsModalOpen] = useState(false)
232
+
232
233
  const local = lang && lang === 'en' ? _en_US.default : _vi_VN.default;
233
234
  const dateRangeLocale = lang && lang === 'en' ? _en_US2.default : _vi_VN2.default;
234
235
  const buddhistLocale = {
@@ -272,7 +273,7 @@ const InternalTable = props => {
272
273
 
273
274
  const [columns, setColumns] = _react.default.useState([]);
274
275
  _react.default.useEffect(() => {
275
- const totalHeight = isFullScreen ? windowSize.innerHeight - 24 : propsHeight;
276
+ const totalHeight = propsHeight;
276
277
  if (totalHeight) {
277
278
  const table = document.querySelector(`#${id}`);
278
279
  const title = table?.querySelector(`.ui-rc-table-title`);
@@ -284,7 +285,22 @@ const InternalTable = props => {
284
285
  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);
285
286
  setHeight(hhh > 0 ? hhh : 0);
286
287
  }
287
- }, [id, propsHeight, columns, editAble, isFullScreen]);
288
+ }, [id, propsHeight, columns, editAble]);
289
+ _react.default.useEffect(() => {
290
+ // const totalHeight = isFullScreen ? windowSize.innerHeight - 50 : propsHeight
291
+ const totalHeight = windowSize.innerHeight - 60;
292
+ if (totalHeight && isFullScreen) {
293
+ const table = document.querySelector(`#${id}`);
294
+ const title = table?.querySelector(`.ui-rc-table-title`);
295
+ const header = table?.querySelector(`.ui-rc-table-header`);
296
+ const paginationE = table?.querySelector(`.ui-rc-pagination`);
297
+ const toolbar = table?.querySelector(`.ui-rc-toolbar-bottom`);
298
+ const summaryE = table?.querySelector(`.ui-rc-table-summary`);
299
+ const scrollbar = table?.querySelector(`.ui-rc-table-tbody-virtual-scrollbar.ui-rc-table-tbody-virtual-scrollbar-horizontal`);
300
+ 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);
301
+ setHeight1(hhh > 0 ? hhh : 0);
302
+ }
303
+ }, [id, isFullScreen, windowSize.innerHeight]);
288
304
  const tableRef = _react.default.useRef(null);
289
305
  _react.default.useEffect(() => {
290
306
  setColumns(propsColumns);
@@ -900,15 +916,18 @@ const InternalTable = props => {
900
916
  const handleChange = (paging, filters, sorter) => {
901
917
  onSorter?.(sorter);
902
918
  };
903
- const fullScreenChange = state => {
904
- setIsFullScreen(state);
919
+
920
+ // const fullScreenChange = (state: boolean) => {
921
+
922
+ // setIsFullScreen(state)
923
+
924
+ // }
925
+
926
+ const handleFullScreen = () => {
927
+ setIsFullScreen(!isFullScreen);
905
928
  };
906
929
  const TableComponent = infiniteScroll ? _InfiniteTable.default : groupAble ? _Group.default : editAble ? _GridEdit.default : _Grid.default;
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, {
930
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, true && /*#__PURE__*/_react.default.createElement(_core.DndContext, {
912
931
  sensors: sensors,
913
932
  modifiers: [_modifiers.restrictToHorizontalAxis],
914
933
  onDragEnd: onDragEnd,
@@ -957,9 +976,10 @@ const InternalTable = props => {
957
976
  } : {
958
977
  y: scrollHeight - (summary ? 1 : 1)
959
978
  } // scroll height auto, không quá 600
960
- ,
961
979
 
962
- height: isFullScreen ? windowSize.innerHeight - 24 : propsHeight,
980
+ // height={isFullScreen ? windowSize.innerHeight - 100 : propsHeight}
981
+ ,
982
+ height: propsHeight,
963
983
  scrollHeight: scrollHeight,
964
984
  components: {
965
985
  header: {
@@ -979,7 +999,116 @@ const InternalTable = props => {
979
999
  mergedFilterKeys: mergedFilterKeys,
980
1000
  wrapSettings: wrapSettings,
981
1001
  onChange: handleChange,
982
- handleFullScreen: handle,
1002
+ handleFullScreen: handleFullScreen,
1003
+ isFullScreen: isFullScreen
1004
+
1005
+ // onChange={(paging, filters, sorter) => {
1006
+ // handleChange(sorter)
1007
+ // }}
1008
+ })))), /*#__PURE__*/_react.default.createElement(_core.DragOverlay, {
1009
+ style: {
1010
+ minWidth: 100,
1011
+ width: columns[columns.findIndex(i => i.field === dragIndex.active)]?.width
1012
+ }
1013
+ }, /*#__PURE__*/_react.default.createElement("th", {
1014
+ style: {
1015
+ backgroundColor: '#f0f0f0',
1016
+ padding: 6,
1017
+ borderRadius: 6,
1018
+ fontWeight: 500
1019
+ }
1020
+ }, columns[columns.findIndex(i => i.field === dragIndex.active)]?.headerText))), /*#__PURE__*/_react.default.createElement(_Modal.default, {
1021
+ open: isFullScreen,
1022
+ footer: null,
1023
+ centered: true,
1024
+ closable: true,
1025
+ width: '100%',
1026
+ style: {
1027
+ maxWidth: '100%',
1028
+ height: '100%'
1029
+ },
1030
+ onClose: () => setIsFullScreen(false),
1031
+ onCancel: () => setIsFullScreen(false)
1032
+
1033
+ // destroyOnClose
1034
+ ,
1035
+ styles: {
1036
+ content: {
1037
+ height: '100vh',
1038
+ borderRadius: 0
1039
+ },
1040
+ wrapper: {
1041
+ zIndex: 1060
1042
+ }
1043
+ }
1044
+ }, /*#__PURE__*/_react.default.createElement(_core.DndContext, {
1045
+ sensors: sensors,
1046
+ modifiers: [_modifiers.restrictToHorizontalAxis],
1047
+ onDragEnd: onDragEnd,
1048
+ onDragOver: onDragOver,
1049
+ collisionDetection: _core.closestCenter
1050
+ }, /*#__PURE__*/_react.default.createElement(_sortable.SortableContext, {
1051
+ items: columns.map(i => i.field),
1052
+ strategy: _sortable.horizontalListSortingStrategy
1053
+ }, /*#__PURE__*/_react.default.createElement(DragIndexContext.Provider, {
1054
+ value: dragIndex
1055
+ }, /*#__PURE__*/_react.default.createElement(TableComponent, (0, _extends2.default)({}, rest, {
1056
+ t: t,
1057
+ id: _faker.faker.string.alpha(20),
1058
+ locale: locale,
1059
+ tableRef: tableRef
1060
+ // dataSource={mergedData}
1061
+ ,
1062
+ originData: mergedData
1063
+ // dataSource={filterStates && filterStates.length ? filterData : mergedData}
1064
+ ,
1065
+ dataSource: (0, _hooks.filterDataByColumns4)(mergedData, filterStates, mergedFilterKeys),
1066
+ format: format,
1067
+ columns: mergedColumns,
1068
+ showSorterTooltip: {
1069
+ target: 'sorter-icon'
1070
+ },
1071
+ triggerChangeColumns: triggerChangeColumns,
1072
+ triggerChangeData: triggerChangeData,
1073
+ triggerGroupColumns: triggerGroupColumns,
1074
+ rowKey: rowKey,
1075
+ getRowKey: getRowKey,
1076
+ triggerPaste: triggerPaste,
1077
+ clickHeaderToSort: clickHeaderToSort,
1078
+ groupSetting: groupSetting,
1079
+ groupAble: groupAble,
1080
+ groupColumns: groupColumns,
1081
+ commandClick: triggerCommandClick,
1082
+ summary: summary,
1083
+ pagination: pagination,
1084
+ scroll: scrollHeight1 - (summary ? 1 : 1) < 0 ? {
1085
+ y: 500
1086
+ } : {
1087
+ y: scrollHeight1 - (summary ? 1 : 1)
1088
+ } // scroll height auto, không quá 600
1089
+ ,
1090
+
1091
+ height: windowSize.innerHeight - 35,
1092
+ scrollHeight: scrollHeight1,
1093
+ components: {
1094
+ header: {
1095
+ cell: ResizableTitle
1096
+ },
1097
+ body: {
1098
+ cell: TableBodyCell
1099
+ }
1100
+ },
1101
+ setTooltipContent: setTooltipContent,
1102
+ onFilter: val => {
1103
+ handleOnFilter(val);
1104
+ // triggerFilter?.(convertFilters(val))
1105
+ // onFilter?.(convertFilters(val))
1106
+ },
1107
+ setMergedFilterKeys: setMergedFilterKeys,
1108
+ mergedFilterKeys: mergedFilterKeys,
1109
+ wrapSettings: wrapSettings,
1110
+ onChange: handleChange,
1111
+ handleFullScreen: handleFullScreen,
983
1112
  isFullScreen: isFullScreen
984
1113
 
985
1114
  // onChange={(paging, filters, sorter) => {
@@ -384,16 +384,16 @@ const TableGrid = props => {
384
384
  , {
385
385
  items: (toolbarItems ?? []).filter(it => it.position !== 'Bottom'),
386
386
  mode: 'scroll'
387
- })), fullScreen && (isFullScreen ? /*#__PURE__*/_react.default.createElement(_becoxyIcons.Minimize, {
387
+ })), fullScreen !== false && (isFullScreen ? /*#__PURE__*/_react.default.createElement(_becoxyIcons.Minimize, {
388
388
  fontSize: 16,
389
- onClick: handleFullScreen.exit,
389
+ onClick: () => handleFullScreen?.(),
390
390
  "data-tooltip-id": "tooltip-icon",
391
- "data-tooltip-content": t ? t('Full Screen') : 'Full screen'
391
+ "data-tooltip-content": t ? t('Minimized') : 'Minimized'
392
392
  }) : /*#__PURE__*/_react.default.createElement(_becoxyIcons.Maximize, {
393
393
  fontSize: 16,
394
- onClick: handleFullScreen.enter,
394
+ onClick: () => handleFullScreen?.(),
395
395
  "data-tooltip-id": "tooltip-icon",
396
- "data-tooltip-content": t ? t('Minimized') : 'Minimized'
396
+ "data-tooltip-content": t ? t('Full screen') : 'Full screen'
397
397
  })), /*#__PURE__*/_react.default.createElement("div", {
398
398
  style: {
399
399
  display: 'flex',
@@ -22,11 +22,13 @@ const Grid = props => {
22
22
  height,
23
23
  scrollHeight,
24
24
  rowHoverable,
25
+ isFullScreen,
25
26
  ...rest
26
27
  } = props;
27
28
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_GridStyle.GridStyle, {
28
29
  $heightTable: height,
29
30
  $heightScroll: scrollHeight,
31
+ $isFullScreen: isFullScreen,
30
32
  style: {
31
33
  position: 'relative'
32
34
  },
@@ -46,6 +48,7 @@ const Grid = props => {
46
48
  }
47
49
  }
48
50
  }, /*#__PURE__*/_react.default.createElement(_TableGrid.default, (0, _extends2.default)({}, rest, {
51
+ isFullScreen: isFullScreen,
49
52
  id: id
50
53
  // style={{...style, minHeight: height}}
51
54
  ,
@@ -252,6 +252,7 @@ const GridEdit = props => {
252
252
  mergedFilterKeys,
253
253
  setMergedFilterKeys,
254
254
  wrapSettings,
255
+ isFullScreen,
255
256
  ...rest
256
257
  } = props;
257
258
  const ref = (0, _react.useRef)(null);
@@ -2549,6 +2550,7 @@ const GridEdit = props => {
2549
2550
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_GridStyle.GridStyle, {
2550
2551
  $heightTable: height,
2551
2552
  $heightScroll: scrollHeight,
2553
+ $isFullScreen: isFullScreen,
2552
2554
  style: {
2553
2555
  position: 'relative'
2554
2556
  },
@@ -2670,7 +2672,8 @@ const GridEdit = props => {
2670
2672
  if (rowsSelected && rowsSelected.current.size > 0) {
2671
2673
  (0, _hooks.addClassCellIndexSelected)(rowsSelected.current, id);
2672
2674
  }
2673
- }
2675
+ },
2676
+ isFullScreen: isFullScreen
2674
2677
  })))))), /*#__PURE__*/_react.default.createElement(_reactHotToast.Toaster, {
2675
2678
  position: toast,
2676
2679
  toastOptions: {
@@ -33,6 +33,7 @@ const Group = props => {
33
33
  groupColumns,
34
34
  triggerGroupColumns,
35
35
  onExpandClick,
36
+ isFullScreen,
36
37
  ...rest
37
38
  } = props;
38
39
  const {
@@ -116,6 +117,7 @@ const Group = props => {
116
117
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_GridStyle.GridStyle, {
117
118
  $heightTable: height,
118
119
  $heightScroll: scrollHeight,
120
+ $isFullScreen: isFullScreen,
119
121
  style: {
120
122
  position: 'relative'
121
123
  },
@@ -179,7 +181,8 @@ const Group = props => {
179
181
  ...expandable
180
182
  },
181
183
  groupToolbar: groupToolbar,
182
- groupColumns: groupColumns
184
+ groupColumns: groupColumns,
185
+ isFullScreen: isFullScreen
183
186
  }))));
184
187
  };
185
188
  var _default = exports.default = Group;
@@ -34,6 +34,7 @@ const InfiniteTable = props => {
34
34
  rowHoverable,
35
35
  pagination,
36
36
  dataSource,
37
+ isFullScreen,
37
38
  ...rest
38
39
  } = props;
39
40
  const {
@@ -76,6 +77,7 @@ const InfiniteTable = props => {
76
77
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_GridStyle.GridStyle, {
77
78
  $heightTable: height,
78
79
  $heightScroll: scrollHeight,
80
+ $isFullScreen: isFullScreen,
79
81
  style: {
80
82
  position: 'relative'
81
83
  },
@@ -100,7 +102,8 @@ const InfiniteTable = props => {
100
102
  pagination: false,
101
103
  virtual: true,
102
104
  onScroll: handleScroll,
103
- loading: loading
105
+ loading: loading,
106
+ isFullScreen: isFullScreen
104
107
  })))));
105
108
  };
106
109
  var _default = exports.default = InfiniteTable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.7.1",
3
+ "version": "1.7.21",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",