@fileverse-dev/fortune-react 1.1.99 → 1.2.0
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/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/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
|
};
|
|
@@ -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
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { rowLocation, rowLocationByIndex, selectTitlesMap, selectTitlesRange, handleContextMenu, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, fixRowStyleOverflowInFreeze, handleRowFreezeHandleMouseDown, getSheetIndex, fixPositionOnFrozenCells } from "@fileverse-dev/fortune-core";
|
|
1
|
+
import { rowLocation, rowLocationByIndex, selectTitlesMap, selectTitlesRange, handleContextMenu, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, fixRowStyleOverflowInFreeze, handleRowFreezeHandleMouseDown, getSheetIndex, showSelected, fixPositionOnFrozenCells } 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";
|
|
@@ -67,7 +68,13 @@ var RowHeader = function RowHeader() {
|
|
|
67
68
|
getRowIndexClicked = _f.getRowIndexClicked,
|
|
68
69
|
isRowDoubleClicked = _f.isRowDoubleClicked;
|
|
69
70
|
var onMouseDown = useCallback(function (e) {
|
|
70
|
-
if (e.button
|
|
71
|
+
if (e.button === 0 && e.target.tagName === "use" || e.button === 2) {
|
|
72
|
+
var nativeEvent_1 = e.nativeEvent;
|
|
73
|
+
setContext(function (draft) {
|
|
74
|
+
handleRowHeaderMouseDown(draft, refs.globalCache, nativeEvent_1, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (e.button !== 0 || context.isFlvReadOnly) return;
|
|
71
78
|
var targetEl = e.target;
|
|
72
79
|
if (targetEl.closest(".fortune-rows-change-size") || targetEl.closest(".fortune-rows-freeze-handle")) return;
|
|
73
80
|
var headerEl = containerRef.current;
|
|
@@ -79,9 +86,9 @@ var RowHeader = function RowHeader() {
|
|
|
79
86
|
draft.luckysheet_scroll_status = true;
|
|
80
87
|
});
|
|
81
88
|
} else {
|
|
82
|
-
var
|
|
89
|
+
var nativeEvent_2 = e.nativeEvent;
|
|
83
90
|
setContext(function (draft) {
|
|
84
|
-
handleRowHeaderMouseDown(draft, refs.globalCache,
|
|
91
|
+
handleRowHeaderMouseDown(draft, refs.globalCache, nativeEvent_2, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
85
92
|
});
|
|
86
93
|
return;
|
|
87
94
|
}
|
|
@@ -147,6 +154,43 @@ var RowHeader = function RowHeader() {
|
|
|
147
154
|
}
|
|
148
155
|
setSelectedLocation(selects);
|
|
149
156
|
}, [context.luckysheet_select_save, context.visibledatarow]);
|
|
157
|
+
var _g = useState([]),
|
|
158
|
+
hiddenPointers = _g[0],
|
|
159
|
+
setHiddenPointers = _g[1];
|
|
160
|
+
useEffect(function () {
|
|
161
|
+
var _a, _b;
|
|
162
|
+
if (sheetIndex == null) return;
|
|
163
|
+
var tempPointers = [];
|
|
164
|
+
var rowhidden = (_b = (_a = context.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.rowhidden;
|
|
165
|
+
if (rowhidden) {
|
|
166
|
+
Object.keys(rowhidden).forEach(function (key) {
|
|
167
|
+
var item = {
|
|
168
|
+
row: key,
|
|
169
|
+
top: context.visibledatarow[Number(key) - 1]
|
|
170
|
+
};
|
|
171
|
+
tempPointers.push(item);
|
|
172
|
+
});
|
|
173
|
+
setHiddenPointers(tempPointers);
|
|
174
|
+
} else {
|
|
175
|
+
setHiddenPointers([]);
|
|
176
|
+
}
|
|
177
|
+
}, [context.visibledatarow, sheetIndex]);
|
|
178
|
+
var showRow = function showRow(e, item) {
|
|
179
|
+
if (context.isFlvReadOnly) return;
|
|
180
|
+
e.stopPropagation();
|
|
181
|
+
setContext(function (ctx) {
|
|
182
|
+
var _a;
|
|
183
|
+
api.setSelection(ctx, [{
|
|
184
|
+
row: [Number(item.row) - 1, Number(item.row) + 1],
|
|
185
|
+
column: [0, (_a = context.visibledatacolumn) === null || _a === void 0 ? void 0 : _a.length]
|
|
186
|
+
}], {
|
|
187
|
+
id: context.currentSheetId
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
setContext(function (ctx) {
|
|
191
|
+
showSelected(ctx, "row");
|
|
192
|
+
});
|
|
193
|
+
};
|
|
150
194
|
useEffect(function () {
|
|
151
195
|
containerRef.current.scrollTop = context.scrollTop;
|
|
152
196
|
}, [context.scrollTop]);
|
|
@@ -161,7 +205,40 @@ var RowHeader = function RowHeader() {
|
|
|
161
205
|
onMouseDown: onMouseDown,
|
|
162
206
|
onMouseLeave: onMouseLeave,
|
|
163
207
|
onContextMenu: onContextMenu
|
|
164
|
-
},
|
|
208
|
+
}, hiddenPointers.map(function (item) {
|
|
209
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
210
|
+
className: "flex flex-col gap-4 cursor-pointer align-center hide-btn-row hide-btn",
|
|
211
|
+
style: {
|
|
212
|
+
top: "".concat(item.top - 16, "px"),
|
|
213
|
+
zIndex: 100
|
|
214
|
+
},
|
|
215
|
+
onClick: function onClick(e) {
|
|
216
|
+
return showRow(e, item);
|
|
217
|
+
}
|
|
218
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
219
|
+
className: "rotate-row-icon"
|
|
220
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
221
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
222
|
+
width: "5",
|
|
223
|
+
height: "8",
|
|
224
|
+
viewBox: "0 0 5 8",
|
|
225
|
+
fill: "none"
|
|
226
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
227
|
+
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",
|
|
228
|
+
fill: "#363B3F"
|
|
229
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
230
|
+
className: "rotate-90"
|
|
231
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
232
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
233
|
+
width: "5",
|
|
234
|
+
height: "8",
|
|
235
|
+
viewBox: "0 0 5 8",
|
|
236
|
+
fill: "none"
|
|
237
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
238
|
+
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",
|
|
239
|
+
fill: "#363B3F"
|
|
240
|
+
}))));
|
|
241
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
165
242
|
className: "fortune-rows-freeze-handle",
|
|
166
243
|
onMouseDown: onRowFreezeHandleMouseDown,
|
|
167
244
|
style: {
|
|
@@ -272,24 +272,26 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
|
|
|
272
272
|
}
|
|
273
273
|
});
|
|
274
274
|
});
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
275
|
+
if (_sheet.dataVerification) {
|
|
276
|
+
var newDataVerification_1 = {};
|
|
277
|
+
Object.keys(_sheet.dataVerification).forEach(function (item) {
|
|
278
|
+
var _a;
|
|
279
|
+
var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
|
|
280
|
+
var colRow = item.split("_");
|
|
281
|
+
if (colRow.length !== 2) return;
|
|
282
|
+
var presentcol = parseInt(colRow[1], 10);
|
|
283
|
+
var updatedCol = presentcol;
|
|
284
|
+
if (presentcol === sourceIndex_1) {
|
|
285
|
+
updatedCol = targetIndex;
|
|
286
|
+
} else if (presentcol > sourceIndex_1 && presentcol < targetIndex) {
|
|
287
|
+
updatedCol -= 1;
|
|
288
|
+
} else if (presentcol < sourceIndex_1 && presentcol >= targetIndex) {
|
|
289
|
+
updatedCol += 1;
|
|
290
|
+
}
|
|
291
|
+
newDataVerification_1["".concat(colRow[0], "_").concat(updatedCol)] = itemData;
|
|
292
|
+
});
|
|
293
|
+
_sheet.dataVerification = newDataVerification_1;
|
|
294
|
+
}
|
|
293
295
|
(_c = _sheet.calcChain) === null || _c === void 0 ? void 0 : _c.forEach(function (item) {
|
|
294
296
|
if (item.c === sourceIndex_1) {
|
|
295
297
|
item.c = targetIndex;
|