pixel-react-excel-sheet 1.0.34 → 1.0.36

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.
@@ -154,4 +154,5 @@ export interface DrawerProps {
154
154
  * Custom overflow for the drawer
155
155
  */
156
156
  overflow?: string;
157
+ onCollapes?: (value: boolean) => void;
157
158
  }
@@ -5,6 +5,7 @@ interface ExcelFileProps {
5
5
  excelData: {
6
6
  sheets: WorkSheet[];
7
7
  };
8
+ heightType?: string;
8
9
  /** Optional: Provide context menu options for actions like right-click */
9
10
  contextOption?: {
10
11
  name: string;
@@ -15,6 +16,8 @@ interface ExcelFileProps {
15
16
  toolbar?: 'show' | 'disable' | 'hide';
16
17
  /** Callback function to save the Excel data */
17
18
  onSave?: (saveData: any) => void;
19
+ contextHeight?: number;
20
+ contextWidth?: number;
18
21
  /** Set your dynamic sheet Height*/
19
22
  sheetHeight?: string;
20
23
  }
package/lib/index.d.ts CHANGED
@@ -303,6 +303,7 @@ interface DrawerProps {
303
303
  * Custom overflow for the drawer
304
304
  */
305
305
  overflow?: string;
306
+ onCollapes?: (value: boolean) => void;
306
307
  }
307
308
 
308
309
  declare const Drawer: FC<DrawerProps>;
@@ -2484,6 +2485,7 @@ interface ExcelFileProps {
2484
2485
  excelData: {
2485
2486
  sheets: WorkSheet[];
2486
2487
  };
2488
+ heightType?: string;
2487
2489
  /** Optional: Provide context menu options for actions like right-click */
2488
2490
  contextOption?: {
2489
2491
  name: string;
@@ -2494,6 +2496,8 @@ interface ExcelFileProps {
2494
2496
  toolbar?: 'show' | 'disable' | 'hide';
2495
2497
  /** Callback function to save the Excel data */
2496
2498
  onSave?: (saveData: any) => void;
2499
+ contextHeight?: number;
2500
+ contextWidth?: number;
2497
2501
  /** Set your dynamic sheet Height*/
2498
2502
  sheetHeight?: string;
2499
2503
  }
package/lib/index.esm.js CHANGED
@@ -1102,6 +1102,7 @@ const Drawer = ({
1102
1102
  leftSecondaryButtonProps = {},
1103
1103
  showEditButton = false,
1104
1104
  onEdit = () => {},
1105
+ onCollapes = () => {},
1105
1106
  overlay = false,
1106
1107
  isFooterRequired = true,
1107
1108
  footerContent = null,
@@ -1128,6 +1129,7 @@ const Drawer = ({
1128
1129
  const handleEsc = useEscapeKey('Escape');
1129
1130
  handleEsc(onClose);
1130
1131
  const toggleExpand = () => {
1132
+ onCollapes(isExpanded);
1131
1133
  setIsExpanded(prev => !prev);
1132
1134
  };
1133
1135
  const onCancel = () => {
@@ -33155,6 +33157,9 @@ const ExcelContextMenu = ({
33155
33157
  const ExcelFile = ({
33156
33158
  excelData,
33157
33159
  sheetHeight = '100%',
33160
+ heightType = 'page',
33161
+ contextHeight = 0,
33162
+ contextWidth = 0,
33158
33163
  onSave = saveData => {
33159
33164
  saveData();
33160
33165
  }
@@ -33486,8 +33491,10 @@ const ExcelFile = ({
33486
33491
  }, [contextMenu.open]);
33487
33492
  React__default.useEffect(() => {
33488
33493
  document.addEventListener('click', handleClickOutside);
33494
+ document.addEventListener('contextmenu', handleClickOutside);
33489
33495
  return () => {
33490
33496
  document.removeEventListener('click', handleClickOutside);
33497
+ document.removeEventListener('contextmenu', handleClickOutside);
33491
33498
  };
33492
33499
  }, [handleClickOutside]);
33493
33500
  const contextClick = event => {
@@ -33499,32 +33506,30 @@ const ExcelFile = ({
33499
33506
  handleSheetChange(name, index);
33500
33507
  }
33501
33508
  });
33502
- setPosition({
33503
- x: event.clientX - 350,
33504
- y: event.clientY
33505
- });
33506
33509
  setContextMenu({
33507
33510
  open: true,
33508
33511
  position: {
33509
- x: event.clientX - 350,
33510
- y: event.clientY - 500
33512
+ x: event.pageX,
33513
+ y: event.pageY
33511
33514
  },
33512
33515
  options: options
33513
33516
  });
33514
33517
  };
33515
33518
  return jsx(Fragment, {
33516
33519
  children: sheetNames.length > 0 && jsxs("div", {
33517
- ref: sheetRef,
33520
+ style: {
33521
+ position: 'relative'
33522
+ },
33518
33523
  onContextMenu: event => {
33524
+ const xPosition = heightType === 'page' ? event.pageX : event.clientX;
33525
+ const yPosition = heightType === 'page' ? event.pageY : event.clientY;
33519
33526
  setPosition({
33520
- x: event.clientX - 350,
33521
- y: event.clientY
33527
+ x: xPosition + contextWidth,
33528
+ y: yPosition + contextHeight
33522
33529
  });
33523
33530
  },
33524
- style: {
33525
- position: 'relative'
33526
- },
33527
33531
  children: [jsx("div", {
33532
+ ref: sheetRef,
33528
33533
  className: "ff-excel-sheet",
33529
33534
  children: jsx(Spreadsheet, {
33530
33535
  sheetHeight: sheetHeight,