@univerjs/sheets-thread-comment 0.4.2 → 0.5.0-alpha.0

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.
Files changed (42) hide show
  1. package/README.md +4 -73
  2. package/lib/cjs/facade.js +1 -0
  3. package/lib/cjs/index.js +1 -1
  4. package/lib/es/facade.js +218 -0
  5. package/lib/es/index.js +331 -784
  6. package/lib/types/controllers/config.schema.d.ts +17 -6
  7. package/lib/types/controllers/sheets-thread-comment-ref-range.controller.d.ts +22 -0
  8. package/lib/types/facade/f-range.d.ts +26 -0
  9. package/lib/types/facade/f-thread-comment.d.ts +56 -0
  10. package/lib/types/facade/f-workbook.d.ts +35 -0
  11. package/lib/types/facade/f-worksheet.d.ts +13 -0
  12. package/lib/types/{locale/en-US.d.ts → facade/index.d.ts} +4 -9
  13. package/lib/types/index.d.ts +3 -9
  14. package/lib/types/models/sheets-thread-comment.model.d.ts +30 -0
  15. package/lib/types/plugin.d.ts +2 -7
  16. package/lib/types/types/const.d.ts +1 -3
  17. package/lib/umd/facade.js +1 -0
  18. package/lib/umd/index.js +1 -1
  19. package/package.json +27 -28
  20. package/lib/locale/en-US.json +0 -8
  21. package/lib/locale/fa-IR.json +0 -8
  22. package/lib/locale/ru-RU.json +0 -8
  23. package/lib/locale/vi-VN.json +0 -8
  24. package/lib/locale/zh-CN.json +0 -8
  25. package/lib/locale/zh-TW.json +0 -8
  26. package/lib/types/commands/operations/comment.operation.d.ts +0 -2
  27. package/lib/types/controllers/menu.d.ts +0 -12
  28. package/lib/types/controllers/menu.schema.d.ts +0 -2
  29. package/lib/types/controllers/render-controllers/render.controller.d.ts +0 -13
  30. package/lib/types/controllers/sheets-thread-comment-copy-paste.controller.d.ts +0 -12
  31. package/lib/types/controllers/sheets-thread-comment-hover.controller.d.ts +0 -12
  32. package/lib/types/controllers/sheets-thread-comment-popup.controller.d.ts +0 -28
  33. package/lib/types/controllers/sheets-thread-comment-remove.controller.d.ts +0 -11
  34. package/lib/types/controllers/sheets-thread-comment.controller.d.ts +0 -11
  35. package/lib/types/locale/fa-IR.d.ts +0 -24
  36. package/lib/types/locale/ru-RU.d.ts +0 -24
  37. package/lib/types/locale/vi-VN.d.ts +0 -24
  38. package/lib/types/locale/zh-CN.d.ts +0 -24
  39. package/lib/types/locale/zh-TW.d.ts +0 -24
  40. package/lib/types/services/sheets-thread-comment-popup.service.d.ts +0 -23
  41. package/lib/types/views/sheets-thread-comment-cell/index.d.ts +0 -2
  42. package/lib/types/views/sheets-thread-comment-panel/index.d.ts +0 -2
