@fileverse-dev/fortune-react 1.1.46 → 1.1.48

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.
@@ -54,13 +54,13 @@ var InputBox = function InputBox() {
54
54
  var preText = useRef("");
55
55
  var placeRef = useRef("");
56
56
  var inputBoxStyle = useMemo(function () {
57
- if (firstSelection && context.luckysheetCellUpdate.length > 0) {
57
+ if (firstSelectionActiveCell && context.luckysheetCellUpdate.length > 0) {
58
58
  var flowdata = getFlowdata(context);
59
59
  if (!flowdata) return {};
60
60
  return getStyleByCell(context, flowdata, firstSelectionActiveCell.row_focus, firstSelectionActiveCell.column_focus);
61
61
  }
62
62
  return {};
63
- }, [context.luckysheetfile, context.currentSheetId, context.luckysheetCellUpdate, firstSelection, firstSelectionActiveCell]);
63
+ }, [context.luckysheetfile, context.currentSheetId, context.luckysheetCellUpdate, firstSelectionActiveCell]);
64
64
  useLayoutEffect(function () {
65
65
  var _a;
66
66
  if (!context.allowEdit) {
@@ -202,11 +202,6 @@ var InputBox = function InputBox() {
202
202
  lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
203
203
  preText.current = inputRef.current.innerText;
204
204
  var allowListNavigation = true;
205
- if (e.key === "Delete" || e.key === "Backspace") {
206
- setTimeout(function () {
207
- moveCursorToEnd(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
208
- }, 5);
209
- }
210
205
  var refCell = placeRef.current;
211
206
  if (e.key === "ArrowUp") {
212
207
  refCell = decrementRow(placeRef.current);
@@ -585,7 +585,7 @@ var Toolbar = function Toolbar(_a) {
585
585
  }
586
586
  }, [itemLocations, setMoreItems, settings.toolbarItems.length, sheetWidth, isDesktop]);
587
587
  var getToolbarItem = useCallback(function (name, i) {
588
- var _a, _b, _c, _d, _e, _f;
588
+ var _a, _b, _c, _d, _e, _f, _g;
589
589
  var tooltip = toolbar[name];
590
590
  if (name === "|") {
591
591
  return /*#__PURE__*/React.createElement(Divider, {
@@ -647,7 +647,7 @@ var Toolbar = function Toolbar(_a) {
647
647
  if ((curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) != null) {
648
648
  if (format != null) {
649
649
  currentFmt = format.text;
650
- } else if (curr_2.fa === "#,##0" || curr_2.fa === "#,##0.00" || curr_2.fa === "0" || curr_2.fa === "0.00") {
650
+ } else if (((_a = curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === null || _a === void 0 ? void 0 : _a.includes("#,##0")) || (curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === "0" || (curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === "0.00") {
651
651
  currentFmt = "Number";
652
652
  } else {
653
653
  currentFmt = defaultFormat[defaultFormat.length - 1].text;
@@ -785,9 +785,9 @@ var Toolbar = function Toolbar(_a) {
785
785
  value: 2
786
786
  }];
787
787
  return /*#__PURE__*/React.createElement(Combo, {
788
- iconId: ((_a = _.find(items_1, function (item) {
788
+ iconId: ((_b = _.find(items_1, function (item) {
789
789
  return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.ht);
790
- })) === null || _a === void 0 ? void 0 : _a.title) || "align-left",
790
+ })) === null || _b === void 0 ? void 0 : _b.title) || "align-left",
791
791
  key: name,
792
792
  tooltip: toolbar.horizontalAlign,
793
793
  showArrow: false
@@ -837,9 +837,9 @@ var Toolbar = function Toolbar(_a) {
837
837
  value: 2
838
838
  }];
839
839
  return /*#__PURE__*/React.createElement(Combo, {
840
- iconId: ((_b = _.find(items_2, function (item) {
840
+ iconId: ((_c = _.find(items_2, function (item) {
841
841
  return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.vt);
842
- })) === null || _b === void 0 ? void 0 : _b.title) || "align-top",
842
+ })) === null || _c === void 0 ? void 0 : _c.title) || "align-top",
843
843
  key: name,
844
844
  tooltip: toolbar.verticalAlign,
845
845
  showArrow: false
@@ -1110,7 +1110,7 @@ var Toolbar = function Toolbar(_a) {
1110
1110
  }));
1111
1111
  }
1112
1112
  if (name === "comment") {
1113
- var last = (_c = context.luckysheet_select_save) === null || _c === void 0 ? void 0 : _c[context.luckysheet_select_save.length - 1];
1113
+ var last = (_d = context.luckysheet_select_save) === null || _d === void 0 ? void 0 : _d[context.luckysheet_select_save.length - 1];
1114
1114
  var row_index_1 = last === null || last === void 0 ? void 0 : last.row_focus;
1115
1115
  var col_index_1 = last === null || last === void 0 ? void 0 : last.column_focus;
1116
1116
  if (!last) {
@@ -1125,7 +1125,7 @@ var Toolbar = function Toolbar(_a) {
1125
1125
  }
1126
1126
  }
1127
1127
  var itemData_1;
1128
- if (((_e = (_d = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row_index_1]) === null || _d === void 0 ? void 0 : _d[col_index_1]) === null || _e === void 0 ? void 0 : _e.ps) != null) {
1128
+ if (((_f = (_e = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row_index_1]) === null || _e === void 0 ? void 0 : _e[col_index_1]) === null || _f === void 0 ? void 0 : _f.ps) != null) {
1129
1129
  itemData_1 = [{
1130
1130
  key: "edit",
1131
1131
  text: comment.edit,
@@ -1614,7 +1614,7 @@ var Toolbar = function Toolbar(_a) {
1614
1614
  iconId: name,
1615
1615
  tooltip: tooltip,
1616
1616
  key: name,
1617
- selected: (_f = toolbarItemSelectedFunc(name)) === null || _f === void 0 ? void 0 : _f(cell),
1617
+ selected: (_g = toolbarItemSelectedFunc(name)) === null || _g === void 0 ? void 0 : _g(cell),
1618
1618
  onClick: function onClick() {
1619
1619
  return setContext(function (draftCtx) {
1620
1620
  var _a;
@@ -63,13 +63,13 @@ var InputBox = function InputBox() {
63
63
  var preText = (0, _react.useRef)("");
64
64
  var placeRef = (0, _react.useRef)("");
65
65
  var inputBoxStyle = (0, _react.useMemo)(function () {
66
- if (firstSelection && context.luckysheetCellUpdate.length > 0) {
66
+ if (firstSelectionActiveCell && context.luckysheetCellUpdate.length > 0) {
67
67
  var flowdata = (0, _fortuneCore.getFlowdata)(context);
68
68
  if (!flowdata) return {};
69
69
  return (0, _fortuneCore.getStyleByCell)(context, flowdata, firstSelectionActiveCell.row_focus, firstSelectionActiveCell.column_focus);
70
70
  }
71
71
  return {};
72
- }, [context.luckysheetfile, context.currentSheetId, context.luckysheetCellUpdate, firstSelection, firstSelectionActiveCell]);
72
+ }, [context.luckysheetfile, context.currentSheetId, context.luckysheetCellUpdate, firstSelectionActiveCell]);
73
73
  (0, _react.useLayoutEffect)(function () {
74
74
  var _a;
75
75
  if (!context.allowEdit) {
@@ -211,11 +211,6 @@ var InputBox = function InputBox() {
211
211
  lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
212
212
  preText.current = inputRef.current.innerText;
213
213
  var allowListNavigation = true;
214
- if (e.key === "Delete" || e.key === "Backspace") {
215
- setTimeout(function () {
216
- (0, _helper.moveCursorToEnd)(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
217
- }, 5);
218
- }
219
214
  var refCell = placeRef.current;
220
215
  if (e.key === "ArrowUp") {
221
216
  refCell = (0, _helper.decrementRow)(placeRef.current);
@@ -594,7 +594,7 @@ var Toolbar = function Toolbar(_a) {
594
594
  }
595
595
  }, [itemLocations, setMoreItems, settings.toolbarItems.length, sheetWidth, isDesktop]);
596
596
  var getToolbarItem = (0, _react.useCallback)(function (name, i) {
597
- var _a, _b, _c, _d, _e, _f;
597
+ var _a, _b, _c, _d, _e, _f, _g;
598
598
  var tooltip = toolbar[name];
599
599
  if (name === "|") {
600
600
  return /*#__PURE__*/_react.default.createElement(_Divider.default, {
@@ -656,7 +656,7 @@ var Toolbar = function Toolbar(_a) {
656
656
  if ((curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) != null) {
657
657
  if (format != null) {
658
658
  currentFmt = format.text;
659
- } else if (curr_2.fa === "#,##0" || curr_2.fa === "#,##0.00" || curr_2.fa === "0" || curr_2.fa === "0.00") {
659
+ } else if (((_a = curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === null || _a === void 0 ? void 0 : _a.includes("#,##0")) || (curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === "0" || (curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === "0.00") {
660
660
  currentFmt = "Number";
661
661
  } else {
662
662
  currentFmt = defaultFormat[defaultFormat.length - 1].text;
@@ -794,9 +794,9 @@ var Toolbar = function Toolbar(_a) {
794
794
  value: 2
795
795
  }];
796
796
  return /*#__PURE__*/_react.default.createElement(_Combo.default, {
797
- iconId: ((_a = _lodash.default.find(items_1, function (item) {
797
+ iconId: ((_b = _lodash.default.find(items_1, function (item) {
798
798
  return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.ht);
799
- })) === null || _a === void 0 ? void 0 : _a.title) || "align-left",
799
+ })) === null || _b === void 0 ? void 0 : _b.title) || "align-left",
800
800
  key: name,
801
801
  tooltip: toolbar.horizontalAlign,
802
802
  showArrow: false
@@ -846,9 +846,9 @@ var Toolbar = function Toolbar(_a) {
846
846
  value: 2
847
847
  }];
848
848
  return /*#__PURE__*/_react.default.createElement(_Combo.default, {
849
- iconId: ((_b = _lodash.default.find(items_2, function (item) {
849
+ iconId: ((_c = _lodash.default.find(items_2, function (item) {
850
850
  return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.vt);
851
- })) === null || _b === void 0 ? void 0 : _b.title) || "align-top",
851
+ })) === null || _c === void 0 ? void 0 : _c.title) || "align-top",
852
852
  key: name,
853
853
  tooltip: toolbar.verticalAlign,
854
854
  showArrow: false
@@ -1119,7 +1119,7 @@ var Toolbar = function Toolbar(_a) {
1119
1119
  }));
1120
1120
  }
1121
1121
  if (name === "comment") {
1122
- var last = (_c = context.luckysheet_select_save) === null || _c === void 0 ? void 0 : _c[context.luckysheet_select_save.length - 1];
1122
+ var last = (_d = context.luckysheet_select_save) === null || _d === void 0 ? void 0 : _d[context.luckysheet_select_save.length - 1];
1123
1123
  var row_index_1 = last === null || last === void 0 ? void 0 : last.row_focus;
1124
1124
  var col_index_1 = last === null || last === void 0 ? void 0 : last.column_focus;
1125
1125
  if (!last) {
@@ -1134,7 +1134,7 @@ var Toolbar = function Toolbar(_a) {
1134
1134
  }
1135
1135
  }
1136
1136
  var itemData_1;
1137
- if (((_e = (_d = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row_index_1]) === null || _d === void 0 ? void 0 : _d[col_index_1]) === null || _e === void 0 ? void 0 : _e.ps) != null) {
1137
+ if (((_f = (_e = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row_index_1]) === null || _e === void 0 ? void 0 : _e[col_index_1]) === null || _f === void 0 ? void 0 : _f.ps) != null) {
1138
1138
  itemData_1 = [{
1139
1139
  key: "edit",
1140
1140
  text: comment.edit,
@@ -1623,7 +1623,7 @@ var Toolbar = function Toolbar(_a) {
1623
1623
  iconId: name,
1624
1624
  tooltip: tooltip,
1625
1625
  key: name,
1626
- selected: (_f = (0, _fortuneCore.toolbarItemSelectedFunc)(name)) === null || _f === void 0 ? void 0 : _f(cell),
1626
+ selected: (_g = (0, _fortuneCore.toolbarItemSelectedFunc)(name)) === null || _g === void 0 ? void 0 : _g(cell),
1627
1627
  onClick: function onClick() {
1628
1628
  return setContext(function (draftCtx) {
1629
1629
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.1.46",
3
+ "version": "1.1.48",
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.1.46",
19
+ "@fileverse-dev/fortune-core": "1.1.48",
20
20
  "@fileverse/ui": "^4.1.7-patch-21",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",