@univerjs/sheets-thread-comment 0.4.1 → 0.4.2-nightly.202410301606
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/README.md +4 -73
- package/lib/es/facade.js +226 -0
- package/lib/es/index.js +172 -780
- package/lib/sheets-thread-comment.model-17mh6Jez.mjs +169 -0
- package/lib/types/controllers/config.schema.d.ts +17 -6
- package/lib/types/controllers/sheets-thread-comment-ref-range.controller.d.ts +22 -0
- package/lib/types/facade/f-range.d.ts +26 -0
- package/lib/types/facade/f-thread-comment.d.ts +56 -0
- package/lib/types/facade/f-workbook.d.ts +35 -0
- package/lib/types/facade/f-worksheet.d.ts +13 -0
- package/lib/types/facade/index.d.ts +1 -0
- package/lib/types/index.d.ts +3 -9
- package/lib/types/models/sheets-thread-comment.model.d.ts +30 -0
- package/lib/types/plugin.d.ts +2 -7
- package/lib/types/types/const.d.ts +1 -3
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +1 -1
- package/package.json +15 -29
- package/LICENSE +0 -176
- package/lib/cjs/index.js +0 -1
- package/lib/locale/en-US.json +0 -8
- package/lib/locale/fa-IR.json +0 -8
- package/lib/locale/ru-RU.json +0 -8
- package/lib/locale/vi-VN.json +0 -8
- package/lib/locale/zh-CN.json +0 -8
- package/lib/locale/zh-TW.json +0 -8
- package/lib/types/commands/operations/comment.operation.d.ts +0 -2
- package/lib/types/controllers/menu.d.ts +0 -12
- package/lib/types/controllers/menu.schema.d.ts +0 -2
- package/lib/types/controllers/render-controllers/render.controller.d.ts +0 -13
- package/lib/types/controllers/sheets-thread-comment-copy-paste.controller.d.ts +0 -12
- package/lib/types/controllers/sheets-thread-comment-hover.controller.d.ts +0 -12
- package/lib/types/controllers/sheets-thread-comment-popup.controller.d.ts +0 -26
- package/lib/types/controllers/sheets-thread-comment-remove.controller.d.ts +0 -11
- package/lib/types/controllers/sheets-thread-comment.controller.d.ts +0 -11
- package/lib/types/locale/en-US.d.ts +0 -24
- package/lib/types/locale/fa-IR.d.ts +0 -24
- package/lib/types/locale/ru-RU.d.ts +0 -24
- package/lib/types/locale/vi-VN.d.ts +0 -24
- package/lib/types/locale/zh-CN.d.ts +0 -24
- package/lib/types/locale/zh-TW.d.ts +0 -24
- package/lib/types/services/sheets-thread-comment-popup.service.d.ts +0 -23
- package/lib/types/views/sheets-thread-comment-cell/index.d.ts +0 -2
- package/lib/types/views/sheets-thread-comment-panel/index.d.ts +0 -2
package/lib/es/index.js
CHANGED
|
@@ -2,817 +2,209 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { Inject, Disposable,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import { IZenZoneService, useObservable, KeyCode, MetaKeys, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, ContextMenuPosition, ContextMenuGroup, ComponentManager, IMenuManagerService, IShortcutService } from "@univerjs/ui";
|
|
13
|
-
import { BehaviorSubject, debounceTime, map } from "rxjs";
|
|
14
|
-
import { IRenderManagerService } from "@univerjs/engine-render";
|
|
15
|
-
import React, { forwardRef, useRef, createElement, useMemo, useCallback, useEffect } from "react";
|
|
16
|
-
import { singleReferenceToGrid, serializeRange } from "@univerjs/engine-formula";
|
|
17
|
-
import { IThreadCommentDataSourceService, DeleteCommentMutation, AddCommentMutation, ThreadCommentModel } from "@univerjs/thread-comment";
|
|
18
|
-
import { AddCommentCommand, DeleteCommentCommand, DeleteCommentTreeCommand, IThreadCommentDataSourceService as IThreadCommentDataSourceService2, ResolveCommentCommand, UpdateCommentCommand } from "@univerjs/thread-comment";
|
|
19
|
-
const SHEETS_THREAD_COMMENT_MODAL = "univer.sheet.thread-comment-modal", COMMENT_SINGLE_ICON = "comment-single", SHEETS_THREAD_COMMENT = "SHEET_THREAD_COMMENT";
|
|
20
|
-
var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
21
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5
|
+
import { Inject, Disposable, sequenceExecuteAsync, toDisposable, ICommandService, UniverInstanceType, DependentOn, Injector, Plugin } from "@univerjs/core";
|
|
6
|
+
import { serializeRange, singleReferenceToGrid } from "@univerjs/engine-formula";
|
|
7
|
+
import { RefRangeService, SheetsSelectionsService, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests } from "@univerjs/sheets";
|
|
8
|
+
import { ThreadCommentModel, DeleteCommentMutation, AddCommentMutation, UpdateCommentRefMutation, UniverThreadCommentPlugin } from "@univerjs/thread-comment";
|
|
9
|
+
import { S as SheetsThreadCommentModel } from "../sheets-thread-comment.model-17mh6Jez.mjs";
|
|
10
|
+
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
11
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
22
12
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
23
|
-
return kind && result && __defProp$
|
|
24
|
-
}, "__decorateClass$
|
|
25
|
-
let
|
|
26
|
-
constructor(
|
|
13
|
+
return kind && result && __defProp$1(target, key, result), result;
|
|
14
|
+
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a;
|
|
15
|
+
let SheetsThreadCommentRefRangeController = (_a = class extends Disposable {
|
|
16
|
+
constructor(_refRangeService, _sheetsThreadCommentModel, _threadCommentModel, _selectionManagerService, _commandService) {
|
|
27
17
|
super();
|
|
28
|
-
__publicField(this, "
|
|
29
|
-
__publicField(this, "
|
|
30
|
-
__publicField(this, "
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
18
|
+
__publicField(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
19
|
+
__publicField(this, "_watcherMap", /* @__PURE__ */ new Map());
|
|
20
|
+
__publicField(this, "_handleRangeChange", /* @__PURE__ */ __name((unitId, subUnitId, comment, resultRange, silent) => {
|
|
21
|
+
const commentId = comment.id, oldRange = {
|
|
22
|
+
startColumn: comment.column,
|
|
23
|
+
endColumn: comment.column,
|
|
24
|
+
startRow: comment.row,
|
|
25
|
+
endRow: comment.row
|
|
26
|
+
};
|
|
27
|
+
return resultRange ? {
|
|
28
|
+
redos: [{
|
|
29
|
+
id: UpdateCommentRefMutation.id,
|
|
30
|
+
params: {
|
|
31
|
+
unitId,
|
|
32
|
+
subUnitId,
|
|
33
|
+
payload: {
|
|
34
|
+
ref: serializeRange(resultRange),
|
|
35
|
+
commentId
|
|
36
|
+
},
|
|
37
|
+
silent
|
|
38
|
+
}
|
|
39
|
+
}],
|
|
40
|
+
undos: [{
|
|
41
|
+
id: UpdateCommentRefMutation.id,
|
|
42
|
+
params: {
|
|
43
|
+
unitId,
|
|
44
|
+
subUnitId,
|
|
45
|
+
payload: {
|
|
46
|
+
ref: serializeRange(oldRange),
|
|
47
|
+
commentId
|
|
48
|
+
},
|
|
49
|
+
silent
|
|
50
|
+
}
|
|
51
|
+
}]
|
|
52
|
+
} : {
|
|
53
|
+
redos: [{
|
|
54
|
+
id: DeleteCommentMutation.id,
|
|
55
|
+
params: {
|
|
56
|
+
unitId,
|
|
57
|
+
subUnitId,
|
|
58
|
+
commentId
|
|
59
|
+
}
|
|
60
|
+
}],
|
|
61
|
+
undos: [{
|
|
62
|
+
id: AddCommentMutation.id,
|
|
63
|
+
params: {
|
|
64
|
+
unitId,
|
|
65
|
+
subUnitId,
|
|
66
|
+
comment,
|
|
67
|
+
sync: !0
|
|
68
|
+
}
|
|
69
|
+
}]
|
|
70
|
+
};
|
|
71
|
+
}, "_handleRangeChange"));
|
|
72
|
+
this._refRangeService = _refRangeService, this._sheetsThreadCommentModel = _sheetsThreadCommentModel, this._threadCommentModel = _threadCommentModel, this._selectionManagerService = _selectionManagerService, this._commandService = _commandService, this._initData(), this._initRefRange();
|
|
73
|
+
}
|
|
74
|
+
_getIdWithUnitId(unitId, subUnitId, id) {
|
|
75
|
+
return `${unitId}-${subUnitId}-${id}`;
|
|
76
|
+
}
|
|
77
|
+
_register(unitId, subUnitId, comment) {
|
|
78
|
+
const commentId = comment.id, oldRange = {
|
|
79
|
+
startColumn: comment.column,
|
|
80
|
+
endColumn: comment.column,
|
|
81
|
+
startRow: comment.row,
|
|
82
|
+
endRow: comment.row
|
|
83
|
+
};
|
|
84
|
+
this._disposableMap.set(
|
|
85
|
+
this._getIdWithUnitId(unitId, subUnitId, commentId),
|
|
86
|
+
this._refRangeService.registerRefRange(oldRange, (commandInfo) => {
|
|
87
|
+
const resultRanges = handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(oldRange, commandInfo, { selectionManagerService: this._selectionManagerService }), resultRange = Array.isArray(resultRanges) ? resultRanges[0] : resultRanges;
|
|
88
|
+
return resultRange && resultRange.startColumn === oldRange.startColumn && resultRange.startRow === oldRange.startRow ? {
|
|
89
|
+
undos: [],
|
|
90
|
+
redos: []
|
|
91
|
+
} : this._handleRangeChange(unitId, subUnitId, comment, resultRange, !1);
|
|
92
|
+
}, unitId, subUnitId)
|
|
68
93
|
);
|
|
69
|
-
if (!popupDisposable)
|
|
70
|
-
throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");
|
|
71
|
-
const disposableCollection = new DisposableCollection();
|
|
72
|
-
disposableCollection.add(popupDisposable), disposableCollection.add({
|
|
73
|
-
dispose: /* @__PURE__ */ __name(() => {
|
|
74
|
-
onHide == null || onHide();
|
|
75
|
-
}, "dispose")
|
|
76
|
-
}), this._lastPopup = disposableCollection;
|
|
77
|
-
}
|
|
78
|
-
hidePopup() {
|
|
79
|
-
this._activePopup && (this._lastPopup && this._lastPopup.dispose(), this._lastPopup = null, this._activePopup = null, this._activePopup$.next(null));
|
|
80
|
-
}
|
|
81
|
-
persistPopup() {
|
|
82
|
-
!this._activePopup || !this._activePopup.temp || (this._activePopup = {
|
|
83
|
-
...this._activePopup,
|
|
84
|
-
temp: !1
|
|
85
|
-
}, this._activePopup$.next(this._activePopup));
|
|
86
94
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
type: CommandType.OPERATION,
|
|
94
|
-
id: "sheets.operation.show-comment-modal",
|
|
95
|
-
handler(accessor) {
|
|
96
|
-
var _a9;
|
|
97
|
-
const selectionManagerService = accessor.get(SheetsSelectionsService), univerInstanceService = accessor.get(IUniverInstanceService), sheetsThreadCommentPopupService = accessor.get(SheetsThreadCommentPopupService), threadCommentPanelService = accessor.get(ThreadCommentPanelService), activeCell = (_a9 = selectionManagerService.getCurrentLastSelection()) == null ? void 0 : _a9.primary, model = accessor.get(SheetsThreadCommentModel);
|
|
98
|
-
if (!activeCell)
|
|
99
|
-
return !1;
|
|
100
|
-
const result = getSheetCommandTarget(univerInstanceService);
|
|
101
|
-
if (!result)
|
|
102
|
-
return !1;
|
|
103
|
-
const { workbook, worksheet, unitId, subUnitId } = result, location = {
|
|
104
|
-
workbook,
|
|
105
|
-
worksheet,
|
|
106
|
-
unitId,
|
|
107
|
-
subUnitId,
|
|
108
|
-
row: activeCell.startRow,
|
|
109
|
-
col: activeCell.startColumn
|
|
95
|
+
_watch(unitId, subUnitId, comment) {
|
|
96
|
+
const commentId = comment.id, oldRange = {
|
|
97
|
+
startColumn: comment.column,
|
|
98
|
+
endColumn: comment.column,
|
|
99
|
+
startRow: comment.row,
|
|
100
|
+
endRow: comment.row
|
|
110
101
|
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
trigger: "context-menu"
|
|
118
|
-
}), !0;
|
|
119
|
-
}
|
|
120
|
-
}, PLUGIN_CONFIG_KEY = "sheets-thread-comment.config", defaultPluginConfig = {};
|
|
121
|
-
var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
122
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
123
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
124
|
-
return kind && result && __defProp$6(target, key, result), result;
|
|
125
|
-
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a2;
|
|
126
|
-
let SheetsThreadCommentRenderController = (_a2 = class extends Disposable {
|
|
127
|
-
constructor(_sheetInterceptorService, _sheetsThreadCommentModel, _univerInstanceService, _renderManagerService) {
|
|
128
|
-
super(), this._sheetInterceptorService = _sheetInterceptorService, this._sheetsThreadCommentModel = _sheetsThreadCommentModel, this._univerInstanceService = _univerInstanceService, this._renderManagerService = _renderManagerService, this._initViewModelIntercept(), this._initSkeletonChange();
|
|
129
|
-
}
|
|
130
|
-
_initViewModelIntercept() {
|
|
131
|
-
this.disposeWithMe(
|
|
132
|
-
this._sheetInterceptorService.intercept(
|
|
133
|
-
INTERCEPTOR_POINT.CELL_CONTENT,
|
|
134
|
-
{
|
|
135
|
-
effect: InterceptorEffectEnum.Style,
|
|
136
|
-
handler: /* @__PURE__ */ __name((cell, pos, next) => {
|
|
137
|
-
const { row, col, unitId, subUnitId } = pos;
|
|
138
|
-
return this._sheetsThreadCommentModel.showCommentMarker(unitId, subUnitId, row, col) ? next({
|
|
139
|
-
...cell,
|
|
140
|
-
markers: {
|
|
141
|
-
...cell == null ? void 0 : cell.markers,
|
|
142
|
-
tr: {
|
|
143
|
-
color: "#FFBD37",
|
|
144
|
-
size: 6
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}) : next(cell);
|
|
148
|
-
}, "handler"),
|
|
149
|
-
priority: 100
|
|
150
|
-
}
|
|
151
|
-
)
|
|
102
|
+
this._watcherMap.set(
|
|
103
|
+
this._getIdWithUnitId(unitId, subUnitId, commentId),
|
|
104
|
+
this._refRangeService.watchRange(unitId, subUnitId, oldRange, (before, after) => {
|
|
105
|
+
const { redos } = this._handleRangeChange(unitId, subUnitId, comment, after, !0);
|
|
106
|
+
sequenceExecuteAsync(redos, this._commandService, { onlyLocal: !0 });
|
|
107
|
+
}, !0)
|
|
152
108
|
);
|
|
153
109
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
var __assign = function() {
|
|
174
|
-
return __assign = Object.assign || function(t) {
|
|
175
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
176
|
-
s = arguments[i];
|
|
177
|
-
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
|
|
178
|
-
}
|
|
179
|
-
return t;
|
|
180
|
-
}, __assign.apply(this, arguments);
|
|
181
|
-
}, __rest = function(s, e) {
|
|
182
|
-
var t = {};
|
|
183
|
-
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
184
|
-
if (s != null && typeof Object.getOwnPropertySymbols == "function")
|
|
185
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
|
186
|
-
e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
|
|
187
|
-
return t;
|
|
188
|
-
}, IconBase = forwardRef(function(props, ref) {
|
|
189
|
-
var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
|
|
190
|
-
return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
|
|
191
|
-
});
|
|
192
|
-
function render(node, id, runtimeProps, rootProps, extend) {
|
|
193
|
-
return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
|
|
194
|
-
return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
|
|
195
|
-
}));
|
|
196
|
-
}
|
|
197
|
-
__name(render, "render");
|
|
198
|
-
function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
199
|
-
var attrs = __assign({}, node.attrs);
|
|
200
|
-
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
201
|
-
var defIds = runtimeProps.defIds;
|
|
202
|
-
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a9) {
|
|
203
|
-
var key = _a9[0], value = _a9[1];
|
|
204
|
-
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
205
|
-
})), attrs;
|
|
206
|
-
}
|
|
207
|
-
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
208
|
-
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
209
|
-
var _a9, defIds = runtimeProps.defIds;
|
|
210
|
-
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a9 = node.children) === null || _a9 === void 0) && _a9.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
|
|
211
|
-
return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
|
|
212
|
-
}) }) : node;
|
|
213
|
-
}
|
|
214
|
-
__name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
|
|
215
|
-
function generateShortUuid() {
|
|
216
|
-
return Math.random().toString(36).substring(2, 8);
|
|
217
|
-
}
|
|
218
|
-
__name(generateShortUuid, "generateShortUuid");
|
|
219
|
-
IconBase.displayName = "UniverIcon";
|
|
220
|
-
var element = { 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" } }] }, CommentSingle = forwardRef(function(props, ref) {
|
|
221
|
-
return createElement(IconBase, Object.assign({}, props, {
|
|
222
|
-
id: "comment-single",
|
|
223
|
-
ref,
|
|
224
|
-
icon: element
|
|
225
|
-
}));
|
|
226
|
-
});
|
|
227
|
-
CommentSingle.displayName = "CommentSingle";
|
|
228
|
-
const SheetsThreadCommentCell = /* @__PURE__ */ __name(() => {
|
|
229
|
-
const univerInstanceService = useDependency(IUniverInstanceService), sheetsThreadCommentPopupService = useDependency(SheetsThreadCommentPopupService), activePopup = useObservable(sheetsThreadCommentPopupService.activePopup$), sheetThreadCommentModel = useDependency(SheetsThreadCommentModel);
|
|
230
|
-
if (useObservable(sheetThreadCommentModel.commentUpdate$), !activePopup)
|
|
231
|
-
return null;
|
|
232
|
-
const { row, col, unitId, subUnitId, trigger } = activePopup, rootId = sheetThreadCommentModel.getByLocation(unitId, subUnitId, row, col), ref = `${Tools.chatAtABC(col)}${row + 1}`, onClose = /* @__PURE__ */ __name(() => {
|
|
233
|
-
sheetsThreadCommentPopupService.hidePopup();
|
|
234
|
-
}, "onClose"), getSubUnitName = /* @__PURE__ */ __name((id) => {
|
|
235
|
-
var _a9, _b, _c;
|
|
236
|
-
return (_c = (_b = (_a9 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a9.getSheetBySheetId(id)) == null ? void 0 : _b.getName()) != null ? _c : "";
|
|
237
|
-
}, "getSubUnitName");
|
|
238
|
-
return /* @__PURE__ */ React.createElement(
|
|
239
|
-
ThreadCommentTree,
|
|
240
|
-
{
|
|
241
|
-
onClick: /* @__PURE__ */ __name(() => {
|
|
242
|
-
sheetsThreadCommentPopupService.persistPopup();
|
|
243
|
-
}, "onClick"),
|
|
244
|
-
prefix: "cell",
|
|
245
|
-
id: rootId,
|
|
246
|
-
unitId,
|
|
247
|
-
subUnitId,
|
|
248
|
-
type: UniverInstanceType.UNIVER_SHEET,
|
|
249
|
-
refStr: ref,
|
|
250
|
-
onClose,
|
|
251
|
-
getSubUnitName,
|
|
252
|
-
autoFocus: trigger === "context-menu"
|
|
253
|
-
}
|
|
254
|
-
);
|
|
255
|
-
}, "SheetsThreadCommentCell"), SheetsThreadCommentPanel = /* @__PURE__ */ __name(() => {
|
|
256
|
-
var _a9;
|
|
257
|
-
const markSelectionService = useDependency(IMarkSelectionService), univerInstanceService = useDependency(IUniverInstanceService), sheetsThreadCommentPopupService = useDependency(SheetsThreadCommentPopupService), workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), unitId = workbook.getUnitId(), commandService = useDependency(ICommandService), subUnitId$ = useMemo(() => workbook.activeSheet$.pipe(map((i) => i == null ? void 0 : i.getSheetId())), [workbook.activeSheet$]), subUnitId = useObservable(subUnitId$, (_a9 = workbook.getActiveSheet()) == null ? void 0 : _a9.getSheetId()), hoverShapeId = useRef(), panelService = useDependency(ThreadCommentPanelService), activeCommentId = useObservable(panelService.activeCommentId$), panelVisible = useObservable(panelService.panelVisible$, panelService.panelVisible), sortComments = useCallback((comments) => {
|
|
258
|
-
const worksheets = workbook.getSheets(), sheetIndex = {};
|
|
259
|
-
worksheets.forEach((sheet, i) => {
|
|
260
|
-
sheetIndex[sheet.getSheetId()] = i;
|
|
261
|
-
});
|
|
262
|
-
const sort = /* @__PURE__ */ __name((comments2) => comments2.map((comment) => {
|
|
263
|
-
var _a10;
|
|
264
|
-
const ref = singleReferenceToGrid(comment.ref), p = [(_a10 = sheetIndex[comment.subUnitId]) != null ? _a10 : 0, ref.row, ref.column];
|
|
265
|
-
return { ...comment, p };
|
|
266
|
-
}).sort((pre, aft) => pre.p[0] === aft.p[0] ? pre.p[1] === aft.p[1] ? pre.p[2] - aft.p[2] : pre.p[1] - aft.p[1] : pre.p[0] - aft.p[0]), "sort");
|
|
267
|
-
return [
|
|
268
|
-
...sort(comments.filter((comment) => !comment.resolved)),
|
|
269
|
-
...sort(comments.filter((comment) => comment.resolved))
|
|
270
|
-
];
|
|
271
|
-
}, [workbook]), showShape = useCallback((comment) => {
|
|
272
|
-
var _a10;
|
|
273
|
-
if (comment.unitId === unitId && comment.subUnitId === subUnitId && !comment.resolved) {
|
|
274
|
-
const { row, column } = singleReferenceToGrid(comment.ref), worksheet = workbook.getSheetBySheetId(comment.subUnitId), mergeInfo = (_a10 = worksheet == null ? void 0 : worksheet.getMergedCell(row, column)) != null ? _a10 : {
|
|
275
|
-
startColumn: column,
|
|
276
|
-
endColumn: column,
|
|
277
|
-
startRow: row,
|
|
278
|
-
endRow: row
|
|
279
|
-
};
|
|
280
|
-
if (!Number.isNaN(row) && !Number.isNaN(column))
|
|
281
|
-
return markSelectionService.addShape({
|
|
282
|
-
range: mergeInfo,
|
|
283
|
-
style: {
|
|
284
|
-
hasAutoFill: !1,
|
|
285
|
-
fill: "rgb(255, 189, 55, 0.35)",
|
|
286
|
-
strokeWidth: 1,
|
|
287
|
-
stroke: "#FFBD37",
|
|
288
|
-
widgets: {}
|
|
289
|
-
},
|
|
290
|
-
primary: null
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}, [markSelectionService, subUnitId, unitId]), getSubUnitName = /* @__PURE__ */ __name((id) => {
|
|
294
|
-
var _a10, _b;
|
|
295
|
-
return (_b = (_a10 = workbook.getSheetBySheetId(id)) == null ? void 0 : _a10.getName()) != null ? _b : "";
|
|
296
|
-
}, "getSubUnitName"), handleAdd = /* @__PURE__ */ __name(() => {
|
|
297
|
-
commandService.executeCommand(ShowAddSheetCommentModalOperation.id);
|
|
298
|
-
}, "handleAdd"), handleHover = /* @__PURE__ */ __name((comment) => {
|
|
299
|
-
activeCommentId && activeCommentId.unitId === comment.unitId && activeCommentId.subUnitId === comment.subUnitId && activeCommentId.commentId === comment.id || (hoverShapeId.current && (markSelectionService.removeShape(hoverShapeId.current), hoverShapeId.current = null), hoverShapeId.current = showShape(comment));
|
|
300
|
-
}, "handleHover"), handleLeave = /* @__PURE__ */ __name(() => {
|
|
301
|
-
hoverShapeId.current && (markSelectionService.removeShape(hoverShapeId.current), hoverShapeId.current = null);
|
|
302
|
-
}, "handleLeave"), handleResolve = /* @__PURE__ */ __name((id, resolved) => {
|
|
303
|
-
resolved && sheetsThreadCommentPopupService.hidePopup();
|
|
304
|
-
}, "handleResolve");
|
|
305
|
-
return useEffect(() => {
|
|
306
|
-
!panelVisible && hoverShapeId.current && markSelectionService.removeShape(hoverShapeId.current);
|
|
307
|
-
}, [markSelectionService, panelVisible]), /* @__PURE__ */ React.createElement(
|
|
308
|
-
ThreadCommentPanel,
|
|
309
|
-
{
|
|
310
|
-
unitId,
|
|
311
|
-
subUnitId$,
|
|
312
|
-
type: UniverInstanceType.UNIVER_SHEET,
|
|
313
|
-
onAdd: handleAdd,
|
|
314
|
-
getSubUnitName,
|
|
315
|
-
onResolve: handleResolve,
|
|
316
|
-
sortComments,
|
|
317
|
-
onItemEnter: handleHover,
|
|
318
|
-
onItemLeave: handleLeave,
|
|
319
|
-
onDeleteComment: /* @__PURE__ */ __name(() => (handleLeave(), !0), "onDeleteComment")
|
|
320
|
-
}
|
|
321
|
-
);
|
|
322
|
-
}, "SheetsThreadCommentPanel"), threadCommentMenuFactory = /* @__PURE__ */ __name((accessor) => ({
|
|
323
|
-
id: ShowAddSheetCommentModalOperation.id,
|
|
324
|
-
type: MenuItemType.BUTTON,
|
|
325
|
-
icon: COMMENT_SINGLE_ICON,
|
|
326
|
-
title: "sheetThreadComment.menu.addComment",
|
|
327
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
328
|
-
disabled$: getCurrentRangeDisable$(accessor, {
|
|
329
|
-
workbookTypes: [WorkbookCommentPermission],
|
|
330
|
-
worksheetTypes: [WorksheetViewPermission],
|
|
331
|
-
rangeTypes: [RangeProtectionPermissionViewPoint]
|
|
332
|
-
})
|
|
333
|
-
}), "threadCommentMenuFactory"), threadPanelMenuFactory = /* @__PURE__ */ __name((accessor) => ({
|
|
334
|
-
id: ToggleSheetCommentPanelOperation.id,
|
|
335
|
-
type: MenuItemType.BUTTON,
|
|
336
|
-
icon: COMMENT_SINGLE_ICON,
|
|
337
|
-
tooltip: "sheetThreadComment.menu.commentManagement",
|
|
338
|
-
disabled$: getCurrentRangeDisable$(accessor, {
|
|
339
|
-
workbookTypes: [WorkbookCommentPermission],
|
|
340
|
-
worksheetTypes: [WorksheetViewPermission],
|
|
341
|
-
rangeTypes: [RangeProtectionPermissionViewPoint]
|
|
342
|
-
}),
|
|
343
|
-
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
|
|
344
|
-
}), "threadPanelMenuFactory"), AddCommentShortcut = {
|
|
345
|
-
id: ShowAddSheetCommentModalOperation.id,
|
|
346
|
-
binding: KeyCode.M | MetaKeys.CTRL_COMMAND | MetaKeys.ALT,
|
|
347
|
-
preconditions: whenSheetEditorFocused
|
|
348
|
-
}, menuSchema = {
|
|
349
|
-
[RibbonStartGroup.OTHERS]: {
|
|
350
|
-
[ToggleSheetCommentPanelOperation.id]: {
|
|
351
|
-
order: 1,
|
|
352
|
-
menuItemFactory: threadPanelMenuFactory
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
[ContextMenuPosition.MAIN_AREA]: {
|
|
356
|
-
[ContextMenuGroup.OTHERS]: {
|
|
357
|
-
[ShowAddSheetCommentModalOperation.id]: {
|
|
358
|
-
order: 0,
|
|
359
|
-
menuItemFactory: threadCommentMenuFactory
|
|
110
|
+
_unwatch(unitId, subUnitId, commentId) {
|
|
111
|
+
var _a3;
|
|
112
|
+
const id = this._getIdWithUnitId(unitId, subUnitId, commentId);
|
|
113
|
+
(_a3 = this._watcherMap.get(id)) == null || _a3.dispose(), this._watcherMap.delete(id);
|
|
114
|
+
}
|
|
115
|
+
_unregister(unitId, subUnitId, commentId) {
|
|
116
|
+
var _a3;
|
|
117
|
+
const id = this._getIdWithUnitId(unitId, subUnitId, commentId);
|
|
118
|
+
(_a3 = this._disposableMap.get(id)) == null || _a3.dispose(), this._disposableMap.delete(id);
|
|
119
|
+
}
|
|
120
|
+
_initData() {
|
|
121
|
+
const datas = this._threadCommentModel.getAll();
|
|
122
|
+
for (const data of datas)
|
|
123
|
+
for (const thread of data.threads) {
|
|
124
|
+
const { unitId, subUnitId, root } = thread, pos = singleReferenceToGrid(root.ref), sheetComment = {
|
|
125
|
+
...root,
|
|
126
|
+
...pos
|
|
127
|
+
};
|
|
128
|
+
this._register(unitId, subUnitId, sheetComment), this._watch(unitId, subUnitId, sheetComment);
|
|
360
129
|
}
|
|
361
|
-
}
|
|
362
130
|
}
|
|
363
|
-
|
|
364
|
-
var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
365
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
366
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
367
|
-
return kind && result && __defProp$5(target, key, result), result;
|
|
368
|
-
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a3;
|
|
369
|
-
let SheetsThreadCommentController = (_a3 = class extends Disposable {
|
|
370
|
-
constructor(_menuManagerService, _componentManager, _shortcutService) {
|
|
371
|
-
super(), this._menuManagerService = _menuManagerService, this._componentManager = _componentManager, this._shortcutService = _shortcutService, this._initMenu(), this._initShortcut(), this._initComponent();
|
|
372
|
-
}
|
|
373
|
-
_initShortcut() {
|
|
374
|
-
this._shortcutService.registerShortcut(AddCommentShortcut);
|
|
375
|
-
}
|
|
376
|
-
_initMenu() {
|
|
377
|
-
this._menuManagerService.mergeMenu(menuSchema);
|
|
378
|
-
}
|
|
379
|
-
_initComponent() {
|
|
380
|
-
[
|
|
381
|
-
[SHEETS_THREAD_COMMENT_MODAL, SheetsThreadCommentCell],
|
|
382
|
-
[THREAD_COMMENT_PANEL, SheetsThreadCommentPanel],
|
|
383
|
-
[COMMENT_SINGLE_ICON, CommentSingle]
|
|
384
|
-
].forEach(([key, comp]) => {
|
|
385
|
-
this._componentManager.register(key, comp);
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
}, __name(_a3, "SheetsThreadCommentController"), _a3);
|
|
389
|
-
SheetsThreadCommentController = __decorateClass$5([
|
|
390
|
-
__decorateParam$5(0, IMenuManagerService),
|
|
391
|
-
__decorateParam$5(1, Inject(ComponentManager)),
|
|
392
|
-
__decorateParam$5(2, IShortcutService)
|
|
393
|
-
], SheetsThreadCommentController);
|
|
394
|
-
var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
395
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
396
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
397
|
-
return kind && result && __defProp$4(target, key, result), result;
|
|
398
|
-
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4");
|
|
399
|
-
const transformRef = /* @__PURE__ */ __name((ref, source, target) => {
|
|
400
|
-
const refObj = singleReferenceToGrid(ref), offsetRow = target.row - source.row, offsetCol = target.column - source.column, targetRange = {
|
|
401
|
-
startColumn: refObj.column + offsetCol,
|
|
402
|
-
startRow: refObj.row + offsetRow,
|
|
403
|
-
endColumn: refObj.column + offsetCol,
|
|
404
|
-
endRow: refObj.row + offsetRow
|
|
405
|
-
};
|
|
406
|
-
return serializeRange(targetRange);
|
|
407
|
-
}, "transformRef");
|
|
408
|
-
var _a4;
|
|
409
|
-
let SheetsThreadCommentCopyPasteController = (_a4 = class extends Disposable {
|
|
410
|
-
constructor(_sheetClipboardService, _sheetsThreadCommentModel, _threadCommentDataSourceService) {
|
|
411
|
-
super();
|
|
412
|
-
__publicField(this, "_copyInfo");
|
|
413
|
-
this._sheetClipboardService = _sheetClipboardService, this._sheetsThreadCommentModel = _sheetsThreadCommentModel, this._threadCommentDataSourceService = _threadCommentDataSourceService, this._initClipboardHook();
|
|
414
|
-
}
|
|
415
|
-
// eslint-disable-next-line max-lines-per-function
|
|
416
|
-
_initClipboardHook() {
|
|
131
|
+
_initRefRange() {
|
|
417
132
|
this.disposeWithMe(
|
|
418
|
-
this.
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
onPasteCells: /* @__PURE__ */ __name((_pasteFrom, pasteTo, _data, payload) => {
|
|
429
|
-
const { unitId: targetUnitId, subUnitId: targetSubUnitId, range } = pasteTo, targetPos = {
|
|
430
|
-
row: range.rows[0],
|
|
431
|
-
column: range.cols[0]
|
|
432
|
-
};
|
|
433
|
-
if (payload.copyType === COPY_TYPE.CUT && this._copyInfo) {
|
|
434
|
-
const { range: range2, unitId: sourceUnitId, subUnitId: sourceSubUnitId } = this._copyInfo, sourcePos = {
|
|
435
|
-
row: range2.startRow,
|
|
436
|
-
column: range2.startColumn
|
|
133
|
+
this._sheetsThreadCommentModel.commentUpdate$.subscribe((option) => {
|
|
134
|
+
const { unitId, subUnitId } = option;
|
|
135
|
+
switch (option.type) {
|
|
136
|
+
case "add": {
|
|
137
|
+
if (option.payload.parentId)
|
|
138
|
+
return;
|
|
139
|
+
const comment = {
|
|
140
|
+
...option.payload,
|
|
141
|
+
row: option.row,
|
|
142
|
+
column: option.column
|
|
437
143
|
};
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
Range.foreach(range2, (row, col) => {
|
|
441
|
-
const comments = this._sheetsThreadCommentModel.getAllByLocation(sourceUnitId, sourceSubUnitId, row, col);
|
|
442
|
-
this._threadCommentDataSourceService.syncUpdateMutationToColla ? comments.forEach((comment) => {
|
|
443
|
-
roots.push(comment);
|
|
444
|
-
}) : comments.forEach(({ children, ...comment }) => {
|
|
445
|
-
comment.parentId || roots.push(comment);
|
|
446
|
-
});
|
|
447
|
-
});
|
|
448
|
-
const sourceRedos = [], sourceUndos = [], targetRedos = [], targetUndos = [], handleCommentItem = /* @__PURE__ */ __name((item) => {
|
|
449
|
-
sourceRedos.unshift({
|
|
450
|
-
id: DeleteCommentMutation.id,
|
|
451
|
-
params: {
|
|
452
|
-
unitId: sourceUnitId,
|
|
453
|
-
subUnitId: sourceSubUnitId,
|
|
454
|
-
commentId: item.id
|
|
455
|
-
}
|
|
456
|
-
}), targetRedos.push({
|
|
457
|
-
id: AddCommentMutation.id,
|
|
458
|
-
params: {
|
|
459
|
-
unitId: targetUnitId,
|
|
460
|
-
subUnitId: targetSubUnitId,
|
|
461
|
-
comment: {
|
|
462
|
-
...item,
|
|
463
|
-
ref: transformRef(item.ref, sourcePos, targetPos),
|
|
464
|
-
unitId: targetUnitId,
|
|
465
|
-
subUnitId: targetSubUnitId
|
|
466
|
-
},
|
|
467
|
-
sync: !0
|
|
468
|
-
}
|
|
469
|
-
}), sourceUndos.push({
|
|
470
|
-
id: AddCommentMutation.id,
|
|
471
|
-
params: {
|
|
472
|
-
unitId: sourceUnitId,
|
|
473
|
-
subUnitId: sourceSubUnitId,
|
|
474
|
-
comment: item,
|
|
475
|
-
sync: !0
|
|
476
|
-
}
|
|
477
|
-
}), targetUndos.unshift({
|
|
478
|
-
id: DeleteCommentMutation.id,
|
|
479
|
-
params: {
|
|
480
|
-
unitId: targetUnitId,
|
|
481
|
-
subUnitId: targetSubUnitId,
|
|
482
|
-
commentId: item.id
|
|
483
|
-
}
|
|
484
|
-
});
|
|
485
|
-
}, "handleCommentItem");
|
|
486
|
-
return roots.forEach((root) => {
|
|
487
|
-
handleCommentItem(root);
|
|
488
|
-
}), {
|
|
489
|
-
redos: [...sourceRedos, ...targetRedos],
|
|
490
|
-
undos: [...targetUndos, ...sourceUndos]
|
|
491
|
-
};
|
|
492
|
-
}
|
|
144
|
+
this._register(option.unitId, option.subUnitId, comment), this._watch(option.unitId, option.subUnitId, comment);
|
|
145
|
+
break;
|
|
493
146
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
}
|
|
502
|
-
}, __name(_a4, "SheetsThreadCommentCopyPasteController"), _a4);
|
|
503
|
-
SheetsThreadCommentCopyPasteController = __decorateClass$4([
|
|
504
|
-
__decorateParam$4(0, Inject(ISheetClipboardService)),
|
|
505
|
-
__decorateParam$4(1, Inject(SheetsThreadCommentModel)),
|
|
506
|
-
__decorateParam$4(2, IThreadCommentDataSourceService)
|
|
507
|
-
], SheetsThreadCommentCopyPasteController);
|
|
508
|
-
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
509
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
510
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
511
|
-
return kind && result && __defProp$3(target, key, result), result;
|
|
512
|
-
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a5;
|
|
513
|
-
let SheetsThreadCommentHoverController = (_a5 = class extends Disposable {
|
|
514
|
-
constructor(_hoverManagerService, _sheetsThreadCommentPopupService, _sheetsThreadCommentModel, _sheetPermissionInterceptorBaseController) {
|
|
515
|
-
super(), this._hoverManagerService = _hoverManagerService, this._sheetsThreadCommentPopupService = _sheetsThreadCommentPopupService, this._sheetsThreadCommentModel = _sheetsThreadCommentModel, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._initHoverEvent();
|
|
516
|
-
}
|
|
517
|
-
_initHoverEvent() {
|
|
518
|
-
this.disposeWithMe(
|
|
519
|
-
this._hoverManagerService.currentCell$.pipe(debounceTime(100)).subscribe((cell) => {
|
|
520
|
-
const currentPopup = this._sheetsThreadCommentPopupService.activePopup;
|
|
521
|
-
if (cell && (currentPopup && currentPopup.temp || !currentPopup)) {
|
|
522
|
-
const { location } = cell, { unitId, subUnitId, row, col } = location, commentId = this._sheetsThreadCommentModel.getByLocation(unitId, subUnitId, row, col);
|
|
523
|
-
if (commentId) {
|
|
524
|
-
if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
525
|
-
workbookTypes: [WorkbookCommentPermission],
|
|
526
|
-
worksheetTypes: [WorksheetViewPermission],
|
|
527
|
-
rangeTypes: [RangeProtectionPermissionViewPoint]
|
|
528
|
-
}, [{ startRow: row, startColumn: col, endRow: row, endColumn: col }]))
|
|
147
|
+
case "delete": {
|
|
148
|
+
this._unregister(unitId, subUnitId, option.payload.commentId), this._unwatch(unitId, subUnitId, option.payload.commentId);
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
case "updateRef": {
|
|
152
|
+
const comment = this._sheetsThreadCommentModel.getComment(unitId, subUnitId, option.payload.commentId);
|
|
153
|
+
if (!comment)
|
|
529
154
|
return;
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
} else
|
|
540
|
-
currentPopup && this._sheetsThreadCommentPopupService.hidePopup();
|
|
155
|
+
this._unregister(unitId, subUnitId, option.payload.commentId);
|
|
156
|
+
const sheetComment = {
|
|
157
|
+
...comment,
|
|
158
|
+
row: option.row,
|
|
159
|
+
column: option.column
|
|
160
|
+
};
|
|
161
|
+
option.silent || (this._unwatch(unitId, subUnitId, option.payload.commentId), this._watch(unitId, subUnitId, sheetComment)), this._register(option.unitId, option.subUnitId, sheetComment);
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
541
164
|
}
|
|
542
165
|
})
|
|
543
|
-
)
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
__decorateParam$3(0, Inject(HoverManagerService)),
|
|
548
|
-
__decorateParam$3(1, Inject(SheetsThreadCommentPopupService)),
|
|
549
|
-
__decorateParam$3(2, Inject(SheetsThreadCommentModel)),
|
|
550
|
-
__decorateParam$3(3, Inject(SheetPermissionInterceptorBaseController))
|
|
551
|
-
], SheetsThreadCommentHoverController);
|
|
552
|
-
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
553
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
554
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
555
|
-
return kind && result && __defProp$2(target, key, result), result;
|
|
556
|
-
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a6;
|
|
557
|
-
let SheetsThreadCommentPopupController = (_a6 = class extends Disposable {
|
|
558
|
-
constructor(_commandService, _sheetsThreadCommentPopupService, _sheetsThreadCommentModel, _threadCommentPanelService, _univerInstanceService, _sheetPermissionInterceptorBaseController, _markSelectionService, _sheetSelectionService, _editorBridgeService) {
|
|
559
|
-
super();
|
|
560
|
-
__publicField(this, "_isSwitchToCommenting", !1);
|
|
561
|
-
__publicField(this, "_selectionShapeInfo", null);
|
|
562
|
-
this._commandService = _commandService, this._sheetsThreadCommentPopupService = _sheetsThreadCommentPopupService, this._sheetsThreadCommentModel = _sheetsThreadCommentModel, this._threadCommentPanelService = _threadCommentPanelService, this._univerInstanceService = _univerInstanceService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._markSelectionService = _markSelectionService, this._sheetSelectionService = _sheetSelectionService, this._editorBridgeService = _editorBridgeService, this._initCommandListener(), this._initPanelListener(), this._initMarkSelection(), this._initSelectionUpdateListener(), this._initEditorBridge();
|
|
563
|
-
}
|
|
564
|
-
_handleSelectionChange(selections, unitId, subUnitId) {
|
|
565
|
-
var _a9, _b;
|
|
566
|
-
const range = (_a9 = selections[0]) == null ? void 0 : _a9.range;
|
|
567
|
-
if (!range)
|
|
568
|
-
return;
|
|
569
|
-
if (((_b = range.rangeType) != null ? _b : RANGE_TYPE.NORMAL) !== RANGE_TYPE.NORMAL || range.endColumn - range.startColumn > 0 || range.endRow - range.startRow > 0) {
|
|
570
|
-
this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(SetActiveCommentOperation.id);
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
const row = range.startRow, col = range.startColumn;
|
|
574
|
-
if (!this._sheetsThreadCommentModel.showCommentMarker(unitId, subUnitId, row, col)) {
|
|
575
|
-
this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(SetActiveCommentOperation.id);
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
const commentId = this._sheetsThreadCommentModel.getByLocation(unitId, subUnitId, row, col);
|
|
579
|
-
commentId && this._commandService.executeCommand(SetActiveCommentOperation.id, {
|
|
580
|
-
unitId,
|
|
581
|
-
subUnitId,
|
|
582
|
-
commentId
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
_initSelectionUpdateListener() {
|
|
586
|
-
this.disposeWithMe(
|
|
587
|
-
this._sheetSelectionService.selectionMoveEnd$.subscribe((selections) => {
|
|
588
|
-
if (this._isSwitchToCommenting)
|
|
589
|
-
return;
|
|
590
|
-
const current = this._sheetSelectionService.currentSelectionParam;
|
|
591
|
-
current && this._handleSelectionChange(selections, current.unitId, current.sheetId);
|
|
592
|
-
})
|
|
593
|
-
);
|
|
594
|
-
}
|
|
595
|
-
_initEditorBridge() {
|
|
596
|
-
this.disposeWithMe(
|
|
597
|
-
this._editorBridgeService.visible$.subscribe((visible) => {
|
|
598
|
-
visible.visible && this._sheetsThreadCommentPopupService.hidePopup();
|
|
599
|
-
})
|
|
600
|
-
);
|
|
601
|
-
}
|
|
602
|
-
_initCommandListener() {
|
|
603
|
-
this._commandService.onCommandExecuted((commandInfo) => {
|
|
604
|
-
if (commandInfo.id === DeleteCommentMutation.id) {
|
|
605
|
-
const params = commandInfo.params, active = this._sheetsThreadCommentPopupService.activePopup;
|
|
606
|
-
if (!active)
|
|
607
|
-
return;
|
|
608
|
-
const { unitId, subUnitId, commentId } = active;
|
|
609
|
-
params.unitId === unitId && params.subUnitId === subUnitId && params.commentId === commentId && this._sheetsThreadCommentPopupService.hidePopup();
|
|
610
|
-
}
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
_initPanelListener() {
|
|
614
|
-
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async (commentInfo) => {
|
|
615
|
-
var _a9;
|
|
616
|
-
if (commentInfo) {
|
|
617
|
-
const { unitId, subUnitId, commentId, trigger } = commentInfo, comment = this._sheetsThreadCommentModel.getComment(unitId, subUnitId, commentId);
|
|
618
|
-
if (!comment || comment.resolved)
|
|
619
|
-
return;
|
|
620
|
-
const currentUnit = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
|
|
621
|
-
if (!currentUnit || currentUnit.getUnitId() !== unitId)
|
|
622
|
-
return;
|
|
623
|
-
this._isSwitchToCommenting = !0, ((_a9 = currentUnit.getActiveSheet()) == null ? void 0 : _a9.getSheetId()) !== subUnitId && await this._commandService.executeCommand(SetWorksheetActiveOperation.id, {
|
|
624
|
-
unitId,
|
|
625
|
-
subUnitId
|
|
626
|
-
}), this._isSwitchToCommenting = !1;
|
|
627
|
-
const location = singleReferenceToGrid(comment.ref), { row, column: col } = location;
|
|
628
|
-
if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
629
|
-
workbookTypes: [WorkbookCommentPermission],
|
|
630
|
-
worksheetTypes: [WorksheetViewPermission],
|
|
631
|
-
rangeTypes: [RangeProtectionPermissionViewPoint]
|
|
632
|
-
}, [{ startRow: row, startColumn: col, endRow: row, endColumn: col }]))
|
|
633
|
-
return;
|
|
634
|
-
const GAP = 1;
|
|
635
|
-
if (await this._commandService.executeCommand(ScrollToRangeOperation.id, {
|
|
636
|
-
range: {
|
|
637
|
-
startRow: Math.max(location.row - GAP, 0),
|
|
638
|
-
endRow: location.row + GAP,
|
|
639
|
-
startColumn: Math.max(location.column - GAP, 0),
|
|
640
|
-
endColumn: location.column + GAP
|
|
641
|
-
}
|
|
642
|
-
}), this._editorBridgeService.isVisible().visible)
|
|
643
|
-
return;
|
|
644
|
-
this._sheetsThreadCommentPopupService.showPopup({
|
|
645
|
-
unitId,
|
|
646
|
-
subUnitId,
|
|
647
|
-
row: location.row,
|
|
648
|
-
col: location.column,
|
|
649
|
-
commentId: comment.id,
|
|
650
|
-
trigger
|
|
651
|
-
});
|
|
652
|
-
} else
|
|
653
|
-
this._sheetsThreadCommentPopupService.hidePopup();
|
|
166
|
+
), this.disposeWithMe(toDisposable(() => {
|
|
167
|
+
this._disposableMap.forEach((item) => {
|
|
168
|
+
item.dispose();
|
|
169
|
+
}), this._disposableMap.clear();
|
|
654
170
|
}));
|
|
655
171
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
|
|
661
|
-
return;
|
|
662
|
-
}
|
|
663
|
-
const { unitId, subUnitId, commentId } = activeComment;
|
|
664
|
-
this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
|
|
665
|
-
const comment = this._sheetsThreadCommentModel.getComment(unitId, subUnitId, commentId);
|
|
666
|
-
if (!comment)
|
|
667
|
-
return;
|
|
668
|
-
const location = singleReferenceToGrid(comment.ref), { row, column } = location;
|
|
669
|
-
if (Number.isNaN(row) || Number.isNaN(column))
|
|
670
|
-
return null;
|
|
671
|
-
const worksheet = (_a9 = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a9.getSheetBySheetId(subUnitId), mergeInfo = (_b = worksheet == null ? void 0 : worksheet.getMergedCell(row, column)) != null ? _b : {
|
|
672
|
-
startColumn: column,
|
|
673
|
-
endColumn: column,
|
|
674
|
-
startRow: row,
|
|
675
|
-
endRow: row
|
|
676
|
-
}, shapeId = this._markSelectionService.addShape(
|
|
677
|
-
{
|
|
678
|
-
range: mergeInfo,
|
|
679
|
-
style: {
|
|
680
|
-
hasAutoFill: !1,
|
|
681
|
-
fill: "rgb(255, 189, 55, 0.35)",
|
|
682
|
-
strokeWidth: 1,
|
|
683
|
-
stroke: "#FFBD37",
|
|
684
|
-
widgets: {}
|
|
685
|
-
},
|
|
686
|
-
primary: null
|
|
687
|
-
},
|
|
688
|
-
[],
|
|
689
|
-
-1
|
|
690
|
-
);
|
|
691
|
-
shapeId && (this._selectionShapeInfo = {
|
|
692
|
-
...activeComment,
|
|
693
|
-
shapeId
|
|
694
|
-
});
|
|
695
|
-
}));
|
|
696
|
-
}
|
|
697
|
-
}, __name(_a6, "SheetsThreadCommentPopupController"), _a6);
|
|
698
|
-
SheetsThreadCommentPopupController = __decorateClass$2([
|
|
699
|
-
__decorateParam$2(0, ICommandService),
|
|
700
|
-
__decorateParam$2(1, Inject(SheetsThreadCommentPopupService)),
|
|
701
|
-
__decorateParam$2(2, Inject(SheetsThreadCommentModel)),
|
|
702
|
-
__decorateParam$2(3, Inject(ThreadCommentPanelService)),
|
|
703
|
-
__decorateParam$2(4, IUniverInstanceService),
|
|
704
|
-
__decorateParam$2(5, Inject(SheetPermissionInterceptorBaseController)),
|
|
705
|
-
__decorateParam$2(6, IMarkSelectionService),
|
|
706
|
-
__decorateParam$2(7, Inject(SheetsSelectionsService)),
|
|
707
|
-
__decorateParam$2(8, IEditorBridgeService)
|
|
708
|
-
], SheetsThreadCommentPopupController);
|
|
709
|
-
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
710
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
711
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
712
|
-
return kind && result && __defProp$1(target, key, result), result;
|
|
713
|
-
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a7;
|
|
714
|
-
let ThreadCommentRemoveSheetsController = (_a7 = class extends Disposable {
|
|
715
|
-
constructor(_sheetInterceptorService, _univerInstanceService, _threadCommentModel, _threadCommentDataSourceService) {
|
|
716
|
-
super(), this._sheetInterceptorService = _sheetInterceptorService, this._univerInstanceService = _univerInstanceService, this._threadCommentModel = _threadCommentModel, this._threadCommentDataSourceService = _threadCommentDataSourceService, this._initSheetChange();
|
|
717
|
-
}
|
|
718
|
-
_initSheetChange() {
|
|
719
|
-
this.disposeWithMe(
|
|
720
|
-
this._sheetInterceptorService.interceptCommand({
|
|
721
|
-
getMutations: /* @__PURE__ */ __name((commandInfo) => {
|
|
722
|
-
var _a9;
|
|
723
|
-
if (commandInfo.id === RemoveSheetCommand.id) {
|
|
724
|
-
const params = commandInfo.params, workbook = params.unitId ? this._univerInstanceService.getUnit(params.unitId) : this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
|
|
725
|
-
if (!workbook)
|
|
726
|
-
return { redos: [], undos: [] };
|
|
727
|
-
const unitId = workbook.getUnitId(), subUnitId = params.subUnitId || ((_a9 = workbook.getActiveSheet()) == null ? void 0 : _a9.getSheetId());
|
|
728
|
-
if (!subUnitId)
|
|
729
|
-
return { redos: [], undos: [] };
|
|
730
|
-
const { commentMap } = this._threadCommentModel.ensureMap(unitId, subUnitId), comments = Array.from(Object.values(commentMap)).filter((comment) => !comment.parentId), ids = comments.map((comment) => comment.id), shouldSync = this._threadCommentDataSourceService.syncUpdateMutationToColla, redos = ids.map((id) => ({
|
|
731
|
-
id: DeleteCommentMutation.id,
|
|
732
|
-
params: {
|
|
733
|
-
unitId,
|
|
734
|
-
subUnitId,
|
|
735
|
-
commentId: id
|
|
736
|
-
}
|
|
737
|
-
})), undos = comments.map(({ children, ...comment }) => ({
|
|
738
|
-
id: AddCommentMutation.id,
|
|
739
|
-
params: {
|
|
740
|
-
unitId,
|
|
741
|
-
subUnitId,
|
|
742
|
-
comment: {
|
|
743
|
-
...comment,
|
|
744
|
-
children: shouldSync ? children : void 0
|
|
745
|
-
},
|
|
746
|
-
sync: !shouldSync
|
|
747
|
-
}
|
|
748
|
-
}));
|
|
749
|
-
return { redos, undos };
|
|
750
|
-
}
|
|
751
|
-
return { redos: [], undos: [] };
|
|
752
|
-
}, "getMutations")
|
|
753
|
-
})
|
|
754
|
-
);
|
|
755
|
-
}
|
|
756
|
-
}, __name(_a7, "ThreadCommentRemoveSheetsController"), _a7);
|
|
757
|
-
ThreadCommentRemoveSheetsController = __decorateClass$1([
|
|
758
|
-
__decorateParam$1(0, Inject(SheetInterceptorService)),
|
|
759
|
-
__decorateParam$1(1, IUniverInstanceService),
|
|
172
|
+
}, __name(_a, "SheetsThreadCommentRefRangeController"), _a);
|
|
173
|
+
SheetsThreadCommentRefRangeController = __decorateClass$1([
|
|
174
|
+
__decorateParam$1(0, Inject(RefRangeService)),
|
|
175
|
+
__decorateParam$1(1, Inject(SheetsThreadCommentModel)),
|
|
760
176
|
__decorateParam$1(2, Inject(ThreadCommentModel)),
|
|
761
|
-
__decorateParam$1(3,
|
|
762
|
-
|
|
177
|
+
__decorateParam$1(3, Inject(SheetsSelectionsService)),
|
|
178
|
+
__decorateParam$1(4, ICommandService)
|
|
179
|
+
], SheetsThreadCommentRefRangeController);
|
|
180
|
+
const SHEET_THREAD_COMMENT_BASE = "SHEET_THREAD_COMMENT_BASE_PLUGIN";
|
|
763
181
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
764
182
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
765
183
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
766
184
|
return kind && result && __defProp2(target, key, result), result;
|
|
767
|
-
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"),
|
|
768
|
-
let UniverSheetsThreadCommentPlugin = (
|
|
769
|
-
constructor(
|
|
770
|
-
super(), this.
|
|
771
|
-
const { menu, ...rest } = this._config;
|
|
772
|
-
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
|
|
185
|
+
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a2;
|
|
186
|
+
let UniverSheetsThreadCommentPlugin = (_a2 = class extends Plugin {
|
|
187
|
+
constructor(config, _injector, _commandService) {
|
|
188
|
+
super(), this._injector = _injector, this._commandService = _commandService;
|
|
773
189
|
}
|
|
774
190
|
onStarting() {
|
|
775
191
|
[
|
|
776
|
-
[
|
|
777
|
-
[
|
|
778
|
-
[SheetsThreadCommentCopyPasteController],
|
|
779
|
-
[SheetsThreadCommentHoverController],
|
|
780
|
-
[ThreadCommentRemoveSheetsController],
|
|
781
|
-
[SheetsThreadCommentPopupController],
|
|
782
|
-
[SheetsThreadCommentPopupService]
|
|
192
|
+
[SheetsThreadCommentModel],
|
|
193
|
+
[SheetsThreadCommentRefRangeController]
|
|
783
194
|
].forEach((dep) => {
|
|
784
195
|
this._injector.add(dep);
|
|
785
|
-
}),
|
|
786
|
-
this._commandService.registerCommand(command);
|
|
787
|
-
}), this._injector.get(SheetsThreadCommentController);
|
|
788
|
-
}
|
|
789
|
-
onReady() {
|
|
790
|
-
this._injector.get(SheetsThreadCommentRenderController), this._injector.get(ThreadCommentRemoveSheetsController);
|
|
791
|
-
}
|
|
792
|
-
onRendered() {
|
|
793
|
-
this._injector.get(SheetsThreadCommentCopyPasteController), this._injector.get(SheetsThreadCommentHoverController), this._injector.get(SheetsThreadCommentPopupController);
|
|
196
|
+
}), this._injector.get(SheetsThreadCommentRefRangeController);
|
|
794
197
|
}
|
|
795
|
-
}, __name(
|
|
796
|
-
__publicField2(UniverSheetsThreadCommentPlugin, "pluginName",
|
|
198
|
+
}, __name(_a2, "UniverSheetsThreadCommentPlugin"), _a2);
|
|
199
|
+
__publicField2(UniverSheetsThreadCommentPlugin, "pluginName", SHEET_THREAD_COMMENT_BASE);
|
|
797
200
|
__publicField2(UniverSheetsThreadCommentPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
798
201
|
UniverSheetsThreadCommentPlugin = __decorateClass([
|
|
799
|
-
DependentOn(
|
|
202
|
+
DependentOn(UniverThreadCommentPlugin),
|
|
800
203
|
__decorateParam(1, Inject(Injector)),
|
|
801
|
-
__decorateParam(2, Inject(ICommandService))
|
|
802
|
-
__decorateParam(3, IConfigService)
|
|
204
|
+
__decorateParam(2, Inject(ICommandService))
|
|
803
205
|
], UniverSheetsThreadCommentPlugin);
|
|
804
206
|
export {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
IThreadCommentDataSourceService2 as IThreadCommentDataSourceService,
|
|
809
|
-
IThreadCommentMentionDataService,
|
|
810
|
-
ResolveCommentCommand,
|
|
811
|
-
SHEETS_THREAD_COMMENT,
|
|
812
|
-
SheetsThreadCommentModel2 as SheetsThreadCommentModel,
|
|
813
|
-
SheetsThreadCommentPopupService,
|
|
814
|
-
ShowAddSheetCommentModalOperation,
|
|
815
|
-
UniverSheetsThreadCommentPlugin,
|
|
816
|
-
UniverThreadCommentUIPlugin2 as UniverThreadCommentUIPlugin,
|
|
817
|
-
UpdateCommentCommand
|
|
207
|
+
SheetsThreadCommentModel,
|
|
208
|
+
SheetsThreadCommentRefRangeController,
|
|
209
|
+
UniverSheetsThreadCommentPlugin
|
|
818
210
|
};
|