@univerjs/ui 0.5.4 → 0.5.5-nightly.202501201336
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 +22 -23
- package/lib/es/facade.js +57 -53
- package/lib/es/index.js +3505 -3551
- package/lib/index.css +1 -1
- package/lib/types/components/hooks/index.d.ts +20 -0
- package/lib/types/components/hooks/update-effect.d.ts +2 -0
- package/lib/types/components/hooks/useClickOutSide.d.ts +5 -0
- package/lib/types/controllers/ui/ui-mobile.controller.d.ts +3 -3
- package/lib/types/facade/f-univer.d.ts +11 -1
- package/lib/types/index.d.ts +2 -4
- package/lib/types/views/components/popup/RectPopup.d.ts +1 -0
- package/lib/types/views/components/popup/dom-popup.d.ts +12 -0
- package/lib/types/views/components/popup/single-canvas-popup.d.ts +9 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +21 -22
- package/package.json +5 -5
- package/LICENSE +0 -176
package/lib/es/facade.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
var x = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var o = (
|
|
4
|
-
import { Inject as l, Injector as v, ICommandService as u, FBase as b, Tools as
|
|
5
|
-
import { IMenuManagerService as
|
|
6
|
-
var L = Object.defineProperty, A = Object.getOwnPropertyDescriptor,
|
|
7
|
-
for (var
|
|
8
|
-
(c =
|
|
9
|
-
return r &&
|
|
10
|
-
},
|
|
11
|
-
let
|
|
12
|
-
constructor(e, t, r,
|
|
2
|
+
var U = (n, e, t) => e in n ? x(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var o = (n, e, t) => U(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Inject as l, Injector as v, ICommandService as u, FBase as b, Tools as B, CommandType as D, FUniver as j, connectInjector as F, FHooks as P, FEnum as M } from "@univerjs/core";
|
|
5
|
+
import { IMenuManagerService as C, MenuItemType as y, RibbonStartGroup as O, RibbonPosition as T, MenuManagerPosition as w, IShortcutService as R, CopyCommand as m, PasteCommand as p, ISidebarService as $, IDialogService as G, ComponentManager as f, IMessageService as V, IUIPartsService as d, SheetPasteShortKeyCommandName as N, BuiltInUIPart as H } from "@univerjs/ui";
|
|
6
|
+
var L = Object.defineProperty, A = Object.getOwnPropertyDescriptor, E = (n, e, t, r) => {
|
|
7
|
+
for (var i = r > 1 ? void 0 : r ? A(e, t) : e, s = n.length - 1, c; s >= 0; s--)
|
|
8
|
+
(c = n[s]) && (i = (r ? c(e, t, i) : c(i)) || i);
|
|
9
|
+
return r && i && L(e, t, i), i;
|
|
10
|
+
}, h = (n, e) => (t, r) => e(t, r, n), a;
|
|
11
|
+
let S = (a = class extends b {
|
|
12
|
+
constructor(e, t, r, i) {
|
|
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 = r, this._menuManagerService =
|
|
17
|
-
const s = typeof e.action == "string" ? e.action :
|
|
16
|
+
this._item = e, this._injector = t, this._commandService = r, this._menuManagerService = i;
|
|
17
|
+
const s = typeof e.action == "string" ? e.action : B.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
|
|
20
20
|
menuItemFactory: () => ({
|
|
21
21
|
id: e.id,
|
|
22
|
-
type:
|
|
22
|
+
type: y.BUTTON,
|
|
23
23
|
// we only support button for now
|
|
24
24
|
icon: e.icon,
|
|
25
25
|
title: e.title,
|
|
@@ -33,7 +33,7 @@ let p = (a = class extends b {
|
|
|
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: D.COMMAND,
|
|
37
37
|
handler: e
|
|
38
38
|
});
|
|
39
39
|
}), { [this._item.id]: this._buildingSchema };
|
|
@@ -48,12 +48,12 @@ let p = (a = class extends b {
|
|
|
48
48
|
[e]: t
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
}, o(a, "RibbonStartGroup",
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
],
|
|
51
|
+
}, o(a, "RibbonStartGroup", O), o(a, "RibbonPosition", T), o(a, "MenuManagerPosition", w), a);
|
|
52
|
+
S = E([
|
|
53
|
+
h(1, l(v)),
|
|
54
|
+
h(2, u),
|
|
55
|
+
h(3, C)
|
|
56
|
+
], S);
|
|
57
57
|
let _ = class extends b {
|
|
58
58
|
constructor(e, t, r) {
|
|
59
59
|
super();
|
|
@@ -64,7 +64,7 @@ let _ = class extends b {
|
|
|
64
64
|
// eslint-disable-next-line ts/explicit-function-return-type
|
|
65
65
|
menuItemFactory: () => ({
|
|
66
66
|
id: e.id,
|
|
67
|
-
type:
|
|
67
|
+
type: y.SUBITEMS,
|
|
68
68
|
icon: e.icon,
|
|
69
69
|
title: e.title,
|
|
70
70
|
tooltip: e.tooltip
|
|
@@ -100,22 +100,22 @@ let _ = class extends b {
|
|
|
100
100
|
__getSchema() {
|
|
101
101
|
const e = {};
|
|
102
102
|
return this.addSeparator(), this._menuByGroups.forEach((t, r) => {
|
|
103
|
-
const
|
|
103
|
+
const i = {};
|
|
104
104
|
t.forEach((s) => {
|
|
105
|
-
Object.assign(
|
|
106
|
-
}), e[`${this._item.id}-group-${r}`] =
|
|
105
|
+
Object.assign(i, s.__getSchema());
|
|
106
|
+
}), e[`${this._item.id}-group-${r}`] = i;
|
|
107
107
|
}), { [this._item.id]: Object.assign(this._buildingSchema, e) };
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
_ =
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
_ = E([
|
|
111
|
+
h(1, l(v)),
|
|
112
|
+
h(2, C)
|
|
113
113
|
], _);
|
|
114
|
-
var K = Object.defineProperty,
|
|
115
|
-
for (var
|
|
116
|
-
(c =
|
|
117
|
-
return r &&
|
|
118
|
-
},
|
|
114
|
+
var K = Object.defineProperty, W = Object.getOwnPropertyDescriptor, q = (n, e, t, r) => {
|
|
115
|
+
for (var i = r > 1 ? void 0 : r ? W(e, t) : e, s = n.length - 1, c; s >= 0; s--)
|
|
116
|
+
(c = n[s]) && (i = (r ? c(e, t, i) : c(i)) || i);
|
|
117
|
+
return r && i && K(e, t, i), i;
|
|
118
|
+
}, I = (n, e) => (t, r) => e(t, r, n);
|
|
119
119
|
let g = class extends b {
|
|
120
120
|
constructor(e, t) {
|
|
121
121
|
super();
|
|
@@ -133,11 +133,11 @@ let g = class extends b {
|
|
|
133
133
|
return this._shortcutService.dispatch(e);
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
|
-
g =
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
g = q([
|
|
137
|
+
I(0, l(v)),
|
|
138
|
+
I(1, R)
|
|
139
139
|
], g);
|
|
140
|
-
class
|
|
140
|
+
class z extends j {
|
|
141
141
|
getURL() {
|
|
142
142
|
return new URL(window.location.href);
|
|
143
143
|
}
|
|
@@ -145,25 +145,25 @@ class J extends I {
|
|
|
145
145
|
return this._injector.createInstance(g);
|
|
146
146
|
}
|
|
147
147
|
copy() {
|
|
148
|
-
return this._commandService.
|
|
148
|
+
return this._commandService.syncExecuteCommand(m.id);
|
|
149
149
|
}
|
|
150
150
|
paste() {
|
|
151
|
-
return this._commandService.
|
|
151
|
+
return this._commandService.syncExecuteCommand(p.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
157
|
return this._injector.createInstance(_, e);
|
|
158
158
|
}
|
|
159
159
|
openSiderbar(e) {
|
|
160
|
-
return this._injector.get(
|
|
160
|
+
return this._injector.get($).open(e);
|
|
161
161
|
}
|
|
162
162
|
openSidebar(e) {
|
|
163
163
|
return this.openSiderbar(e);
|
|
164
164
|
}
|
|
165
165
|
openDialog(e) {
|
|
166
|
-
const r = this._injector.get(
|
|
166
|
+
const r = this._injector.get(G).open({
|
|
167
167
|
...e,
|
|
168
168
|
onClose: () => {
|
|
169
169
|
r.dispose();
|
|
@@ -172,23 +172,27 @@ class J extends I {
|
|
|
172
172
|
return r;
|
|
173
173
|
}
|
|
174
174
|
getComponentManager() {
|
|
175
|
-
return this._injector.get(
|
|
175
|
+
return this._injector.get(f);
|
|
176
176
|
}
|
|
177
177
|
showMessage(e) {
|
|
178
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(d).setUIVisible(e, t), this;
|
|
182
182
|
}
|
|
183
183
|
isUIVisible(e) {
|
|
184
|
-
return this._injector.get(
|
|
184
|
+
return this._injector.get(d).isUIVisible(e);
|
|
185
185
|
}
|
|
186
186
|
registerUIPart(e, t) {
|
|
187
|
-
return this._injector.get(
|
|
187
|
+
return this._injector.get(d).registerComponent(e, () => F(t, this._injector));
|
|
188
|
+
}
|
|
189
|
+
registerComponent(e, t, r) {
|
|
190
|
+
const i = this._injector.get(f);
|
|
191
|
+
return this.disposeWithMe(i.register(e, t, r));
|
|
188
192
|
}
|
|
189
193
|
}
|
|
190
|
-
|
|
191
|
-
class
|
|
194
|
+
j.extend(z);
|
|
195
|
+
class J extends P {
|
|
192
196
|
onBeforeCopy(e) {
|
|
193
197
|
return this._injector.get(u).beforeCommandExecuted((r) => {
|
|
194
198
|
r.id === m.id && e();
|
|
@@ -201,19 +205,19 @@ class Q extends P {
|
|
|
201
205
|
}
|
|
202
206
|
onBeforePaste(e) {
|
|
203
207
|
return this._injector.get(u).beforeCommandExecuted((r) => {
|
|
204
|
-
r.id ===
|
|
208
|
+
r.id === p.id && e();
|
|
205
209
|
});
|
|
206
210
|
}
|
|
207
211
|
onPaste(e) {
|
|
208
212
|
return this._injector.get(u).onCommandExecuted((r) => {
|
|
209
|
-
(r.id ===
|
|
213
|
+
(r.id === p.id || r.id === N) && e();
|
|
210
214
|
});
|
|
211
215
|
}
|
|
212
216
|
}
|
|
213
|
-
P.extend(
|
|
214
|
-
class
|
|
217
|
+
P.extend(J);
|
|
218
|
+
class Q extends M {
|
|
215
219
|
get BuiltInUIPart() {
|
|
216
220
|
return H;
|
|
217
221
|
}
|
|
218
222
|
}
|
|
219
|
-
|
|
223
|
+
M.extend(Q);
|