@fileverse-dev/fortune-react 1.1.99-patch-1 → 1.1.99-patch-4

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 (33) hide show
  1. package/es/components/ContextMenu/index.js +2 -2
  2. package/es/components/DataVerification/ColorPicker.js +31 -7
  3. package/es/components/DataVerification/DropdownList.js +20 -1
  4. package/es/components/DataVerification/DropdownOption.js +5 -2
  5. package/es/components/DataVerification/RangeDialog.js +1 -5
  6. package/es/components/DataVerification/index.css +20 -0
  7. package/es/components/DataVerification/index.js +29 -5
  8. package/es/components/SheetOverlay/ColumnHeader.js +88 -5
  9. package/es/components/SheetOverlay/FormulaHint/index.js +13 -2
  10. package/es/components/SheetOverlay/RowHeader.js +82 -5
  11. package/es/components/SheetOverlay/index.css +24 -1
  12. package/es/components/Toolbar/index.d.ts +1 -1
  13. package/es/components/Toolbar/index.js +23 -19
  14. package/es/components/Workbook/api.d.ts +1 -1
  15. package/es/components/Workbook/index.d.ts +10 -10
  16. package/es/components/Workbook/index.js +5 -0
  17. package/lib/components/ContextMenu/index.js +2 -2
  18. package/lib/components/DataVerification/ColorPicker.js +30 -6
  19. package/lib/components/DataVerification/DropdownList.js +20 -1
  20. package/lib/components/DataVerification/DropdownOption.js +5 -2
  21. package/lib/components/DataVerification/RangeDialog.js +1 -5
  22. package/lib/components/DataVerification/index.css +20 -0
  23. package/lib/components/DataVerification/index.js +29 -5
  24. package/lib/components/SheetOverlay/ColumnHeader.js +87 -4
  25. package/lib/components/SheetOverlay/FormulaHint/index.js +13 -2
  26. package/lib/components/SheetOverlay/RowHeader.js +80 -4
  27. package/lib/components/SheetOverlay/index.css +24 -1
  28. package/lib/components/Toolbar/index.d.ts +1 -1
  29. package/lib/components/Toolbar/index.js +22 -19
  30. package/lib/components/Workbook/api.d.ts +1 -1
  31. package/lib/components/Workbook/index.d.ts +10 -10
  32. package/lib/components/Workbook/index.js +5 -0
  33. package/package.json +2 -2
@@ -76,7 +76,13 @@ var RowHeader = function RowHeader() {
76
76
  getRowIndexClicked = _f.getRowIndexClicked,
77
77
  isRowDoubleClicked = _f.isRowDoubleClicked;
78
78
  var onMouseDown = (0, _react.useCallback)(function (e) {
79
- if (e.button !== 0) return;
79
+ if (e.button === 0 && e.target.tagName === "use" || e.button === 2) {
80
+ var nativeEvent_1 = e.nativeEvent;
81
+ setContext(function (draft) {
82
+ (0, _fortuneCore.handleRowHeaderMouseDown)(draft, refs.globalCache, nativeEvent_1, containerRef.current, refs.cellInput.current, refs.fxInput.current);
83
+ });
84
+ }
85
+ if (e.button !== 0 || context.isFlvReadOnly) return;
80
86
  var targetEl = e.target;
81
87
  if (targetEl.closest(".fortune-rows-change-size") || targetEl.closest(".fortune-rows-freeze-handle")) return;
82
88
  var headerEl = containerRef.current;
@@ -88,9 +94,9 @@ var RowHeader = function RowHeader() {
88
94
  draft.luckysheet_scroll_status = true;
89
95
  });
90
96
  } else {
91
- var nativeEvent_1 = e.nativeEvent;
97
+ var nativeEvent_2 = e.nativeEvent;
92
98
  setContext(function (draft) {
93
- (0, _fortuneCore.handleRowHeaderMouseDown)(draft, refs.globalCache, nativeEvent_1, containerRef.current, refs.cellInput.current, refs.fxInput.current);
99
+ (0, _fortuneCore.handleRowHeaderMouseDown)(draft, refs.globalCache, nativeEvent_2, containerRef.current, refs.cellInput.current, refs.fxInput.current);
94
100
  });
95
101
  return;
96
102
  }
@@ -156,6 +162,43 @@ var RowHeader = function RowHeader() {
156
162
  }
157
163
  setSelectedLocation(selects);
158
164
  }, [context.luckysheet_select_save, context.visibledatarow]);
