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