@univerjs/action-recorder 0.16.1 → 0.17.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 +190 -188
- package/lib/index.js +190 -188
- package/lib/types/commands/commands/commands.spec.d.ts +16 -0
- package/lib/types/commands/operations/operation.spec.d.ts +16 -0
- package/lib/types/controllers/action-recorder.controller.spec.d.ts +16 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/plugin.d.ts +3 -1
- package/lib/types/services/action-recorder.service.spec.d.ts +16 -0
- package/lib/types/services/replay.service.spec.d.ts +16 -0
- package/lib/types/views/components/RecorderPanel.spec.d.ts +16 -0
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
- /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
- /package/lib/types/{controllers → menu}/action-recorder.menu.d.ts +0 -0
package/lib/index.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Disposable as P, CommandType as m, ICommandService as
|
|
5
|
-
import { useRef as
|
|
6
|
-
import { SetSelectionsOperation as A, CopySheetCommand as
|
|
7
|
-
import { SetSheetFilterRangeCommand as
|
|
8
|
-
import { SetRangeBoldCommand as
|
|
9
|
-
import { ILocalFileService as
|
|
10
|
-
import { BehaviorSubject as
|
|
11
|
-
import { MessageType as
|
|
12
|
-
import { jsx as g, jsxs as
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
var oe = Object.defineProperty;
|
|
2
|
+
var ie = (e, t, r) => t in e ? oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var d = (e, t, r) => ie(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { Disposable as P, CommandType as m, ICommandService as $, ILogService as J, IUniverInstanceService as G, awaitTime as ce, Inject as w, Injector as Z, IConfigService as ae, Plugin as se, merge as de } from "@univerjs/core";
|
|
5
|
+
import { useRef as le, createElement as K, forwardRef as me, useCallback as R } from "react";
|
|
6
|
+
import { SetSelectionsOperation as A, CopySheetCommand as ue, DeleteRangeMoveLeftCommand as he, DeleteRangeMoveUpCommand as ge, DeltaColumnWidthCommand as fe, DeltaRowHeightCommand as pe, InsertSheetCommand as Se, InsertColAfterCommand as ve, InsertColBeforeCommand as Ce, InsertRowAfterCommand as _e, InsertRowBeforeCommand as ye, RemoveSheetCommand as Re, SetStyleCommand as Ie, AddWorksheetMergeCommand as Oe, AddWorksheetMergeAllCommand as we, AddWorksheetMergeVerticalCommand as Me, AddWorksheetMergeHorizontalCommand as $e, SetFrozenCommand as xe, CancelFrozenCommand as Ne, SetHorizontalTextAlignCommand as Ue, SetOverlineCommand as Ae, SetRangeValuesCommand as be, SetStrikeThroughCommand as Fe, SetTextColorCommand as Pe, SetTextRotationCommand as Te, SetTextWrapCommand as De, SetVerticalTextAlignCommand as Ee, AutoFillCommand as Le, RefillCommand as je, SetWorksheetActivateCommand as ke, SetWorksheetActiveOperation as Be } from "@univerjs/sheets";
|
|
7
|
+
import { SetSheetFilterRangeCommand as Ve, SetSheetsFilterCriteriaCommand as We, RemoveSheetFilterCommand as ze } from "@univerjs/sheets-filter";
|
|
8
|
+
import { SetRangeBoldCommand as He, SetRangeFontFamilyCommand as Je, SetRangeFontSizeCommand as Ge, SetRangeItalicCommand as Ze, SetRangeStrickThroughCommand as Ke, SetRangeSubscriptCommand as Ye, SetRangeSuperscriptCommand as qe, SetRangeTextColorCommand as Qe, SetRangeUnderlineCommand as Xe, SheetCopyCommand as et, SheetCutCommand as tt, SheetPasteBesidesBorderCommand as rt, SheetPasteColWidthCommand as nt, SheetPasteCommand as ot, SheetPasteFormatCommand as it, SheetPasteShortKeyCommand as ct, SheetPasteValueCommand as at } from "@univerjs/sheets-ui";
|
|
9
|
+
import { ILocalFileService as Y, IMessageService as x, RibbonOthersGroup as st, MenuItemType as y, useDependency as b, useObservable as F, IUIPartsService as dt, IMenuManagerService as lt, ComponentManager as mt, BuiltInUIPart as ut, connectInjector as ht } from "@univerjs/ui";
|
|
10
|
+
import { BehaviorSubject as I } from "rxjs";
|
|
11
|
+
import { MessageType as N, Button as U } from "@univerjs/design";
|
|
12
|
+
import { jsx as g, jsxs as B } from "react/jsx-runtime";
|
|
13
|
+
const gt = "@univerjs/action-recorder", ft = "0.17.0", V = {
|
|
14
|
+
name: gt,
|
|
15
|
+
version: ft
|
|
16
|
+
}, pt = "action-recorder.config", W = {};
|
|
17
|
+
function q({ ref: e, ...t }) {
|
|
18
|
+
const { icon: r, id: n, className: o, extend: i, ...c } = t, a = `univerjs-icon univerjs-icon-${n} ${o || ""}`.trim(), u = le(`_${Ct()}`);
|
|
19
|
+
return Q(r, `${n}`, {
|
|
16
20
|
defIds: r.defIds,
|
|
17
21
|
idSuffix: u.current
|
|
18
22
|
}, {
|
|
@@ -21,14 +25,14 @@ function Y({ ref: e, ...t }) {
|
|
|
21
25
|
...c
|
|
22
26
|
}, i);
|
|
23
27
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
28
|
+
function Q(e, t, r, n, o) {
|
|
29
|
+
return K(e.tag, {
|
|
26
30
|
key: t,
|
|
27
|
-
...
|
|
31
|
+
...St(e, r, o),
|
|
28
32
|
...n
|
|
29
|
-
}, (
|
|
33
|
+
}, (vt(e, r).children || []).map((i, c) => Q(i, `${t}-${e.tag}-${c}`, r, void 0, o)));
|
|
30
34
|
}
|
|
31
|
-
function
|
|
35
|
+
function St(e, t, r) {
|
|
32
36
|
const n = { ...e.attrs };
|
|
33
37
|
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1), e.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(([i, c]) => {
|
|
34
38
|
i === "mask" && typeof c == "string" && (n[i] = c.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
@@ -38,7 +42,7 @@ function ht(e, t, r) {
|
|
|
38
42
|
typeof c == "string" && (n[i] = c.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
39
43
|
})), n;
|
|
40
44
|
}
|
|
41
|
-
function
|
|
45
|
+
function vt(e, t) {
|
|
42
46
|
var n;
|
|
43
47
|
const { defIds: r } = t;
|
|
44
48
|
return !r || r.length === 0 ? e : e.tag === "defs" && ((n = e.children) != null && n.length) ? {
|
|
@@ -52,11 +56,11 @@ function gt(e, t) {
|
|
|
52
56
|
} : o)
|
|
53
57
|
} : e;
|
|
54
58
|
}
|
|
55
|
-
function
|
|
59
|
+
function Ct() {
|
|
56
60
|
return Math.random().toString(36).substring(2, 8);
|
|
57
61
|
}
|
|
58
|
-
|
|
59
|
-
const
|
|
62
|
+
q.displayName = "UniverIcon";
|
|
63
|
+
const _t = {
|
|
60
64
|
tag: "svg",
|
|
61
65
|
attrs: {
|
|
62
66
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -99,31 +103,31 @@ const pt = {
|
|
|
99
103
|
}]
|
|
100
104
|
}],
|
|
101
105
|
defIds: ["record-icon_clip0_1559_19"]
|
|
102
|
-
}, T =
|
|
103
|
-
return
|
|
106
|
+
}, T = me(function(t, r) {
|
|
107
|
+
return K(q, Object.assign({}, t, {
|
|
104
108
|
id: "record-icon",
|
|
105
109
|
ref: r,
|
|
106
|
-
icon:
|
|
110
|
+
icon: _t
|
|
107
111
|
}));
|
|
108
112
|
});
|
|
109
113
|
T.displayName = "RecordIcon";
|
|
110
|
-
var
|
|
111
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
114
|
+
var yt = Object.getOwnPropertyDescriptor, Rt = (e, t, r, n) => {
|
|
115
|
+
for (var o = n > 1 ? void 0 : n ? yt(t, r) : t, i = e.length - 1, c; i >= 0; i--)
|
|
112
116
|
(c = e[i]) && (o = c(o) || o);
|
|
113
117
|
return o;
|
|
114
|
-
},
|
|
115
|
-
let
|
|
118
|
+
}, O = (e, t) => (r, n) => t(r, n, e);
|
|
119
|
+
let l = class extends P {
|
|
116
120
|
constructor(t, r, n, o) {
|
|
117
121
|
super();
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
d(this, "_shouldRecordCommands", /* @__PURE__ */ new Set());
|
|
123
|
+
d(this, "_panelOpened$", new I(!1));
|
|
124
|
+
d(this, "panelOpened$", this._panelOpened$.asObservable());
|
|
125
|
+
d(this, "_recorder", null);
|
|
126
|
+
d(this, "_recording$", new I(!1));
|
|
127
|
+
d(this, "recording$", this._recording$.asObservable());
|
|
128
|
+
d(this, "_recorded$", new I([]));
|
|
129
|
+
d(this, "_recordedCommands$", new I([]));
|
|
130
|
+
d(this, "recordedCommands$", this._recordedCommands$.asObservable());
|
|
127
131
|
this._commandSrv = t, this._logService = r, this._localFileService = n, this._instanceService = o;
|
|
128
132
|
}
|
|
129
133
|
get recording() {
|
|
@@ -172,27 +176,27 @@ let d = class extends P {
|
|
|
172
176
|
this._localFileService.downloadFile(new Blob([JSON.stringify(t, null, 2)]), "recorded-commands.json"), this._logService.error("Recorded commands:", t), this.stopRecording();
|
|
173
177
|
}
|
|
174
178
|
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
],
|
|
181
|
-
const
|
|
179
|
+
l = Rt([
|
|
180
|
+
O(0, $),
|
|
181
|
+
O(1, J),
|
|
182
|
+
O(2, Y),
|
|
183
|
+
O(3, G)
|
|
184
|
+
], l);
|
|
185
|
+
const X = {
|
|
182
186
|
id: "action-recorder.command.start-recording",
|
|
183
187
|
type: m.COMMAND,
|
|
184
|
-
handler: (e, t) => (e.get(
|
|
185
|
-
},
|
|
188
|
+
handler: (e, t) => (e.get(l).startRecording(!!(t != null && t.replaceId)), !0)
|
|
189
|
+
}, ee = {
|
|
186
190
|
id: "action-recorder.command.complete-recording",
|
|
187
191
|
type: m.COMMAND,
|
|
188
|
-
handler: (e) => (e.get(
|
|
189
|
-
},
|
|
192
|
+
handler: (e) => (e.get(l).completeRecording(), !0)
|
|
193
|
+
}, te = {
|
|
190
194
|
id: "action-recorder.command.stop-recording",
|
|
191
195
|
type: m.COMMAND,
|
|
192
|
-
handler: (e) => (e.get(
|
|
196
|
+
handler: (e) => (e.get(l).completeRecording(), !0)
|
|
193
197
|
};
|
|
194
|
-
var
|
|
195
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
198
|
+
var It = Object.getOwnPropertyDescriptor, Ot = (e, t, r, n) => {
|
|
199
|
+
for (var o = n > 1 ? void 0 : n ? It(t, r) : t, i = e.length - 1, c; i >= 0; i--)
|
|
196
200
|
(c = e[i]) && (o = c(o) || o);
|
|
197
201
|
return o;
|
|
198
202
|
}, C = (e, t) => (r, n) => t(r, n, e), D = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.NAME = "name", e.ACTIVE = "active", e))(D || {});
|
|
@@ -211,7 +215,7 @@ let f = class extends P {
|
|
|
211
215
|
return this.replayCommands(JSON.parse(await r.text()), { mode: e });
|
|
212
216
|
} catch {
|
|
213
217
|
return this._messageService.show({
|
|
214
|
-
type:
|
|
218
|
+
type: N.Error,
|
|
215
219
|
content: `Failed to replay commands from local file ${r.name}.`
|
|
216
220
|
}), !1;
|
|
217
221
|
}
|
|
@@ -251,7 +255,7 @@ let f = class extends P {
|
|
|
251
255
|
const t = (r = this._instanceService.getFocusedUnit()) == null ? void 0 : r.getUnitId();
|
|
252
256
|
t || this._logService.error("[ReplayService]", "no focused unit to replay commands");
|
|
253
257
|
for (const n of e) {
|
|
254
|
-
await
|
|
258
|
+
await ce(wt());
|
|
255
259
|
const { id: o, params: i } = n;
|
|
256
260
|
if (i) {
|
|
257
261
|
if (typeof i.unitId < "u" && (i.unitId = t), !await this._commandService.executeCommand(o, i)) return !1;
|
|
@@ -260,14 +264,14 @@ let f = class extends P {
|
|
|
260
264
|
return !0;
|
|
261
265
|
}
|
|
262
266
|
};
|
|
263
|
-
f =
|
|
264
|
-
C(0,
|
|
265
|
-
C(1,
|
|
266
|
-
C(2,
|
|
267
|
-
C(3,
|
|
268
|
-
C(4,
|
|
267
|
+
f = Ot([
|
|
268
|
+
C(0, x),
|
|
269
|
+
C(1, G),
|
|
270
|
+
C(2, Y),
|
|
271
|
+
C(3, J),
|
|
272
|
+
C(4, $)
|
|
269
273
|
], f);
|
|
270
|
-
function
|
|
274
|
+
function wt() {
|
|
271
275
|
return Math.floor(Math.random() * 800) + 200;
|
|
272
276
|
}
|
|
273
277
|
const E = {
|
|
@@ -275,8 +279,8 @@ const E = {
|
|
|
275
279
|
type: m.COMMAND,
|
|
276
280
|
handler: async (e) => {
|
|
277
281
|
const r = await e.get(f).replayLocalJSON();
|
|
278
|
-
return r && e.get(
|
|
279
|
-
type:
|
|
282
|
+
return r && e.get(x).show({
|
|
283
|
+
type: N.Success,
|
|
280
284
|
content: "Successfully replayed local records"
|
|
281
285
|
}), r;
|
|
282
286
|
}
|
|
@@ -285,8 +289,8 @@ const E = {
|
|
|
285
289
|
type: m.COMMAND,
|
|
286
290
|
handler: async (e) => {
|
|
287
291
|
const r = await e.get(f).replayLocalJSON(D.NAME);
|
|
288
|
-
return r && e.get(
|
|
289
|
-
type:
|
|
292
|
+
return r && e.get(x).show({
|
|
293
|
+
type: N.Success,
|
|
290
294
|
content: "Successfully replayed local records"
|
|
291
295
|
}), r;
|
|
292
296
|
}
|
|
@@ -295,165 +299,163 @@ const E = {
|
|
|
295
299
|
type: m.COMMAND,
|
|
296
300
|
handler: async (e) => {
|
|
297
301
|
const r = await e.get(f).replayLocalJSON(D.ACTIVE);
|
|
298
|
-
return r && e.get(
|
|
299
|
-
type:
|
|
302
|
+
return r && e.get(x).show({
|
|
303
|
+
type: N.Success,
|
|
300
304
|
content: "Successfully replayed local records"
|
|
301
305
|
}), r;
|
|
302
306
|
}
|
|
303
|
-
},
|
|
307
|
+
}, k = {
|
|
304
308
|
id: "action-recorder.operation.open-panel",
|
|
305
309
|
type: m.OPERATION,
|
|
306
310
|
handler(e) {
|
|
307
|
-
return e.get(
|
|
311
|
+
return e.get(l).togglePanel(!0), !0;
|
|
308
312
|
}
|
|
309
|
-
},
|
|
313
|
+
}, re = {
|
|
310
314
|
id: "action-recorder.operation.close-panel",
|
|
311
315
|
type: m.OPERATION,
|
|
312
316
|
handler(e) {
|
|
313
|
-
return e.get(
|
|
317
|
+
return e.get(l).togglePanel(!1), !0;
|
|
314
318
|
}
|
|
315
|
-
};
|
|
316
|
-
function
|
|
317
|
-
const e = b(d);
|
|
318
|
-
return F(e.panelOpened$) ? /* @__PURE__ */ g(It, {}) : null;
|
|
319
|
-
}
|
|
320
|
-
function It() {
|
|
321
|
-
var s;
|
|
322
|
-
const e = b(M), t = b(d), r = F(t.recording$), n = F(t.recordedCommands$), o = (s = n == null ? void 0 : n.length) != null ? s : 0, i = y(() => {
|
|
323
|
-
r || e.executeCommand(te.id);
|
|
324
|
-
}, [e, r]), c = y((S) => {
|
|
325
|
-
r || e.executeCommand(Q.id, { replaceId: S });
|
|
326
|
-
}, [e, r]), a = y(() => {
|
|
327
|
-
r && e.executeCommand(X.id);
|
|
328
|
-
}, [e, r]), u = y(() => {
|
|
329
|
-
r && e.executeCommand(ee.id);
|
|
330
|
-
}, [e, r]), h = r ? o === 0 ? "Recording..." : `${o}: ${n[o - 1].id}` : "Start Recording";
|
|
331
|
-
return /* @__PURE__ */ k(
|
|
332
|
-
"div",
|
|
333
|
-
{
|
|
334
|
-
className: "univer-fixed univer-bottom-20 univer-left-1/2 univer-z-[1000] univer-flex univer-h-16 univer-w-[512px] -univer-translate-x-1/2 univer-items-center univer-rounded-lg univer-bg-white univer-px-5 univer-shadow-lg",
|
|
335
|
-
children: [
|
|
336
|
-
/* @__PURE__ */ g("div", { className: "univer-mr-2 univer-size-5 univer-shrink-0 univer-grow-0 univer-text-xl", children: /* @__PURE__ */ g(T, {}) }),
|
|
337
|
-
/* @__PURE__ */ g("div", { className: "univer-flex-1 univer-text-sm", children: h }),
|
|
338
|
-
/* @__PURE__ */ k("div", { className: "univer-flex univer-w-64 univer-shrink-0 univer-grow-0 univer-justify-between", children: [
|
|
339
|
-
/* @__PURE__ */ g(
|
|
340
|
-
N,
|
|
341
|
-
{
|
|
342
|
-
className: "univer-w-20",
|
|
343
|
-
onClick: r ? u : i,
|
|
344
|
-
children: r ? "Cancel" : "Close"
|
|
345
|
-
}
|
|
346
|
-
),
|
|
347
|
-
/* @__PURE__ */ g(
|
|
348
|
-
N,
|
|
349
|
-
{
|
|
350
|
-
className: "univer-w-20",
|
|
351
|
-
variant: "primary",
|
|
352
|
-
onClick: r ? a : () => c(),
|
|
353
|
-
children: r ? "Save" : "Start"
|
|
354
|
-
}
|
|
355
|
-
),
|
|
356
|
-
!r && /* @__PURE__ */ g(N, { variant: "primary", onClick: () => c(!0), children: "Start(N)" })
|
|
357
|
-
] })
|
|
358
|
-
]
|
|
359
|
-
}
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
const re = "RECORD_MENU_ITEM";
|
|
363
|
-
function Ot() {
|
|
319
|
+
}, ne = "RECORD_MENU_ITEM";
|
|
320
|
+
function Mt() {
|
|
364
321
|
return {
|
|
365
|
-
id:
|
|
366
|
-
type:
|
|
322
|
+
id: ne,
|
|
323
|
+
type: y.SUBITEMS,
|
|
367
324
|
icon: "RecordIcon",
|
|
368
325
|
tooltip: "action-recorder.menu.title"
|
|
369
326
|
};
|
|
370
327
|
}
|
|
371
|
-
function
|
|
372
|
-
const t = e.get(
|
|
328
|
+
function $t(e) {
|
|
329
|
+
const t = e.get(l);
|
|
373
330
|
return {
|
|
374
|
-
id:
|
|
331
|
+
id: k.id,
|
|
375
332
|
title: "action-recorder.menu.record",
|
|
376
|
-
type:
|
|
333
|
+
type: y.BUTTON,
|
|
377
334
|
disabled$: t.panelOpened$
|
|
378
335
|
};
|
|
379
336
|
}
|
|
380
|
-
function
|
|
337
|
+
function xt() {
|
|
381
338
|
return {
|
|
382
339
|
id: E.id,
|
|
383
340
|
title: "action-recorder.menu.replay-local",
|
|
384
|
-
type:
|
|
341
|
+
type: y.BUTTON
|
|
385
342
|
};
|
|
386
343
|
}
|
|
387
|
-
function
|
|
344
|
+
function Nt() {
|
|
388
345
|
return {
|
|
389
346
|
id: L.id,
|
|
390
347
|
title: "action-recorder.menu.replay-local-name",
|
|
391
|
-
type:
|
|
348
|
+
type: y.BUTTON
|
|
392
349
|
};
|
|
393
350
|
}
|
|
394
|
-
function
|
|
351
|
+
function Ut() {
|
|
395
352
|
return {
|
|
396
353
|
id: j.id,
|
|
397
354
|
title: "action-recorder.menu.replay-local-active",
|
|
398
|
-
type:
|
|
355
|
+
type: y.BUTTON
|
|
399
356
|
};
|
|
400
357
|
}
|
|
401
|
-
const
|
|
402
|
-
[
|
|
403
|
-
[
|
|
358
|
+
const At = {
|
|
359
|
+
[st.OTHERS]: {
|
|
360
|
+
[ne]: {
|
|
404
361
|
order: 1,
|
|
405
|
-
menuItemFactory:
|
|
406
|
-
[
|
|
362
|
+
menuItemFactory: Mt,
|
|
363
|
+
[k.id]: {
|
|
407
364
|
order: 1,
|
|
408
|
-
menuItemFactory:
|
|
365
|
+
menuItemFactory: $t
|
|
409
366
|
},
|
|
410
367
|
[E.id]: {
|
|
411
368
|
order: 2,
|
|
412
|
-
menuItemFactory:
|
|
369
|
+
menuItemFactory: xt
|
|
413
370
|
},
|
|
414
371
|
[L.id]: {
|
|
415
372
|
order: 3,
|
|
416
|
-
menuItemFactory:
|
|
373
|
+
menuItemFactory: Nt
|
|
417
374
|
},
|
|
418
375
|
[j.id]: {
|
|
419
376
|
order: 4,
|
|
420
|
-
menuItemFactory:
|
|
377
|
+
menuItemFactory: Ut
|
|
421
378
|
}
|
|
422
379
|
}
|
|
423
380
|
}
|
|
424
381
|
};
|
|
425
|
-
|
|
426
|
-
|
|
382
|
+
function bt() {
|
|
383
|
+
const e = b(l);
|
|
384
|
+
return F(e.panelOpened$) ? /* @__PURE__ */ g(Ft, {}) : null;
|
|
385
|
+
}
|
|
386
|
+
function Ft() {
|
|
387
|
+
var s;
|
|
388
|
+
const e = b($), t = b(l), r = F(t.recording$), n = F(t.recordedCommands$), o = (s = n == null ? void 0 : n.length) != null ? s : 0, i = R(() => {
|
|
389
|
+
r || e.executeCommand(re.id);
|
|
390
|
+
}, [e, r]), c = R((S) => {
|
|
391
|
+
r || e.executeCommand(X.id, { replaceId: S });
|
|
392
|
+
}, [e, r]), a = R(() => {
|
|
393
|
+
r && e.executeCommand(ee.id);
|
|
394
|
+
}, [e, r]), u = R(() => {
|
|
395
|
+
r && e.executeCommand(te.id);
|
|
396
|
+
}, [e, r]), h = r ? o === 0 ? "Recording..." : `${o}: ${n[o - 1].id}` : "Start Recording";
|
|
397
|
+
return /* @__PURE__ */ B(
|
|
398
|
+
"div",
|
|
399
|
+
{
|
|
400
|
+
className: "univer-fixed univer-bottom-20 univer-left-1/2 univer-z-[1000] univer-flex univer-h-16 univer-w-[512px] -univer-translate-x-1/2 univer-items-center univer-rounded-lg univer-bg-white univer-px-5 univer-shadow-lg",
|
|
401
|
+
children: [
|
|
402
|
+
/* @__PURE__ */ g("div", { className: "univer-mr-2 univer-size-5 univer-shrink-0 univer-grow-0 univer-text-xl", children: /* @__PURE__ */ g(T, {}) }),
|
|
403
|
+
/* @__PURE__ */ g("div", { className: "univer-flex-1 univer-text-sm", children: h }),
|
|
404
|
+
/* @__PURE__ */ B("div", { className: "univer-flex univer-w-64 univer-shrink-0 univer-grow-0 univer-justify-between", children: [
|
|
405
|
+
/* @__PURE__ */ g(
|
|
406
|
+
U,
|
|
407
|
+
{
|
|
408
|
+
className: "univer-w-20",
|
|
409
|
+
onClick: r ? u : i,
|
|
410
|
+
children: r ? "Cancel" : "Close"
|
|
411
|
+
}
|
|
412
|
+
),
|
|
413
|
+
/* @__PURE__ */ g(
|
|
414
|
+
U,
|
|
415
|
+
{
|
|
416
|
+
className: "univer-w-20",
|
|
417
|
+
variant: "primary",
|
|
418
|
+
onClick: r ? a : () => c(),
|
|
419
|
+
children: r ? "Save" : "Start"
|
|
420
|
+
}
|
|
421
|
+
),
|
|
422
|
+
!r && /* @__PURE__ */ g(U, { variant: "primary", onClick: () => c(!0), children: "Start(N)" })
|
|
423
|
+
] })
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
var Pt = Object.getOwnPropertyDescriptor, Tt = (e, t, r, n) => {
|
|
429
|
+
for (var o = n > 1 ? void 0 : n ? Pt(t, r) : t, i = e.length - 1, c; i >= 0; i--)
|
|
427
430
|
(c = e[i]) && (o = c(o) || o);
|
|
428
431
|
return o;
|
|
429
432
|
}, p = (e, t) => (r, n) => t(r, n, e);
|
|
430
|
-
let
|
|
433
|
+
let M = class extends P {
|
|
431
434
|
constructor(e, t, r, n, o, i) {
|
|
432
435
|
super(), this._commandSrv = e, this._uiPartsSrv = t, this._menuManagerService = r, this._componentManager = n, this._actionRecorderService = o, this._injector = i, this._initCommands(), this._initUI(), this._initSheetsCommands(), this._initDocsCommands();
|
|
433
436
|
}
|
|
434
437
|
_initCommands() {
|
|
435
438
|
[
|
|
436
|
-
Q,
|
|
437
|
-
ee,
|
|
438
439
|
X,
|
|
439
|
-
B,
|
|
440
440
|
te,
|
|
441
|
+
ee,
|
|
442
|
+
k,
|
|
443
|
+
re,
|
|
441
444
|
E,
|
|
442
445
|
L,
|
|
443
446
|
j
|
|
444
447
|
].forEach((e) => this._commandSrv.registerCommand(e));
|
|
445
448
|
}
|
|
446
449
|
_initUI() {
|
|
447
|
-
this._uiPartsSrv.registerComponent(
|
|
450
|
+
this._uiPartsSrv.registerComponent(ut.GLOBAL, () => ht(bt, this._injector)), this.disposeWithMe(
|
|
448
451
|
this._componentManager.register("RecordIcon", T)
|
|
449
|
-
), this._menuManagerService.mergeMenu(
|
|
452
|
+
), this._menuManagerService.mergeMenu(At);
|
|
450
453
|
}
|
|
451
454
|
_initSheetsCommands() {
|
|
452
455
|
[
|
|
453
456
|
// InsertColCommand,
|
|
454
457
|
// InsertRowCommand,
|
|
455
458
|
// #region basic commands
|
|
456
|
-
me,
|
|
457
459
|
ue,
|
|
458
460
|
he,
|
|
459
461
|
ge,
|
|
@@ -469,18 +471,18 @@ let w = class extends P {
|
|
|
469
471
|
Oe,
|
|
470
472
|
we,
|
|
471
473
|
Me,
|
|
474
|
+
$e,
|
|
472
475
|
// ResetBackgroundColorCommand,
|
|
473
476
|
// ResetTextColorCommand,
|
|
474
477
|
// SetBackgroundColorCommand,
|
|
475
478
|
// SetBoldCommand,
|
|
476
479
|
// SetFontFamilyCommand,
|
|
477
480
|
// SetFontSizeCommand,
|
|
478
|
-
$e,
|
|
479
481
|
xe,
|
|
480
482
|
Ne,
|
|
481
|
-
// SetItalicCommand,
|
|
482
483
|
Ue,
|
|
483
|
-
|
|
484
|
+
// SetItalicCommand,
|
|
485
|
+
Ae,
|
|
484
486
|
He,
|
|
485
487
|
Je,
|
|
486
488
|
Ge,
|
|
@@ -489,14 +491,14 @@ let w = class extends P {
|
|
|
489
491
|
Ye,
|
|
490
492
|
qe,
|
|
491
493
|
Qe,
|
|
492
|
-
|
|
494
|
+
Xe,
|
|
493
495
|
be,
|
|
494
496
|
Fe,
|
|
495
497
|
Pe,
|
|
496
498
|
Te,
|
|
497
|
-
// SetUnderlineCommand,
|
|
498
499
|
De,
|
|
499
|
-
|
|
500
|
+
// SetUnderlineCommand,
|
|
501
|
+
Ee,
|
|
500
502
|
et,
|
|
501
503
|
tt,
|
|
502
504
|
rt,
|
|
@@ -504,9 +506,10 @@ let w = class extends P {
|
|
|
504
506
|
ot,
|
|
505
507
|
it,
|
|
506
508
|
ct,
|
|
507
|
-
|
|
509
|
+
at,
|
|
508
510
|
Le,
|
|
509
511
|
je,
|
|
512
|
+
ke,
|
|
510
513
|
Be,
|
|
511
514
|
A,
|
|
512
515
|
// #endregion
|
|
@@ -515,56 +518,55 @@ let w = class extends P {
|
|
|
515
518
|
// #region conditional formatting command
|
|
516
519
|
// #endregion
|
|
517
520
|
// #region filter command
|
|
518
|
-
ke,
|
|
519
521
|
Ve,
|
|
520
|
-
We
|
|
522
|
+
We,
|
|
523
|
+
ze
|
|
521
524
|
// #endregion
|
|
522
525
|
].forEach((e) => this._actionRecorderService.registerRecordedCommand(e));
|
|
523
526
|
}
|
|
524
527
|
_initDocsCommands() {
|
|
525
528
|
}
|
|
526
529
|
};
|
|
527
|
-
|
|
528
|
-
p(0,
|
|
529
|
-
p(1,
|
|
530
|
-
p(2,
|
|
531
|
-
p(3,
|
|
532
|
-
p(4,
|
|
533
|
-
p(5,
|
|
534
|
-
],
|
|
535
|
-
|
|
536
|
-
var
|
|
537
|
-
for (var o = n > 1 ? void 0 : n ? Ft(t, r) : t, i = e.length - 1, c; i >= 0; i--)
|
|
530
|
+
M = Tt([
|
|
531
|
+
p(0, $),
|
|
532
|
+
p(1, dt),
|
|
533
|
+
p(2, lt),
|
|
534
|
+
p(3, w(mt)),
|
|
535
|
+
p(4, w(l)),
|
|
536
|
+
p(5, w(Z))
|
|
537
|
+
], M);
|
|
538
|
+
var Dt = Object.getOwnPropertyDescriptor, Et = (e, t, r, n) => {
|
|
539
|
+
for (var o = n > 1 ? void 0 : n ? Dt(t, r) : t, i = e.length - 1, c; i >= 0; i--)
|
|
538
540
|
(c = e[i]) && (o = c(o) || o);
|
|
539
541
|
return o;
|
|
540
|
-
},
|
|
541
|
-
let
|
|
542
|
-
constructor(e =
|
|
542
|
+
}, z = (e, t) => (r, n) => t(r, n, e), _;
|
|
543
|
+
let H = (_ = class extends se {
|
|
544
|
+
constructor(e = W, t, r) {
|
|
543
545
|
super(), this._config = e, this._injector = t, this._configService = r;
|
|
544
|
-
const { menu: n, ...o } =
|
|
546
|
+
const { menu: n, ...o } = de(
|
|
545
547
|
{},
|
|
546
|
-
|
|
548
|
+
W,
|
|
547
549
|
this._config
|
|
548
550
|
);
|
|
549
|
-
n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(
|
|
551
|
+
n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(pt, o);
|
|
550
552
|
}
|
|
551
553
|
onStarting() {
|
|
552
554
|
(this._config.replayOnly ? [[f]] : [
|
|
553
|
-
[
|
|
555
|
+
[l],
|
|
554
556
|
[f],
|
|
555
|
-
[
|
|
557
|
+
[M]
|
|
556
558
|
]).forEach((t) => this._injector.add(t));
|
|
557
559
|
}
|
|
558
560
|
onSteady() {
|
|
559
|
-
this._config.replayOnly || this._injector.get(
|
|
561
|
+
this._config.replayOnly || this._injector.get(M);
|
|
560
562
|
}
|
|
561
|
-
},
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
],
|
|
563
|
+
}, d(_, "pluginName", "UNIVER_ACTION_RECORDER_PLUGIN"), d(_, "packageName", V.name), d(_, "version", V.version), _);
|
|
564
|
+
H = Et([
|
|
565
|
+
z(1, w(Z)),
|
|
566
|
+
z(2, ae)
|
|
567
|
+
], H);
|
|
566
568
|
export {
|
|
567
|
-
|
|
569
|
+
l as ActionRecorderService,
|
|
568
570
|
f as ActionReplayService,
|
|
569
|
-
|
|
571
|
+
H as UniverActionRecorderPlugin
|
|
570
572
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|