165
+ var _g = (0, _react.useState)([]),
166
+ hiddenPointers = _g[0],
167
+ setHiddenPointers = _g[1];
168
+ (0, _react.useEffect)(function () {
169
+ var _a, _b;
170
+ if (sheetIndex == null) return;
171
+ var tempPointers = [];
172
+ var rowhidden = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.rowhidden;
173
+ if (rowhidden) {
174
+ Object.keys(rowhidden).forEach(function (key) {
175
+ var item = {
176
+ row: key,
177
+ top: context.visibledatarow[Number(key) - 1]
178
+ };
179
+ tempPointers.push(item);
180
+ });
181
+ setHiddenPointers(tempPointers);
182
+ } else {
183
+ setHiddenPointers([]);
184
+ }
185
+ }, [context.visibledatarow, sheetIndex]);
186
+ var showRow = function showRow(e, item) {
187
+ if (context.isFlvReadOnly) return;
188
+ e.stopPropagation();
189
+ setContext(function (ctx) {
190
+ var _a;
191
+ _fortuneCore.api.setSelection(ctx, [{
192
+ row: [Number(item.row) - 1, Number(item.row) + 1],
193
+ column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
194
+ }], {
195
+ id: context.currentSheetId
196
+ });
197
+ });
198
+ setContext(function (ctx) {
199
+ (0, _fortuneCore.showSelected)(ctx, "row");
200
+ });
201
+ };
159
202
  (0, _react.useEffect)(function () {
160
203
  containerRef.current.scrollTop = context.scrollTop;
161
204
  }, [context.scrollTop]);
