@univerjs/sheets-hyper-link-ui 0.3.0 → 0.4.0-alpha.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/es/index.js CHANGED
@@ -2,20 +2,18 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { Tools, Inject, LocaleService, UniverInstanceType, isValidRange, IUniverInstanceService, ICommandService, IConfigService, RANGE_TYPE, Rectangle, OnLifecycle, LifecycleStages, Injector, Disposable, Range, ObjectMatrix, CommandType, IUndoRedoService, BuildTextUtils, DataStreamTreeTokenType, CustomRangeType, TextX, CellValueType, sequenceExecuteAsync, generateRandomId, getBodySlice, useDependency, IContextService, getOriginCellValue, DisposableCollection, createInternalEditorID, FOCUSING_SHEET, DOCS_ZEN_EDITOR_UNIT_ID_KEY, sequenceExecute, DataValidationType, ThemeService, InterceptorEffectEnum, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, IPermissionService, DependentOn, Plugin } from "@univerjs/core";
5
+ import { Tools, Inject, LocaleService, UniverInstanceType, isValidRange, IUniverInstanceService, ICommandService, IConfigService, RANGE_TYPE, Rectangle, Injector, Disposable, Range, ObjectMatrix, CommandType, IUndoRedoService, BuildTextUtils, DataStreamTreeTokenType, CustomRangeType, TextX, CellValueType, sequenceExecuteAsync, generateRandomId, getBodySlice, useDependency, IContextService, ThemeService, ColorKit, DisposableCollection, createInternalEditorID, FOCUSING_SHEET, DOCS_ZEN_EDITOR_UNIT_ID_KEY, sequenceExecute, useObservable as useObservable$1, DataValidationType, IPermissionService, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, InterceptorEffectEnum, DependentOn, Plugin } from "@univerjs/core";
6
6
  import { SheetHyperLinkType, ERROR_RANGE, HyperLinkModel, RemoveHyperLinkMutation, AddHyperLinkMutation, UniverSheetsHyperLinkPlugin } from "@univerjs/sheets-hyper-link";
7
- import { ScrollToRangeOperation, COPY_TYPE, virtualizeDiscreteRanges, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService, SheetSkeletonManagerService, IEditorBridgeService, IMarkSelectionService, SheetCanvasPopManagerService, getEditingCustomRangePosition, getCustomRangePosition, whenSheetEditorFocused, getCurrentRangeDisable$, HoverManagerService, SheetPermissionInterceptorBaseController, HoverRenderController, IAutoFillService, APPLY_TYPE, getAutoFillRepeatRange } from "@univerjs/sheets-ui";
7
+ import { ScrollToRangeOperation, COPY_TYPE, virtualizeDiscreteRanges, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService, SheetSkeletonManagerService, IEditorBridgeService, IMarkSelectionService, SheetCanvasPopManagerService, getEditingCustomRangePosition, getCustomRangePosition, whenSheetEditorFocused, getCurrentRangeDisable$, IAutoFillService, APPLY_TYPE, getAutoFillRepeatRange, SheetPermissionInterceptorBaseController, HoverManagerService, HoverRenderController } from "@univerjs/sheets-ui";
8
8
  import { MessageType, FormLayout, Input, Select, Button, Tooltip } from "@univerjs/design";
9
9
  import { deserializeRangeWithSheet, serializeRangeWithSheet, serializeRange, IDefinedNamesService, serializeRangeToRefString } from "@univerjs/engine-formula";
10
- import { SetSelectionsOperation, SetWorksheetActiveOperation, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SheetsSelectionsService, getSheetCommandTarget, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission, RangeProtectionPermissionEditPoint, SheetInterceptorService, RemoveSheetCommand, INTERCEPTOR_POINT, SetRangeValuesCommand, ClearSelectionContentCommand, ClearSelectionAllCommand, ClearSelectionFormatCommand, WorkbookViewPermission, WorksheetViewPermission, RangeProtectionPermissionViewPoint, WorkbookCopyPermission, WorksheetCopyPermission, RefRangeService, handleDefaultRangeChangeWithEffectRefCommands } from "@univerjs/sheets";
10
+ import { SetSelectionsOperation, SetWorksheetActiveOperation, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SheetsSelectionsService, getSheetCommandTarget, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission, RangeProtectionPermissionEditPoint, WorkbookViewPermission, WorksheetViewPermission, RangeProtectionPermissionViewPoint, WorkbookCopyPermission, WorksheetCopyPermission, ClearSelectionContentCommand, ClearSelectionAllCommand, ClearSelectionFormatCommand, SheetInterceptorService, RemoveSheetCommand, INTERCEPTOR_POINT, RefRangeService, handleDefaultRangeChangeWithEffectRefCommands, SetRangeValuesCommand } from "@univerjs/sheets";
11
11
  import { IMessageService, useObservable, IZenZoneService, useEvent, KeyCode, MenuItemType, MenuPosition, MenuGroup, MetaKeys, getMenuHiddenObservable, RibbonStartGroup, ContextMenuPosition, ContextMenuGroup, ComponentManager, IShortcutService, IMenuManagerService } from "@univerjs/ui";
12
12
  import { DocSelectionManagerService } from "@univerjs/docs";
13
13
  import { Subject, BehaviorSubject, map, mergeMap, Observable, debounceTime } from "rxjs";
14
- import { addCustomRangeBySelectionFactory, replaceSelectionFactory, DocSelectionRenderService, RangeSelector, deleteCustomRangeFactory, DocCanvasPopManagerService, IEditorService, IRangeSelectorService, DocEventManagerService, UniverDocsUIPlugin } from "@univerjs/docs-ui";
14
+ import { addCustomRangeBySelectionFactory, replaceSelectionFactory, DocSelectionRenderService, RangeSelector, DocBackScrollRenderController, deleteCustomRangeFactory, DocCanvasPopManagerService, IEditorService, IRangeSelectorService, DocEventManagerService, UniverDocsUIPlugin } from "@univerjs/docs-ui";
15
15
  import require$$0, { useState, useMemo, useRef, useEffect, forwardRef, createElement } from "react";
16
16
  import { IRenderManagerService } from "@univerjs/engine-render";
17
- import cs from "clsx";
18
- const SHEET_HYPER_LINK_UI_PLUGIN = "SHEET_HYPER_LINK_UI_PLUGIN";
19
17
  function isLegalLink(link) {
20
18
  return Tools.isLegalUrl(link);
21
19
  }
