@univerjs/sheets-hyper-link-ui 1.0.0-rc.0 → 1.0.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/lib/cjs/index.js +289 -185
- package/lib/cjs/locale/ar-SA.js +1 -1
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/de-DE.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/id-ID.js +1 -1
- package/lib/cjs/locale/it-IT.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/pl-PL.js +1 -1
- package/lib/cjs/locale/pt-BR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-HK.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/index.js +289 -185
- package/lib/es/locale/ar-SA.js +1 -0
- package/lib/es/locale/ca-ES.js +1 -0
- package/lib/es/locale/de-DE.js +1 -0
- package/lib/es/locale/en-US.js +1 -0
- package/lib/es/locale/es-ES.js +1 -0
- package/lib/es/locale/fa-IR.js +1 -0
- package/lib/es/locale/fr-FR.js +1 -0
- package/lib/es/locale/id-ID.js +1 -0
- package/lib/es/locale/it-IT.js +1 -0
- package/lib/es/locale/ja-JP.js +1 -0
- package/lib/es/locale/ko-KR.js +1 -0
- package/lib/es/locale/pl-PL.js +1 -0
- package/lib/es/locale/pt-BR.js +1 -0
- package/lib/es/locale/ru-RU.js +1 -0
- package/lib/es/locale/sk-SK.js +1 -0
- package/lib/es/locale/vi-VN.js +1 -0
- package/lib/es/locale/zh-CN.js +1 -0
- package/lib/es/locale/zh-HK.js +1 -0
- package/lib/es/locale/zh-TW.js +1 -0
- package/lib/index.css +32 -4
- package/lib/index.js +289 -185
- package/lib/locale/ar-SA.js +1 -0
- package/lib/locale/ca-ES.js +1 -0
- package/lib/locale/de-DE.js +1 -0
- package/lib/locale/en-US.js +1 -0
- package/lib/locale/es-ES.js +1 -0
- package/lib/locale/fa-IR.js +1 -0
- package/lib/locale/fr-FR.js +1 -0
- package/lib/locale/id-ID.js +1 -0
- package/lib/locale/it-IT.js +1 -0
- package/lib/locale/ja-JP.js +1 -0
- package/lib/locale/ko-KR.js +1 -0
- package/lib/locale/pl-PL.js +1 -0
- package/lib/locale/pt-BR.js +1 -0
- package/lib/locale/ru-RU.js +1 -0
- package/lib/locale/sk-SK.js +1 -0
- package/lib/locale/vi-VN.js +1 -0
- package/lib/locale/zh-CN.js +1 -0
- package/lib/locale/zh-HK.js +1 -0
- package/lib/locale/zh-TW.js +1 -0
- package/lib/types/controllers/mobile/popup.controller.d.ts +2 -2
- package/lib/types/controllers/popup.controller.d.ts +2 -2
- package/lib/types/controllers/ui.controller.d.ts +4 -6
- package/lib/types/locale/en-US.d.ts +1 -0
- package/lib/types/menu/hyper-link-menu.controller.d.ts +20 -0
- package/lib/types/menu/mobile-hyper-link-menu.controller.d.ts +20 -0
- package/lib/types/menu/mobile-schema.d.ts +17 -0
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +17 -17
package/lib/es/index.js
CHANGED
|
@@ -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.149.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.149.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.149.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.149.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.149.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.149.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,
|
|
@@ -316,6 +316,7 @@ function resolveRangePayload(rangeText, defaultSheetName) {
|
|
|
316
316
|
const CellLinkEdit = () => {
|
|
317
317
|
const [id, setId] = useState("");
|
|
318
318
|
const [display, setDisplay] = useState("");
|
|
319
|
+
const [tooltip, setTooltip] = useState("");
|
|
319
320
|
const [showLabel, setShowLabel] = useState(true);
|
|
320
321
|
const [type, setType] = useState(SheetHyperLinkType.URL);
|
|
321
322
|
const [payload, setPayload] = useState("");
|
|
@@ -323,7 +324,7 @@ const CellLinkEdit = () => {
|
|
|
323
324
|
const definedNameService = useDependency(IDefinedNamesService);
|
|
324
325
|
const editorBridgeService = useDependency(IEditorBridgeService);
|
|
325
326
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
326
|
-
const popupService = useDependency(
|
|
327
|
+
const popupService = useDependency(ISheetsHyperLinkPopupService);
|
|
327
328
|
const editing = useObservable(popupService.currentEditing$);
|
|
328
329
|
const parserService = useDependency(SheetsHyperLinkParserService);
|
|
329
330
|
const resolverService = useDependency(SheetsHyperLinkResolverService);
|
|
@@ -360,16 +361,17 @@ const CellLinkEdit = () => {
|
|
|
360
361
|
if (typeof label === "number") label = `${label}`;
|
|
361
362
|
let link;
|
|
362
363
|
if (customRange) {
|
|
363
|
-
var _customRange$properti;
|
|
364
|
+
var _customRange$properti, _customRange$properti2, _customRange$properti3;
|
|
364
365
|
link = {
|
|
365
366
|
id: (customRange === null || customRange === void 0 ? void 0 : customRange.rangeId) ?? "",
|
|
366
367
|
display: label ?? "",
|
|
367
368
|
payload: (customRange === null || customRange === void 0 || (_customRange$properti = customRange.properties) === null || _customRange$properti === void 0 ? void 0 : _customRange$properti.url) ?? "",
|
|
369
|
+
tooltip: (customRange === null || customRange === void 0 || (_customRange$properti2 = customRange.properties) === null || _customRange$properti2 === void 0 ? void 0 : _customRange$properti2.tooltip) ?? (customRange === null || customRange === void 0 || (_customRange$properti3 = customRange.properties) === null || _customRange$properti3 === void 0 ? void 0 : _customRange$properti3._xlsxHyperlinkTooltip) ?? "",
|
|
368
370
|
row,
|
|
369
371
|
column: col
|
|
370
372
|
};
|
|
371
373
|
} else if (editing.type === "viewing") {
|
|
372
|
-
var _cell$p, _cell$p2, _range$properties2;
|
|
374
|
+
var _cell$p, _cell$p2, _range$properties2, _range$properties3, _range$properties4;
|
|
373
375
|
const workbook = univerInstanceService.getUnit(editing.unitId);
|
|
374
376
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(editing.subUnitId);
|
|
375
377
|
const cell = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getCellRaw(editing.row, editing.col);
|
|
@@ -383,11 +385,12 @@ const CellLinkEdit = () => {
|
|
|
383
385
|
id: "",
|
|
384
386
|
display: "",
|
|
385
387
|
payload: (range === null || range === void 0 || (_range$properties2 = range.properties) === null || _range$properties2 === void 0 ? void 0 : _range$properties2.url) ?? "",
|
|
388
|
+
tooltip: (range === null || range === void 0 || (_range$properties3 = range.properties) === null || _range$properties3 === void 0 ? void 0 : _range$properties3.tooltip) ?? (range === null || range === void 0 || (_range$properties4 = range.properties) === null || _range$properties4 === void 0 ? void 0 : _range$properties4._xlsxHyperlinkTooltip) ?? "",
|
|
386
389
|
row,
|
|
387
390
|
column: col
|
|
388
391
|
};
|
|
389
392
|
} else {
|
|
390
|
-
var _BuildTextUtils$custo, _customRange$
|
|
393
|
+
var _BuildTextUtils$custo, _customRange$properti4, _customRange$properti5, _customRange$properti6;
|
|
391
394
|
const doc = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
392
395
|
const currentSelection = textSelectionService.getActiveTextRange();
|
|
393
396
|
const body = doc === null || doc === void 0 ? void 0 : doc.getBody();
|
|
@@ -397,12 +400,14 @@ const CellLinkEdit = () => {
|
|
|
397
400
|
link = {
|
|
398
401
|
id: "",
|
|
399
402
|
display: label ?? "",
|
|
400
|
-
payload: (customRange === null || customRange === void 0 || (_customRange$
|
|
403
|
+
payload: (customRange === null || customRange === void 0 || (_customRange$properti4 = customRange.properties) === null || _customRange$properti4 === void 0 ? void 0 : _customRange$properti4.url) ?? "",
|
|
404
|
+
tooltip: (customRange === null || customRange === void 0 || (_customRange$properti5 = customRange.properties) === null || _customRange$properti5 === void 0 ? void 0 : _customRange$properti5.tooltip) ?? (customRange === null || customRange === void 0 || (_customRange$properti6 = customRange.properties) === null || _customRange$properti6 === void 0 ? void 0 : _customRange$properti6._xlsxHyperlinkTooltip) ?? "",
|
|
401
405
|
row,
|
|
402
406
|
column: col
|
|
403
407
|
};
|
|
404
408
|
}
|
|
405
409
|
setId(link.id);
|
|
410
|
+
setTooltip(link.tooltip);
|
|
406
411
|
const customLink = sidePanelService.findCustomHyperLink(link);
|
|
407
412
|
if (customLink) {
|
|
408
413
|
const customLinkInfo = customLink.convert(link);
|
|
@@ -422,7 +427,8 @@ const CellLinkEdit = () => {
|
|
|
422
427
|
case SheetHyperLinkType.RANGE: {
|
|
423
428
|
var _univerInstanceServic;
|
|
424
429
|
const params = linkInfo.searchObj;
|
|
425
|
-
const
|
|
430
|
+
const sheetName = params.gid ? ((_univerInstanceServic = univerInstanceService.getUnit(editing.unitId)) === null || _univerInstanceServic === void 0 || (_univerInstanceServic = _univerInstanceServic.getSheetBySheetId(params.gid)) === null || _univerInstanceServic === void 0 ? void 0 : _univerInstanceServic.getName()) ?? "" : "";
|
|
431
|
+
const payload = serializeRangeWithSheet(sheetName, deserializeRangeWithSheet(params.range).range);
|
|
426
432
|
setPayload(payload);
|
|
427
433
|
if (payload === link.display) setDisplaySyncedWithPayload(true);
|
|
428
434
|
break;
|
|
@@ -437,9 +443,7 @@ const CellLinkEdit = () => {
|
|
|
437
443
|
setPayload(params.rangeid);
|
|
438
444
|
break;
|
|
439
445
|
}
|
|
440
|
-
default:
|
|
441
|
-
setPayload("");
|
|
442
|
-
break;
|
|
446
|
+
default: setPayload("");
|
|
443
447
|
}
|
|
444
448
|
}
|
|
445
449
|
}, [
|
|
@@ -574,34 +578,38 @@ const CellLinkEdit = () => {
|
|
|
574
578
|
setShowError(true);
|
|
575
579
|
return;
|
|
576
580
|
}
|
|
577
|
-
if (editing)
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
documentId: editorBridgeService.getCurrentEditorId()
|
|
590
|
-
});
|
|
591
|
-
} else {
|
|
592
|
-
const commandId = editing.type === "editing" ? AddRichHyperLinkCommand.id : AddHyperLinkCommand.id;
|
|
593
|
-
await commandService.executeCommand(commandId, {
|
|
594
|
-
unitId: editing.unitId,
|
|
595
|
-
subUnitId: editing.subUnitId,
|
|
596
|
-
link: {
|
|
597
|
-
id: generateRandomId(),
|
|
581
|
+
if (editing) {
|
|
582
|
+
if (id) {
|
|
583
|
+
const commandId = editing.type === "editing" ? UpdateRichHyperLinkCommand.id : UpdateHyperLinkCommand.id;
|
|
584
|
+
await commandService.executeCommand(commandId, {
|
|
585
|
+
id,
|
|
586
|
+
unitId: editing.unitId,
|
|
587
|
+
subUnitId: editing.subUnitId,
|
|
588
|
+
payload: {
|
|
589
|
+
display: showLabel ? display : "",
|
|
590
|
+
tooltip,
|
|
591
|
+
payload: formatUrl(type, payload)
|
|
592
|
+
},
|
|
598
593
|
row: editing.row,
|
|
599
594
|
column: editing.col,
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
595
|
+
documentId: editorBridgeService.getCurrentEditorId()
|
|
596
|
+
});
|
|
597
|
+
} else {
|
|
598
|
+
const commandId = editing.type === "editing" ? AddRichHyperLinkCommand.id : AddHyperLinkCommand.id;
|
|
599
|
+
await commandService.executeCommand(commandId, {
|
|
600
|
+
unitId: editing.unitId,
|
|
601
|
+
subUnitId: editing.subUnitId,
|
|
602
|
+
link: {
|
|
603
|
+
id: generateRandomId(),
|
|
604
|
+
row: editing.row,
|
|
605
|
+
column: editing.col,
|
|
606
|
+
payload: formatUrl(type, payload),
|
|
607
|
+
display: showLabel ? display : "",
|
|
608
|
+
tooltip
|
|
609
|
+
},
|
|
610
|
+
documentId: editorBridgeService.getCurrentEditorId()
|
|
611
|
+
});
|
|
612
|
+
}
|
|
605
613
|
}
|
|
606
614
|
if ((editing === null || editing === void 0 ? void 0 : editing.type) === "viewing") {
|
|
607
615
|
await commandService.executeCommand(SetWorksheetActiveOperation.id, {
|
|
@@ -638,6 +646,13 @@ const CellLinkEdit = () => {
|
|
|
638
646
|
}
|
|
639
647
|
})
|
|
640
648
|
}) : null,
|
|
649
|
+
/* @__PURE__ */ jsx(FormLayout, {
|
|
650
|
+
label: localeService.t("sheets-hyper-link-ui.form.tooltip"),
|
|
651
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
652
|
+
value: tooltip,
|
|
653
|
+
onChange: setTooltip
|
|
654
|
+
})
|
|
655
|
+
}),
|
|
641
656
|
/* @__PURE__ */ jsx(FormLayout, {
|
|
642
657
|
label: localeService.t("sheets-hyper-link-ui.form.type"),
|
|
643
658
|
children: /* @__PURE__ */ jsx(Select, {
|
|
@@ -780,7 +795,7 @@ const iconsMap = {
|
|
|
780
795
|
};
|
|
781
796
|
const CellLinkPopupPure = (props) => {
|
|
782
797
|
var _customRange$properti;
|
|
783
|
-
const popupService = useDependency(
|
|
798
|
+
const popupService = useDependency(ISheetsHyperLinkPopupService);
|
|
784
799
|
const commandService = useDependency(ICommandService);
|
|
785
800
|
const messageService = useDependency(IMessageService);
|
|
786
801
|
const localeService = useDependency(LocaleService);
|
|
@@ -790,97 +805,105 @@ const CellLinkPopupPure = (props) => {
|
|
|
790
805
|
const { customRange, row, col, unitId, subUnitId, editPermission, copyPermission, type } = props;
|
|
791
806
|
if (!(customRange === null || customRange === void 0 || (_customRange$properti = customRange.properties) === null || _customRange$properti === void 0 ? void 0 : _customRange$properti.url)) return null;
|
|
792
807
|
const linkObj = parserHyperLinkService.parseHyperLink(customRange.properties.url ?? "");
|
|
808
|
+
const tooltip = customRange.properties.tooltip ?? customRange.properties._xlsxHyperlinkTooltip;
|
|
793
809
|
const isError = linkObj.type === SheetHyperLinkType.INVALID;
|
|
794
810
|
return /* @__PURE__ */ jsxs("div", {
|
|
795
|
-
className: clsx("univer-mb-1 univer-
|
|
811
|
+
className: clsx("univer-mb-1 univer-grid univer-max-w-80 univer-grid-cols-[minmax(0,1fr)_auto] univer-items-center univer-gap-2 univer-overflow-hidden univer-rounded-lg univer-bg-gray-0 univer-p-2 univer-shadow-md dark:!univer-bg-gray-900", borderClassName),
|
|
796
812
|
onClick: () => popupService.hideCurrentPopup(),
|
|
797
|
-
children: [
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
if (isError) return;
|
|
801
|
-
resolverService.navigate(linkObj);
|
|
802
|
-
},
|
|
803
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
804
|
-
className: "univer-flex univer-size-5 univer-flex-none univer-items-center univer-justify-center univer-text-base univer-text-gray-900 dark:!univer-text-gray-0",
|
|
805
|
-
children: iconsMap[linkObj.type]
|
|
806
|
-
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
807
|
-
showIfEllipsis: true,
|
|
808
|
-
title: linkObj.name,
|
|
809
|
-
asChild: true,
|
|
810
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
811
|
-
className: "univer-flex-1 univer-truncate",
|
|
812
|
-
children: linkObj.name
|
|
813
|
-
})
|
|
814
|
-
})]
|
|
815
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
816
|
-
className: "univer-flex univer-h-6 univer-flex-none univer-flex-row univer-items-center univer-justify-center univer-gap-2",
|
|
817
|
-
children: [/* @__PURE__ */ jsx(Button, {
|
|
818
|
-
type: "button",
|
|
819
|
-
variant: "text",
|
|
820
|
-
size: "small",
|
|
821
|
-
"data-u-comp": "cell-link-popup-copy",
|
|
822
|
-
"aria-label": localeService.t("sheets-hyper-link-ui.popup.copy"),
|
|
823
|
-
className: clsx("!univer-flex univer-size-6 !univer-rounded !univer-border-0 !univer-p-0 !univer-text-base !univer-font-normal disabled:!univer-pointer-events-auto", { "univer-text-red-500": isError }),
|
|
824
|
-
disabled: !copyPermission || isError,
|
|
825
|
-
onClick: async () => {
|
|
826
|
-
if (linkObj.type !== SheetHyperLinkType.URL) {
|
|
827
|
-
const url = new URL(window.location.href);
|
|
828
|
-
url.hash = linkObj.url.slice(1);
|
|
829
|
-
await navigator.clipboard.writeText(url.href);
|
|
830
|
-
} else await navigator.clipboard.writeText(linkObj.url);
|
|
831
|
-
messageService.show({
|
|
832
|
-
content: localeService.t("sheets-hyper-link-ui.message.coped"),
|
|
833
|
-
type: MessageType.Info
|
|
834
|
-
});
|
|
835
|
-
},
|
|
836
|
-
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
837
|
-
placement: "bottom",
|
|
838
|
-
title: localeService.t("sheets-hyper-link-ui.popup.copy"),
|
|
839
|
-
children: /* @__PURE__ */ jsx(CopyIcon, { className: "dark:!univer-text-gray-0" })
|
|
840
|
-
})
|
|
841
|
-
}), editPermission && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
842
|
-
"data-u-comp": "cell-link-popup-edit",
|
|
843
|
-
className: "univer-flex univer-size-6 univer-cursor-pointer univer-flex-row univer-items-center univer-justify-center univer-rounded univer-text-base hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
|
|
844
|
-
onClick: () => {
|
|
845
|
-
return commandService.executeCommand(OpenHyperLinkEditPanelOperation.id, {
|
|
846
|
-
unitId,
|
|
847
|
-
subUnitId,
|
|
848
|
-
row,
|
|
849
|
-
col,
|
|
850
|
-
customRangeId: customRange.rangeId,
|
|
851
|
-
type
|
|
852
|
-
});
|
|
853
|
-
},
|
|
854
|
-
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
855
|
-
placement: "bottom",
|
|
856
|
-
title: localeService.t("sheets-hyper-link-ui.popup.edit"),
|
|
857
|
-
children: /* @__PURE__ */ jsx(WriteIcon, { className: "dark:!univer-text-gray-0" })
|
|
858
|
-
})
|
|
859
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
860
|
-
"data-u-comp": "cell-link-popup-remove",
|
|
861
|
-
className: "univer-flex univer-size-6 univer-cursor-pointer univer-flex-row univer-items-center univer-justify-center univer-rounded univer-text-base hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
|
|
813
|
+
children: [
|
|
814
|
+
/* @__PURE__ */ jsxs("div", {
|
|
815
|
+
className: clsx("univer-flex univer-h-6 univer-flex-1 univer-cursor-pointer univer-flex-row univer-items-center univer-gap-1 univer-truncate univer-text-sm univer-leading-5 univer-text-primary-600", { "univer-text-red-500": isError }),
|
|
862
816
|
onClick: () => {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
unitId,
|
|
866
|
-
subUnitId,
|
|
867
|
-
id: customRange.rangeId,
|
|
868
|
-
row,
|
|
869
|
-
column: col,
|
|
870
|
-
documentId: editorBridgeService.getCurrentEditorId()
|
|
871
|
-
})) popupService.hideCurrentPopup(void 0, true);
|
|
817
|
+
if (isError) return;
|
|
818
|
+
resolverService.navigate(linkObj);
|
|
872
819
|
},
|
|
873
|
-
children: /* @__PURE__ */ jsx(
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
820
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
821
|
+
className: "univer-flex univer-size-5 univer-flex-none univer-items-center univer-justify-center univer-text-base univer-text-gray-900 dark:!univer-text-gray-0",
|
|
822
|
+
children: iconsMap[linkObj.type]
|
|
823
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
824
|
+
showIfEllipsis: true,
|
|
825
|
+
title: linkObj.name,
|
|
826
|
+
asChild: true,
|
|
827
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
828
|
+
className: "univer-flex-1 univer-truncate",
|
|
829
|
+
children: linkObj.name
|
|
830
|
+
})
|
|
831
|
+
})]
|
|
832
|
+
}),
|
|
833
|
+
/* @__PURE__ */ jsxs("div", {
|
|
834
|
+
className: "univer-flex univer-h-6 univer-flex-none univer-flex-row univer-items-center univer-justify-center univer-gap-2",
|
|
835
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
836
|
+
type: "button",
|
|
837
|
+
variant: "text",
|
|
838
|
+
size: "small",
|
|
839
|
+
"data-u-comp": "cell-link-popup-copy",
|
|
840
|
+
"aria-label": localeService.t("sheets-hyper-link-ui.popup.copy"),
|
|
841
|
+
className: clsx("!univer-flex univer-size-6 !univer-rounded !univer-border-0 !univer-p-0 !univer-text-base !univer-font-normal disabled:!univer-pointer-events-auto", { "univer-text-red-500": isError }),
|
|
842
|
+
disabled: !copyPermission || isError,
|
|
843
|
+
onClick: async () => {
|
|
844
|
+
if (linkObj.type !== SheetHyperLinkType.URL) {
|
|
845
|
+
const url = new URL(window.location.href);
|
|
846
|
+
url.hash = linkObj.url.slice(1);
|
|
847
|
+
await navigator.clipboard.writeText(url.href);
|
|
848
|
+
} else await navigator.clipboard.writeText(linkObj.url);
|
|
849
|
+
messageService.show({
|
|
850
|
+
content: localeService.t("sheets-hyper-link-ui.message.coped"),
|
|
851
|
+
type: MessageType.Info
|
|
852
|
+
});
|
|
853
|
+
},
|
|
854
|
+
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
855
|
+
placement: "bottom",
|
|
856
|
+
title: localeService.t("sheets-hyper-link-ui.popup.copy"),
|
|
857
|
+
children: /* @__PURE__ */ jsx(CopyIcon, { className: "dark:!univer-text-gray-0" })
|
|
858
|
+
})
|
|
859
|
+
}), editPermission && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
860
|
+
"data-u-comp": "cell-link-popup-edit",
|
|
861
|
+
className: "univer-flex univer-size-6 univer-cursor-pointer univer-flex-row univer-items-center univer-justify-center univer-rounded univer-text-base hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
|
|
862
|
+
onClick: () => {
|
|
863
|
+
return commandService.executeCommand(OpenHyperLinkEditPanelOperation.id, {
|
|
864
|
+
unitId,
|
|
865
|
+
subUnitId,
|
|
866
|
+
row,
|
|
867
|
+
col,
|
|
868
|
+
customRangeId: customRange.rangeId,
|
|
869
|
+
type
|
|
870
|
+
});
|
|
871
|
+
},
|
|
872
|
+
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
873
|
+
placement: "bottom",
|
|
874
|
+
title: localeService.t("sheets-hyper-link-ui.popup.edit"),
|
|
875
|
+
children: /* @__PURE__ */ jsx(WriteIcon, { className: "dark:!univer-text-gray-0" })
|
|
876
|
+
})
|
|
877
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
878
|
+
"data-u-comp": "cell-link-popup-remove",
|
|
879
|
+
className: "univer-flex univer-size-6 univer-cursor-pointer univer-flex-row univer-items-center univer-justify-center univer-rounded univer-text-base hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
|
|
880
|
+
onClick: () => {
|
|
881
|
+
const commandId = type === "editing" ? CancelRichHyperLinkCommand.id : CancelHyperLinkCommand.id;
|
|
882
|
+
if (commandService.syncExecuteCommand(commandId, {
|
|
883
|
+
unitId,
|
|
884
|
+
subUnitId,
|
|
885
|
+
id: customRange.rangeId,
|
|
886
|
+
row,
|
|
887
|
+
column: col,
|
|
888
|
+
documentId: editorBridgeService.getCurrentEditorId()
|
|
889
|
+
})) popupService.hideCurrentPopup(void 0, true);
|
|
890
|
+
},
|
|
891
|
+
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
892
|
+
placement: "bottom",
|
|
893
|
+
title: localeService.t("sheets-hyper-link-ui.popup.cancel"),
|
|
894
|
+
children: /* @__PURE__ */ jsx(UnlinkIcon, { className: "dark:!univer-text-gray-0" })
|
|
895
|
+
})
|
|
896
|
+
})] })]
|
|
897
|
+
}),
|
|
898
|
+
typeof tooltip === "string" && tooltip && /* @__PURE__ */ jsx("div", {
|
|
899
|
+
className: "univer-col-span-2 univer-max-h-32 univer-overflow-y-auto univer-whitespace-pre-wrap univer-break-words univer-text-sm univer-text-gray-500",
|
|
900
|
+
children: tooltip
|
|
901
|
+
})
|
|
902
|
+
]
|
|
880
903
|
});
|
|
881
904
|
};
|
|
882
905
|
const CellLinkPopup = () => {
|
|
883
|
-
const popupService = useDependency(
|
|
906
|
+
const popupService = useDependency(ISheetsHyperLinkPopupService);
|
|
884
907
|
const currentPopup = useObservable(popupService.currentPopup$, popupService.currentPopup);
|
|
885
908
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
886
909
|
if (!currentPopup) return null;
|
|
@@ -1190,7 +1213,7 @@ const OpenHyperLinkEditPanelOperation = {
|
|
|
1190
1213
|
id: "sheet.operation.open-hyper-link-edit-panel",
|
|
1191
1214
|
handler(accessor, params) {
|
|
1192
1215
|
if (!params) return false;
|
|
1193
|
-
const popupService = accessor.get(
|
|
1216
|
+
const popupService = accessor.get(ISheetsHyperLinkPopupService);
|
|
1194
1217
|
if (!params.customRangeId) popupService.startAddEditing(params);
|
|
1195
1218
|
else popupService.startEditing(params);
|
|
1196
1219
|
return true;
|
|
@@ -1200,7 +1223,7 @@ const CloseHyperLinkPopupOperation = {
|
|
|
1200
1223
|
type: CommandType.OPERATION,
|
|
1201
1224
|
id: "sheet.operation.close-hyper-link-popup",
|
|
1202
1225
|
handler(accessor) {
|
|
1203
|
-
accessor.get(
|
|
1226
|
+
accessor.get(ISheetsHyperLinkPopupService).endEditing();
|
|
1204
1227
|
return true;
|
|
1205
1228
|
}
|
|
1206
1229
|
};
|
|
@@ -1208,7 +1231,8 @@ const InsertHyperLinkOperation = {
|
|
|
1208
1231
|
type: CommandType.OPERATION,
|
|
1209
1232
|
id: "sheet.operation.insert-hyper-link",
|
|
1210
1233
|
handler(accessor) {
|
|
1211
|
-
const
|
|
1234
|
+
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
1235
|
+
const target = getSheetCommandTarget(univerInstanceService);
|
|
1212
1236
|
const editorBridgeService = accessor.get(IEditorBridgeService);
|
|
1213
1237
|
if (!target) return false;
|
|
1214
1238
|
const commandService = accessor.get(ICommandService);
|
|
@@ -1232,7 +1256,7 @@ const InsertHyperLinkToolbarOperation = {
|
|
|
1232
1256
|
handler(accessor) {
|
|
1233
1257
|
if (getShouldDisableCurrentCellLink(accessor)) return false;
|
|
1234
1258
|
const commandService = accessor.get(ICommandService);
|
|
1235
|
-
if (accessor.get(
|
|
1259
|
+
if (accessor.get(ISheetsHyperLinkPopupService).currentEditing) return commandService.executeCommand(CloseHyperLinkPopupOperation.id);
|
|
1236
1260
|
else return commandService.executeCommand(InsertHyperLinkOperation.id);
|
|
1237
1261
|
}
|
|
1238
1262
|
};
|
|
@@ -1477,7 +1501,8 @@ const getLinkDisable$ = (accessor) => {
|
|
|
1477
1501
|
return getShouldDisableCellLink(accessor, target.worksheet, state.row, state.column);
|
|
1478
1502
|
}), switchMap((disableCell) => {
|
|
1479
1503
|
if (disableCell === 1) return of(true);
|
|
1480
|
-
|
|
1504
|
+
const isEditing$ = editorBridgeService ? editorBridgeService.visible$ : of(null);
|
|
1505
|
+
return combineLatest([isEditing$, univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC)]).pipe(switchMap(([editing, focusingDoc]) => {
|
|
1481
1506
|
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);
|
|
1482
1507
|
}));
|
|
1483
1508
|
}))) ?? of(true)).pipe(switchMap((disableCell) => {
|
|
@@ -1546,7 +1571,7 @@ const menuSchema = {
|
|
|
1546
1571
|
//#endregion
|
|
1547
1572
|
//#region package.json
|
|
1548
1573
|
var name = "@univerjs/sheets-hyper-link-ui";
|
|
1549
|
-
var version = "1.0.
|
|
1574
|
+
var version = "1.0.1";
|
|
1550
1575
|
|
|
1551
1576
|
//#endregion
|
|
1552
1577
|
//#region src/controllers/auto-fill.controller.ts
|
|
@@ -1702,6 +1727,7 @@ SheetsHyperLinkPermissionController = __decorate([
|
|
|
1702
1727
|
const MobileCellLinkEdit = () => {
|
|
1703
1728
|
const [id, setId] = useState("");
|
|
1704
1729
|
const [display, setDisplay] = useState("");
|
|
1730
|
+
const [tooltip, setTooltip] = useState("");
|
|
1705
1731
|
const [showLabel, setShowLabel] = useState(true);
|
|
1706
1732
|
const [type, setType] = useState(SheetHyperLinkType.URL);
|
|
1707
1733
|
const [payload, setPayload] = useState("");
|
|
@@ -1709,7 +1735,7 @@ const MobileCellLinkEdit = () => {
|
|
|
1709
1735
|
const definedNameService = useDependency(IDefinedNamesService);
|
|
1710
1736
|
const editorBridgeService = useDependency(IEditorBridgeService);
|
|
1711
1737
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
1712
|
-
const popupService = useDependency(
|
|
1738
|
+
const popupService = useDependency(ISheetsHyperLinkPopupService);
|
|
1713
1739
|
const editing = useObservable(popupService.currentEditing$);
|
|
1714
1740
|
const parserService = useDependency(SheetsHyperLinkParserService);
|
|
1715
1741
|
const resolverService = useDependency(SheetsHyperLinkResolverService);
|
|
@@ -1746,16 +1772,17 @@ const MobileCellLinkEdit = () => {
|
|
|
1746
1772
|
if (typeof label === "number") label = `${label}`;
|
|
1747
1773
|
let link;
|
|
1748
1774
|
if (customRange) {
|
|
1749
|
-
var _customRange$properti;
|
|
1775
|
+
var _customRange$properti, _customRange$properti2, _customRange$properti3;
|
|
1750
1776
|
link = {
|
|
1751
1777
|
id: (customRange === null || customRange === void 0 ? void 0 : customRange.rangeId) ?? "",
|
|
1752
1778
|
display: label ?? "",
|
|
1753
1779
|
payload: (customRange === null || customRange === void 0 || (_customRange$properti = customRange.properties) === null || _customRange$properti === void 0 ? void 0 : _customRange$properti.url) ?? "",
|
|
1780
|
+
tooltip: (customRange === null || customRange === void 0 || (_customRange$properti2 = customRange.properties) === null || _customRange$properti2 === void 0 ? void 0 : _customRange$properti2.tooltip) ?? (customRange === null || customRange === void 0 || (_customRange$properti3 = customRange.properties) === null || _customRange$properti3 === void 0 ? void 0 : _customRange$properti3._xlsxHyperlinkTooltip) ?? "",
|
|
1754
1781
|
row,
|
|
1755
1782
|
column: col
|
|
1756
1783
|
};
|
|
1757
1784
|
} else if (editing.type === "viewing") {
|
|
1758
|
-
var _cell$p, _cell$p2, _range$properties2;
|
|
1785
|
+
var _cell$p, _cell$p2, _range$properties2, _range$properties3, _range$properties4;
|
|
1759
1786
|
const workbook = univerInstanceService.getUnit(editing.unitId);
|
|
1760
1787
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(editing.subUnitId);
|
|
1761
1788
|
const cell = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getCellRaw(editing.row, editing.col);
|
|
@@ -1769,11 +1796,12 @@ const MobileCellLinkEdit = () => {
|
|
|
1769
1796
|
id: "",
|
|
1770
1797
|
display: "",
|
|
1771
1798
|
payload: (range === null || range === void 0 || (_range$properties2 = range.properties) === null || _range$properties2 === void 0 ? void 0 : _range$properties2.url) ?? "",
|
|
1799
|
+
tooltip: (range === null || range === void 0 || (_range$properties3 = range.properties) === null || _range$properties3 === void 0 ? void 0 : _range$properties3.tooltip) ?? (range === null || range === void 0 || (_range$properties4 = range.properties) === null || _range$properties4 === void 0 ? void 0 : _range$properties4._xlsxHyperlinkTooltip) ?? "",
|
|
1772
1800
|
row,
|
|
1773
1801
|
column: col
|
|
1774
1802
|
};
|
|
1775
1803
|
} else {
|
|
1776
|
-
var _BuildTextUtils$custo, _customRange$
|
|
1804
|
+
var _BuildTextUtils$custo, _customRange$properti4, _customRange$properti5, _customRange$properti6;
|
|
1777
1805
|
const doc = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
1778
1806
|
const currentSelection = textSelectionService.getActiveTextRange();
|
|
1779
1807
|
const body = doc === null || doc === void 0 ? void 0 : doc.getBody();
|
|
@@ -1783,12 +1811,14 @@ const MobileCellLinkEdit = () => {
|
|
|
1783
1811
|
link = {
|
|
1784
1812
|
id: "",
|
|
1785
1813
|
display: label ?? "",
|
|
1786
|
-
payload: (customRange === null || customRange === void 0 || (_customRange$
|
|
1814
|
+
payload: (customRange === null || customRange === void 0 || (_customRange$properti4 = customRange.properties) === null || _customRange$properti4 === void 0 ? void 0 : _customRange$properti4.url) ?? "",
|
|
1815
|
+
tooltip: (customRange === null || customRange === void 0 || (_customRange$properti5 = customRange.properties) === null || _customRange$properti5 === void 0 ? void 0 : _customRange$properti5.tooltip) ?? (customRange === null || customRange === void 0 || (_customRange$properti6 = customRange.properties) === null || _customRange$properti6 === void 0 ? void 0 : _customRange$properti6._xlsxHyperlinkTooltip) ?? "",
|
|
1787
1816
|
row,
|
|
1788
1817
|
column: col
|
|
1789
1818
|
};
|
|
1790
1819
|
}
|
|
1791
1820
|
setId(link.id);
|
|
1821
|
+
setTooltip(link.tooltip);
|
|
1792
1822
|
const customLink = sidePanelService.findCustomHyperLink(link);
|
|
1793
1823
|
if (customLink) {
|
|
1794
1824
|
const customLinkInfo = customLink.convert(link);
|
|
@@ -1808,7 +1838,8 @@ const MobileCellLinkEdit = () => {
|
|
|
1808
1838
|
case SheetHyperLinkType.RANGE: {
|
|
1809
1839
|
var _univerInstanceServic;
|
|
1810
1840
|
const params = linkInfo.searchObj;
|
|
1811
|
-
const
|
|
1841
|
+
const sheetName = params.gid ? ((_univerInstanceServic = univerInstanceService.getUnit(editing.unitId)) === null || _univerInstanceServic === void 0 || (_univerInstanceServic = _univerInstanceServic.getSheetBySheetId(params.gid)) === null || _univerInstanceServic === void 0 ? void 0 : _univerInstanceServic.getName()) ?? "" : "";
|
|
1842
|
+
const payload = serializeRangeWithSheet(sheetName, deserializeRangeWithSheet(params.range).range);
|
|
1812
1843
|
setPayload(payload);
|
|
1813
1844
|
if (payload === link.display) setDisplaySyncedWithPayload(true);
|
|
1814
1845
|
break;
|
|
@@ -1823,9 +1854,7 @@ const MobileCellLinkEdit = () => {
|
|
|
1823
1854
|
setPayload(params.rangeid);
|
|
1824
1855
|
break;
|
|
1825
1856
|
}
|
|
1826
|
-
default:
|
|
1827
|
-
setPayload("");
|
|
1828
|
-
break;
|
|
1857
|
+
default: setPayload("");
|
|
1829
1858
|
}
|
|
1830
1859
|
}
|
|
1831
1860
|
}, [
|
|
@@ -1960,34 +1989,38 @@ const MobileCellLinkEdit = () => {
|
|
|
1960
1989
|
setShowError(true);
|
|
1961
1990
|
return;
|
|
1962
1991
|
}
|
|
1963
|
-
if (editing)
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
documentId: editorBridgeService.getCurrentEditorId()
|
|
1976
|
-
});
|
|
1977
|
-
} else {
|
|
1978
|
-
const commandId = editing.type === "editing" ? AddRichHyperLinkCommand.id : AddHyperLinkCommand.id;
|
|
1979
|
-
await commandService.executeCommand(commandId, {
|
|
1980
|
-
unitId: editing.unitId,
|
|
1981
|
-
subUnitId: editing.subUnitId,
|
|
1982
|
-
link: {
|
|
1983
|
-
id: generateRandomId(),
|
|
1992
|
+
if (editing) {
|
|
1993
|
+
if (id) {
|
|
1994
|
+
const commandId = editing.type === "editing" ? UpdateRichHyperLinkCommand.id : UpdateHyperLinkCommand.id;
|
|
1995
|
+
await commandService.executeCommand(commandId, {
|
|
1996
|
+
id,
|
|
1997
|
+
unitId: editing.unitId,
|
|
1998
|
+
subUnitId: editing.subUnitId,
|
|
1999
|
+
payload: {
|
|
2000
|
+
display: showLabel ? display : "",
|
|
2001
|
+
tooltip,
|
|
2002
|
+
payload: formatUrl(type, payload)
|
|
2003
|
+
},
|
|
1984
2004
|
row: editing.row,
|
|
1985
2005
|
column: editing.col,
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
2006
|
+
documentId: editorBridgeService.getCurrentEditorId()
|
|
2007
|
+
});
|
|
2008
|
+
} else {
|
|
2009
|
+
const commandId = editing.type === "editing" ? AddRichHyperLinkCommand.id : AddHyperLinkCommand.id;
|
|
2010
|
+
await commandService.executeCommand(commandId, {
|
|
2011
|
+
unitId: editing.unitId,
|
|
2012
|
+
subUnitId: editing.subUnitId,
|
|
2013
|
+
link: {
|
|
2014
|
+
id: generateRandomId(),
|
|
2015
|
+
row: editing.row,
|
|
2016
|
+
column: editing.col,
|
|
2017
|
+
payload: formatUrl(type, payload),
|
|
2018
|
+
display: showLabel ? display : "",
|
|
2019
|
+
tooltip
|
|
2020
|
+
},
|
|
2021
|
+
documentId: editorBridgeService.getCurrentEditorId()
|
|
2022
|
+
});
|
|
2023
|
+
}
|
|
1991
2024
|
}
|
|
1992
2025
|
if ((editing === null || editing === void 0 ? void 0 : editing.type) === "viewing") {
|
|
1993
2026
|
await commandService.executeCommand(SetWorksheetActiveOperation.id, {
|
|
@@ -2024,6 +2057,13 @@ const MobileCellLinkEdit = () => {
|
|
|
2024
2057
|
}
|
|
2025
2058
|
})
|
|
2026
2059
|
}) : null,
|
|
2060
|
+
/* @__PURE__ */ jsx(FormLayout, {
|
|
2061
|
+
label: localeService.t("sheets-hyper-link-ui.form.tooltip"),
|
|
2062
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
2063
|
+
value: tooltip,
|
|
2064
|
+
onChange: setTooltip
|
|
2065
|
+
})
|
|
2066
|
+
}),
|
|
2027
2067
|
/* @__PURE__ */ jsx(FormLayout, {
|
|
2028
2068
|
label: localeService.t("sheets-hyper-link-ui.form.type"),
|
|
2029
2069
|
children: /* @__PURE__ */ jsx(MobileSelect, {
|
|
@@ -2159,7 +2199,7 @@ MobileCellLinkEdit.componentKey = "univer.sheet.mobile-cell-link-edit";
|
|
|
2159
2199
|
//#region src/views/MobileCellLinkPopup.tsx
|
|
2160
2200
|
function MobileCellLinkPopupPure(props) {
|
|
2161
2201
|
var _customRange$properti;
|
|
2162
|
-
const popupService = useDependency(
|
|
2202
|
+
const popupService = useDependency(ISheetsHyperLinkPopupService);
|
|
2163
2203
|
const commandService = useDependency(ICommandService);
|
|
2164
2204
|
const messageService = useDependency(IMessageService);
|
|
2165
2205
|
const localeService = useDependency(LocaleService);
|
|
@@ -2169,6 +2209,7 @@ function MobileCellLinkPopupPure(props) {
|
|
|
2169
2209
|
const { customRange, row, col, unitId, subUnitId, editPermission, copyPermission, type } = props;
|
|
2170
2210
|
if (!(customRange === null || customRange === void 0 || (_customRange$properti = customRange.properties) === null || _customRange$properti === void 0 ? void 0 : _customRange$properti.url)) return null;
|
|
2171
2211
|
const linkObj = parserHyperLinkService.parseHyperLink(customRange.properties.url);
|
|
2212
|
+
const tooltip = customRange.properties.tooltip ?? customRange.properties._xlsxHyperlinkTooltip;
|
|
2172
2213
|
const isError = linkObj.type === SheetHyperLinkType.INVALID;
|
|
2173
2214
|
const close = () => popupService.hideCurrentPopup(void 0, true);
|
|
2174
2215
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -2186,6 +2227,10 @@ function MobileCellLinkPopupPure(props) {
|
|
|
2186
2227
|
close();
|
|
2187
2228
|
}
|
|
2188
2229
|
}),
|
|
2230
|
+
typeof tooltip === "string" && tooltip && /* @__PURE__ */ jsx("div", {
|
|
2231
|
+
className: "univer-max-h-32 univer-overflow-y-auto univer-whitespace-pre-wrap univer-break-words univer-text-sm univer-text-gray-500",
|
|
2232
|
+
children: tooltip
|
|
2233
|
+
}),
|
|
2189
2234
|
copyPermission && /* @__PURE__ */ jsx(MobileActionRow, {
|
|
2190
2235
|
title: localeService.t("sheets-hyper-link-ui.popup.copy"),
|
|
2191
2236
|
"aria-label": localeService.t("sheets-hyper-link-ui.popup.copy"),
|
|
@@ -2242,7 +2287,7 @@ function MobileCellLinkPopupPure(props) {
|
|
|
2242
2287
|
});
|
|
2243
2288
|
}
|
|
2244
2289
|
function MobileCellLinkPopup() {
|
|
2245
|
-
const popupService = useDependency(
|
|
2290
|
+
const popupService = useDependency(ISheetsHyperLinkPopupService);
|
|
2246
2291
|
const currentPopup = useObservable(popupService.currentPopup$, popupService.currentPopup);
|
|
2247
2292
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
2248
2293
|
if (!currentPopup) return null;
|
|
@@ -2480,7 +2525,7 @@ let SheetsHyperLinkMobilePopupController = class SheetsHyperLinkMobilePopupContr
|
|
|
2480
2525
|
};
|
|
2481
2526
|
SheetsHyperLinkMobilePopupController = __decorate([
|
|
2482
2527
|
__decorateParam(0, Inject(HoverManagerService)),
|
|
2483
|
-
__decorateParam(1, Inject(
|
|
2528
|
+
__decorateParam(1, Inject(ISheetsHyperLinkPopupService)),
|
|
2484
2529
|
__decorateParam(2, Inject(IRenderManagerService)),
|
|
2485
2530
|
__decorateParam(3, Inject(IPermissionService)),
|
|
2486
2531
|
__decorateParam(4, Inject(SheetPermissionCheckController)),
|
|
@@ -2529,13 +2574,11 @@ SheetsHyperLinkRenderController = __decorate([__decorateParam(1, Inject(HyperLin
|
|
|
2529
2574
|
* limitations under the License.
|
|
2530
2575
|
*/
|
|
2531
2576
|
let SheetsHyperLinkUIController = class SheetsHyperLinkUIController extends Disposable {
|
|
2532
|
-
constructor(_commandService,
|
|
2577
|
+
constructor(_commandService, _shortcutService) {
|
|
2533
2578
|
super();
|
|
2534
2579
|
this._commandService = _commandService;
|
|
2535
|
-
this._menuManagerService = _menuManagerService;
|
|
2536
2580
|
this._shortcutService = _shortcutService;
|
|
2537
2581
|
this._initCommands();
|
|
2538
|
-
this._initMenus();
|
|
2539
2582
|
this._initShortCut();
|
|
2540
2583
|
}
|
|
2541
2584
|
_initCommands() {
|
|
@@ -2545,21 +2588,14 @@ let SheetsHyperLinkUIController = class SheetsHyperLinkUIController extends Disp
|
|
|
2545
2588
|
InsertHyperLinkOperation,
|
|
2546
2589
|
InsertHyperLinkToolbarOperation
|
|
2547
2590
|
].forEach((command) => {
|
|
2548
|
-
this._commandService.registerCommand(command);
|
|
2591
|
+
this.disposeWithMe(this._commandService.registerCommand(command));
|
|
2549
2592
|
});
|
|
2550
2593
|
}
|
|
2551
|
-
_initMenus() {
|
|
2552
|
-
this._menuManagerService.mergeMenu(menuSchema);
|
|
2553
|
-
}
|
|
2554
2594
|
_initShortCut() {
|
|
2555
|
-
this._shortcutService.registerShortcut(InsertLinkShortcut);
|
|
2595
|
+
this.disposeWithMe(this._shortcutService.registerShortcut(InsertLinkShortcut));
|
|
2556
2596
|
}
|
|
2557
2597
|
};
|
|
2558
|
-
SheetsHyperLinkUIController = __decorate([
|
|
2559
|
-
__decorateParam(0, ICommandService),
|
|
2560
|
-
__decorateParam(1, IMenuManagerService),
|
|
2561
|
-
__decorateParam(2, Inject(IShortcutService))
|
|
2562
|
-
], SheetsHyperLinkUIController);
|
|
2598
|
+
SheetsHyperLinkUIController = __decorate([__decorateParam(0, ICommandService), __decorateParam(1, Inject(IShortcutService))], SheetsHyperLinkUIController);
|
|
2563
2599
|
|
|
2564
2600
|
//#endregion
|
|
2565
2601
|
//#region src/controllers/url.controller.ts
|
|
@@ -2595,6 +2631,47 @@ let SheetHyperLinkUrlController = class SheetHyperLinkUrlController extends Disp
|
|
|
2595
2631
|
};
|
|
2596
2632
|
SheetHyperLinkUrlController = __decorate([__decorateParam(0, Inject(SheetsHyperLinkParserService)), __decorateParam(1, Inject(SheetsHyperLinkResolverService))], SheetHyperLinkUrlController);
|
|
2597
2633
|
|
|
2634
|
+
//#endregion
|
|
2635
|
+
//#region src/menu/mobile-schema.ts
|
|
2636
|
+
const mobileMenuSchema = {
|
|
2637
|
+
[RibbonInsertGroup.MEDIA]: { [InsertHyperLinkToolbarOperation.id]: {
|
|
2638
|
+
order: 1,
|
|
2639
|
+
menuItemFactory: insertLinkMenuToolbarFactory
|
|
2640
|
+
} },
|
|
2641
|
+
[ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.OTHERS]: {
|
|
2642
|
+
order: 1,
|
|
2643
|
+
[InsertHyperLinkToolbarOperation.id]: {
|
|
2644
|
+
order: 0,
|
|
2645
|
+
menuItemFactory: insertLinkMenuFactory
|
|
2646
|
+
}
|
|
2647
|
+
} }
|
|
2648
|
+
};
|
|
2649
|
+
|
|
2650
|
+
//#endregion
|
|
2651
|
+
//#region src/menu/mobile-hyper-link-menu.controller.ts
|
|
2652
|
+
/**
|
|
2653
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2654
|
+
*
|
|
2655
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2656
|
+
* you may not use this file except in compliance with the License.
|
|
2657
|
+
* You may obtain a copy of the License at
|
|
2658
|
+
*
|
|
2659
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2660
|
+
*
|
|
2661
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2662
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2663
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2664
|
+
* See the License for the specific language governing permissions and
|
|
2665
|
+
* limitations under the License.
|
|
2666
|
+
*/
|
|
2667
|
+
let SheetsHyperLinkMobileMenuController = class SheetsHyperLinkMobileMenuController extends Disposable {
|
|
2668
|
+
constructor(menuManagerService) {
|
|
2669
|
+
super();
|
|
2670
|
+
menuManagerService.mergeMenu(mobileMenuSchema);
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
2673
|
+
SheetsHyperLinkMobileMenuController = __decorate([__decorateParam(0, IMenuManagerService)], SheetsHyperLinkMobileMenuController);
|
|
2674
|
+
|
|
2598
2675
|
//#endregion
|
|
2599
2676
|
//#region src/services/mobile-popup.service.ts
|
|
2600
2677
|
const MOBILE_HYPER_LINK_EDITOR_DIALOG_ID = "sheet-mobile-hyper-link-editor";
|
|
@@ -2728,10 +2805,10 @@ let UniverSheetsHyperLinkMobileUIPlugin = class UniverSheetsHyperLinkMobileUIPlu
|
|
|
2728
2805
|
[MobileComponentsController],
|
|
2729
2806
|
[SheetsHyperLinkResolverService],
|
|
2730
2807
|
[ISheetsHyperLinkPopupService, { useClass: SheetsHyperLinkMobilePopupService }],
|
|
2731
|
-
[SheetsHyperLinkPopupService, { useExisting: ISheetsHyperLinkPopupService }],
|
|
2732
2808
|
[SheetsHyperLinkSidePanelService],
|
|
2733
2809
|
[SheetsHyperLinkMobilePopupController],
|
|
2734
2810
|
[SheetsHyperLinkUIController],
|
|
2811
|
+
[SheetsHyperLinkMobileMenuController],
|
|
2735
2812
|
[SheetsHyperLinkAutoFillController],
|
|
2736
2813
|
[SheetsHyperLinkCopyPasteController],
|
|
2737
2814
|
[SheetsHyperLinkPermissionController],
|
|
@@ -2747,6 +2824,7 @@ let UniverSheetsHyperLinkMobileUIPlugin = class UniverSheetsHyperLinkMobileUIPlu
|
|
|
2747
2824
|
this._injector.get(SheetsHyperLinkAutoFillController);
|
|
2748
2825
|
this._injector.get(SheetsHyperLinkCopyPasteController);
|
|
2749
2826
|
this._injector.get(SheetsHyperLinkUIController);
|
|
2827
|
+
this._injector.get(SheetsHyperLinkMobileMenuController);
|
|
2750
2828
|
}
|
|
2751
2829
|
onRendered() {
|
|
2752
2830
|
this._injector.get(SheetsHyperLinkPermissionController);
|
|
@@ -2992,7 +3070,7 @@ let SheetsHyperLinkPopupController = class SheetsHyperLinkPopupController extend
|
|
|
2992
3070
|
};
|
|
2993
3071
|
SheetsHyperLinkPopupController = __decorate([
|
|
2994
3072
|
__decorateParam(0, Inject(HoverManagerService)),
|
|
2995
|
-
__decorateParam(1, Inject(
|
|
3073
|
+
__decorateParam(1, Inject(ISheetsHyperLinkPopupService)),
|
|
2996
3074
|
__decorateParam(2, Inject(IRenderManagerService)),
|
|
2997
3075
|
__decorateParam(3, Inject(IPermissionService)),
|
|
2998
3076
|
__decorateParam(4, Inject(SheetPermissionCheckController)),
|
|
@@ -3002,6 +3080,31 @@ SheetsHyperLinkPopupController = __decorate([
|
|
|
3002
3080
|
__decorateParam(8, IUniverInstanceService)
|
|
3003
3081
|
], SheetsHyperLinkPopupController);
|
|
3004
3082
|
|
|
3083
|
+
//#endregion
|
|
3084
|
+
//#region src/menu/hyper-link-menu.controller.ts
|
|
3085
|
+
/**
|
|
3086
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3087
|
+
*
|
|
3088
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3089
|
+
* you may not use this file except in compliance with the License.
|
|
3090
|
+
* You may obtain a copy of the License at
|
|
3091
|
+
*
|
|
3092
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3093
|
+
*
|
|
3094
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3095
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3096
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3097
|
+
* See the License for the specific language governing permissions and
|
|
3098
|
+
* limitations under the License.
|
|
3099
|
+
*/
|
|
3100
|
+
let SheetsHyperLinkMenuController = class SheetsHyperLinkMenuController extends Disposable {
|
|
3101
|
+
constructor(menuManagerService) {
|
|
3102
|
+
super();
|
|
3103
|
+
menuManagerService.mergeMenu(menuSchema);
|
|
3104
|
+
}
|
|
3105
|
+
};
|
|
3106
|
+
SheetsHyperLinkMenuController = __decorate([__decorateParam(0, IMenuManagerService)], SheetsHyperLinkMenuController);
|
|
3107
|
+
|
|
3005
3108
|
//#endregion
|
|
3006
3109
|
//#region src/plugin.ts
|
|
3007
3110
|
let UniverSheetsHyperLinkUIPlugin = class UniverSheetsHyperLinkUIPlugin extends Plugin {
|
|
@@ -3020,10 +3123,10 @@ let UniverSheetsHyperLinkUIPlugin = class UniverSheetsHyperLinkUIPlugin extends
|
|
|
3020
3123
|
[
|
|
3021
3124
|
[SheetsHyperLinkResolverService],
|
|
3022
3125
|
[ISheetsHyperLinkPopupService, { useClass: SheetsHyperLinkPopupService }],
|
|
3023
|
-
[SheetsHyperLinkPopupService, { useExisting: ISheetsHyperLinkPopupService }],
|
|
3024
3126
|
[SheetsHyperLinkSidePanelService],
|
|
3025
3127
|
[SheetsHyperLinkPopupController],
|
|
3026
3128
|
[SheetsHyperLinkUIController],
|
|
3129
|
+
[SheetsHyperLinkMenuController],
|
|
3027
3130
|
[SheetsHyperLinkAutoFillController],
|
|
3028
3131
|
[SheetsHyperLinkCopyPasteController],
|
|
3029
3132
|
[SheetsHyperLinkPermissionController],
|
|
@@ -3035,6 +3138,7 @@ let UniverSheetsHyperLinkUIPlugin = class UniverSheetsHyperLinkUIPlugin extends
|
|
|
3035
3138
|
this._injector.get(SheetsHyperLinkAutoFillController);
|
|
3036
3139
|
this._injector.get(SheetsHyperLinkCopyPasteController);
|
|
3037
3140
|
this._injector.get(SheetsHyperLinkUIController);
|
|
3141
|
+
this._injector.get(SheetsHyperLinkMenuController);
|
|
3038
3142
|
}
|
|
3039
3143
|
onRendered() {
|
|
3040
3144
|
this._injector.get(SheetsHyperLinkPermissionController);
|