@univerjs/sheets-hyper-link-ui 0.1.13
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/LICENSE +176 -0
- package/README.md +22 -0
- package/lib/cjs/index.js +9 -0
- package/lib/es/index.js +1717 -0
- package/lib/index.css +1 -0
- package/lib/locale/en-US.json +35 -0
- package/lib/locale/ru-RU.json +35 -0
- package/lib/locale/zh-CN.json +35 -0
- package/lib/types/commands/operations/sidebar.operations.d.ts +11 -0
- package/lib/types/common/util.d.ts +19 -0
- package/lib/types/controllers/auto-fill.controller.d.ts +10 -0
- package/lib/types/controllers/copy-paste.controller.d.ts +17 -0
- package/lib/types/controllers/hyper-link-permission.controller.d.ts +10 -0
- package/lib/types/controllers/menu.d.ts +15 -0
- package/lib/types/controllers/popup.controller.d.ts +10 -0
- package/lib/types/controllers/ref-range.controller.d.ts +20 -0
- package/lib/types/controllers/remove-sheet.controller.d.ts +11 -0
- package/lib/types/controllers/render-controllers/render.controller.d.ts +17 -0
- package/lib/types/controllers/set-range.controller.d.ts +18 -0
- package/lib/types/controllers/ui.controller.d.ts +21 -0
- package/lib/types/controllers/url.controller.d.ts +8 -0
- package/lib/types/index.d.ts +30 -0
- package/lib/types/locale/en-US.d.ts +4 -0
- package/lib/types/locale/ru-RU.d.ts +4 -0
- package/lib/types/locale/zh-CN.d.ts +51 -0
- package/lib/types/plugin.d.ts +13 -0
- package/lib/types/services/popup.service.d.ts +34 -0
- package/lib/types/services/resolver.service.d.ts +38 -0
- package/lib/types/types/const.d.ts +17 -0
- package/lib/types/views/CellLinkEdit/index.d.ts +6 -0
- package/lib/types/views/CellLinkPopup/index.d.ts +6 -0
- package/lib/umd/index.js +9 -0
- package/package.json +94 -0
package/lib/es/index.js
ADDED
|
@@ -0,0 +1,1717 @@
|
|
|
1
|
+
var Kt = Object.defineProperty;
|
|
2
|
+
var Yt = (t, e, n) => e in t ? Kt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var O = (t, e, n) => (Yt(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
+
import { Disposable as T, UniverInstanceType as E, OnLifecycle as U, LifecycleStages as j, IUniverInstanceService as F, isValidRange as Pe, LocaleService as de, Rectangle as oe, ICommandService as W, toDisposable as Gt, BooleanNumber as Xt, ThemeService as qt, createInternalEditorID as Jt, DEFAULT_EMPTY_DOCUMENT_VALUE as Qt, Tools as ae, CommandType as Ue, CellValueType as ot, ObjectMatrix as yt, Range as Xe } from "@univerjs/core";
|
|
5
|
+
import { RemoveSheetCommand as en, SheetInterceptorService as qe, SetSelectionsOperation as tn, NORMAL_SELECTION_PLUGIN_NAME as nn, SetWorksheetActiveOperation as Oe, RefRangeService as rn, handleDefaultRangeChangeWithEffectRefCommands as at, INTERCEPTOR_POINT as sn, getSheetCommandTarget as St, SelectionManagerService as Ct, SetRangeValuesMutation as pe, SetRangeValuesUndoMutationFactory as ct, SetRangeValuesCommand as on, ClearSelectionContentCommand as an, ClearSelectionAllCommand as cn, WorkbookEditablePermission as Je, WorksheetEditPermission as Qe, WorksheetSetCellValuePermission as et, WorksheetInsertHyperlinkPermission as tt, RangeProtectionPermissionEditPoint as nt } from "@univerjs/sheets";
|
|
6
|
+
import { Inject as g, Injector as je } from "@wendellhu/redi";
|
|
7
|
+
import { RemoveHyperLinkCommand as ln, AddHyperLinkCommand as rt, HyperLinkModel as H, RemoveHyperLinkMutation as M, AddHyperLinkMutation as x, UpdateHyperLinkRefMutation as lt, UpdateHyperLinkMutation as we, UpdateHyperLinkCommand as Lt, CancelHyperLinkCommand as dn, UniverSheetsHyperLinkPlugin as un } from "@univerjs/sheets-hyper-link";
|
|
8
|
+
import { deserializeRangeWithSheet as ce, serializeRangeWithSheet as It, IDefinedNamesService as kt, serializeRange as ve, serializeRangeToRefString as pn } from "@univerjs/engine-formula";
|
|
9
|
+
import { MessageType as ie, FormLayout as X, Input as dt, Select as Ve, Button as ut, Tooltip as Fe } from "@univerjs/design";
|
|
10
|
+
import { ScrollToCellCommand as bt, SheetSkeletonManagerService as hn, SheetCanvasPopManagerService as gn, HoverManagerService as mn, whenSheetEditorFocused as fn, getCurrentRangeDisable$ as Rt, APPLY_TYPE as he, IAutoFillService as vn, virtualizeDiscreteRanges as Ye, getAutoFillRepeatRange as _n, COPY_TYPE as pt, rangeToDiscreteRange as yn, PREDEFINED_HOOK_NAME as We, getRepeatRange as Sn, ISheetClipboardService as Cn, SheetPermissionInterceptorBaseController as Ln } from "@univerjs/sheets-ui";
|
|
11
|
+
import { IMessageService as Pt, useObservable as In, RangeSelector as kn, ISidebarService as Ot, KeyCode as bn, MetaKeys as Rn, MenuItemType as wt, MenuPosition as Et, getMenuHiddenObservable as Mt, MenuGroup as Pn, ComponentManager as On, IShortcutService as wn, IMenuService as En } from "@univerjs/ui";
|
|
12
|
+
import { IRenderManagerService as Mn } from "@univerjs/engine-render";
|
|
13
|
+
import { Subject as xn, BehaviorSubject as Tn, debounceTime as Un } from "rxjs";
|
|
14
|
+
import jn, { forwardRef as Z, useRef as xt, createElement as z, useState as te, useEffect as Hn, useMemo as $n } from "react";
|
|
15
|
+
import { useDependency as b, useObservable as Nn } from "@wendellhu/redi/react-bindings";
|
|
16
|
+
import ht from "clsx";
|
|
17
|
+
import { SPECIAL_PASTE_FORMULA as Dn } from "@univerjs/sheets-formula";
|
|
18
|
+
var An = Object.defineProperty, Bn = Object.getOwnPropertyDescriptor, Vn = (t, e, n, i) => {
|
|
19
|
+
for (var r = i > 1 ? void 0 : i ? Bn(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
20
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
21
|
+
return i && r && An(e, n, r), r;
|
|
22
|
+
}, Ze = (t, e) => (n, i) => e(n, i, t);
|
|
23
|
+
let _e = class extends T {
|
|
24
|
+
constructor(t, e, n) {
|
|
25
|
+
super(), this._sheetInterceptorService = t, this._univerInstanceService = e, this._hyperLinkModel = n, this._initSheetChange();
|
|
26
|
+
}
|
|
27
|
+
_initSheetChange() {
|
|
28
|
+
this.disposeWithMe(
|
|
29
|
+
this._sheetInterceptorService.interceptCommand({
|
|
30
|
+
getMutations: (t) => {
|
|
31
|
+
if (t.id === en.id) {
|
|
32
|
+
const e = t.params, n = e.unitId ? this._univerInstanceService.getUnit(e.unitId) : this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
|
|
33
|
+
if (!n)
|
|
34
|
+
return { redos: [], undos: [] };
|
|
35
|
+
const i = n.getUnitId(), r = e.subUnitId || n.getActiveSheet().getSheetId(), s = this._hyperLinkModel.getSubUnit(i, r), o = s.map((a) => ({
|
|
36
|
+
id: ln.id,
|
|
37
|
+
params: {
|
|
38
|
+
unitId: i,
|
|
39
|
+
subUnitId: r,
|
|
40
|
+
id: a.id
|
|
41
|
+
}
|
|
42
|
+
})), c = s.map((a) => ({
|
|
43
|
+
id: rt.id,
|
|
44
|
+
params: {
|
|
45
|
+
unitId: i,
|
|
46
|
+
subUnitId: r,
|
|
47
|
+
link: a
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
return { redos: o, undos: c };
|
|
51
|
+
}
|
|
52
|
+
return { redos: [], undos: [] };
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
_e = Vn([
|
|
59
|
+
U(j.Ready, _e),
|
|
60
|
+
Ze(0, g(qe)),
|
|
61
|
+
Ze(1, F),
|
|
62
|
+
Ze(2, g(H))
|
|
63
|
+
], _e);
|
|
64
|
+
const it = "SHEETS_HYPER_LINK_UI_PLUGIN", Ge = "err";
|
|
65
|
+
var Fn = Object.defineProperty, Wn = Object.getOwnPropertyDescriptor, Zn = (t, e, n, i) => {
|
|
66
|
+
for (var r = i > 1 ? void 0 : i ? Wn(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
67
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
68
|
+
return i && r && Fn(e, n, r), r;
|
|
69
|
+
}, ne = (t, e) => (n, i) => e(n, i, t);
|
|
70
|
+
function zn(t, e) {
|
|
71
|
+
const n = [];
|
|
72
|
+
return e.forEach((i) => {
|
|
73
|
+
oe.intersects(t, i) && n.push(i);
|
|
74
|
+
}), oe.realUnion(t, ...n);
|
|
75
|
+
}
|
|
76
|
+
let B = class {
|
|
77
|
+
constructor(t, e, n, i, r) {
|
|
78
|
+
this._univerInstanceService = t, this._commandService = e, this._definedNamesService = n, this._messageService = i, this._localeService = r;
|
|
79
|
+
}
|
|
80
|
+
_getURLName(t) {
|
|
81
|
+
var c;
|
|
82
|
+
const { gid: e, range: n, rangeid: i } = t, r = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
|
|
83
|
+
if (!r)
|
|
84
|
+
return null;
|
|
85
|
+
const s = e ? r.getSheetBySheetId(e) : r.getActiveSheet(), o = (c = s == null ? void 0 : s.getName()) != null ? c : "";
|
|
86
|
+
if (n) {
|
|
87
|
+
const a = ce(n).range;
|
|
88
|
+
return Pe(a) && n !== Ge ? {
|
|
89
|
+
type: "range",
|
|
90
|
+
name: It(o, a)
|
|
91
|
+
} : {
|
|
92
|
+
type: "range-error",
|
|
93
|
+
name: this._localeService.t("hyperLink.message.refError")
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (i) {
|
|
97
|
+
const a = this._definedNamesService.getValueById(r.getUnitId(), i);
|
|
98
|
+
return a ? {
|
|
99
|
+
type: "defineName",
|
|
100
|
+
name: a.formulaOrRefString
|
|
101
|
+
} : {
|
|
102
|
+
type: "range-error",
|
|
103
|
+
name: this._localeService.t("hyperLink.message.refError")
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (e) {
|
|
107
|
+
const a = r.getSheetBySheetId(e);
|
|
108
|
+
return a ? {
|
|
109
|
+
type: "sheet",
|
|
110
|
+
name: a.getName()
|
|
111
|
+
} : {
|
|
112
|
+
type: "sheet-error",
|
|
113
|
+
name: this._localeService.t("hyperLink.message.refError")
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
navigateTo(t) {
|
|
119
|
+
const { gid: e, range: n, rangeid: i } = t, r = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
|
|
120
|
+
if (!r)
|
|
121
|
+
return;
|
|
122
|
+
const s = r.getUnitId();
|
|
123
|
+
if (i && this.navigateToDefineName(s, i), !!e) {
|
|
124
|
+
if (n) {
|
|
125
|
+
const o = ce(n);
|
|
126
|
+
Pe(o.range) && n !== Ge && this.navigateToRange(s, e, o.range);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this.navigateToSheetById(s, e);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
parseHyperLink(t) {
|
|
133
|
+
var e, n, i;
|
|
134
|
+
if (t != null && t.startsWith("#")) {
|
|
135
|
+
const r = new URLSearchParams(t.slice(1)), s = {
|
|
136
|
+
gid: (e = r.get("gid")) != null ? e : "",
|
|
137
|
+
range: (n = r.get("range")) != null ? n : "",
|
|
138
|
+
rangeid: (i = r.get("rangeid")) != null ? i : ""
|
|
139
|
+
}, o = this._getURLName(s);
|
|
140
|
+
return {
|
|
141
|
+
type: (o == null ? void 0 : o.type) || "link",
|
|
142
|
+
name: (o == null ? void 0 : o.name) || t,
|
|
143
|
+
url: t,
|
|
144
|
+
searchObj: s,
|
|
145
|
+
handler: () => {
|
|
146
|
+
this.navigateTo(s);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
} else
|
|
150
|
+
return {
|
|
151
|
+
type: "outer",
|
|
152
|
+
name: t,
|
|
153
|
+
url: t,
|
|
154
|
+
handler: () => {
|
|
155
|
+
this.navigateToOtherWebsite(t);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
async navigateToRange(t, e, n) {
|
|
160
|
+
const i = await this.navigateToSheetById(t, e);
|
|
161
|
+
if (i) {
|
|
162
|
+
const r = zn(n, i.getMergeData());
|
|
163
|
+
await this._commandService.executeCommand(
|
|
164
|
+
tn.id,
|
|
165
|
+
{
|
|
166
|
+
unitId: t,
|
|
167
|
+
subUnitId: e,
|
|
168
|
+
pluginName: nn,
|
|
169
|
+
selections: [{
|
|
170
|
+
range: r
|
|
171
|
+
}]
|
|
172
|
+
}
|
|
173
|
+
), await this._commandService.executeCommand(bt.id, {
|
|
174
|
+
range: r
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async navigateToSheet(t, e) {
|
|
179
|
+
const n = this._univerInstanceService.getUnit(t, E.UNIVER_SHEET);
|
|
180
|
+
if (!n)
|
|
181
|
+
return !1;
|
|
182
|
+
const i = n.getActiveSheet();
|
|
183
|
+
if ((i == null ? void 0 : i.getName()) === e)
|
|
184
|
+
return !0;
|
|
185
|
+
const r = n.getSheetBySheetName(e);
|
|
186
|
+
if (!r) {
|
|
187
|
+
this._messageService.show({
|
|
188
|
+
content: this._localeService.t("hyperLink.message.noSheet"),
|
|
189
|
+
type: ie.Error
|
|
190
|
+
});
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const s = r.getSheetId();
|
|
194
|
+
return n.getHiddenWorksheets().indexOf(s) > -1 && this._messageService.show({
|
|
195
|
+
content: this._localeService.t("hyperLink.message.hiddenSheet"),
|
|
196
|
+
type: ie.Error
|
|
197
|
+
}), await this._commandService.executeCommand(Oe.id, { unitId: t, subUnitId: s });
|
|
198
|
+
}
|
|
199
|
+
async navigateToSheetById(t, e) {
|
|
200
|
+
const n = this._univerInstanceService.getUnit(t, E.UNIVER_SHEET);
|
|
201
|
+
if (!n)
|
|
202
|
+
return !1;
|
|
203
|
+
const i = n.getActiveSheet();
|
|
204
|
+
if (i.getSheetId() === e)
|
|
205
|
+
return i;
|
|
206
|
+
const r = n.getSheetBySheetId(e);
|
|
207
|
+
return r ? n.getHiddenWorksheets().indexOf(e) > -1 ? (this._messageService.show({
|
|
208
|
+
content: this._localeService.t("hyperLink.message.hiddenSheet"),
|
|
209
|
+
type: ie.Error
|
|
210
|
+
}), !1) : await this._commandService.executeCommand(Oe.id, { unitId: t, subUnitId: e }) ? r : !1 : (this._messageService.show({
|
|
211
|
+
content: this._localeService.t("hyperLink.message.noSheet"),
|
|
212
|
+
type: ie.Error
|
|
213
|
+
}), !1);
|
|
214
|
+
}
|
|
215
|
+
async navigateToDefineName(t, e) {
|
|
216
|
+
return this._definedNamesService.focusRange(t, e), !0;
|
|
217
|
+
}
|
|
218
|
+
async navigateToOtherWebsite(t) {
|
|
219
|
+
window.open(t, "_blank", "noopener noreferrer");
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
B = Zn([
|
|
223
|
+
ne(0, F),
|
|
224
|
+
ne(1, W),
|
|
225
|
+
ne(2, kt),
|
|
226
|
+
ne(3, Pt),
|
|
227
|
+
ne(4, g(de))
|
|
228
|
+
], B);
|
|
229
|
+
var Kn = Object.defineProperty, Yn = Object.getOwnPropertyDescriptor, Gn = (t, e, n, i) => {
|
|
230
|
+
for (var r = i > 1 ? void 0 : i ? Yn(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
231
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
232
|
+
return i && r && Kn(e, n, r), r;
|
|
233
|
+
}, ge = (t, e) => (n, i) => e(n, i, t);
|
|
234
|
+
let ye = class extends T {
|
|
235
|
+
constructor(e, n, i, r) {
|
|
236
|
+
super();
|
|
237
|
+
O(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
238
|
+
O(this, "_rangeDisableMap", /* @__PURE__ */ new Map());
|
|
239
|
+
this._refRangeService = e, this._hyperLinkModel = n, this._resolverService = i, this._univerInstanceService = r, this._initData(), this._initRefRange();
|
|
240
|
+
}
|
|
241
|
+
_register(e, n, i) {
|
|
242
|
+
const r = i.id, s = {
|
|
243
|
+
startColumn: i.column,
|
|
244
|
+
endColumn: i.column,
|
|
245
|
+
startRow: i.row,
|
|
246
|
+
endRow: i.row
|
|
247
|
+
}, o = (c) => {
|
|
248
|
+
const a = at(s, c);
|
|
249
|
+
return a && a.startColumn === s.startColumn && a.startRow === s.startRow ? {
|
|
250
|
+
undos: [],
|
|
251
|
+
redos: []
|
|
252
|
+
} : a ? {
|
|
253
|
+
redos: [{
|
|
254
|
+
id: lt.id,
|
|
255
|
+
params: {
|
|
256
|
+
unitId: e,
|
|
257
|
+
subUnitId: n,
|
|
258
|
+
id: i.id,
|
|
259
|
+
row: a.startRow,
|
|
260
|
+
column: a.startColumn
|
|
261
|
+
}
|
|
262
|
+
}],
|
|
263
|
+
undos: [{
|
|
264
|
+
id: lt.id,
|
|
265
|
+
params: {
|
|
266
|
+
unitId: e,
|
|
267
|
+
subUnitId: n,
|
|
268
|
+
id: i.id,
|
|
269
|
+
row: s.startRow,
|
|
270
|
+
column: s.startColumn
|
|
271
|
+
}
|
|
272
|
+
}]
|
|
273
|
+
} : {
|
|
274
|
+
redos: [{
|
|
275
|
+
id: M.id,
|
|
276
|
+
params: {
|
|
277
|
+
unitId: e,
|
|
278
|
+
subUnitId: n,
|
|
279
|
+
id: i.id
|
|
280
|
+
}
|
|
281
|
+
}],
|
|
282
|
+
undos: [{
|
|
283
|
+
id: x.id,
|
|
284
|
+
params: {
|
|
285
|
+
unitId: e,
|
|
286
|
+
subUnitId: n,
|
|
287
|
+
link: i
|
|
288
|
+
}
|
|
289
|
+
}]
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
this._disposableMap.set(
|
|
293
|
+
r,
|
|
294
|
+
this._refRangeService.registerRefRange(s, o, e, n)
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
_unregister(e) {
|
|
298
|
+
const n = this._disposableMap.get(e);
|
|
299
|
+
n == null || n.dispose(), this._disposableMap.delete(e);
|
|
300
|
+
}
|
|
301
|
+
_registerRange(e, n, i) {
|
|
302
|
+
const r = this._resolverService.parseHyperLink(i);
|
|
303
|
+
if (r.searchObj && r.searchObj.range && r.searchObj.gid) {
|
|
304
|
+
const s = r.searchObj.gid, o = ce(r.searchObj.range).range;
|
|
305
|
+
if (Pe(o) && r.searchObj.range !== Ge) {
|
|
306
|
+
const c = (a) => {
|
|
307
|
+
const p = at(o, a);
|
|
308
|
+
return p && ve(p) === ve(o) ? {
|
|
309
|
+
redos: [],
|
|
310
|
+
undos: []
|
|
311
|
+
} : {
|
|
312
|
+
redos: [{
|
|
313
|
+
id: we.id,
|
|
314
|
+
params: {
|
|
315
|
+
unitId: e,
|
|
316
|
+
subUnitId: s,
|
|
317
|
+
id: n,
|
|
318
|
+
payload: {
|
|
319
|
+
payload: `#gid=${s}&range=${p ? ve(p) : "err"}`
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}],
|
|
323
|
+
undos: [{
|
|
324
|
+
id: we.id,
|
|
325
|
+
params: {
|
|
326
|
+
unitId: e,
|
|
327
|
+
subUnitId: s,
|
|
328
|
+
id: n,
|
|
329
|
+
payload: {
|
|
330
|
+
payload: i
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}]
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
this._rangeDisableMap.set(n, this._refRangeService.registerRefRange(o, c, e, s));
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
_unregisterRange(e) {
|
|
341
|
+
const n = this._rangeDisableMap.get(e);
|
|
342
|
+
n == null || n.dispose(), this._rangeDisableMap.delete(e);
|
|
343
|
+
}
|
|
344
|
+
_initData() {
|
|
345
|
+
this._hyperLinkModel.getAll().forEach((n) => {
|
|
346
|
+
n.forEach((i) => {
|
|
347
|
+
const { unitId: r, subUnitId: s, links: o } = i;
|
|
348
|
+
o.forEach((c) => {
|
|
349
|
+
this._register(r, s, c);
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
_initRefRange() {
|
|
355
|
+
this.disposeWithMe(
|
|
356
|
+
this._hyperLinkModel.linkUpdate$.subscribe((e) => {
|
|
357
|
+
switch (e.type) {
|
|
358
|
+
case "add": {
|
|
359
|
+
this._register(e.unitId, e.subUnitId, e.payload), this._registerRange(e.unitId, e.payload.id, e.payload.payload);
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
case "remove": {
|
|
363
|
+
this._unregister(e.payload.id), this._unregisterRange(e.payload.id);
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
case "updateRef": {
|
|
367
|
+
const { unitId: n, subUnitId: i, id: r } = e, s = this._hyperLinkModel.getHyperLink(n, i, r);
|
|
368
|
+
if (!s)
|
|
369
|
+
return;
|
|
370
|
+
this._unregister(r), this._register(n, i, s);
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
case "unload": {
|
|
374
|
+
const { unitLinks: n } = e;
|
|
375
|
+
n.forEach((i) => {
|
|
376
|
+
const { links: r } = i;
|
|
377
|
+
r.forEach((s) => {
|
|
378
|
+
this._unregister(s.id), this._unregisterRange(s.id);
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
case "update": {
|
|
384
|
+
this._unregisterRange(e.id), this._registerRange(e.unitId, e.id, e.payload.payload);
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
})
|
|
389
|
+
), this.disposeWithMe(Gt(() => {
|
|
390
|
+
this._disposableMap.forEach((e) => {
|
|
391
|
+
e.dispose();
|
|
392
|
+
}), this._disposableMap.clear();
|
|
393
|
+
}));
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
ye = Gn([
|
|
397
|
+
U(j.Starting, ye),
|
|
398
|
+
ge(0, g(rn)),
|
|
399
|
+
ge(1, g(H)),
|
|
400
|
+
ge(2, g(B)),
|
|
401
|
+
ge(3, F)
|
|
402
|
+
], ye);
|
|
403
|
+
var Xn = Object.defineProperty, qn = Object.getOwnPropertyDescriptor, Jn = (t, e, n, i) => {
|
|
404
|
+
for (var r = i > 1 ? void 0 : i ? qn(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
405
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
406
|
+
return i && r && Xn(e, n, r), r;
|
|
407
|
+
}, q = (t, e) => (n, i) => e(n, i, t);
|
|
408
|
+
let Se = class extends T {
|
|
409
|
+
constructor(t, e, n, i, r, s) {
|
|
410
|
+
super(), this._sheetInterceptorService = t, this._hyperLinkModel = e, this._univerInstanceService = n, this._sheetSkeletonManagerService = i, this._renderManagerService = r, this._themeService = s, this._initViewModelIntercept(), this._initSkeletonChange();
|
|
411
|
+
}
|
|
412
|
+
_initViewModelIntercept() {
|
|
413
|
+
this.disposeWithMe(
|
|
414
|
+
this._sheetInterceptorService.intercept(
|
|
415
|
+
sn.CELL_CONTENT,
|
|
416
|
+
{
|
|
417
|
+
handler: (t, e, n) => {
|
|
418
|
+
const { row: i, col: r, unitId: s, subUnitId: o } = e, c = this._hyperLinkModel.getHyperLinkByLocation(s, o, i, r), a = this._themeService.getCurrentTheme();
|
|
419
|
+
return n(c ? {
|
|
420
|
+
...t,
|
|
421
|
+
interceptorStyle: {
|
|
422
|
+
ul: {
|
|
423
|
+
s: Xt.TRUE
|
|
424
|
+
},
|
|
425
|
+
cl: {
|
|
426
|
+
rgb: a.blue500
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
} : t);
|
|
430
|
+
},
|
|
431
|
+
priority: 100
|
|
432
|
+
}
|
|
433
|
+
)
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
_initSkeletonChange() {
|
|
437
|
+
const t = () => {
|
|
438
|
+
const e = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
|
|
439
|
+
if (!e)
|
|
440
|
+
return;
|
|
441
|
+
const n = e.getUnitId(), i = e.getActiveSheet().getSheetId(), r = this._sheetSkeletonManagerService.getOrCreateSkeleton({ unitId: n, sheetId: i }), s = this._renderManagerService.getRenderById(n);
|
|
442
|
+
r == null || r.makeDirty(!0), r == null || r.calculate(), s && s.mainComponent.makeForceDirty();
|
|
443
|
+
};
|
|
444
|
+
this.disposeWithMe(this._hyperLinkModel.linkUpdate$.subscribe(() => {
|
|
445
|
+
t();
|
|
446
|
+
}));
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
Se = Jn([
|
|
450
|
+
U(j.Ready, Se),
|
|
451
|
+
q(0, g(qe)),
|
|
452
|
+
q(1, g(H)),
|
|
453
|
+
q(2, F),
|
|
454
|
+
q(3, g(hn)),
|
|
455
|
+
q(4, Mn),
|
|
456
|
+
q(5, g(qt))
|
|
457
|
+
], Se);
|
|
458
|
+
var Tt = { exports: {} }, He = {};
|
|
459
|
+
/**
|
|
460
|
+
* @license React
|
|
461
|
+
* react-jsx-runtime.production.min.js
|
|
462
|
+
*
|
|
463
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
464
|
+
*
|
|
465
|
+
* This source code is licensed under the MIT license found in the
|
|
466
|
+
* LICENSE file in the root directory of this source tree.
|
|
467
|
+
*/
|
|
468
|
+
var Qn = jn, er = Symbol.for("react.element"), tr = Symbol.for("react.fragment"), nr = Object.prototype.hasOwnProperty, rr = Qn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, ir = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
469
|
+
function Ut(t, e, n) {
|
|
470
|
+
var i, r = {}, s = null, o = null;
|
|
471
|
+
n !== void 0 && (s = "" + n), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (o = e.ref);
|
|
472
|
+
for (i in e)
|
|
473
|
+
nr.call(e, i) && !ir.hasOwnProperty(i) && (r[i] = e[i]);
|
|
474
|
+
if (t && t.defaultProps)
|
|
475
|
+
for (i in e = t.defaultProps, e)
|
|
476
|
+
r[i] === void 0 && (r[i] = e[i]);
|
|
477
|
+
return { $$typeof: er, type: t, key: s, ref: o, props: r, _owner: rr.current };
|
|
478
|
+
}
|
|
479
|
+
He.Fragment = tr;
|
|
480
|
+
He.jsx = Ut;
|
|
481
|
+
He.jsxs = Ut;
|
|
482
|
+
Tt.exports = He;
|
|
483
|
+
var d = Tt.exports, P = function() {
|
|
484
|
+
return P = Object.assign || function(t) {
|
|
485
|
+
for (var e, n = 1, i = arguments.length; n < i; n++) {
|
|
486
|
+
e = arguments[n];
|
|
487
|
+
for (var r in e)
|
|
488
|
+
Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
|
|
489
|
+
}
|
|
490
|
+
return t;
|
|
491
|
+
}, P.apply(this, arguments);
|
|
492
|
+
}, sr = function(t, e) {
|
|
493
|
+
var n = {};
|
|
494
|
+
for (var i in t)
|
|
495
|
+
Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
|
|
496
|
+
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
497
|
+
for (var r = 0, i = Object.getOwnPropertySymbols(t); r < i.length; r++)
|
|
498
|
+
e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
|
|
499
|
+
return n;
|
|
500
|
+
}, K = Z(function(t, e) {
|
|
501
|
+
var n = t.icon, i = t.id, r = t.className, s = t.extend, o = sr(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), a = xt("_".concat(cr()));
|
|
502
|
+
return jt(n, "".concat(i), { defIds: n.defIds, idSuffix: a.current }, P({ ref: e, className: c }, o), s);
|
|
503
|
+
});
|
|
504
|
+
function jt(t, e, n, i, r) {
|
|
505
|
+
return z(t.tag, P(P({ key: e }, or(t, n, r)), i), (ar(t, n).children || []).map(function(s, o) {
|
|
506
|
+
return jt(s, "".concat(e, "-").concat(t.tag, "-").concat(o), n, void 0, r);
|
|
507
|
+
}));
|
|
508
|
+
}
|
|
509
|
+
function or(t, e, n) {
|
|
510
|
+
var i = P({}, t.attrs);
|
|
511
|
+
n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1);
|
|
512
|
+
var r = e.defIds;
|
|
513
|
+
return !r || r.length === 0 || (t.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(function(s) {
|
|
514
|
+
var o = s[0], c = s[1];
|
|
515
|
+
typeof c == "string" && (i[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
516
|
+
})), i;
|
|
517
|
+
}
|
|
518
|
+
function ar(t, e) {
|
|
519
|
+
var n, i = e.defIds;
|
|
520
|
+
return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? P(P({}, t), { children: t.children.map(function(r) {
|
|
521
|
+
return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? P(P({}, r), { attrs: P(P({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
|
|
522
|
+
}) }) : t;
|
|
523
|
+
}
|
|
524
|
+
function cr() {
|
|
525
|
+
return Math.random().toString(36).substring(2, 8);
|
|
526
|
+
}
|
|
527
|
+
K.displayName = "UniverIcon";
|
|
528
|
+
var lr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.9999 1.12915C8.03875 1.12915 8.07673 1.13284 8.11352 1.13989H12.2599C13.6958 1.13989 14.8599 2.30395 14.8599 3.73989V7.88619C14.867 7.92301 14.8707 7.96102 14.8707 7.9999C14.8707 8.03878 14.867 8.0768 14.8599 8.11362V12.2599C14.8599 13.6958 13.6958 14.8599 12.2599 14.8599H8.11362C8.0768 14.867 8.03878 14.8707 7.9999 14.8707C7.96102 14.8707 7.92301 14.867 7.88619 14.8599H3.73989C2.30396 14.8599 1.13989 13.6958 1.13989 12.2599V8.11352C1.13284 8.07673 1.12915 8.03875 1.12915 7.9999C1.12915 7.96106 1.13284 7.92308 1.13989 7.88629V3.73989C1.13989 2.30396 2.30395 1.13989 3.73989 1.13989H7.88629C7.92308 1.13284 7.96106 1.12915 7.9999 1.12915ZM2.33989 8.5999V12.2599C2.33989 13.0331 2.9667 13.6599 3.73989 13.6599H7.3999V8.5999H2.33989ZM7.3999 7.3999H2.33989V3.73989C2.33989 2.9667 2.96669 2.33989 3.73989 2.33989H7.3999V7.3999ZM8.5999 8.5999V13.6599H12.2599C13.0331 13.6599 13.6599 13.0331 13.6599 12.2599V8.5999H8.5999ZM13.6599 7.3999H8.5999V2.33989H12.2599C13.0331 2.33989 13.6599 2.96669 13.6599 3.73989V7.3999Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ht = Z(function(t, e) {
|
|
529
|
+
return z(K, Object.assign({}, t, {
|
|
530
|
+
id: "all-border-single",
|
|
531
|
+
ref: e,
|
|
532
|
+
icon: lr
|
|
533
|
+
}));
|
|
534
|
+
});
|
|
535
|
+
Ht.displayName = "AllBorderSingle";
|
|
536
|
+
const ze = Ht;
|
|
537
|
+
var dr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, $t = Z(function(t, e) {
|
|
538
|
+
return z(K, Object.assign({}, t, {
|
|
539
|
+
id: "copy-single",
|
|
540
|
+
ref: e,
|
|
541
|
+
icon: dr
|
|
542
|
+
}));
|
|
543
|
+
});
|
|
544
|
+
$t.displayName = "CopySingle";
|
|
545
|
+
const ur = $t;
|
|
546
|
+
var pr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ee = Z(function(t, e) {
|
|
547
|
+
return z(K, Object.assign({}, t, {
|
|
548
|
+
id: "link-single",
|
|
549
|
+
ref: e,
|
|
550
|
+
icon: pr
|
|
551
|
+
}));
|
|
552
|
+
});
|
|
553
|
+
Ee.displayName = "LinkSingle";
|
|
554
|
+
var hr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z" } }] }, Nt = Z(function(t, e) {
|
|
555
|
+
return z(K, Object.assign({}, t, {
|
|
556
|
+
id: "unlink-single",
|
|
557
|
+
ref: e,
|
|
558
|
+
icon: hr
|
|
559
|
+
}));
|
|
560
|
+
});
|
|
561
|
+
Nt.displayName = "UnlinkSingle";
|
|
562
|
+
const gr = Nt;
|
|
563
|
+
var mr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z" } }] }, Dt = Z(function(t, e) {
|
|
564
|
+
return z(K, Object.assign({}, t, {
|
|
565
|
+
id: "write-single",
|
|
566
|
+
ref: e,
|
|
567
|
+
icon: mr
|
|
568
|
+
}));
|
|
569
|
+
});
|
|
570
|
+
Dt.displayName = "WriteSingle";
|
|
571
|
+
const fr = Dt;
|
|
572
|
+
var vr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "#35BD4B", d: "M3.36396 1.12549C2.61066 1.12549 2 1.73615 2 2.48945V13.5104C2 14.2637 2.61066 14.8744 3.36396 14.8744H12.457C13.2103 14.8744 13.821 14.2637 13.821 13.5104V5.0992L9.91954 1.12549H3.36396Z" } }, { tag: "path", attrs: { fill: "#32A846", d: "M9.91797 1.12549L13.8209 5.09842H10.5846C10.2164 5.09842 9.91797 4.79994 9.91797 4.43175V1.12549Z" } }, { tag: "path", attrs: { fill: "#fff", d: "M7.71926 10.2949L6.28687 12.403C6.17306 12.5705 5.94501 12.614 5.77751 12.5002C5.61002 12.3864 5.56649 12.1584 5.6803 11.9909L7.27596 9.64252L5.85088 7.54519C5.73707 7.37769 5.78059 7.14964 5.94809 7.03583C6.11558 6.92202 6.34363 6.96555 6.45744 7.13304L7.71926 8.9901L8.98108 7.13304C9.09489 6.96555 9.32294 6.92202 9.49044 7.03583C9.65793 7.14964 9.70146 7.37769 9.58765 7.54519L8.16256 9.64252L9.75822 11.9909C9.87203 12.1584 9.82851 12.3864 9.66101 12.5002C9.49351 12.614 9.26547 12.5705 9.15166 12.403L7.71926 10.2949Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, At = Z(function(t, e) {
|
|
573
|
+
return z(K, Object.assign({}, t, {
|
|
574
|
+
id: "xlsx",
|
|
575
|
+
ref: e,
|
|
576
|
+
icon: vr
|
|
577
|
+
}));
|
|
578
|
+
});
|
|
579
|
+
At.displayName = "Xlsx";
|
|
580
|
+
const gt = At, _r = /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi, yr = new RegExp(_r);
|
|
581
|
+
function le(t) {
|
|
582
|
+
return t.startsWith("http://localhost:3002") || t.startsWith("localhost:3002") ? !0 : !!t.match(yr);
|
|
583
|
+
}
|
|
584
|
+
function Bt(t) {
|
|
585
|
+
return /^[a-zA-Z]+:\/\//.test(t);
|
|
586
|
+
}
|
|
587
|
+
function Sr(t) {
|
|
588
|
+
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(t);
|
|
589
|
+
}
|
|
590
|
+
function Vt(t) {
|
|
591
|
+
return le(t) ? Bt(t) ? t : Sr(t) ? `mailto://${t}` : `http://${t}` : t;
|
|
592
|
+
}
|
|
593
|
+
const Cr = "univer-cell-link-edit-buttons", Lr = {
|
|
594
|
+
cellLinkEditButtons: Cr
|
|
595
|
+
};
|
|
596
|
+
function Ir(t) {
|
|
597
|
+
if (t === null)
|
|
598
|
+
return "";
|
|
599
|
+
if (t != null && t.p) {
|
|
600
|
+
const e = t == null ? void 0 : t.p.body;
|
|
601
|
+
if (e == null)
|
|
602
|
+
return "";
|
|
603
|
+
const n = e.dataStream;
|
|
604
|
+
return n.substring(n.length - 2, n.length) === Qt ? n.substring(0, n.length - 2) : n;
|
|
605
|
+
}
|
|
606
|
+
return t == null ? void 0 : t.v;
|
|
607
|
+
}
|
|
608
|
+
const Me = () => {
|
|
609
|
+
var ee;
|
|
610
|
+
const [t, e] = te(""), [n, i] = te(""), [r, s] = te(
|
|
611
|
+
"link"
|
|
612
|
+
/* link */
|
|
613
|
+
), [o, c] = te(""), a = b(de), p = b(kt), h = b(F), v = b($), l = In(v.currentEditing$), f = b(H), L = b(B), y = b(W), [S, I] = te(!1), _ = xt(!1);
|
|
614
|
+
Hn(() => {
|
|
615
|
+
var u, m, C;
|
|
616
|
+
if ((l == null ? void 0 : l.row) !== void 0 && l.column !== void 0) {
|
|
617
|
+
const k = f.getHyperLinkByLocation(l.unitId, l.subUnitId, l.row, l.column);
|
|
618
|
+
if (k) {
|
|
619
|
+
const Be = L.parseHyperLink(k.payload);
|
|
620
|
+
if (e(k.id), i(k.display), Be.type === "outer") {
|
|
621
|
+
s(
|
|
622
|
+
"link"
|
|
623
|
+
/* link */
|
|
624
|
+
), c(Be.url);
|
|
625
|
+
return;
|
|
626
|
+
} else {
|
|
627
|
+
const A = Be.searchObj;
|
|
628
|
+
if (A.rangeid) {
|
|
629
|
+
s(
|
|
630
|
+
"rangeid"
|
|
631
|
+
/* definedName */
|
|
632
|
+
), c(A.rangeid);
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
if (A.range) {
|
|
636
|
+
const zt = A.gid && (C = (m = (u = h.getUnit(l.unitId)) == null ? void 0 : u.getSheetBySheetId(A.gid)) == null ? void 0 : m.getName()) != null ? C : "";
|
|
637
|
+
s(
|
|
638
|
+
"range"
|
|
639
|
+
/* range */
|
|
640
|
+
), c(It(zt, ce(A.range).range));
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (A.gid) {
|
|
644
|
+
s(
|
|
645
|
+
"gid"
|
|
646
|
+
/* sheet */
|
|
647
|
+
), c(A.gid);
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
const D = h.getUnit(l.unitId), De = D == null ? void 0 : D.getSheetBySheetId(l.subUnitId), Zt = De == null ? void 0 : De.getCellRaw(l.row, l.column), Ae = Ir(Zt);
|
|
653
|
+
s(
|
|
654
|
+
"link"
|
|
655
|
+
/* link */
|
|
656
|
+
), c(""), i((Ae != null ? Ae : "").toString()), e("");
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
s(
|
|
660
|
+
"link"
|
|
661
|
+
/* link */
|
|
662
|
+
), c(""), i(""), e("");
|
|
663
|
+
}, [l, f, L, h]);
|
|
664
|
+
const Y = $n(() => o, [r]), N = [
|
|
665
|
+
{
|
|
666
|
+
label: a.t("hyperLink.form.link"),
|
|
667
|
+
value: "link"
|
|
668
|
+
/* link */
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
label: a.t("hyperLink.form.range"),
|
|
672
|
+
value: "range"
|
|
673
|
+
/* range */
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
label: a.t("hyperLink.form.worksheet"),
|
|
677
|
+
value: "gid"
|
|
678
|
+
/* sheet */
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
label: a.t("hyperLink.form.definedName"),
|
|
682
|
+
value: "rangeid"
|
|
683
|
+
/* definedName */
|
|
684
|
+
}
|
|
685
|
+
], R = h.getCurrentUnitForType(E.UNIVER_SHEET);
|
|
686
|
+
if (!R)
|
|
687
|
+
return;
|
|
688
|
+
const G = R.getHiddenWorksheets(), V = R.getSheets().map((u) => ({ label: u.getName(), value: u.getSheetId() })).filter((u) => G.indexOf(u.value) === -1), Q = Object.values((ee = p.getDefinedNameMap(R.getUnitId())) != null ? ee : {}).map((u) => ({
|
|
689
|
+
label: u.name,
|
|
690
|
+
value: u.id
|
|
691
|
+
})), ue = (u, m) => {
|
|
692
|
+
if (u === "link")
|
|
693
|
+
return Bt(m) ? m : `http://${m}`;
|
|
694
|
+
if (u === "range") {
|
|
695
|
+
const C = ce(m), k = R.getSheetBySheetName(C.sheetName);
|
|
696
|
+
if (k)
|
|
697
|
+
return `#gid=${k.getSheetId()}&range=${ve(C.range)}`;
|
|
698
|
+
}
|
|
699
|
+
return `#${u}=${m}`;
|
|
700
|
+
}, Ne = async () => {
|
|
701
|
+
l && (t ? await y.executeCommand(Lt.id, {
|
|
702
|
+
unitId: l.unitId,
|
|
703
|
+
subUnitId: l.subUnitId,
|
|
704
|
+
id: t,
|
|
705
|
+
payload: {
|
|
706
|
+
display: n,
|
|
707
|
+
payload: ue(r, o)
|
|
708
|
+
}
|
|
709
|
+
}) : await y.executeCommand(rt.id, {
|
|
710
|
+
unitId: l.unitId,
|
|
711
|
+
subUnitId: l.subUnitId,
|
|
712
|
+
link: {
|
|
713
|
+
id: ae.generateRandomId(),
|
|
714
|
+
row: l.row,
|
|
715
|
+
column: l.column,
|
|
716
|
+
payload: ue(r, o),
|
|
717
|
+
display: n
|
|
718
|
+
}
|
|
719
|
+
})), l && (await y.executeCommand(Oe.id, {
|
|
720
|
+
unitId: l.unitId,
|
|
721
|
+
subUnitId: l.subUnitId
|
|
722
|
+
}), await y.executeCommand(bt.id, {
|
|
723
|
+
range: {
|
|
724
|
+
startRow: l.row,
|
|
725
|
+
endRow: l.row,
|
|
726
|
+
startColumn: l.column,
|
|
727
|
+
endColumn: l.column
|
|
728
|
+
}
|
|
729
|
+
})), y.executeCommand(xe.id);
|
|
730
|
+
};
|
|
731
|
+
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
732
|
+
/* @__PURE__ */ d.jsx(
|
|
733
|
+
X,
|
|
734
|
+
{
|
|
735
|
+
label: a.t("hyperLink.form.label"),
|
|
736
|
+
error: S && !n ? a.t("hyperLink.form.inputError") : "",
|
|
737
|
+
children: /* @__PURE__ */ d.jsx(
|
|
738
|
+
dt,
|
|
739
|
+
{
|
|
740
|
+
value: n,
|
|
741
|
+
onChange: (u) => {
|
|
742
|
+
i(u), _.current = !1;
|
|
743
|
+
},
|
|
744
|
+
placeholder: a.t("hyperLink.form.labelPlaceholder")
|
|
745
|
+
}
|
|
746
|
+
)
|
|
747
|
+
}
|
|
748
|
+
),
|
|
749
|
+
/* @__PURE__ */ d.jsx(X, { label: a.t("hyperLink.form.type"), children: /* @__PURE__ */ d.jsx(
|
|
750
|
+
Ve,
|
|
751
|
+
{
|
|
752
|
+
options: N,
|
|
753
|
+
value: r,
|
|
754
|
+
onChange: (u) => {
|
|
755
|
+
s(u), c("");
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
) }),
|
|
759
|
+
r === "link" && /* @__PURE__ */ d.jsx(
|
|
760
|
+
X,
|
|
761
|
+
{
|
|
762
|
+
error: S ? o ? le(o) ? "" : a.t("hyperLink.form.linkError") : a.t("hyperLink.form.inputError") : "",
|
|
763
|
+
children: /* @__PURE__ */ d.jsx(
|
|
764
|
+
dt,
|
|
765
|
+
{
|
|
766
|
+
value: o,
|
|
767
|
+
onChange: (u) => {
|
|
768
|
+
c(u), u && (_.current || !n) && (i(u), _.current = !0);
|
|
769
|
+
},
|
|
770
|
+
placeholder: a.t("hyperLink.form.linkPlaceholder")
|
|
771
|
+
}
|
|
772
|
+
)
|
|
773
|
+
}
|
|
774
|
+
),
|
|
775
|
+
r === "range" && /* @__PURE__ */ d.jsx(X, { error: S && !o ? a.t("hyperLink.form.inputError") : "", children: /* @__PURE__ */ d.jsx(
|
|
776
|
+
kn,
|
|
777
|
+
{
|
|
778
|
+
openForSheetUnitId: R.getUnitId(),
|
|
779
|
+
id: Jt("hyper-link-edit"),
|
|
780
|
+
isSingleChoice: !0,
|
|
781
|
+
value: Y,
|
|
782
|
+
onChange: (u) => {
|
|
783
|
+
const m = u[0];
|
|
784
|
+
if (!m || !Pe(m.range))
|
|
785
|
+
return;
|
|
786
|
+
m.sheetName || (m.sheetName = R.getActiveSheet().getName());
|
|
787
|
+
const C = pn(m);
|
|
788
|
+
c(C), C && (_.current || !n) && (i(C), _.current = !0);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
) }),
|
|
792
|
+
r === "gid" && /* @__PURE__ */ d.jsx(X, { error: S && !o ? a.t("hyperLink.form.selectError") : "", children: /* @__PURE__ */ d.jsx(
|
|
793
|
+
Ve,
|
|
794
|
+
{
|
|
795
|
+
options: V,
|
|
796
|
+
value: o,
|
|
797
|
+
onChange: (u) => {
|
|
798
|
+
var C;
|
|
799
|
+
c(u);
|
|
800
|
+
const m = (C = V.find((k) => k.value === u)) == null ? void 0 : C.label;
|
|
801
|
+
m && (_.current || !n) && (i(m), _.current = !0);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
) }),
|
|
805
|
+
r === "rangeid" && /* @__PURE__ */ d.jsx(X, { error: S && !o ? a.t("hyperLink.form.selectError") : "", children: /* @__PURE__ */ d.jsx(
|
|
806
|
+
Ve,
|
|
807
|
+
{
|
|
808
|
+
options: Q,
|
|
809
|
+
value: o,
|
|
810
|
+
onChange: (u) => {
|
|
811
|
+
var C;
|
|
812
|
+
c(u);
|
|
813
|
+
const m = (C = Q.find((k) => k.value === u)) == null ? void 0 : C.label;
|
|
814
|
+
m && (_.current || !n) && (i(m), _.current = !0);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
) }),
|
|
818
|
+
/* @__PURE__ */ d.jsxs("div", { className: Lr.cellLinkEditButtons, children: [
|
|
819
|
+
/* @__PURE__ */ d.jsx(
|
|
820
|
+
ut,
|
|
821
|
+
{
|
|
822
|
+
onClick: () => {
|
|
823
|
+
l && y.executeCommand(Oe.id, {
|
|
824
|
+
unitId: l.unitId,
|
|
825
|
+
subUnitId: l.subUnitId
|
|
826
|
+
}), y.executeCommand(xe.id);
|
|
827
|
+
},
|
|
828
|
+
children: a.t("hyperLink.form.cancel")
|
|
829
|
+
}
|
|
830
|
+
),
|
|
831
|
+
/* @__PURE__ */ d.jsx(
|
|
832
|
+
ut,
|
|
833
|
+
{
|
|
834
|
+
type: "primary",
|
|
835
|
+
style: { marginLeft: 8 },
|
|
836
|
+
onClick: async () => {
|
|
837
|
+
if (!n || !o || r === "link" && !le(o)) {
|
|
838
|
+
I(!0);
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
Ne();
|
|
842
|
+
},
|
|
843
|
+
children: a.t("hyperLink.form.ok")
|
|
844
|
+
}
|
|
845
|
+
)
|
|
846
|
+
] })
|
|
847
|
+
] });
|
|
848
|
+
};
|
|
849
|
+
Me.componentKey = "univer.sheet.cell-link-edit";
|
|
850
|
+
const st = {
|
|
851
|
+
type: Ue.OPERATION,
|
|
852
|
+
id: "sheet.operation.open-hyper-link-sidebar",
|
|
853
|
+
handler(t, e) {
|
|
854
|
+
if (!e)
|
|
855
|
+
return !1;
|
|
856
|
+
const { unitId: n, subUnitId: i, row: r, column: s } = e, o = t.get(H), c = t.get(Ot), a = t.get($), p = o.getHyperLinkByLocation(n, i, r, s);
|
|
857
|
+
return a.startEditing(e), c.open({
|
|
858
|
+
header: {
|
|
859
|
+
title: p ? "hyperLink.form.editTitle" : "hyperLink.form.addTitle"
|
|
860
|
+
},
|
|
861
|
+
children: {
|
|
862
|
+
label: Me.componentKey
|
|
863
|
+
}
|
|
864
|
+
}), !0;
|
|
865
|
+
}
|
|
866
|
+
}, xe = {
|
|
867
|
+
type: Ue.OPERATION,
|
|
868
|
+
id: "sheet.operation.close-hyper-link-sidebar",
|
|
869
|
+
handler(t) {
|
|
870
|
+
const e = t.get(Ot), n = t.get($);
|
|
871
|
+
return e.close(), n.endEditing(), !0;
|
|
872
|
+
}
|
|
873
|
+
}, $e = {
|
|
874
|
+
type: Ue.OPERATION,
|
|
875
|
+
id: "sheet.operation.insert-hyper-link",
|
|
876
|
+
handler(t) {
|
|
877
|
+
const e = t.get(F), n = St(e);
|
|
878
|
+
if (!n)
|
|
879
|
+
return !1;
|
|
880
|
+
const i = t.get(W), s = t.get(Ct).getFirst();
|
|
881
|
+
if (!(s != null && s.primary))
|
|
882
|
+
return !1;
|
|
883
|
+
const o = s.primary.actualRow, c = s.primary.actualColumn;
|
|
884
|
+
return i.executeCommand(st.id, {
|
|
885
|
+
unitId: n.unitId,
|
|
886
|
+
subUnitId: n.subUnitId,
|
|
887
|
+
row: o,
|
|
888
|
+
column: c
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
}, Ft = {
|
|
892
|
+
type: Ue.OPERATION,
|
|
893
|
+
id: "sheet.operation.insert-hyper-link-toolbar",
|
|
894
|
+
handler(t) {
|
|
895
|
+
const e = t.get(W);
|
|
896
|
+
return t.get($).currentEditing ? e.executeCommand(xe.id) : e.executeCommand($e.id);
|
|
897
|
+
}
|
|
898
|
+
}, kr = "univer-cell-link", br = "univer-cell-link-type", Rr = "univer-cell-link-content", Pr = "univer-cell-link-content-error", Or = "univer-cell-link-url", wr = "univer-cell-link-operations", Er = "univer-cell-link-operation", Mr = "univer-cell-link-operation-error", w = {
|
|
899
|
+
cellLink: kr,
|
|
900
|
+
cellLinkType: br,
|
|
901
|
+
cellLinkContent: Rr,
|
|
902
|
+
cellLinkContentError: Pr,
|
|
903
|
+
cellLinkUrl: Or,
|
|
904
|
+
cellLinkOperations: wr,
|
|
905
|
+
cellLinkOperation: Er,
|
|
906
|
+
cellLinkOperationError: Mr
|
|
907
|
+
}, xr = {
|
|
908
|
+
outer: /* @__PURE__ */ d.jsx(Ee, {}),
|
|
909
|
+
link: /* @__PURE__ */ d.jsx(Ee, {}),
|
|
910
|
+
sheet: /* @__PURE__ */ d.jsx(gt, {}),
|
|
911
|
+
range: /* @__PURE__ */ d.jsx(ze, {}),
|
|
912
|
+
defineName: /* @__PURE__ */ d.jsx(ze, {}),
|
|
913
|
+
"range-error": /* @__PURE__ */ d.jsx(ze, {}),
|
|
914
|
+
"sheet-error": /* @__PURE__ */ d.jsx(gt, {})
|
|
915
|
+
}, Te = () => {
|
|
916
|
+
const t = b($), e = b(H), n = b(W), i = b(Pt), r = b(de), s = Nn(t.currentPopup$, t.currentPopup), o = b(B);
|
|
917
|
+
if (!s)
|
|
918
|
+
return null;
|
|
919
|
+
const { unitId: c, subUnitId: a, id: p } = s, h = e.getHyperLink(c, a, p);
|
|
920
|
+
if (!h)
|
|
921
|
+
return null;
|
|
922
|
+
const v = o.parseHyperLink(h.payload), l = v.type.indexOf("error") > -1;
|
|
923
|
+
return /* @__PURE__ */ d.jsxs("div", { className: w.cellLink, onClick: () => t.hideCurrentPopup(), children: [
|
|
924
|
+
/* @__PURE__ */ d.jsxs("div", { className: ht(w.cellLinkContent, { [w.cellLinkContentError]: l }), onClick: v.handler, children: [
|
|
925
|
+
/* @__PURE__ */ d.jsx("div", { className: w.cellLinkType, children: xr[v.type] }),
|
|
926
|
+
/* @__PURE__ */ d.jsx("div", { className: w.cellLinkUrl, children: v.name })
|
|
927
|
+
] }),
|
|
928
|
+
/* @__PURE__ */ d.jsxs("div", { className: w.cellLinkOperations, children: [
|
|
929
|
+
/* @__PURE__ */ d.jsx(
|
|
930
|
+
"div",
|
|
931
|
+
{
|
|
932
|
+
className: ht(w.cellLinkOperation, { [w.cellLinkOperationError]: l }),
|
|
933
|
+
onClick: () => {
|
|
934
|
+
if (!l) {
|
|
935
|
+
if (v.type !== "outer") {
|
|
936
|
+
const f = new URL(window.location.href);
|
|
937
|
+
f.hash = v.url.slice(1), navigator.clipboard.writeText(f.href);
|
|
938
|
+
} else
|
|
939
|
+
navigator.clipboard.writeText(v.url);
|
|
940
|
+
i.show({
|
|
941
|
+
content: r.t("hyperLink.message.coped"),
|
|
942
|
+
type: ie.Info
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
},
|
|
946
|
+
children: /* @__PURE__ */ d.jsx(Fe, { placement: "bottom", title: r.t("hyperLink.popup.copy"), children: /* @__PURE__ */ d.jsx(ur, {}) })
|
|
947
|
+
}
|
|
948
|
+
),
|
|
949
|
+
/* @__PURE__ */ d.jsx(
|
|
950
|
+
"div",
|
|
951
|
+
{
|
|
952
|
+
className: w.cellLinkOperation,
|
|
953
|
+
onClick: () => {
|
|
954
|
+
n.executeCommand(st.id, {
|
|
955
|
+
unitId: c,
|
|
956
|
+
subUnitId: a,
|
|
957
|
+
row: h.row,
|
|
958
|
+
column: h.column
|
|
959
|
+
});
|
|
960
|
+
},
|
|
961
|
+
children: /* @__PURE__ */ d.jsx(Fe, { placement: "bottom", title: r.t("hyperLink.popup.edit"), children: /* @__PURE__ */ d.jsx(fr, {}) })
|
|
962
|
+
}
|
|
963
|
+
),
|
|
964
|
+
/* @__PURE__ */ d.jsx(
|
|
965
|
+
"div",
|
|
966
|
+
{
|
|
967
|
+
className: w.cellLinkOperation,
|
|
968
|
+
onClick: () => {
|
|
969
|
+
n.executeCommand(dn.id, {
|
|
970
|
+
unitId: c,
|
|
971
|
+
subUnitId: a,
|
|
972
|
+
id: h.id
|
|
973
|
+
});
|
|
974
|
+
},
|
|
975
|
+
children: /* @__PURE__ */ d.jsx(Fe, { placement: "bottom", title: r.t("hyperLink.popup.cancel"), children: /* @__PURE__ */ d.jsx(gr, {}) })
|
|
976
|
+
}
|
|
977
|
+
)
|
|
978
|
+
] })
|
|
979
|
+
] });
|
|
980
|
+
};
|
|
981
|
+
Te.componentKey = "univer.sheet.cell-link-popup";
|
|
982
|
+
var Tr = Object.defineProperty, Ur = Object.getOwnPropertyDescriptor, jr = (t, e, n, i) => {
|
|
983
|
+
for (var r = i > 1 ? void 0 : i ? Ur(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
984
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
985
|
+
return i && r && Tr(e, n, r), r;
|
|
986
|
+
}, mt = (t, e) => (n, i) => e(n, i, t);
|
|
987
|
+
let $ = class {
|
|
988
|
+
constructor(t, e) {
|
|
989
|
+
O(this, "_currentPopup", null);
|
|
990
|
+
O(this, "_currentPopup$", new xn());
|
|
991
|
+
O(this, "currentPopup$", this._currentPopup$.asObservable());
|
|
992
|
+
O(this, "_currentEditing$", new Tn(null));
|
|
993
|
+
O(this, "currentEditing$", this._currentEditing$.asObservable());
|
|
994
|
+
this._hyperLinkModel = t, this._sheetCanvasPopManagerService = e;
|
|
995
|
+
}
|
|
996
|
+
get currentPopup() {
|
|
997
|
+
return this._currentPopup;
|
|
998
|
+
}
|
|
999
|
+
get currentEditing() {
|
|
1000
|
+
return this._currentEditing$.getValue();
|
|
1001
|
+
}
|
|
1002
|
+
showPopup(t) {
|
|
1003
|
+
this.hideCurrentPopup();
|
|
1004
|
+
const { unitId: e, subUnitId: n, row: i, col: r } = t, s = this._hyperLinkModel.getHyperLinkByLocation(e, n, i, r);
|
|
1005
|
+
if (!s)
|
|
1006
|
+
return;
|
|
1007
|
+
const o = this._sheetCanvasPopManagerService.attachPopupToCell(i, r, {
|
|
1008
|
+
componentKey: Te.componentKey,
|
|
1009
|
+
direction: "bottom",
|
|
1010
|
+
closeOnSelfTarget: !0
|
|
1011
|
+
});
|
|
1012
|
+
o && (this._currentPopup = {
|
|
1013
|
+
unitId: e,
|
|
1014
|
+
subUnitId: n,
|
|
1015
|
+
id: s.id,
|
|
1016
|
+
disposable: o
|
|
1017
|
+
}, this._currentPopup$.next(this._currentPopup));
|
|
1018
|
+
}
|
|
1019
|
+
hideCurrentPopup() {
|
|
1020
|
+
var t;
|
|
1021
|
+
this._currentPopup && ((t = this._currentPopup.disposable) == null || t.dispose(), this._currentPopup = null, this._currentPopup$.next(null));
|
|
1022
|
+
}
|
|
1023
|
+
startEditing(t) {
|
|
1024
|
+
this._currentEditing$.next(t);
|
|
1025
|
+
}
|
|
1026
|
+
endEditing() {
|
|
1027
|
+
this._currentEditing$.next(null);
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
$ = jr([
|
|
1031
|
+
mt(0, g(H)),
|
|
1032
|
+
mt(1, g(gn))
|
|
1033
|
+
], $);
|
|
1034
|
+
var Hr = Object.defineProperty, $r = Object.getOwnPropertyDescriptor, Nr = (t, e, n, i) => {
|
|
1035
|
+
for (var r = i > 1 ? void 0 : i ? $r(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
1036
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
1037
|
+
return i && r && Hr(e, n, r), r;
|
|
1038
|
+
}, re = (t, e) => (n, i) => e(n, i, t);
|
|
1039
|
+
let Ce = class extends T {
|
|
1040
|
+
constructor(t, e, n, i, r) {
|
|
1041
|
+
super(), this._sheetInterceptorService = t, this._injector = e, this._hyperLinkModel = n, this._selectionManagerService = i, this._univerInstanceService = r, this._initCommandInterceptor();
|
|
1042
|
+
}
|
|
1043
|
+
_initCommandInterceptor() {
|
|
1044
|
+
this._initAddHyperLinkCommandInterceptor(), this._initSetRangeValuesCommandInterceptor(), this._initUpdateHyperLinkCommandInterceptor(), this._initClearSelectionCommandInterceptor();
|
|
1045
|
+
}
|
|
1046
|
+
_initAddHyperLinkCommandInterceptor() {
|
|
1047
|
+
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
1048
|
+
getMutations: (t) => {
|
|
1049
|
+
if (t.id === rt.id) {
|
|
1050
|
+
const e = t.params, { unitId: n, subUnitId: i, link: r } = e, s = {
|
|
1051
|
+
unitId: n,
|
|
1052
|
+
subUnitId: i,
|
|
1053
|
+
cellValue: {
|
|
1054
|
+
[r.row]: {
|
|
1055
|
+
[r.column]: {
|
|
1056
|
+
v: r.display,
|
|
1057
|
+
t: ot.STRING,
|
|
1058
|
+
p: null
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
};
|
|
1063
|
+
return {
|
|
1064
|
+
redos: [{
|
|
1065
|
+
id: pe.id,
|
|
1066
|
+
params: s
|
|
1067
|
+
}],
|
|
1068
|
+
undos: [{
|
|
1069
|
+
id: pe.id,
|
|
1070
|
+
params: ct(this._injector, s)
|
|
1071
|
+
}]
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
return {
|
|
1075
|
+
redos: [],
|
|
1076
|
+
undos: []
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
}));
|
|
1080
|
+
}
|
|
1081
|
+
_initUpdateHyperLinkCommandInterceptor() {
|
|
1082
|
+
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
1083
|
+
getMutations: (t) => {
|
|
1084
|
+
if (t.id === Lt.id) {
|
|
1085
|
+
const e = t.params, { unitId: n, subUnitId: i, id: r, payload: s } = e, o = this._hyperLinkModel.getHyperLink(n, i, r);
|
|
1086
|
+
if (o && o.display !== s.display) {
|
|
1087
|
+
const c = {
|
|
1088
|
+
unitId: n,
|
|
1089
|
+
subUnitId: i,
|
|
1090
|
+
cellValue: {
|
|
1091
|
+
[o.row]: {
|
|
1092
|
+
[o.column]: {
|
|
1093
|
+
v: s.display,
|
|
1094
|
+
t: ot.STRING,
|
|
1095
|
+
p: null
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
};
|
|
1100
|
+
return {
|
|
1101
|
+
redos: [{
|
|
1102
|
+
id: pe.id,
|
|
1103
|
+
params: c
|
|
1104
|
+
}],
|
|
1105
|
+
undos: [{
|
|
1106
|
+
id: pe.id,
|
|
1107
|
+
params: ct(this._injector, c)
|
|
1108
|
+
}]
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
return {
|
|
1113
|
+
redos: [],
|
|
1114
|
+
undos: []
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
1117
|
+
}));
|
|
1118
|
+
}
|
|
1119
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1120
|
+
_initSetRangeValuesCommandInterceptor() {
|
|
1121
|
+
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
1122
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1123
|
+
getMutations: (t) => {
|
|
1124
|
+
if (t.id === on.id) {
|
|
1125
|
+
const e = t.params, { unitId: n, subUnitId: i } = e, r = [], s = [];
|
|
1126
|
+
return e.cellValue && new yt(e.cellValue).forValue((o, c, a) => {
|
|
1127
|
+
var f, L, y, S;
|
|
1128
|
+
const p = ((S = (y = a == null ? void 0 : a.v) != null ? y : (L = (f = a == null ? void 0 : a.p) == null ? void 0 : f.body) == null ? void 0 : L.dataStream.slice(0, -2)) != null ? S : "").toString(), h = this._hyperLinkModel.getHyperLinkByLocation(n, i, o, c);
|
|
1129
|
+
if (!h) {
|
|
1130
|
+
if (le(p)) {
|
|
1131
|
+
const I = ae.generateRandomId();
|
|
1132
|
+
s.push({
|
|
1133
|
+
id: M.id,
|
|
1134
|
+
params: {
|
|
1135
|
+
unitId: n,
|
|
1136
|
+
subUnitId: i,
|
|
1137
|
+
id: I
|
|
1138
|
+
}
|
|
1139
|
+
}), r.push({
|
|
1140
|
+
id: x.id,
|
|
1141
|
+
params: {
|
|
1142
|
+
unitId: n,
|
|
1143
|
+
subUnitId: i,
|
|
1144
|
+
link: {
|
|
1145
|
+
id: I,
|
|
1146
|
+
row: o,
|
|
1147
|
+
column: c,
|
|
1148
|
+
display: p,
|
|
1149
|
+
payload: Vt(p)
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
if (h.display === p)
|
|
1157
|
+
return;
|
|
1158
|
+
p || (r.push({
|
|
1159
|
+
id: M.id,
|
|
1160
|
+
params: {
|
|
1161
|
+
unitId: n,
|
|
1162
|
+
subUnitId: i,
|
|
1163
|
+
id: h.id
|
|
1164
|
+
}
|
|
1165
|
+
}), s.push({
|
|
1166
|
+
id: x.id,
|
|
1167
|
+
params: {
|
|
1168
|
+
unitId: n,
|
|
1169
|
+
subUnitId: i,
|
|
1170
|
+
link: h
|
|
1171
|
+
}
|
|
1172
|
+
}));
|
|
1173
|
+
const v = {
|
|
1174
|
+
unitId: n,
|
|
1175
|
+
subUnitId: i,
|
|
1176
|
+
id: h.id,
|
|
1177
|
+
payload: {
|
|
1178
|
+
payload: h.payload,
|
|
1179
|
+
display: p
|
|
1180
|
+
}
|
|
1181
|
+
}, l = {
|
|
1182
|
+
unitId: n,
|
|
1183
|
+
subUnitId: i,
|
|
1184
|
+
id: h.id,
|
|
1185
|
+
payload: {
|
|
1186
|
+
payload: h.payload,
|
|
1187
|
+
display: h.display
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
r.push({
|
|
1191
|
+
id: we.id,
|
|
1192
|
+
params: v
|
|
1193
|
+
}), s.push({
|
|
1194
|
+
id: we.id,
|
|
1195
|
+
params: l
|
|
1196
|
+
});
|
|
1197
|
+
}), {
|
|
1198
|
+
undos: s,
|
|
1199
|
+
redos: r
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
return {
|
|
1203
|
+
redos: [],
|
|
1204
|
+
undos: []
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
}));
|
|
1208
|
+
}
|
|
1209
|
+
_initClearSelectionCommandInterceptor() {
|
|
1210
|
+
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
1211
|
+
getMutations: (t) => {
|
|
1212
|
+
if (t.id === an.id || t.id === cn.id) {
|
|
1213
|
+
const e = [], n = [], i = this._selectionManagerService.getFirst(), r = St(this._univerInstanceService);
|
|
1214
|
+
if (i && r) {
|
|
1215
|
+
const { unitId: s, subUnitId: o } = r;
|
|
1216
|
+
Xe.foreach(i.range, (c, a) => {
|
|
1217
|
+
const p = this._hyperLinkModel.getHyperLinkByLocation(s, o, c, a);
|
|
1218
|
+
p && (e.push({
|
|
1219
|
+
id: M.id,
|
|
1220
|
+
params: {
|
|
1221
|
+
unitId: s,
|
|
1222
|
+
subUnitId: o,
|
|
1223
|
+
id: p.id
|
|
1224
|
+
}
|
|
1225
|
+
}), n.push({
|
|
1226
|
+
id: x.id,
|
|
1227
|
+
params: {
|
|
1228
|
+
unitId: s,
|
|
1229
|
+
subUnitId: o,
|
|
1230
|
+
link: p
|
|
1231
|
+
}
|
|
1232
|
+
}));
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
return {
|
|
1236
|
+
redos: e,
|
|
1237
|
+
undos: n
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
return {
|
|
1241
|
+
redos: [],
|
|
1242
|
+
undos: []
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1245
|
+
}));
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
Ce = Nr([
|
|
1249
|
+
U(j.Starting, Ce),
|
|
1250
|
+
re(0, g(qe)),
|
|
1251
|
+
re(1, g(je)),
|
|
1252
|
+
re(2, g(H)),
|
|
1253
|
+
re(3, g(Ct)),
|
|
1254
|
+
re(4, F)
|
|
1255
|
+
], Ce);
|
|
1256
|
+
var Dr = Object.defineProperty, Ar = Object.getOwnPropertyDescriptor, Br = (t, e, n, i) => {
|
|
1257
|
+
for (var r = i > 1 ? void 0 : i ? Ar(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
1258
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
1259
|
+
return i && r && Dr(e, n, r), r;
|
|
1260
|
+
}, ft = (t, e) => (n, i) => e(n, i, t);
|
|
1261
|
+
let Le = class extends T {
|
|
1262
|
+
constructor(t, e) {
|
|
1263
|
+
super(), this._hoverManagerService = t, this._sheetsHyperLinkPopupService = e, this._initHoverListener();
|
|
1264
|
+
}
|
|
1265
|
+
_initHoverListener() {
|
|
1266
|
+
this.disposeWithMe(
|
|
1267
|
+
this._hoverManagerService.currentCell$.pipe(Un(100)).subscribe((t) => {
|
|
1268
|
+
if (!t) {
|
|
1269
|
+
this._sheetsHyperLinkPopupService.hideCurrentPopup();
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
this._sheetsHyperLinkPopupService.showPopup(t.location);
|
|
1273
|
+
})
|
|
1274
|
+
);
|
|
1275
|
+
}
|
|
1276
|
+
};
|
|
1277
|
+
Le = Br([
|
|
1278
|
+
U(j.Rendered, Le),
|
|
1279
|
+
ft(0, g(mn)),
|
|
1280
|
+
ft(1, g($))
|
|
1281
|
+
], Le);
|
|
1282
|
+
const Vr = (t) => ({
|
|
1283
|
+
id: $e.id,
|
|
1284
|
+
type: wt.BUTTON,
|
|
1285
|
+
positions: [Et.CONTEXT_MENU],
|
|
1286
|
+
title: "hyperLink.menu.add",
|
|
1287
|
+
hidden$: Mt(t, E.UNIVER_SHEET),
|
|
1288
|
+
icon: "LinkSingle",
|
|
1289
|
+
disabled$: Rt(t, { workbookTypes: [Je], worksheetTypes: [Qe, et, tt], rangeTypes: [nt] })
|
|
1290
|
+
}), Fr = (t) => ({
|
|
1291
|
+
tooltip: "hyperLink.form.addTitle",
|
|
1292
|
+
positions: Et.TOOLBAR_START,
|
|
1293
|
+
group: Pn.TOOLBAR_OTHERS,
|
|
1294
|
+
id: Ft.id,
|
|
1295
|
+
type: wt.BUTTON,
|
|
1296
|
+
icon: "LinkSingle",
|
|
1297
|
+
hidden$: Mt(t, E.UNIVER_SHEET),
|
|
1298
|
+
disabled$: Rt(t, { workbookTypes: [Je], worksheetTypes: [Qe, et, tt], rangeTypes: [nt] })
|
|
1299
|
+
}), Wt = {
|
|
1300
|
+
id: $e.id,
|
|
1301
|
+
binding: bn.K | Rn.CTRL_COMMAND,
|
|
1302
|
+
preconditions: fn
|
|
1303
|
+
};
|
|
1304
|
+
var Wr = Object.defineProperty, Zr = Object.getOwnPropertyDescriptor, zr = (t, e, n, i) => {
|
|
1305
|
+
for (var r = i > 1 ? void 0 : i ? Zr(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
1306
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
1307
|
+
return i && r && Wr(e, n, r), r;
|
|
1308
|
+
}, J = (t, e) => (n, i) => e(n, i, t);
|
|
1309
|
+
let se = class extends T {
|
|
1310
|
+
constructor(t, e, n, i, r, s, o) {
|
|
1311
|
+
super(), this._config = t, this._componentManager = e, this._commandService = n, this._localeService = i, this._menuService = r, this._injector = s, this._shortcutService = o, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortCut();
|
|
1312
|
+
}
|
|
1313
|
+
_initComponents() {
|
|
1314
|
+
[
|
|
1315
|
+
[Te, Te.componentKey],
|
|
1316
|
+
[Me, Me.componentKey],
|
|
1317
|
+
[Ee, "LinkSingle"]
|
|
1318
|
+
].forEach(([t, e]) => {
|
|
1319
|
+
this._componentManager.register(e, t);
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
_initCommands() {
|
|
1323
|
+
[
|
|
1324
|
+
st,
|
|
1325
|
+
xe,
|
|
1326
|
+
$e,
|
|
1327
|
+
Ft
|
|
1328
|
+
].forEach((t) => {
|
|
1329
|
+
this._commandService.registerCommand(t);
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
_initMenus() {
|
|
1333
|
+
var t, e, n, i;
|
|
1334
|
+
this._menuService.addMenuItem(Vr(this._injector), (e = (t = this._config) == null ? void 0 : t.menu) != null ? e : {}), this._menuService.addMenuItem(Fr(this._injector), (i = (n = this._config) == null ? void 0 : n.menu) != null ? i : {});
|
|
1335
|
+
}
|
|
1336
|
+
_initShortCut() {
|
|
1337
|
+
this._shortcutService.registerShortcut(Wt);
|
|
1338
|
+
}
|
|
1339
|
+
};
|
|
1340
|
+
se = zr([
|
|
1341
|
+
U(j.Ready, se),
|
|
1342
|
+
J(1, g(On)),
|
|
1343
|
+
J(2, W),
|
|
1344
|
+
J(3, g(de)),
|
|
1345
|
+
J(4, En),
|
|
1346
|
+
J(5, g(je)),
|
|
1347
|
+
J(6, g(wn))
|
|
1348
|
+
], se);
|
|
1349
|
+
var Kr = Object.defineProperty, Yr = Object.getOwnPropertyDescriptor, Gr = (t, e, n, i) => {
|
|
1350
|
+
for (var r = i > 1 ? void 0 : i ? Yr(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
1351
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
1352
|
+
return i && r && Kr(e, n, r), r;
|
|
1353
|
+
}, vt = (t, e) => (n, i) => e(n, i, t);
|
|
1354
|
+
let Ie = class extends T {
|
|
1355
|
+
constructor(t, e) {
|
|
1356
|
+
super(), this._autoFillService = t, this._hyperLinkModel = e, this._initAutoFill();
|
|
1357
|
+
}
|
|
1358
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1359
|
+
_initAutoFill() {
|
|
1360
|
+
const t = () => ({ redos: [], undos: [] }), e = (i, r) => {
|
|
1361
|
+
const { source: s, target: o, unitId: c, subUnitId: a } = i, p = Ye([s, o]), [h, v] = p.ranges, { mapFunc: l } = p, f = {
|
|
1362
|
+
row: h.startRow,
|
|
1363
|
+
col: h.startColumn
|
|
1364
|
+
}, L = _n(h, v), y = [], S = [];
|
|
1365
|
+
return L.forEach((I) => {
|
|
1366
|
+
const _ = I.repeatStartCell, Y = I.relativeRange, N = {
|
|
1367
|
+
startRow: f.row,
|
|
1368
|
+
startColumn: f.col,
|
|
1369
|
+
endColumn: f.col,
|
|
1370
|
+
endRow: f.row
|
|
1371
|
+
}, R = {
|
|
1372
|
+
startRow: _.row,
|
|
1373
|
+
startColumn: _.col,
|
|
1374
|
+
endColumn: _.col,
|
|
1375
|
+
endRow: _.row
|
|
1376
|
+
};
|
|
1377
|
+
Xe.foreach(Y, (G, V) => {
|
|
1378
|
+
const Q = oe.getPositionRange(
|
|
1379
|
+
{
|
|
1380
|
+
startRow: G,
|
|
1381
|
+
startColumn: V,
|
|
1382
|
+
endColumn: V,
|
|
1383
|
+
endRow: G
|
|
1384
|
+
},
|
|
1385
|
+
N
|
|
1386
|
+
), { row: ue, col: Ne } = l(Q.startRow, Q.startColumn), ee = this._hyperLinkModel.getHyperLinkByLocation(c, a, ue, Ne);
|
|
1387
|
+
if (ee) {
|
|
1388
|
+
const u = oe.getPositionRange(
|
|
1389
|
+
{
|
|
1390
|
+
startRow: G,
|
|
1391
|
+
startColumn: V,
|
|
1392
|
+
endColumn: V,
|
|
1393
|
+
endRow: G
|
|
1394
|
+
},
|
|
1395
|
+
R
|
|
1396
|
+
), { row: m, col: C } = l(u.startRow, u.startColumn), k = ae.generateRandomId(), D = this._hyperLinkModel.getHyperLinkByLocation(c, a, m, C);
|
|
1397
|
+
D && y.push({
|
|
1398
|
+
id: M.id,
|
|
1399
|
+
params: {
|
|
1400
|
+
unitId: c,
|
|
1401
|
+
subUnitId: a,
|
|
1402
|
+
id: D.id
|
|
1403
|
+
}
|
|
1404
|
+
}), he.COPY === r && (y.push({
|
|
1405
|
+
id: x.id,
|
|
1406
|
+
params: {
|
|
1407
|
+
unitId: c,
|
|
1408
|
+
subUnitId: a,
|
|
1409
|
+
link: {
|
|
1410
|
+
...ee,
|
|
1411
|
+
id: k,
|
|
1412
|
+
row: m,
|
|
1413
|
+
column: C
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
}), S.push({
|
|
1417
|
+
id: M.id,
|
|
1418
|
+
params: {
|
|
1419
|
+
unitId: c,
|
|
1420
|
+
subUnitId: a,
|
|
1421
|
+
id: k
|
|
1422
|
+
}
|
|
1423
|
+
})), D && S.push({
|
|
1424
|
+
id: x.id,
|
|
1425
|
+
params: {
|
|
1426
|
+
unitId: c,
|
|
1427
|
+
subUnitId: a,
|
|
1428
|
+
link: D
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
});
|
|
1433
|
+
}), {
|
|
1434
|
+
undos: S,
|
|
1435
|
+
redos: y
|
|
1436
|
+
};
|
|
1437
|
+
}, n = {
|
|
1438
|
+
id: it,
|
|
1439
|
+
onFillData: (i, r, s) => s === he.COPY || s === he.ONLY_FORMAT || s === he.SERIES ? e(i, s) : t()
|
|
1440
|
+
};
|
|
1441
|
+
this.disposeWithMe(this._autoFillService.addHook(n));
|
|
1442
|
+
}
|
|
1443
|
+
};
|
|
1444
|
+
Ie = Gr([
|
|
1445
|
+
U(j.Ready, Ie),
|
|
1446
|
+
vt(0, vn),
|
|
1447
|
+
vt(1, g(H))
|
|
1448
|
+
], Ie);
|
|
1449
|
+
var Xr = Object.defineProperty, qr = Object.getOwnPropertyDescriptor, Jr = (t, e, n, i) => {
|
|
1450
|
+
for (var r = i > 1 ? void 0 : i ? qr(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
1451
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
1452
|
+
return i && r && Xr(e, n, r), r;
|
|
1453
|
+
}, me = (t, e) => (n, i) => e(n, i, t);
|
|
1454
|
+
let ke = class extends T {
|
|
1455
|
+
constructor(e, n, i, r) {
|
|
1456
|
+
super();
|
|
1457
|
+
O(this, "_copyInfo");
|
|
1458
|
+
this._sheetClipboardService = e, this._hyperLinkModel = n, this._injector = i, this._resolverService = r, this._initCopyPaste();
|
|
1459
|
+
}
|
|
1460
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1461
|
+
_initCopyPaste() {
|
|
1462
|
+
this._sheetClipboardService.addClipboardHook({
|
|
1463
|
+
id: it,
|
|
1464
|
+
onBeforeCopy: (e, n, i) => this._collect(e, n, i),
|
|
1465
|
+
onPasteCells: (e, n, i, r) => {
|
|
1466
|
+
const { copyType: s = pt.COPY, pasteType: o } = r, { range: c } = e || {}, { range: a, unitId: p, subUnitId: h } = n;
|
|
1467
|
+
return this._generateMutations(a, { copyType: s, pasteType: o, copyRange: c, unitId: p, subUnitId: h });
|
|
1468
|
+
},
|
|
1469
|
+
onPastePlainText: (e, n) => {
|
|
1470
|
+
if (le(n)) {
|
|
1471
|
+
let i = Vt(n);
|
|
1472
|
+
const r = new URL(i), s = n;
|
|
1473
|
+
r.hostname === location.hostname && r.port === location.port && r.protocol === location.protocol && r.pathname === location.pathname && r.hash && (i = r.hash);
|
|
1474
|
+
const { range: o, unitId: c, subUnitId: a } = e, { ranges: [p], mapFunc: h } = Ye([o]), v = [], l = [];
|
|
1475
|
+
return Xe.foreach(p, (f, L) => {
|
|
1476
|
+
const { row: y, col: S } = h(f, L), I = this._hyperLinkModel.getHyperLinkByLocation(c, a, y, S);
|
|
1477
|
+
I && v.push({
|
|
1478
|
+
id: M.id,
|
|
1479
|
+
params: {
|
|
1480
|
+
unitId: c,
|
|
1481
|
+
subUnitId: a,
|
|
1482
|
+
id: I.id
|
|
1483
|
+
}
|
|
1484
|
+
});
|
|
1485
|
+
const _ = ae.generateRandomId();
|
|
1486
|
+
v.push({
|
|
1487
|
+
id: x.id,
|
|
1488
|
+
params: {
|
|
1489
|
+
unitId: c,
|
|
1490
|
+
subUnitId: a,
|
|
1491
|
+
link: {
|
|
1492
|
+
id: _,
|
|
1493
|
+
row: y,
|
|
1494
|
+
column: S,
|
|
1495
|
+
display: s,
|
|
1496
|
+
payload: i
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
}), l.push({
|
|
1500
|
+
id: M.id,
|
|
1501
|
+
params: {
|
|
1502
|
+
unitId: c,
|
|
1503
|
+
subUnitId: a,
|
|
1504
|
+
id: _
|
|
1505
|
+
}
|
|
1506
|
+
}), I && l.push({
|
|
1507
|
+
id: x.id,
|
|
1508
|
+
params: {
|
|
1509
|
+
unitId: c,
|
|
1510
|
+
subUnitId: a,
|
|
1511
|
+
link: I
|
|
1512
|
+
}
|
|
1513
|
+
});
|
|
1514
|
+
}), { redos: v, undos: l };
|
|
1515
|
+
}
|
|
1516
|
+
return { undos: [], redos: [] };
|
|
1517
|
+
}
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1520
|
+
_collect(e, n, i) {
|
|
1521
|
+
const r = new yt();
|
|
1522
|
+
this._copyInfo = {
|
|
1523
|
+
unitId: e,
|
|
1524
|
+
subUnitId: n,
|
|
1525
|
+
matrix: r
|
|
1526
|
+
};
|
|
1527
|
+
const s = {
|
|
1528
|
+
get: this._injector.get.bind(this._injector)
|
|
1529
|
+
}, o = yn(i, s, e, n);
|
|
1530
|
+
if (!o)
|
|
1531
|
+
return;
|
|
1532
|
+
const { rows: c, cols: a } = o;
|
|
1533
|
+
c.forEach((p, h) => {
|
|
1534
|
+
a.forEach((v, l) => {
|
|
1535
|
+
var L;
|
|
1536
|
+
const f = this._hyperLinkModel.getHyperLinkByLocation(e, n, p, v);
|
|
1537
|
+
r.setValue(h, l, (L = f == null ? void 0 : f.id) != null ? L : "");
|
|
1538
|
+
});
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1542
|
+
_generateMutations(e, n) {
|
|
1543
|
+
if (!this._copyInfo)
|
|
1544
|
+
return { redos: [], undos: [] };
|
|
1545
|
+
if (n.copyType === pt.CUT)
|
|
1546
|
+
return this._copyInfo = null, { redos: [], undos: [] };
|
|
1547
|
+
if (!this._copyInfo || !this._copyInfo.matrix.getSizeOf() || !n.copyRange)
|
|
1548
|
+
return { redos: [], undos: [] };
|
|
1549
|
+
if ([
|
|
1550
|
+
We.SPECIAL_PASTE_COL_WIDTH,
|
|
1551
|
+
We.SPECIAL_PASTE_VALUE,
|
|
1552
|
+
We.SPECIAL_PASTE_FORMAT,
|
|
1553
|
+
Dn
|
|
1554
|
+
].includes(
|
|
1555
|
+
n.pasteType
|
|
1556
|
+
))
|
|
1557
|
+
return { redos: [], undos: [] };
|
|
1558
|
+
const { unitId: i, subUnitId: r } = this._copyInfo, s = [], o = [], { ranges: [c, a], mapFunc: p } = Ye([n.copyRange, e]);
|
|
1559
|
+
return Sn(c, a, !0).forEach(({ startRange: v }) => {
|
|
1560
|
+
var l;
|
|
1561
|
+
(l = this._copyInfo) == null || l.matrix.forValue((f, L, y) => {
|
|
1562
|
+
const S = oe.getPositionRange(
|
|
1563
|
+
{
|
|
1564
|
+
startRow: f,
|
|
1565
|
+
endRow: f,
|
|
1566
|
+
startColumn: L,
|
|
1567
|
+
endColumn: L
|
|
1568
|
+
},
|
|
1569
|
+
v
|
|
1570
|
+
), I = this._hyperLinkModel.getHyperLink(i, r, y), { row: _, col: Y } = p(S.startRow, S.startColumn), N = this._hyperLinkModel.getHyperLinkByLocation(n.unitId, n.subUnitId, _, Y), R = ae.generateRandomId();
|
|
1571
|
+
N && s.push({
|
|
1572
|
+
id: M.id,
|
|
1573
|
+
params: {
|
|
1574
|
+
unitId: n.unitId,
|
|
1575
|
+
subUnitId: n.subUnitId,
|
|
1576
|
+
id: N.id
|
|
1577
|
+
}
|
|
1578
|
+
}), I && (s.push({
|
|
1579
|
+
id: x.id,
|
|
1580
|
+
params: {
|
|
1581
|
+
unitId: n.unitId,
|
|
1582
|
+
subUnitId: n.subUnitId,
|
|
1583
|
+
link: {
|
|
1584
|
+
...I,
|
|
1585
|
+
id: R,
|
|
1586
|
+
row: _,
|
|
1587
|
+
column: Y
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
}), o.push({
|
|
1591
|
+
id: M.id,
|
|
1592
|
+
params: {
|
|
1593
|
+
unitId: n.unitId,
|
|
1594
|
+
subUnitId: n.subUnitId,
|
|
1595
|
+
id: R
|
|
1596
|
+
}
|
|
1597
|
+
})), N && o.push({
|
|
1598
|
+
id: x.id,
|
|
1599
|
+
params: {
|
|
1600
|
+
unitId: n.unitId,
|
|
1601
|
+
subUnitId: n.subUnitId,
|
|
1602
|
+
link: N
|
|
1603
|
+
}
|
|
1604
|
+
});
|
|
1605
|
+
});
|
|
1606
|
+
}), {
|
|
1607
|
+
redos: s,
|
|
1608
|
+
undos: o
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
};
|
|
1612
|
+
ke = Jr([
|
|
1613
|
+
U(j.Ready, ke),
|
|
1614
|
+
me(0, Cn),
|
|
1615
|
+
me(1, g(H)),
|
|
1616
|
+
me(2, g(je)),
|
|
1617
|
+
me(3, g(B))
|
|
1618
|
+
], ke);
|
|
1619
|
+
var Qr = Object.defineProperty, ei = Object.getOwnPropertyDescriptor, ti = (t, e, n, i) => {
|
|
1620
|
+
for (var r = i > 1 ? void 0 : i ? ei(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
1621
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
1622
|
+
return i && r && Qr(e, n, r), r;
|
|
1623
|
+
}, ni = (t, e) => (n, i) => e(n, i, t);
|
|
1624
|
+
let be = class extends T {
|
|
1625
|
+
constructor(t) {
|
|
1626
|
+
super(), this._resolverService = t, this._handleInitUrl();
|
|
1627
|
+
}
|
|
1628
|
+
_handleInitUrl() {
|
|
1629
|
+
const t = location.hash;
|
|
1630
|
+
t && this._resolverService.parseHyperLink(t).handler();
|
|
1631
|
+
}
|
|
1632
|
+
};
|
|
1633
|
+
be = ti([
|
|
1634
|
+
U(j.Rendered, be),
|
|
1635
|
+
ni(0, g(B))
|
|
1636
|
+
], be);
|
|
1637
|
+
var ri = Object.defineProperty, ii = Object.getOwnPropertyDescriptor, si = (t, e, n, i) => {
|
|
1638
|
+
for (var r = i > 1 ? void 0 : i ? ii(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
1639
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
1640
|
+
return i && r && ri(e, n, r), r;
|
|
1641
|
+
}, Ke = (t, e) => (n, i) => e(n, i, t);
|
|
1642
|
+
let Re = class extends T {
|
|
1643
|
+
constructor(t, e, n) {
|
|
1644
|
+
super(), this._localeService = t, this._commandService = e, this._sheetPermissionInterceptorBaseController = n, this._commandExecutedListener();
|
|
1645
|
+
}
|
|
1646
|
+
_commandExecutedListener() {
|
|
1647
|
+
this.disposeWithMe(
|
|
1648
|
+
this._commandService.beforeCommandExecuted((t) => {
|
|
1649
|
+
t.id === Wt.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
1650
|
+
workbookTypes: [Je],
|
|
1651
|
+
rangeTypes: [nt],
|
|
1652
|
+
worksheetTypes: [Qe, et, tt]
|
|
1653
|
+
}) || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")));
|
|
1654
|
+
})
|
|
1655
|
+
);
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
Re = si([
|
|
1659
|
+
U(j.Rendered, Re),
|
|
1660
|
+
Ke(0, g(de)),
|
|
1661
|
+
Ke(1, W),
|
|
1662
|
+
Ke(2, g(Ln))
|
|
1663
|
+
], Re);
|
|
1664
|
+
var oi = Object.defineProperty, ai = Object.getOwnPropertyDescriptor, ci = (t, e, n, i) => {
|
|
1665
|
+
for (var r = i > 1 ? void 0 : i ? ai(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
1666
|
+
(o = t[s]) && (r = (i ? o(e, n, r) : o(r)) || r);
|
|
1667
|
+
return i && r && oi(e, n, r), r;
|
|
1668
|
+
}, li = (t, e) => (n, i) => e(n, i, t), fe;
|
|
1669
|
+
let _t = (fe = class extends un {
|
|
1670
|
+
constructor(t, e) {
|
|
1671
|
+
super(t, e), this._config = t, this._injector = e;
|
|
1672
|
+
}
|
|
1673
|
+
onStarting(t) {
|
|
1674
|
+
super.onStarting(t), [
|
|
1675
|
+
[B],
|
|
1676
|
+
[$],
|
|
1677
|
+
[_e],
|
|
1678
|
+
[ye],
|
|
1679
|
+
[Se],
|
|
1680
|
+
[Ce],
|
|
1681
|
+
[Le],
|
|
1682
|
+
[
|
|
1683
|
+
se,
|
|
1684
|
+
{
|
|
1685
|
+
useFactory: () => this._injector.createInstance(se, this._config)
|
|
1686
|
+
}
|
|
1687
|
+
],
|
|
1688
|
+
[Ie],
|
|
1689
|
+
[ke],
|
|
1690
|
+
[Re],
|
|
1691
|
+
[be]
|
|
1692
|
+
].forEach((n) => {
|
|
1693
|
+
t.add(n);
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
}, O(fe, "pluginName", it), O(fe, "type", E.UNIVER_SHEET), fe);
|
|
1697
|
+
_t = ci([
|
|
1698
|
+
li(1, g(je))
|
|
1699
|
+
], _t);
|
|
1700
|
+
export {
|
|
1701
|
+
xe as CloseHyperLinkSidebarOperation,
|
|
1702
|
+
$e as InsertHyperLinkOperation,
|
|
1703
|
+
Wt as InsertLinkShortcut,
|
|
1704
|
+
st as OpenHyperLinkSidebarOperation,
|
|
1705
|
+
Ce as SheetHyperLinkSetRangeController,
|
|
1706
|
+
be as SheetHyperLinkUrlController,
|
|
1707
|
+
Ie as SheetsHyperLinkAutoFillController,
|
|
1708
|
+
ke as SheetsHyperLinkCopyPasteController,
|
|
1709
|
+
Le as SheetsHyperLinkPopupController,
|
|
1710
|
+
$ as SheetsHyperLinkPopupService,
|
|
1711
|
+
ye as SheetsHyperLinkRefRangeController,
|
|
1712
|
+
_e as SheetsHyperLinkRemoveSheetController,
|
|
1713
|
+
Se as SheetsHyperLinkRenderController,
|
|
1714
|
+
B as SheetsHyperLinkResolverService,
|
|
1715
|
+
se as SheetsHyperLinkUIController,
|
|
1716
|
+
_t as UniverSheetsHyperLinkUIPlugin
|
|
1717
|
+
};
|