@fileverse-dev/fortune-react 1.1.99 → 1.2.0-link-ux-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/ContextMenu/index.js +2 -2
- package/es/components/DataVerification/ColorPicker.js +31 -7
- package/es/components/DataVerification/DropdownList.js +20 -1
- package/es/components/DataVerification/DropdownOption.js +5 -2
- package/es/components/DataVerification/RangeDialog.js +1 -5
- package/es/components/DataVerification/index.css +21 -1
- package/es/components/DataVerification/index.js +31 -5
- package/es/components/LinkEidtCard/index.js +64 -21
- package/es/components/SheetOverlay/ColumnHeader.js +88 -5
- package/es/components/SheetOverlay/FormulaHint/index.js +13 -2
- package/es/components/SheetOverlay/InputBox.js +1 -1
- package/es/components/SheetOverlay/RowHeader.js +82 -5
- package/es/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -18
- package/es/components/SheetOverlay/drag_and_drop/row-helpers.js +20 -18
- package/es/components/SheetOverlay/helper.js +3 -3
- package/es/components/SheetOverlay/index.css +24 -1
- package/es/components/Toolbar/index.js +28 -19
- package/es/components/Workbook/index.d.ts +1 -1
- package/es/components/Workbook/index.js +5 -0
- package/lib/components/ContextMenu/index.js +2 -2
- package/lib/components/DataVerification/ColorPicker.js +30 -6
- package/lib/components/DataVerification/DropdownList.js +20 -1
- package/lib/components/DataVerification/DropdownOption.js +5 -2
- package/lib/components/DataVerification/RangeDialog.js +1 -5
- package/lib/components/DataVerification/index.css +21 -1
- package/lib/components/DataVerification/index.js +31 -5
- package/lib/components/LinkEidtCard/index.js +63 -20
- package/lib/components/SheetOverlay/ColumnHeader.js +86 -4
- package/lib/components/SheetOverlay/FormulaHint/index.js +13 -2
- package/lib/components/SheetOverlay/InputBox.js +1 -1
- package/lib/components/SheetOverlay/RowHeader.js +80 -4
- package/lib/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -18
- package/lib/components/SheetOverlay/drag_and_drop/row-helpers.js +20 -18
- package/lib/components/SheetOverlay/helper.js +3 -3
- package/lib/components/SheetOverlay/index.css +24 -1
- package/lib/components/Toolbar/index.js +27 -19
- package/lib/components/Workbook/index.d.ts +1 -1
- package/lib/components/Workbook/index.js +5 -0
- package/package.json +2 -2
|
@@ -633,7 +633,7 @@ var ContextMenu = function ContextMenu() {
|
|
|
633
633
|
}), /*#__PURE__*/React.createElement("div", null, rightclick.deleteSelected, rightclick.row))));
|
|
634
634
|
}
|
|
635
635
|
if (name === "hide-row") {
|
|
636
|
-
return (selection === null || selection === void 0 ? void 0 : selection.row_select)
|
|
636
|
+
return (selection === null || selection === void 0 ? void 0 : selection.row_select) && ["hideSelected", "showHide"].map(function (item) {
|
|
637
637
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
638
638
|
key: item,
|
|
639
639
|
onClick: function onClick() {
|
|
@@ -1077,7 +1077,7 @@ var ContextMenu = function ContextMenu() {
|
|
|
1077
1077
|
left: contextMenu.x,
|
|
1078
1078
|
top: contextMenu.y
|
|
1079
1079
|
}
|
|
1080
|
-
}, context.contextMenu.headerMenu === true ? settings.headerContextMenu.map(function (menu, i) {
|
|
1080
|
+
}, context.contextMenu.headerMenu === true || context.contextMenu.headerMenu === "row" ? settings.headerContextMenu.map(function (menu, i) {
|
|
1081
1081
|
return getMenuElement(menu, i);
|
|
1082
1082
|
}) : settings.cellContextMenu.map(function (menu, i) {
|
|
1083
1083
|
return getMenuElement(menu, i);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { ChevronDown } from "lucide-react";
|
|
3
|
-
import { Popover, PopoverContent, PopoverTrigger } from "@fileverse/ui";
|
|
3
|
+
import { Button, Popover, PopoverContent, PopoverTrigger, IconButton } from "@fileverse/ui";
|
|
4
4
|
export var TEXT_COLORS = [{
|
|
5
5
|
name: "Light Gray",
|
|
6
6
|
value: "228, 232, 237"
|
|
@@ -57,7 +57,9 @@ export var ColorSection = function ColorSection(_a) {
|
|
|
57
57
|
}, /*#__PURE__*/React.createElement("div", {
|
|
58
58
|
className: "flex items-center justify-between color-picker rounded transition-all cursor-pointer border border-gray-300",
|
|
59
59
|
style: {
|
|
60
|
-
padding: "7px"
|
|
60
|
+
padding: "7px",
|
|
61
|
+
border: "var(--border-width-md, 1px) solid hsl(var(--color-border-default, #E8EBEC))",
|
|
62
|
+
borderRadius: "var(--border-radius-sm, 4px)"
|
|
61
63
|
}
|
|
62
64
|
}, /*#__PURE__*/React.createElement("div", {
|
|
63
65
|
className: "flex items-center gap-3 color-text-secondary"
|
|
@@ -72,7 +74,7 @@ export var ColorSection = function ColorSection(_a) {
|
|
|
72
74
|
})))), /*#__PURE__*/React.createElement(PopoverContent, {
|
|
73
75
|
align: "start",
|
|
74
76
|
alignOffset: 0,
|
|
75
|
-
className: "
|
|
77
|
+
className: "color-picker-container",
|
|
76
78
|
elevation: 2,
|
|
77
79
|
side: "bottom",
|
|
78
80
|
sideOffset: 4
|
|
@@ -81,18 +83,40 @@ export var ColorSection = function ColorSection(_a) {
|
|
|
81
83
|
}, /*#__PURE__*/React.createElement("div", {
|
|
82
84
|
className: "flex gap-2 flex-wrap w-full"
|
|
83
85
|
}, TEXT_COLORS.map(function (color) {
|
|
84
|
-
return /*#__PURE__*/React.createElement("
|
|
86
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
key: color.value,
|
|
88
|
+
className: "w-7 h-7 rounded-full transition-all hover:scale-110 hover:shadow-md",
|
|
89
|
+
style: {
|
|
90
|
+
border: "".concat(color.value) === trigerColor ? "2px solid rgb(".concat(color.value, ")") : "none",
|
|
91
|
+
padding: "2px"
|
|
92
|
+
}
|
|
93
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
85
94
|
type: "button",
|
|
86
95
|
key: color.value,
|
|
87
96
|
onClick: function onClick() {
|
|
88
97
|
onPick(color.value);
|
|
89
98
|
setIsOpen(false);
|
|
90
99
|
},
|
|
91
|
-
className: "w-
|
|
100
|
+
className: "w-full h-full rounded-full transition-all hover:scale-110 hover:shadow-md",
|
|
92
101
|
style: {
|
|
93
102
|
backgroundColor: "rgb(".concat(color.value, ")")
|
|
94
103
|
},
|
|
95
104
|
title: color.name
|
|
96
|
-
});
|
|
97
|
-
})
|
|
105
|
+
}));
|
|
106
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
107
|
+
className: "w-full flex justify-center",
|
|
108
|
+
onClick: function onClick() {
|
|
109
|
+
onPick("228, 232, 237");
|
|
110
|
+
setIsOpen(false);
|
|
111
|
+
}
|
|
112
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
113
|
+
icon: "DropletOff",
|
|
114
|
+
size: "md",
|
|
115
|
+
variant: "ghost",
|
|
116
|
+
className: "color-picker-icon"
|
|
117
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
118
|
+
size: "md",
|
|
119
|
+
variant: "ghost",
|
|
120
|
+
className: "color-picker-reset"
|
|
121
|
+
}, "Reset"))))));
|
|
98
122
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getCellValue, getDropdownList, getFlowdata, getSheetIndex, mergeBorder, setDropdownValue } from "@fileverse-dev/fortune-core";
|
|
2
2
|
import React, { useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { Button, IconButton } from "@fileverse/ui";
|
|
3
4
|
import WorkbookContext from "../../context";
|
|
4
5
|
import { useOutsideClick } from "../../hooks/useOutsideClick";
|
|
5
6
|
import SVGIcon from "../SVGIcon";
|
|
@@ -145,6 +146,24 @@ var DropDownList = function DropDownList() {
|
|
|
145
146
|
display: isMul && selected.indexOf(v) >= 0 ? "inline" : "none"
|
|
146
147
|
}
|
|
147
148
|
}), v);
|
|
148
|
-
})
|
|
149
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
150
|
+
className: "w-full flex align-center",
|
|
151
|
+
style: {
|
|
152
|
+
height: "28px"
|
|
153
|
+
},
|
|
154
|
+
onClick: function onClick() {
|
|
155
|
+
var _a;
|
|
156
|
+
(_a = window === null || window === void 0 ? void 0 : window.dataVerificationClick) === null || _a === void 0 ? void 0 : _a.call(window);
|
|
157
|
+
}
|
|
158
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
159
|
+
icon: "Pencil",
|
|
160
|
+
size: "sm",
|
|
161
|
+
variant: "ghost",
|
|
162
|
+
className: "color-picker-icon pt-2 color-picker"
|
|
163
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
164
|
+
size: "md",
|
|
165
|
+
variant: "ghost",
|
|
166
|
+
className: "color-picker-reset color-picker"
|
|
167
|
+
}, "Edit")));
|
|
149
168
|
};
|
|
150
169
|
export default DropDownList;
|
|
@@ -174,7 +174,7 @@ var DynamicInputList = function DynamicInputList(_a) {
|
|
|
174
174
|
}, optionItems.map(function (item, index) {
|
|
175
175
|
return /*#__PURE__*/React.createElement("li", {
|
|
176
176
|
key: item.id,
|
|
177
|
-
className: cn("relative flex optionItems-center gap-
|
|
177
|
+
className: cn("relative flex optionItems-center gap-2 transition mb-4", draggingIndex === index && "scale-[0.99] opacity-80 shadow-lg rounded-xl"),
|
|
178
178
|
onDragOver: function onDragOver(e) {
|
|
179
179
|
return onDragOverRow(index, e);
|
|
180
180
|
},
|
|
@@ -269,7 +269,10 @@ var DynamicInputList = function DynamicInputList(_a) {
|
|
|
269
269
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
270
270
|
variant: "secondary",
|
|
271
271
|
onClick: handleAdd,
|
|
272
|
-
|
|
272
|
+
size: "sm",
|
|
273
|
+
style: {
|
|
274
|
+
fontWeight: 500
|
|
275
|
+
}
|
|
273
276
|
}, "Add another item")));
|
|
274
277
|
};
|
|
275
278
|
export default DynamicInputList;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { locale } from "@fileverse-dev/fortune-core";
|
|
2
2
|
import { Button, cn, IconButton, TextField } from "@fileverse/ui";
|
|
3
3
|
import React, { useCallback, useContext, useEffect, useState } from "react";
|
|
4
|
-
import DataVerification from ".";
|
|
5
4
|
import WorkbookContext from "../../context";
|
|
6
5
|
import { useDialog } from "../../hooks/useDialog";
|
|
7
6
|
import ConditionRules from "../ConditionFormat/ConditionRules";
|
|
@@ -14,8 +13,7 @@ var RangeDialog = function RangeDialog() {
|
|
|
14
13
|
var showDialog = useDialog().showDialog;
|
|
15
14
|
var _b = locale(context),
|
|
16
15
|
dataVerification = _b.dataVerification,
|
|
17
|
-
button = _b.button
|
|
18
|
-
toolbar = _b.toolbar;
|
|
16
|
+
button = _b.button;
|
|
19
17
|
var _c = useState(getDisplayedRangeTxt(context)),
|
|
20
18
|
rangeTxt2 = _c[0],
|
|
21
19
|
setRangeTxt2 = _c[1];
|
|
@@ -37,9 +35,7 @@ var RangeDialog = function RangeDialog() {
|
|
|
37
35
|
showDialog(/*#__PURE__*/React.createElement(ConditionRules, {
|
|
38
36
|
type: rulesType
|
|
39
37
|
}), undefined, locale(context).conditionformat["conditionformat_".concat(rulesType)]);
|
|
40
|
-
return;
|
|
41
38
|
}
|
|
42
|
-
showDialog(/*#__PURE__*/React.createElement(DataVerification, null), undefined, toolbar.dataVerification);
|
|
43
39
|
}, [setContext, showDialog, context]);
|
|
44
40
|
useEffect(function () {
|
|
45
41
|
setRangeTxt2(getDisplayedRangeTxt(context));
|
|
@@ -202,5 +202,25 @@
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
.color-picker:hover {
|
|
205
|
-
background: hsl(var(--color-bg-default-hover, #F2F4F5));
|
|
205
|
+
background: hsl(var(--color-bg-default-hover, #F2F4F5))!important;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.color-picker-container {
|
|
209
|
+
border: 1px solid hsl(var(--color-border-default, #E8EBEC)) !important;
|
|
210
|
+
box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.15);
|
|
211
|
+
width: 230px !important;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.color-picker-reset {
|
|
215
|
+
min-width: 0px !important;
|
|
216
|
+
padding-left: 0px !important;
|
|
217
|
+
margin-left: 0px !important;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.color-picker-reset:hover {
|
|
221
|
+
background-color: white!important;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.color-picker-icon:hover {
|
|
225
|
+
background-color: white!important;
|
|
206
226
|
}
|
|
@@ -84,6 +84,14 @@ var DataVerification = function DataVerification() {
|
|
|
84
84
|
}));
|
|
85
85
|
}
|
|
86
86
|
}, []);
|
|
87
|
+
var dataSelectRange = useCallback(function (type, value) {
|
|
88
|
+
hideDialog();
|
|
89
|
+
setContext(function (ctx) {
|
|
90
|
+
ctx.rangeDialog.show = true;
|
|
91
|
+
ctx.rangeDialog.type = type;
|
|
92
|
+
ctx.rangeDialog.rangeTxt = value;
|
|
93
|
+
});
|
|
94
|
+
}, [hideDialog, setContext]);
|
|
87
95
|
var btn = useCallback(function (type) {
|
|
88
96
|
if (type === "confirm") {
|
|
89
97
|
setContext(function (ctx) {
|
|
@@ -210,7 +218,7 @@ var DataVerification = function DataVerification() {
|
|
|
210
218
|
return /*#__PURE__*/React.createElement("div", {
|
|
211
219
|
id: "fortune-data-verification"
|
|
212
220
|
}, /*#__PURE__*/React.createElement("div", {
|
|
213
|
-
className: "flex flex-col gap-4",
|
|
221
|
+
className: "flex flex-col gap-4 h-[calc(100vh-270px)] overflow-y-auto no-scrollbar",
|
|
214
222
|
style: {
|
|
215
223
|
width: "345px",
|
|
216
224
|
padding: "16px"
|
|
@@ -226,7 +234,19 @@ var DataVerification = function DataVerification() {
|
|
|
226
234
|
}),
|
|
227
235
|
"aria-hidden": "true",
|
|
228
236
|
readOnly: true,
|
|
229
|
-
value: (_a = context.dataVerification.dataRegulation) === null || _a === void 0 ? void 0 : _a.rangeTxt
|
|
237
|
+
value: (_a = context.dataVerification.dataRegulation) === null || _a === void 0 ? void 0 : _a.rangeTxt,
|
|
238
|
+
onChange: function onChange(e) {
|
|
239
|
+
var value = e.target.value;
|
|
240
|
+
setContext(function (ctx) {
|
|
241
|
+
ctx.dataVerification.dataRegulation.rangeTxt = value;
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
onClick: function onClick() {
|
|
245
|
+
var _a;
|
|
246
|
+
(_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
247
|
+
hideDialog();
|
|
248
|
+
dataSelectRange("rangeTxt", context.dataVerification.dataRegulation.value1);
|
|
249
|
+
}
|
|
230
250
|
})), /*#__PURE__*/React.createElement("div", {
|
|
231
251
|
className: "flex flex-col"
|
|
232
252
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -271,7 +291,7 @@ var DataVerification = function DataVerification() {
|
|
|
271
291
|
});
|
|
272
292
|
}
|
|
273
293
|
}), /*#__PURE__*/React.createElement("span", {
|
|
274
|
-
className: "ml-2"
|
|
294
|
+
className: "ml-2 text-body-sm"
|
|
275
295
|
}, dataVerification.allowMultiSelect)))), ((_e = (_d = context.dataVerification) === null || _d === void 0 ? void 0 : _d.dataRegulation) === null || _e === void 0 ? void 0 : _e.type) === "checkbox" && (/*#__PURE__*/React.createElement("div", {
|
|
276
296
|
className: "mt-4 space-y-2"
|
|
277
297
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -387,7 +407,7 @@ var DataVerification = function DataVerification() {
|
|
|
387
407
|
});
|
|
388
408
|
}
|
|
389
409
|
}), /*#__PURE__*/React.createElement("span", {
|
|
390
|
-
className: "ml-2"
|
|
410
|
+
className: "ml-2 text-body-sm"
|
|
391
411
|
}, dataVerification[v]));
|
|
392
412
|
}), ((_o = (_m = context.dataVerification) === null || _m === void 0 ? void 0 : _m.dataRegulation) === null || _o === void 0 ? void 0 : _o.hintShow) && (/*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(TextField, {
|
|
393
413
|
placeholder: dataVerification.placeholder5,
|
|
@@ -399,7 +419,11 @@ var DataVerification = function DataVerification() {
|
|
|
399
419
|
});
|
|
400
420
|
}
|
|
401
421
|
}))))), /*#__PURE__*/React.createElement(Divider, {
|
|
402
|
-
className: "
|
|
422
|
+
className: "border-t-[1px]",
|
|
423
|
+
style: {
|
|
424
|
+
width: "315px",
|
|
425
|
+
margin: "0 16px 16px 16px"
|
|
426
|
+
}
|
|
403
427
|
}), /*#__PURE__*/React.createElement("div", {
|
|
404
428
|
className: "flex gap-2 justify-between items-center",
|
|
405
429
|
style: {
|
|
@@ -423,7 +447,9 @@ var DataVerification = function DataVerification() {
|
|
|
423
447
|
minWidth: "80px"
|
|
424
448
|
},
|
|
425
449
|
onClick: function onClick() {
|
|
450
|
+
var _a;
|
|
426
451
|
btn("confirm");
|
|
452
|
+
(_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
427
453
|
}
|
|
428
454
|
}, button.confirm))));
|
|
429
455
|
};
|
|
@@ -8,7 +8,7 @@ var __assign = this && this.__assign || function () {
|
|
|
8
8
|
};
|
|
9
9
|
return __assign.apply(this, arguments);
|
|
10
10
|
};
|
|
11
|
-
import React, { useContext, useState, useMemo, useCallback, useLayoutEffect } from "react";
|
|
11
|
+
import React, { useContext, useState, useMemo, useCallback, useLayoutEffect, useRef, useEffect } from "react";
|
|
12
12
|
import { locale, saveHyperlink, removeHyperlink, replaceHtml, goToLink, isLinkValid } from "@fileverse-dev/fortune-core";
|
|
13
13
|
import { Button, TextField, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, LucideIcon } from "@fileverse/ui";
|
|
14
14
|
import "./index.css";
|
|
@@ -16,6 +16,7 @@ import _ from "lodash";
|
|
|
16
16
|
import WorkbookContext from "../../context";
|
|
17
17
|
import SVGIcon from "../SVGIcon";
|
|
18
18
|
export var LinkEditCard = function LinkEditCard(_a) {
|
|
19
|
+
var _b;
|
|
19
20
|
var r = _a.r,
|
|
20
21
|
c = _a.c,
|
|
21
22
|
rc = _a.rc,
|
|
@@ -24,22 +25,22 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
24
25
|
originAddress = _a.originAddress,
|
|
25
26
|
isEditing = _a.isEditing,
|
|
26
27
|
position = _a.position;
|
|
27
|
-
var
|
|
28
|
-
context =
|
|
29
|
-
setContext =
|
|
30
|
-
refs =
|
|
31
|
-
var
|
|
32
|
-
linkText =
|
|
33
|
-
setLinkText =
|
|
34
|
-
var
|
|
35
|
-
linkAddress =
|
|
36
|
-
setLinkAddress =
|
|
37
|
-
var
|
|
38
|
-
linkType =
|
|
39
|
-
setLinkType =
|
|
40
|
-
var
|
|
41
|
-
insertLink =
|
|
42
|
-
linkTypeList =
|
|
28
|
+
var _c = useContext(WorkbookContext),
|
|
29
|
+
context = _c.context,
|
|
30
|
+
setContext = _c.setContext,
|
|
31
|
+
refs = _c.refs;
|
|
32
|
+
var _d = useState(originText),
|
|
33
|
+
linkText = _d[0],
|
|
34
|
+
setLinkText = _d[1];
|
|
35
|
+
var _e = useState(originAddress),
|
|
36
|
+
linkAddress = _e[0],
|
|
37
|
+
setLinkAddress = _e[1];
|
|
38
|
+
var _f = useState(originType),
|
|
39
|
+
linkType = _f[0],
|
|
40
|
+
setLinkType = _f[1];
|
|
41
|
+
var _g = locale(context),
|
|
42
|
+
insertLink = _g.insertLink,
|
|
43
|
+
linkTypeList = _g.linkTypeList;
|
|
43
44
|
var isLinkAddressValid = isLinkValid(context, linkType, linkAddress);
|
|
44
45
|
var isButtonDisabled = useMemo(function () {
|
|
45
46
|
if (!linkText.trim()) return true;
|
|
@@ -75,13 +76,20 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
75
76
|
return e.stopPropagation();
|
|
76
77
|
},
|
|
77
78
|
onKeyDown: function onKeyDown(e) {
|
|
78
|
-
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
if (isButtonDisabled) return;
|
|
81
|
+
if (e.key === "Enter") {
|
|
82
|
+
_.set(refs.globalCache, "linkCard.mouseEnter", false);
|
|
83
|
+
setContext(function (draftCtx) {
|
|
84
|
+
return saveHyperlink(draftCtx, r, c, linkText, linkType, linkAddress);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
79
87
|
},
|
|
80
88
|
onDoubleClick: function onDoubleClick(e) {
|
|
81
89
|
return e.stopPropagation();
|
|
82
90
|
}
|
|
83
91
|
};
|
|
84
|
-
}, [refs.globalCache]);
|
|
92
|
+
}, [refs.globalCache, isButtonDisabled]);
|
|
85
93
|
var renderToolbarButton = useCallback(function (iconId, onClick) {
|
|
86
94
|
return /*#__PURE__*/React.createElement("div", {
|
|
87
95
|
className: "fortune-toolbar-button",
|
|
@@ -100,6 +108,38 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
100
108
|
setLinkText(originText);
|
|
101
109
|
setLinkType(originType);
|
|
102
110
|
}, [rc, originAddress, originText, originType]);
|
|
111
|
+
var hintRef = useRef(null);
|
|
112
|
+
var _h = useState(((_b = position === null || position === void 0 ? void 0 : position.cellBottom) !== null && _b !== void 0 ? _b : 0) + 4),
|
|
113
|
+
popupTopPx = _h[0],
|
|
114
|
+
setPopupTopPx = _h[1];
|
|
115
|
+
var calculatePopupPlacement = useCallback(function () {
|
|
116
|
+
var _a, _b, _c, _d, _e, _f;
|
|
117
|
+
var firstSelection = (_a = context === null || context === void 0 ? void 0 : context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
118
|
+
if (!((_c = (_b = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.top) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b)) || !((_e = (_d = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) === null || _d === void 0 ? void 0 : _d.toString) === null || _e === void 0 ? void 0 : _e.call(_d)) || !hintRef.current) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
var selectionHeight = (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0;
|
|
122
|
+
var cellBottom = position === null || position === void 0 ? void 0 : position.cellBottom;
|
|
123
|
+
var cellTop = cellBottom - selectionHeight;
|
|
124
|
+
var inputBottom = cellTop + selectionHeight;
|
|
125
|
+
var availableBelow = window.innerHeight - inputBottom;
|
|
126
|
+
var divOffset = (_f = hintRef.current) === null || _f === void 0 ? void 0 : _f.offsetHeight;
|
|
127
|
+
var hintAbove = divOffset > availableBelow;
|
|
128
|
+
var nextTop = hintAbove ? Math.max(0, cellTop - (divOffset + 30)) : cellBottom + 4;
|
|
129
|
+
setPopupTopPx(nextTop);
|
|
130
|
+
}, [context === null || context === void 0 ? void 0 : context.luckysheet_select_save, position === null || position === void 0 ? void 0 : position.cellBottom]);
|
|
131
|
+
useLayoutEffect(function () {
|
|
132
|
+
calculatePopupPlacement();
|
|
133
|
+
}, [calculatePopupPlacement, isEditing, rc, position]);
|
|
134
|
+
useEffect(function () {
|
|
135
|
+
var onResize = function onResize() {
|
|
136
|
+
return calculatePopupPlacement();
|
|
137
|
+
};
|
|
138
|
+
window.addEventListener("resize", onResize);
|
|
139
|
+
return function () {
|
|
140
|
+
return window.removeEventListener("resize", onResize);
|
|
141
|
+
};
|
|
142
|
+
}, [calculatePopupPlacement]);
|
|
103
143
|
if (!isEditing) {
|
|
104
144
|
return /*#__PURE__*/React.createElement("div", __assign({}, containerEvent, {
|
|
105
145
|
onKeyDown: function onKeyDown(e) {
|
|
@@ -142,9 +182,10 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
142
182
|
}
|
|
143
183
|
return /*#__PURE__*/React.createElement("div", __assign({
|
|
144
184
|
className: "fortune-link-card",
|
|
185
|
+
ref: hintRef,
|
|
145
186
|
style: {
|
|
146
187
|
left: position.cellLeft + 20,
|
|
147
|
-
top:
|
|
188
|
+
top: popupTopPx
|
|
148
189
|
}
|
|
149
190
|
}, containerEvent), /*#__PURE__*/React.createElement(Select, {
|
|
150
191
|
value: linkType,
|
|
@@ -182,7 +223,8 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
182
223
|
onChange: function onChange(e) {
|
|
183
224
|
return setLinkText(e.target.value);
|
|
184
225
|
},
|
|
185
|
-
className: "fortune-link-input"
|
|
226
|
+
className: "fortune-link-input",
|
|
227
|
+
autoFocus: !linkText
|
|
186
228
|
})), linkType === "webpage" && (/*#__PURE__*/React.createElement("div", {
|
|
187
229
|
className: "fortune-input-with-icon"
|
|
188
230
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -194,6 +236,7 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
194
236
|
})), /*#__PURE__*/React.createElement(TextField, {
|
|
195
237
|
placeholder: "Paste URL",
|
|
196
238
|
value: linkAddress,
|
|
239
|
+
autoFocus: !!linkText,
|
|
197
240
|
onChange: function onChange(e) {
|
|
198
241
|
return setLinkAddress(e.target.value);
|
|
199
242
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { colLocation, colLocationByIndex, selectTitlesMap, selectTitlesRange, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, isAllowEdit, getFlowdata, fixColumnStyleOverflowInFreeze, handleColFreezeHandleMouseDown, getSheetIndex, fixPositionOnFrozenCells } from "@fileverse-dev/fortune-core";
|
|
1
|
+
import { colLocation, colLocationByIndex, selectTitlesMap, selectTitlesRange, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, isAllowEdit, getFlowdata, fixColumnStyleOverflowInFreeze, handleColFreezeHandleMouseDown, getSheetIndex, fixPositionOnFrozenCells, showSelected } from "@fileverse-dev/fortune-core";
|
|
2
|
+
import { api } from "@fileverse-dev/fortune-core";
|
|
2
3
|
import _ from "lodash";
|
|
3
4
|
import React, { useContext, useState, useRef, useCallback, useEffect, useMemo } from "react";
|
|
4
5
|
import WorkbookContext from "../../context";
|
|
@@ -73,13 +74,13 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
73
74
|
}]);
|
|
74
75
|
}, [context, hoverLocation.col_index, refs.globalCache.freezen]);
|
|
75
76
|
var onMouseDown = useCallback(function (e) {
|
|
76
|
-
if (e.button === 0 && e.target.tagName === "use") {
|
|
77
|
+
if (e.button === 0 && e.target.tagName === "use" || e.button === 2) {
|
|
77
78
|
var nativeEvent_1 = e.nativeEvent;
|
|
78
79
|
setContext(function (draft) {
|
|
79
80
|
handleColumnHeaderMouseDown(draft, refs.globalCache, nativeEvent_1, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
|
-
if (e.button !== 0) return;
|
|
83
|
+
if (e.button !== 0 || context.isFlvReadOnly) return;
|
|
83
84
|
var targetEl = e.target;
|
|
84
85
|
if (targetEl.closest(".fortune-cols-change-size") || targetEl.closest(".fortune-cols-freeze-handle") || targetEl.closest(".header-arrow")) return;
|
|
85
86
|
var headerEl = containerRef.current;
|
|
@@ -154,6 +155,44 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
154
155
|
}
|
|
155
156
|
setSelectedLocation(selects);
|
|
156
157
|
}, [context.luckysheet_select_save, context.visibledatacolumn]);
|
|
158
|
+
var _g = useState([]),
|
|
159
|
+
hiddenPointers = _g[0],
|
|
160
|
+
setHiddenPointers = _g[1];
|
|
161
|
+
useEffect(function () {
|
|
162
|
+
var _a, _b;
|
|
163
|
+
if (sheetIndex == null) return;
|
|
164
|
+
var tempPointers = [];
|
|
165
|
+
var colhidden = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.colhidden;
|
|
166
|
+
if (colhidden) {
|
|
167
|
+
Object.keys(colhidden).forEach(function (key) {
|
|
168
|
+
var item = {
|
|
169
|
+
col: key,
|
|
170
|
+
left: context.visibledatacolumn[Number(key) - 1]
|
|
171
|
+
};
|
|
172
|
+
tempPointers.push(item);
|
|
173
|
+
});
|
|
174
|
+
console.log(tempPointers);
|
|
175
|
+
setHiddenPointers(tempPointers);
|
|
176
|
+
} else {
|
|
177
|
+
setHiddenPointers([]);
|
|
178
|
+
}
|
|
179
|
+
}, [context.visibledatacolumn, sheetIndex]);
|
|
180
|
+
var showColumn = function showColumn(e, item) {
|
|
181
|
+
if (context.isFlvReadOnly) return;
|
|
182
|
+
e.stopPropagation();
|
|
183
|
+
setContext(function (ctx) {
|
|
184
|
+
var _a;
|
|
185
|
+
api.setSelection(ctx, [{
|
|
186
|
+
row: [0, (_a = context.visibledatarow) === null || _a === void 0 ? void 0 : _a.length],
|
|
187
|
+
column: [Number(item.col) - 1, Number(item.col) + 1]
|
|
188
|
+
}], {
|
|
189
|
+
id: context.currentSheetId
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
setContext(function (ctx) {
|
|
193
|
+
showSelected(ctx, "column");
|
|
194
|
+
});
|
|
195
|
+
};
|
|
157
196
|
useEffect(function () {
|
|
158
197
|
containerRef.current.scrollLeft = context.scrollLeft;
|
|
159
198
|
}, [context.scrollLeft]);
|
|
@@ -176,7 +215,51 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
176
215
|
};
|
|
177
216
|
});
|
|
178
217
|
}
|
|
179
|
-
},
|
|
218
|
+
}, hiddenPointers.map(function (item) {
|
|
219
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
220
|
+
className: "flex gap-4 cursor-pointer hide-btn align-center",
|
|
221
|
+
style: {
|
|
222
|
+
height: context.columnHeaderHeight - 12,
|
|
223
|
+
left: "".concat(item.left - 12, "px")
|
|
224
|
+
},
|
|
225
|
+
onClick: function onClick(e) {
|
|
226
|
+
return showColumn(e, item);
|
|
227
|
+
}
|
|
228
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
className: ""
|
|
230
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
231
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
232
|
+
width: "5",
|
|
233
|
+
height: "8",
|
|
234
|
+
viewBox: "0 0 5 8",
|
|
235
|
+
fill: "none"
|
|
236
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
237
|
+
d: "M0.164574 4.20629L3.54376 7.58548C3.7275 7.76922 4.04167 7.63909 4.04167 7.37924L4.04167 0.620865C4.04167 0.361018 3.7275 0.230885 3.54376 0.414625L0.164575 3.79381C0.0506717 3.90772 0.0506715 4.09239 0.164574 4.20629Z",
|
|
238
|
+
fill: "#363B3F"
|
|
239
|
+
}))));
|
|
240
|
+
}), hiddenPointers.map(function (item) {
|
|
241
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
242
|
+
className: "flex gap-4 cursor-pointer hide-btn align-center",
|
|
243
|
+
style: {
|
|
244
|
+
height: context.columnHeaderHeight - 12,
|
|
245
|
+
left: "".concat(item.left + 6, "px")
|
|
246
|
+
},
|
|
247
|
+
onClick: function onClick(e) {
|
|
248
|
+
return showColumn(e, item);
|
|
249
|
+
}
|
|
250
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
251
|
+
className: ""
|
|
252
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
253
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
254
|
+
width: "5",
|
|
255
|
+
height: "8",
|
|
256
|
+
viewBox: "0 0 5 8",
|
|
257
|
+
fill: "none"
|
|
258
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
259
|
+
d: "M4.68811 4.35359L1.81188 7.22982C1.4969 7.5448 0.958328 7.32172 0.958328 6.87627L0.958328 1.12381C0.958328 0.678362 1.4969 0.455279 1.81188 0.770261L4.68811 3.64649C4.88337 3.84175 4.88337 4.15833 4.68811 4.35359Z",
|
|
260
|
+
fill: "#363B3F"
|
|
261
|
+
}))));
|
|
262
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
180
263
|
className: "fortune-cols-freeze-handle",
|
|
181
264
|
onMouseDown: onColFreezeHandleMouseDown,
|
|
182
265
|
style: {
|
|
@@ -199,7 +282,7 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
199
282
|
display: "block"
|
|
200
283
|
}, fixColumnStyleOverflowInFreeze(context, hoverLocation.col_index, hoverLocation.col_index, (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[context.currentSheetId]))
|
|
201
284
|
}, allowEditRef.current && (/*#__PURE__*/React.createElement("span", {
|
|
202
|
-
className: "header-arrow",
|
|
285
|
+
className: "header-arrow mr-2",
|
|
203
286
|
onClick: function onClick(e) {
|
|
204
287
|
setContext(function (ctx) {
|
|
205
288
|
ctx.contextMenu = {
|
|
@@ -66,6 +66,17 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
66
66
|
var divOffset = ((_d = hintRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
|
|
67
67
|
setTop(hintAbove ? selectionHeight - (divOffset + 30) : selectionHeight + 4);
|
|
68
68
|
};
|
|
69
|
+
var hexToRgbString = function hexToRgbString(hex) {
|
|
70
|
+
hex = hex.replace("#", "");
|
|
71
|
+
var r = parseInt(hex.substring(0, 2), 16);
|
|
72
|
+
var g = parseInt(hex.substring(2, 4), 16);
|
|
73
|
+
var b = parseInt(hex.substring(4, 6), 16);
|
|
74
|
+
return "".concat(r, ", ").concat(g, ", ").concat(b);
|
|
75
|
+
};
|
|
76
|
+
var bgColor = function bgColor(BRAND_SECONDARY_COLOR) {
|
|
77
|
+
var bg = BRAND_SECONDARY_COLOR ? "rgb(".concat(hexToRgbString(BRAND_SECONDARY_COLOR), ", 0.4)") : "#FFDF0A";
|
|
78
|
+
return bg;
|
|
79
|
+
};
|
|
69
80
|
useEffect(function () {
|
|
70
81
|
calcuatePopUpPlacement();
|
|
71
82
|
}, []);
|
|
@@ -189,7 +200,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
189
200
|
dir: "auto",
|
|
190
201
|
key: name,
|
|
191
202
|
style: {
|
|
192
|
-
backgroundColor: commaCount === i ? (fn
|
|
203
|
+
backgroundColor: commaCount === i ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
|
|
193
204
|
}
|
|
194
205
|
}, name, i !== fn.p.length - 1 && ", ");
|
|
195
206
|
})), /*#__PURE__*/React.createElement("code", {
|
|
@@ -365,7 +376,7 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
365
376
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("code", {
|
|
366
377
|
className: "font-family-mono mb-1 mt-2 color-text-default font-family-mono",
|
|
367
378
|
style: {
|
|
368
|
-
backgroundColor: commaCount === index ? (fn
|
|
379
|
+
backgroundColor: commaCount === index ? bgColor(fn.BRAND_SECONDARY_COLOR) : "transparent"
|
|
369
380
|
}
|
|
370
381
|
}, param.name, param.repeat === "y" && (/*#__PURE__*/React.createElement("span", {
|
|
371
382
|
className: "luckysheet-arguments-help-argument-info example-value",
|
|
@@ -495,7 +495,7 @@ var InputBox = function InputBox() {
|
|
|
495
495
|
minHeight: firstSelection.height
|
|
496
496
|
}, inputBoxStyle) : {}
|
|
497
497
|
}, /*#__PURE__*/React.createElement(ContentEditable, {
|
|
498
|
-
onMouseUp: function onMouseUp(
|
|
498
|
+
onMouseUp: function onMouseUp() {
|
|
499
499
|
var currentCommaCount = countCommasBeforeCursor(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
500
500
|
setCommaCount(currentCommaCount);
|
|
501
501
|
},
|