pixel-react-excel-sheet 1.0.33 → 1.0.35

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',
@@ -33174,6 +33175,9 @@ const ExcelContextMenu = ({
33174
33175
  const ExcelFile = ({
33175
33176
  excelData,
33176
33177
  sheetHeight = '100%',
33178
+ heightType = 'page',
33179
+ contextHeight = 0,
33180
+ contextWidth = 0,
33177
33181
  onSave = saveData => {
33178
33182
  saveData();
33179
33183
  }
@@ -33218,6 +33222,10 @@ const ExcelFile = ({
33218
33222
  defaultSheet: [[EmptyRow]]
33219
33223
  });
33220
33224
  const [selectedSheetData, setSelectedSheetData] = React.useState([[EmptyRow]]);
33225
+ const [position, setPosition] = React.useState({
33226
+ x: 0,
33227
+ y: 0
33228
+ });
33221
33229
  const pageRef = React.useRef('');
33222
33230
  const sheetRef = React.useRef(null);
33223
33231
  const checkVal = val => {
@@ -33526,7 +33534,15 @@ const ExcelFile = ({
33526
33534
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
33527
33535
  children: sheetNames.length > 0 && jsxRuntime.jsxs("div", {
33528
33536
  style: {
33529
- position: "relative"
33537
+ position: 'relative'
33538
+ },
33539
+ onContextMenu: event => {
33540
+ const xPosition = heightType === 'page' ? event.pageX : event.clientX;
33541
+ const yPosition = heightType === 'page' ? event.pageY : event.clientY;
33542
+ setPosition({
33543
+ x: xPosition + contextWidth,
33544
+ y: yPosition + contextHeight
33545
+ });
33530
33546
  },
33531
33547
  children: [jsxRuntime.jsx("div", {
33532
33548
  ref: sheetRef,
@@ -33586,7 +33602,8 @@ const ExcelFile = ({
33586
33602
  }, name))
33587
33603
  })]
33588
33604
  }), contextMenu.open && jsxRuntime.jsx(ExcelContextMenu, {
33589
- contextMenu: contextMenu
33605
+ contextMenu: contextMenu,
33606
+ position: position
33590
33607
  }), jsxRuntime.jsx(Toastify, {})]
33591
33608
  })
33592
33609
  });