@univerjs/ui 0.5.3 → 0.5.4
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/facade.js +1 -1
- package/lib/cjs/index.js +28 -29
- package/lib/es/facade.js +67 -64
- package/lib/es/index.js +910 -908
- package/lib/index.css +1 -1
- package/lib/types/facade/f-univer.d.ts +11 -7
- package/lib/types/index.d.ts +1 -0
- package/lib/types/services/clipboard/clipboard.command.d.ts +1 -1
- package/lib/types/services/parts/parts.service.d.ts +4 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +30 -31
- package/package.json +9 -9
package/lib/es/facade.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
var x = Object.defineProperty;
|
|
2
|
-
var E = (
|
|
3
|
-
var o = (
|
|
4
|
-
import { Inject as l, Injector as
|
|
5
|
-
import { IMenuManagerService as
|
|
6
|
-
var
|
|
7
|
-
for (var n =
|
|
8
|
-
(c =
|
|
9
|
-
return
|
|
10
|
-
}, d = (
|
|
11
|
-
let
|
|
12
|
-
constructor(e, t,
|
|
2
|
+
var E = (i, e, t) => e in i ? x(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var o = (i, e, t) => E(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Inject as l, Injector as v, ICommandService as u, FBase as b, Tools as U, CommandType as B, FUniver as I, connectInjector as D, FHooks as P, FEnum as j } from "@univerjs/core";
|
|
5
|
+
import { IMenuManagerService as M, MenuItemType as C, RibbonStartGroup as F, RibbonPosition as O, MenuManagerPosition as T, IShortcutService as w, CopyCommand as m, PasteCommand as S, ISidebarService as R, IDialogService as $, ComponentManager as G, IMessageService as V, IUIPartsService as h, SheetPasteShortKeyCommandName as N, BuiltInUIPart as H } from "@univerjs/ui";
|
|
6
|
+
var L = Object.defineProperty, A = Object.getOwnPropertyDescriptor, y = (i, e, t, r) => {
|
|
7
|
+
for (var n = r > 1 ? void 0 : r ? A(e, t) : e, s = i.length - 1, c; s >= 0; s--)
|
|
8
|
+
(c = i[s]) && (n = (r ? c(e, t, n) : c(n)) || n);
|
|
9
|
+
return r && n && L(e, t, n), n;
|
|
10
|
+
}, d = (i, e) => (t, r) => e(t, r, i), a;
|
|
11
|
+
let p = (a = class extends b {
|
|
12
|
+
constructor(e, t, r, n) {
|
|
13
13
|
super();
|
|
14
14
|
o(this, "_commandToRegister", /* @__PURE__ */ new Map());
|
|
15
15
|
o(this, "_buildingSchema");
|
|
16
|
-
this._item = e, this._injector = t, this._commandService =
|
|
16
|
+
this._item = e, this._injector = t, this._commandService = r, this._menuManagerService = n;
|
|
17
17
|
const s = typeof e.action == "string" ? e.action : U.generateRandomId(12);
|
|
18
18
|
s !== e.action && this._commandToRegister.set(s, e.action), this._buildingSchema = {
|
|
19
19
|
// eslint-disable-next-line ts/explicit-function-return-type
|
|
@@ -48,19 +48,19 @@ let S = (a = class extends v {
|
|
|
48
48
|
[e]: t
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
}, o(a, "RibbonStartGroup",
|
|
52
|
-
|
|
53
|
-
d(1, l(
|
|
51
|
+
}, o(a, "RibbonStartGroup", F), o(a, "RibbonPosition", O), o(a, "MenuManagerPosition", T), a);
|
|
52
|
+
p = y([
|
|
53
|
+
d(1, l(v)),
|
|
54
54
|
d(2, u),
|
|
55
|
-
d(3,
|
|
56
|
-
],
|
|
57
|
-
let
|
|
58
|
-
constructor(e, t,
|
|
55
|
+
d(3, M)
|
|
56
|
+
], p);
|
|
57
|
+
let _ = class extends b {
|
|
58
|
+
constructor(e, t, r) {
|
|
59
59
|
super();
|
|
60
60
|
o(this, "_menuByGroups", []);
|
|
61
61
|
o(this, "_submenus", []);
|
|
62
62
|
o(this, "_buildingSchema");
|
|
63
|
-
this._item = e, this._injector = t, this._menuManagerService =
|
|
63
|
+
this._item = e, this._injector = t, this._menuManagerService = r, this._buildingSchema = {
|
|
64
64
|
// eslint-disable-next-line ts/explicit-function-return-type
|
|
65
65
|
menuItemFactory: () => ({
|
|
66
66
|
id: e.id,
|
|
@@ -99,24 +99,24 @@ let p = class extends v {
|
|
|
99
99
|
/** @ignore */
|
|
100
100
|
__getSchema() {
|
|
101
101
|
const e = {};
|
|
102
|
-
return this.addSeparator(), this._menuByGroups.forEach((t,
|
|
102
|
+
return this.addSeparator(), this._menuByGroups.forEach((t, r) => {
|
|
103
103
|
const n = {};
|
|
104
104
|
t.forEach((s) => {
|
|
105
105
|
Object.assign(n, s.__getSchema());
|
|
106
|
-
}), e[`${this._item.id}-group-${
|
|
106
|
+
}), e[`${this._item.id}-group-${r}`] = n;
|
|
107
107
|
}), { [this._item.id]: Object.assign(this._buildingSchema, e) };
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
|
|
111
|
-
d(1, l(
|
|
112
|
-
d(2,
|
|
113
|
-
],
|
|
114
|
-
var
|
|
115
|
-
for (var n =
|
|
116
|
-
(c =
|
|
117
|
-
return
|
|
118
|
-
}, f = (
|
|
119
|
-
let
|
|
110
|
+
_ = y([
|
|
111
|
+
d(1, l(v)),
|
|
112
|
+
d(2, M)
|
|
113
|
+
], _);
|
|
114
|
+
var K = Object.defineProperty, q = Object.getOwnPropertyDescriptor, z = (i, e, t, r) => {
|
|
115
|
+
for (var n = r > 1 ? void 0 : r ? q(e, t) : e, s = i.length - 1, c; s >= 0; s--)
|
|
116
|
+
(c = i[s]) && (n = (r ? c(e, t, n) : c(n)) || n);
|
|
117
|
+
return r && n && K(e, t, n), n;
|
|
118
|
+
}, f = (i, e) => (t, r) => e(t, r, i);
|
|
119
|
+
let g = class extends b {
|
|
120
120
|
constructor(e, t) {
|
|
121
121
|
super();
|
|
122
122
|
o(this, "_forceEscapeDisposable", null);
|
|
@@ -133,84 +133,87 @@ let _ = class extends v {
|
|
|
133
133
|
return this._shortcutService.dispatch(e);
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
|
-
|
|
137
|
-
f(0, l(
|
|
138
|
-
f(1,
|
|
139
|
-
],
|
|
140
|
-
class
|
|
136
|
+
g = z([
|
|
137
|
+
f(0, l(v)),
|
|
138
|
+
f(1, w)
|
|
139
|
+
], g);
|
|
140
|
+
class J extends I {
|
|
141
141
|
getURL() {
|
|
142
142
|
return new URL(window.location.href);
|
|
143
143
|
}
|
|
144
144
|
getShortcut() {
|
|
145
|
-
return this._injector.createInstance(
|
|
145
|
+
return this._injector.createInstance(g);
|
|
146
146
|
}
|
|
147
147
|
copy() {
|
|
148
|
-
return this._commandService.executeCommand(
|
|
148
|
+
return this._commandService.executeCommand(m.id);
|
|
149
149
|
}
|
|
150
150
|
paste() {
|
|
151
|
-
return this._commandService.executeCommand(
|
|
151
|
+
return this._commandService.executeCommand(S.id);
|
|
152
152
|
}
|
|
153
153
|
createMenu(e) {
|
|
154
|
-
return this._injector.createInstance(
|
|
154
|
+
return this._injector.createInstance(p, e);
|
|
155
155
|
}
|
|
156
156
|
createSubmenu(e) {
|
|
157
|
-
return this._injector.createInstance(
|
|
157
|
+
return this._injector.createInstance(_, e);
|
|
158
158
|
}
|
|
159
159
|
openSiderbar(e) {
|
|
160
|
-
return this._injector.get(
|
|
160
|
+
return this._injector.get(R).open(e);
|
|
161
161
|
}
|
|
162
162
|
openSidebar(e) {
|
|
163
163
|
return this.openSiderbar(e);
|
|
164
164
|
}
|
|
165
165
|
openDialog(e) {
|
|
166
|
-
const
|
|
166
|
+
const r = this._injector.get($).open({
|
|
167
167
|
...e,
|
|
168
168
|
onClose: () => {
|
|
169
|
-
|
|
169
|
+
r.dispose();
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
|
-
return
|
|
172
|
+
return r;
|
|
173
173
|
}
|
|
174
174
|
getComponentManager() {
|
|
175
|
-
return this._injector.get(
|
|
175
|
+
return this._injector.get(G);
|
|
176
176
|
}
|
|
177
177
|
showMessage(e) {
|
|
178
|
-
return this._injector.get(
|
|
178
|
+
return this._injector.get(V).show(e), this;
|
|
179
179
|
}
|
|
180
180
|
setUIVisible(e, t) {
|
|
181
|
-
return this._injector.get(
|
|
181
|
+
return this._injector.get(h).setUIVisible(e, t), this;
|
|
182
182
|
}
|
|
183
183
|
isUIVisible(e) {
|
|
184
|
-
return this._injector.get(
|
|
184
|
+
return this._injector.get(h).isUIVisible(e);
|
|
185
|
+
}
|
|
186
|
+
registerUIPart(e, t) {
|
|
187
|
+
return this._injector.get(h).registerComponent(e, () => D(t, this._injector));
|
|
185
188
|
}
|
|
186
189
|
}
|
|
187
|
-
I.extend(
|
|
188
|
-
class
|
|
190
|
+
I.extend(J);
|
|
191
|
+
class Q extends P {
|
|
189
192
|
onBeforeCopy(e) {
|
|
190
|
-
return this._injector.get(u).beforeCommandExecuted((
|
|
191
|
-
|
|
193
|
+
return this._injector.get(u).beforeCommandExecuted((r) => {
|
|
194
|
+
r.id === m.id && e();
|
|
192
195
|
});
|
|
193
196
|
}
|
|
194
197
|
onCopy(e) {
|
|
195
|
-
return this._injector.get(u).onCommandExecuted((
|
|
196
|
-
|
|
198
|
+
return this._injector.get(u).onCommandExecuted((r) => {
|
|
199
|
+
r.id === m.id && e();
|
|
197
200
|
});
|
|
198
201
|
}
|
|
199
202
|
onBeforePaste(e) {
|
|
200
|
-
return this._injector.get(u).beforeCommandExecuted((
|
|
201
|
-
|
|
203
|
+
return this._injector.get(u).beforeCommandExecuted((r) => {
|
|
204
|
+
r.id === S.id && e();
|
|
202
205
|
});
|
|
203
206
|
}
|
|
204
207
|
onPaste(e) {
|
|
205
|
-
return this._injector.get(u).onCommandExecuted((
|
|
206
|
-
(
|
|
208
|
+
return this._injector.get(u).onCommandExecuted((r) => {
|
|
209
|
+
(r.id === S.id || r.id === N) && e();
|
|
207
210
|
});
|
|
208
211
|
}
|
|
209
212
|
}
|
|
210
|
-
|
|
211
|
-
class
|
|
213
|
+
P.extend(Q);
|
|
214
|
+
class W extends j {
|
|
212
215
|
get BuiltInUIPart() {
|
|
213
|
-
return
|
|
216
|
+
return H;
|
|
214
217
|
}
|
|
215
218
|
}
|
|
216
|
-
|
|
219
|
+
j.extend(W);
|