@univerjs/action-recorder 0.6.10 → 0.7.0-beta.1
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 +4 -1
- package/lib/es/index.js +222 -204
- package/lib/index.css +1 -1
- package/lib/index.js +222 -204
- package/lib/umd/index.js +4 -1
- package/package.json +11 -12
package/lib/index.js
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
var
|
|
2
|
-
var ae = (e, t, r) => t in e ?
|
|
1
|
+
var ie = Object.defineProperty;
|
|
2
|
+
var ae = (e, t, r) => t in e ? ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var m = (e, t, r) => ae(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { Disposable as
|
|
5
|
-
import { SetSelectionsOperation as $, CopySheetCommand as
|
|
6
|
-
import { SetSheetFilterRangeCommand as
|
|
7
|
-
import { SetRangeBoldCommand as
|
|
8
|
-
import { ILocalFileService as
|
|
9
|
-
import { BehaviorSubject as
|
|
10
|
-
import { MessageType as
|
|
11
|
-
import { jsx as h, jsxs as
|
|
12
|
-
import { forwardRef as
|
|
13
|
-
var
|
|
14
|
-
return
|
|
4
|
+
import { Disposable as T, CommandType as u, ICommandService as b, ILogService as J, IUniverInstanceService as G, awaitTime as ce, Inject as x, Injector as Z, IConfigService as se, Plugin as de, merge as le } from "@univerjs/core";
|
|
5
|
+
import { SetSelectionsOperation as $, CopySheetCommand as me, DeleteRangeMoveLeftCommand as ue, DeleteRangeMoveUpCommand as fe, DeltaColumnWidthCommand as ge, DeltaRowHeightCommand as he, InsertSheetCommand as ve, InsertColAfterCommand as Se, InsertColBeforeCommand as pe, InsertRowAfterCommand as Ce, InsertRowBeforeCommand as _e, RemoveSheetCommand as ye, SetStyleCommand as Re, AddWorksheetMergeCommand as Ie, AddWorksheetMergeAllCommand as Oe, AddWorksheetMergeVerticalCommand as xe, AddWorksheetMergeHorizontalCommand as we, SetFrozenCommand as be, CancelFrozenCommand as Me, SetHorizontalTextAlignCommand as Ne, SetOverlineCommand as Ue, SetRangeValuesCommand as Ae, SetStrikeThroughCommand as $e, SetTextColorCommand as Pe, SetTextRotationCommand as Fe, SetTextWrapCommand as Te, SetVerticalTextAlignCommand as Ee, SetWorksheetActivateCommand as De, SetWorksheetActiveOperation as je } from "@univerjs/sheets";
|
|
6
|
+
import { SetSheetFilterRangeCommand as Le, SetSheetsFilterCriteriaCommand as ke, RemoveSheetFilterCommand as Be } from "@univerjs/sheets-filter";
|
|
7
|
+
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 at } from "@univerjs/sheets-ui";
|
|
8
|
+
import { ILocalFileService as K, IMessageService as M, useDependency as P, useObservable as F, RibbonStartGroup as ct, MenuItemType as y, IUIPartsService as st, IMenuManagerService as dt, ComponentManager as lt, BuiltInUIPart as mt, connectInjector as ut } from "@univerjs/ui";
|
|
9
|
+
import { BehaviorSubject as R } from "rxjs";
|
|
10
|
+
import { MessageType as N, Button as U } from "@univerjs/design";
|
|
11
|
+
import { jsx as h, jsxs as V } from "react/jsx-runtime";
|
|
12
|
+
import { forwardRef as Y, useRef as ft, createElement as q, useCallback as I } from "react";
|
|
13
|
+
var d = function() {
|
|
14
|
+
return d = Object.assign || function(e) {
|
|
15
15
|
for (var t, r = 1, n = arguments.length; r < n; r++) {
|
|
16
16
|
t = arguments[r];
|
|
17
17
|
for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
|
|
18
18
|
}
|
|
19
19
|
return e;
|
|
20
|
-
},
|
|
21
|
-
},
|
|
20
|
+
}, d.apply(this, arguments);
|
|
21
|
+
}, gt = function(e, t) {
|
|
22
22
|
var r = {};
|
|
23
23
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
24
24
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
25
25
|
for (var o = 0, n = Object.getOwnPropertySymbols(e); o < n.length; o++)
|
|
26
26
|
t.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[o]) && (r[n[o]] = e[n[o]]);
|
|
27
27
|
return r;
|
|
28
|
-
},
|
|
29
|
-
var r = e.icon, n = e.id, o = e.className, i = e.extend,
|
|
30
|
-
return
|
|
28
|
+
}, Q = Y(function(e, t) {
|
|
29
|
+
var r = e.icon, n = e.id, o = e.className, i = e.extend, a = gt(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(n, " ").concat(o || "").trim(), f = ft("_".concat(St()));
|
|
30
|
+
return X(r, "".concat(n), { defIds: r.defIds, idSuffix: f.current }, d({ ref: t, className: c }, a), i);
|
|
31
31
|
});
|
|
32
|
-
function
|
|
33
|
-
return
|
|
34
|
-
return
|
|
32
|
+
function X(e, t, r, n, o) {
|
|
33
|
+
return q(e.tag, d(d({ key: t }, ht(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
35
|
}));
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
var n =
|
|
37
|
+
function ht(e, t, r) {
|
|
38
|
+
var n = d({}, e.attrs);
|
|
39
39
|
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(function(i) {
|
|
40
|
-
var
|
|
41
|
-
|
|
40
|
+
var a = i[0], c = i[1];
|
|
41
|
+
a === "mask" && typeof c == "string" && (n[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
42
42
|
});
|
|
43
43
|
var o = t.defIds;
|
|
44
44
|
return !o || o.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(i) {
|
|
45
|
-
var
|
|
46
|
-
typeof
|
|
45
|
+
var a = i[0], c = i[1];
|
|
46
|
+
typeof c == "string" && (n[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
47
47
|
})), n;
|
|
48
48
|
}
|
|
49
49
|
function vt(e, t) {
|
|
50
50
|
var r, n = t.defIds;
|
|
51
|
-
return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ?
|
|
52
|
-
return typeof o.attrs.id == "string" && n && n.indexOf(o.attrs.id) > -1 ?
|
|
51
|
+
return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? d(d({}, e), { children: e.children.map(function(o) {
|
|
52
|
+
return typeof o.attrs.id == "string" && n && n.indexOf(o.attrs.id) > -1 ? d(d({}, o), { attrs: d(d({}, o.attrs), { id: o.attrs.id + t.idSuffix }) }) : o;
|
|
53
53
|
}) }) : e;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function St() {
|
|
56
56
|
return Math.random().toString(36).substring(2, 8);
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
var
|
|
60
|
-
return Q
|
|
58
|
+
Q.displayName = "UniverIcon";
|
|
59
|
+
var pt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "g", attrs: { fill: "currentColor", clipPath: "url(#record-single_clip0_1559_19)" }, children: [{ tag: "path", 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" } }, { tag: "path", attrs: { 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", fillRule: "evenodd", clipRule: "evenodd" } }] }, { tag: "defs", attrs: {}, children: [{ tag: "clipPath", attrs: { id: "record-single_clip0_1559_19" }, children: [{ tag: "path", attrs: { fill: "#fff", d: "M0 0H16V16H0z", transform: "translate(.94)" } }] }] }], defIds: ["record-single_clip0_1559_19"] }, E = Y(function(e, t) {
|
|
60
|
+
return q(Q, Object.assign({}, e, {
|
|
61
61
|
id: "record-single",
|
|
62
62
|
ref: t,
|
|
63
|
-
icon:
|
|
63
|
+
icon: pt
|
|
64
64
|
}));
|
|
65
65
|
});
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
69
|
-
(
|
|
66
|
+
E.displayName = "RecordSingle";
|
|
67
|
+
var Ct = Object.getOwnPropertyDescriptor, _t = (e, t, r, n) => {
|
|
68
|
+
for (var o = n > 1 ? void 0 : n ? Ct(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
69
|
+
(a = e[i]) && (o = a(o) || o);
|
|
70
70
|
return o;
|
|
71
|
-
},
|
|
72
|
-
let l = class extends
|
|
71
|
+
}, O = (e, t) => (r, n) => t(r, n, e);
|
|
72
|
+
let l = class extends T {
|
|
73
73
|
constructor(t, r, n, o) {
|
|
74
74
|
super();
|
|
75
75
|
m(this, "_shouldRecordCommands", /* @__PURE__ */ new Set());
|
|
76
|
-
m(this, "_panelOpened$", new
|
|
76
|
+
m(this, "_panelOpened$", new R(!1));
|
|
77
77
|
m(this, "panelOpened$", this._panelOpened$.asObservable());
|
|
78
78
|
m(this, "_recorder", null);
|
|
79
|
-
m(this, "_recording$", new
|
|
79
|
+
m(this, "_recording$", new R(!1));
|
|
80
80
|
m(this, "recording$", this._recording$.asObservable());
|
|
81
|
-
m(this, "_recorded$", new
|
|
82
|
-
m(this, "_recordedCommands$", new
|
|
81
|
+
m(this, "_recorded$", new R([]));
|
|
82
|
+
m(this, "_recordedCommands$", new R([]));
|
|
83
83
|
m(this, "recordedCommands$", this._recordedCommands$.asObservable());
|
|
84
84
|
this._commandSrv = t, this._logService = r, this._localFileService = n, this._instanceService = o;
|
|
85
85
|
}
|
|
@@ -103,20 +103,20 @@ let l = class extends E {
|
|
|
103
103
|
this._recorder = this._commandSrv.onCommandExecuted((r) => {
|
|
104
104
|
var n, o;
|
|
105
105
|
if (this._shouldRecordCommands.has(r.id)) {
|
|
106
|
-
const i = this._recorded,
|
|
107
|
-
let
|
|
108
|
-
const f = (n = this._instanceService.getFocusedUnit()) == null ? void 0 : n.getUnitId(), { unitId: g = f, subUnitId:
|
|
109
|
-
if (t && g &&
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
...
|
|
106
|
+
const i = this._recorded, a = this._recordedCommands;
|
|
107
|
+
let c = { ...r };
|
|
108
|
+
const f = (n = this._instanceService.getFocusedUnit()) == null ? void 0 : n.getUnitId(), { unitId: g = f, subUnitId: s } = c == null ? void 0 : c.params;
|
|
109
|
+
if (t && g && s) {
|
|
110
|
+
const p = (o = this._instanceService.getUnit(g).getSheetBySheetId(s)) == null ? void 0 : o.getName();
|
|
111
|
+
c = {
|
|
112
|
+
...c,
|
|
113
113
|
params: {
|
|
114
|
-
...
|
|
115
|
-
subUnitId:
|
|
114
|
+
...c.params,
|
|
115
|
+
subUnitId: p
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
c.id === $.id && i.length > 0 && i[i.length - 1].id === $.id ? i[i.length - 1] = c : (i.push(c), this._recorded$.next(i), c.type === u.COMMAND && (a.push(c), this._recordedCommands$.next(a)));
|
|
120
120
|
}
|
|
121
121
|
}), this._recording$.next(!0);
|
|
122
122
|
}
|
|
@@ -129,31 +129,31 @@ let l = class extends E {
|
|
|
129
129
|
this._localFileService.downloadFile(new Blob([JSON.stringify(t, null, 2)]), "recorded-commands.json"), this._logService.error("Recorded commands:", t), this.stopRecording();
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
|
-
l =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
l = _t([
|
|
133
|
+
O(0, b),
|
|
134
|
+
O(1, J),
|
|
135
|
+
O(2, K),
|
|
136
|
+
O(3, G)
|
|
137
137
|
], l);
|
|
138
|
-
const
|
|
138
|
+
const ee = {
|
|
139
139
|
id: "action-recorder.command.start-recording",
|
|
140
140
|
type: u.COMMAND,
|
|
141
141
|
handler: (e, t) => (e.get(l).startRecording(!!(t != null && t.replaceId)), !0)
|
|
142
|
-
},
|
|
142
|
+
}, te = {
|
|
143
143
|
id: "action-recorder.command.complete-recording",
|
|
144
144
|
type: u.COMMAND,
|
|
145
145
|
handler: (e) => (e.get(l).completeRecording(), !0)
|
|
146
|
-
},
|
|
146
|
+
}, re = {
|
|
147
147
|
id: "action-recorder.command.stop-recording",
|
|
148
148
|
type: u.COMMAND,
|
|
149
149
|
handler: (e) => (e.get(l).completeRecording(), !0)
|
|
150
150
|
};
|
|
151
|
-
var
|
|
152
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
153
|
-
(
|
|
151
|
+
var yt = Object.getOwnPropertyDescriptor, Rt = (e, t, r, n) => {
|
|
152
|
+
for (var o = n > 1 ? void 0 : n ? yt(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
153
|
+
(a = e[i]) && (o = a(o) || o);
|
|
154
154
|
return o;
|
|
155
|
-
}, _ = (e, t) => (r, n) => t(r, n, e),
|
|
156
|
-
let
|
|
155
|
+
}, _ = (e, t) => (r, n) => t(r, n, e), D = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.NAME = "name", e.ACTIVE = "active", e))(D || {});
|
|
156
|
+
let v = class extends T {
|
|
157
157
|
constructor(e, t, r, n, o) {
|
|
158
158
|
super(), this._messageService = e, this._instanceService = t, this._localFileService = r, this._logService = n, this._commandService = o;
|
|
159
159
|
}
|
|
@@ -168,7 +168,7 @@ let p = class extends E {
|
|
|
168
168
|
return this.replayCommands(JSON.parse(await r.text()), { mode: e });
|
|
169
169
|
} catch {
|
|
170
170
|
return this._messageService.show({
|
|
171
|
-
type:
|
|
171
|
+
type: N.Error,
|
|
172
172
|
content: `Failed to replay commands from local file ${r.name}.`
|
|
173
173
|
}), !1;
|
|
174
174
|
}
|
|
@@ -179,20 +179,20 @@ let p = class extends E {
|
|
|
179
179
|
* @returns If the replay is successful.
|
|
180
180
|
*/
|
|
181
181
|
async replayCommands(e, t) {
|
|
182
|
-
var o, i,
|
|
182
|
+
var o, i, a;
|
|
183
183
|
const r = (o = this._instanceService.getFocusedUnit()) == null ? void 0 : o.getUnitId();
|
|
184
184
|
r || this._logService.error("[ReplayService]", "no focused unit to replay commands");
|
|
185
185
|
const { mode: n } = t || {};
|
|
186
|
-
for (const
|
|
187
|
-
const { id: f, params: g } =
|
|
188
|
-
if (
|
|
189
|
-
if (typeof
|
|
190
|
-
const C = (i = this._instanceService.getFocusedUnit().getSheetBySheetName(
|
|
191
|
-
C ?
|
|
186
|
+
for (const c of e) {
|
|
187
|
+
const { id: f, params: g } = c, s = g;
|
|
188
|
+
if (s) {
|
|
189
|
+
if (typeof s.unitId < "u" && (s.unitId = r), n === "name" && s.subUnitId !== "undefined") {
|
|
190
|
+
const C = (i = this._instanceService.getFocusedUnit().getSheetBySheetName(s.subUnitId)) == null ? void 0 : i.getSheetId();
|
|
191
|
+
C ? s.subUnitId = C : this._logService.error("[ReplayService]", `failed to find subunit by subUnitName = ${s.subUnitId}`);
|
|
192
192
|
}
|
|
193
|
-
if (n === "active" &&
|
|
194
|
-
const C = (
|
|
195
|
-
C ?
|
|
193
|
+
if (n === "active" && s.subUnitId !== "undefined") {
|
|
194
|
+
const C = (a = this._instanceService.getFocusedUnit().getActiveSheet()) == null ? void 0 : a.getSheetId();
|
|
195
|
+
C ? s.subUnitId = C : this._logService.error("[ReplayService]", "failed to find active subunit");
|
|
196
196
|
}
|
|
197
197
|
if (!await this._commandService.executeCommand(f, g)) return !1;
|
|
198
198
|
} else if (!await this._commandService.executeCommand(f)) return !1;
|
|
@@ -208,7 +208,7 @@ let p = class extends E {
|
|
|
208
208
|
const t = (r = this._instanceService.getFocusedUnit()) == null ? void 0 : r.getUnitId();
|
|
209
209
|
t || this._logService.error("[ReplayService]", "no focused unit to replay commands");
|
|
210
210
|
for (const n of e) {
|
|
211
|
-
await
|
|
211
|
+
await ce(It());
|
|
212
212
|
const { id: o, params: i } = n;
|
|
213
213
|
if (i) {
|
|
214
214
|
if (typeof i.unitId < "u" && (i.unitId = t), !await this._commandService.executeCommand(o, i)) return !1;
|
|
@@ -217,33 +217,33 @@ let p = class extends E {
|
|
|
217
217
|
return !0;
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
|
-
|
|
221
|
-
_(0,
|
|
222
|
-
_(1,
|
|
223
|
-
_(2,
|
|
224
|
-
_(3,
|
|
220
|
+
v = Rt([
|
|
221
|
+
_(0, M),
|
|
222
|
+
_(1, G),
|
|
223
|
+
_(2, K),
|
|
224
|
+
_(3, J),
|
|
225
225
|
_(4, b)
|
|
226
|
-
],
|
|
227
|
-
function
|
|
226
|
+
], v);
|
|
227
|
+
function It() {
|
|
228
228
|
return Math.floor(Math.random() * 800) + 200;
|
|
229
229
|
}
|
|
230
|
-
const
|
|
230
|
+
const j = {
|
|
231
231
|
id: "action-recorder.command.replay-local-records",
|
|
232
232
|
type: u.COMMAND,
|
|
233
233
|
handler: async (e) => {
|
|
234
|
-
const r = await e.get(
|
|
235
|
-
return r && e.get(
|
|
236
|
-
type:
|
|
234
|
+
const r = await e.get(v).replayLocalJSON();
|
|
235
|
+
return r && e.get(M).show({
|
|
236
|
+
type: N.Success,
|
|
237
237
|
content: "Successfully replayed local records"
|
|
238
238
|
}), r;
|
|
239
239
|
}
|
|
240
|
-
},
|
|
240
|
+
}, L = {
|
|
241
241
|
id: "action-recorder.command.replay-local-records-name",
|
|
242
242
|
type: u.COMMAND,
|
|
243
243
|
handler: async (e) => {
|
|
244
|
-
const r = await e.get(
|
|
245
|
-
return r && e.get(
|
|
246
|
-
type:
|
|
244
|
+
const r = await e.get(v).replayLocalJSON(D.NAME);
|
|
245
|
+
return r && e.get(M).show({
|
|
246
|
+
type: N.Success,
|
|
247
247
|
content: "Successfully replayed local records"
|
|
248
248
|
}), r;
|
|
249
249
|
}
|
|
@@ -251,164 +251,182 @@ const L = {
|
|
|
251
251
|
id: "action-recorder.command.replay-local-records-active",
|
|
252
252
|
type: u.COMMAND,
|
|
253
253
|
handler: async (e) => {
|
|
254
|
-
const r = await e.get(
|
|
255
|
-
return r && e.get(
|
|
256
|
-
type:
|
|
254
|
+
const r = await e.get(v).replayLocalJSON(D.ACTIVE);
|
|
255
|
+
return r && e.get(M).show({
|
|
256
|
+
type: N.Success,
|
|
257
257
|
content: "Successfully replayed local records"
|
|
258
258
|
}), r;
|
|
259
259
|
}
|
|
260
|
-
},
|
|
260
|
+
}, B = {
|
|
261
261
|
id: "action-recorder.operation.open-panel",
|
|
262
262
|
type: u.OPERATION,
|
|
263
263
|
handler(e) {
|
|
264
264
|
return e.get(l).togglePanel(!0), !0;
|
|
265
265
|
}
|
|
266
|
-
},
|
|
266
|
+
}, ne = {
|
|
267
267
|
id: "action-recorder.operation.close-panel",
|
|
268
268
|
type: u.OPERATION,
|
|
269
269
|
handler(e) {
|
|
270
270
|
return e.get(l).togglePanel(!1), !0;
|
|
271
271
|
}
|
|
272
|
-
}, Mt = "univer-action-recorder-panel", Nt = "univer-action-recorder-panel-icon", bt = "univer-action-recorder-panel-icon-recording", xt = "univer-action-recorder-panel-title", At = "univer-action-recorder-panel-actions", y = {
|
|
273
|
-
actionRecorderPanel: Mt,
|
|
274
|
-
actionRecorderPanelIcon: Nt,
|
|
275
|
-
actionRecorderPanelIconRecording: bt,
|
|
276
|
-
actionRecorderPanelTitle: xt,
|
|
277
|
-
actionRecorderPanelActions: At
|
|
278
272
|
};
|
|
279
|
-
function
|
|
280
|
-
const e =
|
|
281
|
-
return F(e.panelOpened$) ? /* @__PURE__ */ h(
|
|
273
|
+
function Ot() {
|
|
274
|
+
const e = P(l);
|
|
275
|
+
return F(e.panelOpened$) ? /* @__PURE__ */ h(xt, {}) : null;
|
|
282
276
|
}
|
|
283
|
-
function
|
|
284
|
-
var
|
|
285
|
-
const e =
|
|
286
|
-
r || e.executeCommand(
|
|
287
|
-
}, [e, r]),
|
|
288
|
-
r || e.executeCommand(
|
|
289
|
-
}, [e, r]),
|
|
277
|
+
function xt() {
|
|
278
|
+
var s;
|
|
279
|
+
const e = P(b), t = P(l), r = F(t.recording$), n = F(t.recordedCommands$), o = (s = n == null ? void 0 : n.length) != null ? s : 0, i = I(() => {
|
|
280
|
+
r || e.executeCommand(ne.id);
|
|
281
|
+
}, [e, r]), a = I((p) => {
|
|
282
|
+
r || e.executeCommand(ee.id, { replaceId: p });
|
|
283
|
+
}, [e, r]), c = I(() => {
|
|
284
|
+
r && e.executeCommand(te.id);
|
|
285
|
+
}, [e, r]), f = I(() => {
|
|
290
286
|
r && e.executeCommand(re.id);
|
|
291
|
-
}, [e, r]), f = O(() => {
|
|
292
|
-
r && e.executeCommand(ne.id);
|
|
293
287
|
}, [e, r]), g = r ? o === 0 ? "Recording..." : `${o}: ${n[o - 1].id}` : "Start Recording";
|
|
294
|
-
return /* @__PURE__ */
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
288
|
+
return /* @__PURE__ */ V(
|
|
289
|
+
"div",
|
|
290
|
+
{
|
|
291
|
+
className: `
|
|
292
|
+
univer-fixed univer-bottom-20 univer-left-1/2 univer-z-[1000] univer-flex univer-h-16 univer-w-[512px]
|
|
293
|
+
-univer-translate-x-1/2 univer-items-center univer-rounded-lg univer-bg-white univer-px-5 univer-shadow-lg
|
|
294
|
+
`,
|
|
295
|
+
children: [
|
|
296
|
+
/* @__PURE__ */ h("div", { className: "univer-mr-2 univer-size-5 univer-shrink-0 univer-grow-0 univer-text-xl", children: /* @__PURE__ */ h(E, {}) }),
|
|
297
|
+
/* @__PURE__ */ h("div", { className: "univer-flex-1 univer-text-[13px]", children: g }),
|
|
298
|
+
/* @__PURE__ */ V("div", { className: "univer-flex univer-w-64 univer-shrink-0 univer-grow-0 univer-justify-between", children: [
|
|
299
|
+
/* @__PURE__ */ h(
|
|
300
|
+
U,
|
|
301
|
+
{
|
|
302
|
+
className: "univer-w-20",
|
|
303
|
+
onClick: r ? f : i,
|
|
304
|
+
children: r ? "Cancel" : "Close"
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
/* @__PURE__ */ h(
|
|
308
|
+
U,
|
|
309
|
+
{
|
|
310
|
+
className: "univer-w-20",
|
|
311
|
+
variant: "primary",
|
|
312
|
+
onClick: r ? c : () => a(),
|
|
313
|
+
children: r ? "Save" : "Start"
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
!r && /* @__PURE__ */ h(U, { variant: "primary", onClick: () => a(!0), children: "Start(N)" })
|
|
317
|
+
] })
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
);
|
|
303
321
|
}
|
|
304
|
-
const
|
|
305
|
-
function
|
|
322
|
+
const oe = "RECORD_MENU_ITEM";
|
|
323
|
+
function wt() {
|
|
306
324
|
return {
|
|
307
|
-
id:
|
|
308
|
-
type:
|
|
325
|
+
id: oe,
|
|
326
|
+
type: y.SUBITEMS,
|
|
309
327
|
icon: "RecordSingle",
|
|
310
328
|
tooltip: "action-recorder.menu.title"
|
|
311
329
|
};
|
|
312
330
|
}
|
|
313
|
-
function
|
|
331
|
+
function bt(e) {
|
|
314
332
|
const t = e.get(l);
|
|
315
333
|
return {
|
|
316
|
-
id:
|
|
334
|
+
id: B.id,
|
|
317
335
|
title: "action-recorder.menu.record",
|
|
318
|
-
type:
|
|
336
|
+
type: y.BUTTON,
|
|
319
337
|
disabled$: t.panelOpened$
|
|
320
338
|
};
|
|
321
339
|
}
|
|
322
|
-
function
|
|
340
|
+
function Mt() {
|
|
323
341
|
return {
|
|
324
|
-
id:
|
|
342
|
+
id: j.id,
|
|
325
343
|
title: "action-recorder.menu.replay-local",
|
|
326
|
-
type:
|
|
344
|
+
type: y.BUTTON
|
|
327
345
|
};
|
|
328
346
|
}
|
|
329
|
-
function
|
|
347
|
+
function Nt() {
|
|
330
348
|
return {
|
|
331
|
-
id:
|
|
349
|
+
id: L.id,
|
|
332
350
|
title: "action-recorder.menu.replay-local-name",
|
|
333
|
-
type:
|
|
351
|
+
type: y.BUTTON
|
|
334
352
|
};
|
|
335
353
|
}
|
|
336
|
-
function
|
|
354
|
+
function Ut() {
|
|
337
355
|
return {
|
|
338
356
|
id: k.id,
|
|
339
357
|
title: "action-recorder.menu.replay-local-active",
|
|
340
|
-
type:
|
|
358
|
+
type: y.BUTTON
|
|
341
359
|
};
|
|
342
360
|
}
|
|
343
|
-
const
|
|
344
|
-
[
|
|
345
|
-
[
|
|
361
|
+
const At = {
|
|
362
|
+
[ct.OTHERS]: {
|
|
363
|
+
[oe]: {
|
|
346
364
|
order: 10,
|
|
347
|
-
menuItemFactory:
|
|
348
|
-
[
|
|
365
|
+
menuItemFactory: wt,
|
|
366
|
+
[B.id]: {
|
|
349
367
|
order: 1,
|
|
350
|
-
menuItemFactory:
|
|
368
|
+
menuItemFactory: bt
|
|
351
369
|
},
|
|
352
|
-
[
|
|
370
|
+
[j.id]: {
|
|
353
371
|
order: 2,
|
|
354
|
-
menuItemFactory:
|
|
372
|
+
menuItemFactory: Mt
|
|
355
373
|
},
|
|
356
|
-
[
|
|
374
|
+
[L.id]: {
|
|
357
375
|
order: 3,
|
|
358
|
-
menuItemFactory:
|
|
376
|
+
menuItemFactory: Nt
|
|
359
377
|
},
|
|
360
378
|
[k.id]: {
|
|
361
379
|
order: 4,
|
|
362
|
-
menuItemFactory:
|
|
380
|
+
menuItemFactory: Ut
|
|
363
381
|
}
|
|
364
382
|
}
|
|
365
383
|
}
|
|
366
384
|
};
|
|
367
|
-
var
|
|
368
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
369
|
-
(
|
|
385
|
+
var $t = Object.getOwnPropertyDescriptor, Pt = (e, t, r, n) => {
|
|
386
|
+
for (var o = n > 1 ? void 0 : n ? $t(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
387
|
+
(a = e[i]) && (o = a(o) || o);
|
|
370
388
|
return o;
|
|
371
389
|
}, S = (e, t) => (r, n) => t(r, n, e);
|
|
372
|
-
let
|
|
390
|
+
let w = class extends T {
|
|
373
391
|
constructor(e, t, r, n, o, i) {
|
|
374
392
|
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();
|
|
375
393
|
}
|
|
376
394
|
_initCommands() {
|
|
377
395
|
[
|
|
396
|
+
ee,
|
|
397
|
+
re,
|
|
378
398
|
te,
|
|
399
|
+
B,
|
|
379
400
|
ne,
|
|
380
|
-
|
|
381
|
-
V,
|
|
382
|
-
oe,
|
|
401
|
+
j,
|
|
383
402
|
L,
|
|
384
|
-
B,
|
|
385
403
|
k
|
|
386
404
|
].forEach((e) => this._commandSrv.registerCommand(e));
|
|
387
405
|
}
|
|
388
406
|
_initUI() {
|
|
389
|
-
this._uiPartsSrv.registerComponent(
|
|
407
|
+
this._uiPartsSrv.registerComponent(mt.GLOBAL, () => ut(Ot, this._injector)), this._componentManager.register("RecordSingle", E), this._menuManagerService.mergeMenu(At);
|
|
390
408
|
}
|
|
391
409
|
_initSheetsCommands() {
|
|
392
410
|
[
|
|
393
411
|
// InsertColCommand,
|
|
394
412
|
// InsertRowCommand,
|
|
395
413
|
// #region basic commands
|
|
414
|
+
me,
|
|
396
415
|
ue,
|
|
397
416
|
fe,
|
|
398
417
|
ge,
|
|
399
418
|
he,
|
|
400
|
-
pe,
|
|
401
|
-
Se,
|
|
402
419
|
ve,
|
|
420
|
+
Se,
|
|
421
|
+
pe,
|
|
403
422
|
Ce,
|
|
404
423
|
_e,
|
|
405
424
|
ye,
|
|
406
425
|
Re,
|
|
407
426
|
Ie,
|
|
408
427
|
Oe,
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
Ne,
|
|
428
|
+
xe,
|
|
429
|
+
we,
|
|
412
430
|
// ResetBackgroundColorCommand,
|
|
413
431
|
// ResetTextColorCommand,
|
|
414
432
|
// SetBackgroundColorCommand,
|
|
@@ -416,26 +434,27 @@ let N = class extends E {
|
|
|
416
434
|
// SetFontFamilyCommand,
|
|
417
435
|
// SetFontSizeCommand,
|
|
418
436
|
be,
|
|
419
|
-
|
|
420
|
-
|
|
437
|
+
Me,
|
|
438
|
+
Ne,
|
|
421
439
|
// SetItalicCommand,
|
|
422
440
|
Ue,
|
|
441
|
+
Ve,
|
|
423
442
|
We,
|
|
424
|
-
He,
|
|
425
443
|
ze,
|
|
444
|
+
He,
|
|
426
445
|
Je,
|
|
427
446
|
Ge,
|
|
428
447
|
Ze,
|
|
429
448
|
Ke,
|
|
430
449
|
Ye,
|
|
431
|
-
|
|
432
|
-
we,
|
|
450
|
+
Ae,
|
|
433
451
|
$e,
|
|
434
|
-
|
|
452
|
+
Pe,
|
|
435
453
|
Fe,
|
|
436
|
-
|
|
454
|
+
Te,
|
|
437
455
|
// SetUnderlineCommand,
|
|
438
|
-
|
|
456
|
+
Ee,
|
|
457
|
+
qe,
|
|
439
458
|
Qe,
|
|
440
459
|
Xe,
|
|
441
460
|
et,
|
|
@@ -444,10 +463,9 @@ let N = class extends E {
|
|
|
444
463
|
nt,
|
|
445
464
|
ot,
|
|
446
465
|
it,
|
|
447
|
-
ct,
|
|
448
466
|
at,
|
|
467
|
+
De,
|
|
449
468
|
je,
|
|
450
|
-
Le,
|
|
451
469
|
$,
|
|
452
470
|
// #endregion
|
|
453
471
|
// #region data validation command
|
|
@@ -455,56 +473,56 @@ let N = class extends E {
|
|
|
455
473
|
// #region conditional formatting command
|
|
456
474
|
// #endregion
|
|
457
475
|
// #region filter command
|
|
458
|
-
|
|
476
|
+
Le,
|
|
459
477
|
ke,
|
|
460
|
-
|
|
478
|
+
Be
|
|
461
479
|
// #endregion
|
|
462
480
|
].forEach((e) => this._actionRecorderService.registerRecordedCommand(e));
|
|
463
481
|
}
|
|
464
482
|
_initDocsCommands() {
|
|
465
483
|
}
|
|
466
484
|
};
|
|
467
|
-
|
|
485
|
+
w = Pt([
|
|
468
486
|
S(0, b),
|
|
469
487
|
S(1, st),
|
|
470
|
-
S(2,
|
|
471
|
-
S(3,
|
|
472
|
-
S(4,
|
|
473
|
-
S(5,
|
|
474
|
-
],
|
|
475
|
-
const
|
|
476
|
-
var
|
|
477
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
478
|
-
(
|
|
488
|
+
S(2, dt),
|
|
489
|
+
S(3, x(lt)),
|
|
490
|
+
S(4, x(l)),
|
|
491
|
+
S(5, x(Z))
|
|
492
|
+
], w);
|
|
493
|
+
const Ft = "action-recorder.config", W = {};
|
|
494
|
+
var Tt = Object.getOwnPropertyDescriptor, Et = (e, t, r, n) => {
|
|
495
|
+
for (var o = n > 1 ? void 0 : n ? Tt(t, r) : t, i = e.length - 1, a; i >= 0; i--)
|
|
496
|
+
(a = e[i]) && (o = a(o) || o);
|
|
479
497
|
return o;
|
|
480
|
-
}, z = (e, t) => (r, n) => t(r, n, e),
|
|
481
|
-
let
|
|
482
|
-
constructor(e =
|
|
498
|
+
}, z = (e, t) => (r, n) => t(r, n, e), A;
|
|
499
|
+
let H = (A = class extends de {
|
|
500
|
+
constructor(e = W, t, r) {
|
|
483
501
|
super(), this._config = e, this._injector = t, this._configService = r;
|
|
484
|
-
const { menu: n, ...o } =
|
|
502
|
+
const { menu: n, ...o } = le(
|
|
485
503
|
{},
|
|
486
|
-
|
|
504
|
+
W,
|
|
487
505
|
this._config
|
|
488
506
|
);
|
|
489
|
-
n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(
|
|
507
|
+
n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(Ft, o);
|
|
490
508
|
}
|
|
491
509
|
onStarting() {
|
|
492
|
-
(this._config.replayOnly ? [[
|
|
510
|
+
(this._config.replayOnly ? [[v]] : [
|
|
493
511
|
[l],
|
|
494
|
-
[
|
|
495
|
-
[
|
|
512
|
+
[v],
|
|
513
|
+
[w]
|
|
496
514
|
]).forEach((t) => this._injector.add(t));
|
|
497
515
|
}
|
|
498
516
|
onSteady() {
|
|
499
|
-
this._config.replayOnly || this._injector.get(
|
|
517
|
+
this._config.replayOnly || this._injector.get(w);
|
|
500
518
|
}
|
|
501
|
-
}, m(
|
|
502
|
-
|
|
503
|
-
z(1,
|
|
519
|
+
}, m(A, "pluginName", "UNIVER_ACTION_RECORDER_PLUGIN"), A);
|
|
520
|
+
H = Et([
|
|
521
|
+
z(1, x(Z)),
|
|
504
522
|
z(2, se)
|
|
505
|
-
],
|
|
523
|
+
], H);
|
|
506
524
|
export {
|
|
507
525
|
l as ActionRecorderService,
|
|
508
|
-
|
|
509
|
-
|
|
526
|
+
v as ActionReplayService,
|
|
527
|
+
H as UniverActionRecorderPlugin
|
|
510
528
|
};
|