@univerjs/sheets-thread-comment-ui 0.4.2-nightly.202411081606 → 0.4.2-nightly.202411091134
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 +9 -1
- package/lib/es/index.js +366 -344
- package/lib/umd/index.js +9 -1
- package/package.json +12 -12
package/lib/es/index.js
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var E = (o, e,
|
|
4
|
-
import { Inject as v, Disposable as $, DisposableCollection as
|
|
5
|
-
import { SheetsSelectionsService as
|
|
6
|
-
import { SheetsThreadCommentModel as
|
|
7
|
-
import { ThreadCommentPanelService as
|
|
8
|
-
import { IThreadCommentMentionDataService as
|
|
9
|
-
import { SheetCanvasPopManagerService as
|
|
10
|
-
import { IZenZoneService as
|
|
11
|
-
import { BehaviorSubject as
|
|
12
|
-
import { IRenderManagerService as
|
|
13
|
-
import {
|
|
14
|
-
import { singleReferenceToGrid as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
constructor(e, n) {
|
|
1
|
+
var Be = Object.defineProperty;
|
|
2
|
+
var Le = (o, e, r) => e in o ? Be(o, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[e] = r;
|
|
3
|
+
var E = (o, e, r) => Le(o, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { Inject as v, Disposable as $, DisposableCollection as He, CommandType as Fe, IUniverInstanceService as N, InterceptorEffectEnum as ke, UniverInstanceType as b, useDependency as O, Tools as We, ICommandService as se, Range as Ze, RANGE_TYPE as he, Rectangle as ze, DependentOn as Ge, Injector as Ye, Plugin as qe, IConfigService as Ke } from "@univerjs/core";
|
|
5
|
+
import { SheetsSelectionsService as ve, getSheetCommandTarget as Je, SheetInterceptorService as _e, INTERCEPTOR_POINT as Qe, WorkbookCommentPermission as K, WorksheetViewPermission as J, RangeProtectionPermissionViewPoint as Q, SetWorksheetActiveOperation as Xe, RemoveSheetCommand as et } from "@univerjs/sheets";
|
|
6
|
+
import { SheetsThreadCommentModel as x, UniverSheetsThreadCommentPlugin as tt } from "@univerjs/sheets-thread-comment";
|
|
7
|
+
import { ThreadCommentPanelService as ae, ThreadCommentTree as nt, ThreadCommentPanel as rt, ToggleSheetCommentPanelOperation as fe, THREAD_COMMENT_PANEL as ot, SetActiveCommentOperation as te, UniverThreadCommentUIPlugin as it } from "@univerjs/thread-comment-ui";
|
|
8
|
+
import { IThreadCommentMentionDataService as xn, UniverThreadCommentUIPlugin as Dn } from "@univerjs/thread-comment-ui";
|
|
9
|
+
import { SheetCanvasPopManagerService as st, IMarkSelectionService as Ce, whenSheetEditorFocused as at, getCurrentRangeDisable$ as Se, ISheetClipboardService as ct, COPY_TYPE as mt, HoverManagerService as dt, SheetPermissionInterceptorBaseController as ge, IEditorBridgeService as ht, SheetSkeletonManagerService as ut, ScrollToRangeOperation as lt } from "@univerjs/sheets-ui";
|
|
10
|
+
import { IZenZoneService as pt, useObservable as j, KeyCode as vt, MetaKeys as ue, MenuItemType as Ie, getMenuHiddenObservable as Pe, RibbonStartGroup as _t, ContextMenuPosition as ft, ContextMenuGroup as Ct, ComponentManager as St, IMenuManagerService as gt, IShortcutService as It } from "@univerjs/ui";
|
|
11
|
+
import { BehaviorSubject as Pt, debounceTime as ce, map as Tt } from "rxjs";
|
|
12
|
+
import { IRenderManagerService as Te } from "@univerjs/engine-render";
|
|
13
|
+
import bt, { forwardRef as be, useRef as Me, createElement as we, useMemo as Mt, useCallback as le, useEffect as wt } from "react";
|
|
14
|
+
import { singleReferenceToGrid as A, serializeRange as yt } from "@univerjs/engine-formula";
|
|
15
|
+
import { IThreadCommentDataSourceService as ye, DeleteCommentMutation as F, AddCommentMutation as ie, ThreadCommentModel as Et } from "@univerjs/thread-comment";
|
|
16
|
+
import { AddCommentCommand as An, DeleteCommentCommand as Vn, DeleteCommentTreeCommand as Bn, IThreadCommentDataSourceService as Ln, ResolveCommentCommand as Hn, UpdateCommentCommand as Fn } from "@univerjs/thread-comment";
|
|
17
|
+
const Ee = "univer.sheet.thread-comment-modal", me = "comment-single", Oe = "SHEET_THREAD_COMMENT";
|
|
18
|
+
var Ot = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, Ut = (o, e, r, t) => {
|
|
19
|
+
for (var n = t > 1 ? void 0 : t ? Rt(e, r) : e, i = o.length - 1, s; i >= 0; i--)
|
|
20
|
+
(s = o[i]) && (n = (t ? s(e, r, n) : s(n)) || n);
|
|
21
|
+
return t && n && Ot(e, r, n), n;
|
|
22
|
+
}, pe = (o, e) => (r, t) => e(r, t, o);
|
|
23
|
+
let R = class extends $ {
|
|
24
|
+
constructor(e, r) {
|
|
26
25
|
super();
|
|
27
26
|
E(this, "_lastPopup", null);
|
|
28
27
|
E(this, "_activePopup");
|
|
29
|
-
E(this, "_activePopup$", new
|
|
28
|
+
E(this, "_activePopup$", new Pt(null));
|
|
30
29
|
E(this, "activePopup$", this._activePopup$.asObservable());
|
|
31
|
-
this._canvasPopupManagerService = e, this._zenZoneService =
|
|
30
|
+
this._canvasPopupManagerService = e, this._zenZoneService = r, this._initZenVisible(), this.disposeWithMe(() => {
|
|
32
31
|
this._activePopup$.complete();
|
|
33
32
|
});
|
|
34
33
|
}
|
|
@@ -40,10 +39,10 @@ let U = class extends $ {
|
|
|
40
39
|
e && this.hidePopup();
|
|
41
40
|
}));
|
|
42
41
|
}
|
|
43
|
-
showPopup(e,
|
|
44
|
-
var
|
|
45
|
-
const { row: t, col:
|
|
46
|
-
if (this._activePopup && t === this._activePopup.row &&
|
|
42
|
+
showPopup(e, r) {
|
|
43
|
+
var m;
|
|
44
|
+
const { row: t, col: n, unitId: i, subUnitId: s } = e;
|
|
45
|
+
if (this._activePopup && t === this._activePopup.row && n === this._activePopup.col && i === this._activePopup.unitId && s === ((m = this.activePopup) == null ? void 0 : m.subUnitId)) {
|
|
47
46
|
this._activePopup = e, this._activePopup$.next(e);
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
@@ -52,7 +51,7 @@ let U = class extends $ {
|
|
|
52
51
|
this._activePopup = e, this._activePopup$.next(e);
|
|
53
52
|
const a = this._canvasPopupManagerService.attachPopupToCell(
|
|
54
53
|
t,
|
|
55
|
-
|
|
54
|
+
n,
|
|
56
55
|
{
|
|
57
56
|
componentKey: Ee,
|
|
58
57
|
onClickOutside: () => {
|
|
@@ -67,10 +66,10 @@ let U = class extends $ {
|
|
|
67
66
|
);
|
|
68
67
|
if (!a)
|
|
69
68
|
throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");
|
|
70
|
-
const c = new
|
|
69
|
+
const c = new He();
|
|
71
70
|
c.add(a), c.add({
|
|
72
71
|
dispose: () => {
|
|
73
|
-
|
|
72
|
+
r == null || r();
|
|
74
73
|
}
|
|
75
74
|
}), this._lastPopup = c;
|
|
76
75
|
}
|
|
@@ -84,57 +83,57 @@ let U = class extends $ {
|
|
|
84
83
|
}, this._activePopup$.next(this._activePopup));
|
|
85
84
|
}
|
|
86
85
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
],
|
|
86
|
+
R = Ut([
|
|
87
|
+
pe(0, v(st)),
|
|
88
|
+
pe(1, pt)
|
|
89
|
+
], R);
|
|
91
90
|
const V = {
|
|
92
|
-
type:
|
|
91
|
+
type: Fe.OPERATION,
|
|
93
92
|
id: "sheets.operation.show-comment-modal",
|
|
94
93
|
handler(o) {
|
|
95
94
|
var _;
|
|
96
|
-
const e = o.get(
|
|
95
|
+
const e = o.get(ve), r = o.get(N), t = o.get(R), n = o.get(ae), i = (_ = e.getCurrentLastSelection()) == null ? void 0 : _.primary, s = o.get(x);
|
|
97
96
|
if (!i)
|
|
98
97
|
return !1;
|
|
99
|
-
const a =
|
|
98
|
+
const a = Je(r);
|
|
100
99
|
if (!a)
|
|
101
100
|
return !1;
|
|
102
|
-
const { workbook: c, worksheet:
|
|
101
|
+
const { workbook: c, worksheet: m, unitId: h, subUnitId: d } = a, u = {
|
|
103
102
|
workbook: c,
|
|
104
|
-
worksheet:
|
|
105
|
-
unitId:
|
|
106
|
-
subUnitId:
|
|
103
|
+
worksheet: m,
|
|
104
|
+
unitId: h,
|
|
105
|
+
subUnitId: d,
|
|
107
106
|
row: i.startRow,
|
|
108
107
|
col: i.startColumn
|
|
109
108
|
};
|
|
110
109
|
t.showPopup(u);
|
|
111
|
-
const p = s.getByLocation(
|
|
112
|
-
return p &&
|
|
113
|
-
unitId:
|
|
114
|
-
subUnitId:
|
|
110
|
+
const p = s.getByLocation(h, d, i.startRow, i.startColumn);
|
|
111
|
+
return p && n.setActiveComment({
|
|
112
|
+
unitId: h,
|
|
113
|
+
subUnitId: d,
|
|
115
114
|
commentId: p,
|
|
116
115
|
trigger: "context-menu"
|
|
117
116
|
}), !0;
|
|
118
117
|
}
|
|
119
|
-
},
|
|
120
|
-
var
|
|
121
|
-
for (var
|
|
122
|
-
(s = o[i]) && (
|
|
123
|
-
return t &&
|
|
124
|
-
}, B = (o, e) => (
|
|
118
|
+
}, $t = "sheets-thread-comment.config", Nt = {};
|
|
119
|
+
var xt = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, jt = (o, e, r, t) => {
|
|
120
|
+
for (var n = t > 1 ? void 0 : t ? Dt(e, r) : e, i = o.length - 1, s; i >= 0; i--)
|
|
121
|
+
(s = o[i]) && (n = (t ? s(e, r, n) : s(n)) || n);
|
|
122
|
+
return t && n && xt(e, r, n), n;
|
|
123
|
+
}, B = (o, e) => (r, t) => e(r, t, o);
|
|
125
124
|
let k = class extends $ {
|
|
126
|
-
constructor(o, e,
|
|
127
|
-
super(), this._sheetInterceptorService = o, this._sheetsThreadCommentModel = e, this._univerInstanceService =
|
|
125
|
+
constructor(o, e, r, t) {
|
|
126
|
+
super(), this._sheetInterceptorService = o, this._sheetsThreadCommentModel = e, this._univerInstanceService = r, this._renderManagerService = t, this._initViewModelIntercept(), this._initSkeletonChange();
|
|
128
127
|
}
|
|
129
128
|
_initViewModelIntercept() {
|
|
130
129
|
this.disposeWithMe(
|
|
131
130
|
this._sheetInterceptorService.intercept(
|
|
132
|
-
|
|
131
|
+
Qe.CELL_CONTENT,
|
|
133
132
|
{
|
|
134
|
-
effect:
|
|
135
|
-
handler: (o, e,
|
|
136
|
-
const { row: t, col:
|
|
137
|
-
return this._sheetsThreadCommentModel.showCommentMarker(i, s, t,
|
|
133
|
+
effect: ke.Style,
|
|
134
|
+
handler: (o, e, r) => {
|
|
135
|
+
const { row: t, col: n, unitId: i, subUnitId: s } = e;
|
|
136
|
+
return this._sheetsThreadCommentModel.showCommentMarker(i, s, t, n) ? r({
|
|
138
137
|
...o,
|
|
139
138
|
markers: {
|
|
140
139
|
...o == null ? void 0 : o.markers,
|
|
@@ -143,7 +142,7 @@ let k = class extends $ {
|
|
|
143
142
|
size: 6
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
|
-
}) :
|
|
145
|
+
}) : r(o);
|
|
147
146
|
},
|
|
148
147
|
priority: 100
|
|
149
148
|
}
|
|
@@ -152,121 +151,144 @@ let k = class extends $ {
|
|
|
152
151
|
}
|
|
153
152
|
_initSkeletonChange() {
|
|
154
153
|
const o = () => {
|
|
155
|
-
var
|
|
154
|
+
var n;
|
|
156
155
|
const e = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
157
156
|
if (!e) return;
|
|
158
|
-
const
|
|
159
|
-
(
|
|
157
|
+
const r = e.getUnitId(), t = this._renderManagerService.getRenderById(r);
|
|
158
|
+
(n = t == null ? void 0 : t.mainComponent) == null || n.makeForceDirty();
|
|
160
159
|
};
|
|
161
|
-
this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(
|
|
160
|
+
this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(ce(16)).subscribe(() => {
|
|
162
161
|
o();
|
|
163
162
|
}));
|
|
164
163
|
}
|
|
165
164
|
};
|
|
166
|
-
k =
|
|
167
|
-
B(0, v(
|
|
168
|
-
B(1, v(
|
|
165
|
+
k = jt([
|
|
166
|
+
B(0, v(_e)),
|
|
167
|
+
B(1, v(x)),
|
|
169
168
|
B(2, N),
|
|
170
|
-
B(3,
|
|
169
|
+
B(3, Te)
|
|
171
170
|
], k);
|
|
172
171
|
var P = function() {
|
|
173
172
|
return P = Object.assign || function(o) {
|
|
174
|
-
for (var e,
|
|
175
|
-
e = arguments[
|
|
176
|
-
for (var
|
|
173
|
+
for (var e, r = 1, t = arguments.length; r < t; r++) {
|
|
174
|
+
e = arguments[r];
|
|
175
|
+
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (o[n] = e[n]);
|
|
177
176
|
}
|
|
178
177
|
return o;
|
|
179
178
|
}, P.apply(this, arguments);
|
|
180
|
-
},
|
|
181
|
-
var
|
|
182
|
-
for (var t in o) Object.prototype.hasOwnProperty.call(o, t) && e.indexOf(t) < 0 && (
|
|
179
|
+
}, At = function(o, e) {
|
|
180
|
+
var r = {};
|
|
181
|
+
for (var t in o) Object.prototype.hasOwnProperty.call(o, t) && e.indexOf(t) < 0 && (r[t] = o[t]);
|
|
183
182
|
if (o != null && typeof Object.getOwnPropertySymbols == "function")
|
|
184
|
-
for (var
|
|
185
|
-
e.indexOf(t[
|
|
186
|
-
return
|
|
187
|
-
},
|
|
188
|
-
var
|
|
189
|
-
return
|
|
183
|
+
for (var n = 0, t = Object.getOwnPropertySymbols(o); n < t.length; n++)
|
|
184
|
+
e.indexOf(t[n]) < 0 && Object.prototype.propertyIsEnumerable.call(o, t[n]) && (r[t[n]] = o[t[n]]);
|
|
185
|
+
return r;
|
|
186
|
+
}, Re = be(function(o, e) {
|
|
187
|
+
var r = o.icon, t = o.id, n = o.className, i = o.extend, s = At(o, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(n || "").trim(), c = Me("_".concat(Lt()));
|
|
188
|
+
return Ue(r, "".concat(t), { defIds: r.defIds, idSuffix: c.current }, P({ ref: e, className: a }, s), i);
|
|
190
189
|
});
|
|
191
|
-
function
|
|
192
|
-
return we(o.tag, P(P({ key: e },
|
|
193
|
-
return
|
|
190
|
+
function Ue(o, e, r, t, n) {
|
|
191
|
+
return we(o.tag, P(P({ key: e }, Vt(o, r, n)), t), (Bt(o, r).children || []).map(function(i, s) {
|
|
192
|
+
return Ue(i, "".concat(e, "-").concat(o.tag, "-").concat(s), r, void 0, n);
|
|
194
193
|
}));
|
|
195
194
|
}
|
|
196
|
-
function
|
|
195
|
+
function Vt(o, e, r) {
|
|
197
196
|
var t = P({}, o.attrs);
|
|
198
|
-
|
|
199
|
-
var
|
|
200
|
-
return !
|
|
197
|
+
r != null && r.colorChannel1 && t.fill === "colorChannel1" && (t.fill = r.colorChannel1);
|
|
198
|
+
var n = e.defIds;
|
|
199
|
+
return !n || n.length === 0 || (o.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(i) {
|
|
201
200
|
var s = i[0], a = i[1];
|
|
202
201
|
typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
203
202
|
})), t;
|
|
204
203
|
}
|
|
205
|
-
function
|
|
206
|
-
var
|
|
207
|
-
return !t || t.length === 0 ? o : o.tag === "defs" && (!((
|
|
208
|
-
return typeof
|
|
204
|
+
function Bt(o, e) {
|
|
205
|
+
var r, t = e.defIds;
|
|
206
|
+
return !t || t.length === 0 ? o : o.tag === "defs" && (!((r = o.children) === null || r === void 0) && r.length) ? P(P({}, o), { children: o.children.map(function(n) {
|
|
207
|
+
return typeof n.attrs.id == "string" && t && t.indexOf(n.attrs.id) > -1 ? P(P({}, n), { attrs: P(P({}, n.attrs), { id: n.attrs.id + e.idSuffix }) }) : n;
|
|
209
208
|
}) }) : o;
|
|
210
209
|
}
|
|
211
|
-
function
|
|
210
|
+
function Lt() {
|
|
212
211
|
return Math.random().toString(36).substring(2, 8);
|
|
213
212
|
}
|
|
214
|
-
|
|
215
|
-
var
|
|
216
|
-
return we(
|
|
213
|
+
Re.displayName = "UniverIcon";
|
|
214
|
+
var Ht = { 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" } }] }, $e = be(function(o, e) {
|
|
215
|
+
return we(Re, Object.assign({}, o, {
|
|
217
216
|
id: "comment-single",
|
|
218
217
|
ref: e,
|
|
219
|
-
icon:
|
|
218
|
+
icon: Ht
|
|
220
219
|
}));
|
|
221
220
|
});
|
|
222
221
|
$e.displayName = "CommentSingle";
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
var Ne = { exports: {} }, X = {};
|
|
223
|
+
/**
|
|
224
|
+
* @license React
|
|
225
|
+
* react-jsx-runtime.production.min.js
|
|
226
|
+
*
|
|
227
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the MIT license found in the
|
|
230
|
+
* LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/
|
|
232
|
+
var Ft = bt, kt = Symbol.for("react.element"), Wt = Symbol.for("react.fragment"), Zt = Object.prototype.hasOwnProperty, zt = Ft.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Gt = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
233
|
+
function xe(o, e, r) {
|
|
234
|
+
var t, n = {}, i = null, s = null;
|
|
235
|
+
r !== void 0 && (i = "" + r), e.key !== void 0 && (i = "" + e.key), e.ref !== void 0 && (s = e.ref);
|
|
236
|
+
for (t in e) Zt.call(e, t) && !Gt.hasOwnProperty(t) && (n[t] = e[t]);
|
|
237
|
+
if (o && o.defaultProps) for (t in e = o.defaultProps, e) n[t] === void 0 && (n[t] = e[t]);
|
|
238
|
+
return { $$typeof: kt, type: o, key: i, ref: s, props: n, _owner: zt.current };
|
|
239
|
+
}
|
|
240
|
+
X.Fragment = Wt;
|
|
241
|
+
X.jsx = xe;
|
|
242
|
+
X.jsxs = xe;
|
|
243
|
+
Ne.exports = X;
|
|
244
|
+
var De = Ne.exports;
|
|
245
|
+
const Yt = () => {
|
|
246
|
+
const o = O(N), e = O(R), r = j(e.activePopup$), t = O(x);
|
|
247
|
+
if (j(t.commentUpdate$), !r)
|
|
226
248
|
return null;
|
|
227
|
-
const { row:
|
|
249
|
+
const { row: n, col: i, unitId: s, subUnitId: a, trigger: c } = r, m = t.getByLocation(s, a, n, i), h = `${We.chatAtABC(i)}${n + 1}`, d = () => {
|
|
228
250
|
e.hidePopup();
|
|
229
251
|
}, u = (p) => {
|
|
230
|
-
var _, S,
|
|
231
|
-
return (
|
|
252
|
+
var _, S, U;
|
|
253
|
+
return (U = (S = (_ = o.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : _.getSheetBySheetId(p)) == null ? void 0 : S.getName()) != null ? U : "";
|
|
232
254
|
};
|
|
233
|
-
return /* @__PURE__ */
|
|
234
|
-
|
|
255
|
+
return /* @__PURE__ */ De.jsx(
|
|
256
|
+
nt,
|
|
235
257
|
{
|
|
236
258
|
onClick: () => {
|
|
237
259
|
e.persistPopup();
|
|
238
260
|
},
|
|
239
261
|
prefix: "cell",
|
|
240
|
-
id:
|
|
262
|
+
id: m,
|
|
241
263
|
unitId: s,
|
|
242
264
|
subUnitId: a,
|
|
243
265
|
type: b.UNIVER_SHEET,
|
|
244
|
-
refStr:
|
|
245
|
-
onClose:
|
|
266
|
+
refStr: h,
|
|
267
|
+
onClose: d,
|
|
246
268
|
getSubUnitName: u,
|
|
247
269
|
autoFocus: c === "context-menu"
|
|
248
270
|
}
|
|
249
271
|
);
|
|
250
|
-
},
|
|
272
|
+
}, qt = () => {
|
|
251
273
|
var g;
|
|
252
|
-
const o = O(
|
|
274
|
+
const o = O(Ce), e = O(N), r = O(R), t = e.getCurrentUnitForType(b.UNIVER_SHEET), n = t.getUnitId(), i = O(se), s = Mt(() => t.activeSheet$.pipe(Tt((l) => l == null ? void 0 : l.getSheetId())), [t.activeSheet$]), a = j(s, (g = t.getActiveSheet()) == null ? void 0 : g.getSheetId()), c = Me(), m = O(ae), h = j(m.activeCommentId$), d = j(m.panelVisible$, m.panelVisible), u = le((l) => {
|
|
253
275
|
const I = t.getSheets(), f = {};
|
|
254
276
|
I.forEach((T, C) => {
|
|
255
277
|
f[T.getSheetId()] = C;
|
|
256
278
|
});
|
|
257
279
|
const M = (T) => T.map((C) => {
|
|
258
|
-
var
|
|
259
|
-
const y =
|
|
260
|
-
return { ...C, p:
|
|
280
|
+
var de;
|
|
281
|
+
const y = A(C.ref), Ve = [(de = f[C.subUnitId]) != null ? de : 0, y.row, y.column];
|
|
282
|
+
return { ...C, p: Ve };
|
|
261
283
|
}).sort((C, y) => C.p[0] === y.p[0] ? C.p[1] === y.p[1] ? C.p[2] - y.p[2] : C.p[1] - y.p[1] : C.p[0] - y.p[0]);
|
|
262
284
|
return [
|
|
263
285
|
...M(l.filter((T) => !T.resolved)),
|
|
264
286
|
...M(l.filter((T) => T.resolved))
|
|
265
287
|
];
|
|
266
|
-
}, [t]), p =
|
|
288
|
+
}, [t]), p = le((l) => {
|
|
267
289
|
var I;
|
|
268
|
-
if (l.unitId ===
|
|
269
|
-
const { row: f, column: M } =
|
|
290
|
+
if (l.unitId === n && l.subUnitId === a && !l.resolved) {
|
|
291
|
+
const { row: f, column: M } = A(l.ref), T = t.getSheetBySheetId(l.subUnitId), C = (I = T == null ? void 0 : T.getMergedCell(f, M)) != null ? I : {
|
|
270
292
|
startColumn: M,
|
|
271
293
|
endColumn: M,
|
|
272
294
|
startRow: f,
|
|
@@ -285,190 +307,190 @@ const Vt = () => {
|
|
|
285
307
|
primary: null
|
|
286
308
|
});
|
|
287
309
|
}
|
|
288
|
-
}, [o, a,
|
|
310
|
+
}, [o, a, n]), _ = (l) => {
|
|
289
311
|
var I, f;
|
|
290
312
|
return (f = (I = t.getSheetBySheetId(l)) == null ? void 0 : I.getName()) != null ? f : "";
|
|
291
313
|
}, S = () => {
|
|
292
314
|
i.executeCommand(V.id);
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
},
|
|
315
|
+
}, U = (l) => {
|
|
316
|
+
h && h.unitId === l.unitId && h.subUnitId === l.subUnitId && h.commentId === l.id || (c.current && (o.removeShape(c.current), c.current = null), c.current = p(l));
|
|
317
|
+
}, D = () => {
|
|
296
318
|
c.current && (o.removeShape(c.current), c.current = null);
|
|
297
|
-
},
|
|
298
|
-
I &&
|
|
319
|
+
}, ee = (l, I) => {
|
|
320
|
+
I && r.hidePopup();
|
|
299
321
|
};
|
|
300
|
-
return
|
|
301
|
-
!
|
|
302
|
-
}, [o,
|
|
303
|
-
|
|
322
|
+
return wt(() => {
|
|
323
|
+
!d && c.current && o.removeShape(c.current);
|
|
324
|
+
}, [o, d]), /* @__PURE__ */ De.jsx(
|
|
325
|
+
rt,
|
|
304
326
|
{
|
|
305
|
-
unitId:
|
|
327
|
+
unitId: n,
|
|
306
328
|
subUnitId$: s,
|
|
307
329
|
type: b.UNIVER_SHEET,
|
|
308
330
|
onAdd: S,
|
|
309
331
|
getSubUnitName: _,
|
|
310
|
-
onResolve:
|
|
332
|
+
onResolve: ee,
|
|
311
333
|
sortComments: u,
|
|
312
|
-
onItemEnter:
|
|
313
|
-
onItemLeave:
|
|
314
|
-
onDeleteComment: () => (
|
|
334
|
+
onItemEnter: U,
|
|
335
|
+
onItemLeave: D,
|
|
336
|
+
onDeleteComment: () => (D(), !0)
|
|
315
337
|
}
|
|
316
338
|
);
|
|
317
|
-
},
|
|
339
|
+
}, Kt = (o) => ({
|
|
318
340
|
id: V.id,
|
|
319
|
-
type:
|
|
320
|
-
icon:
|
|
341
|
+
type: Ie.BUTTON,
|
|
342
|
+
icon: me,
|
|
321
343
|
title: "sheetThreadComment.menu.addComment",
|
|
322
|
-
hidden$:
|
|
323
|
-
disabled$:
|
|
324
|
-
workbookTypes: [
|
|
344
|
+
hidden$: Pe(o, b.UNIVER_SHEET),
|
|
345
|
+
disabled$: Se(o, {
|
|
346
|
+
workbookTypes: [K],
|
|
325
347
|
worksheetTypes: [J],
|
|
326
348
|
rangeTypes: [Q]
|
|
327
349
|
})
|
|
328
|
-
}),
|
|
329
|
-
id:
|
|
330
|
-
type:
|
|
331
|
-
icon:
|
|
350
|
+
}), Jt = (o) => ({
|
|
351
|
+
id: fe.id,
|
|
352
|
+
type: Ie.BUTTON,
|
|
353
|
+
icon: me,
|
|
332
354
|
tooltip: "sheetThreadComment.menu.commentManagement",
|
|
333
|
-
disabled$:
|
|
334
|
-
workbookTypes: [
|
|
355
|
+
disabled$: Se(o, {
|
|
356
|
+
workbookTypes: [K],
|
|
335
357
|
worksheetTypes: [J],
|
|
336
358
|
rangeTypes: [Q]
|
|
337
359
|
}),
|
|
338
|
-
hidden$:
|
|
339
|
-
}),
|
|
360
|
+
hidden$: Pe(o, b.UNIVER_SHEET)
|
|
361
|
+
}), Qt = {
|
|
340
362
|
id: V.id,
|
|
341
|
-
binding:
|
|
342
|
-
preconditions:
|
|
343
|
-
},
|
|
344
|
-
[
|
|
345
|
-
[
|
|
363
|
+
binding: vt.M | ue.CTRL_COMMAND | ue.ALT,
|
|
364
|
+
preconditions: at
|
|
365
|
+
}, Xt = {
|
|
366
|
+
[_t.OTHERS]: {
|
|
367
|
+
[fe.id]: {
|
|
346
368
|
order: 1,
|
|
347
|
-
menuItemFactory:
|
|
369
|
+
menuItemFactory: Jt
|
|
348
370
|
}
|
|
349
371
|
},
|
|
350
|
-
[
|
|
351
|
-
[
|
|
372
|
+
[ft.MAIN_AREA]: {
|
|
373
|
+
[Ct.OTHERS]: {
|
|
352
374
|
[V.id]: {
|
|
353
375
|
order: 0,
|
|
354
|
-
menuItemFactory:
|
|
376
|
+
menuItemFactory: Kt
|
|
355
377
|
}
|
|
356
378
|
}
|
|
357
379
|
}
|
|
358
380
|
};
|
|
359
|
-
var
|
|
360
|
-
for (var
|
|
361
|
-
(s = o[i]) && (
|
|
362
|
-
return t &&
|
|
363
|
-
},
|
|
381
|
+
var en = Object.defineProperty, tn = Object.getOwnPropertyDescriptor, nn = (o, e, r, t) => {
|
|
382
|
+
for (var n = t > 1 ? void 0 : t ? tn(e, r) : e, i = o.length - 1, s; i >= 0; i--)
|
|
383
|
+
(s = o[i]) && (n = (t ? s(e, r, n) : s(n)) || n);
|
|
384
|
+
return t && n && en(e, r, n), n;
|
|
385
|
+
}, ne = (o, e) => (r, t) => e(r, t, o);
|
|
364
386
|
let W = class extends $ {
|
|
365
|
-
constructor(o, e,
|
|
366
|
-
super(), this._menuManagerService = o, this._componentManager = e, this._shortcutService =
|
|
387
|
+
constructor(o, e, r) {
|
|
388
|
+
super(), this._menuManagerService = o, this._componentManager = e, this._shortcutService = r, this._initMenu(), this._initShortcut(), this._initComponent();
|
|
367
389
|
}
|
|
368
390
|
_initShortcut() {
|
|
369
|
-
this._shortcutService.registerShortcut(
|
|
391
|
+
this._shortcutService.registerShortcut(Qt);
|
|
370
392
|
}
|
|
371
393
|
_initMenu() {
|
|
372
|
-
this._menuManagerService.mergeMenu(
|
|
394
|
+
this._menuManagerService.mergeMenu(Xt);
|
|
373
395
|
}
|
|
374
396
|
_initComponent() {
|
|
375
397
|
[
|
|
376
|
-
[Ee,
|
|
377
|
-
[
|
|
378
|
-
[
|
|
398
|
+
[Ee, Yt],
|
|
399
|
+
[ot, qt],
|
|
400
|
+
[me, $e]
|
|
379
401
|
].forEach(([o, e]) => {
|
|
380
402
|
this._componentManager.register(o, e);
|
|
381
403
|
});
|
|
382
404
|
}
|
|
383
405
|
};
|
|
384
|
-
W =
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
406
|
+
W = nn([
|
|
407
|
+
ne(0, gt),
|
|
408
|
+
ne(1, v(St)),
|
|
409
|
+
ne(2, It)
|
|
388
410
|
], W);
|
|
389
|
-
var
|
|
390
|
-
for (var
|
|
391
|
-
(s = o[i]) && (
|
|
392
|
-
return t &&
|
|
393
|
-
},
|
|
394
|
-
const
|
|
395
|
-
const t =
|
|
411
|
+
var rn = Object.defineProperty, on = Object.getOwnPropertyDescriptor, sn = (o, e, r, t) => {
|
|
412
|
+
for (var n = t > 1 ? void 0 : t ? on(e, r) : e, i = o.length - 1, s; i >= 0; i--)
|
|
413
|
+
(s = o[i]) && (n = (t ? s(e, r, n) : s(n)) || n);
|
|
414
|
+
return t && n && rn(e, r, n), n;
|
|
415
|
+
}, re = (o, e) => (r, t) => e(r, t, o);
|
|
416
|
+
const an = (o, e, r) => {
|
|
417
|
+
const t = A(o), n = r.row - e.row, i = r.column - e.column, s = {
|
|
396
418
|
startColumn: t.column + i,
|
|
397
|
-
startRow: t.row +
|
|
419
|
+
startRow: t.row + n,
|
|
398
420
|
endColumn: t.column + i,
|
|
399
|
-
endRow: t.row +
|
|
421
|
+
endRow: t.row + n
|
|
400
422
|
};
|
|
401
|
-
return
|
|
423
|
+
return yt(s);
|
|
402
424
|
};
|
|
403
425
|
let Z = class extends $ {
|
|
404
|
-
constructor(e,
|
|
426
|
+
constructor(e, r, t) {
|
|
405
427
|
super();
|
|
406
428
|
E(this, "_copyInfo");
|
|
407
|
-
this._sheetClipboardService = e, this._sheetsThreadCommentModel =
|
|
429
|
+
this._sheetClipboardService = e, this._sheetsThreadCommentModel = r, this._threadCommentDataSourceService = t, this._initClipboardHook();
|
|
408
430
|
}
|
|
409
431
|
// eslint-disable-next-line max-lines-per-function
|
|
410
432
|
_initClipboardHook() {
|
|
411
433
|
this.disposeWithMe(
|
|
412
434
|
this._sheetClipboardService.addClipboardHook({
|
|
413
435
|
id: Oe,
|
|
414
|
-
onBeforeCopy: (e,
|
|
436
|
+
onBeforeCopy: (e, r, t) => {
|
|
415
437
|
this._copyInfo = {
|
|
416
438
|
unitId: e,
|
|
417
|
-
subUnitId:
|
|
439
|
+
subUnitId: r,
|
|
418
440
|
range: t
|
|
419
441
|
};
|
|
420
442
|
},
|
|
421
443
|
// eslint-disable-next-line max-lines-per-function
|
|
422
|
-
onPasteCells: (e,
|
|
423
|
-
const { unitId: i, subUnitId: s, range: a } =
|
|
444
|
+
onPasteCells: (e, r, t, n) => {
|
|
445
|
+
const { unitId: i, subUnitId: s, range: a } = r, c = {
|
|
424
446
|
row: a.rows[0],
|
|
425
447
|
column: a.cols[0]
|
|
426
448
|
};
|
|
427
|
-
if (
|
|
428
|
-
const { range:
|
|
429
|
-
row:
|
|
430
|
-
column:
|
|
449
|
+
if (n.copyType === mt.CUT && this._copyInfo) {
|
|
450
|
+
const { range: m, unitId: h, subUnitId: d } = this._copyInfo, u = {
|
|
451
|
+
row: m.startRow,
|
|
452
|
+
column: m.startColumn
|
|
431
453
|
};
|
|
432
|
-
if (!(i ===
|
|
454
|
+
if (!(i === h && s === d)) {
|
|
433
455
|
const p = [];
|
|
434
|
-
|
|
435
|
-
const I = this._sheetsThreadCommentModel.getAllByLocation(
|
|
456
|
+
Ze.foreach(m, (g, l) => {
|
|
457
|
+
const I = this._sheetsThreadCommentModel.getAllByLocation(h, d, g, l);
|
|
436
458
|
this._threadCommentDataSourceService.syncUpdateMutationToColla ? I.forEach((f) => {
|
|
437
459
|
p.push(f);
|
|
438
460
|
}) : I.forEach(({ children: f, ...M }) => {
|
|
439
461
|
M.parentId || p.push(M);
|
|
440
462
|
});
|
|
441
463
|
});
|
|
442
|
-
const _ = [], S = [],
|
|
464
|
+
const _ = [], S = [], U = [], D = [], ee = (g) => {
|
|
443
465
|
_.unshift({
|
|
444
466
|
id: F.id,
|
|
445
467
|
params: {
|
|
446
|
-
unitId:
|
|
447
|
-
subUnitId:
|
|
468
|
+
unitId: h,
|
|
469
|
+
subUnitId: d,
|
|
448
470
|
commentId: g.id
|
|
449
471
|
}
|
|
450
|
-
}),
|
|
451
|
-
id:
|
|
472
|
+
}), U.push({
|
|
473
|
+
id: ie.id,
|
|
452
474
|
params: {
|
|
453
475
|
unitId: i,
|
|
454
476
|
subUnitId: s,
|
|
455
477
|
comment: {
|
|
456
478
|
...g,
|
|
457
|
-
ref:
|
|
479
|
+
ref: an(g.ref, u, c),
|
|
458
480
|
unitId: i,
|
|
459
481
|
subUnitId: s
|
|
460
482
|
},
|
|
461
483
|
sync: !0
|
|
462
484
|
}
|
|
463
485
|
}), S.push({
|
|
464
|
-
id:
|
|
486
|
+
id: ie.id,
|
|
465
487
|
params: {
|
|
466
|
-
unitId:
|
|
467
|
-
subUnitId:
|
|
488
|
+
unitId: h,
|
|
489
|
+
subUnitId: d,
|
|
468
490
|
comment: g,
|
|
469
491
|
sync: !0
|
|
470
492
|
}
|
|
471
|
-
}),
|
|
493
|
+
}), D.unshift({
|
|
472
494
|
id: F.id,
|
|
473
495
|
params: {
|
|
474
496
|
unitId: i,
|
|
@@ -478,10 +500,10 @@ let Z = class extends $ {
|
|
|
478
500
|
});
|
|
479
501
|
};
|
|
480
502
|
return p.forEach((g) => {
|
|
481
|
-
|
|
503
|
+
ee(g);
|
|
482
504
|
}), {
|
|
483
|
-
redos: [..._, ...
|
|
484
|
-
undos: [...
|
|
505
|
+
redos: [..._, ...U],
|
|
506
|
+
undos: [...D, ...S]
|
|
485
507
|
};
|
|
486
508
|
}
|
|
487
509
|
}
|
|
@@ -494,37 +516,37 @@ let Z = class extends $ {
|
|
|
494
516
|
);
|
|
495
517
|
}
|
|
496
518
|
};
|
|
497
|
-
Z =
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
519
|
+
Z = sn([
|
|
520
|
+
re(0, v(ct)),
|
|
521
|
+
re(1, v(x)),
|
|
522
|
+
re(2, ye)
|
|
501
523
|
], Z);
|
|
502
|
-
var
|
|
503
|
-
for (var
|
|
504
|
-
(s = o[i]) && (
|
|
505
|
-
return t &&
|
|
506
|
-
},
|
|
524
|
+
var cn = Object.defineProperty, mn = Object.getOwnPropertyDescriptor, dn = (o, e, r, t) => {
|
|
525
|
+
for (var n = t > 1 ? void 0 : t ? mn(e, r) : e, i = o.length - 1, s; i >= 0; i--)
|
|
526
|
+
(s = o[i]) && (n = (t ? s(e, r, n) : s(n)) || n);
|
|
527
|
+
return t && n && cn(e, r, n), n;
|
|
528
|
+
}, L = (o, e) => (r, t) => e(r, t, o);
|
|
507
529
|
let z = class extends $ {
|
|
508
|
-
constructor(o, e,
|
|
509
|
-
super(), this._hoverManagerService = o, this._sheetsThreadCommentPopupService = e, this._sheetsThreadCommentModel =
|
|
530
|
+
constructor(o, e, r, t) {
|
|
531
|
+
super(), this._hoverManagerService = o, this._sheetsThreadCommentPopupService = e, this._sheetsThreadCommentModel = r, this._sheetPermissionInterceptorBaseController = t, this._initHoverEvent();
|
|
510
532
|
}
|
|
511
533
|
_initHoverEvent() {
|
|
512
534
|
this.disposeWithMe(
|
|
513
|
-
this._hoverManagerService.currentCell$.pipe(
|
|
535
|
+
this._hoverManagerService.currentCell$.pipe(ce(100)).subscribe((o) => {
|
|
514
536
|
const e = this._sheetsThreadCommentPopupService.activePopup;
|
|
515
537
|
if (o && (e && e.temp || !e)) {
|
|
516
|
-
const { location:
|
|
538
|
+
const { location: r } = o, { unitId: t, subUnitId: n, row: i, col: s } = r, a = this._sheetsThreadCommentModel.getByLocation(t, n, i, s);
|
|
517
539
|
if (a) {
|
|
518
540
|
if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
519
|
-
workbookTypes: [
|
|
541
|
+
workbookTypes: [K],
|
|
520
542
|
worksheetTypes: [J],
|
|
521
543
|
rangeTypes: [Q]
|
|
522
544
|
}, [{ startRow: i, startColumn: s, endRow: i, endColumn: s }]))
|
|
523
545
|
return;
|
|
524
|
-
const
|
|
525
|
-
|
|
546
|
+
const m = this._sheetsThreadCommentModel.getComment(t, n, a);
|
|
547
|
+
m && !m.resolved && this._sheetsThreadCommentPopupService.showPopup({
|
|
526
548
|
unitId: t,
|
|
527
|
-
subUnitId:
|
|
549
|
+
subUnitId: n,
|
|
528
550
|
row: i,
|
|
529
551
|
col: s,
|
|
530
552
|
commentId: a,
|
|
@@ -537,44 +559,44 @@ let z = class extends $ {
|
|
|
537
559
|
);
|
|
538
560
|
}
|
|
539
561
|
};
|
|
540
|
-
z =
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
562
|
+
z = dn([
|
|
563
|
+
L(0, v(dt)),
|
|
564
|
+
L(1, v(R)),
|
|
565
|
+
L(2, v(x)),
|
|
566
|
+
L(3, v(ge))
|
|
545
567
|
], z);
|
|
546
|
-
var
|
|
547
|
-
for (var
|
|
548
|
-
(s = o[i]) && (
|
|
549
|
-
return t &&
|
|
550
|
-
}, w = (o, e) => (
|
|
568
|
+
var hn = Object.defineProperty, un = Object.getOwnPropertyDescriptor, ln = (o, e, r, t) => {
|
|
569
|
+
for (var n = t > 1 ? void 0 : t ? un(e, r) : e, i = o.length - 1, s; i >= 0; i--)
|
|
570
|
+
(s = o[i]) && (n = (t ? s(e, r, n) : s(n)) || n);
|
|
571
|
+
return t && n && hn(e, r, n), n;
|
|
572
|
+
}, w = (o, e) => (r, t) => e(r, t, o);
|
|
551
573
|
let G = class extends $ {
|
|
552
|
-
constructor(e,
|
|
574
|
+
constructor(e, r, t, n, i, s, a, c, m, h) {
|
|
553
575
|
super();
|
|
554
576
|
E(this, "_isSwitchToCommenting", !1);
|
|
555
577
|
E(this, "_selectionShapeInfo", null);
|
|
556
|
-
this._commandService = e, this._sheetsThreadCommentPopupService =
|
|
578
|
+
this._commandService = e, this._sheetsThreadCommentPopupService = r, this._sheetsThreadCommentModel = t, this._threadCommentPanelService = n, this._univerInstanceService = i, this._sheetPermissionInterceptorBaseController = s, this._markSelectionService = a, this._sheetSelectionService = c, this._editorBridgeService = m, this._renderManagerService = h, this._initCommandListener(), this._initPanelListener(), this._initMarkSelection(), this._initSelectionUpdateListener(), this._initEditorBridge();
|
|
557
579
|
}
|
|
558
|
-
_handleSelectionChange(e,
|
|
580
|
+
_handleSelectionChange(e, r, t) {
|
|
559
581
|
var u, p, _;
|
|
560
|
-
const
|
|
561
|
-
if (!s || !
|
|
582
|
+
const n = (u = e[0]) == null ? void 0 : u.range, i = this._renderManagerService.getRenderById(r), s = (p = i == null ? void 0 : i.with(ut).getWorksheetSkeleton(t)) == null ? void 0 : p.skeleton;
|
|
583
|
+
if (!s || !n)
|
|
562
584
|
return;
|
|
563
|
-
const a = s.getCellByIndex(
|
|
564
|
-
if ((((_ =
|
|
565
|
-
this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(
|
|
585
|
+
const a = s.getCellByIndex(n.startRow, n.startColumn);
|
|
586
|
+
if ((((_ = n.rangeType) != null ? _ : he.NORMAL) !== he.NORMAL || n.endColumn - n.startColumn > 0 || n.endRow - n.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && ze.equals(a.mergeInfo, n))) {
|
|
587
|
+
this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(te.id);
|
|
566
588
|
return;
|
|
567
589
|
}
|
|
568
|
-
const
|
|
569
|
-
if (!this._sheetsThreadCommentModel.showCommentMarker(
|
|
570
|
-
this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(
|
|
590
|
+
const m = a.actualRow, h = a.actualColumn;
|
|
591
|
+
if (!this._sheetsThreadCommentModel.showCommentMarker(r, t, m, h)) {
|
|
592
|
+
this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(te.id);
|
|
571
593
|
return;
|
|
572
594
|
}
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
unitId:
|
|
595
|
+
const d = this._sheetsThreadCommentModel.getByLocation(r, t, m, h);
|
|
596
|
+
d && this._commandService.executeCommand(te.id, {
|
|
597
|
+
unitId: r,
|
|
576
598
|
subUnitId: t,
|
|
577
|
-
commentId:
|
|
599
|
+
commentId: d
|
|
578
600
|
});
|
|
579
601
|
}
|
|
580
602
|
_initSelectionUpdateListener() {
|
|
@@ -582,8 +604,8 @@ let G = class extends $ {
|
|
|
582
604
|
this._sheetSelectionService.selectionMoveEnd$.subscribe((e) => {
|
|
583
605
|
if (this._isSwitchToCommenting)
|
|
584
606
|
return;
|
|
585
|
-
const
|
|
586
|
-
|
|
607
|
+
const r = this._sheetSelectionService.currentSelectionParam;
|
|
608
|
+
r && this._handleSelectionChange(e, r.unitId, r.sheetId);
|
|
587
609
|
})
|
|
588
610
|
);
|
|
589
611
|
}
|
|
@@ -597,50 +619,50 @@ let G = class extends $ {
|
|
|
597
619
|
_initCommandListener() {
|
|
598
620
|
this._commandService.onCommandExecuted((e) => {
|
|
599
621
|
if (e.id === F.id) {
|
|
600
|
-
const
|
|
622
|
+
const r = e.params, t = this._sheetsThreadCommentPopupService.activePopup;
|
|
601
623
|
if (!t)
|
|
602
624
|
return;
|
|
603
|
-
const { unitId:
|
|
604
|
-
|
|
625
|
+
const { unitId: n, subUnitId: i, commentId: s } = t;
|
|
626
|
+
r.unitId === n && r.subUnitId === i && r.commentId === s && this._sheetsThreadCommentPopupService.hidePopup();
|
|
605
627
|
}
|
|
606
628
|
});
|
|
607
629
|
}
|
|
608
630
|
_initPanelListener() {
|
|
609
631
|
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async (e) => {
|
|
610
|
-
var
|
|
632
|
+
var r;
|
|
611
633
|
if (e) {
|
|
612
|
-
const { unitId: t, subUnitId:
|
|
634
|
+
const { unitId: t, subUnitId: n, commentId: i, trigger: s } = e, a = this._sheetsThreadCommentModel.getComment(t, n, i);
|
|
613
635
|
if (!a || a.resolved)
|
|
614
636
|
return;
|
|
615
637
|
const c = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
616
638
|
if (!c || c.getUnitId() !== t)
|
|
617
639
|
return;
|
|
618
|
-
this._isSwitchToCommenting = !0, ((
|
|
640
|
+
this._isSwitchToCommenting = !0, ((r = c.getActiveSheet()) == null ? void 0 : r.getSheetId()) !== n && await this._commandService.executeCommand(Xe.id, {
|
|
619
641
|
unitId: t,
|
|
620
|
-
subUnitId:
|
|
642
|
+
subUnitId: n
|
|
621
643
|
}), this._isSwitchToCommenting = !1;
|
|
622
|
-
const
|
|
644
|
+
const d = A(a.ref), { row: u, column: p } = d;
|
|
623
645
|
if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
624
|
-
workbookTypes: [
|
|
646
|
+
workbookTypes: [K],
|
|
625
647
|
worksheetTypes: [J],
|
|
626
648
|
rangeTypes: [Q]
|
|
627
649
|
}, [{ startRow: u, startColumn: p, endRow: u, endColumn: p }]))
|
|
628
650
|
return;
|
|
629
651
|
const S = 1;
|
|
630
|
-
if (await this._commandService.executeCommand(
|
|
652
|
+
if (await this._commandService.executeCommand(lt.id, {
|
|
631
653
|
range: {
|
|
632
|
-
startRow: Math.max(
|
|
633
|
-
endRow:
|
|
634
|
-
startColumn: Math.max(
|
|
635
|
-
endColumn:
|
|
654
|
+
startRow: Math.max(d.row - S, 0),
|
|
655
|
+
endRow: d.row + S,
|
|
656
|
+
startColumn: Math.max(d.column - S, 0),
|
|
657
|
+
endColumn: d.column + S
|
|
636
658
|
}
|
|
637
659
|
}), this._editorBridgeService.isVisible().visible)
|
|
638
660
|
return;
|
|
639
661
|
this._sheetsThreadCommentPopupService.showPopup({
|
|
640
662
|
unitId: t,
|
|
641
|
-
subUnitId:
|
|
642
|
-
row:
|
|
643
|
-
col:
|
|
663
|
+
subUnitId: n,
|
|
664
|
+
row: d.row,
|
|
665
|
+
col: d.column,
|
|
644
666
|
commentId: a.id,
|
|
645
667
|
trigger: s
|
|
646
668
|
});
|
|
@@ -649,28 +671,28 @@ let G = class extends $ {
|
|
|
649
671
|
}));
|
|
650
672
|
}
|
|
651
673
|
_initMarkSelection() {
|
|
652
|
-
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(
|
|
674
|
+
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(ce(100)).subscribe((e) => {
|
|
653
675
|
var u, p;
|
|
654
676
|
if (!e) {
|
|
655
677
|
this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
|
|
656
678
|
return;
|
|
657
679
|
}
|
|
658
|
-
const { unitId:
|
|
680
|
+
const { unitId: r, subUnitId: t, commentId: n } = e;
|
|
659
681
|
this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
|
|
660
|
-
const i = this._sheetsThreadCommentModel.getComment(
|
|
682
|
+
const i = this._sheetsThreadCommentModel.getComment(r, t, n);
|
|
661
683
|
if (!i)
|
|
662
684
|
return;
|
|
663
|
-
const s =
|
|
685
|
+
const s = A(i.ref), { row: a, column: c } = s;
|
|
664
686
|
if (Number.isNaN(a) || Number.isNaN(c))
|
|
665
687
|
return null;
|
|
666
|
-
const
|
|
688
|
+
const m = (u = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : u.getSheetBySheetId(t), h = (p = m == null ? void 0 : m.getMergedCell(a, c)) != null ? p : {
|
|
667
689
|
startColumn: c,
|
|
668
690
|
endColumn: c,
|
|
669
691
|
startRow: a,
|
|
670
692
|
endRow: a
|
|
671
|
-
},
|
|
693
|
+
}, d = this._markSelectionService.addShape(
|
|
672
694
|
{
|
|
673
|
-
range:
|
|
695
|
+
range: h,
|
|
674
696
|
style: {
|
|
675
697
|
hasAutoFill: !1,
|
|
676
698
|
fill: "rgb(255, 189, 55, 0.35)",
|
|
@@ -683,66 +705,66 @@ let G = class extends $ {
|
|
|
683
705
|
[],
|
|
684
706
|
-1
|
|
685
707
|
);
|
|
686
|
-
|
|
708
|
+
d && (this._selectionShapeInfo = {
|
|
687
709
|
...e,
|
|
688
|
-
shapeId:
|
|
710
|
+
shapeId: d
|
|
689
711
|
});
|
|
690
712
|
}));
|
|
691
713
|
}
|
|
692
714
|
};
|
|
693
|
-
G =
|
|
694
|
-
w(0,
|
|
695
|
-
w(1, v(
|
|
696
|
-
w(2, v(
|
|
697
|
-
w(3, v(
|
|
715
|
+
G = ln([
|
|
716
|
+
w(0, se),
|
|
717
|
+
w(1, v(R)),
|
|
718
|
+
w(2, v(x)),
|
|
719
|
+
w(3, v(ae)),
|
|
698
720
|
w(4, N),
|
|
699
|
-
w(5, v(
|
|
700
|
-
w(6,
|
|
701
|
-
w(7, v(
|
|
702
|
-
w(8,
|
|
703
|
-
w(9,
|
|
721
|
+
w(5, v(ge)),
|
|
722
|
+
w(6, Ce),
|
|
723
|
+
w(7, v(ve)),
|
|
724
|
+
w(8, ht),
|
|
725
|
+
w(9, Te)
|
|
704
726
|
], G);
|
|
705
|
-
var
|
|
706
|
-
for (var
|
|
707
|
-
(s = o[i]) && (
|
|
708
|
-
return t &&
|
|
709
|
-
},
|
|
710
|
-
let
|
|
711
|
-
constructor(o, e,
|
|
712
|
-
super(), this._sheetInterceptorService = o, this._univerInstanceService = e, this._threadCommentModel =
|
|
727
|
+
var pn = Object.defineProperty, vn = Object.getOwnPropertyDescriptor, _n = (o, e, r, t) => {
|
|
728
|
+
for (var n = t > 1 ? void 0 : t ? vn(e, r) : e, i = o.length - 1, s; i >= 0; i--)
|
|
729
|
+
(s = o[i]) && (n = (t ? s(e, r, n) : s(n)) || n);
|
|
730
|
+
return t && n && pn(e, r, n), n;
|
|
731
|
+
}, H = (o, e) => (r, t) => e(r, t, o);
|
|
732
|
+
let Y = class extends $ {
|
|
733
|
+
constructor(o, e, r, t) {
|
|
734
|
+
super(), this._sheetInterceptorService = o, this._univerInstanceService = e, this._threadCommentModel = r, this._threadCommentDataSourceService = t, this._initSheetChange();
|
|
713
735
|
}
|
|
714
736
|
_initSheetChange() {
|
|
715
737
|
this.disposeWithMe(
|
|
716
738
|
this._sheetInterceptorService.interceptCommand({
|
|
717
739
|
getMutations: (o) => {
|
|
718
740
|
var e;
|
|
719
|
-
if (o.id ===
|
|
720
|
-
const
|
|
741
|
+
if (o.id === et.id) {
|
|
742
|
+
const r = o.params, t = r.unitId ? this._univerInstanceService.getUnit(r.unitId) : this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
721
743
|
if (!t)
|
|
722
744
|
return { redos: [], undos: [] };
|
|
723
|
-
const
|
|
745
|
+
const n = t.getUnitId(), i = r.subUnitId || ((e = t.getActiveSheet()) == null ? void 0 : e.getSheetId());
|
|
724
746
|
if (!i)
|
|
725
747
|
return { redos: [], undos: [] };
|
|
726
|
-
const s = this._threadCommentModel.ensureMap(
|
|
748
|
+
const s = this._threadCommentModel.ensureMap(n, i), a = Array.from(s.values()).filter((u) => !u.parentId), c = a.map((u) => u.id), m = this._threadCommentDataSourceService.syncUpdateMutationToColla, h = c.map((u) => ({
|
|
727
749
|
id: F.id,
|
|
728
750
|
params: {
|
|
729
|
-
unitId:
|
|
751
|
+
unitId: n,
|
|
730
752
|
subUnitId: i,
|
|
731
753
|
commentId: u
|
|
732
754
|
}
|
|
733
|
-
})),
|
|
734
|
-
id:
|
|
755
|
+
})), d = a.map(({ children: u, ...p }) => ({
|
|
756
|
+
id: ie.id,
|
|
735
757
|
params: {
|
|
736
|
-
unitId:
|
|
758
|
+
unitId: n,
|
|
737
759
|
subUnitId: i,
|
|
738
760
|
comment: {
|
|
739
761
|
...p,
|
|
740
|
-
children:
|
|
762
|
+
children: m ? u : void 0
|
|
741
763
|
},
|
|
742
|
-
sync: !
|
|
764
|
+
sync: !m
|
|
743
765
|
}
|
|
744
766
|
}));
|
|
745
|
-
return { redos:
|
|
767
|
+
return { redos: h, undos: d };
|
|
746
768
|
}
|
|
747
769
|
return { redos: [], undos: [] };
|
|
748
770
|
}
|
|
@@ -750,22 +772,22 @@ let K = class extends $ {
|
|
|
750
772
|
);
|
|
751
773
|
}
|
|
752
774
|
};
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
],
|
|
759
|
-
var
|
|
760
|
-
for (var
|
|
761
|
-
(s = o[i]) && (
|
|
762
|
-
return t &&
|
|
763
|
-
},
|
|
764
|
-
let
|
|
765
|
-
constructor(o =
|
|
766
|
-
super(), this._config = o, this._injector = e, this._commandService =
|
|
767
|
-
const { menu:
|
|
768
|
-
|
|
775
|
+
Y = _n([
|
|
776
|
+
H(0, v(_e)),
|
|
777
|
+
H(1, N),
|
|
778
|
+
H(2, v(Et)),
|
|
779
|
+
H(3, ye)
|
|
780
|
+
], Y);
|
|
781
|
+
var je = Object.defineProperty, fn = Object.getOwnPropertyDescriptor, Cn = (o, e, r) => e in o ? je(o, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[e] = r, Sn = (o, e, r, t) => {
|
|
782
|
+
for (var n = t > 1 ? void 0 : t ? fn(e, r) : e, i = o.length - 1, s; i >= 0; i--)
|
|
783
|
+
(s = o[i]) && (n = (t ? s(e, r, n) : s(n)) || n);
|
|
784
|
+
return t && n && je(e, r, n), n;
|
|
785
|
+
}, oe = (o, e) => (r, t) => e(r, t, o), Ae = (o, e, r) => Cn(o, typeof e != "symbol" ? e + "" : e, r);
|
|
786
|
+
let q = class extends qe {
|
|
787
|
+
constructor(o = Nt, e, r, t) {
|
|
788
|
+
super(), this._config = o, this._injector = e, this._commandService = r, this._configService = t;
|
|
789
|
+
const { menu: n, ...i } = this._config;
|
|
790
|
+
n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig($t, i);
|
|
769
791
|
}
|
|
770
792
|
onStarting() {
|
|
771
793
|
[
|
|
@@ -773,9 +795,9 @@ let Y = class extends ze {
|
|
|
773
795
|
[k],
|
|
774
796
|
[Z],
|
|
775
797
|
[z],
|
|
776
|
-
[
|
|
798
|
+
[Y],
|
|
777
799
|
[G],
|
|
778
|
-
[
|
|
800
|
+
[R]
|
|
779
801
|
].forEach((o) => {
|
|
780
802
|
this._injector.add(o);
|
|
781
803
|
}), [V].forEach((o) => {
|
|
@@ -783,31 +805,31 @@ let Y = class extends ze {
|
|
|
783
805
|
}), this._injector.get(W);
|
|
784
806
|
}
|
|
785
807
|
onReady() {
|
|
786
|
-
this._injector.get(k), this._injector.get(
|
|
808
|
+
this._injector.get(k), this._injector.get(Y);
|
|
787
809
|
}
|
|
788
810
|
onRendered() {
|
|
789
811
|
this._injector.get(Z), this._injector.get(z), this._injector.get(G);
|
|
790
812
|
}
|
|
791
813
|
};
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
],
|
|
814
|
+
Ae(q, "pluginName", Oe);
|
|
815
|
+
Ae(q, "type", b.UNIVER_SHEET);
|
|
816
|
+
q = Sn([
|
|
817
|
+
Ge(it, tt),
|
|
818
|
+
oe(1, v(Ye)),
|
|
819
|
+
oe(2, v(se)),
|
|
820
|
+
oe(3, Ke)
|
|
821
|
+
], q);
|
|
800
822
|
export {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
823
|
+
An as AddCommentCommand,
|
|
824
|
+
Vn as DeleteCommentCommand,
|
|
825
|
+
Bn as DeleteCommentTreeCommand,
|
|
826
|
+
Ln as IThreadCommentDataSourceService,
|
|
827
|
+
xn as IThreadCommentMentionDataService,
|
|
828
|
+
Hn as ResolveCommentCommand,
|
|
807
829
|
Oe as SHEETS_THREAD_COMMENT,
|
|
808
|
-
|
|
830
|
+
R as SheetsThreadCommentPopupService,
|
|
809
831
|
V as ShowAddSheetCommentModalOperation,
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
832
|
+
q as UniverSheetsThreadCommentUIPlugin,
|
|
833
|
+
Dn as UniverThreadCommentUIPlugin,
|
|
834
|
+
Fn as UpdateCommentCommand
|
|
813
835
|
};
|