@@ -170,7 +213,40 @@ var RowHeader = function RowHeader() {
170
213
  onMouseDown: onMouseDown,
171
214
  onMouseLeave: onMouseLeave,
172
215
  onContextMenu: onContextMenu
173
- }, /*#__PURE__*/_react.default.createElement("div", {
216
+ }, hiddenPointers.map(function (item) {
217
+ return /*#__PURE__*/_react.default.createElement("div", {
218
+ className: "flex flex-col gap-4 cursor-pointer align-center hide-btn-row hide-btn",
219
+ style: {
220
+ top: "".concat(item.top - 16, "px"),
221
+ zIndex: 100
222
+ },
223
+ onClick: function onClick(e) {
224
+ return showRow(e, item);
225
+ }
226
+ }, /*#__PURE__*/_react.default.createElement("div", {
227
+ className: "rotate-row-icon"
228
+ }, /*#__PURE__*/_react.default.createElement("svg", {
229
+ xmlns: "http://www.w3.org/2000/svg",
230
+ width: "5",
231
+ height: "8",
232
+ viewBox: "0 0 5 8",
233
+ fill: "none"
234
+ }, /*#__PURE__*/_react.default.createElement("path", {
235
+ d: "M0.164574 4.20629L3.54376 7.58548C3.7275 7.76922 4.04167 7.63909 4.04167 7.37924L4.04167 0.620865C4.04167 0.361018 3.7275 0.230885 3.54376 0.414625L0.164575 3.79381C0.0506717 3.90772 0.0506715 4.09239 0.164574 4.20629Z",
236
+ fill: "#363B3F"
237
+ }))), /*#__PURE__*/_react.default.createElement("div", {
238
+ className: "rotate-90"
239
+ }, /*#__PURE__*/_react.default.createElement("svg", {
240
+ xmlns: "http://www.w3.org/2000/svg",
241
+ width: "5",
242
+ height: "8",
243
+ viewBox: "0 0 5 8",
244
+ fill: "none"
245
+ }, /*#__PURE__*/_react.default.createElement("path", {
246
+ d: "M0.164574 4.20629L3.54376 7.58548C3.7275 7.76922 4.04167 7.63909 4.04167 7.37924L4.04167 0.620865C4.04167 0.361018 3.7275 0.230885 3.54376 0.414625L0.164575 3.79381C0.0506717 3.90772 0.0506715 4.09239 0.164574 4.20629Z",
247
+ fill: "#363B3F"
248
+ }))));
249
+ }), /*#__PURE__*/_react.default.createElement("div", {
174
250
  className: "fortune-rows-freeze-handle",
175
251
  onMouseDown: onRowFreezeHandleMouseDown,
176
252
  style: {
@@ -1010,4 +1010,27 @@
1010
1010
  background: #555;
1011
1011
  /* darker on hover */
1012
1012
  /* scrollbar */
1013
- }
1013
+ }
1014
+
1015
+ .hide-btn {
1016
+ padding-top: 1px;
1017
+ position: absolute;
1018
+ right: 5;
1019
+ top: 5px;
1020
+ z-index: 200;
1021
+ width: 9px;
1022
+ }
1023
+
1024
+ .hide-btn:hover {
1025
+ border: 1px solid #0188fb;
1026
+ }
1027
+
1028
+ .rotate-row-icon {
1029
+ transform: rotate(-90deg);
1030
+ }
1031
+
1032
+ .hide-btn-row {
1033
+ position: absolute;
1034
+ left: 4px;
1035
+ z-index: 200;
1036
+ }
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { Cell } from "@fileverse-dev/fortune-core";
3
3
  import "./index.css";
4
- export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "" | "ChevronDown" | "Undo" | "Redo" | "Underline" | "Border" | "Filter" | "Link" | "Search" | "Percent" | "PaintRoller" | "Bold" | "Italic" | "Strikethrough" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "MergeHorizontal" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "DuneChart" | "Ellipsis";
4
+ export declare const getLucideIcon: (title: string) => "Ethereum" | "DollarSign" | "Undo" | "Redo" | "Underline" | "Border" | "Filter" | "Link" | "Search" | "" | "Percent" | "ChevronDown" | "PaintRoller" | "Bold" | "Italic" | "Strikethrough" | "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "Baseline" | "PaintBucket" | "MergeHorizontal" | "DecimalsArrowLeft" | "DecimalsArrowRight" | "PaintbrushVertical" | "MessageSquarePlus" | "Image" | "Sigma" | "ShieldCheck" | "DuneChart" | "Ellipsis";
5
5
  export declare const CurrencySelector: ({ cell, defaultTextFormat, toolTipText, }: {
6
6
  cell: Cell | null | undefined;
7
7
  defaultTextFormat: string;
@@ -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/src/api");
11
10
  var _lodash = _interopRequireDefault(require("lodash"));
12
11
  var _ui = require("@fileverse/ui");
13
12
  var _dataVerificationPortal = _interopRequireDefault(require("./dataVerificationPortal"));
@@ -597,6 +596,27 @@ var Toolbar = function Toolbar(_a) {
597
596
  var _o = (0, _react.useState)(false),
598
597
  showDataValidation = _o[0],
599
598
  setShowDataValidation = _o[1];
599
+ var dataVerificationClick = function dataVerificationClick() {
600
+ var _a;
601
+ var selection = _fortuneCore.api.getSelection(context);
602
+ if (!selection) {
603
+ setContext(function (ctx) {
604
+ _fortuneCore.api.setSelection(ctx, [{
605
+ row: [0, 0],
606
+ column: [0, 0]
607
+ }], {
608
+ id: context.currentSheetId
609
+ });
610
+ });
611
+ }
612
+ (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
613
+ setTimeout(function () {
614
+ setShowDataValidation(true);
615
+ }, 100);
616
+ };
617
+ (0, _react.useEffect)(function () {
618
+ window.dataVerificationClick = dataVerificationClick;
619
+ }, []);
600
620
  var getToolbarItem = (0, _react.useCallback)(function (name, i) {
601
621
  var _a, _b, _c, _d, _e, _f, _g;
602
622
  var tooltip = toolbar[name];
@@ -979,24 +999,7 @@ var Toolbar = function Toolbar(_a) {
979
999
  iconId: name,
980
1000
  tooltip: tooltip,
981
1001
  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
- }
1002
+ onClick: dataVerificationClick
1000
1003
  }));
1001
1004
  }
1002
1005
  if (name === "locationCondition") {
@@ -109,7 +109,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
109
109
  dynamicArray_compute?: any;
110
110
  dynamicArray?: any[] | undefined;
111
111
  frozen?: {
112
- type: "column" | "rangeColumn" | "rangeBoth" | "both" | "row" | "rangeRow";
112
+ type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
113
113
  range?: {
114
114
  row_focus: number;
115
115
  column_focus: number;
@@ -12,30 +12,30 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
12
12
  applyOp: (ops: Op[]) => void;
13
13
  getCryptoPrice: typeof getCryptoPrice;
14
14
  getCellValue: (row: number, column: number, options?: api.CommonOptions & {
15
- type?: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
15
+ type?: "m" | "v" | "f" | "mc" | "rt" | "lo" | "ct" | "qp" | "spl" | "bg" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | "error" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
16
16
  }) => any;
17
17
  onboardingActiveCell: (functionName: string) => void;
18
18
  initializeComment: (row: number, column: number) => void;
19
19
  updateSheetLiveQueryList: (subsheetIndex: number, _data: import("@fileverse-dev/fortune-core").LiveQueryData) => void;
20
20
  removeFromLiveQueryList: (subSheetIndex: number, id: string) => void;
21
21
  setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
22
- type?: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
22
+ type?: "m" | "v" | "f" | "mc" | "rt" | "lo" | "ct" | "qp" | "spl" | "bg" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | "error" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
23
23
  }) => void;
24
24
  setCellError: (row: number, column: number, errorMessage: {
25
25
  title: string;
26
26
  message: string;
27
27
  }) => void;
28
28
  clearCell: (row: number, column: number, options?: api.CommonOptions) => void;
29
- setCellFormat: (row: number, column: number, 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, options?: api.CommonOptions) => void;
29
+ setCellFormat: (row: number, column: number, attr: "m" | "v" | "f" | "mc" | "rt" | "lo" | "ct" | "qp" | "spl" | "bg" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | "error" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, options?: api.CommonOptions) => void;
30
30
  autoFillCell: (copyRange: import("@fileverse-dev/fortune-core").SingleRange, applyRange: import("@fileverse-dev/fortune-core").SingleRange, direction: "left" | "right" | "down" | "up") => void;
31
- freeze: (type: "column" | "both" | "row", range: {
31
+ freeze: (type: "row" | "column" | "both", range: {
32
32
  row: number;
33
33
  column: number;
34
34
  }, options?: api.CommonOptions) => void;
35
- insertRowOrColumn: (type: "column" | "row", index: number, count: number, direction?: "lefttop" | "rightbottom", options?: api.CommonOptions) => void;
36
- deleteRowOrColumn: (type: "column" | "row", start: number, end: number, options?: api.CommonOptions) => void;
37
- hideRowOrColumn: (rowOrColInfo: string[], type: "column" | "row") => void;
38
- showRowOrColumn: (rowOrColInfo: string[], type: "column" | "row") => void;
35
+ insertRowOrColumn: (type: "row" | "column", index: number, count: number, direction?: "lefttop" | "rightbottom", options?: api.CommonOptions) => void;
36
+ deleteRowOrColumn: (type: "row" | "column", start: number, end: number, options?: api.CommonOptions) => void;
37
+ hideRowOrColumn: (rowOrColInfo: string[], type: "row" | "column") => void;
38
+ showRowOrColumn: (rowOrColInfo: string[], type: "row" | "column") => void;
39
39
  setRowHeight: (rowInfo: Record<string, number>, options?: api.CommonOptions, custom?: boolean) => void;
40
40
  setColumnWidth: (columnInfo: Record<string, number>, options?: api.CommonOptions, custom?: boolean) => void;
41
41
  getRowHeight: (rows: number[], options?: api.CommonOptions) => Record<number, number>;
@@ -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: "m" | "v" | "f" | "mc" | "rt" | "lo" | "ct" | "qp" | "spl" | "bg" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | "error" | 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[];
@@ -116,7 +116,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
116
116
  dynamicArray_compute?: any;
117
117
  dynamicArray?: any[] | undefined;
118
118
  frozen?: {
119
- type: "column" | "rangeColumn" | "rangeBoth" | "both" | "row" | "rangeRow";
119
+ type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
120
120
  range?: {
121
121
  row_focus: number;
122
122
  column_focus: number;
@@ -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-patch-1",
3
+ "version": "1.1.99-patch-4",
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-patch-1",
19
+ "@fileverse-dev/fortune-core": "1.1.99-patch-4",
20
20
  "@fileverse/ui": "^4.1.7-patch-21",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",