@@ -101,7 +99,28 @@ let SheetsHyperLinkResolverService = (_a = class {
101
99
  if (!workbook)
102
100
  return;
103
101
  const unitId = workbook.getUnitId();
104
- if (rangeid && this.navigateToDefineName(unitId, rangeid), !!gid) {
102
+ if (rangeid) {
103
+ const item = this._definedNamesService.getValueById(unitId, rangeid);
104
+ if (!item)
105
+ return;
106
+ const { formulaOrRefString } = item, worksheet = this._definedNamesService.getWorksheetByRef(unitId, formulaOrRefString);
107
+ if (!worksheet) {
108
+ this._messageService.show({
109
+ content: this._localeService.t("hyperLink.message.refError"),
110
+ type: MessageType.Error
111
+ });
112
+ return;
113
+ }
114
+ if (worksheet.isSheetHidden()) {
115
+ this._messageService.show({
116
+ content: this._localeService.t("hyperLink.message.hiddenSheet"),
117
+ type: MessageType.Error
118
+ });
119
+ return;
120
+ }
121
+ this.navigateToDefineName(unitId, rangeid);
122
+ }
123
+ if (gid) {
105
124
  if (range) {
106
125
  const rangeInfo = deserializeRangeWithSheet(range);
107
126
  isValidRange(rangeInfo.range) && range !== ERROR_RANGE && this.navigateToRange(unitId, gid, rangeInfo.range);
@@ -218,6 +237,7 @@ SheetsHyperLinkResolverService = __decorateClass$c([
218
237
  __decorateParam$c(4, Inject(LocaleService)),
219
238
  __decorateParam$c(5, IConfigService)
220
239
  ], SheetsHyperLinkResolverService);
240
+ const SHEET_HYPER_LINK_UI_PLUGIN = "SHEET_HYPER_LINK_UI_PLUGIN";
221
241
  var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPropertyDescriptor, __decorateClass$b = /* @__PURE__ */ __name((decorators, target, key, kind) => {
222
242
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
223
243
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
@@ -364,7 +384,6 @@ let SheetsHyperLinkCopyPasteController = (_a2 = class extends Disposable {
364
384
  }
365
385
  }, __name(_a2, "SheetsHyperLinkCopyPasteController"), _a2);
366
386
  SheetsHyperLinkCopyPasteController = __decorateClass$b([
367
- OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkCopyPasteController),
368
387
  __decorateParam$b(0, ISheetClipboardService),
369
388
  __decorateParam$b(1, Inject(HyperLinkModel)),
370
389
  __decorateParam$b(2, Inject(Injector)),
@@ -668,12 +687,12 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
668
687
  cellLinkEditButtons
669
688
  }, CellLinkEdit = /* @__PURE__ */ __name(() => {
670
689
  var _a15;
671
- const [id, setId] = useState(""), [hide, setHide] = useState(!1), [display, setDisplay] = useState(""), [showLabel, setShowLabel] = useState(!0), [type, setType] = useState(SheetHyperLinkType.URL), [payload, setPayload] = useState(""), localeService = useDependency(LocaleService), definedNameService = useDependency(IDefinedNamesService), editorBridgeService = useDependency(IEditorBridgeService), univerInstanceService = useDependency(IUniverInstanceService), popupService = useDependency(SheetsHyperLinkPopupService), editing = useObservable(popupService.currentEditing$), resolverService = useDependency(SheetsHyperLinkResolverService), commandService = useDependency(ICommandService), sidePanelService = useDependency(SheetsHyperLinkSidePanelService), sidePanelOptions = useMemo(() => sidePanelService.getOptions(), [sidePanelService]), zenZoneService = useDependency(IZenZoneService), renderManagerService = useDependency(IRenderManagerService), markSelectionService = useDependency(IMarkSelectionService), textSelectionService = useDependency(DocSelectionManagerService), contextService = useDependency(IContextService), customHyperLinkSidePanel = useMemo(() => {
690
+ const [id, setId] = useState(""), [hide, setHide] = useState(!1), [display, setDisplay] = useState(""), [showLabel, setShowLabel] = useState(!0), [type, setType] = useState(SheetHyperLinkType.URL), [payload, setPayload] = useState(""), localeService = useDependency(LocaleService), definedNameService = useDependency(IDefinedNamesService), editorBridgeService = useDependency(IEditorBridgeService), univerInstanceService = useDependency(IUniverInstanceService), popupService = useDependency(SheetsHyperLinkPopupService), editing = useObservable(popupService.currentEditing$), resolverService = useDependency(SheetsHyperLinkResolverService), commandService = useDependency(ICommandService), sidePanelService = useDependency(SheetsHyperLinkSidePanelService), sidePanelOptions = useMemo(() => sidePanelService.getOptions(), [sidePanelService]), zenZoneService = useDependency(IZenZoneService), renderManagerService = useDependency(IRenderManagerService), markSelectionService = useDependency(IMarkSelectionService), textSelectionService = useDependency(DocSelectionManagerService), contextService = useDependency(IContextService), themeService = useDependency(ThemeService), docSelectionManagerService = useDependency(DocSelectionManagerService), customHyperLinkSidePanel = useMemo(() => {
672
691
  if (!sidePanelService.isBuiltInLinkType(type))
673
692
  return sidePanelService.getCustomHyperLink(type);
674
693
  }, [sidePanelService, type]), [showError, setShowError] = useState(!1), setByPayload = useRef(!1);
675
694
  useEffect(() => {
676
- var _a16, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
695
+ var _a16, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
677
696
  if ((editing == null ? void 0 : editing.row) !== void 0 && editing.col !== void 0) {
678
697
  const { label, customRange, row, col } = editing;
679
698
  let link;
@@ -689,20 +708,20 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
689
708
  const workbook2 = univerInstanceService.getUnit(editing.unitId), worksheet = workbook2 == null ? void 0 : workbook2.getSheetBySheetId(editing.subUnitId), cell = worksheet == null ? void 0 : worksheet.getCellRaw(editing.row, editing.col), range = (_f = (_e = (_d = cell == null ? void 0 : cell.p) == null ? void 0 : _d.body) == null ? void 0 : _e.customRanges) == null ? void 0 : _f.find((range2) => {
690
709
  var _a17;
691
710
  return range2.rangeType === CustomRangeType.HYPERLINK && ((_a17 = range2.properties) == null ? void 0 : _a17.url);
692
- }), cellValue = `${(_g = getOriginCellValue(cell)) != null ? _g : ""}`;
693
- cell && (cell.p || cellValue) && setShowLabel(!1), link = {
711
+ }), cellValue = cell == null ? void 0 : cell.v;
712
+ cell && (!BuildTextUtils.transform.isEmptyDocument((_h = (_g = cell.p) == null ? void 0 : _g.body) == null ? void 0 : _h.dataStream) || cellValue) && setShowLabel(!1), link = {
694
713
  id: "",
695
714
  display: "",
696
- payload: (_i = (_h = range == null ? void 0 : range.properties) == null ? void 0 : _h.url) != null ? _i : "",
715
+ payload: (_j = (_i = range == null ? void 0 : range.properties) == null ? void 0 : _i.url) != null ? _j : "",
697
716
  row,
698
717
  column: col
699
718
  };
700
719
  } else {
701
- const doc = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC), selection = textSelectionService.getActiveTextRange(), customRange2 = selection && ((_l = BuildTextUtils.customRange.getCustomRangesInterestsWithRange(selection, (_k = (_j = doc == null ? void 0 : doc.getBody()) == null ? void 0 : _j.customRanges) != null ? _k : [])) == null ? void 0 : _l[0]);
720
+ const doc = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC), selection = textSelectionService.getActiveTextRange(), customRange2 = selection && ((_m = BuildTextUtils.customRange.getCustomRangesInterestsWithRange(selection, (_l = (_k = doc == null ? void 0 : doc.getBody()) == null ? void 0 : _k.customRanges) != null ? _l : [])) == null ? void 0 : _m[0]);
702
721
  setShowLabel(!1), link = {
703
722
  id: "",
704
723
  display: label != null ? label : "",
705
- payload: (_n = (_m = customRange2 == null ? void 0 : customRange2.properties) == null ? void 0 : _m.url) != null ? _n : "",
724
+ payload: (_o = (_n = customRange2 == null ? void 0 : customRange2.properties) == null ? void 0 : _n.url) != null ? _o : "",
706
725
  row,
707
726
  column: col
708
727
  };
@@ -722,7 +741,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
722
741
  break;
723
742
  }
724
743
  case SheetHyperLinkType.RANGE: {
725
- const params = linkInfo.searchObj, sheetName = params.gid && (_q = (_p = (_o = univerInstanceService.getUnit(editing.unitId)) == null ? void 0 : _o.getSheetBySheetId(params.gid)) == null ? void 0 : _p.getName()) != null ? _q : "", payload2 = serializeRangeWithSheet(sheetName, deserializeRangeWithSheet(params.range).range);
744
+ const params = linkInfo.searchObj, sheetName = params.gid && (_r = (_q = (_p = univerInstanceService.getUnit(editing.unitId)) == null ? void 0 : _p.getSheetBySheetId(params.gid)) == null ? void 0 : _q.getName()) != null ? _r : "", payload2 = serializeRangeWithSheet(sheetName, deserializeRangeWithSheet(params.range).range);
726
745
  setPayload(payload2), payload2 === link.display && (setByPayload.current = !0);
727
746
  break;
728
747
  }
@@ -742,10 +761,9 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
742
761
  }
743
762
  }
744
763
  }, [editing, resolverService, sidePanelService, textSelectionService, univerInstanceService]), useEffect(() => {
745
- var _a16;
746
764
  let id2 = null;
747
- if (editing && editing.type === HyperLinkEditSourceType.VIEWING && Tools.isDefine(editing.row) && Tools.isDefine(editing.col)) {
748
- const worksheet = (_a16 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a16.getSheetBySheetId(editing.subUnitId), mergeInfo = worksheet == null ? void 0 : worksheet.getMergedCell(editing.row, editing.col);
765
+ if (editing && !editing.customRangeId && editing.type === HyperLinkEditSourceType.VIEWING && Tools.isDefine(editing.row) && Tools.isDefine(editing.col)) {
766
+ const workbook2 = univerInstanceService.getUnit(editing.unitId, UniverInstanceType.UNIVER_SHEET), worksheet = workbook2 == null ? void 0 : workbook2.getSheetBySheetId(editing.subUnitId), mergeInfo = worksheet == null ? void 0 : worksheet.getMergedCell(editing.row, editing.col), color = new ColorKit(themeService.getCurrentTheme().hyacinth500).toRgb();
749
767
  id2 = markSelectionService.addShape(
750
768
  {
751
769
  range: mergeInfo != null ? mergeInfo : {
@@ -756,7 +774,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
756
774
  },
757
775
  style: {
758
776
  hasAutoFill: !1,
759
- fill: "rgb(255, 189, 55, 0.35)",
777
+ fill: `rgb(${color.r}, ${color.g}, ${color.b}, 0.12)`,
760
778
  strokeWidth: 1,
761
779
  stroke: "#FFBD37",
762
780
  widgets: {}
@@ -770,7 +788,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
770
788
  return () => {
771
789
  id2 && markSelectionService.removeShape(id2);
772
790
  };
773
- }, [editing, markSelectionService]);
791
+ }, [editing, markSelectionService, themeService, univerInstanceService]);
774
792
  const payloadInitial = useMemo(() => payload, [type]);
775
793
  useEffect(() => {
776
794
  const render2 = renderManagerService.getRenderById(editorBridgeService.getCurrentEditorId()), disposeCollection = new DisposableCollection();
@@ -937,13 +955,25 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
937
955
  isSingleChoice: !0,
938
956
  value: payloadInitial,
939
957
  onChange: handleRangeChange,
940
- disableInput: editing.type === HyperLinkEditSourceType.ZEN_EDITOR,
958
+ dialogOnly: !0,
941
959
  onSelectorVisibleChange: /* @__PURE__ */ __name(async (visible) => {
942
- visible ? (editing.type === HyperLinkEditSourceType.ZEN_EDITOR && (zenZoneService.hide(), contextService.setContextValue(FOCUSING_SHEET, !0)), editing.type !== HyperLinkEditSourceType.VIEWING && editorBridgeService.enableForceKeepVisible(), setHide(!0)) : (await resolverService.navigateToRange(editing.unitId, editing.subUnitId, { startRow: editing.row, endRow: editing.row, startColumn: editing.col, endColumn: editing.col }), editing.type === HyperLinkEditSourceType.ZEN_EDITOR && (await commandService.executeCommand(SetSelectionsOperation.id, {
943
- unitId: editing.unitId,
944
- subUnitId: editing.subUnitId,
945
- selections: [{ range: { startRow: editing.row, endRow: editing.row, startColumn: editing.col, endColumn: editing.col } }]
946
- }), zenZoneService.show(), contextService.setContextValue(FOCUSING_SHEET, !1)), editorBridgeService.disableForceKeepVisible(), setHide(!1));
960
+ var _a16, _b;
961
+ if (visible)
962
+ editing.type === HyperLinkEditSourceType.ZEN_EDITOR && (zenZoneService.hide(), contextService.setContextValue(FOCUSING_SHEET, !0)), editing.type !== HyperLinkEditSourceType.VIEWING && editorBridgeService.enableForceKeepVisible(), setHide(!0);
963
+ else {
964
+ if (await resolverService.navigateToRange(editing.unitId, editing.subUnitId, { startRow: editing.row, endRow: editing.row, startColumn: editing.col, endColumn: editing.col }), editing.type === HyperLinkEditSourceType.ZEN_EDITOR) {
965
+ await commandService.executeCommand(SetSelectionsOperation.id, {
966
+ unitId: editing.unitId,
967
+ subUnitId: editing.subUnitId,
968
+ selections: [{ range: { startRow: editing.row, endRow: editing.row, startColumn: editing.col, endColumn: editing.col } }]
969
+ }), zenZoneService.show(), contextService.setContextValue(FOCUSING_SHEET, !1);
970
+ const docBackScrollRenderController = (_a16 = renderManagerService.getRenderById(DOCS_ZEN_EDITOR_UNIT_ID_KEY)) == null ? void 0 : _a16.with(DocBackScrollRenderController), range = (_b = docSelectionManagerService.getTextRanges({ unitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY, subUnitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY })) == null ? void 0 : _b[0];
971
+ docBackScrollRenderController && range && setTimeout(() => {
972
+ docBackScrollRenderController.scrollToRange(range), docSelectionManagerService.refreshSelection({ unitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY, subUnitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY });
973
+ }, 100);
974
+ }
975
+ editorBridgeService.disableForceKeepVisible(), setHide(!1);
976
+ }
947
977
  }, "onSelectorVisibleChange")
948
978
  }
949
979
  ) }),
@@ -1107,6 +1137,21 @@ var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width:
1107
1137
  }));
1108
1138
  });
1109
1139
  Xlsx.displayName = "Xlsx";
1140
+ function r(e) {
1141
+ var t, f2, n2 = "";
1142
+ if (typeof e == "string" || typeof e == "number") n2 += e;
1143
+ else if (typeof e == "object") if (Array.isArray(e)) {
1144
+ var o = e.length;
1145
+ for (t = 0; t < o; t++) e[t] && (f2 = r(e[t])) && (n2 && (n2 += " "), n2 += f2);
1146
+ } else for (f2 in e) e[f2] && (n2 && (n2 += " "), n2 += f2);
1147
+ return n2;
1148
+ }
1149
+ __name(r, "r");
1150
+ function clsx() {
1151
+ for (var e, t, f2 = 0, n2 = "", o = arguments.length; f2 < o; f2++) (e = arguments[f2]) && (t = r(e)) && (n2 && (n2 += " "), n2 += t);
1152
+ return n2;
1153
+ }
1154
+ __name(clsx, "clsx");
1110
1155
  const CancelHyperLinkCommand = {
1111
1156
  type: CommandType.COMMAND,
1112
1157
  id: "sheets.command.cancel-hyper-link",
@@ -1212,8 +1257,8 @@ const CancelHyperLinkCommand = {
1212
1257
  [SheetHyperLinkType.INVALID]: /* @__PURE__ */ jsxRuntimeExports.jsx(AllBorderSingle, {})
1213
1258
  }, CellLinkPopup = /* @__PURE__ */ __name(() => {
1214
1259
  var _a15, _b;
1215
- const popupService = useDependency(SheetsHyperLinkPopupService), commandService = useDependency(ICommandService), messageService = useDependency(IMessageService), localeService = useDependency(LocaleService), [currentPopup, setCurrentPopup] = useState(null), resolverService = useDependency(SheetsHyperLinkResolverService), editorBridgeService = useDependency(IEditorBridgeService);
1216
- if (useEffect(() => {
1260
+ const popupService = useDependency(SheetsHyperLinkPopupService), commandService = useDependency(ICommandService), messageService = useDependency(IMessageService), localeService = useDependency(LocaleService), [currentPopup, setCurrentPopup] = useState(null), resolverService = useDependency(SheetsHyperLinkResolverService), editorBridgeService = useDependency(IEditorBridgeService), zenZoneService = useDependency(IZenZoneService);
1261
+ if (useObservable$1(zenZoneService.visible$), useEffect(() => {
1217
1262
  setCurrentPopup(popupService.currentPopup);
1218
1263
  const ob = popupService.currentPopup$.subscribe((popup) => {
1219
1264
  setCurrentPopup(popup);
@@ -1228,15 +1273,24 @@ const CancelHyperLinkCommand = {
1228
1273
  return null;
1229
1274
  const linkObj = resolverService.parseHyperLink((_b = customRange.properties.url) != null ? _b : ""), isError = linkObj.type === SheetHyperLinkType.INVALID;
1230
1275
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.cellLink, onClick: /* @__PURE__ */ __name(() => popupService.hideCurrentPopup(), "onClick"), children: [
1231
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cs(styles.cellLinkContent, { [styles.cellLinkContentError]: isError }), onClick: linkObj.handler, children: [
1232
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.cellLinkType, children: iconsMap[linkObj.type] }),
1233
- /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { showIfEllipsis: !0, title: linkObj.name, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles.cellLinkUrl, children: linkObj.name }) })
1234
- ] }),
1276
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
1277
+ "div",
1278
+ {
1279
+ className: clsx(styles.cellLinkContent, { [styles.cellLinkContentError]: isError }),
1280
+ onClick: /* @__PURE__ */ __name(() => {
1281
+ zenZoneService.visible || linkObj.handler();
1282
+ }, "onClick"),
1283
+ children: [
1284
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.cellLinkType, children: iconsMap[linkObj.type] }),
1285
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { showIfEllipsis: !0, title: linkObj.name, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles.cellLinkUrl, children: linkObj.name }) })
1286
+ ]
1287
+ }
1288
+ ),
1235
1289
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.cellLinkOperations, children: [
1236
1290
  currentPopup.copyPermission && /* @__PURE__ */ jsxRuntimeExports.jsx(
1237
1291
  "div",
1238
1292
  {
1239
- className: cs(styles.cellLinkOperation, { [styles.cellLinkOperationError]: isError }),
1293
+ className: clsx(styles.cellLinkOperation, { [styles.cellLinkOperationError]: isError }),
1240
1294
  onClick: /* @__PURE__ */ __name(() => {
1241
1295
  if (!isError) {
1242
1296
  if (linkObj.type !== SheetHyperLinkType.URL) {
@@ -1408,6 +1462,9 @@ let SheetsHyperLinkPopupService = (_a3 = class extends Disposable {
1408
1462
  const hyperLinkRangeSelectorId = createInternalEditorID("hyper-link-edit");
1409
1463
  this._editorService.getFocusId() !== hyperLinkRangeSelectorId && (this._rangeSelectorService.getCurrentSelectorId() === hyperLinkRangeSelectorId && this._rangeSelectorService.selectorModalVisible || this.endEditing());
1410
1464
  }, "onClickOutside"),
1465
+ onContextMenu: /* @__PURE__ */ __name(() => {
1466
+ this.endEditing();
1467
+ }, "onContextMenu"),
1411
1468
  hiddenType: "hide"
1412
1469
  };
1413
1470
  }
@@ -1688,299 +1745,163 @@ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPrope
1688
1745
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1689
1746
  return kind && result && __defProp$9(target, key, result), result;
1690
1747
  }, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a4;
1691
- let SheetsHyperLinkRemoveSheetController = (_a4 = class extends Disposable {
1692
- constructor(_sheetInterceptorService, _univerInstanceService, _hyperLinkModel) {
1693
- super(), this._sheetInterceptorService = _sheetInterceptorService, this._univerInstanceService = _univerInstanceService, this._hyperLinkModel = _hyperLinkModel, this._initSheetChange();
1748
+ let SheetsHyperLinkAutoFillController = (_a4 = class extends Disposable {
1749
+ constructor(_autoFillService, _hyperLinkModel) {
1750
+ super(), this._autoFillService = _autoFillService, this._hyperLinkModel = _hyperLinkModel, this._initAutoFill();
1694
1751
  }
1695
- _initSheetChange() {
1696
- this.disposeWithMe(
1697
- this._sheetInterceptorService.interceptCommand({
1698
- getMutations: /* @__PURE__ */ __name((commandInfo) => {
1699
- var _a15;
1700
- if (commandInfo.id === RemoveSheetCommand.id) {
1701
- const params = commandInfo.params, workbook = params.unitId ? this._univerInstanceService.getUnit(params.unitId) : this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
1702
- if (!workbook)
1703
- return { redos: [], undos: [] };
1704
- const unitId = workbook.getUnitId(), subUnitId = params.subUnitId || ((_a15 = workbook.getActiveSheet()) == null ? void 0 : _a15.getSheetId());
1705
- if (!subUnitId)
1706
- return { redos: [], undos: [] };
1707
- const links = this._hyperLinkModel.getSubUnit(unitId, subUnitId), redos = links.map((link) => ({
1708
- id: RemoveHyperLinkMutation.id,
1709
- params: {
1710
- unitId,
1711
- subUnitId,
1712
- id: link.id
1713
- }
1714
- })), undos = links.map((link) => ({
1715
- id: AddHyperLinkMutation.id,
1716
- params: {
1717
- unitId,
1718
- subUnitId,
1719
- link
1752
+ // eslint-disable-next-line max-lines-per-function
1753
+ _initAutoFill() {
1754
+ const noopReturnFunc = /* @__PURE__ */ __name(() => ({ redos: [], undos: [] }), "noopReturnFunc"), generalApplyFunc = /* @__PURE__ */ __name((location2, applyType) => {
1755
+ const { source: sourceRange, target: targetRange, unitId, subUnitId } = location2, virtualRange = virtualizeDiscreteRanges([sourceRange, targetRange]), [vSourceRange, vTargetRange] = virtualRange.ranges, { mapFunc } = virtualRange, sourceStartCell = {
1756
+ row: vSourceRange.startRow,
1757
+ col: vSourceRange.startColumn
1758
+ }, repeats = getAutoFillRepeatRange(vSourceRange, vTargetRange), redos = [], undos = [];
1759
+ return repeats.forEach((repeat) => {
1760
+ const targetStartCell = repeat.repeatStartCell, relativeRange = repeat.relativeRange, sourceRange2 = {
1761
+ startRow: sourceStartCell.row,
1762
+ startColumn: sourceStartCell.col,
1763
+ endColumn: sourceStartCell.col,
1764
+ endRow: sourceStartCell.row
1765
+ }, targetRange2 = {
1766
+ startRow: targetStartCell.row,
1767
+ startColumn: targetStartCell.col,
1768
+ endColumn: targetStartCell.col,
1769
+ endRow: targetStartCell.row
1770
+ };
1771
+ Range.foreach(relativeRange, (row, col) => {
1772
+ const sourcePositionRange = Rectangle.getPositionRange(
1773
+ {
1774
+ startRow: row,
1775
+ startColumn: col,
1776
+ endColumn: col,
1777
+ endRow: row
1778
+ },
1779
+ sourceRange2
1780
+ ), { row: sourceRow, col: sourceCol } = mapFunc(sourcePositionRange.startRow, sourcePositionRange.startColumn), link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, sourceRow, sourceCol), targetPositionRange = Rectangle.getPositionRange(
1781
+ {
1782
+ startRow: row,
1783
+ startColumn: col,
1784
+ endColumn: col,
1785
+ endRow: row
1786
+ },
1787
+ targetRange2
1788
+ ), { row: targetRow, col: targetCol } = mapFunc(targetPositionRange.startRow, targetPositionRange.startColumn), id = Tools.generateRandomId(), currentLink = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, targetRow, targetCol);
1789
+ currentLink && redos.push({
1790
+ id: RemoveHyperLinkMutation.id,
1791
+ params: {
1792
+ unitId,
1793
+ subUnitId,
1794
+ id: currentLink.id
1795
+ }
1796
+ }), (APPLY_TYPE.COPY === applyType || APPLY_TYPE.SERIES === applyType) && link && (redos.push({
1797
+ id: AddHyperLinkMutation.id,
1798
+ params: {
1799
+ unitId,
1800
+ subUnitId,
1801
+ link: {
1802
+ ...link,
1803
+ id,
1804
+ row: targetRow,
1805
+ column: targetCol
1720
1806
  }
1721
- }));
1722
- return { redos, undos };
1723
- }
1724
- return { redos: [], undos: [] };
1725
- }, "getMutations")
1726
- })
1727
- );
1807
+ }
1808
+ }), undos.push({
1809
+ id: RemoveHyperLinkMutation.id,
1810
+ params: {
1811
+ unitId,
1812
+ subUnitId,
1813
+ id
1814
+ }
1815
+ })), currentLink && undos.push({
1816
+ id: AddHyperLinkMutation.id,
1817
+ params: {
1818
+ unitId,
1819
+ subUnitId,
1820
+ link: currentLink
1821
+ }
1822
+ });
1823
+ });
1824
+ }), {
1825
+ undos,
1826
+ redos
1827
+ };
1828
+ }, "generalApplyFunc"), hook = {
1829
+ id: SHEET_HYPER_LINK_UI_PLUGIN,
1830
+ onFillData: /* @__PURE__ */ __name((location2, direction, applyType) => applyType === APPLY_TYPE.COPY || applyType === APPLY_TYPE.ONLY_FORMAT || applyType === APPLY_TYPE.SERIES ? generalApplyFunc(location2, applyType) : noopReturnFunc(), "onFillData")
1831
+ };
1832
+ this.disposeWithMe(this._autoFillService.addHook(hook));
1728
1833
  }
1729
- }, __name(_a4, "SheetsHyperLinkRemoveSheetController"), _a4);
1730
- SheetsHyperLinkRemoveSheetController = __decorateClass$9([
1731
- OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkRemoveSheetController),
1732
- __decorateParam$9(0, Inject(SheetInterceptorService)),
1733
- __decorateParam$9(1, IUniverInstanceService),
1734
- __decorateParam$9(2, Inject(HyperLinkModel))
1735
- ], SheetsHyperLinkRemoveSheetController);
1834
+ }, __name(_a4, "SheetsHyperLinkAutoFillController"), _a4);
1835
+ SheetsHyperLinkAutoFillController = __decorateClass$9([
1836
+ __decorateParam$9(0, IAutoFillService),
1837
+ __decorateParam$9(1, Inject(HyperLinkModel))
1838
+ ], SheetsHyperLinkAutoFillController);
1736
1839
  var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1737
1840
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1738
1841
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1739
1842
  return kind && result && __defProp$8(target, key, result), result;
1740
1843
  }, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a5;
1741
- let SheetsHyperLinkRenderController = (_a5 = class extends Disposable {
1742
- constructor(_context, _hyperLinkModel, _sheetSkeletonManagerService, _renderManagerService) {
1743
- super(), this._context = _context, this._hyperLinkModel = _hyperLinkModel, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._renderManagerService = _renderManagerService, this._initSkeletonChange();
1744
- }
1745
- _initSkeletonChange() {
1746
- const markSkeletonDirty = /* @__PURE__ */ __name(() => {
1747
- var _a15;
1748
- const workbook = this._context.unit, unitId = workbook.getUnitId(), subUnitId = (_a15 = workbook.getActiveSheet()) == null ? void 0 : _a15.getSheetId();
1749
- if (!subUnitId) {
1750
- console.warn("No active sheet found");
1751
- return;
1752
- }
1753
- const skeleton = this._sheetSkeletonManagerService.getOrCreateSkeleton({ sheetId: subUnitId }), currentRender = this._renderManagerService.getRenderById(unitId);
1754
- skeleton == null || skeleton.makeDirty(!0), skeleton == null || skeleton.calculate(), currentRender && currentRender.mainComponent.makeForceDirty();
1755
- }, "markSkeletonDirty");
1756
- this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(debounceTime(16)).subscribe(() => {
1757
- markSkeletonDirty();
1758
- }));
1759
- }
1760
- }, __name(_a5, "SheetsHyperLinkRenderController"), _a5);
1761
- SheetsHyperLinkRenderController = __decorateClass$8([
1762
- __decorateParam$8(1, Inject(HyperLinkModel)),
1763
- __decorateParam$8(2, Inject(SheetSkeletonManagerService)),
1764
- __decorateParam$8(3, IRenderManagerService)
1765
- ], SheetsHyperLinkRenderController);
1766
- var _a6;
1767
- let SheetsHyperLinkRenderManagerController = (_a6 = class extends Disposable {
1768
- constructor(_sheetInterceptorService, _hyperLinkModel, _themeService) {
1769
- super(), this._sheetInterceptorService = _sheetInterceptorService, this._hyperLinkModel = _hyperLinkModel, this._themeService = _themeService, this._initViewModelIntercept();
1844
+ let SheetsHyperLinkPermissionController = (_a5 = class extends Disposable {
1845
+ constructor(_localeService, _commandService, _sheetPermissionInterceptorBaseController) {
1846
+ super(), this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
1770
1847
  }
1771
- _initViewModelIntercept() {
1848
+ _commandExecutedListener() {
1772
1849
  this.disposeWithMe(
1773
- this._sheetInterceptorService.intercept(
1774
- INTERCEPTOR_POINT.CELL_CONTENT,
1775
- {
1776
- effect: InterceptorEffectEnum.Value,
1777
- priority: 100,
1778
- handler: /* @__PURE__ */ __name((cell, pos, next) => {
1779
- const { row, col, unitId, subUnitId } = pos, link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
1780
- return next(link ? {
1781
- ...cell,
1782
- linkUrl: link.payload,
1783
- linkId: link.id
1784
- } : cell);
1785
- }, "handler")
1786
- }
1787
- )
1850
+ this._commandService.beforeCommandExecuted((command) => {
1851
+ command.id === InsertLinkShortcut.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1852
+ workbookTypes: [WorkbookEditablePermission],
1853
+ rangeTypes: [RangeProtectionPermissionEditPoint],
1854
+ worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission]
1855
+ }) || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")));
1856
+ })
1788
1857
  );
1789
1858
  }
1790
- }, __name(_a6, "SheetsHyperLinkRenderManagerController"), _a6);
1791
- SheetsHyperLinkRenderManagerController = __decorateClass$8([
1792
- OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkRenderManagerController),
1793
- __decorateParam$8(0, Inject(SheetInterceptorService)),
1794
- __decorateParam$8(1, Inject(HyperLinkModel)),
1795
- __decorateParam$8(2, Inject(ThemeService))
1796
- ], SheetsHyperLinkRenderManagerController);
1859
+ }, __name(_a5, "SheetsHyperLinkPermissionController"), _a5);
1860
+ SheetsHyperLinkPermissionController = __decorateClass$8([
1861
+ __decorateParam$8(0, Inject(LocaleService)),
1862
+ __decorateParam$8(1, ICommandService),
1863
+ __decorateParam$8(2, Inject(SheetPermissionInterceptorBaseController))
1864
+ ], SheetsHyperLinkPermissionController);
1797
1865
  var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1798
1866
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1799
1867
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1800
1868
  return kind && result && __defProp$7(target, key, result), result;
1801
- }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a7;
1802
- let SheetHyperLinkSetRangeController = (_a7 = class extends Disposable {
1803
- constructor(_sheetInterceptorService, _hyperLinkModel, _selectionManagerService, _univerInstanceService, _editorBridgeService, _renderManagerService) {
1804
- super(), this._sheetInterceptorService = _sheetInterceptorService, this._hyperLinkModel = _hyperLinkModel, this._selectionManagerService = _selectionManagerService, this._univerInstanceService = _univerInstanceService, this._editorBridgeService = _editorBridgeService, this._renderManagerService = _renderManagerService, this._initCommandInterceptor(), this._initAfterEditor();
1869
+ }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a6;
1870
+ let SheetsHyperLinkPopupController = (_a6 = class extends Disposable {
1871
+ constructor(_hoverManagerService, _sheetsHyperLinkPopupService, _renderManagerService, _permissionService, _sheetPermissionInterceptorBaseController, _commandService, _editorBridgeService, _textSelectionManagerService, _univerInstanceService, _zenZoneService) {
1872
+ super(), this._hoverManagerService = _hoverManagerService, this._sheetsHyperLinkPopupService = _sheetsHyperLinkPopupService, this._renderManagerService = _renderManagerService, this._permissionService = _permissionService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandService = _commandService, this._editorBridgeService = _editorBridgeService, this._textSelectionManagerService = _textSelectionManagerService, this._univerInstanceService = _univerInstanceService, this._zenZoneService = _zenZoneService, this._initHoverListener(), this._initCommandListener(), this._initHoverEditingListener(), this._initTextSelectionListener(), this._initZenEditor();
1805
1873
  }
1806
- _initCommandInterceptor() {
1807
- this._initSetRangeValuesCommandInterceptor(), this._initClearSelectionCommandInterceptor();
1874
+ _getLinkPermission(location2) {
1875
+ const { unitId, subUnitId, row: currentRow, col: currentCol } = location2, workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
1876
+ if (!(workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId)))
1877
+ return {
1878
+ viewPermission: !1,
1879
+ editPermission: !1,
1880
+ copyPermission: !1
1881
+ };
1882
+ const viewPermission = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1883
+ workbookTypes: [WorkbookViewPermission],
1884
+ worksheetTypes: [WorksheetViewPermission],
1885
+ rangeTypes: [RangeProtectionPermissionViewPoint]
1886
+ }, [{ startRow: currentRow, startColumn: currentCol, endRow: currentRow, endColumn: currentCol }]), editPermission = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1887
+ workbookTypes: [WorkbookEditablePermission],
1888
+ worksheetTypes: [WorksheetEditPermission, WorksheetInsertHyperlinkPermission],
1889
+ rangeTypes: [RangeProtectionPermissionEditPoint]
1890
+ }, [{ startRow: currentRow, startColumn: currentCol, endRow: currentRow, endColumn: currentCol }]), copyPermission = this._permissionService.composePermission([new WorkbookCopyPermission(unitId).id, new WorksheetCopyPermission(unitId, subUnitId).id]).every((permission) => permission.value);
1891
+ return {
1892
+ viewPermission,
1893
+ editPermission,
1894
+ copyPermission
1895
+ };
1808
1896
  }
1809
- _initSetRangeValuesCommandInterceptor() {
1810
- this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
1811
- getMutations: /* @__PURE__ */ __name((command) => {
1812
- if (command.id === SetRangeValuesCommand.id) {
1813
- const params = command.params, { unitId, subUnitId } = params, redos = [], undos = [];
1814
- return params.cellValue && new ObjectMatrix(params.cellValue).forValue((row, col) => {
1815
- const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
1816
- link && (redos.push({
1817
- id: RemoveHyperLinkMutation.id,
1818
- params: {
1819
- unitId,
1820
- subUnitId,
1821
- id: link.id
1822
- }
1823
- }), undos.push({
1824
- id: AddHyperLinkMutation.id,
1825
- params: {
1826
- unitId,
1827
- subUnitId,
1828
- link
1829
- }
1830
- }));
1831
- }), {
1832
- undos,
1833
- redos
1834
- };
1835
- }
1836
- return {
1837
- redos: [],
1838
- undos: []
1839
- };
1840
- }, "getMutations")
1841
- }));
1842
- }
1843
- _initClearSelectionCommandInterceptor() {
1844
- this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
1845
- getMutations: /* @__PURE__ */ __name((command) => {
1846
- if (command.id === ClearSelectionContentCommand.id || command.id === ClearSelectionAllCommand.id || command.id === ClearSelectionFormatCommand.id) {
1847
- const redos = [], undos = [], selection = this._selectionManagerService.getCurrentLastSelection(), target = getSheetCommandTarget(this._univerInstanceService);
1848
- if (selection && target) {
1849
- const { unitId, subUnitId } = target;
1850
- Range.foreach(selection.range, (row, col) => {
1851
- const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
1852
- link && (redos.push({
1853
- id: RemoveHyperLinkMutation.id,
1854
- params: {
1855
- unitId,
1856
- subUnitId,
1857
- id: link.id
1858
- }
1859
- }), undos.push({
1860
- id: AddHyperLinkMutation.id,
1861
- params: {
1862
- unitId,
1863
- subUnitId,
1864
- link
1865
- }
1866
- }));
1867
- });
1868
- }
1869
- return {
1870
- redos,
1871
- undos
1872
- };
1873
- }
1874
- return {
1875
- redos: [],
1876
- undos: []
1877
- };
1878
- }, "getMutations")
1879
- }));
1880
- }
1881
- _initAfterEditor() {
1882
- this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT, {
1883
- handler: /* @__PURE__ */ __name((cell, context, next) => {
1884
- if (!cell || cell.p)
1885
- return next(cell);
1886
- if (typeof cell.v == "string" && Tools.isLegalUrl(cell.v) && cell.v[cell.v.length - 1] !== " ") {
1887
- const { unitId, subUnitId } = context, renderer = this._renderManagerService.getRenderById(unitId), skeleton = renderer == null ? void 0 : renderer.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
1888
- if (!skeleton)
1889
- return next(cell);
1890
- const doc = skeleton.skeleton.getBlankCellDocumentModel(cell);
1891
- if (!doc.documentModel)
1892
- return next(cell);
1893
- const textX = BuildTextUtils.selection.replace({
1894
- selection: {
1895
- startOffset: 0,
1896
- endOffset: cell.v.length,
1897
- collapsed: !1
1898
- },
1899
- body: {
1900
- dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${cell.v}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
1901
- customRanges: [{
1902
- startIndex: 0,
1903
- endIndex: cell.v.length + 1,
1904
- rangeId: generateRandomId(),
1905
- rangeType: CustomRangeType.HYPERLINK,
1906
- properties: {
1907
- url: cell.v
1908
- }
1909
- }]
1910
- },
1911
- doc: doc.documentModel
1912
- });
1913
- if (!textX)
1914
- return next(cell);
1915
- const body = doc.documentModel.getBody();
1916
- return TextX.apply(body, textX.serialize()), next({
1917
- ...cell,
1918
- p: {
1919
- id: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
1920
- body,
1921
- documentStyle: {
1922
- pageSize: {
1923
- width: 1 / 0,
1924
- height: 1 / 0
1925
- }
1926
- }
1927
- }
1928
- });
1929
- }
1930
- return next(cell);
1931
- }, "handler")
1932
- }));
1933
- }
1934
- }, __name(_a7, "SheetHyperLinkSetRangeController"), _a7);
1935
- SheetHyperLinkSetRangeController = __decorateClass$7([
1936
- OnLifecycle(LifecycleStages.Starting, SheetHyperLinkSetRangeController),
1937
- __decorateParam$7(0, Inject(SheetInterceptorService)),
1938
- __decorateParam$7(1, Inject(HyperLinkModel)),
1939
- __decorateParam$7(2, Inject(SheetsSelectionsService)),
1940
- __decorateParam$7(3, IUniverInstanceService),
1941
- __decorateParam$7(4, IEditorBridgeService),
1942
- __decorateParam$7(5, IRenderManagerService)
1943
- ], SheetHyperLinkSetRangeController);
1944
- var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1945
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1946
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1947
- return kind && result && __defProp$6(target, key, result), result;
1948
- }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a8;
1949
- let SheetsHyperLinkPopupController = (_a8 = class extends Disposable {
1950
- constructor(_hoverManagerService, _sheetsHyperLinkPopupService, _renderManagerService, _permissionService, _sheetPermissionInterceptorBaseController, _commandService, _editorBridgeService, _textSelectionManagerService, _univerInstanceService, _zenZoneService) {
1951
- super(), this._hoverManagerService = _hoverManagerService, this._sheetsHyperLinkPopupService = _sheetsHyperLinkPopupService, this._renderManagerService = _renderManagerService, this._permissionService = _permissionService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandService = _commandService, this._editorBridgeService = _editorBridgeService, this._textSelectionManagerService = _textSelectionManagerService, this._univerInstanceService = _univerInstanceService, this._zenZoneService = _zenZoneService, this._initHoverListener(), this._initCommandListener(), this._initHoverEditingListener(), this._initTextSelectionListener(), this._initZenEditor();
1952
- }
1953
- _getLinkPermission(location2) {
1954
- const { unitId, subUnitId, row: currentRow, col: currentCol } = location2, workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
1955
- if (!(workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId)))
1956
- return {
1957
- viewPermission: !1,
1958
- editPermission: !1,
1959
- copyPermission: !1
1960
- };
1961
- const viewPermission = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1962
- workbookTypes: [WorkbookViewPermission],
1963
- worksheetTypes: [WorksheetViewPermission],
1964
- rangeTypes: [RangeProtectionPermissionViewPoint]
1965
- }, [{ startRow: currentRow, startColumn: currentCol, endRow: currentRow, endColumn: currentCol }]), editPermission = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1966
- workbookTypes: [WorkbookEditablePermission],
1967
- worksheetTypes: [WorksheetEditPermission, WorksheetInsertHyperlinkPermission],
1968
- rangeTypes: [RangeProtectionPermissionEditPoint]
1969
- }, [{ startRow: currentRow, startColumn: currentCol, endRow: currentRow, endColumn: currentCol }]), copyPermission = this._permissionService.composePermission([new WorkbookCopyPermission(unitId).id, new WorksheetCopyPermission(unitId, subUnitId).id]).every((permission) => permission.value);
1970
- return {
1971
- viewPermission,
1972
- editPermission,
1973
- copyPermission
1974
- };
1975
- }
1976
- _initHoverListener() {
1977
- this.disposeWithMe(
1978
- // hover over not editing cell
1979
- this._hoverManagerService.currentRichText$.pipe(debounceTime(200)).subscribe((currentCell) => {
1980
- var _a15;
1981
- if (!currentCell) {
1982
- this._sheetsHyperLinkPopupService.hideCurrentPopup();
1983
- return;
1897
+ _initHoverListener() {
1898
+ this.disposeWithMe(
1899
+ // hover over not editing cell
1900
+ this._hoverManagerService.currentRichText$.pipe(debounceTime(200)).subscribe((currentCell) => {
1901
+ var _a15;
1902
+ if (!currentCell) {
1903
+ this._sheetsHyperLinkPopupService.hideCurrentPopup();
1904
+ return;
1984
1905
  }
1985
1906
  const { unitId, subUnitId, row, col } = currentCell, renderer = this._renderManagerService.getRenderById(unitId);
1986
1907
  if (!renderer)
@@ -2105,242 +2026,125 @@ let SheetsHyperLinkPopupController = (_a8 = class extends Disposable {
2105
2026
  HIDE_COMMAND_LIST.includes(command.id) && this._sheetsHyperLinkPopupService.hideCurrentPopup();
2106
2027
  }));
2107
2028
  }
2108
- }, __name(_a8, "SheetsHyperLinkPopupController"), _a8);
2109
- SheetsHyperLinkPopupController = __decorateClass$6([
2110
- OnLifecycle(LifecycleStages.Rendered, SheetsHyperLinkPopupController),
2111
- __decorateParam$6(0, Inject(HoverManagerService)),
2112
- __decorateParam$6(1, Inject(SheetsHyperLinkPopupService)),
2113
- __decorateParam$6(2, Inject(IRenderManagerService)),
2114
- __decorateParam$6(3, Inject(IPermissionService)),
2115
- __decorateParam$6(4, Inject(SheetPermissionInterceptorBaseController)),
2116
- __decorateParam$6(5, ICommandService),
2117
- __decorateParam$6(6, IEditorBridgeService),
2118
- __decorateParam$6(7, Inject(DocSelectionManagerService)),
2119
- __decorateParam$6(8, IUniverInstanceService),
2120
- __decorateParam$6(9, IZenZoneService)
2029
+ }, __name(_a6, "SheetsHyperLinkPopupController"), _a6);
2030
+ SheetsHyperLinkPopupController = __decorateClass$7([
2031
+ __decorateParam$7(0, Inject(HoverManagerService)),
2032
+ __decorateParam$7(1, Inject(SheetsHyperLinkPopupService)),
2033
+ __decorateParam$7(2, Inject(IRenderManagerService)),
2034
+ __decorateParam$7(3, Inject(IPermissionService)),
2035
+ __decorateParam$7(4, Inject(SheetPermissionInterceptorBaseController)),
2036
+ __decorateParam$7(5, ICommandService),
2037
+ __decorateParam$7(6, IEditorBridgeService),
2038
+ __decorateParam$7(7, Inject(DocSelectionManagerService)),
2039
+ __decorateParam$7(8, IUniverInstanceService),
2040
+ __decorateParam$7(9, IZenZoneService)
2121
2041
  ], SheetsHyperLinkPopupController);
2122
- const menuSchema = {
2123
- [RibbonStartGroup.OTHERS]: {
2124
- [InsertHyperLinkToolbarOperation.id]: {
2125
- order: 2,
2126
- menuItemFactory: insertLinkMenuToolbarFactory
2127
- },
2128
- [genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]: {
2129
- order: 2,
2130
- menuItemFactory: zenEditorInsertLinkMenuToolbarFactory
2131
- }
2132
- },
2133
- [ContextMenuPosition.MAIN_AREA]: {
2134
- [ContextMenuGroup.OTHERS]: {
2135
- order: 1,
2136
- [InsertHyperLinkToolbarOperation.id]: {
2137
- order: 0,
2138
- menuItemFactory: insertLinkMenuFactory
2139
- },
2140
- [genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]: {
2141
- order: 0,
2142
- menuItemFactory: zenEditorInsertLinkMenuFactory
2143
- }
2144
- }
2145
- }
2146
- };
2147
- var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2148
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2149
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2150
- return kind && result && __defProp$5(target, key, result), result;
2151
- }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a9;
2152
- let SheetsHyperLinkUIController = (_a9 = class extends Disposable {
2153
- constructor(_componentManager, _commandService, _menuManagerService, _injector, _shortcutService) {
2154
- super(), this._componentManager = _componentManager, this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._injector = _injector, this._shortcutService = _shortcutService, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortCut();
2155
- }
2156
- _initComponents() {
2157
- [
2158
- [CellLinkPopup, CellLinkPopup.componentKey],
2159
- [CellLinkEdit, CellLinkEdit.componentKey],
2160
- [LinkSingle, "LinkSingle"]
2161
- ].forEach(([comp, key]) => {
2162
- this._componentManager.register(key, comp);
2163
- });
2164
- }
2165
- _initCommands() {
2166
- [
2167
- OpenHyperLinkEditPanelOperation,
2168
- CloseHyperLinkPopupOperation,
2169
- InsertHyperLinkOperation,
2170
- InsertHyperLinkToolbarOperation,
2171
- AddHyperLinkCommand,
2172
- UpdateHyperLinkCommand,
2173
- CancelHyperLinkCommand,
2174
- UpdateRichHyperLinkCommand,
2175
- CancelRichHyperLinkCommand,
2176
- AddRichHyperLinkCommand
2177
- ].forEach((command) => {
2178
- this._commandService.registerCommand(command);
2179
- });
2180
- }
2181
- _initMenus() {
2182
- this._menuManagerService.mergeMenu(menuSchema);
2183
- }
2184
- _initShortCut() {
2185
- this._shortcutService.registerShortcut(InsertLinkShortcut);
2186
- }
2187
- }, __name(_a9, "SheetsHyperLinkUIController"), _a9);
2188
- SheetsHyperLinkUIController = __decorateClass$5([
2189
- OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkUIController),
2190
- __decorateParam$5(0, Inject(ComponentManager)),
2191
- __decorateParam$5(1, ICommandService),
2192
- __decorateParam$5(2, IMenuManagerService),
2193
- __decorateParam$5(3, Inject(Injector)),
2194
- __decorateParam$5(4, Inject(IShortcutService))
2195
- ], SheetsHyperLinkUIController);
2196
- var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2197
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2042
+ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2043
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2198
2044
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2199
- return kind && result && __defProp$4(target, key, result), result;
2200
- }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a10;
2201
- let SheetsHyperLinkAutoFillController = (_a10 = class extends Disposable {
2202
- constructor(_autoFillService, _hyperLinkModel) {
2203
- super(), this._autoFillService = _autoFillService, this._hyperLinkModel = _hyperLinkModel, this._initAutoFill();
2045
+ return kind && result && __defProp$6(target, key, result), result;
2046
+ }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a7;
2047
+ let SheetsHyperLinkRemoveSheetController = (_a7 = class extends Disposable {
2048
+ constructor(_sheetInterceptorService, _univerInstanceService, _hyperLinkModel) {
2049
+ super(), this._sheetInterceptorService = _sheetInterceptorService, this._univerInstanceService = _univerInstanceService, this._hyperLinkModel = _hyperLinkModel, this._initSheetChange();
2204
2050
  }
2205
- // eslint-disable-next-line max-lines-per-function
2206
- _initAutoFill() {
2207
- const noopReturnFunc = /* @__PURE__ */ __name(() => ({ redos: [], undos: [] }), "noopReturnFunc"), generalApplyFunc = /* @__PURE__ */ __name((location2, applyType) => {
2208
- const { source: sourceRange, target: targetRange, unitId, subUnitId } = location2, virtualRange = virtualizeDiscreteRanges([sourceRange, targetRange]), [vSourceRange, vTargetRange] = virtualRange.ranges, { mapFunc } = virtualRange, sourceStartCell = {
2209
- row: vSourceRange.startRow,
2210
- col: vSourceRange.startColumn
2211
- }, repeats = getAutoFillRepeatRange(vSourceRange, vTargetRange), redos = [], undos = [];
2212
- return repeats.forEach((repeat) => {
2213
- const targetStartCell = repeat.repeatStartCell, relativeRange = repeat.relativeRange, sourceRange2 = {
2214
- startRow: sourceStartCell.row,
2215
- startColumn: sourceStartCell.col,
2216
- endColumn: sourceStartCell.col,
2217
- endRow: sourceStartCell.row
2218
- }, targetRange2 = {
2219
- startRow: targetStartCell.row,
2220
- startColumn: targetStartCell.col,
2221
- endColumn: targetStartCell.col,
2222
- endRow: targetStartCell.row
2223
- };
2224
- Range.foreach(relativeRange, (row, col) => {
2225
- const sourcePositionRange = Rectangle.getPositionRange(
2226
- {
2227
- startRow: row,
2228
- startColumn: col,
2229
- endColumn: col,
2230
- endRow: row
2231
- },
2232
- sourceRange2
2233
- ), { row: sourceRow, col: sourceCol } = mapFunc(sourcePositionRange.startRow, sourcePositionRange.startColumn), link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, sourceRow, sourceCol), targetPositionRange = Rectangle.getPositionRange(
2234
- {
2235
- startRow: row,
2236
- startColumn: col,
2237
- endColumn: col,
2238
- endRow: row
2239
- },
2240
- targetRange2
2241
- ), { row: targetRow, col: targetCol } = mapFunc(targetPositionRange.startRow, targetPositionRange.startColumn), id = Tools.generateRandomId(), currentLink = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, targetRow, targetCol);
2242
- currentLink && redos.push({
2243
- id: RemoveHyperLinkMutation.id,
2244
- params: {
2245
- unitId,
2246
- subUnitId,
2247
- id: currentLink.id
2248
- }
2249
- }), (APPLY_TYPE.COPY === applyType || APPLY_TYPE.SERIES === applyType) && link && (redos.push({
2250
- id: AddHyperLinkMutation.id,
2251
- params: {
2252
- unitId,
2253
- subUnitId,
2254
- link: {
2255
- ...link,
2256
- id,
2257
- row: targetRow,
2258
- column: targetCol
2051
+ _initSheetChange() {
2052
+ this.disposeWithMe(
2053
+ this._sheetInterceptorService.interceptCommand({
2054
+ getMutations: /* @__PURE__ */ __name((commandInfo) => {
2055
+ var _a15;
2056
+ if (commandInfo.id === RemoveSheetCommand.id) {
2057
+ const params = commandInfo.params, workbook = params.unitId ? this._univerInstanceService.getUnit(params.unitId) : this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2058
+ if (!workbook)
2059
+ return { redos: [], undos: [] };
2060
+ const unitId = workbook.getUnitId(), subUnitId = params.subUnitId || ((_a15 = workbook.getActiveSheet()) == null ? void 0 : _a15.getSheetId());
2061
+ if (!subUnitId)
2062
+ return { redos: [], undos: [] };
2063
+ const links = this._hyperLinkModel.getSubUnit(unitId, subUnitId), redos = links.map((link) => ({
2064
+ id: RemoveHyperLinkMutation.id,
2065
+ params: {
2066
+ unitId,
2067
+ subUnitId,
2068
+ id: link.id
2259
2069
  }
2260
- }
2261
- }), undos.push({
2262
- id: RemoveHyperLinkMutation.id,
2263
- params: {
2264
- unitId,
2265
- subUnitId,
2266
- id
2267
- }
2268
- })), currentLink && undos.push({
2269
- id: AddHyperLinkMutation.id,
2270
- params: {
2271
- unitId,
2272
- subUnitId,
2273
- link: currentLink
2274
- }
2275
- });
2276
- });
2277
- }), {
2278
- undos,
2279
- redos
2280
- };
2281
- }, "generalApplyFunc"), hook = {
2282
- id: SHEET_HYPER_LINK_UI_PLUGIN,
2283
- onFillData: /* @__PURE__ */ __name((location2, direction, applyType) => applyType === APPLY_TYPE.COPY || applyType === APPLY_TYPE.ONLY_FORMAT || applyType === APPLY_TYPE.SERIES ? generalApplyFunc(location2, applyType) : noopReturnFunc(), "onFillData")
2284
- };
2285
- this.disposeWithMe(this._autoFillService.addHook(hook));
2070
+ })), undos = links.map((link) => ({
2071
+ id: AddHyperLinkMutation.id,
2072
+ params: {
2073
+ unitId,
2074
+ subUnitId,
2075
+ link
2076
+ }
2077
+ }));
2078
+ return { redos, undos };
2079
+ }
2080
+ return { redos: [], undos: [] };
2081
+ }, "getMutations")
2082
+ })
2083
+ );
2286
2084
  }
2287
- }, __name(_a10, "SheetsHyperLinkAutoFillController"), _a10);
2288
- SheetsHyperLinkAutoFillController = __decorateClass$4([
2289
- OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkAutoFillController),
2290
- __decorateParam$4(0, IAutoFillService),
2291
- __decorateParam$4(1, Inject(HyperLinkModel))
2292
- ], SheetsHyperLinkAutoFillController);
2293
- var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2294
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2085
+ }, __name(_a7, "SheetsHyperLinkRemoveSheetController"), _a7);
2086
+ SheetsHyperLinkRemoveSheetController = __decorateClass$6([
2087
+ __decorateParam$6(0, Inject(SheetInterceptorService)),
2088
+ __decorateParam$6(1, IUniverInstanceService),
2089
+ __decorateParam$6(2, Inject(HyperLinkModel))
2090
+ ], SheetsHyperLinkRemoveSheetController);
2091
+ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2092
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2295
2093
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2296
- return kind && result && __defProp$3(target, key, result), result;
2297
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a11;
2298
- let SheetHyperLinkUrlController = (_a11 = class extends Disposable {
2299
- constructor(_resolverService) {
2300
- super(), this._resolverService = _resolverService, this._handleInitUrl();
2301
- }
2302
- _handleInitUrl() {
2303
- const hash = location.hash;
2304
- hash && this._resolverService.parseHyperLink(hash).handler();
2094
+ return kind && result && __defProp$5(target, key, result), result;
2095
+ }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a8;
2096
+ let SheetsHyperLinkRenderController = (_a8 = class extends Disposable {
2097
+ constructor(_context, _hyperLinkModel) {
2098
+ super(), this._context = _context, this._hyperLinkModel = _hyperLinkModel, this._initSkeletonChange();
2305
2099
  }
2306
- }, __name(_a11, "SheetHyperLinkUrlController"), _a11);
2307
- SheetHyperLinkUrlController = __decorateClass$3([
2308
- OnLifecycle(LifecycleStages.Rendered, SheetHyperLinkUrlController),
2309
- __decorateParam$3(0, Inject(SheetsHyperLinkResolverService))
2310
- ], SheetHyperLinkUrlController);
2311
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2312
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2313
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2314
- return kind && result && __defProp$2(target, key, result), result;
2315
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a12;
2316
- let SheetsHyperLinkPermissionController = (_a12 = class extends Disposable {
2317
- constructor(_localeService, _commandService, _sheetPermissionInterceptorBaseController) {
2318
- super(), this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
2100
+ _initSkeletonChange() {
2101
+ const markSkeletonDirty = /* @__PURE__ */ __name(() => {
2102
+ var _a15;
2103
+ (_a15 = this._context.mainComponent) == null || _a15.makeForceDirty();
2104
+ }, "markSkeletonDirty");
2105
+ this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(debounceTime(16)).subscribe(() => {
2106
+ markSkeletonDirty();
2107
+ }));
2319
2108
  }
2320
- _commandExecutedListener() {
2109
+ }, __name(_a8, "SheetsHyperLinkRenderController"), _a8);
2110
+ SheetsHyperLinkRenderController = __decorateClass$5([
2111
+ __decorateParam$5(1, Inject(HyperLinkModel))
2112
+ ], SheetsHyperLinkRenderController);
2113
+ var _a9;
2114
+ let SheetsHyperLinkRenderManagerController = (_a9 = class extends Disposable {
2115
+ constructor(_sheetInterceptorService, _hyperLinkModel) {
2116
+ super(), this._sheetInterceptorService = _sheetInterceptorService, this._hyperLinkModel = _hyperLinkModel, this._initViewModelIntercept();
2117
+ }
2118
+ _initViewModelIntercept() {
2321
2119
  this.disposeWithMe(
2322
- this._commandService.beforeCommandExecuted((command) => {
2323
- command.id === InsertLinkShortcut.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
2324
- workbookTypes: [WorkbookEditablePermission],
2325
- rangeTypes: [RangeProtectionPermissionEditPoint],
2326
- worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission]
2327
- }) || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")));
2328
- })
2120
+ this._sheetInterceptorService.intercept(
2121
+ INTERCEPTOR_POINT.CELL_CONTENT,
2122
+ {
2123
+ effect: InterceptorEffectEnum.Value,
2124
+ priority: 100,
2125
+ handler: /* @__PURE__ */ __name((cell, pos, next) => {
2126
+ const { row, col, unitId, subUnitId } = pos, link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
2127
+ return next(link ? {
2128
+ ...cell,
2129
+ linkUrl: link.payload,
2130
+ linkId: link.id
2131
+ } : cell);
2132
+ }, "handler")
2133
+ }
2134
+ )
2329
2135
  );
2330
2136
  }
2331
- }, __name(_a12, "SheetsHyperLinkPermissionController"), _a12);
2332
- SheetsHyperLinkPermissionController = __decorateClass$2([
2333
- OnLifecycle(LifecycleStages.Rendered, SheetsHyperLinkPermissionController),
2334
- __decorateParam$2(0, Inject(LocaleService)),
2335
- __decorateParam$2(1, ICommandService),
2336
- __decorateParam$2(2, Inject(SheetPermissionInterceptorBaseController))
2337
- ], SheetsHyperLinkPermissionController);
2338
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2339
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2137
+ }, __name(_a9, "SheetsHyperLinkRenderManagerController"), _a9);
2138
+ SheetsHyperLinkRenderManagerController = __decorateClass$5([
2139
+ __decorateParam$5(0, Inject(SheetInterceptorService)),
2140
+ __decorateParam$5(1, Inject(HyperLinkModel))
2141
+ ], SheetsHyperLinkRenderManagerController);
2142
+ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2143
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2340
2144
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2341
- return kind && result && __defProp$1(target, key, result), result;
2342
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a13;
2343
- let SheetsHyperLinkRichTextRefRangeController = (_a13 = class extends Disposable {
2145
+ return kind && result && __defProp$4(target, key, result), result;
2146
+ }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a10;
2147
+ let SheetsHyperLinkRichTextRefRangeController = (_a10 = class extends Disposable {
2344
2148
  constructor(_commandService, _univerInstanceService, _refRangeService) {
2345
2149
  super();
2346
2150
  __publicField(this, "_refRangeMap", /* @__PURE__ */ new Map());
@@ -2485,21 +2289,256 @@ let SheetsHyperLinkRichTextRefRangeController = (_a13 = class extends Disposable
2485
2289
  })
2486
2290
  );
2487
2291
  }
2488
- }, __name(_a13, "SheetsHyperLinkRichTextRefRangeController"), _a13);
2489
- SheetsHyperLinkRichTextRefRangeController = __decorateClass$1([
2490
- OnLifecycle(LifecycleStages.Starting, SheetsHyperLinkRichTextRefRangeController),
2491
- __decorateParam$1(0, ICommandService),
2492
- __decorateParam$1(1, IUniverInstanceService),
2493
- __decorateParam$1(2, Inject(RefRangeService))
2292
+ }, __name(_a10, "SheetsHyperLinkRichTextRefRangeController"), _a10);
2293
+ SheetsHyperLinkRichTextRefRangeController = __decorateClass$4([
2294
+ __decorateParam$4(0, ICommandService),
2295
+ __decorateParam$4(1, IUniverInstanceService),
2296
+ __decorateParam$4(2, Inject(RefRangeService))
2494
2297
  ], SheetsHyperLinkRichTextRefRangeController);
