@univerjs/sheets-hyper-link 0.8.2-nightly.202506261607 → 0.8.3-nightly.202506271607
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 +430 -432
- package/lib/index.js +430 -432
- package/lib/types/index.d.ts +7 -6
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
package/lib/es/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var $e = Object.defineProperty;
|
|
2
2
|
var Ae = (s, e, t) => e in s ? $e(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
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,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { Disposable as T, ObjectMatrix as Q, UniverInstanceType as I, IUniverInstanceService as k, CommandType as L, ICommandService as b, IUndoRedoService as Se, Tools as de, BuildTextUtils as Z, CustomRangeType as U, TextX as ce, CellValueType as Re, sequenceExecute as Y, generateRandomId as le, getBodySlice as De, Inject as M, sequenceExecuteAsync as We, isValidRange as Ie, toDisposable as Be, DisposableCollection as je, Rectangle as Fe, Range as Ke, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ye, IResourceManagerService as Ge, 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 { addCustomRangeBySelectionFactory as nt, deleteCustomRangeFactory as rt, replaceSelectionFactory as Ne } from "@univerjs/docs";
|
|
6
|
+
import { SheetInterceptorService as ue, getSheetCommandTarget as j, SetRangeValuesMutation as V, SetRangeValuesUndoMutationFactory as Me, RefRangeService as Oe, SheetsSelectionsService as He, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests as st, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests as it, RemoveSheetCommand as at, handleDefaultRangeChangeWithEffectRefCommands as ot, SetRangeValuesCommand as dt, ClearSelectionContentCommand as ct, ClearSelectionAllCommand as lt, ClearSelectionFormatCommand as ut, AFTER_CELL_EDIT as pt, UniverSheetsPlugin as ht } from "@univerjs/sheets";
|
|
7
|
+
import { Subject as gt } from "rxjs";
|
|
8
|
+
import { deserializeRangeWithSheet as Ce, serializeRange as B, IDefinedNamesService as ft, serializeRangeWithSheet as mt } from "@univerjs/engine-formula";
|
|
9
9
|
var _t = Object.getOwnPropertyDescriptor, yt = (s, e, t, n) => {
|
|
10
10
|
for (var r = n > 1 ? void 0 : n ? _t(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
11
11
|
(a = s[i]) && (r = a(r) || r);
|
|
@@ -14,7 +14,7 @@ var _t = Object.getOwnPropertyDescriptor, yt = (s, e, t, n) => {
|
|
|
14
14
|
let R = class extends T {
|
|
15
15
|
constructor(e) {
|
|
16
16
|
super();
|
|
17
|
-
w(this, "_linkUpdate$", new
|
|
17
|
+
w(this, "_linkUpdate$", new gt());
|
|
18
18
|
w(this, "linkUpdate$", this._linkUpdate$.asObservable());
|
|
19
19
|
w(this, "_linkMap", /* @__PURE__ */ new Map());
|
|
20
20
|
w(this, "_linkPositionMap", /* @__PURE__ */ new Map());
|
|
@@ -140,8 +140,7 @@ let R = class extends T {
|
|
|
140
140
|
R = yt([
|
|
141
141
|
vt(0, k)
|
|
142
142
|
], R);
|
|
143
|
-
|
|
144
|
-
const St = "sheets-hyper-link.config", Ue = {}, D = {
|
|
143
|
+
const D = {
|
|
145
144
|
type: L.MUTATION,
|
|
146
145
|
id: "sheets.mutation.add-hyper-link",
|
|
147
146
|
handler(s, e) {
|
|
@@ -159,92 +158,394 @@ const St = "sheets-hyper-link.config", Ue = {}, D = {
|
|
|
159
158
|
const t = s.get(R), { unitId: n, subUnitId: r, id: i } = e;
|
|
160
159
|
return t.removeHyperLink(n, r, i);
|
|
161
160
|
}
|
|
162
|
-
},
|
|
163
|
-
type: L.
|
|
164
|
-
id: "sheets.
|
|
165
|
-
|
|
161
|
+
}, St = {
|
|
162
|
+
type: L.COMMAND,
|
|
163
|
+
id: "sheets.command.add-hyper-link",
|
|
164
|
+
// eslint-disable-next-line max-lines-per-function
|
|
165
|
+
async handler(s, e) {
|
|
166
|
+
if (!e) return !1;
|
|
167
|
+
const t = s.get(b), n = s.get(Se), r = s.get(k), i = s.get(R), a = s.get(ue), o = j(r, e);
|
|
168
|
+
if (!o) return !1;
|
|
169
|
+
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, f, m), v = y.documentModel.getSnapshot(), S = de.deepClone(v.body);
|
|
170
|
+
if (!S) return !1;
|
|
171
|
+
let P;
|
|
172
|
+
if (p ? P = Z.selection.replace({
|
|
173
|
+
selection: {
|
|
174
|
+
startOffset: 0,
|
|
175
|
+
endOffset: S.dataStream.length - 2,
|
|
176
|
+
collapsed: S.dataStream.length - 2 === 0
|
|
177
|
+
},
|
|
178
|
+
body: {
|
|
179
|
+
dataStream: `${p}`,
|
|
180
|
+
customRanges: [{
|
|
181
|
+
startIndex: 0,
|
|
182
|
+
endIndex: p.length - 1,
|
|
183
|
+
rangeType: U.HYPERLINK,
|
|
184
|
+
rangeId: _,
|
|
185
|
+
properties: {
|
|
186
|
+
url: g
|
|
187
|
+
// refId: id,
|
|
188
|
+
}
|
|
189
|
+
}]
|
|
190
|
+
},
|
|
191
|
+
doc: y.documentModel
|
|
192
|
+
}) : P = Z.customRange.add({
|
|
193
|
+
body: S,
|
|
194
|
+
ranges: [{ startOffset: 0, endOffset: S.dataStream.length - 2, collapsed: !1 }],
|
|
195
|
+
rangeId: _,
|
|
196
|
+
rangeType: U.HYPERLINK,
|
|
197
|
+
properties: {
|
|
198
|
+
url: g,
|
|
199
|
+
refId: _
|
|
200
|
+
}
|
|
201
|
+
}), !P) return !1;
|
|
202
|
+
const F = ce.apply(S, P.serialize()), O = {
|
|
203
|
+
p: {
|
|
204
|
+
...v,
|
|
205
|
+
body: F
|
|
206
|
+
},
|
|
207
|
+
t: Re.STRING
|
|
208
|
+
}, A = a.onWriteCell(l, u, f, m, O), W = {
|
|
209
|
+
unitId: c,
|
|
210
|
+
subUnitId: d,
|
|
211
|
+
cellValue: {
|
|
212
|
+
[h.row]: {
|
|
213
|
+
[h.column]: A
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}, pe = {
|
|
217
|
+
id: V.id,
|
|
218
|
+
params: W
|
|
219
|
+
}, G = Me(s, W), he = {
|
|
220
|
+
id: V.id,
|
|
221
|
+
params: G
|
|
222
|
+
}, K = [pe], H = [he], x = i.getHyperLinkByLocation(c, d, f, m);
|
|
223
|
+
return x && (K.push({
|
|
224
|
+
id: N.id,
|
|
225
|
+
params: {
|
|
226
|
+
unitId: c,
|
|
227
|
+
subUnitId: d,
|
|
228
|
+
id: x.id
|
|
229
|
+
}
|
|
230
|
+
}), H.push({
|
|
231
|
+
id: D.id,
|
|
232
|
+
params: {
|
|
233
|
+
unitId: c,
|
|
234
|
+
subUnitId: d,
|
|
235
|
+
link: x
|
|
236
|
+
}
|
|
237
|
+
})), await Y(K, t) ? await a.onValidateCell(l, u, f, m) === !1 ? (Y(H, t), !1) : (n.pushUndoRedo({
|
|
238
|
+
redoMutations: K,
|
|
239
|
+
undoMutations: H,
|
|
240
|
+
unitID: c
|
|
241
|
+
}), !0) : !1;
|
|
242
|
+
}
|
|
243
|
+
}, Rt = {
|
|
244
|
+
id: "sheets.command.add-rich-hyper-link",
|
|
245
|
+
type: L.COMMAND,
|
|
246
|
+
handler: async (s, e) => {
|
|
166
247
|
if (!e)
|
|
167
248
|
return !1;
|
|
168
|
-
const t = s.get(
|
|
169
|
-
|
|
249
|
+
const { documentId: t, link: n } = e, r = s.get(b), i = le(), { payload: a } = n, o = nt(s, {
|
|
250
|
+
unitId: t,
|
|
251
|
+
rangeId: i,
|
|
252
|
+
rangeType: U.HYPERLINK,
|
|
253
|
+
properties: {
|
|
254
|
+
url: a,
|
|
255
|
+
refId: i
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
return o ? r.syncExecuteCommand(o.id, o.params) : !1;
|
|
170
259
|
}
|
|
171
|
-
},
|
|
172
|
-
type: L.
|
|
173
|
-
id: "sheets.
|
|
260
|
+
}, It = {
|
|
261
|
+
type: L.COMMAND,
|
|
262
|
+
id: "sheets.command.cancel-hyper-link",
|
|
263
|
+
// eslint-disable-next-line max-lines-per-function
|
|
174
264
|
handler(s, e) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const t = s.get(
|
|
178
|
-
|
|
265
|
+
var O, A;
|
|
266
|
+
if (!e) return !1;
|
|
267
|
+
const t = s.get(b), n = s.get(Se), r = s.get(k), i = s.get(R), a = j(r, e);
|
|
268
|
+
if (!a) return !1;
|
|
269
|
+
const { row: o, column: c, id: d } = e, { unitId: l, subUnitId: u, worksheet: h } = a, g = h.getCell(o, c);
|
|
270
|
+
if (!g) return !1;
|
|
271
|
+
const p = h.getCellDocumentModelWithFormula(g, o, c);
|
|
272
|
+
if (!(p != null && p.documentModel)) return !1;
|
|
273
|
+
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);
|
|
274
|
+
if (!m) return !1;
|
|
275
|
+
const _ = Z.customRange.delete({ documentDataModel: p.documentModel, rangeId: m.rangeId });
|
|
276
|
+
if (!_) return !1;
|
|
277
|
+
const C = ce.apply(f.body, _.serialize()), y = [], v = [], S = {
|
|
278
|
+
unitId: l,
|
|
279
|
+
subUnitId: u,
|
|
280
|
+
cellValue: {
|
|
281
|
+
[o]: {
|
|
282
|
+
[c]: {
|
|
283
|
+
p: {
|
|
284
|
+
...f,
|
|
285
|
+
body: C
|
|
286
|
+
},
|
|
287
|
+
t: Re.STRING
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
y.push({
|
|
293
|
+
id: V.id,
|
|
294
|
+
params: S
|
|
295
|
+
});
|
|
296
|
+
const P = Me(s, S);
|
|
297
|
+
v.push({
|
|
298
|
+
id: V.id,
|
|
299
|
+
params: P
|
|
300
|
+
});
|
|
301
|
+
const F = i.getHyperLinkByLocation(l, u, o, c);
|
|
302
|
+
return F && (y.push({
|
|
303
|
+
id: N.id,
|
|
304
|
+
params: {
|
|
305
|
+
unitId: l,
|
|
306
|
+
subUnitId: u,
|
|
307
|
+
id: d
|
|
308
|
+
}
|
|
309
|
+
}), v.push({
|
|
310
|
+
id: D.id,
|
|
311
|
+
params: {
|
|
312
|
+
unitId: l,
|
|
313
|
+
subUnitId: u,
|
|
314
|
+
link: {
|
|
315
|
+
...F
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
})), Y(y, t).result ? (n.pushUndoRedo({
|
|
319
|
+
redoMutations: y,
|
|
320
|
+
undoMutations: v,
|
|
321
|
+
unitID: l
|
|
322
|
+
}), !0) : !1;
|
|
179
323
|
}
|
|
180
|
-
},
|
|
181
|
-
type: L.
|
|
182
|
-
id: "sheets.
|
|
324
|
+
}, Mt = {
|
|
325
|
+
type: L.COMMAND,
|
|
326
|
+
id: "sheets.command.cancel-rich-hyper-link",
|
|
183
327
|
handler(s, e) {
|
|
184
|
-
var
|
|
328
|
+
var l, u;
|
|
185
329
|
if (!e)
|
|
186
330
|
return !1;
|
|
187
|
-
const {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
331
|
+
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);
|
|
332
|
+
let c = null;
|
|
333
|
+
o && o.endIndex === a.getBody().dataStream.length - 3 && (c = {
|
|
334
|
+
dataStream: " "
|
|
335
|
+
});
|
|
336
|
+
const d = rt(s, { unitId: n, rangeId: t, insert: c });
|
|
337
|
+
return d ? r.syncExecuteCommand(d.id, d.params) : !1;
|
|
192
338
|
}
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}],
|
|
225
|
-
undos: [{
|
|
226
|
-
id: ye.id,
|
|
227
|
-
params: {
|
|
228
|
-
unitId: e,
|
|
229
|
-
subUnitId: t,
|
|
230
|
-
id: n.id,
|
|
231
|
-
row: a.startRow,
|
|
232
|
-
column: a.startColumn,
|
|
233
|
-
silent: i
|
|
234
|
-
}
|
|
235
|
-
}]
|
|
236
|
-
} : {
|
|
237
|
-
redos: [{
|
|
238
|
-
id: N.id,
|
|
239
|
-
params: {
|
|
240
|
-
unitId: e,
|
|
241
|
-
subUnitId: t,
|
|
242
|
-
id: n.id
|
|
339
|
+
}, Ct = {
|
|
340
|
+
type: L.COMMAND,
|
|
341
|
+
id: "sheets.command.update-hyper-link",
|
|
342
|
+
// eslint-disable-next-line max-lines-per-function
|
|
343
|
+
async handler(s, e) {
|
|
344
|
+
var we, ke, Le;
|
|
345
|
+
if (!e) return !1;
|
|
346
|
+
const t = s.get(b), n = s.get(Se), r = s.get(k), i = s.get(R), a = s.get(ue), o = j(r, {
|
|
347
|
+
unitId: e.unitId,
|
|
348
|
+
subUnitId: e.subUnitId
|
|
349
|
+
});
|
|
350
|
+
if (!o) return !1;
|
|
351
|
+
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);
|
|
352
|
+
if (!C) return !1;
|
|
353
|
+
const y = g.getCellDocumentModelWithFormula(C, d, l);
|
|
354
|
+
if (!(y != null && y.documentModel)) return !1;
|
|
355
|
+
const v = y.documentModel.getSnapshot(), S = (ke = (we = v.body) == null ? void 0 : we.customRanges) == null ? void 0 : ke.find((Ee) => `${Ee.rangeId}` === u);
|
|
356
|
+
if (!S) return !1;
|
|
357
|
+
const P = le(), $ = (Le = De(y.documentModel.getBody(), S.startIndex, S.endIndex + 1).textRuns) == null ? void 0 : Le[0];
|
|
358
|
+
$ && ($.ed = _.length + 1);
|
|
359
|
+
const O = Ne(s, {
|
|
360
|
+
unitId: p,
|
|
361
|
+
body: {
|
|
362
|
+
dataStream: `${_}`,
|
|
363
|
+
customRanges: [{
|
|
364
|
+
rangeId: P,
|
|
365
|
+
rangeType: U.HYPERLINK,
|
|
366
|
+
startIndex: 0,
|
|
367
|
+
endIndex: _.length - 1,
|
|
368
|
+
properties: {
|
|
369
|
+
url: m
|
|
243
370
|
}
|
|
244
371
|
}],
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
372
|
+
textRuns: $ ? [$] : void 0
|
|
373
|
+
},
|
|
374
|
+
selection: {
|
|
375
|
+
startOffset: S.startIndex,
|
|
376
|
+
endOffset: S.endIndex + 1,
|
|
377
|
+
collapsed: !1
|
|
378
|
+
},
|
|
379
|
+
doc: y.documentModel
|
|
380
|
+
});
|
|
381
|
+
if (!O)
|
|
382
|
+
return !1;
|
|
383
|
+
const A = ce.apply(de.deepClone(v.body), O.textX.serialize()), W = {
|
|
384
|
+
p: {
|
|
385
|
+
...v,
|
|
386
|
+
body: A
|
|
387
|
+
},
|
|
388
|
+
t: Re.STRING
|
|
389
|
+
}, pe = a.onWriteCell(h, g, d, l, W), G = {
|
|
390
|
+
id: V.id,
|
|
391
|
+
params: {
|
|
392
|
+
unitId: p,
|
|
393
|
+
subUnitId: f,
|
|
394
|
+
cellValue: {
|
|
395
|
+
[d]: {
|
|
396
|
+
[l]: pe
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}, he = Me(s, G.params), K = {
|
|
401
|
+
id: V.id,
|
|
402
|
+
params: he
|
|
403
|
+
}, H = [G], x = [K], z = i.getHyperLinkByLocation(p, f, d, l);
|
|
404
|
+
return z && (H.push({
|
|
405
|
+
id: N.id,
|
|
406
|
+
params: {
|
|
407
|
+
unitId: p,
|
|
408
|
+
subUnitId: f,
|
|
409
|
+
id: z.id
|
|
410
|
+
}
|
|
411
|
+
}), x.push({
|
|
412
|
+
id: D.id,
|
|
413
|
+
params: {
|
|
414
|
+
unitId: p,
|
|
415
|
+
subUnitId: f,
|
|
416
|
+
link: z
|
|
417
|
+
}
|
|
418
|
+
})), Y(H, t) ? await a.onValidateCell(h, g, d, l) === !1 ? (Y(x, t), !1) : (n.pushUndoRedo({
|
|
419
|
+
redoMutations: H,
|
|
420
|
+
undoMutations: x,
|
|
421
|
+
unitID: p
|
|
422
|
+
}), !0) : !1;
|
|
423
|
+
}
|
|
424
|
+
}, wt = {
|
|
425
|
+
type: L.COMMAND,
|
|
426
|
+
id: "sheets.command.update-rich-hyper-link",
|
|
427
|
+
handler: (s, e) => {
|
|
428
|
+
var p, f, m, _;
|
|
429
|
+
if (!e)
|
|
430
|
+
return !1;
|
|
431
|
+
const { documentId: t, payload: n, id: r } = e, i = s.get(k), a = s.get(b), o = i.getUnit(t, I.UNIVER_DOC);
|
|
432
|
+
if (!o)
|
|
433
|
+
return !1;
|
|
434
|
+
const c = (f = (p = o.getBody()) == null ? void 0 : p.customRanges) == null ? void 0 : f.find((C) => C.rangeId === r);
|
|
435
|
+
if (!c)
|
|
436
|
+
return !1;
|
|
437
|
+
const d = (m = e.payload.display) != null ? m : "", l = le(), h = (_ = De(o.getBody(), c.startIndex, c.endIndex + 1).textRuns) == null ? void 0 : _[0];
|
|
438
|
+
h && (h.ed = d.length + 1);
|
|
439
|
+
const g = Ne(s, {
|
|
440
|
+
unitId: t,
|
|
441
|
+
body: {
|
|
442
|
+
dataStream: `${d}`,
|
|
443
|
+
customRanges: [{
|
|
444
|
+
rangeId: l,
|
|
445
|
+
rangeType: U.HYPERLINK,
|
|
446
|
+
startIndex: 0,
|
|
447
|
+
endIndex: d.length - 1,
|
|
448
|
+
properties: {
|
|
449
|
+
url: n.payload
|
|
450
|
+
}
|
|
451
|
+
}],
|
|
452
|
+
textRuns: h ? [h] : void 0
|
|
453
|
+
},
|
|
454
|
+
selection: {
|
|
455
|
+
startOffset: c.startIndex,
|
|
456
|
+
endOffset: c.endIndex + 1,
|
|
457
|
+
collapsed: !1
|
|
458
|
+
},
|
|
459
|
+
doc: o
|
|
460
|
+
});
|
|
461
|
+
return g ? a.syncExecuteCommand(g.id, g.params) : !1;
|
|
462
|
+
}
|
|
463
|
+
}, _e = {
|
|
464
|
+
type: L.MUTATION,
|
|
465
|
+
id: "sheets.mutation.update-hyper-link",
|
|
466
|
+
handler(s, e) {
|
|
467
|
+
if (!e)
|
|
468
|
+
return !1;
|
|
469
|
+
const t = s.get(R), { unitId: n, subUnitId: r, payload: i, id: a } = e;
|
|
470
|
+
return t.updateHyperLink(n, r, a, i, !1);
|
|
471
|
+
}
|
|
472
|
+
}, ye = {
|
|
473
|
+
type: L.MUTATION,
|
|
474
|
+
id: "sheets.mutation.update-hyper-link-ref",
|
|
475
|
+
handler(s, e) {
|
|
476
|
+
if (!e)
|
|
477
|
+
return !1;
|
|
478
|
+
const t = s.get(R), { unitId: n, subUnitId: r, id: i, row: a, column: o, silent: c } = e;
|
|
479
|
+
return t.updateHyperLinkRef(n, r, i, { row: a, column: o }, c);
|
|
480
|
+
}
|
|
481
|
+
}, q = {
|
|
482
|
+
type: L.MUTATION,
|
|
483
|
+
id: "sheets.mutation.update-rich-hyper-link",
|
|
484
|
+
handler(s, e) {
|
|
485
|
+
var g, p, f;
|
|
486
|
+
if (!e)
|
|
487
|
+
return !1;
|
|
488
|
+
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 });
|
|
489
|
+
if (!d)
|
|
490
|
+
return !1;
|
|
491
|
+
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);
|
|
492
|
+
return h && (h.properties.url = o), !0;
|
|
493
|
+
}
|
|
494
|
+
}, kt = "sheets-hyper-link.config", Ue = {}, xe = "SHEET_HYPER_LINK_PLUGIN", ee = "err";
|
|
495
|
+
var Lt = Object.getOwnPropertyDescriptor, Et = (s, e, t, n) => {
|
|
496
|
+
for (var r = n > 1 ? void 0 : n ? Lt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
497
|
+
(a = s[i]) && (r = a(r) || r);
|
|
498
|
+
return r;
|
|
499
|
+
}, J = (s, e) => (t, n) => e(t, n, s);
|
|
500
|
+
let te = class extends T {
|
|
501
|
+
constructor(e, t, n, r) {
|
|
502
|
+
super();
|
|
503
|
+
w(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
504
|
+
w(this, "_watchDisposableMap", /* @__PURE__ */ new Map());
|
|
505
|
+
w(this, "_rangeDisableMap", /* @__PURE__ */ new Map());
|
|
506
|
+
w(this, "_rangeWatcherMap", /* @__PURE__ */ new Map());
|
|
507
|
+
w(this, "_handlePositionChange", (e, t, n, r, i) => {
|
|
508
|
+
const a = {
|
|
509
|
+
startColumn: n.column,
|
|
510
|
+
endColumn: n.column,
|
|
511
|
+
startRow: n.row,
|
|
512
|
+
endRow: n.row
|
|
513
|
+
};
|
|
514
|
+
return r ? {
|
|
515
|
+
redos: [{
|
|
516
|
+
id: ye.id,
|
|
517
|
+
params: {
|
|
518
|
+
unitId: e,
|
|
519
|
+
subUnitId: t,
|
|
520
|
+
id: n.id,
|
|
521
|
+
row: r.startRow,
|
|
522
|
+
column: r.startColumn,
|
|
523
|
+
silent: i
|
|
524
|
+
}
|
|
525
|
+
}],
|
|
526
|
+
undos: [{
|
|
527
|
+
id: ye.id,
|
|
528
|
+
params: {
|
|
529
|
+
unitId: e,
|
|
530
|
+
subUnitId: t,
|
|
531
|
+
id: n.id,
|
|
532
|
+
row: a.startRow,
|
|
533
|
+
column: a.startColumn,
|
|
534
|
+
silent: i
|
|
535
|
+
}
|
|
536
|
+
}]
|
|
537
|
+
} : {
|
|
538
|
+
redos: [{
|
|
539
|
+
id: N.id,
|
|
540
|
+
params: {
|
|
541
|
+
unitId: e,
|
|
542
|
+
subUnitId: t,
|
|
543
|
+
id: n.id
|
|
544
|
+
}
|
|
545
|
+
}],
|
|
546
|
+
undos: [{
|
|
547
|
+
id: D.id,
|
|
548
|
+
params: {
|
|
248
549
|
unitId: e,
|
|
249
550
|
subUnitId: t,
|
|
250
551
|
link: n
|
|
@@ -261,7 +562,7 @@ let te = class extends T {
|
|
|
261
562
|
startRow: n.row,
|
|
262
563
|
endRow: n.row
|
|
263
564
|
}, a = (o) => {
|
|
264
|
-
const c =
|
|
565
|
+
const c = st(i, o, { selectionManagerService: this._selectionManagerService }), d = Array.isArray(c) ? c[0] : c;
|
|
265
566
|
return d && d.startColumn === i.startColumn && d.startRow === i.startRow ? {
|
|
266
567
|
undos: [],
|
|
267
568
|
redos: []
|
|
@@ -299,9 +600,9 @@ let te = class extends T {
|
|
|
299
600
|
};
|
|
300
601
|
if (d.range && d.gid) {
|
|
301
602
|
const l = d.gid, u = Ce(d.range).range;
|
|
302
|
-
if (
|
|
603
|
+
if (Ie(u) && d.range !== ee) {
|
|
303
604
|
const h = (g) => {
|
|
304
|
-
const p =
|
|
605
|
+
const p = it(u, g, { selectionManagerService: this._selectionManagerService });
|
|
305
606
|
return p && B(p) === B(u) ? {
|
|
306
607
|
redos: [],
|
|
307
608
|
undos: []
|
|
@@ -399,14 +700,14 @@ let te = class extends T {
|
|
|
399
700
|
}));
|
|
400
701
|
}
|
|
401
702
|
};
|
|
402
|
-
te =
|
|
403
|
-
J(0, M(
|
|
703
|
+
te = Et([
|
|
704
|
+
J(0, M(Oe)),
|
|
404
705
|
J(1, M(R)),
|
|
405
|
-
J(2, M(
|
|
706
|
+
J(2, M(He)),
|
|
406
707
|
J(3, b)
|
|
407
708
|
], te);
|
|
408
|
-
var
|
|
409
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
709
|
+
var Ut = Object.getOwnPropertyDescriptor, bt = (s, e, t, n) => {
|
|
710
|
+
for (var r = n > 1 ? void 0 : n ? Ut(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
410
711
|
(a = s[i]) && (r = a(r) || r);
|
|
411
712
|
return r;
|
|
412
713
|
}, ge = (s, e) => (t, n) => e(t, n, s);
|
|
@@ -419,7 +720,7 @@ let ne = class extends T {
|
|
|
419
720
|
this._sheetInterceptorService.interceptCommand({
|
|
420
721
|
getMutations: (s) => {
|
|
421
722
|
var e;
|
|
422
|
-
if (s.id ===
|
|
723
|
+
if (s.id === at.id) {
|
|
423
724
|
const t = s.params, n = t.unitId ? this._univerInstanceService.getUnit(t.unitId) : this._univerInstanceService.getCurrentUnitForType(I.UNIVER_SHEET);
|
|
424
725
|
if (!n)
|
|
425
726
|
return { redos: [], undos: [] };
|
|
@@ -449,13 +750,13 @@ let ne = class extends T {
|
|
|
449
750
|
);
|
|
450
751
|
}
|
|
451
752
|
};
|
|
452
|
-
ne =
|
|
753
|
+
ne = bt([
|
|
453
754
|
ge(0, M(ue)),
|
|
454
755
|
ge(1, k),
|
|
455
756
|
ge(2, M(R))
|
|
456
757
|
], ne);
|
|
457
|
-
var
|
|
458
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
758
|
+
var Pt = Object.getOwnPropertyDescriptor, Dt = (s, e, t, n) => {
|
|
759
|
+
for (var r = n > 1 ? void 0 : n ? Pt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
459
760
|
(a = s[i]) && (r = a(r) || r);
|
|
460
761
|
return r;
|
|
461
762
|
}, fe = (s, e) => (t, n) => e(t, n, s);
|
|
@@ -487,7 +788,7 @@ let re = class extends T {
|
|
|
487
788
|
if (!l)
|
|
488
789
|
return null;
|
|
489
790
|
const u = Ce(c.range).range;
|
|
490
|
-
if (
|
|
791
|
+
if (Ie(u, l) && c.range !== ee)
|
|
491
792
|
return {
|
|
492
793
|
range: u,
|
|
493
794
|
worksheet: l
|
|
@@ -515,7 +816,7 @@ let re = class extends T {
|
|
|
515
816
|
this._refRangeService.registerRefRange(
|
|
516
817
|
_,
|
|
517
818
|
(y) => {
|
|
518
|
-
const v =
|
|
819
|
+
const v = ot(_, y);
|
|
519
820
|
return v && Fe.equals(v, _) ? {
|
|
520
821
|
preRedos: [],
|
|
521
822
|
preUndos: [],
|
|
@@ -612,13 +913,13 @@ let re = class extends T {
|
|
|
612
913
|
);
|
|
613
914
|
}
|
|
614
915
|
};
|
|
615
|
-
re =
|
|
916
|
+
re = Dt([
|
|
616
917
|
fe(0, b),
|
|
617
918
|
fe(1, k),
|
|
618
|
-
fe(2, M(
|
|
919
|
+
fe(2, M(Oe))
|
|
619
920
|
], re);
|
|
620
|
-
var
|
|
621
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
921
|
+
var Nt = Object.getOwnPropertyDescriptor, Ot = (s, e, t, n) => {
|
|
922
|
+
for (var r = n > 1 ? void 0 : n ? Nt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
622
923
|
(a = s[i]) && (r = a(r) || r);
|
|
623
924
|
return r;
|
|
624
925
|
}, X = (s, e) => (t, n) => e(t, n, s);
|
|
@@ -632,7 +933,7 @@ let se = class extends T {
|
|
|
632
933
|
_initSetRangeValuesCommandInterceptor() {
|
|
633
934
|
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
634
935
|
getMutations: (s) => {
|
|
635
|
-
if (s.id ===
|
|
936
|
+
if (s.id === dt.id) {
|
|
636
937
|
const e = s.params, { unitId: t, subUnitId: n } = e, r = [], i = [];
|
|
637
938
|
return e.cellValue && new Q(e.cellValue).forValue((a, o) => {
|
|
638
939
|
const c = this._hyperLinkModel.getHyperLinkByLocation(t, n, a, o);
|
|
@@ -666,7 +967,7 @@ let se = class extends T {
|
|
|
666
967
|
_initClearSelectionCommandInterceptor() {
|
|
667
968
|
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
668
969
|
getMutations: (s) => {
|
|
669
|
-
if (s.id ===
|
|
970
|
+
if (s.id === ct.id || s.id === lt.id || s.id === ut.id) {
|
|
670
971
|
const e = [], t = [], n = this._selectionManagerService.getCurrentLastSelection(), r = j(this._univerInstanceService);
|
|
671
972
|
if (n && r) {
|
|
672
973
|
const { unitId: i, subUnitId: a } = r;
|
|
@@ -702,7 +1003,7 @@ let se = class extends T {
|
|
|
702
1003
|
}));
|
|
703
1004
|
}
|
|
704
1005
|
_initAfterEditor() {
|
|
705
|
-
this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
1006
|
+
this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(pt, {
|
|
706
1007
|
handler: (s, e, t) => {
|
|
707
1008
|
if (!s || s.p)
|
|
708
1009
|
return t(s);
|
|
@@ -724,7 +1025,7 @@ let se = class extends T {
|
|
|
724
1025
|
customRanges: [{
|
|
725
1026
|
startIndex: 0,
|
|
726
1027
|
endIndex: s.v.length - 1,
|
|
727
|
-
rangeId:
|
|
1028
|
+
rangeId: le(),
|
|
728
1029
|
rangeType: U.HYPERLINK,
|
|
729
1030
|
properties: {
|
|
730
1031
|
url: s.v
|
|
@@ -736,7 +1037,7 @@ let se = class extends T {
|
|
|
736
1037
|
if (!l)
|
|
737
1038
|
return t(s);
|
|
738
1039
|
const u = d.documentModel.getBody();
|
|
739
|
-
return
|
|
1040
|
+
return ce.apply(u, l.serialize()), t({
|
|
740
1041
|
...s,
|
|
741
1042
|
p: {
|
|
742
1043
|
id: Ye,
|
|
@@ -755,14 +1056,14 @@ let se = class extends T {
|
|
|
755
1056
|
}));
|
|
756
1057
|
}
|
|
757
1058
|
};
|
|
758
|
-
se =
|
|
1059
|
+
se = Ot([
|
|
759
1060
|
X(0, M(ue)),
|
|
760
1061
|
X(1, M(R)),
|
|
761
|
-
X(2, M(
|
|
1062
|
+
X(2, M(He)),
|
|
762
1063
|
X(3, k)
|
|
763
1064
|
], se);
|
|
764
|
-
var
|
|
765
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1065
|
+
var Ht = Object.getOwnPropertyDescriptor, xt = (s, e, t, n) => {
|
|
1066
|
+
for (var r = n > 1 ? void 0 : n ? Ht(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
766
1067
|
(a = s[i]) && (r = a(r) || r);
|
|
767
1068
|
return r;
|
|
768
1069
|
}, be = (s, e) => (t, n) => e(t, n, s);
|
|
@@ -805,313 +1106,10 @@ let ie = class extends T {
|
|
|
805
1106
|
);
|
|
806
1107
|
}
|
|
807
1108
|
};
|
|
808
|
-
ie =
|
|
1109
|
+
ie = xt([
|
|
809
1110
|
be(0, Ge),
|
|
810
1111
|
be(1, M(R))
|
|
811
1112
|
], ie);
|
|
812
|
-
const Pt = {
|
|
813
|
-
type: L.COMMAND,
|
|
814
|
-
id: "sheets.command.add-hyper-link",
|
|
815
|
-
// eslint-disable-next-line max-lines-per-function
|
|
816
|
-
async handler(s, e) {
|
|
817
|
-
if (!e) return !1;
|
|
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
|
-
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: m, id: _ } = h, C = u.getCell(f, m), y = u.getBlankCellDocumentModel(C, f, m), v = y.documentModel.getSnapshot(), S = de.deepClone(v.body);
|
|
821
|
-
if (!S) return !1;
|
|
822
|
-
let P;
|
|
823
|
-
if (p ? P = Z.selection.replace({
|
|
824
|
-
selection: {
|
|
825
|
-
startOffset: 0,
|
|
826
|
-
endOffset: S.dataStream.length - 2,
|
|
827
|
-
collapsed: S.dataStream.length - 2 === 0
|
|
828
|
-
},
|
|
829
|
-
body: {
|
|
830
|
-
dataStream: `${p}`,
|
|
831
|
-
customRanges: [{
|
|
832
|
-
startIndex: 0,
|
|
833
|
-
endIndex: p.length - 1,
|
|
834
|
-
rangeType: U.HYPERLINK,
|
|
835
|
-
rangeId: _,
|
|
836
|
-
properties: {
|
|
837
|
-
url: g
|
|
838
|
-
// refId: id,
|
|
839
|
-
}
|
|
840
|
-
}]
|
|
841
|
-
},
|
|
842
|
-
doc: y.documentModel
|
|
843
|
-
}) : P = Z.customRange.add({
|
|
844
|
-
body: S,
|
|
845
|
-
ranges: [{ startOffset: 0, endOffset: S.dataStream.length - 2, collapsed: !1 }],
|
|
846
|
-
rangeId: _,
|
|
847
|
-
rangeType: U.HYPERLINK,
|
|
848
|
-
properties: {
|
|
849
|
-
url: g,
|
|
850
|
-
refId: _
|
|
851
|
-
}
|
|
852
|
-
}), !P) return !1;
|
|
853
|
-
const F = le.apply(S, P.serialize()), O = {
|
|
854
|
-
p: {
|
|
855
|
-
...v,
|
|
856
|
-
body: F
|
|
857
|
-
},
|
|
858
|
-
t: Ie.STRING
|
|
859
|
-
}, A = a.onWriteCell(l, u, f, m, O), W = {
|
|
860
|
-
unitId: c,
|
|
861
|
-
subUnitId: d,
|
|
862
|
-
cellValue: {
|
|
863
|
-
[h.row]: {
|
|
864
|
-
[h.column]: A
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
}, pe = {
|
|
868
|
-
id: V.id,
|
|
869
|
-
params: W
|
|
870
|
-
}, G = Me(s, W), he = {
|
|
871
|
-
id: V.id,
|
|
872
|
-
params: G
|
|
873
|
-
}, K = [pe], H = [he], x = i.getHyperLinkByLocation(c, d, f, m);
|
|
874
|
-
return x && (K.push({
|
|
875
|
-
id: N.id,
|
|
876
|
-
params: {
|
|
877
|
-
unitId: c,
|
|
878
|
-
subUnitId: d,
|
|
879
|
-
id: x.id
|
|
880
|
-
}
|
|
881
|
-
}), H.push({
|
|
882
|
-
id: D.id,
|
|
883
|
-
params: {
|
|
884
|
-
unitId: c,
|
|
885
|
-
subUnitId: d,
|
|
886
|
-
link: x
|
|
887
|
-
}
|
|
888
|
-
})), await Y(K, t) ? await a.onValidateCell(l, u, f, m) === !1 ? (Y(H, t), !1) : (n.pushUndoRedo({
|
|
889
|
-
redoMutations: K,
|
|
890
|
-
undoMutations: H,
|
|
891
|
-
unitID: c
|
|
892
|
-
}), !0) : !1;
|
|
893
|
-
}
|
|
894
|
-
}, Dt = {
|
|
895
|
-
id: "sheets.command.add-rich-hyper-link",
|
|
896
|
-
type: L.COMMAND,
|
|
897
|
-
handler: async (s, e) => {
|
|
898
|
-
if (!e)
|
|
899
|
-
return !1;
|
|
900
|
-
const { documentId: t, link: n } = e, r = s.get(b), i = ce(), { payload: a } = n, o = ft(s, {
|
|
901
|
-
unitId: t,
|
|
902
|
-
rangeId: i,
|
|
903
|
-
rangeType: U.HYPERLINK,
|
|
904
|
-
properties: {
|
|
905
|
-
url: a,
|
|
906
|
-
refId: i
|
|
907
|
-
}
|
|
908
|
-
});
|
|
909
|
-
return o ? r.syncExecuteCommand(o.id, o.params) : !1;
|
|
910
|
-
}
|
|
911
|
-
}, Nt = {
|
|
912
|
-
type: L.COMMAND,
|
|
913
|
-
id: "sheets.command.cancel-hyper-link",
|
|
914
|
-
// eslint-disable-next-line max-lines-per-function
|
|
915
|
-
handler(s, e) {
|
|
916
|
-
var O, A;
|
|
917
|
-
if (!e) return !1;
|
|
918
|
-
const t = s.get(b), n = s.get(Re), r = s.get(k), i = s.get(R), a = j(r, e);
|
|
919
|
-
if (!a) return !1;
|
|
920
|
-
const { row: o, column: c, id: d } = e, { unitId: l, subUnitId: u, worksheet: h } = a, g = h.getCell(o, c);
|
|
921
|
-
if (!g) return !1;
|
|
922
|
-
const p = h.getCellDocumentModelWithFormula(g, o, c);
|
|
923
|
-
if (!(p != null && p.documentModel)) return !1;
|
|
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);
|
|
925
|
-
if (!m) return !1;
|
|
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
|
-
unitId: l,
|
|
930
|
-
subUnitId: u,
|
|
931
|
-
cellValue: {
|
|
932
|
-
[o]: {
|
|
933
|
-
[c]: {
|
|
934
|
-
p: {
|
|
935
|
-
...f,
|
|
936
|
-
body: C
|
|
937
|
-
},
|
|
938
|
-
t: Ie.STRING
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
};
|
|
943
|
-
y.push({
|
|
944
|
-
id: V.id,
|
|
945
|
-
params: S
|
|
946
|
-
});
|
|
947
|
-
const P = Me(s, S);
|
|
948
|
-
v.push({
|
|
949
|
-
id: V.id,
|
|
950
|
-
params: P
|
|
951
|
-
});
|
|
952
|
-
const F = i.getHyperLinkByLocation(l, u, o, c);
|
|
953
|
-
return F && (y.push({
|
|
954
|
-
id: N.id,
|
|
955
|
-
params: {
|
|
956
|
-
unitId: l,
|
|
957
|
-
subUnitId: u,
|
|
958
|
-
id: d
|
|
959
|
-
}
|
|
960
|
-
}), v.push({
|
|
961
|
-
id: D.id,
|
|
962
|
-
params: {
|
|
963
|
-
unitId: l,
|
|
964
|
-
subUnitId: u,
|
|
965
|
-
link: {
|
|
966
|
-
...F
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
})), Y(y, t).result ? (n.pushUndoRedo({
|
|
970
|
-
redoMutations: y,
|
|
971
|
-
undoMutations: v,
|
|
972
|
-
unitID: l
|
|
973
|
-
}), !0) : !1;
|
|
974
|
-
}
|
|
975
|
-
}, Ot = {
|
|
976
|
-
type: L.COMMAND,
|
|
977
|
-
id: "sheets.command.cancel-rich-hyper-link",
|
|
978
|
-
handler(s, e) {
|
|
979
|
-
var l, u;
|
|
980
|
-
if (!e)
|
|
981
|
-
return !1;
|
|
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
|
-
let c = null;
|
|
984
|
-
o && o.endIndex === a.getBody().dataStream.length - 3 && (c = {
|
|
985
|
-
dataStream: " "
|
|
986
|
-
});
|
|
987
|
-
const d = mt(s, { unitId: n, rangeId: t, insert: c });
|
|
988
|
-
return d ? r.syncExecuteCommand(d.id, d.params) : !1;
|
|
989
|
-
}
|
|
990
|
-
}, Ht = {
|
|
991
|
-
type: L.COMMAND,
|
|
992
|
-
id: "sheets.command.update-hyper-link",
|
|
993
|
-
// eslint-disable-next-line max-lines-per-function
|
|
994
|
-
async handler(s, e) {
|
|
995
|
-
var we, ke, Le;
|
|
996
|
-
if (!e) return !1;
|
|
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
|
-
unitId: e.unitId,
|
|
999
|
-
subUnitId: e.subUnitId
|
|
1000
|
-
});
|
|
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: m, display: _ = "" } = c, C = g.getCell(d, l);
|
|
1003
|
-
if (!C) return !1;
|
|
1004
|
-
const y = g.getCellDocumentModelWithFormula(C, d, l);
|
|
1005
|
-
if (!(y != null && y.documentModel)) return !1;
|
|
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
|
-
if (!S) return !1;
|
|
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
|
-
unitId: p,
|
|
1012
|
-
body: {
|
|
1013
|
-
dataStream: `${_}`,
|
|
1014
|
-
customRanges: [{
|
|
1015
|
-
rangeId: P,
|
|
1016
|
-
rangeType: U.HYPERLINK,
|
|
1017
|
-
startIndex: 0,
|
|
1018
|
-
endIndex: _.length - 1,
|
|
1019
|
-
properties: {
|
|
1020
|
-
url: m
|
|
1021
|
-
}
|
|
1022
|
-
}],
|
|
1023
|
-
textRuns: $ ? [$] : void 0
|
|
1024
|
-
},
|
|
1025
|
-
selection: {
|
|
1026
|
-
startOffset: S.startIndex,
|
|
1027
|
-
endOffset: S.endIndex + 1,
|
|
1028
|
-
collapsed: !1
|
|
1029
|
-
},
|
|
1030
|
-
doc: y.documentModel
|
|
1031
|
-
});
|
|
1032
|
-
if (!O)
|
|
1033
|
-
return !1;
|
|
1034
|
-
const A = le.apply(de.deepClone(v.body), O.textX.serialize()), W = {
|
|
1035
|
-
p: {
|
|
1036
|
-
...v,
|
|
1037
|
-
body: A
|
|
1038
|
-
},
|
|
1039
|
-
t: Ie.STRING
|
|
1040
|
-
}, pe = a.onWriteCell(h, g, d, l, W), G = {
|
|
1041
|
-
id: V.id,
|
|
1042
|
-
params: {
|
|
1043
|
-
unitId: p,
|
|
1044
|
-
subUnitId: f,
|
|
1045
|
-
cellValue: {
|
|
1046
|
-
[d]: {
|
|
1047
|
-
[l]: pe
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
}, he = Me(s, G.params), K = {
|
|
1052
|
-
id: V.id,
|
|
1053
|
-
params: he
|
|
1054
|
-
}, H = [G], x = [K], z = i.getHyperLinkByLocation(p, f, d, l);
|
|
1055
|
-
return z && (H.push({
|
|
1056
|
-
id: N.id,
|
|
1057
|
-
params: {
|
|
1058
|
-
unitId: p,
|
|
1059
|
-
subUnitId: f,
|
|
1060
|
-
id: z.id
|
|
1061
|
-
}
|
|
1062
|
-
}), x.push({
|
|
1063
|
-
id: D.id,
|
|
1064
|
-
params: {
|
|
1065
|
-
unitId: p,
|
|
1066
|
-
subUnitId: f,
|
|
1067
|
-
link: z
|
|
1068
|
-
}
|
|
1069
|
-
})), Y(H, t) ? await a.onValidateCell(h, g, d, l) === !1 ? (Y(x, t), !1) : (n.pushUndoRedo({
|
|
1070
|
-
redoMutations: H,
|
|
1071
|
-
undoMutations: x,
|
|
1072
|
-
unitID: p
|
|
1073
|
-
}), !0) : !1;
|
|
1074
|
-
}
|
|
1075
|
-
}, xt = {
|
|
1076
|
-
type: L.COMMAND,
|
|
1077
|
-
id: "sheets.command.update-rich-hyper-link",
|
|
1078
|
-
handler: (s, e) => {
|
|
1079
|
-
var p, f, m, _;
|
|
1080
|
-
if (!e)
|
|
1081
|
-
return !1;
|
|
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
|
-
if (!o)
|
|
1084
|
-
return !1;
|
|
1085
|
-
const c = (f = (p = o.getBody()) == null ? void 0 : p.customRanges) == null ? void 0 : f.find((C) => C.rangeId === r);
|
|
1086
|
-
if (!c)
|
|
1087
|
-
return !1;
|
|
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
|
-
h && (h.ed = d.length + 1);
|
|
1090
|
-
const g = He(s, {
|
|
1091
|
-
unitId: t,
|
|
1092
|
-
body: {
|
|
1093
|
-
dataStream: `${d}`,
|
|
1094
|
-
customRanges: [{
|
|
1095
|
-
rangeId: l,
|
|
1096
|
-
rangeType: U.HYPERLINK,
|
|
1097
|
-
startIndex: 0,
|
|
1098
|
-
endIndex: d.length - 1,
|
|
1099
|
-
properties: {
|
|
1100
|
-
url: n.payload
|
|
1101
|
-
}
|
|
1102
|
-
}],
|
|
1103
|
-
textRuns: h ? [h] : void 0
|
|
1104
|
-
},
|
|
1105
|
-
selection: {
|
|
1106
|
-
startOffset: c.startIndex,
|
|
1107
|
-
endOffset: c.endIndex + 1,
|
|
1108
|
-
collapsed: !1
|
|
1109
|
-
},
|
|
1110
|
-
doc: o
|
|
1111
|
-
});
|
|
1112
|
-
return g ? a.syncExecuteCommand(g.id, g.params) : !1;
|
|
1113
|
-
}
|
|
1114
|
-
};
|
|
1115
1113
|
var Vt = Object.getOwnPropertyDescriptor, Tt = (s, e, t, n) => {
|
|
1116
1114
|
for (var r = n > 1 ? void 0 : n ? Vt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
1117
1115
|
(a = s[i]) && (r = a(r) || r);
|
|
@@ -1123,12 +1121,12 @@ let ae = class extends T {
|
|
|
1123
1121
|
}
|
|
1124
1122
|
_registerCommands() {
|
|
1125
1123
|
[
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1124
|
+
St,
|
|
1125
|
+
Ct,
|
|
1126
|
+
It,
|
|
1127
|
+
wt,
|
|
1128
|
+
Mt,
|
|
1129
|
+
Rt,
|
|
1132
1130
|
D,
|
|
1133
1131
|
_e,
|
|
1134
1132
|
N,
|
|
@@ -1142,7 +1140,7 @@ let ae = class extends T {
|
|
|
1142
1140
|
ae = Tt([
|
|
1143
1141
|
$t(0, b)
|
|
1144
1142
|
], ae);
|
|
1145
|
-
var At = Object.getOwnPropertyDescriptor, Wt = (s, e, t, n) => {
|
|
1143
|
+
var E = /* @__PURE__ */ ((s) => (s.SHEET = "gid", s.RANGE = "range", s.DEFINE_NAME = "rangeid", s.INVALID = "invalid", s.URL = "url", s))(E || {}), At = Object.getOwnPropertyDescriptor, Wt = (s, e, t, n) => {
|
|
1146
1144
|
for (var r = n > 1 ? void 0 : n ? At(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
1147
1145
|
(a = s[i]) && (r = a(r) || r);
|
|
1148
1146
|
return r;
|
|
@@ -1189,9 +1187,9 @@ let ve = class {
|
|
|
1189
1187
|
if (t) {
|
|
1190
1188
|
if (!o) return a;
|
|
1191
1189
|
const l = Ce(t).range;
|
|
1192
|
-
return
|
|
1190
|
+
return Ie(l, o) && t !== ee ? {
|
|
1193
1191
|
type: E.RANGE,
|
|
1194
|
-
name:
|
|
1192
|
+
name: mt(c, l)
|
|
1195
1193
|
} : a;
|
|
1196
1194
|
}
|
|
1197
1195
|
if (n) {
|
|
@@ -1214,7 +1212,7 @@ let ve = class {
|
|
|
1214
1212
|
ve = Wt([
|
|
1215
1213
|
me(0, k),
|
|
1216
1214
|
me(1, M(ze)),
|
|
1217
|
-
me(2,
|
|
1215
|
+
me(2, ft)
|
|
1218
1216
|
], ve);
|
|
1219
1217
|
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
1218
|
for (var r = n > 1 ? void 0 : n ? jt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
|
|
@@ -1229,7 +1227,7 @@ let oe = class extends Qe {
|
|
|
1229
1227
|
Ue,
|
|
1230
1228
|
this._config
|
|
1231
1229
|
);
|
|
1232
|
-
this._configService.setConfig(
|
|
1230
|
+
this._configService.setConfig(kt, n);
|
|
1233
1231
|
}
|
|
1234
1232
|
onStarting() {
|
|
1235
1233
|
et(this._injector, [
|
|
@@ -1254,24 +1252,24 @@ let oe = class extends Qe {
|
|
|
1254
1252
|
Ve(oe, "pluginName", xe);
|
|
1255
1253
|
Ve(oe, "type", I.UNIVER_SHEET);
|
|
1256
1254
|
oe = Kt([
|
|
1257
|
-
Je(
|
|
1255
|
+
Je(ht),
|
|
1258
1256
|
Pe(1, M(Xe)),
|
|
1259
1257
|
Pe(2, qe)
|
|
1260
1258
|
], oe);
|
|
1261
1259
|
export {
|
|
1262
|
-
|
|
1260
|
+
St as AddHyperLinkCommand,
|
|
1263
1261
|
D as AddHyperLinkMutation,
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1262
|
+
Rt as AddRichHyperLinkCommand,
|
|
1263
|
+
It as CancelHyperLinkCommand,
|
|
1264
|
+
Mt as CancelRichHyperLinkCommand,
|
|
1267
1265
|
ee as ERROR_RANGE,
|
|
1268
1266
|
R as HyperLinkModel,
|
|
1269
1267
|
N as RemoveHyperLinkMutation,
|
|
1270
1268
|
E as SheetHyperLinkType,
|
|
1271
1269
|
ve as SheetsHyperLinkParserService,
|
|
1272
1270
|
oe as UniverSheetsHyperLinkPlugin,
|
|
1273
|
-
|
|
1271
|
+
Ct as UpdateHyperLinkCommand,
|
|
1274
1272
|
_e as UpdateHyperLinkMutation,
|
|
1275
1273
|
ye as UpdateHyperLinkRefMutation,
|
|
1276
|
-
|
|
1274
|
+
wt as UpdateRichHyperLinkCommand
|
|
1277
1275
|
};
|