@fileverse-dev/fortune-react 1.1.99 → 1.2.0-patch-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 (51) hide show
  1. package/es/components/ContextMenu/Menu.d.ts +1 -0
  2. package/es/components/ContextMenu/Menu.js +5 -2
  3. package/es/components/ContextMenu/index.css +4 -1
  4. package/es/components/ContextMenu/index.js +37 -10
  5. package/es/components/DataVerification/ColorPicker.js +31 -7
  6. package/es/components/DataVerification/DropdownList.js +20 -1
  7. package/es/components/DataVerification/DropdownOption.js +5 -2
  8. package/es/components/DataVerification/RangeDialog.js +1 -5
  9. package/es/components/DataVerification/index.css +21 -1
  10. package/es/components/DataVerification/index.js +31 -5
  11. package/es/components/SheetOverlay/ColumnHeader.js +89 -7
  12. package/es/components/SheetOverlay/FormulaHint/index.js +13 -2
  13. package/es/components/SheetOverlay/FormulaSearch/index.css +0 -1
  14. package/es/components/SheetOverlay/FormulaSearch/index.js +1 -1
  15. package/es/components/SheetOverlay/InputBox.js +1 -1
  16. package/es/components/SheetOverlay/RowHeader.js +83 -7
  17. package/es/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -18
  18. package/es/components/SheetOverlay/drag_and_drop/row-helpers.js +20 -18
  19. package/es/components/SheetOverlay/helper.js +3 -3
  20. package/es/components/SheetOverlay/index.css +26 -7
  21. package/es/components/Toolbar/Combo.js +5 -2
  22. package/es/components/Toolbar/index.css +17 -1
  23. package/es/components/Toolbar/index.js +28 -19
  24. package/es/components/Workbook/index.d.ts +1 -1
  25. package/es/components/Workbook/index.js +5 -0
  26. package/lib/components/ContextMenu/Menu.d.ts +1 -0
  27. package/lib/components/ContextMenu/Menu.js +5 -2
  28. package/lib/components/ContextMenu/index.css +4 -1
  29. package/lib/components/ContextMenu/index.js +36 -9
  30. package/lib/components/DataVerification/ColorPicker.js +30 -6
  31. package/lib/components/DataVerification/DropdownList.js +20 -1
  32. package/lib/components/DataVerification/DropdownOption.js +5 -2
  33. package/lib/components/DataVerification/RangeDialog.js +1 -5
  34. package/lib/components/DataVerification/index.css +21 -1
  35. package/lib/components/DataVerification/index.js +31 -5
  36. package/lib/components/SheetOverlay/ColumnHeader.js +87 -6
  37. package/lib/components/SheetOverlay/FormulaHint/index.js +13 -2
  38. package/lib/components/SheetOverlay/FormulaSearch/index.css +0 -1
  39. package/lib/components/SheetOverlay/FormulaSearch/index.js +1 -1
  40. package/lib/components/SheetOverlay/InputBox.js +1 -1
  41. package/lib/components/SheetOverlay/RowHeader.js +81 -6
  42. package/lib/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -18
  43. package/lib/components/SheetOverlay/drag_and_drop/row-helpers.js +20 -18
  44. package/lib/components/SheetOverlay/helper.js +3 -3
  45. package/lib/components/SheetOverlay/index.css +26 -7
  46. package/lib/components/Toolbar/Combo.js +4 -1
  47. package/lib/components/Toolbar/index.css +17 -1
  48. package/lib/components/Toolbar/index.js +27 -19
  49. package/lib/components/Workbook/index.d.ts +1 -1
  50. package/lib/components/Workbook/index.js +5 -0
  51. package/package.json +2 -2
@@ -260,24 +260,26 @@ var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(c
260
260
  }
261
261
  });
262
262
  });
