@fileverse-dev/fortune-react 1.0.21-patch-2 → 1.0.22

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.
@@ -31,7 +31,7 @@ export var ResetColumnWidth = function ResetColumnWidth() {
31
31
  }
32
32
  } else if (_typeof(cellD) === "object" && cellD !== null) {
33
33
  var cellText = cellD.v || cellD.m;
34
- if (cellText.length * 7 > maxWidth) {
34
+ if (cellText && cellText.length * 7 > maxWidth) {
35
35
  maxWidth = cellText.length * 7;
36
36
  }
37
37
  }
@@ -16,8 +16,9 @@ import WorkbookContext from "../../../context";
16
16
  import "./index.css";
17
17
  var FormulaSearch = function FormulaSearch(props) {
18
18
  var _a;
19
- var context = useContext(WorkbookContext).context;
20
- var isAuthorized = true;
19
+ var _b = useContext(WorkbookContext),
20
+ context = _b.context,
21
+ isAuthorized = _b.settings.isAuthorized;
21
22
  var authedFunction = ["COINGECKO", "ETHERSCAN", "DEFILLAMA", "GNOSIS", "BASE", "EOA", "PNL", "SAFE", "BLOCKSCOUT", "GNOSIS", "LENS", "FARCASTER", "Ethereum"];
22
23
  var filteredDefaultCandidates = context.defaultCandidates.filter(function (item) {
23
24
  return !authedFunction.includes(item.n);
@@ -31,9 +32,9 @@ var FormulaSearch = function FormulaSearch(props) {
31
32
  });
32
33
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
33
34
  var hintRef = useRef(null);
34
- var _b = useState(0),
35
- top = _b[0],
36
- setTop = _b[1];
35
+ var _c = useState(0),
36
+ top = _c[0],
37
+ setTop = _c[1];
37
38
  var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
38
39
  var _a, _b, _c;
39
40
  if (!((_a = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.top) === null || _a === void 0 ? void 0 : _a.toString()) || !((_b = firstSelection.height_move) === null || _b === void 0 ? void 0 : _b.toString()) || !hintRef.current) return;
@@ -150,6 +150,7 @@ var SheetItem = function SheetItem(_a) {
150
150
  },
151
151
  tabIndex: 0,
152
152
  onContextMenu: function onContextMenu(e) {
153
+ if (context.isFlvReadOnly) return;
153
154
  if (isDropPlaceholder) return;
154
155
  var rect = refs.workbookContainer.current.getBoundingClientRect();
155
156
  var pageX = e.pageX,
@@ -178,7 +179,8 @@ var SheetItem = function SheetItem(_a) {
178
179
  suppressContentEditableWarning: true,
179
180
  contentEditable: isDropPlaceholder ? false : editing,
180
181
  onDoubleClick: function onDoubleClick() {
181
- return setEditing(true);
182
+ if (context.isFlvReadOnly) return;
183
+ setEditing(true);
182
184
  },
183
185
  onBlur: onBlur,
184
186
  onKeyDown: onKeyDown,
@@ -39,7 +39,7 @@ var ResetColumnWidth = exports.ResetColumnWidth = function ResetColumnWidth() {
39
39
  }
40
40
  } else if (_typeof(cellD) === "object" && cellD !== null) {
41
41
  var cellText = cellD.v || cellD.m;
42
- if (cellText.length * 7 > maxWidth) {
42
+ if (cellText && cellText.length * 7 > maxWidth) {
43
43
  maxWidth = cellText.length * 7;
44
44
  }
45
45
  }
@@ -25,8 +25,9 @@ var __assign = void 0 && (void 0).__assign || function () {
25
25
  };
26
26
  var FormulaSearch = function FormulaSearch(props) {
27
27
  var _a;
28
- var context = (0, _react.useContext)(_context.default).context;
29
- var isAuthorized = true;
28
+ var _b = (0, _react.useContext)(_context.default),
29
+ context = _b.context,
30
+ isAuthorized = _b.settings.isAuthorized;
30
31
  var authedFunction = ["COINGECKO", "ETHERSCAN", "DEFILLAMA", "GNOSIS", "BASE", "EOA", "PNL", "SAFE", "BLOCKSCOUT", "GNOSIS", "LENS", "FARCASTER", "Ethereum"];
31
32
  var filteredDefaultCandidates = context.defaultCandidates.filter(function (item) {
32
33
  return !authedFunction.includes(item.n);
@@ -40,9 +41,9 @@ var FormulaSearch = function FormulaSearch(props) {
40
41
  });
41
42
  var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
42
43
  var hintRef = (0, _react.useRef)(null);
43
- var _b = (0, _react.useState)(0),
44
- top = _b[0],
45
- setTop = _b[1];
44
+ var _c = (0, _react.useState)(0),
45
+ top = _c[0],
46
+ setTop = _c[1];
46
47
  var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
47
48
  var _a, _b, _c;
48
49
  if (!((_a = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.top) === null || _a === void 0 ? void 0 : _a.toString()) || !((_b = firstSelection.height_move) === null || _b === void 0 ? void 0 : _b.toString()) || !hintRef.current) return;
@@ -159,6 +159,7 @@ var SheetItem = function SheetItem(_a) {
159
159
  },
160
160
  tabIndex: 0,
161
161
  onContextMenu: function onContextMenu(e) {
162
+ if (context.isFlvReadOnly) return;
162
163
  if (isDropPlaceholder) return;
163
164
  var rect = refs.workbookContainer.current.getBoundingClientRect();
164
165
  var pageX = e.pageX,
@@ -187,7 +188,8 @@ var SheetItem = function SheetItem(_a) {
187
188
  suppressContentEditableWarning: true,
188
189
  contentEditable: isDropPlaceholder ? false : editing,
189
190
  onDoubleClick: function onDoubleClick() {
190
- return setEditing(true);
191
+ if (context.isFlvReadOnly) return;
192
+ setEditing(true);
191
193
  },
192
194
  onBlur: onBlur,
193
195
  onKeyDown: onKeyDown,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.0.21-patch-2",
3
+ "version": "1.0.22",
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.0.21-patch-2",
19
+ "@fileverse-dev/fortune-core": "1.0.22",
20
20
  "@fileverse/ui": "^4.1.7-patch-16",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",