@leankylin-sheet/react 1.2.1 → 1.2.3

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,6 +1,7 @@
1
1
  import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol } from "@leankylin-sheet/core";
2
- import { SetContextOptions } from "../../context";
3
- export declare function generateAPIs(context: Context, setContext: (recipe: (ctx: Context) => void, options?: SetContextOptions) => void, handleUndo: () => void, handleRedo: () => void, settings: Required<Settings>, cellInput: HTMLDivElement | null, scrollbarX: HTMLDivElement | null, scrollbarY: HTMLDivElement | null): {
2
+ import { RefValues, SetContextOptions } from "../../context";
3
+ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx: Context) => void, options?: SetContextOptions) => void, handleUndo: () => void, handleRedo: () => void, settings: Required<Settings>, cellInput: HTMLDivElement | null, scrollbarX: HTMLDivElement | null, scrollbarY: HTMLDivElement | null, refs: RefValues): {
4
+ getRefs: () => RefValues;
4
5
  applyOp: (ops: Op[]) => void;
5
6
  getCellValue: (row: number, column: number, options?: api.CommonOptions & {
6
7
  type?: keyof Cell;
@@ -1,6 +1,7 @@
1
1
  import { Settings, CellWithRowAndCol, Sheet as SheetType, Op, CellMatrix } from "@leankylin-sheet/core";
2
2
  import React from "react";
3
3
  import "./index.css";
4
+ import { RefValues } from "../../context";
4
5
  import { generateAPIs } from "./api";
5
6
  export type WorkbookInstance = ReturnType<typeof generateAPIs>;
6
7
  type AdditionalProps = {
@@ -8,6 +9,7 @@ type AdditionalProps = {
8
9
  onOp?: (op: Op[]) => void;
9
10
  };
10
11
  declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalProps & React.RefAttributes<{
12
+ getRefs: () => RefValues;
11
13
  applyOp: (ops: Op[]) => void;
12
14
  getCellValue: (row: number, column: number, options?: import("@leankylin-sheet/core/dist/api").CommonOptions & {
13
15
  type?: "v" | "m" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "rt" | "ps" | "hl" | keyof import("@leankylin-sheet/core").CellStyle | undefined;
package/dist/index.css CHANGED
@@ -475,7 +475,7 @@ html::-webkit-scrollbar-button {
475
475
 
476
476
  .luckysheet-bottom-controll-row {
477
477
  position: absolute;
478
- height: 50px;
478
+ /* height: 50px; */
479
479
  bottom: 30px;
480
480
  left: 0px;
481
481
  z-index: 1000;
@@ -475,7 +475,7 @@ html::-webkit-scrollbar-button {
475
475
 
476
476
  .luckysheet-bottom-controll-row {
477
477
  position: absolute;
478
- height: 50px;
478
+ /* height: 50px; */
479
479
  bottom: 30px;
480
480
  left: 0px;
481
481
  z-index: 1000;
package/dist/index.esm.js CHANGED
@@ -3627,7 +3627,7 @@ var Sheet = function Sheet(_ref) {
3627
3627
  if (settings.devicePixelRatio === 0) {
3628
3628
  draftCtx.devicePixelRatio = (globalThis || window).devicePixelRatio;
3629
3629
  }
3630
- updateContextWithSheetData(draftCtx, data);
3630
+ updateContextWithSheetData(draftCtx, data, settings.blank);
3631
3631
  updateContextWithCanvas(draftCtx, refs.canvas.current, placeholderRef.current);
3632
3632
  });
3633
3633
  }
@@ -3635,13 +3635,13 @@ var Sheet = function Sheet(_ref) {
3635
3635
  return function () {
3636
3636
  window.removeEventListener("resize", resize);
3637
3637
  };
3638
- }, [data, refs.canvas, setContext, settings.devicePixelRatio]);
3638
+ }, [data, refs.canvas, setContext, settings.devicePixelRatio, settings.blank]);
3639
3639
  useEffect(function () {
3640
3640
  if (!data) return;
3641
3641
  setContext(function (draftCtx) {
3642
- return updateContextWithSheetData(draftCtx, data);
3642
+ return updateContextWithSheetData(draftCtx, data, settings.blank);
3643
3643
  });
3644
- }, [(_context$config = context.config) === null || _context$config === void 0 ? void 0 : _context$config.rowlen, (_context$config2 = context.config) === null || _context$config2 === void 0 ? void 0 : _context$config2.columnlen, (_context$config3 = context.config) === null || _context$config3 === void 0 ? void 0 : _context$config3.rowhidden, context.config.colhidden, data, context.zoomRatio, setContext]);
3644
+ }, [(_context$config = context.config) === null || _context$config === void 0 ? void 0 : _context$config.rowlen, (_context$config2 = context.config) === null || _context$config2 === void 0 ? void 0 : _context$config2.columnlen, (_context$config3 = context.config) === null || _context$config3 === void 0 ? void 0 : _context$config3.rowhidden, context.config.colhidden, data, context.zoomRatio, setContext, settings.blank]);
3645
3645
  useEffect(function () {
3646
3646
  setContext(function (draftCtx) {
3647
3647
  return updateContextWithCanvas(draftCtx, refs.canvas.current, placeholderRef.current);
@@ -9283,8 +9283,11 @@ var MoreItemsContaier = function MoreItemsContaier(_ref) {
9283
9283
  }, children);
9284
9284
  };
9285
9285
 
9286
- function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY) {
9286
+ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, refs) {
9287
9287
  return {
9288
+ getRefs: function getRefs() {
9289
+ return refs;
9290
+ },
9288
9291
  applyOp: function applyOp(ops) {
9289
9292
  setContext(function (ctx_) {
9290
9293
  var _ops$, _ops$$path, _ops$2, _ops$2$path, _ops$3;
@@ -10724,7 +10727,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
10724
10727
  };
10725
10728
  }, [onPaste]);
10726
10729
  useImperativeHandle(ref, function () {
10727
- return generateAPIs(context, setContextWithProduce, handleUndo, handleRedo, mergedSettings, cellInput.current, scrollbarX.current, scrollbarY.current);
10730
+ return generateAPIs(context, setContextWithProduce, handleUndo, handleRedo, mergedSettings, cellInput.current, scrollbarX.current, scrollbarY.current, refs);
10728
10731
  }, [context, setContextWithProduce, handleUndo, handleRedo, mergedSettings]);
10729
10732
  var i = getSheetIndex(context, context.currentSheetId);
10730
10733
  if (i == null) {
package/dist/index.js CHANGED
@@ -3637,7 +3637,7 @@ var Sheet = function Sheet(_ref) {
3637
3637
  if (settings.devicePixelRatio === 0) {
3638
3638
  draftCtx.devicePixelRatio = (globalThis || window).devicePixelRatio;
3639
3639
  }
3640
- core.updateContextWithSheetData(draftCtx, data);
3640
+ core.updateContextWithSheetData(draftCtx, data, settings.blank);
3641
3641
  core.updateContextWithCanvas(draftCtx, refs.canvas.current, placeholderRef.current);
3642
3642
  });
3643
3643
  }
@@ -3645,13 +3645,13 @@ var Sheet = function Sheet(_ref) {
3645
3645
  return function () {
3646
3646
  window.removeEventListener("resize", resize);
3647
3647
  };
3648
- }, [data, refs.canvas, setContext, settings.devicePixelRatio]);
3648
+ }, [data, refs.canvas, setContext, settings.devicePixelRatio, settings.blank]);
3649
3649
  React.useEffect(function () {
3650
3650
  if (!data) return;
3651
3651
  setContext(function (draftCtx) {
3652
- return core.updateContextWithSheetData(draftCtx, data);
3652
+ return core.updateContextWithSheetData(draftCtx, data, settings.blank);
3653
3653
  });
3654
- }, [(_context$config = context.config) === null || _context$config === void 0 ? void 0 : _context$config.rowlen, (_context$config2 = context.config) === null || _context$config2 === void 0 ? void 0 : _context$config2.columnlen, (_context$config3 = context.config) === null || _context$config3 === void 0 ? void 0 : _context$config3.rowhidden, context.config.colhidden, data, context.zoomRatio, setContext]);
3654
+ }, [(_context$config = context.config) === null || _context$config === void 0 ? void 0 : _context$config.rowlen, (_context$config2 = context.config) === null || _context$config2 === void 0 ? void 0 : _context$config2.columnlen, (_context$config3 = context.config) === null || _context$config3 === void 0 ? void 0 : _context$config3.rowhidden, context.config.colhidden, data, context.zoomRatio, setContext, settings.blank]);
3655
3655
  React.useEffect(function () {
3656
3656
  setContext(function (draftCtx) {
3657
3657
  return core.updateContextWithCanvas(draftCtx, refs.canvas.current, placeholderRef.current);
@@ -9293,8 +9293,11 @@ var MoreItemsContaier = function MoreItemsContaier(_ref) {
9293
9293
  }, children);
9294
9294
  };
9295
9295
 
9296
- function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY) {
9296
+ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, refs) {
9297
9297
  return {
9298
+ getRefs: function getRefs() {
9299
+ return refs;
9300
+ },
9298
9301
  applyOp: function applyOp(ops) {
9299
9302
  setContext(function (ctx_) {
9300
9303
  var _ops$, _ops$$path, _ops$2, _ops$2$path, _ops$3;
@@ -10734,7 +10737,7 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
10734
10737
  };
10735
10738
  }, [onPaste]);
10736
10739
  React.useImperativeHandle(ref, function () {
10737
- return generateAPIs(context, setContextWithProduce, handleUndo, handleRedo, mergedSettings, cellInput.current, scrollbarX.current, scrollbarY.current);
10740
+ return generateAPIs(context, setContextWithProduce, handleUndo, handleRedo, mergedSettings, cellInput.current, scrollbarX.current, scrollbarY.current, refs);
10738
10741
  }, [context, setContextWithProduce, handleUndo, handleRedo, mergedSettings]);
10739
10742
  var i = core.getSheetIndex(context, context.currentSheetId);
10740
10743
  if (i == null) {
@@ -475,7 +475,7 @@ html::-webkit-scrollbar-button {
475
475
 
476
476
  .luckysheet-bottom-controll-row {
477
477
  position: absolute;
478
- height: 50px;
478
+ /* height: 50px; */
479
479
  bottom: 30px;
480
480
  left: 0px;
481
481
  z-index: 1000;