@fileverse-dev/fortune-react 1.1.55-smooth-scroll-1 → 1.1.56
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.
- package/es/components/Sheet/index.js +21 -4
- package/es/components/SheetOverlay/FormulaHint/dragable-div.d.ts +11 -0
- package/es/components/SheetOverlay/FormulaHint/dragable-div.js +87 -0
- package/es/components/SheetOverlay/FormulaHint/index.css +8 -4
- package/es/components/SheetOverlay/FormulaHint/index.d.ts +1 -1
- package/es/components/SheetOverlay/FormulaHint/index.js +76 -23
- package/es/components/SheetOverlay/FormulaSearch/index.css +13 -3
- package/es/components/SheetOverlay/FormulaSearch/index.js +18 -13
- package/es/components/SheetOverlay/Icon.d.ts +18 -0
- package/es/components/SheetOverlay/Icon.js +383 -0
- package/es/components/SheetOverlay/InputBox.js +83 -25
- package/es/components/SheetOverlay/LucideIcon.d.ts +30 -0
- package/es/components/SheetOverlay/LucideIcon.js +45 -0
- package/es/components/SheetOverlay/index.css +15 -0
- package/lib/components/Sheet/index.js +19 -2
- package/lib/components/SheetOverlay/FormulaHint/dragable-div.d.ts +11 -0
- package/lib/components/SheetOverlay/FormulaHint/dragable-div.js +93 -0
- package/lib/components/SheetOverlay/FormulaHint/index.css +8 -4
- package/lib/components/SheetOverlay/FormulaHint/index.d.ts +1 -1
- package/lib/components/SheetOverlay/FormulaHint/index.js +76 -23
- package/lib/components/SheetOverlay/FormulaSearch/index.css +13 -3
- package/lib/components/SheetOverlay/FormulaSearch/index.js +18 -13
- package/lib/components/SheetOverlay/Icon.d.ts +18 -0
- package/lib/components/SheetOverlay/Icon.js +390 -0
- package/lib/components/SheetOverlay/InputBox.js +83 -25
- package/lib/components/SheetOverlay/LucideIcon.d.ts +30 -0
- package/lib/components/SheetOverlay/LucideIcon.js +54 -0
- package/lib/components/SheetOverlay/index.css +15 -0
- package/package.json +2 -2
- package/es/components/Sheet/use-smooth-scroll.d.ts +0 -2
- package/es/components/Sheet/use-smooth-scroll.js +0 -85
- package/lib/components/Sheet/use-smooth-scroll.d.ts +0 -2
- package/lib/components/Sheet/use-smooth-scroll.js +0 -92
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useContext } from "react";
|
|
2
|
-
import { Canvas, updateContextWithCanvas, updateContextWithSheetData, initFreeze, cellFadeAnimator } from "@fileverse-dev/fortune-core";
|
|
1
|
+
import React, { useRef, useEffect, useContext, useCallback } from "react";
|
|
2
|
+
import { Canvas, updateContextWithCanvas, updateContextWithSheetData, handleGlobalWheel, initFreeze, cellFadeAnimator } from "@fileverse-dev/fortune-core";
|
|
3
3
|
import "./index.css";
|
|
4
4
|
import WorkbookContext from "../../context";
|
|
5
5
|
import SheetOverlay from "../SheetOverlay";
|
|
6
|
-
import { useSmoothScroll } from "./use-smooth-scroll";
|
|
7
6
|
var Sheet = function Sheet(_a) {
|
|
8
7
|
var _b, _c, _d;
|
|
9
8
|
var sheet = _a.sheet;
|
|
@@ -150,7 +149,25 @@ var Sheet = function Sheet(_a) {
|
|
|
150
149
|
return cellFadeAnimator.setOnTick(null);
|
|
151
150
|
};
|
|
152
151
|
}, [context, refs.canvas, refs.globalCache.freezen, setContext, sheet.id]);
|
|
153
|
-
|
|
152
|
+
var onWheel = useCallback(function (e) {
|
|
153
|
+
var _a, _b;
|
|
154
|
+
var functionDetailsEl = document.getElementById("function-details");
|
|
155
|
+
var formulaSearchEl = document.getElementById("luckysheet-formula-search-c");
|
|
156
|
+
var isMouseOverFunctionDetails = functionDetailsEl === null || functionDetailsEl === void 0 ? void 0 : functionDetailsEl.matches(":hover");
|
|
157
|
+
var isMouseOverFormulaSearch = formulaSearchEl === null || formulaSearchEl === void 0 ? void 0 : formulaSearchEl.matches(":hover");
|
|
158
|
+
if (functionDetailsEl && isMouseOverFunctionDetails || formulaSearchEl && isMouseOverFormulaSearch || ((_b = (_a = refs === null || refs === void 0 ? void 0 : refs.globalCache) === null || _a === void 0 ? void 0 : _a.searchDialog) === null || _b === void 0 ? void 0 : _b.mouseEnter)) return;
|
|
159
|
+
setContext(function (draftCtx) {
|
|
160
|
+
handleGlobalWheel(draftCtx, e, refs.globalCache, refs.scrollbarX.current, refs.scrollbarY.current);
|
|
161
|
+
});
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
}, [refs.globalCache, refs.scrollbarX, refs.scrollbarY, setContext]);
|
|
164
|
+
useEffect(function () {
|
|
165
|
+
var container = containerRef.current;
|
|
166
|
+
container === null || container === void 0 ? void 0 : container.addEventListener("wheel", onWheel);
|
|
167
|
+
return function () {
|
|
168
|
+
container === null || container === void 0 ? void 0 : container.removeEventListener("wheel", onWheel);
|
|
169
|
+
};
|
|
170
|
+
}, [onWheel]);
|
|
154
171
|
return /*#__PURE__*/React.createElement("div", {
|
|
155
172
|
ref: containerRef,
|
|
156
173
|
className: "fortune-sheet-container"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface DraggableDivProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
initialX?: number;
|
|
6
|
+
initialY?: number;
|
|
7
|
+
initialPos?: any;
|
|
8
|
+
dragHasMoved?: any;
|
|
9
|
+
}
|
|
10
|
+
export declare function DraggableDiv({ children, className, initialPos, dragHasMoved }: DraggableDivProps): React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { useEffect } from "react";
|
|
4
|
+
import { useState, useRef } from "react";
|
|
5
|
+
import { cn } from "@fileverse/ui";
|
|
6
|
+
export function DraggableDiv(_a) {
|
|
7
|
+
var children = _a.children,
|
|
8
|
+
className = _a.className,
|
|
9
|
+
initialPos = _a.initialPos,
|
|
10
|
+
dragHasMoved = _a.dragHasMoved;
|
|
11
|
+
var initialX = 0,
|
|
12
|
+
initialY = initialPos;
|
|
13
|
+
var _b = useState({
|
|
14
|
+
x: initialX,
|
|
15
|
+
y: initialY
|
|
16
|
+
}),
|
|
17
|
+
position = _b[0],
|
|
18
|
+
setPosition = _b[1];
|
|
19
|
+
var _c = useState(false),
|
|
20
|
+
isDragging = _c[0],
|
|
21
|
+
setIsDragging = _c[1];
|
|
22
|
+
var _d = useState({
|
|
23
|
+
x: 0,
|
|
24
|
+
y: 0
|
|
25
|
+
}),
|
|
26
|
+
dragOffset = _d[0],
|
|
27
|
+
setDragOffset = _d[1];
|
|
28
|
+
var divRef = useRef(null);
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
setPosition({
|
|
31
|
+
x: position.x,
|
|
32
|
+
y: initialPos
|
|
33
|
+
});
|
|
34
|
+
}, [initialPos]);
|
|
35
|
+
var handleMouseDown = function handleMouseDown(e) {
|
|
36
|
+
setIsDragging(true);
|
|
37
|
+
var element = document.getElementById('luckysheet-formula-help-c');
|
|
38
|
+
if (element) {
|
|
39
|
+
element.style.userSelect = 'none';
|
|
40
|
+
}
|
|
41
|
+
setDragOffset({
|
|
42
|
+
x: e.clientX - position.x,
|
|
43
|
+
y: e.clientY - position.y
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
var handleMouseMove = function handleMouseMove(e) {
|
|
47
|
+
if (!isDragging) return;
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
dragHasMoved.current = true;
|
|
50
|
+
setPosition(function (currentPosition) {
|
|
51
|
+
var newX = e.clientX - dragOffset.x;
|
|
52
|
+
var newY = e.clientY - dragOffset.y;
|
|
53
|
+
return {
|
|
54
|
+
x: newX * 1.3,
|
|
55
|
+
y: newY * 1.3
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
var handleMouseUp = function handleMouseUp() {
|
|
60
|
+
setIsDragging(false);
|
|
61
|
+
var element = document.getElementById('luckysheet-formula-help-c');
|
|
62
|
+
if (element) {
|
|
63
|
+
element.style.userSelect = 'auto';
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
if (isDragging) {
|
|
68
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
69
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
70
|
+
return function () {
|
|
71
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
72
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
76
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
ref: divRef,
|
|
78
|
+
className: cn("absolute select-none touch-none", isDragging ? "cursor-grabbing shadow-2xl z-50" : "cursor-grab shadow-lg", className),
|
|
79
|
+
style: {
|
|
80
|
+
left: "".concat(position.x, "px"),
|
|
81
|
+
top: "".concat(position.y, "px"),
|
|
82
|
+
height: "0px"
|
|
83
|
+
},
|
|
84
|
+
onMouseDown: handleMouseDown,
|
|
85
|
+
onMouseUp: handleMouseUp
|
|
86
|
+
}, children);
|
|
87
|
+
}
|
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
width: 300px;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
.font-family-mono {
|
|
13
|
+
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
}
|
|
17
|
+
|
|
12
18
|
/* .luckysheet-formula-help-c .luckysheet-formula-help-content {
|
|
13
19
|
max-height: 300px;
|
|
14
20
|
overflow-y: scroll;
|
|
@@ -29,25 +35,23 @@
|
|
|
29
35
|
|
|
30
36
|
.luckysheet-formula-help-title,
|
|
31
37
|
.luckysheet-formula-search-item-active {
|
|
32
|
-
padding: 10px !important;
|
|
38
|
+
padding: 4px 10px !important;
|
|
33
39
|
font-size: small;
|
|
34
40
|
/* background: #f8f9fa !important; */
|
|
35
41
|
font-weight: 600;
|
|
36
42
|
border-bottom: 0px !important;
|
|
37
43
|
border-top: 0px !important;
|
|
44
|
+
border-radius: 4px;
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
.luckysheet-formula-help-c,
|
|
41
48
|
.luckysheet-formula-search-c {
|
|
42
49
|
padding: 6px;
|
|
43
50
|
user-select: text;
|
|
44
|
-
border-radius: 10px;
|
|
45
51
|
top: 25px;
|
|
46
52
|
background: #ffff;
|
|
47
53
|
min-width: 300px;
|
|
48
54
|
/* max-width: 450px; */
|
|
49
|
-
border: 1px solid lavender;
|
|
50
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
#luckysheet-formula-help-c {
|
|
@@ -13,8 +13,10 @@ import { Button, TextField, LucideIcon } from "@fileverse/ui";
|
|
|
13
13
|
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
14
14
|
import WorkbookContext from "../../../context";
|
|
15
15
|
import "./index.css";
|
|
16
|
+
import { DraggableDiv } from "./dragable-div";
|
|
16
17
|
var FormulaHint = function FormulaHint(props) {
|
|
17
18
|
var _a;
|
|
19
|
+
var dragHasMoved = useRef(false);
|
|
18
20
|
var context = useContext(WorkbookContext).context;
|
|
19
21
|
var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
20
22
|
var formulaMore = locale(context).formulaMore;
|
|
@@ -28,7 +30,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
28
30
|
var _d = useState(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
|
|
29
31
|
isKeyAdded = _d[0],
|
|
30
32
|
setApiKeyAdded = _d[1];
|
|
31
|
-
var
|
|
33
|
+
var formulaExpand = localStorage.getItem("formula-expand") === "true";
|
|
34
|
+
var _e = useState(formulaExpand),
|
|
32
35
|
showFunctionBody = _e[0],
|
|
33
36
|
setShouldShowFunctionBody = _e[1];
|
|
34
37
|
useEffect(function () {
|
|
@@ -45,6 +48,9 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
45
48
|
var _f = useState(0),
|
|
46
49
|
top = _f[0],
|
|
47
50
|
setTop = _f[1];
|
|
51
|
+
var _g = useState(false),
|
|
52
|
+
showDelayedHint = _g[0],
|
|
53
|
+
setShowDelayedHint = _g[1];
|
|
48
54
|
var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
|
|
49
55
|
var _a, _b, _c;
|
|
50
56
|
if (!((_a = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.top) === null || _a === void 0 ? void 0 : _a.toString()) || !((_b = firstSelection.height_move) === null || _b === void 0 ? void 0 : _b.toString()) || !hintRef.current) return;
|
|
@@ -58,7 +64,14 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
58
64
|
};
|
|
59
65
|
useEffect(function () {
|
|
60
66
|
calcuatePopUpPlacement();
|
|
61
|
-
});
|
|
67
|
+
}, []);
|
|
68
|
+
useEffect(function () {
|
|
69
|
+
if (!top) {
|
|
70
|
+
setTimeout(function () {
|
|
71
|
+
setShowDelayedHint(true);
|
|
72
|
+
}, 40);
|
|
73
|
+
}
|
|
74
|
+
}, [top]);
|
|
62
75
|
useEffect(function () {
|
|
63
76
|
var el = document.getElementById("function-details");
|
|
64
77
|
var handleWheel;
|
|
@@ -94,12 +107,44 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
94
107
|
};
|
|
95
108
|
}, []);
|
|
96
109
|
if (!fn) return null;
|
|
97
|
-
return /*#__PURE__*/React.createElement(
|
|
110
|
+
return /*#__PURE__*/React.createElement(DraggableDiv, {
|
|
111
|
+
initialX: 50,
|
|
112
|
+
initialY: 50,
|
|
113
|
+
initialPos: top,
|
|
114
|
+
dragHasMoved: dragHasMoved,
|
|
115
|
+
className: "bg-secondary text-secondary-foreground p-4 rounded-lg flex items-center justify-center ".concat(showDelayedHint ? "opacity-100" : "opacity-0")
|
|
116
|
+
}, props.showFormulaHint && (/*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
|
|
117
|
+
className: "flex items-center justify-center w-4 h-4 rounded-full",
|
|
118
|
+
style: {
|
|
119
|
+
backgroundColor: "black",
|
|
120
|
+
zIndex: 2000,
|
|
121
|
+
position: "absolute",
|
|
122
|
+
left: "327px",
|
|
123
|
+
top: "-8px"
|
|
124
|
+
},
|
|
125
|
+
onClick: props.handleShowFormulaHint
|
|
126
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
127
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
128
|
+
className: " text-white",
|
|
129
|
+
style: {
|
|
130
|
+
width: "12px",
|
|
131
|
+
height: "12px"
|
|
132
|
+
},
|
|
133
|
+
fill: "none",
|
|
134
|
+
viewBox: "0 0 24 24",
|
|
135
|
+
stroke: "currentColor",
|
|
136
|
+
"stroke-width": "3"
|
|
137
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
138
|
+
"stroke-linecap": "round",
|
|
139
|
+
"stroke-linejoin": "round",
|
|
140
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
141
|
+
}))), /*#__PURE__*/React.createElement("div", __assign({}, props, {
|
|
98
142
|
ref: hintRef,
|
|
99
143
|
id: "luckysheet-formula-help-c",
|
|
100
144
|
className: "luckysheet-formula-help-c",
|
|
101
145
|
style: {
|
|
102
|
-
top:
|
|
146
|
+
top: '0px',
|
|
147
|
+
left: '0px',
|
|
103
148
|
borderWidth: "1px",
|
|
104
149
|
borderColor: (fn === null || fn === void 0 ? void 0 : fn.BRAND_SECONDARY_COLOR) ? fn === null || fn === void 0 ? void 0 : fn.BRAND_SECONDARY_COLOR : "#F8F9FA",
|
|
105
150
|
backgroundColor: "".concat(fn.BRAND_COLOR ? fn.BRAND_COLOR : "#F8F9FA"),
|
|
@@ -119,10 +164,14 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
119
164
|
className: "fa fa-angle-up",
|
|
120
165
|
"aria-hidden": "true"
|
|
121
166
|
})), /*#__PURE__*/React.createElement("div", {
|
|
122
|
-
onClick: function onClick() {
|
|
123
|
-
|
|
167
|
+
onClick: function onClick(e) {
|
|
168
|
+
if (!dragHasMoved.current) {
|
|
169
|
+
localStorage.setItem('formula-expand', "".concat(!showFunctionBody));
|
|
170
|
+
setShouldShowFunctionBody(!showFunctionBody);
|
|
171
|
+
}
|
|
172
|
+
dragHasMoved.current = false;
|
|
124
173
|
},
|
|
125
|
-
className: "flex cursor-pointer items-
|
|
174
|
+
className: "flex cursor-pointer items-start justify-between",
|
|
126
175
|
style: {
|
|
127
176
|
backgroundColor: "".concat(fn.BRAND_COLOR ? fn.BRAND_COLOR : "#F8F9FA"),
|
|
128
177
|
padding: "10px",
|
|
@@ -134,11 +183,11 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
134
183
|
style: {
|
|
135
184
|
fontWeight: 500
|
|
136
185
|
},
|
|
137
|
-
className: "luckysheet-arguments-help-function-name"
|
|
186
|
+
className: "luckysheet-arguments-help-function-name font-family-mono mb-1 mt-2 color-text-default font-family-mono"
|
|
138
187
|
}, fn.n), /*#__PURE__*/React.createElement("code", {
|
|
139
|
-
className: "luckysheet-arguments-paren"
|
|
188
|
+
className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
|
|
140
189
|
}, "("), /*#__PURE__*/React.createElement("code", {
|
|
141
|
-
className: "luckysheet-arguments-parameter-holder"
|
|
190
|
+
className: "luckysheet-arguments-parameter-holder font-family-mono mb-1 mt-2 color-text-default"
|
|
142
191
|
}, fn.p.map(function (param, i) {
|
|
143
192
|
var name = param.name;
|
|
144
193
|
if (param.repeat === "y") {
|
|
@@ -148,12 +197,12 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
148
197
|
name = "[".concat(name, "]");
|
|
149
198
|
}
|
|
150
199
|
return /*#__PURE__*/React.createElement("code", {
|
|
151
|
-
className: "luckysheet-arguments-help-parameter",
|
|
200
|
+
className: "luckysheet-arguments-help-parameter font-family-mono mb-1 mt-2 color-text-default",
|
|
152
201
|
dir: "auto",
|
|
153
202
|
key: name
|
|
154
203
|
}, name, i !== fn.p.length - 1 && ", ");
|
|
155
204
|
})), /*#__PURE__*/React.createElement("code", {
|
|
156
|
-
className: "luckysheet-arguments-paren"
|
|
205
|
+
className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
|
|
157
206
|
}, ")")), /*#__PURE__*/React.createElement("div", {
|
|
158
207
|
style: {
|
|
159
208
|
display: "flex",
|
|
@@ -199,14 +248,15 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
199
248
|
id: "function-details",
|
|
200
249
|
style: {
|
|
201
250
|
backgroundColor: "".concat(fn.BRAND_COLOR ? fn.BRAND_COLOR : "#F8F9FA"),
|
|
202
|
-
maxHeight: "
|
|
251
|
+
maxHeight: "284px",
|
|
203
252
|
overflowY: "scroll"
|
|
204
253
|
}
|
|
205
254
|
}, fn.API_KEY && (/*#__PURE__*/React.createElement("div", {
|
|
206
255
|
style: {
|
|
207
256
|
borderLeft: "4px solid ".concat(isKeyAdded ? "#177E23" : "#fb923c"),
|
|
208
257
|
backgroundColor: "white",
|
|
209
|
-
padding: "
|
|
258
|
+
padding: "8px",
|
|
259
|
+
paddingBottom: "2px",
|
|
210
260
|
margin: "4px 4px 0px 4px",
|
|
211
261
|
borderRadius: "4px"
|
|
212
262
|
}
|
|
@@ -245,7 +295,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
245
295
|
setApiKeyAdded(false);
|
|
246
296
|
}
|
|
247
297
|
}), /*#__PURE__*/React.createElement("div", {
|
|
248
|
-
className: "flex justify-end mt-2"
|
|
298
|
+
className: "flex justify-end mt-2 mb-2"
|
|
249
299
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
250
300
|
onClick: function onClick() {
|
|
251
301
|
localStorage.setItem(fn.API_KEY, API_KEY);
|
|
@@ -259,16 +309,17 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
259
309
|
backgroundColor: "white",
|
|
260
310
|
padding: "6px",
|
|
261
311
|
margin: "4px 4px 0px 4px",
|
|
262
|
-
borderRadius: "4px"
|
|
312
|
+
borderRadius: "4px",
|
|
313
|
+
marginTop: "-1px"
|
|
263
314
|
}
|
|
264
315
|
}, /*#__PURE__*/React.createElement("div", {
|
|
265
316
|
className: ""
|
|
266
317
|
}, /*#__PURE__*/React.createElement("div", {
|
|
267
318
|
style: {
|
|
268
319
|
lineHeight: "16px",
|
|
269
|
-
fontSize: "
|
|
320
|
+
fontSize: "14px"
|
|
270
321
|
},
|
|
271
|
-
className: "
|
|
322
|
+
className: "font-family-mono mb-1 color-text-default jetbrains-mono"
|
|
272
323
|
}, formulaMore.helpExample), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("code", {
|
|
273
324
|
style: {
|
|
274
325
|
overflowWrap: "break-word"
|
|
@@ -298,10 +349,10 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
298
349
|
}, /*#__PURE__*/React.createElement("div", {
|
|
299
350
|
style: {
|
|
300
351
|
lineHeight: "16px",
|
|
301
|
-
fontSize: "
|
|
352
|
+
fontSize: "14px",
|
|
302
353
|
padding: "0px"
|
|
303
354
|
},
|
|
304
|
-
className: "
|
|
355
|
+
className: "font-family-mono mb-1 mt-2 color-text-default"
|
|
305
356
|
}, "About"), /*#__PURE__*/React.createElement("span", {
|
|
306
357
|
className: "luckysheet-arguments-help-parameter-content text-helper-text-sm"
|
|
307
358
|
}, fn.d))), /*#__PURE__*/React.createElement("div", {
|
|
@@ -313,7 +364,9 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
313
364
|
return /*#__PURE__*/React.createElement("div", {
|
|
314
365
|
className: "",
|
|
315
366
|
key: param.name
|
|
316
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("code",
|
|
367
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("code", {
|
|
368
|
+
className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono"
|
|
369
|
+
}, param.name, param.repeat === "y" && (/*#__PURE__*/React.createElement("span", {
|
|
317
370
|
className: "luckysheet-arguments-help-argument-info example-value",
|
|
318
371
|
style: {
|
|
319
372
|
marginTop: "2px"
|
|
@@ -329,7 +382,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
329
382
|
marginTop: "2px"
|
|
330
383
|
}
|
|
331
384
|
}, param.detail));
|
|
332
|
-
}))))), /*#__PURE__*/React.createElement("div", {
|
|
385
|
+
}))))), showFunctionBody && /*#__PURE__*/React.createElement("div", {
|
|
333
386
|
style: {
|
|
334
387
|
backgroundColor: "".concat(fn.BRAND_COLOR ? fn.BRAND_COLOR : "#F8F9FA"),
|
|
335
388
|
padding: "8px",
|
|
@@ -343,6 +396,6 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
343
396
|
(_a = document.getElementById("function-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
344
397
|
},
|
|
345
398
|
className: "color-text-link cursor-pointer text-helper-text-sm"
|
|
346
|
-
}, "Learn More")));
|
|
399
|
+
}, "Learn More"))))));
|
|
347
400
|
};
|
|
348
401
|
export default FormulaHint;
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
.luckysheet-formula-search-c {
|
|
1
|
+
.luckysheet-formula-search-c-p {
|
|
2
2
|
position: absolute;
|
|
3
|
-
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
4
3
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
5
4
|
color: #535353;
|
|
6
5
|
font-size: 12px;
|
|
7
6
|
background: #fff;
|
|
8
7
|
z-index: 1003;
|
|
8
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
9
|
+
border: 1px solid lavender;
|
|
10
|
+
border-radius: 10px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.luckysheet-formula-search-c {
|
|
14
|
+
color: #535353;
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
background: #fff;
|
|
9
17
|
width: 300px;
|
|
10
|
-
max-height:
|
|
18
|
+
max-height: 380px;
|
|
11
19
|
overflow-y: auto;
|
|
20
|
+
border-radius: 10px;
|
|
21
|
+
|
|
12
22
|
}
|
|
13
23
|
|
|
14
24
|
.luckysheet-formula-search-c .luckysheet-formula-search-item {
|
|
@@ -19,7 +19,7 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
19
19
|
var _b = useContext(WorkbookContext),
|
|
20
20
|
context = _b.context,
|
|
21
21
|
isAuthorized = _b.settings.isAuthorized;
|
|
22
|
-
var authedFunction = ["COINGECKO", "ETHERSCAN", "DEFILLAMA", "GNOSIS", "BASE", "EOA", "PNL", "SAFE", "BLOCKSCOUT", "
|
|
22
|
+
var authedFunction = ["COINGECKO", "ETHERSCAN", "DEFILLAMA", "GNOSIS", "BASE", "EOA", "PNL", "SAFE", "BLOCKSCOUT", "LENS", "FARCASTER", "Ethereum", "SMARTCONTRACT", "DUNESIM"];
|
|
23
23
|
var filteredDefaultCandidates = context.defaultCandidates.filter(function (item) {
|
|
24
24
|
return !authedFunction.includes(item.n);
|
|
25
25
|
});
|
|
@@ -44,19 +44,22 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
44
44
|
var hintAbove = hintHeight > availableBelow;
|
|
45
45
|
var selectionHeight = (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0;
|
|
46
46
|
var divOffset = ((_c = hintRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) || 0;
|
|
47
|
-
|
|
47
|
+
var topV = hintAbove ? selectionHeight - (divOffset + 80) : selectionHeight + 4;
|
|
48
|
+
setTop(topV);
|
|
48
49
|
};
|
|
49
50
|
useEffect(function () {
|
|
50
51
|
calcuatePopUpPlacement();
|
|
51
52
|
});
|
|
52
53
|
if (_.isEmpty(context.functionCandidates) && _.isEmpty(context.defaultCandidates)) return null;
|
|
53
|
-
return /*#__PURE__*/React.createElement("div",
|
|
54
|
-
|
|
55
|
-
id: "luckysheet-formula-search-c",
|
|
56
|
-
className: "luckysheet-formula-search-c",
|
|
54
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "flex flex-col luckysheet-formula-search-c-p",
|
|
57
56
|
style: {
|
|
58
57
|
top: top
|
|
59
58
|
}
|
|
59
|
+
}, /*#__PURE__*/React.createElement("div", __assign({}, props, {
|
|
60
|
+
ref: hintRef,
|
|
61
|
+
id: "luckysheet-formula-search-c",
|
|
62
|
+
className: "luckysheet-formula-search-c"
|
|
60
63
|
}), context.defaultCandidates.length > 0 && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
61
64
|
style: {
|
|
62
65
|
marginBottom: "4px"
|
|
@@ -100,14 +103,14 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
100
103
|
height: "16px"
|
|
101
104
|
}
|
|
102
105
|
});
|
|
103
|
-
})))))), context.defaultCandidates.length > 0 ? (/*#__PURE__*/React.createElement(React.Fragment, null, finalDefaultCandidates.map(function (v) {
|
|
106
|
+
})))))), context.defaultCandidates.length > 0 ? (/*#__PURE__*/React.createElement(React.Fragment, null, finalDefaultCandidates.map(function (v, index) {
|
|
104
107
|
return /*#__PURE__*/React.createElement("div", {
|
|
105
108
|
key: v.n,
|
|
106
109
|
"data-func": v.n,
|
|
107
110
|
style: {
|
|
108
111
|
cursor: "pointer"
|
|
109
112
|
},
|
|
110
|
-
className: "luckysheet-formula-search-item"
|
|
113
|
+
className: "luckysheet-formula-search-item ".concat(index === 0 ? "luckysheet-formula-search-item-active" : "")
|
|
111
114
|
}, /*#__PURE__*/React.createElement("div", {
|
|
112
115
|
style: {
|
|
113
116
|
display: "flex",
|
|
@@ -155,11 +158,11 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
155
158
|
})))))), /*#__PURE__*/React.createElement("div", {
|
|
156
159
|
className: "luckysheet-formula-search-detail mt-1 text-helper-text-sm color-text-default"
|
|
157
160
|
}, v.d));
|
|
158
|
-
}))) : (/*#__PURE__*/React.createElement(React.Fragment, null, finalFunctionCandidates.length > 0 && finalFunctionCandidates.map(function (v) {
|
|
161
|
+
}))) : (/*#__PURE__*/React.createElement(React.Fragment, null, finalFunctionCandidates.length > 0 && finalFunctionCandidates.map(function (v, index) {
|
|
159
162
|
return /*#__PURE__*/React.createElement("div", {
|
|
160
163
|
key: v.n,
|
|
161
164
|
"data-func": v.n,
|
|
162
|
-
className: "luckysheet-formula-search-item"
|
|
165
|
+
className: "luckysheet-formula-search-item ".concat(index === 0 ? "luckysheet-formula-search-item-active" : "")
|
|
163
166
|
}, /*#__PURE__*/React.createElement("div", {
|
|
164
167
|
style: {
|
|
165
168
|
display: "flex",
|
|
@@ -244,8 +247,10 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
244
247
|
height: "16px"
|
|
245
248
|
}
|
|
246
249
|
});
|
|
247
|
-
})))))))), /*#__PURE__*/React.createElement("
|
|
248
|
-
className: "
|
|
250
|
+
}))))))))), /*#__PURE__*/React.createElement("div", {
|
|
251
|
+
className: "p-2 pt-0"
|
|
252
|
+
}, /*#__PURE__*/React.createElement("hr", {
|
|
253
|
+
className: "color-border-default mb-2"
|
|
249
254
|
}), /*#__PURE__*/React.createElement("div", {
|
|
250
255
|
style: {
|
|
251
256
|
paddingLeft: "10px",
|
|
@@ -256,6 +261,6 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
256
261
|
className: "border p-1 color-text-default rounded"
|
|
257
262
|
}, "Tab"), /*#__PURE__*/React.createElement("p", {
|
|
258
263
|
className: "color-text-secondary"
|
|
259
|
-
}, "to insert")));
|
|
264
|
+
}, "to insert"))));
|
|
260
265
|
};
|
|
261
266
|
export default FormulaSearch;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LucideIconProps } from './LucideIcon';
|
|
3
|
+
export declare const LucideIcons: {
|
|
4
|
+
File3d: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
5
|
+
FileWord: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
6
|
+
FilePdf: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
7
|
+
FilePpt: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
8
|
+
FileExcel: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
9
|
+
Section: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
10
|
+
XSocial: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
11
|
+
Farcaster: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
12
|
+
Warpcast: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
13
|
+
DSheetTextDisabled: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
14
|
+
Orb: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
15
|
+
Lens: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
16
|
+
Hey: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
17
|
+
CloudSaved: ({ width, height, ...props }: LucideIconProps) => React.JSX.Element;
|
|
18
|
+
};
|