@univerjs/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.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +675 -392
- package/lib/types/common/utils.d.ts +16 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/umd/index.js +1 -1
- package/package.json +11 -10
package/lib/es/index.js
CHANGED
|
@@ -1,529 +1,812 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const _ThreadCommentDataSourceService = class _ThreadCommentDataSourceService extends Disposable {
|
|
1
|
+
var Ce = Object.defineProperty;
|
|
2
|
+
var _e = (s, t, e) => t in s ? Ce(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var E = (s, t, e) => _e(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { createIdentifier as ve, Disposable as ee, Inject as Z, LifecycleService as ge, LifecycleStages as ae, IResourceManagerService as ye, CommandType as I, ICommandService as H, Plugin as Se, UniverInstanceType as $e, mergeOverrideWithDependencies as Te, Injector as De, IConfigService as Oe } from "@univerjs/core";
|
|
5
|
+
import { Subject as we } from "rxjs";
|
|
6
|
+
class Ue extends ee {
|
|
8
7
|
constructor() {
|
|
9
8
|
super();
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
E(this, "_dataSource", null);
|
|
10
|
+
E(this, "syncUpdateMutationToColla", !0);
|
|
12
11
|
}
|
|
13
|
-
set dataSource(
|
|
14
|
-
this._dataSource =
|
|
12
|
+
set dataSource(e) {
|
|
13
|
+
this._dataSource = e;
|
|
15
14
|
}
|
|
16
15
|
get dataSource() {
|
|
17
16
|
return this._dataSource;
|
|
18
17
|
}
|
|
19
|
-
async getThreadComment(
|
|
20
|
-
return this._dataSource ? (await this._dataSource.listComments(
|
|
18
|
+
async getThreadComment(e, n, r) {
|
|
19
|
+
return this._dataSource ? (await this._dataSource.listComments(e, n, [r]))[0] : null;
|
|
21
20
|
}
|
|
22
|
-
async addComment(
|
|
23
|
-
var
|
|
24
|
-
return this._dataSource ? this._dataSource.addComment(
|
|
21
|
+
async addComment(e) {
|
|
22
|
+
var n;
|
|
23
|
+
return this._dataSource ? this._dataSource.addComment(e) : { ...e, threadId: (n = e.threadId) != null ? n : e.id };
|
|
25
24
|
}
|
|
26
|
-
async updateComment(
|
|
27
|
-
return this._dataSource ? this._dataSource.updateComment(
|
|
25
|
+
async updateComment(e) {
|
|
26
|
+
return this._dataSource ? this._dataSource.updateComment(e) : !0;
|
|
28
27
|
}
|
|
29
|
-
async resolveComment(
|
|
30
|
-
return this._dataSource ? this._dataSource.resolveComment(
|
|
28
|
+
async resolveComment(e) {
|
|
29
|
+
return this._dataSource ? this._dataSource.resolveComment(e) : !0;
|
|
31
30
|
}
|
|
32
|
-
async deleteComment(
|
|
33
|
-
return this._dataSource ? this._dataSource.deleteComment(
|
|
31
|
+
async deleteComment(e, n, r, a) {
|
|
32
|
+
return this._dataSource ? this._dataSource.deleteComment(e, n, r, a) : !0;
|
|
34
33
|
}
|
|
35
|
-
async listThreadComments(
|
|
36
|
-
return this.dataSource ? this.dataSource.listComments(
|
|
34
|
+
async listThreadComments(e, n, r) {
|
|
35
|
+
return this.dataSource ? this.dataSource.listComments(e, n, r) : !1;
|
|
37
36
|
}
|
|
38
|
-
saveToSnapshot(
|
|
37
|
+
saveToSnapshot(e, n) {
|
|
39
38
|
if (this._dataSource) {
|
|
40
|
-
const
|
|
41
|
-
return Object.keys(
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
}),
|
|
39
|
+
const r = {};
|
|
40
|
+
return Object.keys(e).forEach((a) => {
|
|
41
|
+
const o = e[a];
|
|
42
|
+
r[a] = o.map(this.dataSource.saveCommentToSnapshot);
|
|
43
|
+
}), r;
|
|
45
44
|
}
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
let ThreadCommentModel = (_a = class extends Disposable {
|
|
58
|
-
constructor(_dataSourceService, _lifecycleService) {
|
|
45
|
+
return e;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const b = ve("univer.thread-comment.data-source-service");
|
|
49
|
+
var Ne = Object.defineProperty, Ee = Object.getOwnPropertyDescriptor, Ie = (s, t, e, n) => {
|
|
50
|
+
for (var r = n > 1 ? void 0 : n ? Ee(t, e) : t, a = s.length - 1, o; a >= 0; a--)
|
|
51
|
+
(o = s[a]) && (r = (n ? o(t, e, r) : o(r)) || r);
|
|
52
|
+
return n && r && Ne(t, e, r), r;
|
|
53
|
+
}, se = (s, t) => (e, n) => t(e, n, s);
|
|
54
|
+
let O = class extends ee {
|
|
55
|
+
constructor(t, e) {
|
|
59
56
|
super();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this._dataSourceService =
|
|
57
|
+
E(this, "_commentsMap", /* @__PURE__ */ new Map());
|
|
58
|
+
E(this, "_threadMap", /* @__PURE__ */ new Map());
|
|
59
|
+
E(this, "_commentUpdate$", new we());
|
|
60
|
+
E(this, "commentUpdate$", this._commentUpdate$.asObservable());
|
|
61
|
+
E(this, "_tasks", []);
|
|
62
|
+
this._dataSourceService = t, this._lifecycleService = e, this.disposeWithMe(() => {
|
|
66
63
|
this._commentUpdate$.complete();
|
|
67
|
-
}), this.disposeWithMe(this._lifecycleService.lifecycle$.subscribe((
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
for (const
|
|
75
|
-
|
|
76
|
-
}), this._tasks = [],
|
|
77
|
-
|
|
78
|
-
this.syncThreadComments(
|
|
64
|
+
}), this.disposeWithMe(this._lifecycleService.lifecycle$.subscribe((n) => {
|
|
65
|
+
const r = /* @__PURE__ */ new Map();
|
|
66
|
+
n === ae.Rendered && (this._tasks.forEach(({ unitId: a, subUnitId: o, threadIds: M }) => {
|
|
67
|
+
let u = r.get(a);
|
|
68
|
+
u || (u = /* @__PURE__ */ new Map(), r.set(a, u));
|
|
69
|
+
let p = u.get(o);
|
|
70
|
+
p || (p = /* @__PURE__ */ new Set(), u.set(o, p));
|
|
71
|
+
for (const S of M)
|
|
72
|
+
p.add(S);
|
|
73
|
+
}), this._tasks = [], r.forEach((a, o) => {
|
|
74
|
+
a.forEach((M, u) => {
|
|
75
|
+
this.syncThreadComments(o, u, Array.from(M));
|
|
79
76
|
});
|
|
80
77
|
}));
|
|
81
78
|
}));
|
|
82
79
|
}
|
|
83
|
-
_ensureCommentMap(
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
let
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
ensureMap(
|
|
90
|
-
return this._ensureCommentMap(
|
|
91
|
-
}
|
|
92
|
-
_ensureThreadMap(
|
|
93
|
-
let
|
|
94
|
-
|
|
95
|
-
let
|
|
96
|
-
return
|
|
97
|
-
}
|
|
98
|
-
_replaceComment(
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
const { children, ...
|
|
102
|
-
...
|
|
103
|
-
ref:
|
|
80
|
+
_ensureCommentMap(t, e) {
|
|
81
|
+
let n = this._commentsMap.get(t);
|
|
82
|
+
n || (n = /* @__PURE__ */ new Map(), this._commentsMap.set(t, n));
|
|
83
|
+
let r = n.get(e);
|
|
84
|
+
return r || (r = /* @__PURE__ */ new Map(), n.set(e, r)), r;
|
|
85
|
+
}
|
|
86
|
+
ensureMap(t, e) {
|
|
87
|
+
return this._ensureCommentMap(t, e);
|
|
88
|
+
}
|
|
89
|
+
_ensureThreadMap(t, e) {
|
|
90
|
+
let n = this._threadMap.get(t);
|
|
91
|
+
n || (n = /* @__PURE__ */ new Map(), this._threadMap.set(t, n));
|
|
92
|
+
let r = n.get(e);
|
|
93
|
+
return r || (r = /* @__PURE__ */ new Map(), n.set(e, r)), r;
|
|
94
|
+
}
|
|
95
|
+
_replaceComment(t, e, n) {
|
|
96
|
+
const r = this._ensureCommentMap(t, e), a = r.get(n.id);
|
|
97
|
+
if (a) {
|
|
98
|
+
const { children: o, ...M } = n, u = {
|
|
99
|
+
...M,
|
|
100
|
+
ref: a.ref
|
|
104
101
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
...
|
|
102
|
+
r.set(n.id, u), o == null || o.forEach((p) => {
|
|
103
|
+
r.set(p.id, {
|
|
104
|
+
...p,
|
|
108
105
|
ref: ""
|
|
109
106
|
});
|
|
110
107
|
}), this._commentUpdate$.next({
|
|
111
|
-
unitId,
|
|
112
|
-
subUnitId,
|
|
108
|
+
unitId: t,
|
|
109
|
+
subUnitId: e,
|
|
113
110
|
type: "syncUpdate",
|
|
114
|
-
payload:
|
|
115
|
-
}), !!
|
|
116
|
-
unitId,
|
|
117
|
-
subUnitId,
|
|
111
|
+
payload: u
|
|
112
|
+
}), !!n.resolved != !!a.resolved && this._commentUpdate$.next({
|
|
113
|
+
unitId: t,
|
|
114
|
+
subUnitId: e,
|
|
118
115
|
type: "resolve",
|
|
119
116
|
payload: {
|
|
120
|
-
commentId:
|
|
121
|
-
resolved: !!
|
|
117
|
+
commentId: n.id,
|
|
118
|
+
resolved: !!n.resolved
|
|
122
119
|
}
|
|
123
120
|
});
|
|
124
121
|
}
|
|
125
122
|
}
|
|
126
|
-
async syncThreadComments(
|
|
127
|
-
if (this._lifecycleService.stage <
|
|
128
|
-
this._tasks.push({ unitId, subUnitId, threadIds });
|
|
123
|
+
async syncThreadComments(t, e, n) {
|
|
124
|
+
if (this._lifecycleService.stage < ae.Rendered) {
|
|
125
|
+
this._tasks.push({ unitId: t, subUnitId: e, threadIds: n });
|
|
129
126
|
return;
|
|
130
127
|
}
|
|
131
|
-
const
|
|
132
|
-
if (!
|
|
128
|
+
const r = this._ensureThreadMap(t, e), a = this._ensureCommentMap(t, e), o = await this._dataSourceService.listThreadComments(t, e, n);
|
|
129
|
+
if (!o)
|
|
133
130
|
return;
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
this._replaceComment(
|
|
137
|
-
}),
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
const M = new Set(n);
|
|
132
|
+
o.forEach((u) => {
|
|
133
|
+
this._replaceComment(t, e, u), M.delete(u.threadId);
|
|
134
|
+
}), M.forEach((u) => {
|
|
135
|
+
r.delete(u), a.forEach((p, S) => {
|
|
136
|
+
p.threadId === u && a.delete(S);
|
|
140
137
|
});
|
|
141
138
|
});
|
|
142
139
|
}
|
|
143
|
-
addComment(
|
|
144
|
-
const
|
|
145
|
-
...
|
|
146
|
-
parentId:
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
unitId,
|
|
150
|
-
subUnitId,
|
|
140
|
+
addComment(t, e, n, r) {
|
|
141
|
+
const a = this._ensureCommentMap(t, e), { parentId: o, children: M = [], ...u } = n, p = {
|
|
142
|
+
...u,
|
|
143
|
+
parentId: o === n.id ? void 0 : o
|
|
144
|
+
}, S = (N) => {
|
|
145
|
+
a.set(N.id, N), this._commentUpdate$.next({
|
|
146
|
+
unitId: t,
|
|
147
|
+
subUnitId: e,
|
|
151
148
|
type: "add",
|
|
152
|
-
payload:
|
|
153
|
-
isRoot: !
|
|
149
|
+
payload: N,
|
|
150
|
+
isRoot: !N.parentId
|
|
154
151
|
});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
159
|
-
|
|
160
|
-
for (const
|
|
161
|
-
|
|
152
|
+
};
|
|
153
|
+
S(p);
|
|
154
|
+
const $ = this._ensureThreadMap(t, e);
|
|
155
|
+
if (!p.parentId) {
|
|
156
|
+
$.set(p.threadId, p);
|
|
157
|
+
for (const N of M)
|
|
158
|
+
S(N);
|
|
162
159
|
}
|
|
163
|
-
return
|
|
160
|
+
return r && this.syncThreadComments(t, e, [p.threadId]), !0;
|
|
164
161
|
}
|
|
165
|
-
updateComment(
|
|
166
|
-
const
|
|
167
|
-
return
|
|
168
|
-
unitId,
|
|
169
|
-
subUnitId,
|
|
162
|
+
updateComment(t, e, n, r) {
|
|
163
|
+
const o = this._ensureCommentMap(t, e).get(n.commentId);
|
|
164
|
+
return o && (o.updated = !0, o.text = n.text, o.attachments = n.attachments, o.updateT = n.updateT, this._commentUpdate$.next({
|
|
165
|
+
unitId: t,
|
|
166
|
+
subUnitId: e,
|
|
170
167
|
type: "update",
|
|
171
|
-
payload,
|
|
172
|
-
silent
|
|
168
|
+
payload: n,
|
|
169
|
+
silent: r
|
|
173
170
|
})), !0;
|
|
174
171
|
}
|
|
175
|
-
updateCommentRef(
|
|
176
|
-
const
|
|
177
|
-
return
|
|
178
|
-
unitId,
|
|
179
|
-
subUnitId,
|
|
172
|
+
updateCommentRef(t, e, n, r) {
|
|
173
|
+
const o = this._ensureCommentMap(t, e).get(n.commentId);
|
|
174
|
+
return o ? (o.ref = n.ref, this._commentUpdate$.next({
|
|
175
|
+
unitId: t,
|
|
176
|
+
subUnitId: e,
|
|
180
177
|
type: "updateRef",
|
|
181
|
-
payload,
|
|
182
|
-
silent,
|
|
183
|
-
threadId:
|
|
178
|
+
payload: n,
|
|
179
|
+
silent: r,
|
|
180
|
+
threadId: o.threadId
|
|
184
181
|
}), !0) : !1;
|
|
185
182
|
}
|
|
186
|
-
resolveComment(
|
|
187
|
-
const
|
|
188
|
-
return
|
|
189
|
-
unitId,
|
|
190
|
-
subUnitId,
|
|
183
|
+
resolveComment(t, e, n, r) {
|
|
184
|
+
const o = this._ensureCommentMap(t, e).get(n);
|
|
185
|
+
return o ? (o.resolved = r, this._commentUpdate$.next({
|
|
186
|
+
unitId: t,
|
|
187
|
+
subUnitId: e,
|
|
191
188
|
type: "resolve",
|
|
192
189
|
payload: {
|
|
193
|
-
commentId,
|
|
194
|
-
resolved
|
|
190
|
+
commentId: n,
|
|
191
|
+
resolved: r
|
|
195
192
|
}
|
|
196
193
|
}), !0) : !1;
|
|
197
194
|
}
|
|
198
|
-
getComment(
|
|
199
|
-
return this._ensureCommentMap(
|
|
195
|
+
getComment(t, e, n) {
|
|
196
|
+
return this._ensureCommentMap(t, e).get(n);
|
|
200
197
|
}
|
|
201
|
-
getRootComment(
|
|
202
|
-
return this._ensureThreadMap(
|
|
198
|
+
getRootComment(t, e, n) {
|
|
199
|
+
return this._ensureThreadMap(t, e).get(n);
|
|
203
200
|
}
|
|
204
|
-
getThread(
|
|
205
|
-
const
|
|
206
|
-
let
|
|
207
|
-
const
|
|
208
|
-
for (const
|
|
209
|
-
|
|
210
|
-
if (
|
|
201
|
+
getThread(t, e, n) {
|
|
202
|
+
const r = this._ensureCommentMap(t, e), a = Array.from(r.values()).filter((p) => p.threadId === n);
|
|
203
|
+
let o;
|
|
204
|
+
const M = [], u = /* @__PURE__ */ new Set();
|
|
205
|
+
for (const p of a)
|
|
206
|
+
p.parentId ? M.push(p) : o = p, u.add(p.personId);
|
|
207
|
+
if (o)
|
|
211
208
|
return {
|
|
212
|
-
root,
|
|
213
|
-
children,
|
|
214
|
-
relativeUsers,
|
|
215
|
-
unitId,
|
|
216
|
-
subUnitId,
|
|
217
|
-
threadId
|
|
209
|
+
root: o,
|
|
210
|
+
children: M,
|
|
211
|
+
relativeUsers: u,
|
|
212
|
+
unitId: t,
|
|
213
|
+
subUnitId: e,
|
|
214
|
+
threadId: n
|
|
218
215
|
};
|
|
219
216
|
}
|
|
220
|
-
getCommentWithChildren(
|
|
221
|
-
const
|
|
222
|
-
if (
|
|
223
|
-
return this.getThread(
|
|
217
|
+
getCommentWithChildren(t, e, n) {
|
|
218
|
+
const r = this.getComment(t, e, n);
|
|
219
|
+
if (r)
|
|
220
|
+
return this.getThread(t, e, r.threadId);
|
|
224
221
|
}
|
|
225
|
-
_deleteComment(
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
unitId,
|
|
229
|
-
subUnitId,
|
|
222
|
+
_deleteComment(t, e, n) {
|
|
223
|
+
const r = this._ensureCommentMap(t, e), a = r.get(n);
|
|
224
|
+
a && (r.delete(n), this._commentUpdate$.next({
|
|
225
|
+
unitId: t,
|
|
226
|
+
subUnitId: e,
|
|
230
227
|
type: "delete",
|
|
231
228
|
payload: {
|
|
232
|
-
commentId,
|
|
233
|
-
isRoot: !
|
|
234
|
-
comment:
|
|
229
|
+
commentId: n,
|
|
230
|
+
isRoot: !a.parentId,
|
|
231
|
+
comment: a
|
|
235
232
|
}
|
|
236
233
|
}));
|
|
237
234
|
}
|
|
238
|
-
deleteThread(
|
|
239
|
-
this._ensureThreadMap(
|
|
240
|
-
|
|
235
|
+
deleteThread(t, e, n) {
|
|
236
|
+
this._ensureThreadMap(t, e).delete(n), this._ensureCommentMap(t, e).forEach((o) => {
|
|
237
|
+
o.threadId === n && this._deleteComment(t, e, o.id);
|
|
241
238
|
});
|
|
242
239
|
}
|
|
243
|
-
deleteComment(
|
|
244
|
-
const
|
|
245
|
-
return
|
|
240
|
+
deleteComment(t, e, n) {
|
|
241
|
+
const a = this._ensureCommentMap(t, e).get(n);
|
|
242
|
+
return a && (a.parentId ? this._deleteComment(t, e, n) : this.deleteThread(t, e, a.threadId)), !0;
|
|
246
243
|
}
|
|
247
|
-
deleteUnit(
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
this.deleteComment(
|
|
244
|
+
deleteUnit(t) {
|
|
245
|
+
const e = this._commentsMap.get(t);
|
|
246
|
+
e && e.forEach((n, r) => {
|
|
247
|
+
n.forEach((a) => {
|
|
248
|
+
this.deleteComment(t, r, a.id);
|
|
252
249
|
});
|
|
253
250
|
});
|
|
254
251
|
}
|
|
255
|
-
getUnit(
|
|
256
|
-
const
|
|
257
|
-
if (!
|
|
252
|
+
getUnit(t) {
|
|
253
|
+
const e = this._threadMap.get(t);
|
|
254
|
+
if (!e)
|
|
258
255
|
return [];
|
|
259
|
-
const
|
|
260
|
-
return
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
|
|
256
|
+
const n = [];
|
|
257
|
+
return e.forEach((r, a) => {
|
|
258
|
+
r.forEach((o, M) => {
|
|
259
|
+
const u = this.getThread(t, a, M);
|
|
260
|
+
u && n.push(u);
|
|
264
261
|
});
|
|
265
|
-
}),
|
|
262
|
+
}), n;
|
|
266
263
|
}
|
|
267
264
|
getAll() {
|
|
268
|
-
const
|
|
269
|
-
return this._commentsMap.forEach((
|
|
270
|
-
|
|
271
|
-
unitId,
|
|
272
|
-
threads: this.getUnit(
|
|
265
|
+
const t = [];
|
|
266
|
+
return this._commentsMap.forEach((e, n) => {
|
|
267
|
+
t.push({
|
|
268
|
+
unitId: n,
|
|
269
|
+
threads: this.getUnit(n)
|
|
273
270
|
});
|
|
274
|
-
}),
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
],
|
|
281
|
-
var
|
|
282
|
-
const
|
|
283
|
-
var
|
|
284
|
-
for (var
|
|
285
|
-
(
|
|
286
|
-
return
|
|
287
|
-
},
|
|
288
|
-
let
|
|
289
|
-
constructor(
|
|
290
|
-
super(), this._resourceManagerService =
|
|
271
|
+
}), t;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
O = Ie([
|
|
275
|
+
se(0, Z(b)),
|
|
276
|
+
se(1, Z(ge))
|
|
277
|
+
], O);
|
|
278
|
+
var X = /* @__PURE__ */ ((s) => (s[s.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", s[s.UNIVER_DOC = 1] = "UNIVER_DOC", s[s.UNIVER_SHEET = 2] = "UNIVER_SHEET", s[s.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", s[s.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", s[s.UNRECOGNIZED = -1] = "UNRECOGNIZED", s))(X || {});
|
|
279
|
+
const ce = "UNIVER_THREAD_COMMENT_PLUGIN";
|
|
280
|
+
var Re = Object.defineProperty, be = Object.getOwnPropertyDescriptor, xe = (s, t, e, n) => {
|
|
281
|
+
for (var r = n > 1 ? void 0 : n ? be(t, e) : t, a = s.length - 1, o; a >= 0; a--)
|
|
282
|
+
(o = s[a]) && (r = (n ? o(t, e, r) : o(r)) || r);
|
|
283
|
+
return n && r && Re(t, e, r), r;
|
|
284
|
+
}, q = (s, t) => (e, n) => t(e, n, s);
|
|
285
|
+
let B = class extends ee {
|
|
286
|
+
constructor(s, t, e) {
|
|
287
|
+
super(), this._resourceManagerService = s, this._threadCommentModel = t, this._threadCommentDataSourceService = e, this._initSnapshot();
|
|
291
288
|
}
|
|
292
289
|
_initSnapshot() {
|
|
293
|
-
const
|
|
294
|
-
const
|
|
295
|
-
return
|
|
296
|
-
var
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
...
|
|
300
|
-
children:
|
|
301
|
-
}),
|
|
302
|
-
}), JSON.stringify(this._threadCommentDataSourceService.saveToSnapshot(
|
|
303
|
-
},
|
|
304
|
-
if (!
|
|
290
|
+
const s = (e) => {
|
|
291
|
+
const n = this._threadCommentModel.getUnit(e), r = {};
|
|
292
|
+
return n ? (n.forEach((a) => {
|
|
293
|
+
var M;
|
|
294
|
+
const o = (M = r[a.subUnitId]) != null ? M : [];
|
|
295
|
+
o.push({
|
|
296
|
+
...a.root,
|
|
297
|
+
children: a.children
|
|
298
|
+
}), r[a.unitId] = o;
|
|
299
|
+
}), JSON.stringify(this._threadCommentDataSourceService.saveToSnapshot(r, e))) : "";
|
|
300
|
+
}, t = (e) => {
|
|
301
|
+
if (!e)
|
|
305
302
|
return {};
|
|
306
303
|
try {
|
|
307
|
-
return JSON.parse(
|
|
304
|
+
return JSON.parse(e);
|
|
308
305
|
} catch {
|
|
309
306
|
return {};
|
|
310
307
|
}
|
|
311
|
-
}
|
|
308
|
+
};
|
|
312
309
|
this.disposeWithMe(
|
|
313
310
|
this._resourceManagerService.registerPluginResource({
|
|
314
|
-
pluginName: `SHEET_${
|
|
315
|
-
businesses: [
|
|
316
|
-
toJson:
|
|
317
|
-
parseJson:
|
|
318
|
-
onUnLoad:
|
|
319
|
-
this._threadCommentModel.deleteUnit(
|
|
320
|
-
},
|
|
321
|
-
onLoad:
|
|
322
|
-
Object.keys(
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
this._threadCommentModel.addComment(
|
|
326
|
-
}), this._threadCommentModel.syncThreadComments(
|
|
311
|
+
pluginName: `SHEET_${ce}`,
|
|
312
|
+
businesses: [X.UNIVER_SHEET, X.UNIVER_DOC],
|
|
313
|
+
toJson: (e) => s(e),
|
|
314
|
+
parseJson: (e) => t(e),
|
|
315
|
+
onUnLoad: (e) => {
|
|
316
|
+
this._threadCommentModel.deleteUnit(e);
|
|
317
|
+
},
|
|
318
|
+
onLoad: async (e, n) => {
|
|
319
|
+
Object.keys(n).forEach((r) => {
|
|
320
|
+
const a = n[r];
|
|
321
|
+
a.forEach((o) => {
|
|
322
|
+
this._threadCommentModel.addComment(e, r, o);
|
|
323
|
+
}), this._threadCommentModel.syncThreadComments(e, r, a.map((o) => o.threadId));
|
|
327
324
|
});
|
|
328
|
-
}
|
|
325
|
+
}
|
|
329
326
|
})
|
|
330
327
|
);
|
|
331
328
|
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
],
|
|
338
|
-
const
|
|
329
|
+
};
|
|
330
|
+
B = xe([
|
|
331
|
+
q(0, ye),
|
|
332
|
+
q(1, Z(O)),
|
|
333
|
+
q(2, b)
|
|
334
|
+
], B);
|
|
335
|
+
const me = {
|
|
339
336
|
id: "thread-comment.mutation.add-comment",
|
|
340
|
-
type:
|
|
341
|
-
handler(
|
|
342
|
-
if (!
|
|
337
|
+
type: I.MUTATION,
|
|
338
|
+
handler(s, t, e) {
|
|
339
|
+
if (!t)
|
|
343
340
|
return !1;
|
|
344
|
-
const
|
|
345
|
-
return
|
|
341
|
+
const n = s.get(O), { unitId: r, subUnitId: a, comment: o, sync: M } = t, u = M || (e == null ? void 0 : e.fromChangeset) && !o.parentId;
|
|
342
|
+
return n.addComment(r, a, o, u);
|
|
346
343
|
}
|
|
347
|
-
},
|
|
344
|
+
}, de = {
|
|
348
345
|
id: "thread-comment.mutation.update-comment",
|
|
349
|
-
type:
|
|
350
|
-
handler(
|
|
351
|
-
if (!
|
|
346
|
+
type: I.MUTATION,
|
|
347
|
+
handler(s, t) {
|
|
348
|
+
if (!t)
|
|
352
349
|
return !1;
|
|
353
|
-
const
|
|
354
|
-
return
|
|
350
|
+
const e = s.get(O), { unitId: n, subUnitId: r, payload: a, silent: o } = t;
|
|
351
|
+
return e.updateComment(n, r, a, o);
|
|
355
352
|
}
|
|
356
|
-
},
|
|
353
|
+
}, Pe = {
|
|
357
354
|
id: "thread-comment.mutation.update-comment-ref",
|
|
358
|
-
type:
|
|
359
|
-
handler(
|
|
360
|
-
if (!
|
|
355
|
+
type: I.MUTATION,
|
|
356
|
+
handler(s, t) {
|
|
357
|
+
if (!t)
|
|
361
358
|
return !1;
|
|
362
|
-
const
|
|
363
|
-
return
|
|
359
|
+
const e = s.get(O), { unitId: n, subUnitId: r, payload: a, silent: o } = t;
|
|
360
|
+
return e.updateCommentRef(n, r, a, o);
|
|
364
361
|
}
|
|
365
|
-
},
|
|
362
|
+
}, ue = {
|
|
366
363
|
id: "thread-comment.mutation.resolve-comment",
|
|
367
|
-
type:
|
|
368
|
-
handler(
|
|
369
|
-
if (!
|
|
364
|
+
type: I.MUTATION,
|
|
365
|
+
handler(s, t) {
|
|
366
|
+
if (!t)
|
|
370
367
|
return !1;
|
|
371
|
-
const
|
|
372
|
-
return
|
|
368
|
+
const e = s.get(O), { unitId: n, subUnitId: r, resolved: a, commentId: o } = t;
|
|
369
|
+
return e.resolveComment(n, r, o, a);
|
|
373
370
|
}
|
|
374
|
-
},
|
|
371
|
+
}, te = {
|
|
375
372
|
id: "thread-comment.mutation.delete-comment",
|
|
376
|
-
type:
|
|
377
|
-
handler(
|
|
378
|
-
if (!
|
|
373
|
+
type: I.MUTATION,
|
|
374
|
+
handler(s, t) {
|
|
375
|
+
if (!t)
|
|
379
376
|
return !1;
|
|
380
|
-
const
|
|
381
|
-
return
|
|
377
|
+
const e = s.get(O), { unitId: n, subUnitId: r, commentId: a } = t;
|
|
378
|
+
return e.deleteComment(n, r, a);
|
|
382
379
|
}
|
|
383
|
-
},
|
|
380
|
+
}, je = {
|
|
384
381
|
id: "thread-comment.command.add-comment",
|
|
385
|
-
type:
|
|
386
|
-
async handler(
|
|
387
|
-
if (!
|
|
382
|
+
type: I.COMMAND,
|
|
383
|
+
async handler(s, t) {
|
|
384
|
+
if (!t)
|
|
388
385
|
return !1;
|
|
389
|
-
const
|
|
390
|
-
id:
|
|
386
|
+
const e = s.get(H), n = s.get(b), { comment: r } = t, a = await n.addComment(r), o = n.syncUpdateMutationToColla, M = !r.parentId, u = {
|
|
387
|
+
id: me.id,
|
|
391
388
|
params: {
|
|
392
|
-
...
|
|
393
|
-
comment
|
|
389
|
+
...t,
|
|
390
|
+
comment: a
|
|
394
391
|
}
|
|
395
392
|
};
|
|
396
|
-
return
|
|
397
|
-
onlyLocal: !
|
|
393
|
+
return M ? await e.executeCommand(u.id, u.params) : e.executeCommand(u.id, u.params, {
|
|
394
|
+
onlyLocal: !o
|
|
398
395
|
});
|
|
399
396
|
}
|
|
400
|
-
},
|
|
397
|
+
}, Ae = {
|
|
401
398
|
id: "thread-comment.command.update-comment",
|
|
402
|
-
type:
|
|
403
|
-
async handler(
|
|
404
|
-
if (!
|
|
399
|
+
type: I.COMMAND,
|
|
400
|
+
async handler(s, t) {
|
|
401
|
+
if (!t)
|
|
405
402
|
return !1;
|
|
406
|
-
const { unitId, subUnitId, payload } =
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
403
|
+
const { unitId: e, subUnitId: n, payload: r } = t, a = s.get(H), o = s.get(O), M = s.get(b), u = M.syncUpdateMutationToColla, p = o.getComment(
|
|
404
|
+
e,
|
|
405
|
+
n,
|
|
406
|
+
r.commentId
|
|
410
407
|
);
|
|
411
|
-
if (!
|
|
408
|
+
if (!p)
|
|
412
409
|
return !1;
|
|
413
|
-
const { children,
|
|
414
|
-
if (!await
|
|
415
|
-
|
|
416
|
-
...
|
|
410
|
+
const { children: S, ...$ } = p;
|
|
411
|
+
if (!await M.updateComment({
|
|
412
|
+
...$,
|
|
413
|
+
...r
|
|
417
414
|
}))
|
|
418
415
|
return !1;
|
|
419
|
-
const
|
|
420
|
-
id:
|
|
421
|
-
params
|
|
416
|
+
const U = {
|
|
417
|
+
id: de.id,
|
|
418
|
+
params: t
|
|
422
419
|
};
|
|
423
|
-
return
|
|
420
|
+
return a.executeCommand(U.id, U.params, { onlyLocal: !u }), !0;
|
|
424
421
|
}
|
|
425
|
-
},
|
|
422
|
+
}, Le = {
|
|
426
423
|
id: "thread-comment.command.resolve-comment",
|
|
427
|
-
type:
|
|
428
|
-
async handler(
|
|
429
|
-
if (!
|
|
424
|
+
type: I.COMMAND,
|
|
425
|
+
async handler(s, t) {
|
|
426
|
+
if (!t)
|
|
430
427
|
return !1;
|
|
431
|
-
const { unitId, subUnitId, resolved, commentId } =
|
|
432
|
-
return !
|
|
433
|
-
...
|
|
434
|
-
resolved
|
|
435
|
-
}) ? !1 :
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
{ onlyLocal: !
|
|
428
|
+
const { unitId: e, subUnitId: n, resolved: r, commentId: a } = t, o = s.get(b), u = s.get(O).getComment(e, n, a), p = o.syncUpdateMutationToColla;
|
|
429
|
+
return !u || !await o.resolveComment({
|
|
430
|
+
...u,
|
|
431
|
+
resolved: r
|
|
432
|
+
}) ? !1 : s.get(H).executeCommand(
|
|
433
|
+
ue.id,
|
|
434
|
+
t,
|
|
435
|
+
{ onlyLocal: !p }
|
|
439
436
|
);
|
|
440
437
|
}
|
|
441
|
-
},
|
|
438
|
+
}, He = {
|
|
442
439
|
id: "thread-comment.command.delete-comment",
|
|
443
|
-
type:
|
|
444
|
-
async handler(
|
|
445
|
-
if (!
|
|
440
|
+
type: I.COMMAND,
|
|
441
|
+
async handler(s, t) {
|
|
442
|
+
if (!t)
|
|
446
443
|
return !1;
|
|
447
|
-
const
|
|
448
|
-
if (!
|
|
444
|
+
const e = s.get(O), n = s.get(b), r = s.get(H), { unitId: a, subUnitId: o, commentId: M } = t, u = n.syncUpdateMutationToColla, p = e.getComment(a, o, M);
|
|
445
|
+
if (!p || !await n.deleteComment(a, o, p.threadId, M))
|
|
449
446
|
return !1;
|
|
450
|
-
const
|
|
451
|
-
id:
|
|
452
|
-
params
|
|
447
|
+
const S = {
|
|
448
|
+
id: te.id,
|
|
449
|
+
params: t
|
|
453
450
|
};
|
|
454
|
-
return
|
|
451
|
+
return r.executeCommand(S.id, S.params, { onlyLocal: !u });
|
|
455
452
|
}
|
|
456
|
-
},
|
|
453
|
+
}, We = {
|
|
457
454
|
id: "thread-comment.command.delete-comment-tree",
|
|
458
|
-
type:
|
|
459
|
-
async handler(
|
|
460
|
-
if (!
|
|
455
|
+
type: I.COMMAND,
|
|
456
|
+
async handler(s, t) {
|
|
457
|
+
if (!t)
|
|
461
458
|
return !1;
|
|
462
|
-
const
|
|
463
|
-
return !
|
|
464
|
-
unitId,
|
|
465
|
-
subUnitId,
|
|
466
|
-
commentId:
|
|
459
|
+
const e = s.get(O), n = s.get(H), r = s.get(b), { unitId: a, subUnitId: o, commentId: M } = t, u = e.getCommentWithChildren(a, o, M);
|
|
460
|
+
return !u || !await r.deleteComment(a, o, u.root.threadId, M) ? !1 : await n.executeCommand(te.id, {
|
|
461
|
+
unitId: a,
|
|
462
|
+
subUnitId: o,
|
|
463
|
+
commentId: u.root.id
|
|
467
464
|
});
|
|
468
465
|
}
|
|
469
|
-
},
|
|
470
|
-
var
|
|
471
|
-
for (var
|
|
472
|
-
(
|
|
473
|
-
return
|
|
474
|
-
},
|
|
475
|
-
let
|
|
476
|
-
constructor(
|
|
477
|
-
super(), this._config =
|
|
478
|
-
const { ...
|
|
479
|
-
this._configService.setConfig(
|
|
466
|
+
}, Ye = "thread-comment.config", Ve = {};
|
|
467
|
+
var Je = Object.defineProperty, ke = Object.getOwnPropertyDescriptor, Ge = (s, t, e, n) => {
|
|
468
|
+
for (var r = n > 1 ? void 0 : n ? ke(t, e) : t, a = s.length - 1, o; a >= 0; a--)
|
|
469
|
+
(o = s[a]) && (r = (n ? o(t, e, r) : o(r)) || r);
|
|
470
|
+
return n && r && Je(t, e, r), r;
|
|
471
|
+
}, Q = (s, t) => (e, n) => t(e, n, s), F;
|
|
472
|
+
let ie = (F = class extends Se {
|
|
473
|
+
constructor(s = Ve, t, e, n) {
|
|
474
|
+
super(), this._config = s, this._injector = t, this._commandService = e, this._configService = n;
|
|
475
|
+
const { ...r } = this._config;
|
|
476
|
+
this._configService.setConfig(Ye, r);
|
|
480
477
|
}
|
|
481
478
|
onStarting() {
|
|
482
|
-
var
|
|
483
|
-
|
|
484
|
-
[
|
|
485
|
-
[
|
|
486
|
-
[
|
|
487
|
-
], (
|
|
488
|
-
(
|
|
489
|
-
this._injector.add(
|
|
479
|
+
var s;
|
|
480
|
+
Te([
|
|
481
|
+
[b, { useClass: Ue }],
|
|
482
|
+
[O],
|
|
483
|
+
[B]
|
|
484
|
+
], (s = this._config) == null ? void 0 : s.overrides).forEach(
|
|
485
|
+
(t) => {
|
|
486
|
+
this._injector.add(t);
|
|
490
487
|
}
|
|
491
488
|
), [
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
].forEach((
|
|
503
|
-
this._commandService.registerCommand(
|
|
504
|
-
}), this._injector.get(
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
],
|
|
489
|
+
je,
|
|
490
|
+
Ae,
|
|
491
|
+
He,
|
|
492
|
+
Le,
|
|
493
|
+
We,
|
|
494
|
+
me,
|
|
495
|
+
de,
|
|
496
|
+
Pe,
|
|
497
|
+
te,
|
|
498
|
+
ue
|
|
499
|
+
].forEach((t) => {
|
|
500
|
+
this._commandService.registerCommand(t);
|
|
501
|
+
}), this._injector.get(B);
|
|
502
|
+
}
|
|
503
|
+
}, E(F, "pluginName", ce), E(F, "type", $e.UNIVER_UNKNOWN), F);
|
|
504
|
+
ie = Ge([
|
|
505
|
+
Q(1, Z(De)),
|
|
506
|
+
Q(2, H),
|
|
507
|
+
Q(3, Oe)
|
|
508
|
+
], ie);
|
|
509
|
+
var Fe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
510
|
+
function Ze(s) {
|
|
511
|
+
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
|
|
512
|
+
}
|
|
513
|
+
var he = { exports: {} };
|
|
514
|
+
(function(s, t) {
|
|
515
|
+
(function(e, n) {
|
|
516
|
+
s.exports = n();
|
|
517
|
+
})(Fe, function() {
|
|
518
|
+
var e = 1e3, n = 6e4, r = 36e5, a = "millisecond", o = "second", M = "minute", u = "hour", p = "day", S = "week", $ = "month", N = "quarter", U = "year", A = "date", ne = "Invalid Date", le = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, fe = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, pe = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(h) {
|
|
519
|
+
var m = ["th", "st", "nd", "rd"], i = h % 100;
|
|
520
|
+
return "[" + h + (m[(i - 20) % 10] || m[i] || m[0]) + "]";
|
|
521
|
+
} }, K = function(h, m, i) {
|
|
522
|
+
var d = String(h);
|
|
523
|
+
return !d || d.length >= m ? h : "" + Array(m + 1 - d.length).join(i) + h;
|
|
524
|
+
}, Me = { s: K, z: function(h) {
|
|
525
|
+
var m = -h.utcOffset(), i = Math.abs(m), d = Math.floor(i / 60), c = i % 60;
|
|
526
|
+
return (m <= 0 ? "+" : "-") + K(d, 2, "0") + ":" + K(c, 2, "0");
|
|
527
|
+
}, m: function h(m, i) {
|
|
528
|
+
if (m.date() < i.date()) return -h(i, m);
|
|
529
|
+
var d = 12 * (i.year() - m.year()) + (i.month() - m.month()), c = m.clone().add(d, $), l = i - c < 0, f = m.clone().add(d + (l ? -1 : 1), $);
|
|
530
|
+
return +(-(d + (i - c) / (l ? c - f : f - c)) || 0);
|
|
531
|
+
}, a: function(h) {
|
|
532
|
+
return h < 0 ? Math.ceil(h) || 0 : Math.floor(h);
|
|
533
|
+
}, p: function(h) {
|
|
534
|
+
return { M: $, y: U, w: S, d: p, D: A, h: u, m: M, s: o, ms: a, Q: N }[h] || String(h || "").toLowerCase().replace(/s$/, "");
|
|
535
|
+
}, u: function(h) {
|
|
536
|
+
return h === void 0;
|
|
537
|
+
} }, W = "en", x = {};
|
|
538
|
+
x[W] = pe;
|
|
539
|
+
var re = "$isDayjsObject", z = function(h) {
|
|
540
|
+
return h instanceof k || !(!h || !h[re]);
|
|
541
|
+
}, J = function h(m, i, d) {
|
|
542
|
+
var c;
|
|
543
|
+
if (!m) return W;
|
|
544
|
+
if (typeof m == "string") {
|
|
545
|
+
var l = m.toLowerCase();
|
|
546
|
+
x[l] && (c = l), i && (x[l] = i, c = l);
|
|
547
|
+
var f = m.split("-");
|
|
548
|
+
if (!c && f.length > 1) return h(f[0]);
|
|
549
|
+
} else {
|
|
550
|
+
var _ = m.name;
|
|
551
|
+
x[_] = m, c = _;
|
|
552
|
+
}
|
|
553
|
+
return !d && c && (W = c), c || !d && W;
|
|
554
|
+
}, g = function(h, m) {
|
|
555
|
+
if (z(h)) return h.clone();
|
|
556
|
+
var i = typeof m == "object" ? m : {};
|
|
557
|
+
return i.date = h, i.args = arguments, new k(i);
|
|
558
|
+
}, C = Me;
|
|
559
|
+
C.l = J, C.i = z, C.w = function(h, m) {
|
|
560
|
+
return g(h, { locale: m.$L, utc: m.$u, x: m.$x, $offset: m.$offset });
|
|
561
|
+
};
|
|
562
|
+
var k = function() {
|
|
563
|
+
function h(i) {
|
|
564
|
+
this.$L = J(i.locale, null, !0), this.parse(i), this.$x = this.$x || i.x || {}, this[re] = !0;
|
|
565
|
+
}
|
|
566
|
+
var m = h.prototype;
|
|
567
|
+
return m.parse = function(i) {
|
|
568
|
+
this.$d = function(d) {
|
|
569
|
+
var c = d.date, l = d.utc;
|
|
570
|
+
if (c === null) return /* @__PURE__ */ new Date(NaN);
|
|
571
|
+
if (C.u(c)) return /* @__PURE__ */ new Date();
|
|
572
|
+
if (c instanceof Date) return new Date(c);
|
|
573
|
+
if (typeof c == "string" && !/Z$/i.test(c)) {
|
|
574
|
+
var f = c.match(le);
|
|
575
|
+
if (f) {
|
|
576
|
+
var _ = f[2] - 1 || 0, v = (f[7] || "0").substring(0, 3);
|
|
577
|
+
return l ? new Date(Date.UTC(f[1], _, f[3] || 1, f[4] || 0, f[5] || 0, f[6] || 0, v)) : new Date(f[1], _, f[3] || 1, f[4] || 0, f[5] || 0, f[6] || 0, v);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
return new Date(c);
|
|
581
|
+
}(i), this.init();
|
|
582
|
+
}, m.init = function() {
|
|
583
|
+
var i = this.$d;
|
|
584
|
+
this.$y = i.getFullYear(), this.$M = i.getMonth(), this.$D = i.getDate(), this.$W = i.getDay(), this.$H = i.getHours(), this.$m = i.getMinutes(), this.$s = i.getSeconds(), this.$ms = i.getMilliseconds();
|
|
585
|
+
}, m.$utils = function() {
|
|
586
|
+
return C;
|
|
587
|
+
}, m.isValid = function() {
|
|
588
|
+
return this.$d.toString() !== ne;
|
|
589
|
+
}, m.isSame = function(i, d) {
|
|
590
|
+
var c = g(i);
|
|
591
|
+
return this.startOf(d) <= c && c <= this.endOf(d);
|
|
592
|
+
}, m.isAfter = function(i, d) {
|
|
593
|
+
return g(i) < this.startOf(d);
|
|
594
|
+
}, m.isBefore = function(i, d) {
|
|
595
|
+
return this.endOf(d) < g(i);
|
|
596
|
+
}, m.$g = function(i, d, c) {
|
|
597
|
+
return C.u(i) ? this[d] : this.set(c, i);
|
|
598
|
+
}, m.unix = function() {
|
|
599
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
600
|
+
}, m.valueOf = function() {
|
|
601
|
+
return this.$d.getTime();
|
|
602
|
+
}, m.startOf = function(i, d) {
|
|
603
|
+
var c = this, l = !!C.u(d) || d, f = C.p(i), _ = function(j, D) {
|
|
604
|
+
var R = C.w(c.$u ? Date.UTC(c.$y, D, j) : new Date(c.$y, D, j), c);
|
|
605
|
+
return l ? R : R.endOf(p);
|
|
606
|
+
}, v = function(j, D) {
|
|
607
|
+
return C.w(c.toDate()[j].apply(c.toDate("s"), (l ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(D)), c);
|
|
608
|
+
}, y = this.$W, T = this.$M, w = this.$D, L = "set" + (this.$u ? "UTC" : "");
|
|
609
|
+
switch (f) {
|
|
610
|
+
case U:
|
|
611
|
+
return l ? _(1, 0) : _(31, 11);
|
|
612
|
+
case $:
|
|
613
|
+
return l ? _(1, T) : _(0, T + 1);
|
|
614
|
+
case S:
|
|
615
|
+
var P = this.$locale().weekStart || 0, Y = (y < P ? y + 7 : y) - P;
|
|
616
|
+
return _(l ? w - Y : w + (6 - Y), T);
|
|
617
|
+
case p:
|
|
618
|
+
case A:
|
|
619
|
+
return v(L + "Hours", 0);
|
|
620
|
+
case u:
|
|
621
|
+
return v(L + "Minutes", 1);
|
|
622
|
+
case M:
|
|
623
|
+
return v(L + "Seconds", 2);
|
|
624
|
+
case o:
|
|
625
|
+
return v(L + "Milliseconds", 3);
|
|
626
|
+
default:
|
|
627
|
+
return this.clone();
|
|
628
|
+
}
|
|
629
|
+
}, m.endOf = function(i) {
|
|
630
|
+
return this.startOf(i, !1);
|
|
631
|
+
}, m.$set = function(i, d) {
|
|
632
|
+
var c, l = C.p(i), f = "set" + (this.$u ? "UTC" : ""), _ = (c = {}, c[p] = f + "Date", c[A] = f + "Date", c[$] = f + "Month", c[U] = f + "FullYear", c[u] = f + "Hours", c[M] = f + "Minutes", c[o] = f + "Seconds", c[a] = f + "Milliseconds", c)[l], v = l === p ? this.$D + (d - this.$W) : d;
|
|
633
|
+
if (l === $ || l === U) {
|
|
634
|
+
var y = this.clone().set(A, 1);
|
|
635
|
+
y.$d[_](v), y.init(), this.$d = y.set(A, Math.min(this.$D, y.daysInMonth())).$d;
|
|
636
|
+
} else _ && this.$d[_](v);
|
|
637
|
+
return this.init(), this;
|
|
638
|
+
}, m.set = function(i, d) {
|
|
639
|
+
return this.clone().$set(i, d);
|
|
640
|
+
}, m.get = function(i) {
|
|
641
|
+
return this[C.p(i)]();
|
|
642
|
+
}, m.add = function(i, d) {
|
|
643
|
+
var c, l = this;
|
|
644
|
+
i = Number(i);
|
|
645
|
+
var f = C.p(d), _ = function(T) {
|
|
646
|
+
var w = g(l);
|
|
647
|
+
return C.w(w.date(w.date() + Math.round(T * i)), l);
|
|
648
|
+
};
|
|
649
|
+
if (f === $) return this.set($, this.$M + i);
|
|
650
|
+
if (f === U) return this.set(U, this.$y + i);
|
|
651
|
+
if (f === p) return _(1);
|
|
652
|
+
if (f === S) return _(7);
|
|
653
|
+
var v = (c = {}, c[M] = n, c[u] = r, c[o] = e, c)[f] || 1, y = this.$d.getTime() + i * v;
|
|
654
|
+
return C.w(y, this);
|
|
655
|
+
}, m.subtract = function(i, d) {
|
|
656
|
+
return this.add(-1 * i, d);
|
|
657
|
+
}, m.format = function(i) {
|
|
658
|
+
var d = this, c = this.$locale();
|
|
659
|
+
if (!this.isValid()) return c.invalidDate || ne;
|
|
660
|
+
var l = i || "YYYY-MM-DDTHH:mm:ssZ", f = C.z(this), _ = this.$H, v = this.$m, y = this.$M, T = c.weekdays, w = c.months, L = c.meridiem, P = function(D, R, V, G) {
|
|
661
|
+
return D && (D[R] || D(d, l)) || V[R].slice(0, G);
|
|
662
|
+
}, Y = function(D) {
|
|
663
|
+
return C.s(_ % 12 || 12, D, "0");
|
|
664
|
+
}, j = L || function(D, R, V) {
|
|
665
|
+
var G = D < 12 ? "AM" : "PM";
|
|
666
|
+
return V ? G.toLowerCase() : G;
|
|
667
|
+
};
|
|
668
|
+
return l.replace(fe, function(D, R) {
|
|
669
|
+
return R || function(V) {
|
|
670
|
+
switch (V) {
|
|
671
|
+
case "YY":
|
|
672
|
+
return String(d.$y).slice(-2);
|
|
673
|
+
case "YYYY":
|
|
674
|
+
return C.s(d.$y, 4, "0");
|
|
675
|
+
case "M":
|
|
676
|
+
return y + 1;
|
|
677
|
+
case "MM":
|
|
678
|
+
return C.s(y + 1, 2, "0");
|
|
679
|
+
case "MMM":
|
|
680
|
+
return P(c.monthsShort, y, w, 3);
|
|
681
|
+
case "MMMM":
|
|
682
|
+
return P(w, y);
|
|
683
|
+
case "D":
|
|
684
|
+
return d.$D;
|
|
685
|
+
case "DD":
|
|
686
|
+
return C.s(d.$D, 2, "0");
|
|
687
|
+
case "d":
|
|
688
|
+
return String(d.$W);
|
|
689
|
+
case "dd":
|
|
690
|
+
return P(c.weekdaysMin, d.$W, T, 2);
|
|
691
|
+
case "ddd":
|
|
692
|
+
return P(c.weekdaysShort, d.$W, T, 3);
|
|
693
|
+
case "dddd":
|
|
694
|
+
return T[d.$W];
|
|
695
|
+
case "H":
|
|
696
|
+
return String(_);
|
|
697
|
+
case "HH":
|
|
698
|
+
return C.s(_, 2, "0");
|
|
699
|
+
case "h":
|
|
700
|
+
return Y(1);
|
|
701
|
+
case "hh":
|
|
702
|
+
return Y(2);
|
|
703
|
+
case "a":
|
|
704
|
+
return j(_, v, !0);
|
|
705
|
+
case "A":
|
|
706
|
+
return j(_, v, !1);
|
|
707
|
+
case "m":
|
|
708
|
+
return String(v);
|
|
709
|
+
case "mm":
|
|
710
|
+
return C.s(v, 2, "0");
|
|
711
|
+
case "s":
|
|
712
|
+
return String(d.$s);
|
|
713
|
+
case "ss":
|
|
714
|
+
return C.s(d.$s, 2, "0");
|
|
715
|
+
case "SSS":
|
|
716
|
+
return C.s(d.$ms, 3, "0");
|
|
717
|
+
case "Z":
|
|
718
|
+
return f;
|
|
719
|
+
}
|
|
720
|
+
return null;
|
|
721
|
+
}(D) || f.replace(":", "");
|
|
722
|
+
});
|
|
723
|
+
}, m.utcOffset = function() {
|
|
724
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
725
|
+
}, m.diff = function(i, d, c) {
|
|
726
|
+
var l, f = this, _ = C.p(d), v = g(i), y = (v.utcOffset() - this.utcOffset()) * n, T = this - v, w = function() {
|
|
727
|
+
return C.m(f, v);
|
|
728
|
+
};
|
|
729
|
+
switch (_) {
|
|
730
|
+
case U:
|
|
731
|
+
l = w() / 12;
|
|
732
|
+
break;
|
|
733
|
+
case $:
|
|
734
|
+
l = w();
|
|
735
|
+
break;
|
|
736
|
+
case N:
|
|
737
|
+
l = w() / 3;
|
|
738
|
+
break;
|
|
739
|
+
case S:
|
|
740
|
+
l = (T - y) / 6048e5;
|
|
741
|
+
break;
|
|
742
|
+
case p:
|
|
743
|
+
l = (T - y) / 864e5;
|
|
744
|
+
break;
|
|
745
|
+
case u:
|
|
746
|
+
l = T / r;
|
|
747
|
+
break;
|
|
748
|
+
case M:
|
|
749
|
+
l = T / n;
|
|
750
|
+
break;
|
|
751
|
+
case o:
|
|
752
|
+
l = T / e;
|
|
753
|
+
break;
|
|
754
|
+
default:
|
|
755
|
+
l = T;
|
|
756
|
+
}
|
|
757
|
+
return c ? l : C.a(l);
|
|
758
|
+
}, m.daysInMonth = function() {
|
|
759
|
+
return this.endOf($).$D;
|
|
760
|
+
}, m.$locale = function() {
|
|
761
|
+
return x[this.$L];
|
|
762
|
+
}, m.locale = function(i, d) {
|
|
763
|
+
if (!i) return this.$L;
|
|
764
|
+
var c = this.clone(), l = J(i, d, !0);
|
|
765
|
+
return l && (c.$L = l), c;
|
|
766
|
+
}, m.clone = function() {
|
|
767
|
+
return C.w(this.$d, this);
|
|
768
|
+
}, m.toDate = function() {
|
|
769
|
+
return new Date(this.valueOf());
|
|
770
|
+
}, m.toJSON = function() {
|
|
771
|
+
return this.isValid() ? this.toISOString() : null;
|
|
772
|
+
}, m.toISOString = function() {
|
|
773
|
+
return this.$d.toISOString();
|
|
774
|
+
}, m.toString = function() {
|
|
775
|
+
return this.$d.toUTCString();
|
|
776
|
+
}, h;
|
|
777
|
+
}(), oe = k.prototype;
|
|
778
|
+
return g.prototype = oe, [["$ms", a], ["$s", o], ["$m", M], ["$H", u], ["$W", p], ["$M", $], ["$y", U], ["$D", A]].forEach(function(h) {
|
|
779
|
+
oe[h[1]] = function(m) {
|
|
780
|
+
return this.$g(m, h[0], h[1]);
|
|
781
|
+
};
|
|
782
|
+
}), g.extend = function(h, m) {
|
|
783
|
+
return h.$i || (h(m, k, g), h.$i = !0), g;
|
|
784
|
+
}, g.locale = J, g.isDayjs = z, g.unix = function(h) {
|
|
785
|
+
return g(1e3 * h);
|
|
786
|
+
}, g.en = x[W], g.Ls = x, g.p = {}, g;
|
|
787
|
+
});
|
|
788
|
+
})(he);
|
|
789
|
+
var Be = he.exports;
|
|
790
|
+
const Ke = /* @__PURE__ */ Ze(Be);
|
|
791
|
+
function Xe() {
|
|
792
|
+
return Ke().format("YYYY/MM/DD HH:mm");
|
|
793
|
+
}
|
|
512
794
|
export {
|
|
513
|
-
AddCommentCommand,
|
|
514
|
-
AddCommentMutation,
|
|
515
|
-
DeleteCommentCommand,
|
|
516
|
-
DeleteCommentMutation,
|
|
517
|
-
DeleteCommentTreeCommand,
|
|
518
|
-
IThreadCommentDataSourceService,
|
|
519
|
-
ResolveCommentCommand,
|
|
520
|
-
ResolveCommentMutation,
|
|
521
|
-
TC_PLUGIN_NAME,
|
|
522
|
-
ThreadCommentDataSourceService,
|
|
523
|
-
ThreadCommentModel,
|
|
524
|
-
ThreadCommentResourceController,
|
|
525
|
-
UniverThreadCommentPlugin,
|
|
526
|
-
UpdateCommentCommand,
|
|
527
|
-
UpdateCommentMutation,
|
|
528
|
-
UpdateCommentRefMutation
|
|
795
|
+
je as AddCommentCommand,
|
|
796
|
+
me as AddCommentMutation,
|
|
797
|
+
He as DeleteCommentCommand,
|
|
798
|
+
te as DeleteCommentMutation,
|
|
799
|
+
We as DeleteCommentTreeCommand,
|
|
800
|
+
b as IThreadCommentDataSourceService,
|
|
801
|
+
Le as ResolveCommentCommand,
|
|
802
|
+
ue as ResolveCommentMutation,
|
|
803
|
+
ce as TC_PLUGIN_NAME,
|
|
804
|
+
Ue as ThreadCommentDataSourceService,
|
|
805
|
+
O as ThreadCommentModel,
|
|
806
|
+
B as ThreadCommentResourceController,
|
|
807
|
+
ie as UniverThreadCommentPlugin,
|
|
808
|
+
Ae as UpdateCommentCommand,
|
|
809
|
+
de as UpdateCommentMutation,
|
|
810
|
+
Pe as UpdateCommentRefMutation,
|
|
811
|
+
Xe as getDT
|
|
529
812
|
};
|