@univerjs/sheets-hyper-link-ui 0.4.2 → 0.5.0-nightly.202411091605
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/facade.js +1 -0
- package/lib/cjs/index.js +2 -2
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/facade.js +1 -0
- package/lib/es/index.js +1343 -2023
- package/lib/es/locale/en-US.js +38 -0
- package/lib/es/locale/fa-IR.js +38 -0
- package/lib/es/locale/ru-RU.js +38 -0
- package/lib/es/locale/vi-VN.js +38 -0
- package/lib/es/locale/zh-CN.js +38 -0
- package/lib/es/locale/zh-TW.js +38 -0
- package/lib/index.css +1 -1
- package/lib/types/controllers/url.controller.d.ts +3 -1
- package/lib/types/facade/f-workbook.d.ts +13 -0
- package/lib/types/{types/interfaces/i-sheet-url-params.d.ts → facade/index.d.ts} +0 -6
- package/lib/types/index.d.ts +0 -4
- package/lib/types/services/popup.service.d.ts +5 -5
- package/lib/types/services/resolver.service.d.ts +5 -9
- package/lib/types/views/CellLinkPopup/index.d.ts +14 -0
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +44 -25
- package/LICENSE +0 -176
- package/lib/locale/en-US.json +0 -35
- package/lib/locale/fa-IR.json +0 -35
- package/lib/locale/ru-RU.json +0 -35
- package/lib/locale/vi-VN.json +0 -35
- package/lib/locale/zh-CN.json +0 -35
- package/lib/locale/zh-TW.json +0 -35
- package/lib/types/commands/commands/add-hyper-link.command.d.ts +0 -19
- package/lib/types/commands/commands/remove-hyper-link.command.d.ts +0 -19
- package/lib/types/commands/commands/update-hyper-link.command.d.ts +0 -17
- package/lib/types/controllers/remove-sheet.controller.d.ts +0 -10
- package/lib/types/controllers/rich-text-ref-range.controller.d.ts +0 -15
- package/lib/types/controllers/set-range.controller.d.ts +0 -18
- package/lib/types/types/interfaces/i-sheet-hyper-link-info.d.ts +0 -10
- package/lib/types/types/interfaces/index.d.ts +0 -17
package/lib/es/index.js
CHANGED
|
@@ -1,396 +1,313 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return Tools.isLegalUrl(link);
|
|
1
|
+
var er = Object.defineProperty;
|
|
2
|
+
var tr = (t, e, n) => e in t ? er(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var V = (t, e, n) => tr(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { Tools as Ce, Inject as R, LocaleService as it, UniverInstanceType as O, isValidRange as _n, IUniverInstanceService as K, ICommandService as re, IConfigService as Sn, RANGE_TYPE as nn, Rectangle as Ie, Injector as st, Disposable as z, Range as Cn, ObjectMatrix as nr, useDependency as E, IContextService as In, ThemeService as rr, DataStreamTreeTokenType as rn, CustomRangeType as Me, BuildTextUtils as de, ColorKit as ir, DOCS_ZEN_EDITOR_UNIT_ID_KEY as x, DisposableCollection as sr, FOCUSING_SHEET as _t, generateRandomId as or, DataValidationType as St, CommandType as ot, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as yt, FOCUSING_FX_BAR_EDITOR as ar, IPermissionService as cr, InterceptorEffectEnum as lr, DependentOn as ur, Plugin as dr } from "@univerjs/core";
|
|
5
|
+
import { SheetHyperLinkType as S, ERROR_RANGE as pr, HyperLinkModel as at, RemoveHyperLinkMutation as xe, AddHyperLinkMutation as Ne, SheetsHyperLinkParserService as wt, UpdateRichHyperLinkCommand as hr, UpdateHyperLinkCommand as gr, AddRichHyperLinkCommand as mr, AddHyperLinkCommand as fr, CancelRichHyperLinkCommand as vr, CancelHyperLinkCommand as _r, UniverSheetsHyperLinkPlugin as Sr } from "@univerjs/sheets-hyper-link";
|
|
6
|
+
import { ScrollToRangeOperation as yn, COPY_TYPE as Cr, virtualizeDiscreteRanges as Et, rangeToDiscreteRange as Ir, PREDEFINED_HOOK_NAME as De, getRepeatRange as yr, ISheetClipboardService as Er, IEditorBridgeService as ne, IMarkSelectionService as Rr, SheetCanvasPopManagerService as Pr, getEditingCustomRangePosition as Lr, getCustomRangePosition as br, whenSheetEditorFocused as wr, getCurrentRangeDisable$ as Or, IAutoFillService as kr, APPLY_TYPE as we, getAutoFillRepeatRange as Tr, SheetPermissionInterceptorBaseController as En, HoverManagerService as xr, HoverRenderController as Nr, SheetSkeletonManagerService as sn } from "@univerjs/sheets-ui";
|
|
7
|
+
import { MessageType as ke, FormLayout as _e, Input as on, Select as Ct, Button as an, Tooltip as $e } from "@univerjs/design";
|
|
8
|
+
import { deserializeRangeWithSheet as Ve, IDefinedNamesService as Rn, serializeRangeWithSheet as Mr, serializeRangeToRefString as Ur, serializeRange as Hr } from "@univerjs/engine-formula";
|
|
9
|
+
import { SetSelectionsOperation as Pn, SetWorksheetActiveOperation as Ln, SheetsSelectionsService as Ot, getSheetCommandTarget as bn, WorkbookEditablePermission as kt, WorksheetEditPermission as Tt, WorksheetSetCellValuePermission as wn, WorksheetInsertHyperlinkPermission as xt, RangeProtectionPermissionEditPoint as Nt, WorkbookViewPermission as Dr, WorksheetViewPermission as $r, RangeProtectionPermissionViewPoint as jr, WorkbookCopyPermission as Vr, WorksheetCopyPermission as Br, ClearSelectionContentCommand as Ar, ClearSelectionAllCommand as Fr, ClearSelectionFormatCommand as Wr, SheetInterceptorService as Zr, INTERCEPTOR_POINT as Gr } from "@univerjs/sheets";
|
|
10
|
+
import { IMessageService as On, useObservable as Kr, IZenZoneService as ct, useEvent as zr, KeyCode as Rt, MenuItemType as kn, MenuPosition as Tn, MenuGroup as Yr, MetaKeys as Xr, getMenuHiddenObservable as lt, RibbonStartGroup as qr, ContextMenuPosition as Jr, ContextMenuGroup as Qr, ComponentManager as ei, IShortcutService as ti, IMenuManagerService as ni } from "@univerjs/ui";
|
|
11
|
+
import { DocSelectionRenderService as xn, DocBackScrollRenderController as ri, DocCanvasPopManagerService as ii, DocEventManagerService as cn, UniverDocsUIPlugin as si } from "@univerjs/docs-ui";
|
|
12
|
+
import { IRenderManagerService as ut } from "@univerjs/engine-render";
|
|
13
|
+
import { Subject as oi, BehaviorSubject as ai, of as Te, map as le, filter as ln, switchMap as ue, combineLatest as ci, distinctUntilChanged as li, debounceTime as Be, Observable as ui } from "rxjs";
|
|
14
|
+
import { DocSelectionManagerService as Ue } from "@univerjs/docs";
|
|
15
|
+
import di, { useState as X, useMemo as un, useRef as Pt, useCallback as pi, useEffect as te, forwardRef as ge, createElement as me } from "react";
|
|
16
|
+
import { RangeSelector as hi } from "@univerjs/sheets-formula-ui";
|
|
17
|
+
function Fe(t) {
|
|
18
|
+
return Ce.isLegalUrl(t);
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return /^[a-zA-Z]+:\/\//.test(urlString);
|
|
20
|
+
function gi(t) {
|
|
21
|
+
return /^[a-zA-Z]+:\/\//.test(t);
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(url);
|
|
23
|
+
function mi(t) {
|
|
24
|
+
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(t);
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
let url;
|
|
26
|
+
function fi(t) {
|
|
27
|
+
if (Fe(t)) {
|
|
28
|
+
const e = gi(t) ? t : mi(t) ? `mailto://${t}` : `http://${t}`;
|
|
29
|
+
let n;
|
|
34
30
|
try {
|
|
35
|
-
|
|
31
|
+
n = new URL(e);
|
|
36
32
|
} catch {
|
|
37
|
-
return
|
|
33
|
+
return t;
|
|
38
34
|
}
|
|
39
|
-
return
|
|
35
|
+
return n.hostname === location.hostname && n.port === location.port && n.protocol === location.protocol && n.pathname === location.pathname && n.hash && !n.search ? n.hash : e;
|
|
40
36
|
}
|
|
41
|
-
return
|
|
37
|
+
return t;
|
|
42
38
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}), Rectangle.realUnion(range, ...relativeCells);
|
|
39
|
+
const Nn = "sheets-hyper-link-ui.config", vi = {};
|
|
40
|
+
var _i = Object.defineProperty, Si = Object.getOwnPropertyDescriptor, Ci = (t, e, n, r) => {
|
|
41
|
+
for (var i = r > 1 ? void 0 : r ? Si(e, n) : e, o = t.length - 1, s; o >= 0; o--)
|
|
42
|
+
(s = t[o]) && (i = (r ? s(e, n, i) : s(i)) || i);
|
|
43
|
+
return r && i && _i(e, n, i), i;
|
|
44
|
+
}, Se = (t, e) => (n, r) => e(n, r, t);
|
|
45
|
+
function Ii(t, e) {
|
|
46
|
+
const n = e.getMergeData(), r = e.getMaxColumns() - 1, i = e.getMaxRows() - 1;
|
|
47
|
+
if (r < t.endColumn && (t.endColumn = r), i < t.endRow && (t.endRow = i), t.rangeType === nn.COLUMN || nn.ROW)
|
|
48
|
+
return t;
|
|
49
|
+
const o = [];
|
|
50
|
+
return n.forEach((s) => {
|
|
51
|
+
Ie.intersects(t, s) && o.push(s);
|
|
52
|
+
}), Ie.realUnion(t, ...o);
|
|
58
53
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
};
|
|
71
|
-
if (!workbook)
|
|
72
|
-
return invalidLink;
|
|
73
|
-
const sheet = gid ? workbook.getSheetBySheetId(gid) : workbook.getActiveSheet(), sheetName = (_a15 = sheet == null ? void 0 : sheet.getName()) != null ? _a15 : "";
|
|
74
|
-
if (range) {
|
|
75
|
-
if (!sheet) return invalidLink;
|
|
76
|
-
const rangeObj = deserializeRangeWithSheet(range).range;
|
|
77
|
-
return isValidRange(rangeObj, sheet) && range !== ERROR_RANGE ? {
|
|
78
|
-
type: SheetHyperLinkType.RANGE,
|
|
79
|
-
name: serializeRangeWithSheet(sheetName, rangeObj)
|
|
80
|
-
} : invalidLink;
|
|
81
|
-
}
|
|
82
|
-
if (rangeid) {
|
|
83
|
-
const range2 = this._definedNamesService.getValueById(workbook.getUnitId(), rangeid);
|
|
84
|
-
return range2 ? {
|
|
85
|
-
type: SheetHyperLinkType.DEFINE_NAME,
|
|
86
|
-
name: range2.formulaOrRefString
|
|
87
|
-
} : invalidLink;
|
|
54
|
+
let he = class {
|
|
55
|
+
constructor(t, e, n, r, i, o) {
|
|
56
|
+
this._univerInstanceService = t, this._commandService = e, this._definedNamesService = n, this._messageService = r, this._localeService = i, this._configService = o;
|
|
57
|
+
}
|
|
58
|
+
navigate(t) {
|
|
59
|
+
switch (t.type) {
|
|
60
|
+
case S.URL:
|
|
61
|
+
this.navigateToOtherWebsite(t.url);
|
|
62
|
+
break;
|
|
63
|
+
default:
|
|
64
|
+
this._navigateToUniver(t.searchObj);
|
|
88
65
|
}
|
|
89
|
-
if (gid) {
|
|
90
|
-
const worksheet = workbook.getSheetBySheetId(gid);
|
|
91
|
-
return worksheet ? {
|
|
92
|
-
type: SheetHyperLinkType.SHEET,
|
|
93
|
-
name: worksheet.getName()
|
|
94
|
-
} : invalidLink;
|
|
95
|
-
}
|
|
96
|
-
return invalidLink;
|
|
97
66
|
}
|
|
98
|
-
|
|
99
|
-
const { gid, range, rangeid } =
|
|
100
|
-
if (!
|
|
67
|
+
_navigateToUniver(t) {
|
|
68
|
+
const { gid: e, range: n, rangeid: r } = t, i = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET);
|
|
69
|
+
if (!i)
|
|
101
70
|
return;
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
const
|
|
105
|
-
if (!
|
|
71
|
+
const o = i.getUnitId();
|
|
72
|
+
if (r) {
|
|
73
|
+
const s = this._definedNamesService.getValueById(o, r);
|
|
74
|
+
if (!s)
|
|
106
75
|
return;
|
|
107
|
-
const { formulaOrRefString } =
|
|
108
|
-
if (!
|
|
76
|
+
const { formulaOrRefString: c } = s, u = this._definedNamesService.getWorksheetByRef(o, c);
|
|
77
|
+
if (!u) {
|
|
109
78
|
this._messageService.show({
|
|
110
79
|
content: this._localeService.t("hyperLink.message.refError"),
|
|
111
|
-
type:
|
|
80
|
+
type: ke.Error
|
|
112
81
|
});
|
|
113
82
|
return;
|
|
114
83
|
}
|
|
115
|
-
if (
|
|
84
|
+
if (u.isSheetHidden()) {
|
|
116
85
|
this._messageService.show({
|
|
117
86
|
content: this._localeService.t("hyperLink.message.hiddenSheet"),
|
|
118
|
-
type:
|
|
87
|
+
type: ke.Error
|
|
119
88
|
});
|
|
120
89
|
return;
|
|
121
90
|
}
|
|
122
|
-
this.navigateToDefineName(
|
|
91
|
+
this.navigateToDefineName(o, r);
|
|
123
92
|
}
|
|
124
|
-
if (
|
|
125
|
-
if (
|
|
126
|
-
const
|
|
127
|
-
|
|
93
|
+
if (e) {
|
|
94
|
+
if (n) {
|
|
95
|
+
const s = Ve(n);
|
|
96
|
+
_n(s.range) && n !== pr && this.navigateToRange(o, e, s.range);
|
|
128
97
|
return;
|
|
129
98
|
}
|
|
130
|
-
this.navigateToSheetById(
|
|
99
|
+
this.navigateToSheetById(o, e);
|
|
131
100
|
}
|
|
132
101
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
var _a15, _b, _c, _d;
|
|
138
|
-
if (urlStr.startsWith("#")) {
|
|
139
|
-
const search = new URLSearchParams(urlStr.slice(1)), searchObj = {
|
|
140
|
-
gid: (_a15 = search.get("gid")) != null ? _a15 : "",
|
|
141
|
-
range: (_b = search.get("range")) != null ? _b : "",
|
|
142
|
-
rangeid: (_c = search.get("rangeid")) != null ? _c : "",
|
|
143
|
-
unitid: (_d = search.get("unitid")) != null ? _d : ""
|
|
144
|
-
}, urlInfo = this._getURLName(searchObj);
|
|
145
|
-
return {
|
|
146
|
-
type: urlInfo.type,
|
|
147
|
-
name: urlInfo.name,
|
|
148
|
-
url: urlStr,
|
|
149
|
-
searchObj,
|
|
150
|
-
handler: /* @__PURE__ */ __name(() => {
|
|
151
|
-
this.navigateTo(searchObj);
|
|
152
|
-
}, "handler")
|
|
153
|
-
};
|
|
154
|
-
} else
|
|
155
|
-
return {
|
|
156
|
-
type: SheetHyperLinkType.URL,
|
|
157
|
-
name: urlStr,
|
|
158
|
-
url: urlStr,
|
|
159
|
-
handler: /* @__PURE__ */ __name(() => {
|
|
160
|
-
this.navigateToOtherWebsite(urlStr);
|
|
161
|
-
}, "handler"),
|
|
162
|
-
searchObj: null
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
async navigateToRange(unitId, subUnitId, range) {
|
|
166
|
-
const worksheet = await this.navigateToSheetById(unitId, subUnitId);
|
|
167
|
-
if (worksheet) {
|
|
168
|
-
const realRange = getContainRange(range, worksheet);
|
|
102
|
+
async navigateToRange(t, e, n, r) {
|
|
103
|
+
const i = await this.navigateToSheetById(t, e);
|
|
104
|
+
if (i) {
|
|
105
|
+
const o = Ii(n, i);
|
|
169
106
|
await this._commandService.executeCommand(
|
|
170
|
-
|
|
107
|
+
Pn.id,
|
|
171
108
|
{
|
|
172
|
-
unitId,
|
|
173
|
-
subUnitId,
|
|
109
|
+
unitId: t,
|
|
110
|
+
subUnitId: e,
|
|
174
111
|
selections: [{
|
|
175
|
-
range:
|
|
112
|
+
range: o
|
|
176
113
|
}]
|
|
177
114
|
}
|
|
178
|
-
), await this._commandService.executeCommand(
|
|
179
|
-
range:
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
async navigateToSheet(unitId, sheetName) {
|
|
184
|
-
const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
185
|
-
if (!workbook)
|
|
186
|
-
return !1;
|
|
187
|
-
const worksheet = workbook.getActiveSheet();
|
|
188
|
-
if ((worksheet == null ? void 0 : worksheet.getName()) === sheetName)
|
|
189
|
-
return !0;
|
|
190
|
-
const targetSheet = workbook.getSheetBySheetName(sheetName);
|
|
191
|
-
if (!targetSheet) {
|
|
192
|
-
this._messageService.show({
|
|
193
|
-
content: this._localeService.t("hyperLink.message.noSheet"),
|
|
194
|
-
type: MessageType.Error
|
|
115
|
+
), await this._commandService.executeCommand(yn.id, {
|
|
116
|
+
range: o,
|
|
117
|
+
forceTop: r
|
|
195
118
|
});
|
|
196
|
-
return;
|
|
197
119
|
}
|
|
198
|
-
const sheetId = targetSheet.getSheetId();
|
|
199
|
-
return workbook.getHiddenWorksheets().indexOf(sheetId) > -1 && this._messageService.show({
|
|
200
|
-
content: this._localeService.t("hyperLink.message.hiddenSheet"),
|
|
201
|
-
type: MessageType.Error
|
|
202
|
-
}), await this._commandService.executeCommand(SetWorksheetActiveOperation.id, { unitId, subUnitId: sheetId });
|
|
203
120
|
}
|
|
204
|
-
async navigateToSheetById(
|
|
205
|
-
const
|
|
206
|
-
if (!
|
|
121
|
+
async navigateToSheetById(t, e) {
|
|
122
|
+
const n = this._univerInstanceService.getUnit(t, O.UNIVER_SHEET);
|
|
123
|
+
if (!n)
|
|
207
124
|
return !1;
|
|
208
|
-
const
|
|
209
|
-
if (!
|
|
125
|
+
const r = n.getActiveSheet();
|
|
126
|
+
if (!r)
|
|
210
127
|
return !1;
|
|
211
|
-
if (
|
|
212
|
-
return
|
|
213
|
-
const
|
|
214
|
-
return
|
|
128
|
+
if (r.getSheetId() === e)
|
|
129
|
+
return r;
|
|
130
|
+
const i = n.getSheetBySheetId(e);
|
|
131
|
+
return i ? n.getHiddenWorksheets().indexOf(e) > -1 ? (this._messageService.show({
|
|
215
132
|
content: this._localeService.t("hyperLink.message.hiddenSheet"),
|
|
216
|
-
type:
|
|
217
|
-
}), !1) : await this._commandService.executeCommand(
|
|
133
|
+
type: ke.Error
|
|
134
|
+
}), !1) : await this._commandService.executeCommand(Ln.id, { unitId: t, subUnitId: e }) ? i : !1 : (this._messageService.show({
|
|
218
135
|
content: this._localeService.t("hyperLink.message.noSheet"),
|
|
219
|
-
type:
|
|
136
|
+
type: ke.Error
|
|
220
137
|
}), !1);
|
|
221
138
|
}
|
|
222
|
-
async navigateToDefineName(
|
|
223
|
-
return this._definedNamesService.focusRange(
|
|
224
|
-
}
|
|
225
|
-
async navigateToOtherWebsite(
|
|
226
|
-
var
|
|
227
|
-
const
|
|
228
|
-
if ((
|
|
229
|
-
return
|
|
230
|
-
window.open(
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
],
|
|
241
|
-
const
|
|
242
|
-
var
|
|
243
|
-
for (var
|
|
244
|
-
(
|
|
245
|
-
return
|
|
246
|
-
},
|
|
247
|
-
let
|
|
248
|
-
constructor(
|
|
139
|
+
async navigateToDefineName(t, e) {
|
|
140
|
+
return this._definedNamesService.focusRange(t, e), !0;
|
|
141
|
+
}
|
|
142
|
+
async navigateToOtherWebsite(t) {
|
|
143
|
+
var n;
|
|
144
|
+
const e = this._configService.getConfig(Nn);
|
|
145
|
+
if ((n = e == null ? void 0 : e.urlHandler) != null && n.navigateToOtherWebsite)
|
|
146
|
+
return e.urlHandler.navigateToOtherWebsite(t);
|
|
147
|
+
window.open(t, "_blank", "noopener noreferrer");
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
he = Ci([
|
|
151
|
+
Se(0, K),
|
|
152
|
+
Se(1, re),
|
|
153
|
+
Se(2, Rn),
|
|
154
|
+
Se(3, On),
|
|
155
|
+
Se(4, R(it)),
|
|
156
|
+
Se(5, Sn)
|
|
157
|
+
], he);
|
|
158
|
+
const Mt = "SHEET_HYPER_LINK_UI_PLUGIN";
|
|
159
|
+
var yi = Object.defineProperty, Ei = Object.getOwnPropertyDescriptor, Ri = (t, e, n, r) => {
|
|
160
|
+
for (var i = r > 1 ? void 0 : r ? Ei(e, n) : e, o = t.length - 1, s; o >= 0; o--)
|
|
161
|
+
(s = t[o]) && (i = (r ? s(e, n, i) : s(i)) || i);
|
|
162
|
+
return r && i && yi(e, n, i), i;
|
|
163
|
+
}, je = (t, e) => (n, r) => e(n, r, t);
|
|
164
|
+
let We = class extends z {
|
|
165
|
+
constructor(e, n, r, i) {
|
|
249
166
|
super();
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
this._sheetClipboardService =
|
|
167
|
+
V(this, "_plainTextFilter", /* @__PURE__ */ new Set());
|
|
168
|
+
V(this, "_copyInfo");
|
|
169
|
+
this._sheetClipboardService = e, this._hyperLinkModel = n, this._injector = r, this._resolverService = i, this._initCopyPaste(), this.disposeWithMe(() => {
|
|
253
170
|
this._plainTextFilter.clear();
|
|
254
171
|
});
|
|
255
172
|
}
|
|
256
|
-
registerPlainTextFilter(
|
|
257
|
-
this._plainTextFilter.add(
|
|
173
|
+
registerPlainTextFilter(e) {
|
|
174
|
+
this._plainTextFilter.add(e);
|
|
258
175
|
}
|
|
259
|
-
removePlainTextFilter(
|
|
260
|
-
this._plainTextFilter.delete(
|
|
176
|
+
removePlainTextFilter(e) {
|
|
177
|
+
this._plainTextFilter.delete(e);
|
|
261
178
|
}
|
|
262
179
|
/* If return false the process of paste text will be stop */
|
|
263
|
-
_filterPlainText(
|
|
264
|
-
return Array.from(this._plainTextFilter).every((
|
|
180
|
+
_filterPlainText(e) {
|
|
181
|
+
return Array.from(this._plainTextFilter).every((n) => n(e));
|
|
265
182
|
}
|
|
266
183
|
_initCopyPaste() {
|
|
267
184
|
this._sheetClipboardService.addClipboardHook({
|
|
268
|
-
id:
|
|
269
|
-
onBeforeCopy:
|
|
270
|
-
onPasteCells:
|
|
271
|
-
const { copyType =
|
|
272
|
-
return this._generateMutations(
|
|
273
|
-
},
|
|
274
|
-
onPastePlainText:
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
277
|
-
const { range, unitId, subUnitId } =
|
|
278
|
-
return
|
|
279
|
-
const { row, col:
|
|
280
|
-
|
|
281
|
-
id:
|
|
185
|
+
id: Mt,
|
|
186
|
+
onBeforeCopy: (e, n, r) => this._collect(e, n, r),
|
|
187
|
+
onPasteCells: (e, n, r, i) => {
|
|
188
|
+
const { copyType: o = Cr.COPY, pasteType: s } = i, { range: c } = e || {}, { range: u, unitId: d, subUnitId: l } = n;
|
|
189
|
+
return this._generateMutations(u, { copyType: o, pasteType: s, copyRange: c, unitId: d, subUnitId: l });
|
|
190
|
+
},
|
|
191
|
+
onPastePlainText: (e, n) => {
|
|
192
|
+
const r = this._filterPlainText(n);
|
|
193
|
+
if (Fe(n) && r) {
|
|
194
|
+
const { range: i, unitId: o, subUnitId: s } = e, { ranges: [c], mapFunc: u } = Et([i]), d = [], l = [];
|
|
195
|
+
return Cn.foreach(c, (g, p) => {
|
|
196
|
+
const { row: v, col: C } = u(g, p), _ = this._hyperLinkModel.getHyperLinkByLocation(o, s, v, C);
|
|
197
|
+
_ && d.push({
|
|
198
|
+
id: xe.id,
|
|
282
199
|
params: {
|
|
283
|
-
unitId,
|
|
284
|
-
subUnitId,
|
|
285
|
-
id:
|
|
200
|
+
unitId: o,
|
|
201
|
+
subUnitId: s,
|
|
202
|
+
id: _.id
|
|
286
203
|
}
|
|
287
|
-
}),
|
|
288
|
-
id:
|
|
204
|
+
}), _ && l.push({
|
|
205
|
+
id: Ne.id,
|
|
289
206
|
params: {
|
|
290
|
-
unitId,
|
|
291
|
-
subUnitId,
|
|
292
|
-
link
|
|
207
|
+
unitId: o,
|
|
208
|
+
subUnitId: s,
|
|
209
|
+
link: _
|
|
293
210
|
}
|
|
294
211
|
});
|
|
295
|
-
}), { redos, undos };
|
|
212
|
+
}), { redos: d, undos: l };
|
|
296
213
|
}
|
|
297
214
|
return { undos: [], redos: [] };
|
|
298
|
-
},
|
|
215
|
+
},
|
|
299
216
|
priority: 99
|
|
300
217
|
});
|
|
301
218
|
}
|
|
302
|
-
_collect(
|
|
303
|
-
const
|
|
219
|
+
_collect(e, n, r) {
|
|
220
|
+
const i = new nr();
|
|
304
221
|
this._copyInfo = {
|
|
305
|
-
unitId,
|
|
306
|
-
subUnitId,
|
|
307
|
-
matrix
|
|
222
|
+
unitId: e,
|
|
223
|
+
subUnitId: n,
|
|
224
|
+
matrix: i
|
|
308
225
|
};
|
|
309
|
-
const
|
|
310
|
-
if (!
|
|
226
|
+
const o = this._injector.invoke((u) => Ir(r, u, e, n));
|
|
227
|
+
if (!o)
|
|
311
228
|
return;
|
|
312
|
-
const { rows, cols } =
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
var
|
|
316
|
-
const
|
|
317
|
-
|
|
229
|
+
const { rows: s, cols: c } = o;
|
|
230
|
+
s.forEach((u, d) => {
|
|
231
|
+
c.forEach((l, g) => {
|
|
232
|
+
var v;
|
|
233
|
+
const p = this._hyperLinkModel.getHyperLinkByLocation(e, n, u, l);
|
|
234
|
+
i.setValue(d, g, (v = p == null ? void 0 : p.id) != null ? v : "");
|
|
318
235
|
});
|
|
319
236
|
});
|
|
320
237
|
}
|
|
321
238
|
// eslint-disable-next-line max-lines-per-function
|
|
322
|
-
_generateMutations(
|
|
239
|
+
_generateMutations(e, n) {
|
|
323
240
|
if (!this._copyInfo)
|
|
324
241
|
return { redos: [], undos: [] };
|
|
325
|
-
if (!this._copyInfo || !this._copyInfo.matrix.getSizeOf() || !
|
|
242
|
+
if (!this._copyInfo || !this._copyInfo.matrix.getSizeOf() || !n.copyRange)
|
|
326
243
|
return { redos: [], undos: [] };
|
|
327
244
|
if ([
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
245
|
+
De.SPECIAL_PASTE_COL_WIDTH,
|
|
246
|
+
De.SPECIAL_PASTE_VALUE,
|
|
247
|
+
De.SPECIAL_PASTE_FORMAT,
|
|
248
|
+
De.SPECIAL_PASTE_FORMULA
|
|
332
249
|
].includes(
|
|
333
|
-
|
|
250
|
+
n.pasteType
|
|
334
251
|
))
|
|
335
252
|
return { redos: [], undos: [] };
|
|
336
|
-
const { unitId, subUnitId } = this._copyInfo,
|
|
337
|
-
return
|
|
338
|
-
var
|
|
339
|
-
(
|
|
340
|
-
const
|
|
253
|
+
const { unitId: r, subUnitId: i } = this._copyInfo, o = [], s = [], { ranges: [c, u], mapFunc: d } = Et([n.copyRange, e]);
|
|
254
|
+
return yr(c, u, !0).forEach(({ startRange: g }) => {
|
|
255
|
+
var p;
|
|
256
|
+
(p = this._copyInfo) == null || p.matrix.forValue((v, C, _) => {
|
|
257
|
+
const b = Ie.getPositionRange(
|
|
341
258
|
{
|
|
342
|
-
startRow:
|
|
343
|
-
endRow:
|
|
344
|
-
startColumn:
|
|
345
|
-
endColumn:
|
|
259
|
+
startRow: v,
|
|
260
|
+
endRow: v,
|
|
261
|
+
startColumn: C,
|
|
262
|
+
endColumn: C
|
|
346
263
|
},
|
|
347
|
-
|
|
348
|
-
),
|
|
349
|
-
|
|
350
|
-
id:
|
|
264
|
+
g
|
|
265
|
+
), a = this._hyperLinkModel.getHyperLink(r, i, _), { row: w, col: M } = d(b.startRow, b.startColumn), P = this._hyperLinkModel.getHyperLinkByLocation(n.unitId, n.subUnitId, w, M), k = Ce.generateRandomId();
|
|
266
|
+
P && o.push({
|
|
267
|
+
id: xe.id,
|
|
351
268
|
params: {
|
|
352
|
-
unitId:
|
|
353
|
-
subUnitId:
|
|
354
|
-
id:
|
|
269
|
+
unitId: n.unitId,
|
|
270
|
+
subUnitId: n.subUnitId,
|
|
271
|
+
id: P.id
|
|
355
272
|
}
|
|
356
|
-
}),
|
|
357
|
-
id:
|
|
273
|
+
}), a && (o.push({
|
|
274
|
+
id: Ne.id,
|
|
358
275
|
params: {
|
|
359
|
-
unitId:
|
|
360
|
-
subUnitId:
|
|
276
|
+
unitId: n.unitId,
|
|
277
|
+
subUnitId: n.subUnitId,
|
|
361
278
|
link: {
|
|
362
|
-
...
|
|
363
|
-
id,
|
|
364
|
-
row:
|
|
365
|
-
column:
|
|
279
|
+
...a,
|
|
280
|
+
id: k,
|
|
281
|
+
row: w,
|
|
282
|
+
column: M
|
|
366
283
|
}
|
|
367
284
|
}
|
|
368
|
-
}),
|
|
369
|
-
id:
|
|
285
|
+
}), s.push({
|
|
286
|
+
id: xe.id,
|
|
370
287
|
params: {
|
|
371
|
-
unitId:
|
|
372
|
-
subUnitId:
|
|
373
|
-
id
|
|
288
|
+
unitId: n.unitId,
|
|
289
|
+
subUnitId: n.subUnitId,
|
|
290
|
+
id: k
|
|
374
291
|
}
|
|
375
|
-
})),
|
|
376
|
-
id:
|
|
292
|
+
})), P && s.push({
|
|
293
|
+
id: Ne.id,
|
|
377
294
|
params: {
|
|
378
|
-
unitId:
|
|
379
|
-
subUnitId:
|
|
380
|
-
link:
|
|
295
|
+
unitId: n.unitId,
|
|
296
|
+
subUnitId: n.subUnitId,
|
|
297
|
+
link: P
|
|
381
298
|
}
|
|
382
299
|
});
|
|
383
300
|
});
|
|
384
|
-
}), { redos, undos };
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
],
|
|
393
|
-
var
|
|
301
|
+
}), { redos: o, undos: s };
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
We = Ri([
|
|
305
|
+
je(0, Er),
|
|
306
|
+
je(1, R(at)),
|
|
307
|
+
je(2, R(st)),
|
|
308
|
+
je(3, R(he))
|
|
309
|
+
], We);
|
|
310
|
+
var f = /* @__PURE__ */ ((t) => (t.EDITING = "editing", t.VIEWING = "viewing", t.ZEN_EDITOR = "zen_mode", t))(f || {}), Mn = { exports: {} }, dt = {};
|
|
394
311
|
/**
|
|
395
312
|
* @license React
|
|
396
313
|
* react-jsx-runtime.production.min.js
|
|
@@ -400,381 +317,144 @@ var HyperLinkEditSourceType = /* @__PURE__ */ ((HyperLinkEditSourceType2) => (Hy
|
|
|
400
317
|
* This source code is licensed under the MIT license found in the
|
|
401
318
|
* LICENSE file in the root directory of this source tree.
|
|
402
319
|
*/
|
|
403
|
-
var
|
|
404
|
-
function
|
|
405
|
-
var
|
|
406
|
-
|
|
407
|
-
for (
|
|
408
|
-
if (
|
|
409
|
-
return { $$typeof:
|
|
320
|
+
var Pi = di, Li = Symbol.for("react.element"), bi = Symbol.for("react.fragment"), wi = Object.prototype.hasOwnProperty, Oi = Pi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, ki = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
321
|
+
function Un(t, e, n) {
|
|
322
|
+
var r, i = {}, o = null, s = null;
|
|
323
|
+
n !== void 0 && (o = "" + n), e.key !== void 0 && (o = "" + e.key), e.ref !== void 0 && (s = e.ref);
|
|
324
|
+
for (r in e) wi.call(e, r) && !ki.hasOwnProperty(r) && (i[r] = e[r]);
|
|
325
|
+
if (t && t.defaultProps) for (r in e = t.defaultProps, e) i[r] === void 0 && (i[r] = e[r]);
|
|
326
|
+
return { $$typeof: Li, type: t, key: o, ref: s, props: i, _owner: Oi.current };
|
|
410
327
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
const AddHyperLinkCommand = {
|
|
418
|
-
type: CommandType.COMMAND,
|
|
419
|
-
id: "sheets.command.add-hyper-link",
|
|
420
|
-
// eslint-disable-next-line max-lines-per-function
|
|
421
|
-
async handler(accessor, params) {
|
|
422
|
-
var _a15;
|
|
423
|
-
if (!params)
|
|
424
|
-
return !1;
|
|
425
|
-
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), renderManagerService = accessor.get(IRenderManagerService), univerInstanceService = accessor.get(IUniverInstanceService), hyperLinkModel = accessor.get(HyperLinkModel), editorBridgeService = accessor.get(IEditorBridgeService), { unitId, subUnitId, link } = params, workbook = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET), currentRender = renderManagerService.getRenderById(unitId);
|
|
426
|
-
if (!currentRender || !workbook)
|
|
427
|
-
return !1;
|
|
428
|
-
const worksheet = workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId), skeleton = (_a15 = currentRender.with(SheetSkeletonManagerService).getCurrent()) == null ? void 0 : _a15.skeleton;
|
|
429
|
-
if (!worksheet || !skeleton)
|
|
430
|
-
return !1;
|
|
431
|
-
const { payload, display, row, column, id } = link, cellData = worksheet.getCell(row, column), doc = skeleton.getBlankCellDocumentModel(cellData), snapshot = doc.documentModel.getSnapshot(), body = Tools.deepClone(snapshot.body);
|
|
432
|
-
if (!body)
|
|
433
|
-
return !1;
|
|
434
|
-
let textX;
|
|
435
|
-
if (display ? textX = BuildTextUtils.selection.replace({
|
|
436
|
-
selection: {
|
|
437
|
-
startOffset: 0,
|
|
438
|
-
endOffset: body.dataStream.length - 2,
|
|
439
|
-
collapsed: !0
|
|
440
|
-
},
|
|
441
|
-
body: {
|
|
442
|
-
dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${display}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
|
|
443
|
-
customRanges: [{
|
|
444
|
-
startIndex: 0,
|
|
445
|
-
endIndex: display.length + 1,
|
|
446
|
-
rangeType: CustomRangeType.HYPERLINK,
|
|
447
|
-
rangeId: id,
|
|
448
|
-
properties: {
|
|
449
|
-
url: payload
|
|
450
|
-
// refId: id,
|
|
451
|
-
}
|
|
452
|
-
}]
|
|
453
|
-
},
|
|
454
|
-
doc: doc.documentModel
|
|
455
|
-
}) : textX = BuildTextUtils.customRange.add({
|
|
456
|
-
body,
|
|
457
|
-
range: { startOffset: 0, endOffset: body.dataStream.length - 2, collapsed: !1 },
|
|
458
|
-
rangeId: id,
|
|
459
|
-
rangeType: CustomRangeType.HYPERLINK,
|
|
460
|
-
properties: {
|
|
461
|
-
url: payload,
|
|
462
|
-
refId: id
|
|
463
|
-
}
|
|
464
|
-
}), !textX)
|
|
465
|
-
return !1;
|
|
466
|
-
const newBody = TextX.apply(body, textX.serialize()), newCellData = {
|
|
467
|
-
p: {
|
|
468
|
-
...snapshot,
|
|
469
|
-
body: newBody
|
|
470
|
-
},
|
|
471
|
-
t: CellValueType.STRING
|
|
472
|
-
}, finalCellData = await editorBridgeService.beforeSetRangeValue(workbook, worksheet, row, column, newCellData), redoParams = {
|
|
473
|
-
unitId,
|
|
474
|
-
subUnitId,
|
|
475
|
-
cellValue: {
|
|
476
|
-
[link.row]: {
|
|
477
|
-
[link.column]: finalCellData
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}, redo = {
|
|
481
|
-
id: SetRangeValuesMutation.id,
|
|
482
|
-
params: redoParams
|
|
483
|
-
}, undoParams = SetRangeValuesUndoMutationFactory(accessor, redoParams), undo = {
|
|
484
|
-
id: SetRangeValuesMutation.id,
|
|
485
|
-
params: undoParams
|
|
486
|
-
}, redos = [redo], undos = [undo], modelLink = hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, column);
|
|
487
|
-
return modelLink && (redos.push({
|
|
488
|
-
id: RemoveHyperLinkMutation.id,
|
|
489
|
-
params: {
|
|
490
|
-
unitId,
|
|
491
|
-
subUnitId,
|
|
492
|
-
id: modelLink.id
|
|
493
|
-
}
|
|
494
|
-
}), undos.push({
|
|
495
|
-
id: AddHyperLinkMutation.id,
|
|
496
|
-
params: {
|
|
497
|
-
unitId,
|
|
498
|
-
subUnitId,
|
|
499
|
-
link: modelLink
|
|
500
|
-
}
|
|
501
|
-
})), await sequenceExecuteAsync(redos, commandService) ? (undoRedoService.pushUndoRedo({
|
|
502
|
-
redoMutations: redos,
|
|
503
|
-
undoMutations: undos,
|
|
504
|
-
unitID: unitId
|
|
505
|
-
}), !0) : !1;
|
|
506
|
-
}
|
|
507
|
-
}, AddRichHyperLinkCommand = {
|
|
508
|
-
id: "sheets.command.add-rich-hyper-link",
|
|
509
|
-
type: CommandType.COMMAND,
|
|
510
|
-
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
511
|
-
if (!params)
|
|
512
|
-
return !1;
|
|
513
|
-
const { documentId, link } = params, commandService = accessor.get(ICommandService), newId = generateRandomId(), { payload } = link, replaceSelection = addCustomRangeBySelectionFactory(accessor, {
|
|
514
|
-
unitId: documentId,
|
|
515
|
-
rangeId: newId,
|
|
516
|
-
rangeType: CustomRangeType.HYPERLINK,
|
|
517
|
-
properties: {
|
|
518
|
-
url: payload,
|
|
519
|
-
refId: newId
|
|
520
|
-
}
|
|
521
|
-
});
|
|
522
|
-
return replaceSelection ? commandService.syncExecuteCommand(replaceSelection.id, replaceSelection.params) : !1;
|
|
523
|
-
}, "handler")
|
|
524
|
-
}, UpdateHyperLinkCommand = {
|
|
525
|
-
type: CommandType.COMMAND,
|
|
526
|
-
id: "sheets.command.update-hyper-link",
|
|
527
|
-
// eslint-disable-next-line max-lines-per-function, complexity
|
|
528
|
-
async handler(accessor, params) {
|
|
529
|
-
var _a15, _b, _c, _d;
|
|
530
|
-
if (!params)
|
|
531
|
-
return !1;
|
|
532
|
-
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), renderManagerService = accessor.get(IRenderManagerService), univerInstanceService = accessor.get(IUniverInstanceService), hyperLinkModel = accessor.get(HyperLinkModel), editorBridgeService = accessor.get(IEditorBridgeService), { unitId, subUnitId, payload: link, row, column, id } = params, workbook = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET), currentRender = renderManagerService.getRenderById(unitId);
|
|
533
|
-
if (!currentRender || !workbook)
|
|
534
|
-
return !1;
|
|
535
|
-
const worksheet = workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId), skeleton = (_a15 = currentRender.with(SheetSkeletonManagerService).getCurrent()) == null ? void 0 : _a15.skeleton;
|
|
536
|
-
if (!worksheet || !skeleton)
|
|
537
|
-
return !1;
|
|
538
|
-
const { payload, display = "" } = link, cellData = worksheet.getCell(row, column);
|
|
539
|
-
if (!cellData)
|
|
540
|
-
return !1;
|
|
541
|
-
const doc = skeleton.getCellDocumentModelWithFormula(cellData);
|
|
542
|
-
if (!(doc != null && doc.documentModel))
|
|
543
|
-
return !1;
|
|
544
|
-
const snapshot = doc.documentModel.getSnapshot(), range = (_c = (_b = snapshot.body) == null ? void 0 : _b.customRanges) == null ? void 0 : _c.find((range2) => range2.rangeId === id);
|
|
545
|
-
if (!range)
|
|
546
|
-
return !1;
|
|
547
|
-
const newId = generateRandomId(), textRun = (_d = getBodySlice(doc.documentModel.getBody(), range.startIndex, range.endIndex + 1).textRuns) == null ? void 0 : _d[0];
|
|
548
|
-
textRun && (textRun.ed = display.length + 1);
|
|
549
|
-
const replaceSelection = replaceSelectionFactory(accessor, {
|
|
550
|
-
unitId,
|
|
551
|
-
body: {
|
|
552
|
-
dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${display}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
|
|
553
|
-
customRanges: [{
|
|
554
|
-
rangeId: newId,
|
|
555
|
-
rangeType: CustomRangeType.HYPERLINK,
|
|
556
|
-
startIndex: 0,
|
|
557
|
-
endIndex: display.length + 1,
|
|
558
|
-
properties: {
|
|
559
|
-
url: payload
|
|
560
|
-
}
|
|
561
|
-
}],
|
|
562
|
-
textRuns: textRun ? [textRun] : void 0
|
|
563
|
-
},
|
|
564
|
-
selection: {
|
|
565
|
-
startOffset: range.startIndex,
|
|
566
|
-
endOffset: range.endIndex + 1,
|
|
567
|
-
collapsed: !1
|
|
568
|
-
},
|
|
569
|
-
doc: doc.documentModel
|
|
570
|
-
});
|
|
571
|
-
if (!replaceSelection)
|
|
572
|
-
return !1;
|
|
573
|
-
const newBody = TextX.apply(Tools.deepClone(snapshot.body), replaceSelection.textX.serialize()), newCellData = {
|
|
574
|
-
p: {
|
|
575
|
-
...snapshot,
|
|
576
|
-
body: newBody
|
|
577
|
-
},
|
|
578
|
-
t: CellValueType.STRING
|
|
579
|
-
}, finalCellData = await editorBridgeService.beforeSetRangeValue(workbook, worksheet, row, column, newCellData), redo = {
|
|
580
|
-
id: SetRangeValuesMutation.id,
|
|
581
|
-
params: {
|
|
582
|
-
unitId,
|
|
583
|
-
subUnitId,
|
|
584
|
-
cellValue: {
|
|
585
|
-
[row]: {
|
|
586
|
-
[column]: finalCellData
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
}, undoParams = SetRangeValuesUndoMutationFactory(accessor, redo.params), undo = {
|
|
591
|
-
id: SetRangeValuesMutation.id,
|
|
592
|
-
params: undoParams
|
|
593
|
-
}, redos = [redo], undos = [undo], modelLink = hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, column);
|
|
594
|
-
return modelLink && (redos.push({
|
|
595
|
-
id: RemoveHyperLinkMutation.id,
|
|
596
|
-
params: {
|
|
597
|
-
unitId,
|
|
598
|
-
subUnitId,
|
|
599
|
-
id: modelLink.id
|
|
600
|
-
}
|
|
601
|
-
}), undos.push({
|
|
602
|
-
id: AddHyperLinkMutation.id,
|
|
603
|
-
params: {
|
|
604
|
-
unitId,
|
|
605
|
-
subUnitId,
|
|
606
|
-
link: modelLink
|
|
607
|
-
}
|
|
608
|
-
})), await sequenceExecuteAsync(redos, commandService) ? (undoRedoService.pushUndoRedo({
|
|
609
|
-
redoMutations: redos,
|
|
610
|
-
undoMutations: undos,
|
|
611
|
-
unitID: unitId
|
|
612
|
-
}), !0) : !1;
|
|
613
|
-
}
|
|
614
|
-
}, UpdateRichHyperLinkCommand = {
|
|
615
|
-
type: CommandType.COMMAND,
|
|
616
|
-
id: "sheets.command.update-rich-hyper-link",
|
|
617
|
-
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
618
|
-
var _a15, _b, _c, _d;
|
|
619
|
-
if (!params)
|
|
620
|
-
return !1;
|
|
621
|
-
const { documentId: unitId, payload, id: rangeId } = params, univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService), doc = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
622
|
-
if (!doc)
|
|
623
|
-
return !1;
|
|
624
|
-
const range = (_b = (_a15 = doc.getBody()) == null ? void 0 : _a15.customRanges) == null ? void 0 : _b.find((range2) => range2.rangeId === rangeId);
|
|
625
|
-
if (!range)
|
|
626
|
-
return !1;
|
|
627
|
-
const display = (_c = params.payload.display) != null ? _c : "", newId = generateRandomId(), textRun = (_d = getBodySlice(doc.getBody(), range.startIndex, range.endIndex + 1).textRuns) == null ? void 0 : _d[0];
|
|
628
|
-
textRun && (textRun.ed = display.length + 1);
|
|
629
|
-
const replaceSelection = replaceSelectionFactory(accessor, {
|
|
630
|
-
unitId,
|
|
631
|
-
body: {
|
|
632
|
-
dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${display}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
|
|
633
|
-
customRanges: [{
|
|
634
|
-
rangeId: newId,
|
|
635
|
-
rangeType: CustomRangeType.HYPERLINK,
|
|
636
|
-
startIndex: 0,
|
|
637
|
-
endIndex: display.length + 1,
|
|
638
|
-
properties: {
|
|
639
|
-
url: payload.payload
|
|
640
|
-
}
|
|
641
|
-
}],
|
|
642
|
-
textRuns: textRun ? [textRun] : void 0
|
|
643
|
-
},
|
|
644
|
-
selection: {
|
|
645
|
-
startOffset: range.startIndex,
|
|
646
|
-
endOffset: range.endIndex + 1,
|
|
647
|
-
collapsed: !1
|
|
648
|
-
},
|
|
649
|
-
doc
|
|
650
|
-
});
|
|
651
|
-
return replaceSelection ? commandService.syncExecuteCommand(replaceSelection.id, replaceSelection.params) : !1;
|
|
652
|
-
}, "handler")
|
|
653
|
-
}, _SheetsHyperLinkSidePanelService = class _SheetsHyperLinkSidePanelService extends Disposable {
|
|
328
|
+
dt.Fragment = bi;
|
|
329
|
+
dt.jsx = Un;
|
|
330
|
+
dt.jsxs = Un;
|
|
331
|
+
Mn.exports = dt;
|
|
332
|
+
var m = Mn.exports;
|
|
333
|
+
class Hn extends z {
|
|
654
334
|
constructor() {
|
|
655
335
|
super(...arguments);
|
|
656
|
-
|
|
336
|
+
V(this, "_customHyperLinks", /* @__PURE__ */ new Map());
|
|
657
337
|
}
|
|
658
|
-
isBuiltInLinkType(
|
|
659
|
-
return
|
|
338
|
+
isBuiltInLinkType(n) {
|
|
339
|
+
return n !== S.URL;
|
|
660
340
|
}
|
|
661
341
|
getOptions() {
|
|
662
|
-
return Array.from(this._customHyperLinks.values()).map(({ option }) =>
|
|
342
|
+
return Array.from(this._customHyperLinks.values()).map(({ option: n }) => n);
|
|
663
343
|
}
|
|
664
|
-
findCustomHyperLink(
|
|
665
|
-
return Array.from(this._customHyperLinks.values()).find((
|
|
344
|
+
findCustomHyperLink(n) {
|
|
345
|
+
return Array.from(this._customHyperLinks.values()).find((i) => i.match(n));
|
|
666
346
|
}
|
|
667
|
-
registerCustomHyperLink(
|
|
668
|
-
this._customHyperLinks.set(
|
|
347
|
+
registerCustomHyperLink(n) {
|
|
348
|
+
this._customHyperLinks.set(n.type, n);
|
|
669
349
|
}
|
|
670
|
-
getCustomHyperLink(
|
|
671
|
-
return this._customHyperLinks.get(
|
|
350
|
+
getCustomHyperLink(n) {
|
|
351
|
+
return this._customHyperLinks.get(n);
|
|
672
352
|
}
|
|
673
|
-
removeCustomHyperLink(
|
|
674
|
-
const { _customHyperLinks } = this;
|
|
675
|
-
|
|
353
|
+
removeCustomHyperLink(n) {
|
|
354
|
+
const { _customHyperLinks: r } = this;
|
|
355
|
+
r.delete(n);
|
|
676
356
|
}
|
|
677
357
|
dispose() {
|
|
678
358
|
super.dispose(), this._customHyperLinks.clear();
|
|
679
359
|
}
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
}, [
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
let
|
|
699
|
-
if (
|
|
700
|
-
|
|
701
|
-
id: (
|
|
702
|
-
display:
|
|
703
|
-
payload: (
|
|
704
|
-
row,
|
|
705
|
-
column:
|
|
360
|
+
}
|
|
361
|
+
const Ti = "univer-cell-link-edit", xi = "univer-cell-link-edit-buttons", dn = {
|
|
362
|
+
cellLinkEdit: Ti,
|
|
363
|
+
cellLinkEditButtons: xi
|
|
364
|
+
}, Ze = () => {
|
|
365
|
+
var Bt;
|
|
366
|
+
const [t, e] = X(""), [n, r] = X(!1), [i, o] = X(""), [s, c] = X(!0), [u, d] = X(S.URL), [l, g] = X(""), p = E(it), v = E(Rn), C = E(ne), _ = E(K), b = E(G), a = Kr(b.currentEditing$), w = E(wt), M = E(he), P = E(re), k = E(Hn), q = un(() => k.getOptions(), [k]), D = E(ct), ie = E(ut), ye = E(Rr), He = E(Ue), se = E(In), Ee = E(rr), Re = E(Ue), Pe = Pt({}), oe = un(() => {
|
|
367
|
+
if (!k.isBuiltInLinkType(u))
|
|
368
|
+
return k.getCustomHyperLink(u);
|
|
369
|
+
}, [k, u]), [j, zn] = X(!1), [Le, pt] = X(!1), H = Pt(!1), B = _.getCurrentUnitForType(O.UNIVER_SHEET), Yn = (B == null ? void 0 : B.getActiveSheet().getSheetId()) || "", J = pi((h) => {
|
|
370
|
+
o(h.replaceAll(rn.CUSTOM_RANGE_START, "").replaceAll(rn.CUSTOM_RANGE_END, ""));
|
|
371
|
+
}, [o]);
|
|
372
|
+
te(() => {
|
|
373
|
+
var h, y, I, L, N, A, At, Ft, Wt, Zt, Gt, Kt, zt, Yt, Xt, qt, Jt;
|
|
374
|
+
if ((a == null ? void 0 : a.row) !== void 0 && a.col !== void 0) {
|
|
375
|
+
const { customRange: ae, row: ft, col: vt } = a;
|
|
376
|
+
let { label: Y } = a;
|
|
377
|
+
typeof Y == "number" && (Y = `${Y}`);
|
|
378
|
+
let F;
|
|
379
|
+
if (ae)
|
|
380
|
+
F = {
|
|
381
|
+
id: (h = ae == null ? void 0 : ae.rangeId) != null ? h : "",
|
|
382
|
+
display: Y != null ? Y : "",
|
|
383
|
+
payload: (I = (y = ae == null ? void 0 : ae.properties) == null ? void 0 : y.url) != null ? I : "",
|
|
384
|
+
row: ft,
|
|
385
|
+
column: vt
|
|
706
386
|
};
|
|
707
|
-
else if (
|
|
708
|
-
const
|
|
709
|
-
var
|
|
710
|
-
return
|
|
711
|
-
}),
|
|
712
|
-
|
|
387
|
+
else if (a.type === f.VIEWING) {
|
|
388
|
+
const T = _.getUnit(a.unitId), ee = T == null ? void 0 : T.getSheetBySheetId(a.subUnitId), U = ee == null ? void 0 : ee.getCellRaw(a.row, a.col), ve = (A = (N = (L = U == null ? void 0 : U.p) == null ? void 0 : L.body) == null ? void 0 : N.customRanges) == null ? void 0 : A.find((en) => {
|
|
389
|
+
var tn;
|
|
390
|
+
return en.rangeType === Me.HYPERLINK && ((tn = en.properties) == null ? void 0 : tn.url);
|
|
391
|
+
}), be = U == null ? void 0 : U.v;
|
|
392
|
+
U && (!de.transform.isEmptyDocument((Ft = (At = U.p) == null ? void 0 : At.body) == null ? void 0 : Ft.dataStream) || Ce.isDefine(be)) && c(!1), F = {
|
|
713
393
|
id: "",
|
|
714
394
|
display: "",
|
|
715
|
-
payload: (
|
|
716
|
-
row,
|
|
717
|
-
column:
|
|
395
|
+
payload: (Zt = (Wt = ve == null ? void 0 : ve.properties) == null ? void 0 : Wt.url) != null ? Zt : "",
|
|
396
|
+
row: ft,
|
|
397
|
+
column: vt
|
|
718
398
|
};
|
|
719
399
|
} else {
|
|
720
|
-
const
|
|
721
|
-
|
|
400
|
+
const T = _.getCurrentUnitForType(O.UNIVER_DOC), ee = He.getActiveTextRange(), U = T == null ? void 0 : T.getBody(), ve = ee && U ? ee : null, be = ve && ((Kt = de.customRange.getCustomRangesInterestsWithSelection(ve, (Gt = U == null ? void 0 : U.customRanges) != null ? Gt : [])) == null ? void 0 : Kt[0]);
|
|
401
|
+
c(!1), F = {
|
|
722
402
|
id: "",
|
|
723
|
-
display:
|
|
724
|
-
payload: (
|
|
725
|
-
row,
|
|
726
|
-
column:
|
|
403
|
+
display: Y != null ? Y : "",
|
|
404
|
+
payload: (Yt = (zt = be == null ? void 0 : be.properties) == null ? void 0 : zt.url) != null ? Yt : "",
|
|
405
|
+
row: ft,
|
|
406
|
+
column: vt
|
|
727
407
|
};
|
|
728
408
|
}
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
if (
|
|
732
|
-
const
|
|
733
|
-
|
|
409
|
+
e(F.id);
|
|
410
|
+
const Qt = k.findCustomHyperLink(F);
|
|
411
|
+
if (Qt) {
|
|
412
|
+
const T = Qt.convert(F);
|
|
413
|
+
d(T.type), g(T.payload), J(T.display);
|
|
734
414
|
return;
|
|
735
415
|
}
|
|
736
|
-
|
|
737
|
-
const
|
|
738
|
-
switch (
|
|
739
|
-
case
|
|
740
|
-
|
|
416
|
+
J(F.display);
|
|
417
|
+
const Q = w.parseHyperLink(F.payload);
|
|
418
|
+
switch (d(Q.type === S.INVALID ? S.RANGE : Q.type), Q.type) {
|
|
419
|
+
case S.URL: {
|
|
420
|
+
g(Q.url), Q.url === F.display && (H.current = !0);
|
|
741
421
|
break;
|
|
742
422
|
}
|
|
743
|
-
case
|
|
744
|
-
const
|
|
745
|
-
|
|
423
|
+
case S.RANGE: {
|
|
424
|
+
const T = Q.searchObj, ee = T.gid && (Jt = (qt = (Xt = _.getUnit(a.unitId)) == null ? void 0 : Xt.getSheetBySheetId(T.gid)) == null ? void 0 : qt.getName()) != null ? Jt : "", U = Mr(ee, Ve(T.range).range);
|
|
425
|
+
g(U), U === F.display && (H.current = !0);
|
|
746
426
|
break;
|
|
747
427
|
}
|
|
748
|
-
case
|
|
749
|
-
const
|
|
750
|
-
|
|
428
|
+
case S.SHEET: {
|
|
429
|
+
const T = Q.searchObj;
|
|
430
|
+
g(T.gid);
|
|
751
431
|
break;
|
|
752
432
|
}
|
|
753
|
-
case
|
|
754
|
-
const
|
|
755
|
-
|
|
433
|
+
case S.DEFINE_NAME: {
|
|
434
|
+
const T = Q.searchObj;
|
|
435
|
+
g(T.rangeid);
|
|
756
436
|
break;
|
|
757
437
|
}
|
|
758
438
|
default:
|
|
759
|
-
|
|
439
|
+
g("");
|
|
760
440
|
break;
|
|
761
441
|
}
|
|
762
442
|
}
|
|
763
|
-
}, [
|
|
764
|
-
let
|
|
765
|
-
if (
|
|
766
|
-
const
|
|
767
|
-
|
|
443
|
+
}, [a, M, k, He, _]), te(() => {
|
|
444
|
+
let h = null;
|
|
445
|
+
if (a && !a.customRangeId && a.type === f.VIEWING && Ce.isDefine(a.row) && Ce.isDefine(a.col)) {
|
|
446
|
+
const y = _.getUnit(a.unitId, O.UNIVER_SHEET), I = y == null ? void 0 : y.getSheetBySheetId(a.subUnitId), L = I == null ? void 0 : I.getMergedCell(a.row, a.col), N = new ir(Ee.getCurrentTheme().hyacinth500).toRgb();
|
|
447
|
+
h = ye.addShape(
|
|
768
448
|
{
|
|
769
|
-
range:
|
|
770
|
-
startColumn:
|
|
771
|
-
endColumn:
|
|
772
|
-
startRow:
|
|
773
|
-
endRow:
|
|
449
|
+
range: L != null ? L : {
|
|
450
|
+
startColumn: a.col,
|
|
451
|
+
endColumn: a.col,
|
|
452
|
+
startRow: a.row,
|
|
453
|
+
endRow: a.row
|
|
774
454
|
},
|
|
775
455
|
style: {
|
|
776
456
|
hasAutoFill: !1,
|
|
777
|
-
fill: `rgb(${
|
|
457
|
+
fill: `rgb(${N.r}, ${N.g}, ${N.b}, 0.12)`,
|
|
778
458
|
strokeWidth: 1,
|
|
779
459
|
stroke: "#FFBD37",
|
|
780
460
|
widgets: {}
|
|
@@ -786,602 +466,517 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
|
|
|
786
466
|
);
|
|
787
467
|
}
|
|
788
468
|
return () => {
|
|
789
|
-
|
|
469
|
+
h && ye.removeShape(h);
|
|
790
470
|
};
|
|
791
|
-
}, [
|
|
792
|
-
|
|
793
|
-
}, [
|
|
794
|
-
const
|
|
795
|
-
if (
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
|
|
471
|
+
}, [a, ye, Ee, _]), te(() => {
|
|
472
|
+
pt(u === S.RANGE);
|
|
473
|
+
}, [u]), te(() => {
|
|
474
|
+
const h = (a == null ? void 0 : a.type) === f.ZEN_EDITOR ? ie.getRenderById(x) : ie.getRenderById(C.getCurrentEditorId()), y = new sr();
|
|
475
|
+
if (h) {
|
|
476
|
+
const I = h.with(xn);
|
|
477
|
+
I.setReserveRangesStatus(!0), y.add(() => {
|
|
478
|
+
I.setReserveRangesStatus(!1);
|
|
799
479
|
});
|
|
800
480
|
}
|
|
801
481
|
return () => {
|
|
802
|
-
|
|
482
|
+
C.disableForceKeepVisible(), y.dispose();
|
|
803
483
|
};
|
|
804
|
-
}, [
|
|
805
|
-
|
|
806
|
-
}), [
|
|
807
|
-
|
|
808
|
-
}, [
|
|
809
|
-
|
|
484
|
+
}, [a == null ? void 0 : a.type, C, ie]), te(() => (b.setIsKeepVisible(Le), () => {
|
|
485
|
+
b.setIsKeepVisible(!1);
|
|
486
|
+
}), [Le, b]), te(() => () => {
|
|
487
|
+
D.temporaryHidden && (D.show(), se.setContextValue(_t, !1));
|
|
488
|
+
}, [se, D]), te(() => {
|
|
489
|
+
if (Le)
|
|
490
|
+
return C.enableForceKeepVisible(), () => {
|
|
491
|
+
C.disableForceKeepVisible();
|
|
492
|
+
};
|
|
493
|
+
}, [Le, C]);
|
|
494
|
+
const Xn = [
|
|
810
495
|
{
|
|
811
|
-
label:
|
|
812
|
-
value:
|
|
496
|
+
label: p.t("hyperLink.form.link"),
|
|
497
|
+
value: S.URL
|
|
813
498
|
},
|
|
814
499
|
{
|
|
815
|
-
label:
|
|
816
|
-
value:
|
|
500
|
+
label: p.t("hyperLink.form.range"),
|
|
501
|
+
value: S.RANGE
|
|
817
502
|
},
|
|
818
503
|
{
|
|
819
|
-
label:
|
|
820
|
-
value:
|
|
504
|
+
label: p.t("hyperLink.form.worksheet"),
|
|
505
|
+
value: S.SHEET
|
|
821
506
|
},
|
|
822
507
|
{
|
|
823
|
-
label:
|
|
824
|
-
value:
|
|
508
|
+
label: p.t("hyperLink.form.definedName"),
|
|
509
|
+
value: S.DEFINE_NAME
|
|
825
510
|
},
|
|
826
|
-
...
|
|
511
|
+
...q
|
|
827
512
|
];
|
|
828
|
-
if (!
|
|
513
|
+
if (!B)
|
|
829
514
|
return;
|
|
830
|
-
const
|
|
831
|
-
label:
|
|
832
|
-
value:
|
|
833
|
-
})),
|
|
834
|
-
if (
|
|
835
|
-
return
|
|
836
|
-
if (
|
|
837
|
-
const
|
|
838
|
-
if (
|
|
839
|
-
return `#gid=${
|
|
515
|
+
const qn = B.getHiddenWorksheets(), ht = B.getSheets().map((h) => ({ label: h.getName(), value: h.getSheetId() })).filter((h) => qn.indexOf(h.value) === -1), gt = Object.values((Bt = v.getDefinedNameMap(B.getUnitId())) != null ? Bt : {}).map((h) => ({
|
|
516
|
+
label: h.name,
|
|
517
|
+
value: h.id
|
|
518
|
+
})), Vt = (h, y) => {
|
|
519
|
+
if (h === S.URL)
|
|
520
|
+
return fi(y);
|
|
521
|
+
if (h === S.RANGE) {
|
|
522
|
+
const I = Ve(y), L = B.getSheetBySheetName(I.sheetName);
|
|
523
|
+
if (L)
|
|
524
|
+
return `#gid=${L.getSheetId()}&range=${Hr(I.range)}`;
|
|
840
525
|
}
|
|
841
|
-
return `#${
|
|
842
|
-
},
|
|
843
|
-
var
|
|
844
|
-
const
|
|
845
|
-
if (!
|
|
526
|
+
return `#${h}=${y}`;
|
|
527
|
+
}, Jn = zr((h) => {
|
|
528
|
+
var N;
|
|
529
|
+
const I = h.split(",").map(Ve)[0];
|
|
530
|
+
if (!I || !_n(I.range))
|
|
846
531
|
return;
|
|
847
|
-
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
}),
|
|
851
|
-
if (
|
|
852
|
-
|
|
532
|
+
I.sheetName || (I.sheetName = ((N = B.getActiveSheet()) == null ? void 0 : N.getName()) || "");
|
|
533
|
+
const L = Ur(I);
|
|
534
|
+
g(L), L && (H.current || !i) && (J(L), H.current = !0);
|
|
535
|
+
}), mt = async () => {
|
|
536
|
+
if (s && !i || !l || u === S.URL && !Fe(l)) {
|
|
537
|
+
zn(!0);
|
|
853
538
|
return;
|
|
854
539
|
}
|
|
855
|
-
if (
|
|
856
|
-
if (
|
|
857
|
-
const
|
|
858
|
-
await
|
|
859
|
-
id,
|
|
860
|
-
unitId:
|
|
861
|
-
subUnitId:
|
|
540
|
+
if (a)
|
|
541
|
+
if (t) {
|
|
542
|
+
const h = a.type === f.ZEN_EDITOR || a.type === f.EDITING ? hr.id : gr.id;
|
|
543
|
+
await P.executeCommand(h, {
|
|
544
|
+
id: t,
|
|
545
|
+
unitId: a.unitId,
|
|
546
|
+
subUnitId: a.subUnitId,
|
|
862
547
|
payload: {
|
|
863
|
-
display:
|
|
864
|
-
payload:
|
|
548
|
+
display: s ? i : "",
|
|
549
|
+
payload: Vt(u, l)
|
|
865
550
|
},
|
|
866
|
-
row:
|
|
867
|
-
column:
|
|
868
|
-
documentId:
|
|
551
|
+
row: a.row,
|
|
552
|
+
column: a.col,
|
|
553
|
+
documentId: a.type === f.ZEN_EDITOR ? x : C.getCurrentEditorId()
|
|
869
554
|
});
|
|
870
555
|
} else {
|
|
871
|
-
const
|
|
872
|
-
await
|
|
873
|
-
unitId:
|
|
874
|
-
subUnitId:
|
|
556
|
+
const h = a.type === f.ZEN_EDITOR || a.type === f.EDITING ? mr.id : fr.id;
|
|
557
|
+
await P.executeCommand(h, {
|
|
558
|
+
unitId: a.unitId,
|
|
559
|
+
subUnitId: a.subUnitId,
|
|
875
560
|
link: {
|
|
876
|
-
id:
|
|
877
|
-
row:
|
|
878
|
-
column:
|
|
879
|
-
payload:
|
|
880
|
-
display:
|
|
561
|
+
id: or(),
|
|
562
|
+
row: a.row,
|
|
563
|
+
column: a.col,
|
|
564
|
+
payload: Vt(u, l),
|
|
565
|
+
display: s ? i : ""
|
|
881
566
|
},
|
|
882
|
-
documentId:
|
|
567
|
+
documentId: a.type === f.ZEN_EDITOR ? x : C.getCurrentEditorId()
|
|
883
568
|
});
|
|
884
569
|
}
|
|
885
|
-
if ((
|
|
886
|
-
await
|
|
887
|
-
unitId:
|
|
888
|
-
subUnitId:
|
|
570
|
+
if ((a == null ? void 0 : a.type) === f.VIEWING) {
|
|
571
|
+
await P.executeCommand(Ln.id, {
|
|
572
|
+
unitId: a.unitId,
|
|
573
|
+
subUnitId: a.subUnitId
|
|
889
574
|
});
|
|
890
|
-
const
|
|
891
|
-
await
|
|
575
|
+
const h = 1;
|
|
576
|
+
await P.executeCommand(yn.id, {
|
|
892
577
|
range: {
|
|
893
|
-
startRow: Math.max(
|
|
894
|
-
endRow:
|
|
895
|
-
startColumn: Math.max(
|
|
896
|
-
endColumn:
|
|
578
|
+
startRow: Math.max(a.row - h, 0),
|
|
579
|
+
endRow: a.row + h,
|
|
580
|
+
startColumn: Math.max(a.col - h, 0),
|
|
581
|
+
endColumn: a.col + h
|
|
897
582
|
}
|
|
898
583
|
});
|
|
899
584
|
}
|
|
900
|
-
|
|
901
|
-
},
|
|
902
|
-
var
|
|
903
|
-
if (
|
|
585
|
+
P.executeCommand(Ke.id);
|
|
586
|
+
}, Qn = (h) => {
|
|
587
|
+
var I;
|
|
588
|
+
if (u !== S.RANGE)
|
|
904
589
|
return;
|
|
905
|
-
const
|
|
906
|
-
|
|
907
|
-
}
|
|
908
|
-
return
|
|
909
|
-
|
|
910
|
-
|
|
590
|
+
const y = (I = Pe.current) == null ? void 0 : I.handleOutClick;
|
|
591
|
+
y && y(h, () => pt(!1));
|
|
592
|
+
};
|
|
593
|
+
return a ? /* @__PURE__ */ m.jsxs("div", { className: dn.cellLinkEdit, style: { display: n ? "none" : "block" }, onClick: Qn, children: [
|
|
594
|
+
s ? /* @__PURE__ */ m.jsx(
|
|
595
|
+
_e,
|
|
911
596
|
{
|
|
912
|
-
label:
|
|
913
|
-
error:
|
|
914
|
-
children: /* @__PURE__ */
|
|
915
|
-
|
|
597
|
+
label: p.t("hyperLink.form.label"),
|
|
598
|
+
error: j && !i ? p.t("hyperLink.form.inputError") : "",
|
|
599
|
+
children: /* @__PURE__ */ m.jsx(
|
|
600
|
+
on,
|
|
916
601
|
{
|
|
917
|
-
value:
|
|
918
|
-
onChange:
|
|
919
|
-
|
|
920
|
-
},
|
|
921
|
-
placeholder:
|
|
602
|
+
value: i,
|
|
603
|
+
onChange: (h) => {
|
|
604
|
+
J(h), H.current = !1;
|
|
605
|
+
},
|
|
606
|
+
placeholder: p.t("hyperLink.form.labelPlaceholder"),
|
|
922
607
|
autoFocus: !0,
|
|
923
|
-
onKeyDown:
|
|
924
|
-
|
|
925
|
-
}
|
|
608
|
+
onKeyDown: (h) => {
|
|
609
|
+
h.keyCode === Rt.ENTER && mt();
|
|
610
|
+
}
|
|
926
611
|
}
|
|
927
612
|
)
|
|
928
613
|
}
|
|
929
614
|
) : null,
|
|
930
|
-
/* @__PURE__ */
|
|
931
|
-
|
|
615
|
+
/* @__PURE__ */ m.jsx(_e, { label: p.t("hyperLink.form.type"), children: /* @__PURE__ */ m.jsx(
|
|
616
|
+
Ct,
|
|
932
617
|
{
|
|
933
|
-
options:
|
|
934
|
-
value:
|
|
935
|
-
onChange:
|
|
936
|
-
|
|
937
|
-
}
|
|
618
|
+
options: Xn,
|
|
619
|
+
value: u,
|
|
620
|
+
onChange: (h) => {
|
|
621
|
+
d(h), g("");
|
|
622
|
+
}
|
|
938
623
|
}
|
|
939
624
|
) }),
|
|
940
|
-
|
|
941
|
-
|
|
625
|
+
u === S.URL && /* @__PURE__ */ m.jsx(
|
|
626
|
+
_e,
|
|
942
627
|
{
|
|
943
|
-
error:
|
|
944
|
-
children: /* @__PURE__ */
|
|
945
|
-
|
|
628
|
+
error: j ? l ? Fe(l) ? "" : p.t("hyperLink.form.linkError") : p.t("hyperLink.form.inputError") : "",
|
|
629
|
+
children: /* @__PURE__ */ m.jsx(
|
|
630
|
+
on,
|
|
946
631
|
{
|
|
947
|
-
value:
|
|
948
|
-
onChange:
|
|
949
|
-
|
|
950
|
-
},
|
|
951
|
-
placeholder:
|
|
632
|
+
value: l,
|
|
633
|
+
onChange: (h) => {
|
|
634
|
+
g(h), h && (H.current || !i || i === l) && (J(h), H.current = !0);
|
|
635
|
+
},
|
|
636
|
+
placeholder: p.t("hyperLink.form.linkPlaceholder"),
|
|
952
637
|
autoFocus: !0,
|
|
953
|
-
onKeyDown:
|
|
954
|
-
|
|
955
|
-
}
|
|
638
|
+
onKeyDown: (h) => {
|
|
639
|
+
h.keyCode === Rt.ENTER && mt();
|
|
640
|
+
}
|
|
956
641
|
}
|
|
957
642
|
)
|
|
958
643
|
}
|
|
959
644
|
),
|
|
960
|
-
|
|
961
|
-
|
|
645
|
+
u === S.RANGE && /* @__PURE__ */ m.jsx(_e, { error: j && !l ? p.t("hyperLink.form.inputError") : "", children: /* @__PURE__ */ m.jsx(
|
|
646
|
+
hi,
|
|
962
647
|
{
|
|
963
|
-
unitId:
|
|
964
|
-
subUnitId,
|
|
648
|
+
unitId: B.getUnitId(),
|
|
649
|
+
subUnitId: Yn,
|
|
965
650
|
isOnlyOneRange: !0,
|
|
966
651
|
isSupportAcrossSheet: !0,
|
|
967
|
-
initValue:
|
|
968
|
-
onChange:
|
|
969
|
-
isFocus:
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
if (visible)
|
|
977
|
-
editing.type === HyperLinkEditSourceType.ZEN_EDITOR && (zenZoneService.hide(), contextService.setContextValue(FOCUSING_SHEET, !0)), editing.type !== HyperLinkEditSourceType.VIEWING && editorBridgeService.enableForceKeepVisible(), setHide(!0);
|
|
652
|
+
initValue: l,
|
|
653
|
+
onChange: Jn,
|
|
654
|
+
isFocus: Le,
|
|
655
|
+
onFocus: () => pt(!0),
|
|
656
|
+
actions: Pe.current,
|
|
657
|
+
onRangeSelectorDialogVisibleChange: async (h) => {
|
|
658
|
+
var y, I;
|
|
659
|
+
if (h)
|
|
660
|
+
a.type === f.ZEN_EDITOR && (D.hide(), se.setContextValue(_t, !0)), a.type !== f.VIEWING && C.enableForceKeepVisible(), r(!0);
|
|
978
661
|
else {
|
|
979
|
-
if (await
|
|
980
|
-
await
|
|
981
|
-
unitId:
|
|
982
|
-
subUnitId:
|
|
983
|
-
selections: [{ range: { startRow:
|
|
984
|
-
}),
|
|
985
|
-
const
|
|
986
|
-
|
|
662
|
+
if (await M.navigateToRange(a.unitId, a.subUnitId, { startRow: a.row, endRow: a.row, startColumn: a.col, endColumn: a.col }, !0), a.type === f.ZEN_EDITOR) {
|
|
663
|
+
await P.executeCommand(Pn.id, {
|
|
664
|
+
unitId: a.unitId,
|
|
665
|
+
subUnitId: a.subUnitId,
|
|
666
|
+
selections: [{ range: { startRow: a.row, endRow: a.row, startColumn: a.col, endColumn: a.col } }]
|
|
667
|
+
}), D.show(), se.setContextValue(_t, !1);
|
|
668
|
+
const L = (y = ie.getRenderById(x)) == null ? void 0 : y.with(ri), N = (I = Re.getTextRanges({ unitId: x, subUnitId: x })) == null ? void 0 : I[0];
|
|
669
|
+
L && N && (L.scrollToRange(N), Re.refreshSelection({ unitId: x, subUnitId: x }));
|
|
987
670
|
}
|
|
988
|
-
|
|
671
|
+
C.disableForceKeepVisible(), r(!1);
|
|
989
672
|
}
|
|
990
|
-
}
|
|
673
|
+
}
|
|
991
674
|
}
|
|
992
675
|
) }),
|
|
993
|
-
|
|
994
|
-
|
|
676
|
+
u === S.SHEET && /* @__PURE__ */ m.jsx(_e, { error: j && !l ? p.t("hyperLink.form.selectError") : "", children: /* @__PURE__ */ m.jsx(
|
|
677
|
+
Ct,
|
|
995
678
|
{
|
|
996
|
-
options:
|
|
997
|
-
value:
|
|
998
|
-
onChange:
|
|
999
|
-
var
|
|
1000
|
-
|
|
1001
|
-
const
|
|
1002
|
-
|
|
1003
|
-
}
|
|
679
|
+
options: ht,
|
|
680
|
+
value: l,
|
|
681
|
+
onChange: (h) => {
|
|
682
|
+
var L, N;
|
|
683
|
+
g(h);
|
|
684
|
+
const y = (L = ht.find((A) => A.value === h)) == null ? void 0 : L.label, I = (N = ht.find((A) => A.value === l)) == null ? void 0 : N.label;
|
|
685
|
+
y && (H.current || !i || i === I) && (J(y), H.current = !0);
|
|
686
|
+
}
|
|
1004
687
|
}
|
|
1005
688
|
) }),
|
|
1006
|
-
|
|
1007
|
-
|
|
689
|
+
u === S.DEFINE_NAME && /* @__PURE__ */ m.jsx(_e, { error: j && !l ? p.t("hyperLink.form.selectError") : "", children: /* @__PURE__ */ m.jsx(
|
|
690
|
+
Ct,
|
|
1008
691
|
{
|
|
1009
|
-
options:
|
|
1010
|
-
value:
|
|
1011
|
-
onChange:
|
|
1012
|
-
var
|
|
1013
|
-
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1016
|
-
}
|
|
692
|
+
options: gt,
|
|
693
|
+
value: l,
|
|
694
|
+
onChange: (h) => {
|
|
695
|
+
var L, N;
|
|
696
|
+
g(h);
|
|
697
|
+
const y = (L = gt.find((A) => A.value === h)) == null ? void 0 : L.label, I = (N = gt.find((A) => A.value === l)) == null ? void 0 : N.label;
|
|
698
|
+
y && (H.current || !i || i === I) && (J(y), H.current = !0);
|
|
699
|
+
}
|
|
1017
700
|
}
|
|
1018
701
|
) }),
|
|
1019
|
-
(
|
|
1020
|
-
|
|
702
|
+
(oe == null ? void 0 : oe.Form) && /* @__PURE__ */ m.jsx(
|
|
703
|
+
oe.Form,
|
|
1021
704
|
{
|
|
1022
|
-
linkId:
|
|
1023
|
-
payload,
|
|
1024
|
-
display,
|
|
1025
|
-
showError,
|
|
1026
|
-
setByPayload,
|
|
1027
|
-
setDisplay:
|
|
1028
|
-
|
|
1029
|
-
},
|
|
1030
|
-
setPayload
|
|
705
|
+
linkId: t,
|
|
706
|
+
payload: l,
|
|
707
|
+
display: i,
|
|
708
|
+
showError: j,
|
|
709
|
+
setByPayload: H,
|
|
710
|
+
setDisplay: (h) => {
|
|
711
|
+
J(h), H.current = !0;
|
|
712
|
+
},
|
|
713
|
+
setPayload: g
|
|
1031
714
|
}
|
|
1032
715
|
),
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
/* @__PURE__ */
|
|
1035
|
-
|
|
716
|
+
/* @__PURE__ */ m.jsxs("div", { className: dn.cellLinkEditButtons, children: [
|
|
717
|
+
/* @__PURE__ */ m.jsx(
|
|
718
|
+
an,
|
|
1036
719
|
{
|
|
1037
|
-
onClick:
|
|
1038
|
-
|
|
1039
|
-
},
|
|
1040
|
-
children:
|
|
720
|
+
onClick: () => {
|
|
721
|
+
a && M.navigateToRange(a.unitId, a.subUnitId, { startRow: a.row, endRow: a.row, startColumn: a.col, endColumn: a.col }, !0), P.executeCommand(Ke.id);
|
|
722
|
+
},
|
|
723
|
+
children: p.t("hyperLink.form.cancel")
|
|
1041
724
|
}
|
|
1042
725
|
),
|
|
1043
|
-
/* @__PURE__ */
|
|
1044
|
-
|
|
726
|
+
/* @__PURE__ */ m.jsx(
|
|
727
|
+
an,
|
|
1045
728
|
{
|
|
1046
729
|
type: "primary",
|
|
1047
730
|
style: { marginLeft: 8 },
|
|
1048
|
-
onClick:
|
|
1049
|
-
|
|
1050
|
-
},
|
|
1051
|
-
children:
|
|
731
|
+
onClick: async () => {
|
|
732
|
+
mt();
|
|
733
|
+
},
|
|
734
|
+
children: p.t("hyperLink.form.ok")
|
|
1052
735
|
}
|
|
1053
736
|
)
|
|
1054
737
|
] })
|
|
1055
738
|
] }) : null;
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
var
|
|
1059
|
-
return
|
|
1060
|
-
for (var
|
|
1061
|
-
|
|
1062
|
-
for (var
|
|
739
|
+
};
|
|
740
|
+
Ze.componentKey = "univer.sheet.cell-link-edit";
|
|
741
|
+
var $ = function() {
|
|
742
|
+
return $ = Object.assign || function(t) {
|
|
743
|
+
for (var e, n = 1, r = arguments.length; n < r; n++) {
|
|
744
|
+
e = arguments[n];
|
|
745
|
+
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
|
|
1063
746
|
}
|
|
1064
747
|
return t;
|
|
1065
|
-
},
|
|
1066
|
-
},
|
|
1067
|
-
var
|
|
1068
|
-
for (var
|
|
1069
|
-
if (
|
|
1070
|
-
for (var i = 0,
|
|
1071
|
-
e.indexOf(
|
|
1072
|
-
return
|
|
1073
|
-
},
|
|
1074
|
-
var
|
|
1075
|
-
return
|
|
748
|
+
}, $.apply(this, arguments);
|
|
749
|
+
}, Ni = function(t, e) {
|
|
750
|
+
var n = {};
|
|
751
|
+
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
752
|
+
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
753
|
+
for (var i = 0, r = Object.getOwnPropertySymbols(t); i < r.length; i++)
|
|
754
|
+
e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (n[r[i]] = t[r[i]]);
|
|
755
|
+
return n;
|
|
756
|
+
}, fe = ge(function(t, e) {
|
|
757
|
+
var n = t.icon, r = t.id, i = t.className, o = t.extend, s = Ni(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(r, " ").concat(i || "").trim(), u = Pt("_".concat(Hi()));
|
|
758
|
+
return Dn(n, "".concat(r), { defIds: n.defIds, idSuffix: u.current }, $({ ref: e, className: c }, s), o);
|
|
1076
759
|
});
|
|
1077
|
-
function
|
|
1078
|
-
return
|
|
1079
|
-
return
|
|
760
|
+
function Dn(t, e, n, r, i) {
|
|
761
|
+
return me(t.tag, $($({ key: e }, Mi(t, n, i)), r), (Ui(t, n).children || []).map(function(o, s) {
|
|
762
|
+
return Dn(o, "".concat(e, "-").concat(t.tag, "-").concat(s), n, void 0, i);
|
|
1080
763
|
}));
|
|
1081
764
|
}
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
})), attrs;
|
|
765
|
+
function Mi(t, e, n) {
|
|
766
|
+
var r = $({}, t.attrs);
|
|
767
|
+
n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
|
|
768
|
+
var i = e.defIds;
|
|
769
|
+
return !i || i.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(o) {
|
|
770
|
+
var s = o[0], c = o[1];
|
|
771
|
+
typeof c == "string" && (r[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
772
|
+
})), r;
|
|
1091
773
|
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
}) }) : node;
|
|
774
|
+
function Ui(t, e) {
|
|
775
|
+
var n, r = e.defIds;
|
|
776
|
+
return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? $($({}, t), { children: t.children.map(function(i) {
|
|
777
|
+
return typeof i.attrs.id == "string" && r && r.indexOf(i.attrs.id) > -1 ? $($({}, i), { attrs: $($({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
|
|
778
|
+
}) }) : t;
|
|
1098
779
|
}
|
|
1099
|
-
|
|
1100
|
-
function generateShortUuid() {
|
|
780
|
+
function Hi() {
|
|
1101
781
|
return Math.random().toString(36).substring(2, 8);
|
|
1102
782
|
}
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
return createElement(IconBase, Object.assign({}, props, {
|
|
783
|
+
fe.displayName = "UniverIcon";
|
|
784
|
+
var Di = { 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" } }] }, Ae = ge(function(t, e) {
|
|
785
|
+
return me(fe, Object.assign({}, t, {
|
|
1107
786
|
id: "all-border-single",
|
|
1108
|
-
ref,
|
|
1109
|
-
icon:
|
|
787
|
+
ref: e,
|
|
788
|
+
icon: Di
|
|
1110
789
|
}));
|
|
1111
790
|
});
|
|
1112
|
-
|
|
1113
|
-
var
|
|
1114
|
-
return
|
|
791
|
+
Ae.displayName = "AllBorderSingle";
|
|
792
|
+
var $i = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, $n = ge(function(t, e) {
|
|
793
|
+
return me(fe, Object.assign({}, t, {
|
|
1115
794
|
id: "copy-single",
|
|
1116
|
-
ref,
|
|
1117
|
-
icon:
|
|
795
|
+
ref: e,
|
|
796
|
+
icon: $i
|
|
1118
797
|
}));
|
|
1119
798
|
});
|
|
1120
|
-
|
|
1121
|
-
var
|
|
1122
|
-
return
|
|
799
|
+
$n.displayName = "CopySingle";
|
|
800
|
+
var ji = { 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" } }] }, Ut = ge(function(t, e) {
|
|
801
|
+
return me(fe, Object.assign({}, t, {
|
|
1123
802
|
id: "link-single",
|
|
1124
|
-
ref,
|
|
1125
|
-
icon:
|
|
803
|
+
ref: e,
|
|
804
|
+
icon: ji
|
|
1126
805
|
}));
|
|
1127
806
|
});
|
|
1128
|
-
|
|
1129
|
-
var
|
|
1130
|
-
return
|
|
807
|
+
Ut.displayName = "LinkSingle";
|
|
808
|
+
var Vi = { 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" } }] }, jn = ge(function(t, e) {
|
|
809
|
+
return me(fe, Object.assign({}, t, {
|
|
1131
810
|
id: "unlink-single",
|
|
1132
|
-
ref,
|
|
1133
|
-
icon:
|
|
811
|
+
ref: e,
|
|
812
|
+
icon: Vi
|
|
1134
813
|
}));
|
|
1135
814
|
});
|
|
1136
|
-
|
|
1137
|
-
var
|
|
1138
|
-
return
|
|
815
|
+
jn.displayName = "UnlinkSingle";
|
|
816
|
+
var Bi = { 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" } }] }, Vn = ge(function(t, e) {
|
|
817
|
+
return me(fe, Object.assign({}, t, {
|
|
1139
818
|
id: "write-single",
|
|
1140
|
-
ref,
|
|
1141
|
-
icon:
|
|
819
|
+
ref: e,
|
|
820
|
+
icon: Bi
|
|
1142
821
|
}));
|
|
1143
822
|
});
|
|
1144
|
-
|
|
1145
|
-
var
|
|
1146
|
-
return
|
|
823
|
+
Vn.displayName = "WriteSingle";
|
|
824
|
+
var Ai = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "#35BD4B", d: "M3.4535 1.12549C2.7002 1.12549 2.08954 1.73615 2.08954 2.48945V13.5104C2.08954 14.2637 2.7002 14.8744 3.4535 14.8744H12.5465C13.2998 14.8744 13.9105 14.2637 13.9105 13.5104V5.0992L10.0091 1.12549H3.4535Z" } }, { tag: "path", attrs: { fill: "#32A846", d: "M10.0075 1.12549L13.9104 5.09842H10.6742C10.306 5.09842 10.0075 4.79994 10.0075 4.43175V1.12549Z" } }, { tag: "path", attrs: { fill: "#fff", d: "M7.8088 10.2949L6.3764 12.403C6.26259 12.5705 6.03455 12.614 5.86705 12.5002C5.69955 12.3864 5.65603 12.1584 5.76984 11.9909L7.3655 9.64252L5.94042 7.54519C5.82661 7.37769 5.87013 7.14964 6.03763 7.03583C6.20512 6.92202 6.43317 6.96555 6.54698 7.13304L7.8088 8.9901L9.07062 7.13304C9.18443 6.96555 9.41248 6.92202 9.57997 7.03583C9.74747 7.14964 9.79099 7.37769 9.67718 7.54519L8.2521 9.64252L9.84776 11.9909C9.96157 12.1584 9.91805 12.3864 9.75055 12.5002C9.58305 12.614 9.35501 12.5705 9.2412 12.403L7.8088 10.2949Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Bn = ge(function(t, e) {
|
|
825
|
+
return me(fe, Object.assign({}, t, {
|
|
1147
826
|
id: "xlsx",
|
|
1148
|
-
ref,
|
|
1149
|
-
icon:
|
|
827
|
+
ref: e,
|
|
828
|
+
icon: Ai
|
|
1150
829
|
}));
|
|
1151
830
|
});
|
|
1152
|
-
|
|
1153
|
-
function
|
|
1154
|
-
var
|
|
1155
|
-
if (typeof
|
|
1156
|
-
else if (typeof
|
|
1157
|
-
var
|
|
1158
|
-
for (
|
|
1159
|
-
} else for (
|
|
1160
|
-
return
|
|
831
|
+
Bn.displayName = "Xlsx";
|
|
832
|
+
function An(t) {
|
|
833
|
+
var e, n, r = "";
|
|
834
|
+
if (typeof t == "string" || typeof t == "number") r += t;
|
|
835
|
+
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
836
|
+
var i = t.length;
|
|
837
|
+
for (e = 0; e < i; e++) t[e] && (n = An(t[e])) && (r && (r += " "), r += n);
|
|
838
|
+
} else for (n in t) t[n] && (r && (r += " "), r += n);
|
|
839
|
+
return r;
|
|
1161
840
|
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
return n2;
|
|
841
|
+
function pn() {
|
|
842
|
+
for (var t, e, n = 0, r = "", i = arguments.length; n < i; n++) (t = arguments[n]) && (e = An(t)) && (r && (r += " "), r += e);
|
|
843
|
+
return r;
|
|
1166
844
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
if (!(doc != null && doc.documentModel))
|
|
1187
|
-
return !1;
|
|
1188
|
-
const snapshot = Tools.deepClone(doc.documentModel.getSnapshot());
|
|
1189
|
-
if (!((_c = (_b = snapshot.body) == null ? void 0 : _b.customRanges) == null ? void 0 : _c.find((range2) => range2.rangeId === id)))
|
|
1190
|
-
return !1;
|
|
1191
|
-
const textX = BuildTextUtils.customRange.delete(accessor, { documentDataModel: doc.documentModel, rangeId: id });
|
|
1192
|
-
if (!textX)
|
|
1193
|
-
return !1;
|
|
1194
|
-
const newBody = TextX.apply(snapshot.body, textX.serialize()), redos = [], undos = [], setRangeParams = {
|
|
1195
|
-
unitId,
|
|
1196
|
-
subUnitId,
|
|
1197
|
-
cellValue: {
|
|
1198
|
-
[row]: {
|
|
1199
|
-
[column]: {
|
|
1200
|
-
p: {
|
|
1201
|
-
...snapshot,
|
|
1202
|
-
body: newBody
|
|
1203
|
-
},
|
|
1204
|
-
t: CellValueType.STRING
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
};
|
|
1209
|
-
redos.push({
|
|
1210
|
-
id: SetRangeValuesMutation.id,
|
|
1211
|
-
params: setRangeParams
|
|
1212
|
-
});
|
|
1213
|
-
const undoParams = SetRangeValuesUndoMutationFactory(accessor, setRangeParams);
|
|
1214
|
-
undos.push({
|
|
1215
|
-
id: SetRangeValuesMutation.id,
|
|
1216
|
-
params: undoParams
|
|
1217
|
-
});
|
|
1218
|
-
const link = hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, column);
|
|
1219
|
-
return link && (redos.push({
|
|
1220
|
-
id: RemoveHyperLinkMutation.id,
|
|
1221
|
-
params: {
|
|
1222
|
-
unitId,
|
|
1223
|
-
subUnitId,
|
|
1224
|
-
id
|
|
1225
|
-
}
|
|
1226
|
-
}), undos.push({
|
|
1227
|
-
id: AddHyperLinkMutation.id,
|
|
1228
|
-
params: {
|
|
1229
|
-
unitId,
|
|
1230
|
-
subUnitId,
|
|
1231
|
-
link: {
|
|
1232
|
-
...link
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
})), sequenceExecute(redos, commandService).result ? (undoRedoService.pushUndoRedo({
|
|
1236
|
-
redoMutations: redos,
|
|
1237
|
-
undoMutations: undos,
|
|
1238
|
-
unitID: unitId
|
|
1239
|
-
}), !0) : !1;
|
|
1240
|
-
}
|
|
1241
|
-
}, CancelRichHyperLinkCommand = {
|
|
1242
|
-
type: CommandType.COMMAND,
|
|
1243
|
-
id: "sheets.command.cancel-rich-hyper-link",
|
|
1244
|
-
handler(accessor, params) {
|
|
1245
|
-
var _a15, _b;
|
|
1246
|
-
if (!params)
|
|
1247
|
-
return !1;
|
|
1248
|
-
const { id: linkId, documentId } = params, commandService = accessor.get(ICommandService), doc = accessor.get(IUniverInstanceService).getUnit(documentId, UniverInstanceType.UNIVER_DOC), link = (_b = (_a15 = doc == null ? void 0 : doc.getBody()) == null ? void 0 : _a15.customRanges) == null ? void 0 : _b.find((i) => i.rangeId === linkId);
|
|
1249
|
-
let insert = null;
|
|
1250
|
-
link && link.endIndex === doc.getBody().dataStream.length - 3 && (insert = {
|
|
1251
|
-
dataStream: " "
|
|
1252
|
-
});
|
|
1253
|
-
const doMutation = deleteCustomRangeFactory(accessor, { unitId: documentId, rangeId: linkId, insert });
|
|
1254
|
-
return doMutation ? commandService.syncExecuteCommand(doMutation.id, doMutation.params) : !1;
|
|
1255
|
-
}
|
|
1256
|
-
}, cellLink = "univer-cell-link", cellLinkType = "univer-cell-link-type", cellLinkContent = "univer-cell-link-content", cellLinkContentError = "univer-cell-link-content-error", cellLinkUrl = "univer-cell-link-url", cellLinkOperations = "univer-cell-link-operations", cellLinkOperation = "univer-cell-link-operation", cellLinkOperationError = "univer-cell-link-operation-error", styles = {
|
|
1257
|
-
cellLink,
|
|
1258
|
-
cellLinkType,
|
|
1259
|
-
cellLinkContent,
|
|
1260
|
-
cellLinkContentError,
|
|
1261
|
-
cellLinkUrl,
|
|
1262
|
-
cellLinkOperations,
|
|
1263
|
-
cellLinkOperation,
|
|
1264
|
-
cellLinkOperationError
|
|
1265
|
-
}, iconsMap = {
|
|
1266
|
-
[SheetHyperLinkType.URL]: /* @__PURE__ */ jsxRuntimeExports.jsx(LinkSingle, {}),
|
|
1267
|
-
[SheetHyperLinkType.SHEET]: /* @__PURE__ */ jsxRuntimeExports.jsx(Xlsx, {}),
|
|
1268
|
-
[SheetHyperLinkType.RANGE]: /* @__PURE__ */ jsxRuntimeExports.jsx(AllBorderSingle, {}),
|
|
1269
|
-
[SheetHyperLinkType.DEFINE_NAME]: /* @__PURE__ */ jsxRuntimeExports.jsx(AllBorderSingle, {}),
|
|
1270
|
-
[SheetHyperLinkType.INVALID]: /* @__PURE__ */ jsxRuntimeExports.jsx(AllBorderSingle, {})
|
|
1271
|
-
}, CellLinkPopup = /* @__PURE__ */ __name(() => {
|
|
1272
|
-
var _a15, _b;
|
|
1273
|
-
const popupService = useDependency(SheetsHyperLinkPopupService), commandService = useDependency(ICommandService), messageService = useDependency(IMessageService), localeService = useDependency(LocaleService), [currentPopup, setCurrentPopup] = useState(null), resolverService = useDependency(SheetsHyperLinkResolverService), editorBridgeService = useDependency(IEditorBridgeService), zenZoneService = useDependency(IZenZoneService);
|
|
1274
|
-
if (useObservable$1(zenZoneService.visible$), useEffect(() => {
|
|
1275
|
-
setCurrentPopup(popupService.currentPopup);
|
|
1276
|
-
const ob = popupService.currentPopup$.subscribe((popup) => {
|
|
1277
|
-
setCurrentPopup(popup);
|
|
1278
|
-
});
|
|
1279
|
-
return () => {
|
|
1280
|
-
ob.unsubscribe();
|
|
1281
|
-
};
|
|
1282
|
-
}, [popupService.currentPopup, popupService.currentPopup$]), !currentPopup)
|
|
1283
|
-
return null;
|
|
1284
|
-
const { unitId, subUnitId, customRange, row, col } = currentPopup;
|
|
1285
|
-
if (!((_a15 = customRange == null ? void 0 : customRange.properties) != null && _a15.url))
|
|
845
|
+
const Fi = "univer-cell-link", Wi = "univer-cell-link-type", Zi = "univer-cell-link-content", Gi = "univer-cell-link-content-error", Ki = "univer-cell-link-url", zi = "univer-cell-link-operations", Yi = "univer-cell-link-operation", Xi = "univer-cell-link-operation-error", W = {
|
|
846
|
+
cellLink: Fi,
|
|
847
|
+
cellLinkType: Wi,
|
|
848
|
+
cellLinkContent: Zi,
|
|
849
|
+
cellLinkContentError: Gi,
|
|
850
|
+
cellLinkUrl: Ki,
|
|
851
|
+
cellLinkOperations: zi,
|
|
852
|
+
cellLinkOperation: Yi,
|
|
853
|
+
cellLinkOperationError: Xi
|
|
854
|
+
}, qi = {
|
|
855
|
+
[S.URL]: /* @__PURE__ */ m.jsx(Ut, {}),
|
|
856
|
+
[S.SHEET]: /* @__PURE__ */ m.jsx(Bn, {}),
|
|
857
|
+
[S.RANGE]: /* @__PURE__ */ m.jsx(Ae, {}),
|
|
858
|
+
[S.DEFINE_NAME]: /* @__PURE__ */ m.jsx(Ae, {}),
|
|
859
|
+
[S.INVALID]: /* @__PURE__ */ m.jsx(Ae, {})
|
|
860
|
+
}, hn = (t) => {
|
|
861
|
+
var M, P;
|
|
862
|
+
const e = E(G), n = E(re), r = E(On), i = E(it), o = E(he), s = E(ne), c = E(wt), u = E(ct), { customRange: d, row: l, col: g, unitId: p, subUnitId: v, editPermission: C, copyPermission: _, type: b } = t;
|
|
863
|
+
if (!((M = d == null ? void 0 : d.properties) != null && M.url))
|
|
1286
864
|
return null;
|
|
1287
|
-
const
|
|
1288
|
-
return /* @__PURE__ */
|
|
1289
|
-
/* @__PURE__ */
|
|
865
|
+
const a = c.parseHyperLink((P = d.properties.url) != null ? P : ""), w = a.type === S.INVALID;
|
|
866
|
+
return /* @__PURE__ */ m.jsxs("div", { className: W.cellLink, onClick: () => e.hideCurrentPopup(), children: [
|
|
867
|
+
/* @__PURE__ */ m.jsxs(
|
|
1290
868
|
"div",
|
|
1291
869
|
{
|
|
1292
|
-
className:
|
|
1293
|
-
onClick:
|
|
1294
|
-
|
|
1295
|
-
},
|
|
870
|
+
className: pn(W.cellLinkContent, { [W.cellLinkContentError]: w }),
|
|
871
|
+
onClick: () => {
|
|
872
|
+
u.visible || w || o.navigate(a);
|
|
873
|
+
},
|
|
1296
874
|
children: [
|
|
1297
|
-
/* @__PURE__ */
|
|
1298
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__PURE__ */ m.jsx("div", { className: W.cellLinkType, children: qi[a.type] }),
|
|
876
|
+
/* @__PURE__ */ m.jsx($e, { showIfEllipsis: !0, title: a.name, children: /* @__PURE__ */ m.jsx("span", { className: W.cellLinkUrl, children: a.name }) })
|
|
1299
877
|
]
|
|
1300
878
|
}
|
|
1301
879
|
),
|
|
1302
|
-
/* @__PURE__ */
|
|
1303
|
-
|
|
880
|
+
/* @__PURE__ */ m.jsxs("div", { className: W.cellLinkOperations, children: [
|
|
881
|
+
_ && /* @__PURE__ */ m.jsx(
|
|
1304
882
|
"div",
|
|
1305
883
|
{
|
|
1306
|
-
className:
|
|
1307
|
-
onClick:
|
|
1308
|
-
if (!
|
|
1309
|
-
if (
|
|
1310
|
-
const
|
|
1311
|
-
|
|
884
|
+
className: pn(W.cellLinkOperation, { [W.cellLinkOperationError]: w }),
|
|
885
|
+
onClick: () => {
|
|
886
|
+
if (!w) {
|
|
887
|
+
if (a.type !== S.URL) {
|
|
888
|
+
const k = new URL(window.location.href);
|
|
889
|
+
k.hash = a.url.slice(1), navigator.clipboard.writeText(k.href);
|
|
1312
890
|
} else
|
|
1313
|
-
navigator.clipboard.writeText(
|
|
1314
|
-
|
|
1315
|
-
content:
|
|
1316
|
-
type:
|
|
891
|
+
navigator.clipboard.writeText(a.url);
|
|
892
|
+
r.show({
|
|
893
|
+
content: i.t("hyperLink.message.coped"),
|
|
894
|
+
type: ke.Info
|
|
1317
895
|
});
|
|
1318
896
|
}
|
|
1319
|
-
},
|
|
1320
|
-
children: /* @__PURE__ */
|
|
897
|
+
},
|
|
898
|
+
children: /* @__PURE__ */ m.jsx($e, { placement: "bottom", title: i.t("hyperLink.popup.copy"), children: /* @__PURE__ */ m.jsx($n, {}) })
|
|
1321
899
|
}
|
|
1322
900
|
),
|
|
1323
|
-
|
|
1324
|
-
/* @__PURE__ */
|
|
901
|
+
C && /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
|
|
902
|
+
/* @__PURE__ */ m.jsx(
|
|
1325
903
|
"div",
|
|
1326
904
|
{
|
|
1327
|
-
className:
|
|
1328
|
-
onClick:
|
|
1329
|
-
|
|
1330
|
-
unitId,
|
|
1331
|
-
subUnitId,
|
|
1332
|
-
row,
|
|
1333
|
-
col,
|
|
1334
|
-
customRangeId:
|
|
1335
|
-
type:
|
|
905
|
+
className: W.cellLinkOperation,
|
|
906
|
+
onClick: () => {
|
|
907
|
+
n.executeCommand(Dt.id, {
|
|
908
|
+
unitId: p,
|
|
909
|
+
subUnitId: v,
|
|
910
|
+
row: l,
|
|
911
|
+
col: g,
|
|
912
|
+
customRangeId: d.rangeId,
|
|
913
|
+
type: b
|
|
1336
914
|
});
|
|
1337
|
-
},
|
|
1338
|
-
children: /* @__PURE__ */
|
|
915
|
+
},
|
|
916
|
+
children: /* @__PURE__ */ m.jsx($e, { placement: "bottom", title: i.t("hyperLink.popup.edit"), children: /* @__PURE__ */ m.jsx(Vn, {}) })
|
|
1339
917
|
}
|
|
1340
918
|
),
|
|
1341
|
-
/* @__PURE__ */
|
|
919
|
+
/* @__PURE__ */ m.jsx(
|
|
1342
920
|
"div",
|
|
1343
921
|
{
|
|
1344
|
-
className:
|
|
1345
|
-
onClick:
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1348
|
-
unitId,
|
|
1349
|
-
subUnitId,
|
|
1350
|
-
id:
|
|
1351
|
-
row,
|
|
1352
|
-
column:
|
|
1353
|
-
documentId:
|
|
1354
|
-
}) &&
|
|
1355
|
-
},
|
|
1356
|
-
children: /* @__PURE__ */
|
|
922
|
+
className: W.cellLinkOperation,
|
|
923
|
+
onClick: () => {
|
|
924
|
+
const k = b === f.EDITING || b === f.ZEN_EDITOR ? vr.id : _r.id;
|
|
925
|
+
n.syncExecuteCommand(k, {
|
|
926
|
+
unitId: p,
|
|
927
|
+
subUnitId: v,
|
|
928
|
+
id: d.rangeId,
|
|
929
|
+
row: l,
|
|
930
|
+
column: g,
|
|
931
|
+
documentId: b === f.ZEN_EDITOR ? x : s.getCurrentEditorId()
|
|
932
|
+
}) && e.hideCurrentPopup(void 0, !0);
|
|
933
|
+
},
|
|
934
|
+
children: /* @__PURE__ */ m.jsx($e, { placement: "bottom", title: i.t("hyperLink.popup.cancel"), children: /* @__PURE__ */ m.jsx(jn, {}) })
|
|
1357
935
|
}
|
|
1358
936
|
)
|
|
1359
937
|
] })
|
|
1360
938
|
] })
|
|
1361
939
|
] });
|
|
1362
|
-
},
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
(
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
940
|
+
}, Ge = () => {
|
|
941
|
+
var i, o;
|
|
942
|
+
const t = E(G), [e, n] = X(null), r = E(K);
|
|
943
|
+
if (te(() => {
|
|
944
|
+
n(t.currentPopup);
|
|
945
|
+
const s = t.currentPopup$.subscribe((c) => {
|
|
946
|
+
n(c);
|
|
947
|
+
});
|
|
948
|
+
return () => {
|
|
949
|
+
s.unsubscribe();
|
|
950
|
+
};
|
|
951
|
+
}, [t.currentPopup, t.currentPopup$]), !e)
|
|
952
|
+
return null;
|
|
953
|
+
if (e.showAll) {
|
|
954
|
+
const s = r.getUnit(e.unitId, O.UNIVER_SHEET), c = s == null ? void 0 : s.getSheetBySheetId(e.subUnitId), u = c == null ? void 0 : c.getCell(e.row, e.col), d = (o = (i = u == null ? void 0 : u.p) == null ? void 0 : i.body) == null ? void 0 : o.customRanges;
|
|
955
|
+
return d != null && d.length ? /* @__PURE__ */ m.jsx("div", { children: d.map((l) => /* @__PURE__ */ m.jsx(hn, { ...e, customRange: l }, l.rangeId)) }) : null;
|
|
956
|
+
}
|
|
957
|
+
return /* @__PURE__ */ m.jsx(hn, { ...e });
|
|
958
|
+
};
|
|
959
|
+
Ge.componentKey = "univer.sheet.cell-link-popup";
|
|
960
|
+
var Ji = Object.defineProperty, Qi = Object.getOwnPropertyDescriptor, es = (t, e, n, r) => {
|
|
961
|
+
for (var i = r > 1 ? void 0 : r ? Qi(e, n) : e, o = t.length - 1, s; o >= 0; o--)
|
|
962
|
+
(s = t[o]) && (i = (r ? s(e, n, i) : s(i)) || i);
|
|
963
|
+
return r && i && Ji(e, n, i), i;
|
|
964
|
+
}, ce = (t, e) => (n, r) => e(n, r, t);
|
|
965
|
+
const gn = (t, e) => {
|
|
966
|
+
var n, r;
|
|
967
|
+
return t.unitId === e.unitId && t.subUnitId === e.subUnitId && t.row === e.row && t.col === e.col && ((n = t.customRange) == null ? void 0 : n.rangeId) === ((r = e.customRange) == null ? void 0 : r.rangeId) && t.type === e.type;
|
|
968
|
+
};
|
|
969
|
+
let G = class extends z {
|
|
970
|
+
constructor(e, n, r, i, o, s, c) {
|
|
1376
971
|
super();
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
this._sheetCanvasPopManagerService =
|
|
972
|
+
V(this, "_currentPopup", null);
|
|
973
|
+
V(this, "_currentPopup$", new oi());
|
|
974
|
+
V(this, "currentPopup$", this._currentPopup$.asObservable());
|
|
975
|
+
V(this, "_currentEditingPopup", null);
|
|
976
|
+
V(this, "_currentEditing$", new ai(null));
|
|
977
|
+
V(this, "currentEditing$", this._currentEditing$.asObservable());
|
|
978
|
+
V(this, "_isKeepVisible", !1);
|
|
979
|
+
this._sheetCanvasPopManagerService = e, this._injector = n, this._univerInstanceService = r, this._editorBridgeService = i, this._textSelectionManagerService = o, this._docCanvasPopManagerService = s, this._zenZoneService = c, this.disposeWithMe(() => {
|
|
1385
980
|
this.hideCurrentPopup(), this.endEditing(), this._currentEditing$.complete(), this._currentPopup$.complete();
|
|
1386
981
|
});
|
|
1387
982
|
}
|
|
@@ -1391,1177 +986,902 @@ let SheetsHyperLinkPopupService = (_a3 = class extends Disposable {
|
|
|
1391
986
|
get currentEditing() {
|
|
1392
987
|
return this._currentEditing$.getValue();
|
|
1393
988
|
}
|
|
1394
|
-
setIsKeepVisible(
|
|
1395
|
-
this._isKeepVisible =
|
|
989
|
+
setIsKeepVisible(e) {
|
|
990
|
+
this._isKeepVisible = e;
|
|
1396
991
|
}
|
|
1397
992
|
getIsKeepVisible() {
|
|
1398
993
|
return this._isKeepVisible;
|
|
1399
994
|
}
|
|
1400
|
-
showPopup(
|
|
1401
|
-
if (this._currentPopup &&
|
|
995
|
+
showPopup(e) {
|
|
996
|
+
if (this._currentPopup && gn(e, this._currentPopup) || (this.hideCurrentPopup(void 0, !0), e.type !== f.ZEN_EDITOR && this._zenZoneService.visible))
|
|
1402
997
|
return;
|
|
1403
|
-
const
|
|
1404
|
-
if (
|
|
998
|
+
const n = this._currentEditing$.getValue();
|
|
999
|
+
if (n && gn(e, n))
|
|
1405
1000
|
return;
|
|
1406
|
-
const { unitId, subUnitId, row, col, customRangeRect, customRange } =
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
const popup = {
|
|
1411
|
-
componentKey: CellLinkPopup.componentKey,
|
|
1001
|
+
const { unitId: r, subUnitId: i, row: o, col: s, customRangeRect: c, customRange: u } = e;
|
|
1002
|
+
let d;
|
|
1003
|
+
const l = {
|
|
1004
|
+
componentKey: Ge.componentKey,
|
|
1412
1005
|
direction: "bottom",
|
|
1413
|
-
onClickOutside:
|
|
1006
|
+
onClickOutside: () => {
|
|
1414
1007
|
this.hideCurrentPopup();
|
|
1415
|
-
}, "onClickOutside"),
|
|
1416
|
-
onClick: /* @__PURE__ */ __name(() => {
|
|
1417
|
-
this.hideCurrentPopup(location2.type, !0);
|
|
1418
|
-
}, "onClick")
|
|
1419
|
-
};
|
|
1420
|
-
location2.type === HyperLinkEditSourceType.EDITING ? disposable = customRangeRect && this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(
|
|
1421
|
-
customRangeRect,
|
|
1422
|
-
popup
|
|
1423
|
-
) : location2.type === HyperLinkEditSourceType.ZEN_EDITOR ? disposable = this._docCanvasPopManagerService.attachPopupToRange(
|
|
1424
|
-
{
|
|
1425
|
-
startOffset: customRange.startIndex,
|
|
1426
|
-
endOffset: customRange.endIndex + 1,
|
|
1427
|
-
collapsed: !1
|
|
1428
1008
|
},
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1009
|
+
onClick: () => {
|
|
1010
|
+
this.hideCurrentPopup(e.type, !0);
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
if (e.type === f.EDITING) {
|
|
1014
|
+
if (!u)
|
|
1015
|
+
return;
|
|
1016
|
+
d = c && this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(
|
|
1017
|
+
c,
|
|
1018
|
+
l
|
|
1019
|
+
);
|
|
1020
|
+
} else if (e.type === f.ZEN_EDITOR) {
|
|
1021
|
+
if (!u)
|
|
1022
|
+
return;
|
|
1023
|
+
d = this._docCanvasPopManagerService.attachPopupToRange(
|
|
1024
|
+
{
|
|
1025
|
+
startOffset: u.startIndex,
|
|
1026
|
+
endOffset: u.endIndex + 1,
|
|
1027
|
+
collapsed: !1
|
|
1028
|
+
},
|
|
1029
|
+
l,
|
|
1030
|
+
x
|
|
1031
|
+
);
|
|
1032
|
+
} else if (e.showAll)
|
|
1033
|
+
d = this._sheetCanvasPopManagerService.attachPopupToCell(e.row, e.col, l, r, i);
|
|
1034
|
+
else {
|
|
1035
|
+
if (!u)
|
|
1036
|
+
return;
|
|
1037
|
+
d = c && this._sheetCanvasPopManagerService.attachPopupByPosition(
|
|
1038
|
+
c,
|
|
1039
|
+
l,
|
|
1040
|
+
e
|
|
1041
|
+
);
|
|
1042
|
+
}
|
|
1043
|
+
d && (this._currentPopup = {
|
|
1044
|
+
unitId: r,
|
|
1045
|
+
subUnitId: i,
|
|
1046
|
+
disposable: d,
|
|
1047
|
+
row: o,
|
|
1048
|
+
col: s,
|
|
1049
|
+
editPermission: !!e.editPermission,
|
|
1050
|
+
copyPermission: !!e.copyPermission,
|
|
1051
|
+
customRange: u,
|
|
1052
|
+
type: e.type,
|
|
1053
|
+
showAll: e.showAll
|
|
1444
1054
|
}, this._currentPopup$.next(this._currentPopup));
|
|
1445
1055
|
}
|
|
1446
|
-
hideCurrentPopup(
|
|
1447
|
-
var
|
|
1448
|
-
this._currentPopup && ((!
|
|
1056
|
+
hideCurrentPopup(e, n) {
|
|
1057
|
+
var r, i;
|
|
1058
|
+
this._currentPopup && ((!e || e === this._currentPopup.type) && this._currentPopup.disposable.canDispose() || n) && ((i = (r = this._currentPopup) == null ? void 0 : r.disposable) == null || i.dispose(), this._currentPopup = null, this._currentPopup$.next(null));
|
|
1449
1059
|
}
|
|
1450
1060
|
_getEditingRange() {
|
|
1451
|
-
var
|
|
1452
|
-
const
|
|
1453
|
-
if (
|
|
1454
|
-
const
|
|
1455
|
-
if (!
|
|
1061
|
+
var r, i, o;
|
|
1062
|
+
const e = this._editorBridgeService.isVisible().visible, n = this._editorBridgeService.getEditCellState();
|
|
1063
|
+
if (e && n) {
|
|
1064
|
+
const s = this._textSelectionManagerService.getActiveTextRange(), c = (r = n.documentLayoutObject.documentModel) == null ? void 0 : r.getBody();
|
|
1065
|
+
if (!c)
|
|
1456
1066
|
return null;
|
|
1457
|
-
if (!
|
|
1067
|
+
if (!s || s.collapsed)
|
|
1458
1068
|
return {
|
|
1459
1069
|
startOffset: 0,
|
|
1460
|
-
endOffset:
|
|
1461
|
-
collapsed:
|
|
1462
|
-
label:
|
|
1070
|
+
endOffset: c.dataStream.length - 2,
|
|
1071
|
+
collapsed: c.dataStream.length - 2 === 0,
|
|
1072
|
+
label: de.transform.getPlainText(c.dataStream)
|
|
1463
1073
|
};
|
|
1464
|
-
const
|
|
1465
|
-
let
|
|
1466
|
-
return
|
|
1467
|
-
|
|
1074
|
+
const u = de.customRange.getCustomRangesInterestsWithSelection(s, (o = (i = c.customRanges) == null ? void 0 : i.filter((g) => g.rangeType === Me.HYPERLINK)) != null ? o : []);
|
|
1075
|
+
let d = s.startOffset, l = s.endOffset;
|
|
1076
|
+
return u.forEach((g) => {
|
|
1077
|
+
d = Math.min(d, g.startIndex), l = Math.max(l, g.endIndex + 1);
|
|
1468
1078
|
}), {
|
|
1469
|
-
startOffset:
|
|
1470
|
-
endOffset:
|
|
1471
|
-
collapsed:
|
|
1472
|
-
label:
|
|
1079
|
+
startOffset: d,
|
|
1080
|
+
endOffset: l,
|
|
1081
|
+
collapsed: d === l,
|
|
1082
|
+
label: de.transform.getPlainText(c.dataStream.slice(d, l))
|
|
1473
1083
|
};
|
|
1474
1084
|
}
|
|
1475
1085
|
return null;
|
|
1476
1086
|
}
|
|
1477
1087
|
get _editPopup() {
|
|
1478
1088
|
return {
|
|
1479
|
-
componentKey:
|
|
1089
|
+
componentKey: Ze.componentKey,
|
|
1480
1090
|
direction: "bottom",
|
|
1481
|
-
onClickOutside:
|
|
1091
|
+
onClickOutside: () => {
|
|
1482
1092
|
this.getIsKeepVisible() || this.endEditing();
|
|
1483
|
-
},
|
|
1484
|
-
onContextMenu:
|
|
1093
|
+
},
|
|
1094
|
+
onContextMenu: () => {
|
|
1485
1095
|
this.getIsKeepVisible() || this.endEditing();
|
|
1486
|
-
},
|
|
1096
|
+
},
|
|
1487
1097
|
hiddenType: "hide"
|
|
1488
1098
|
};
|
|
1489
1099
|
}
|
|
1490
|
-
startAddEditing(
|
|
1491
|
-
var
|
|
1492
|
-
const { unitId, subUnitId, type } =
|
|
1493
|
-
if (
|
|
1494
|
-
const
|
|
1495
|
-
if (!
|
|
1100
|
+
startAddEditing(e) {
|
|
1101
|
+
var o, s, c, u, d;
|
|
1102
|
+
const { unitId: n, subUnitId: r, type: i } = e;
|
|
1103
|
+
if (i === f.ZEN_EDITOR) {
|
|
1104
|
+
const l = this._univerInstanceService.getUnit(x, O.UNIVER_DOC);
|
|
1105
|
+
if (!l)
|
|
1496
1106
|
return;
|
|
1497
|
-
const
|
|
1498
|
-
if (!
|
|
1107
|
+
const g = this._textSelectionManagerService.getActiveTextRange();
|
|
1108
|
+
if (!g)
|
|
1499
1109
|
return;
|
|
1500
1110
|
this._currentEditingPopup = this._docCanvasPopManagerService.attachPopupToRange(
|
|
1501
|
-
|
|
1111
|
+
g,
|
|
1502
1112
|
this._editPopup,
|
|
1503
|
-
|
|
1113
|
+
x
|
|
1504
1114
|
);
|
|
1505
|
-
const
|
|
1115
|
+
const p = (o = l.getBody()) == null ? void 0 : o.dataStream.slice(g.startOffset, g.endOffset);
|
|
1506
1116
|
this._currentEditing$.next({
|
|
1507
|
-
...
|
|
1508
|
-
label
|
|
1117
|
+
...e,
|
|
1118
|
+
label: p
|
|
1509
1119
|
});
|
|
1510
|
-
} else if (
|
|
1511
|
-
const
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1120
|
+
} else if (i === f.EDITING) {
|
|
1121
|
+
const l = this._getEditingRange();
|
|
1122
|
+
l && this._textSelectionManagerService.replaceTextRanges([{ ...l }]), this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupToCell(
|
|
1123
|
+
e.row,
|
|
1124
|
+
e.col,
|
|
1515
1125
|
this._editPopup,
|
|
1516
|
-
|
|
1517
|
-
|
|
1126
|
+
n,
|
|
1127
|
+
r
|
|
1518
1128
|
), this._currentEditing$.next({
|
|
1519
|
-
...
|
|
1520
|
-
label: (
|
|
1129
|
+
...e,
|
|
1130
|
+
label: (s = l == null ? void 0 : l.label) != null ? s : ""
|
|
1521
1131
|
});
|
|
1522
1132
|
} else {
|
|
1523
1133
|
this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupToCell(
|
|
1524
|
-
|
|
1525
|
-
|
|
1134
|
+
e.row,
|
|
1135
|
+
e.col,
|
|
1526
1136
|
this._editPopup,
|
|
1527
|
-
|
|
1528
|
-
|
|
1137
|
+
n,
|
|
1138
|
+
r
|
|
1529
1139
|
);
|
|
1530
|
-
const
|
|
1140
|
+
const l = this._univerInstanceService.getUnit(n, O.UNIVER_SHEET), g = l == null ? void 0 : l.getSheetBySheetId(r), p = g == null ? void 0 : g.getCellRaw(e.row, e.col);
|
|
1531
1141
|
this._currentEditing$.next({
|
|
1532
|
-
...
|
|
1533
|
-
label:
|
|
1142
|
+
...e,
|
|
1143
|
+
label: p != null && p.p ? de.transform.getPlainText((u = (c = p.p.body) == null ? void 0 : c.dataStream) != null ? u : "") : ((d = p == null ? void 0 : p.v) != null ? d : "").toString()
|
|
1534
1144
|
});
|
|
1535
1145
|
}
|
|
1536
1146
|
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1147
|
+
// eslint-disable-next-line complexity, max-lines-per-function
|
|
1148
|
+
startEditing(e) {
|
|
1149
|
+
var s, c, u, d, l, g;
|
|
1150
|
+
(s = this._currentEditingPopup) == null || s.dispose(), this.hideCurrentPopup(void 0, !0);
|
|
1151
|
+
const { unitId: n, subUnitId: r } = e;
|
|
1152
|
+
let i, o;
|
|
1153
|
+
if (e.type === f.ZEN_EDITOR) {
|
|
1154
|
+
const p = this._univerInstanceService.getUnit(x, O.UNIVER_DOC);
|
|
1155
|
+
if (i = (u = (c = p == null ? void 0 : p.getBody()) == null ? void 0 : c.customRanges) == null ? void 0 : u.find((v) => v.rangeId === e.customRangeId), o = i ? (d = p == null ? void 0 : p.getBody()) == null ? void 0 : d.dataStream.slice(i.startIndex, i.endIndex + 1) : "", !i || !o)
|
|
1545
1156
|
return;
|
|
1546
1157
|
this._textSelectionManagerService.replaceTextRanges([
|
|
1547
1158
|
{
|
|
1548
|
-
startOffset:
|
|
1549
|
-
endOffset:
|
|
1159
|
+
startOffset: i.startIndex,
|
|
1160
|
+
endOffset: i.endIndex + 1
|
|
1550
1161
|
}
|
|
1551
1162
|
]), this._currentEditingPopup = this._docCanvasPopManagerService.attachPopupToRange(
|
|
1552
1163
|
{
|
|
1553
|
-
startOffset:
|
|
1554
|
-
endOffset:
|
|
1164
|
+
startOffset: i.startIndex,
|
|
1165
|
+
endOffset: i.endIndex,
|
|
1555
1166
|
collapsed: !1
|
|
1556
1167
|
},
|
|
1557
1168
|
this._editPopup,
|
|
1558
|
-
|
|
1169
|
+
x
|
|
1559
1170
|
);
|
|
1560
|
-
} else if (
|
|
1561
|
-
const
|
|
1562
|
-
if (!
|
|
1171
|
+
} else if (e.type === f.EDITING) {
|
|
1172
|
+
const p = Lr(this._injector, e.unitId, e.subUnitId, e.row, e.col, e.customRangeId);
|
|
1173
|
+
if (!p || !((l = p.rects) != null && l.length))
|
|
1563
1174
|
return;
|
|
1564
|
-
|
|
1175
|
+
i = p.customRange, o = p.label, this._textSelectionManagerService.replaceTextRanges([
|
|
1565
1176
|
{
|
|
1566
|
-
startOffset:
|
|
1567
|
-
endOffset:
|
|
1177
|
+
startOffset: i.startIndex,
|
|
1178
|
+
endOffset: i.endIndex + 1
|
|
1568
1179
|
}
|
|
1569
1180
|
]), this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(
|
|
1570
|
-
|
|
1181
|
+
p.rects.pop(),
|
|
1571
1182
|
this._editPopup,
|
|
1572
|
-
|
|
1573
|
-
|
|
1183
|
+
n,
|
|
1184
|
+
r
|
|
1574
1185
|
);
|
|
1575
1186
|
} else {
|
|
1576
|
-
const
|
|
1577
|
-
if (!
|
|
1187
|
+
const p = this._univerInstanceService.getUnit(n, O.UNIVER_SHEET), v = p == null ? void 0 : p.getSheetBySheetId(r), C = v == null ? void 0 : v.getCellRaw(e.row, e.col), _ = p == null ? void 0 : p.getStyles().getStyleByCell(C), b = _ == null ? void 0 : _.tr, a = br(this._injector, e.unitId, e.subUnitId, e.row, e.col, e.customRangeId);
|
|
1188
|
+
if (!a || !((g = a.rects) != null && g.length))
|
|
1578
1189
|
return;
|
|
1579
|
-
|
|
1580
|
-
|
|
1190
|
+
i = a.customRange, o = a.label, b ? this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupToCell(
|
|
1191
|
+
e.row,
|
|
1192
|
+
e.col,
|
|
1193
|
+
this._editPopup,
|
|
1194
|
+
n,
|
|
1195
|
+
r
|
|
1196
|
+
) : this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupByPosition(
|
|
1197
|
+
a.rects.pop(),
|
|
1581
1198
|
this._editPopup,
|
|
1582
|
-
|
|
1583
|
-
|
|
1199
|
+
{
|
|
1200
|
+
unitId: n,
|
|
1201
|
+
subUnitId: r,
|
|
1202
|
+
row: e.row,
|
|
1203
|
+
col: e.col
|
|
1204
|
+
}
|
|
1584
1205
|
);
|
|
1585
1206
|
}
|
|
1586
1207
|
this._currentEditing$.next({
|
|
1587
|
-
...
|
|
1588
|
-
customRange,
|
|
1589
|
-
label
|
|
1208
|
+
...e,
|
|
1209
|
+
customRange: i,
|
|
1210
|
+
label: o
|
|
1590
1211
|
});
|
|
1591
1212
|
}
|
|
1592
|
-
endEditing(
|
|
1593
|
-
var
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
const cell = worksheet.getCell(row, col);
|
|
1611
|
-
if (cell != null && cell.f || cell != null && cell.si)
|
|
1213
|
+
endEditing(e) {
|
|
1214
|
+
var r;
|
|
1215
|
+
const n = this._currentEditing$.getValue();
|
|
1216
|
+
n && (!e || e === n.type) && ((r = this._currentEditingPopup) == null || r.dispose(), this._currentEditing$.next(null));
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
G = es([
|
|
1220
|
+
ce(0, R(Pr)),
|
|
1221
|
+
ce(1, R(st)),
|
|
1222
|
+
ce(2, K),
|
|
1223
|
+
ce(3, ne),
|
|
1224
|
+
ce(4, R(Ue)),
|
|
1225
|
+
ce(5, R(ii)),
|
|
1226
|
+
ce(6, ct)
|
|
1227
|
+
], G);
|
|
1228
|
+
const Ht = (t, e, n) => {
|
|
1229
|
+
const r = t.getCell(e, n);
|
|
1230
|
+
if (r != null && r.f || r != null && r.si)
|
|
1612
1231
|
return !0;
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1232
|
+
const i = [
|
|
1233
|
+
St.CHECKBOX,
|
|
1234
|
+
St.LIST,
|
|
1235
|
+
St.LIST_MULTIPLE
|
|
1617
1236
|
];
|
|
1618
|
-
return !!(
|
|
1619
|
-
},
|
|
1620
|
-
const
|
|
1621
|
-
if (!
|
|
1237
|
+
return !!(r != null && r.dataValidation && i.includes(r.dataValidation.rule.type));
|
|
1238
|
+
}, ts = (t) => {
|
|
1239
|
+
const e = t.get(K).getCurrentUnitForType(O.UNIVER_SHEET);
|
|
1240
|
+
if (!e)
|
|
1622
1241
|
return !0;
|
|
1623
|
-
const
|
|
1624
|
-
if (!
|
|
1242
|
+
const n = e.getActiveSheet(), r = t.get(Ot).getCurrentSelections();
|
|
1243
|
+
if (!r.length)
|
|
1625
1244
|
return !0;
|
|
1626
|
-
const
|
|
1627
|
-
return
|
|
1628
|
-
},
|
|
1629
|
-
var
|
|
1630
|
-
const
|
|
1631
|
-
if (!
|
|
1245
|
+
const i = r[0].range.startRow, o = r[0].range.startColumn;
|
|
1246
|
+
return Ht(n, i, o);
|
|
1247
|
+
}, ns = (t) => {
|
|
1248
|
+
var d, l;
|
|
1249
|
+
const e = t.get(Ue), n = t.get(K), r = e.getDocRanges();
|
|
1250
|
+
if (!r.length || r.length > 1)
|
|
1632
1251
|
return !0;
|
|
1633
|
-
const
|
|
1634
|
-
if (!
|
|
1252
|
+
const i = r[0], o = n.getCurrentUnitForType(O.UNIVER_DOC);
|
|
1253
|
+
if (!o || !i || i.collapsed)
|
|
1635
1254
|
return !0;
|
|
1636
|
-
const
|
|
1637
|
-
if (!
|
|
1255
|
+
const s = o.getSelfOrHeaderFooterModel(i.segmentId).getBody();
|
|
1256
|
+
if (!s)
|
|
1638
1257
|
return !0;
|
|
1639
|
-
const
|
|
1640
|
-
for (let
|
|
1641
|
-
const
|
|
1642
|
-
if (
|
|
1258
|
+
const c = (d = s == null ? void 0 : s.paragraphs) != null ? d : [];
|
|
1259
|
+
for (let g = 0, p = c.length; g < p; g++) {
|
|
1260
|
+
const v = c[g];
|
|
1261
|
+
if (i.startOffset <= v.startIndex && i.endOffset > v.startIndex)
|
|
1643
1262
|
return !0;
|
|
1644
|
-
if (
|
|
1263
|
+
if (v.startIndex > i.endOffset)
|
|
1645
1264
|
break;
|
|
1646
1265
|
}
|
|
1647
|
-
return !
|
|
1648
|
-
},
|
|
1649
|
-
type:
|
|
1266
|
+
return !de.customRange.getCustomRangesInterestsWithSelection(i, (l = s.customRanges) != null ? l : []).every((g) => g.rangeType === Me.HYPERLINK);
|
|
1267
|
+
}, Dt = {
|
|
1268
|
+
type: ot.OPERATION,
|
|
1650
1269
|
id: "sheet.operation.open-hyper-link-edit-panel",
|
|
1651
|
-
handler(
|
|
1652
|
-
if (!
|
|
1270
|
+
handler(t, e) {
|
|
1271
|
+
if (!e)
|
|
1653
1272
|
return !1;
|
|
1654
|
-
const
|
|
1655
|
-
return
|
|
1273
|
+
const n = t.get(G);
|
|
1274
|
+
return e.customRangeId ? n.startEditing(e) : n.startAddEditing(e), !0;
|
|
1656
1275
|
}
|
|
1657
|
-
},
|
|
1658
|
-
type:
|
|
1276
|
+
}, Ke = {
|
|
1277
|
+
type: ot.OPERATION,
|
|
1659
1278
|
id: "sheet.operation.close-hyper-link-popup",
|
|
1660
|
-
handler(
|
|
1661
|
-
return
|
|
1279
|
+
handler(t) {
|
|
1280
|
+
return t.get(G).endEditing(), !0;
|
|
1662
1281
|
}
|
|
1663
|
-
},
|
|
1664
|
-
type:
|
|
1282
|
+
}, $t = {
|
|
1283
|
+
type: ot.OPERATION,
|
|
1665
1284
|
id: "sheet.operation.insert-hyper-link",
|
|
1666
|
-
handler(
|
|
1667
|
-
var
|
|
1668
|
-
const
|
|
1669
|
-
if (!
|
|
1285
|
+
handler(t) {
|
|
1286
|
+
var g;
|
|
1287
|
+
const e = t.get(K), n = bn(e), r = t.get(ne);
|
|
1288
|
+
if (!n)
|
|
1670
1289
|
return !1;
|
|
1671
|
-
const
|
|
1672
|
-
if (!
|
|
1290
|
+
const i = t.get(re), s = t.get(Ot).getCurrentLastSelection();
|
|
1291
|
+
if (!s)
|
|
1673
1292
|
return !1;
|
|
1674
|
-
const
|
|
1675
|
-
return
|
|
1676
|
-
unitId:
|
|
1677
|
-
subUnitId:
|
|
1678
|
-
row,
|
|
1679
|
-
col,
|
|
1680
|
-
type:
|
|
1293
|
+
const c = s.range.startRow, u = s.range.startColumn, d = r.isVisible(), l = ((g = e.getFocusedUnit()) == null ? void 0 : g.getUnitId()) === x;
|
|
1294
|
+
return i.executeCommand(Dt.id, {
|
|
1295
|
+
unitId: n.unitId,
|
|
1296
|
+
subUnitId: n.subUnitId,
|
|
1297
|
+
row: c,
|
|
1298
|
+
col: u,
|
|
1299
|
+
type: l ? f.ZEN_EDITOR : d.visible ? f.EDITING : f.VIEWING
|
|
1681
1300
|
});
|
|
1682
1301
|
}
|
|
1683
|
-
},
|
|
1684
|
-
type:
|
|
1302
|
+
}, pe = {
|
|
1303
|
+
type: ot.OPERATION,
|
|
1685
1304
|
id: "sheet.operation.insert-hyper-link-toolbar",
|
|
1686
|
-
handler(
|
|
1687
|
-
if (
|
|
1305
|
+
handler(t) {
|
|
1306
|
+
if (ts(t))
|
|
1688
1307
|
return !1;
|
|
1689
|
-
const
|
|
1690
|
-
return
|
|
1691
|
-
}
|
|
1692
|
-
},
|
|
1693
|
-
var
|
|
1694
|
-
const
|
|
1695
|
-
return
|
|
1696
|
-
const
|
|
1697
|
-
if (!
|
|
1308
|
+
const e = t.get(re);
|
|
1309
|
+
return t.get(G).currentEditing ? e.executeCommand(Ke.id) : e.executeCommand($t.id);
|
|
1310
|
+
}
|
|
1311
|
+
}, jt = (t, e = x) => {
|
|
1312
|
+
var i;
|
|
1313
|
+
const n = t.get(K), r = (i = t.get(ut).getRenderById(e)) == null ? void 0 : i.with(xn);
|
|
1314
|
+
return r ? r.textSelectionInner$.pipe(le(() => {
|
|
1315
|
+
const s = t.get(ne).getEditCellState();
|
|
1316
|
+
if (!s)
|
|
1698
1317
|
return !0;
|
|
1699
|
-
const
|
|
1700
|
-
return !(
|
|
1701
|
-
})) :
|
|
1702
|
-
},
|
|
1703
|
-
const
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
if (!
|
|
1318
|
+
const c = bn(n, { unitId: s.unitId, subUnitId: s.sheetId });
|
|
1319
|
+
return !(c != null && c.worksheet) || Ht(c.worksheet, s.row, s.column) ? !0 : ns(t);
|
|
1320
|
+
})) : Te(!0);
|
|
1321
|
+
}, Fn = (t) => {
|
|
1322
|
+
const e = Or(t, { workbookTypes: [kt], worksheetTypes: [Tt, wn, xt], rangeTypes: [Nt] }, !0), n = t.get(K), r = t.get(Ot), i = t.has(ne) ? t.get(ne) : null, o = n.focused$.pipe(
|
|
1323
|
+
ln((s) => !!s),
|
|
1324
|
+
le((s) => n.getUnit(s, O.UNIVER_SHEET)),
|
|
1325
|
+
ln((s) => !!s),
|
|
1326
|
+
ue((s) => s.activeSheet$),
|
|
1327
|
+
ue((s) => r.selectionMoveEnd$.pipe(le((c) => s && { selections: c, sheet: s }))),
|
|
1328
|
+
le((s) => {
|
|
1329
|
+
if (!s)
|
|
1711
1330
|
return !0;
|
|
1712
|
-
const { selections, sheet } =
|
|
1713
|
-
if (!
|
|
1331
|
+
const { selections: c, sheet: u } = s;
|
|
1332
|
+
if (!c.length)
|
|
1714
1333
|
return !0;
|
|
1715
|
-
const
|
|
1716
|
-
if (
|
|
1334
|
+
const d = c[0].range.startRow, l = c[0].range.startColumn;
|
|
1335
|
+
if (Ht(u, d, l))
|
|
1717
1336
|
return !0;
|
|
1718
1337
|
}),
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
)
|
|
1723
|
-
|
|
1338
|
+
ue((s) => {
|
|
1339
|
+
if (s)
|
|
1340
|
+
return Te(!0);
|
|
1341
|
+
const c = (i ? i.visible$ : Te(null)).pipe(le((d) => d != null && d.visible ? yt : void 0)), u = t.get(In).subscribeContextValue$(ar);
|
|
1342
|
+
return ci([c, u]).pipe(
|
|
1343
|
+
ue(
|
|
1344
|
+
([d, l]) => d ? l ? Te(!0) : jt(t, d) : Te(!1)
|
|
1345
|
+
)
|
|
1346
|
+
);
|
|
1347
|
+
})
|
|
1724
1348
|
);
|
|
1725
|
-
return
|
|
1726
|
-
|
|
1727
|
-
|
|
1349
|
+
return e.pipe(
|
|
1350
|
+
li(),
|
|
1351
|
+
ue((s) => o.pipe(le((c) => s || c)))
|
|
1728
1352
|
);
|
|
1729
|
-
},
|
|
1730
|
-
commandId:
|
|
1731
|
-
type:
|
|
1732
|
-
positions: [
|
|
1353
|
+
}, ze = {
|
|
1354
|
+
commandId: $t.id,
|
|
1355
|
+
type: kn.BUTTON,
|
|
1356
|
+
positions: [Tn.CONTEXT_MENU],
|
|
1733
1357
|
title: "hyperLink.menu.add",
|
|
1734
1358
|
icon: "LinkSingle"
|
|
1735
|
-
},
|
|
1736
|
-
...
|
|
1737
|
-
id:
|
|
1738
|
-
hidden$:
|
|
1739
|
-
disabled$:
|
|
1359
|
+
}, Ye = (t) => `${t}-zen-editor`, rs = (t) => ({
|
|
1360
|
+
...ze,
|
|
1361
|
+
id: ze.commandId,
|
|
1362
|
+
hidden$: lt(t, O.UNIVER_SHEET),
|
|
1363
|
+
disabled$: Fn(t)
|
|
1740
1364
|
// disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })),
|
|
1741
|
-
}),
|
|
1742
|
-
...
|
|
1743
|
-
id:
|
|
1744
|
-
hidden$:
|
|
1745
|
-
disabled$:
|
|
1746
|
-
}),
|
|
1365
|
+
}), is = (t) => ({
|
|
1366
|
+
...ze,
|
|
1367
|
+
id: Ye(ze.commandId),
|
|
1368
|
+
hidden$: lt(t, O.UNIVER_DOC, x),
|
|
1369
|
+
disabled$: jt(t)
|
|
1370
|
+
}), Xe = {
|
|
1747
1371
|
tooltip: "hyperLink.form.addTitle",
|
|
1748
|
-
positions:
|
|
1749
|
-
group:
|
|
1750
|
-
commandId:
|
|
1751
|
-
type:
|
|
1372
|
+
positions: Tn.TOOLBAR_START,
|
|
1373
|
+
group: Yr.TOOLBAR_OTHERS,
|
|
1374
|
+
commandId: pe.id,
|
|
1375
|
+
type: kn.BUTTON,
|
|
1752
1376
|
icon: "LinkSingle"
|
|
1753
|
-
},
|
|
1754
|
-
...
|
|
1755
|
-
id:
|
|
1756
|
-
hidden$:
|
|
1757
|
-
disabled$:
|
|
1758
|
-
}),
|
|
1759
|
-
...
|
|
1760
|
-
id:
|
|
1761
|
-
hidden$:
|
|
1762
|
-
disabled$:
|
|
1763
|
-
}),
|
|
1764
|
-
id:
|
|
1765
|
-
binding:
|
|
1766
|
-
preconditions:
|
|
1377
|
+
}, ss = (t) => ({
|
|
1378
|
+
...Xe,
|
|
1379
|
+
id: Xe.commandId,
|
|
1380
|
+
hidden$: lt(t, O.UNIVER_SHEET),
|
|
1381
|
+
disabled$: Fn(t)
|
|
1382
|
+
}), os = (t) => ({
|
|
1383
|
+
...Xe,
|
|
1384
|
+
id: Ye(Xe.commandId),
|
|
1385
|
+
hidden$: lt(t, O.UNIVER_DOC, x),
|
|
1386
|
+
disabled$: jt(t)
|
|
1387
|
+
}), Wn = {
|
|
1388
|
+
id: pe.id,
|
|
1389
|
+
binding: Rt.K | Xr.CTRL_COMMAND,
|
|
1390
|
+
preconditions: wr
|
|
1767
1391
|
};
|
|
1768
|
-
var
|
|
1769
|
-
for (var
|
|
1770
|
-
(
|
|
1771
|
-
return
|
|
1772
|
-
},
|
|
1773
|
-
let
|
|
1774
|
-
constructor(
|
|
1775
|
-
super(), this._autoFillService =
|
|
1392
|
+
var as = Object.defineProperty, cs = Object.getOwnPropertyDescriptor, ls = (t, e, n, r) => {
|
|
1393
|
+
for (var i = r > 1 ? void 0 : r ? cs(e, n) : e, o = t.length - 1, s; o >= 0; o--)
|
|
1394
|
+
(s = t[o]) && (i = (r ? s(e, n, i) : s(i)) || i);
|
|
1395
|
+
return r && i && as(e, n, i), i;
|
|
1396
|
+
}, mn = (t, e) => (n, r) => e(n, r, t);
|
|
1397
|
+
let qe = class extends z {
|
|
1398
|
+
constructor(t, e) {
|
|
1399
|
+
super(), this._autoFillService = t, this._hyperLinkModel = e, this._initAutoFill();
|
|
1776
1400
|
}
|
|
1777
1401
|
// eslint-disable-next-line max-lines-per-function
|
|
1778
1402
|
_initAutoFill() {
|
|
1779
|
-
const
|
|
1780
|
-
const { source:
|
|
1781
|
-
row:
|
|
1782
|
-
col:
|
|
1783
|
-
},
|
|
1784
|
-
return
|
|
1785
|
-
const
|
|
1786
|
-
startRow:
|
|
1787
|
-
startColumn:
|
|
1788
|
-
endColumn:
|
|
1789
|
-
endRow:
|
|
1790
|
-
},
|
|
1791
|
-
startRow:
|
|
1792
|
-
startColumn:
|
|
1793
|
-
endColumn:
|
|
1794
|
-
endRow:
|
|
1403
|
+
const t = () => ({ redos: [], undos: [] }), e = (r, i) => {
|
|
1404
|
+
const { source: o, target: s, unitId: c, subUnitId: u } = r, d = Et([o, s]), [l, g] = d.ranges, { mapFunc: p } = d, v = {
|
|
1405
|
+
row: l.startRow,
|
|
1406
|
+
col: l.startColumn
|
|
1407
|
+
}, C = Tr(l, g), _ = [], b = [];
|
|
1408
|
+
return C.forEach((a) => {
|
|
1409
|
+
const w = a.repeatStartCell, M = a.relativeRange, P = {
|
|
1410
|
+
startRow: v.row,
|
|
1411
|
+
startColumn: v.col,
|
|
1412
|
+
endColumn: v.col,
|
|
1413
|
+
endRow: v.row
|
|
1414
|
+
}, k = {
|
|
1415
|
+
startRow: w.row,
|
|
1416
|
+
startColumn: w.col,
|
|
1417
|
+
endColumn: w.col,
|
|
1418
|
+
endRow: w.row
|
|
1795
1419
|
};
|
|
1796
|
-
|
|
1797
|
-
const
|
|
1420
|
+
Cn.foreach(M, (q, D) => {
|
|
1421
|
+
const ie = Ie.getPositionRange(
|
|
1798
1422
|
{
|
|
1799
|
-
startRow:
|
|
1800
|
-
startColumn:
|
|
1801
|
-
endColumn:
|
|
1802
|
-
endRow:
|
|
1423
|
+
startRow: q,
|
|
1424
|
+
startColumn: D,
|
|
1425
|
+
endColumn: D,
|
|
1426
|
+
endRow: q
|
|
1803
1427
|
},
|
|
1804
|
-
|
|
1805
|
-
), { row:
|
|
1428
|
+
P
|
|
1429
|
+
), { row: ye, col: He } = p(ie.startRow, ie.startColumn), se = this._hyperLinkModel.getHyperLinkByLocation(c, u, ye, He), Ee = Ie.getPositionRange(
|
|
1806
1430
|
{
|
|
1807
|
-
startRow:
|
|
1808
|
-
startColumn:
|
|
1809
|
-
endColumn:
|
|
1810
|
-
endRow:
|
|
1431
|
+
startRow: q,
|
|
1432
|
+
startColumn: D,
|
|
1433
|
+
endColumn: D,
|
|
1434
|
+
endRow: q
|
|
1811
1435
|
},
|
|
1812
|
-
|
|
1813
|
-
), { row:
|
|
1814
|
-
|
|
1815
|
-
id:
|
|
1436
|
+
k
|
|
1437
|
+
), { row: Re, col: Pe } = p(Ee.startRow, Ee.startColumn), oe = Ce.generateRandomId(), j = this._hyperLinkModel.getHyperLinkByLocation(c, u, Re, Pe);
|
|
1438
|
+
j && _.push({
|
|
1439
|
+
id: xe.id,
|
|
1816
1440
|
params: {
|
|
1817
|
-
unitId,
|
|
1818
|
-
subUnitId,
|
|
1819
|
-
id:
|
|
1441
|
+
unitId: c,
|
|
1442
|
+
subUnitId: u,
|
|
1443
|
+
id: j.id
|
|
1820
1444
|
}
|
|
1821
|
-
}), (
|
|
1822
|
-
id:
|
|
1445
|
+
}), (we.COPY === i || we.SERIES === i) && se && (_.push({
|
|
1446
|
+
id: Ne.id,
|
|
1823
1447
|
params: {
|
|
1824
|
-
unitId,
|
|
1825
|
-
subUnitId,
|
|
1448
|
+
unitId: c,
|
|
1449
|
+
subUnitId: u,
|
|
1826
1450
|
link: {
|
|
1827
|
-
...
|
|
1828
|
-
id,
|
|
1829
|
-
row:
|
|
1830
|
-
column:
|
|
1451
|
+
...se,
|
|
1452
|
+
id: oe,
|
|
1453
|
+
row: Re,
|
|
1454
|
+
column: Pe
|
|
1831
1455
|
}
|
|
1832
1456
|
}
|
|
1833
|
-
}),
|
|
1834
|
-
id:
|
|
1457
|
+
}), b.push({
|
|
1458
|
+
id: xe.id,
|
|
1835
1459
|
params: {
|
|
1836
|
-
unitId,
|
|
1837
|
-
subUnitId,
|
|
1838
|
-
id
|
|
1460
|
+
unitId: c,
|
|
1461
|
+
subUnitId: u,
|
|
1462
|
+
id: oe
|
|
1839
1463
|
}
|
|
1840
|
-
})),
|
|
1841
|
-
id:
|
|
1464
|
+
})), j && b.push({
|
|
1465
|
+
id: Ne.id,
|
|
1842
1466
|
params: {
|
|
1843
|
-
unitId,
|
|
1844
|
-
subUnitId,
|
|
1845
|
-
link:
|
|
1467
|
+
unitId: c,
|
|
1468
|
+
subUnitId: u,
|
|
1469
|
+
link: j
|
|
1846
1470
|
}
|
|
1847
1471
|
});
|
|
1848
1472
|
});
|
|
1849
1473
|
}), {
|
|
1850
|
-
undos,
|
|
1851
|
-
redos
|
|
1474
|
+
undos: b,
|
|
1475
|
+
redos: _
|
|
1852
1476
|
};
|
|
1853
|
-
},
|
|
1854
|
-
id:
|
|
1855
|
-
onFillData:
|
|
1477
|
+
}, n = {
|
|
1478
|
+
id: Mt,
|
|
1479
|
+
onFillData: (r, i, o) => o === we.COPY || o === we.ONLY_FORMAT || o === we.SERIES ? e(r, o) : t()
|
|
1856
1480
|
};
|
|
1857
|
-
this.disposeWithMe(this._autoFillService.addHook(
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
],
|
|
1864
|
-
var
|
|
1865
|
-
for (var
|
|
1866
|
-
(
|
|
1867
|
-
return
|
|
1868
|
-
},
|
|
1869
|
-
let
|
|
1870
|
-
constructor(
|
|
1871
|
-
super(), this._localeService =
|
|
1481
|
+
this.disposeWithMe(this._autoFillService.addHook(n));
|
|
1482
|
+
}
|
|
1483
|
+
};
|
|
1484
|
+
qe = ls([
|
|
1485
|
+
mn(0, kr),
|
|
1486
|
+
mn(1, R(at))
|
|
1487
|
+
], qe);
|
|
1488
|
+
var us = Object.defineProperty, ds = Object.getOwnPropertyDescriptor, ps = (t, e, n, r) => {
|
|
1489
|
+
for (var i = r > 1 ? void 0 : r ? ds(e, n) : e, o = t.length - 1, s; o >= 0; o--)
|
|
1490
|
+
(s = t[o]) && (i = (r ? s(e, n, i) : s(i)) || i);
|
|
1491
|
+
return r && i && us(e, n, i), i;
|
|
1492
|
+
}, It = (t, e) => (n, r) => e(n, r, t);
|
|
1493
|
+
let Je = class extends z {
|
|
1494
|
+
constructor(t, e, n) {
|
|
1495
|
+
super(), this._localeService = t, this._commandService = e, this._sheetPermissionInterceptorBaseController = n, this._commandExecutedListener();
|
|
1872
1496
|
}
|
|
1873
1497
|
_commandExecutedListener() {
|
|
1874
1498
|
this.disposeWithMe(
|
|
1875
|
-
this._commandService.beforeCommandExecuted((
|
|
1876
|
-
|
|
1877
|
-
workbookTypes: [
|
|
1878
|
-
rangeTypes: [
|
|
1879
|
-
worksheetTypes: [
|
|
1499
|
+
this._commandService.beforeCommandExecuted((t) => {
|
|
1500
|
+
t.id === Wn.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
1501
|
+
workbookTypes: [kt],
|
|
1502
|
+
rangeTypes: [Nt],
|
|
1503
|
+
worksheetTypes: [Tt, wn, xt]
|
|
1880
1504
|
}) || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")));
|
|
1881
1505
|
})
|
|
1882
1506
|
);
|
|
1883
1507
|
}
|
|
1884
|
-
}
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
],
|
|
1890
|
-
var
|
|
1891
|
-
for (var
|
|
1892
|
-
(
|
|
1893
|
-
return
|
|
1894
|
-
},
|
|
1895
|
-
let
|
|
1896
|
-
constructor(
|
|
1897
|
-
super(), this._hoverManagerService =
|
|
1898
|
-
}
|
|
1899
|
-
_getLinkPermission(
|
|
1900
|
-
const { unitId, subUnitId, row:
|
|
1901
|
-
if (!(
|
|
1508
|
+
};
|
|
1509
|
+
Je = ps([
|
|
1510
|
+
It(0, R(it)),
|
|
1511
|
+
It(1, re),
|
|
1512
|
+
It(2, R(En))
|
|
1513
|
+
], Je);
|
|
1514
|
+
var hs = Object.defineProperty, gs = Object.getOwnPropertyDescriptor, ms = (t, e, n, r) => {
|
|
1515
|
+
for (var i = r > 1 ? void 0 : r ? gs(e, n) : e, o = t.length - 1, s; o >= 0; o--)
|
|
1516
|
+
(s = t[o]) && (i = (r ? s(e, n, i) : s(i)) || i);
|
|
1517
|
+
return r && i && hs(e, n, i), i;
|
|
1518
|
+
}, Z = (t, e) => (n, r) => e(n, r, t);
|
|
1519
|
+
let Qe = class extends z {
|
|
1520
|
+
constructor(t, e, n, r, i, o, s, c, u, d) {
|
|
1521
|
+
super(), this._hoverManagerService = t, this._sheetsHyperLinkPopupService = e, this._renderManagerService = n, this._permissionService = r, this._sheetPermissionInterceptorBaseController = i, this._commandService = o, this._editorBridgeService = s, this._textSelectionManagerService = c, this._univerInstanceService = u, this._zenZoneService = d, this._initHoverListener(), this._initCommandListener(), this._initHoverEditingListener(), this._initTextSelectionListener(), this._initZenEditor();
|
|
1522
|
+
}
|
|
1523
|
+
_getLinkPermission(t) {
|
|
1524
|
+
const { unitId: e, subUnitId: n, row: r, col: i } = t, o = this._univerInstanceService.getUnit(e, O.UNIVER_SHEET);
|
|
1525
|
+
if (!(o == null ? void 0 : o.getSheetBySheetId(n)))
|
|
1902
1526
|
return {
|
|
1903
1527
|
viewPermission: !1,
|
|
1904
1528
|
editPermission: !1,
|
|
1905
1529
|
copyPermission: !1
|
|
1906
1530
|
};
|
|
1907
|
-
const
|
|
1908
|
-
workbookTypes: [
|
|
1909
|
-
worksheetTypes: [
|
|
1910
|
-
rangeTypes: [
|
|
1911
|
-
}, [{ startRow:
|
|
1912
|
-
workbookTypes: [
|
|
1913
|
-
worksheetTypes: [
|
|
1914
|
-
rangeTypes: [
|
|
1915
|
-
}, [{ startRow:
|
|
1531
|
+
const c = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
1532
|
+
workbookTypes: [Dr],
|
|
1533
|
+
worksheetTypes: [$r],
|
|
1534
|
+
rangeTypes: [jr]
|
|
1535
|
+
}, [{ startRow: r, startColumn: i, endRow: r, endColumn: i }]), u = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
1536
|
+
workbookTypes: [kt],
|
|
1537
|
+
worksheetTypes: [Tt, xt],
|
|
1538
|
+
rangeTypes: [Nt]
|
|
1539
|
+
}, [{ startRow: r, startColumn: i, endRow: r, endColumn: i }]), d = this._permissionService.composePermission([new Vr(e).id, new Br(e, n).id]).every((l) => l.value);
|
|
1916
1540
|
return {
|
|
1917
|
-
viewPermission,
|
|
1918
|
-
editPermission,
|
|
1919
|
-
copyPermission
|
|
1541
|
+
viewPermission: c,
|
|
1542
|
+
editPermission: u,
|
|
1543
|
+
copyPermission: d
|
|
1920
1544
|
};
|
|
1921
1545
|
}
|
|
1922
1546
|
_initHoverListener() {
|
|
1923
1547
|
this.disposeWithMe(
|
|
1924
1548
|
// hover over not editing cell
|
|
1925
|
-
this._hoverManagerService.currentRichText$.pipe(
|
|
1926
|
-
var
|
|
1927
|
-
if (!
|
|
1549
|
+
this._hoverManagerService.currentRichText$.pipe(Be(200)).subscribe((t) => {
|
|
1550
|
+
var P;
|
|
1551
|
+
if (!t) {
|
|
1928
1552
|
this._sheetsHyperLinkPopupService.hideCurrentPopup();
|
|
1929
1553
|
return;
|
|
1930
1554
|
}
|
|
1931
|
-
const { unitId, subUnitId, row, col } =
|
|
1932
|
-
if (!
|
|
1555
|
+
const { unitId: e, subUnitId: n, row: r, col: i } = t, o = this._renderManagerService.getRenderById(e);
|
|
1556
|
+
if (!o)
|
|
1557
|
+
return;
|
|
1558
|
+
const s = this._univerInstanceService.getUnit(e, O.UNIVER_SHEET), c = s == null ? void 0 : s.getSheetBySheetId(n);
|
|
1559
|
+
if (!c)
|
|
1933
1560
|
return;
|
|
1934
|
-
if (!
|
|
1935
|
-
this._sheetsHyperLinkPopupService.hideCurrentPopup(
|
|
1561
|
+
if (!o.with(Nr).active) {
|
|
1562
|
+
this._sheetsHyperLinkPopupService.hideCurrentPopup(f.VIEWING);
|
|
1936
1563
|
return;
|
|
1937
1564
|
}
|
|
1938
|
-
const
|
|
1939
|
-
let
|
|
1940
|
-
|
|
1941
|
-
|
|
1565
|
+
const d = (P = o == null ? void 0 : o.with(sn).getWorksheetSkeleton(n)) == null ? void 0 : P.skeleton, l = i, g = r;
|
|
1566
|
+
let p = g, v = l;
|
|
1567
|
+
d && d.overflowCache.forValue((k, q, D) => {
|
|
1568
|
+
Ie.contains(D, { startColumn: l, endColumn: l, startRow: g, endRow: g }) && (p = k, v = q);
|
|
1942
1569
|
});
|
|
1943
|
-
const { viewPermission, editPermission, copyPermission } = this._getLinkPermission(
|
|
1944
|
-
if (!
|
|
1570
|
+
const { viewPermission: C, editPermission: _, copyPermission: b } = this._getLinkPermission(t);
|
|
1571
|
+
if (!C) {
|
|
1572
|
+
this._sheetsHyperLinkPopupService.hideCurrentPopup();
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
const a = c.getCellStyleOnly(p, v), w = s.getStyles().getStyleByCell(a), M = w == null ? void 0 : w.tr;
|
|
1576
|
+
if (!M && !t.customRange) {
|
|
1945
1577
|
this._sheetsHyperLinkPopupService.hideCurrentPopup();
|
|
1946
1578
|
return;
|
|
1947
1579
|
}
|
|
1948
1580
|
this._sheetsHyperLinkPopupService.showPopup({
|
|
1949
|
-
row:
|
|
1950
|
-
col:
|
|
1951
|
-
editPermission,
|
|
1952
|
-
copyPermission,
|
|
1953
|
-
customRange:
|
|
1954
|
-
customRangeRect:
|
|
1955
|
-
type:
|
|
1956
|
-
unitId,
|
|
1957
|
-
subUnitId
|
|
1581
|
+
row: p,
|
|
1582
|
+
col: v,
|
|
1583
|
+
editPermission: _,
|
|
1584
|
+
copyPermission: b,
|
|
1585
|
+
customRange: t.customRange,
|
|
1586
|
+
customRangeRect: t.rect,
|
|
1587
|
+
type: f.VIEWING,
|
|
1588
|
+
unitId: e,
|
|
1589
|
+
subUnitId: n,
|
|
1590
|
+
showAll: !!M
|
|
1958
1591
|
});
|
|
1959
1592
|
})
|
|
1960
1593
|
);
|
|
1961
1594
|
}
|
|
1962
1595
|
_initHoverEditingListener() {
|
|
1963
|
-
let
|
|
1596
|
+
let t = null;
|
|
1964
1597
|
this.disposeWithMe(
|
|
1965
|
-
this._editorBridgeService.currentEditCellState$.pipe(
|
|
1966
|
-
if (!
|
|
1598
|
+
this._editorBridgeService.currentEditCellState$.pipe(ue((e) => this._editorBridgeService.visible$.pipe(le((n) => ({ visible: n, state: e }))))).subscribe(({ visible: e, state: n }) => {
|
|
1599
|
+
if (!n || n.editorUnitId !== yt)
|
|
1967
1600
|
return;
|
|
1968
|
-
if (!
|
|
1969
|
-
|
|
1601
|
+
if (!e.visible) {
|
|
1602
|
+
t == null || t.unsubscribe(), this._sheetsHyperLinkPopupService.hideCurrentPopup(f.EDITING), this._sheetsHyperLinkPopupService.endEditing(f.EDITING);
|
|
1970
1603
|
return;
|
|
1971
1604
|
}
|
|
1972
|
-
const { editorUnitId, unitId, sheetId, row, column } =
|
|
1973
|
-
if (!
|
|
1605
|
+
const { editorUnitId: r, unitId: i, sheetId: o, row: s, column: c } = n, u = this._renderManagerService.getRenderById(r);
|
|
1606
|
+
if (!u)
|
|
1974
1607
|
return;
|
|
1975
|
-
const { editPermission, viewPermission, copyPermission } = this._getLinkPermission({ unitId, subUnitId:
|
|
1976
|
-
|
|
1977
|
-
var
|
|
1978
|
-
const
|
|
1979
|
-
if (!
|
|
1608
|
+
const { editPermission: d, viewPermission: l, copyPermission: g } = this._getLinkPermission({ unitId: i, subUnitId: o, row: s, col: c }), p = u.with(cn);
|
|
1609
|
+
l && (t == null || t.unsubscribe(), t = p.hoverCustomRanges$.pipe(Be(200)).subscribe((v) => {
|
|
1610
|
+
var w, M;
|
|
1611
|
+
const C = v.find((P) => P.range.rangeType === Me.HYPERLINK);
|
|
1612
|
+
if (!C) {
|
|
1980
1613
|
this._sheetsHyperLinkPopupService.hideCurrentPopup();
|
|
1981
1614
|
return;
|
|
1982
1615
|
}
|
|
1983
|
-
const
|
|
1984
|
-
if (!((
|
|
1616
|
+
const _ = C.rects[C.rects.length - 1];
|
|
1617
|
+
if (!((M = (w = this._renderManagerService.getRenderById(i)) == null ? void 0 : w.with(sn).getWorksheetSkeleton(o)) == null ? void 0 : M.skeleton) || !_)
|
|
1985
1618
|
return;
|
|
1986
|
-
const
|
|
1619
|
+
const a = u.engine.getCanvasElement().getBoundingClientRect();
|
|
1987
1620
|
this._sheetsHyperLinkPopupService.showPopup({
|
|
1988
|
-
unitId,
|
|
1989
|
-
subUnitId:
|
|
1990
|
-
row,
|
|
1991
|
-
col:
|
|
1992
|
-
customRange:
|
|
1621
|
+
unitId: i,
|
|
1622
|
+
subUnitId: o,
|
|
1623
|
+
row: s,
|
|
1624
|
+
col: c,
|
|
1625
|
+
customRange: C.range,
|
|
1993
1626
|
customRangeRect: {
|
|
1994
|
-
left:
|
|
1995
|
-
top:
|
|
1996
|
-
bottom:
|
|
1997
|
-
right:
|
|
1627
|
+
left: _.left + a.left,
|
|
1628
|
+
top: _.top + a.top,
|
|
1629
|
+
bottom: _.bottom + a.top,
|
|
1630
|
+
right: _.right + a.left
|
|
1998
1631
|
},
|
|
1999
|
-
editPermission,
|
|
2000
|
-
copyPermission,
|
|
2001
|
-
type:
|
|
1632
|
+
editPermission: d,
|
|
1633
|
+
copyPermission: g,
|
|
1634
|
+
type: f.EDITING
|
|
2002
1635
|
});
|
|
2003
1636
|
}));
|
|
2004
1637
|
})
|
|
2005
1638
|
), this.disposeWithMe(() => {
|
|
2006
|
-
|
|
1639
|
+
t == null || t.unsubscribe();
|
|
2007
1640
|
});
|
|
2008
1641
|
}
|
|
2009
1642
|
_initZenEditor() {
|
|
2010
1643
|
this.disposeWithMe(
|
|
2011
|
-
this._zenZoneService.visible$.subscribe((
|
|
2012
|
-
|
|
1644
|
+
this._zenZoneService.visible$.subscribe((t) => {
|
|
1645
|
+
t ? (this._sheetsHyperLinkPopupService.hideCurrentPopup(f.VIEWING), this._sheetsHyperLinkPopupService.hideCurrentPopup(f.EDITING), this._sheetsHyperLinkPopupService.endEditing(f.EDITING), this._sheetsHyperLinkPopupService.hideCurrentPopup(f.VIEWING)) : (this._sheetsHyperLinkPopupService.hideCurrentPopup(f.ZEN_EDITOR), this._sheetsHyperLinkPopupService.endEditing(f.ZEN_EDITOR));
|
|
2013
1646
|
})
|
|
2014
1647
|
), this.disposeWithMe(
|
|
2015
1648
|
this._univerInstanceService.focused$.pipe(
|
|
2016
|
-
|
|
2017
|
-
const
|
|
2018
|
-
return
|
|
2019
|
-
|
|
1649
|
+
ue((t) => {
|
|
1650
|
+
const e = t === x ? this._renderManagerService.getRenderById(t) : null;
|
|
1651
|
+
return e ? e.with(cn).hoverCustomRanges$.pipe(Be(200)) : new ui((n) => {
|
|
1652
|
+
n.next(null);
|
|
2020
1653
|
});
|
|
2021
1654
|
})
|
|
2022
|
-
).subscribe((
|
|
2023
|
-
const
|
|
2024
|
-
if (
|
|
2025
|
-
const { unitId, sheetId, row, column } =
|
|
2026
|
-
|
|
2027
|
-
type:
|
|
2028
|
-
unitId,
|
|
2029
|
-
subUnitId:
|
|
2030
|
-
row,
|
|
2031
|
-
col:
|
|
2032
|
-
customRange:
|
|
2033
|
-
editPermission,
|
|
2034
|
-
copyPermission
|
|
1655
|
+
).subscribe((t) => {
|
|
1656
|
+
const e = t == null ? void 0 : t.find((r) => r.range.rangeType === Me.HYPERLINK), n = this._editorBridgeService.getEditCellState();
|
|
1657
|
+
if (e && n) {
|
|
1658
|
+
const { unitId: r, sheetId: i, row: o, column: s } = n, { editPermission: c, viewPermission: u, copyPermission: d } = this._getLinkPermission({ unitId: r, subUnitId: i, row: o, col: s });
|
|
1659
|
+
u && this._sheetsHyperLinkPopupService.showPopup({
|
|
1660
|
+
type: f.ZEN_EDITOR,
|
|
1661
|
+
unitId: r,
|
|
1662
|
+
subUnitId: i,
|
|
1663
|
+
row: o,
|
|
1664
|
+
col: s,
|
|
1665
|
+
customRange: e.range,
|
|
1666
|
+
editPermission: c,
|
|
1667
|
+
copyPermission: d
|
|
2035
1668
|
});
|
|
2036
1669
|
} else
|
|
2037
|
-
this._sheetsHyperLinkPopupService.hideCurrentPopup(
|
|
1670
|
+
this._sheetsHyperLinkPopupService.hideCurrentPopup(f.ZEN_EDITOR);
|
|
2038
1671
|
})
|
|
2039
1672
|
);
|
|
2040
1673
|
}
|
|
2041
1674
|
_initTextSelectionListener() {
|
|
2042
1675
|
this.disposeWithMe(
|
|
2043
|
-
this._textSelectionManagerService.textSelection$.subscribe((
|
|
2044
|
-
|
|
1676
|
+
this._textSelectionManagerService.textSelection$.subscribe((t) => {
|
|
1677
|
+
t && t.unitId === yt && this._sheetsHyperLinkPopupService.endEditing(f.EDITING);
|
|
2045
1678
|
})
|
|
2046
1679
|
);
|
|
2047
1680
|
}
|
|
2048
1681
|
_initCommandListener() {
|
|
2049
|
-
const
|
|
2050
|
-
this.disposeWithMe(this._commandService.onCommandExecuted((
|
|
2051
|
-
|
|
1682
|
+
const t = [Ar.id, Fr.id, Wr.id];
|
|
1683
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
|
|
1684
|
+
t.includes(e.id) && this._sheetsHyperLinkPopupService.hideCurrentPopup();
|
|
2052
1685
|
}));
|
|
2053
1686
|
}
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
],
|
|
2067
|
-
var
|
|
2068
|
-
for (var
|
|
2069
|
-
(
|
|
2070
|
-
return
|
|
2071
|
-
},
|
|
2072
|
-
let
|
|
2073
|
-
constructor(
|
|
2074
|
-
super(), this.
|
|
2075
|
-
}
|
|
2076
|
-
_initSheetChange() {
|
|
2077
|
-
this.disposeWithMe(
|
|
2078
|
-
this._sheetInterceptorService.interceptCommand({
|
|
2079
|
-
getMutations: /* @__PURE__ */ __name((commandInfo) => {
|
|
2080
|
-
var _a15;
|
|
2081
|
-
if (commandInfo.id === RemoveSheetCommand.id) {
|
|
2082
|
-
const params = commandInfo.params, workbook = params.unitId ? this._univerInstanceService.getUnit(params.unitId) : this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
|
|
2083
|
-
if (!workbook)
|
|
2084
|
-
return { redos: [], undos: [] };
|
|
2085
|
-
const unitId = workbook.getUnitId(), subUnitId = params.subUnitId || ((_a15 = workbook.getActiveSheet()) == null ? void 0 : _a15.getSheetId());
|
|
2086
|
-
if (!subUnitId)
|
|
2087
|
-
return { redos: [], undos: [] };
|
|
2088
|
-
const links = this._hyperLinkModel.getSubUnit(unitId, subUnitId), redos = links.map((link) => ({
|
|
2089
|
-
id: RemoveHyperLinkMutation.id,
|
|
2090
|
-
params: {
|
|
2091
|
-
unitId,
|
|
2092
|
-
subUnitId,
|
|
2093
|
-
id: link.id
|
|
2094
|
-
}
|
|
2095
|
-
})), undos = links.map((link) => ({
|
|
2096
|
-
id: AddHyperLinkMutation.id,
|
|
2097
|
-
params: {
|
|
2098
|
-
unitId,
|
|
2099
|
-
subUnitId,
|
|
2100
|
-
link
|
|
2101
|
-
}
|
|
2102
|
-
}));
|
|
2103
|
-
return { redos, undos };
|
|
2104
|
-
}
|
|
2105
|
-
return { redos: [], undos: [] };
|
|
2106
|
-
}, "getMutations")
|
|
2107
|
-
})
|
|
2108
|
-
);
|
|
2109
|
-
}
|
|
2110
|
-
}, __name(_a7, "SheetsHyperLinkRemoveSheetController"), _a7);
|
|
2111
|
-
SheetsHyperLinkRemoveSheetController = __decorateClass$6([
|
|
2112
|
-
__decorateParam$6(0, Inject(SheetInterceptorService)),
|
|
2113
|
-
__decorateParam$6(1, IUniverInstanceService),
|
|
2114
|
-
__decorateParam$6(2, Inject(HyperLinkModel))
|
|
2115
|
-
], SheetsHyperLinkRemoveSheetController);
|
|
2116
|
-
var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2117
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2118
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2119
|
-
return kind && result && __defProp$5(target, key, result), result;
|
|
2120
|
-
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a8;
|
|
2121
|
-
let SheetsHyperLinkRenderController = (_a8 = class extends Disposable {
|
|
2122
|
-
constructor(_context, _hyperLinkModel) {
|
|
2123
|
-
super(), this._context = _context, this._hyperLinkModel = _hyperLinkModel, this._initSkeletonChange();
|
|
1687
|
+
};
|
|
1688
|
+
Qe = ms([
|
|
1689
|
+
Z(0, R(xr)),
|
|
1690
|
+
Z(1, R(G)),
|
|
1691
|
+
Z(2, R(ut)),
|
|
1692
|
+
Z(3, R(cr)),
|
|
1693
|
+
Z(4, R(En)),
|
|
1694
|
+
Z(5, re),
|
|
1695
|
+
Z(6, ne),
|
|
1696
|
+
Z(7, R(Ue)),
|
|
1697
|
+
Z(8, K),
|
|
1698
|
+
Z(9, ct)
|
|
1699
|
+
], Qe);
|
|
1700
|
+
var fs = Object.defineProperty, vs = Object.getOwnPropertyDescriptor, Zn = (t, e, n, r) => {
|
|
1701
|
+
for (var i = r > 1 ? void 0 : r ? vs(e, n) : e, o = t.length - 1, s; o >= 0; o--)
|
|
1702
|
+
(s = t[o]) && (i = (r ? s(e, n, i) : s(i)) || i);
|
|
1703
|
+
return r && i && fs(e, n, i), i;
|
|
1704
|
+
}, Lt = (t, e) => (n, r) => e(n, r, t);
|
|
1705
|
+
let bt = class extends z {
|
|
1706
|
+
constructor(t, e) {
|
|
1707
|
+
super(), this._context = t, this._hyperLinkModel = e, this._initSkeletonChange();
|
|
2124
1708
|
}
|
|
2125
1709
|
_initSkeletonChange() {
|
|
2126
|
-
const
|
|
2127
|
-
var
|
|
2128
|
-
(
|
|
2129
|
-
}
|
|
2130
|
-
this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(
|
|
2131
|
-
|
|
1710
|
+
const t = () => {
|
|
1711
|
+
var e;
|
|
1712
|
+
(e = this._context.mainComponent) == null || e.makeForceDirty();
|
|
1713
|
+
};
|
|
1714
|
+
this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(Be(16)).subscribe(() => {
|
|
1715
|
+
t();
|
|
2132
1716
|
}));
|
|
2133
1717
|
}
|
|
2134
|
-
}
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
],
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
super(), this._sheetInterceptorService = _sheetInterceptorService, this._hyperLinkModel = _hyperLinkModel, this._initViewModelIntercept();
|
|
1718
|
+
};
|
|
1719
|
+
bt = Zn([
|
|
1720
|
+
Lt(1, R(at))
|
|
1721
|
+
], bt);
|
|
1722
|
+
let et = class extends z {
|
|
1723
|
+
constructor(t, e) {
|
|
1724
|
+
super(), this._sheetInterceptorService = t, this._hyperLinkModel = e, this._initViewModelIntercept();
|
|
2142
1725
|
}
|
|
2143
1726
|
_initViewModelIntercept() {
|
|
2144
1727
|
this.disposeWithMe(
|
|
2145
1728
|
this._sheetInterceptorService.intercept(
|
|
2146
|
-
|
|
1729
|
+
Gr.CELL_CONTENT,
|
|
2147
1730
|
{
|
|
2148
|
-
effect:
|
|
1731
|
+
effect: lr.Value,
|
|
2149
1732
|
priority: 100,
|
|
2150
|
-
handler:
|
|
2151
|
-
const { row, col, unitId, subUnitId } =
|
|
2152
|
-
return
|
|
2153
|
-
...
|
|
2154
|
-
linkUrl:
|
|
2155
|
-
linkId:
|
|
2156
|
-
} :
|
|
2157
|
-
}
|
|
1733
|
+
handler: (t, e, n) => {
|
|
1734
|
+
const { row: r, col: i, unitId: o, subUnitId: s } = e, c = this._hyperLinkModel.getHyperLinkByLocation(o, s, r, i);
|
|
1735
|
+
return n(c ? {
|
|
1736
|
+
...t,
|
|
1737
|
+
linkUrl: c.payload,
|
|
1738
|
+
linkId: c.id
|
|
1739
|
+
} : t);
|
|
1740
|
+
}
|
|
2158
1741
|
}
|
|
2159
1742
|
)
|
|
2160
1743
|
);
|
|
2161
1744
|
}
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
],
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
return kind && result && __defProp$4(target, key, result), result;
|
|
2171
|
-
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a10;
|
|
2172
|
-
let SheetsHyperLinkRichTextRefRangeController = (_a10 = class extends Disposable {
|
|
2173
|
-
constructor(_commandService, _univerInstanceService, _refRangeService) {
|
|
2174
|
-
super();
|
|
2175
|
-
__publicField(this, "_refRangeMap", /* @__PURE__ */ new Map());
|
|
2176
|
-
this._commandService = _commandService, this._univerInstanceService = _univerInstanceService, this._refRangeService = _refRangeService, this._initWorkbookLoad(), this._initWorkbookUnload(), this._initSetRangesListener();
|
|
2177
|
-
}
|
|
2178
|
-
_enusreMap(unitId, subUnitId) {
|
|
2179
|
-
let unitMap = this._refRangeMap.get(unitId);
|
|
2180
|
-
unitMap || (unitMap = /* @__PURE__ */ new Map(), this._refRangeMap.set(unitId, unitMap));
|
|
2181
|
-
let subUnitMap = unitMap.get(subUnitId);
|
|
2182
|
-
return subUnitMap || (subUnitMap = new ObjectMatrix(), unitMap.set(subUnitId, subUnitMap)), subUnitMap;
|
|
2183
|
-
}
|
|
2184
|
-
_isLegalRangeUrl(unitId, payload) {
|
|
2185
|
-
var _a15, _b, _c;
|
|
2186
|
-
const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
2187
|
-
if (!workbook)
|
|
2188
|
-
return null;
|
|
2189
|
-
if (payload && payload.startsWith("#")) {
|
|
2190
|
-
const search = new URLSearchParams(payload.slice(1)), searchObj = {
|
|
2191
|
-
gid: (_a15 = search.get("gid")) != null ? _a15 : "",
|
|
2192
|
-
range: (_b = search.get("range")) != null ? _b : "",
|
|
2193
|
-
rangeid: (_c = search.get("rangeid")) != null ? _c : ""
|
|
2194
|
-
};
|
|
2195
|
-
if (searchObj.range && searchObj.gid) {
|
|
2196
|
-
const subUnitId = searchObj.gid, worksheet = workbook.getSheetBySheetId(subUnitId);
|
|
2197
|
-
if (!worksheet)
|
|
2198
|
-
return null;
|
|
2199
|
-
const range = deserializeRangeWithSheet(searchObj.range).range;
|
|
2200
|
-
if (isValidRange(range, worksheet) && searchObj.range !== ERROR_RANGE)
|
|
2201
|
-
return range;
|
|
2202
|
-
}
|
|
2203
|
-
}
|
|
2204
|
-
return null;
|
|
2205
|
-
}
|
|
2206
|
-
_registerRange(unitId, subUnitId, row, col, p2) {
|
|
2207
|
-
var _a15, _b, _c, _d;
|
|
2208
|
-
const map2 = this._enusreMap(unitId, subUnitId);
|
|
2209
|
-
if ((_b = (_a15 = p2.body) == null ? void 0 : _a15.customRanges) != null && _b.some((customRange) => {
|
|
2210
|
-
var _a16;
|
|
2211
|
-
return customRange.rangeType === CustomRangeType.HYPERLINK && this._isLegalRangeUrl(unitId, (_a16 = customRange.properties) == null ? void 0 : _a16.url);
|
|
2212
|
-
})) {
|
|
2213
|
-
const disposableCollection = new DisposableCollection();
|
|
2214
|
-
(_d = (_c = p2.body) == null ? void 0 : _c.customRanges) == null || _d.forEach((customRange) => {
|
|
2215
|
-
var _a16;
|
|
2216
|
-
if (customRange.rangeType === CustomRangeType.HYPERLINK) {
|
|
2217
|
-
const payload = (_a16 = customRange.properties) == null ? void 0 : _a16.url, range = this._isLegalRangeUrl(unitId, payload);
|
|
2218
|
-
range && disposableCollection.add(this._refRangeService.watchRange(unitId, subUnitId, range, (before, after) => {
|
|
2219
|
-
customRange.properties.url = `#gid=${subUnitId}&range=${after ? serializeRange(after) : ERROR_RANGE}`;
|
|
2220
|
-
}));
|
|
2221
|
-
}
|
|
2222
|
-
}), map2.setValue(row, col, disposableCollection);
|
|
2223
|
-
}
|
|
2224
|
-
}
|
|
2225
|
-
_initWorkbookLoad() {
|
|
2226
|
-
const handleWorkbook = /* @__PURE__ */ __name((workbook) => {
|
|
2227
|
-
const unitId = workbook.getUnitId();
|
|
2228
|
-
workbook.getSheets().forEach((sheet) => {
|
|
2229
|
-
const subUnitId = sheet.getSheetId(), map2 = this._enusreMap(unitId, subUnitId);
|
|
2230
|
-
sheet.getCellMatrix().forValue((row, col, cell) => {
|
|
2231
|
-
const dispose = map2.getValue(row, col);
|
|
2232
|
-
dispose && dispose.dispose(), cell && cell.p && this._registerRange(unitId, subUnitId, row, col, cell.p);
|
|
2233
|
-
});
|
|
2234
|
-
});
|
|
2235
|
-
}, "handleWorkbook");
|
|
2236
|
-
this._univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).forEach((workbook) => {
|
|
2237
|
-
handleWorkbook(workbook);
|
|
2238
|
-
}), this.disposeWithMe(
|
|
2239
|
-
this._univerInstanceService.unitAdded$.subscribe((unit) => {
|
|
2240
|
-
unit.type === UniverInstanceType.UNIVER_SHEET && handleWorkbook(unit);
|
|
2241
|
-
})
|
|
2242
|
-
);
|
|
2243
|
-
}
|
|
2244
|
-
_initWorkbookUnload() {
|
|
2245
|
-
this._univerInstanceService.unitDisposed$.subscribe((unit) => {
|
|
2246
|
-
if (unit.type === UniverInstanceType.UNIVER_SHEET) {
|
|
2247
|
-
const workbook = unit, unitId = workbook.getUnitId();
|
|
2248
|
-
workbook.getSheets().forEach((sheet) => {
|
|
2249
|
-
const subUnitId = sheet.getSheetId();
|
|
2250
|
-
this._enusreMap(unitId, subUnitId).forValue((row, col, dispose) => {
|
|
2251
|
-
dispose && dispose.dispose();
|
|
2252
|
-
});
|
|
2253
|
-
}), this._refRangeMap.delete(unitId);
|
|
2254
|
-
}
|
|
2255
|
-
});
|
|
2256
|
-
}
|
|
2257
|
-
_initSetRangesListener() {
|
|
2258
|
-
this.disposeWithMe(
|
|
2259
|
-
this._commandService.onCommandExecuted((commandInfo) => {
|
|
2260
|
-
if (commandInfo.id === SetRangeValuesMutation.id) {
|
|
2261
|
-
const params = commandInfo.params, { unitId, subUnitId, cellValue } = params, map2 = this._enusreMap(unitId, subUnitId);
|
|
2262
|
-
cellValue && new ObjectMatrix(cellValue).forValue((row, col, cell) => {
|
|
2263
|
-
const dispose = map2.getValue(row, col);
|
|
2264
|
-
dispose && dispose.dispose(), cell && cell.p && this._registerRange(unitId, subUnitId, row, col, cell.p);
|
|
2265
|
-
});
|
|
2266
|
-
}
|
|
2267
|
-
})
|
|
2268
|
-
);
|
|
2269
|
-
}
|
|
2270
|
-
}, __name(_a10, "SheetsHyperLinkRichTextRefRangeController"), _a10);
|
|
2271
|
-
SheetsHyperLinkRichTextRefRangeController = __decorateClass$4([
|
|
2272
|
-
__decorateParam$4(0, ICommandService),
|
|
2273
|
-
__decorateParam$4(1, IUniverInstanceService),
|
|
2274
|
-
__decorateParam$4(2, Inject(RefRangeService))
|
|
2275
|
-
], SheetsHyperLinkRichTextRefRangeController);
|
|
2276
|
-
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2277
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2278
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2279
|
-
return kind && result && __defProp$3(target, key, result), result;
|
|
2280
|
-
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a11;
|
|
2281
|
-
let SheetHyperLinkSetRangeController = (_a11 = class extends Disposable {
|
|
2282
|
-
constructor(_sheetInterceptorService, _hyperLinkModel, _selectionManagerService, _univerInstanceService, _editorBridgeService, _renderManagerService) {
|
|
2283
|
-
super(), this._sheetInterceptorService = _sheetInterceptorService, this._hyperLinkModel = _hyperLinkModel, this._selectionManagerService = _selectionManagerService, this._univerInstanceService = _univerInstanceService, this._editorBridgeService = _editorBridgeService, this._renderManagerService = _renderManagerService, this._initCommandInterceptor(), this._initAfterEditor();
|
|
2284
|
-
}
|
|
2285
|
-
_initCommandInterceptor() {
|
|
2286
|
-
this._initSetRangeValuesCommandInterceptor(), this._initClearSelectionCommandInterceptor();
|
|
2287
|
-
}
|
|
2288
|
-
_initSetRangeValuesCommandInterceptor() {
|
|
2289
|
-
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
2290
|
-
getMutations: /* @__PURE__ */ __name((command) => {
|
|
2291
|
-
if (command.id === SetRangeValuesCommand.id) {
|
|
2292
|
-
const params = command.params, { unitId, subUnitId } = params, redos = [], undos = [];
|
|
2293
|
-
return params.cellValue && new ObjectMatrix(params.cellValue).forValue((row, col) => {
|
|
2294
|
-
const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
|
|
2295
|
-
link && (redos.push({
|
|
2296
|
-
id: RemoveHyperLinkMutation.id,
|
|
2297
|
-
params: {
|
|
2298
|
-
unitId,
|
|
2299
|
-
subUnitId,
|
|
2300
|
-
id: link.id
|
|
2301
|
-
}
|
|
2302
|
-
}), undos.push({
|
|
2303
|
-
id: AddHyperLinkMutation.id,
|
|
2304
|
-
params: {
|
|
2305
|
-
unitId,
|
|
2306
|
-
subUnitId,
|
|
2307
|
-
link
|
|
2308
|
-
}
|
|
2309
|
-
}));
|
|
2310
|
-
}), {
|
|
2311
|
-
undos,
|
|
2312
|
-
redos
|
|
2313
|
-
};
|
|
2314
|
-
}
|
|
2315
|
-
return {
|
|
2316
|
-
redos: [],
|
|
2317
|
-
undos: []
|
|
2318
|
-
};
|
|
2319
|
-
}, "getMutations")
|
|
2320
|
-
}));
|
|
2321
|
-
}
|
|
2322
|
-
_initClearSelectionCommandInterceptor() {
|
|
2323
|
-
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
2324
|
-
getMutations: /* @__PURE__ */ __name((command) => {
|
|
2325
|
-
if (command.id === ClearSelectionContentCommand.id || command.id === ClearSelectionAllCommand.id || command.id === ClearSelectionFormatCommand.id) {
|
|
2326
|
-
const redos = [], undos = [], selection = this._selectionManagerService.getCurrentLastSelection(), target = getSheetCommandTarget(this._univerInstanceService);
|
|
2327
|
-
if (selection && target) {
|
|
2328
|
-
const { unitId, subUnitId } = target;
|
|
2329
|
-
Range.foreach(selection.range, (row, col) => {
|
|
2330
|
-
const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
|
|
2331
|
-
link && (redos.push({
|
|
2332
|
-
id: RemoveHyperLinkMutation.id,
|
|
2333
|
-
params: {
|
|
2334
|
-
unitId,
|
|
2335
|
-
subUnitId,
|
|
2336
|
-
id: link.id
|
|
2337
|
-
}
|
|
2338
|
-
}), undos.push({
|
|
2339
|
-
id: AddHyperLinkMutation.id,
|
|
2340
|
-
params: {
|
|
2341
|
-
unitId,
|
|
2342
|
-
subUnitId,
|
|
2343
|
-
link
|
|
2344
|
-
}
|
|
2345
|
-
}));
|
|
2346
|
-
});
|
|
2347
|
-
}
|
|
2348
|
-
return {
|
|
2349
|
-
redos,
|
|
2350
|
-
undos
|
|
2351
|
-
};
|
|
2352
|
-
}
|
|
2353
|
-
return {
|
|
2354
|
-
redos: [],
|
|
2355
|
-
undos: []
|
|
2356
|
-
};
|
|
2357
|
-
}, "getMutations")
|
|
2358
|
-
}));
|
|
2359
|
-
}
|
|
2360
|
-
_initAfterEditor() {
|
|
2361
|
-
this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT, {
|
|
2362
|
-
handler: /* @__PURE__ */ __name((cell, context, next) => {
|
|
2363
|
-
if (!cell || cell.p)
|
|
2364
|
-
return next(cell);
|
|
2365
|
-
if (typeof cell.v == "string" && Tools.isLegalUrl(cell.v) && cell.v[cell.v.length - 1] !== " ") {
|
|
2366
|
-
const { unitId, subUnitId } = context, renderer = this._renderManagerService.getRenderById(unitId), skeleton = renderer == null ? void 0 : renderer.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
|
|
2367
|
-
if (!skeleton)
|
|
2368
|
-
return next(cell);
|
|
2369
|
-
const doc = skeleton.skeleton.getBlankCellDocumentModel(cell);
|
|
2370
|
-
if (!doc.documentModel)
|
|
2371
|
-
return next(cell);
|
|
2372
|
-
const textX = BuildTextUtils.selection.replace({
|
|
2373
|
-
selection: {
|
|
2374
|
-
startOffset: 0,
|
|
2375
|
-
endOffset: cell.v.length,
|
|
2376
|
-
collapsed: !1
|
|
2377
|
-
},
|
|
2378
|
-
body: {
|
|
2379
|
-
dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${cell.v}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
|
|
2380
|
-
customRanges: [{
|
|
2381
|
-
startIndex: 0,
|
|
2382
|
-
endIndex: cell.v.length + 1,
|
|
2383
|
-
rangeId: generateRandomId(),
|
|
2384
|
-
rangeType: CustomRangeType.HYPERLINK,
|
|
2385
|
-
properties: {
|
|
2386
|
-
url: cell.v
|
|
2387
|
-
}
|
|
2388
|
-
}]
|
|
2389
|
-
},
|
|
2390
|
-
doc: doc.documentModel
|
|
2391
|
-
});
|
|
2392
|
-
if (!textX)
|
|
2393
|
-
return next(cell);
|
|
2394
|
-
const body = doc.documentModel.getBody();
|
|
2395
|
-
return TextX.apply(body, textX.serialize()), next({
|
|
2396
|
-
...cell,
|
|
2397
|
-
p: {
|
|
2398
|
-
id: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
2399
|
-
body,
|
|
2400
|
-
documentStyle: {
|
|
2401
|
-
pageSize: {
|
|
2402
|
-
width: 1 / 0,
|
|
2403
|
-
height: 1 / 0
|
|
2404
|
-
}
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
});
|
|
2408
|
-
}
|
|
2409
|
-
return next(cell);
|
|
2410
|
-
}, "handler")
|
|
2411
|
-
}));
|
|
2412
|
-
}
|
|
2413
|
-
}, __name(_a11, "SheetHyperLinkSetRangeController"), _a11);
|
|
2414
|
-
SheetHyperLinkSetRangeController = __decorateClass$3([
|
|
2415
|
-
__decorateParam$3(0, Inject(SheetInterceptorService)),
|
|
2416
|
-
__decorateParam$3(1, Inject(HyperLinkModel)),
|
|
2417
|
-
__decorateParam$3(2, Inject(SheetsSelectionsService)),
|
|
2418
|
-
__decorateParam$3(3, IUniverInstanceService),
|
|
2419
|
-
__decorateParam$3(4, IEditorBridgeService),
|
|
2420
|
-
__decorateParam$3(5, IRenderManagerService)
|
|
2421
|
-
], SheetHyperLinkSetRangeController);
|
|
2422
|
-
const menuSchema = {
|
|
2423
|
-
[RibbonStartGroup.OTHERS]: {
|
|
2424
|
-
[InsertHyperLinkToolbarOperation.id]: {
|
|
1745
|
+
};
|
|
1746
|
+
et = Zn([
|
|
1747
|
+
Lt(0, R(Zr)),
|
|
1748
|
+
Lt(1, R(at))
|
|
1749
|
+
], et);
|
|
1750
|
+
const _s = {
|
|
1751
|
+
[qr.OTHERS]: {
|
|
1752
|
+
[pe.id]: {
|
|
2425
1753
|
order: 2,
|
|
2426
|
-
menuItemFactory:
|
|
1754
|
+
menuItemFactory: ss
|
|
2427
1755
|
},
|
|
2428
|
-
[
|
|
1756
|
+
[Ye(pe.id)]: {
|
|
2429
1757
|
order: 2,
|
|
2430
|
-
menuItemFactory:
|
|
1758
|
+
menuItemFactory: os
|
|
2431
1759
|
}
|
|
2432
1760
|
},
|
|
2433
|
-
[
|
|
2434
|
-
[
|
|
1761
|
+
[Jr.MAIN_AREA]: {
|
|
1762
|
+
[Qr.OTHERS]: {
|
|
2435
1763
|
order: 1,
|
|
2436
|
-
[
|
|
1764
|
+
[pe.id]: {
|
|
2437
1765
|
order: 0,
|
|
2438
|
-
menuItemFactory:
|
|
1766
|
+
menuItemFactory: rs
|
|
2439
1767
|
},
|
|
2440
|
-
[
|
|
1768
|
+
[Ye(pe.id)]: {
|
|
2441
1769
|
order: 0,
|
|
2442
|
-
menuItemFactory:
|
|
1770
|
+
menuItemFactory: is
|
|
2443
1771
|
}
|
|
2444
1772
|
}
|
|
2445
1773
|
}
|
|
2446
1774
|
};
|
|
2447
|
-
var
|
|
2448
|
-
for (var
|
|
2449
|
-
(
|
|
2450
|
-
return
|
|
2451
|
-
},
|
|
2452
|
-
let
|
|
2453
|
-
constructor(
|
|
2454
|
-
super(), this._componentManager =
|
|
1775
|
+
var Ss = Object.defineProperty, Cs = Object.getOwnPropertyDescriptor, Is = (t, e, n, r) => {
|
|
1776
|
+
for (var i = r > 1 ? void 0 : r ? Cs(e, n) : e, o = t.length - 1, s; o >= 0; o--)
|
|
1777
|
+
(s = t[o]) && (i = (r ? s(e, n, i) : s(i)) || i);
|
|
1778
|
+
return r && i && Ss(e, n, i), i;
|
|
1779
|
+
}, Oe = (t, e) => (n, r) => e(n, r, t);
|
|
1780
|
+
let tt = class extends z {
|
|
1781
|
+
constructor(t, e, n, r, i) {
|
|
1782
|
+
super(), this._componentManager = t, this._commandService = e, this._menuManagerService = n, this._injector = r, this._shortcutService = i, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortCut();
|
|
2455
1783
|
}
|
|
2456
1784
|
_initComponents() {
|
|
2457
1785
|
[
|
|
2458
|
-
[
|
|
2459
|
-
[
|
|
2460
|
-
[
|
|
2461
|
-
].forEach(([
|
|
2462
|
-
this._componentManager.register(
|
|
1786
|
+
[Ge, Ge.componentKey],
|
|
1787
|
+
[Ze, Ze.componentKey],
|
|
1788
|
+
[Ut, "LinkSingle"]
|
|
1789
|
+
].forEach(([t, e]) => {
|
|
1790
|
+
this._componentManager.register(e, t);
|
|
2463
1791
|
});
|
|
2464
1792
|
}
|
|
2465
1793
|
_initCommands() {
|
|
2466
1794
|
[
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
CancelHyperLinkCommand,
|
|
2474
|
-
UpdateRichHyperLinkCommand,
|
|
2475
|
-
CancelRichHyperLinkCommand,
|
|
2476
|
-
AddRichHyperLinkCommand
|
|
2477
|
-
].forEach((command) => {
|
|
2478
|
-
this._commandService.registerCommand(command);
|
|
1795
|
+
Dt,
|
|
1796
|
+
Ke,
|
|
1797
|
+
$t,
|
|
1798
|
+
pe
|
|
1799
|
+
].forEach((t) => {
|
|
1800
|
+
this._commandService.registerCommand(t);
|
|
2479
1801
|
});
|
|
2480
1802
|
}
|
|
2481
1803
|
_initMenus() {
|
|
2482
|
-
this._menuManagerService.mergeMenu(
|
|
1804
|
+
this._menuManagerService.mergeMenu(_s);
|
|
2483
1805
|
}
|
|
2484
1806
|
_initShortCut() {
|
|
2485
|
-
this._shortcutService.registerShortcut(
|
|
2486
|
-
}
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
],
|
|
2495
|
-
var
|
|
2496
|
-
for (var
|
|
2497
|
-
(
|
|
2498
|
-
return
|
|
2499
|
-
},
|
|
2500
|
-
let
|
|
2501
|
-
constructor(
|
|
2502
|
-
super(), this._resolverService =
|
|
1807
|
+
this._shortcutService.registerShortcut(Wn);
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
tt = Is([
|
|
1811
|
+
Oe(0, R(ei)),
|
|
1812
|
+
Oe(1, re),
|
|
1813
|
+
Oe(2, ni),
|
|
1814
|
+
Oe(3, R(st)),
|
|
1815
|
+
Oe(4, R(ti))
|
|
1816
|
+
], tt);
|
|
1817
|
+
var ys = Object.defineProperty, Es = Object.getOwnPropertyDescriptor, Rs = (t, e, n, r) => {
|
|
1818
|
+
for (var i = r > 1 ? void 0 : r ? Es(e, n) : e, o = t.length - 1, s; o >= 0; o--)
|
|
1819
|
+
(s = t[o]) && (i = (r ? s(e, n, i) : s(i)) || i);
|
|
1820
|
+
return r && i && ys(e, n, i), i;
|
|
1821
|
+
}, fn = (t, e) => (n, r) => e(n, r, t);
|
|
1822
|
+
let nt = class extends z {
|
|
1823
|
+
constructor(t, e) {
|
|
1824
|
+
super(), this._parserService = t, this._resolverService = e, this._handleInitUrl();
|
|
2503
1825
|
}
|
|
2504
1826
|
_handleInitUrl() {
|
|
2505
|
-
const
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
1827
|
+
const t = location.hash;
|
|
1828
|
+
if (t) {
|
|
1829
|
+
const e = this._parserService.parseHyperLink(t);
|
|
1830
|
+
this._resolverService.navigate(e);
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
};
|
|
1834
|
+
nt = Rs([
|
|
1835
|
+
fn(0, R(wt)),
|
|
1836
|
+
fn(1, R(he))
|
|
1837
|
+
], nt);
|
|
1838
|
+
var Gn = Object.defineProperty, Ps = Object.getOwnPropertyDescriptor, Ls = (t, e, n) => e in t ? Gn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, bs = (t, e, n, r) => {
|
|
1839
|
+
for (var i = r > 1 ? void 0 : r ? Ps(e, n) : e, o = t.length - 1, s; o >= 0; o--)
|
|
1840
|
+
(s = t[o]) && (i = (r ? s(e, n, i) : s(i)) || i);
|
|
1841
|
+
return r && i && Gn(e, n, i), i;
|
|
1842
|
+
}, vn = (t, e) => (n, r) => e(n, r, t), Kn = (t, e, n) => Ls(t, typeof e != "symbol" ? e + "" : e, n);
|
|
1843
|
+
let rt = class extends dr {
|
|
1844
|
+
constructor(t = vi, e, n) {
|
|
1845
|
+
super(), this._config = t, this._injector = e, this._configService = n;
|
|
1846
|
+
const { menu: r, ...i } = this._config;
|
|
1847
|
+
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Nn, i);
|
|
2522
1848
|
}
|
|
2523
1849
|
onStarting() {
|
|
2524
1850
|
[
|
|
2525
|
-
[
|
|
2526
|
-
[
|
|
2527
|
-
[
|
|
2528
|
-
[
|
|
2529
|
-
[
|
|
2530
|
-
[
|
|
2531
|
-
[
|
|
2532
|
-
[
|
|
2533
|
-
[
|
|
2534
|
-
[
|
|
2535
|
-
|
|
2536
|
-
[SheetHyperLinkUrlController],
|
|
2537
|
-
[SheetsHyperLinkRichTextRefRangeController]
|
|
2538
|
-
].forEach((dep) => this._injector.add(dep)), this._injector.get(SheetsHyperLinkRenderManagerController), this._injector.get(SheetsHyperLinkRichTextRefRangeController), this._injector.get(SheetHyperLinkSetRangeController);
|
|
1851
|
+
[he],
|
|
1852
|
+
[G],
|
|
1853
|
+
[Hn],
|
|
1854
|
+
[et],
|
|
1855
|
+
[Qe],
|
|
1856
|
+
[tt],
|
|
1857
|
+
[qe],
|
|
1858
|
+
[We],
|
|
1859
|
+
[Je],
|
|
1860
|
+
[nt]
|
|
1861
|
+
].forEach((e) => this._injector.add(e)), this._injector.get(et);
|
|
2539
1862
|
}
|
|
2540
1863
|
onReady() {
|
|
2541
|
-
this._injector.get(
|
|
1864
|
+
this._injector.get(ut).registerRenderModule(O.UNIVER_SHEET, [bt]), this._injector.get(qe), this._injector.get(We), this._injector.get(tt);
|
|
2542
1865
|
}
|
|
2543
1866
|
onRendered() {
|
|
2544
|
-
this._injector.get(
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
],
|
|
1867
|
+
this._injector.get(Je), this._injector.get(nt), this._injector.get(Qe);
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1870
|
+
Kn(rt, "pluginName", Mt);
|
|
1871
|
+
Kn(rt, "type", O.UNIVER_SHEET);
|
|
1872
|
+
rt = bs([
|
|
1873
|
+
ur(Sr, si),
|
|
1874
|
+
vn(1, R(st)),
|
|
1875
|
+
vn(2, Sn)
|
|
1876
|
+
], rt);
|
|
2554
1877
|
export {
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
SheetsHyperLinkSidePanelService,
|
|
2565
|
-
UniverSheetsHyperLinkUIPlugin,
|
|
2566
|
-
UpdateHyperLinkCommand
|
|
1878
|
+
Ke as CloseHyperLinkPopupOperation,
|
|
1879
|
+
$t as InsertHyperLinkOperation,
|
|
1880
|
+
Wn as InsertLinkShortcut,
|
|
1881
|
+
Dt as OpenHyperLinkEditPanelOperation,
|
|
1882
|
+
We as SheetsHyperLinkCopyPasteController,
|
|
1883
|
+
G as SheetsHyperLinkPopupService,
|
|
1884
|
+
he as SheetsHyperLinkResolverService,
|
|
1885
|
+
Hn as SheetsHyperLinkSidePanelService,
|
|
1886
|
+
rt as UniverSheetsHyperLinkUIPlugin
|
|
2567
1887
|
};
|