@fileverse-dev/fortune-react 1.1.9 → 1.1.10-live-query-v6
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: "Average",
|
|
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: "Cells",
|
|
25
|
-
value:
|
|
24
|
+
label: "Number of 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: "Average",
|
|
32
32
|
count: "Count",
|
|
33
33
|
max: "Max",
|
|
34
34
|
min: "Min",
|
|
35
|
-
numberC: "Cells",
|
|
35
|
+
numberC: "Number of 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,51 +242,35 @@ 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 &&
|
|
245
|
+
}, calInfo.count > 0 && /*#__PURE__*/React.createElement("p", {
|
|
246
246
|
className: "text-body-sm"
|
|
247
|
-
}, STATS_LABELS[selectedStat], ":
|
|
247
|
+
}, STATS_LABELS[selectedStat], ": ", calInfo[selectedStat]))), /*#__PURE__*/React.createElement(PopoverContent, {
|
|
248
248
|
align: "end",
|
|
249
249
|
alignOffset: 0,
|
|
250
|
-
className: "export-content color-border-default shadow-elevation-3
|
|
250
|
+
className: "w-72 export-content color-border-default shadow-elevation-3",
|
|
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
|
-
|
|
259
|
-
}, STATS.map(function (option) {
|
|
255
|
+
className: "p-2 color-text-default color-border-default"
|
|
256
|
+
}, /*#__PURE__*/React.createElement("h1", {
|
|
257
|
+
className: "text-helper-text-sm color-text-secondary pl-2 mb-2"
|
|
258
|
+
}, "Sort By"), STATS.map(function (option) {
|
|
260
259
|
return /*#__PURE__*/React.createElement(Button, {
|
|
261
260
|
variant: "ghost",
|
|
262
261
|
key: option.value,
|
|
263
|
-
className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition
|
|
262
|
+
className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition ".concat(selectedStat === option.value && 'bg-[#F8F9FA]'),
|
|
264
263
|
onClick: function onClick() {
|
|
265
264
|
return setSelectedStat(option.value);
|
|
266
265
|
}
|
|
267
266
|
}, /*#__PURE__*/React.createElement("div", {
|
|
268
|
-
className: "flex gap-2 items-center
|
|
269
|
-
}, selectedStat === option.value && (/*#__PURE__*/React.createElement(
|
|
270
|
-
className: "w-[20px] h-[20px]"
|
|
271
|
-
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
267
|
+
className: "flex gap-2 items-center"
|
|
268
|
+
}, selectedStat === option.value && (/*#__PURE__*/React.createElement(LucideIcon, {
|
|
272
269
|
name: "Check",
|
|
273
270
|
size: "sm"
|
|
274
|
-
}))
|
|
275
|
-
className: "text-body-sm
|
|
276
|
-
|
|
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]))));
|
|
271
|
+
})), /*#__PURE__*/React.createElement("p", {
|
|
272
|
+
className: "text-body-sm"
|
|
273
|
+
}, option.label, ": ", calInfo[option.value])));
|
|
290
274
|
})))), /*#__PURE__*/React.createElement(ZoomControl, null))));
|
|
291
275
|
};
|
|
292
276
|
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: "Average",
|
|
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: "Cells",
|
|
34
|
-
value:
|
|
33
|
+
label: "Number of 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: "Average",
|
|
41
41
|
count: "Count",
|
|
42
42
|
max: "Max",
|
|
43
43
|
min: "Min",
|
|
44
|
-
numberC: "Cells",
|
|
44
|
+
numberC: "Number of 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,51 +251,35 @@ 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 &&
|
|
254
|
+
}, calInfo.count > 0 && /*#__PURE__*/_react.default.createElement("p", {
|
|
255
255
|
className: "text-body-sm"
|
|
256
|
-
}, STATS_LABELS[selectedStat], ":
|
|
256
|
+
}, STATS_LABELS[selectedStat], ": ", calInfo[selectedStat]))), /*#__PURE__*/_react.default.createElement(_ui.PopoverContent, {
|
|
257
257
|
align: "end",
|
|
258
258
|
alignOffset: 0,
|
|
259
|
-
className: "export-content color-border-default shadow-elevation-3
|
|
259
|
+
className: "w-72 export-content color-border-default shadow-elevation-3",
|
|
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
|
-
|
|
268
|
-
}, STATS.map(function (option) {
|
|
264
|
+
className: "p-2 color-text-default color-border-default"
|
|
265
|
+
}, /*#__PURE__*/_react.default.createElement("h1", {
|
|
266
|
+
className: "text-helper-text-sm color-text-secondary pl-2 mb-2"
|
|
267
|
+
}, "Sort By"), STATS.map(function (option) {
|
|
269
268
|
return /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
270
269
|
variant: "ghost",
|
|
271
270
|
key: option.value,
|
|
272
|
-
className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition
|
|
271
|
+
className: "w-full h-8 rounded p-2 m-1 text-left flex items-center justify-between transition ".concat(selectedStat === option.value && 'bg-[#F8F9FA]'),
|
|
273
272
|
onClick: function onClick() {
|
|
274
273
|
return setSelectedStat(option.value);
|
|
275
274
|
}
|
|
276
275
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
277
|
-
className: "flex gap-2 items-center
|
|
278
|
-
}, selectedStat === option.value && (/*#__PURE__*/_react.default.createElement(
|
|
279
|
-
className: "w-[20px] h-[20px]"
|
|
280
|
-
}, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
|
|
276
|
+
className: "flex gap-2 items-center"
|
|
277
|
+
}, selectedStat === option.value && (/*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
|
|
281
278
|
name: "Check",
|
|
282
279
|
size: "sm"
|
|
283
|
-
}))
|
|
284
|
-
className: "text-body-sm
|
|
285
|
-
|
|
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]))));
|
|
280
|
+
})), /*#__PURE__*/_react.default.createElement("p", {
|
|
281
|
+
className: "text-body-sm"
|
|
282
|
+
}, option.label, ": ", calInfo[option.value])));
|
|
299
283
|
})))), /*#__PURE__*/_react.default.createElement(_ZoomControl.default, null))));
|
|
300
284
|
};
|
|
301
285
|
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.10-live-query-v6",
|
|
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.10-live-query-v6",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-21",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|