@univerjs/action-recorder 0.10.12 → 0.10.13
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 +278 -235
- package/lib/index.js +278 -235
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
package/lib/es/index.js
CHANGED
|
@@ -1,86 +1,129 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Disposable as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
var ne = Object.defineProperty;
|
|
2
|
+
var oe = (e, t, r) => t in e ? ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var l = (e, t, r) => oe(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { Disposable as P, CommandType as m, ICommandService as M, ILogService as H, IUniverInstanceService as J, awaitTime as ie, Inject as O, Injector as G, IConfigService as ce, Plugin as ae, merge as se } from "@univerjs/core";
|
|
5
|
+
import { useRef as de, createElement as Z, forwardRef as le, useCallback as y } from "react";
|
|
6
|
+
import { SetSelectionsOperation as A, CopySheetCommand as me, DeleteRangeMoveLeftCommand as ue, DeleteRangeMoveUpCommand as he, DeltaColumnWidthCommand as ge, DeltaRowHeightCommand as fe, InsertSheetCommand as pe, InsertColAfterCommand as Se, InsertColBeforeCommand as ve, InsertRowAfterCommand as Ce, InsertRowBeforeCommand as _e, RemoveSheetCommand as ye, SetStyleCommand as Re, AddWorksheetMergeCommand as Ie, AddWorksheetMergeAllCommand as Oe, AddWorksheetMergeVerticalCommand as we, AddWorksheetMergeHorizontalCommand as Me, SetFrozenCommand as $e, CancelFrozenCommand as xe, SetHorizontalTextAlignCommand as Ne, SetOverlineCommand as Ue, SetRangeValuesCommand as Ae, SetStrikeThroughCommand as be, SetTextColorCommand as Fe, SetTextRotationCommand as Pe, SetTextWrapCommand as Te, SetVerticalTextAlignCommand as De, SetWorksheetActivateCommand as Ee, SetWorksheetActiveOperation as Le } from "@univerjs/sheets";
|
|
7
|
+
import { SetSheetFilterRangeCommand as je, SetSheetsFilterCriteriaCommand as Be, RemoveSheetFilterCommand as ke } from "@univerjs/sheets-filter";
|
|
8
|
+
import { SetRangeBoldCommand as Ve, SetRangeFontFamilyCommand as We, SetRangeFontSizeCommand as ze, SetRangeItalicCommand as He, SetRangeStrickThroughCommand as Je, SetRangeSubscriptCommand as Ge, SetRangeSuperscriptCommand as Ze, SetRangeTextColorCommand as Ke, SetRangeUnderlineCommand as Ye, SheetCopyCommand as qe, SheetCutCommand as Qe, SheetPasteBesidesBorderCommand as Xe, SheetPasteColWidthCommand as et, SheetPasteCommand as tt, SheetPasteFormatCommand as rt, SheetPasteShortKeyCommand as nt, SheetPasteValueCommand as ot, AutoFillCommand as it, RefillCommand as ct } from "@univerjs/sheets-ui";
|
|
9
|
+
import { ILocalFileService as K, IMessageService as $, useDependency as b, useObservable as F, RibbonStartGroup as at, MenuItemType as _, IUIPartsService as st, IMenuManagerService as dt, ComponentManager as lt, BuiltInUIPart as mt, connectInjector as ut } from "@univerjs/ui";
|
|
9
10
|
import { BehaviorSubject as R } from "rxjs";
|
|
10
|
-
import { MessageType as
|
|
11
|
-
import { jsx as g, jsxs as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
var r = {};
|
|
23
|
-
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
24
|
-
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
25
|
-
for (var o = 0, n = Object.getOwnPropertySymbols(e); o < n.length; o++)
|
|
26
|
-
t.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[o]) && (r[n[o]] = e[n[o]]);
|
|
27
|
-
return r;
|
|
28
|
-
}, Q = Y(function(e, t) {
|
|
29
|
-
var r = e.icon, n = e.id, o = e.className, i = e.extend, a = ht(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(n, " ").concat(o || "").trim(), f = ft("_".concat(pt()));
|
|
30
|
-
return X(r, "".concat(n), { defIds: r.defIds, idSuffix: f.current }, d({ ref: t, className: c }, a), i);
|
|
31
|
-
});
|
|
32
|
-
function X(e, t, r, n, o) {
|
|
33
|
-
return q(e.tag, d(d({ key: t }, gt(e, r, o)), n), (vt(e, r).children || []).map(function(i, a) {
|
|
34
|
-
return X(i, "".concat(t, "-").concat(e.tag, "-").concat(a), r, void 0, o);
|
|
35
|
-
}));
|
|
11
|
+
import { MessageType as x, Button as N } from "@univerjs/design";
|
|
12
|
+
import { jsx as g, jsxs as k } from "react/jsx-runtime";
|
|
13
|
+
function Y({ ref: e, ...t }) {
|
|
14
|
+
const { icon: r, id: n, className: o, extend: i, ...c } = t, a = `univerjs-icon univerjs-icon-${n} ${o || ""}`.trim(), u = de(`_${ft()}`);
|
|
15
|
+
return q(r, `${n}`, {
|
|
16
|
+
defIds: r.defIds,
|
|
17
|
+
idSuffix: u.current
|
|
18
|
+
}, {
|
|
19
|
+
ref: e,
|
|
20
|
+
className: a,
|
|
21
|
+
...c
|
|
22
|
+
}, i);
|
|
36
23
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
function q(e, t, r, n, o) {
|
|
25
|
+
return Z(e.tag, {
|
|
26
|
+
key: t,
|
|
27
|
+
...ht(e, r, o),
|
|
28
|
+
...n
|
|
29
|
+
}, (gt(e, r).children || []).map((i, c) => q(i, `${t}-${e.tag}-${c}`, r, void 0, o)));
|
|
30
|
+
}
|
|
31
|
+
function ht(e, t, r) {
|
|
32
|
+
const n = { ...e.attrs };
|
|
33
|
+
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
|
+
i === "mask" && typeof c == "string" && (n[i] = c.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
42
35
|
});
|
|
43
|
-
|
|
44
|
-
return !o || o.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(
|
|
45
|
-
|
|
46
|
-
typeof c == "string" && (n[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
36
|
+
const { defIds: o } = t;
|
|
37
|
+
return !o || o.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(([i, c]) => {
|
|
38
|
+
typeof c == "string" && (n[i] = c.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
47
39
|
})), n;
|
|
48
40
|
}
|
|
49
|
-
function
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
function gt(e, t) {
|
|
42
|
+
var n;
|
|
43
|
+
const { defIds: r } = t;
|
|
44
|
+
return !r || r.length === 0 ? e : e.tag === "defs" && ((n = e.children) != null && n.length) ? {
|
|
45
|
+
...e,
|
|
46
|
+
children: e.children.map((o) => typeof o.attrs.id == "string" && r && r.includes(o.attrs.id) ? {
|
|
47
|
+
...o,
|
|
48
|
+
attrs: {
|
|
49
|
+
...o.attrs,
|
|
50
|
+
id: o.attrs.id + t.idSuffix
|
|
51
|
+
}
|
|
52
|
+
} : o)
|
|
53
|
+
} : e;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function ft() {
|
|
56
56
|
return Math.random().toString(36).substring(2, 8);
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
Y.displayName = "UniverIcon";
|
|
59
|
+
const pt = {
|
|
60
|
+
tag: "svg",
|
|
61
|
+
attrs: {
|
|
62
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
63
|
+
fill: "none",
|
|
64
|
+
viewBox: "0 0 17 16",
|
|
65
|
+
width: "1em",
|
|
66
|
+
height: "1em"
|
|
67
|
+
},
|
|
68
|
+
children: [{
|
|
69
|
+
tag: "g",
|
|
70
|
+
attrs: {
|
|
71
|
+
fill: "currentColor",
|
|
72
|
+
clipPath: "url(#record-icon_clip0_1559_19)"
|
|
73
|
+
},
|
|
74
|
+
children: [{
|
|
75
|
+
tag: "path",
|
|
76
|
+
attrs: { d: "M7.60303 10C8.7076 10 9.60303 9.10457 9.60303 8C9.60303 6.89543 8.7076 6 7.60303 6C6.49846 6 5.60303 6.89543 5.60303 8C5.60303 9.10457 6.49846 10 7.60303 10Z" }
|
|
77
|
+
}, {
|
|
78
|
+
tag: "path",
|
|
79
|
+
attrs: {
|
|
80
|
+
d: "M1.66943 5.29023C1.66941 3.85426 2.83349 2.69017 4.26946 2.69019L10.9362 2.69026C12.3192 2.69028 13.45 3.77008 13.5315 5.13259L14.5692 4.55638C15.3024 4.14929 16.2032 4.67947 16.2032 5.51809V10.4819C16.2032 11.3205 15.3024 11.8507 14.5692 11.4436L13.5315 10.8674C13.45 12.2299 12.3192 13.3097 10.9362 13.3097H4.26953C2.83361 13.3097 1.66956 12.1457 1.66953 10.7098L1.66943 5.29023ZM13.5362 9.49743L15.0032 10.312V5.68799L13.5362 6.50254V9.49743ZM4.26945 3.89019C3.49623 3.89018 2.86942 4.517 2.86943 5.29021L2.86953 10.7098C2.86955 11.483 3.49634 12.1097 4.26953 12.1097H10.9362C11.7094 12.1097 12.3362 11.4829 12.3362 10.7097V5.29026C12.3362 4.51707 11.7094 3.89027 10.9362 3.89026L4.26945 3.89019Z",
|
|
81
|
+
fillRule: "evenodd",
|
|
82
|
+
clipRule: "evenodd"
|
|
83
|
+
}
|
|
84
|
+
}]
|
|
85
|
+
}, {
|
|
86
|
+
tag: "defs",
|
|
87
|
+
attrs: {},
|
|
88
|
+
children: [{
|
|
89
|
+
tag: "clipPath",
|
|
90
|
+
attrs: { id: "record-icon_clip0_1559_19" },
|
|
91
|
+
children: [{
|
|
92
|
+
tag: "path",
|
|
93
|
+
attrs: {
|
|
94
|
+
fill: "white",
|
|
95
|
+
d: "M0 0H16V16H0z",
|
|
96
|
+
transform: "translate(.94)"
|
|
97
|
+
}
|
|
98
|
+
}]
|
|
99
|
+
}]
|
|
100
|
+
}],
|
|
101
|
+
defIds: ["record-icon_clip0_1559_19"]
|
|
102
|
+
}, T = le(function(t, r) {
|
|
103
|
+
return Z(Y, Object.assign({}, t, {
|
|
61
104
|
id: "record-icon",
|
|
62
|
-
ref:
|
|
63
|
-
icon:
|
|
105
|
+
ref: r,
|
|
106
|
+
icon: pt
|
|
64
107
|
}));
|
|
65
108
|
});
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
69
|
-
(
|
|
109
|
+
T.displayName = "RecordIcon";
|
|
110
|
+
var St = Object.getOwnPropertyDescriptor, vt = (e, t, r, n) => {
|
|
111
|
+
for (var o = n > 1 ? void 0 : n ? St(t, r) : t, i = e.length - 1, c; i >= 0; i--)
|
|
112
|
+
(c = e[i]) && (o = c(o) || o);
|
|
70
113
|
return o;
|
|
71
|
-
},
|
|
72
|
-
let
|
|
114
|
+
}, I = (e, t) => (r, n) => t(r, n, e);
|
|
115
|
+
let d = class extends P {
|
|
73
116
|
constructor(t, r, n, o) {
|
|
74
117
|
super();
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
118
|
+
l(this, "_shouldRecordCommands", /* @__PURE__ */ new Set());
|
|
119
|
+
l(this, "_panelOpened$", new R(!1));
|
|
120
|
+
l(this, "panelOpened$", this._panelOpened$.asObservable());
|
|
121
|
+
l(this, "_recorder", null);
|
|
122
|
+
l(this, "_recording$", new R(!1));
|
|
123
|
+
l(this, "recording$", this._recording$.asObservable());
|
|
124
|
+
l(this, "_recorded$", new R([]));
|
|
125
|
+
l(this, "_recordedCommands$", new R([]));
|
|
126
|
+
l(this, "recordedCommands$", this._recordedCommands$.asObservable());
|
|
84
127
|
this._commandSrv = t, this._logService = r, this._localFileService = n, this._instanceService = o;
|
|
85
128
|
}
|
|
86
129
|
get recording() {
|
|
@@ -93,7 +136,7 @@ let l = class extends T {
|
|
|
93
136
|
return this._recordedCommands$.getValue();
|
|
94
137
|
}
|
|
95
138
|
registerRecordedCommand(t) {
|
|
96
|
-
if (t.type ===
|
|
139
|
+
if (t.type === m.MUTATION) throw new Error("[CommandRecorderService] Cannot record mutation commands.");
|
|
97
140
|
this._shouldRecordCommands.add(t.id);
|
|
98
141
|
}
|
|
99
142
|
togglePanel(t) {
|
|
@@ -103,20 +146,20 @@ let l = class extends T {
|
|
|
103
146
|
this._recorder = this._commandSrv.onCommandExecuted((r) => {
|
|
104
147
|
var n, o;
|
|
105
148
|
if (this._shouldRecordCommands.has(r.id)) {
|
|
106
|
-
const i = this._recorded,
|
|
107
|
-
let
|
|
108
|
-
const
|
|
149
|
+
const i = this._recorded, c = this._recordedCommands;
|
|
150
|
+
let a = { ...r };
|
|
151
|
+
const u = (n = this._instanceService.getFocusedUnit()) == null ? void 0 : n.getUnitId(), { unitId: h = u, subUnitId: s } = a == null ? void 0 : a.params;
|
|
109
152
|
if (t && h && s) {
|
|
110
153
|
const S = (o = this._instanceService.getUnit(h).getSheetBySheetId(s)) == null ? void 0 : o.getName();
|
|
111
|
-
|
|
112
|
-
...
|
|
154
|
+
a = {
|
|
155
|
+
...a,
|
|
113
156
|
params: {
|
|
114
|
-
...
|
|
157
|
+
...a.params,
|
|
115
158
|
subUnitId: S
|
|
116
159
|
}
|
|
117
160
|
};
|
|
118
161
|
}
|
|
119
|
-
|
|
162
|
+
a.id === A.id && i.length > 0 && i[i.length - 1].id === A.id ? i[i.length - 1] = a : (i.push(a), this._recorded$.next(i), a.type === m.COMMAND && (c.push(a), this._recordedCommands$.next(c)));
|
|
120
163
|
}
|
|
121
164
|
}), this._recording$.next(!0);
|
|
122
165
|
}
|
|
@@ -129,31 +172,31 @@ let l = class extends T {
|
|
|
129
172
|
this._localFileService.downloadFile(new Blob([JSON.stringify(t, null, 2)]), "recorded-commands.json"), this._logService.error("Recorded commands:", t), this.stopRecording();
|
|
130
173
|
}
|
|
131
174
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
],
|
|
138
|
-
const
|
|
175
|
+
d = vt([
|
|
176
|
+
I(0, M),
|
|
177
|
+
I(1, H),
|
|
178
|
+
I(2, K),
|
|
179
|
+
I(3, J)
|
|
180
|
+
], d);
|
|
181
|
+
const Q = {
|
|
139
182
|
id: "action-recorder.command.start-recording",
|
|
140
|
-
type:
|
|
141
|
-
handler: (e, t) => (e.get(
|
|
142
|
-
},
|
|
183
|
+
type: m.COMMAND,
|
|
184
|
+
handler: (e, t) => (e.get(d).startRecording(!!(t != null && t.replaceId)), !0)
|
|
185
|
+
}, X = {
|
|
143
186
|
id: "action-recorder.command.complete-recording",
|
|
144
|
-
type:
|
|
145
|
-
handler: (e) => (e.get(
|
|
146
|
-
},
|
|
187
|
+
type: m.COMMAND,
|
|
188
|
+
handler: (e) => (e.get(d).completeRecording(), !0)
|
|
189
|
+
}, ee = {
|
|
147
190
|
id: "action-recorder.command.stop-recording",
|
|
148
|
-
type:
|
|
149
|
-
handler: (e) => (e.get(
|
|
191
|
+
type: m.COMMAND,
|
|
192
|
+
handler: (e) => (e.get(d).completeRecording(), !0)
|
|
150
193
|
};
|
|
151
|
-
var
|
|
152
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
153
|
-
(
|
|
194
|
+
var Ct = Object.getOwnPropertyDescriptor, _t = (e, t, r, n) => {
|
|
195
|
+
for (var o = n > 1 ? void 0 : n ? Ct(t, r) : t, i = e.length - 1, c; i >= 0; i--)
|
|
196
|
+
(c = e[i]) && (o = c(o) || o);
|
|
154
197
|
return o;
|
|
155
|
-
},
|
|
156
|
-
let
|
|
198
|
+
}, C = (e, t) => (r, n) => t(r, n, e), D = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.NAME = "name", e.ACTIVE = "active", e))(D || {});
|
|
199
|
+
let f = class extends P {
|
|
157
200
|
constructor(e, t, r, n, o) {
|
|
158
201
|
super(), this._messageService = e, this._instanceService = t, this._localFileService = r, this._logService = n, this._commandService = o;
|
|
159
202
|
}
|
|
@@ -168,7 +211,7 @@ let v = class extends T {
|
|
|
168
211
|
return this.replayCommands(JSON.parse(await r.text()), { mode: e });
|
|
169
212
|
} catch {
|
|
170
213
|
return this._messageService.show({
|
|
171
|
-
type:
|
|
214
|
+
type: x.Error,
|
|
172
215
|
content: `Failed to replay commands from local file ${r.name}.`
|
|
173
216
|
}), !1;
|
|
174
217
|
}
|
|
@@ -179,23 +222,23 @@ let v = class extends T {
|
|
|
179
222
|
* @returns If the replay is successful.
|
|
180
223
|
*/
|
|
181
224
|
async replayCommands(e, t) {
|
|
182
|
-
var o, i,
|
|
225
|
+
var o, i, c;
|
|
183
226
|
const r = (o = this._instanceService.getFocusedUnit()) == null ? void 0 : o.getUnitId();
|
|
184
227
|
r || this._logService.error("[ReplayService]", "no focused unit to replay commands");
|
|
185
228
|
const { mode: n } = t || {};
|
|
186
|
-
for (const
|
|
187
|
-
const { id:
|
|
229
|
+
for (const a of e) {
|
|
230
|
+
const { id: u, params: h } = a, s = h;
|
|
188
231
|
if (s) {
|
|
189
232
|
if (typeof s.unitId < "u" && (s.unitId = r), n === "name" && s.subUnitId !== "undefined") {
|
|
190
|
-
const
|
|
191
|
-
|
|
233
|
+
const v = (i = this._instanceService.getFocusedUnit().getSheetBySheetName(s.subUnitId)) == null ? void 0 : i.getSheetId();
|
|
234
|
+
v ? s.subUnitId = v : this._logService.error("[ReplayService]", `failed to find subunit by subUnitName = ${s.subUnitId}`);
|
|
192
235
|
}
|
|
193
236
|
if (n === "active" && s.subUnitId !== "undefined") {
|
|
194
|
-
const
|
|
195
|
-
|
|
237
|
+
const v = (c = this._instanceService.getFocusedUnit().getActiveSheet()) == null ? void 0 : c.getSheetId();
|
|
238
|
+
v ? s.subUnitId = v : this._logService.error("[ReplayService]", "failed to find active subunit");
|
|
196
239
|
}
|
|
197
|
-
if (!await this._commandService.executeCommand(
|
|
198
|
-
} else if (!await this._commandService.executeCommand(
|
|
240
|
+
if (!await this._commandService.executeCommand(u, h)) return !1;
|
|
241
|
+
} else if (!await this._commandService.executeCommand(u)) return !1;
|
|
199
242
|
}
|
|
200
243
|
return !0;
|
|
201
244
|
}
|
|
@@ -208,7 +251,7 @@ let v = class extends T {
|
|
|
208
251
|
const t = (r = this._instanceService.getFocusedUnit()) == null ? void 0 : r.getUnitId();
|
|
209
252
|
t || this._logService.error("[ReplayService]", "no focused unit to replay commands");
|
|
210
253
|
for (const n of e) {
|
|
211
|
-
await
|
|
254
|
+
await ie(yt());
|
|
212
255
|
const { id: o, params: i } = n;
|
|
213
256
|
if (i) {
|
|
214
257
|
if (typeof i.unitId < "u" && (i.unitId = t), !await this._commandService.executeCommand(o, i)) return !1;
|
|
@@ -217,193 +260,193 @@ let v = class extends T {
|
|
|
217
260
|
return !0;
|
|
218
261
|
}
|
|
219
262
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
],
|
|
227
|
-
function
|
|
263
|
+
f = _t([
|
|
264
|
+
C(0, $),
|
|
265
|
+
C(1, J),
|
|
266
|
+
C(2, K),
|
|
267
|
+
C(3, H),
|
|
268
|
+
C(4, M)
|
|
269
|
+
], f);
|
|
270
|
+
function yt() {
|
|
228
271
|
return Math.floor(Math.random() * 800) + 200;
|
|
229
272
|
}
|
|
230
|
-
const
|
|
273
|
+
const E = {
|
|
231
274
|
id: "action-recorder.command.replay-local-records",
|
|
232
|
-
type:
|
|
275
|
+
type: m.COMMAND,
|
|
233
276
|
handler: async (e) => {
|
|
234
|
-
const r = await e.get(
|
|
235
|
-
return r && e.get(
|
|
236
|
-
type:
|
|
277
|
+
const r = await e.get(f).replayLocalJSON();
|
|
278
|
+
return r && e.get($).show({
|
|
279
|
+
type: x.Success,
|
|
237
280
|
content: "Successfully replayed local records"
|
|
238
281
|
}), r;
|
|
239
282
|
}
|
|
240
283
|
}, L = {
|
|
241
284
|
id: "action-recorder.command.replay-local-records-name",
|
|
242
|
-
type:
|
|
285
|
+
type: m.COMMAND,
|
|
243
286
|
handler: async (e) => {
|
|
244
|
-
const r = await e.get(
|
|
245
|
-
return r && e.get(
|
|
246
|
-
type:
|
|
287
|
+
const r = await e.get(f).replayLocalJSON(D.NAME);
|
|
288
|
+
return r && e.get($).show({
|
|
289
|
+
type: x.Success,
|
|
247
290
|
content: "Successfully replayed local records"
|
|
248
291
|
}), r;
|
|
249
292
|
}
|
|
250
|
-
},
|
|
293
|
+
}, j = {
|
|
251
294
|
id: "action-recorder.command.replay-local-records-active",
|
|
252
|
-
type:
|
|
295
|
+
type: m.COMMAND,
|
|
253
296
|
handler: async (e) => {
|
|
254
|
-
const r = await e.get(
|
|
255
|
-
return r && e.get(
|
|
256
|
-
type:
|
|
297
|
+
const r = await e.get(f).replayLocalJSON(D.ACTIVE);
|
|
298
|
+
return r && e.get($).show({
|
|
299
|
+
type: x.Success,
|
|
257
300
|
content: "Successfully replayed local records"
|
|
258
301
|
}), r;
|
|
259
302
|
}
|
|
260
303
|
}, B = {
|
|
261
304
|
id: "action-recorder.operation.open-panel",
|
|
262
|
-
type:
|
|
305
|
+
type: m.OPERATION,
|
|
263
306
|
handler(e) {
|
|
264
|
-
return e.get(
|
|
307
|
+
return e.get(d).togglePanel(!0), !0;
|
|
265
308
|
}
|
|
266
|
-
},
|
|
309
|
+
}, te = {
|
|
267
310
|
id: "action-recorder.operation.close-panel",
|
|
268
|
-
type:
|
|
311
|
+
type: m.OPERATION,
|
|
269
312
|
handler(e) {
|
|
270
|
-
return e.get(
|
|
313
|
+
return e.get(d).togglePanel(!1), !0;
|
|
271
314
|
}
|
|
272
315
|
};
|
|
273
|
-
function
|
|
274
|
-
const e =
|
|
275
|
-
return F(e.panelOpened$) ? /* @__PURE__ */ g(
|
|
316
|
+
function Rt() {
|
|
317
|
+
const e = b(d);
|
|
318
|
+
return F(e.panelOpened$) ? /* @__PURE__ */ g(It, {}) : null;
|
|
276
319
|
}
|
|
277
|
-
function
|
|
320
|
+
function It() {
|
|
278
321
|
var s;
|
|
279
|
-
const e =
|
|
280
|
-
r || e.executeCommand(
|
|
281
|
-
}, [e, r]),
|
|
282
|
-
r || e.executeCommand(
|
|
283
|
-
}, [e, r]),
|
|
284
|
-
r && e.executeCommand(
|
|
285
|
-
}, [e, r]),
|
|
286
|
-
r && e.executeCommand(
|
|
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);
|
|
287
330
|
}, [e, r]), h = r ? o === 0 ? "Recording..." : `${o}: ${n[o - 1].id}` : "Start Recording";
|
|
288
|
-
return /* @__PURE__ */
|
|
331
|
+
return /* @__PURE__ */ k(
|
|
289
332
|
"div",
|
|
290
333
|
{
|
|
291
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",
|
|
292
335
|
children: [
|
|
293
|
-
/* @__PURE__ */ g("div", { className: "univer-mr-2 univer-size-5 univer-shrink-0 univer-grow-0 univer-text-xl", children: /* @__PURE__ */ g(
|
|
336
|
+
/* @__PURE__ */ g("div", { className: "univer-mr-2 univer-size-5 univer-shrink-0 univer-grow-0 univer-text-xl", children: /* @__PURE__ */ g(T, {}) }),
|
|
294
337
|
/* @__PURE__ */ g("div", { className: "univer-flex-1 univer-text-sm", children: h }),
|
|
295
|
-
/* @__PURE__ */
|
|
338
|
+
/* @__PURE__ */ k("div", { className: "univer-flex univer-w-64 univer-shrink-0 univer-grow-0 univer-justify-between", children: [
|
|
296
339
|
/* @__PURE__ */ g(
|
|
297
|
-
|
|
340
|
+
N,
|
|
298
341
|
{
|
|
299
342
|
className: "univer-w-20",
|
|
300
|
-
onClick: r ?
|
|
343
|
+
onClick: r ? u : i,
|
|
301
344
|
children: r ? "Cancel" : "Close"
|
|
302
345
|
}
|
|
303
346
|
),
|
|
304
347
|
/* @__PURE__ */ g(
|
|
305
|
-
|
|
348
|
+
N,
|
|
306
349
|
{
|
|
307
350
|
className: "univer-w-20",
|
|
308
351
|
variant: "primary",
|
|
309
|
-
onClick: r ?
|
|
352
|
+
onClick: r ? a : () => c(),
|
|
310
353
|
children: r ? "Save" : "Start"
|
|
311
354
|
}
|
|
312
355
|
),
|
|
313
|
-
!r && /* @__PURE__ */ g(
|
|
356
|
+
!r && /* @__PURE__ */ g(N, { variant: "primary", onClick: () => c(!0), children: "Start(N)" })
|
|
314
357
|
] })
|
|
315
358
|
]
|
|
316
359
|
}
|
|
317
360
|
);
|
|
318
361
|
}
|
|
319
|
-
const
|
|
320
|
-
function
|
|
362
|
+
const re = "RECORD_MENU_ITEM";
|
|
363
|
+
function Ot() {
|
|
321
364
|
return {
|
|
322
|
-
id:
|
|
323
|
-
type:
|
|
365
|
+
id: re,
|
|
366
|
+
type: _.SUBITEMS,
|
|
324
367
|
icon: "RecordIcon",
|
|
325
368
|
tooltip: "action-recorder.menu.title"
|
|
326
369
|
};
|
|
327
370
|
}
|
|
328
|
-
function
|
|
329
|
-
const t = e.get(
|
|
371
|
+
function wt(e) {
|
|
372
|
+
const t = e.get(d);
|
|
330
373
|
return {
|
|
331
374
|
id: B.id,
|
|
332
375
|
title: "action-recorder.menu.record",
|
|
333
|
-
type:
|
|
376
|
+
type: _.BUTTON,
|
|
334
377
|
disabled$: t.panelOpened$
|
|
335
378
|
};
|
|
336
379
|
}
|
|
337
|
-
function
|
|
380
|
+
function Mt() {
|
|
338
381
|
return {
|
|
339
|
-
id:
|
|
382
|
+
id: E.id,
|
|
340
383
|
title: "action-recorder.menu.replay-local",
|
|
341
|
-
type:
|
|
384
|
+
type: _.BUTTON
|
|
342
385
|
};
|
|
343
386
|
}
|
|
344
|
-
function
|
|
387
|
+
function $t() {
|
|
345
388
|
return {
|
|
346
389
|
id: L.id,
|
|
347
390
|
title: "action-recorder.menu.replay-local-name",
|
|
348
|
-
type:
|
|
391
|
+
type: _.BUTTON
|
|
349
392
|
};
|
|
350
393
|
}
|
|
351
|
-
function
|
|
394
|
+
function xt() {
|
|
352
395
|
return {
|
|
353
|
-
id:
|
|
396
|
+
id: j.id,
|
|
354
397
|
title: "action-recorder.menu.replay-local-active",
|
|
355
|
-
type:
|
|
398
|
+
type: _.BUTTON
|
|
356
399
|
};
|
|
357
400
|
}
|
|
358
|
-
const
|
|
359
|
-
[
|
|
360
|
-
[
|
|
401
|
+
const Nt = {
|
|
402
|
+
[at.OTHERS]: {
|
|
403
|
+
[re]: {
|
|
361
404
|
order: 2,
|
|
362
|
-
menuItemFactory:
|
|
405
|
+
menuItemFactory: Ot,
|
|
363
406
|
[B.id]: {
|
|
364
407
|
order: 1,
|
|
365
|
-
menuItemFactory:
|
|
408
|
+
menuItemFactory: wt
|
|
366
409
|
},
|
|
367
|
-
[
|
|
410
|
+
[E.id]: {
|
|
368
411
|
order: 2,
|
|
369
|
-
menuItemFactory:
|
|
412
|
+
menuItemFactory: Mt
|
|
370
413
|
},
|
|
371
414
|
[L.id]: {
|
|
372
415
|
order: 3,
|
|
373
|
-
menuItemFactory:
|
|
416
|
+
menuItemFactory: $t
|
|
374
417
|
},
|
|
375
|
-
[
|
|
418
|
+
[j.id]: {
|
|
376
419
|
order: 4,
|
|
377
|
-
menuItemFactory:
|
|
420
|
+
menuItemFactory: xt
|
|
378
421
|
}
|
|
379
422
|
}
|
|
380
423
|
}
|
|
381
424
|
};
|
|
382
|
-
var
|
|
383
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
384
|
-
(
|
|
425
|
+
var Ut = Object.getOwnPropertyDescriptor, At = (e, t, r, n) => {
|
|
426
|
+
for (var o = n > 1 ? void 0 : n ? Ut(t, r) : t, i = e.length - 1, c; i >= 0; i--)
|
|
427
|
+
(c = e[i]) && (o = c(o) || o);
|
|
385
428
|
return o;
|
|
386
429
|
}, p = (e, t) => (r, n) => t(r, n, e);
|
|
387
|
-
let
|
|
430
|
+
let w = class extends P {
|
|
388
431
|
constructor(e, t, r, n, o, i) {
|
|
389
432
|
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();
|
|
390
433
|
}
|
|
391
434
|
_initCommands() {
|
|
392
435
|
[
|
|
436
|
+
Q,
|
|
393
437
|
ee,
|
|
394
|
-
|
|
395
|
-
te,
|
|
438
|
+
X,
|
|
396
439
|
B,
|
|
397
|
-
|
|
398
|
-
|
|
440
|
+
te,
|
|
441
|
+
E,
|
|
399
442
|
L,
|
|
400
|
-
|
|
443
|
+
j
|
|
401
444
|
].forEach((e) => this._commandSrv.registerCommand(e));
|
|
402
445
|
}
|
|
403
446
|
_initUI() {
|
|
404
|
-
this._uiPartsSrv.registerComponent(mt.GLOBAL, () => ut(
|
|
405
|
-
this._componentManager.register("RecordIcon",
|
|
406
|
-
), this._menuManagerService.mergeMenu(
|
|
447
|
+
this._uiPartsSrv.registerComponent(mt.GLOBAL, () => ut(Rt, this._injector)), this.disposeWithMe(
|
|
448
|
+
this._componentManager.register("RecordIcon", T)
|
|
449
|
+
), this._menuManagerService.mergeMenu(Nt);
|
|
407
450
|
}
|
|
408
451
|
_initSheetsCommands() {
|
|
409
452
|
[
|
|
@@ -412,12 +455,12 @@ let x = class extends T {
|
|
|
412
455
|
// #region basic commands
|
|
413
456
|
me,
|
|
414
457
|
ue,
|
|
415
|
-
fe,
|
|
416
458
|
he,
|
|
417
459
|
ge,
|
|
418
|
-
|
|
460
|
+
fe,
|
|
419
461
|
pe,
|
|
420
462
|
Se,
|
|
463
|
+
ve,
|
|
421
464
|
Ce,
|
|
422
465
|
_e,
|
|
423
466
|
ye,
|
|
@@ -425,15 +468,15 @@ let x = class extends T {
|
|
|
425
468
|
Ie,
|
|
426
469
|
Oe,
|
|
427
470
|
we,
|
|
428
|
-
|
|
471
|
+
Me,
|
|
429
472
|
// ResetBackgroundColorCommand,
|
|
430
473
|
// ResetTextColorCommand,
|
|
431
474
|
// SetBackgroundColorCommand,
|
|
432
475
|
// SetBoldCommand,
|
|
433
476
|
// SetFontFamilyCommand,
|
|
434
477
|
// SetFontSizeCommand,
|
|
435
|
-
|
|
436
|
-
|
|
478
|
+
$e,
|
|
479
|
+
xe,
|
|
437
480
|
Ne,
|
|
438
481
|
// SetItalicCommand,
|
|
439
482
|
Ue,
|
|
@@ -447,12 +490,12 @@ let x = class extends T {
|
|
|
447
490
|
Ke,
|
|
448
491
|
Ye,
|
|
449
492
|
Ae,
|
|
450
|
-
|
|
451
|
-
Pe,
|
|
493
|
+
be,
|
|
452
494
|
Fe,
|
|
495
|
+
Pe,
|
|
453
496
|
Te,
|
|
454
497
|
// SetUnderlineCommand,
|
|
455
|
-
|
|
498
|
+
De,
|
|
456
499
|
qe,
|
|
457
500
|
Qe,
|
|
458
501
|
Xe,
|
|
@@ -462,66 +505,66 @@ let x = class extends T {
|
|
|
462
505
|
nt,
|
|
463
506
|
ot,
|
|
464
507
|
it,
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
508
|
+
ct,
|
|
509
|
+
Ee,
|
|
510
|
+
Le,
|
|
511
|
+
A,
|
|
469
512
|
// #endregion
|
|
470
513
|
// #region data validation command
|
|
471
514
|
// #endregion
|
|
472
515
|
// #region conditional formatting command
|
|
473
516
|
// #endregion
|
|
474
517
|
// #region filter command
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
518
|
+
je,
|
|
519
|
+
Be,
|
|
520
|
+
ke
|
|
478
521
|
// #endregion
|
|
479
522
|
].forEach((e) => this._actionRecorderService.registerRecordedCommand(e));
|
|
480
523
|
}
|
|
481
524
|
_initDocsCommands() {
|
|
482
525
|
}
|
|
483
526
|
};
|
|
484
|
-
|
|
527
|
+
w = At([
|
|
485
528
|
p(0, M),
|
|
486
529
|
p(1, st),
|
|
487
530
|
p(2, dt),
|
|
488
|
-
p(3,
|
|
489
|
-
p(4,
|
|
490
|
-
p(5,
|
|
491
|
-
],
|
|
492
|
-
const
|
|
493
|
-
var
|
|
494
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
495
|
-
(
|
|
531
|
+
p(3, O(lt)),
|
|
532
|
+
p(4, O(d)),
|
|
533
|
+
p(5, O(G))
|
|
534
|
+
], w);
|
|
535
|
+
const bt = "action-recorder.config", V = {};
|
|
536
|
+
var Ft = Object.getOwnPropertyDescriptor, Pt = (e, t, r, n) => {
|
|
537
|
+
for (var o = n > 1 ? void 0 : n ? Ft(t, r) : t, i = e.length - 1, c; i >= 0; i--)
|
|
538
|
+
(c = e[i]) && (o = c(o) || o);
|
|
496
539
|
return o;
|
|
497
|
-
},
|
|
498
|
-
let
|
|
499
|
-
constructor(e =
|
|
540
|
+
}, W = (e, t) => (r, n) => t(r, n, e), U;
|
|
541
|
+
let z = (U = class extends ae {
|
|
542
|
+
constructor(e = V, t, r) {
|
|
500
543
|
super(), this._config = e, this._injector = t, this._configService = r;
|
|
501
|
-
const { menu: n, ...o } =
|
|
544
|
+
const { menu: n, ...o } = se(
|
|
502
545
|
{},
|
|
503
|
-
|
|
546
|
+
V,
|
|
504
547
|
this._config
|
|
505
548
|
);
|
|
506
|
-
n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(
|
|
549
|
+
n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(bt, o);
|
|
507
550
|
}
|
|
508
551
|
onStarting() {
|
|
509
|
-
(this._config.replayOnly ? [[
|
|
510
|
-
[
|
|
511
|
-
[
|
|
512
|
-
[
|
|
552
|
+
(this._config.replayOnly ? [[f]] : [
|
|
553
|
+
[d],
|
|
554
|
+
[f],
|
|
555
|
+
[w]
|
|
513
556
|
]).forEach((t) => this._injector.add(t));
|
|
514
557
|
}
|
|
515
558
|
onSteady() {
|
|
516
|
-
this._config.replayOnly || this._injector.get(
|
|
559
|
+
this._config.replayOnly || this._injector.get(w);
|
|
517
560
|
}
|
|
518
|
-
},
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
],
|
|
561
|
+
}, l(U, "pluginName", "UNIVER_ACTION_RECORDER_PLUGIN"), U);
|
|
562
|
+
z = Pt([
|
|
563
|
+
W(1, O(G)),
|
|
564
|
+
W(2, ce)
|
|
565
|
+
], z);
|
|
523
566
|
export {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
567
|
+
d as ActionRecorderService,
|
|
568
|
+
f as ActionReplayService,
|
|
569
|
+
z as UniverActionRecorderPlugin
|
|
527
570
|
};
|