@univerjs/sheets-hyper-link-ui 1.0.0-alpha.7 → 1.0.0-beta.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/lib/cjs/index.js +39 -43
- package/lib/cjs/locale/zh-HK.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/index.js +44 -48
- package/lib/es/locale/zh-HK.js +1 -1
- package/lib/es/locale/zh-TW.js +1 -1
- package/lib/index.js +44 -48
- package/lib/locale/zh-HK.js +1 -1
- package/lib/locale/zh-TW.js +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +16 -16
package/lib/es/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BuildTextUtils, ColorKit, CommandType, CustomRangeType, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DataValidationType, DependentOn, Disposable, DisposableCollection, ICommandService, IConfigService, IPermissionService, IUniverInstanceService, Inject, Injector, LocaleService, ObjectMatrix, Plugin, RANGE_TYPE, Range, Rectangle, ThemeService, Tools, UniverInstanceType, generateRandomId, isSafeUrl, isValidRange, merge } from "@univerjs/core";
|
|
2
|
-
import { AUTO_FILL_APPLY_TYPE, AutoFillTools, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, IAutoFillService, RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint, SetSelectionsOperation, SetWorksheetActiveOperation, SheetPermissionCheckController, SheetsSelectionsService, WorkbookCopyPermission, WorkbookEditablePermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetEditPermission, WorksheetInsertHyperlinkPermission, WorksheetSetCellValuePermission, WorksheetViewPermission, getSheetCommandTarget, rangeToDiscreteRange } from "@univerjs/sheets";
|
|
3
|
-
import { COPY_TYPE, HoverManagerService, HoverRenderController, IEditorBridgeService, IMarkSelectionService, ISheetClipboardService, PREDEFINED_HOOK_NAME_PASTE, ScrollToRangeOperation, SheetCanvasPopManagerService, SheetSkeletonManagerService, getCurrentRangeDisable$, getCustomRangePosition, getEditingCustomRangePosition, getRepeatRange, virtualizeDiscreteRanges, whenSheetEditorFocused } from "@univerjs/sheets-ui";
|
|
4
|
-
import { DocSelectionManagerService } from "@univerjs/docs";
|
|
2
|
+
import { AUTO_FILL_APPLY_TYPE, AutoFillTools, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, IAutoFillService, RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint, SetSelectionsOperation, SetWorksheetActiveOperation, SheetPermissionCheckController, SheetsSelectionsService, UniverSheetsPlugin, WorkbookCopyPermission, WorkbookEditablePermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetEditPermission, WorksheetInsertHyperlinkPermission, WorksheetSetCellValuePermission, WorksheetViewPermission, getSheetCommandTarget, rangeToDiscreteRange } from "@univerjs/sheets";
|
|
3
|
+
import { COPY_TYPE, HoverManagerService, HoverRenderController, IEditorBridgeService, IMarkSelectionService, ISheetClipboardService, PREDEFINED_HOOK_NAME_PASTE, ScrollToRangeOperation, SheetCanvasPopManagerService, SheetSkeletonManagerService, UniverSheetsUIPlugin, getCurrentRangeDisable$, getCustomRangePosition, getEditingCustomRangePosition, getRepeatRange, virtualizeDiscreteRanges, whenSheetEditorFocused } from "@univerjs/sheets-ui";
|
|
4
|
+
import { DocSelectionManagerService, UniverDocsPlugin } from "@univerjs/docs";
|
|
5
5
|
import { DocEventManagerService, DocSelectionRenderService, UniverDocsUIPlugin, calcDocRangePositions } from "@univerjs/docs-ui";
|
|
6
|
-
import { IRenderManagerService } from "@univerjs/engine-render";
|
|
6
|
+
import { IRenderManagerService, UniverRenderEnginePlugin } from "@univerjs/engine-render";
|
|
7
7
|
import { BehaviorSubject, Subject, combineLatest, debounceTime, map, of, switchMap } from "rxjs";
|
|
8
8
|
import { Button, FormLayout, Input, MessageType, Select, Tooltip, borderClassName, clsx } from "@univerjs/design";
|
|
9
|
-
import { IDefinedNamesService, deserializeRangeWithSheet, serializeRange, serializeRangeToRefString, serializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
9
|
+
import { IDefinedNamesService, UniverFormulaEnginePlugin, deserializeRangeWithSheet, serializeRange, serializeRangeToRefString, serializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
10
10
|
import { RangeSelector } from "@univerjs/sheets-formula-ui";
|
|
11
11
|
import { AddHyperLinkCommand, AddHyperLinkMutation, AddRichHyperLinkCommand, CancelHyperLinkCommand, CancelRichHyperLinkCommand, ERROR_RANGE, HyperLinkModel, RemoveHyperLinkMutation, SheetHyperLinkType, SheetsHyperLinkParserService, UniverSheetsHyperLinkPlugin, UpdateHyperLinkCommand, UpdateRichHyperLinkCommand } from "@univerjs/sheets-hyper-link";
|
|
12
12
|
import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IMenuManagerService, IMessageService, IShortcutService, IconManager, KeyCode, MenuItemType, MetaKeys, RibbonInsertGroup, getMenuHiddenObservable, useDependency, useEvent, useObservable } from "@univerjs/ui";
|
|
@@ -62,7 +62,7 @@ const configSymbol = Symbol(SHEETS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY);
|
|
|
62
62
|
const defaultPluginConfig = {};
|
|
63
63
|
|
|
64
64
|
//#endregion
|
|
65
|
-
//#region \0@oxc-project+runtime@0.
|
|
65
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
66
66
|
function __decorateParam(paramIndex, decorator) {
|
|
67
67
|
return function(target, key) {
|
|
68
68
|
decorator(target, key, paramIndex);
|
|
@@ -70,7 +70,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
//#endregion
|
|
73
|
-
//#region \0@oxc-project+runtime@0.
|
|
73
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
74
74
|
function __decorate(decorators, target, key, desc) {
|
|
75
75
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
76
76
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -211,7 +211,7 @@ SheetsHyperLinkResolverService = __decorate([
|
|
|
211
211
|
], SheetsHyperLinkResolverService);
|
|
212
212
|
|
|
213
213
|
//#endregion
|
|
214
|
-
//#region \0@oxc-project+runtime@0.
|
|
214
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
215
215
|
function _typeof(o) {
|
|
216
216
|
"@babel/helpers - typeof";
|
|
217
217
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -222,7 +222,7 @@ function _typeof(o) {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
//#endregion
|
|
225
|
-
//#region \0@oxc-project+runtime@0.
|
|
225
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
226
226
|
function toPrimitive(t, r) {
|
|
227
227
|
if ("object" != _typeof(t) || !t) return t;
|
|
228
228
|
var e = t[Symbol.toPrimitive];
|
|
@@ -235,14 +235,14 @@ function toPrimitive(t, r) {
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
//#endregion
|
|
238
|
-
//#region \0@oxc-project+runtime@0.
|
|
238
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
239
239
|
function toPropertyKey(t) {
|
|
240
240
|
var i = toPrimitive(t, "string");
|
|
241
241
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
//#endregion
|
|
245
|
-
//#region \0@oxc-project+runtime@0.
|
|
245
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
246
246
|
function _defineProperty(e, r, t) {
|
|
247
247
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
248
248
|
value: t,
|
|
@@ -314,7 +314,6 @@ function resolveRangePayload(rangeText, defaultSheetName) {
|
|
|
314
314
|
//#endregion
|
|
315
315
|
//#region src/views/CellLinkEdit.tsx
|
|
316
316
|
const CellLinkEdit = () => {
|
|
317
|
-
var _definedNameService$g;
|
|
318
317
|
const [id, setId] = useState("");
|
|
319
318
|
const [hide, setHide] = useState(false);
|
|
320
319
|
const [display, _setDisplay] = useState("");
|
|
@@ -362,16 +361,16 @@ const CellLinkEdit = () => {
|
|
|
362
361
|
if (typeof label === "number") label = `${label}`;
|
|
363
362
|
let link;
|
|
364
363
|
if (customRange) {
|
|
365
|
-
var _customRange$
|
|
364
|
+
var _customRange$properti;
|
|
366
365
|
link = {
|
|
367
|
-
id: (
|
|
368
|
-
display:
|
|
369
|
-
payload: (
|
|
366
|
+
id: (customRange === null || customRange === void 0 ? void 0 : customRange.rangeId) ?? "",
|
|
367
|
+
display: label ?? "",
|
|
368
|
+
payload: (customRange === null || customRange === void 0 || (_customRange$properti = customRange.properties) === null || _customRange$properti === void 0 ? void 0 : _customRange$properti.url) ?? "",
|
|
370
369
|
row,
|
|
371
370
|
column: col
|
|
372
371
|
};
|
|
373
372
|
} else if (editing.type === "viewing") {
|
|
374
|
-
var _cell$p, _cell$p2, _range$
|
|
373
|
+
var _cell$p, _cell$p2, _range$properties2;
|
|
375
374
|
const workbook = univerInstanceService.getUnit(editing.unitId);
|
|
376
375
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(editing.subUnitId);
|
|
377
376
|
const cell = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getCellRaw(editing.row, editing.col);
|
|
@@ -384,22 +383,22 @@ const CellLinkEdit = () => {
|
|
|
384
383
|
link = {
|
|
385
384
|
id: "",
|
|
386
385
|
display: "",
|
|
387
|
-
payload: (
|
|
386
|
+
payload: (range === null || range === void 0 || (_range$properties2 = range.properties) === null || _range$properties2 === void 0 ? void 0 : _range$properties2.url) ?? "",
|
|
388
387
|
row,
|
|
389
388
|
column: col
|
|
390
389
|
};
|
|
391
390
|
} else {
|
|
392
|
-
var _BuildTextUtils$custo,
|
|
391
|
+
var _BuildTextUtils$custo, _customRange$properti2;
|
|
393
392
|
const doc = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
394
393
|
const currentSelection = textSelectionService.getActiveTextRange();
|
|
395
394
|
const body = doc === null || doc === void 0 ? void 0 : doc.getBody();
|
|
396
395
|
const selection = currentSelection && body ? currentSelection : null;
|
|
397
|
-
const customRange = selection && ((_BuildTextUtils$custo = BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection, (
|
|
396
|
+
const customRange = selection && ((_BuildTextUtils$custo = BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection, (body === null || body === void 0 ? void 0 : body.customRanges) ?? [])) === null || _BuildTextUtils$custo === void 0 ? void 0 : _BuildTextUtils$custo[0]);
|
|
398
397
|
setShowLabel(false);
|
|
399
398
|
link = {
|
|
400
399
|
id: "",
|
|
401
|
-
display:
|
|
402
|
-
payload: (
|
|
400
|
+
display: label ?? "",
|
|
401
|
+
payload: (customRange === null || customRange === void 0 || (_customRange$properti2 = customRange.properties) === null || _customRange$properti2 === void 0 ? void 0 : _customRange$properti2.url) ?? "",
|
|
403
402
|
row,
|
|
404
403
|
column: col
|
|
405
404
|
};
|
|
@@ -422,9 +421,9 @@ const CellLinkEdit = () => {
|
|
|
422
421
|
if (linkInfo.url === link.display) setDisplaySyncedWithPayload(true);
|
|
423
422
|
break;
|
|
424
423
|
case SheetHyperLinkType.RANGE: {
|
|
425
|
-
var _univerInstanceServic
|
|
424
|
+
var _univerInstanceServic;
|
|
426
425
|
const params = linkInfo.searchObj;
|
|
427
|
-
const payload = serializeRangeWithSheet(params.gid ? (_univerInstanceServic =
|
|
426
|
+
const payload = serializeRangeWithSheet(params.gid ? ((_univerInstanceServic = univerInstanceService.getUnit(editing.unitId)) === null || _univerInstanceServic === void 0 || (_univerInstanceServic = _univerInstanceServic.getSheetBySheetId(params.gid)) === null || _univerInstanceServic === void 0 ? void 0 : _univerInstanceServic.getName()) ?? "" : "", deserializeRangeWithSheet(params.range).range);
|
|
428
427
|
setPayload(payload);
|
|
429
428
|
if (payload === link.display) setDisplaySyncedWithPayload(true);
|
|
430
429
|
break;
|
|
@@ -459,7 +458,7 @@ const CellLinkEdit = () => {
|
|
|
459
458
|
const mergeInfo = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getMergedCell(editing.row, editing.col);
|
|
460
459
|
const color = new ColorKit(themeService.getColorFromTheme("primary.600")).toRgb();
|
|
461
460
|
id = markSelectionService.addShape({
|
|
462
|
-
range: mergeInfo
|
|
461
|
+
range: mergeInfo ?? {
|
|
463
462
|
startColumn: editing.col,
|
|
464
463
|
endColumn: editing.col,
|
|
465
464
|
startRow: editing.row,
|
|
@@ -487,7 +486,7 @@ const CellLinkEdit = () => {
|
|
|
487
486
|
setIsFocusRangeSelector(type === SheetHyperLinkType.RANGE);
|
|
488
487
|
}, [type]);
|
|
489
488
|
useEffect(() => {
|
|
490
|
-
const render = renderManagerService.
|
|
489
|
+
const render = renderManagerService.getRenderUnitById(editorBridgeService.getCurrentEditorId());
|
|
491
490
|
const disposeCollection = new DisposableCollection();
|
|
492
491
|
if (render) {
|
|
493
492
|
const selectionRenderService = render.with(DocSelectionRenderService);
|
|
@@ -558,7 +557,7 @@ const CellLinkEdit = () => {
|
|
|
558
557
|
label: sheet.getName(),
|
|
559
558
|
value: sheet.getSheetId()
|
|
560
559
|
})).filter((opt) => hiddens.indexOf(opt.value) === -1);
|
|
561
|
-
const definedNames = Object.values(
|
|
560
|
+
const definedNames = Object.values(definedNameService.getDefinedNameMap(workbook.getUnitId()) ?? {}).map((value) => ({
|
|
562
561
|
label: value.name,
|
|
563
562
|
value: value.id
|
|
564
563
|
}));
|
|
@@ -784,7 +783,7 @@ const iconsMap = {
|
|
|
784
783
|
[SheetHyperLinkType.INVALID]: /* @__PURE__ */ jsx(AllBorderIcon, {})
|
|
785
784
|
};
|
|
786
785
|
const CellLinkPopupPure = (props) => {
|
|
787
|
-
var _customRange$properti
|
|
786
|
+
var _customRange$properti;
|
|
788
787
|
const popupService = useDependency(SheetsHyperLinkPopupService);
|
|
789
788
|
const commandService = useDependency(ICommandService);
|
|
790
789
|
const messageService = useDependency(IMessageService);
|
|
@@ -794,7 +793,7 @@ const CellLinkPopupPure = (props) => {
|
|
|
794
793
|
const parserHyperLinkService = useDependency(SheetsHyperLinkParserService);
|
|
795
794
|
const { customRange, row, col, unitId, subUnitId, editPermission, copyPermission, type } = props;
|
|
796
795
|
if (!(customRange === null || customRange === void 0 || (_customRange$properti = customRange.properties) === null || _customRange$properti === void 0 ? void 0 : _customRange$properti.url)) return null;
|
|
797
|
-
const linkObj = parserHyperLinkService.parseHyperLink(
|
|
796
|
+
const linkObj = parserHyperLinkService.parseHyperLink(customRange.properties.url ?? "");
|
|
798
797
|
const isError = linkObj.type === SheetHyperLinkType.INVALID;
|
|
799
798
|
return /* @__PURE__ */ jsxs("div", {
|
|
800
799
|
className: clsx("univer-mb-1 univer-flex univer-max-w-80 univer-flex-row univer-items-center univer-justify-between univer-gap-2 univer-overflow-hidden univer-rounded-lg univer-bg-white univer-p-2 univer-shadow-md dark:!univer-bg-gray-900", borderClassName),
|
|
@@ -1006,7 +1005,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends Disp
|
|
|
1006
1005
|
const visible = this._editorBridgeService.isVisible().visible;
|
|
1007
1006
|
const state = this._editorBridgeService.getEditCellState();
|
|
1008
1007
|
if (visible && state) {
|
|
1009
|
-
var _state$documentLayout, _body$customRanges
|
|
1008
|
+
var _state$documentLayout, _body$customRanges;
|
|
1010
1009
|
const textRange = this._textSelectionManagerService.getActiveTextRange();
|
|
1011
1010
|
const body = (_state$documentLayout = state.documentLayoutObject.documentModel) === null || _state$documentLayout === void 0 ? void 0 : _state$documentLayout.getBody();
|
|
1012
1011
|
if (!body) return null;
|
|
@@ -1016,7 +1015,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends Disp
|
|
|
1016
1015
|
collapsed: body.dataStream.length - 2 === 0,
|
|
1017
1016
|
label: BuildTextUtils.transform.getPlainText(body.dataStream)
|
|
1018
1017
|
};
|
|
1019
|
-
const links = BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(textRange, (
|
|
1018
|
+
const links = BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(textRange, ((_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.filter((i) => i.rangeType === CustomRangeType.HYPERLINK)) ?? []);
|
|
1020
1019
|
let start = textRange.startOffset;
|
|
1021
1020
|
let end = textRange.endOffset;
|
|
1022
1021
|
links.forEach((link) => {
|
|
@@ -1048,31 +1047,30 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends Disp
|
|
|
1048
1047
|
startAddEditing(link) {
|
|
1049
1048
|
const { unitId, subUnitId, type } = link;
|
|
1050
1049
|
if (type === "editing") {
|
|
1051
|
-
var _range$label;
|
|
1052
1050
|
const range = this._getEditingRange();
|
|
1053
1051
|
if (!range) return;
|
|
1054
1052
|
this._textSelectionManagerService.replaceDocRanges([{ ...range }], {
|
|
1055
1053
|
unitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
1056
1054
|
subUnitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
1057
1055
|
});
|
|
1058
|
-
const currentRender = this._injector.get(IRenderManagerService).
|
|
1056
|
+
const currentRender = this._injector.get(IRenderManagerService).getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
1059
1057
|
if (!currentRender) return;
|
|
1060
1058
|
const rects = calcDocRangePositions(range, currentRender);
|
|
1061
1059
|
if (!(rects === null || rects === void 0 ? void 0 : rects.length)) return;
|
|
1062
1060
|
this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(rects.pop(), this._editPopup, unitId, subUnitId);
|
|
1063
1061
|
this._currentEditing$.next({
|
|
1064
1062
|
...link,
|
|
1065
|
-
label: (
|
|
1063
|
+
label: (range === null || range === void 0 ? void 0 : range.label) ?? ""
|
|
1066
1064
|
});
|
|
1067
1065
|
} else {
|
|
1068
|
-
var _cell$p$body
|
|
1066
|
+
var _cell$p$body;
|
|
1069
1067
|
this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupToCell(link.row, link.col, this._editPopup, unitId, subUnitId);
|
|
1070
1068
|
const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
1071
1069
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
1072
1070
|
const cell = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getCellRaw(link.row, link.col);
|
|
1073
1071
|
this._currentEditing$.next({
|
|
1074
1072
|
...link,
|
|
1075
|
-
label: (cell === null || cell === void 0 ? void 0 : cell.p) ? BuildTextUtils.transform.getPlainText((
|
|
1073
|
+
label: (cell === null || cell === void 0 ? void 0 : cell.p) ? BuildTextUtils.transform.getPlainText(((_cell$p$body = cell.p.body) === null || _cell$p$body === void 0 ? void 0 : _cell$p$body.dataStream) ?? "") : ((cell === null || cell === void 0 ? void 0 : cell.v) ?? "").toString()
|
|
1076
1074
|
});
|
|
1077
1075
|
}
|
|
1078
1076
|
}
|
|
@@ -1089,7 +1087,7 @@ let SheetsHyperLinkPopupService = class SheetsHyperLinkPopupService extends Disp
|
|
|
1089
1087
|
if (!customRangeInfo || !((_customRangeInfo$rect = customRangeInfo.rects) === null || _customRangeInfo$rect === void 0 ? void 0 : _customRangeInfo$rect.length)) return;
|
|
1090
1088
|
customRange = customRangeInfo.customRange;
|
|
1091
1089
|
label = customRangeInfo.label;
|
|
1092
|
-
this._textSelectionManagerService.
|
|
1090
|
+
this._textSelectionManagerService.replaceDocRanges([{
|
|
1093
1091
|
startOffset: customRange.startIndex,
|
|
1094
1092
|
endOffset: customRange.endIndex + 1
|
|
1095
1093
|
}]);
|
|
@@ -1345,9 +1343,8 @@ let SheetsHyperLinkCopyPasteController = class SheetsHyperLinkCopyPasteControlle
|
|
|
1345
1343
|
const { rows, cols } = discreteRange;
|
|
1346
1344
|
rows.forEach((row, rowIndex) => {
|
|
1347
1345
|
cols.forEach((col, colIndex) => {
|
|
1348
|
-
var _link$id;
|
|
1349
1346
|
const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
|
|
1350
|
-
matrix.setValue(rowIndex, colIndex, (
|
|
1347
|
+
matrix.setValue(rowIndex, colIndex, (link === null || link === void 0 ? void 0 : link.id) ?? "");
|
|
1351
1348
|
});
|
|
1352
1349
|
});
|
|
1353
1350
|
}
|
|
@@ -1445,7 +1442,7 @@ SheetsHyperLinkCopyPasteController = __decorate([
|
|
|
1445
1442
|
const getEditingLinkDisable$ = (accessor, unitId = DOCS_NORMAL_EDITOR_UNIT_ID_KEY) => {
|
|
1446
1443
|
var _accessor$get$getRend;
|
|
1447
1444
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
1448
|
-
const docSelctionService = (_accessor$get$getRend = accessor.get(IRenderManagerService).
|
|
1445
|
+
const docSelctionService = (_accessor$get$getRend = accessor.get(IRenderManagerService).getRenderUnitById(unitId)) === null || _accessor$get$getRend === void 0 ? void 0 : _accessor$get$getRend.with(DocSelectionRenderService);
|
|
1449
1446
|
if (!docSelctionService) return of(true);
|
|
1450
1447
|
return docSelctionService.textSelectionInner$.pipe(map(() => {
|
|
1451
1448
|
const state = accessor.get(IEditorBridgeService).getEditCellState();
|
|
@@ -1460,10 +1457,9 @@ const getEditingLinkDisable$ = (accessor, unitId = DOCS_NORMAL_EDITOR_UNIT_ID_KE
|
|
|
1460
1457
|
}));
|
|
1461
1458
|
};
|
|
1462
1459
|
const getLinkDisable$ = (accessor) => {
|
|
1463
|
-
var _editorBridgeService$;
|
|
1464
1460
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
1465
1461
|
const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
|
|
1466
|
-
return ((
|
|
1462
|
+
return ((editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.currentEditCellState$.pipe(map((state) => {
|
|
1467
1463
|
if (!state) return 1;
|
|
1468
1464
|
const target = getSheetCommandTarget(univerInstanceService, {
|
|
1469
1465
|
unitId: state.unitId,
|
|
@@ -1476,7 +1472,7 @@ const getLinkDisable$ = (accessor) => {
|
|
|
1476
1472
|
return combineLatest([editorBridgeService ? editorBridgeService.visible$ : of(null), univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC)]).pipe(switchMap(([editing, focusingDoc]) => {
|
|
1477
1473
|
return (editing === null || editing === void 0 ? void 0 : editing.visible) ? (focusingDoc === null || focusingDoc === void 0 ? void 0 : focusingDoc.getUnitId()) === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY ? of(true) : getEditingLinkDisable$(accessor, DOCS_NORMAL_EDITOR_UNIT_ID_KEY) : of(disableCell !== 0);
|
|
1478
1474
|
}));
|
|
1479
|
-
})))
|
|
1475
|
+
}))) ?? of(true)).pipe(switchMap((disableCell) => {
|
|
1480
1476
|
if (disableCell) return of(true);
|
|
1481
1477
|
else return getCurrentRangeDisable$(accessor, {
|
|
1482
1478
|
workbookTypes: [WorkbookEditablePermission],
|
|
@@ -1542,7 +1538,7 @@ const menuSchema = {
|
|
|
1542
1538
|
//#endregion
|
|
1543
1539
|
//#region package.json
|
|
1544
1540
|
var name = "@univerjs/sheets-hyper-link-ui";
|
|
1545
|
-
var version = "1.0.0-
|
|
1541
|
+
var version = "1.0.0-beta.0";
|
|
1546
1542
|
|
|
1547
1543
|
//#endregion
|
|
1548
1544
|
//#region src/controllers/auto-fill.controller.ts
|
|
@@ -1794,7 +1790,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
|
|
|
1794
1790
|
return;
|
|
1795
1791
|
}
|
|
1796
1792
|
const { unitId, subUnitId, row, col } = currentCell;
|
|
1797
|
-
const renderer = this._renderManagerService.
|
|
1793
|
+
const renderer = this._renderManagerService.getRenderUnitById(unitId);
|
|
1798
1794
|
if (!renderer) return;
|
|
1799
1795
|
const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
1800
1796
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
@@ -1860,7 +1856,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
|
|
|
1860
1856
|
return;
|
|
1861
1857
|
}
|
|
1862
1858
|
const { editorUnitId, unitId, sheetId, row, column } = state;
|
|
1863
|
-
const renderer = this._renderManagerService.
|
|
1859
|
+
const renderer = this._renderManagerService.getRenderUnitById(editorUnitId);
|
|
1864
1860
|
if (!renderer) return;
|
|
1865
1861
|
const { editPermission, viewPermission, copyPermission } = this._getLinkPermission({
|
|
1866
1862
|
unitId,
|
|
@@ -1879,7 +1875,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
|
|
|
1879
1875
|
return;
|
|
1880
1876
|
}
|
|
1881
1877
|
const rect = customRange.rects[customRange.rects.length - 1];
|
|
1882
|
-
if (!((_this$_renderManagerS = this._renderManagerService.
|
|
1878
|
+
if (!((_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 || (_this$_renderManagerS = _this$_renderManagerS.with(SheetSkeletonManagerService).getSkeletonParam(sheetId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.skeleton) || !rect) return;
|
|
1883
1879
|
const canvasClientRect = renderer.engine.getCanvasElement().getBoundingClientRect();
|
|
1884
1880
|
this._sheetsHyperLinkPopupService.showPopup({
|
|
1885
1881
|
unitId,
|
|
@@ -2080,7 +2076,7 @@ _defineProperty(UniverSheetsHyperLinkUIPlugin, "packageName", name);
|
|
|
2080
2076
|
_defineProperty(UniverSheetsHyperLinkUIPlugin, "version", version);
|
|
2081
2077
|
_defineProperty(UniverSheetsHyperLinkUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
2082
2078
|
UniverSheetsHyperLinkUIPlugin = __decorate([
|
|
2083
|
-
DependentOn(UniverSheetsHyperLinkPlugin,
|
|
2079
|
+
DependentOn(UniverDocsPlugin, UniverFormulaEnginePlugin, UniverRenderEnginePlugin, UniverSheetsPlugin, UniverDocsUIPlugin, UniverSheetsHyperLinkPlugin, UniverSheetsUIPlugin),
|
|
2084
2080
|
__decorateParam(1, Inject(Injector)),
|
|
2085
2081
|
__decorateParam(2, IConfigService)
|
|
2086
2082
|
], UniverSheetsHyperLinkUIPlugin);
|
package/lib/es/locale/zh-HK.js
CHANGED