@fileverse-dev/fortune-react 1.1.55 → 1.1.57
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/SheetOverlay/FormulaHint/dragable-div.d.ts +9 -0
- package/es/components/SheetOverlay/FormulaHint/dragable-div.js +125 -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 +77 -22
- 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/SheetOverlay/FormulaHint/dragable-div.d.ts +9 -0
- package/lib/components/SheetOverlay/FormulaHint/dragable-div.js +132 -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 +77 -22
- 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
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
15
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
import cn from "classnames";
|
|
20
|
+
import React, { forwardRef } from "react";
|
|
21
|
+
import { LucideIcons } from "./Icon";
|
|
22
|
+
export var UltimateIcons = __assign({}, LucideIcons);
|
|
23
|
+
export var LucideIcon = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
24
|
+
var name = _a.name,
|
|
25
|
+
className = _a.className,
|
|
26
|
+
strokeWidth = _a.strokeWidth,
|
|
27
|
+
size = _a.size,
|
|
28
|
+
fill = _a.fill,
|
|
29
|
+
stroke = _a.stroke,
|
|
30
|
+
props = __rest(_a, ["name", "className", "strokeWidth", "size", "fill", "stroke"]);
|
|
31
|
+
var buttonSize = size === "sm" ? "w-6 h-6" : size === "lg" ? "w-10 h-10" : "w-8 h-8";
|
|
32
|
+
var IconComponent = UltimateIcons[name];
|
|
33
|
+
if (!IconComponent) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/React.createElement(IconComponent, __assign({
|
|
37
|
+
name: name,
|
|
38
|
+
ref: ref,
|
|
39
|
+
className: cn(buttonSize, className),
|
|
40
|
+
strokeWidth: strokeWidth || 2,
|
|
41
|
+
fill: fill || "none",
|
|
42
|
+
stroke: stroke || "currentColor"
|
|
43
|
+
}, props));
|
|
44
|
+
});
|
|
45
|
+
LucideIcon.displayName = "LucideIcon";
|
|
@@ -950,3 +950,18 @@
|
|
|
950
950
|
pointer-events: none;
|
|
951
951
|
user-select: none;
|
|
952
952
|
}
|
|
953
|
+
|
|
954
|
+
.luckysheet-hint {
|
|
955
|
+
/* position: absolute; */
|
|
956
|
+
top: -18px;
|
|
957
|
+
left: 0;
|
|
958
|
+
background-color: #efc703;
|
|
959
|
+
color: #000000;
|
|
960
|
+
padding: 2px 8px;
|
|
961
|
+
font-size: 12px;
|
|
962
|
+
font-weight: 500;
|
|
963
|
+
white-space: nowrap;
|
|
964
|
+
z-index: 20;
|
|
965
|
+
pointer-events: none;
|
|
966
|
+
user-select: none;
|
|
967
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface DraggableDivProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
initialTop?: any;
|
|
6
|
+
dragHasMoved?: any;
|
|
7
|
+
}
|
|
8
|
+
export declare const DraggableDiv: ({ children, className, initialTop, dragHasMoved, }: DraggableDivProps) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.DraggableDiv = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _ui = require("@fileverse/ui");
|
|
11
|
+
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); }
|
|
12
|
+
var DraggableDiv = exports.DraggableDiv = function DraggableDiv(_a) {
|
|
13
|
+
var children = _a.children,
|
|
14
|
+
className = _a.className,
|
|
15
|
+
initialTop = _a.initialTop,
|
|
16
|
+
dragHasMoved = _a.dragHasMoved;
|
|
17
|
+
var initialX = 0;
|
|
18
|
+
var initialY = initialTop;
|
|
19
|
+
var _b = (0, _react.useState)({
|
|
20
|
+
x: initialX,
|
|
21
|
+
y: initialY
|
|
22
|
+
}),
|
|
23
|
+
position = _b[0],
|
|
24
|
+
setPosition = _b[1];
|
|
25
|
+
var _c = (0, _react.useState)(false),
|
|
26
|
+
isDragging = _c[0],
|
|
27
|
+
setIsDragging = _c[1];
|
|
28
|
+
var _d = (0, _react.useState)({
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0
|
|
31
|
+
}),
|
|
32
|
+
dragOffset = _d[0],
|
|
33
|
+
setDragOffset = _d[1];
|
|
34
|
+
var divRef = (0, _react.useRef)(null);
|
|
35
|
+
(0, _react.useEffect)(function () {
|
|
36
|
+
setPosition({
|
|
37
|
+
x: position.x,
|
|
38
|
+
y: initialTop
|
|
39
|
+
});
|
|
40
|
+
}, [initialTop]);
|
|
41
|
+
var handleMouseDown = function handleMouseDown(e) {
|
|
42
|
+
setIsDragging(true);
|
|
43
|
+
var element = document.getElementById("luckysheet-formula-help-c");
|
|
44
|
+
if (element) {
|
|
45
|
+
element.style.userSelect = "none";
|
|
46
|
+
}
|
|
47
|
+
setDragOffset({
|
|
48
|
+
x: e.clientX - position.x,
|
|
49
|
+
y: e.clientY - position.y
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
var handleTouchStart = function handleTouchStart(e) {
|
|
53
|
+
setIsDragging(true);
|
|
54
|
+
var element = document.getElementById("luckysheet-formula-help-c");
|
|
55
|
+
if (element) {
|
|
56
|
+
element.style.userSelect = "none";
|
|
57
|
+
}
|
|
58
|
+
var touch = e.touches[0];
|
|
59
|
+
setDragOffset({
|
|
60
|
+
x: touch.clientX - position.x,
|
|
61
|
+
y: touch.clientY - position.y
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var handleMouseMove = function handleMouseMove(e) {
|
|
65
|
+
if (!isDragging) return;
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
dragHasMoved.current = true;
|
|
68
|
+
setPosition(function () {
|
|
69
|
+
var newX = e.clientX - dragOffset.x;
|
|
70
|
+
var newY = e.clientY - dragOffset.y;
|
|
71
|
+
return {
|
|
72
|
+
x: newX * 1.3,
|
|
73
|
+
y: newY * 1.3
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
var handleTouchMove = function handleTouchMove(e) {
|
|
78
|
+
if (!isDragging) return;
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
dragHasMoved.current = true;
|
|
81
|
+
var touch = e.touches[0];
|
|
82
|
+
setPosition(function () {
|
|
83
|
+
var newX = touch.clientX - dragOffset.x;
|
|
84
|
+
var newY = touch.clientY - dragOffset.y;
|
|
85
|
+
return {
|
|
86
|
+
x: newX * 1.3,
|
|
87
|
+
y: newY * 1.3
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
var handleMouseUp = function handleMouseUp() {
|
|
92
|
+
setIsDragging(false);
|
|
93
|
+
var element = document.getElementById("luckysheet-formula-help-c");
|
|
94
|
+
if (element) {
|
|
95
|
+
element.style.userSelect = "auto";
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var handleTouchEnd = function handleTouchEnd() {
|
|
99
|
+
setIsDragging(false);
|
|
100
|
+
var element = document.getElementById("luckysheet-formula-help-c");
|
|
101
|
+
if (element) {
|
|
102
|
+
element.style.userSelect = "auto";
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
_react.default.useEffect(function () {
|
|
106
|
+
if (isDragging) {
|
|
107
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
108
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
109
|
+
document.addEventListener("touchmove", handleTouchMove);
|
|
110
|
+
document.addEventListener("touchend", handleTouchEnd);
|
|
111
|
+
}
|
|
112
|
+
return function () {
|
|
113
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
114
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
115
|
+
document.removeEventListener("touchmove", handleTouchMove);
|
|
116
|
+
document.removeEventListener("touchend", handleTouchEnd);
|
|
117
|
+
};
|
|
118
|
+
}, [isDragging, handleMouseMove, handleMouseUp, handleTouchMove, handleTouchEnd]);
|
|
119
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
120
|
+
ref: divRef,
|
|
121
|
+
className: (0, _ui.cn)("absolute select-none touch-none", isDragging ? "cursor-grabbing shadow-2xl z-50" : "cursor-grab shadow-lg", className),
|
|
122
|
+
style: {
|
|
123
|
+
left: "".concat(position.x, "px"),
|
|
124
|
+
top: "".concat(position.y, "px"),
|
|
125
|
+
height: "0px"
|
|
126
|
+
},
|
|
127
|
+
onMouseDown: handleMouseDown,
|
|
128
|
+
onMouseUp: handleMouseUp,
|
|
129
|
+
onTouchStart: handleTouchStart,
|
|
130
|
+
onTouchEnd: handleTouchEnd
|
|
131
|
+
}, children);
|
|
132
|
+
};
|
|
@@ -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 {
|
|
@@ -10,6 +10,7 @@ var _ui = require("@fileverse/ui");
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _context = _interopRequireDefault(require("../../../context"));
|
|
12
12
|
require("./index.css");
|
|
13
|
+
var _dragableDiv = require("./dragable-div");
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
15
|
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); }
|
|
15
16
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
@@ -24,6 +25,9 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
24
25
|
};
|
|
25
26
|
var FormulaHint = function FormulaHint(props) {
|
|
26
27
|
var _a;
|
|
28
|
+
var showFormulaHint = props.showFormulaHint,
|
|
29
|
+
handleShowFormulaHint = props.handleShowFormulaHint;
|
|
30
|
+
var dragHasMoved = (0, _react.useRef)(false);
|
|
27
31
|
var context = (0, _react.useContext)(_context.default).context;
|
|
28
32
|
var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
29
33
|
var formulaMore = (0, _fortuneCore.locale)(context).formulaMore;
|
|
@@ -37,7 +41,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
37
41
|
var _d = (0, _react.useState)(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
|
|
38
42
|
isKeyAdded = _d[0],
|
|
39
43
|
setApiKeyAdded = _d[1];
|
|
40
|
-
var
|
|
44
|
+
var formulaExpand = localStorage.getItem("formula-expand") === "true";
|
|
45
|
+
var _e = (0, _react.useState)(formulaExpand),
|
|
41
46
|
showFunctionBody = _e[0],
|
|
42
47
|
setShouldShowFunctionBody = _e[1];
|
|
43
48
|
(0, _react.useEffect)(function () {
|
|
@@ -54,6 +59,9 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
54
59
|
var _f = (0, _react.useState)(0),
|
|
55
60
|
top = _f[0],
|
|
56
61
|
setTop = _f[1];
|
|
62
|
+
var _g = (0, _react.useState)(false),
|
|
63
|
+
showDelayedHint = _g[0],
|
|
64
|
+
setShowDelayedHint = _g[1];
|
|
57
65
|
var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
|
|
58
66
|
var _a, _b, _c;
|
|
59
67
|
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;
|
|
@@ -67,7 +75,14 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
67
75
|
};
|
|
68
76
|
(0, _react.useEffect)(function () {
|
|
69
77
|
calcuatePopUpPlacement();
|
|
70
|
-
});
|
|
78
|
+
}, []);
|
|
79
|
+
(0, _react.useEffect)(function () {
|
|
80
|
+
if (!top) {
|
|
81
|
+
setTimeout(function () {
|
|
82
|
+
setShowDelayedHint(true);
|
|
83
|
+
}, 40);
|
|
84
|
+
}
|
|
85
|
+
}, [top]);
|
|
71
86
|
(0, _react.useEffect)(function () {
|
|
72
87
|
var el = document.getElementById("function-details");
|
|
73
88
|
var handleWheel;
|
|
@@ -103,12 +118,44 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
103
118
|
};
|
|
104
119
|
}, []);
|
|
105
120
|
if (!fn) return null;
|
|
106
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
121
|
+
return /*#__PURE__*/_react.default.createElement(_dragableDiv.DraggableDiv, {
|
|
122
|
+
initialTop: top,
|
|
123
|
+
dragHasMoved: dragHasMoved,
|
|
124
|
+
className: "bg-secondary text-secondary-foreground p-4 rounded-lg flex items-center justify-center ".concat(showDelayedHint ? "opacity-100" : "opacity-0")
|
|
125
|
+
}, showFormulaHint && (/*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("button", {
|
|
126
|
+
type: "button",
|
|
127
|
+
className: "flex items-center justify-center w-4 h-4 rounded-full",
|
|
128
|
+
style: {
|
|
129
|
+
backgroundColor: "black",
|
|
130
|
+
zIndex: 2000,
|
|
131
|
+
position: "absolute",
|
|
132
|
+
left: "327px",
|
|
133
|
+
top: "-8px"
|
|
134
|
+
},
|
|
135
|
+
onClick: handleShowFormulaHint,
|
|
136
|
+
"aria-label": "Close formula hint"
|
|
137
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
138
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
139
|
+
className: " text-white",
|
|
140
|
+
style: {
|
|
141
|
+
width: "12px",
|
|
142
|
+
height: "12px"
|
|
143
|
+
},
|
|
144
|
+
fill: "none",
|
|
145
|
+
viewBox: "0 0 24 24",
|
|
146
|
+
stroke: "currentColor",
|
|
147
|
+
strokeWidth: "3"
|
|
148
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
149
|
+
strokeLinecap: "round",
|
|
150
|
+
strokeLinejoin: "round",
|
|
151
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
152
|
+
}))), /*#__PURE__*/_react.default.createElement("div", __assign({}, props, {
|
|
107
153
|
ref: hintRef,
|
|
108
154
|
id: "luckysheet-formula-help-c",
|
|
109
155
|
className: "luckysheet-formula-help-c",
|
|
110
156
|
style: {
|
|
111
|
-
top:
|
|
157
|
+
top: "0px",
|
|
158
|
+
left: "0px",
|
|
112
159
|
borderWidth: "1px",
|
|
113
160
|
borderColor: (fn === null || fn === void 0 ? void 0 : fn.BRAND_SECONDARY_COLOR) ? fn === null || fn === void 0 ? void 0 : fn.BRAND_SECONDARY_COLOR : "#F8F9FA",
|
|
114
161
|
backgroundColor: "".concat(fn.BRAND_COLOR ? fn.BRAND_COLOR : "#F8F9FA"),
|
|
@@ -129,9 +176,13 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
129
176
|
"aria-hidden": "true"
|
|
130
177
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
131
178
|
onClick: function onClick() {
|
|
132
|
-
|
|
179
|
+
if (!dragHasMoved.current) {
|
|
180
|
+
localStorage.setItem("formula-expand", "".concat(!showFunctionBody));
|
|
181
|
+
setShouldShowFunctionBody(!showFunctionBody);
|
|
182
|
+
}
|
|
183
|
+
dragHasMoved.current = false;
|
|
133
184
|
},
|
|
134
|
-
className: "flex cursor-pointer items-
|
|
185
|
+
className: "flex cursor-pointer items-start justify-between",
|
|
135
186
|
style: {
|
|
136
187
|
backgroundColor: "".concat(fn.BRAND_COLOR ? fn.BRAND_COLOR : "#F8F9FA"),
|
|
137
188
|
padding: "10px",
|
|
@@ -143,11 +194,11 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
143
194
|
style: {
|
|
144
195
|
fontWeight: 500
|
|
145
196
|
},
|
|
146
|
-
className: "luckysheet-arguments-help-function-name"
|
|
197
|
+
className: "luckysheet-arguments-help-function-name font-family-mono mb-1 mt-2 color-text-default font-family-mono"
|
|
147
198
|
}, fn.n), /*#__PURE__*/_react.default.createElement("code", {
|
|
148
|
-
className: "luckysheet-arguments-paren"
|
|
199
|
+
className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
|
|
149
200
|
}, "("), /*#__PURE__*/_react.default.createElement("code", {
|
|
150
|
-
className: "luckysheet-arguments-parameter-holder"
|
|
201
|
+
className: "luckysheet-arguments-parameter-holder font-family-mono mb-1 mt-2 color-text-default"
|
|
151
202
|
}, fn.p.map(function (param, i) {
|
|
152
203
|
var name = param.name;
|
|
153
204
|
if (param.repeat === "y") {
|
|
@@ -157,12 +208,12 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
157
208
|
name = "[".concat(name, "]");
|
|
158
209
|
}
|
|
159
210
|
return /*#__PURE__*/_react.default.createElement("code", {
|
|
160
|
-
className: "luckysheet-arguments-help-parameter",
|
|
211
|
+
className: "luckysheet-arguments-help-parameter font-family-mono mb-1 mt-2 color-text-default",
|
|
161
212
|
dir: "auto",
|
|
162
213
|
key: name
|
|
163
214
|
}, name, i !== fn.p.length - 1 && ", ");
|
|
164
215
|
})), /*#__PURE__*/_react.default.createElement("code", {
|
|
165
|
-
className: "luckysheet-arguments-paren"
|
|
216
|
+
className: "luckysheet-arguments-paren font-family-mono mb-1 mt-2 color-text-default"
|
|
166
217
|
}, ")")), /*#__PURE__*/_react.default.createElement("div", {
|
|
167
218
|
style: {
|
|
168
219
|
display: "flex",
|
|
@@ -208,14 +259,15 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
208
259
|
id: "function-details",
|
|
209
260
|
style: {
|
|
210
261
|
backgroundColor: "".concat(fn.BRAND_COLOR ? fn.BRAND_COLOR : "#F8F9FA"),
|
|
211
|
-
maxHeight: "
|
|
262
|
+
maxHeight: "284px",
|
|
212
263
|
overflowY: "scroll"
|
|
213
264
|
}
|
|
214
265
|
}, fn.API_KEY && (/*#__PURE__*/_react.default.createElement("div", {
|
|
215
266
|
style: {
|
|
216
267
|
borderLeft: "4px solid ".concat(isKeyAdded ? "#177E23" : "#fb923c"),
|
|
217
268
|
backgroundColor: "white",
|
|
218
|
-
padding: "
|
|
269
|
+
padding: "8px",
|
|
270
|
+
paddingBottom: "2px",
|
|
219
271
|
margin: "4px 4px 0px 4px",
|
|
220
272
|
borderRadius: "4px"
|
|
221
273
|
}
|
|
@@ -254,7 +306,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
254
306
|
setApiKeyAdded(false);
|
|
255
307
|
}
|
|
256
308
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
257
|
-
className: "flex justify-end mt-2"
|
|
309
|
+
className: "flex justify-end mt-2 mb-2"
|
|
258
310
|
}, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
259
311
|
onClick: function onClick() {
|
|
260
312
|
localStorage.setItem(fn.API_KEY, API_KEY);
|
|
@@ -268,16 +320,17 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
268
320
|
backgroundColor: "white",
|
|
269
321
|
padding: "6px",
|
|
270
322
|
margin: "4px 4px 0px 4px",
|
|
271
|
-
borderRadius: "4px"
|
|
323
|
+
borderRadius: "4px",
|
|
324
|
+
marginTop: "-1px"
|
|
272
325
|
}
|
|
273
326
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
274
327
|
className: ""
|
|
275
328
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
276
329
|
style: {
|
|
277
330
|
lineHeight: "16px",
|
|
278
|
-
fontSize: "
|
|
331
|
+
fontSize: "14px"
|
|
279
332
|
},
|
|
280
|
-
className: "
|
|
333
|
+
className: "font-family-mono mb-1 color-text-default jetbrains-mono"
|
|
281
334
|
}, formulaMore.helpExample), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("code", {
|
|
282
335
|
style: {
|
|
283
336
|
overflowWrap: "break-word"
|
|
@@ -307,10 +360,10 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
307
360
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
308
361
|
style: {
|
|
309
362
|
lineHeight: "16px",
|
|
310
|
-
fontSize: "
|
|
363
|
+
fontSize: "14px",
|
|
311
364
|
padding: "0px"
|
|
312
365
|
},
|
|
313
|
-
className: "
|
|
366
|
+
className: "font-family-mono mb-1 mt-2 color-text-default"
|
|
314
367
|
}, "About"), /*#__PURE__*/_react.default.createElement("span", {
|
|
315
368
|
className: "luckysheet-arguments-help-parameter-content text-helper-text-sm"
|
|
316
369
|
}, fn.d))), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -322,7 +375,9 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
322
375
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
323
376
|
className: "",
|
|
324
377
|
key: param.name
|
|
325
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("code",
|
|
378
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("code", {
|
|
379
|
+
className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono"
|
|
380
|
+
}, param.name, param.repeat === "y" && (/*#__PURE__*/_react.default.createElement("span", {
|
|
326
381
|
className: "luckysheet-arguments-help-argument-info example-value",
|
|
327
382
|
style: {
|
|
328
383
|
marginTop: "2px"
|
|
@@ -338,7 +393,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
338
393
|
marginTop: "2px"
|
|
339
394
|
}
|
|
340
395
|
}, param.detail));
|
|
341
|
-
}))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
396
|
+
}))))), showFunctionBody && (/*#__PURE__*/_react.default.createElement("div", {
|
|
342
397
|
style: {
|
|
343
398
|
backgroundColor: "".concat(fn.BRAND_COLOR ? fn.BRAND_COLOR : "#F8F9FA"),
|
|
344
399
|
padding: "8px",
|
|
@@ -352,6 +407,6 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
352
407
|
(_a = document.getElementById("function-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
353
408
|
},
|
|
354
409
|
className: "color-text-link cursor-pointer text-helper-text-sm"
|
|
355
|
-
}, "Learn More")));
|
|
410
|
+
}, "Learn More")))))));
|
|
356
411
|
};
|
|
357
412
|
var _default = exports.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 {
|
|
@@ -28,7 +28,7 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
28
28
|
var _b = (0, _react.useContext)(_context.default),
|
|
29
29
|
context = _b.context,
|
|
30
30
|
isAuthorized = _b.settings.isAuthorized;
|
|
31
|
-
var authedFunction = ["COINGECKO", "ETHERSCAN", "DEFILLAMA", "GNOSIS", "BASE", "EOA", "PNL", "SAFE", "BLOCKSCOUT", "
|
|
31
|
+
var authedFunction = ["COINGECKO", "ETHERSCAN", "DEFILLAMA", "GNOSIS", "BASE", "EOA", "PNL", "SAFE", "BLOCKSCOUT", "LENS", "FARCASTER", "Ethereum", "SMARTCONTRACT", "DUNESIM"];
|
|
32
32
|
var filteredDefaultCandidates = context.defaultCandidates.filter(function (item) {
|
|
33
33
|
return !authedFunction.includes(item.n);
|
|
34
34
|
});
|
|
@@ -53,19 +53,22 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
53
53
|
var hintAbove = hintHeight > availableBelow;
|
|
54
54
|
var selectionHeight = (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0;
|
|
55
55
|
var divOffset = ((_c = hintRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) || 0;
|
|
56
|
-
|
|
56
|
+
var topV = hintAbove ? selectionHeight - (divOffset + 80) : selectionHeight + 4;
|
|
57
|
+
setTop(topV);
|
|
57
58
|
};
|
|
58
59
|
(0, _react.useEffect)(function () {
|
|
59
60
|
calcuatePopUpPlacement();
|
|
60
61
|
});
|
|
61
62
|
if (_lodash.default.isEmpty(context.functionCandidates) && _lodash.default.isEmpty(context.defaultCandidates)) return null;
|
|
62
|
-
return /*#__PURE__*/_react.default.createElement("div",
|
|
63
|
-
|
|
64
|
-
id: "luckysheet-formula-search-c",
|
|
65
|
-
className: "luckysheet-formula-search-c",
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
64
|
+
className: "flex flex-col luckysheet-formula-search-c-p",
|
|
66
65
|
style: {
|
|
67
66
|
top: top
|
|
68
67
|
}
|
|
68
|
+
}, /*#__PURE__*/_react.default.createElement("div", __assign({}, props, {
|
|
69
|
+
ref: hintRef,
|
|
70
|
+
id: "luckysheet-formula-search-c",
|
|
71
|
+
className: "luckysheet-formula-search-c"
|
|
69
72
|
}), context.defaultCandidates.length > 0 && (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
70
73
|
style: {
|
|
71
74
|
marginBottom: "4px"
|
|
@@ -109,14 +112,14 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
109
112
|
height: "16px"
|
|
110
113
|
}
|
|
111
114
|
});
|
|
112
|
-
})))))), context.defaultCandidates.length > 0 ? (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, finalDefaultCandidates.map(function (v) {
|
|
115
|
+
})))))), context.defaultCandidates.length > 0 ? (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, finalDefaultCandidates.map(function (v, index) {
|
|
113
116
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
114
117
|
key: v.n,
|
|
115
118
|
"data-func": v.n,
|
|
116
119
|
style: {
|
|
117
120
|
cursor: "pointer"
|
|
118
121
|
},
|
|
119
|
-
className: "luckysheet-formula-search-item"
|
|
122
|
+
className: "luckysheet-formula-search-item ".concat(index === 0 ? "luckysheet-formula-search-item-active" : "")
|
|
120
123
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
121
124
|
style: {
|
|
122
125
|
display: "flex",
|
|
@@ -164,11 +167,11 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
164
167
|
})))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
165
168
|
className: "luckysheet-formula-search-detail mt-1 text-helper-text-sm color-text-default"
|
|
166
169
|
}, v.d));
|
|
167
|
-
}))) : (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, finalFunctionCandidates.length > 0 && finalFunctionCandidates.map(function (v) {
|
|
170
|
+
}))) : (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, finalFunctionCandidates.length > 0 && finalFunctionCandidates.map(function (v, index) {
|
|
168
171
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
169
172
|
key: v.n,
|
|
170
173
|
"data-func": v.n,
|
|
171
|
-
className: "luckysheet-formula-search-item"
|
|
174
|
+
className: "luckysheet-formula-search-item ".concat(index === 0 ? "luckysheet-formula-search-item-active" : "")
|
|
172
175
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
173
176
|
style: {
|
|
174
177
|
display: "flex",
|
|
@@ -253,8 +256,10 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
253
256
|
height: "16px"
|
|
254
257
|
}
|
|
255
258
|
});
|
|
256
|
-
})))))))), /*#__PURE__*/_react.default.createElement("
|
|
257
|
-
className: "
|
|
259
|
+
}))))))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
260
|
+
className: "p-2 pt-0"
|
|
261
|
+
}, /*#__PURE__*/_react.default.createElement("hr", {
|
|
262
|
+
className: "color-border-default mb-2"
|
|
258
263
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
259
264
|
style: {
|
|
260
265
|
paddingLeft: "10px",
|
|
@@ -265,6 +270,6 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
265
270
|
className: "border p-1 color-text-default rounded"
|
|
266
271
|
}, "Tab"), /*#__PURE__*/_react.default.createElement("p", {
|
|
267
272
|
className: "color-text-secondary"
|
|
268
|
-
}, "to insert")));
|
|
273
|
+
}, "to insert"))));
|
|
269
274
|
};
|
|
270
275
|
var _default = exports.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
|
+
};
|