263
- var newDataVerification = {};
264
- Object.keys(_sheet.dataVerification).forEach(function (item) {
265
- var _a;
266
- var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
267
- var colRow = item.split("_");
268
- if (colRow.length !== 2) return;
269
- var presentRow = parseInt(colRow[0], 10);
270
- var updatedRow = presentRow;
271
- if (presentRow === sourceIndex_1) {
272
- updatedRow = targetIndex;
273
- } else if (presentRow > sourceIndex_1 && presentRow < targetIndex) {
274
- updatedRow -= 1;
275
- } else if (presentRow < sourceIndex_1 && presentRow >= targetIndex) {
276
- updatedRow += 1;
277
- }
278
- newDataVerification["".concat(updatedRow, "_").concat(colRow[1])] = itemData;
279
- });
280
- _sheet.dataVerification = newDataVerification;
263
+ if (_sheet.dataVerification) {
264
+ var newDataVerification_1 = {};
265
+ Object.keys(_sheet.dataVerification).forEach(function (item) {
266
+ var _a;
267
+ var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
268
+ var colRow = item.split("_");
269
+ if (colRow.length !== 2) return;
270
+ var presentRow = parseInt(colRow[0], 10);
271
+ var updatedRow = presentRow;
272
+ if (presentRow === sourceIndex_1) {
273
+ updatedRow = targetIndex;
274
+ } else if (presentRow > sourceIndex_1 && presentRow < targetIndex) {
275
+ updatedRow -= 1;
276
+ } else if (presentRow < sourceIndex_1 && presentRow >= targetIndex) {
277
+ updatedRow += 1;
278
+ }
279
+ newDataVerification_1["".concat(updatedRow, "_").concat(colRow[1])] = itemData;
280
+ });
281
+ _sheet.dataVerification = newDataVerification_1;
282
+ }
281
283
  (_a = _sheet.calcChain) === null || _a === void 0 ? void 0 : _a.forEach(function (item) {
282
284
  if (item.r === sourceIndex_1) {
283
285
  item.r = targetIndex;
@@ -108,12 +108,12 @@ function countCommasBeforeCursor(editableDiv) {
108
108
  var textBeforeCursor = preCaretRange.toString();
109
109
  var inQuotes = false;
110
110
  var count = 0;
111
- for (var i = 0; i < textBeforeCursor.length; i++) {
111
+ for (var i = 0; i < textBeforeCursor.length; i += 1) {
112
112
  var char = textBeforeCursor[i];
113
113
  if (char === '"') {
114
114
  inQuotes = !inQuotes;
115
- } else if (char === ',' && !inQuotes) {
116
- count++;
115
+ } else if (char === "," && !inQuotes) {
116
+ count += 1;
117
117
  }
118
118
  }
119
119
  return count;
@@ -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,7 +195,7 @@
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);
198
+ background: rgba(239, 199, 5, 0.02);
203
199
  display: none;
204
200
  box-sizing: content-box;
205
201
  }
@@ -1010,4 +1006,27 @@
1010
1006
  background: #555;
1011
1007
  /* darker on hover */
1012
1008
  /* scrollbar */
1013
- }
1009
+ }
1010
+
1011
+ .hide-btn {
1012
+ padding-top: 1px;
1013
+ position: absolute;
1014
+ right: 5;
1015
+ top: 5px;
1016
+ z-index: 200;
1017
+ width: 9px;
1018
+ }
1019
+
1020
+ .hide-btn:hover {
1021
+ border: 1px solid #0188fb;
1022
+ }
1023
+
1024
+ .rotate-row-icon {
1025
+ transform: rotate(-90deg);
1026
+ }
1027
+
1028
+ .hide-btn-row {
1029
+ position: absolute;
1030
+ left: 4px;
1031
+ z-index: 200;
1032
+ }
@@ -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, {
@@ -141,12 +141,24 @@
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;
152
164
  }
@@ -171,6 +183,10 @@
171
183
  font-weight: 500;
172
184
  font-size: 14px;
173
185
  line-height: 20px;
186
+ max-width: 56px;
187
+ overflow: hidden;
188
+ text-overflow: ellipsis;
189
+ white-space: nowrap;
174
190
  }
175
191
 
