@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/es/index.js CHANGED
@@ -1,86 +1,129 @@
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
- var m = (e, t, r) => ae(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { Disposable as T, CommandType as u, ICommandService as M, ILogService as J, IUniverInstanceService as G, awaitTime as ce, Inject as w, 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 he, DeltaRowHeightCommand as ge, InsertSheetCommand as ve, InsertColAfterCommand as pe, InsertColBeforeCommand as Se, InsertRowAfterCommand as Ce, InsertRowBeforeCommand as _e, RemoveSheetCommand as ye, SetStyleCommand as Re, AddWorksheetMergeCommand as Ie, AddWorksheetMergeAllCommand as Oe, AddWorksheetMergeVerticalCommand as we, AddWorksheetMergeHorizontalCommand as xe, SetFrozenCommand as Me, CancelFrozenCommand as be, 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 b, 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";
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 N, Button as U } from "@univerjs/design";
11
- import { jsx as g, 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
- for (var t, r = 1, n = arguments.length; r < n; r++) {
16
- t = arguments[r];
17
- for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
18
- }
19
- return e;
20
- }, d.apply(this, arguments);
21
- }, ht = function(e, t) {
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 gt(e, t, r) {
38
- var n = d({}, e.attrs);
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 a = i[0], c = i[1];
41
- a === "mask" && typeof c == "string" && (n[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
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
- var o = t.defIds;
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 a = i[0], c = i[1];
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 vt(e, t) {
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) ? d(d({}, e), { children: e.children.map(function(o) {
52
- return typeof o.attrs.id == "string" && n && n.includes(o.attrs.id) ? d(d({}, o), { attrs: d(d({}, o.attrs), { id: o.attrs.id + t.idSuffix }) }) : o;
53
- }) }) : e;
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 pt() {
55
+ function ft() {
56
56
  return Math.random().toString(36).substring(2, 8);
57
57
  }
58
- Q.displayName = "UniverIcon";
59
- var St = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "g", attrs: { fill: "currentColor", clipPath: "url(#record-icon_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-icon_clip0_1559_19" }, children: [{ tag: "path", attrs: { fill: "white", d: "M0 0H16V16H0z", transform: "translate(.94)" } }] }] }], defIds: ["record-icon_clip0_1559_19"] }, E = Y(function(e, t) {
60
- return q(Q, Object.assign({}, e, {
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: t,
63
- icon: St
105
+ ref: r,
106
+ icon: pt
64
107
  }));
65
108
  });
