@fileverse-dev/fortune-react 1.2.7 → 1.2.10-oc-1

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.
Files changed (37) hide show
  1. package/es/components/ConditionFormat/index.css +2 -0
  2. package/es/components/ContextMenu/Menu.d.ts +1 -0
  3. package/es/components/ContextMenu/Menu.js +5 -2
  4. package/es/components/ContextMenu/index.css +4 -1
  5. package/es/components/ContextMenu/index.js +35 -8
  6. package/es/components/LinkEidtCard/index.js +66 -16
  7. package/es/components/NotationBoxes/index.js +2 -11
  8. package/es/components/SheetOverlay/ColumnHeader.js +22 -14
  9. package/es/components/SheetOverlay/FormulaSearch/index.css +0 -1
  10. package/es/components/SheetOverlay/FormulaSearch/index.js +1 -1
  11. package/es/components/SheetOverlay/RowHeader.js +22 -14
  12. package/es/components/SheetOverlay/index.css +2 -6
  13. package/es/components/Toolbar/Combo.js +5 -2
  14. package/es/components/Toolbar/Select.js +1 -1
  15. package/es/components/Toolbar/index.css +21 -1
  16. package/es/components/Workbook/api.d.ts +1 -0
  17. package/es/components/Workbook/api.js +3 -0
  18. package/es/components/Workbook/index.d.ts +2 -0
  19. package/lib/components/ConditionFormat/index.css +2 -0
  20. package/lib/components/ContextMenu/Menu.d.ts +1 -0
  21. package/lib/components/ContextMenu/Menu.js +5 -2
  22. package/lib/components/ContextMenu/index.css +4 -1
  23. package/lib/components/ContextMenu/index.js +34 -7
  24. package/lib/components/LinkEidtCard/index.js +65 -15
  25. package/lib/components/NotationBoxes/index.js +2 -11
  26. package/lib/components/SheetOverlay/ColumnHeader.js +22 -14
  27. package/lib/components/SheetOverlay/FormulaSearch/index.css +0 -1
  28. package/lib/components/SheetOverlay/FormulaSearch/index.js +1 -1
  29. package/lib/components/SheetOverlay/RowHeader.js +22 -14
  30. package/lib/components/SheetOverlay/index.css +2 -6
  31. package/lib/components/Toolbar/Combo.js +4 -1
  32. package/lib/components/Toolbar/Select.js +1 -1
  33. package/lib/components/Toolbar/index.css +21 -1
  34. package/lib/components/Workbook/api.d.ts +1 -0
  35. package/lib/components/Workbook/api.js +3 -0
  36. package/lib/components/Workbook/index.d.ts +2 -0
  37. package/package.json +2 -2
@@ -22,6 +22,8 @@
22
22
  z-index: 1005;
23
23
  border-radius: 4px;
24
24
  cursor: pointer;
25
+ align-items: center;
26
+ height: 32px;
25
27
  }
26
28
 
