pixel-react-excel-sheet 1.0.33 → 1.0.34

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/lib/index.js CHANGED
@@ -33141,17 +33141,18 @@ const Spreadsheet = props => {
33141
33141
  var css_248z$l = ".ff-excel-sheet {\n position: relative;\n top: 0;\n}\n\n.ff-excel-sheet-bar {\n position: static;\n max-width: 100%;\n margin-left: 60px;\n display: flex;\n height: 36px;\n align-items: center;\n color: var(--brand2-color);\n box-shadow: 0px 0px 4px -1px var(--toggle-strip-shadow);\n}\n.ff-excel-sheet-bar .ff-excel-add-sheet-set {\n position: relative;\n background-color: var(--tab-bg-color);\n display: flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n top: 0;\n left: 0px;\n height: 100%;\n}\n.ff-excel-sheet-bar .ff-excel-add-sheet-set .ff-excel-add-sheet-icon {\n padding: 8px 10px;\n}\n.ff-excel-sheet-bar .ff-excel-tab-container {\n height: 36px;\n display: flex;\n overflow-x: auto;\n align-items: center;\n scrollbar-width: none;\n}\n.ff-excel-sheet-bar .ff-excel-tab-container .ff-excel-tab-list {\n margin-top: 2px;\n padding: 10px 9px;\n min-width: max-content;\n cursor: pointer;\n display: flex;\n background-color: var(--hover-color);\n}\n.ff-excel-sheet-bar .ff-excel-tab-container .ff-excel-tab-list.active {\n background-color: var(--excel-sheet-button-color);\n}\n.ff-excel-sheet-bar .ff-excel-tab-container .ff-excel-tab-list:focus {\n outline: none;\n text-decoration: none;\n}";
33142
33142
  styleInject(css_248z$l);
33143
33143
 
33144
- var css_248z$k = ".ff-excel-menu {\n position: absolute;\n border: 1px solid var(--option-card-border-color);\n background: var(--option-card-bg-color);\n border-radius: 4px;\n margin: 2px;\n min-height: 32px;\n min-width: 111px;\n white-space: nowrap;\n z-index: 2000;\n}\n.ff-excel-menu .ff-excel-menu-options {\n color: var(--text-color);\n cursor: pointer;\n border-radius: 3px;\n display: flex;\n align-items: center;\n padding: 4px;\n gap: 8px;\n}\n.ff-excel-menu .ff-excel-menu-options:hover {\n background-color: var(--hover-color);\n}\n.ff-excel-menu .ff-excel-menu-options label {\n cursor: pointer;\n}";
33144
+ var css_248z$k = ".ff-excel-menu {\n position: fixed;\n border: 1px solid var(--option-card-border-color);\n background: var(--option-card-bg-color);\n border-radius: 4px;\n margin: 2px;\n min-height: 32px;\n min-width: 111px;\n white-space: nowrap;\n z-index: 2000;\n}\n.ff-excel-menu .ff-excel-menu-options {\n color: var(--text-color);\n cursor: pointer;\n border-radius: 3px;\n display: flex;\n align-items: center;\n padding: 4px;\n gap: 8px;\n}\n.ff-excel-menu .ff-excel-menu-options:hover {\n background-color: var(--hover-color);\n}\n.ff-excel-menu .ff-excel-menu-options label {\n cursor: pointer;\n}";
33145
33145
  styleInject(css_248z$k);
33146
33146
 
33147
33147
  const ExcelContextMenu = ({
33148
- contextMenu
33148
+ contextMenu,
33149
+ position
33149
33150
  }) => {
33150
33151
  return jsxRuntime.jsx("div", {
33151
33152
  className: "ff-excel-menu",
33152
33153
  style: {
33153
- left: contextMenu.position.x,
33154
- top: contextMenu.position.y
33154
+ left: position.x,
33155
+ top: position.y
33155
33156
  },
33156
33157
  children: contextMenu.options.map(option => jsxRuntime.jsxs("div", {
33157
33158
  className: 'ff-excel-menu-options',
@@ -33218,6 +33219,10 @@ const ExcelFile = ({
33218
33219
  defaultSheet: [[EmptyRow]]
33219
33220
  });
33220
33221
  const [selectedSheetData, setSelectedSheetData] = React.useState([[EmptyRow]]);
33222
+ const [position, setPosition] = React.useState({
33223
+ x: 0,
33224
+ y: 0
33225
+ });
33221
33226
  const pageRef = React.useRef('');
33222
33227
  const sheetRef = React.useRef(null);
33223
33228
  const checkVal = val => {
@@ -33514,22 +33519,32 @@ const ExcelFile = ({
33514
33519
  handleSheetChange(name, index);
33515
33520
  }
33516
33521
  });
33522
+ setPosition({
33523
+ x: event.clientX - 350,
33524
+ y: event.clientY
33525
+ });
33517
33526
  setContextMenu({
33518
33527
  open: true,
33519
33528
  position: {
33520
- x: event.pageX,
33521
- y: event.pageY
33529
+ x: event.clientX - 350,
33530
+ y: event.clientY - 500
33522
33531
  },
33523
33532
  options: options
33524
33533
  });
33525
33534
  };
33526
33535
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
33527
33536
  children: sheetNames.length > 0 && jsxRuntime.jsxs("div", {
33537
+ ref: sheetRef,
33538
+ onContextMenu: event => {
33539
+ setPosition({
33540
+ x: event.clientX - 350,
33541
+ y: event.clientY
33542
+ });
33543
+ },
33528
33544
  style: {
33529
- position: "relative"
33545
+ position: 'relative'
33530
33546
  },
33531
33547
  children: [jsxRuntime.jsx("div", {
33532
- ref: sheetRef,
33533
33548
  className: "ff-excel-sheet",
33534
33549
  children: jsxRuntime.jsx(Spreadsheet, {
33535
33550
  sheetHeight: sheetHeight,
@@ -33586,7 +33601,8 @@ const ExcelFile = ({
33586
33601
  }, name))
33587
33602
  })]
33588
33603
  }), contextMenu.open && jsxRuntime.jsx(ExcelContextMenu, {
33589
- contextMenu: contextMenu
33604
+ contextMenu: contextMenu,
33605
+ position: position
33590
33606
  }), jsxRuntime.jsx(Toastify, {})]
33591
33607
  })
33592
33608
  });