@fileverse-dev/fortune-react 1.2.98 → 1.2.99-ydoc
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/ConditionFormat/ConditionRules.d.ts +0 -1
- package/es/components/ConditionFormat/ConditionRules.js +21 -12
- package/es/components/ConditionFormat/index.js +2 -2
- package/es/components/DataVerification/RangeDialog.js +19 -8
- package/es/components/Dialog/index.js +24 -10
- package/es/components/ErrorState/index.js +6 -3
- package/es/components/LinkEidtCard/index.js +22 -13
- package/es/components/SheetOverlay/FormulaHint/index.js +48 -33
- package/es/components/SheetTab/SheetItem.js +29 -16
- package/es/components/SheetTab/index.js +35 -20
- package/es/components/Toolbar/Button.js +10 -3
- package/es/components/Toolbar/Combo.js +10 -2
- package/es/components/Toolbar/CustomButton.js +12 -3
- package/es/components/Toolbar/Select.js +7 -1
- package/es/components/Workbook/api.d.ts +2 -3
- package/es/components/Workbook/api.js +4 -4
- package/es/components/Workbook/index.d.ts +2 -3
- package/es/components/Workbook/index.js +114 -0
- package/lib/components/ConditionFormat/ConditionRules.d.ts +0 -1
- package/lib/components/ConditionFormat/ConditionRules.js +21 -12
- package/lib/components/ConditionFormat/index.js +2 -2
- package/lib/components/DataVerification/RangeDialog.js +19 -8
- package/lib/components/Dialog/index.js +24 -10
- package/lib/components/ErrorState/index.js +6 -3
- package/lib/components/LinkEidtCard/index.js +22 -13
- package/lib/components/SheetOverlay/FormulaHint/index.js +48 -33
- package/lib/components/SheetTab/SheetItem.js +29 -16
- package/lib/components/SheetTab/index.js +35 -20
- package/lib/components/Toolbar/Button.js +10 -3
- package/lib/components/Toolbar/Combo.js +10 -2
- package/lib/components/Toolbar/CustomButton.js +12 -3
- package/lib/components/Toolbar/Select.js +7 -1
- package/lib/components/Workbook/api.d.ts +2 -3
- package/lib/components/Workbook/api.js +4 -4
- package/lib/components/Workbook/index.d.ts +2 -3
- package/lib/components/Workbook/index.js +114 -0
- package/package.json +2 -2
|
@@ -47,7 +47,8 @@ var RangeDialog = function RangeDialog() {
|
|
|
47
47
|
}, [context, context.luckysheet_select_save]);
|
|
48
48
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
49
49
|
id: "range-dialog",
|
|
50
|
-
className: "fortune-dialog",
|
|
50
|
+
className: "fortune-dialog fortune-range-dialog",
|
|
51
|
+
"data-testid": "range-dialog",
|
|
51
52
|
onClick: function onClick(e) {
|
|
52
53
|
return e.stopPropagation();
|
|
53
54
|
},
|
|
@@ -65,32 +66,41 @@ var RangeDialog = function RangeDialog() {
|
|
|
65
66
|
},
|
|
66
67
|
tabIndex: 0
|
|
67
68
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
-
className: (0, _ui.cn)("flex items-center justify-between border-b color-border-default py-3 px-6")
|
|
69
|
+
className: (0, _ui.cn)("fortune-range-dialog__header flex items-center justify-between border-b color-border-default py-3 px-6"),
|
|
70
|
+
"data-testid": "range-dialog-header"
|
|
69
71
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
70
|
-
className: "text-heading-sm"
|
|
72
|
+
className: "fortune-range-dialog__heading text-heading-sm",
|
|
73
|
+
"data-testid": "range-dialog-heading"
|
|
71
74
|
}, dataVerification.selectCellRange), /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
|
|
72
75
|
icon: "X",
|
|
73
76
|
variant: "ghost",
|
|
74
77
|
onClick: close,
|
|
75
|
-
tabIndex: 0
|
|
78
|
+
tabIndex: 0,
|
|
79
|
+
className: "fortune-range-dialog__icon fortune-range-dialog__icon--close",
|
|
80
|
+
"data-testid": "range-dialog-icon-close"
|
|
76
81
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
77
|
-
className: "px-6 pb-6 pt-4 text-body-sm"
|
|
82
|
+
className: "fortune-range-dialog__para px-6 pb-6 pt-4 text-body-sm",
|
|
83
|
+
"data-testid": "range-dialog-para"
|
|
78
84
|
}, /*#__PURE__*/_react.default.createElement(_ui.TextField, {
|
|
79
85
|
className: "w-full",
|
|
80
86
|
readOnly: true,
|
|
81
87
|
placeholder: dataVerification.selectCellRange2,
|
|
82
88
|
value: rangeTxt2
|
|
83
89
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
84
|
-
className: "px-6 pb-6 flex flex-row gap-2 justify-end"
|
|
90
|
+
className: "fortune-range-dialog__actions px-6 pb-6 flex flex-row gap-2 justify-end",
|
|
91
|
+
"data-testid": "range-dialog-actions"
|
|
85
92
|
}, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
86
93
|
variant: "secondary",
|
|
94
|
+
className: "fortune-range-dialog__cta fortune-range-dialog__cta--close",
|
|
87
95
|
style: {
|
|
88
96
|
minWidth: "80px"
|
|
89
97
|
},
|
|
90
98
|
onClick: close,
|
|
91
|
-
tabIndex: 0
|
|
99
|
+
tabIndex: 0,
|
|
100
|
+
"data-testid": "range-dialog-cta-close"
|
|
92
101
|
}, button.close), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
93
102
|
variant: "default",
|
|
103
|
+
className: "fortune-range-dialog__cta fortune-range-dialog__cta--confirm",
|
|
94
104
|
style: {
|
|
95
105
|
minWidth: "80px"
|
|
96
106
|
},
|
|
@@ -100,7 +110,8 @@ var RangeDialog = function RangeDialog() {
|
|
|
100
110
|
});
|
|
101
111
|
close();
|
|
102
112
|
},
|
|
103
|
-
tabIndex: 0
|
|
113
|
+
tabIndex: 0,
|
|
114
|
+
"data-testid": "range-dialog-cta-confirm"
|
|
104
115
|
}, button.confirm)));
|
|
105
116
|
};
|
|
106
117
|
var _default = exports.default = RangeDialog;
|
|
@@ -36,46 +36,60 @@ var Dialog = function Dialog(_a) {
|
|
|
36
36
|
var button = (0, _fortuneCore.locale)(context).button;
|
|
37
37
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
38
38
|
className: "fortune-dialog",
|
|
39
|
+
"data-testid": "dialog",
|
|
39
40
|
style: __assign(__assign({}, containerStyle), ["Data validation", "Split text to columns", "Resize column"].includes(title) ? {
|
|
40
41
|
maxWidth: "unset"
|
|
41
42
|
} : {})
|
|
42
43
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
-
className: (0, _ui.cn)("flex items-center justify-between border-b color-border-default py-3 px-6")
|
|
44
|
+
className: (0, _ui.cn)("fortune-dialog__header flex items-center justify-between border-b color-border-default py-3 px-6"),
|
|
45
|
+
"data-testid": "dialog-header"
|
|
44
46
|
}, title ? (/*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
-
className: "text-heading-sm"
|
|
47
|
+
className: "fortune-dialog__heading text-heading-sm",
|
|
48
|
+
"data-testid": "dialog-heading"
|
|
46
49
|
}, title)) : (/*#__PURE__*/_react.default.createElement("div", {
|
|
47
|
-
className: "text-heading-sm"
|
|
50
|
+
className: "fortune-dialog__heading text-heading-sm",
|
|
51
|
+
"data-testid": "dialog-heading"
|
|
48
52
|
}, "Oops! Something went wrong")), /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
|
|
49
53
|
icon: "X",
|
|
50
54
|
variant: "ghost",
|
|
51
55
|
onClick: onCancel,
|
|
52
|
-
tabIndex: 0
|
|
56
|
+
tabIndex: 0,
|
|
57
|
+
className: "fortune-dialog__icon fortune-dialog__icon--close",
|
|
58
|
+
"data-testid": "dialog-icon-close"
|
|
53
59
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
54
|
-
className: "px-6 pb-6 pt-4 text-body-sm",
|
|
55
|
-
style: contentStyle
|
|
60
|
+
className: "fortune-dialog__para px-6 pb-6 pt-4 text-body-sm",
|
|
61
|
+
style: contentStyle,
|
|
62
|
+
"data-testid": "dialog-para"
|
|
56
63
|
}, children), type != null && (/*#__PURE__*/_react.default.createElement("div", {
|
|
57
|
-
className: "px-6 pb-6 flex flex-row gap-2 justify-end"
|
|
64
|
+
className: "fortune-dialog__actions px-6 pb-6 flex flex-row gap-2 justify-end",
|
|
65
|
+
"data-testid": "dialog-actions"
|
|
58
66
|
}, type === "ok" ? (/*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
59
67
|
variant: "default",
|
|
68
|
+
className: "fortune-dialog__cta fortune-dialog__cta--confirm",
|
|
60
69
|
style: {
|
|
61
70
|
minWidth: "80px"
|
|
62
71
|
},
|
|
63
72
|
onClick: onOk,
|
|
64
|
-
tabIndex: 0
|
|
73
|
+
tabIndex: 0,
|
|
74
|
+
"data-testid": "dialog-cta-confirm"
|
|
65
75
|
}, okLabel || button.confirm)) : (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
66
76
|
variant: "secondary",
|
|
77
|
+
className: "fortune-dialog__cta fortune-dialog__cta--cancel",
|
|
67
78
|
style: {
|
|
68
79
|
minWidth: "80px"
|
|
69
80
|
},
|
|
70
81
|
onClick: onCancel,
|
|
71
|
-
tabIndex: 0
|
|
82
|
+
tabIndex: 0,
|
|
83
|
+
"data-testid": "dialog-cta-cancel"
|
|
72
84
|
}, cancelLabel || button.cancel), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
73
85
|
variant: "default",
|
|
86
|
+
className: "fortune-dialog__cta fortune-dialog__cta--confirm",
|
|
74
87
|
style: {
|
|
75
88
|
minWidth: "80px"
|
|
76
89
|
},
|
|
77
90
|
onClick: onOk,
|
|
78
|
-
tabIndex: 0
|
|
91
|
+
tabIndex: 0,
|
|
92
|
+
"data-testid": "dialog-cta-confirm"
|
|
79
93
|
}, okLabel || button.confirm))))));
|
|
80
94
|
};
|
|
81
95
|
var _default = exports.default = Dialog;
|
|
@@ -31,11 +31,14 @@ var ErrorBoxes = function ErrorBoxes() {
|
|
|
31
31
|
zIndex: 100,
|
|
32
32
|
borderRadius: "4px"
|
|
33
33
|
},
|
|
34
|
-
className: "shadow-lg flex flex-col gap-2 break-all"
|
|
34
|
+
className: "fortune-error-state shadow-lg flex flex-col gap-2 break-all",
|
|
35
|
+
"data-testid": "error-state"
|
|
35
36
|
}, /*#__PURE__*/_react.default.createElement("h3", {
|
|
36
|
-
className: "text-heading-xsm color-text-danger"
|
|
37
|
+
className: "fortune-error-state__heading text-heading-xsm color-text-danger",
|
|
38
|
+
"data-testid": "error-state-heading"
|
|
37
39
|
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
-
className: "color-text-default text-body-sm"
|
|
40
|
+
className: "fortune-error-state__para color-text-default text-body-sm",
|
|
41
|
+
"data-testid": "error-state-para"
|
|
39
42
|
}, message));
|
|
40
43
|
};
|
|
41
44
|
var _default = exports.default = ErrorBoxes;
|
|
@@ -105,10 +105,13 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
105
105
|
};
|
|
106
106
|
}, [refs.globalCache, isButtonDisabled]);
|
|
107
107
|
var renderToolbarButton = (0, _react.useCallback)(function (iconId, onClick) {
|
|
108
|
+
var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
108
109
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
109
|
-
className: "fortune-toolbar-button",
|
|
110
|
+
className: "fortune-link-card__icon fortune-link-card__action fortune-link-card__action--".concat(iconIdClass, " fortune-toolbar-button"),
|
|
111
|
+
"data-icon-id": iconId,
|
|
110
112
|
onClick: onClick,
|
|
111
|
-
tabIndex: 0
|
|
113
|
+
tabIndex: 0,
|
|
114
|
+
"data-testid": "link-card-action-".concat(iconId)
|
|
112
115
|
}, /*#__PURE__*/_react.default.createElement(_SVGIcon.default, {
|
|
113
116
|
name: iconId,
|
|
114
117
|
style: {
|
|
@@ -161,19 +164,21 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
161
164
|
onKeyDown: function onKeyDown(e) {
|
|
162
165
|
e.stopPropagation();
|
|
163
166
|
},
|
|
164
|
-
className: "fortune-link-modify-modal link-toolbar",
|
|
167
|
+
className: "fortune-link-card fortune-link-modify-modal link-toolbar",
|
|
165
168
|
style: {
|
|
166
169
|
left: position.cellLeft + 20,
|
|
167
170
|
top: position.cellBottom - 5
|
|
168
|
-
}
|
|
171
|
+
},
|
|
172
|
+
"data-testid": "link-card"
|
|
169
173
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
170
|
-
className: "link-content",
|
|
174
|
+
className: "fortune-link-card__info link-content",
|
|
171
175
|
onClick: function onClick() {
|
|
172
176
|
setContext(function (draftCtx) {
|
|
173
177
|
return (0, _fortuneCore.goToLink)(draftCtx, r, c, linkType, linkAddress, refs.scrollbarX.current, refs.scrollbarY.current);
|
|
174
178
|
});
|
|
175
179
|
},
|
|
176
|
-
tabIndex: 0
|
|
180
|
+
tabIndex: 0,
|
|
181
|
+
"data-testid": "link-card-info-open"
|
|
177
182
|
}, linkType === "webpage" ? insertLink.openLink : (0, _fortuneCore.replaceHtml)(insertLink.goTo, {
|
|
178
183
|
linkAddress: linkAddress
|
|
179
184
|
})), context.allowEdit === true && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -197,13 +202,15 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
197
202
|
}));
|
|
198
203
|
}
|
|
199
204
|
return /*#__PURE__*/_react.default.createElement("div", __assign({
|
|
200
|
-
className: "fortune-link-card",
|
|
205
|
+
className: "fortune-link-card fortune-link-card--editing",
|
|
201
206
|
ref: cardRef,
|
|
202
207
|
style: {
|
|
203
208
|
left: position.cellLeft + 20,
|
|
204
209
|
top: cardTop
|
|
205
210
|
}
|
|
206
|
-
}, containerEvent
|
|
211
|
+
}, containerEvent, {
|
|
212
|
+
"data-testid": "link-card-editing"
|
|
213
|
+
}), /*#__PURE__*/_react.default.createElement(_ui.Select, {
|
|
207
214
|
value: linkType,
|
|
208
215
|
onValueChange: function onValueChange(value) {
|
|
209
216
|
if (value === "sheet") {
|
|
@@ -228,9 +235,10 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
228
235
|
value: type.value
|
|
229
236
|
}, type.text);
|
|
230
237
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
231
|
-
className: "fortune-input-with-icon"
|
|
238
|
+
className: "fortune-link-card__para fortune-input-with-icon",
|
|
239
|
+
"data-testid": "link-card-para-text"
|
|
232
240
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
233
|
-
className: "input-icon"
|
|
241
|
+
className: "fortune-link-card__icon input-icon"
|
|
234
242
|
}, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
|
|
235
243
|
name: "ALargeSmall"
|
|
236
244
|
})), /*#__PURE__*/_react.default.createElement(_ui.TextField, {
|
|
@@ -283,15 +291,16 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
283
291
|
value: sheet.name
|
|
284
292
|
}, sheet.name);
|
|
285
293
|
}))))), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
286
|
-
className: "fortune-insert-button",
|
|
294
|
+
className: "fortune-link-card__cta fortune-insert-button",
|
|
287
295
|
disabled: isButtonDisabled,
|
|
288
296
|
onClick: function onClick() {
|
|
289
297
|
if (isButtonDisabled) return;
|
|
290
298
|
_lodash.default.set(refs.globalCache, "linkCard.mouseEnter", false);
|
|
291
299
|
setContext(function (draftCtx) {
|
|
292
|
-
|
|
300
|
+
(0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress);
|
|
293
301
|
});
|
|
294
|
-
}
|
|
302
|
+
},
|
|
303
|
+
"data-testid": "link-card-cta-insert"
|
|
295
304
|
}, "Insert link"));
|
|
296
305
|
};
|
|
297
306
|
var _default = exports.default = LinkEditCard;
|
|
@@ -24,7 +24,7 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
24
24
|
return __assign.apply(this, arguments);
|
|
25
25
|
};
|
|
26
26
|
var FormulaHint = function FormulaHint(props) {
|
|
27
|
-
var _a;
|
|
27
|
+
var _a, _b, _c;
|
|
28
28
|
var showFormulaHint = props.showFormulaHint,
|
|
29
29
|
handleShowFormulaHint = props.handleShowFormulaHint,
|
|
30
30
|
commaCount = props.commaCount,
|
|
@@ -34,19 +34,19 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
34
34
|
var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
35
35
|
var formulaMore = (0, _fortuneCore.locale)(context).formulaMore;
|
|
36
36
|
var fn = functionName ? context.formulaCache.functionlistMap[functionName] : context.formulaCache.functionlistMap[(context === null || context === void 0 ? void 0 : context.functionHint) || ""];
|
|
37
|
-
var
|
|
38
|
-
API_KEY =
|
|
39
|
-
setAPI_KEY =
|
|
40
|
-
var
|
|
41
|
-
showAPInput =
|
|
42
|
-
setShowAPInput =
|
|
43
|
-
var
|
|
44
|
-
isKeyAdded =
|
|
45
|
-
setApiKeyAdded =
|
|
37
|
+
var _d = (0, _react.useState)(localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
|
|
38
|
+
API_KEY = _d[0],
|
|
39
|
+
setAPI_KEY = _d[1];
|
|
40
|
+
var _e = (0, _react.useState)(!API_KEY),
|
|
41
|
+
showAPInput = _e[0],
|
|
42
|
+
setShowAPInput = _e[1];
|
|
43
|
+
var _f = (0, _react.useState)(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
|
|
44
|
+
isKeyAdded = _f[0],
|
|
45
|
+
setApiKeyAdded = _f[1];
|
|
46
46
|
var formulaExpand = localStorage.getItem("formula-expand") === "true";
|
|
47
|
-
var
|
|
48
|
-
showFunctionBody =
|
|
49
|
-
setShouldShowFunctionBody =
|
|
47
|
+
var _g = (0, _react.useState)(formulaExpand),
|
|
48
|
+
showFunctionBody = _g[0],
|
|
49
|
+
setShouldShowFunctionBody = _g[1];
|
|
50
50
|
(0, _react.useEffect)(function () {
|
|
51
51
|
if (fn) {
|
|
52
52
|
setApiKeyAdded(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY));
|
|
@@ -58,12 +58,12 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
58
58
|
ETHERSCAN_API_KEY: "Etherscan API key"
|
|
59
59
|
};
|
|
60
60
|
var hintRef = (0, _react.useRef)(null);
|
|
61
|
-
var
|
|
62
|
-
top =
|
|
63
|
-
setTop =
|
|
64
|
-
var
|
|
65
|
-
showDelayedHint =
|
|
66
|
-
setShowDelayedHint =
|
|
61
|
+
var _h = (0, _react.useState)(0),
|
|
62
|
+
top = _h[0],
|
|
63
|
+
setTop = _h[1];
|
|
64
|
+
var _j = (0, _react.useState)(false),
|
|
65
|
+
showDelayedHint = _j[0],
|
|
66
|
+
setShowDelayedHint = _j[1];
|
|
67
67
|
var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
|
|
68
68
|
var _a, _b, _c, _d, _e, _f;
|
|
69
69
|
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;
|
|
@@ -103,6 +103,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
103
103
|
}
|
|
104
104
|
}, [top]);
|
|
105
105
|
if (!fn) return null;
|
|
106
|
+
var fnNameClass = fn.n ? String(fn.n).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-") : "";
|
|
106
107
|
return /*#__PURE__*/_react.default.createElement(_dragableDiv.DraggableDiv, {
|
|
107
108
|
initialTop: top,
|
|
108
109
|
dragHasMoved: dragHasMoved,
|
|
@@ -119,7 +120,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
119
120
|
}
|
|
120
121
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
121
122
|
type: "button",
|
|
122
|
-
className: "flex items-center justify-center w-4 h-4 rounded-full",
|
|
123
|
+
className: "fortune-formula-hint__icon fortune-formula-hint__action flex items-center justify-center w-4 h-4 rounded-full",
|
|
123
124
|
style: {
|
|
124
125
|
backgroundColor: "black",
|
|
125
126
|
zIndex: 2000,
|
|
@@ -130,7 +131,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
130
131
|
color: "white"
|
|
131
132
|
},
|
|
132
133
|
onClick: handleShowFormulaHint,
|
|
133
|
-
"aria-label": "Close formula hint"
|
|
134
|
+
"aria-label": "Close formula hint",
|
|
135
|
+
"data-testid": "formula-hint-icon-close"
|
|
134
136
|
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
135
137
|
xmlns: "http://www.w3.org/2000/svg",
|
|
136
138
|
width: "20",
|
|
@@ -149,7 +151,9 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
149
151
|
})))), /*#__PURE__*/_react.default.createElement("div", __assign({}, props, {
|
|
150
152
|
ref: hintRef,
|
|
151
153
|
id: "luckysheet-formula-help-c",
|
|
152
|
-
className: "luckysheet-formula-help-c",
|
|
154
|
+
className: "fortune-formula-hint fortune-formula-hint--".concat(fnNameClass || "unknown", " luckysheet-formula-help-c"),
|
|
155
|
+
"data-function-name": (_b = fn.n) !== null && _b !== void 0 ? _b : undefined,
|
|
156
|
+
"data-testid": "formula-hint-".concat((_c = fn.n) !== null && _c !== void 0 ? _c : "unknown"),
|
|
153
157
|
style: {
|
|
154
158
|
top: "0px",
|
|
155
159
|
left: "0px",
|
|
@@ -160,14 +164,16 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
160
164
|
padding: "0px"
|
|
161
165
|
}
|
|
162
166
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
163
|
-
className: "
|
|
164
|
-
title: "\u5173\u95ED"
|
|
167
|
+
className: "fortune-formula-hint__icon fortune-formula-help-close",
|
|
168
|
+
title: "\u5173\u95ED",
|
|
169
|
+
"data-testid": "formula-hint-icon-close-legacy"
|
|
165
170
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
166
171
|
className: "fa fa-times",
|
|
167
172
|
"aria-hidden": "true"
|
|
168
173
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
169
|
-
className: "
|
|
170
|
-
title: "\u6536\u8D77"
|
|
174
|
+
className: "fortune-formula-hint__icon fortune-formula-help-collapse",
|
|
175
|
+
title: "\u6536\u8D77",
|
|
176
|
+
"data-testid": "formula-hint-icon-collapse"
|
|
171
177
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
172
178
|
className: "fa fa-angle-up",
|
|
173
179
|
"aria-hidden": "true"
|
|
@@ -182,8 +188,9 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
182
188
|
}
|
|
183
189
|
dragHasMoved.current = false;
|
|
184
190
|
},
|
|
185
|
-
className: "flex !cursor-grab active:cursor-grabbing items-start justify-between",
|
|
191
|
+
className: "fortune-formula-hint__heading flex !cursor-grab active:cursor-grabbing items-start justify-between",
|
|
186
192
|
id: "luckysheet-formula-help-title",
|
|
193
|
+
"data-testid": "formula-hint-heading",
|
|
187
194
|
style: {
|
|
188
195
|
backgroundColor: "".concat(fn.BRAND_COLOR ? fn.BRAND_COLOR : "#F8F9FA"),
|
|
189
196
|
padding: "10px",
|
|
@@ -192,7 +199,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
192
199
|
userSelect: "none"
|
|
193
200
|
}
|
|
194
201
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
195
|
-
className: " flex-grow
|
|
202
|
+
className: "fortune-formula-hint__para flex-grow color-text-default",
|
|
203
|
+
"data-testid": "formula-hint-para"
|
|
196
204
|
}, /*#__PURE__*/_react.default.createElement("code", {
|
|
197
205
|
style: {
|
|
198
206
|
fontWeight: "bold"
|
|
@@ -294,12 +302,14 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
294
302
|
},
|
|
295
303
|
onClick: function onClick() {
|
|
296
304
|
return setShowAPInput(!showAPInput);
|
|
297
|
-
}
|
|
305
|
+
},
|
|
306
|
+
"data-testid": "formula-hint-info-api"
|
|
298
307
|
}, /*#__PURE__*/_react.default.createElement("h3", {
|
|
299
308
|
style: {
|
|
300
309
|
margin: "0 0 8px 0"
|
|
301
310
|
},
|
|
302
|
-
className: "text-heading-xsm color-text-default"
|
|
311
|
+
className: "fortune-formula-hint__heading-sm text-heading-xsm color-text-default",
|
|
312
|
+
"data-testid": "formula-hint-info-heading"
|
|
303
313
|
}, isKeyAdded ? "API key provided" : "API key is required"), /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
|
|
304
314
|
name: showAPInput ? "ChevronUp" : "ChevronDown",
|
|
305
315
|
width: 24,
|
|
@@ -307,11 +317,15 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
307
317
|
style: {
|
|
308
318
|
cursor: "pointer"
|
|
309
319
|
}
|
|
310
|
-
})), showAPInput && (/*#__PURE__*/_react.default.createElement("div",
|
|
320
|
+
})), showAPInput && (/*#__PURE__*/_react.default.createElement("div", {
|
|
321
|
+
className: "fortune-formula-hint__info-content",
|
|
322
|
+
"data-testid": "formula-hint-info-content"
|
|
323
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
311
324
|
style: {
|
|
312
325
|
margin: "0 0 16px 0"
|
|
313
326
|
},
|
|
314
|
-
className: "text-body-sm color-text-default"
|
|
327
|
+
className: "fortune-formula-hint__para fortune-formula-hint__para--api text-body-sm color-text-default",
|
|
328
|
+
"data-testid": "formula-hint-para-api"
|
|
315
329
|
}, "This function requires an API key. Please paste it below and\n press 'Ok'."), /*#__PURE__*/_react.default.createElement("div", {
|
|
316
330
|
className: "w-full"
|
|
317
331
|
}, /*#__PURE__*/_react.default.createElement(_ui.TextField, {
|
|
@@ -332,7 +346,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
332
346
|
setShowAPInput(false);
|
|
333
347
|
},
|
|
334
348
|
disabled: !API_KEY,
|
|
335
|
-
className: "min-w-[80px]"
|
|
349
|
+
className: "fortune-formula-hint__cta min-w-[80px]",
|
|
350
|
+
"data-testid": "formula-hint-cta-ok"
|
|
336
351
|
}, "Ok"))))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
337
352
|
style: {
|
|
338
353
|
backgroundColor: "white",
|
|
@@ -13,22 +13,28 @@ var _useAlert = require("../../hooks/useAlert");
|
|
|
13
13
|
var _SVGIcon = _interopRequireDefault(require("../SVGIcon"));
|
|
14
14
|
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
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
var toCssId = function toCssId(s) {
|
|
17
|
+
return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
18
|
+
};
|
|
16
19
|
var SheetItem = function SheetItem(_a) {
|
|
20
|
+
var _b, _c, _d, _e;
|
|
17
21
|
var sheet = _a.sheet,
|
|
18
22
|
isDropPlaceholder = _a.isDropPlaceholder;
|
|
19
|
-
var
|
|
20
|
-
context =
|
|
21
|
-
setContext =
|
|
22
|
-
refs =
|
|
23
|
-
var
|
|
24
|
-
editing =
|
|
25
|
-
setEditing =
|
|
23
|
+
var _f = (0, _react.useContext)(_context.default),
|
|
24
|
+
context = _f.context,
|
|
25
|
+
setContext = _f.setContext,
|
|
26
|
+
refs = _f.refs;
|
|
27
|
+
var _g = (0, _react.useState)(false),
|
|
28
|
+
editing = _g[0],
|
|
29
|
+
setEditing = _g[1];
|
|
26
30
|
var containerRef = (0, _react.useRef)(null);
|
|
27
31
|
var editable = (0, _react.useRef)(null);
|
|
28
|
-
var
|
|
29
|
-
dragOver =
|
|
30
|
-
setDragOver =
|
|
32
|
+
var _h = (0, _react.useState)(false),
|
|
33
|
+
dragOver = _h[0],
|
|
34
|
+
setDragOver = _h[1];
|
|
31
35
|
var showAlert = (0, _useAlert.useAlert)().showAlert;
|
|
36
|
+
var sheetIdClass = sheet.id != null ? toCssId(String(sheet.id)) : "placeholder";
|
|
37
|
+
var sheetNameClass = sheet.name ? toCssId(sheet.name) : "";
|
|
32
38
|
(0, _react.useEffect)(function () {
|
|
33
39
|
setContext(function (draftCtx) {
|
|
34
40
|
var _a, _b, _c, _d;
|
|
@@ -136,7 +142,10 @@ var SheetItem = function SheetItem(_a) {
|
|
|
136
142
|
draggable: context.allowEdit && !editing,
|
|
137
143
|
key: sheet.id,
|
|
138
144
|
ref: containerRef,
|
|
139
|
-
className: isDropPlaceholder ? "fortune-sheettab-placeholder" : "luckysheet-sheets-item".concat(context.currentSheetId === sheet.id ? " luckysheet-sheets-item-active" : ""),
|
|
145
|
+
className: isDropPlaceholder ? "fortune-sheettab-item fortune-sheettab-placeholder" : "fortune-sheettab-item fortune-sheettab-item--".concat(sheetIdClass).concat(sheetNameClass ? " fortune-sheettab-item--name-".concat(sheetNameClass) : "", " luckysheet-sheets-item").concat(context.currentSheetId === sheet.id ? " luckysheet-sheets-item-active" : ""),
|
|
146
|
+
"data-sheet-id": sheet.id != null ? String(sheet.id) : undefined,
|
|
147
|
+
"data-sheet-name": sheet.name || undefined,
|
|
148
|
+
"data-testid": "sheettab-item-".concat((_b = sheet.id) !== null && _b !== void 0 ? _b : "placeholder"),
|
|
140
149
|
onClick: function onClick() {
|
|
141
150
|
if (isDropPlaceholder) return;
|
|
142
151
|
setContext(function (draftCtx) {
|
|
@@ -180,13 +189,14 @@ var SheetItem = function SheetItem(_a) {
|
|
|
180
189
|
display: sheet.hide === 1 ? "none" : ""
|
|
181
190
|
}
|
|
182
191
|
}, editing === false && (/*#__PURE__*/_react.default.createElement("p", {
|
|
183
|
-
className: "luckysheet-sheets-item-name",
|
|
192
|
+
className: "fortune-sheettab-item__para luckysheet-sheets-item-name",
|
|
184
193
|
onDoubleClick: function onDoubleClick() {
|
|
185
194
|
if (context.isFlvReadOnly) return;
|
|
186
195
|
setEditing(true);
|
|
187
|
-
}
|
|
196
|
+
},
|
|
197
|
+
"data-testid": "sheettab-item-para-".concat((_c = sheet.id) !== null && _c !== void 0 ? _c : "placeholder")
|
|
188
198
|
}, sheet.name)), editing && (/*#__PURE__*/_react.default.createElement("span", {
|
|
189
|
-
className: "luckysheet-sheets-item-name",
|
|
199
|
+
className: "fortune-sheettab-item__para luckysheet-sheets-item-name",
|
|
190
200
|
spellCheck: "false",
|
|
191
201
|
suppressContentEditableWarning: true,
|
|
192
202
|
contentEditable: isDropPlaceholder ? false : editing,
|
|
@@ -199,13 +209,16 @@ var SheetItem = function SheetItem(_a) {
|
|
|
199
209
|
ref: editable,
|
|
200
210
|
style: dragOver ? {
|
|
201
211
|
pointerEvents: "none"
|
|
202
|
-
} : {}
|
|
212
|
+
} : {},
|
|
213
|
+
"data-testid": "sheettab-item-para-editable-".concat((_d = sheet.id) !== null && _d !== void 0 ? _d : "placeholder")
|
|
203
214
|
}, sheet.name)), /*#__PURE__*/_react.default.createElement("span", {
|
|
204
|
-
className: "luckysheet-sheets-item-function",
|
|
215
|
+
className: "fortune-sheettab-item__icon fortune-sheettab-item__action fortune-sheettab-item__icon--menu luckysheet-sheets-item-function",
|
|
205
216
|
style: {
|
|
206
217
|
marginRight: "4px",
|
|
207
218
|
marginLeft: "4px"
|
|
208
219
|
},
|
|
220
|
+
"data-sheet-id": sheet.id != null ? String(sheet.id) : undefined,
|
|
221
|
+
"data-testid": "sheettab-item-icon-menu-".concat((_e = sheet.id) !== null && _e !== void 0 ? _e : "placeholder"),
|
|
209
222
|
onClick: function onClick(e) {
|
|
210
223
|
if (isDropPlaceholder || context.allowEdit === false) return;
|
|
211
224
|
var rect = refs.workbookContainer.current.getBoundingClientRect();
|
|
@@ -139,8 +139,9 @@ var SheetTab = function SheetTab() {
|
|
|
139
139
|
});
|
|
140
140
|
var finalStats = statsFilter.length !== 6 ? [] : statsFilter;
|
|
141
141
|
return /*#__PURE__*/_react.default.createElement("div", null, showDisclaimer && (/*#__PURE__*/_react.default.createElement("div", {
|
|
142
|
-
className: "w-full",
|
|
142
|
+
className: "fortune-sheettab__info fortune-sheettab__disclaimer w-full",
|
|
143
143
|
id: "denomination-warning",
|
|
144
|
+
"data-testid": "sheettab-info-disclaimer",
|
|
144
145
|
style: {
|
|
145
146
|
zIndex: 1003,
|
|
146
147
|
position: "absolute",
|
|
@@ -157,36 +158,43 @@ var SheetTab = function SheetTab() {
|
|
|
157
158
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
158
159
|
className: "max-w-7xl mx-auto px-4 py-1 ".concat(isMobile && "w-full flex justify-between")
|
|
159
160
|
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
160
|
-
className: "".concat(isMobile ? "text-left" : "text-center", " text-xsm")
|
|
161
|
+
className: "fortune-sheettab__para ".concat(isMobile ? "text-left" : "text-center", " text-xsm"),
|
|
162
|
+
"data-testid": "sheettab-para-disclaimer"
|
|
161
163
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
162
164
|
className: "font-medium"
|
|
163
165
|
}, "Disclaimer:"), " Prices are not updated in real time and may differ slightly. Updates may be delayed by up to 20 minutes."), isMobile && (/*#__PURE__*/_react.default.createElement("p", {
|
|
164
|
-
className: "ml-4 content-center cursor-pointer",
|
|
166
|
+
className: "fortune-sheettab__action fortune-sheettab__action--close-disclaimer ml-4 content-center cursor-pointer",
|
|
165
167
|
style: {
|
|
166
168
|
alignContent: "center"
|
|
167
169
|
},
|
|
168
|
-
onClick: handleCloseDisclaimer
|
|
170
|
+
onClick: handleCloseDisclaimer,
|
|
171
|
+
"data-testid": "sheettab-action-close-disclaimer"
|
|
169
172
|
}, "Close"))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
170
|
-
className: "luckysheet-sheet-area luckysheet-noselected-text border-t color-border-default color-bg-secondary",
|
|
173
|
+
className: "fortune-sheettab luckysheet-sheet-area luckysheet-noselected-text border-t color-border-default color-bg-secondary",
|
|
171
174
|
onContextMenu: function onContextMenu(e) {
|
|
172
175
|
return e.preventDefault();
|
|
173
176
|
},
|
|
174
|
-
id: "luckysheet-sheet-area"
|
|
177
|
+
id: "luckysheet-sheet-area",
|
|
178
|
+
"data-testid": "sheettab"
|
|
175
179
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
176
|
-
id: "luckysheet-sheet-content"
|
|
180
|
+
id: "luckysheet-sheet-content",
|
|
181
|
+
className: "fortune-sheettab__content",
|
|
182
|
+
"data-testid": "sheettab-content"
|
|
177
183
|
}, context.allowEdit && (/*#__PURE__*/_react.default.createElement(_ui.IconButton, {
|
|
178
|
-
className: "fortune-sheettab-button border-none shadow-none",
|
|
184
|
+
className: "fortune-sheettab__cta fortune-sheettab-button border-none shadow-none",
|
|
179
185
|
onClick: onAddSheetClick,
|
|
180
186
|
elevation: 1,
|
|
181
187
|
icon: "Plus",
|
|
182
188
|
size: "sm",
|
|
183
|
-
variant: "secondary"
|
|
189
|
+
variant: "secondary",
|
|
190
|
+
"data-testid": "sheettab-cta-add-sheet"
|
|
184
191
|
})), context.allowEdit && (/*#__PURE__*/_react.default.createElement("div", {
|
|
185
192
|
className: "sheet-list-container"
|
|
186
193
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
187
194
|
id: "all-sheets",
|
|
188
|
-
className: "fortune-sheettab-button",
|
|
195
|
+
className: "fortune-sheettab__icon fortune-sheettab-button",
|
|
189
196
|
ref: tabContainerRef,
|
|
197
|
+
"data-testid": "sheettab-icon-all-sheets",
|
|
190
198
|
onMouseDown: function onMouseDown(e) {
|
|
191
199
|
e.stopPropagation();
|
|
192
200
|
setContext(function (ctx) {
|
|
@@ -195,14 +203,16 @@ var SheetTab = function SheetTab() {
|
|
|
195
203
|
});
|
|
196
204
|
}
|
|
197
205
|
}, /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
|
|
198
|
-
className: "fortune-sheettab-button border-none shadow-none",
|
|
206
|
+
className: "fortune-sheettab__icon fortune-sheettab-button border-none shadow-none",
|
|
199
207
|
elevation: 1,
|
|
200
208
|
icon: "Menu",
|
|
201
209
|
size: "sm",
|
|
202
|
-
variant: "secondary"
|
|
210
|
+
variant: "secondary",
|
|
211
|
+
"data-testid": "sheettab-icon-menu"
|
|
203
212
|
})))), /*#__PURE__*/_react.default.createElement("div", {
|
|
204
|
-
className: "fortune-sheettab-container",
|
|
205
|
-
id: "fortune-sheettab-container"
|
|
213
|
+
className: "fortune-sheettab__tabs fortune-sheettab-container",
|
|
214
|
+
id: "fortune-sheettab-container",
|
|
215
|
+
"data-testid": "sheettab-tabs"
|
|
206
216
|
}, !isShowBoundary && /*#__PURE__*/_react.default.createElement("div", {
|
|
207
217
|
className: "boundary boundary-left"
|
|
208
218
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -255,21 +265,24 @@ var SheetTab = function SheetTab() {
|
|
|
255
265
|
})))), /*#__PURE__*/_react.default.createElement("div", {
|
|
256
266
|
className: "fortune-sheet-area-right"
|
|
257
267
|
}, statsFilter.length === 6 && calInfo.count > 1 && (/*#__PURE__*/_react.default.createElement(_ui.Popover, null, /*#__PURE__*/_react.default.createElement(_ui.PopoverTrigger, {
|
|
258
|
-
className: "p-0 m-0 mr-2"
|
|
268
|
+
className: "fortune-sheettab__info-trigger p-0 m-0 mr-2",
|
|
269
|
+
"data-testid": "sheettab-info-stats-trigger"
|
|
259
270
|
}, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
260
271
|
variant: "ghost",
|
|
261
|
-
className: "w-full !h-6 p-2 m-1 text-left flex items-center justify-center transition mr-2 !rounded-[0px]",
|
|
272
|
+
className: "fortune-sheettab__info fortune-sheettab__info--stats w-full !h-6 p-2 m-1 text-left flex items-center justify-center transition mr-2 !rounded-[0px]",
|
|
262
273
|
style: {
|
|
263
274
|
height: "24px !important"
|
|
264
|
-
}
|
|
275
|
+
},
|
|
276
|
+
"data-testid": "sheettab-info-stats"
|
|
265
277
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
266
278
|
className: "flex items-center"
|
|
267
279
|
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
268
|
-
className: "text-body-sm",
|
|
280
|
+
className: "fortune-sheettab__para fortune-sheettab__para--stats text-body-sm",
|
|
269
281
|
style: {
|
|
270
282
|
fontWeight: "500",
|
|
271
283
|
marginRight: "8px"
|
|
272
|
-
}
|
|
284
|
+
},
|
|
285
|
+
"data-testid": "sheettab-para-stats"
|
|
273
286
|
}, STATS_LABELS[selectedStat], ":", " ", calInfo[selectedStat]), /*#__PURE__*/_react.default.createElement("svg", {
|
|
274
287
|
xmlns: "http://www.w3.org/2000/svg",
|
|
275
288
|
width: "18",
|
|
@@ -302,7 +315,9 @@ var SheetTab = function SheetTab() {
|
|
|
302
315
|
return /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
303
316
|
variant: "ghost",
|
|
304
317
|
key: option.value,
|
|
305
|
-
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]"),
|
|
318
|
+
className: "fortune-sheettab__stats-option fortune-sheettab__stats-option--".concat(option.value, " 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]"),
|
|
319
|
+
"data-stat-value": option.value,
|
|
320
|
+
"data-testid": "sheettab-stats-option-".concat(option.value),
|
|
306
321
|
onClick: function onClick() {
|
|
307
322
|
return setSelectedStat(option.value);
|
|
308
323
|
}
|