@fileverse-dev/fortune-react 1.2.6 → 1.2.9

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.
@@ -633,7 +633,7 @@ var ContextMenu = function ContextMenu() {
633
633
  }), /*#__PURE__*/React.createElement("div", null, rightclick.deleteSelected, rightclick.row))));
634
634
  }
635
635
  if (name === "hide-row") {
636
- return (selection === null || selection === void 0 ? void 0 : selection.row_select) && ["hideSelected", "showHide"].map(function (item) {
636
+ return (selection === null || selection === void 0 ? void 0 : selection.row_select) && ["hideSelected"].map(function (item) {
637
637
  return /*#__PURE__*/React.createElement(Menu, {
638
638
  key: item,
639
639
  onClick: function onClick() {
@@ -658,7 +658,7 @@ var ContextMenu = function ContextMenu() {
658
658
  });
659
659
  }
660
660
  if (name === "hide-column") {
661
- return (selection === null || selection === void 0 ? void 0 : selection.column_select) === true && ["hideSelected", "showHide"].map(function (item) {
661
+ return (selection === null || selection === void 0 ? void 0 : selection.column_select) === true && ["hideSelected"].map(function (item) {
662
662
  return /*#__PURE__*/React.createElement(Menu, {
663
663
  key: item,
664
664
  onClick: function onClick() {
@@ -179,21 +179,30 @@ var ColumnHeader = function ColumnHeader() {
179
179
  var showColumn = function showColumn(e, item) {
180
180
  var _a, _b;
181
181
  if (sheetIndex == null) return;
182
+ var startCol = item.col;
183
+ var endCol = item.col;
182
184
  var startPoint = item.col;
183
- var startCol = startPoint,
184
- endCol = startPoint;
185
185
  var colhiddenData = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.colhidden;
186
- var findColBoundary = function findColBoundary(start, direction) {
187
- var tempPoint = start;
188
- while (true) {
189
- var checkColIndex = tempPoint + direction;
190
- if (!(colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(checkColIndex))) break;
191
- tempPoint = checkColIndex;
186
+ var cod = true;
187
+ var tempStartPoint = startPoint;
188
+ while (cod) {
189
+ tempStartPoint -= 1;
190
+ if (colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(tempStartPoint)) {
191
+ startCol = tempStartPoint;
192
+ } else {
193
+ cod = false;
192
194
  }
193
- return tempPoint;
194
- };
195
- startCol = findColBoundary(startPoint, -1);
196
- endCol = findColBoundary(startPoint, 1);
195
+ }
196
+ cod = true;
197
+ tempStartPoint = startPoint;
198
+ while (cod) {
199
+ tempStartPoint += 1;
200
+ if (colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(tempStartPoint)) {
201
+ endCol = tempStartPoint;
202
+ } else {
203
+ cod = false;
204
+ }
205
+ }
197
206
  if (context.isFlvReadOnly) return;
198
207
  e.stopPropagation();
199
208
  setContext(function (ctx) {
@@ -177,22 +177,30 @@ var RowHeader = function RowHeader() {
177
177
  var showRow = function showRow(e, item) {
178
178
  var _a, _b;
179
179
  if (sheetIndex == null) return;
180
+ var startRow = item.row;
181
+ var endRow = item.row;
180
182
  var startPoint = item.row;
181
- var startRow = startPoint,
182
- endRow = startPoint;
183
183
  var rowhiddenData = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.rowhidden;
184
- var findRowBoundary = function findRowBoundary(start, direction) {
185
- var tempPoint = start;
186
- while (true) {
187
- var checkRowIndex = tempPoint + direction;
188
- if (!(rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(checkRowIndex))) break;
189
- tempPoint = checkRowIndex;
184
+ var cod = true;
185
+ var tempStartPoint = startPoint;
186
+ while (cod) {
187
+ tempStartPoint -= 1;
188
+ if (rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(tempStartPoint)) {
189
+ startRow = tempStartPoint;
190
+ } else {
191
+ cod = false;
190
192
  }
191
- return tempPoint;
192
- };
193
- startRow = findRowBoundary(startPoint, -1);
194
- endRow = findRowBoundary(startPoint, 1);
195
- console.log(startRow, endRow);
193
+ }
194
+ cod = true;
195
+ tempStartPoint = startPoint;
196
+ while (cod) {
197
+ tempStartPoint += 1;
198
+ if (rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(tempStartPoint)) {
199
+ endRow = tempStartPoint;
200
+ } else {
201
+ cod = false;
202
+ }
203
+ }
196
204
  if (context.isFlvReadOnly) return;
197
205
  e.stopPropagation();
198
206
  setContext(function (ctx) {
@@ -1189,5 +1189,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
1189
1189
  };
1190
1190
  };
1191
1191
  getWorkbookContext: () => Context;
1192
+ getWorkbookSetContext: () => (recipe: (ctx: Context) => void, options?: SetContextOptions) => void;
1192
1193
  getSettings: () => Required<Settings>;
1193
1194
  };
@@ -431,6 +431,9 @@ export function generateAPIs(context, setContext, handleUndo, handleRedo, settin
431
431
  getWorkbookContext: function getWorkbookContext() {
432
432
  return context;
433
433
  },
434
+ getWorkbookSetContext: function getWorkbookSetContext() {
435
+ return setContext;
436
+ },
434
437
  getSettings: function getSettings() {
435
438
  return settings;
436
439
  }
@@ -2,6 +2,7 @@ import { Settings, Context, CellWithRowAndCol, Sheet as SheetType, Op, CellMatri
2
2
  import React from "react";
3
3
  import "./index.css";
4
4
  import { getCryptoPrice } from "../../utils/cryptoApi";
5
+ import { SetContextOptions } from "../../context";
5
6
  import { generateAPIs } from "./api";
6
7
  export type WorkbookInstance = ReturnType<typeof generateAPIs>;
7
8
  type AdditionalProps = {
@@ -1196,6 +1197,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
1196
1197
  };
1197
1198
  };
1198
1199
  getWorkbookContext: () => Context;
1200
+ getWorkbookSetContext: () => (recipe: (ctx: Context) => void, options?: SetContextOptions | undefined) => void;
1199
1201
  getSettings: () => Required<Settings>;
1200
1202
  }>>;
1201
1203
  export default Workbook;
@@ -642,7 +642,7 @@ var ContextMenu = function ContextMenu() {
642
642
  }), /*#__PURE__*/_react.default.createElement("div", null, rightclick.deleteSelected, rightclick.row))));
643
643
  }
644
644
  if (name === "hide-row") {
645
- return (selection === null || selection === void 0 ? void 0 : selection.row_select) && ["hideSelected", "showHide"].map(function (item) {
645
+ return (selection === null || selection === void 0 ? void 0 : selection.row_select) && ["hideSelected"].map(function (item) {
646
646
  return /*#__PURE__*/_react.default.createElement(_Menu.default, {
647
647
  key: item,
648
648
  onClick: function onClick() {
@@ -667,7 +667,7 @@ var ContextMenu = function ContextMenu() {
667
667
  });
668
668
  }
669
669
  if (name === "hide-column") {
670
- return (selection === null || selection === void 0 ? void 0 : selection.column_select) === true && ["hideSelected", "showHide"].map(function (item) {
670
+ return (selection === null || selection === void 0 ? void 0 : selection.column_select) === true && ["hideSelected"].map(function (item) {
671
671
  return /*#__PURE__*/_react.default.createElement(_Menu.default, {
672
672
  key: item,
673
673
  onClick: function onClick() {
@@ -188,21 +188,30 @@ var ColumnHeader = function ColumnHeader() {
188
188
  var showColumn = function showColumn(e, item) {
189
189
  var _a, _b;
190
190
  if (sheetIndex == null) return;
191
+ var startCol = item.col;
192
+ var endCol = item.col;
191
193
  var startPoint = item.col;
192
- var startCol = startPoint,
193
- endCol = startPoint;
194
194
  var colhiddenData = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.colhidden;
195
- var findColBoundary = function findColBoundary(start, direction) {
196
- var tempPoint = start;
197
- while (true) {
198
- var checkColIndex = tempPoint + direction;
199
- if (!(colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(checkColIndex))) break;
200
- tempPoint = checkColIndex;
195
+ var cod = true;
196
+ var tempStartPoint = startPoint;
197
+ while (cod) {
198
+ tempStartPoint -= 1;
199
+ if (colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(tempStartPoint)) {
200
+ startCol = tempStartPoint;
201
+ } else {
202
+ cod = false;
201
203
  }
202
- return tempPoint;
203
- };
204
- startCol = findColBoundary(startPoint, -1);
205
- endCol = findColBoundary(startPoint, 1);
204
+ }
205
+ cod = true;
206
+ tempStartPoint = startPoint;
207
+ while (cod) {
208
+ tempStartPoint += 1;
209
+ if (colhiddenData === null || colhiddenData === void 0 ? void 0 : colhiddenData.hasOwnProperty(tempStartPoint)) {
210
+ endCol = tempStartPoint;
211
+ } else {
212
+ cod = false;
213
+ }
214
+ }
206
215
  if (context.isFlvReadOnly) return;
207
216
  e.stopPropagation();
208
217
  setContext(function (ctx) {
@@ -186,22 +186,30 @@ var RowHeader = function RowHeader() {
186
186
  var showRow = function showRow(e, item) {
187
187
  var _a, _b;
188
188
  if (sheetIndex == null) return;
189
+ var startRow = item.row;
190
+ var endRow = item.row;
189
191
  var startPoint = item.row;
190
- var startRow = startPoint,
191
- endRow = startPoint;
192
192
  var rowhiddenData = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.rowhidden;
193
- var findRowBoundary = function findRowBoundary(start, direction) {
194
- var tempPoint = start;
195
- while (true) {
196
- var checkRowIndex = tempPoint + direction;
197
- if (!(rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(checkRowIndex))) break;
198
- tempPoint = checkRowIndex;
193
+ var cod = true;
194
+ var tempStartPoint = startPoint;
195
+ while (cod) {
196
+ tempStartPoint -= 1;
197
+ if (rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(tempStartPoint)) {
198
+ startRow = tempStartPoint;
199
+ } else {
200
+ cod = false;
199
201
  }
200
- return tempPoint;
201
- };
202
- startRow = findRowBoundary(startPoint, -1);
203
- endRow = findRowBoundary(startPoint, 1);
204
- console.log(startRow, endRow);
202
+ }
203
+ cod = true;
204
+ tempStartPoint = startPoint;
205
+ while (cod) {
206
+ tempStartPoint += 1;
207
+ if (rowhiddenData === null || rowhiddenData === void 0 ? void 0 : rowhiddenData.hasOwnProperty(tempStartPoint)) {
208
+ endRow = tempStartPoint;
209
+ } else {
210
+ cod = false;
211
+ }
212
+ }
205
213
  if (context.isFlvReadOnly) return;
206
214
  e.stopPropagation();
207
215
  setContext(function (ctx) {
@@ -1189,5 +1189,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
1189
1189
  };
1190
1190
  };
1191
1191
  getWorkbookContext: () => Context;
1192
+ getWorkbookSetContext: () => (recipe: (ctx: Context) => void, options?: SetContextOptions) => void;
1192
1193
  getSettings: () => Required<Settings>;
1193
1194
  };
@@ -438,6 +438,9 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
438
438
  getWorkbookContext: function getWorkbookContext() {
439
439
  return context;
440
440
  },
441
+ getWorkbookSetContext: function getWorkbookSetContext() {
442
+ return setContext;
443
+ },
441
444
  getSettings: function getSettings() {
442
445
  return settings;
443
446
  }
@@ -2,6 +2,7 @@ import { Settings, Context, CellWithRowAndCol, Sheet as SheetType, Op, CellMatri
2
2
  import React from "react";
3
3
  import "./index.css";
4
4
  import { getCryptoPrice } from "../../utils/cryptoApi";
5
+ import { SetContextOptions } from "../../context";
5
6
  import { generateAPIs } from "./api";
6
7
  export type WorkbookInstance = ReturnType<typeof generateAPIs>;
7
8
  type AdditionalProps = {
@@ -1196,6 +1197,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
1196
1197
  };
1197
1198
  };
1198
1199
  getWorkbookContext: () => Context;
1200
+ getWorkbookSetContext: () => (recipe: (ctx: Context) => void, options?: SetContextOptions | undefined) => void;
1199
1201
  getSettings: () => Required<Settings>;
1200
1202
  }>>;
1201
1203
  export default Workbook;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.6",
3
+ "version": "1.2.9",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "tsc": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@fileverse-dev/fortune-core": "1.2.6",
19
+ "@fileverse-dev/fortune-core": "1.2.9",
20
20
  "@fileverse/ui": "^4.1.7-patch-21",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",