27
29
  .condition-format-item:hover {
@@ -3,6 +3,7 @@ type Props = React.PropsWithChildren<{
3
3
  onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
4
4
  onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
5
5
  onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
6
+ isActive?: boolean;
6
7
  }>;
7
8
  declare const Menu: React.FC<Props>;
8
9
  export default Menu;
@@ -1,13 +1,16 @@
1
+ import { cn } from "@fileverse/ui";
1
2
  import React, { useRef } from "react";
2
3
  var Menu = function Menu(_a) {
3
4
  var _onClick = _a.onClick,
4
5
  _onMouseLeave = _a.onMouseLeave,
5
6
  _onMouseEnter = _a.onMouseEnter,
6
- children = _a.children;
7
+ children = _a.children,
8
+ _b = _a.isActive,
9
+ isActive = _b === void 0 ? false : _b;
7
10
  var containerRef = useRef(null);
8
11
  return /*#__PURE__*/React.createElement("div", {
9
12
  ref: containerRef,
10
- className: "luckysheet-cols-menuitem luckysheet-mousedown-cancel",
13
+ className: cn("luckysheet-cols-menuitem luckysheet-mousedown-cancel", isActive && "color-bg-default-hover"),
11
14
  onClick: function onClick(e) {
12
15
  return _onClick === null || _onClick === void 0 ? void 0 : _onClick(e, containerRef.current);
13
16
  },
@@ -82,7 +82,10 @@
82
82
  cursor: pointer;
83
83
  list-style: none;
84
84
  margin: 0;
85
- padding: 8px !important;
85
+ padding-right: 8px !important;
86
+ padding-left: 8px !important;
87
+ padding-top: 6px !important;
88
+ padding-bottom: 6px !important;
86
89
  white-space: nowrap;
87
90
  user-select: none;
88
91
  display: flex;
@@ -115,7 +115,7 @@ var __generator = this && this.__generator || function (thisArg, body) {
115
115
  };
116
116
  import { locale, handleCopy, handlePasteByClick, deleteRowCol, insertRowCol, removeActiveImage, deleteSelectedCellText, sortSelection, createFilter, showImgChooser, handleLink, hideSelected, showSelected, getSheetIndex, api, isAllowEdit, jfrefreshgrid, newComment, getFreezeState, toggleFreeze, clearFilter, clearSelectedCellFormat, clearColumnsCellsFormat, clearRowsCellsFormat } from "@fileverse-dev/fortune-core";
117
117
  import _ from "lodash";
118
- import React, { useContext, useRef, useCallback, useLayoutEffect } from "react";
118
+ import React, { useContext, useRef, useCallback, useLayoutEffect, useState } from "react";
119
119
  import regeneratorRuntime from "regenerator-runtime";
120
120
  import Tippy from "@tippyjs/react";
121
121
  import { LucideIcon } from "@fileverse/ui";
@@ -149,6 +149,9 @@ var ContextMenu = function ContextMenu() {
149
149
  info = _b.info,
150
150
  toolbar = _b.toolbar,
151
151
  splitText = _b.splitText;
152
+ var _c = useState(""),
153
+ activeMenu = _c[0],
154
+ setActiveMenu = _c[1];
152
155
  var addRowColRightAvobe = function addRowColRightAvobe(type, direction) {
153
156
  var _a, _b, _c, _d, _e, _f;
154
157
  var positionCol = (_c = (_b = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.column) === null || _c === void 0 ? void 0 : _c[0];
@@ -829,6 +832,12 @@ var ContextMenu = function ContextMenu() {
829
832
  arrow: false,
830
833
  zIndex: 3000,
831
834
  appendTo: document.body,
835
+ onShow: function onShow() {
836
+ setActiveMenu("sort");
837
+ },
838
+ onHide: function onHide() {
839
+ if (activeMenu === "sort") setActiveMenu("");
840
+ },
832
841
  content: /*#__PURE__*/React.createElement("div", {
833
842
  className: "fortune-toolbar-select",
834
843
  style: {
@@ -867,7 +876,9 @@ var ContextMenu = function ContextMenu() {
867
876
  }), /*#__PURE__*/React.createElement("p", null, sort.desc))))),
868
877
  trigger: "mouseenter focus",
869
878
  hideOnClick: false
870
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement("div", {
879
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Menu, {
880
+ isActive: activeMenu === "sort"
881
+ }, /*#__PURE__*/React.createElement("div", {
871
882
  className: "flex items-center justify-between w-full"
872
883
  }, /*#__PURE__*/React.createElement("div", {
873
884
  className: "context-item"
@@ -907,7 +918,7 @@ var ContextMenu = function ContextMenu() {
907
918
  }, /*#__PURE__*/React.createElement("div", {
908
919
  className: "context-item p-2 w-full",
909
920
  style: {
910
- height: "40px"
921
+ height: "32px"
911
922
  }
912
923
  }, /*#__PURE__*/React.createElement(LucideIcon, {
913
924
  name: "Filter",
@@ -922,14 +933,22 @@ var ContextMenu = function ContextMenu() {
922
933
  }, /*#__PURE__*/React.createElement("div", {
923
934
  className: "context-item p-2 w-full",
924
935
  style: {
925
- height: "40px"
936
+ height: "32px"
926
937
  }
927
938
  }, /*#__PURE__*/React.createElement(LucideIcon, {
928
939
  name: "Eraser"
929
940
  }), /*#__PURE__*/React.createElement("p", null, filter.clearFilter))))),
930
941
  trigger: "mouseenter focus",
931
- hideOnClick: false
932
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement("div", {
942
+ hideOnClick: false,
943
+ onShow: function onShow() {
944
+ setActiveMenu("filter");
945
+ },
946
+ onHide: function onHide() {
947
+ if (activeMenu === "filter") setActiveMenu("");
948
+ }
949
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Menu, {
950
+ isActive: activeMenu === "filter"
951
+ }, /*#__PURE__*/React.createElement("div", {
933
952
  className: "flex items-center justify-between w-full"
934
953
  }, /*#__PURE__*/React.createElement("div", {
935
954
  className: "context-item"
@@ -983,6 +1002,12 @@ var ContextMenu = function ContextMenu() {
983
1002
  arrow: false,
984
1003
  zIndex: 3000,
985
1004
  appendTo: document.body,
1005
+ onShow: function onShow() {
1006
+ setActiveMenu("conditionFormat");
1007
+ },
1008
+ onHide: function onHide() {
1009
+ if (activeMenu === "conditionFormat") setActiveMenu("");
1010
+ },
986
1011
  content: /*#__PURE__*/React.createElement("div", {
987
1012
  style: {
988
1013
  minWidth: 220
@@ -993,7 +1018,9 @@ var ContextMenu = function ContextMenu() {
993
1018
  })),
994
1019
  trigger: "mouseenter focus",
995
1020
  hideOnClick: false
996
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement("div", {
1021
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Menu, {
1022
+ isActive: activeMenu === "conditionFormat"
1023
+ }, /*#__PURE__*/React.createElement("div", {
997
1024
  className: "flex items-center justify-between w-full"
998
1025
  }, /*#__PURE__*/React.createElement("div", {
999
1026
  className: "flex items-center gap-2 context-item"
@@ -1029,7 +1056,7 @@ var ContextMenu = function ContextMenu() {
1029
1056
  }), /*#__PURE__*/React.createElement("p", null, "Clear formatting")));
1030
1057
  }
1031
1058
  return null;
1032
- }, [context, setContext, refs.globalCache, rightclick, showAlert, showDialog, drag.noMulti, info.tipRowHeightLimit, info.tipColumnWidthLimit, generalDialog.partiallyError, generalDialog.readOnlyError, generalDialog.dataNullError]);
1059
+ }, [context, setContext, refs.globalCache, rightclick, showAlert, showDialog, drag.noMulti, info.tipRowHeightLimit, info.tipColumnWidthLimit, generalDialog.partiallyError, generalDialog.readOnlyError, generalDialog.dataNullError, activeMenu]);
1033
1060
  useLayoutEffect(function () {
1034
1061
  var _a;
1035
1062
  if (!containerRef.current) {
@@ -8,7 +8,7 @@ var __assign = this && this.__assign || function () {
8
8
  };
9
9
  return __assign.apply(this, arguments);
10
10
  };
11
- import React, { useContext, useState, useMemo, useCallback, useLayoutEffect } from "react";
11
+ import React, { useContext, useState, useMemo, useCallback, useLayoutEffect, useRef, useEffect } from "react";
12
12
  import { locale, saveHyperlink, removeHyperlink, replaceHtml, goToLink, isLinkValid } from "@fileverse-dev/fortune-core";
13
13
  import { Button, TextField, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, LucideIcon } from "@fileverse/ui";
14
14
  import "./index.css";
@@ -28,18 +28,24 @@ export var LinkEditCard = function LinkEditCard(_a) {
28
28
  context = _b.context,
29
29
  setContext = _b.setContext,
30
30
  refs = _b.refs;
31
- var _c = useState(originText),
32
- linkText = _c[0],
33
- setLinkText = _c[1];
34
- var _d = useState(originAddress),
35
- linkAddress = _d[0],
36
- setLinkAddress = _d[1];
37
- var _e = useState(originType),
38
- linkType = _e[0],
39
- setLinkType = _e[1];
40
- var _f = locale(context),
41
- insertLink = _f.insertLink,
42
- linkTypeList = _f.linkTypeList;
31
+ var cardRef = useRef(null);
32
+ var linkAddressRef = useRef(null);
33
+ var linkTextRef = useRef(null);
34
+ var _c = useState(position.cellBottom),
35
+ cardTop = _c[0],
36
+ setCardTop = _c[1];
37
+ var _d = useState(originText),
38
+ linkText = _d[0],
39
+ setLinkText = _d[1];
40
+ var _e = useState(originAddress),
41
+ linkAddress = _e[0],
42
+ setLinkAddress = _e[1];
43
+ var _f = useState(originType),
44
+ linkType = _f[0],
45
+ setLinkType = _f[1];
46
+ var _g = locale(context),
47
+ insertLink = _g.insertLink,
48
+ linkTypeList = _g.linkTypeList;
43
49
  var isLinkAddressValid = isLinkValid(context, linkType, linkAddress);
44
50
  var isButtonDisabled = useMemo(function () {
45
51
  if (!linkText.trim()) return true;
@@ -75,13 +81,20 @@ export var LinkEditCard = function LinkEditCard(_a) {
75
81
  return e.stopPropagation();
76
82
  },
77
83
  onKeyDown: function onKeyDown(e) {
78
- return e.stopPropagation();
84
+ e.stopPropagation();
85
+ if (isButtonDisabled) return;
86
+ if (e.key === "Enter") {
87
+ _.set(refs.globalCache, "linkCard.mouseEnter", false);
88
+ setContext(function (draftCtx) {
89
+ return saveHyperlink(draftCtx, r, c, linkText, linkType, linkAddress);
90
+ });
91
+ }
79
92
  },
80
93
  onDoubleClick: function onDoubleClick(e) {
81
94
  return e.stopPropagation();
82
95
  }
83
96
  };
84
- }, [refs.globalCache]);
97
+ }, [refs.globalCache, isButtonDisabled]);
85
98
  var renderToolbarButton = useCallback(function (iconId, onClick) {
86
99
  return /*#__PURE__*/React.createElement("div", {
87
100
  className: "fortune-toolbar-button",
@@ -100,6 +113,40 @@ export var LinkEditCard = function LinkEditCard(_a) {
100
113
  setLinkText(originText);
101
114
  setLinkType(originType);
102
115
  }, [rc, originAddress, originText, originType]);
116
+ useEffect(function () {
117
+ var dragHandle = document.querySelector(".luckysheet-cs-draghandle-top.luckysheet-cs-draghandle");
118
+ var card = cardRef.current;
119
+ if (!dragHandle || !card) {
120
+ setCardTop(position.cellBottom + 8);
121
+ return;
122
+ }
123
+ var dragRect = dragHandle.getBoundingClientRect();
124
+ var cardRect = card.getBoundingClientRect();
125
+ var viewportHeight = window.innerHeight;
126
+ var spaceBelow = viewportHeight - dragRect.bottom;
127
+ var spaceAbove = dragRect.top;
128
+ var newTop;
129
+ if (spaceBelow < cardRect.height + 16 && spaceAbove > cardRect.height + 16) {
130
+ var cellTop = position.cellBottom - 30;
131
+ newTop = cellTop - cardRect.height - 8;
132
+ } else {
133
+ newTop = position.cellBottom + 8;
134
+ }
135
+ setCardTop(newTop);
136
+ }, [position.cellBottom, isEditing]);
137
+ useEffect(function () {
138
+ var _a, _b;
139
+ if (linkAddressRef.current && !linkAddress && isEditing) {
140
+ (_a = linkAddressRef.current) === null || _a === void 0 ? void 0 : _a.focus({
141
+ preventScroll: true
142
+ });
143
+ }
144
+ if (linkTextRef.current && !linkText && isEditing) {
145
+ (_b = linkTextRef.current) === null || _b === void 0 ? void 0 : _b.focus({
146
+ preventScroll: true
147
+ });
148
+ }
149
+ }, [linkAddressRef, isEditing, linkTextRef]);
103
150
  if (!isEditing) {
104
151
  return /*#__PURE__*/React.createElement("div", __assign({}, containerEvent, {
105
152
  onKeyDown: function onKeyDown(e) {
@@ -142,9 +189,10 @@ export var LinkEditCard = function LinkEditCard(_a) {
142
189
  }
143
190
  return /*#__PURE__*/React.createElement("div", __assign({
144
191
  className: "fortune-link-card",
192
+ ref: cardRef,
145
193
  style: {
146
194
  left: position.cellLeft + 20,
147
- top: position.cellBottom
195
+ top: cardTop
148
196
  }
149
197
  }, containerEvent), /*#__PURE__*/React.createElement(Select, {
150
198
  value: linkType,
@@ -177,6 +225,7 @@ export var LinkEditCard = function LinkEditCard(_a) {
177
225
  }, /*#__PURE__*/React.createElement(LucideIcon, {
178
226
  name: "ALargeSmall"
179
227
  })), /*#__PURE__*/React.createElement(TextField, {
228
+ ref: linkTextRef,
180
229
  placeholder: "Display text",
181
230
  value: linkText,
182
231
  onChange: function onChange(e) {
@@ -192,6 +241,7 @@ export var LinkEditCard = function LinkEditCard(_a) {
192
241
  width: 16,
193
242
  height: 16
194
243
  })), /*#__PURE__*/React.createElement(TextField, {
244
+ ref: linkAddressRef,
195
245
  placeholder: "Paste URL",
196
246
  value: linkAddress,
197
247
  onChange: function onChange(e) {
@@ -44,8 +44,6 @@ var NotationBoxes = function NotationBoxes() {
44
44
  rc = commentBox.rc,
45
45
  left = commentBox.left,
46
46
  top = commentBox.top,
47
- width = commentBox.width,
48
- height = commentBox.height,
49
47
  size = commentBox.size;
50
48
  var isEditing = ((_a = context.editingCommentBox) === null || _a === void 0 ? void 0 : _a.rc) === rc;
51
49
  var commentId = "comment-box-".concat(rc);
@@ -65,19 +63,12 @@ var NotationBoxes = function NotationBoxes() {
65
63
  }
66
64
  }), /*#__PURE__*/React.createElement("div", {
67
65
  id: commentId,
68
- className: "luckysheet-postil-show-main",
69
66
  style: {
70
- width: width,
71
- height: height,
72
- color: "#000",
73
- padding: 5,
74
- border: "1px solid #000",
75
- backgroundColor: "rgb(255,255,225)",
76
67
  position: "absolute",
77
68
  left: left,
78
69
  top: top,
79
- boxSizing: "border-box",
80
- zIndex: isEditing ? 200 : 100
70
+ zIndex: isEditing ? 200 : 100,
71
+ boxShadow: "0 1px 1px #0000002e,0 4px 8px #0000001a"
81
72
  },
82
73
  onMouseDown: function onMouseDown(e) {
83
74
  var nativeEvent = e.nativeEvent;
@@ -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
- var 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) {
@@ -320,13 +329,12 @@ var ColumnHeader = function ColumnHeader() {
320
329
  c1 = _a.c1,
321
330
  c2 = _a.c2;
322
331
  return /*#__PURE__*/React.createElement("div", {
323
- className: "fortune-col-header-selected",
332
+ className: "fortune-col-header-selected color-bg-tertiary",
324
333
  key: i,
325
334
  style: _.assign({
326
335
  left: col_pre,
327
336
  width: col - col_pre - 1,
328
337
  display: "block",
329
- backgroundColor: "#EFC703",
330
338
  mixBlendMode: "multiply"
331
339
  }, fixColumnStyleOverflowInFreeze(context, c1, c2, (_b = refs.globalCache.freezen) === null || _b === void 0 ? void 0 : _b[context.currentSheetId]))
332
340
  });
@@ -6,7 +6,6 @@
6
6
  background: #fff;
7
7
  z-index: 1003;
8
8
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
9
- border: 1px solid lavender;
10
9
  border-radius: 10px;
11
10
  }
12
11
 
@@ -53,7 +53,7 @@ var FormulaSearch = function FormulaSearch(props) {
53
53
  });
54
54
  if (_.isEmpty(context.functionCandidates) && _.isEmpty(context.defaultCandidates)) return null;
55
55
  return /*#__PURE__*/React.createElement("div", {
56
- className: "flex flex-col luckysheet-formula-search-c-p custom-scroll",
56
+ className: "flex color-border-default border flex-col luckysheet-formula-search-c-p custom-scroll",
57
57
  id: "luckysheet-formula-search-c-p",
58
58
  style: {
59
59
  top: top
@@ -177,21 +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
- var 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);
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
+ }
195
204
  if (context.isFlvReadOnly) return;
196
205
  e.stopPropagation();
197
206
  setContext(function (ctx) {
@@ -291,13 +300,12 @@ var RowHeader = function RowHeader() {
291
300
  r1 = _a.r1,
292
301
  r2 = _a.r2;
293
302
  return /*#__PURE__*/React.createElement("div", {
294
- className: "fortune-row-header-selected",
303
+ className: "fortune-row-header-selected color-bg-tertiary",
295
304
  key: i,
296
305
  style: _.assign({
297
306
  top: row_pre,
298
307
  height: row - row_pre - 1,
299
308
  display: "block",
300
- backgroundColor: "#EFC703",
301
309
  mixBlendMode: "multiply"
302
310
  }, fixRowStyleOverflowInFreeze(context, r1, r2, (_b = refs.globalCache.freezen) === null || _b === void 0 ? void 0 : _b[context.currentSheetId]))
303
311
  });
@@ -45,12 +45,10 @@
45
45
  .fortune-row-header-selected {
46
46
  position: absolute;
47
47
  z-index: 10;
48
- border-right: 1px solid #0188fb;
49
48
  right: 0;
50
49
  width: 100%;
51
50
  margin-top: 2px;
52
51
  display: none;
53
- background-color: rgba(76, 76, 76, 0.1);
54
52
  }
55
53
 
56
54
  .fortune-col-header-wrap {
@@ -94,12 +92,10 @@
94
92
  cursor: default;
95
93
  position: absolute;
96
94
  z-index: 10;
97
- border-bottom: 1px solid #0188fb;
98
95
  bottom: 0;
99
96
  height: 100%;
100
97
  margin-left: 0px;
101
98
  display: none;
102
- background-color: rgba(76, 76, 76, 0.1);
103
99
  }
104
100
 
105
101
  .fortune-left-top {
@@ -137,7 +133,7 @@
137
133
  z-index: 14;
138
134
  /*border:1px solid #fff;*/
139
135
  margin: 0px 0 0 0px;
140
- background: rgba(0, 80, 208, 0.15);
136
+ /* background: rgba(0, 80, 208, 0.15); */
141
137
  display: none;
142
138
  }
143
139
 
@@ -199,9 +195,9 @@
199
195
  z-index: 15;
200
196
  border: 2.5px solid #efc703;
201
197
  margin: -1px 0 0 -1px;
202
- background: rgba(1, 136, 251, 0.15);
203
198
  display: none;
204
199
  box-sizing: content-box;
200
+ background: rgba(239, 199, 5, 0.02);
205
201
  }
206
202
 
207
203
  .luckysheet-cs-inner-border {
@@ -1,5 +1,5 @@
1
1
  import React, { useMemo, useRef, useState } from "react";
2
- import { IconButton, Tooltip, Popover, PopoverContent, PopoverTrigger, cn, Button } from "@fileverse/ui";
2
+ import { IconButton, Tooltip, Popover, PopoverContent, PopoverTrigger, cn, Button, LucideIcon } from "@fileverse/ui";
3
3
  import SVGIcon from "../SVGIcon";
4
4
  import { getLucideIcon } from ".";
5
5
  var Combo = function Combo(_a) {
@@ -49,7 +49,10 @@ var Combo = function Combo(_a) {
49
49
  height: 16
50
50
  })) : (/*#__PURE__*/React.createElement("span", {
51
51
  className: "fortune-toolbar-combo-text"
52
- }, text !== undefined ? text : ""))))) : (/*#__PURE__*/React.createElement("span", null, iconId === "font-color" ? (/*#__PURE__*/React.createElement(Tooltip, {
52
+ }, text !== undefined ? text : "")), /*#__PURE__*/React.createElement(LucideIcon, {
53
+ className: "w-[16px] h-[16px]",
54
+ name: "ChevronDown"
55
+ })))) : (/*#__PURE__*/React.createElement("span", null, iconId === "font-color" ? (/*#__PURE__*/React.createElement(Tooltip, {
53
56
  text: tooltip,
54
57
  placement: "bottom"
55
58
  }, /*#__PURE__*/React.createElement(Button, {
@@ -27,7 +27,7 @@ var Option = function Option(_a) {
27
27
  }, iconId && /*#__PURE__*/React.createElement(SVGIcon, {
28
28
  name: iconId
29
29
  }), /*#__PURE__*/React.createElement("div", {
30
- className: "fortuen-toolbar-text color-text-default text-body-sm"
30
+ className: "fortuen-toolbar-text color-text-default text-body-sm w-full"
31
31
  }, children));
32
32
  };
33
33
  export { Option };
@@ -141,14 +141,30 @@
141
141
 
142
142
  .fortune-toolbar-combo-button {
143
143
  font-size: 12px;
144
+ padding-top: 4px;
145
+ padding-bottom: 4px;
146
+ padding-left: 8px;
147
+ padding-right: 8px;
148
+ border-radius: 4px;
149
+ gap: 8px;
150
+ }
151
+ .fortune-toolbar-combo-button:hover {
152
+ background: hsl(var(--color-bg-default-hover));
144
153
  }
145
154
 
146
155
  .fortune-toolbar-select-option {
147
156
  font-size: 12px;
148
157
  min-width: 60px;
149
- padding: 8px;
158
+ padding-left: 8px;
159
+ padding-right: 8px;
160
+ padding-top: 6px;
161
+ padding-bottom: 6px;
150
162
  cursor: pointer;
151
163
  user-select: none;
164
+ height: 32px;
165
+ display: flex;
166
+ align-items: center;
167
+
152
168
  }
153
169
 
154
170
  .fortune-toolbar-select-option:hover {
@@ -171,6 +187,10 @@
171
187
  font-weight: 500;
172
188
  font-size: 14px;
173
189
  line-height: 20px;
190
+ max-width: 56px;
191
+ overflow: hidden;
192
+ text-overflow: ellipsis;
193
+ white-space: nowrap;
174
194
  }
175
195
 
176
196
  .fortune-toolbar-color-picker-item {
@@ -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;
@@ -22,6 +22,8 @@
22
22
  z-index: 1005;
23
23
  border-radius: 4px;
24
24
  cursor: pointer;
25
+ align-items: center;
26
+ height: 32px;
25
27
  }
26
28
 
27
29
  .condition-format-item:hover {
@@ -3,6 +3,7 @@ type Props = React.PropsWithChildren<{
3
3
  onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
4
4
  onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
5
5
  onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
6
+ isActive?: boolean;
6
7
  }>;
7
8
  declare const Menu: React.FC<Props>;
8
9
  export default Menu;
@@ -5,17 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _ui = require("@fileverse/ui");
8
9
  var _react = _interopRequireWildcard(require("react"));
9
10
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
10
11
  var Menu = function Menu(_a) {
11
12
  var _onClick = _a.onClick,
12
13
  _onMouseLeave = _a.onMouseLeave,
13
14
  _onMouseEnter = _a.onMouseEnter,
14
- children = _a.children;
15
+ children = _a.children,
16
+ _b = _a.isActive,
17
+ isActive = _b === void 0 ? false : _b;
15
18
  var containerRef = (0, _react.useRef)(null);
16
19
  return /*#__PURE__*/_react.default.createElement("div", {
17
20
  ref: containerRef,
18
- className: "luckysheet-cols-menuitem luckysheet-mousedown-cancel",
21
+ className: (0, _ui.cn)("luckysheet-cols-menuitem luckysheet-mousedown-cancel", isActive && "color-bg-default-hover"),
19
22
  onClick: function onClick(e) {
20
23
  return _onClick === null || _onClick === void 0 ? void 0 : _onClick(e, containerRef.current);
21
24
  },
@@ -82,7 +82,10 @@
82
82
  cursor: pointer;
83
83
  list-style: none;
84
84
  margin: 0;
85
- padding: 8px !important;
85
+ padding-right: 8px !important;
86
+ padding-left: 8px !important;
87
+ padding-top: 6px !important;
88
+ padding-bottom: 6px !important;
86
89
  white-space: nowrap;
87
90
  user-select: none;
88
91
  display: flex;
@@ -158,6 +158,9 @@ var ContextMenu = function ContextMenu() {
158
158
  info = _b.info,
159
159
  toolbar = _b.toolbar,
160
160
  splitText = _b.splitText;
161
+ var _c = (0, _react.useState)(""),
162
+ activeMenu = _c[0],
163
+ setActiveMenu = _c[1];
161
164
  var addRowColRightAvobe = function addRowColRightAvobe(type, direction) {
162
165
  var _a, _b, _c, _d, _e, _f;
163
166
  var positionCol = (_c = (_b = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.column) === null || _c === void 0 ? void 0 : _c[0];
@@ -838,6 +841,12 @@ var ContextMenu = function ContextMenu() {
838
841
  arrow: false,
839
842
  zIndex: 3000,
840
843
  appendTo: document.body,
844
+ onShow: function onShow() {
845
+ setActiveMenu("sort");
846
+ },
847
+ onHide: function onHide() {
848
+ if (activeMenu === "sort") setActiveMenu("");
849
+ },
841
850
  content: /*#__PURE__*/_react.default.createElement("div", {
842
851
  className: "fortune-toolbar-select",
843
852
  style: {
@@ -876,7 +885,9 @@ var ContextMenu = function ContextMenu() {
876
885
  }), /*#__PURE__*/_react.default.createElement("p", null, sort.desc))))),
877
886
  trigger: "mouseenter focus",
878
887
  hideOnClick: false
879
- }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Menu.default, null, /*#__PURE__*/_react.default.createElement("div", {
888
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Menu.default, {
889
+ isActive: activeMenu === "sort"
890
+ }, /*#__PURE__*/_react.default.createElement("div", {
880
891
  className: "flex items-center justify-between w-full"
881
892
  }, /*#__PURE__*/_react.default.createElement("div", {
882
893
  className: "context-item"
@@ -916,7 +927,7 @@ var ContextMenu = function ContextMenu() {
916
927
  }, /*#__PURE__*/_react.default.createElement("div", {
917
928
  className: "context-item p-2 w-full",
918
929
  style: {
919
- height: "40px"
930
+ height: "32px"
920
931
  }
921
932
  }, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
922
933
  name: "Filter",
@@ -931,14 +942,22 @@ var ContextMenu = function ContextMenu() {
931
942
  }, /*#__PURE__*/_react.default.createElement("div", {
932
943
  className: "context-item p-2 w-full",
933
944
  style: {
934
- height: "40px"
945
+ height: "32px"
935
946
  }
936
947
  }, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
937
948
  name: "Eraser"
938
949
  }), /*#__PURE__*/_react.default.createElement("p", null, filter.clearFilter))))),
939
950
  trigger: "mouseenter focus",
940
- hideOnClick: false
941
- }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Menu.default, null, /*#__PURE__*/_react.default.createElement("div", {
951
+ hideOnClick: false,
952
+ onShow: function onShow() {
953
+ setActiveMenu("filter");
954
+ },
955
+ onHide: function onHide() {
956
+ if (activeMenu === "filter") setActiveMenu("");
957
+ }
958
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Menu.default, {
959
+ isActive: activeMenu === "filter"
960
+ }, /*#__PURE__*/_react.default.createElement("div", {
942
961
  className: "flex items-center justify-between w-full"
943
962
  }, /*#__PURE__*/_react.default.createElement("div", {
944
963
  className: "context-item"
@@ -992,6 +1011,12 @@ var ContextMenu = function ContextMenu() {
992
1011
  arrow: false,
993
1012
  zIndex: 3000,
994
1013
  appendTo: document.body,
1014
+ onShow: function onShow() {
1015
+ setActiveMenu("conditionFormat");
1016
+ },
1017
+ onHide: function onHide() {
1018
+ if (activeMenu === "conditionFormat") setActiveMenu("");
1019
+ },
995
1020
  content: /*#__PURE__*/_react.default.createElement("div", {
996
1021
  style: {
997
1022
  minWidth: 220
@@ -1002,7 +1027,9 @@ var ContextMenu = function ContextMenu() {
1002
1027
  })),
1003
1028
  trigger: "mouseenter focus",
1004
1029
  hideOnClick: false
1005
- }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Menu.default, null, /*#__PURE__*/_react.default.createElement("div", {
1030
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Menu.default, {
1031
+ isActive: activeMenu === "conditionFormat"
1032
+ }, /*#__PURE__*/_react.default.createElement("div", {
1006
1033
  className: "flex items-center justify-between w-full"
1007
1034
  }, /*#__PURE__*/_react.default.createElement("div", {
1008
1035
  className: "flex items-center gap-2 context-item"
@@ -1038,7 +1065,7 @@ var ContextMenu = function ContextMenu() {
1038
1065
  }), /*#__PURE__*/_react.default.createElement("p", null, "Clear formatting")));
1039
1066
  }
1040
1067
  return null;
1041
- }, [context, setContext, refs.globalCache, rightclick, showAlert, showDialog, drag.noMulti, info.tipRowHeightLimit, info.tipColumnWidthLimit, generalDialog.partiallyError, generalDialog.readOnlyError, generalDialog.dataNullError]);
1068
+ }, [context, setContext, refs.globalCache, rightclick, showAlert, showDialog, drag.noMulti, info.tipRowHeightLimit, info.tipColumnWidthLimit, generalDialog.partiallyError, generalDialog.readOnlyError, generalDialog.dataNullError, activeMenu]);
1042
1069
  (0, _react.useLayoutEffect)(function () {
1043
1070
  var _a;
1044
1071
  if (!containerRef.current) {
@@ -37,18 +37,24 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
37
37
  context = _b.context,
38
38
  setContext = _b.setContext,
39
39
  refs = _b.refs;
40
- var _c = (0, _react.useState)(originText),
41
- linkText = _c[0],
42
- setLinkText = _c[1];
43
- var _d = (0, _react.useState)(originAddress),
44
- linkAddress = _d[0],
45
- setLinkAddress = _d[1];
46
- var _e = (0, _react.useState)(originType),
47
- linkType = _e[0],
48
- setLinkType = _e[1];
49
- var _f = (0, _fortuneCore.locale)(context),
50
- insertLink = _f.insertLink,
51
- linkTypeList = _f.linkTypeList;
40
+ var cardRef = (0, _react.useRef)(null);
41
+ var linkAddressRef = (0, _react.useRef)(null);
42
+ var linkTextRef = (0, _react.useRef)(null);
43
+ var _c = (0, _react.useState)(position.cellBottom),
44
+ cardTop = _c[0],
45
+ setCardTop = _c[1];
46
+ var _d = (0, _react.useState)(originText),
47
+ linkText = _d[0],
48
+ setLinkText = _d[1];
49
+ var _e = (0, _react.useState)(originAddress),
50
+ linkAddress = _e[0],
51
+ setLinkAddress = _e[1];
52
+ var _f = (0, _react.useState)(originType),
53
+ linkType = _f[0],
54
+ setLinkType = _f[1];
55
+ var _g = (0, _fortuneCore.locale)(context),
56
+ insertLink = _g.insertLink,
57
+ linkTypeList = _g.linkTypeList;
52
58
  var isLinkAddressValid = (0, _fortuneCore.isLinkValid)(context, linkType, linkAddress);
53
59
  var isButtonDisabled = (0, _react.useMemo)(function () {
54
60
  if (!linkText.trim()) return true;
@@ -84,13 +90,20 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
84
90
  return e.stopPropagation();
85
91
  },
86
92
  onKeyDown: function onKeyDown(e) {
87
- return e.stopPropagation();
93
+ e.stopPropagation();
94
+ if (isButtonDisabled) return;
95
+ if (e.key === "Enter") {
96
+ _lodash.default.set(refs.globalCache, "linkCard.mouseEnter", false);
97
+ setContext(function (draftCtx) {
98
+ return (0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress);
99
+ });
100
+ }
88
101
  },
89
102
  onDoubleClick: function onDoubleClick(e) {
90
103
  return e.stopPropagation();
91
104
  }
92
105
  };
93
- }, [refs.globalCache]);
106
+ }, [refs.globalCache, isButtonDisabled]);
94
107
  var renderToolbarButton = (0, _react.useCallback)(function (iconId, onClick) {
95
108
  return /*#__PURE__*/_react.default.createElement("div", {
96
109
  className: "fortune-toolbar-button",
@@ -109,6 +122,40 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
109
122
  setLinkText(originText);
110
123
  setLinkType(originType);
111
124
  }, [rc, originAddress, originText, originType]);
125
+ (0, _react.useEffect)(function () {
126
+ var dragHandle = document.querySelector(".luckysheet-cs-draghandle-top.luckysheet-cs-draghandle");
127
+ var card = cardRef.current;
128
+ if (!dragHandle || !card) {
129
+ setCardTop(position.cellBottom + 8);
130
+ return;
131
+ }
132
+ var dragRect = dragHandle.getBoundingClientRect();
133
+ var cardRect = card.getBoundingClientRect();
134
+ var viewportHeight = window.innerHeight;
135
+ var spaceBelow = viewportHeight - dragRect.bottom;
136
+ var spaceAbove = dragRect.top;
137
+ var newTop;
138
+ if (spaceBelow < cardRect.height + 16 && spaceAbove > cardRect.height + 16) {
139
+ var cellTop = position.cellBottom - 30;
140
+ newTop = cellTop - cardRect.height - 8;
141
+ } else {
142
+ newTop = position.cellBottom + 8;
143
+ }
144
+ setCardTop(newTop);
145
+ }, [position.cellBottom, isEditing]);
146
+ (0, _react.useEffect)(function () {
147
+ var _a, _b;
148
+ if (linkAddressRef.current && !linkAddress && isEditing) {
149
+ (_a = linkAddressRef.current) === null || _a === void 0 ? void 0 : _a.focus({
150
+ preventScroll: true
151
+ });
152
+ }
153
+ if (linkTextRef.current && !linkText && isEditing) {
154
+ (_b = linkTextRef.current) === null || _b === void 0 ? void 0 : _b.focus({
155
+ preventScroll: true
156
+ });
157
+ }
158
+ }, [linkAddressRef, isEditing, linkTextRef]);
112
159
  if (!isEditing) {
113
160
  return /*#__PURE__*/_react.default.createElement("div", __assign({}, containerEvent, {
114
161
  onKeyDown: function onKeyDown(e) {
@@ -151,9 +198,10 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
151
198
  }
152
199
  return /*#__PURE__*/_react.default.createElement("div", __assign({
153
200
  className: "fortune-link-card",
201
+ ref: cardRef,
154
202
  style: {
155
203
  left: position.cellLeft + 20,
156
- top: position.cellBottom
204
+ top: cardTop
157
205
  }
158
206
  }, containerEvent), /*#__PURE__*/_react.default.createElement(_ui.Select, {
159
207
  value: linkType,
@@ -186,6 +234,7 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
186
234
  }, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
187
235
  name: "ALargeSmall"
188
236
  })), /*#__PURE__*/_react.default.createElement(_ui.TextField, {
237
+ ref: linkTextRef,
189
238
  placeholder: "Display text",
190
239
  value: linkText,
191
240
  onChange: function onChange(e) {
@@ -201,6 +250,7 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
201
250
  width: 16,
202
251
  height: 16
203
252
  })), /*#__PURE__*/_react.default.createElement(_ui.TextField, {
253
+ ref: linkAddressRef,
204
254
  placeholder: "Paste URL",
205
255
  value: linkAddress,
206
256
  onChange: function onChange(e) {
@@ -53,8 +53,6 @@ var NotationBoxes = function NotationBoxes() {
53
53
  rc = commentBox.rc,
54
54
  left = commentBox.left,
55
55
  top = commentBox.top,
56
- width = commentBox.width,
57
- height = commentBox.height,
58
56
  size = commentBox.size;
59
57
  var isEditing = ((_a = context.editingCommentBox) === null || _a === void 0 ? void 0 : _a.rc) === rc;
60
58
  var commentId = "comment-box-".concat(rc);
@@ -74,19 +72,12 @@ var NotationBoxes = function NotationBoxes() {
74
72
  }
75
73
  }), /*#__PURE__*/_react.default.createElement("div", {
76
74
  id: commentId,
77
- className: "luckysheet-postil-show-main",
78
75
  style: {
79
- width: width,
80
- height: height,
81
- color: "#000",
82
- padding: 5,
83
- border: "1px solid #000",
84
- backgroundColor: "rgb(255,255,225)",
85
76
  position: "absolute",
86
77
  left: left,
87
78
  top: top,
88
- boxSizing: "border-box",
89
- zIndex: isEditing ? 200 : 100
79
+ zIndex: isEditing ? 200 : 100,
80
+ boxShadow: "0 1px 1px #0000002e,0 4px 8px #0000001a"
90
81
  },
91
82
  onMouseDown: function onMouseDown(e) {
92
83
  var nativeEvent = e.nativeEvent;
@@ -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
- var 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) {
@@ -329,13 +338,12 @@ var ColumnHeader = function ColumnHeader() {
329
338
  c1 = _a.c1,
330
339
  c2 = _a.c2;
331
340
  return /*#__PURE__*/_react.default.createElement("div", {
332
- className: "fortune-col-header-selected",
341
+ className: "fortune-col-header-selected color-bg-tertiary",
333
342
  key: i,
334
343
  style: _lodash.default.assign({
335
344
  left: col_pre,
336
345
  width: col - col_pre - 1,
337
346
  display: "block",
338
- backgroundColor: "#EFC703",
339
347
  mixBlendMode: "multiply"
340
348
  }, (0, _fortuneCore.fixColumnStyleOverflowInFreeze)(context, c1, c2, (_b = refs.globalCache.freezen) === null || _b === void 0 ? void 0 : _b[context.currentSheetId]))
341
349
  });
@@ -6,7 +6,6 @@
6
6
  background: #fff;
7
7
  z-index: 1003;
8
8
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
9
- border: 1px solid lavender;
10
9
  border-radius: 10px;
11
10
  }
12
11
 
@@ -62,7 +62,7 @@ var FormulaSearch = function FormulaSearch(props) {
62
62
  });
63
63
  if (_lodash.default.isEmpty(context.functionCandidates) && _lodash.default.isEmpty(context.defaultCandidates)) return null;
64
64
  return /*#__PURE__*/_react.default.createElement("div", {
65
- className: "flex flex-col luckysheet-formula-search-c-p custom-scroll",
65
+ className: "flex color-border-default border flex-col luckysheet-formula-search-c-p custom-scroll",
66
66
  id: "luckysheet-formula-search-c-p",
67
67
  style: {
68
68
  top: top
@@ -186,21 +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
- var 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);
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
+ }
204
213
  if (context.isFlvReadOnly) return;
205
214
  e.stopPropagation();
206
215
  setContext(function (ctx) {
@@ -300,13 +309,12 @@ var RowHeader = function RowHeader() {
300
309
  r1 = _a.r1,
301
310
  r2 = _a.r2;
302
311
  return /*#__PURE__*/_react.default.createElement("div", {
303
- className: "fortune-row-header-selected",
312
+ className: "fortune-row-header-selected color-bg-tertiary",
304
313
  key: i,
305
314
  style: _lodash.default.assign({
306
315
  top: row_pre,
307
316
  height: row - row_pre - 1,
308
317
  display: "block",
309
- backgroundColor: "#EFC703",
310
318
  mixBlendMode: "multiply"
311
319
  }, (0, _fortuneCore.fixRowStyleOverflowInFreeze)(context, r1, r2, (_b = refs.globalCache.freezen) === null || _b === void 0 ? void 0 : _b[context.currentSheetId]))
312
320
  });
@@ -45,12 +45,10 @@
45
45
  .fortune-row-header-selected {
46
46
  position: absolute;
47
47
  z-index: 10;
48
- border-right: 1px solid #0188fb;
49
48
  right: 0;
50
49
  width: 100%;
51
50
  margin-top: 2px;
52
51
  display: none;
53
- background-color: rgba(76, 76, 76, 0.1);
54
52
  }
55
53
 
56
54
  .fortune-col-header-wrap {
@@ -94,12 +92,10 @@
94
92
  cursor: default;
95
93
  position: absolute;
96
94
  z-index: 10;
97
- border-bottom: 1px solid #0188fb;
98
95
  bottom: 0;
99
96
  height: 100%;
100
97
  margin-left: 0px;
101
98
  display: none;
102
- background-color: rgba(76, 76, 76, 0.1);
103
99
  }
104
100
 
105
101
  .fortune-left-top {
@@ -137,7 +133,7 @@
137
133
  z-index: 14;
138
134
  /*border:1px solid #fff;*/
139
135
  margin: 0px 0 0 0px;
140
- background: rgba(0, 80, 208, 0.15);
136
+ /* background: rgba(0, 80, 208, 0.15); */
141
137
  display: none;
142
138
  }
143
139
 
@@ -199,9 +195,9 @@
199
195
  z-index: 15;
200
196
  border: 2.5px solid #efc703;
201
197
  margin: -1px 0 0 -1px;
202
- background: rgba(1, 136, 251, 0.15);
203
198
  display: none;
204
199
  box-sizing: content-box;
200
+ background: rgba(239, 199, 5, 0.02);
205
201
  }
206
202
 
207
203
  .luckysheet-cs-inner-border {
@@ -58,7 +58,10 @@ var Combo = function Combo(_a) {
58
58
  height: 16
59
59
  })) : (/*#__PURE__*/_react.default.createElement("span", {
60
60
  className: "fortune-toolbar-combo-text"
61
- }, text !== undefined ? text : ""))))) : (/*#__PURE__*/_react.default.createElement("span", null, iconId === "font-color" ? (/*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
61
+ }, text !== undefined ? text : "")), /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
62
+ className: "w-[16px] h-[16px]",
63
+ name: "ChevronDown"
64
+ })))) : (/*#__PURE__*/_react.default.createElement("span", null, iconId === "font-color" ? (/*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
62
65
  text: tooltip,
63
66
  placement: "bottom"
64
67
  }, /*#__PURE__*/_react.default.createElement(_ui.Button, {
@@ -34,7 +34,7 @@ var Option = exports.Option = function Option(_a) {
34
34
  }, iconId && /*#__PURE__*/_react.default.createElement(_SVGIcon.default, {
35
35
  name: iconId
36
36
  }), /*#__PURE__*/_react.default.createElement("div", {
37
- className: "fortuen-toolbar-text color-text-default text-body-sm"
37
+ className: "fortuen-toolbar-text color-text-default text-body-sm w-full"
38
38
  }, children));
39
39
  };
40
40
  var _default = exports.default = Select;
@@ -141,14 +141,30 @@
141
141
 
142
142
  .fortune-toolbar-combo-button {
143
143
  font-size: 12px;
144
+ padding-top: 4px;
145
+ padding-bottom: 4px;
146
+ padding-left: 8px;
147
+ padding-right: 8px;
148
+ border-radius: 4px;
149
+ gap: 8px;
150
+ }
151
+ .fortune-toolbar-combo-button:hover {
152
+ background: hsl(var(--color-bg-default-hover));
144
153
  }
145
154
 
146
155
  .fortune-toolbar-select-option {
147
156
  font-size: 12px;
148
157
  min-width: 60px;
149
- padding: 8px;
158
+ padding-left: 8px;
159
+ padding-right: 8px;
160
+ padding-top: 6px;
161
+ padding-bottom: 6px;
150
162
  cursor: pointer;
151
163
  user-select: none;
164
+ height: 32px;
165
+ display: flex;
166
+ align-items: center;
167
+
152
168
  }
153
169
 
154
170
  .fortune-toolbar-select-option:hover {
@@ -171,6 +187,10 @@
171
187
  font-weight: 500;
172
188
  font-size: 14px;
173
189
  line-height: 20px;
190
+ max-width: 56px;
191
+ overflow: hidden;
192
+ text-overflow: ellipsis;
193
+ white-space: nowrap;
174
194
  }
175
195
 
176
196
  .fortune-toolbar-color-picker-item {
@@ -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.7",
3
+ "version": "1.2.10-oc-1",
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.7",
19
+ "@fileverse-dev/fortune-core": "1.2.10-oc-1",
20
20
  "@fileverse/ui": "^4.1.7-patch-21",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",