@leankylin-sheet/react 3.1.33 → 3.1.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.
@@ -1,6 +1,7 @@
1
1
  import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol } from "@leankylin-sheet/core";
2
2
  import { RefValues, SetContextOptions } from "../../context";
3
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
+ replaceVariables: (_map: Record<string, any>) => void;
4
5
  setVariable: (name: string, value: string | number) => void;
5
6
  scrollToHighlightCell: (r: number, c: number, selected: number) => void;
6
7
  getRefs: () => RefValues;
@@ -45,6 +46,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
45
46
  getHtmlByRange: (range: Range, options?: api.CommonOptions) => string | null;
46
47
  setSelection: (range: Range, options?: api.CommonOptions) => void;
47
48
  setCellValuesByRange: (data: any[][], range: SingleRange, options?: api.CommonOptions) => void;
49
+ setCellValues: (data: any[], options?: api.CommonOptions) => void;
48
50
  setCellFormatByRange: (attr: keyof Cell, value: any, range: Range | SingleRange, options?: api.CommonOptions) => void;
49
51
  mergeCells: (ranges: Range, type: string, options?: api.CommonOptions) => void;
50
52
  cancelMerge: (ranges: Range, options?: api.CommonOptions) => void;
@@ -9,6 +9,7 @@ type AdditionalProps = {
9
9
  onOp?: (op: Op[]) => void;
10
10
  };