package/lib/es/index.js CHANGED
@@ -1,820 +1,367 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { Inject, Disposable, DisposableCollection, CommandType, IUniverInstanceService, InterceptorEffectEnum, UniverInstanceType, useDependency, Tools, ICommandService, Range, RANGE_TYPE, Rectangle, DependentOn, Injector, Plugin, IConfigService } from "@univerjs/core";
6
- import { SheetsSelectionsService, getSheetCommandTarget, SheetInterceptorService, INTERCEPTOR_POINT, WorkbookCommentPermission, WorksheetViewPermission, RangeProtectionPermissionViewPoint, SetWorksheetActiveOperation, RemoveSheetCommand } from "@univerjs/sheets";
7
- import { SheetsThreadCommentModel, UniverSheetsThreadCommentBasePlugin } from "@univerjs/sheets-thread-comment-base";
8
- import { SheetsThreadCommentModel as SheetsThreadCommentModel2 } from "@univerjs/sheets-thread-comment-base";
9
- import { ThreadCommentPanelService, ThreadCommentTree, ThreadCommentPanel, ToggleSheetCommentPanelOperation, THREAD_COMMENT_PANEL, SetActiveCommentOperation, UniverThreadCommentUIPlugin } from "@univerjs/thread-comment-ui";
10
- import { IThreadCommentMentionDataService, UniverThreadCommentUIPlugin as UniverThreadCommentUIPlugin2 } from "@univerjs/thread-comment-ui";
11
- import { SheetCanvasPopManagerService, IMarkSelectionService, whenSheetEditorFocused, getCurrentRangeDisable$, ISheetClipboardService, COPY_TYPE, HoverManagerService, SheetPermissionInterceptorBaseController, IEditorBridgeService, SheetSkeletonManagerService, ScrollToRangeOperation } from "@univerjs/sheets-ui";
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--)
22
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
23
- return kind && result && __defProp$7(target, key, result), result;
24
- }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a;
25
- let SheetsThreadCommentPopupService = (_a = class extends Disposable {
26
- constructor(_canvasPopupManagerService, _zenZoneService) {
1
+ var x = Object.defineProperty;
2
+ var T = (i, e, r) => e in i ? x(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
3
+ var h = (i, e, r) => T(i, typeof e != "symbol" ? e + "" : e, r);
4
+ import { Inject as l, Disposable as R, ObjectMatrix as $, UniverInstanceType as y, IUniverInstanceService as E, sequenceExecuteAsync as P, toDisposable as D, ICommandService as b, DependentOn as O, Injector as A, Plugin as j } from "@univerjs/core";
5
+ import { singleReferenceToGrid as p, serializeRange as M } from "@univerjs/engine-formula";
6
+ import { RefRangeService as W, SheetsSelectionsService as L, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests as B } from "@univerjs/sheets";
7
+ import { ThreadCommentModel as S, DeleteCommentMutation as N, AddCommentMutation as V, UpdateCommentRefMutation as C, UniverThreadCommentPlugin as H } from "@univerjs/thread-comment";
8
+ import { Subject as F } from "rxjs";
9
+ var z = Object.defineProperty, G = Object.getOwnPropertyDescriptor, q = (i, e, r, t) => {
10
+ for (var n = t > 1 ? void 0 : t ? G(e, r) : e, s = i.length - 1, o; s >= 0; s--)
11
+ (o = i[s]) && (n = (t ? o(e, r, n) : o(n)) || n);
12
+ return t && n && z(e, r, n), n;
13
+ }, w = (i, e) => (r, t) => e(r, t, i);
14
+ let u = class extends R {
15
+ constructor(e, r) {
27
16
  super();
28
- __publicField(this, "_lastPopup", null);
29
- __publicField(this, "_activePopup");
30
- __publicField(this, "_activePopup$", new BehaviorSubject(null));
31
- __publicField(this, "activePopup$", this._activePopup$.asObservable());
32
- this._canvasPopupManagerService = _canvasPopupManagerService, this._zenZoneService = _zenZoneService, this._initZenVisible(), this.disposeWithMe(() => {
33
- this._activePopup$.complete();
17
+ h(this, "_matrixMap", /* @__PURE__ */ new Map());
18
+ h(this, "_locationMap", /* @__PURE__ */ new Map());
19
+ h(this, "_commentUpdate$", new F());
20
+ h(this, "commentUpdate$", this._commentUpdate$.asObservable());
21
+ this._threadCommentModel = e, this._univerInstanceService = r, this._init(), this.disposeWithMe(() => {
22
+ this._commentUpdate$.complete();
34
23
  });
35
24
  }
36
- get activePopup() {
37
- return this._activePopup;
38
- }
39
- _initZenVisible() {
40
- this.disposeWithMe(this._zenZoneService.visible$.subscribe((visible) => {
41
- visible && this.hidePopup();
42
- }));
43
- }
44
- showPopup(location, onHide) {
45
- var _a9;
46
- const { row, col, unitId, subUnitId } = location;
47
- if (this._activePopup && row === this._activePopup.row && col === this._activePopup.col && unitId === this._activePopup.unitId && subUnitId === ((_a9 = this.activePopup) == null ? void 0 : _a9.subUnitId)) {
48
- this._activePopup = location, this._activePopup$.next(location);
49
- return;
25
+ _init() {
26
+ this._initData(), this._initUpdateTransform();
27
+ }
28
+ _ensureCommentMatrix(e, r) {
29
+ let t = this._matrixMap.get(e);
30
+ t || (t = /* @__PURE__ */ new Map(), this._matrixMap.set(e, t));
31
+ let n = t.get(r);
32
+ return n || (n = new $(), t.set(r, n)), n;
33
+ }
34
+ _ensureCommentLocationMap(e, r) {
35
+ let t = this._locationMap.get(e);
36
+ t || (t = /* @__PURE__ */ new Map(), this._locationMap.set(e, t));
37
+ let n = t.get(r);
38
+ return n || (n = /* @__PURE__ */ new Map(), t.set(r, n)), n;
39
+ }
40
+ _addCommentToMatrix(e, r, t, n) {
41
+ var o;
42
+ const s = (o = e.getValue(r, t)) != null ? o : /* @__PURE__ */ new Set();
43
+ s.add(n), e.setValue(r, t, s);
44
+ }
45
+ _deleteCommentFromMatrix(e, r, t, n) {
46
+ if (r >= 0 && t >= 0) {
47
+ const s = e.getValue(r, t);
48
+ s && s.has(n) && (s.delete(n), s.size === 0 && e.realDeleteValue(r, t));
50
49
  }
51
- if (this._lastPopup && this._lastPopup.dispose(), this._zenZoneService.visible)
52
- return;
53
- this._activePopup = location, this._activePopup$.next(location);
54
- const popupDisposable = this._canvasPopupManagerService.attachPopupToCell(
55
- row,
56
- col,
57
- {
58
- componentKey: SHEETS_THREAD_COMMENT_MODAL,
59
- onClickOutside: /* @__PURE__ */ __name(() => {
60
- this.hidePopup();
61
- }, "onClickOutside"),
62
- direction: "horizontal",
63
- excludeOutside: [
64
- ...Array.from(document.querySelectorAll(".univer-thread-comment")),
65
- document.getElementById("thread-comment-add")
66
- ].filter(Boolean)
67
- }
68
- );
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
50
  }
78
- hidePopup() {
79
- this._activePopup && (this._lastPopup && this._lastPopup.dispose(), this._lastPopup = null, this._activePopup = null, this._activePopup$.next(null));
51
+ _ensure(e, r) {
52
+ const t = this._ensureCommentMatrix(e, r), n = this._ensureCommentLocationMap(e, r);
53
+ return { matrix: t, locationMap: n };
80
54
  }
81
- persistPopup() {
82
- !this._activePopup || !this._activePopup.temp || (this._activePopup = {
83
- ...this._activePopup,
84
- temp: !1
85
- }, this._activePopup$.next(this._activePopup));
86
- }
87
- }, __name(_a, "SheetsThreadCommentPopupService"), _a);
88
- SheetsThreadCommentPopupService = __decorateClass$7([
89
- __decorateParam$7(0, Inject(SheetCanvasPopManagerService)),
90
- __decorateParam$7(1, IZenZoneService)
91
- ], SheetsThreadCommentPopupService);
92
- const ShowAddSheetCommentModalOperation = {
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
110
- };
111
- sheetsThreadCommentPopupService.showPopup(location);
112
- const rootId = model.getByLocation(unitId, subUnitId, activeCell.startRow, activeCell.startColumn);
113
- return rootId && threadCommentPanelService.setActiveComment({
114
- unitId,
115
- subUnitId,
116
- commentId: rootId,
117
- trigger: "context-menu"
118
- }), !0;
55
+ _initData() {
56
+ const e = this._threadCommentModel.getAll();
57
+ for (const r of e)
58
+ for (const t of r.threads) {
59
+ const { unitId: n, subUnitId: s, root: o } = t;
60
+ this._addComment(n, s, o);
61
+ }
119
62
  }
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();
63
+ _addComment(e, r, t) {
64
+ const n = p(t.ref), s = t.parentId, { row: o, column: a } = n, c = t.id, { matrix: m, locationMap: d } = this._ensure(e, r);
65
+ !s && o >= 0 && a >= 0 && (this._addCommentToMatrix(m, o, a, c), d.set(c, { row: o, column: a })), s || this._commentUpdate$.next({
66
+ unitId: e,
67
+ subUnitId: r,
68
+ payload: t,
69
+ type: "add",
70
+ isRoot: !s,
71
+ ...n
72
+ });
129
73
  }
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
74
+ // eslint-disable-next-line max-lines-per-function
75
+ _initUpdateTransform() {
76
+ this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe((e) => {
77
+ const { unitId: r, subUnitId: t } = e;
78
+ try {
79
+ if (this._univerInstanceService.getUnitType(r) !== y.UNIVER_SHEET)
80
+ return;
81
+ } catch {
82
+ }
83
+ const { matrix: n, locationMap: s } = this._ensure(r, t);
84
+ switch (e.type) {
85
+ case "add": {
86
+ this._addComment(e.unitId, e.subUnitId, e.payload);
87
+ break;
88
+ }
89
+ case "delete": {
90
+ const { isRoot: o, comment: a } = e.payload;
91
+ if (o) {
92
+ const c = p(a.ref), { row: m, column: d } = c;
93
+ this._deleteCommentFromMatrix(n, m, d, a.id), this._commentUpdate$.next({
94
+ ...e,
95
+ ...c
96
+ });
97
+ }
98
+ break;
99
+ }
100
+ case "update": {
101
+ const { commentId: o } = e.payload, a = this._threadCommentModel.getComment(r, t, o);
102
+ if (!a)
103
+ return;
104
+ const c = p(a.ref);
105
+ this._commentUpdate$.next({
106
+ ...e,
107
+ ...c
108
+ });
109
+ break;
110
+ }
111
+ case "updateRef": {
112
+ const o = p(e.payload.ref), { commentId: a } = e.payload, c = s.get(a);
113
+ if (!c)
114
+ return;
115
+ const { row: m, column: d } = c;
116
+ this._deleteCommentFromMatrix(n, m, d, a), s.delete(a), o.row >= 0 && o.column >= 0 && (this._addCommentToMatrix(n, o.row, o.column, a), s.set(a, { row: o.row, column: o.column })), this._commentUpdate$.next({
117
+ ...e,
118
+ ...o
119
+ });
120
+ break;
121
+ }
122
+ case "resolve": {
123
+ const { unitId: o, subUnitId: a, payload: c } = e, { locationMap: m } = this._ensure(o, a), d = m.get(c.commentId);
124
+ d && this._commentUpdate$.next({
125
+ ...e,
126
+ ...d
127
+ });
128
+ break;
150
129
  }
151
- )
152
- );
153
- }
154
- _initSkeletonChange() {
155
- const markSkeletonDirty = /* @__PURE__ */ __name(() => {
156
- var _a9;
157
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
158
- if (!workbook) return;
159
- const unitId = workbook.getUnitId(), currentRender = this._renderManagerService.getRenderById(unitId);
160
- (_a9 = currentRender == null ? void 0 : currentRender.mainComponent) == null || _a9.makeForceDirty();
161
- }, "markSkeletonDirty");
162
- this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(debounceTime(16)).subscribe(() => {
163
- markSkeletonDirty();
164
- }));
165
- }
166
- }, __name(_a2, "SheetsThreadCommentRenderController"), _a2);
167
- SheetsThreadCommentRenderController = __decorateClass$6([
168
- __decorateParam$6(0, Inject(SheetInterceptorService)),
169
- __decorateParam$6(1, Inject(SheetsThreadCommentModel)),
170
- __decorateParam$6(2, IUniverInstanceService),
171
- __decorateParam$6(3, IRenderManagerService)
172
- ], SheetsThreadCommentRenderController);
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
360
130
  }
361
- }
362
- }
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();
131
+ }));
372
132
  }
