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