176
192
  .fortune-toolbar-color-picker-item {
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getLucideIcon = exports.default = exports.CurrencySelector = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _fortuneCore = require("@fileverse-dev/fortune-core");
10
- var _api = require("@fileverse-dev/fortune-core/lib/api");
11
10
  var _lodash = _interopRequireDefault(require("lodash"));
12
11
  var _ui = require("@fileverse/ui");
13
12
  var _dataVerificationPortal = _interopRequireDefault(require("./dataVerificationPortal"));
@@ -594,9 +593,35 @@ var Toolbar = function Toolbar(_a) {
594
593
  }
595
594
  }
596
595
  }, [itemLocations, setMoreItems, settings.toolbarItems.length, sheetWidth, isDesktop]);
596
+ (0, _react.useEffect)(function () {
597
+ setContext(function (ctx) {
598
+ ctx.dataVerification.dataRegulation.value1 = "value1";
599
+ });
600
+ }, []);
597
601
  var _o = (0, _react.useState)(false),
598
602
  showDataValidation = _o[0],
599
603
  setShowDataValidation = _o[1];
604
+ var dataVerificationClick = function dataVerificationClick() {
605
+ var _a;
606
+ var selection = _fortuneCore.api.getSelection(context);
607
+ if (!selection) {
608
+ setContext(function (ctx) {
609
+ _fortuneCore.api.setSelection(ctx, [{
610
+ row: [0, 0],
611
+ column: [0, 0]
612
+ }], {
613
+ id: context.currentSheetId
614
+ });
615
+ });
616
+ }
617
+ (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
618
+ setTimeout(function () {
619
+ setShowDataValidation(true);
620
+ }, 100);
621
+ };
622
+ (0, _react.useEffect)(function () {
623
+ window.dataVerificationClick = dataVerificationClick;
624
+ }, []);
600
625
  var getToolbarItem = (0, _react.useCallback)(function (name, i) {
601
626
  var _a, _b, _c, _d, _e, _f, _g;
602
627
  var tooltip = toolbar[name];
@@ -979,24 +1004,7 @@ var Toolbar = function Toolbar(_a) {
979
1004
  iconId: name,
980
1005
  tooltip: tooltip,
981
1006
  key: name,
982
- onClick: function onClick() {
983
- var _a;
984
- var selection = (0, _api.getSelection)(context);
985
- if (!selection) {
986
- setContext(function (ctx) {
987
- (0, _api.setSelection)(ctx, [{
988
- row: [0, 0],
989
- column: [0, 0]
990
- }], {
991
- id: context.currentSheetId
992
- });
993
- });
994
- }
995
- (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
996
- setTimeout(function () {
997
- setShowDataValidation(true);
998
- }, 100);
999
- }
1007
+ onClick: dataVerificationClick
1000
1008
  }));
1001
1009
  }
1002
1010
  if (name === "locationCondition") {
@@ -57,7 +57,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
57
57
  getHtmlByRange: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => string | null;
58
58
  setSelection: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
59
59
  setCellValuesByRange: (data: any[][], range: import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
60
- setCellFormatByRange: (attr: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, range: import("@fileverse-dev/fortune-core").SingleRange | import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
60
+ setCellFormatByRange: (attr: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, range: import("@fileverse-dev/fortune-core").Range | import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
61
61
  mergeCells: (ranges: import("@fileverse-dev/fortune-core").Range, type: string, options?: api.CommonOptions) => void;
62
62
  cancelMerge: (ranges: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
63
63
  getAllSheets: () => SheetType[];
@@ -656,6 +656,11 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
656
656
  }
657
657
  });
658
658
  }
659
+ setContextWithProduce(function (ctx) {
660
+ if (ctx.luckysheet_selection_range) {
661
+ ctx.luckysheet_selection_range = [];
662
+ }
663
+ });
659
664
  }, [context, setContextWithProduce]);
660
665
  var onMoreToolbarItemsClose = (0, _react.useCallback)(function () {
661
666
  setMoreToolbarItems(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.1.99",
3
+ "version": "1.2.0-patch-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.1.99",
19
+ "@fileverse-dev/fortune-core": "1.2.0-patch-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",