66
- E.displayName = "RecordIcon";
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);
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
- }, O = (e, t) => (r, n) => t(r, n, e);
72
- let l = class extends T {
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
- m(this, "_shouldRecordCommands", /* @__PURE__ */ new Set());
76
- m(this, "_panelOpened$", new R(!1));
77
- m(this, "panelOpened$", this._panelOpened$.asObservable());
78
- m(this, "_recorder", null);
79
- m(this, "_recording$", new R(!1));
80
- m(this, "recording$", this._recording$.asObservable());
81
- m(this, "_recorded$", new R([]));
82
- m(this, "_recordedCommands$", new R([]));
83
- m(this, "recordedCommands$", this._recordedCommands$.asObservable());
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 === u.MUTATION) throw new Error("[CommandRecorderService] Cannot record mutation commands.");
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, a = this._recordedCommands;
107
- let c = { ...r };
108
- const f = (n = this._instanceService.getFocusedUnit()) == null ? void 0 : n.getUnitId(), { unitId: h = f, subUnitId: s } = c == null ? void 0 : c.params;
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
- c = {
112
- ...c,
154
+ a = {
155
+ ...a,
113
156
  params: {
114
- ...c.params,
157
+ ...a.params,
115
158
  subUnitId: S
116
159
  }
117
160
  };
118
161
  }
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)));
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
- l = _t([
133
- O(0, M),
134
- O(1, J),
135
- O(2, K),
136
- O(3, G)
137
- ], l);
138
- const ee = {
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: u.COMMAND,
141
- handler: (e, t) => (e.get(l).startRecording(!!(t != null && t.replaceId)), !0)
142
- }, te = {
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: u.COMMAND,
145
- handler: (e) => (e.get(l).completeRecording(), !0)
146
- }, re = {
187
+ type: m.COMMAND,
188
+ handler: (e) => (e.get(d).completeRecording(), !0)
189
+ }, ee = {
147
190
  id: "action-recorder.command.stop-recording",
148
- type: u.COMMAND,
149
- handler: (e) => (e.get(l).completeRecording(), !0)
191
+ type: m.COMMAND,
192
+ handler: (e) => (e.get(d).completeRecording(), !0)
150
193
  };
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);
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
- }, _ = (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 {
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: N.Error,
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, a;
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 c of e) {
187
- const { id: f, params: h } = c, s = h;
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 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}`);
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 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");
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(f, h)) return !1;
198
- } else if (!await this._commandService.executeCommand(f)) return !1;
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 ce(It());
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
- v = Rt([
221
- _(0, b),
222
- _(1, G),
223
- _(2, K),
224
- _(3, J),
225
- _(4, M)
226
- ], v);
227
- function It() {
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 j = {
273
+ const E = {
231
274
  id: "action-recorder.command.replay-local-records",
232
- type: u.COMMAND,
275
+ type: m.COMMAND,
233
276
  handler: async (e) => {
234
- const r = await e.get(v).replayLocalJSON();
235
- return r && e.get(b).show({
236
- type: N.Success,
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: u.COMMAND,
285
+ type: m.COMMAND,
243
286
  handler: async (e) => {
244
- const r = await e.get(v).replayLocalJSON(D.NAME);
245
- return r && e.get(b).show({
246
- type: N.Success,
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
- }, k = {
293
+ }, j = {
251
294
  id: "action-recorder.command.replay-local-records-active",
252
- type: u.COMMAND,
295
+ type: m.COMMAND,
253
296
  handler: async (e) => {
254
- const r = await e.get(v).replayLocalJSON(D.ACTIVE);
255
- return r && e.get(b).show({
256
- type: N.Success,
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: u.OPERATION,
305
+ type: m.OPERATION,
263
306
  handler(e) {
264
- return e.get(l).togglePanel(!0), !0;
307
+ return e.get(d).togglePanel(!0), !0;
265
308
  }
266
- }, ne = {
309
+ }, te = {
267
310
  id: "action-recorder.operation.close-panel",
268
- type: u.OPERATION,
311
+ type: m.OPERATION,
269
312
  handler(e) {
270
- return e.get(l).togglePanel(!1), !0;
313
+ return e.get(d).togglePanel(!1), !0;
271
314
  }
272
315
  };
273
- function Ot() {
274
- const e = P(l);
275
- return F(e.panelOpened$) ? /* @__PURE__ */ g(wt, {}) : null;
316
+ function Rt() {
317
+ const e = b(d);
318
+ return F(e.panelOpened$) ? /* @__PURE__ */ g(It, {}) : null;
276
319
  }
277
- function wt() {
320
+ function It() {
278
321
  var s;
279
- const e = P(M), 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((S) => {
282
- r || e.executeCommand(ee.id, { replaceId: S });
283
- }, [e, r]), c = I(() => {
284
- r && e.executeCommand(te.id);
285
- }, [e, r]), f = I(() => {
286
- r && e.executeCommand(re.id);
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__ */ V(
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(E, {}) }),
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__ */ V("div", { className: "univer-flex univer-w-64 univer-shrink-0 univer-grow-0 univer-justify-between", children: [
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
- U,
340
+ N,
298
341
  {
299
342
  className: "univer-w-20",
300
- onClick: r ? f : i,
343
+ onClick: r ? u : i,
301
344
  children: r ? "Cancel" : "Close"
302
345
  }
303
346
  ),
304
347
  /* @__PURE__ */ g(
305
- U,
348
+ N,
306
349
  {
307
350
  className: "univer-w-20",
308
351
  variant: "primary",
309
- onClick: r ? c : () => a(),
352
+ onClick: r ? a : () => c(),
310
353
  children: r ? "Save" : "Start"
311
354
  }
312
355
  ),
313
- !r && /* @__PURE__ */ g(U, { variant: "primary", onClick: () => a(!0), children: "Start(N)" })
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 oe = "RECORD_MENU_ITEM";
320
- function xt() {
362
+ const re = "RECORD_MENU_ITEM";
363
+ function Ot() {
321
364
  return {
322
- id: oe,
323
- type: y.SUBITEMS,
365
+ id: re,
366
+ type: _.SUBITEMS,
324
367
  icon: "RecordIcon",
325
368
  tooltip: "action-recorder.menu.title"
326
369
  };
327
370
  }
328
- function Mt(e) {
329
- const t = e.get(l);
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: y.BUTTON,
376
+ type: _.BUTTON,
334
377
  disabled$: t.panelOpened$
335
378
  };
336
379
  }
337
- function bt() {
380
+ function Mt() {
338
381
  return {
339
- id: j.id,
382
+ id: E.id,
340
383
  title: "action-recorder.menu.replay-local",
341
- type: y.BUTTON
384
+ type: _.BUTTON
342
385
  };
343
386
  }
344
- function Nt() {
387
+ function $t() {
345
388
  return {
346
389
  id: L.id,
347
390
  title: "action-recorder.menu.replay-local-name",
348
- type: y.BUTTON
391
+ type: _.BUTTON
349
392
  };
350
393
  }
351
- function Ut() {
394
+ function xt() {
352
395
  return {
353
- id: k.id,
396
+ id: j.id,
354
397
  title: "action-recorder.menu.replay-local-active",
355
- type: y.BUTTON
398
+ type: _.BUTTON
356
399
  };
357
400
  }
358
- const At = {
359
- [ct.OTHERS]: {
360
- [oe]: {
401
+ const Nt = {
402
+ [at.OTHERS]: {
403
+ [re]: {
361
404
  order: 2,
362
- menuItemFactory: xt,
405
+ menuItemFactory: Ot,
363
406
  [B.id]: {
364
407
  order: 1,
365
- menuItemFactory: Mt
408
+ menuItemFactory: wt
366
409
  },
367
- [j.id]: {
410
+ [E.id]: {
368
411
  order: 2,
369
- menuItemFactory: bt
412
+ menuItemFactory: Mt
370
413
  },
371
414
  [L.id]: {
372
415
  order: 3,
373
- menuItemFactory: Nt
416
+ menuItemFactory: $t
374
417
  },
375
- [k.id]: {
418
+ [j.id]: {
376
419
  order: 4,
377
- menuItemFactory: Ut
420
+ menuItemFactory: xt
378
421
  }
379
422
  }
380
423
  }
381
424
  };
382
- var $t = Object.getOwnPropertyDescriptor, Pt = (e, t, r, n) => {
383
- for (var o = n > 1 ? void 0 : n ? $t(t, r) : t, i = e.length - 1, a; i >= 0; i--)
384
- (a = e[i]) && (o = a(o) || o);
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 x = class extends T {
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
- re,
395
- te,
438
+ X,
396
439
  B,
397
- ne,
398
- j,
440
+ te,
441
+ E,
399
442
  L,
400
- k
443
+ j
401
444
  ].forEach((e) => this._commandSrv.registerCommand(e));
402
445
  }
403
446
  _initUI() {
404
- this._uiPartsSrv.registerComponent(mt.GLOBAL, () => ut(Ot, this._injector)), this.disposeWithMe(
405
- this._componentManager.register("RecordIcon", E)
406
- ), this._menuManagerService.mergeMenu(At);
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
- ve,
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
- xe,
471
+ Me,
429
472
  // ResetBackgroundColorCommand,
430
473
  // ResetTextColorCommand,
431
474
  // SetBackgroundColorCommand,
432
475
  // SetBoldCommand,
433
476
  // SetFontFamilyCommand,
434
477
  // SetFontSizeCommand,
435
- Me,
436
- be,
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
- $e,
451
- Pe,
493
+ be,
452
494
  Fe,
495
+ Pe,
453
496
  Te,
454
497
  // SetUnderlineCommand,
455
- Ee,
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
- at,
466
- De,
467
- je,
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
- Le,
476
- ke,
477
- Be
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
- x = Pt([
527
+ w = At([
485
528
  p(0, M),
486
529
  p(1, st),
487
530
  p(2, dt),
488
- p(3, w(lt)),
489
- p(4, w(l)),
490
- p(5, w(Z))
491
- ], x);
492
- const Ft = "action-recorder.config", W = {};
493
- var Tt = Object.getOwnPropertyDescriptor, Et = (e, t, r, n) => {
494
- for (var o = n > 1 ? void 0 : n ? Tt(t, r) : t, i = e.length - 1, a; i >= 0; i--)
495
- (a = e[i]) && (o = a(o) || o);
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
- }, z = (e, t) => (r, n) => t(r, n, e), A;
498
- let H = (A = class extends de {
499
- constructor(e = W, t, r) {
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 } = le(
544
+ const { menu: n, ...o } = se(
502
545
  {},
503
- W,
546
+ V,
504
547
  this._config
505
548
  );
506
- n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(Ft, o);
549
+ n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(bt, o);
507
550
  }
508
551
  onStarting() {
509
- (this._config.replayOnly ? [[v]] : [
510
- [l],
511
- [v],
512
- [x]
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(x);
559
+ this._config.replayOnly || this._injector.get(w);
517
560
  }
518
- }, m(A, "pluginName", "UNIVER_ACTION_RECORDER_PLUGIN"), A);
519
- H = Et([
520
- z(1, w(Z)),
521
- z(2, se)
522
- ], H);
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
- l as ActionRecorderService,
525
- v as ActionReplayService,
526
- H as UniverActionRecorderPlugin
567
+ d as ActionRecorderService,
568
+ f as ActionReplayService,
569
+ z as UniverActionRecorderPlugin
527
570
  };