11
11
  declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalProps & React.RefAttributes<{
12
+ replaceVariables: (_map: Record<string, any>) => void;
12
13
  setVariable: (name: string, value: string | number) => void;
13
14
  scrollToHighlightCell: (r: number, c: number, selected: number) => void;
14
15
  getRefs: () => RefValues;
@@ -53,6 +54,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
53
54
  getHtmlByRange: (range: import("@leankylin-sheet/core").Range, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => string | null;
54
55
  setSelection: (range: import("@leankylin-sheet/core").Range, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
55
56
  setCellValuesByRange: (data: any[][], range: import("@leankylin-sheet/core").SingleRange, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
57
+ setCellValues: (data: any[], options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
56
58
  setCellFormatByRange: (attr: "v" | "m" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "rt" | "ps" | "hl" | keyof import("@leankylin-sheet/core").CellStyle, value: any, range: import("@leankylin-sheet/core").SingleRange | import("@leankylin-sheet/core").Range, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
57
59
  mergeCells: (ranges: import("@leankylin-sheet/core").Range, type: string, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
58
60
  cancelMerge: (ranges: import("@leankylin-sheet/core").Range, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
package/dist/index.esm.js CHANGED
@@ -8031,11 +8031,11 @@ var ContextMenu = function ContextMenu() {
8031
8031
  left: contextMenu.x,
8032
8032
  top: contextMenu.y
8033
8033
  }
8034
- }, context.contextMenu.headerMenu === true ? settings.headerContextMenu.map(function (menu, i) {
8034
+ }, renderCustom(), context.contextMenu.headerMenu === true ? settings.headerContextMenu.map(function (menu, i) {
8035
8035
  return getMenuElement(menu, i);
8036
8036
  }) : settings.cellContextMenu().map(function (menu, i) {
8037
8037
  return getMenuElement(menu, i);
8038
- }), renderCustom());
8038
+ }));
8039
8039
  };
8040
8040
 
8041
8041
  var SVGDefines = function SVGDefines() {
@@ -9722,6 +9722,9 @@ var MoreItemsContaier = function MoreItemsContaier(_ref) {
9722
9722
 
9723
9723
  function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, refs) {
9724
9724
  return {
9725
+ replaceVariables: function replaceVariables(_map) {
9726
+ context.formulaCache.parser.replaceVariables(_map);
9727
+ },
9725
9728
  setVariable: function setVariable(name, value) {
9726
9729
  context.formulaCache.parser.setVariable(name, value);
9727
9730
  },
@@ -9915,6 +9918,12 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
9915
9918
  return api.setCellValuesByRange(draftCtx, data, range, cellInput, options);
9916
9919
  });
9917
9920
  },
9921
+ setCellValues: function setCellValues(data) {
9922
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9923
+ return setContext(function (draftCtx) {
9924
+ return api.setCellValues(draftCtx, data, cellInput, options);
9925
+ });
9926
+ },
9918
9927
  setCellFormatByRange: function setCellFormatByRange(attr, value, range) {
9919
9928
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
9920
9929
  return setContext(function (draftCtx) {
package/dist/index.js CHANGED
@@ -8041,11 +8041,11 @@ var ContextMenu = function ContextMenu() {
8041
8041
  left: contextMenu.x,
8042
8042
  top: contextMenu.y
8043
8043
  }
8044
- }, context.contextMenu.headerMenu === true ? settings.headerContextMenu.map(function (menu, i) {
8044
+ }, renderCustom(), context.contextMenu.headerMenu === true ? settings.headerContextMenu.map(function (menu, i) {
8045
8045
  return getMenuElement(menu, i);
8046
8046
  }) : settings.cellContextMenu().map(function (menu, i) {
8047
8047
  return getMenuElement(menu, i);
8048
- }), renderCustom());
8048
+ }));
8049
8049
  };
8050
8050
 
8051
8051
  var SVGDefines = function SVGDefines() {
@@ -9732,6 +9732,9 @@ var MoreItemsContaier = function MoreItemsContaier(_ref) {
9732
9732
 
9733
9733
  function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, refs) {
9734
9734
  return {
9735
+ replaceVariables: function replaceVariables(_map) {
9736
+ context.formulaCache.parser.replaceVariables(_map);
9737
+ },
9735
9738
  setVariable: function setVariable(name, value) {
9736
9739
  context.formulaCache.parser.setVariable(name, value);
9737
9740
  },
@@ -9925,6 +9928,12 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
9925
9928
  return core.api.setCellValuesByRange(draftCtx, data, range, cellInput, options);
9926
9929
  });
9927
9930
  },
9931
+ setCellValues: function setCellValues(data) {
9932
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9933
+ return setContext(function (draftCtx) {
9934
+ return core.api.setCellValues(draftCtx, data, cellInput, options);
9935
+ });
9936
+ },
9928
9937
  setCellFormatByRange: function setCellFormatByRange(attr, value, range) {
9929
9938
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
9930
9939
  return setContext(function (draftCtx) {
package/dist/index.umd.js CHANGED
@@ -101353,11 +101353,11 @@
101353
101353
  left: contextMenu.x,
101354
101354
  top: contextMenu.y
101355
101355
  }
101356
- }, context.contextMenu.headerMenu === true ? settings.headerContextMenu.map(function (menu, i) {
101356
+ }, renderCustom(), context.contextMenu.headerMenu === true ? settings.headerContextMenu.map(function (menu, i) {
101357
101357
  return getMenuElement(menu, i);
101358
101358
  }) : settings.cellContextMenu().map(function (menu, i) {
101359
101359
  return getMenuElement(menu, i);
101360
- }), renderCustom());
101360
+ }));
101361
101361
  };
101362
101362
 
101363
101363
  var SVGDefines = function SVGDefines() {
@@ -103044,6 +103044,9 @@
103044
103044
 
103045
103045
  function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, refs) {
103046
103046
  return {
103047
+ replaceVariables: function replaceVariables(_map) {
103048
+ context.formulaCache.parser.replaceVariables(_map);
103049
+ },
103047
103050
  setVariable: function setVariable(name, value) {
103048
103051
  context.formulaCache.parser.setVariable(name, value);
103049
103052
  },
@@ -103237,6 +103240,12 @@
103237
103240
  return index.setCellValuesByRange(draftCtx, data, range, cellInput, options);
103238
103241
  });
103239
103242
  },
103243
+ setCellValues: function setCellValues(data) {
103244
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
103245
+ return setContext(function (draftCtx) {
103246
+ return index.setCellValues(draftCtx, data, cellInput, options);
103247
+ });
103248
+ },
103240
103249
  setCellFormatByRange: function setCellFormatByRange(attr, value, range) {
103241
103250
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
103242
103251
  return setContext(function (draftCtx) {