@fileverse-dev/fortune-react 1.1.7 → 1.1.8
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from "lodash";
|
|
2
2
|
import React, { useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
3
|
-
import { Popover, PopoverTrigger, PopoverContent, LucideIcon, Button } from
|
|
3
|
+
import { Popover, PopoverTrigger, PopoverContent, LucideIcon, Button } from "@fileverse/ui";
|
|
4
4
|
import { useMediaQuery } from "usehooks-ts";
|
|
5
5
|
import { updateCell, addSheet, calcSelectionInfo } from "@fileverse-dev/fortune-core";
|
|
6
6
|
import WorkbookContext from "../../context";
|
|
@@ -9,30 +9,30 @@ import "./index.css";
|
|
|
9
9
|
import SheetItem from "./SheetItem";
|
|
10
10
|
import ZoomControl from "../ZoomControl";
|
|
11
11
|
var STATS = [{
|
|
12
|
-
label: "
|
|
13
|
-
value:
|
|
12
|
+
label: "Avg",
|
|
13
|
+
value: "average"
|
|
14
14
|
}, {
|
|
15
15
|
label: "Count",
|
|
16
|
-
value:
|
|
16
|
+
value: "count"
|
|
17
17
|
}, {
|
|
18
18
|
label: "Max",
|
|
19
|
-
value:
|
|
19
|
+
value: "max"
|
|
20
20
|
}, {
|
|
21
21
|
label: "Min",
|
|
22
|
-
value:
|
|
22
|
+
value: "min"
|
|
23
23
|
}, {
|
|
24
|
-
label: "
|
|
25
|
-
value:
|
|
24
|
+
label: "Cells",
|
|
25
|
+
value: "numberC"
|
|
26
26
|
}, {
|
|
27
27
|
label: "Sum",
|
|
28
|
-
value:
|
|
28
|
+
value: "sum"
|
|
29
29
|
}];
|
|
30
30
|
var STATS_LABELS = {
|
|
31
|
-
average: "
|
|
31
|
+
average: "Avg",
|
|
32
32
|
count: "Count",
|
|
33
33
|
max: "Max",
|
|
34
34
|
min: "Min",
|
|
35
|
-
numberC: "
|
|
35
|
+
numberC: "Cells",
|
|
36
36
|
sum: "Sum"
|
|
37
37
|
};
|
|
38
38
|
var SheetTab = function SheetTab() {
|
|
@@ -63,7 +63,7 @@ var SheetTab = function SheetTab() {
|
|
|
63
63
|
}),
|
|
64
64
|
calInfo = _d[0],
|
|
65
65
|
setCalInfo = _d[1];
|
|
66
|
-
var _e = useState(
|
|
66
|
+
var _e = useState("sum"),
|
|
67
67
|
selectedStat = _e[0],
|
|
68
68
|
setSelectedStat = _e[1];
|
|
69
69
|
var scrollDelta = 150;
|
|
@@ -82,7 +82,7 @@ var SheetTab = function SheetTab() {
|
|
|
82
82
|
useEffect(function () {
|
|
83
83
|
var selection = context.luckysheet_select_save;
|
|
84
84
|
if (selection) {
|
|
85
|
-
var re = calcSelectionInfo(context,
|
|
85
|
+
var re = calcSelectionInfo(context, "en");
|
|
86
86
|
setCalInfo(re);
|
|
87
87
|
}
|
|
88
88
|
}, [context.luckysheet_select_save]);
|
|
@@ -242,35 +242,51 @@ var SheetTab = function SheetTab() {
|
|
|
242
242
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
243
243
|
variant: "ghost",
|
|
244
244
|
className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-center transition mr-2"
|
|
245
|
-
}, calInfo.count > 0 && /*#__PURE__*/React.createElement("p", {
|
|
245
|
+
}, calInfo.count > 0 && (/*#__PURE__*/React.createElement("p", {
|
|
246
246
|
className: "text-body-sm"
|
|
247
|
-
}, STATS_LABELS[selectedStat], ": ", calInfo[selectedStat]))), /*#__PURE__*/React.createElement(PopoverContent, {
|
|
247
|
+
}, STATS_LABELS[selectedStat], ":", " ", calInfo[selectedStat])))), /*#__PURE__*/React.createElement(PopoverContent, {
|
|
248
248
|
align: "end",
|
|
249
249
|
alignOffset: 0,
|
|
250
|
-
className: "w-72 export-content color-border-default shadow-elevation-3",
|
|
250
|
+
className: "w-72 export-content color-border-default shadow-elevation-3 w-fit",
|
|
251
251
|
elevation: 2,
|
|
252
252
|
side: "bottom",
|
|
253
253
|
sideOffset: 4
|
|
254
254
|
}, /*#__PURE__*/React.createElement("div", {
|
|
255
|
-
className: "p-2 color-text-default color-border-default"
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
className: "p-2 color-text-default color-border-default",
|
|
256
|
+
style: {
|
|
257
|
+
paddingRight: "15px"
|
|
258
|
+
}
|
|
259
|
+
}, STATS.map(function (option) {
|
|
259
260
|
return /*#__PURE__*/React.createElement(Button, {
|
|
260
261
|
variant: "ghost",
|
|
261
262
|
key: option.value,
|
|
262
|
-
className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition ".concat(selectedStat === option.value &&
|
|
263
|
+
className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition mr-2 min-w-[50px] ".concat(selectedStat === option.value && "bg-[#F8F9FA]"),
|
|
263
264
|
onClick: function onClick() {
|
|
264
265
|
return setSelectedStat(option.value);
|
|
265
266
|
}
|
|
266
267
|
}, /*#__PURE__*/React.createElement("div", {
|
|
267
|
-
className: "flex gap-2 items-center"
|
|
268
|
-
}, selectedStat === option.value && (/*#__PURE__*/React.createElement(
|
|
268
|
+
className: "flex gap-2 items-center w-full"
|
|
269
|
+
}, selectedStat === option.value && (/*#__PURE__*/React.createElement("div", {
|
|
270
|
+
className: "w-[20px] h-[20px]"
|
|
271
|
+
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
269
272
|
name: "Check",
|
|
270
273
|
size: "sm"
|
|
271
|
-
})), /*#__PURE__*/React.createElement("p", {
|
|
272
|
-
className: "text-body-sm"
|
|
273
|
-
|
|
274
|
+
}))), /*#__PURE__*/React.createElement("p", {
|
|
275
|
+
className: "text-body-sm color-text-secondary",
|
|
276
|
+
style: {
|
|
277
|
+
marginLeft: selectedStat === option.value ? 0 : '24px',
|
|
278
|
+
fontSize: "14px"
|
|
279
|
+
}
|
|
280
|
+
}, option.label, ":", " "), /*#__PURE__*/React.createElement("div", {
|
|
281
|
+
className: "flex w-full justify-end"
|
|
282
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
283
|
+
className: "font-body-sm-bold color-text-default",
|
|
284
|
+
style: {
|
|
285
|
+
marginLeft: selectedStat === option.value ? 0 : '24px',
|
|
286
|
+
fontSize: "14px",
|
|
287
|
+
fontWeight: 500
|
|
288
|
+
}
|
|
289
|
+
}, calInfo[option.value]))));
|
|
274
290
|
})))), /*#__PURE__*/React.createElement(ZoomControl, null))));
|
|
275
291
|
};
|
|
276
292
|
export default SheetTab;
|
|
@@ -18,30 +18,30 @@ var _ZoomControl = _interopRequireDefault(require("../ZoomControl"));
|
|
|
18
18
|
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); }
|
|
19
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
20
|
var STATS = [{
|
|
21
|
-
label: "
|
|
22
|
-
value:
|
|
21
|
+
label: "Avg",
|
|
22
|
+
value: "average"
|
|
23
23
|
}, {
|
|
24
24
|
label: "Count",
|
|
25
|
-
value:
|
|
25
|
+
value: "count"
|
|
26
26
|
}, {
|
|
27
27
|
label: "Max",
|
|
28
|
-
value:
|
|
28
|
+
value: "max"
|
|
29
29
|
}, {
|
|
30
30
|
label: "Min",
|
|
31
|
-
value:
|
|
31
|
+
value: "min"
|
|
32
32
|
}, {
|
|
33
|
-
label: "
|
|
34
|
-
value:
|
|
33
|
+
label: "Cells",
|
|
34
|
+
value: "numberC"
|
|
35
35
|
}, {
|
|
36
36
|
label: "Sum",
|
|
37
|
-
value:
|
|
37
|
+
value: "sum"
|
|
38
38
|
}];
|
|
39
39
|
var STATS_LABELS = {
|
|
40
|
-
average: "
|
|
40
|
+
average: "Avg",
|
|
41
41
|
count: "Count",
|
|
42
42
|
max: "Max",
|
|
43
43
|
min: "Min",
|
|
44
|
-
numberC: "
|
|
44
|
+
numberC: "Cells",
|
|
45
45
|
sum: "Sum"
|
|
46
46
|
};
|
|
47
47
|
var SheetTab = function SheetTab() {
|
|
@@ -72,7 +72,7 @@ var SheetTab = function SheetTab() {
|
|
|
72
72
|
}),
|
|
73
73
|
calInfo = _d[0],
|
|
74
74
|
setCalInfo = _d[1];
|
|
75
|
-
var _e = (0, _react.useState)(
|
|
75
|
+
var _e = (0, _react.useState)("sum"),
|
|
76
76
|
selectedStat = _e[0],
|
|
77
77
|
setSelectedStat = _e[1];
|
|
78
78
|
var scrollDelta = 150;
|
|
@@ -91,7 +91,7 @@ var SheetTab = function SheetTab() {
|
|
|
91
91
|
(0, _react.useEffect)(function () {
|
|
92
92
|
var selection = context.luckysheet_select_save;
|
|
93
93
|
if (selection) {
|
|
94
|
-
var re = (0, _fortuneCore.calcSelectionInfo)(context,
|
|
94
|
+
var re = (0, _fortuneCore.calcSelectionInfo)(context, "en");
|
|
95
95
|
setCalInfo(re);
|
|
96
96
|
}
|
|
97
97
|
}, [context.luckysheet_select_save]);
|
|
@@ -251,35 +251,51 @@ var SheetTab = function SheetTab() {
|
|
|
251
251
|
}, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
252
252
|
variant: "ghost",
|
|
253
253
|
className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-center transition mr-2"
|
|
254
|
-
}, calInfo.count > 0 && /*#__PURE__*/_react.default.createElement("p", {
|
|
254
|
+
}, calInfo.count > 0 && (/*#__PURE__*/_react.default.createElement("p", {
|
|
255
255
|
className: "text-body-sm"
|
|
256
|
-
}, STATS_LABELS[selectedStat], ": ", calInfo[selectedStat]))), /*#__PURE__*/_react.default.createElement(_ui.PopoverContent, {
|
|
256
|
+
}, STATS_LABELS[selectedStat], ":", " ", calInfo[selectedStat])))), /*#__PURE__*/_react.default.createElement(_ui.PopoverContent, {
|
|
257
257
|
align: "end",
|
|
258
258
|
alignOffset: 0,
|
|
259
|
-
className: "w-72 export-content color-border-default shadow-elevation-3",
|
|
259
|
+
className: "w-72 export-content color-border-default shadow-elevation-3 w-fit",
|
|
260
260
|
elevation: 2,
|
|
261
261
|
side: "bottom",
|
|
262
262
|
sideOffset: 4
|
|
263
263
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
264
|
-
className: "p-2 color-text-default color-border-default"
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
264
|
+
className: "p-2 color-text-default color-border-default",
|
|
265
|
+
style: {
|
|
266
|
+
paddingRight: "15px"
|
|
267
|
+
}
|
|
268
|
+
}, STATS.map(function (option) {
|
|
268
269
|
return /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
269
270
|
variant: "ghost",
|
|
270
271
|
key: option.value,
|
|
271
|
-
className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition ".concat(selectedStat === option.value &&
|
|
272
|
+
className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition mr-2 min-w-[50px] ".concat(selectedStat === option.value && "bg-[#F8F9FA]"),
|
|
272
273
|
onClick: function onClick() {
|
|
273
274
|
return setSelectedStat(option.value);
|
|
274
275
|
}
|
|
275
276
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
276
|
-
className: "flex gap-2 items-center"
|
|
277
|
-
}, selectedStat === option.value && (/*#__PURE__*/_react.default.createElement(
|
|
277
|
+
className: "flex gap-2 items-center w-full"
|
|
278
|
+
}, selectedStat === option.value && (/*#__PURE__*/_react.default.createElement("div", {
|
|
279
|
+
className: "w-[20px] h-[20px]"
|
|
280
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
|
|
278
281
|
name: "Check",
|
|
279
282
|
size: "sm"
|
|
280
|
-
})), /*#__PURE__*/_react.default.createElement("p", {
|
|
281
|
-
className: "text-body-sm"
|
|
282
|
-
|
|
283
|
+
}))), /*#__PURE__*/_react.default.createElement("p", {
|
|
284
|
+
className: "text-body-sm color-text-secondary",
|
|
285
|
+
style: {
|
|
286
|
+
marginLeft: selectedStat === option.value ? 0 : '24px',
|
|
287
|
+
fontSize: "14px"
|
|
288
|
+
}
|
|
289
|
+
}, option.label, ":", " "), /*#__PURE__*/_react.default.createElement("div", {
|
|
290
|
+
className: "flex w-full justify-end"
|
|
291
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
292
|
+
className: "font-body-sm-bold color-text-default",
|
|
293
|
+
style: {
|
|
294
|
+
marginLeft: selectedStat === option.value ? 0 : '24px',
|
|
295
|
+
fontSize: "14px",
|
|
296
|
+
fontWeight: 500
|
|
297
|
+
}
|
|
298
|
+
}, calInfo[option.value]))));
|
|
283
299
|
})))), /*#__PURE__*/_react.default.createElement(_ZoomControl.default, null))));
|
|
284
300
|
};
|
|
285
301
|
var _default = exports.default = SheetTab;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
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.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.1.8",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-21",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|