@univerjs/sheets-hyper-link 0.5.3 → 0.5.4-nightly.202501131606

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
@@ -1,17 +1,17 @@
1
1
  var Ae = Object.defineProperty;
2
2
  var We = (s, e, t) => e in s ? Ae(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
3
  var w = (s, e, t) => We(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { Disposable as V, ObjectMatrix as q, UniverInstanceType as I, IUniverInstanceService as E, CommandType as L, CustomRangeType as b, Inject as M, ICommandService as P, sequenceExecuteAsync as ve, isValidRange as Re, toDisposable as Be, DisposableCollection as je, Rectangle as Fe, Range as Ke, Tools as oe, BuildTextUtils as Z, generateRandomId as de, TextX as ce, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ye, IResourceManagerService as Ge, IUndoRedoService as Se, CellValueType as Ie, sequenceExecute as ze, getBodySlice as Ne, LocaleService as Je, DependentOn as Xe, Injector as qe, Plugin as Ze, merge as Qe, registerDependencies as et, touchDependencies as tt, IConfigService as nt } from "@univerjs/core";
4
+ import { Disposable as V, ObjectMatrix as q, UniverInstanceType as v, IUniverInstanceService as E, CommandType as L, CustomRangeType as b, Inject as M, ICommandService as P, sequenceExecuteAsync as Re, isValidRange as Se, toDisposable as Be, DisposableCollection as je, Rectangle as Fe, Range as Ke, Tools as oe, BuildTextUtils as Z, generateRandomId as de, TextX as ce, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ye, IResourceManagerService as Ge, IUndoRedoService as Ie, CellValueType as ve, sequenceExecute as ze, getBodySlice as Ne, LocaleService as Je, DependentOn as Xe, Injector as qe, Plugin as Ze, merge as Qe, registerDependencies as et, touchDependencies as tt, IConfigService as nt } from "@univerjs/core";
5
5
  import { Subject as rt } from "rxjs";
6
6
  import { getSheetCommandTarget as j, RefRangeService as Oe, SheetsSelectionsService as ke, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests as st, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests as it, SheetInterceptorService as le, RemoveSheetCommand as at, handleDefaultRangeChangeWithEffectRefCommands as ot, SetRangeValuesMutation as H, SetRangeValuesCommand as dt, ClearSelectionContentCommand as ct, ClearSelectionAllCommand as lt, ClearSelectionFormatCommand as ut, AFTER_CELL_EDIT as pt, SetRangeValuesUndoMutationFactory as Me, UniverSheetsPlugin as ht } from "@univerjs/sheets";
7
7
  import { deserializeRangeWithSheet as Ce, serializeRange as B, serializeRangeWithSheet as gt, IDefinedNamesService as ft } from "@univerjs/engine-formula";
8
8
  import { addCustomRangeBySelectionFactory as _t, deleteCustomRangeFactory as mt, replaceSelectionFactory as De } from "@univerjs/docs";
9
- var yt = Object.defineProperty, vt = Object.getOwnPropertyDescriptor, Rt = (s, e, t, n) => {
10
- for (var r = n > 1 ? void 0 : n ? vt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
9
+ var yt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, St = (s, e, t, n) => {
10
+ for (var r = n > 1 ? void 0 : n ? Rt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
11
11
  (a = s[i]) && (r = (n ? a(e, t, r) : a(r)) || r);
12
12
  return n && r && yt(e, t, r), r;
13
- }, St = (s, e) => (t, n) => e(t, n, s);
14
- let S = class extends V {
13
+ }, It = (s, e) => (t, n) => e(t, n, s);
14
+ let I = class extends V {
15
15
  constructor(e) {
16
16
  super();
17
17
  w(this, "_linkUpdate$", new rt());
@@ -101,7 +101,7 @@ let S = class extends V {
101
101
  }
102
102
  getHyperLinkByLocationSync(e, t, n, r) {
103
103
  var l, u, h, g, p;
104
- const { matrix: i } = this._ensureMap(e, t), a = this._univerInstanceService.getUnit(e, I.UNIVER_SHEET), o = (l = a == null ? void 0 : a.getSheetBySheetId(t)) == null ? void 0 : l.getCellRaw(n, r), c = ((p = (g = o == null ? void 0 : o.v) != null ? g : (h = (u = o == null ? void 0 : o.p) == null ? void 0 : u.body) == null ? void 0 : h.dataStream.slice(0, -2)) != null ? p : "").toString(), d = i.getValue(n, r);
104
+ const { matrix: i } = this._ensureMap(e, t), a = this._univerInstanceService.getUnit(e, v.UNIVER_SHEET), o = (l = a == null ? void 0 : a.getSheetBySheetId(t)) == null ? void 0 : l.getCellRaw(n, r), c = ((p = (g = o == null ? void 0 : o.v) != null ? g : (h = (u = o == null ? void 0 : o.p) == null ? void 0 : u.body) == null ? void 0 : h.dataStream.slice(0, -2)) != null ? p : "").toString(), d = i.getValue(n, r);
105
105
  if (d)
106
106
  return {
107
107
  ...d,
@@ -137,17 +137,17 @@ let S = class extends V {
137
137
  return Array.from(this._linkMap.keys()).map((t) => this.getUnit(t));
138
138
  }
139
139
  };
140
- S = Rt([
141
- St(0, E)
142
- ], S);
140
+ I = St([
141
+ It(0, E)
142
+ ], I);
143
143
  var U = /* @__PURE__ */ ((s) => (s.SHEET = "gid", s.RANGE = "range", s.DEFINE_NAME = "rangeid", s.INVALID = "invalid", s.URL = "url", s))(U || {});
144
- const It = "sheets-hyper-link.config", Ue = {}, O = {
144
+ const vt = "sheets-hyper-link.config", Ue = {}, O = {
145
145
  type: L.MUTATION,
146
146
  id: "sheets.mutation.add-hyper-link",
147
147
  handler(s, e) {
148
148
  if (!e)
149
149
  return !1;
150
- const t = s.get(S), { unitId: n, subUnitId: r, link: i } = e;
150
+ const t = s.get(I), { unitId: n, subUnitId: r, link: i } = e;
151
151
  return t.addHyperLink(n, r, i);
152
152
  }
153
153
  }, k = {
@@ -156,7 +156,7 @@ const It = "sheets-hyper-link.config", Ue = {}, O = {
156
156
  handler(s, e) {
157
157
  if (!e)
158
158
  return !1;
159
- const t = s.get(S), { unitId: n, subUnitId: r, id: i } = e;
159
+ const t = s.get(I), { unitId: n, subUnitId: r, id: i } = e;
160
160
  return t.removeHyperLink(n, r, i);
161
161
  }
162
162
  }, _e = {
@@ -165,7 +165,7 @@ const It = "sheets-hyper-link.config", Ue = {}, O = {
165
165
  handler(s, e) {
166
166
  if (!e)
167
167
  return !1;
168
- const t = s.get(S), { unitId: n, subUnitId: r, payload: i, id: a } = e;
168
+ const t = s.get(I), { unitId: n, subUnitId: r, payload: i, id: a } = e;
169
169
  return t.updateHyperLink(n, r, a, i, !1);
170
170
  }
171
171
  }, me = {
@@ -174,7 +174,7 @@ const It = "sheets-hyper-link.config", Ue = {}, O = {
174
174
  handler(s, e) {
175
175
  if (!e)
176
176
  return !1;
177
- const t = s.get(S), { unitId: n, subUnitId: r, id: i, row: a, column: o, silent: c } = e;
177
+ const t = s.get(I), { unitId: n, subUnitId: r, id: i, row: a, column: o, silent: c } = e;
178
178
  return t.updateHyperLinkRef(n, r, i, { row: a, column: o }, c);
179
179
  }
180
180
  }, X = {
@@ -280,7 +280,7 @@ let ee = class extends V {
280
280
  r,
281
281
  this._refRangeService.watchRange(e, t, i, (a, o) => {
282
282
  const { redos: c } = this._handlePositionChange(e, t, n, o, !0);
283
- ve(c, this._commandService, { onlyLocal: !0 });
283
+ Re(c, this._commandService, { onlyLocal: !0 });
284
284
  }, !0)
285
285
  );
286
286
  }
@@ -302,7 +302,7 @@ let ee = class extends V {
302
302
  };
303
303
  if (d.range && d.gid) {
304
304
  const l = d.gid, u = Ce(d.range).range;
305
- if (Re(u) && d.range !== Q) {
305
+ if (Se(u) && d.range !== Q) {
306
306
  const h = (g) => {
307
307
  const p = it(u, g, { selectionManagerService: this._selectionManagerService });
308
308
  return p && B(p) === B(u) ? {
@@ -404,7 +404,7 @@ let ee = class extends V {
404
404
  };
405
405
  ee = wt([
406
406
  z(0, M(Oe)),
407
- z(1, M(S)),
407
+ z(1, M(I)),
408
408
  z(2, M(ke)),
409
409
  z(3, P)
410
410
  ], ee);
@@ -423,7 +423,7 @@ let te = class extends V {
423
423
  getMutations: (s) => {
424
424
  var e;
425
425
  if (s.id === at.id) {
426
- const t = s.params, n = t.unitId ? this._univerInstanceService.getUnit(t.unitId) : this._univerInstanceService.getCurrentUnitForType(I.UNIVER_SHEET);
426
+ const t = s.params, n = t.unitId ? this._univerInstanceService.getUnit(t.unitId) : this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET);
427
427
  if (!n)
428
428
  return { redos: [], undos: [] };
429
429
  const r = n.getUnitId(), i = t.subUnitId || ((e = n.getActiveSheet()) == null ? void 0 : e.getSheetId());
@@ -455,7 +455,7 @@ let te = class extends V {
455
455
  te = Ut([
456
456
  he(0, M(le)),
457
457
  he(1, E),
458
- he(2, M(S))
458
+ he(2, M(I))
459
459
  ], te);
460
460
  var bt = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, Nt = (s, e, t, n) => {
461
461
  for (var r = n > 1 ? void 0 : n ? Pt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
@@ -476,7 +476,7 @@ let ne = class extends V {
476
476
  }
477
477
  _isLegalRangeUrl(e, t) {
478
478
  var r, i, a;
479
- const n = this._univerInstanceService.getUnit(e, I.UNIVER_SHEET);
479
+ const n = this._univerInstanceService.getUnit(e, v.UNIVER_SHEET);
480
480
  if (!n)
481
481
  return null;
482
482
  if (t && t.startsWith("#")) {
@@ -490,7 +490,7 @@ let ne = class extends V {
490
490
  if (!l)
491
491
  return null;
492
492
  const u = Ce(c.range).range;
493
- if (Re(u, l) && c.range !== Q)
493
+ if (Se(u, l) && c.range !== Q)
494
494
  return {
495
495
  range: u,
496
496
  worksheet: l
@@ -518,8 +518,8 @@ let ne = class extends V {
518
518
  this._refRangeService.registerRefRange(
519
519
  m,
520
520
  (y) => {
521
- const v = ot(m, y);
522
- return v && Fe.equals(v, m) ? {
521
+ const R = ot(m, y);
522
+ return R && Fe.equals(R, m) ? {
523
523
  preRedos: [],
524
524
  preUndos: [],
525
525
  redos: [],
@@ -533,7 +533,7 @@ let ne = class extends V {
533
533
  row: n,
534
534
  col: r,
535
535
  id: g.rangeId,
536
- url: `#gid=${t}&range=${v ? B(v) : Q}`
536
+ url: `#gid=${t}&range=${R ? B(R) : Q}`
537
537
  }
538
538
  }],
539
539
  undos: [{
@@ -570,17 +570,17 @@ let ne = class extends V {
570
570
  });
571
571
  });
572
572
  };
573
- this._univerInstanceService.getAllUnitsForType(I.UNIVER_SHEET).forEach((t) => {
573
+ this._univerInstanceService.getAllUnitsForType(v.UNIVER_SHEET).forEach((t) => {
574
574
  e(t);
575
575
  }), this.disposeWithMe(
576
576
  this._univerInstanceService.unitAdded$.subscribe((t) => {
577
- t.type === I.UNIVER_SHEET && e(t);
577
+ t.type === v.UNIVER_SHEET && e(t);
578
578
  })
579
579
  );
580
580
  }
581
581
  _initWorkbookUnload() {
582
582
  this._univerInstanceService.unitDisposed$.subscribe((e) => {
583
- if (e.type === I.UNIVER_SHEET) {
583
+ if (e.type === v.UNIVER_SHEET) {
584
584
  const t = e, n = t.getUnitId();
585
585
  t.getSheets().forEach((r) => {
586
586
  const i = r.getSheetId();
@@ -710,7 +710,7 @@ let re = class extends V {
710
710
  if (!s || s.p)
711
711
  return t(s);
712
712
  if (typeof s.v == "string" && oe.isLegalUrl(s.v) && s.v[s.v.length - 1] !== " ") {
713
- const { unitId: n, subUnitId: r } = e, i = this._univerInstanceService.getUnit(n, I.UNIVER_SHEET), a = i == null ? void 0 : i.getSheetBySheetId(r);
713
+ const { unitId: n, subUnitId: r } = e, i = this._univerInstanceService.getUnit(n, v.UNIVER_SHEET), a = i == null ? void 0 : i.getSheetBySheetId(r);
714
714
  if (!a)
715
715
  return t(s);
716
716
  const o = a.getBlankCellDocumentModel(s);
@@ -760,7 +760,7 @@ let re = class extends V {
760
760
  };
761
761
  re = Dt([
762
762
  J(0, M(le)),
763
- J(1, M(S)),
763
+ J(1, M(I)),
764
764
  J(2, M(ke)),
765
765
  J(3, E)
766
766
  ], re);
@@ -810,7 +810,7 @@ let se = class extends V {
810
810
  };
811
811
  se = $t([
812
812
  be(0, Ge),
813
- be(1, M(S))
813
+ be(1, M(I))
814
814
  ], se);
815
815
  const xt = {
816
816
  type: L.COMMAND,
@@ -818,16 +818,16 @@ const xt = {
818
818
  // eslint-disable-next-line max-lines-per-function
819
819
  async handler(s, e) {
820
820
  if (!e) return !1;
821
- const t = s.get(P), n = s.get(Se), r = s.get(E), i = s.get(S), a = s.get(le), o = j(r, e);
821
+ const t = s.get(P), n = s.get(Ie), r = s.get(E), i = s.get(I), a = s.get(le), o = j(r, e);
822
822
  if (!o) return !1;
823
- const { unitId: c, subUnitId: d, workbook: l, worksheet: u } = o, { link: h } = e, { payload: g, display: p, row: f, column: _, id: m } = h, C = u.getCell(f, _), y = u.getBlankCellDocumentModel(C), v = y.documentModel.getSnapshot(), R = oe.deepClone(v.body);
824
- if (!R) return !1;
823
+ const { unitId: c, subUnitId: d, workbook: l, worksheet: u } = o, { link: h } = e, { payload: g, display: p, row: f, column: _, id: m } = h, C = u.getCell(f, _), y = u.getBlankCellDocumentModel(C), R = y.documentModel.getSnapshot(), S = oe.deepClone(R.body);
824
+ if (!S) return !1;
825
825
  let N;
826
826
  if (p ? N = Z.selection.replace({
827
827
  selection: {
828
828
  startOffset: 0,
829
- endOffset: R.dataStream.length - 2,
830
- collapsed: R.dataStream.length - 2 === 0
829
+ endOffset: S.dataStream.length - 2,
830
+ collapsed: S.dataStream.length - 2 === 0
831
831
  },
832
832
  body: {
833
833
  dataStream: `${p}`,
@@ -844,8 +844,8 @@ const xt = {
844
844
  },
845
845
  doc: y.documentModel
846
846
  }) : N = Z.customRange.add({
847
- body: R,
848
- ranges: [{ startOffset: 0, endOffset: R.dataStream.length - 2, collapsed: !1 }],
847
+ body: S,
848
+ ranges: [{ startOffset: 0, endOffset: S.dataStream.length - 2, collapsed: !1 }],
849
849
  rangeId: m,
850
850
  rangeType: b.HYPERLINK,
851
851
  properties: {
@@ -853,12 +853,12 @@ const xt = {
853
853
  refId: m
854
854
  }
855
855
  }), !N) return !1;
856
- const F = ce.apply(R, N.serialize()), D = {
856
+ const F = ce.apply(S, N.serialize()), D = {
857
857
  p: {
858
- ...v,
858
+ ...R,
859
859
  body: F
860
860
  },
861
- t: Ie.STRING
861
+ t: ve.STRING
862
862
  }, x = await a.onWriteCell(l, u, f, _, D), T = {
863
863
  unitId: c,
864
864
  subUnitId: d,
@@ -888,7 +888,7 @@ const xt = {
888
888
  subUnitId: d,
889
889
  link: W
890
890
  }
891
- })), await ve(K, t) ? (n.pushUndoRedo({
891
+ })), await Re(K, t) ? (n.pushUndoRedo({
892
892
  redoMutations: K,
893
893
  undoMutations: A,
894
894
  unitID: c
@@ -918,7 +918,7 @@ const xt = {
918
918
  handler(s, e) {
919
919
  var D, x;
920
920
  if (!e) return !1;
921
- const t = s.get(P), n = s.get(Se), r = s.get(E), i = s.get(S), a = j(r, e);
921
+ const t = s.get(P), n = s.get(Ie), r = s.get(E), i = s.get(I), a = j(r, e);
922
922
  if (!a) return !1;
923
923
  const { row: o, column: c, id: d } = e, { unitId: l, subUnitId: u, worksheet: h } = a, g = h.getCell(o, c);
924
924
  if (!g) return !1;
@@ -926,9 +926,9 @@ const xt = {
926
926
  if (!(p != null && p.documentModel)) return !1;
927
927
  const f = oe.deepClone(p.documentModel.getSnapshot()), _ = (x = (D = f.body) == null ? void 0 : D.customRanges) == null ? void 0 : x.find((T) => `${T.rangeId}` === d);
928
928
  if (!_) return !1;
929
- const m = Z.customRange.delete(s, { documentDataModel: p.documentModel, rangeId: _.rangeId });
929
+ const m = Z.customRange.delete({ documentDataModel: p.documentModel, rangeId: _.rangeId });
930
930
  if (!m) return !1;
931
- const C = ce.apply(f.body, m.serialize()), y = [], v = [], R = {
931
+ const C = ce.apply(f.body, m.serialize()), y = [], R = [], S = {
932
932
  unitId: l,
933
933
  subUnitId: u,
934
934
  cellValue: {
@@ -938,17 +938,17 @@ const xt = {
938
938
  ...f,
939
939
  body: C
940
940
  },
941
- t: Ie.STRING
941
+ t: ve.STRING
942
942
  }
943
943
  }
944
944
  }
945
945
  };
946
946
  y.push({
947
947
  id: H.id,
948
- params: R
948
+ params: S
949
949
  });
950
- const N = Me(s, R);
951
- v.push({
950
+ const N = Me(s, S);
951
+ R.push({
952
952
  id: H.id,
953
953
  params: N
954
954
  });
@@ -960,7 +960,7 @@ const xt = {
960
960
  subUnitId: u,
961
961
  id: d
962
962
  }
963
- }), v.push({
963
+ }), R.push({
964
964
  id: O.id,
965
965
  params: {
966
966
  unitId: l,
@@ -971,7 +971,7 @@ const xt = {
971
971
  }
972
972
  })), ze(y, t).result ? (n.pushUndoRedo({
973
973
  redoMutations: y,
974
- undoMutations: v,
974
+ undoMutations: R,
975
975
  unitID: l
976
976
  }), !0) : !1;
977
977
  }
@@ -982,7 +982,7 @@ const xt = {
982
982
  var l, u;
983
983
  if (!e)
984
984
  return !1;
985
- const { id: t, documentId: n } = e, r = s.get(P), a = s.get(E).getUnit(n, I.UNIVER_DOC), o = (u = (l = a == null ? void 0 : a.getBody()) == null ? void 0 : l.customRanges) == null ? void 0 : u.find((h) => h.rangeId === t);
985
+ const { id: t, documentId: n } = e, r = s.get(P), a = s.get(E).getUnit(n, v.UNIVER_DOC), o = (u = (l = a == null ? void 0 : a.getBody()) == null ? void 0 : l.customRanges) == null ? void 0 : u.find((h) => h.rangeId === t);
986
986
  let c = null;
987
987
  o && o.endIndex === a.getBody().dataStream.length - 3 && (c = {
988
988
  dataStream: " "
@@ -997,7 +997,7 @@ const xt = {
997
997
  async handler(s, e) {
998
998
  var we, Ee, Le;
999
999
  if (!e) return !1;
1000
- const t = s.get(P), n = s.get(Se), r = s.get(E), i = s.get(S), a = s.get(le), o = j(r, {
1000
+ const t = s.get(P), n = s.get(Ie), r = s.get(E), i = s.get(I), a = s.get(le), o = j(r, {
1001
1001
  unitId: e.unitId,
1002
1002
  subUnitId: e.subUnitId
1003
1003
  });
@@ -1006,9 +1006,9 @@ const xt = {
1006
1006
  if (!C) return !1;
1007
1007
  const y = g.getCellDocumentModelWithFormula(C);
1008
1008
  if (!(y != null && y.documentModel)) return !1;
1009
- const v = y.documentModel.getSnapshot(), R = (Ee = (we = v.body) == null ? void 0 : we.customRanges) == null ? void 0 : Ee.find((Te) => `${Te.rangeId}` === u);
1010
- if (!R) return !1;
1011
- const N = de(), $ = (Le = Ne(y.documentModel.getBody(), R.startIndex, R.endIndex + 1).textRuns) == null ? void 0 : Le[0];
1009
+ const R = y.documentModel.getSnapshot(), S = (Ee = (we = R.body) == null ? void 0 : we.customRanges) == null ? void 0 : Ee.find((Te) => `${Te.rangeId}` === u);
1010
+ if (!S) return !1;
1011
+ const N = de(), $ = (Le = Ne(y.documentModel.getBody(), S.startIndex, S.endIndex + 1).textRuns) == null ? void 0 : Le[0];
1012
1012
  $ && ($.ed = m.length + 1);
1013
1013
  const D = De(s, {
1014
1014
  unitId: p,
@@ -1026,20 +1026,20 @@ const xt = {
1026
1026
  textRuns: $ ? [$] : void 0
1027
1027
  },
1028
1028
  selection: {
1029
- startOffset: R.startIndex,
1030
- endOffset: R.endIndex + 1,
1029
+ startOffset: S.startIndex,
1030
+ endOffset: S.endIndex + 1,
1031
1031
  collapsed: !1
1032
1032
  },
1033
1033
  doc: y.documentModel
1034
1034
  });
1035
1035
  if (!D)
1036
1036
  return !1;
1037
- const x = ce.apply(oe.deepClone(v.body), D.textX.serialize()), T = {
1037
+ const x = ce.apply(oe.deepClone(R.body), D.textX.serialize()), T = {
1038
1038
  p: {
1039
- ...v,
1039
+ ...R,
1040
1040
  body: x
1041
1041
  },
1042
- t: Ie.STRING
1042
+ t: ve.STRING
1043
1043
  }, ue = await a.onWriteCell(h, g, d, l, T), Y = {
1044
1044
  id: H.id,
1045
1045
  params: {
@@ -1069,7 +1069,7 @@ const xt = {
1069
1069
  subUnitId: f,
1070
1070
  link: G
1071
1071
  }
1072
- })), await ve(A, t) ? (n.pushUndoRedo({
1072
+ })), await Re(A, t) ? (n.pushUndoRedo({
1073
1073
  redoMutations: A,
1074
1074
  undoMutations: W,
1075
1075
  unitID: p
@@ -1082,7 +1082,7 @@ const xt = {
1082
1082
  var p, f, _, m;
1083
1083
  if (!e)
1084
1084
  return !1;
1085
- const { documentId: t, payload: n, id: r } = e, i = s.get(E), a = s.get(P), o = i.getUnit(t, I.UNIVER_DOC);
1085
+ const { documentId: t, payload: n, id: r } = e, i = s.get(E), a = s.get(P), o = i.getUnit(t, v.UNIVER_DOC);
1086
1086
  if (!o)
1087
1087
  return !1;
1088
1088
  const c = (f = (p = o.getBody()) == null ? void 0 : p.customRanges) == null ? void 0 : f.find((C) => C.rangeId === r);
@@ -1182,7 +1182,7 @@ let ye = class {
1182
1182
  }
1183
1183
  _getURLName(s) {
1184
1184
  var d;
1185
- const { gid: e, range: t, rangeid: n, unitid: r } = s, i = r ? this._univerInstanceService.getUnit(r, I.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitForType(I.UNIVER_SHEET), a = {
1185
+ const { gid: e, range: t, rangeid: n, unitid: r } = s, i = r ? this._univerInstanceService.getUnit(r, v.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET), a = {
1186
1186
  type: U.INVALID,
1187
1187
  name: this._localeService.t("hyperLink.message.refError")
1188
1188
  };
@@ -1192,7 +1192,7 @@ let ye = class {
1192
1192
  if (t) {
1193
1193
  if (!o) return a;
1194
1194
  const l = Ce(t).range;
1195
- return Re(l, o) && t !== Q ? {
1195
+ return Se(l, o) && t !== Q ? {
1196
1196
  type: U.RANGE,
1197
1197
  name: gt(c, l)
1198
1198
  } : a;
@@ -1232,11 +1232,11 @@ let ae = class extends Ze {
1232
1232
  Ue,
1233
1233
  this._config
1234
1234
  );
1235
- this._configService.setConfig(It, n);
1235
+ this._configService.setConfig(vt, n);
1236
1236
  }
1237
1237
  onStarting() {
1238
1238
  et(this._injector, [
1239
- [S],
1239
+ [I],
1240
1240
  [ye],
1241
1241
  [se],
1242
1242
  [ie],
@@ -1255,7 +1255,7 @@ let ae = class extends Ze {
1255
1255
  }
1256
1256
  };
1257
1257
  xe(ae, "pluginName", He);
1258
- xe(ae, "type", I.UNIVER_SHEET);
1258
+ xe(ae, "type", v.UNIVER_SHEET);
1259
1259
  ae = Qt([
1260
1260
  Xe(ht),
1261
1261
  Pe(1, M(qe)),
@@ -1268,7 +1268,7 @@ export {
1268
1268
  At as CancelHyperLinkCommand,
1269
1269
  Wt as CancelRichHyperLinkCommand,
1270
1270
  Q as ERROR_RANGE,
1271
- S as HyperLinkModel,
1271
+ I as HyperLinkModel,
1272
1272
  k as RemoveHyperLinkMutation,
1273
1273
  U as SheetHyperLinkType,
1274
1274
  ye as SheetsHyperLinkParserService,
@@ -1,9 +1,9 @@
1
1
  import { ICommand } from '@univerjs/core';
2
- import { ICellHyperLink } from '../../types/interfaces/i-hyper-link';
2
+ import { ISheetHyperLink } from '../../types/interfaces/i-hyper-link';
3
3
  export interface IAddHyperLinkCommandParams {
4
4
  unitId: string;
5
5
  subUnitId: string;
6
- link: ICellHyperLink;
6
+ link: ISheetHyperLink;
7
7
  }
8
8
  /**
9
9
  * Command for add hyperlink
@@ -14,6 +14,6 @@ export interface IAddRichHyperLinkCommandParams {
14
14
  * url of link
15
15
  */
16
16
  documentId: string;
17
- link: ICellHyperLink;
17
+ link: ISheetHyperLink;
18
18
  }
19
19
  export declare const AddRichHyperLinkCommand: ICommand<IAddRichHyperLinkCommandParams>;
@@ -1,8 +1,8 @@
1
1
  import { ICommand } from '@univerjs/core';
2
- import { ICellHyperLink } from '../../types/interfaces/i-hyper-link';
2
+ import { ISheetHyperLink } from '../../types/interfaces/i-hyper-link';
3
3
  export interface IAddHyperLinkMutationParams {
4
4
  unitId: string;
5
5
  subUnitId: string;
6
- link: ICellHyperLink;
6
+ link: ISheetHyperLink;
7
7
  }
8
8
  export declare const AddHyperLinkMutation: ICommand<IAddHyperLinkMutationParams>;
@@ -8,57 +8,50 @@ export interface ICellHyperLink {
8
8
  }
9
9
  export interface IFRangeHyperlinkMixin {
10
10
  /**
11
- * Set hyperlink in the cell in the range.
12
- * [!important] This method is async.
13
- * @param url url
14
- * @param label optional, label of the url
15
- * @returns success or not
11
+ * @deprecated use `range.setRichTextValueForCell(univerAPI.newRichText().insertLink(label, url))` instead
16
12
  */
17
13
  setHyperLink(url: string, label?: string): Promise<boolean>;
18
14
  /**
19
- * Get all hyperlinks in the cell in the range.
20
- * @returns hyperlinks
15
+ * @deprecated use `range.setRichTextValueForCell(range.getRichTextValue().getLinks())` instead
21
16
  */
22
17
  getHyperLinks(): ICellHyperLink[];
23
18
  /**
24
- * Update hyperlink in the cell in the range.
25
- * [!important] This method is async.
26
- * @param id id of the hyperlink
27
- * @param url url
28
- * @param label optional, label of the url
29
- * @returns success or not
19
+ * @deprecated use `range.setRichTextValueForCell(range.getRichTextValue().copy().updateLink(id, url))` instead
30
20
  */
31
21
  updateHyperLink(id: string, url: string, label?: string): Promise<boolean>;
32
22
  /**
33
- * Cancel hyperlink in the cell in the range.
34
- * [!important] This method is async.
35
- * @param id id of the hyperlink
36
- * @returns success or not
23
+ * @deprecated use `range.setRichTextValueForCell(range.getRichTextValue().copy().cancelLink(id))` instead
37
24
  */
38
25
  cancelHyperLink(id: string): boolean;
26
+ /**
27
+ * Get the url of this range.
28
+ */
29
+ getUrl(): string;
39
30
  }
40
31
  export declare class FRangeHyperlinkMixin extends FRange implements IFRangeHyperlinkMixin {
32
+ /**
33
+ * @param url
34
+ * @param label
35
+ * @deprecated
36
+ */
41
37
  setHyperLink(url: string, label?: string): Promise<boolean>;
42
38
  /**
43
- * Get all hyperlinks in the cell in the range.
44
- * @returns hyperlinks
39
+ * @deprecated
45
40
  */
46
41
  getHyperLinks(): ICellHyperLink[];
47
42
  /**
48
- * Update hyperlink in the cell in the range.
49
- * [!important] This method is async.
50
- * @param id id of the hyperlink
51
- * @param url url
52
- * @param label optional, label of the url
53
- * @returns success or not
43
+ * @param id
44
+ * @param url
45
+ * @param label
46
+ * @deprecated
54
47
  */
55
48
  updateHyperLink(id: string, url: string, label?: string): Promise<boolean>;
56
49
  /**
57
- * Cancel hyperlink in the cell in the range.
58
- * @param id id of the hyperlink
59
- * @returns success or not
50
+ * @param id
51
+ * @deprecated
60
52
  */
61
53
  cancelHyperLink(id: string): boolean;
54
+ getUrl(): string;
62
55
  }
63
56
  declare module '@univerjs/sheets/facade' {
64
57
  interface FRange extends IFRangeHyperlinkMixin {
@@ -1,27 +1,34 @@
1
+ import { ISheetHyperLinkInfo, SheetsHyperLinkParserService } from '@univerjs/sheets-hyper-link';
2
+ import { FRange, FWorkbook } from '@univerjs/sheets/facade';
1
3
  import { IRange } from '@univerjs/core';
2
- import { ISheetHyperLinkInfo } from '@univerjs/sheets-hyper-link';
3
- import { FWorkbook } from '@univerjs/sheets/facade';
4
+ export declare class SheetHyperLinkBuilder {
5
+ private _workbook;
6
+ private readonly _parserService;
7
+ constructor(_workbook: FWorkbook, _parserService: SheetsHyperLinkParserService);
8
+ getRangeUrl(range: FRange): this;
9
+ }
4
10
  export interface IFWorkbookHyperlinkMixin {
5
11
  /**
6
- * create a hyperlink for the sheet
7
- * @param sheetId the sheet id to link
8
- * @param range the range to link, or define-name id
9
- * @returns the hyperlink string
12
+ * @deprecated use `getUrl` method in `FRange` or `FWorksheet` instead.
10
13
  */
11
14
  createSheetHyperlink(this: FWorkbook, sheetId: string, range?: string | IRange): string;
12
15
  /**
13
- * parse the hyperlink string to get the hyperlink info
16
+ * Parse the hyperlink string to get the hyperlink info.
14
17
  * @param hyperlink the hyperlink string
15
18
  * @returns the hyperlink info
19
+ * @example
20
+ * ``` ts
21
+ * univerAPI.getActiveWorkbook().parseSheetHyperlink('#gid=sheet_Id&range=F6')
22
+ * ```
16
23
  */
17
24
  parseSheetHyperlink(this: FWorkbook, hyperlink: string): ISheetHyperLinkInfo;
18
25
  }
19
26
  export declare class FWorkbookHyperLinkMixin extends FWorkbook implements IFWorkbookHyperlinkMixin {
20
27
  createSheetHyperlink(sheetId: string, range?: string | IRange): string;
21
28
  /**
22
- * parse the hyperlink string to get the hyperlink info
23
- * @param hyperlink the hyperlink string
24
- * @returns the hyperlink info
29
+ * Parse the hyperlink string to get the hyperlink info.
30
+ * @param {string} hyperlink the hyperlink string
31
+ * @returns {ISheetHyperLinkInfo} the hyperlink info
25
32
  */
26
33
  parseSheetHyperlink(hyperlink: string): ISheetHyperLinkInfo;
27
34
  }
@@ -0,0 +1,14 @@
1
+ import { FWorksheet } from '@univerjs/sheets/facade';
2
+ export interface IFWorksheetHyperlinkMixin {
3
+ /**
4
+ * Get the url of this sheet
5
+ */
6
+ getUrl(): string;
7
+ }
8
+ export declare class FWorksheetHyperlinkMixin extends FWorksheet implements IFWorksheetHyperlinkMixin {
9
+ getUrl(): string;
10
+ }
11
+ declare module '@univerjs/sheets/facade' {
12
+ interface FWorksheet extends IFWorksheetHyperlinkMixin {
13
+ }
14
+ }
@@ -14,7 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import './f-workbook';
17
+ import './f-worksheet';
17
18
  import './f-range';
18
19
  export { FWorkbookHyperLinkMixin } from './f-workbook';
19
20
  export type * from './f-range';
20
21
  export type * from './f-workbook';
22
+ export type * from './f-worksheet';
@@ -16,7 +16,7 @@
16
16
  export { HyperLinkModel } from './models/hyper-link.model';
17
17
  export { SheetHyperLinkType } from './types/enums/hyper-link-type';
18
18
  export { UniverSheetsHyperLinkPlugin } from './plugin';
19
- export type { ICellHyperLink, ICellLinkContent } from './types/interfaces/i-hyper-link';
19
+ export type { ICellLinkContent, ISheetHyperLink } from './types/interfaces/i-hyper-link';
20
20
  export { type ISheetHyperLinkInfo, type ISheetUrlParams, SheetsHyperLinkParserService } from './services/parser.service';
21
21
  export { ERROR_RANGE } from './types/const';
22
22
  export { AddHyperLinkCommand, AddRichHyperLinkCommand, type IAddHyperLinkCommandParams, type IAddRichHyperLinkCommandParams } from './commands/commands/add-hyper-link.command';