@zhenliang/sheet 0.1.7-4.beta.1 → 0.1.7-4.beta.2

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.
@@ -1,3 +1,9 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
8
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
9
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -231,6 +237,21 @@ var Sheet = function Sheet(props) {
231
237
  useMouseEvent(dispatch, sheetWrapperRef);
232
238
  useKeyBoardEvent(dispatch, sheetWrapperRef);
233
239
  var menu = useContextMenu(dispatch, sheetWrapperRef, !!ContextMenu, contextMenuRef);
240
+ var menuCell = useMemo(function () {
241
+ var _data$cellPosition$ro, _data$cellPosition$ro2, _data$cellPosition$ro3;
242
+ var cellPosition = menu.cellPosition,
243
+ showMenu = menu.showMenu;
244
+ if (!showMenu) {
245
+ return cellPosition;
246
+ }
247
+ var _ref2 = (_data$cellPosition$ro = data === null || data === void 0 || (_data$cellPosition$ro2 = data[cellPosition.row]) === null || _data$cellPosition$ro2 === void 0 ? void 0 : _data$cellPosition$ro2[cellPosition.col - 1 - ((_data$cellPosition$ro3 = data[cellPosition.row][0].col) !== null && _data$cellPosition$ro3 !== void 0 ? _data$cellPosition$ro3 : 0)]) !== null && _data$cellPosition$ro !== void 0 ? _data$cellPosition$ro : {},
248
+ id = _ref2.id,
249
+ dataIndex = _ref2.dataIndex;
250
+ return _objectSpread(_objectSpread({}, cellPosition), {}, {
251
+ id: id,
252
+ key: dataIndex
253
+ });
254
+ }, [data, menu.cellPosition]);
234
255
  var _useRemarkContainer = useRemarkContainer(sheetWrapperRef, state.start, state.editing, showRemark),
235
256
  remarkInfo = _useRemarkContainer.remarkInfo;
236
257
 
@@ -393,7 +414,7 @@ var Sheet = function Sheet(props) {
393
414
  }, "sheet"), /*#__PURE__*/_jsx(Menu, {
394
415
  ref: contextMenuRef,
395
416
  position: menu.position,
396
- cell: menu.cellPosition,
417
+ cell: menuCell,
397
418
  showMenu: menu.showMenu,
398
419
  contextMenu: ContextMenu,
399
420
  onContextMenu: onContextMenu
@@ -91,7 +91,7 @@ export type MenuRenderProps = {
91
91
  top: number;
92
92
  left: number;
93
93
  };
94
- cell?: CellPosition;
94
+ cell?: CellPosition & Partial<Cell>;
95
95
  onContextMenu?: (event: any) => void;
96
96
  children?: ReactNode | ReactNode[];
97
97
  target?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.74.beta.1",
3
+ "version": "0.1.74.beta.2",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",