2298
+ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2299
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2300
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2301
+ return kind && result && __defProp$3(target, key, result), result;
2302
+ }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a11;
2303
+ let SheetHyperLinkSetRangeController = (_a11 = class extends Disposable {
2304
+ constructor(_sheetInterceptorService, _hyperLinkModel, _selectionManagerService, _univerInstanceService, _editorBridgeService, _renderManagerService) {
2305
+ super(), this._sheetInterceptorService = _sheetInterceptorService, this._hyperLinkModel = _hyperLinkModel, this._selectionManagerService = _selectionManagerService, this._univerInstanceService = _univerInstanceService, this._editorBridgeService = _editorBridgeService, this._renderManagerService = _renderManagerService, this._initCommandInterceptor(), this._initAfterEditor();
2306
+ }
2307
+ _initCommandInterceptor() {
2308
+ this._initSetRangeValuesCommandInterceptor(), this._initClearSelectionCommandInterceptor();
2309
+ }
2310
+ _initSetRangeValuesCommandInterceptor() {
2311
+ this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
2312
+ getMutations: /* @__PURE__ */ __name((command) => {
2313
+ if (command.id === SetRangeValuesCommand.id) {
2314
+ const params = command.params, { unitId, subUnitId } = params, redos = [], undos = [];
2315
+ return params.cellValue && new ObjectMatrix(params.cellValue).forValue((row, col) => {
2316
+ const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
2317
+ link && (redos.push({
2318
+ id: RemoveHyperLinkMutation.id,
2319
+ params: {
2320
+ unitId,
2321
+ subUnitId,
2322
+ id: link.id
2323
+ }
2324
+ }), undos.push({
2325
+ id: AddHyperLinkMutation.id,
2326
+ params: {
2327
+ unitId,
2328
+ subUnitId,
2329
+ link
2330
+ }
2331
+ }));
2332
+ }), {
2333
+ undos,
2334
+ redos
2335
+ };
2336
+ }
2337
+ return {
2338
+ redos: [],
2339
+ undos: []
2340
+ };
2341
+ }, "getMutations")
2342
+ }));
2343
+ }
2344
+ _initClearSelectionCommandInterceptor() {
2345
+ this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
2346
+ getMutations: /* @__PURE__ */ __name((command) => {
2347
+ if (command.id === ClearSelectionContentCommand.id || command.id === ClearSelectionAllCommand.id || command.id === ClearSelectionFormatCommand.id) {
2348
+ const redos = [], undos = [], selection = this._selectionManagerService.getCurrentLastSelection(), target = getSheetCommandTarget(this._univerInstanceService);
2349
+ if (selection && target) {
2350
+ const { unitId, subUnitId } = target;
2351
+ Range.foreach(selection.range, (row, col) => {
2352
+ const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
2353
+ link && (redos.push({
2354
+ id: RemoveHyperLinkMutation.id,
2355
+ params: {
2356
+ unitId,
2357
+ subUnitId,
2358
+ id: link.id
2359
+ }
2360
+ }), undos.push({
2361
+ id: AddHyperLinkMutation.id,
2362
+ params: {
2363
+ unitId,
2364
+ subUnitId,
2365
+ link
2366
+ }
2367
+ }));
2368
+ });
2369
+ }
2370
+ return {
2371
+ redos,
2372
+ undos
2373
+ };
2374
+ }
2375
+ return {
2376
+ redos: [],
2377
+ undos: []
2378
+ };
2379
+ }, "getMutations")
2380
+ }));
2381
+ }
2382
+ _initAfterEditor() {
2383
+ this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT, {
2384
+ handler: /* @__PURE__ */ __name((cell, context, next) => {
2385
+ if (!cell || cell.p)
2386
+ return next(cell);
2387
+ if (typeof cell.v == "string" && Tools.isLegalUrl(cell.v) && cell.v[cell.v.length - 1] !== " ") {
2388
+ const { unitId, subUnitId } = context, renderer = this._renderManagerService.getRenderById(unitId), skeleton = renderer == null ? void 0 : renderer.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
2389
+ if (!skeleton)
2390
+ return next(cell);
2391
+ const doc = skeleton.skeleton.getBlankCellDocumentModel(cell);
2392
+ if (!doc.documentModel)
2393
+ return next(cell);
2394
+ const textX = BuildTextUtils.selection.replace({
2395
+ selection: {
2396
+ startOffset: 0,
2397
+ endOffset: cell.v.length,
2398
+ collapsed: !1
2399
+ },
2400
+ body: {
2401
+ dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${cell.v}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
2402
+ customRanges: [{
2403
+ startIndex: 0,
2404
+ endIndex: cell.v.length + 1,
2405
+ rangeId: generateRandomId(),
2406
+ rangeType: CustomRangeType.HYPERLINK,
2407
+ properties: {
2408
+ url: cell.v
2409
+ }
2410
+ }]
2411
+ },
2412
+ doc: doc.documentModel
2413
+ });
2414
+ if (!textX)
2415
+ return next(cell);
2416
+ const body = doc.documentModel.getBody();
2417
+ return TextX.apply(body, textX.serialize()), next({
2418
+ ...cell,
2419
+ p: {
2420
+ id: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
2421
+ body,
2422
+ documentStyle: {
2423
+ pageSize: {
2424
+ width: 1 / 0,
2425
+ height: 1 / 0
2426
+ }
2427
+ }
2428
+ }
2429
+ });
2430
+ }
2431
+ return next(cell);
2432
+ }, "handler")
2433
+ }));
2434
+ }
2435
+ }, __name(_a11, "SheetHyperLinkSetRangeController"), _a11);
2436
+ SheetHyperLinkSetRangeController = __decorateClass$3([
2437
+ __decorateParam$3(0, Inject(SheetInterceptorService)),
2438
+ __decorateParam$3(1, Inject(HyperLinkModel)),
2439
+ __decorateParam$3(2, Inject(SheetsSelectionsService)),
2440
+ __decorateParam$3(3, IUniverInstanceService),
2441
+ __decorateParam$3(4, IEditorBridgeService),
2442
+ __decorateParam$3(5, IRenderManagerService)
2443
+ ], SheetHyperLinkSetRangeController);
2444
+ const menuSchema = {
2445
+ [RibbonStartGroup.OTHERS]: {
2446
+ [InsertHyperLinkToolbarOperation.id]: {
2447
+ order: 2,
2448
+ menuItemFactory: insertLinkMenuToolbarFactory
2449
+ },
2450
+ [genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]: {
2451
+ order: 2,
2452
+ menuItemFactory: zenEditorInsertLinkMenuToolbarFactory
2453
+ }
2454
+ },
2455
+ [ContextMenuPosition.MAIN_AREA]: {
2456
+ [ContextMenuGroup.OTHERS]: {
2457
+ order: 1,
2458
+ [InsertHyperLinkToolbarOperation.id]: {
2459
+ order: 0,
2460
+ menuItemFactory: insertLinkMenuFactory
2461
+ },
2462
+ [genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]: {
2463
+ order: 0,
2464
+ menuItemFactory: zenEditorInsertLinkMenuFactory
2465
+ }
2466
+ }
2467
+ }
2468
+ };
2469
+ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2470
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2471
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2472
+ return kind && result && __defProp$2(target, key, result), result;
2473
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a12;
2474
+ let SheetsHyperLinkUIController = (_a12 = class extends Disposable {
2475
+ constructor(_componentManager, _commandService, _menuManagerService, _injector, _shortcutService) {
2476
+ super(), this._componentManager = _componentManager, this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._injector = _injector, this._shortcutService = _shortcutService, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortCut();
2477
+ }
2478
+ _initComponents() {
2479
+ [
2480
+ [CellLinkPopup, CellLinkPopup.componentKey],
2481
+ [CellLinkEdit, CellLinkEdit.componentKey],
2482
+ [LinkSingle, "LinkSingle"]
2483
+ ].forEach(([comp, key]) => {
2484
+ this._componentManager.register(key, comp);
2485
+ });
2486
+ }
2487
+ _initCommands() {
2488
+ [
2489
+ OpenHyperLinkEditPanelOperation,
2490
+ CloseHyperLinkPopupOperation,
2491
+ InsertHyperLinkOperation,
2492
+ InsertHyperLinkToolbarOperation,
2493
+ AddHyperLinkCommand,
2494
+ UpdateHyperLinkCommand,
2495
+ CancelHyperLinkCommand,
2496
+ UpdateRichHyperLinkCommand,
2497
+ CancelRichHyperLinkCommand,
2498
+ AddRichHyperLinkCommand
2499
+ ].forEach((command) => {
2500
+ this._commandService.registerCommand(command);
2501
+ });
2502
+ }
2503
+ _initMenus() {
2504
+ this._menuManagerService.mergeMenu(menuSchema);
2505
+ }
2506
+ _initShortCut() {
2507
+ this._shortcutService.registerShortcut(InsertLinkShortcut);
2508
+ }
2509
+ }, __name(_a12, "SheetsHyperLinkUIController"), _a12);
2510
+ SheetsHyperLinkUIController = __decorateClass$2([
2511
+ __decorateParam$2(0, Inject(ComponentManager)),
2512
+ __decorateParam$2(1, ICommandService),
2513
+ __decorateParam$2(2, IMenuManagerService),
2514
+ __decorateParam$2(3, Inject(Injector)),
2515
+ __decorateParam$2(4, Inject(IShortcutService))
2516
+ ], SheetsHyperLinkUIController);
2517
+ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2518
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2519
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2520
+ return kind && result && __defProp$1(target, key, result), result;
2521
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a13;
2522
+ let SheetHyperLinkUrlController = (_a13 = class extends Disposable {
2523
+ constructor(_resolverService) {
2524
+ super(), this._resolverService = _resolverService, this._handleInitUrl();
2525
+ }
2526
+ _handleInitUrl() {
2527
+ const hash = location.hash;
2528
+ hash && this._resolverService.parseHyperLink(hash).handler();
2529
+ }
2530
+ }, __name(_a13, "SheetHyperLinkUrlController"), _a13);
2531
+ SheetHyperLinkUrlController = __decorateClass$1([
2532
+ __decorateParam$1(0, Inject(SheetsHyperLinkResolverService))
2533
+ ], SheetHyperLinkUrlController);
2495
2534
  var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2496
