@fileverse-dev/fortune-react 1.2.98 → 1.2.99-data-validation-fix-1
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/DataVerification/helpers.d.ts +9 -0
- package/es/components/DataVerification/helpers.js +69 -0
- package/es/components/DataVerification/index.js +80 -43
- package/es/components/Dialog/index.js +24 -10
- package/es/components/ErrorState/index.js +6 -3
- package/es/components/LinkEidtCard/index.js +21 -12
- 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 +0 -1
- package/es/components/Workbook/index.d.ts +0 -1
- 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/DataVerification/helpers.d.ts +9 -0
- package/lib/components/DataVerification/helpers.js +76 -0
- package/lib/components/DataVerification/index.js +80 -43
- package/lib/components/Dialog/index.js +24 -10
- package/lib/components/ErrorState/index.js +6 -3
- package/lib/components/LinkEidtCard/index.js +21 -12
- 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 +0 -1
- package/lib/components/Workbook/index.d.ts +0 -1
- package/package.json +2 -2
|
@@ -15,7 +15,7 @@ import WorkbookContext from "../../../context";
|
|
|
15
15
|
import "./index.css";
|
|
16
16
|
import { DraggableDiv } from "./dragable-div";
|
|
17
17
|
var FormulaHint = function FormulaHint(props) {
|
|
18
|
-
var _a;
|
|
18
|
+
var _a, _b, _c;
|
|
19
19
|
var showFormulaHint = props.showFormulaHint,
|
|
20
20
|
handleShowFormulaHint = props.handleShowFormulaHint,
|
|
21
21
|
commaCount = props.commaCount,
|
|
@@ -25,19 +25,19 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
25
25
|
var firstSelection = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
26
26
|
var formulaMore = locale(context).formulaMore;
|
|
27
27
|
var fn = functionName ? context.formulaCache.functionlistMap[functionName] : context.formulaCache.functionlistMap[(context === null || context === void 0 ? void 0 : context.functionHint) || ""];
|
|
28
|
-
var
|
|
29
|
-
API_KEY =
|
|
30
|
-
setAPI_KEY =
|
|
31
|
-
var
|
|
32
|
-
showAPInput =
|
|
33
|
-
setShowAPInput =
|
|
34
|
-
var
|
|
35
|
-
isKeyAdded =
|
|
36
|
-
setApiKeyAdded =
|
|
28
|
+
var _d = useState(localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
|
|
29
|
+
API_KEY = _d[0],
|
|
30
|
+
setAPI_KEY = _d[1];
|
|
31
|
+
var _e = useState(!API_KEY),
|
|
32
|
+
showAPInput = _e[0],
|
|
33
|
+
setShowAPInput = _e[1];
|
|
34
|
+
var _f = useState(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
|
|
35
|
+
isKeyAdded = _f[0],
|
|
36
|
+
setApiKeyAdded = _f[1];
|
|
37
37
|
var formulaExpand = localStorage.getItem("formula-expand") === "true";
|
|
38
|
-
var
|
|
39
|
-
showFunctionBody =
|
|
40
|
-
setShouldShowFunctionBody =
|
|
38
|
+
var _g = useState(formulaExpand),
|
|
39
|
+
showFunctionBody = _g[0],
|
|
40
|
+
setShouldShowFunctionBody = _g[1];
|
|
41
41
|
useEffect(function () {
|
|
42
42
|
if (fn) {
|
|
43
43
|
setApiKeyAdded(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY));
|
|
@@ -49,12 +49,12 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
49
49
|
ETHERSCAN_API_KEY: "Etherscan API key"
|
|
50
50
|
};
|
|
51
51
|
var hintRef = useRef(null);
|
|
52
|
-
var
|
|
53
|
-
top =
|
|
54
|
-
setTop =
|
|
55
|
-
var
|
|
56
|
-
showDelayedHint =
|
|
57
|
-
setShowDelayedHint =
|
|
52
|
+
var _h = useState(0),
|
|
53
|
+
top = _h[0],
|
|
54
|
+
setTop = _h[1];
|
|
55
|
+
var _j = useState(false),
|
|
56
|
+
showDelayedHint = _j[0],
|
|
57
|
+
setShowDelayedHint = _j[1];
|
|
58
58
|
var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
|
|
59
59
|
var _a, _b, _c, _d, _e, _f;
|
|
60
60
|
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;
|
|
@@ -94,6 +94,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
94
94
|
}
|
|
95
95
|
}, [top]);
|
|
96
96
|
if (!fn) return null;
|
|
97
|
+
var fnNameClass = fn.n ? String(fn.n).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-") : "";
|
|
97
98
|
return /*#__PURE__*/React.createElement(DraggableDiv, {
|
|
98
99
|
initialTop: top,
|
|
99
100
|
dragHasMoved: dragHasMoved,
|
|
@@ -110,7 +111,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
110
111
|
}
|
|
111
112
|
}, /*#__PURE__*/React.createElement("button", {
|
|
112
113
|
type: "button",
|
|
113
|
-
className: "flex items-center justify-center w-4 h-4 rounded-full",
|
|
114
|
+
className: "fortune-formula-hint__icon fortune-formula-hint__action flex items-center justify-center w-4 h-4 rounded-full",
|
|
114
115
|
style: {
|
|
115
116
|
backgroundColor: "black",
|
|
116
117
|
zIndex: 2000,
|
|
@@ -121,7 +122,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
121
122
|
color: "white"
|
|
122
123
|
},
|
|
123
124
|
onClick: handleShowFormulaHint,
|
|
124
|
-
"aria-label": "Close formula hint"
|
|
125
|
+
"aria-label": "Close formula hint",
|
|
126
|
+
"data-testid": "formula-hint-icon-close"
|
|
125
127
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
126
128
|
xmlns: "http://www.w3.org/2000/svg",
|
|
127
129
|
width: "20",
|
|
@@ -140,7 +142,9 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
140
142
|
})))), /*#__PURE__*/React.createElement("div", __assign({}, props, {
|
|
141
143
|
ref: hintRef,
|
|
142
144
|
id: "luckysheet-formula-help-c",
|
|
143
|
-
className: "luckysheet-formula-help-c",
|
|
145
|
+
className: "fortune-formula-hint fortune-formula-hint--".concat(fnNameClass || "unknown", " luckysheet-formula-help-c"),
|
|
146
|
+
"data-function-name": (_b = fn.n) !== null && _b !== void 0 ? _b : undefined,
|
|
147
|
+
"data-testid": "formula-hint-".concat((_c = fn.n) !== null && _c !== void 0 ? _c : "unknown"),
|
|
144
148
|
style: {
|
|
145
149
|
top: "0px",
|
|
146
150
|
left: "0px",
|
|
@@ -151,14 +155,16 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
151
155
|
padding: "0px"
|
|
152
156
|
}
|
|
153
157
|
}), /*#__PURE__*/React.createElement("div", {
|
|
154
|
-
className: "
|
|
155
|
-
title: "\u5173\u95ED"
|
|
158
|
+
className: "fortune-formula-hint__icon fortune-formula-help-close",
|
|
159
|
+
title: "\u5173\u95ED",
|
|
160
|
+
"data-testid": "formula-hint-icon-close-legacy"
|
|
156
161
|
}, /*#__PURE__*/React.createElement("i", {
|
|
157
162
|
className: "fa fa-times",
|
|
158
163
|
"aria-hidden": "true"
|
|
159
164
|
})), /*#__PURE__*/React.createElement("div", {
|
|
160
|
-
className: "
|
|
161
|
-
title: "\u6536\u8D77"
|
|
165
|
+
className: "fortune-formula-hint__icon fortune-formula-help-collapse",
|
|
166
|
+
title: "\u6536\u8D77",
|
|
167
|
+
"data-testid": "formula-hint-icon-collapse"
|
|
162
168
|
}, /*#__PURE__*/React.createElement("i", {
|
|
163
169
|
className: "fa fa-angle-up",
|
|
164
170
|
"aria-hidden": "true"
|
|
@@ -173,8 +179,9 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
173
179
|
}
|
|
174
180
|
dragHasMoved.current = false;
|
|
175
181
|
},
|
|
176
|
-
className: "flex !cursor-grab active:cursor-grabbing items-start justify-between",
|
|
182
|
+
className: "fortune-formula-hint__heading flex !cursor-grab active:cursor-grabbing items-start justify-between",
|
|
177
183
|
id: "luckysheet-formula-help-title",
|
|
184
|
+
"data-testid": "formula-hint-heading",
|
|
178
185
|
style: {
|
|
179
186
|
backgroundColor: "".concat(fn.BRAND_COLOR ? fn.BRAND_COLOR : "#F8F9FA"),
|
|
180
187
|
padding: "10px",
|
|
@@ -183,7 +190,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
183
190
|
userSelect: "none"
|
|
184
191
|
}
|
|
185
192
|
}, /*#__PURE__*/React.createElement("div", {
|
|
186
|
-
className: " flex-grow
|
|
193
|
+
className: "fortune-formula-hint__para flex-grow color-text-default",
|
|
194
|
+
"data-testid": "formula-hint-para"
|
|
187
195
|
}, /*#__PURE__*/React.createElement("code", {
|
|
188
196
|
style: {
|
|
189
197
|
fontWeight: "bold"
|
|
@@ -285,12 +293,14 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
285
293
|
},
|
|
286
294
|
onClick: function onClick() {
|
|
287
295
|
return setShowAPInput(!showAPInput);
|
|
288
|
-
}
|
|
296
|
+
},
|
|
297
|
+
"data-testid": "formula-hint-info-api"
|
|
289
298
|
}, /*#__PURE__*/React.createElement("h3", {
|
|
290
299
|
style: {
|
|
291
300
|
margin: "0 0 8px 0"
|
|
292
301
|
},
|
|
293
|
-
className: "text-heading-xsm color-text-default"
|
|
302
|
+
className: "fortune-formula-hint__heading-sm text-heading-xsm color-text-default",
|
|
303
|
+
"data-testid": "formula-hint-info-heading"
|
|
294
304
|
}, isKeyAdded ? "API key provided" : "API key is required"), /*#__PURE__*/React.createElement(LucideIcon, {
|
|
295
305
|
name: showAPInput ? "ChevronUp" : "ChevronDown",
|
|
296
306
|
width: 24,
|
|
@@ -298,11 +308,15 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
298
308
|
style: {
|
|
299
309
|
cursor: "pointer"
|
|
300
310
|
}
|
|
301
|
-
})), showAPInput && (/*#__PURE__*/React.createElement("div",
|
|
311
|
+
})), showAPInput && (/*#__PURE__*/React.createElement("div", {
|
|
312
|
+
className: "fortune-formula-hint__info-content",
|
|
313
|
+
"data-testid": "formula-hint-info-content"
|
|
314
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
302
315
|
style: {
|
|
303
316
|
margin: "0 0 16px 0"
|
|
304
317
|
},
|
|
305
|
-
className: "text-body-sm color-text-default"
|
|
318
|
+
className: "fortune-formula-hint__para fortune-formula-hint__para--api text-body-sm color-text-default",
|
|
319
|
+
"data-testid": "formula-hint-para-api"
|
|
306
320
|
}, "This function requires an API key. Please paste it below and\n press 'Ok'."), /*#__PURE__*/React.createElement("div", {
|
|
307
321
|
className: "w-full"
|
|
308
322
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
@@ -323,7 +337,8 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
323
337
|
setShowAPInput(false);
|
|
324
338
|
},
|
|
325
339
|
disabled: !API_KEY,
|
|
326
|
-
className: "min-w-[80px]"
|
|
340
|
+
className: "fortune-formula-hint__cta min-w-[80px]",
|
|
341
|
+
"data-testid": "formula-hint-cta-ok"
|
|
327
342
|
}, "Ok"))))))), /*#__PURE__*/React.createElement("div", {
|
|
328
343
|
style: {
|
|
329
344
|
backgroundColor: "white",
|
|
@@ -4,22 +4,28 @@ import React, { useContext, useState, useEffect, useRef, useCallback } from "rea
|
|
|
4
4
|
import WorkbookContext from "../../context";
|
|
5
5
|
import { useAlert } from "../../hooks/useAlert";
|
|
6
6
|
import SVGIcon from "../SVGIcon";
|
|
7
|
+
var toCssId = function toCssId(s) {
|
|
8
|
+
return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
9
|
+
};
|
|
7
10
|
var SheetItem = function SheetItem(_a) {
|
|
11
|
+
var _b, _c, _d, _e;
|
|
8
12
|
var sheet = _a.sheet,
|
|
9
13
|
isDropPlaceholder = _a.isDropPlaceholder;
|
|
10
|
-
var
|
|
11
|
-
context =
|
|
12
|
-
setContext =
|
|
13
|
-
refs =
|
|
14
|
-
var
|
|
15
|
-
editing =
|
|
16
|
-
setEditing =
|
|
14
|
+
var _f = useContext(WorkbookContext),
|
|
15
|
+
context = _f.context,
|
|
16
|
+
setContext = _f.setContext,
|
|
17
|
+
refs = _f.refs;
|
|
18
|
+
var _g = useState(false),
|
|
19
|
+
editing = _g[0],
|
|
20
|
+
setEditing = _g[1];
|
|
17
21
|
var containerRef = useRef(null);
|
|
18
22
|
var editable = useRef(null);
|
|
19
|
-
var
|
|
20
|
-
dragOver =
|
|
21
|
-
setDragOver =
|
|
23
|
+
var _h = useState(false),
|
|
24
|
+
dragOver = _h[0],
|
|
25
|
+
setDragOver = _h[1];
|
|
22
26
|
var showAlert = useAlert().showAlert;
|
|
27
|
+
var sheetIdClass = sheet.id != null ? toCssId(String(sheet.id)) : "placeholder";
|
|
28
|
+
var sheetNameClass = sheet.name ? toCssId(sheet.name) : "";
|
|
23
29
|
useEffect(function () {
|
|
24
30
|
setContext(function (draftCtx) {
|
|
25
31
|
var _a, _b, _c, _d;
|
|
@@ -127,7 +133,10 @@ var SheetItem = function SheetItem(_a) {
|
|
|
127
133
|
draggable: context.allowEdit && !editing,
|
|
128
134
|
key: sheet.id,
|
|
129
135
|
ref: containerRef,
|
|
130
|
-
className: isDropPlaceholder ? "fortune-sheettab-placeholder" : "luckysheet-sheets-item".concat(context.currentSheetId === sheet.id ? " luckysheet-sheets-item-active" : ""),
|
|
136
|
+
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" : ""),
|
|
137
|
+
"data-sheet-id": sheet.id != null ? String(sheet.id) : undefined,
|
|
138
|
+
"data-sheet-name": sheet.name || undefined,
|
|
139
|
+
"data-testid": "sheettab-item-".concat((_b = sheet.id) !== null && _b !== void 0 ? _b : "placeholder"),
|
|
131
140
|
onClick: function onClick() {
|
|
132
141
|
if (isDropPlaceholder) return;
|
|
133
142
|
setContext(function (draftCtx) {
|
|
@@ -171,13 +180,14 @@ var SheetItem = function SheetItem(_a) {
|
|
|
171
180
|
display: sheet.hide === 1 ? "none" : ""
|
|
172
181
|
}
|
|
173
182
|
}, editing === false && (/*#__PURE__*/React.createElement("p", {
|
|
174
|
-
className: "luckysheet-sheets-item-name",
|
|
183
|
+
className: "fortune-sheettab-item__para luckysheet-sheets-item-name",
|
|
175
184
|
onDoubleClick: function onDoubleClick() {
|
|
176
185
|
if (context.isFlvReadOnly) return;
|
|
177
186
|
setEditing(true);
|
|
178
|
-
}
|
|
187
|
+
},
|
|
188
|
+
"data-testid": "sheettab-item-para-".concat((_c = sheet.id) !== null && _c !== void 0 ? _c : "placeholder")
|
|
179
189
|
}, sheet.name)), editing && (/*#__PURE__*/React.createElement("span", {
|
|
180
|
-
className: "luckysheet-sheets-item-name",
|
|
190
|
+
className: "fortune-sheettab-item__para luckysheet-sheets-item-name",
|
|
181
191
|
spellCheck: "false",
|
|
182
192
|
suppressContentEditableWarning: true,
|
|
183
193
|
contentEditable: isDropPlaceholder ? false : editing,
|
|
@@ -190,13 +200,16 @@ var SheetItem = function SheetItem(_a) {
|
|
|
190
200
|
ref: editable,
|
|
191
201
|
style: dragOver ? {
|
|
192
202
|
pointerEvents: "none"
|
|
193
|
-
} : {}
|
|
203
|
+
} : {},
|
|
204
|
+
"data-testid": "sheettab-item-para-editable-".concat((_d = sheet.id) !== null && _d !== void 0 ? _d : "placeholder")
|
|
194
205
|
}, sheet.name)), /*#__PURE__*/React.createElement("span", {
|
|
195
|
-
className: "luckysheet-sheets-item-function",
|
|
206
|
+
className: "fortune-sheettab-item__icon fortune-sheettab-item__action fortune-sheettab-item__icon--menu luckysheet-sheets-item-function",
|
|
196
207
|
style: {
|
|
197
208
|
marginRight: "4px",
|
|
198
209
|
marginLeft: "4px"
|
|
199
210
|
},
|
|
211
|
+
"data-sheet-id": sheet.id != null ? String(sheet.id) : undefined,
|
|
212
|
+
"data-testid": "sheettab-item-icon-menu-".concat((_e = sheet.id) !== null && _e !== void 0 ? _e : "placeholder"),
|
|
200
213
|
onClick: function onClick(e) {
|
|
201
214
|
if (isDropPlaceholder || context.allowEdit === false) return;
|
|
202
215
|
var rect = refs.workbookContainer.current.getBoundingClientRect();
|
|
@@ -130,8 +130,9 @@ var SheetTab = function SheetTab() {
|
|
|
130
130
|
});
|
|
131
131
|
var finalStats = statsFilter.length !== 6 ? [] : statsFilter;
|
|
132
132
|
return /*#__PURE__*/React.createElement("div", null, showDisclaimer && (/*#__PURE__*/React.createElement("div", {
|
|
133
|
-
className: "w-full",
|
|
133
|
+
className: "fortune-sheettab__info fortune-sheettab__disclaimer w-full",
|
|
134
134
|
id: "denomination-warning",
|
|
135
|
+
"data-testid": "sheettab-info-disclaimer",
|
|
135
136
|
style: {
|
|
136
137
|
zIndex: 1003,
|
|
137
138
|
position: "absolute",
|
|
@@ -148,36 +149,43 @@ var SheetTab = function SheetTab() {
|
|
|
148
149
|
}, /*#__PURE__*/React.createElement("div", {
|
|
149
150
|
className: "max-w-7xl mx-auto px-4 py-1 ".concat(isMobile && "w-full flex justify-between")
|
|
150
151
|
}, /*#__PURE__*/React.createElement("p", {
|
|
151
|
-
className: "".concat(isMobile ? "text-left" : "text-center", " text-xsm")
|
|
152
|
+
className: "fortune-sheettab__para ".concat(isMobile ? "text-left" : "text-center", " text-xsm"),
|
|
153
|
+
"data-testid": "sheettab-para-disclaimer"
|
|
152
154
|
}, /*#__PURE__*/React.createElement("span", {
|
|
153
155
|
className: "font-medium"
|
|
154
156
|
}, "Disclaimer:"), " Prices are not updated in real time and may differ slightly. Updates may be delayed by up to 20 minutes."), isMobile && (/*#__PURE__*/React.createElement("p", {
|
|
155
|
-
className: "ml-4 content-center cursor-pointer",
|
|
157
|
+
className: "fortune-sheettab__action fortune-sheettab__action--close-disclaimer ml-4 content-center cursor-pointer",
|
|
156
158
|
style: {
|
|
157
159
|
alignContent: "center"
|
|
158
160
|
},
|
|
159
|
-
onClick: handleCloseDisclaimer
|
|
161
|
+
onClick: handleCloseDisclaimer,
|
|
162
|
+
"data-testid": "sheettab-action-close-disclaimer"
|
|
160
163
|
}, "Close"))))), /*#__PURE__*/React.createElement("div", {
|
|
161
|
-
className: "luckysheet-sheet-area luckysheet-noselected-text border-t color-border-default color-bg-secondary",
|
|
164
|
+
className: "fortune-sheettab luckysheet-sheet-area luckysheet-noselected-text border-t color-border-default color-bg-secondary",
|
|
162
165
|
onContextMenu: function onContextMenu(e) {
|
|
163
166
|
return e.preventDefault();
|
|
164
167
|
},
|
|
165
|
-
id: "luckysheet-sheet-area"
|
|
168
|
+
id: "luckysheet-sheet-area",
|
|
169
|
+
"data-testid": "sheettab"
|
|
166
170
|
}, /*#__PURE__*/React.createElement("div", {
|
|
167
|
-
id: "luckysheet-sheet-content"
|
|
171
|
+
id: "luckysheet-sheet-content",
|
|
172
|
+
className: "fortune-sheettab__content",
|
|
173
|
+
"data-testid": "sheettab-content"
|
|
168
174
|
}, context.allowEdit && (/*#__PURE__*/React.createElement(IconButton, {
|
|
169
|
-
className: "fortune-sheettab-button border-none shadow-none",
|
|
175
|
+
className: "fortune-sheettab__cta fortune-sheettab-button border-none shadow-none",
|
|
170
176
|
onClick: onAddSheetClick,
|
|
171
177
|
elevation: 1,
|
|
172
178
|
icon: "Plus",
|
|
173
179
|
size: "sm",
|
|
174
|
-
variant: "secondary"
|
|
180
|
+
variant: "secondary",
|
|
181
|
+
"data-testid": "sheettab-cta-add-sheet"
|
|
175
182
|
})), context.allowEdit && (/*#__PURE__*/React.createElement("div", {
|
|
176
183
|
className: "sheet-list-container"
|
|
177
184
|
}, /*#__PURE__*/React.createElement("div", {
|
|
178
185
|
id: "all-sheets",
|
|
179
|
-
className: "fortune-sheettab-button",
|
|
186
|
+
className: "fortune-sheettab__icon fortune-sheettab-button",
|
|
180
187
|
ref: tabContainerRef,
|
|
188
|
+
"data-testid": "sheettab-icon-all-sheets",
|
|
181
189
|
onMouseDown: function onMouseDown(e) {
|
|
182
190
|
e.stopPropagation();
|
|
183
191
|
setContext(function (ctx) {
|
|
@@ -186,14 +194,16 @@ var SheetTab = function SheetTab() {
|
|
|
186
194
|
});
|
|
187
195
|
}
|
|
188
196
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
189
|
-
className: "fortune-sheettab-button border-none shadow-none",
|
|
197
|
+
className: "fortune-sheettab__icon fortune-sheettab-button border-none shadow-none",
|
|
190
198
|
elevation: 1,
|
|
191
199
|
icon: "Menu",
|
|
192
200
|
size: "sm",
|
|
193
|
-
variant: "secondary"
|
|
201
|
+
variant: "secondary",
|
|
202
|
+
"data-testid": "sheettab-icon-menu"
|
|
194
203
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
195
|
-
className: "fortune-sheettab-container",
|
|
196
|
-
id: "fortune-sheettab-container"
|
|
204
|
+
className: "fortune-sheettab__tabs fortune-sheettab-container",
|
|
205
|
+
id: "fortune-sheettab-container",
|
|
206
|
+
"data-testid": "sheettab-tabs"
|
|
197
207
|
}, !isShowBoundary && /*#__PURE__*/React.createElement("div", {
|
|
198
208
|
className: "boundary boundary-left"
|
|
199
209
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -246,21 +256,24 @@ var SheetTab = function SheetTab() {
|
|
|
246
256
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
247
257
|
className: "fortune-sheet-area-right"
|
|
248
258
|
}, statsFilter.length === 6 && calInfo.count > 1 && (/*#__PURE__*/React.createElement(Popover, null, /*#__PURE__*/React.createElement(PopoverTrigger, {
|
|
249
|
-
className: "p-0 m-0 mr-2"
|
|
259
|
+
className: "fortune-sheettab__info-trigger p-0 m-0 mr-2",
|
|
260
|
+
"data-testid": "sheettab-info-stats-trigger"
|
|
250
261
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
251
262
|
variant: "ghost",
|
|
252
|
-
className: "w-full !h-6 p-2 m-1 text-left flex items-center justify-center transition mr-2 !rounded-[0px]",
|
|
263
|
+
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]",
|
|
253
264
|
style: {
|
|
254
265
|
height: "24px !important"
|
|
255
|
-
}
|
|
266
|
+
},
|
|
267
|
+
"data-testid": "sheettab-info-stats"
|
|
256
268
|
}, /*#__PURE__*/React.createElement("div", {
|
|
257
269
|
className: "flex items-center"
|
|
258
270
|
}, /*#__PURE__*/React.createElement("p", {
|
|
259
|
-
className: "text-body-sm",
|
|
271
|
+
className: "fortune-sheettab__para fortune-sheettab__para--stats text-body-sm",
|
|
260
272
|
style: {
|
|
261
273
|
fontWeight: "500",
|
|
262
274
|
marginRight: "8px"
|
|
263
|
-
}
|
|
275
|
+
},
|
|
276
|
+
"data-testid": "sheettab-para-stats"
|
|
264
277
|
}, STATS_LABELS[selectedStat], ":", " ", calInfo[selectedStat]), /*#__PURE__*/React.createElement("svg", {
|
|
265
278
|
xmlns: "http://www.w3.org/2000/svg",
|
|
266
279
|
width: "18",
|
|
@@ -293,7 +306,9 @@ var SheetTab = function SheetTab() {
|
|
|
293
306
|
return /*#__PURE__*/React.createElement(Button, {
|
|
294
307
|
variant: "ghost",
|
|
295
308
|
key: option.value,
|
|
296
|
-
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]"),
|
|
309
|
+
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]"),
|
|
310
|
+
"data-stat-value": option.value,
|
|
311
|
+
"data-testid": "sheettab-stats-option-".concat(option.value),
|
|
297
312
|
onClick: function onClick() {
|
|
298
313
|
return setSelectedStat(option.value);
|
|
299
314
|
}
|
|
@@ -10,18 +10,25 @@ var Button = function Button(_a) {
|
|
|
10
10
|
children = _a.children,
|
|
11
11
|
style = _a.style,
|
|
12
12
|
id = _a.id;
|
|
13
|
+
var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
13
14
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
14
15
|
text: tooltip,
|
|
15
16
|
placement: "bottom"
|
|
16
17
|
}, /*#__PURE__*/React.createElement("div", {
|
|
17
18
|
id: id,
|
|
18
|
-
className: "fortune-toolbar-button fortune-toolbar-item",
|
|
19
|
+
className: "fortune-toolbar-button fortune-toolbar-item fortune-toolbar-button__cta fortune-toolbar-button--".concat(iconIdClass),
|
|
20
|
+
"data-icon-id": iconId,
|
|
19
21
|
onClick: onClick,
|
|
20
22
|
tabIndex: 0,
|
|
21
23
|
role: "button",
|
|
22
24
|
style: selected ? {
|
|
23
25
|
backgroundColor: "#FFDF0A"
|
|
24
|
-
} : style
|
|
26
|
+
} : style,
|
|
27
|
+
"data-testid": "toolbar-cta-".concat(id !== null && id !== void 0 ? id : iconId)
|
|
28
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
29
|
+
className: "fortune-toolbar-button__icon fortune-toolbar-button__icon--".concat(iconIdClass),
|
|
30
|
+
"data-icon-id": iconId,
|
|
31
|
+
"data-testid": "toolbar-icon-".concat(iconId)
|
|
25
32
|
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
26
33
|
name: getLucideIcon(iconId),
|
|
27
34
|
width: 16,
|
|
@@ -29,6 +36,6 @@ var Button = function Button(_a) {
|
|
|
29
36
|
style: disabled ? {
|
|
30
37
|
opacity: 0.3
|
|
31
38
|
} : {}
|
|
32
|
-
}), children));
|
|
39
|
+
})), children));
|
|
33
40
|
};
|
|
34
41
|
export default Button;
|
|
@@ -2,6 +2,9 @@ import React, { useMemo, useRef, useState } from "react";
|
|
|
2
2
|
import { IconButton, Tooltip, Popover, PopoverContent, PopoverTrigger, cn, Button, LucideIcon } from "@fileverse/ui";
|
|
3
3
|
import SVGIcon from "../SVGIcon";
|
|
4
4
|
import { getLucideIcon } from ".";
|
|
5
|
+
var toCssId = function toCssId(s) {
|
|
6
|
+
return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
7
|
+
};
|
|
5
8
|
var Combo = function Combo(_a) {
|
|
6
9
|
var tooltip = _a.tooltip,
|
|
7
10
|
_onClick = _a.onClick,
|
|
@@ -20,6 +23,7 @@ var Combo = function Combo(_a) {
|
|
|
20
23
|
setOpen = _c[1];
|
|
21
24
|
var buttonRef = useRef(null);
|
|
22
25
|
var ref = useRef(null);
|
|
26
|
+
var iconIdClass = iconId ? toCssId(iconId) : "combo";
|
|
23
27
|
if (!triggerRef) {
|
|
24
28
|
triggerRef = ref;
|
|
25
29
|
}
|
|
@@ -33,7 +37,9 @@ var Combo = function Combo(_a) {
|
|
|
33
37
|
text: tooltip,
|
|
34
38
|
placement: "bottom"
|
|
35
39
|
}, /*#__PURE__*/React.createElement("div", {
|
|
36
|
-
className: "fortune-toolbar-combo-button",
|
|
40
|
+
className: "fortune-toolbar-combo-button fortune-toolbar-combo-button--".concat(iconIdClass),
|
|
41
|
+
"data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
|
|
42
|
+
"data-testid": "toolbar-combo-".concat(iconId !== null && iconId !== void 0 ? iconId : "combo"),
|
|
37
43
|
onClick: function onClick(e) {
|
|
38
44
|
if (_onClick) {
|
|
39
45
|
_onClick(e);
|
|
@@ -93,7 +99,9 @@ var Combo = function Combo(_a) {
|
|
|
93
99
|
})))));
|
|
94
100
|
return /*#__PURE__*/React.createElement("div", {
|
|
95
101
|
ref: buttonRef,
|
|
96
|
-
className: "fortune-toolbar-item",
|
|
102
|
+
className: "fortune-toolbar-item fortune-toolbar-combo fortune-toolbar-combo--".concat(iconIdClass),
|
|
103
|
+
"data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
|
|
104
|
+
"data-testid": "toolbar-combo-".concat(iconId !== null && iconId !== void 0 ? iconId : "combo"),
|
|
97
105
|
onKeyDown: function onKeyDown(e) {
|
|
98
106
|
e.stopPropagation();
|
|
99
107
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Tooltip } from "@fileverse/ui";
|
|
3
3
|
import CustomIcon from "./CustomIcon";
|
|
4
|
+
var toCssId = function toCssId(s) {
|
|
5
|
+
return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
6
|
+
};
|
|
4
7
|
var CustomButton = function CustomButton(_a) {
|
|
5
8
|
var tooltip = _a.tooltip,
|
|
6
9
|
onClick = _a.onClick,
|
|
@@ -8,22 +11,28 @@ var CustomButton = function CustomButton(_a) {
|
|
|
8
11
|
children = _a.children,
|
|
9
12
|
iconName = _a.iconName,
|
|
10
13
|
icon = _a.icon;
|
|
14
|
+
var iconNameClass = iconName ? toCssId(iconName) : "custom";
|
|
11
15
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
12
16
|
text: tooltip,
|
|
13
17
|
placement: "bottom"
|
|
14
18
|
}, /*#__PURE__*/React.createElement("div", {
|
|
15
|
-
className: "fortune-toolbar-button fortune-toolbar-item",
|
|
19
|
+
className: "fortune-toolbar-button fortune-toolbar-item fortune-toolbar-button--".concat(iconNameClass),
|
|
20
|
+
"data-icon-name": iconName !== null && iconName !== void 0 ? iconName : undefined,
|
|
16
21
|
onClick: onClick,
|
|
17
22
|
tabIndex: 0,
|
|
18
23
|
role: "button",
|
|
19
24
|
style: selected ? {
|
|
20
25
|
backgroundColor: "#FFDF0A"
|
|
21
|
-
} : {}
|
|
26
|
+
} : {},
|
|
27
|
+
"data-testid": "toolbar-cta-".concat(iconName !== null && iconName !== void 0 ? iconName : "custom")
|
|
28
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
29
|
+
className: "fortune-toolbar-button__icon fortune-toolbar-button__icon--".concat(iconNameClass),
|
|
30
|
+
"data-icon-name": iconName !== null && iconName !== void 0 ? iconName : undefined
|
|
22
31
|
}, /*#__PURE__*/React.createElement(CustomIcon, {
|
|
23
32
|
width: 16,
|
|
24
33
|
height: 16,
|
|
25
34
|
iconName: iconName,
|
|
26
35
|
content: icon
|
|
27
|
-
}), children));
|
|
36
|
+
})), children));
|
|
28
37
|
};
|
|
29
38
|
export default CustomButton;
|
|
@@ -8,16 +8,22 @@ var Select = function Select(_a) {
|
|
|
8
8
|
style: style
|
|
9
9
|
}, children);
|
|
10
10
|
};
|
|
11
|
+
var toCssId = function toCssId(s) {
|
|
12
|
+
return String(s).replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
13
|
+
};
|
|
11
14
|
var Option = function Option(_a) {
|
|
12
15
|
var iconId = _a.iconId,
|
|
13
16
|
onClick = _a.onClick,
|
|
14
17
|
children = _a.children,
|
|
15
18
|
_onMouseLeave = _a.onMouseLeave,
|
|
16
19
|
_onMouseEnter = _a.onMouseEnter;
|
|
20
|
+
var iconIdClass = iconId ? toCssId(iconId) : "option";
|
|
17
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
22
|
onClick: onClick,
|
|
19
23
|
tabIndex: 0,
|
|
20
|
-
className: "fortune-toolbar-select-option",
|
|
24
|
+
className: "fortune-toolbar-select-option fortune-toolbar-select-option--".concat(iconIdClass),
|
|
25
|
+
"data-icon-id": iconId !== null && iconId !== void 0 ? iconId : undefined,
|
|
26
|
+
"data-testid": "toolbar-select-option-".concat(iconId !== null && iconId !== void 0 ? iconId : "option"),
|
|
21
27
|
onMouseLeave: function onMouseLeave(e) {
|
|
22
28
|
return _onMouseLeave === null || _onMouseLeave === void 0 ? void 0 : _onMouseLeave(e);
|
|
23
29
|
},
|
|
@@ -1199,7 +1199,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
1199
1199
|
getShowDialog: () => typeof useDialog;
|
|
1200
1200
|
getSplitColComponent: () => import("react").FC<{}>;
|
|
1201
1201
|
getConditionalFormatComponent: () => import("react").FC<{
|
|
1202
|
-
type?: string | undefined;
|
|
1203
1202
|
context?: any;
|
|
1204
1203
|
}>;
|
|
1205
1204
|
};
|
|
@@ -1206,7 +1206,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
1206
1206
|
getShowDialog: () => typeof import("../../hooks/useDialog").useDialog;
|
|
1207
1207
|
getSplitColComponent: () => React.FC<{}>;
|
|
1208
1208
|
getConditionalFormatComponent: () => React.FC<{
|
|
1209
|
-
type?: string | undefined;
|
|
1210
1209
|
context?: any;
|
|
1211
1210
|
}>;
|
|
1212
1211
|
}>>;
|