373
- _initShortcut() {
374
- this._shortcutService.registerShortcut(AddCommentShortcut);
133
+ getByLocation(e, r, t, n) {
134
+ var a;
135
+ return (a = this.getAllByLocation(e, r, t, n).filter((c) => !c.resolved)[0]) == null ? void 0 : a.id;
375
136
  }
376
- _initMenu() {
377
- this._menuManagerService.mergeMenu(menuSchema);
137
+ getAllByLocation(e, r, t, n) {
138
+ const o = this._ensureCommentMatrix(e, r).getValue(t, n);
139
+ return o ? Array.from(o).map((a) => this.getComment(e, r, a)).filter(Boolean) : [];
378
140
  }
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
- });
141
+ getComment(e, r, t) {
142
+ return this._threadCommentModel.getComment(e, r, t);
387
143
  }
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();
144
+ getCommentWithChildren(e, r, t, n) {
145
+ const s = this.getByLocation(e, r, t, n);
146
+ if (!s)
147
+ return;
148
+ const o = this.getComment(e, r, s);
149
+ if (o)
150
+ return this._threadCommentModel.getThread(e, r, o.threadId);
414
151
  }
415
- // eslint-disable-next-line max-lines-per-function
416
- _initClipboardHook() {
417
- this.disposeWithMe(
418
- this._sheetClipboardService.addClipboardHook({
419
- id: SHEETS_THREAD_COMMENT,
420
- onBeforeCopy: /* @__PURE__ */ __name((unitId, subUnitId, range) => {
421
- this._copyInfo = {
422
- unitId,
423
- subUnitId,
424
- range
425
- };
426
- }, "onBeforeCopy"),
427
- // eslint-disable-next-line max-lines-per-function
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
437
- };
438
- if (!(targetUnitId === sourceUnitId && targetSubUnitId === sourceSubUnitId)) {
439
- const roots = [];
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
- }
493
- }
494
- return {
495
- redos: [],
496
- undos: []
497
- };
498
- }, "onPasteCells")
499
- })
500
- );
152
+ showCommentMarker(e, r, t, n) {
153
+ const s = this.getByLocation(e, r, t, n);
154
+ if (!s)
155
+ return !1;
156
+ const o = this.getComment(e, r, s);
157
+ return !!(o && !o.resolved);
501
158
  }
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();
159
+ getSubUnitAll(e, r) {
160
+ return this._threadCommentModel.getUnit(e).filter((t) => t.subUnitId === r).map((t) => t.root);
516
161
  }
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 }]))
529
- return;
530
- const comment = this._sheetsThreadCommentModel.getComment(unitId, subUnitId, commentId);
531
- comment && !comment.resolved && this._sheetsThreadCommentPopupService.showPopup({
532
- unitId,
533
- subUnitId,
534
- row,
535
- col,
536
- commentId,
537
- temp: !0
538
- });
539
- } else
540
- currentPopup && this._sheetsThreadCommentPopupService.hidePopup();
541
- }
542
- })
543
- );
544
- }
545
- }, __name(_a5, "SheetsThreadCommentHoverController"), _a5);
546
- SheetsThreadCommentHoverController = __decorateClass$3([
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, _renderManagerService) {
162
+ };
163
+ u = q([
164
+ w(0, l(S)),
165
+ w(1, E)
166
+ ], u);
167
+ var J = Object.defineProperty, K = Object.getOwnPropertyDescriptor, Q = (i, e, r, t) => {
168
+ for (var n = t > 1 ? void 0 : t ? K(e, r) : e, s = i.length - 1, o; s >= 0; s--)
169
+ (o = i[s]) && (n = (t ? o(e, r, n) : o(n)) || n);
170
+ return t && n && J(e, r, n), n;
171
+ }, _ = (i, e) => (r, t) => e(r, t, i);
172
+ let f = class extends R {
173
+ constructor(e, r, t, n, s) {
559
174
  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._renderManagerService = _renderManagerService, this._initCommandListener(), this._initPanelListener(), this._initMarkSelection(), this._initSelectionUpdateListener(), this._initEditorBridge();
563
- }
564
- _handleSelectionChange(selections, unitId, subUnitId) {
565
- var _a9, _b, _c;
566
- const range = (_a9 = selections[0]) == null ? void 0 : _a9.range, render2 = this._renderManagerService.getRenderById(unitId), skeleton = (_b = render2 == null ? void 0 : render2.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b.skeleton;
567
- if (!skeleton || !range)
568
- return;
569
- const actualCell = skeleton.getCellByIndex(range.startRow, range.startColumn);
570
- if ((((_c = range.rangeType) != null ? _c : RANGE_TYPE.NORMAL) !== RANGE_TYPE.NORMAL || range.endColumn - range.startColumn > 0 || range.endRow - range.startRow > 0) && !((actualCell.isMerged || actualCell.isMergedMainCell) && Rectangle.equals(actualCell.mergeInfo, range))) {
571
- this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(SetActiveCommentOperation.id);
572
- return;
573
- }
574
- const row = actualCell.actualRow, col = actualCell.actualColumn;
575
- if (!this._sheetsThreadCommentModel.showCommentMarker(unitId, subUnitId, row, col)) {
576
- this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(SetActiveCommentOperation.id);
577
- return;
578
- }
579
- const commentId = this._sheetsThreadCommentModel.getByLocation(unitId, subUnitId, row, col);
580
- commentId && this._commandService.executeCommand(SetActiveCommentOperation.id, {
581
- unitId,
582
- subUnitId,
583
- commentId
175
+ h(this, "_disposableMap", /* @__PURE__ */ new Map());
176
+ h(this, "_watcherMap", /* @__PURE__ */ new Map());
177
+ h(this, "_handleRangeChange", (e, r, t, n, s) => {
178
+ const o = t.id, a = {
179
+ startColumn: t.column,
180
+ endColumn: t.column,
181
+ startRow: t.row,
182
+ endRow: t.row
183
+ };
184
+ return n ? {
185
+ redos: [{
186
+ id: C.id,
187
+ params: {
188
+ unitId: e,
189
+ subUnitId: r,
190
+ payload: {
191
+ ref: M(n),
192
+ commentId: o
193
+ },
194
+ silent: s
195
+ }
196
+ }],
197
+ undos: [{
198
+ id: C.id,
199
+ params: {
200
+ unitId: e,
201
+ subUnitId: r,
202
+ payload: {
203
+ ref: M(a),
204
+ commentId: o
205
+ },
206
+ silent: s
207
+ }
208
+ }]
209
+ } : {
210
+ redos: [{
211
+ id: N.id,
212
+ params: {
213
+ unitId: e,
214
+ subUnitId: r,
215
+ commentId: o
216
+ }
217
+ }],
218
+ undos: [{
219
+ id: V.id,
220
+ params: {
221
+ unitId: e,
222
+ subUnitId: r,
223
+ comment: t,
224
+ sync: !0
225
+ }
226
+ }]
227
+ };
584
228
  });
229
+ this._refRangeService = e, this._sheetsThreadCommentModel = r, this._threadCommentModel = t, this._selectionManagerService = n, this._commandService = s, this._initData(), this._initRefRange();
585
230
  }
586
- _initSelectionUpdateListener() {
587
- this.disposeWithMe(
588
- this._sheetSelectionService.selectionMoveEnd$.subscribe((selections) => {
589
- if (this._isSwitchToCommenting)
590
- return;
591
- const current = this._sheetSelectionService.currentSelectionParam;
592
- current && this._handleSelectionChange(selections, current.unitId, current.sheetId);
593
- })
594
- );
231
+ _getIdWithUnitId(e, r, t) {
232
+ return `${e}-${r}-${t}`;
595
233
  }
596
- _initEditorBridge() {
597
- this.disposeWithMe(
598
- this._editorBridgeService.visible$.subscribe((visible) => {
599
- visible.visible && this._sheetsThreadCommentPopupService.hidePopup();
600
- })
234
+ _register(e, r, t) {
235
+ const n = t.id, s = {
236
+ startColumn: t.column,
237
+ endColumn: t.column,
238
+ startRow: t.row,
239
+ endRow: t.row
240
+ };
241
+ this._disposableMap.set(
242
+ this._getIdWithUnitId(e, r, n),
243
+ this._refRangeService.registerRefRange(s, (o) => {
244
+ const a = B(s, o, { selectionManagerService: this._selectionManagerService }), c = Array.isArray(a) ? a[0] : a;
245
+ return c && c.startColumn === s.startColumn && c.startRow === s.startRow ? {
246
+ undos: [],
247
+ redos: []
248
+ } : this._handleRangeChange(e, r, t, c, !1);
249
+ }, e, r)
601
250
  );
602
251
  }
603
- _initCommandListener() {
604
- this._commandService.onCommandExecuted((commandInfo) => {
605
- if (commandInfo.id === DeleteCommentMutation.id) {
606
- const params = commandInfo.params, active = this._sheetsThreadCommentPopupService.activePopup;
607
- if (!active)
608
- return;
609
- const { unitId, subUnitId, commentId } = active;
610
- params.unitId === unitId && params.subUnitId === subUnitId && params.commentId === commentId && this._sheetsThreadCommentPopupService.hidePopup();
611
- }
612
- });
613
- }
614
- _initPanelListener() {
615
- this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async (commentInfo) => {
616
- var _a9;
617
- if (commentInfo) {
618
- const { unitId, subUnitId, commentId, trigger } = commentInfo, comment = this._sheetsThreadCommentModel.getComment(unitId, subUnitId, commentId);
619
- if (!comment || comment.resolved)
620
- return;
621
- const currentUnit = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
622
- if (!currentUnit || currentUnit.getUnitId() !== unitId)
623
- return;
624
- this._isSwitchToCommenting = !0, ((_a9 = currentUnit.getActiveSheet()) == null ? void 0 : _a9.getSheetId()) !== subUnitId && await this._commandService.executeCommand(SetWorksheetActiveOperation.id, {
625
- unitId,
626
- subUnitId
627
- }), this._isSwitchToCommenting = !1;
628
- const location = singleReferenceToGrid(comment.ref), { row, column: col } = location;
629
- if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
630
- workbookTypes: [WorkbookCommentPermission],
631
- worksheetTypes: [WorksheetViewPermission],
632
- rangeTypes: [RangeProtectionPermissionViewPoint]
633
- }, [{ startRow: row, startColumn: col, endRow: row, endColumn: col }]))
634
- return;
635
- const GAP = 1;
636
- if (await this._commandService.executeCommand(ScrollToRangeOperation.id, {
637
- range: {
638
- startRow: Math.max(location.row - GAP, 0),
639
- endRow: location.row + GAP,
640
- startColumn: Math.max(location.column - GAP, 0),
641
- endColumn: location.column + GAP
642
- }
643
- }), this._editorBridgeService.isVisible().visible)
644
- return;
645
- this._sheetsThreadCommentPopupService.showPopup({
646
- unitId,
647
- subUnitId,
648
- row: location.row,
649
- col: location.column,
650
- commentId: comment.id,
651
- trigger
652
- });
653
- } else
654
- this._sheetsThreadCommentPopupService.hidePopup();
655
- }));
252
+ _watch(e, r, t) {
253
+ const n = t.id, s = {
254
+ startColumn: t.column,
255
+ endColumn: t.column,
256
+ startRow: t.row,
257
+ endRow: t.row
258
+ };
259
+ this._watcherMap.set(
260
+ this._getIdWithUnitId(e, r, n),
261
+ this._refRangeService.watchRange(e, r, s, (o, a) => {
262
+ const { redos: c } = this._handleRangeChange(e, r, t, a, !0);
263
+ P(c, this._commandService, { onlyLocal: !0 });
264
+ }, !0)
265
+ );
656
266
  }
657
- _initMarkSelection() {
658
- this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(debounceTime(100)).subscribe((activeComment) => {
659
- var _a9, _b;
660
- if (!activeComment) {
661
- this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
662
- return;
267
+ _unwatch(e, r, t) {
268
+ var s;
269
+ const n = this._getIdWithUnitId(e, r, t);
270
+ (s = this._watcherMap.get(n)) == null || s.dispose(), this._watcherMap.delete(n);
271
+ }
272
+ _unregister(e, r, t) {
273
+ var s;
274
+ const n = this._getIdWithUnitId(e, r, t);
275
+ (s = this._disposableMap.get(n)) == null || s.dispose(), this._disposableMap.delete(n);
276
+ }
277
+ _initData() {
278
+ const e = this._threadCommentModel.getAll();
279
+ for (const r of e)
280
+ for (const t of r.threads) {
281
+ const { unitId: n, subUnitId: s, root: o } = t, a = p(o.ref), c = {
282
+ ...o,
283
+ ...a
284
+ };
285
+ this._register(n, s, c), this._watch(n, s, c);
663
286
  }
664
- const { unitId, subUnitId, commentId } = activeComment;
665
- this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
666
- const comment = this._sheetsThreadCommentModel.getComment(unitId, subUnitId, commentId);
667
- if (!comment)
668
- return;
669
- const location = singleReferenceToGrid(comment.ref), { row, column } = location;
670
- if (Number.isNaN(row) || Number.isNaN(column))
671
- return null;
672
- 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 : {
673
- startColumn: column,
674
- endColumn: column,
675
- startRow: row,
676
- endRow: row
677
- }, shapeId = this._markSelectionService.addShape(
678
- {
679
- range: mergeInfo,
680
- style: {
681
- hasAutoFill: !1,
682
- fill: "rgb(255, 189, 55, 0.35)",
683
- strokeWidth: 1,
684
- stroke: "#FFBD37",
685
- widgets: {}
686
- },
687
- primary: null
688
- },
689
- [],
690
- -1
691
- );
692
- shapeId && (this._selectionShapeInfo = {
693
- ...activeComment,
694
- shapeId
695
- });
696
- }));
697
- }
698
- }, __name(_a6, "SheetsThreadCommentPopupController"), _a6);
699
- SheetsThreadCommentPopupController = __decorateClass$2([
700
- __decorateParam$2(0, ICommandService),
701
- __decorateParam$2(1, Inject(SheetsThreadCommentPopupService)),
702
- __decorateParam$2(2, Inject(SheetsThreadCommentModel)),
703
- __decorateParam$2(3, Inject(ThreadCommentPanelService)),
704
- __decorateParam$2(4, IUniverInstanceService),
705
- __decorateParam$2(5, Inject(SheetPermissionInterceptorBaseController)),
706
- __decorateParam$2(6, IMarkSelectionService),
707
- __decorateParam$2(7, Inject(SheetsSelectionsService)),
708
- __decorateParam$2(8, IEditorBridgeService),
709
- __decorateParam$2(9, IRenderManagerService)
710
- ], SheetsThreadCommentPopupController);
711
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
712
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
713
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
714
- return kind && result && __defProp$1(target, key, result), result;
715
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a7;
716
- let ThreadCommentRemoveSheetsController = (_a7 = class extends Disposable {
717
- constructor(_sheetInterceptorService, _univerInstanceService, _threadCommentModel, _threadCommentDataSourceService) {
718
- super(), this._sheetInterceptorService = _sheetInterceptorService, this._univerInstanceService = _univerInstanceService, this._threadCommentModel = _threadCommentModel, this._threadCommentDataSourceService = _threadCommentDataSourceService, this._initSheetChange();
719
287
  }
720
- _initSheetChange() {
288
+ _initRefRange() {
721
289
  this.disposeWithMe(
722
- this._sheetInterceptorService.interceptCommand({
723
- getMutations: /* @__PURE__ */ __name((commandInfo) => {
724
- var _a9;
725
- if (commandInfo.id === RemoveSheetCommand.id) {
726
- const params = commandInfo.params, workbook = params.unitId ? this._univerInstanceService.getUnit(params.unitId) : this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
727
- if (!workbook)
728
- return { redos: [], undos: [] };
729
- const unitId = workbook.getUnitId(), subUnitId = params.subUnitId || ((_a9 = workbook.getActiveSheet()) == null ? void 0 : _a9.getSheetId());
730
- if (!subUnitId)
731
- return { redos: [], undos: [] };
732
- const commentMap = this._threadCommentModel.ensureMap(unitId, subUnitId), comments = Array.from(commentMap.values()).filter((comment) => !comment.parentId), ids = comments.map((comment) => comment.id), shouldSync = this._threadCommentDataSourceService.syncUpdateMutationToColla, redos = ids.map((id) => ({
733
- id: DeleteCommentMutation.id,
734
- params: {
735
- unitId,
736
- subUnitId,
737
- commentId: id
738
- }
739
- })), undos = comments.map(({ children, ...comment }) => ({
740
- id: AddCommentMutation.id,
741
- params: {
742
- unitId,
743
- subUnitId,
744
- comment: {
745
- ...comment,
746
- children: shouldSync ? children : void 0
747
- },
748
- sync: !shouldSync
749
- }
750
- }));
751
- return { redos, undos };
290
+ this._sheetsThreadCommentModel.commentUpdate$.subscribe((e) => {
291
+ const { unitId: r, subUnitId: t } = e;
292
+ switch (e.type) {
293
+ case "add": {
294
+ if (e.payload.parentId)
295
+ return;
296
+ const n = {
297
+ ...e.payload,
298
+ row: e.row,
299
+ column: e.column
300
+ };
301
+ this._register(e.unitId, e.subUnitId, n), this._watch(e.unitId, e.subUnitId, n);
302
+ break;
303
+ }
304
+ case "delete": {
305
+ this._unregister(r, t, e.payload.commentId), this._unwatch(r, t, e.payload.commentId);
306
+ break;
307
+ }
308
+ case "updateRef": {
309
+ const n = this._sheetsThreadCommentModel.getComment(r, t, e.payload.commentId);
310
+ if (!n)
311
+ return;
312
+ this._unregister(r, t, e.payload.commentId);
313
+ const s = {
314
+ ...n,
315
+ row: e.row,
316
+ column: e.column
317
+ };
318
+ e.silent || (this._unwatch(r, t, e.payload.commentId), this._watch(r, t, s)), this._register(e.unitId, e.subUnitId, s);
319
+ break;
752
320
  }
753
- return { redos: [], undos: [] };
754
- }, "getMutations")
321
+ }
755
322
  })
756
- );
323
+ ), this.disposeWithMe(D(() => {
324
+ this._disposableMap.forEach((e) => {
325
+ e.dispose();
326
+ }), this._disposableMap.clear();
327
+ }));
757
328
  }
758
- }, __name(_a7, "ThreadCommentRemoveSheetsController"), _a7);
759
- ThreadCommentRemoveSheetsController = __decorateClass$1([
760
- __decorateParam$1(0, Inject(SheetInterceptorService)),
761
- __decorateParam$1(1, IUniverInstanceService),
762
- __decorateParam$1(2, Inject(ThreadCommentModel)),
763
- __decorateParam$1(3, IThreadCommentDataSourceService)
764
- ], ThreadCommentRemoveSheetsController);
765
- 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) => {
766
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
767
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
768
- return kind && result && __defProp2(target, key, result), result;
769
- }, "__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"), _a8;
770
- let UniverSheetsThreadCommentPlugin = (_a8 = class extends Plugin {
771
- constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
772
- super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._configService = _configService;
773
- const { menu, ...rest } = this._config;
774
- menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
329
+ };
330
+ f = Q([
331
+ _(0, l(W)),
332
+ _(1, l(u)),
333
+ _(2, l(S)),
334
+ _(3, l(L)),
335
+ _(4, b)
336
+ ], f);
337
+ const X = "SHEET_THREAD_COMMENT_BASE_PLUGIN";
338
+ var I = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, Z = (i, e, r) => e in i ? I(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r, k = (i, e, r, t) => {
339
+ for (var n = t > 1 ? void 0 : t ? Y(e, r) : e, s = i.length - 1, o; s >= 0; s--)
340
+ (o = i[s]) && (n = (t ? o(e, r, n) : o(n)) || n);
341
+ return t && n && I(e, r, n), n;
342
+ }, v = (i, e) => (r, t) => e(r, t, i), U = (i, e, r) => Z(i, typeof e != "symbol" ? e + "" : e, r);
343
+ let g = class extends j {
344
+ constructor(i, e, r) {
345
+ super(), this._injector = e, this._commandService = r;
775
346
  }
776
347
  onStarting() {
777
348
  [
778
- [SheetsThreadCommentController],
779
- [SheetsThreadCommentRenderController],
780
- [SheetsThreadCommentCopyPasteController],
781
- [SheetsThreadCommentHoverController],
782
- [ThreadCommentRemoveSheetsController],
783
- [SheetsThreadCommentPopupController],
784
- [SheetsThreadCommentPopupService]
785
- ].forEach((dep) => {
786
- this._injector.add(dep);
787
- }), [ShowAddSheetCommentModalOperation].forEach((command) => {
788
- this._commandService.registerCommand(command);
789
- }), this._injector.get(SheetsThreadCommentController);
349
+ [u],
350
+ [f]
351
+ ].forEach((i) => {
352
+ this._injector.add(i);
353
+ }), this._injector.get(f);
790
354
  }
791
- onReady() {
792
- this._injector.get(SheetsThreadCommentRenderController), this._injector.get(ThreadCommentRemoveSheetsController);
793
- }
794
- onRendered() {
795
- this._injector.get(SheetsThreadCommentCopyPasteController), this._injector.get(SheetsThreadCommentHoverController), this._injector.get(SheetsThreadCommentPopupController);
796
- }
797
- }, __name(_a8, "UniverSheetsThreadCommentPlugin"), _a8);
798
- __publicField2(UniverSheetsThreadCommentPlugin, "pluginName", SHEETS_THREAD_COMMENT);
799
- __publicField2(UniverSheetsThreadCommentPlugin, "type", UniverInstanceType.UNIVER_SHEET);
800
- UniverSheetsThreadCommentPlugin = __decorateClass([
801
- DependentOn(UniverThreadCommentUIPlugin, UniverSheetsThreadCommentBasePlugin),
802
- __decorateParam(1, Inject(Injector)),
803
- __decorateParam(2, Inject(ICommandService)),
804
- __decorateParam(3, IConfigService)
805
- ], UniverSheetsThreadCommentPlugin);
355
+ };
356
+ U(g, "pluginName", X);
357
+ U(g, "type", y.UNIVER_SHEET);
358
+ g = k([
359
+ O(H),
360
+ v(1, l(A)),
361
+ v(2, l(b))
362
+ ], g);
806
363
  export {
807
- AddCommentCommand,
808
- DeleteCommentCommand,
809
- DeleteCommentTreeCommand,
810
- IThreadCommentDataSourceService2 as IThreadCommentDataSourceService,
811
- IThreadCommentMentionDataService,
812
- ResolveCommentCommand,
813
- SHEETS_THREAD_COMMENT,
814
- SheetsThreadCommentModel2 as SheetsThreadCommentModel,
815
- SheetsThreadCommentPopupService,
816
- ShowAddSheetCommentModalOperation,
817
- UniverSheetsThreadCommentPlugin,
818
- UniverThreadCommentUIPlugin2 as UniverThreadCommentUIPlugin,
819
- UpdateCommentCommand
364
+ u as SheetsThreadCommentModel,
365
+ f as SheetsThreadCommentRefRangeController,
366
+ g as UniverSheetsThreadCommentPlugin
820
367
  };