@fileverse-dev/fortune-react 1.3.4 → 1.3.5-hyper
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 -1
- package/es/components/LinkEidtCard/index.js +20 -5
- package/es/components/SheetOverlay/index.js +2 -2
- package/lib/components/ContextMenu/index.js +2 -1
- package/lib/components/LinkEidtCard/index.js +19 -4
- package/lib/components/SheetOverlay/index.js +2 -2
- package/package.json +2 -2
|
@@ -974,7 +974,8 @@ var ContextMenu = function ContextMenu() {
|
|
|
974
974
|
key: name,
|
|
975
975
|
onClick: function onClick() {
|
|
976
976
|
setContext(function (draftCtx) {
|
|
977
|
-
|
|
977
|
+
var _a;
|
|
978
|
+
handleLink(draftCtx, (_a = refs.cellInput.current) !== null && _a !== void 0 ? _a : undefined);
|
|
978
979
|
draftCtx.contextMenu = {};
|
|
979
980
|
});
|
|
980
981
|
}
|
|
@@ -9,7 +9,7 @@ var __assign = this && this.__assign || function () {
|
|
|
9
9
|
return __assign.apply(this, arguments);
|
|
10
10
|
};
|
|
11
11
|
import React, { useContext, useState, useMemo, useCallback, useLayoutEffect, useRef, useEffect } from "react";
|
|
12
|
-
import { locale, saveHyperlink, removeHyperlink, replaceHtml, goToLink, isLinkValid } from "@fileverse-dev/fortune-core";
|
|
12
|
+
import { locale, saveHyperlink, removeHyperlink, replaceHtml, goToLink, isLinkValid, jfrefreshgrid } from "@fileverse-dev/fortune-core";
|
|
13
13
|
import { Button, TextField, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, LucideIcon } from "@fileverse/ui";
|
|
14
14
|
import "./index.css";
|
|
15
15
|
import _ from "lodash";
|
|
@@ -23,7 +23,8 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
23
23
|
originType = _a.originType,
|
|
24
24
|
originAddress = _a.originAddress,
|
|
25
25
|
isEditing = _a.isEditing,
|
|
26
|
-
position = _a.position
|
|
26
|
+
position = _a.position,
|
|
27
|
+
applyToSelection = _a.applyToSelection;
|
|
27
28
|
var _b = useContext(WorkbookContext),
|
|
28
29
|
context = _b.context,
|
|
29
30
|
setContext = _b.setContext,
|
|
@@ -86,7 +87,14 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
86
87
|
if (e.key === "Enter") {
|
|
87
88
|
_.set(refs.globalCache, "linkCard.mouseEnter", false);
|
|
88
89
|
setContext(function (draftCtx) {
|
|
89
|
-
|
|
90
|
+
saveHyperlink(draftCtx, r, c, linkText, linkType, linkAddress, {
|
|
91
|
+
applyToSelection: applyToSelection || undefined,
|
|
92
|
+
cellInput: refs.cellInput.current
|
|
93
|
+
});
|
|
94
|
+
if (!applyToSelection) {
|
|
95
|
+
draftCtx.luckysheetCellUpdate = [];
|
|
96
|
+
jfrefreshgrid(draftCtx, null, undefined);
|
|
97
|
+
}
|
|
90
98
|
});
|
|
91
99
|
}
|
|
92
100
|
},
|
|
@@ -94,7 +102,7 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
94
102
|
return e.stopPropagation();
|
|
95
103
|
}
|
|
96
104
|
};
|
|
97
|
-
}, [refs.globalCache, isButtonDisabled]);
|
|
105
|
+
}, [refs.globalCache, isButtonDisabled, applyToSelection, linkText, linkType, linkAddress, r, c, setContext, refs.cellInput]);
|
|
98
106
|
var renderToolbarButton = useCallback(function (iconId, onClick) {
|
|
99
107
|
var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
100
108
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -288,7 +296,14 @@ export var LinkEditCard = function LinkEditCard(_a) {
|
|
|
288
296
|
if (isButtonDisabled) return;
|
|
289
297
|
_.set(refs.globalCache, "linkCard.mouseEnter", false);
|
|
290
298
|
setContext(function (draftCtx) {
|
|
291
|
-
|
|
299
|
+
saveHyperlink(draftCtx, r, c, linkText, linkType, linkAddress, {
|
|
300
|
+
applyToSelection: applyToSelection || undefined,
|
|
301
|
+
cellInput: refs.cellInput.current
|
|
302
|
+
});
|
|
303
|
+
if (!applyToSelection) {
|
|
304
|
+
draftCtx.luckysheetCellUpdate = [];
|
|
305
|
+
jfrefreshgrid(draftCtx, null, undefined);
|
|
306
|
+
}
|
|
292
307
|
});
|
|
293
308
|
},
|
|
294
309
|
"data-testid": "link-card-cta-insert"
|
|
@@ -83,7 +83,7 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
83
83
|
}
|
|
84
84
|
if (skip || ((_a = globalCache.linkCard) === null || _a === void 0 ? void 0 : _a.mouseEnter)) return;
|
|
85
85
|
setContext(function (draftCtx) {
|
|
86
|
-
showLinkCard(draftCtx, r, c, isEditing);
|
|
86
|
+
showLinkCard(draftCtx, r, c, undefined, isEditing);
|
|
87
87
|
});
|
|
88
88
|
}, 800);
|
|
89
89
|
}, [setContext]);
|
|
@@ -96,7 +96,7 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
96
96
|
debouncedShowLinkCard(globalCache, rc.r, rc.c, false);
|
|
97
97
|
} else {
|
|
98
98
|
if ((_a = globalCache.linkCard) === null || _a === void 0 ? void 0 : _a.mouseEnter) return;
|
|
99
|
-
showLinkCard(ctx, rc.r, rc.c, false);
|
|
99
|
+
showLinkCard(ctx, rc.r, rc.c, undefined, false);
|
|
100
100
|
debouncedShowLinkCard(globalCache, rc.r, rc.c, false, true);
|
|
101
101
|
}
|
|
102
102
|
}, [debouncedShowLinkCard]);
|
|
@@ -983,7 +983,8 @@ var ContextMenu = function ContextMenu() {
|
|
|
983
983
|
key: name,
|
|
984
984
|
onClick: function onClick() {
|
|
985
985
|
setContext(function (draftCtx) {
|
|
986
|
-
|
|
986
|
+
var _a;
|
|
987
|
+
(0, _fortuneCore.handleLink)(draftCtx, (_a = refs.cellInput.current) !== null && _a !== void 0 ? _a : undefined);
|
|
987
988
|
draftCtx.contextMenu = {};
|
|
988
989
|
});
|
|
989
990
|
}
|
|
@@ -32,7 +32,8 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
32
32
|
originType = _a.originType,
|
|
33
33
|
originAddress = _a.originAddress,
|
|
34
34
|
isEditing = _a.isEditing,
|
|
35
|
-
position = _a.position
|
|
35
|
+
position = _a.position,
|
|
36
|
+
applyToSelection = _a.applyToSelection;
|
|
36
37
|
var _b = (0, _react.useContext)(_context.default),
|
|
37
38
|
context = _b.context,
|
|
38
39
|
setContext = _b.setContext,
|
|
@@ -95,7 +96,14 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
95
96
|
if (e.key === "Enter") {
|
|
96
97
|
_lodash.default.set(refs.globalCache, "linkCard.mouseEnter", false);
|
|
97
98
|
setContext(function (draftCtx) {
|
|
98
|
-
|
|
99
|
+
(0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress, {
|
|
100
|
+
applyToSelection: applyToSelection || undefined,
|
|
101
|
+
cellInput: refs.cellInput.current
|
|
102
|
+
});
|
|
103
|
+
if (!applyToSelection) {
|
|
104
|
+
draftCtx.luckysheetCellUpdate = [];
|
|
105
|
+
(0, _fortuneCore.jfrefreshgrid)(draftCtx, null, undefined);
|
|
106
|
+
}
|
|
99
107
|
});
|
|
100
108
|
}
|
|
101
109
|
},
|
|
@@ -103,7 +111,7 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
103
111
|
return e.stopPropagation();
|
|
104
112
|
}
|
|
105
113
|
};
|
|
106
|
-
}, [refs.globalCache, isButtonDisabled]);
|
|
114
|
+
}, [refs.globalCache, isButtonDisabled, applyToSelection, linkText, linkType, linkAddress, r, c, setContext, refs.cellInput]);
|
|
107
115
|
var renderToolbarButton = (0, _react.useCallback)(function (iconId, onClick) {
|
|
108
116
|
var iconIdClass = iconId.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-");
|
|
109
117
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -297,7 +305,14 @@ var LinkEditCard = exports.LinkEditCard = function LinkEditCard(_a) {
|
|
|
297
305
|
if (isButtonDisabled) return;
|
|
298
306
|
_lodash.default.set(refs.globalCache, "linkCard.mouseEnter", false);
|
|
299
307
|
setContext(function (draftCtx) {
|
|
300
|
-
|
|
308
|
+
(0, _fortuneCore.saveHyperlink)(draftCtx, r, c, linkText, linkType, linkAddress, {
|
|
309
|
+
applyToSelection: applyToSelection || undefined,
|
|
310
|
+
cellInput: refs.cellInput.current
|
|
311
|
+
});
|
|
312
|
+
if (!applyToSelection) {
|
|
313
|
+
draftCtx.luckysheetCellUpdate = [];
|
|
314
|
+
(0, _fortuneCore.jfrefreshgrid)(draftCtx, null, undefined);
|
|
315
|
+
}
|
|
301
316
|
});
|
|
302
317
|
},
|
|
303
318
|
"data-testid": "link-card-cta-insert"
|
|
@@ -92,7 +92,7 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
92
92
|
}
|
|
93
93
|
if (skip || ((_a = globalCache.linkCard) === null || _a === void 0 ? void 0 : _a.mouseEnter)) return;
|
|
94
94
|
setContext(function (draftCtx) {
|
|
95
|
-
(0, _fortuneCore.showLinkCard)(draftCtx, r, c, isEditing);
|
|
95
|
+
(0, _fortuneCore.showLinkCard)(draftCtx, r, c, undefined, isEditing);
|
|
96
96
|
});
|
|
97
97
|
}, 800);
|
|
98
98
|
}, [setContext]);
|
|
@@ -105,7 +105,7 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
105
105
|
debouncedShowLinkCard(globalCache, rc.r, rc.c, false);
|
|
106
106
|
} else {
|
|
107
107
|
if ((_a = globalCache.linkCard) === null || _a === void 0 ? void 0 : _a.mouseEnter) return;
|
|
108
|
-
(0, _fortuneCore.showLinkCard)(ctx, rc.r, rc.c, false);
|
|
108
|
+
(0, _fortuneCore.showLinkCard)(ctx, rc.r, rc.c, undefined, false);
|
|
109
109
|
debouncedShowLinkCard(globalCache, rc.r, rc.c, false, true);
|
|
110
110
|
}
|
|
111
111
|
}, [debouncedShowLinkCard]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5-hyper",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"tsc": "tsc"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@fileverse-dev/fortune-core": "1.3.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.3.5-hyper",
|
|
20
20
|
"@fileverse/ui": "5.0.0",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|