@fileverse-dev/fortune-react 1.3.5-hyper-2 → 1.3.6

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.
@@ -7,7 +7,6 @@
7
7
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
8
8
  border: 1px solid #e5e5e5;
9
9
  border-radius: 8px;
10
- min-width: 320px;
11
10
  }
12
11
 
13
12
  .fortune-link-cards-container {
@@ -23,7 +22,7 @@
23
22
  border: 1px solid #e5e5e5;
24
23
  border-radius: 8px;
25
24
  padding: 16px;
26
- width: 300px;
25
+ width: fit-content;
27
26
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
28
27
  display: flex;
29
28
  flex-direction: column;
@@ -31,6 +30,10 @@
31
30
  z-index: 300;
32
31
  }
33
32
 
33
+ .fortune-link-card--editing {
34
+ min-width: 280px;
35
+ }
36
+
34
37
  .fortune-link-type-select {
35
38
  width: 100% !important;
36
39
  }
@@ -184,20 +184,20 @@ export var LinkEditCard = function LinkEditCard(_a) {
184
184
  "data-testid": "link-card-info-open"
185
185
  }, linkType === "webpage" ? insertLink.openLink : replaceHtml(insertLink.goTo, {
186
186
  linkAddress: linkAddress
187
- })), context.allowEdit === true && /*#__PURE__*/React.createElement("div", {
187
+ })), (context.allowEdit === true || context.isFlvReadOnly && linkType === "webpage") && (/*#__PURE__*/React.createElement("div", {
188
188
  className: "divider"
189
- }), context.allowEdit === true && linkType === "webpage" && renderToolbarButton("copy", function () {
189
+ })), (context.allowEdit === true || context.isFlvReadOnly) && linkType === "webpage" && renderToolbarButton("copy", function () {
190
190
  navigator.clipboard.writeText(originAddress);
191
191
  hideLinkCard();
192
- }), context.allowEdit === true && renderToolbarButton("pencil", function () {
192
+ }), context.allowEdit === true && !context.isFlvReadOnly && renderToolbarButton("pencil", function () {
193
193
  return setContext(function (draftCtx) {
194
194
  if (draftCtx.linkCard != null && draftCtx.allowEdit) {
195
195
  draftCtx.linkCard.isEditing = true;
196
196
  }
197
197
  });
198
- }), context.allowEdit === true && /*#__PURE__*/React.createElement("div", {
198
+ }), context.allowEdit === true && !context.isFlvReadOnly && (/*#__PURE__*/React.createElement("div", {
199
199
  className: "divider"
200
- }), context.allowEdit === true && renderToolbarButton("unlink", function () {
200
+ })), context.allowEdit === true && !context.isFlvReadOnly && renderToolbarButton("unlink", function () {
201
201
  return setContext(function (draftCtx) {
202
202
  _.set(refs.globalCache, "linkCard.mouseEnter", false);
203
203
  removeHyperlink(draftCtx, r, c);
@@ -10,7 +10,7 @@ var __assign = this && this.__assign || function () {
10
10
  };
11
11
  import React, { useContext, useCallback, useRef, useEffect, useLayoutEffect, useMemo } from "react";
12
12
  import "./index.css";
13
- import { locale, drawArrow, handleCellAreaDoubleClick, handleCellAreaMouseDown, handleContextMenu, handleOverlayMouseMove, handleOverlayMouseUp, selectAll, handleOverlayTouchEnd, handleOverlayTouchStart, createDropCellRange, getCellRowColumn, getCellHyperlink, showLinkCard, onCellsMoveStart, insertRowCol, getSheetIndex, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, handleKeydownForZoom } from "@fileverse-dev/fortune-core";
13
+ import { locale, drawArrow, handleCellAreaDoubleClick, handleCellAreaMouseDown, handleContextMenu, handleOverlayMouseMove, handleOverlayMouseUp, selectAll, handleOverlayTouchEnd, handleOverlayTouchStart, createDropCellRange, getCellRowColumn, getCellHyperlink, showLinkCard, isAllowEdit, onCellsMoveStart, insertRowCol, getSheetIndex, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, handleKeydownForZoom } from "@fileverse-dev/fortune-core";
14
14
  import _ from "lodash";
15
15
  import WorkbookContext from "../../context";
16
16
  import ColumnHeader from "./ColumnHeader";
@@ -50,14 +50,23 @@ var SheetOverlay = function SheetOverlay() {
50
50
  var _a;
51
51
  handleCellAreaMouseDown(draftCtx, refs.globalCache, nativeEvent, refs.cellInput.current, refs.cellArea.current, refs.fxInput.current, refs.canvas.current.getContext("2d"));
52
52
  if (!_.isEmpty((_a = draftCtx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0]) && refs.cellInput.current) {
53
- setTimeout(function () {
54
- var _a;
55
- (_a = refs.cellInput.current) === null || _a === void 0 ? void 0 : _a.focus();
56
- });
53
+ if (!isAllowEdit(draftCtx)) {
54
+ setTimeout(function () {
55
+ var _a;
56
+ (_a = refs.workbookContainer.current) === null || _a === void 0 ? void 0 : _a.focus({
57
+ preventScroll: true
58
+ });
59
+ });
60
+ } else {
61
+ setTimeout(function () {
62
+ var _a;
63
+ (_a = refs.cellInput.current) === null || _a === void 0 ? void 0 : _a.focus();
64
+ });
65
+ }
57
66
  }
58
67
  });
59
68
  }
60
- }, [setContext, refs.globalCache, refs.cellInput, refs.cellArea, refs.fxInput, refs.canvas]);
69
+ }, [setContext, refs.globalCache, refs.cellInput, refs.cellArea, refs.fxInput, refs.canvas, refs.workbookContainer]);
61
70
  var cellAreaContextMenu = useCallback(function (e) {
62
71
  var nativeEvent = e.nativeEvent;
63
72
  setContext(function (draftCtx) {
@@ -10,6 +10,7 @@
10
10
  sans-serif;
11
11
  background-color: white;
12
12
  position: relative;
13
+ outline: none;
13
14
  }
14
15
 
15
16
  .fortune-workarea {
@@ -726,7 +726,8 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
726
726
  }, /*#__PURE__*/React.createElement(ModalProvider, null, /*#__PURE__*/React.createElement("div", {
727
727
  className: "fortune-container",
728
728
  ref: workbookContainer,
729
- onKeyDown: onKeyDown
729
+ onKeyDown: onKeyDown,
730
+ tabIndex: -1
730
731
  }, /*#__PURE__*/React.createElement(SVGDefines, {
731
732
  currency: mergedSettings.currency
732
733
  }), /*#__PURE__*/React.createElement("div", {
@@ -7,7 +7,6 @@
7
7
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
8
8
  border: 1px solid #e5e5e5;
9
9
  border-radius: 8px;
10
- min-width: 320px;
11
10
  }
12
11
 
13
12
  .fortune-link-cards-container {
@@ -23,7 +22,7 @@
23
22
  border: 1px solid #e5e5e5;
24
23
  border-radius: 8px;
25
24
  padding: 16px;
26
- width: 300px;
25
+ width: fit-content;
27
26
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
28
27
  display: flex;
29
28
  flex-direction: column;
@@ -31,6 +30,10 @@
31
30
  z-index: 300;
32
31
  }
33
32
 
33
+ .fortune-link-card--editing {
34
+ min-width: 280px;
35
+ }
36
+
34
37
  .fortune-link-type-select {
35
38
  width: 100% !important;
36
39
  }
@@ -193,20 +193,20 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
193
193
  "data-testid": "link-card-info-open"
194
194
  }, linkType === "webpage" ? insertLink.openLink : (0, _fortuneCore.replaceHtml)(insertLink.goTo, {
195
195
  linkAddress: linkAddress
196
- })), context.allowEdit === true && /*#__PURE__*/_react.default.createElement("div", {
196
+ })), (context.allowEdit === true || context.isFlvReadOnly && linkType === "webpage") && (/*#__PURE__*/_react.default.createElement("div", {
197
197
  className: "divider"
198
- }), context.allowEdit === true && linkType === "webpage" && renderToolbarButton("copy", function () {
198
+ })), (context.allowEdit === true || context.isFlvReadOnly) && linkType === "webpage" && renderToolbarButton("copy", function () {
199
199
  navigator.clipboard.writeText(originAddress);
200
200
  hideLinkCard();
201
- }), context.allowEdit === true && renderToolbarButton("pencil", function () {
201
+ }), context.allowEdit === true && !context.isFlvReadOnly && renderToolbarButton("pencil", function () {
202
202
  return setContext(function (draftCtx) {
203
203
  if (draftCtx.linkCard != null && draftCtx.allowEdit) {
204
204
  draftCtx.linkCard.isEditing = true;
205
205
  }
206
206
  });
207
- }), context.allowEdit === true && /*#__PURE__*/_react.default.createElement("div", {
207
+ }), context.allowEdit === true && !context.isFlvReadOnly && (/*#__PURE__*/_react.default.createElement("div", {
208
208
  className: "divider"
209
- }), context.allowEdit === true && renderToolbarButton("unlink", function () {
209
+ })), context.allowEdit === true && !context.isFlvReadOnly && renderToolbarButton("unlink", function () {
210
210
  return setContext(function (draftCtx) {
211
211
  _lodash.default.set(refs.globalCache, "linkCard.mouseEnter", false);
212
212
  (0, _fortuneCore.removeHyperlink)(draftCtx, r, c);
@@ -59,14 +59,23 @@ var SheetOverlay = function SheetOverlay() {
59
59
  var _a;
60
60
  (0, _fortuneCore.handleCellAreaMouseDown)(draftCtx, refs.globalCache, nativeEvent, refs.cellInput.current, refs.cellArea.current, refs.fxInput.current, refs.canvas.current.getContext("2d"));
61
61
  if (!_lodash.default.isEmpty((_a = draftCtx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0]) && refs.cellInput.current) {
62
- setTimeout(function () {
63
- var _a;
64
- (_a = refs.cellInput.current) === null || _a === void 0 ? void 0 : _a.focus();
65
- });
62
+ if (!(0, _fortuneCore.isAllowEdit)(draftCtx)) {
63
+ setTimeout(function () {
64
+ var _a;
65
+ (_a = refs.workbookContainer.current) === null || _a === void 0 ? void 0 : _a.focus({
66
+ preventScroll: true
67
+ });
68
+ });
69
+ } else {
70
+ setTimeout(function () {
71
+ var _a;
72
+ (_a = refs.cellInput.current) === null || _a === void 0 ? void 0 : _a.focus();
73
+ });
74
+ }
66
75
  }
67
76
  });
68
77
  }
69
- }, [setContext, refs.globalCache, refs.cellInput, refs.cellArea, refs.fxInput, refs.canvas]);
78
+ }, [setContext, refs.globalCache, refs.cellInput, refs.cellArea, refs.fxInput, refs.canvas, refs.workbookContainer]);
70
79
  var cellAreaContextMenu = (0, _react.useCallback)(function (e) {
71
80
  var nativeEvent = e.nativeEvent;
72
81
  setContext(function (draftCtx) {
@@ -10,6 +10,7 @@
10
10
  sans-serif;
11
11
  background-color: white;
12
12
  position: relative;
13
+ outline: none;
13
14
  }
14
15
 
15
16
  .fortune-workarea {
@@ -735,7 +735,8 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
735
735
  }, /*#__PURE__*/_react.default.createElement(_modal.ModalProvider, null, /*#__PURE__*/_react.default.createElement("div", {
736
736
  className: "fortune-container",
737
737
  ref: workbookContainer,
738
- onKeyDown: onKeyDown
738
+ onKeyDown: onKeyDown,
739
+ tabIndex: -1
739
740
  }, /*#__PURE__*/_react.default.createElement(_SVGDefines.default, {
740
741
  currency: mergedSettings.currency
741
742
  }), /*#__PURE__*/_react.default.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.3.5-hyper-2",
3
+ "version": "1.3.6",
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.3.5-hyper-2",
19
+ "@fileverse-dev/fortune-core": "1.3.6",
20
20
  "@fileverse/ui": "5.0.0",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",