@fileverse-dev/fortune-react 1.1.99 → 1.2.0-patch-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/Menu.d.ts +1 -0
- package/es/components/ContextMenu/Menu.js +5 -2
- package/es/components/ContextMenu/index.css +4 -1
- package/es/components/ContextMenu/index.js +37 -10
- 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 +89 -7
- package/es/components/SheetOverlay/FormulaHint/index.js +13 -2
- package/es/components/SheetOverlay/FormulaSearch/index.css +0 -1
- package/es/components/SheetOverlay/FormulaSearch/index.js +1 -1
- package/es/components/SheetOverlay/InputBox.js +1 -1
- package/es/components/SheetOverlay/RowHeader.js +83 -7
- 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 +26 -7
- package/es/components/Toolbar/Combo.js +5 -2
- package/es/components/Toolbar/index.css +17 -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/Menu.d.ts +1 -0
- package/lib/components/ContextMenu/Menu.js +5 -2
- package/lib/components/ContextMenu/index.css +4 -1
- package/lib/components/ContextMenu/index.js +36 -9
- 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 +87 -6
- package/lib/components/SheetOverlay/FormulaHint/index.js +13 -2
- package/lib/components/SheetOverlay/FormulaSearch/index.css +0 -1
- package/lib/components/SheetOverlay/FormulaSearch/index.js +1 -1
- package/lib/components/SheetOverlay/InputBox.js +1 -1
- package/lib/components/SheetOverlay/RowHeader.js +81 -6
- 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 +26 -7
- package/lib/components/Toolbar/Combo.js +4 -1
- package/lib/components/Toolbar/index.css +17 -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
|
@@ -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: {
|
|
@@ -189,13 +266,12 @@ var RowHeader = function RowHeader() {
|
|
|
189
266
|
r1 = _a.r1,
|
|
190
267
|
r2 = _a.r2;
|
|
191
268
|
return /*#__PURE__*/React.createElement("div", {
|
|
192
|
-
className: "fortune-row-header-selected",
|
|
269
|
+
className: "fortune-row-header-selected color-bg-tertiary",
|
|
193
270
|
key: i,
|
|
194
271
|
style: _.assign({
|
|
195
272
|
top: row_pre,
|
|
196
273
|
height: row - row_pre - 1,
|
|
197
274
|
display: "block",
|
|
198
|
-
backgroundColor: "#EFC703",
|
|
199
275
|
mixBlendMode: "multiply"
|
|
200
276
|
}, fixRowStyleOverflowInFreeze(context, r1, r2, (_b = refs.globalCache.freezen) === null || _b === void 0 ? void 0 : _b[context.currentSheetId]))
|
|
201
277
|
});
|
|
@@ -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;
|
|
@@ -253,24 +253,26 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
|
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
255
|
});
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
256
|
+
if (_sheet.dataVerification) {
|
|
257
|
+
var newDataVerification_1 = {};
|
|
258
|
+
Object.keys(_sheet.dataVerification).forEach(function (item) {
|
|
259
|
+
var _a;
|
|
260
|
+
var itemData = (_a = _sheet.dataVerification) === null || _a === void 0 ? void 0 : _a[item];
|
|
261
|
+
var colRow = item.split("_");
|
|
262
|
+
if (colRow.length !== 2) return;
|
|
263
|
+
var presentRow = parseInt(colRow[0], 10);
|
|
264
|
+
var updatedRow = presentRow;
|
|
265
|
+
if (presentRow === sourceIndex_1) {
|
|
266
|
+
updatedRow = targetIndex;
|
|
267
|
+
} else if (presentRow > sourceIndex_1 && presentRow < targetIndex) {
|
|
268
|
+
updatedRow -= 1;
|
|
269
|
+
} else if (presentRow < sourceIndex_1 && presentRow >= targetIndex) {
|
|
270
|
+
updatedRow += 1;
|
|
271
|
+
}
|
|
272
|
+
newDataVerification_1["".concat(updatedRow, "_").concat(colRow[1])] = itemData;
|
|
273
|
+
});
|
|
274
|
+
_sheet.dataVerification = newDataVerification_1;
|
|
275
|
+
}
|
|
274
276
|
(_a = _sheet.calcChain) === null || _a === void 0 ? void 0 : _a.forEach(function (item) {
|
|
275
277
|
if (item.r === sourceIndex_1) {
|
|
276
278
|
item.r = targetIndex;
|
|
@@ -94,12 +94,12 @@ export function countCommasBeforeCursor(editableDiv) {
|
|
|
94
94
|
var textBeforeCursor = preCaretRange.toString();
|
|
95
95
|
var inQuotes = false;
|
|
96
96
|
var count = 0;
|
|
97
|
-
for (var i = 0; i < textBeforeCursor.length; i
|
|
97
|
+
for (var i = 0; i < textBeforeCursor.length; i += 1) {
|
|
98
98
|
var char = textBeforeCursor[i];
|
|
99
99
|
if (char === '"') {
|
|
100
100
|
inQuotes = !inQuotes;
|
|
101
|
-
} else if (char ===
|
|
102
|
-
count
|
|
101
|
+
} else if (char === "," && !inQuotes) {
|
|
102
|
+
count += 1;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
return count;
|
|
@@ -45,12 +45,10 @@
|
|
|
45
45
|
.fortune-row-header-selected {
|
|
46
46
|
position: absolute;
|
|
47
47
|
z-index: 10;
|
|
48
|
-
border-right: 1px solid #0188fb;
|
|
49
48
|
right: 0;
|
|
50
49
|
width: 100%;
|
|
51
50
|
margin-top: 2px;
|
|
52
51
|
display: none;
|
|
53
|
-
background-color: rgba(76, 76, 76, 0.1);
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
.fortune-col-header-wrap {
|
|
@@ -94,12 +92,10 @@
|
|
|
94
92
|
cursor: default;
|
|
95
93
|
position: absolute;
|
|
96
94
|
z-index: 10;
|
|
97
|
-
border-bottom: 1px solid #0188fb;
|
|
98
95
|
bottom: 0;
|
|
99
96
|
height: 100%;
|
|
100
97
|
margin-left: 0px;
|
|
101
98
|
display: none;
|
|
102
|
-
background-color: rgba(76, 76, 76, 0.1);
|
|
103
99
|
}
|
|
104
100
|
|
|
105
101
|
.fortune-left-top {
|
|
@@ -137,7 +133,7 @@
|
|
|
137
133
|
z-index: 14;
|
|
138
134
|
/*border:1px solid #fff;*/
|
|
139
135
|
margin: 0px 0 0 0px;
|
|
140
|
-
background: rgba(0, 80, 208, 0.15);
|
|
136
|
+
/* background: rgba(0, 80, 208, 0.15); */
|
|
141
137
|
display: none;
|
|
142
138
|
}
|
|
143
139
|
|
|
@@ -199,7 +195,7 @@
|
|
|
199
195
|
z-index: 15;
|
|
200
196
|
border: 2.5px solid #efc703;
|
|
201
197
|
margin: -1px 0 0 -1px;
|
|
202
|
-
background: rgba(
|
|
198
|
+
background: rgba(239, 199, 5, 0.02);
|
|
203
199
|
display: none;
|
|
204
200
|
box-sizing: content-box;
|
|
205
201
|
}
|
|
@@ -1010,4 +1006,27 @@
|
|
|
1010
1006
|
background: #555;
|
|
1011
1007
|
/* darker on hover */
|
|
1012
1008
|
/* scrollbar */
|
|
1013
|
-
}
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
.hide-btn {
|
|
1012
|
+
padding-top: 1px;
|
|
1013
|
+
position: absolute;
|
|
1014
|
+
right: 5;
|
|
1015
|
+
top: 5px;
|
|
1016
|
+
z-index: 200;
|
|
1017
|
+
width: 9px;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
.hide-btn:hover {
|
|
1021
|
+
border: 1px solid #0188fb;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
.rotate-row-icon {
|
|
1025
|
+
transform: rotate(-90deg);
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
.hide-btn-row {
|
|
1029
|
+
position: absolute;
|
|
1030
|
+
left: 4px;
|
|
1031
|
+
z-index: 200;
|
|
1032
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo, useRef, useState } from "react";
|
|
2
|
-
import { IconButton, Tooltip, Popover, PopoverContent, PopoverTrigger, cn, Button } from "@fileverse/ui";
|
|
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
5
|
var Combo = function Combo(_a) {
|
|
@@ -49,7 +49,10 @@ var Combo = function Combo(_a) {
|
|
|
49
49
|
height: 16
|
|
50
50
|
})) : (/*#__PURE__*/React.createElement("span", {
|
|
51
51
|
className: "fortune-toolbar-combo-text"
|
|
52
|
-
}, text !== undefined ? text : ""))
|
|
52
|
+
}, text !== undefined ? text : "")), /*#__PURE__*/React.createElement(LucideIcon, {
|
|
53
|
+
className: "w-[16px] h-[16px]",
|
|
54
|
+
name: "ChevronDown"
|
|
55
|
+
})))) : (/*#__PURE__*/React.createElement("span", null, iconId === "font-color" ? (/*#__PURE__*/React.createElement(Tooltip, {
|
|
53
56
|
text: tooltip,
|
|
54
57
|
placement: "bottom"
|
|
55
58
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -141,12 +141,24 @@
|
|
|
141
141
|
|
|
142
142
|
.fortune-toolbar-combo-button {
|
|
143
143
|
font-size: 12px;
|
|
144
|
+
padding-top: 4px;
|
|
145
|
+
padding-bottom: 4px;
|
|
146
|
+
padding-left: 8px;
|
|
147
|
+
padding-right: 8px;
|
|
148
|
+
border-radius: 4px;
|
|
149
|
+
gap: 8px;
|
|
150
|
+
}
|
|
151
|
+
.fortune-toolbar-combo-button:hover {
|
|
152
|
+
background: hsl(var(--color-bg-default-hover));
|
|
144
153
|
}
|
|
145
154
|
|
|
146
155
|
.fortune-toolbar-select-option {
|
|
147
156
|
font-size: 12px;
|
|
148
157
|
min-width: 60px;
|
|
149
|
-
padding: 8px;
|
|
158
|
+
padding-left: 8px;
|
|
159
|
+
padding-right: 8px;
|
|
160
|
+
padding-top: 6px;
|
|
161
|
+
padding-bottom: 6px;
|
|
150
162
|
cursor: pointer;
|
|
151
163
|
user-select: none;
|
|
152
164
|
}
|
|
@@ -171,6 +183,10 @@
|
|
|
171
183
|
font-weight: 500;
|
|
172
184
|
font-size: 14px;
|
|
173
185
|
line-height: 20px;
|
|
186
|
+
max-width: 56px;
|
|
187
|
+
overflow: hidden;
|
|
188
|
+
text-overflow: ellipsis;
|
|
189
|
+
white-space: nowrap;
|
|
174
190
|
}
|
|
175
191
|
|
|
176
192
|
.fortune-toolbar-color-picker-item {
|
|
@@ -124,7 +124,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
124
124
|
};
|
|
125
125
|
import React, { useContext, useCallback, useRef, useEffect, useState } from "react";
|
|
126
126
|
import { toolbarItemClickHandler, handleTextBackground, handleTextColor, handleTextSize, normalizedCellAttr, getFlowdata, newComment, editComment, deleteComment, showHideComment, showHideAllComments, autoSelectionFormula, handleSum, locale, handleMerge, handleBorder, toolbarItemSelectedFunc, handleFreeze, insertImage, showImgChooser, updateFormat, handleSort, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, createFilter, clearFilter, applyLocation, insertDuneChart } from "@fileverse-dev/fortune-core";
|
|
127
|
-
import {
|
|
127
|
+
import { api } from "@fileverse-dev/fortune-core";
|
|
128
128
|
import _ from "lodash";
|
|
129
129
|
import { IconButton, LucideIcon, Tooltip, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@fileverse/ui";
|
|
130
130
|
import DataVerificationPortal from "./dataVerificationPortal";
|
|
@@ -585,9 +585,35 @@ var Toolbar = function Toolbar(_a) {
|
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
}, [itemLocations, setMoreItems, settings.toolbarItems.length, sheetWidth, isDesktop]);
|
|
588
|
+
useEffect(function () {
|
|
589
|
+
setContext(function (ctx) {
|
|
590
|
+
ctx.dataVerification.dataRegulation.value1 = "value1";
|
|
591
|
+
});
|
|
592
|
+
}, []);
|
|
588
593
|
var _o = useState(false),
|
|
589
594
|
showDataValidation = _o[0],
|
|
590
595
|
setShowDataValidation = _o[1];
|
|
596
|
+
var dataVerificationClick = function dataVerificationClick() {
|
|
597
|
+
var _a;
|
|
598
|
+
var selection = api.getSelection(context);
|
|
599
|
+
if (!selection) {
|
|
600
|
+
setContext(function (ctx) {
|
|
601
|
+
api.setSelection(ctx, [{
|
|
602
|
+
row: [0, 0],
|
|
603
|
+
column: [0, 0]
|
|
604
|
+
}], {
|
|
605
|
+
id: context.currentSheetId
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
(_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
610
|
+
setTimeout(function () {
|
|
611
|
+
setShowDataValidation(true);
|
|
612
|
+
}, 100);
|
|
613
|
+
};
|
|
614
|
+
useEffect(function () {
|
|
615
|
+
window.dataVerificationClick = dataVerificationClick;
|
|
616
|
+
}, []);
|
|
591
617
|
var getToolbarItem = useCallback(function (name, i) {
|
|
592
618
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
593
619
|
var tooltip = toolbar[name];
|
|
@@ -970,24 +996,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
970
996
|
iconId: name,
|
|
971
997
|
tooltip: tooltip,
|
|
972
998
|
key: name,
|
|
973
|
-
onClick:
|
|
974
|
-
var _a;
|
|
975
|
-
var selection = getSelection(context);
|
|
976
|
-
if (!selection) {
|
|
977
|
-
setContext(function (ctx) {
|
|
978
|
-
setSelection(ctx, [{
|
|
979
|
-
row: [0, 0],
|
|
980
|
-
column: [0, 0]
|
|
981
|
-
}], {
|
|
982
|
-
id: context.currentSheetId
|
|
983
|
-
});
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
(_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
987
|
-
setTimeout(function () {
|
|
988
|
-
setShowDataValidation(true);
|
|
989
|
-
}, 100);
|
|
990
|
-
}
|
|
999
|
+
onClick: dataVerificationClick
|
|
991
1000
|
}));
|
|
992
1001
|
}
|
|
993
1002
|
if (name === "locationCondition") {
|
|
@@ -57,7 +57,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
57
57
|
getHtmlByRange: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => string | null;
|
|
58
58
|
setSelection: (range: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
|
|
59
59
|
setCellValuesByRange: (data: any[][], range: import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
|
|
60
|
-
setCellFormatByRange: (attr: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, range: import("@fileverse-dev/fortune-core").
|
|
60
|
+
setCellFormatByRange: (attr: "error" | "rt" | "f" | "m" | "v" | "mc" | "ct" | "qp" | "spl" | "bg" | "lo" | "baseValue" | "baseCurrency" | "baseCurrencyPrice" | "isDataBlockFormula" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle, value: any, range: import("@fileverse-dev/fortune-core").Range | import("@fileverse-dev/fortune-core").SingleRange, options?: api.CommonOptions) => void;
|
|
61
61
|
mergeCells: (ranges: import("@fileverse-dev/fortune-core").Range, type: string, options?: api.CommonOptions) => void;
|
|
62
62
|
cancelMerge: (ranges: import("@fileverse-dev/fortune-core").Range, options?: api.CommonOptions) => void;
|
|
63
63
|
getAllSheets: () => SheetType[];
|
|
@@ -647,6 +647,11 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
647
647
|
}
|
|
648
648
|
});
|
|
649
649
|
}
|
|
650
|
+
setContextWithProduce(function (ctx) {
|
|
651
|
+
if (ctx.luckysheet_selection_range) {
|
|
652
|
+
ctx.luckysheet_selection_range = [];
|
|
653
|
+
}
|
|
654
|
+
});
|
|
650
655
|
}, [context, setContextWithProduce]);
|
|
651
656
|
var onMoreToolbarItemsClose = useCallback(function () {
|
|
652
657
|
setMoreToolbarItems(null);
|
|
@@ -3,6 +3,7 @@ type Props = React.PropsWithChildren<{
|
|
|
3
3
|
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
|
|
4
4
|
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
|
|
5
5
|
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
|
|
6
|
+
isActive?: boolean;
|
|
6
7
|
}>;
|
|
7
8
|
declare const Menu: React.FC<Props>;
|
|
8
9
|
export default Menu;
|
|
@@ -5,17 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _ui = require("@fileverse/ui");
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
10
11
|
var Menu = function Menu(_a) {
|
|
11
12
|
var _onClick = _a.onClick,
|
|
12
13
|
_onMouseLeave = _a.onMouseLeave,
|
|
13
14
|
_onMouseEnter = _a.onMouseEnter,
|
|
14
|
-
children = _a.children
|
|
15
|
+
children = _a.children,
|
|
16
|
+
_b = _a.isActive,
|
|
17
|
+
isActive = _b === void 0 ? false : _b;
|
|
15
18
|
var containerRef = (0, _react.useRef)(null);
|
|
16
19
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
17
20
|
ref: containerRef,
|
|
18
|
-
className: "luckysheet-cols-menuitem luckysheet-mousedown-cancel",
|
|
21
|
+
className: (0, _ui.cn)("luckysheet-cols-menuitem luckysheet-mousedown-cancel", isActive && "color-bg-default-hover"),
|
|
19
22
|
onClick: function onClick(e) {
|
|
20
23
|
return _onClick === null || _onClick === void 0 ? void 0 : _onClick(e, containerRef.current);
|
|
21
24
|
},
|
|
@@ -82,7 +82,10 @@
|
|
|
82
82
|
cursor: pointer;
|
|
83
83
|
list-style: none;
|
|
84
84
|
margin: 0;
|
|
85
|
-
padding: 8px !important;
|
|
85
|
+
padding-right: 8px !important;
|
|
86
|
+
padding-left: 8px !important;
|
|
87
|
+
padding-top: 6px !important;
|
|
88
|
+
padding-bottom: 6px !important;
|
|
86
89
|
white-space: nowrap;
|
|
87
90
|
user-select: none;
|
|
88
91
|
display: flex;
|
|
@@ -158,6 +158,9 @@ var ContextMenu = function ContextMenu() {
|
|
|
158
158
|
info = _b.info,
|
|
159
159
|
toolbar = _b.toolbar,
|
|
160
160
|
splitText = _b.splitText;
|
|
161
|
+
var _c = (0, _react.useState)(""),
|
|
162
|
+
activeMenu = _c[0],
|
|
163
|
+
setActiveMenu = _c[1];
|
|
161
164
|
var addRowColRightAvobe = function addRowColRightAvobe(type, direction) {
|
|
162
165
|
var _a, _b, _c, _d, _e, _f;
|
|
163
166
|
var positionCol = (_c = (_b = (_a = context.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.column) === null || _c === void 0 ? void 0 : _c[0];
|
|
@@ -642,7 +645,7 @@ var ContextMenu = function ContextMenu() {
|
|
|
642
645
|
}), /*#__PURE__*/_react.default.createElement("div", null, rightclick.deleteSelected, rightclick.row))));
|
|
643
646
|
}
|
|
644
647
|
if (name === "hide-row") {
|
|
645
|
-
return (selection === null || selection === void 0 ? void 0 : selection.row_select)
|
|
648
|
+
return (selection === null || selection === void 0 ? void 0 : selection.row_select) && ["hideSelected", "showHide"].map(function (item) {
|
|
646
649
|
return /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
647
650
|
key: item,
|
|
648
651
|
onClick: function onClick() {
|
|
@@ -838,6 +841,12 @@ var ContextMenu = function ContextMenu() {
|
|
|
838
841
|
arrow: false,
|
|
839
842
|
zIndex: 3000,
|
|
840
843
|
appendTo: document.body,
|
|
844
|
+
onShow: function onShow() {
|
|
845
|
+
setActiveMenu("sort");
|
|
846
|
+
},
|
|
847
|
+
onHide: function onHide() {
|
|
848
|
+
if (activeMenu === "sort") setActiveMenu("");
|
|
849
|
+
},
|
|
841
850
|
content: /*#__PURE__*/_react.default.createElement("div", {
|
|
842
851
|
className: "fortune-toolbar-select",
|
|
843
852
|
style: {
|
|
@@ -876,7 +885,9 @@ var ContextMenu = function ContextMenu() {
|
|
|
876
885
|
}), /*#__PURE__*/_react.default.createElement("p", null, sort.desc))))),
|
|
877
886
|
trigger: "mouseenter focus",
|
|
878
887
|
hideOnClick: false
|
|
879
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Menu.default,
|
|
888
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
889
|
+
isActive: activeMenu === "sort"
|
|
890
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
880
891
|
className: "flex items-center justify-between w-full"
|
|
881
892
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
882
893
|
className: "context-item"
|
|
@@ -916,7 +927,7 @@ var ContextMenu = function ContextMenu() {
|
|
|
916
927
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
917
928
|
className: "context-item p-2 w-full",
|
|
918
929
|
style: {
|
|
919
|
-
height: "
|
|
930
|
+
height: "32px"
|
|
920
931
|
}
|
|
921
932
|
}, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
|
|
922
933
|
name: "Filter",
|
|
@@ -931,14 +942,22 @@ var ContextMenu = function ContextMenu() {
|
|
|
931
942
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
932
943
|
className: "context-item p-2 w-full",
|
|
933
944
|
style: {
|
|
934
|
-
height: "
|
|
945
|
+
height: "32px"
|
|
935
946
|
}
|
|
936
947
|
}, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
|
|
937
948
|
name: "Eraser"
|
|
938
949
|
}), /*#__PURE__*/_react.default.createElement("p", null, filter.clearFilter))))),
|
|
939
950
|
trigger: "mouseenter focus",
|
|
940
|
-
hideOnClick: false
|
|
941
|
-
|
|
951
|
+
hideOnClick: false,
|
|
952
|
+
onShow: function onShow() {
|
|
953
|
+
setActiveMenu("filter");
|
|
954
|
+
},
|
|
955
|
+
onHide: function onHide() {
|
|
956
|
+
if (activeMenu === "filter") setActiveMenu("");
|
|
957
|
+
}
|
|
958
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
959
|
+
isActive: activeMenu === "filter"
|
|
960
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
942
961
|
className: "flex items-center justify-between w-full"
|
|
943
962
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
944
963
|
className: "context-item"
|
|
@@ -992,6 +1011,12 @@ var ContextMenu = function ContextMenu() {
|
|
|
992
1011
|
arrow: false,
|
|
993
1012
|
zIndex: 3000,
|
|
994
1013
|
appendTo: document.body,
|
|
1014
|
+
onShow: function onShow() {
|
|
1015
|
+
setActiveMenu("conditionFormat");
|
|
1016
|
+
},
|
|
1017
|
+
onHide: function onHide() {
|
|
1018
|
+
if (activeMenu === "conditionFormat") setActiveMenu("");
|
|
1019
|
+
},
|
|
995
1020
|
content: /*#__PURE__*/_react.default.createElement("div", {
|
|
996
1021
|
style: {
|
|
997
1022
|
minWidth: 220
|
|
@@ -1002,7 +1027,9 @@ var ContextMenu = function ContextMenu() {
|
|
|
1002
1027
|
})),
|
|
1003
1028
|
trigger: "mouseenter focus",
|
|
1004
1029
|
hideOnClick: false
|
|
1005
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Menu.default,
|
|
1030
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
1031
|
+
isActive: activeMenu === "conditionFormat"
|
|
1032
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
1006
1033
|
className: "flex items-center justify-between w-full"
|
|
1007
1034
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
1008
1035
|
className: "flex items-center gap-2 context-item"
|
|
@@ -1038,7 +1065,7 @@ var ContextMenu = function ContextMenu() {
|
|
|
1038
1065
|
}), /*#__PURE__*/_react.default.createElement("p", null, "Clear formatting")));
|
|
1039
1066
|
}
|
|
1040
1067
|
return null;
|
|
1041
|
-
}, [context, setContext, refs.globalCache, rightclick, showAlert, showDialog, drag.noMulti, info.tipRowHeightLimit, info.tipColumnWidthLimit, generalDialog.partiallyError, generalDialog.readOnlyError, generalDialog.dataNullError]);
|
|
1068
|
+
}, [context, setContext, refs.globalCache, rightclick, showAlert, showDialog, drag.noMulti, info.tipRowHeightLimit, info.tipColumnWidthLimit, generalDialog.partiallyError, generalDialog.readOnlyError, generalDialog.dataNullError, activeMenu]);
|
|
1042
1069
|
(0, _react.useLayoutEffect)(function () {
|
|
1043
1070
|
var _a;
|
|
1044
1071
|
if (!containerRef.current) {
|
|
@@ -1086,7 +1113,7 @@ var ContextMenu = function ContextMenu() {
|
|
|
1086
1113
|
left: contextMenu.x,
|
|
1087
1114
|
top: contextMenu.y
|
|
1088
1115
|
}
|
|
1089
|
-
}, context.contextMenu.headerMenu === true ? settings.headerContextMenu.map(function (menu, i) {
|
|
1116
|
+
}, context.contextMenu.headerMenu === true || context.contextMenu.headerMenu === "row" ? settings.headerContextMenu.map(function (menu, i) {
|
|
1090
1117
|
return getMenuElement(menu, i);
|
|
1091
1118
|
}) : settings.cellContextMenu.map(function (menu, i) {
|
|
1092
1119
|
return getMenuElement(menu, i);
|