@univerjs/sheets-hyper-link 0.7.0-nightly.202505111606 → 0.7.0-nightly.202505121607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +381 -381
- package/lib/index.js +381 -381
- package/lib/umd/index.js +1 -1
- package/package.json +6 -7
package/lib/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var w = (
|
|
4
|
-
import { Disposable as T, ObjectMatrix as
|
|
5
|
-
import { Subject as
|
|
6
|
-
import { getSheetCommandTarget as j, RefRangeService as
|
|
7
|
-
import { deserializeRangeWithSheet as Ce, serializeRange as B, IDefinedNamesService as
|
|
8
|
-
import { addCustomRangeBySelectionFactory as
|
|
9
|
-
var
|
|
10
|
-
for (var
|
|
11
|
-
(a =
|
|
12
|
-
return
|
|
13
|
-
},
|
|
14
|
-
let
|
|
1
|
+
var $e = Object.defineProperty;
|
|
2
|
+
var Ae = (s, e, t) => e in s ? $e(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var w = (s, e, t) => Ae(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Disposable as T, ObjectMatrix as Q, UniverInstanceType as I, IUniverInstanceService as k, CommandType as L, CustomRangeType as U, Inject as M, ICommandService as b, sequenceExecuteAsync as We, isValidRange as Se, toDisposable as Be, DisposableCollection as je, Rectangle as Fe, Range as Ke, Tools as de, BuildTextUtils as Z, generateRandomId as ce, TextX as le, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ye, IResourceManagerService as Ge, IUndoRedoService as Re, CellValueType as Ie, sequenceExecute as Y, getBodySlice as De, LocaleService as ze, DependentOn as Je, Injector as Xe, IConfigService as qe, Plugin as Qe, merge as Ze, registerDependencies as et, touchDependencies as tt } from "@univerjs/core";
|
|
5
|
+
import { Subject as nt } from "rxjs";
|
|
6
|
+
import { getSheetCommandTarget as j, RefRangeService as Ne, SheetsSelectionsService as Oe, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests as rt, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests as st, SheetInterceptorService as ue, RemoveSheetCommand as it, handleDefaultRangeChangeWithEffectRefCommands as at, SetRangeValuesMutation as V, SetRangeValuesCommand as ot, ClearSelectionContentCommand as dt, ClearSelectionAllCommand as ct, ClearSelectionFormatCommand as lt, AFTER_CELL_EDIT as ut, SetRangeValuesUndoMutationFactory as Me, UniverSheetsPlugin as pt } from "@univerjs/sheets";
|
|
7
|
+
import { deserializeRangeWithSheet as Ce, serializeRange as B, IDefinedNamesService as ht, serializeRangeWithSheet as gt } from "@univerjs/engine-formula";
|
|
8
|
+
import { addCustomRangeBySelectionFactory as ft, deleteCustomRangeFactory as mt, replaceSelectionFactory as He } from "@univerjs/docs";
|
|
9
|
+
var _t = Object.getOwnPropertyDescriptor, yt = (s, e, t, n) => {
|
|
10
|
+
for (var r = n > 1 ? void 0 : n ? _t(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
11
|
+
(a = s[i]) && (r = a(r) || r);
|
|
12
|
+
return r;
|
|
13
|
+
}, vt = (s, e) => (t, n) => e(t, n, s);
|
|
14
|
+
let R = class extends T {
|
|
15
15
|
constructor(e) {
|
|
16
16
|
super();
|
|
17
|
-
w(this, "_linkUpdate$", new
|
|
17
|
+
w(this, "_linkUpdate$", new nt());
|
|
18
18
|
w(this, "linkUpdate$", this._linkUpdate$.asObservable());
|
|
19
19
|
w(this, "_linkMap", /* @__PURE__ */ new Map());
|
|
20
20
|
w(this, "_linkPositionMap", /* @__PURE__ */ new Map());
|
|
@@ -27,31 +27,31 @@ let v = class extends T {
|
|
|
27
27
|
_ensureMap(e, t) {
|
|
28
28
|
let n = this._linkMap.get(e);
|
|
29
29
|
n || (n = /* @__PURE__ */ new Map(), this._linkMap.set(e, n));
|
|
30
|
-
let
|
|
31
|
-
|
|
30
|
+
let r = n.get(t);
|
|
31
|
+
r || (r = new Q(), n.set(t, r));
|
|
32
32
|
let i = this._linkPositionMap.get(e);
|
|
33
33
|
i || (i = /* @__PURE__ */ new Map(), this._linkPositionMap.set(e, i));
|
|
34
34
|
let a = i.get(t);
|
|
35
35
|
return a || (a = /* @__PURE__ */ new Map(), i.set(t, a)), {
|
|
36
|
-
matrix:
|
|
36
|
+
matrix: r,
|
|
37
37
|
positionMap: a
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
addHyperLink(e, t, n) {
|
|
41
|
-
const { matrix:
|
|
42
|
-
return
|
|
41
|
+
const { matrix: r, positionMap: i } = this._ensureMap(e, t);
|
|
42
|
+
return r.setValue(n.row, n.column, n), i.set(n.id, { row: n.row, column: n.column, link: n }), this._linkUpdate$.next({
|
|
43
43
|
unitId: e,
|
|
44
44
|
subUnitId: t,
|
|
45
45
|
payload: n,
|
|
46
46
|
type: "add"
|
|
47
47
|
}), !0;
|
|
48
48
|
}
|
|
49
|
-
updateHyperLink(e, t, n,
|
|
49
|
+
updateHyperLink(e, t, n, r, i = !1) {
|
|
50
50
|
const { matrix: a, positionMap: o } = this._ensureMap(e, t), c = o.get(n);
|
|
51
51
|
if (!c)
|
|
52
52
|
return !0;
|
|
53
53
|
const d = a.getValue(c.row, c.column);
|
|
54
|
-
return d && (Object.assign(d,
|
|
54
|
+
return d && (Object.assign(d, r), this._linkUpdate$.next({
|
|
55
55
|
unitId: e,
|
|
56
56
|
subUnitId: t,
|
|
57
57
|
payload: {
|
|
@@ -63,27 +63,27 @@ let v = class extends T {
|
|
|
63
63
|
silent: i
|
|
64
64
|
})), !0;
|
|
65
65
|
}
|
|
66
|
-
updateHyperLinkRef(e, t, n,
|
|
66
|
+
updateHyperLinkRef(e, t, n, r, i = !1) {
|
|
67
67
|
const { matrix: a, positionMap: o } = this._ensureMap(e, t), c = o.get(n);
|
|
68
68
|
if (!c)
|
|
69
69
|
return !0;
|
|
70
70
|
let d = a.getValue(c.row, c.column);
|
|
71
|
-
return !d || d.id !== n ? d = c.link : a.realDeleteValue(c.row, c.column), Object.assign(d,
|
|
71
|
+
return !d || d.id !== n ? d = c.link : a.realDeleteValue(c.row, c.column), Object.assign(d, r), o.set(n, { ...r, link: d }), a.setValue(r.row, r.column, d), this._linkUpdate$.next({
|
|
72
72
|
unitId: e,
|
|
73
73
|
subUnitId: t,
|
|
74
|
-
payload:
|
|
74
|
+
payload: r,
|
|
75
75
|
id: n,
|
|
76
76
|
type: "updateRef",
|
|
77
77
|
silent: i
|
|
78
78
|
}), !0;
|
|
79
79
|
}
|
|
80
80
|
removeHyperLink(e, t, n) {
|
|
81
|
-
const { matrix:
|
|
81
|
+
const { matrix: r, positionMap: i } = this._ensureMap(e, t), a = i.get(n);
|
|
82
82
|
if (!a)
|
|
83
83
|
return !1;
|
|
84
84
|
i.delete(n);
|
|
85
|
-
const o =
|
|
86
|
-
return o && o.id === n &&
|
|
85
|
+
const o = r.getValue(a.row, a.column);
|
|
86
|
+
return o && o.id === n && r.realDeleteValue(a.row, a.column), this._linkUpdate$.next({
|
|
87
87
|
unitId: e,
|
|
88
88
|
subUnitId: t,
|
|
89
89
|
payload: a.link,
|
|
@@ -91,17 +91,17 @@ let v = class extends T {
|
|
|
91
91
|
}), !0;
|
|
92
92
|
}
|
|
93
93
|
getHyperLink(e, t, n) {
|
|
94
|
-
const { matrix:
|
|
94
|
+
const { matrix: r, positionMap: i } = this._ensureMap(e, t), a = i.get(n);
|
|
95
95
|
if (a)
|
|
96
|
-
return
|
|
96
|
+
return r.getValue(a.row, a.column);
|
|
97
97
|
}
|
|
98
|
-
getHyperLinkByLocation(e, t, n,
|
|
98
|
+
getHyperLinkByLocation(e, t, n, r) {
|
|
99
99
|
const { matrix: i } = this._ensureMap(e, t);
|
|
100
|
-
return i.getValue(n,
|
|
100
|
+
return i.getValue(n, r);
|
|
101
101
|
}
|
|
102
|
-
getHyperLinkByLocationSync(e, t, n,
|
|
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,
|
|
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);
|
|
105
105
|
if (d)
|
|
106
106
|
return {
|
|
107
107
|
...d,
|
|
@@ -109,19 +109,19 @@ let v = class extends T {
|
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
getSubUnit(e, t) {
|
|
112
|
-
const { matrix: n } = this._ensureMap(e, t),
|
|
112
|
+
const { matrix: n } = this._ensureMap(e, t), r = [];
|
|
113
113
|
return n.forValue((i, a, o) => {
|
|
114
|
-
o &&
|
|
115
|
-
}),
|
|
114
|
+
o && r.push(o);
|
|
115
|
+
}), r;
|
|
116
116
|
}
|
|
117
117
|
getUnit(e) {
|
|
118
118
|
const t = this._linkMap.get(e);
|
|
119
119
|
return t ? Array.from(t.keys()).map((n) => {
|
|
120
|
-
const
|
|
120
|
+
const r = this.getSubUnit(e, n);
|
|
121
121
|
return {
|
|
122
122
|
unitId: e,
|
|
123
123
|
subUnitId: n,
|
|
124
|
-
links:
|
|
124
|
+
links: r
|
|
125
125
|
};
|
|
126
126
|
}) : [];
|
|
127
127
|
}
|
|
@@ -137,88 +137,88 @@ let v = class extends T {
|
|
|
137
137
|
return Array.from(this._linkMap.keys()).map((t) => this.getUnit(t));
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
],
|
|
143
|
-
var
|
|
144
|
-
const
|
|
145
|
-
type:
|
|
140
|
+
R = yt([
|
|
141
|
+
vt(0, k)
|
|
142
|
+
], R);
|
|
143
|
+
var E = /* @__PURE__ */ ((s) => (s.SHEET = "gid", s.RANGE = "range", s.DEFINE_NAME = "rangeid", s.INVALID = "invalid", s.URL = "url", s))(E || {});
|
|
144
|
+
const St = "sheets-hyper-link.config", Ue = {}, D = {
|
|
145
|
+
type: L.MUTATION,
|
|
146
146
|
id: "sheets.mutation.add-hyper-link",
|
|
147
|
-
handler(
|
|
147
|
+
handler(s, e) {
|
|
148
148
|
if (!e)
|
|
149
149
|
return !1;
|
|
150
|
-
const t =
|
|
151
|
-
return t.addHyperLink(n,
|
|
150
|
+
const t = s.get(R), { unitId: n, subUnitId: r, link: i } = e;
|
|
151
|
+
return t.addHyperLink(n, r, i);
|
|
152
152
|
}
|
|
153
|
-
},
|
|
154
|
-
type:
|
|
153
|
+
}, N = {
|
|
154
|
+
type: L.MUTATION,
|
|
155
155
|
id: "sheets.mutation.remove-hyper-link",
|
|
156
|
-
handler(
|
|
156
|
+
handler(s, e) {
|
|
157
157
|
if (!e)
|
|
158
158
|
return !1;
|
|
159
|
-
const t =
|
|
160
|
-
return t.removeHyperLink(n,
|
|
159
|
+
const t = s.get(R), { unitId: n, subUnitId: r, id: i } = e;
|
|
160
|
+
return t.removeHyperLink(n, r, i);
|
|
161
161
|
}
|
|
162
|
-
},
|
|
163
|
-
type:
|
|
162
|
+
}, _e = {
|
|
163
|
+
type: L.MUTATION,
|
|
164
164
|
id: "sheets.mutation.update-hyper-link",
|
|
165
|
-
handler(
|
|
165
|
+
handler(s, e) {
|
|
166
166
|
if (!e)
|
|
167
167
|
return !1;
|
|
168
|
-
const t =
|
|
169
|
-
return t.updateHyperLink(n,
|
|
168
|
+
const t = s.get(R), { unitId: n, subUnitId: r, payload: i, id: a } = e;
|
|
169
|
+
return t.updateHyperLink(n, r, a, i, !1);
|
|
170
170
|
}
|
|
171
171
|
}, ye = {
|
|
172
|
-
type:
|
|
172
|
+
type: L.MUTATION,
|
|
173
173
|
id: "sheets.mutation.update-hyper-link-ref",
|
|
174
|
-
handler(
|
|
174
|
+
handler(s, e) {
|
|
175
175
|
if (!e)
|
|
176
176
|
return !1;
|
|
177
|
-
const t =
|
|
178
|
-
return t.updateHyperLinkRef(n,
|
|
177
|
+
const t = s.get(R), { unitId: n, subUnitId: r, id: i, row: a, column: o, silent: c } = e;
|
|
178
|
+
return t.updateHyperLinkRef(n, r, i, { row: a, column: o }, c);
|
|
179
179
|
}
|
|
180
180
|
}, q = {
|
|
181
|
-
type:
|
|
181
|
+
type: L.MUTATION,
|
|
182
182
|
id: "sheets.mutation.update-rich-hyper-link",
|
|
183
|
-
handler(
|
|
183
|
+
handler(s, e) {
|
|
184
184
|
var g, p, f;
|
|
185
185
|
if (!e)
|
|
186
186
|
return !1;
|
|
187
|
-
const { unitId: t, subUnitId: n, row:
|
|
187
|
+
const { unitId: t, subUnitId: n, row: r, col: i, id: a, url: o } = e, c = s.get(k), d = j(c, { unitId: t, subUnitId: n });
|
|
188
188
|
if (!d)
|
|
189
189
|
return !1;
|
|
190
|
-
const { worksheet: l } = d, u = l.getCellRaw(
|
|
190
|
+
const { worksheet: l } = d, u = l.getCellRaw(r, i), h = (f = (p = (g = u == null ? void 0 : u.p) == null ? void 0 : g.body) == null ? void 0 : p.customRanges) == null ? void 0 : f.find((m) => m.rangeType === U.HYPERLINK && m.rangeId === a);
|
|
191
191
|
return h && (h.properties.url = o), !0;
|
|
192
192
|
}
|
|
193
|
-
},
|
|
194
|
-
var
|
|
195
|
-
for (var
|
|
196
|
-
(a =
|
|
197
|
-
return
|
|
198
|
-
}, J = (
|
|
193
|
+
}, xe = "SHEET_HYPER_LINK_PLUGIN", ee = "err";
|
|
194
|
+
var Rt = Object.getOwnPropertyDescriptor, It = (s, e, t, n) => {
|
|
195
|
+
for (var r = n > 1 ? void 0 : n ? Rt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
196
|
+
(a = s[i]) && (r = a(r) || r);
|
|
197
|
+
return r;
|
|
198
|
+
}, J = (s, e) => (t, n) => e(t, n, s);
|
|
199
199
|
let te = class extends T {
|
|
200
|
-
constructor(e, t, n,
|
|
200
|
+
constructor(e, t, n, r) {
|
|
201
201
|
super();
|
|
202
202
|
w(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
203
203
|
w(this, "_watchDisposableMap", /* @__PURE__ */ new Map());
|
|
204
204
|
w(this, "_rangeDisableMap", /* @__PURE__ */ new Map());
|
|
205
205
|
w(this, "_rangeWatcherMap", /* @__PURE__ */ new Map());
|
|
206
|
-
w(this, "_handlePositionChange", (e, t, n,
|
|
206
|
+
w(this, "_handlePositionChange", (e, t, n, r, i) => {
|
|
207
207
|
const a = {
|
|
208
208
|
startColumn: n.column,
|
|
209
209
|
endColumn: n.column,
|
|
210
210
|
startRow: n.row,
|
|
211
211
|
endRow: n.row
|
|
212
212
|
};
|
|
213
|
-
return
|
|
213
|
+
return r ? {
|
|
214
214
|
redos: [{
|
|
215
215
|
id: ye.id,
|
|
216
216
|
params: {
|
|
217
217
|
unitId: e,
|
|
218
218
|
subUnitId: t,
|
|
219
219
|
id: n.id,
|
|
220
|
-
row:
|
|
221
|
-
column:
|
|
220
|
+
row: r.startRow,
|
|
221
|
+
column: r.startColumn,
|
|
222
222
|
silent: i
|
|
223
223
|
}
|
|
224
224
|
}],
|
|
@@ -235,7 +235,7 @@ let te = class extends T {
|
|
|
235
235
|
}]
|
|
236
236
|
} : {
|
|
237
237
|
redos: [{
|
|
238
|
-
id:
|
|
238
|
+
id: N.id,
|
|
239
239
|
params: {
|
|
240
240
|
unitId: e,
|
|
241
241
|
subUnitId: t,
|
|
@@ -243,7 +243,7 @@ let te = class extends T {
|
|
|
243
243
|
}
|
|
244
244
|
}],
|
|
245
245
|
undos: [{
|
|
246
|
-
id:
|
|
246
|
+
id: D.id,
|
|
247
247
|
params: {
|
|
248
248
|
unitId: e,
|
|
249
249
|
subUnitId: t,
|
|
@@ -252,33 +252,33 @@ let te = class extends T {
|
|
|
252
252
|
}]
|
|
253
253
|
};
|
|
254
254
|
});
|
|
255
|
-
this._refRangeService = e, this._hyperLinkModel = t, this._selectionManagerService = n, this._commandService =
|
|
255
|
+
this._refRangeService = e, this._hyperLinkModel = t, this._selectionManagerService = n, this._commandService = r, this._initData(), this._initRefRange();
|
|
256
256
|
}
|
|
257
257
|
_registerPosition(e, t, n) {
|
|
258
|
-
const
|
|
258
|
+
const r = n.id, i = {
|
|
259
259
|
startColumn: n.column,
|
|
260
260
|
endColumn: n.column,
|
|
261
261
|
startRow: n.row,
|
|
262
262
|
endRow: n.row
|
|
263
263
|
}, a = (o) => {
|
|
264
|
-
const c =
|
|
264
|
+
const c = rt(i, o, { selectionManagerService: this._selectionManagerService }), d = Array.isArray(c) ? c[0] : c;
|
|
265
265
|
return d && d.startColumn === i.startColumn && d.startRow === i.startRow ? {
|
|
266
266
|
undos: [],
|
|
267
267
|
redos: []
|
|
268
268
|
} : this._handlePositionChange(e, t, n, d, !1);
|
|
269
269
|
};
|
|
270
|
-
this._disposableMap.set(
|
|
270
|
+
this._disposableMap.set(r, this._refRangeService.registerRefRange(i, a, e, t));
|
|
271
271
|
}
|
|
272
272
|
_watchPosition(e, t, n) {
|
|
273
|
-
const
|
|
273
|
+
const r = n.id, i = {
|
|
274
274
|
startColumn: n.column,
|
|
275
275
|
endColumn: n.column,
|
|
276
276
|
startRow: n.row,
|
|
277
277
|
endRow: n.row
|
|
278
278
|
};
|
|
279
|
-
this._watchDisposableMap.set(
|
|
279
|
+
this._watchDisposableMap.set(r, this._refRangeService.watchRange(e, t, i, (a, o) => {
|
|
280
280
|
const { redos: c } = this._handlePositionChange(e, t, n, o, !0);
|
|
281
|
-
|
|
281
|
+
We(c, this._commandService, { onlyLocal: !0 });
|
|
282
282
|
}, !0));
|
|
283
283
|
}
|
|
284
284
|
_unregisterPosition(e) {
|
|
@@ -289,7 +289,7 @@ let te = class extends T {
|
|
|
289
289
|
const t = this._watchDisposableMap.get(e);
|
|
290
290
|
t == null || t.dispose(), this._watchDisposableMap.delete(e);
|
|
291
291
|
}
|
|
292
|
-
_registerRange(e, t, n,
|
|
292
|
+
_registerRange(e, t, n, r = !1) {
|
|
293
293
|
var i, a, o;
|
|
294
294
|
if (n.startsWith("#")) {
|
|
295
295
|
const c = new URLSearchParams(n.slice(1)), d = {
|
|
@@ -301,13 +301,13 @@ let te = class extends T {
|
|
|
301
301
|
const l = d.gid, u = Ce(d.range).range;
|
|
302
302
|
if (Se(u) && d.range !== ee) {
|
|
303
303
|
const h = (g) => {
|
|
304
|
-
const p =
|
|
304
|
+
const p = st(u, g, { selectionManagerService: this._selectionManagerService });
|
|
305
305
|
return p && B(p) === B(u) ? {
|
|
306
306
|
redos: [],
|
|
307
307
|
undos: []
|
|
308
308
|
} : {
|
|
309
309
|
redos: [{
|
|
310
|
-
id:
|
|
310
|
+
id: _e.id,
|
|
311
311
|
params: {
|
|
312
312
|
unitId: e,
|
|
313
313
|
subUnitId: l,
|
|
@@ -318,7 +318,7 @@ let te = class extends T {
|
|
|
318
318
|
}
|
|
319
319
|
}],
|
|
320
320
|
undos: [{
|
|
321
|
-
id:
|
|
321
|
+
id: _e.id,
|
|
322
322
|
params: {
|
|
323
323
|
unitId: e,
|
|
324
324
|
subUnitId: l,
|
|
@@ -330,7 +330,7 @@ let te = class extends T {
|
|
|
330
330
|
}]
|
|
331
331
|
};
|
|
332
332
|
};
|
|
333
|
-
this._rangeDisableMap.set(t, this._refRangeService.registerRefRange(u, h, e, l)),
|
|
333
|
+
this._rangeDisableMap.set(t, this._refRangeService.registerRefRange(u, h, e, l)), r || this._rangeWatcherMap.set(t, this._refRangeService.watchRange(e, l, u, (g, p) => {
|
|
334
334
|
this._hyperLinkModel.updateHyperLink(e, l, t, {
|
|
335
335
|
payload: `#gid=${l}&range=${p ? B(p) : "err"}`
|
|
336
336
|
}, !0);
|
|
@@ -350,9 +350,9 @@ let te = class extends T {
|
|
|
350
350
|
_initData() {
|
|
351
351
|
this._hyperLinkModel.getAll().forEach((t) => {
|
|
352
352
|
t.forEach((n) => {
|
|
353
|
-
const { unitId:
|
|
353
|
+
const { unitId: r, subUnitId: i, links: a } = n;
|
|
354
354
|
a.forEach((o) => {
|
|
355
|
-
this._registerPosition(
|
|
355
|
+
this._registerPosition(r, i, o), this._watchPosition(r, i, o), this._registerRange(r, o.id, o.payload);
|
|
356
356
|
});
|
|
357
357
|
});
|
|
358
358
|
});
|
|
@@ -370,17 +370,17 @@ let te = class extends T {
|
|
|
370
370
|
break;
|
|
371
371
|
}
|
|
372
372
|
case "updateRef": {
|
|
373
|
-
const { unitId: t, subUnitId: n, id:
|
|
373
|
+
const { unitId: t, subUnitId: n, id: r, silent: i } = e, a = this._hyperLinkModel.getHyperLink(t, n, r);
|
|
374
374
|
if (!a)
|
|
375
375
|
return;
|
|
376
|
-
this._unregisterPosition(
|
|
376
|
+
this._unregisterPosition(r), this._registerPosition(t, n, a), i || (this._unwatchPosition(r), this._watchPosition(t, n, a));
|
|
377
377
|
break;
|
|
378
378
|
}
|
|
379
379
|
case "unload": {
|
|
380
380
|
const { unitLinks: t } = e;
|
|
381
381
|
t.forEach((n) => {
|
|
382
|
-
const { links:
|
|
383
|
-
|
|
382
|
+
const { links: r } = n;
|
|
383
|
+
r.forEach((i) => {
|
|
384
384
|
this._unregisterPosition(i.id), this._unwatchPosition(i.id), this._unregisterRange(i.id), this._unwatchRange(i.id);
|
|
385
385
|
});
|
|
386
386
|
});
|
|
@@ -392,51 +392,51 @@ let te = class extends T {
|
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
})
|
|
395
|
-
), this.disposeWithMe(
|
|
395
|
+
), this.disposeWithMe(Be(() => {
|
|
396
396
|
this._disposableMap.forEach((e) => {
|
|
397
397
|
e.dispose();
|
|
398
398
|
}), this._disposableMap.clear();
|
|
399
399
|
}));
|
|
400
400
|
}
|
|
401
401
|
};
|
|
402
|
-
te =
|
|
403
|
-
J(0, M(
|
|
404
|
-
J(1, M(
|
|
405
|
-
J(2, M(
|
|
402
|
+
te = It([
|
|
403
|
+
J(0, M(Ne)),
|
|
404
|
+
J(1, M(R)),
|
|
405
|
+
J(2, M(Oe)),
|
|
406
406
|
J(3, b)
|
|
407
407
|
], te);
|
|
408
|
-
var
|
|
409
|
-
for (var
|
|
410
|
-
(a =
|
|
411
|
-
return
|
|
412
|
-
}, ge = (
|
|
408
|
+
var Mt = Object.getOwnPropertyDescriptor, Ct = (s, e, t, n) => {
|
|
409
|
+
for (var r = n > 1 ? void 0 : n ? Mt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
410
|
+
(a = s[i]) && (r = a(r) || r);
|
|
411
|
+
return r;
|
|
412
|
+
}, ge = (s, e) => (t, n) => e(t, n, s);
|
|
413
413
|
let ne = class extends T {
|
|
414
|
-
constructor(
|
|
415
|
-
super(), this._sheetInterceptorService =
|
|
414
|
+
constructor(s, e, t) {
|
|
415
|
+
super(), this._sheetInterceptorService = s, this._univerInstanceService = e, this._hyperLinkModel = t, this._initSheetChange();
|
|
416
416
|
}
|
|
417
417
|
_initSheetChange() {
|
|
418
418
|
this.disposeWithMe(
|
|
419
419
|
this._sheetInterceptorService.interceptCommand({
|
|
420
|
-
getMutations: (
|
|
420
|
+
getMutations: (s) => {
|
|
421
421
|
var e;
|
|
422
|
-
if (
|
|
423
|
-
const t =
|
|
422
|
+
if (s.id === it.id) {
|
|
423
|
+
const t = s.params, n = t.unitId ? this._univerInstanceService.getUnit(t.unitId) : this._univerInstanceService.getCurrentUnitForType(I.UNIVER_SHEET);
|
|
424
424
|
if (!n)
|
|
425
425
|
return { redos: [], undos: [] };
|
|
426
|
-
const
|
|
426
|
+
const r = n.getUnitId(), i = t.subUnitId || ((e = n.getActiveSheet()) == null ? void 0 : e.getSheetId());
|
|
427
427
|
if (!i)
|
|
428
428
|
return { redos: [], undos: [] };
|
|
429
|
-
const a = this._hyperLinkModel.getSubUnit(
|
|
430
|
-
id:
|
|
429
|
+
const a = this._hyperLinkModel.getSubUnit(r, i), o = a.map((d) => ({
|
|
430
|
+
id: N.id,
|
|
431
431
|
params: {
|
|
432
|
-
unitId:
|
|
432
|
+
unitId: r,
|
|
433
433
|
subUnitId: i,
|
|
434
434
|
id: d.id
|
|
435
435
|
}
|
|
436
436
|
})), c = a.map((d) => ({
|
|
437
|
-
id:
|
|
437
|
+
id: D.id,
|
|
438
438
|
params: {
|
|
439
|
-
unitId:
|
|
439
|
+
unitId: r,
|
|
440
440
|
subUnitId: i,
|
|
441
441
|
link: d
|
|
442
442
|
}
|
|
@@ -449,16 +449,16 @@ let ne = class extends T {
|
|
|
449
449
|
);
|
|
450
450
|
}
|
|
451
451
|
};
|
|
452
|
-
ne =
|
|
452
|
+
ne = Ct([
|
|
453
453
|
ge(0, M(ue)),
|
|
454
454
|
ge(1, k),
|
|
455
|
-
ge(2, M(
|
|
455
|
+
ge(2, M(R))
|
|
456
456
|
], ne);
|
|
457
|
-
var
|
|
458
|
-
for (var
|
|
459
|
-
(a =
|
|
460
|
-
return
|
|
461
|
-
}, fe = (
|
|
457
|
+
var wt = Object.getOwnPropertyDescriptor, kt = (s, e, t, n) => {
|
|
458
|
+
for (var r = n > 1 ? void 0 : n ? wt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
459
|
+
(a = s[i]) && (r = a(r) || r);
|
|
460
|
+
return r;
|
|
461
|
+
}, fe = (s, e) => (t, n) => e(t, n, s);
|
|
462
462
|
let re = class extends T {
|
|
463
463
|
constructor(e, t, n) {
|
|
464
464
|
super();
|
|
@@ -468,17 +468,17 @@ let re = class extends T {
|
|
|
468
468
|
_enusreMap(e, t) {
|
|
469
469
|
let n = this._refRangeMap.get(e);
|
|
470
470
|
n || (n = /* @__PURE__ */ new Map(), this._refRangeMap.set(e, n));
|
|
471
|
-
let
|
|
472
|
-
return
|
|
471
|
+
let r = n.get(t);
|
|
472
|
+
return r || (r = new Q(), n.set(t, r)), r;
|
|
473
473
|
}
|
|
474
474
|
_isLegalRangeUrl(e, t) {
|
|
475
|
-
var
|
|
475
|
+
var r, i, a;
|
|
476
476
|
const n = this._univerInstanceService.getUnit(e, I.UNIVER_SHEET);
|
|
477
477
|
if (!n)
|
|
478
478
|
return null;
|
|
479
479
|
if (t && t.startsWith("#")) {
|
|
480
480
|
const o = new URLSearchParams(t.slice(1)), c = {
|
|
481
|
-
gid: (
|
|
481
|
+
gid: (r = o.get("gid")) != null ? r : "",
|
|
482
482
|
range: (i = o.get("range")) != null ? i : "",
|
|
483
483
|
rangeid: (a = o.get("rangeid")) != null ? a : ""
|
|
484
484
|
};
|
|
@@ -496,27 +496,27 @@ let re = class extends T {
|
|
|
496
496
|
}
|
|
497
497
|
return null;
|
|
498
498
|
}
|
|
499
|
-
_registerRange(e, t, n,
|
|
499
|
+
_registerRange(e, t, n, r, i) {
|
|
500
500
|
var o, c, d, l;
|
|
501
501
|
const a = this._enusreMap(e, t);
|
|
502
502
|
if ((c = (o = i.body) == null ? void 0 : o.customRanges) != null && c.some((u) => {
|
|
503
503
|
var h;
|
|
504
504
|
return u.rangeType === U.HYPERLINK && this._isLegalRangeUrl(e, (h = u.properties) == null ? void 0 : h.url);
|
|
505
505
|
})) {
|
|
506
|
-
const u = new
|
|
506
|
+
const u = new je();
|
|
507
507
|
let h = !1;
|
|
508
508
|
(l = (d = i.body) == null ? void 0 : d.customRanges) == null || l.forEach((g) => {
|
|
509
509
|
var p;
|
|
510
510
|
if (g.rangeType === U.HYPERLINK) {
|
|
511
|
-
const f = (p = g.properties) == null ? void 0 : p.url,
|
|
512
|
-
if (
|
|
513
|
-
const { range:
|
|
511
|
+
const f = (p = g.properties) == null ? void 0 : p.url, m = this._isLegalRangeUrl(e, f);
|
|
512
|
+
if (m) {
|
|
513
|
+
const { range: _, worksheet: C } = m;
|
|
514
514
|
h = !0, u.add(
|
|
515
515
|
this._refRangeService.registerRefRange(
|
|
516
|
-
|
|
516
|
+
_,
|
|
517
517
|
(y) => {
|
|
518
|
-
const
|
|
519
|
-
return
|
|
518
|
+
const v = at(_, y);
|
|
519
|
+
return v && Fe.equals(v, _) ? {
|
|
520
520
|
preRedos: [],
|
|
521
521
|
preUndos: [],
|
|
522
522
|
redos: [],
|
|
@@ -528,9 +528,9 @@ let re = class extends T {
|
|
|
528
528
|
unitId: e,
|
|
529
529
|
subUnitId: t,
|
|
530
530
|
row: n,
|
|
531
|
-
col:
|
|
531
|
+
col: r,
|
|
532
532
|
id: g.rangeId,
|
|
533
|
-
url: `#gid=${t}&range=${
|
|
533
|
+
url: `#gid=${t}&range=${v ? B(v) : ee}`
|
|
534
534
|
}
|
|
535
535
|
}],
|
|
536
536
|
undos: [{
|
|
@@ -539,7 +539,7 @@ let re = class extends T {
|
|
|
539
539
|
unitId: e,
|
|
540
540
|
subUnitId: t,
|
|
541
541
|
row: n,
|
|
542
|
-
col:
|
|
542
|
+
col: r,
|
|
543
543
|
id: g.rangeId,
|
|
544
544
|
url: f
|
|
545
545
|
}
|
|
@@ -553,15 +553,15 @@ let re = class extends T {
|
|
|
553
553
|
);
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
|
-
}), h && a.setValue(n,
|
|
556
|
+
}), h && a.setValue(n, r, u);
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
_initWorkbookLoad() {
|
|
560
560
|
const e = (t) => {
|
|
561
561
|
const n = t.getUnitId();
|
|
562
|
-
t.getSheets().forEach((
|
|
563
|
-
const i =
|
|
564
|
-
|
|
562
|
+
t.getSheets().forEach((r) => {
|
|
563
|
+
const i = r.getSheetId(), a = this._enusreMap(n, i);
|
|
564
|
+
r.getCellMatrix().forValue((o, c, d) => {
|
|
565
565
|
const l = a.getValue(o, c);
|
|
566
566
|
l && l.dispose(), d && d.p && this._registerRange(n, i, o, c, d.p);
|
|
567
567
|
});
|
|
@@ -579,8 +579,8 @@ let re = class extends T {
|
|
|
579
579
|
this._univerInstanceService.unitDisposed$.subscribe((e) => {
|
|
580
580
|
if (e.type === I.UNIVER_SHEET) {
|
|
581
581
|
const t = e, n = t.getUnitId();
|
|
582
|
-
t.getSheets().forEach((
|
|
583
|
-
const i =
|
|
582
|
+
t.getSheets().forEach((r) => {
|
|
583
|
+
const i = r.getSheetId();
|
|
584
584
|
this._enusreMap(n, i).forValue((o, c, d) => {
|
|
585
585
|
d && d.dispose();
|
|
586
586
|
});
|
|
@@ -591,60 +591,60 @@ let re = class extends T {
|
|
|
591
591
|
_initSetRangesListener() {
|
|
592
592
|
this.disposeWithMe(
|
|
593
593
|
this._commandService.onCommandExecuted((e) => {
|
|
594
|
-
if (e.id ===
|
|
595
|
-
const t = e.params, { unitId: n, subUnitId:
|
|
596
|
-
i && new
|
|
594
|
+
if (e.id === V.id) {
|
|
595
|
+
const t = e.params, { unitId: n, subUnitId: r, cellValue: i } = t, a = this._enusreMap(n, r);
|
|
596
|
+
i && new Q(i).forValue((o, c, d) => {
|
|
597
597
|
const l = a.getValue(o, c);
|
|
598
|
-
l && l.dispose(), d && d.p && this._registerRange(n,
|
|
598
|
+
l && l.dispose(), d && d.p && this._registerRange(n, r, o, c, d.p);
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
})
|
|
602
602
|
), this.disposeWithMe(
|
|
603
603
|
this._commandService.onCommandExecuted((e) => {
|
|
604
604
|
if (e.id === q.id) {
|
|
605
|
-
const t = e.params, { unitId: n, subUnitId:
|
|
605
|
+
const t = e.params, { unitId: n, subUnitId: r, row: i, col: a } = t, o = j(this._univerInstanceService, { unitId: n, subUnitId: r }), d = this._enusreMap(n, r).getValue(i, a);
|
|
606
606
|
if (d && d.dispose(), o) {
|
|
607
607
|
const { worksheet: l } = o, u = l.getCellRaw(i, a);
|
|
608
|
-
u && u.p && this._registerRange(n,
|
|
608
|
+
u && u.p && this._registerRange(n, r, i, a, u.p);
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
611
|
})
|
|
612
612
|
);
|
|
613
613
|
}
|
|
614
614
|
};
|
|
615
|
-
re =
|
|
615
|
+
re = kt([
|
|
616
616
|
fe(0, b),
|
|
617
617
|
fe(1, k),
|
|
618
|
-
fe(2, M(
|
|
618
|
+
fe(2, M(Ne))
|
|
619
619
|
], re);
|
|
620
|
-
var Lt = Object.getOwnPropertyDescriptor,
|
|
621
|
-
for (var
|
|
622
|
-
(a =
|
|
623
|
-
return
|
|
624
|
-
}, X = (
|
|
620
|
+
var Lt = Object.getOwnPropertyDescriptor, Et = (s, e, t, n) => {
|
|
621
|
+
for (var r = n > 1 ? void 0 : n ? Lt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
622
|
+
(a = s[i]) && (r = a(r) || r);
|
|
623
|
+
return r;
|
|
624
|
+
}, X = (s, e) => (t, n) => e(t, n, s);
|
|
625
625
|
let se = class extends T {
|
|
626
|
-
constructor(
|
|
627
|
-
super(), this._sheetInterceptorService =
|
|
626
|
+
constructor(s, e, t, n) {
|
|
627
|
+
super(), this._sheetInterceptorService = s, this._hyperLinkModel = e, this._selectionManagerService = t, this._univerInstanceService = n, this._initCommandInterceptor(), this._initAfterEditor();
|
|
628
628
|
}
|
|
629
629
|
_initCommandInterceptor() {
|
|
630
630
|
this._initSetRangeValuesCommandInterceptor(), this._initClearSelectionCommandInterceptor();
|
|
631
631
|
}
|
|
632
632
|
_initSetRangeValuesCommandInterceptor() {
|
|
633
633
|
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
634
|
-
getMutations: (
|
|
635
|
-
if (
|
|
636
|
-
const e =
|
|
637
|
-
return e.cellValue && new
|
|
634
|
+
getMutations: (s) => {
|
|
635
|
+
if (s.id === ot.id) {
|
|
636
|
+
const e = s.params, { unitId: t, subUnitId: n } = e, r = [], i = [];
|
|
637
|
+
return e.cellValue && new Q(e.cellValue).forValue((a, o) => {
|
|
638
638
|
const c = this._hyperLinkModel.getHyperLinkByLocation(t, n, a, o);
|
|
639
|
-
c && (
|
|
640
|
-
id:
|
|
639
|
+
c && (r.push({
|
|
640
|
+
id: N.id,
|
|
641
641
|
params: {
|
|
642
642
|
unitId: t,
|
|
643
643
|
subUnitId: n,
|
|
644
644
|
id: c.id
|
|
645
645
|
}
|
|
646
646
|
}), i.push({
|
|
647
|
-
id:
|
|
647
|
+
id: D.id,
|
|
648
648
|
params: {
|
|
649
649
|
unitId: t,
|
|
650
650
|
subUnitId: n,
|
|
@@ -653,7 +653,7 @@ let se = class extends T {
|
|
|
653
653
|
}));
|
|
654
654
|
}), {
|
|
655
655
|
undos: i,
|
|
656
|
-
redos:
|
|
656
|
+
redos: r
|
|
657
657
|
};
|
|
658
658
|
}
|
|
659
659
|
return {
|
|
@@ -665,22 +665,22 @@ let se = class extends T {
|
|
|
665
665
|
}
|
|
666
666
|
_initClearSelectionCommandInterceptor() {
|
|
667
667
|
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
668
|
-
getMutations: (
|
|
669
|
-
if (
|
|
670
|
-
const e = [], t = [], n = this._selectionManagerService.getCurrentLastSelection(),
|
|
671
|
-
if (n &&
|
|
672
|
-
const { unitId: i, subUnitId: a } =
|
|
673
|
-
|
|
668
|
+
getMutations: (s) => {
|
|
669
|
+
if (s.id === dt.id || s.id === ct.id || s.id === lt.id) {
|
|
670
|
+
const e = [], t = [], n = this._selectionManagerService.getCurrentLastSelection(), r = j(this._univerInstanceService);
|
|
671
|
+
if (n && r) {
|
|
672
|
+
const { unitId: i, subUnitId: a } = r;
|
|
673
|
+
Ke.foreach(n.range, (o, c) => {
|
|
674
674
|
const d = this._hyperLinkModel.getHyperLinkByLocation(i, a, o, c);
|
|
675
675
|
d && (e.push({
|
|
676
|
-
id:
|
|
676
|
+
id: N.id,
|
|
677
677
|
params: {
|
|
678
678
|
unitId: i,
|
|
679
679
|
subUnitId: a,
|
|
680
680
|
id: d.id
|
|
681
681
|
}
|
|
682
682
|
}), t.push({
|
|
683
|
-
id:
|
|
683
|
+
id: D.id,
|
|
684
684
|
params: {
|
|
685
685
|
unitId: i,
|
|
686
686
|
subUnitId: a,
|
|
@@ -702,44 +702,44 @@ let se = class extends T {
|
|
|
702
702
|
}));
|
|
703
703
|
}
|
|
704
704
|
_initAfterEditor() {
|
|
705
|
-
this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
706
|
-
handler: (
|
|
707
|
-
if (!
|
|
708
|
-
return t(
|
|
709
|
-
if (typeof
|
|
710
|
-
const { unitId: n, subUnitId:
|
|
705
|
+
this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(ut, {
|
|
706
|
+
handler: (s, e, t) => {
|
|
707
|
+
if (!s || s.p)
|
|
708
|
+
return t(s);
|
|
709
|
+
if (typeof s.v == "string" && de.isLegalUrl(s.v) && s.v[s.v.length - 1] !== " ") {
|
|
710
|
+
const { unitId: n, subUnitId: r } = e, i = this._univerInstanceService.getUnit(n, I.UNIVER_SHEET), a = i == null ? void 0 : i.getSheetBySheetId(r);
|
|
711
711
|
if (!a)
|
|
712
|
-
return t(
|
|
713
|
-
const o = a.getBlankCellDocumentModel(
|
|
712
|
+
return t(s);
|
|
713
|
+
const o = a.getBlankCellDocumentModel(s);
|
|
714
714
|
if (!o.documentModel)
|
|
715
|
-
return t(
|
|
716
|
-
const c =
|
|
715
|
+
return t(s);
|
|
716
|
+
const c = Z.selection.replace({
|
|
717
717
|
selection: {
|
|
718
718
|
startOffset: 0,
|
|
719
|
-
endOffset:
|
|
719
|
+
endOffset: s.v.length,
|
|
720
720
|
collapsed: !1
|
|
721
721
|
},
|
|
722
722
|
body: {
|
|
723
|
-
dataStream: `${
|
|
723
|
+
dataStream: `${s.v}`,
|
|
724
724
|
customRanges: [{
|
|
725
725
|
startIndex: 0,
|
|
726
|
-
endIndex:
|
|
726
|
+
endIndex: s.v.length - 1,
|
|
727
727
|
rangeId: ce(),
|
|
728
728
|
rangeType: U.HYPERLINK,
|
|
729
729
|
properties: {
|
|
730
|
-
url:
|
|
730
|
+
url: s.v
|
|
731
731
|
}
|
|
732
732
|
}]
|
|
733
733
|
},
|
|
734
734
|
doc: o.documentModel
|
|
735
735
|
});
|
|
736
736
|
if (!c)
|
|
737
|
-
return t(
|
|
737
|
+
return t(s);
|
|
738
738
|
const d = o.documentModel.getBody();
|
|
739
739
|
return le.apply(d, c.serialize()), t({
|
|
740
|
-
...
|
|
740
|
+
...s,
|
|
741
741
|
p: {
|
|
742
|
-
id:
|
|
742
|
+
id: Ye,
|
|
743
743
|
body: d,
|
|
744
744
|
documentStyle: {
|
|
745
745
|
pageSize: {
|
|
@@ -750,32 +750,32 @@ let se = class extends T {
|
|
|
750
750
|
}
|
|
751
751
|
});
|
|
752
752
|
}
|
|
753
|
-
return t(
|
|
753
|
+
return t(s);
|
|
754
754
|
}
|
|
755
755
|
}));
|
|
756
756
|
}
|
|
757
757
|
};
|
|
758
|
-
se =
|
|
758
|
+
se = Et([
|
|
759
759
|
X(0, M(ue)),
|
|
760
|
-
X(1, M(
|
|
761
|
-
X(2, M(
|
|
760
|
+
X(1, M(R)),
|
|
761
|
+
X(2, M(Oe)),
|
|
762
762
|
X(3, k)
|
|
763
763
|
], se);
|
|
764
|
-
var
|
|
765
|
-
for (var
|
|
766
|
-
(a =
|
|
767
|
-
return
|
|
768
|
-
}, be = (
|
|
764
|
+
var Ut = Object.getOwnPropertyDescriptor, bt = (s, e, t, n) => {
|
|
765
|
+
for (var r = n > 1 ? void 0 : n ? Ut(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
766
|
+
(a = s[i]) && (r = a(r) || r);
|
|
767
|
+
return r;
|
|
768
|
+
}, be = (s, e) => (t, n) => e(t, n, s);
|
|
769
769
|
let ie = class extends T {
|
|
770
|
-
constructor(
|
|
771
|
-
super(), this._resourceManagerService =
|
|
770
|
+
constructor(s, e) {
|
|
771
|
+
super(), this._resourceManagerService = s, this._hyperLinkModel = e, this._initSnapshot();
|
|
772
772
|
}
|
|
773
773
|
_initSnapshot() {
|
|
774
|
-
const
|
|
775
|
-
const n = this._hyperLinkModel.getUnit(t),
|
|
774
|
+
const s = (t) => {
|
|
775
|
+
const n = this._hyperLinkModel.getUnit(t), r = {};
|
|
776
776
|
return n ? (n.forEach((i) => {
|
|
777
|
-
|
|
778
|
-
}), JSON.stringify(
|
|
777
|
+
r[i.subUnitId] = i.links.map(({ display: a, ...o }) => o);
|
|
778
|
+
}), JSON.stringify(r)) : "";
|
|
779
779
|
}, e = (t) => {
|
|
780
780
|
if (!t)
|
|
781
781
|
return {};
|
|
@@ -787,17 +787,17 @@ let ie = class extends T {
|
|
|
787
787
|
};
|
|
788
788
|
this.disposeWithMe(
|
|
789
789
|
this._resourceManagerService.registerPluginResource({
|
|
790
|
-
pluginName:
|
|
791
|
-
businesses: [
|
|
792
|
-
toJson: (t) =>
|
|
790
|
+
pluginName: xe,
|
|
791
|
+
businesses: [I.UNIVER_SHEET],
|
|
792
|
+
toJson: (t) => s(t),
|
|
793
793
|
parseJson: (t) => e(t),
|
|
794
794
|
onUnLoad: (t) => {
|
|
795
795
|
this._hyperLinkModel.deleteUnit(t);
|
|
796
796
|
},
|
|
797
797
|
onLoad: async (t, n) => {
|
|
798
|
-
Object.keys(n).forEach((
|
|
799
|
-
n[
|
|
800
|
-
this._hyperLinkModel.addHyperLink(t,
|
|
798
|
+
Object.keys(n).forEach((r) => {
|
|
799
|
+
n[r].forEach((a) => {
|
|
800
|
+
this._hyperLinkModel.addHyperLink(t, r, a);
|
|
801
801
|
});
|
|
802
802
|
});
|
|
803
803
|
}
|
|
@@ -805,22 +805,22 @@ let ie = class extends T {
|
|
|
805
805
|
);
|
|
806
806
|
}
|
|
807
807
|
};
|
|
808
|
-
ie =
|
|
809
|
-
be(0,
|
|
810
|
-
be(1, M(
|
|
808
|
+
ie = bt([
|
|
809
|
+
be(0, Ge),
|
|
810
|
+
be(1, M(R))
|
|
811
811
|
], ie);
|
|
812
812
|
const Pt = {
|
|
813
|
-
type:
|
|
813
|
+
type: L.COMMAND,
|
|
814
814
|
id: "sheets.command.add-hyper-link",
|
|
815
815
|
// eslint-disable-next-line max-lines-per-function
|
|
816
|
-
async handler(
|
|
816
|
+
async handler(s, e) {
|
|
817
817
|
if (!e) return !1;
|
|
818
|
-
const t =
|
|
818
|
+
const t = s.get(b), n = s.get(Re), r = s.get(k), i = s.get(R), a = s.get(ue), o = j(r, e);
|
|
819
819
|
if (!o) return !1;
|
|
820
|
-
const { unitId: c, subUnitId: d, workbook: l, worksheet: u } = o, { link: h } = e, { payload: g, display: p, row: f, column:
|
|
820
|
+
const { unitId: c, subUnitId: d, workbook: l, worksheet: u } = o, { link: h } = e, { payload: g, display: p, row: f, column: m, id: _ } = h, C = u.getCell(f, m), y = u.getBlankCellDocumentModel(C), v = y.documentModel.getSnapshot(), S = de.deepClone(v.body);
|
|
821
821
|
if (!S) return !1;
|
|
822
|
-
let
|
|
823
|
-
if (p ?
|
|
822
|
+
let P;
|
|
823
|
+
if (p ? P = Z.selection.replace({
|
|
824
824
|
selection: {
|
|
825
825
|
startOffset: 0,
|
|
826
826
|
endOffset: S.dataStream.length - 2,
|
|
@@ -832,7 +832,7 @@ const Pt = {
|
|
|
832
832
|
startIndex: 0,
|
|
833
833
|
endIndex: p.length - 1,
|
|
834
834
|
rangeType: U.HYPERLINK,
|
|
835
|
-
rangeId:
|
|
835
|
+
rangeId: _,
|
|
836
836
|
properties: {
|
|
837
837
|
url: g
|
|
838
838
|
// refId: id,
|
|
@@ -840,23 +840,23 @@ const Pt = {
|
|
|
840
840
|
}]
|
|
841
841
|
},
|
|
842
842
|
doc: y.documentModel
|
|
843
|
-
}) :
|
|
843
|
+
}) : P = Z.customRange.add({
|
|
844
844
|
body: S,
|
|
845
845
|
ranges: [{ startOffset: 0, endOffset: S.dataStream.length - 2, collapsed: !1 }],
|
|
846
|
-
rangeId:
|
|
846
|
+
rangeId: _,
|
|
847
847
|
rangeType: U.HYPERLINK,
|
|
848
848
|
properties: {
|
|
849
849
|
url: g,
|
|
850
|
-
refId:
|
|
850
|
+
refId: _
|
|
851
851
|
}
|
|
852
|
-
}), !
|
|
853
|
-
const F = le.apply(S,
|
|
852
|
+
}), !P) return !1;
|
|
853
|
+
const F = le.apply(S, P.serialize()), O = {
|
|
854
854
|
p: {
|
|
855
|
-
...
|
|
855
|
+
...v,
|
|
856
856
|
body: F
|
|
857
857
|
},
|
|
858
858
|
t: Ie.STRING
|
|
859
|
-
}, A = a.onWriteCell(l, u, f,
|
|
859
|
+
}, A = a.onWriteCell(l, u, f, m, O), W = {
|
|
860
860
|
unitId: c,
|
|
861
861
|
subUnitId: d,
|
|
862
862
|
cellValue: {
|
|
@@ -865,39 +865,39 @@ const Pt = {
|
|
|
865
865
|
}
|
|
866
866
|
}
|
|
867
867
|
}, pe = {
|
|
868
|
-
id:
|
|
868
|
+
id: V.id,
|
|
869
869
|
params: W
|
|
870
|
-
}, G = Me(
|
|
871
|
-
id:
|
|
870
|
+
}, G = Me(s, W), he = {
|
|
871
|
+
id: V.id,
|
|
872
872
|
params: G
|
|
873
|
-
}, K = [pe], H = [he],
|
|
874
|
-
return
|
|
875
|
-
id:
|
|
873
|
+
}, K = [pe], H = [he], x = i.getHyperLinkByLocation(c, d, f, m);
|
|
874
|
+
return x && (K.push({
|
|
875
|
+
id: N.id,
|
|
876
876
|
params: {
|
|
877
877
|
unitId: c,
|
|
878
878
|
subUnitId: d,
|
|
879
|
-
id:
|
|
879
|
+
id: x.id
|
|
880
880
|
}
|
|
881
881
|
}), H.push({
|
|
882
|
-
id:
|
|
882
|
+
id: D.id,
|
|
883
883
|
params: {
|
|
884
884
|
unitId: c,
|
|
885
885
|
subUnitId: d,
|
|
886
|
-
link:
|
|
886
|
+
link: x
|
|
887
887
|
}
|
|
888
|
-
})), await Y(K, t) ? await a.onValidateCell(l, u, f,
|
|
888
|
+
})), await Y(K, t) ? await a.onValidateCell(l, u, f, m) === !1 ? (Y(H, t), !1) : (n.pushUndoRedo({
|
|
889
889
|
redoMutations: K,
|
|
890
890
|
undoMutations: H,
|
|
891
891
|
unitID: c
|
|
892
892
|
}), !0) : !1;
|
|
893
893
|
}
|
|
894
|
-
},
|
|
894
|
+
}, Dt = {
|
|
895
895
|
id: "sheets.command.add-rich-hyper-link",
|
|
896
|
-
type:
|
|
897
|
-
handler: async (
|
|
896
|
+
type: L.COMMAND,
|
|
897
|
+
handler: async (s, e) => {
|
|
898
898
|
if (!e)
|
|
899
899
|
return !1;
|
|
900
|
-
const { documentId: t, link: n } = e,
|
|
900
|
+
const { documentId: t, link: n } = e, r = s.get(b), i = ce(), { payload: a } = n, o = ft(s, {
|
|
901
901
|
unitId: t,
|
|
902
902
|
rangeId: i,
|
|
903
903
|
rangeType: U.HYPERLINK,
|
|
@@ -906,26 +906,26 @@ const Pt = {
|
|
|
906
906
|
refId: i
|
|
907
907
|
}
|
|
908
908
|
});
|
|
909
|
-
return o ?
|
|
909
|
+
return o ? r.syncExecuteCommand(o.id, o.params) : !1;
|
|
910
910
|
}
|
|
911
|
-
},
|
|
912
|
-
type:
|
|
911
|
+
}, Nt = {
|
|
912
|
+
type: L.COMMAND,
|
|
913
913
|
id: "sheets.command.cancel-hyper-link",
|
|
914
914
|
// eslint-disable-next-line max-lines-per-function
|
|
915
|
-
handler(
|
|
916
|
-
var
|
|
915
|
+
handler(s, e) {
|
|
916
|
+
var O, A;
|
|
917
917
|
if (!e) return !1;
|
|
918
|
-
const t =
|
|
918
|
+
const t = s.get(b), n = s.get(Re), r = s.get(k), i = s.get(R), a = j(r, e);
|
|
919
919
|
if (!a) return !1;
|
|
920
920
|
const { row: o, column: c, id: d } = e, { unitId: l, subUnitId: u, worksheet: h } = a, g = h.getCell(o, c);
|
|
921
921
|
if (!g) return !1;
|
|
922
922
|
const p = h.getCellDocumentModelWithFormula(g);
|
|
923
923
|
if (!(p != null && p.documentModel)) return !1;
|
|
924
|
-
const f = de.deepClone(p.documentModel.getSnapshot()),
|
|
925
|
-
if (!_) return !1;
|
|
926
|
-
const m = Q.customRange.delete({ documentDataModel: p.documentModel, rangeId: _.rangeId });
|
|
924
|
+
const f = de.deepClone(p.documentModel.getSnapshot()), m = (A = (O = f.body) == null ? void 0 : O.customRanges) == null ? void 0 : A.find((W) => `${W.rangeId}` === d);
|
|
927
925
|
if (!m) return !1;
|
|
928
|
-
const
|
|
926
|
+
const _ = Z.customRange.delete({ documentDataModel: p.documentModel, rangeId: m.rangeId });
|
|
927
|
+
if (!_) return !1;
|
|
928
|
+
const C = le.apply(f.body, _.serialize()), y = [], v = [], S = {
|
|
929
929
|
unitId: l,
|
|
930
930
|
subUnitId: u,
|
|
931
931
|
cellValue: {
|
|
@@ -941,24 +941,24 @@ const Pt = {
|
|
|
941
941
|
}
|
|
942
942
|
};
|
|
943
943
|
y.push({
|
|
944
|
-
id:
|
|
944
|
+
id: V.id,
|
|
945
945
|
params: S
|
|
946
946
|
});
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
-
id:
|
|
950
|
-
params:
|
|
947
|
+
const P = Me(s, S);
|
|
948
|
+
v.push({
|
|
949
|
+
id: V.id,
|
|
950
|
+
params: P
|
|
951
951
|
});
|
|
952
952
|
const F = i.getHyperLinkByLocation(l, u, o, c);
|
|
953
953
|
return F && (y.push({
|
|
954
|
-
id:
|
|
954
|
+
id: N.id,
|
|
955
955
|
params: {
|
|
956
956
|
unitId: l,
|
|
957
957
|
subUnitId: u,
|
|
958
958
|
id: d
|
|
959
959
|
}
|
|
960
|
-
}),
|
|
961
|
-
id:
|
|
960
|
+
}), v.push({
|
|
961
|
+
id: D.id,
|
|
962
962
|
params: {
|
|
963
963
|
unitId: l,
|
|
964
964
|
subUnitId: u,
|
|
@@ -968,56 +968,56 @@ const Pt = {
|
|
|
968
968
|
}
|
|
969
969
|
})), Y(y, t).result ? (n.pushUndoRedo({
|
|
970
970
|
redoMutations: y,
|
|
971
|
-
undoMutations:
|
|
971
|
+
undoMutations: v,
|
|
972
972
|
unitID: l
|
|
973
973
|
}), !0) : !1;
|
|
974
974
|
}
|
|
975
|
-
},
|
|
976
|
-
type:
|
|
975
|
+
}, Ot = {
|
|
976
|
+
type: L.COMMAND,
|
|
977
977
|
id: "sheets.command.cancel-rich-hyper-link",
|
|
978
|
-
handler(
|
|
978
|
+
handler(s, e) {
|
|
979
979
|
var l, u;
|
|
980
980
|
if (!e)
|
|
981
981
|
return !1;
|
|
982
|
-
const { id: t, documentId: n } = e,
|
|
982
|
+
const { id: t, documentId: n } = e, r = s.get(b), a = s.get(k).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);
|
|
983
983
|
let c = null;
|
|
984
984
|
o && o.endIndex === a.getBody().dataStream.length - 3 && (c = {
|
|
985
985
|
dataStream: " "
|
|
986
986
|
});
|
|
987
|
-
const d = mt(
|
|
988
|
-
return d ?
|
|
987
|
+
const d = mt(s, { unitId: n, rangeId: t, insert: c });
|
|
988
|
+
return d ? r.syncExecuteCommand(d.id, d.params) : !1;
|
|
989
989
|
}
|
|
990
|
-
},
|
|
991
|
-
type:
|
|
990
|
+
}, Ht = {
|
|
991
|
+
type: L.COMMAND,
|
|
992
992
|
id: "sheets.command.update-hyper-link",
|
|
993
993
|
// eslint-disable-next-line max-lines-per-function
|
|
994
|
-
async handler(
|
|
995
|
-
var we, ke,
|
|
994
|
+
async handler(s, e) {
|
|
995
|
+
var we, ke, Le;
|
|
996
996
|
if (!e) return !1;
|
|
997
|
-
const t =
|
|
997
|
+
const t = s.get(b), n = s.get(Re), r = s.get(k), i = s.get(R), a = s.get(ue), o = j(r, {
|
|
998
998
|
unitId: e.unitId,
|
|
999
999
|
subUnitId: e.subUnitId
|
|
1000
1000
|
});
|
|
1001
1001
|
if (!o) return !1;
|
|
1002
|
-
const { payload: c, row: d, column: l, id: u } = e, { workbook: h, worksheet: g, unitId: p, subUnitId: f } = o, { payload:
|
|
1002
|
+
const { payload: c, row: d, column: l, id: u } = e, { workbook: h, worksheet: g, unitId: p, subUnitId: f } = o, { payload: m, display: _ = "" } = c, C = g.getCell(d, l);
|
|
1003
1003
|
if (!C) return !1;
|
|
1004
1004
|
const y = g.getCellDocumentModelWithFormula(C);
|
|
1005
1005
|
if (!(y != null && y.documentModel)) return !1;
|
|
1006
|
-
const
|
|
1006
|
+
const v = y.documentModel.getSnapshot(), S = (ke = (we = v.body) == null ? void 0 : we.customRanges) == null ? void 0 : ke.find((Ee) => `${Ee.rangeId}` === u);
|
|
1007
1007
|
if (!S) return !1;
|
|
1008
|
-
const
|
|
1009
|
-
$ && ($.ed =
|
|
1010
|
-
const
|
|
1008
|
+
const P = ce(), $ = (Le = De(y.documentModel.getBody(), S.startIndex, S.endIndex + 1).textRuns) == null ? void 0 : Le[0];
|
|
1009
|
+
$ && ($.ed = _.length + 1);
|
|
1010
|
+
const O = He(s, {
|
|
1011
1011
|
unitId: p,
|
|
1012
1012
|
body: {
|
|
1013
|
-
dataStream: `${
|
|
1013
|
+
dataStream: `${_}`,
|
|
1014
1014
|
customRanges: [{
|
|
1015
|
-
rangeId:
|
|
1015
|
+
rangeId: P,
|
|
1016
1016
|
rangeType: U.HYPERLINK,
|
|
1017
1017
|
startIndex: 0,
|
|
1018
|
-
endIndex:
|
|
1018
|
+
endIndex: _.length - 1,
|
|
1019
1019
|
properties: {
|
|
1020
|
-
url:
|
|
1020
|
+
url: m
|
|
1021
1021
|
}
|
|
1022
1022
|
}],
|
|
1023
1023
|
textRuns: $ ? [$] : void 0
|
|
@@ -1029,16 +1029,16 @@ const Pt = {
|
|
|
1029
1029
|
},
|
|
1030
1030
|
doc: y.documentModel
|
|
1031
1031
|
});
|
|
1032
|
-
if (!
|
|
1032
|
+
if (!O)
|
|
1033
1033
|
return !1;
|
|
1034
|
-
const A = le.apply(de.deepClone(
|
|
1034
|
+
const A = le.apply(de.deepClone(v.body), O.textX.serialize()), W = {
|
|
1035
1035
|
p: {
|
|
1036
|
-
...
|
|
1036
|
+
...v,
|
|
1037
1037
|
body: A
|
|
1038
1038
|
},
|
|
1039
1039
|
t: Ie.STRING
|
|
1040
1040
|
}, pe = a.onWriteCell(h, g, d, l, W), G = {
|
|
1041
|
-
id:
|
|
1041
|
+
id: V.id,
|
|
1042
1042
|
params: {
|
|
1043
1043
|
unitId: p,
|
|
1044
1044
|
subUnitId: f,
|
|
@@ -1048,46 +1048,46 @@ const Pt = {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
}
|
|
1050
1050
|
}
|
|
1051
|
-
}, he = Me(
|
|
1052
|
-
id:
|
|
1051
|
+
}, he = Me(s, G.params), K = {
|
|
1052
|
+
id: V.id,
|
|
1053
1053
|
params: he
|
|
1054
|
-
}, H = [G],
|
|
1054
|
+
}, H = [G], x = [K], z = i.getHyperLinkByLocation(p, f, d, l);
|
|
1055
1055
|
return z && (H.push({
|
|
1056
|
-
id:
|
|
1056
|
+
id: N.id,
|
|
1057
1057
|
params: {
|
|
1058
1058
|
unitId: p,
|
|
1059
1059
|
subUnitId: f,
|
|
1060
1060
|
id: z.id
|
|
1061
1061
|
}
|
|
1062
|
-
}),
|
|
1063
|
-
id:
|
|
1062
|
+
}), x.push({
|
|
1063
|
+
id: D.id,
|
|
1064
1064
|
params: {
|
|
1065
1065
|
unitId: p,
|
|
1066
1066
|
subUnitId: f,
|
|
1067
1067
|
link: z
|
|
1068
1068
|
}
|
|
1069
|
-
})), Y(H, t) ? await a.onValidateCell(h, g, d, l) === !1 ? (Y(
|
|
1069
|
+
})), Y(H, t) ? await a.onValidateCell(h, g, d, l) === !1 ? (Y(x, t), !1) : (n.pushUndoRedo({
|
|
1070
1070
|
redoMutations: H,
|
|
1071
|
-
undoMutations:
|
|
1071
|
+
undoMutations: x,
|
|
1072
1072
|
unitID: p
|
|
1073
1073
|
}), !0) : !1;
|
|
1074
1074
|
}
|
|
1075
1075
|
}, xt = {
|
|
1076
|
-
type:
|
|
1076
|
+
type: L.COMMAND,
|
|
1077
1077
|
id: "sheets.command.update-rich-hyper-link",
|
|
1078
|
-
handler: (
|
|
1079
|
-
var p, f,
|
|
1078
|
+
handler: (s, e) => {
|
|
1079
|
+
var p, f, m, _;
|
|
1080
1080
|
if (!e)
|
|
1081
1081
|
return !1;
|
|
1082
|
-
const { documentId: t, payload: n, id:
|
|
1082
|
+
const { documentId: t, payload: n, id: r } = e, i = s.get(k), a = s.get(b), o = i.getUnit(t, I.UNIVER_DOC);
|
|
1083
1083
|
if (!o)
|
|
1084
1084
|
return !1;
|
|
1085
|
-
const c = (f = (p = o.getBody()) == null ? void 0 : p.customRanges) == null ? void 0 : f.find((C) => C.rangeId ===
|
|
1085
|
+
const c = (f = (p = o.getBody()) == null ? void 0 : p.customRanges) == null ? void 0 : f.find((C) => C.rangeId === r);
|
|
1086
1086
|
if (!c)
|
|
1087
1087
|
return !1;
|
|
1088
|
-
const d = (
|
|
1088
|
+
const d = (m = e.payload.display) != null ? m : "", l = ce(), h = (_ = De(o.getBody(), c.startIndex, c.endIndex + 1).textRuns) == null ? void 0 : _[0];
|
|
1089
1089
|
h && (h.ed = d.length + 1);
|
|
1090
|
-
const g = He(
|
|
1090
|
+
const g = He(s, {
|
|
1091
1091
|
unitId: t,
|
|
1092
1092
|
body: {
|
|
1093
1093
|
dataStream: `${d}`,
|
|
@@ -1112,75 +1112,75 @@ const Pt = {
|
|
|
1112
1112
|
return g ? a.syncExecuteCommand(g.id, g.params) : !1;
|
|
1113
1113
|
}
|
|
1114
1114
|
};
|
|
1115
|
-
var
|
|
1116
|
-
for (var
|
|
1117
|
-
(a =
|
|
1118
|
-
return
|
|
1119
|
-
},
|
|
1115
|
+
var Vt = Object.getOwnPropertyDescriptor, Tt = (s, e, t, n) => {
|
|
1116
|
+
for (var r = n > 1 ? void 0 : n ? Vt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
1117
|
+
(a = s[i]) && (r = a(r) || r);
|
|
1118
|
+
return r;
|
|
1119
|
+
}, $t = (s, e) => (t, n) => e(t, n, s);
|
|
1120
1120
|
let ae = class extends T {
|
|
1121
|
-
constructor(
|
|
1122
|
-
super(), this._commandService =
|
|
1121
|
+
constructor(s) {
|
|
1122
|
+
super(), this._commandService = s, this._registerCommands();
|
|
1123
1123
|
}
|
|
1124
1124
|
_registerCommands() {
|
|
1125
1125
|
[
|
|
1126
1126
|
Pt,
|
|
1127
|
-
Vt,
|
|
1128
|
-
Dt,
|
|
1129
|
-
xt,
|
|
1130
1127
|
Ht,
|
|
1128
|
+
Nt,
|
|
1129
|
+
xt,
|
|
1131
1130
|
Ot,
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1131
|
+
Dt,
|
|
1132
|
+
D,
|
|
1133
|
+
_e,
|
|
1134
|
+
N,
|
|
1135
1135
|
ye,
|
|
1136
1136
|
q
|
|
1137
|
-
].forEach((
|
|
1138
|
-
this._commandService.registerCommand(
|
|
1137
|
+
].forEach((s) => {
|
|
1138
|
+
this._commandService.registerCommand(s);
|
|
1139
1139
|
});
|
|
1140
1140
|
}
|
|
1141
1141
|
};
|
|
1142
|
-
ae =
|
|
1143
|
-
|
|
1142
|
+
ae = Tt([
|
|
1143
|
+
$t(0, b)
|
|
1144
1144
|
], ae);
|
|
1145
|
-
var
|
|
1146
|
-
for (var
|
|
1147
|
-
(a =
|
|
1148
|
-
return
|
|
1149
|
-
},
|
|
1150
|
-
let
|
|
1151
|
-
constructor(
|
|
1152
|
-
this._univerInstanceService =
|
|
1145
|
+
var At = Object.getOwnPropertyDescriptor, Wt = (s, e, t, n) => {
|
|
1146
|
+
for (var r = n > 1 ? void 0 : n ? At(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
1147
|
+
(a = s[i]) && (r = a(r) || r);
|
|
1148
|
+
return r;
|
|
1149
|
+
}, me = (s, e) => (t, n) => e(t, n, s);
|
|
1150
|
+
let ve = class {
|
|
1151
|
+
constructor(s, e, t) {
|
|
1152
|
+
this._univerInstanceService = s, this._localeService = e, this._definedNamesService = t;
|
|
1153
1153
|
}
|
|
1154
|
-
buildHyperLink(
|
|
1155
|
-
return `#${
|
|
1154
|
+
buildHyperLink(s, e, t) {
|
|
1155
|
+
return `#${E.SHEET}=${e}${t ? `&${typeof t == "string" ? E.DEFINE_NAME : E.RANGE}=${typeof t == "string" ? t : B(t)}` : ""}`;
|
|
1156
1156
|
}
|
|
1157
|
-
parseHyperLink(
|
|
1158
|
-
var e, t, n,
|
|
1159
|
-
if (
|
|
1160
|
-
const i = new URLSearchParams(
|
|
1157
|
+
parseHyperLink(s) {
|
|
1158
|
+
var e, t, n, r;
|
|
1159
|
+
if (s.startsWith("#")) {
|
|
1160
|
+
const i = new URLSearchParams(s.slice(1)), a = {
|
|
1161
1161
|
gid: (e = i.get("gid")) != null ? e : "",
|
|
1162
1162
|
range: (t = i.get("range")) != null ? t : "",
|
|
1163
1163
|
rangeid: (n = i.get("rangeid")) != null ? n : "",
|
|
1164
|
-
unitid: (
|
|
1164
|
+
unitid: (r = i.get("unitid")) != null ? r : ""
|
|
1165
1165
|
}, o = this._getURLName(a);
|
|
1166
1166
|
return {
|
|
1167
1167
|
type: o.type,
|
|
1168
1168
|
name: o.name,
|
|
1169
|
-
url:
|
|
1169
|
+
url: s,
|
|
1170
1170
|
searchObj: a
|
|
1171
1171
|
};
|
|
1172
1172
|
} else
|
|
1173
1173
|
return {
|
|
1174
|
-
type:
|
|
1175
|
-
name:
|
|
1176
|
-
url:
|
|
1174
|
+
type: E.URL,
|
|
1175
|
+
name: s,
|
|
1176
|
+
url: s,
|
|
1177
1177
|
searchObj: null
|
|
1178
1178
|
};
|
|
1179
1179
|
}
|
|
1180
|
-
_getURLName(
|
|
1180
|
+
_getURLName(s) {
|
|
1181
1181
|
var d;
|
|
1182
|
-
const { gid: e, range: t, rangeid: n, unitid:
|
|
1183
|
-
type:
|
|
1182
|
+
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 = {
|
|
1183
|
+
type: E.INVALID,
|
|
1184
1184
|
name: this._localeService.t("hyperLink.message.refError")
|
|
1185
1185
|
};
|
|
1186
1186
|
if (!i)
|
|
@@ -1190,58 +1190,58 @@ let Re = class {
|
|
|
1190
1190
|
if (!o) return a;
|
|
1191
1191
|
const l = Ce(t).range;
|
|
1192
1192
|
return Se(l, o) && t !== ee ? {
|
|
1193
|
-
type:
|
|
1194
|
-
name:
|
|
1193
|
+
type: E.RANGE,
|
|
1194
|
+
name: gt(c, l)
|
|
1195
1195
|
} : a;
|
|
1196
1196
|
}
|
|
1197
1197
|
if (n) {
|
|
1198
1198
|
const l = this._definedNamesService.getValueById(i.getUnitId(), n);
|
|
1199
1199
|
return l ? {
|
|
1200
|
-
type:
|
|
1200
|
+
type: E.DEFINE_NAME,
|
|
1201
1201
|
name: l.formulaOrRefString
|
|
1202
1202
|
} : a;
|
|
1203
1203
|
}
|
|
1204
1204
|
if (e) {
|
|
1205
1205
|
const l = i.getSheetBySheetId(e);
|
|
1206
1206
|
return l ? {
|
|
1207
|
-
type:
|
|
1207
|
+
type: E.SHEET,
|
|
1208
1208
|
name: l.getName()
|
|
1209
1209
|
} : a;
|
|
1210
1210
|
}
|
|
1211
1211
|
return a;
|
|
1212
1212
|
}
|
|
1213
1213
|
};
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
],
|
|
1219
|
-
var
|
|
1220
|
-
for (var
|
|
1221
|
-
(a =
|
|
1222
|
-
return
|
|
1223
|
-
},
|
|
1214
|
+
ve = Wt([
|
|
1215
|
+
me(0, k),
|
|
1216
|
+
me(1, M(ze)),
|
|
1217
|
+
me(2, ht)
|
|
1218
|
+
], ve);
|
|
1219
|
+
var Bt = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, Ft = (s, e, t) => e in s ? Bt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, Kt = (s, e, t, n) => {
|
|
1220
|
+
for (var r = n > 1 ? void 0 : n ? jt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
1221
|
+
(a = s[i]) && (r = a(r) || r);
|
|
1222
|
+
return r;
|
|
1223
|
+
}, Pe = (s, e) => (t, n) => e(t, n, s), Ve = (s, e, t) => Ft(s, typeof e != "symbol" ? e + "" : e, t);
|
|
1224
1224
|
let oe = class extends Qe {
|
|
1225
|
-
constructor(
|
|
1226
|
-
super(), this._config =
|
|
1227
|
-
const { ...n } =
|
|
1225
|
+
constructor(s = Ue, e, t) {
|
|
1226
|
+
super(), this._config = s, this._injector = e, this._configService = t;
|
|
1227
|
+
const { ...n } = Ze(
|
|
1228
1228
|
{},
|
|
1229
1229
|
Ue,
|
|
1230
1230
|
this._config
|
|
1231
1231
|
);
|
|
1232
|
-
this._configService.setConfig(
|
|
1232
|
+
this._configService.setConfig(St, n);
|
|
1233
1233
|
}
|
|
1234
1234
|
onStarting() {
|
|
1235
|
-
|
|
1236
|
-
[
|
|
1237
|
-
[
|
|
1235
|
+
et(this._injector, [
|
|
1236
|
+
[R],
|
|
1237
|
+
[ve],
|
|
1238
1238
|
[ie],
|
|
1239
1239
|
[ae],
|
|
1240
1240
|
[te],
|
|
1241
1241
|
[se],
|
|
1242
1242
|
[ne],
|
|
1243
1243
|
[re]
|
|
1244
|
-
]),
|
|
1244
|
+
]), tt(this._injector, [
|
|
1245
1245
|
[te],
|
|
1246
1246
|
[ie],
|
|
1247
1247
|
[ae],
|
|
@@ -1251,27 +1251,27 @@ let oe = class extends Qe {
|
|
|
1251
1251
|
]);
|
|
1252
1252
|
}
|
|
1253
1253
|
};
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
oe =
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1254
|
+
Ve(oe, "pluginName", xe);
|
|
1255
|
+
Ve(oe, "type", I.UNIVER_SHEET);
|
|
1256
|
+
oe = Kt([
|
|
1257
|
+
Je(pt),
|
|
1258
|
+
Pe(1, M(Xe)),
|
|
1259
|
+
Pe(2, qe)
|
|
1260
1260
|
], oe);
|
|
1261
1261
|
export {
|
|
1262
1262
|
Pt as AddHyperLinkCommand,
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1263
|
+
D as AddHyperLinkMutation,
|
|
1264
|
+
Dt as AddRichHyperLinkCommand,
|
|
1265
|
+
Nt as CancelHyperLinkCommand,
|
|
1266
|
+
Ot as CancelRichHyperLinkCommand,
|
|
1267
1267
|
ee as ERROR_RANGE,
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1268
|
+
R as HyperLinkModel,
|
|
1269
|
+
N as RemoveHyperLinkMutation,
|
|
1270
|
+
E as SheetHyperLinkType,
|
|
1271
|
+
ve as SheetsHyperLinkParserService,
|
|
1272
1272
|
oe as UniverSheetsHyperLinkPlugin,
|
|
1273
|
-
|
|
1274
|
-
|
|
1273
|
+
Ht as UpdateHyperLinkCommand,
|
|
1274
|
+
_e as UpdateHyperLinkMutation,
|
|
1275
1275
|
ye as UpdateHyperLinkRefMutation,
|
|
1276
1276
|
xt as UpdateRichHyperLinkCommand
|
|
1277
1277
|
};
|