@univerjs/sheets-thread-comment 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +418 -394
- package/lib/types/controllers/sheets-thread-comment-hover.controller.d.ts +3 -2
- package/lib/types/controllers/sheets-thread-comment.controller.d.ts +3 -1
- package/lib/types/types/const.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +22 -22
package/lib/es/index.js
CHANGED
|
@@ -1,90 +1,88 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Inject as p, Injector as
|
|
5
|
-
import { Inject as
|
|
6
|
-
import { Disposable as U, DisposableCollection as
|
|
7
|
-
import { ICommandService as
|
|
8
|
-
import { ThreadCommentTree as
|
|
9
|
-
import { IThreadCommentMentionDataService as
|
|
10
|
-
import { IZenZoneService as We, useObservable as
|
|
11
|
-
import { SelectionManagerService as
|
|
12
|
-
import { singleReferenceToGrid as
|
|
13
|
-
import { ThreadCommentModel as _e, DeleteCommentMutation as
|
|
14
|
-
import { IThreadCommentDataSourceService as
|
|
15
|
-
import { SheetCanvasPopManagerService as
|
|
16
|
-
import { SheetsThreadCommentModel as
|
|
17
|
-
import { SheetsThreadCommentModel as
|
|
18
|
-
import { useDependency as
|
|
19
|
-
import
|
|
20
|
-
import { BehaviorSubject as
|
|
21
|
-
import { IRenderManagerService as
|
|
22
|
-
var
|
|
23
|
-
return
|
|
24
|
-
for (var e, n = 1,
|
|
1
|
+
var Re = Object.defineProperty;
|
|
2
|
+
var $e = (t, e, n) => e in t ? Re(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var E = (t, e, n) => $e(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { Inject as p, Injector as de } from "@wendellhu/redi";
|
|
5
|
+
import { Inject as vn, Injector as _n } from "@wendellhu/redi";
|
|
6
|
+
import { Disposable as U, DisposableCollection as Ne, IUniverInstanceService as R, Tools as me, UniverInstanceType as b, CommandType as xe, ICommandService as ee, OnLifecycle as x, LifecycleStages as D, LocaleService as De, Range as je, DependentOn as Ae, Plugin as Ve } from "@univerjs/core";
|
|
7
|
+
import { ICommandService as Cn, Plugin as Sn, UniverInstanceType as In } from "@univerjs/core";
|
|
8
|
+
import { ThreadCommentTree as He, ThreadCommentPanelService as te, ThreadCommentPanel as Le, ToggleSheetCommentPanelOperation as Be, SetActiveCommentOperation as oe, THREAD_COMMENT_PANEL as Fe, UniverThreadCommentUIPlugin as ke } from "@univerjs/thread-comment-ui";
|
|
9
|
+
import { IThreadCommentMentionDataService as Pn, UniverThreadCommentUIPlugin as Tn } from "@univerjs/thread-comment-ui";
|
|
10
|
+
import { IZenZoneService as We, useObservable as W, KeyCode as Ze, MetaKeys as ie, MenuItemType as he, MenuPosition as pe, getMenuHiddenObservable as le, MenuGroup as ze, ComponentManager as Ge, IMenuService as Ke, IShortcutService as Ye } from "@univerjs/ui";
|
|
11
|
+
import { SelectionManagerService as qe, getSheetCommandTarget as Xe, WorkbookCommentPermission as K, WorksheetViewPermission as Y, RangeProtectionPermissionViewPoint as q, SetSelectionsOperation as Je, SelectionMoveType as Qe, SetWorksheetActiveOperation as et, SheetInterceptorService as ve, INTERCEPTOR_POINT as tt, RemoveSheetCommand as nt } from "@univerjs/sheets";
|
|
12
|
+
import { singleReferenceToGrid as Z, serializeRange as rt } from "@univerjs/engine-formula";
|
|
13
|
+
import { ThreadCommentModel as _e, DeleteCommentMutation as z, AddCommentMutation as Q } from "@univerjs/thread-comment";
|
|
14
|
+
import { IThreadCommentDataSourceService as wn } from "@univerjs/thread-comment";
|
|
15
|
+
import { SheetCanvasPopManagerService as ot, IMarkSelectionService as it, whenSheetEditorFocused as st, getCurrentRangeDisable$ as fe, SheetPermissionInterceptorBaseController as Ce, ScrollToRangeOperation as at, SheetSkeletonManagerService as ct, ISheetClipboardService as ut, COPY_TYPE as dt, HoverManagerService as mt } from "@univerjs/sheets-ui";
|
|
16
|
+
import { SheetsThreadCommentModel as $, UniverSheetsThreadCommentBasePlugin as ht } from "@univerjs/sheets-thread-comment-base";
|
|
17
|
+
import { SheetsThreadCommentModel as yn } from "@univerjs/sheets-thread-comment-base";
|
|
18
|
+
import { useDependency as M } from "@wendellhu/redi/react-bindings";
|
|
19
|
+
import Se, { forwardRef as Ie, useRef as ge, createElement as Pe, useMemo as pt, useCallback as se, useEffect as lt } from "react";
|
|
20
|
+
import { BehaviorSubject as vt, map as _t, debounceTime as ft } from "rxjs";
|
|
21
|
+
import { IRenderManagerService as Ct } from "@univerjs/engine-render";
|
|
22
|
+
var f = function() {
|
|
23
|
+
return f = Object.assign || function(t) {
|
|
24
|
+
for (var e, n = 1, r = arguments.length; n < r; n++) {
|
|
25
25
|
e = arguments[n];
|
|
26
|
-
for (var
|
|
27
|
-
Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
|
|
26
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
|
|
28
27
|
}
|
|
29
28
|
return t;
|
|
30
|
-
},
|
|
31
|
-
},
|
|
29
|
+
}, f.apply(this, arguments);
|
|
30
|
+
}, St = function(t, e) {
|
|
32
31
|
var n = {};
|
|
33
|
-
for (var
|
|
34
|
-
Object.prototype.hasOwnProperty.call(t, o) && e.indexOf(o) < 0 && (n[o] = t[o]);
|
|
32
|
+
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
35
33
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
36
|
-
for (var
|
|
37
|
-
e.indexOf(o
|
|
34
|
+
for (var o = 0, r = Object.getOwnPropertySymbols(t); o < r.length; o++)
|
|
35
|
+
e.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[o]) && (n[r[o]] = t[r[o]]);
|
|
38
36
|
return n;
|
|
39
|
-
},
|
|
40
|
-
var n = t.icon,
|
|
41
|
-
return be(n, "".concat(
|
|
37
|
+
}, Te = Ie(function(t, e) {
|
|
38
|
+
var n = t.icon, r = t.id, o = t.className, i = t.extend, s = St(t, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(r, " ").concat(o || "").trim(), d = ge("_".concat(Pt()));
|
|
39
|
+
return be(n, "".concat(r), { defIds: n.defIds, idSuffix: d.current }, f({ ref: e, className: a }, s), i);
|
|
42
40
|
});
|
|
43
|
-
function be(t, e, n,
|
|
44
|
-
return
|
|
45
|
-
return be(i, "".concat(e, "-").concat(t.tag, "-").concat(s), n, void 0,
|
|
41
|
+
function be(t, e, n, r, o) {
|
|
42
|
+
return Pe(t.tag, f(f({ key: e }, It(t, n, o)), r), (gt(t, n).children || []).map(function(i, s) {
|
|
43
|
+
return be(i, "".concat(e, "-").concat(t.tag, "-").concat(s), n, void 0, o);
|
|
46
44
|
}));
|
|
47
45
|
}
|
|
48
|
-
function
|
|
49
|
-
var
|
|
50
|
-
n != null && n.colorChannel1 &&
|
|
51
|
-
var
|
|
52
|
-
return !
|
|
53
|
-
var s = i[0],
|
|
54
|
-
typeof
|
|
55
|
-
})),
|
|
46
|
+
function It(t, e, n) {
|
|
47
|
+
var r = f({}, t.attrs);
|
|
48
|
+
n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
|
|
49
|
+
var o = e.defIds;
|
|
50
|
+
return !o || o.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(i) {
|
|
51
|
+
var s = i[0], a = i[1];
|
|
52
|
+
typeof a == "string" && (r[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
53
|
+
})), r;
|
|
56
54
|
}
|
|
57
|
-
function
|
|
58
|
-
var n,
|
|
59
|
-
return !
|
|
60
|
-
return typeof
|
|
55
|
+
function gt(t, e) {
|
|
56
|
+
var n, r = e.defIds;
|
|
57
|
+
return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? f(f({}, t), { children: t.children.map(function(o) {
|
|
58
|
+
return typeof o.attrs.id == "string" && r && r.indexOf(o.attrs.id) > -1 ? f(f({}, o), { attrs: f(f({}, o.attrs), { id: o.attrs.id + e.idSuffix }) }) : o;
|
|
61
59
|
}) }) : t;
|
|
62
60
|
}
|
|
63
|
-
function
|
|
61
|
+
function Pt() {
|
|
64
62
|
return Math.random().toString(36).substring(2, 8);
|
|
65
63
|
}
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
return
|
|
64
|
+
Te.displayName = "UniverIcon";
|
|
65
|
+
var Tt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, we = Ie(function(t, e) {
|
|
66
|
+
return Pe(Te, Object.assign({}, t, {
|
|
69
67
|
id: "comment-single",
|
|
70
68
|
ref: e,
|
|
71
|
-
icon:
|
|
69
|
+
icon: Tt
|
|
72
70
|
}));
|
|
73
71
|
});
|
|
74
|
-
|
|
75
|
-
const Me = "univer.sheet.thread-comment-modal",
|
|
76
|
-
var bt = Object.defineProperty,
|
|
77
|
-
for (var
|
|
78
|
-
(s = t[i]) && (
|
|
79
|
-
return
|
|
80
|
-
},
|
|
81
|
-
let
|
|
72
|
+
we.displayName = "CommentSingle";
|
|
73
|
+
const Me = "univer.sheet.thread-comment-modal", ne = "comment-single", ye = "SHEET_THREAD_COMMENT";
|
|
74
|
+
var bt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, Mt = (t, e, n, r) => {
|
|
75
|
+
for (var o = r > 1 ? void 0 : r ? wt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
|
|
76
|
+
(s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
|
|
77
|
+
return r && o && bt(e, n, o), o;
|
|
78
|
+
}, ae = (t, e) => (n, r) => e(n, r, t);
|
|
79
|
+
let y = class extends U {
|
|
82
80
|
constructor(e, n) {
|
|
83
81
|
super();
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
E(this, "_lastPopup", null);
|
|
83
|
+
E(this, "_activePopup");
|
|
84
|
+
E(this, "_activePopup$", new vt(null));
|
|
85
|
+
E(this, "activePopup$", this._activePopup$.asObservable());
|
|
88
86
|
this._canvasPopupManagerService = e, this._zenZoneService = n, this._initZenVisible();
|
|
89
87
|
}
|
|
90
88
|
get activePopup() {
|
|
@@ -96,18 +94,18 @@ let M = class extends U {
|
|
|
96
94
|
}));
|
|
97
95
|
}
|
|
98
96
|
showPopup(e, n) {
|
|
99
|
-
var
|
|
100
|
-
const { row:
|
|
101
|
-
if (this._activePopup &&
|
|
97
|
+
var c;
|
|
98
|
+
const { row: r, col: o, unitId: i, subUnitId: s } = e;
|
|
99
|
+
if (this._activePopup && r === this._activePopup.row && o === this._activePopup.col && i === this._activePopup.unitId && s === ((c = this.activePopup) == null ? void 0 : c.subUnitId)) {
|
|
102
100
|
this._activePopup = e, this._activePopup$.next(e);
|
|
103
101
|
return;
|
|
104
102
|
}
|
|
105
103
|
if (this._lastPopup && this._lastPopup.dispose(), this._zenZoneService.visible)
|
|
106
104
|
return;
|
|
107
105
|
this._activePopup = e, this._activePopup$.next(e);
|
|
108
|
-
const
|
|
109
|
-
o,
|
|
106
|
+
const a = this._canvasPopupManagerService.attachPopupToCell(
|
|
110
107
|
r,
|
|
108
|
+
o,
|
|
111
109
|
{
|
|
112
110
|
componentKey: Me,
|
|
113
111
|
onClickOutside: () => {
|
|
@@ -120,14 +118,14 @@ let M = class extends U {
|
|
|
120
118
|
].filter(Boolean)
|
|
121
119
|
}
|
|
122
120
|
);
|
|
123
|
-
if (!
|
|
121
|
+
if (!a)
|
|
124
122
|
throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");
|
|
125
|
-
const
|
|
126
|
-
|
|
123
|
+
const d = new Ne();
|
|
124
|
+
d.add(a), d.add({
|
|
127
125
|
dispose: () => {
|
|
128
126
|
n == null || n();
|
|
129
127
|
}
|
|
130
|
-
}), this._lastPopup =
|
|
128
|
+
}), this._lastPopup = d;
|
|
131
129
|
}
|
|
132
130
|
hidePopup() {
|
|
133
131
|
this._activePopup && (this._lastPopup && this._lastPopup.dispose(), this._lastPopup = null, this._activePopup = null, this._activePopup$.next(null));
|
|
@@ -139,88 +137,89 @@ let M = class extends U {
|
|
|
139
137
|
}, this._activePopup$.next(this._activePopup));
|
|
140
138
|
}
|
|
141
139
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
],
|
|
146
|
-
const
|
|
147
|
-
const t =
|
|
148
|
-
if (
|
|
140
|
+
y = Mt([
|
|
141
|
+
ae(0, p(ot)),
|
|
142
|
+
ae(1, We)
|
|
143
|
+
], y);
|
|
144
|
+
const yt = () => {
|
|
145
|
+
const t = M(R), e = M(y), n = W(e.activePopup$), r = M($);
|
|
146
|
+
if (W(r.commentUpdate$), !n)
|
|
149
147
|
return null;
|
|
150
|
-
const { row:
|
|
148
|
+
const { row: o, col: i, unitId: s, subUnitId: a, trigger: d } = n, c = r.getByLocation(s, a, o, i), h = `${me.chatAtABC(i)}${o + 1}`, u = () => {
|
|
151
149
|
e.hidePopup();
|
|
152
|
-
},
|
|
153
|
-
var
|
|
154
|
-
return (O = (
|
|
150
|
+
}, g = (C) => {
|
|
151
|
+
var l, P, O;
|
|
152
|
+
return (O = (P = (l = t.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : l.getSheetBySheetId(C)) == null ? void 0 : P.getName()) != null ? O : "";
|
|
155
153
|
};
|
|
156
|
-
return /* @__PURE__ */
|
|
157
|
-
|
|
154
|
+
return /* @__PURE__ */ Se.createElement(
|
|
155
|
+
He,
|
|
158
156
|
{
|
|
159
157
|
onClick: () => {
|
|
160
158
|
e.persistPopup();
|
|
161
159
|
},
|
|
162
160
|
prefix: "cell",
|
|
163
|
-
id:
|
|
161
|
+
id: c,
|
|
164
162
|
unitId: s,
|
|
165
|
-
subUnitId:
|
|
163
|
+
subUnitId: a,
|
|
166
164
|
type: b.UNIVER_SHEET,
|
|
167
|
-
refStr:
|
|
168
|
-
onClose:
|
|
169
|
-
getSubUnitName:
|
|
170
|
-
autoFocus:
|
|
165
|
+
refStr: h,
|
|
166
|
+
onClose: u,
|
|
167
|
+
getSubUnitName: g,
|
|
168
|
+
autoFocus: d === "context-menu"
|
|
171
169
|
}
|
|
172
170
|
);
|
|
173
|
-
},
|
|
174
|
-
type:
|
|
171
|
+
}, X = {
|
|
172
|
+
type: xe.OPERATION,
|
|
175
173
|
id: "sheets.operation.show-comment-modal",
|
|
176
174
|
handler(t) {
|
|
177
|
-
var
|
|
178
|
-
const e = t.get(
|
|
175
|
+
var P;
|
|
176
|
+
const e = t.get(qe), n = t.get(R), r = t.get(y), o = t.get(te), i = (P = e.getFirst()) == null ? void 0 : P.primary, s = e.getCurrent(), a = t.get($);
|
|
179
177
|
if (!s || !i)
|
|
180
178
|
return !1;
|
|
181
|
-
const { unitId:
|
|
182
|
-
if (!
|
|
179
|
+
const { unitId: d, sheetId: c } = s, h = Xe(n, { unitId: d, subUnitId: c });
|
|
180
|
+
if (!h)
|
|
183
181
|
return !1;
|
|
184
|
-
const { workbook:
|
|
185
|
-
workbook:
|
|
186
|
-
worksheet:
|
|
187
|
-
unitId:
|
|
188
|
-
subUnitId:
|
|
182
|
+
const { workbook: u, worksheet: g } = h, C = {
|
|
183
|
+
workbook: u,
|
|
184
|
+
worksheet: g,
|
|
185
|
+
unitId: d,
|
|
186
|
+
subUnitId: c,
|
|
189
187
|
row: i.startRow,
|
|
190
188
|
col: i.startColumn
|
|
191
189
|
};
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
return
|
|
195
|
-
unitId:
|
|
196
|
-
subUnitId:
|
|
197
|
-
commentId:
|
|
190
|
+
r.showPopup(C);
|
|
191
|
+
const l = a.getByLocation(d, c, i.startRow, i.startColumn);
|
|
192
|
+
return l && o.setActiveComment({
|
|
193
|
+
unitId: d,
|
|
194
|
+
subUnitId: c,
|
|
195
|
+
commentId: l,
|
|
198
196
|
trigger: "context-menu"
|
|
199
197
|
}), !0;
|
|
200
198
|
}
|
|
201
199
|
}, Ot = () => {
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
var _;
|
|
201
|
+
const t = M(it), e = M(R), n = M(_e), r = M(y), o = e.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
202
|
+
if (!o)
|
|
204
203
|
return null;
|
|
205
|
-
const i =
|
|
206
|
-
const
|
|
207
|
-
return
|
|
208
|
-
|
|
209
|
-
}),
|
|
210
|
-
var
|
|
211
|
-
const
|
|
212
|
-
return { ...
|
|
213
|
-
}).sort((
|
|
214
|
-
}, [
|
|
215
|
-
if (
|
|
216
|
-
const { row:
|
|
217
|
-
if (!Number.isNaN(
|
|
204
|
+
const i = o.getUnitId(), s = M(ee), a = pt(() => o.activeSheet$.pipe(_t((m) => m == null ? void 0 : m.getSheetId())), [o.activeSheet$]), d = W(a, (_ = o.getActiveSheet()) == null ? void 0 : _.getSheetId()), c = ge(), h = M(te), u = W(h.activeCommentId$), g = se((m) => {
|
|
205
|
+
const v = o.getSheets(), w = {};
|
|
206
|
+
return v.forEach((S, T) => {
|
|
207
|
+
w[S.getSheetId()] = T;
|
|
208
|
+
}), m.map((S) => {
|
|
209
|
+
var re;
|
|
210
|
+
const T = Z(S.ref), Ue = [(re = w[S.subUnitId]) != null ? re : 0, T.row, T.column];
|
|
211
|
+
return { ...S, p: Ue };
|
|
212
|
+
}).sort((S, T) => S.p[0] === T.p[0] ? S.p[1] === T.p[1] ? S.p[2] - T.p[2] : S.p[1] - T.p[1] : S.p[0] - T.p[0]);
|
|
213
|
+
}, [o]), C = se((m) => {
|
|
214
|
+
if (m.unitId === i && m.subUnitId === d && !m.resolved) {
|
|
215
|
+
const { row: v, column: w } = Z(m.ref);
|
|
216
|
+
if (!Number.isNaN(v) && !Number.isNaN(w))
|
|
218
217
|
return t.addShape({
|
|
219
218
|
range: {
|
|
220
|
-
startColumn:
|
|
221
|
-
endColumn:
|
|
222
|
-
startRow:
|
|
223
|
-
endRow:
|
|
219
|
+
startColumn: w,
|
|
220
|
+
endColumn: w,
|
|
221
|
+
startRow: v,
|
|
222
|
+
endRow: v
|
|
224
223
|
},
|
|
225
224
|
style: {
|
|
226
225
|
hasAutoFill: !1,
|
|
@@ -232,116 +231,116 @@ const wt = () => {
|
|
|
232
231
|
primary: null
|
|
233
232
|
});
|
|
234
233
|
}
|
|
235
|
-
}, [t,
|
|
236
|
-
var
|
|
237
|
-
return (
|
|
238
|
-
},
|
|
239
|
-
s.executeCommand(
|
|
234
|
+
}, [t, d, i]), l = (m) => {
|
|
235
|
+
var v, w;
|
|
236
|
+
return (w = (v = o.getSheetBySheetId(m)) == null ? void 0 : v.getName()) != null ? w : "";
|
|
237
|
+
}, P = () => {
|
|
238
|
+
s.executeCommand(X.id);
|
|
240
239
|
}, O = () => {
|
|
241
|
-
|
|
242
|
-
},
|
|
243
|
-
|
|
244
|
-
},
|
|
245
|
-
|
|
240
|
+
r.hidePopup();
|
|
241
|
+
}, j = (m) => {
|
|
242
|
+
u && u.unitId === m.unitId && u.subUnitId === m.subUnitId && u.commentId === m.id || (c.current && (t.removeShape(c.current), c.current = null), c.current = C(m));
|
|
243
|
+
}, A = () => {
|
|
244
|
+
c.current && (t.removeShape(c.current), c.current = null);
|
|
246
245
|
};
|
|
247
|
-
return
|
|
248
|
-
if (!
|
|
246
|
+
return lt(() => {
|
|
247
|
+
if (!u)
|
|
249
248
|
return;
|
|
250
|
-
const
|
|
251
|
-
if (!
|
|
249
|
+
const m = n.getComment(u.unitId, u.subUnitId, u.commentId);
|
|
250
|
+
if (!m)
|
|
252
251
|
return;
|
|
253
|
-
const
|
|
252
|
+
const v = C(m);
|
|
254
253
|
return () => {
|
|
255
|
-
|
|
254
|
+
v && t.removeShape(v);
|
|
256
255
|
};
|
|
257
|
-
}, [C,
|
|
256
|
+
}, [C, u, n, t]), /* @__PURE__ */ Se.createElement(
|
|
258
257
|
Le,
|
|
259
258
|
{
|
|
260
259
|
unitId: i,
|
|
261
|
-
subUnitId$:
|
|
260
|
+
subUnitId$: a,
|
|
262
261
|
type: b.UNIVER_SHEET,
|
|
263
|
-
onAdd:
|
|
264
|
-
getSubUnitName:
|
|
262
|
+
onAdd: P,
|
|
263
|
+
getSubUnitName: l,
|
|
265
264
|
onResolve: O,
|
|
266
|
-
sortComments:
|
|
267
|
-
onItemEnter:
|
|
268
|
-
onItemLeave:
|
|
265
|
+
sortComments: g,
|
|
266
|
+
onItemEnter: j,
|
|
267
|
+
onItemLeave: A
|
|
269
268
|
}
|
|
270
269
|
);
|
|
271
|
-
},
|
|
272
|
-
id:
|
|
273
|
-
type:
|
|
274
|
-
positions: [
|
|
275
|
-
icon:
|
|
270
|
+
}, Et = (t) => ({
|
|
271
|
+
id: X.id,
|
|
272
|
+
type: he.BUTTON,
|
|
273
|
+
positions: [pe.CONTEXT_MENU],
|
|
274
|
+
icon: ne,
|
|
276
275
|
title: "sheetThreadComment.menu.addComment",
|
|
277
|
-
hidden$:
|
|
276
|
+
hidden$: le(t, b.UNIVER_SHEET),
|
|
278
277
|
disabled$: fe(t, {
|
|
279
|
-
workbookTypes: [
|
|
280
|
-
worksheetTypes: [
|
|
281
|
-
rangeTypes: [
|
|
278
|
+
workbookTypes: [K],
|
|
279
|
+
worksheetTypes: [Y],
|
|
280
|
+
rangeTypes: [q]
|
|
282
281
|
})
|
|
283
282
|
}), Ut = (t) => ({
|
|
284
|
-
id:
|
|
285
|
-
type:
|
|
286
|
-
icon:
|
|
283
|
+
id: Be.id,
|
|
284
|
+
type: he.BUTTON,
|
|
285
|
+
icon: ne,
|
|
287
286
|
tooltip: "sheetThreadComment.menu.commentManagement",
|
|
288
|
-
positions:
|
|
287
|
+
positions: pe.TOOLBAR_START,
|
|
289
288
|
group: ze.TOOLBAR_OTHERS,
|
|
290
289
|
disabled$: fe(t, {
|
|
291
|
-
workbookTypes: [
|
|
292
|
-
worksheetTypes: [
|
|
293
|
-
rangeTypes: [
|
|
290
|
+
workbookTypes: [K],
|
|
291
|
+
worksheetTypes: [Y],
|
|
292
|
+
rangeTypes: [q]
|
|
294
293
|
}),
|
|
295
|
-
hidden$:
|
|
296
|
-
}),
|
|
297
|
-
id:
|
|
298
|
-
binding: Ze.M |
|
|
299
|
-
preconditions:
|
|
294
|
+
hidden$: le(t, b.UNIVER_SHEET)
|
|
295
|
+
}), Rt = {
|
|
296
|
+
id: X.id,
|
|
297
|
+
binding: Ze.M | ie.CTRL_COMMAND | ie.ALT,
|
|
298
|
+
preconditions: st
|
|
300
299
|
};
|
|
301
|
-
var
|
|
302
|
-
for (var
|
|
303
|
-
(s = t[i]) && (
|
|
304
|
-
return
|
|
305
|
-
},
|
|
306
|
-
const
|
|
307
|
-
let
|
|
308
|
-
constructor(t, e, n,
|
|
309
|
-
super(), this._config = t, this._menuService = e, this._injector = n, this._componentManager =
|
|
300
|
+
var $t = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, xt = (t, e, n, r) => {
|
|
301
|
+
for (var o = r > 1 ? void 0 : r ? Nt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
|
|
302
|
+
(s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
|
|
303
|
+
return r && o && $t(e, n, o), o;
|
|
304
|
+
}, I = (t, e) => (n, r) => e(n, r, t);
|
|
305
|
+
const Dt = {};
|
|
306
|
+
let N = class extends U {
|
|
307
|
+
constructor(t, e, n, r, o, i, s, a, d, c, h, u) {
|
|
308
|
+
super(), this._config = t, this._menuService = e, this._injector = n, this._componentManager = r, this._localeService = o, this._commandService = i, this._sheetsThreadCommentPopupService = s, this._sheetsThreadCommentModel = a, this._threadCommentPanelService = d, this._shortcutService = c, this._univerInstanceService = h, this._sheetPermissionInterceptorBaseController = u, this._initMenu(), this._initShortcut(), this._initComponent(), this._initCommandListener(), this._initPanelListener();
|
|
310
309
|
}
|
|
311
310
|
_initShortcut() {
|
|
312
|
-
this._shortcutService.registerShortcut(
|
|
311
|
+
this._shortcutService.registerShortcut(Rt);
|
|
313
312
|
}
|
|
314
313
|
_initCommandListener() {
|
|
315
314
|
this._commandService.onCommandExecuted((t) => {
|
|
316
|
-
if (t.id ===
|
|
317
|
-
const e = t.params, { unitId: n, subUnitId:
|
|
318
|
-
if ((i ===
|
|
319
|
-
const s =
|
|
320
|
-
if (!this._sheetsThreadCommentModel.showCommentMarker(n,
|
|
321
|
-
this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(
|
|
315
|
+
if (t.id === Je.id) {
|
|
316
|
+
const e = t.params, { unitId: n, subUnitId: r, selections: o, type: i } = e;
|
|
317
|
+
if ((i === Qe.MOVE_END || i === void 0) && o[0].primary) {
|
|
318
|
+
const s = o[0].primary.actualRow, a = o[0].primary.actualColumn;
|
|
319
|
+
if (!this._sheetsThreadCommentModel.showCommentMarker(n, r, s, a)) {
|
|
320
|
+
this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(oe.id);
|
|
322
321
|
return;
|
|
323
322
|
}
|
|
324
|
-
const
|
|
325
|
-
|
|
323
|
+
const d = this._sheetsThreadCommentModel.getByLocation(n, r, s, a);
|
|
324
|
+
d && this._commandService.executeCommand(oe.id, {
|
|
326
325
|
unitId: n,
|
|
327
|
-
subUnitId:
|
|
328
|
-
commentId:
|
|
326
|
+
subUnitId: r,
|
|
327
|
+
commentId: d
|
|
329
328
|
});
|
|
330
329
|
}
|
|
331
330
|
}
|
|
332
|
-
if (t.id ===
|
|
331
|
+
if (t.id === z.id) {
|
|
333
332
|
const e = t.params, n = this._sheetsThreadCommentPopupService.activePopup;
|
|
334
333
|
if (!n)
|
|
335
334
|
return;
|
|
336
|
-
const { unitId:
|
|
337
|
-
e.unitId ===
|
|
335
|
+
const { unitId: r, subUnitId: o, commentId: i } = n;
|
|
336
|
+
e.unitId === r && e.subUnitId === o && e.commentId === i && this._sheetsThreadCommentPopupService.hidePopup();
|
|
338
337
|
}
|
|
339
338
|
});
|
|
340
339
|
}
|
|
341
340
|
_initMenu() {
|
|
342
341
|
const { menu: t = {} } = this._config;
|
|
343
342
|
[
|
|
344
|
-
|
|
343
|
+
Et,
|
|
345
344
|
Ut
|
|
346
345
|
].forEach((e) => {
|
|
347
346
|
this._menuService.addMenuItem(e(this._injector), t);
|
|
@@ -349,77 +348,86 @@ let $ = class extends U {
|
|
|
349
348
|
}
|
|
350
349
|
_initComponent() {
|
|
351
350
|
[
|
|
352
|
-
[Me,
|
|
353
|
-
[
|
|
354
|
-
[
|
|
351
|
+
[Me, yt],
|
|
352
|
+
[Fe, Ot],
|
|
353
|
+
[ne, we]
|
|
355
354
|
].forEach(([t, e]) => {
|
|
356
355
|
this._componentManager.register(t, e);
|
|
357
356
|
});
|
|
358
357
|
}
|
|
359
358
|
_initPanelListener() {
|
|
360
359
|
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async (t) => {
|
|
360
|
+
var e;
|
|
361
361
|
if (t) {
|
|
362
|
-
const { unitId:
|
|
363
|
-
if (!
|
|
362
|
+
const { unitId: n, subUnitId: r, commentId: o, trigger: i } = t, s = this._sheetsThreadCommentModel.getComment(n, r, o);
|
|
363
|
+
if (!s || s.resolved)
|
|
364
364
|
return;
|
|
365
|
-
const
|
|
366
|
-
if (!
|
|
365
|
+
const a = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
366
|
+
if (!a || a.getUnitId() !== n)
|
|
367
367
|
return;
|
|
368
|
-
|
|
369
|
-
unitId:
|
|
370
|
-
subUnitId:
|
|
368
|
+
((e = a.getActiveSheet()) == null ? void 0 : e.getSheetId()) !== r && await this._commandService.executeCommand(et.id, {
|
|
369
|
+
unitId: n,
|
|
370
|
+
subUnitId: r
|
|
371
371
|
});
|
|
372
|
-
const
|
|
373
|
-
|
|
372
|
+
const h = Z(s.ref), { row: u, column: g } = h;
|
|
373
|
+
if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
374
|
+
workbookTypes: [K],
|
|
375
|
+
worksheetTypes: [Y],
|
|
376
|
+
rangeTypes: [q]
|
|
377
|
+
}, [{ startRow: u, startColumn: g, endRow: u, endColumn: g }]))
|
|
378
|
+
return;
|
|
379
|
+
const l = 5;
|
|
380
|
+
await this._commandService.executeCommand(at.id, {
|
|
374
381
|
range: {
|
|
375
|
-
startRow: Math.max(
|
|
376
|
-
endRow:
|
|
377
|
-
startColumn: Math.max(
|
|
378
|
-
endColumn:
|
|
382
|
+
startRow: Math.max(h.row - l, 0),
|
|
383
|
+
endRow: h.row + l,
|
|
384
|
+
startColumn: Math.max(h.column - l, 0),
|
|
385
|
+
endColumn: h.column + l
|
|
379
386
|
}
|
|
380
387
|
}), this._sheetsThreadCommentPopupService.showPopup({
|
|
381
|
-
unitId:
|
|
382
|
-
subUnitId:
|
|
383
|
-
row:
|
|
384
|
-
col:
|
|
385
|
-
commentId:
|
|
386
|
-
trigger:
|
|
388
|
+
unitId: n,
|
|
389
|
+
subUnitId: r,
|
|
390
|
+
row: h.row,
|
|
391
|
+
col: h.column,
|
|
392
|
+
commentId: s.id,
|
|
393
|
+
trigger: i
|
|
387
394
|
});
|
|
388
395
|
} else
|
|
389
396
|
this._sheetsThreadCommentPopupService.hidePopup();
|
|
390
397
|
}));
|
|
391
398
|
}
|
|
392
399
|
};
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
400
|
+
N = xt([
|
|
401
|
+
x(D.Starting, N),
|
|
402
|
+
I(1, Ke),
|
|
403
|
+
I(2, p(de)),
|
|
404
|
+
I(3, p(Ge)),
|
|
405
|
+
I(4, p(De)),
|
|
406
|
+
I(5, ee),
|
|
407
|
+
I(6, p(y)),
|
|
408
|
+
I(7, p($)),
|
|
409
|
+
I(8, p(te)),
|
|
410
|
+
I(9, Ye),
|
|
411
|
+
I(10, R),
|
|
412
|
+
I(11, p(Ce))
|
|
413
|
+
], N);
|
|
414
|
+
var jt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, Vt = (t, e, n, r) => {
|
|
415
|
+
for (var o = r > 1 ? void 0 : r ? At(e, n) : e, i = t.length - 1, s; i >= 0; i--)
|
|
416
|
+
(s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
|
|
417
|
+
return r && o && jt(e, n, o), o;
|
|
418
|
+
}, V = (t, e) => (n, r) => e(n, r, t);
|
|
419
|
+
let L = class extends U {
|
|
420
|
+
constructor(t, e, n, r) {
|
|
421
|
+
super(), this._sheetInterceptorService = t, this._sheetsThreadCommentModel = e, this._univerInstanceService = n, this._renderManagerService = r, this._initViewModelIntercept(), this._initSkeletonChange();
|
|
414
422
|
}
|
|
415
423
|
_initViewModelIntercept() {
|
|
416
424
|
this.disposeWithMe(
|
|
417
425
|
this._sheetInterceptorService.intercept(
|
|
418
|
-
|
|
426
|
+
tt.CELL_CONTENT,
|
|
419
427
|
{
|
|
420
428
|
handler: (t, e, n) => {
|
|
421
|
-
const { row:
|
|
422
|
-
return this._sheetsThreadCommentModel.showCommentMarker(i, s,
|
|
429
|
+
const { row: r, col: o, unitId: i, subUnitId: s } = e;
|
|
430
|
+
return this._sheetsThreadCommentModel.showCommentMarker(i, s, r, o) ? n({
|
|
423
431
|
...t,
|
|
424
432
|
markers: {
|
|
425
433
|
...t == null ? void 0 : t.markers,
|
|
@@ -437,116 +445,121 @@ let V = class extends U {
|
|
|
437
445
|
}
|
|
438
446
|
_initSkeletonChange() {
|
|
439
447
|
const t = () => {
|
|
448
|
+
var s;
|
|
440
449
|
const e = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
441
|
-
if (!e)
|
|
450
|
+
if (!e) return;
|
|
451
|
+
const n = e.getUnitId(), r = (s = e.getActiveSheet()) == null ? void 0 : s.getSheetId();
|
|
452
|
+
if (!r) {
|
|
453
|
+
console.warn("No active sheet found");
|
|
442
454
|
return;
|
|
443
|
-
|
|
444
|
-
|
|
455
|
+
}
|
|
456
|
+
const o = this._renderManagerService.getRenderById(n), i = o == null ? void 0 : o.with(ct).getOrCreateSkeleton({ sheetId: r });
|
|
457
|
+
i == null || i.makeDirty(!0), i == null || i.calculate(), o && o.mainComponent.makeForceDirty();
|
|
445
458
|
};
|
|
446
459
|
this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(() => {
|
|
447
460
|
t();
|
|
448
461
|
}));
|
|
449
462
|
}
|
|
450
463
|
};
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
],
|
|
458
|
-
var
|
|
459
|
-
for (var
|
|
460
|
-
(s = t[i]) && (
|
|
461
|
-
return
|
|
462
|
-
},
|
|
463
|
-
const
|
|
464
|
-
const
|
|
465
|
-
startColumn:
|
|
466
|
-
startRow:
|
|
467
|
-
endColumn:
|
|
468
|
-
endRow:
|
|
464
|
+
L = Vt([
|
|
465
|
+
x(D.Ready, L),
|
|
466
|
+
V(0, p(ve)),
|
|
467
|
+
V(1, p($)),
|
|
468
|
+
V(2, R),
|
|
469
|
+
V(3, Ct)
|
|
470
|
+
], L);
|
|
471
|
+
var Ht = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, Bt = (t, e, n, r) => {
|
|
472
|
+
for (var o = r > 1 ? void 0 : r ? Lt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
|
|
473
|
+
(s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
|
|
474
|
+
return r && o && Ht(e, n, o), o;
|
|
475
|
+
}, ce = (t, e) => (n, r) => e(n, r, t);
|
|
476
|
+
const Ft = (t, e, n) => {
|
|
477
|
+
const r = Z(t), o = n.row - e.row, i = n.column - e.column, s = {
|
|
478
|
+
startColumn: r.column + i,
|
|
479
|
+
startRow: r.row + o,
|
|
480
|
+
endColumn: r.column + i,
|
|
481
|
+
endRow: r.row + o
|
|
469
482
|
};
|
|
470
|
-
return
|
|
483
|
+
return rt(s);
|
|
471
484
|
};
|
|
472
|
-
let
|
|
485
|
+
let B = class extends U {
|
|
473
486
|
constructor(e, n) {
|
|
474
487
|
super();
|
|
475
|
-
|
|
488
|
+
E(this, "_copyInfo");
|
|
476
489
|
this._sheetClipboardService = e, this._sheetsThreadCommentModel = n, this._initClipboardHook();
|
|
477
490
|
}
|
|
478
491
|
// eslint-disable-next-line max-lines-per-function
|
|
479
492
|
_initClipboardHook() {
|
|
480
493
|
this.disposeWithMe(
|
|
481
494
|
this._sheetClipboardService.addClipboardHook({
|
|
482
|
-
id:
|
|
483
|
-
onBeforeCopy: (e, n,
|
|
495
|
+
id: ye,
|
|
496
|
+
onBeforeCopy: (e, n, r) => {
|
|
484
497
|
this._copyInfo = {
|
|
485
498
|
unitId: e,
|
|
486
499
|
subUnitId: n,
|
|
487
|
-
range:
|
|
500
|
+
range: r
|
|
488
501
|
};
|
|
489
502
|
},
|
|
490
503
|
// eslint-disable-next-line max-lines-per-function
|
|
491
|
-
onPasteCells: (e, n,
|
|
492
|
-
const { unitId: i, subUnitId: s, range:
|
|
493
|
-
row:
|
|
494
|
-
column:
|
|
504
|
+
onPasteCells: (e, n, r, o) => {
|
|
505
|
+
const { unitId: i, subUnitId: s, range: a } = n, d = {
|
|
506
|
+
row: a.rows[0],
|
|
507
|
+
column: a.cols[0]
|
|
495
508
|
};
|
|
496
|
-
if (
|
|
497
|
-
const { range:
|
|
498
|
-
row:
|
|
499
|
-
column:
|
|
509
|
+
if (o.copyType === dt.CUT && this._copyInfo) {
|
|
510
|
+
const { range: c, unitId: h, subUnitId: u } = this._copyInfo, g = {
|
|
511
|
+
row: c.startRow,
|
|
512
|
+
column: c.startColumn
|
|
500
513
|
};
|
|
501
|
-
if (!(i ===
|
|
514
|
+
if (!(i === h && s === u)) {
|
|
502
515
|
const C = [];
|
|
503
|
-
|
|
504
|
-
const v = this._sheetsThreadCommentModel.getCommentWithChildren(
|
|
516
|
+
je.foreach(c, (_, m) => {
|
|
517
|
+
const v = this._sheetsThreadCommentModel.getCommentWithChildren(h, u, _, m);
|
|
505
518
|
v && C.push(v);
|
|
506
519
|
});
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
id:
|
|
520
|
+
const l = [], P = [], O = [], j = [], A = (_) => {
|
|
521
|
+
l.unshift({
|
|
522
|
+
id: z.id,
|
|
510
523
|
params: {
|
|
511
|
-
unitId:
|
|
512
|
-
subUnitId:
|
|
513
|
-
commentId:
|
|
524
|
+
unitId: h,
|
|
525
|
+
subUnitId: u,
|
|
526
|
+
commentId: _.id
|
|
514
527
|
}
|
|
515
528
|
}), O.push({
|
|
516
|
-
id:
|
|
529
|
+
id: Q.id,
|
|
517
530
|
params: {
|
|
518
531
|
unitId: i,
|
|
519
532
|
subUnitId: s,
|
|
520
533
|
comment: {
|
|
521
|
-
...
|
|
522
|
-
ref:
|
|
534
|
+
..._,
|
|
535
|
+
ref: Ft(_.ref, g, d),
|
|
523
536
|
unitId: i,
|
|
524
537
|
subUnitId: s
|
|
525
538
|
}
|
|
526
539
|
}
|
|
527
|
-
}),
|
|
528
|
-
id:
|
|
540
|
+
}), P.push({
|
|
541
|
+
id: Q.id,
|
|
529
542
|
params: {
|
|
530
|
-
unitId:
|
|
531
|
-
subUnitId:
|
|
532
|
-
comment:
|
|
543
|
+
unitId: h,
|
|
544
|
+
subUnitId: u,
|
|
545
|
+
comment: _
|
|
533
546
|
}
|
|
534
|
-
}),
|
|
535
|
-
id:
|
|
547
|
+
}), j.unshift({
|
|
548
|
+
id: z.id,
|
|
536
549
|
params: {
|
|
537
550
|
unitId: i,
|
|
538
551
|
subUnitId: s,
|
|
539
|
-
commentId:
|
|
552
|
+
commentId: _.id
|
|
540
553
|
}
|
|
541
554
|
});
|
|
542
555
|
};
|
|
543
|
-
return C.forEach((
|
|
544
|
-
|
|
545
|
-
|
|
556
|
+
return C.forEach((_) => {
|
|
557
|
+
A(_.root), _.children.forEach((m) => {
|
|
558
|
+
A(m);
|
|
546
559
|
});
|
|
547
560
|
}), {
|
|
548
|
-
redos: [...
|
|
549
|
-
undos: [...
|
|
561
|
+
redos: [...l, ...O],
|
|
562
|
+
undos: [...j, ...P]
|
|
550
563
|
};
|
|
551
564
|
}
|
|
552
565
|
}
|
|
@@ -559,34 +572,40 @@ let L = class extends U {
|
|
|
559
572
|
);
|
|
560
573
|
}
|
|
561
574
|
};
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
],
|
|
567
|
-
var
|
|
568
|
-
for (var
|
|
569
|
-
(s = t[i]) && (
|
|
570
|
-
return
|
|
571
|
-
},
|
|
572
|
-
let
|
|
573
|
-
constructor(t, e, n) {
|
|
574
|
-
super(), this._hoverManagerService = t, this._sheetsThreadCommentPopupService = e, this._sheetsThreadCommentModel = n, this._initHoverEvent();
|
|
575
|
+
B = Bt([
|
|
576
|
+
x(D.Rendered, B),
|
|
577
|
+
ce(0, p(ut)),
|
|
578
|
+
ce(1, p($))
|
|
579
|
+
], B);
|
|
580
|
+
var kt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Zt = (t, e, n, r) => {
|
|
581
|
+
for (var o = r > 1 ? void 0 : r ? Wt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
|
|
582
|
+
(s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
|
|
583
|
+
return r && o && kt(e, n, o), o;
|
|
584
|
+
}, H = (t, e) => (n, r) => e(n, r, t);
|
|
585
|
+
let F = class extends U {
|
|
586
|
+
constructor(t, e, n, r) {
|
|
587
|
+
super(), this._hoverManagerService = t, this._sheetsThreadCommentPopupService = e, this._sheetsThreadCommentModel = n, this._sheetPermissionInterceptorBaseController = r, this._initHoverEvent();
|
|
575
588
|
}
|
|
576
589
|
_initHoverEvent() {
|
|
577
590
|
this.disposeWithMe(
|
|
578
|
-
this._hoverManagerService.currentCell$.pipe(
|
|
591
|
+
this._hoverManagerService.currentCell$.pipe(ft(100)).subscribe((t) => {
|
|
579
592
|
const e = this._sheetsThreadCommentPopupService.activePopup;
|
|
580
593
|
if (t && (e && e.temp || !e)) {
|
|
581
|
-
const { location: n } = t, { unitId:
|
|
582
|
-
if (
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
594
|
+
const { location: n } = t, { unitId: r, subUnitId: o, row: i, col: s } = n, a = this._sheetsThreadCommentModel.getByLocation(r, o, i, s);
|
|
595
|
+
if (a) {
|
|
596
|
+
if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
597
|
+
workbookTypes: [K],
|
|
598
|
+
worksheetTypes: [Y],
|
|
599
|
+
rangeTypes: [q]
|
|
600
|
+
}, [{ startRow: i, startColumn: s, endRow: i, endColumn: s }]))
|
|
601
|
+
return;
|
|
602
|
+
const c = this._sheetsThreadCommentModel.getComment(r, o, a);
|
|
603
|
+
c && !c.resolved && this._sheetsThreadCommentPopupService.showPopup({
|
|
604
|
+
unitId: r,
|
|
605
|
+
subUnitId: o,
|
|
587
606
|
row: i,
|
|
588
607
|
col: s,
|
|
589
|
-
commentId:
|
|
608
|
+
commentId: a,
|
|
590
609
|
temp: !0
|
|
591
610
|
});
|
|
592
611
|
} else
|
|
@@ -596,18 +615,19 @@ let H = class extends U {
|
|
|
596
615
|
);
|
|
597
616
|
}
|
|
598
617
|
};
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
618
|
+
F = Zt([
|
|
619
|
+
x(D.Rendered, F),
|
|
620
|
+
H(0, p(mt)),
|
|
621
|
+
H(1, p(y)),
|
|
622
|
+
H(2, p($)),
|
|
623
|
+
H(3, p(Ce))
|
|
624
|
+
], F);
|
|
625
|
+
var zt = Object.defineProperty, Gt = Object.getOwnPropertyDescriptor, Kt = (t, e, n, r) => {
|
|
626
|
+
for (var o = r > 1 ? void 0 : r ? Gt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
|
|
627
|
+
(s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
|
|
628
|
+
return r && o && zt(e, n, o), o;
|
|
629
|
+
}, J = (t, e) => (n, r) => e(n, r, t);
|
|
630
|
+
let k = class extends U {
|
|
611
631
|
constructor(t, e, n) {
|
|
612
632
|
super(), this._sheetInterceptorService = t, this._univerInstanceService = e, this._threadCommentModel = n, this._initSheetChange();
|
|
613
633
|
}
|
|
@@ -615,26 +635,30 @@ let B = class extends U {
|
|
|
615
635
|
this.disposeWithMe(
|
|
616
636
|
this._sheetInterceptorService.interceptCommand({
|
|
617
637
|
getMutations: (t) => {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
638
|
+
var e;
|
|
639
|
+
if (t.id === nt.id) {
|
|
640
|
+
const n = t.params, r = n.unitId ? this._univerInstanceService.getUnit(n.unitId) : this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
641
|
+
if (!r)
|
|
621
642
|
return { redos: [], undos: [] };
|
|
622
|
-
const o =
|
|
623
|
-
|
|
643
|
+
const o = r.getUnitId(), i = n.subUnitId || ((e = r.getActiveSheet()) == null ? void 0 : e.getSheetId());
|
|
644
|
+
if (!i)
|
|
645
|
+
return { redos: [], undos: [] };
|
|
646
|
+
const { commentMap: s } = this._threadCommentModel.ensureMap(o, i), a = Array.from(Object.keys(s)), d = Array.from(Object.values(s)), c = a.map((u) => ({
|
|
647
|
+
id: z.id,
|
|
624
648
|
params: {
|
|
625
649
|
unitId: o,
|
|
626
|
-
subUnitId:
|
|
627
|
-
commentId:
|
|
650
|
+
subUnitId: i,
|
|
651
|
+
commentId: u
|
|
628
652
|
}
|
|
629
|
-
})),
|
|
630
|
-
id:
|
|
653
|
+
})), h = d.map((u) => ({
|
|
654
|
+
id: Q.id,
|
|
631
655
|
params: {
|
|
632
656
|
unitId: o,
|
|
633
|
-
subUnitId:
|
|
634
|
-
comment:
|
|
657
|
+
subUnitId: i,
|
|
658
|
+
comment: u
|
|
635
659
|
}
|
|
636
660
|
}));
|
|
637
|
-
return { redos:
|
|
661
|
+
return { redos: c, undos: h };
|
|
638
662
|
}
|
|
639
663
|
return { redos: [], undos: [] };
|
|
640
664
|
}
|
|
@@ -642,65 +666,65 @@ let B = class extends U {
|
|
|
642
666
|
);
|
|
643
667
|
}
|
|
644
668
|
};
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
],
|
|
651
|
-
var Oe = Object.defineProperty,
|
|
652
|
-
for (var
|
|
653
|
-
(s = t[i]) && (
|
|
654
|
-
return
|
|
655
|
-
},
|
|
656
|
-
let
|
|
657
|
-
constructor(e = {}, n,
|
|
669
|
+
k = Kt([
|
|
670
|
+
x(D.Ready, k),
|
|
671
|
+
J(0, p(ve)),
|
|
672
|
+
J(1, R),
|
|
673
|
+
J(2, p(_e))
|
|
674
|
+
], k);
|
|
675
|
+
var Oe = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, qt = (t, e, n) => e in t ? Oe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Xt = (t, e, n, r) => {
|
|
676
|
+
for (var o = r > 1 ? void 0 : r ? Yt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
|
|
677
|
+
(s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
|
|
678
|
+
return r && o && Oe(e, n, o), o;
|
|
679
|
+
}, ue = (t, e) => (n, r) => e(n, r, t), Ee = (t, e, n) => qt(t, typeof e != "symbol" ? e + "" : e, n);
|
|
680
|
+
let G = class extends Ve {
|
|
681
|
+
constructor(e = {}, n, r) {
|
|
658
682
|
super();
|
|
659
|
-
|
|
660
|
-
this._injector = n, this._commandService =
|
|
683
|
+
E(this, "_pluginConfig");
|
|
684
|
+
this._injector = n, this._commandService = r, this._pluginConfig = me.deepMerge({}, Dt, e);
|
|
661
685
|
}
|
|
662
686
|
onStarting(e) {
|
|
663
687
|
[
|
|
664
688
|
[
|
|
665
|
-
|
|
689
|
+
N,
|
|
666
690
|
{
|
|
667
|
-
useFactory: () => this._injector.createInstance(
|
|
691
|
+
useFactory: () => this._injector.createInstance(N, this._pluginConfig)
|
|
668
692
|
}
|
|
669
693
|
],
|
|
670
|
-
[V],
|
|
671
694
|
[L],
|
|
672
|
-
[H],
|
|
673
695
|
[B],
|
|
674
|
-
[
|
|
696
|
+
[F],
|
|
697
|
+
[k],
|
|
698
|
+
[y]
|
|
675
699
|
].forEach((n) => {
|
|
676
700
|
e.add(n);
|
|
677
|
-
}), [
|
|
701
|
+
}), [X].forEach((n) => {
|
|
678
702
|
this._commandService.registerCommand(n);
|
|
679
703
|
});
|
|
680
704
|
}
|
|
681
705
|
};
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
],
|
|
706
|
+
Ee(G, "pluginName", ye);
|
|
707
|
+
Ee(G, "type", b.UNIVER_SHEET);
|
|
708
|
+
G = Xt([
|
|
709
|
+
Ae(ke, ht),
|
|
710
|
+
ue(1, p(de)),
|
|
711
|
+
ue(2, p(ee))
|
|
712
|
+
], G);
|
|
689
713
|
export {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
714
|
+
Cn as ICommandService,
|
|
715
|
+
wn as IThreadCommentDataSourceService,
|
|
716
|
+
Pn as IThreadCommentMentionDataService,
|
|
717
|
+
vn as Inject,
|
|
718
|
+
_n as Injector,
|
|
719
|
+
Sn as Plugin,
|
|
720
|
+
ye as SHEETS_THREAD_COMMENT,
|
|
721
|
+
N as SheetsThreadCommentController,
|
|
722
|
+
B as SheetsThreadCommentCopyPasteController,
|
|
723
|
+
F as SheetsThreadCommentHoverController,
|
|
724
|
+
yn as SheetsThreadCommentModel,
|
|
725
|
+
y as SheetsThreadCommentPopupService,
|
|
726
|
+
k as ThreadCommentRemoveSheetsController,
|
|
727
|
+
In as UniverInstanceType,
|
|
728
|
+
G as UniverSheetsThreadCommentPlugin,
|
|
729
|
+
Tn as UniverThreadCommentUIPlugin
|
|
706
730
|
};
|