2535
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2497
2536
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2498
2537
  return kind && result && __defProp2(target, key, result), result;
2499
2538
  }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a14;
2500
2539
  let UniverSheetsHyperLinkUIPlugin = (_a14 = class extends Plugin {
2501
- constructor(_config = defaultPluginConfig, _injector, _renderManagerService, _configService) {
2502
- super(), this._config = _config, this._injector = _injector, this._renderManagerService = _renderManagerService, this._configService = _configService;
2540
+ constructor(_config = defaultPluginConfig, _injector, _configService) {
2541
+ super(), this._config = _config, this._injector = _injector, this._configService = _configService;
2503
2542
  const { menu, ...rest } = this._config;
2504
2543
  menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
2505
2544
  }
@@ -2518,12 +2557,13 @@ let UniverSheetsHyperLinkUIPlugin = (_a14 = class extends Plugin {
2518
2557
  [SheetsHyperLinkPermissionController],
2519
2558
  [SheetHyperLinkUrlController],
2520
2559
  [SheetsHyperLinkRichTextRefRangeController]
2521
- ].forEach((dep) => this._injector.add(dep));
2560
+ ].forEach((dep) => this._injector.add(dep)), this._injector.get(SheetsHyperLinkRenderManagerController), this._injector.get(SheetsHyperLinkRichTextRefRangeController), this._injector.get(SheetHyperLinkSetRangeController);
2522
2561
  }
2523
2562
  onReady() {
2524
- [
2525
- [SheetsHyperLinkRenderController]
2526
- ].forEach((d) => this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, d));
2563
+ this._injector.get(IRenderManagerService).registerRenderModule(UniverInstanceType.UNIVER_SHEET, [SheetsHyperLinkRenderController]), this._injector.get(SheetsHyperLinkAutoFillController), this._injector.get(SheetsHyperLinkCopyPasteController), this._injector.get(SheetsHyperLinkRemoveSheetController), this._injector.get(SheetsHyperLinkUIController);
2564
+ }
2565
+ onRendered() {
2566
+ this._injector.get(SheetsHyperLinkPermissionController), this._injector.get(SheetHyperLinkUrlController), this._injector.get(SheetsHyperLinkPopupController);
2527
2567
  }
2528
2568
  }, __name(_a14, "UniverSheetsHyperLinkUIPlugin"), _a14);
2529
2569
  __publicField2(UniverSheetsHyperLinkUIPlugin, "pluginName", SHEET_HYPER_LINK_UI_PLUGIN);
@@ -2531,8 +2571,7 @@ __publicField2(UniverSheetsHyperLinkUIPlugin, "type", UniverInstanceType.UNIVER_
2531
2571
  UniverSheetsHyperLinkUIPlugin = __decorateClass([
2532
2572
  DependentOn(UniverSheetsHyperLinkPlugin, UniverDocsUIPlugin),
2533
2573
  __decorateParam(1, Inject(Injector)),
2534
- __decorateParam(2, IRenderManagerService),
2535
- __decorateParam(3, IConfigService)
2574
+ __decorateParam(2, IConfigService)
2536
2575
  ], UniverSheetsHyperLinkUIPlugin);
2537
2576
  export {
2538
2577
  AddHyperLinkCommand,