123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- import {
- At,
- Bt,
- xt,
- ye
- } from "./chunk-4SXJQ6MB.js";
- import {
- S,
- f,
- m
- } from "./chunk-CLOCSTN3.js";
- import {
- Pt,
- hi,
- ln,
- mn,
- ot,
- pi,
- qt,
- xf
- } from "./chunk-23V3HWTR.js";
- // node_modules/.pnpm/@univerjs+sheets-hyper-link@0.5.5_@grpc+grpc-js@1.13.4_react@18.3.1_rxjs@7.8.1/node_modules/@univerjs/sheets-hyper-link/lib/es/facade.js
- var I = Object.defineProperty;
- var H = Object.getOwnPropertyDescriptor;
- var U = (o, e, i, r) => {
- for (var n = r > 1 ? void 0 : r ? H(e, i) : e, t = o.length - 1, s; t >= 0; t--)
- (s = o[t]) && (n = (r ? s(e, i, n) : s(n)) || n);
- return r && n && I(e, i, n), n;
- };
- var R = (o, e) => (i, r) => e(i, r, o);
- var m2 = class {
- constructor(o, e) {
- this._workbook = o, this._parserService = e;
- }
- getRangeUrl(o) {
- return this._parserService.buildHyperLink(this._workbook.getId(), o.getSheetId(), o.getRange()), this;
- }
- };
- m2 = U([
- R(1, ot(ye))
- ], m2);
- var E = class extends f {
- createSheetHyperlink(e, i) {
- return this._injector.get(ye).buildHyperLink(this.getId(), e, i);
- }
- /**
- * Parse the hyperlink string to get the hyperlink info.
- * @param {string} hyperlink the hyperlink string
- * @returns {ISheetHyperLinkInfo} the hyperlink info
- */
- parseSheetHyperlink(e) {
- return this._injector.get(ye).parseHyperLink(e);
- }
- };
- f.extend(E);
- var T = class extends m {
- getUrl() {
- return this._injector.get(ye).buildHyperLink(this._workbook.getUnitId(), this._worksheet.getSheetId());
- }
- };
- m.extend(T);
- var B = class extends S {
- // #region hyperlink
- setHyperLink(e, i) {
- const r = {
- unitId: this.getUnitId(),
- subUnitId: this._worksheet.getSheetId(),
- link: {
- row: this._range.startRow,
- column: this._range.startColumn,
- payload: e,
- display: i,
- id: qt()
- }
- };
- return this._commandService.executeCommand(xt.id, r);
- }
- getHyperLinks() {
- var i, r, n;
- const e = this._worksheet.getCellRaw(this._range.startRow, this._range.startColumn);
- return e != null && e.p ? (n = (r = (i = e.p.body) == null ? void 0 : i.customRanges) == null ? void 0 : r.filter((t) => t.rangeType === mn.HYPERLINK).map((t) => {
- var s, h, c, p, l;
- return {
- id: `${t.rangeId}`,
- startIndex: t.startIndex,
- endIndex: t.endIndex,
- url: (h = (s = t.properties) == null ? void 0 : s.url) != null ? h : "",
- label: (l = (p = (c = e.p) == null ? void 0 : c.body) == null ? void 0 : p.dataStream.slice(t.startIndex, t.endIndex + 1).replaceAll(ln.CUSTOM_RANGE_START, "").replaceAll(ln.CUSTOM_RANGE_END, "")) != null ? l : ""
- };
- })) != null ? n : [] : [];
- }
- updateHyperLink(e, i, r) {
- const n = {
- unitId: this.getUnitId(),
- subUnitId: this._worksheet.getSheetId(),
- row: this._range.startRow,
- column: this._range.startColumn,
- id: e,
- payload: {
- payload: i,
- display: r
- }
- };
- return this._commandService.executeCommand(Bt.id, n);
- }
- cancelHyperLink(e) {
- const i = {
- unitId: this.getUnitId(),
- subUnitId: this._worksheet.getSheetId(),
- row: this._range.startRow,
- column: this._range.startColumn,
- id: e
- };
- return this._commandService.syncExecuteCommand(At.id, i);
- }
- getUrl() {
- return this._injector.get(ye).buildHyperLink(this.getUnitId(), this.getSheetId(), this.getRange());
- }
- // #endregion
- };
- S.extend(B);
- var A = class {
- get BeforeSheetLinkAdd() {
- return "BeforeSheetLinkAdd";
- }
- get BeforeSheetLinkCancel() {
- return "BeforeSheetLinkCancel";
- }
- get BeforeSheetLinkUpdate() {
- return "BeforeSheetLinkUpdate";
- }
- };
- hi.extend(A);
- var F = class extends pi {
- _initialize(e) {
- const i = e.get(Pt);
- this.disposeWithMe(
- i.beforeCommandExecuted((r) => {
- if (r.id === xt.id) {
- if (!this._eventListend(this.Event.BeforeSheetLinkAdd))
- return;
- const n = this.getCommandSheetTarget(r);
- if (!n)
- return;
- const t = r.params, s = {
- workbook: n.workbook,
- worksheet: n.worksheet,
- row: t.link.row,
- col: t.link.column,
- link: t.link
- };
- if (this.fireEvent(this.Event.BeforeSheetLinkAdd, s), s.cancel)
- throw new xf();
- }
- if (r.id === Bt.id) {
- const n = this.getCommandSheetTarget(r);
- if (!n)
- return;
- const t = r.params, s = {
- workbook: n.workbook,
- worksheet: n.worksheet,
- row: t.row,
- column: t.column,
- id: t.id,
- payload: t.payload
- };
- if (this.fireEvent(this.Event.BeforeSheetLinkUpdate, s), s.cancel)
- throw new xf();
- }
- if (r.id === At.id) {
- const n = this.getCommandSheetTarget(r);
- if (!n)
- return;
- const t = r.params, s = {
- workbook: n.workbook,
- worksheet: n.worksheet,
- row: t.row,
- column: t.column,
- id: t.id
- };
- if (this.fireEvent(this.Event.BeforeSheetLinkCancel, s), s.cancel)
- throw new xf();
- }
- })
- );
- }
- };
- pi.extend(F);
- export {
- E
- };
- //# sourceMappingURL=chunk-SJCG2OJH.js.map
|