@univerjs/slides 0.1.12 → 0.1.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/cjs/index.js +1 -1
- package/lib/es/index.js +396 -389
- package/lib/locale/en-US.json +1 -0
- package/lib/locale/ru-RU.json +1 -0
- package/lib/locale/zh-CN.json +1 -0
- package/lib/types/index.d.ts +0 -1
- package/lib/types/views/render/adaptors/image-adaptor.d.ts +2 -2
- package/lib/types/views/render/adaptors/shape-adaptor.d.ts +0 -1
- package/lib/umd/index.js +1 -1
- package/package.json +8 -7
- package/lib/types/locale/index.d.ts +0 -18
package/lib/es/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var xe = (
|
|
3
|
-
var
|
|
4
|
-
import { Registry as Ce, LocaleService as ne, PageElementType as F, DocumentDataModel as je, getColorStyle as te,
|
|
5
|
-
import { Liquid as
|
|
6
|
-
import { Inject as A, Injector as
|
|
1
|
+
var Ee = Object.defineProperty;
|
|
2
|
+
var xe = (s, e, r) => e in s ? Ee(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
|
|
3
|
+
var u = (s, e, r) => (xe(s, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
+
import { Registry as Ce, LocaleService as ne, PageElementType as F, DocumentDataModel as je, getColorStyle as te, BasicShapes as fe, SlideDataModel as Me, IContextService as Xe, ObjectMatrix as Le, Styles as Ve, Worksheet as ze, sortRules as Ne, OnLifecycle as Ae, LifecycleStages as Ye, RxDisposable as We, UniverInstanceType as X, debounce as Ue, IUniverInstanceService as be, Plugin as $e } from "@univerjs/core";
|
|
5
|
+
import { Liquid as He, DocumentViewModel as Fe, DocumentSkeleton as Be, Documents as Ke, SceneViewer as me, Scene as ie, Viewport as N, EVENT_TYPE as ue, ScrollBar as pe, Rect as H, Image as Te, PageLayoutType as ve, RichText as ke, Slide as Oe, SpreadsheetSkeleton as qe, Spreadsheet as Ge, SpreadsheetRowHeader as Ze, SpreadsheetColumnHeader as Je, getColor as we, IRenderManagerService as Qe, IRenderingEngine as et } from "@univerjs/engine-render";
|
|
6
|
+
import { Inject as A, Injector as ae } from "@wendellhu/redi";
|
|
7
7
|
import { takeUntil as Se } from "rxjs";
|
|
8
|
-
const Yt = {}, tt = {}, Ft = {};
|
|
9
8
|
class B {
|
|
10
9
|
constructor() {
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
u(this, "zIndex", 0);
|
|
11
|
+
u(this, "viewKey", null);
|
|
13
12
|
}
|
|
14
13
|
check(e) {
|
|
15
14
|
if (e === this.viewKey)
|
|
@@ -18,18 +17,18 @@ class B {
|
|
|
18
17
|
create(e) {
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
|
-
const
|
|
22
|
-
var
|
|
23
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
24
|
-
(i = a
|
|
25
|
-
return n && t &&
|
|
26
|
-
},
|
|
20
|
+
const U = Ce.create();
|
|
21
|
+
var tt = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, nt = (s, e, r, n) => {
|
|
22
|
+
for (var t = n > 1 ? void 0 : n ? rt(e, r) : e, a = s.length - 1, i; a >= 0; a--)
|
|
23
|
+
(i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
24
|
+
return n && t && tt(e, r, t), t;
|
|
25
|
+
}, it = (s, e) => (r, n) => e(r, n, s);
|
|
27
26
|
let le = class extends B {
|
|
28
27
|
constructor(e) {
|
|
29
28
|
super();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
u(this, "zIndex", 5);
|
|
30
|
+
u(this, "viewKey", F.DOCUMENT);
|
|
31
|
+
u(this, "_liquid", new He());
|
|
33
32
|
this._localeService = e;
|
|
34
33
|
}
|
|
35
34
|
check(e) {
|
|
@@ -42,92 +41,92 @@ let le = class extends B {
|
|
|
42
41
|
const {
|
|
43
42
|
id: n,
|
|
44
43
|
zIndex: t,
|
|
45
|
-
left:
|
|
44
|
+
left: a = 0,
|
|
46
45
|
top: i = 0,
|
|
47
46
|
width: o,
|
|
48
47
|
height: c,
|
|
49
48
|
angle: l,
|
|
50
|
-
scaleX:
|
|
51
|
-
scaleY:
|
|
52
|
-
skewX:
|
|
53
|
-
skewY:
|
|
54
|
-
flipX:
|
|
55
|
-
flipY:
|
|
56
|
-
title:
|
|
57
|
-
description:
|
|
49
|
+
scaleX: f,
|
|
50
|
+
scaleY: h,
|
|
51
|
+
skewX: g,
|
|
52
|
+
skewY: d,
|
|
53
|
+
flipX: p,
|
|
54
|
+
flipY: _,
|
|
55
|
+
title: D,
|
|
56
|
+
description: y,
|
|
58
57
|
document: T
|
|
59
58
|
} = e;
|
|
60
59
|
if (T == null)
|
|
61
60
|
return;
|
|
62
|
-
const
|
|
61
|
+
const b = new je(T), w = new Fe(b), I = Be.create(w, this._localeService), S = new Ke("__DocsRender__", I);
|
|
63
62
|
I.calculate();
|
|
64
|
-
const
|
|
63
|
+
const R = new me("__DocsViewer__" + n, {
|
|
65
64
|
top: i,
|
|
66
|
-
left:
|
|
65
|
+
left: a,
|
|
67
66
|
width: o,
|
|
68
67
|
height: c,
|
|
69
68
|
zIndex: t,
|
|
70
69
|
angle: l,
|
|
71
|
-
scaleX:
|
|
72
|
-
scaleY:
|
|
73
|
-
skewX:
|
|
74
|
-
skewY:
|
|
75
|
-
flipX:
|
|
76
|
-
flipY:
|
|
77
|
-
|
|
78
|
-
}), v = new ie("__DocsScene__" + n, D), b = new X("__DocsViewPort_" + n, v, {
|
|
70
|
+
scaleX: f,
|
|
71
|
+
scaleY: h,
|
|
72
|
+
skewX: g,
|
|
73
|
+
skewY: d,
|
|
74
|
+
flipX: p,
|
|
75
|
+
flipY: _
|
|
76
|
+
}), v = new ie("__DocsScene__" + n, R), P = new N("__DocsViewPort_" + n, v, {
|
|
79
77
|
left: 0,
|
|
80
78
|
top: 0,
|
|
81
79
|
bottom: 0,
|
|
82
80
|
right: 0,
|
|
81
|
+
isRelativeX: !0,
|
|
82
|
+
isRelativeY: !0,
|
|
83
83
|
isWheelPreventDefaultX: !0
|
|
84
84
|
});
|
|
85
|
-
v.attachControl(), v.on(
|
|
86
|
-
const O =
|
|
85
|
+
v.attachControl(), v.on(ue.wheel, (j, W) => {
|
|
86
|
+
const O = j;
|
|
87
87
|
if (O.ctrlKey) {
|
|
88
88
|
const z = Math.abs(O.deltaX);
|
|
89
89
|
let x = z < 40 ? 0.2 : z < 80 ? 0.4 : 0.2;
|
|
90
90
|
x *= O.deltaY > 0 ? -1 : 1, v.scaleX < 1 && (x /= 2), v.scaleX + x > 4 ? v.scale(4, 4) : v.scaleX + x < 0.1 ? v.scale(0.1, 0.1) : (O.deltaY > 0, O.preventDefault());
|
|
91
91
|
} else
|
|
92
|
-
|
|
93
|
-
}), new
|
|
92
|
+
P.onMouseWheel(O, W);
|
|
93
|
+
}), new pe(P, {
|
|
94
94
|
mainScene: r
|
|
95
95
|
}), v.addObject(S);
|
|
96
96
|
const m = I.getActualSize();
|
|
97
97
|
S.resize(m.actualWidth, m.actualHeight), v.resize(m.actualWidth, m.actualHeight + 200);
|
|
98
|
-
const
|
|
99
|
-
S.onPageRenderObservable.add((
|
|
100
|
-
const { page: W, pageLeft: O, pageTop: z, ctx: x } =
|
|
101
|
-
x.save(), x.translate(O - 0.5, z - 0.5),
|
|
102
|
-
width: (
|
|
103
|
-
height: (
|
|
98
|
+
const E = (k = S.getSkeleton()) == null ? void 0 : k.getPageSize();
|
|
99
|
+
S.onPageRenderObservable.add((j) => {
|
|
100
|
+
const { page: W, pageLeft: O, pageTop: z, ctx: x } = j, { width: q, height: G, marginBottom: se, marginLeft: M, marginRight: Z, marginTop: J } = W;
|
|
101
|
+
x.save(), x.translate(O - 0.5, z - 0.5), H.drawWith(x, {
|
|
102
|
+
width: (E == null ? void 0 : E.width) || q,
|
|
103
|
+
height: (E == null ? void 0 : E.height) || G,
|
|
104
104
|
strokeWidth: 1,
|
|
105
105
|
stroke: "rgba(198,198,198, 1)",
|
|
106
106
|
fill: "rgba(255,255,255, 1)",
|
|
107
107
|
zIndex: 3
|
|
108
108
|
}), x.restore();
|
|
109
109
|
});
|
|
110
|
-
const { left:
|
|
110
|
+
const { left: $, top: Y } = S, L = I.getSkeletonData();
|
|
111
111
|
if (L == null)
|
|
112
112
|
return;
|
|
113
113
|
const { pages: C } = L, V = [], K = /* @__PURE__ */ new Map();
|
|
114
114
|
this._recalculateSizeBySkeleton(S, v, I);
|
|
115
|
-
for (let
|
|
116
|
-
const O = C[
|
|
117
|
-
this._liquid.translatePagePadding(O), z.forEach((
|
|
118
|
-
const { aLeft: Z, aTop: J, height:
|
|
119
|
-
// url:
|
|
120
|
-
left: Z +
|
|
121
|
-
top: J +
|
|
122
|
-
width:
|
|
123
|
-
height:
|
|
124
|
-
zIndex: 11
|
|
125
|
-
isTransformer: !0
|
|
115
|
+
for (let j = 0, W = C.length; j < W; j++) {
|
|
116
|
+
const O = C[j], { skeDrawings: z, marginLeft: x, marginTop: q, pageWidth: G, pageHeight: se } = O;
|
|
117
|
+
this._liquid.translatePagePadding(O), z.forEach((M) => {
|
|
118
|
+
const { aLeft: Z, aTop: J, height: Re, width: De, drawingOrigin: zt } = M, ye = new Te(M.drawingId, {
|
|
119
|
+
// url: docTransform.imageProperties?.contentUrl || '',
|
|
120
|
+
left: Z + $ + this._liquid.x,
|
|
121
|
+
top: J + Y + this._liquid.y,
|
|
122
|
+
width: De,
|
|
123
|
+
height: Re,
|
|
124
|
+
zIndex: 11
|
|
126
125
|
});
|
|
127
|
-
K.set(
|
|
126
|
+
K.set(M.drawingId, {
|
|
128
127
|
marginLeft: this._liquid.x,
|
|
129
128
|
marginTop: this._liquid.y
|
|
130
|
-
}), V.push(
|
|
129
|
+
}), V.push(ye);
|
|
131
130
|
}), this._liquid.translatePage(
|
|
132
131
|
O,
|
|
133
132
|
S.pageLayoutType,
|
|
@@ -135,63 +134,65 @@ let le = class extends B {
|
|
|
135
134
|
S.pageMarginTop
|
|
136
135
|
);
|
|
137
136
|
}
|
|
138
|
-
return v.
|
|
139
|
-
|
|
137
|
+
return v.addObjects(V), V.forEach((j) => {
|
|
138
|
+
v.attachTransformerTo(j);
|
|
139
|
+
}), (_e = v.getTransformer()) == null || _e.onChangingObservable.add((j) => {
|
|
140
|
+
const { objects: W } = j;
|
|
140
141
|
W.forEach((O) => {
|
|
141
|
-
const { oKey: z, left: x, top: q, height: G, width:
|
|
142
|
+
const { oKey: z, left: x, top: q, height: G, width: se } = O, M = K.get(z), Z = (M == null ? void 0 : M.marginLeft) || 0, J = (M == null ? void 0 : M.marginTop) || 0;
|
|
142
143
|
I == null || I.getViewModel().getDataModel().updateDrawing(z, {
|
|
143
|
-
left: x -
|
|
144
|
-
top: q -
|
|
144
|
+
left: x - $ - Z,
|
|
145
|
+
top: q - Y - J,
|
|
145
146
|
height: G,
|
|
146
|
-
width:
|
|
147
|
+
width: se
|
|
147
148
|
});
|
|
148
149
|
}), I == null || I.calculate();
|
|
149
|
-
}),
|
|
150
|
+
}), this._calculatePagePosition(S, v, P), R;
|
|
150
151
|
}
|
|
151
152
|
_recalculateSizeBySkeleton(e, r, n) {
|
|
152
153
|
var o;
|
|
153
154
|
const t = (o = n.getSkeletonData()) == null ? void 0 : o.pages;
|
|
154
155
|
if (t == null)
|
|
155
156
|
return;
|
|
156
|
-
let
|
|
157
|
+
let a = 0, i = 0;
|
|
157
158
|
for (let c = 0, l = t.length; c < l; c++) {
|
|
158
|
-
const
|
|
159
|
-
e.pageLayoutType === ve.VERTICAL ? (i +=
|
|
159
|
+
const f = t[c], { pageWidth: h, pageHeight: g } = f;
|
|
160
|
+
e.pageLayoutType === ve.VERTICAL ? (i += g, i += e.pageMarginTop, c === l - 1 && (i += e.pageMarginTop), a = Math.max(a, h)) : e.pageLayoutType === ve.HORIZONTAL && (a += h, c !== l - 1 && (a += e.pageMarginLeft), i = Math.max(i, g));
|
|
160
161
|
}
|
|
161
|
-
e.resize(
|
|
162
|
+
e.resize(a, i), r.resize(a, i);
|
|
162
163
|
}
|
|
163
164
|
_calculatePagePosition(e, r, n, t = 1) {
|
|
164
|
-
const
|
|
165
|
-
if (
|
|
165
|
+
const a = r == null ? void 0 : r.getParent(), { width: i, height: o, pageMarginLeft: c, pageMarginTop: l } = e;
|
|
166
|
+
if (a == null || i === Number.POSITIVE_INFINITY || o === Number.POSITIVE_INFINITY)
|
|
166
167
|
return;
|
|
167
|
-
const { width:
|
|
168
|
-
let
|
|
169
|
-
if (
|
|
170
|
-
const
|
|
168
|
+
const { width: f, height: h } = a;
|
|
169
|
+
let g = 0, d = 0, p = 0, _ = 0, D = Number.POSITIVE_INFINITY;
|
|
170
|
+
if (f > (i + c * 2) * t ? (g = f / 2 - i * t / 2, g /= t, p = (f - c * 2) / t, D = 0) : (g = c, p = i + c * 2, D = (p - f / t) / 2), h > o ? (d = h / 2 - o / 2, _ = (h - l * 2) / t) : (d = l, _ = o + l * 2), r.resize(p, _ + 200), e.translate(g, d), D !== Number.POSITIVE_INFINITY && n != null) {
|
|
171
|
+
const y = n.getBarScroll(D, 0).x;
|
|
171
172
|
n.scrollTo({
|
|
172
|
-
x:
|
|
173
|
+
x: y
|
|
173
174
|
});
|
|
174
175
|
}
|
|
175
176
|
return this;
|
|
176
177
|
}
|
|
177
178
|
};
|
|
178
|
-
le =
|
|
179
|
-
|
|
179
|
+
le = nt([
|
|
180
|
+
it(0, A(ne))
|
|
180
181
|
], le);
|
|
181
182
|
class at {
|
|
182
183
|
constructor() {
|
|
183
|
-
|
|
184
|
+
u(this, "zIndex", 5);
|
|
184
185
|
}
|
|
185
186
|
create(e) {
|
|
186
187
|
return e.createInstance(le);
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
|
-
|
|
190
|
-
class
|
|
190
|
+
U.add(new at());
|
|
191
|
+
class st extends B {
|
|
191
192
|
constructor() {
|
|
192
193
|
super(...arguments);
|
|
193
|
-
|
|
194
|
-
|
|
194
|
+
u(this, "zIndex", 1);
|
|
195
|
+
u(this, "viewKey", F.IMAGE);
|
|
195
196
|
}
|
|
196
197
|
check(r) {
|
|
197
198
|
if (r === this.viewKey)
|
|
@@ -201,59 +202,58 @@ class ct extends B {
|
|
|
201
202
|
const {
|
|
202
203
|
id: n,
|
|
203
204
|
zIndex: t,
|
|
204
|
-
left:
|
|
205
|
+
left: a = 0,
|
|
205
206
|
top: i = 0,
|
|
206
207
|
width: o,
|
|
207
208
|
height: c,
|
|
208
209
|
angle: l,
|
|
209
|
-
scaleX:
|
|
210
|
-
scaleY:
|
|
211
|
-
skewX:
|
|
212
|
-
skewY:
|
|
213
|
-
flipX:
|
|
214
|
-
flipY:
|
|
215
|
-
title:
|
|
216
|
-
description:
|
|
210
|
+
scaleX: f,
|
|
211
|
+
scaleY: h,
|
|
212
|
+
skewX: g,
|
|
213
|
+
skewY: d,
|
|
214
|
+
flipX: p,
|
|
215
|
+
flipY: _,
|
|
216
|
+
title: D,
|
|
217
|
+
description: y,
|
|
217
218
|
image: T = {}
|
|
218
|
-
} = r, { imageProperties:
|
|
219
|
+
} = r, { imageProperties: b, placeholder: w, link: I } = T, S = (b == null ? void 0 : b.contentUrl) || "";
|
|
219
220
|
return new Te(n, {
|
|
220
221
|
url: S,
|
|
221
222
|
top: i,
|
|
222
|
-
left:
|
|
223
|
+
left: a,
|
|
223
224
|
width: o,
|
|
224
225
|
height: c,
|
|
225
226
|
zIndex: t,
|
|
226
227
|
angle: l,
|
|
227
|
-
scaleX:
|
|
228
|
-
scaleY:
|
|
229
|
-
skewX:
|
|
230
|
-
skewY:
|
|
231
|
-
flipX:
|
|
232
|
-
flipY:
|
|
233
|
-
isTransformer: !0,
|
|
228
|
+
scaleX: f,
|
|
229
|
+
scaleY: h,
|
|
230
|
+
skewX: g,
|
|
231
|
+
skewY: d,
|
|
232
|
+
flipX: p,
|
|
233
|
+
flipY: _,
|
|
234
234
|
forceRender: !0
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
class
|
|
238
|
+
class ct {
|
|
239
239
|
constructor() {
|
|
240
|
-
|
|
240
|
+
u(this, "zIndex", 4);
|
|
241
241
|
}
|
|
242
242
|
create(e) {
|
|
243
|
-
return e.createInstance(
|
|
243
|
+
return e.createInstance(st);
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
|
|
247
|
-
var
|
|
248
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
249
|
-
(i = a
|
|
250
|
-
return n && t &&
|
|
251
|
-
},
|
|
246
|
+
U.add(new ct());
|
|
247
|
+
var ot = Object.defineProperty, lt = Object.getOwnPropertyDescriptor, dt = (s, e, r, n) => {
|
|
248
|
+
for (var t = n > 1 ? void 0 : n ? lt(e, r) : e, a = s.length - 1, i; a >= 0; a--)
|
|
249
|
+
(i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
250
|
+
return n && t && ot(e, r, t), t;
|
|
251
|
+
}, ht = (s, e) => (r, n) => e(r, n, s);
|
|
252
252
|
let de = class extends B {
|
|
253
253
|
constructor(e) {
|
|
254
254
|
super();
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
u(this, "zIndex", 2);
|
|
256
|
+
u(this, "viewKey", F.TEXT);
|
|
257
257
|
this._localeService = e;
|
|
258
258
|
}
|
|
259
259
|
check(e) {
|
|
@@ -264,58 +264,57 @@ let de = class extends B {
|
|
|
264
264
|
const {
|
|
265
265
|
id: n,
|
|
266
266
|
zIndex: t,
|
|
267
|
-
left:
|
|
267
|
+
left: a = 0,
|
|
268
268
|
top: i = 0,
|
|
269
269
|
width: o,
|
|
270
270
|
height: c,
|
|
271
271
|
angle: l,
|
|
272
|
-
scaleX:
|
|
273
|
-
scaleY:
|
|
274
|
-
skewX:
|
|
275
|
-
skewY:
|
|
276
|
-
flipX:
|
|
277
|
-
flipY:
|
|
278
|
-
title:
|
|
279
|
-
description:
|
|
272
|
+
scaleX: f,
|
|
273
|
+
scaleY: h,
|
|
274
|
+
skewX: g,
|
|
275
|
+
skewY: d,
|
|
276
|
+
flipX: p,
|
|
277
|
+
flipY: _,
|
|
278
|
+
title: D,
|
|
279
|
+
description: y,
|
|
280
280
|
richText: T = {}
|
|
281
|
-
} = e, { text:
|
|
281
|
+
} = e, { text: b, ff: w, fs: I, it: S, bl: R, ul: v, st: P, ol: m, bg: E, bd: $, cl: Y, rich: L } = T;
|
|
282
282
|
let C = {
|
|
283
283
|
top: i,
|
|
284
|
-
left:
|
|
284
|
+
left: a,
|
|
285
285
|
width: o,
|
|
286
286
|
height: c,
|
|
287
287
|
zIndex: t,
|
|
288
288
|
angle: l,
|
|
289
|
-
scaleX:
|
|
290
|
-
scaleY:
|
|
291
|
-
skewX:
|
|
292
|
-
skewY:
|
|
293
|
-
flipX:
|
|
294
|
-
flipY:
|
|
295
|
-
isTransformer: !0,
|
|
289
|
+
scaleX: f,
|
|
290
|
+
scaleY: h,
|
|
291
|
+
skewX: g,
|
|
292
|
+
skewY: d,
|
|
293
|
+
flipX: p,
|
|
294
|
+
flipY: _,
|
|
296
295
|
forceRender: !0
|
|
297
296
|
}, V = !1;
|
|
298
|
-
if (
|
|
297
|
+
if (b != null ? (C = { ...C, text: b, ff: w, fs: I, it: S, bl: R, ul: v, st: P, ol: m, bg: E, bd: $, cl: Y }, V = !0) : L != null && (C = { ...C, richText: L }, V = !0), V !== !1)
|
|
299
298
|
return new ke(this._localeService, n, C);
|
|
300
299
|
}
|
|
301
300
|
};
|
|
302
|
-
de =
|
|
303
|
-
|
|
301
|
+
de = dt([
|
|
302
|
+
ht(0, A(ne))
|
|
304
303
|
], de);
|
|
305
|
-
class
|
|
304
|
+
class gt {
|
|
306
305
|
constructor() {
|
|
307
|
-
|
|
306
|
+
u(this, "zIndex", 0);
|
|
308
307
|
}
|
|
309
308
|
create(e) {
|
|
310
309
|
return e.createInstance(de);
|
|
311
310
|
}
|
|
312
311
|
}
|
|
313
|
-
|
|
312
|
+
U.add(new gt());
|
|
314
313
|
class ut extends B {
|
|
315
314
|
constructor() {
|
|
316
315
|
super(...arguments);
|
|
317
|
-
|
|
318
|
-
|
|
316
|
+
u(this, "zIndex", 2);
|
|
317
|
+
u(this, "viewKey", F.SHAPE);
|
|
319
318
|
}
|
|
320
319
|
check(r) {
|
|
321
320
|
if (r === this.viewKey)
|
|
@@ -325,87 +324,85 @@ class ut extends B {
|
|
|
325
324
|
const {
|
|
326
325
|
id: n,
|
|
327
326
|
zIndex: t,
|
|
328
|
-
left:
|
|
327
|
+
left: a = 0,
|
|
329
328
|
top: i = 0,
|
|
330
329
|
width: o,
|
|
331
330
|
height: c,
|
|
332
331
|
angle: l,
|
|
333
|
-
scaleX:
|
|
334
|
-
scaleY:
|
|
335
|
-
skewX:
|
|
336
|
-
skewY:
|
|
337
|
-
flipX:
|
|
338
|
-
flipY:
|
|
339
|
-
title:
|
|
340
|
-
description:
|
|
341
|
-
} = r, { shapeType: T, text:
|
|
332
|
+
scaleX: f,
|
|
333
|
+
scaleY: h,
|
|
334
|
+
skewX: g,
|
|
335
|
+
skewY: d,
|
|
336
|
+
flipX: p,
|
|
337
|
+
flipY: _,
|
|
338
|
+
title: D,
|
|
339
|
+
description: y
|
|
340
|
+
} = r, { shapeType: T, text: b, shapeProperties: w, placeholder: I, link: S } = r.shape || {}, R = w == null ? "" : te(w.shapeBackgroundFill) || "rgba(255,255,255,1)", v = w == null ? void 0 : w.outline, P = {};
|
|
342
341
|
if (v) {
|
|
343
|
-
const { outlineFill: m, weight:
|
|
344
|
-
|
|
342
|
+
const { outlineFill: m, weight: E } = v;
|
|
343
|
+
P.strokeWidth = E, P.stroke = te(m) || "rgba(0,0,0,1)";
|
|
345
344
|
}
|
|
346
|
-
if (T === fe.
|
|
347
|
-
return new
|
|
348
|
-
fill:
|
|
345
|
+
if (T === fe.Rect)
|
|
346
|
+
return new H(n, {
|
|
347
|
+
fill: R,
|
|
349
348
|
top: i,
|
|
350
|
-
left:
|
|
349
|
+
left: a,
|
|
351
350
|
width: o,
|
|
352
351
|
height: c,
|
|
353
352
|
zIndex: t,
|
|
354
353
|
angle: l,
|
|
355
|
-
scaleX:
|
|
356
|
-
scaleY:
|
|
357
|
-
skewX:
|
|
358
|
-
skewY:
|
|
359
|
-
flipX:
|
|
360
|
-
flipY:
|
|
361
|
-
isTransformer: !0,
|
|
354
|
+
scaleX: f,
|
|
355
|
+
scaleY: h,
|
|
356
|
+
skewX: g,
|
|
357
|
+
skewY: d,
|
|
358
|
+
flipX: p,
|
|
359
|
+
flipY: _,
|
|
362
360
|
forceRender: !0,
|
|
363
|
-
...
|
|
361
|
+
...P
|
|
364
362
|
});
|
|
365
|
-
if (T === fe.
|
|
363
|
+
if (T === fe.RoundRect) {
|
|
366
364
|
const m = (w == null ? void 0 : w.radius) || 0;
|
|
367
|
-
return new
|
|
368
|
-
fill:
|
|
365
|
+
return new H(n, {
|
|
366
|
+
fill: R,
|
|
369
367
|
top: i,
|
|
370
|
-
left:
|
|
368
|
+
left: a,
|
|
371
369
|
width: o,
|
|
372
370
|
height: c,
|
|
373
371
|
zIndex: t,
|
|
374
372
|
angle: l,
|
|
375
|
-
scaleX:
|
|
376
|
-
scaleY:
|
|
377
|
-
skewX:
|
|
378
|
-
skewY:
|
|
379
|
-
flipX:
|
|
380
|
-
flipY:
|
|
381
|
-
isTransformer: !0,
|
|
373
|
+
scaleX: f,
|
|
374
|
+
scaleY: h,
|
|
375
|
+
skewX: g,
|
|
376
|
+
skewY: d,
|
|
377
|
+
flipX: p,
|
|
378
|
+
flipY: _,
|
|
382
379
|
forceRender: !0,
|
|
383
380
|
radius: m,
|
|
384
|
-
...
|
|
381
|
+
...P
|
|
385
382
|
});
|
|
386
383
|
}
|
|
387
384
|
}
|
|
388
385
|
}
|
|
389
|
-
class
|
|
386
|
+
class pt {
|
|
390
387
|
constructor() {
|
|
391
|
-
|
|
388
|
+
u(this, "zIndex", 2);
|
|
392
389
|
}
|
|
393
390
|
create(e) {
|
|
394
391
|
return e.createInstance(ut);
|
|
395
392
|
}
|
|
396
393
|
}
|
|
397
|
-
|
|
398
|
-
var
|
|
399
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
400
|
-
(i = a
|
|
401
|
-
return n && t &&
|
|
402
|
-
},
|
|
394
|
+
U.add(new pt());
|
|
395
|
+
var _t = Object.defineProperty, ft = Object.getOwnPropertyDescriptor, vt = (s, e, r, n) => {
|
|
396
|
+
for (var t = n > 1 ? void 0 : n ? ft(e, r) : e, a = s.length - 1, i; a >= 0; a--)
|
|
397
|
+
(i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
398
|
+
return n && t && _t(e, r, t), t;
|
|
399
|
+
}, wt = (s, e) => (r, n) => e(r, n, s);
|
|
403
400
|
let he = class extends B {
|
|
404
401
|
constructor(e) {
|
|
405
402
|
super();
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
403
|
+
u(this, "zIndex", 6);
|
|
404
|
+
u(this, "viewKey", F.SLIDE);
|
|
405
|
+
u(this, "_ObjectProvider", null);
|
|
409
406
|
this._injector = e;
|
|
410
407
|
}
|
|
411
408
|
check(e) {
|
|
@@ -416,70 +413,73 @@ let he = class extends B {
|
|
|
416
413
|
const {
|
|
417
414
|
id: n,
|
|
418
415
|
zIndex: t,
|
|
419
|
-
left:
|
|
416
|
+
left: a = 0,
|
|
420
417
|
top: i = 0,
|
|
421
418
|
width: o,
|
|
422
419
|
height: c,
|
|
423
420
|
angle: l,
|
|
424
|
-
scaleX:
|
|
425
|
-
scaleY:
|
|
426
|
-
skewX:
|
|
427
|
-
skewY:
|
|
428
|
-
flipX:
|
|
429
|
-
flipY:
|
|
430
|
-
title:
|
|
431
|
-
description:
|
|
421
|
+
scaleX: f,
|
|
422
|
+
scaleY: h,
|
|
423
|
+
skewX: g,
|
|
424
|
+
skewY: d,
|
|
425
|
+
flipX: p,
|
|
426
|
+
flipY: _,
|
|
427
|
+
title: D,
|
|
428
|
+
description: y,
|
|
432
429
|
slide: T
|
|
433
430
|
} = e;
|
|
434
431
|
if (T == null)
|
|
435
432
|
return;
|
|
436
|
-
const
|
|
433
|
+
const b = new Me(T), w = new Oe("__SLIDERender__" + n, {
|
|
437
434
|
top: i,
|
|
438
|
-
left:
|
|
435
|
+
left: a,
|
|
439
436
|
width: o,
|
|
440
437
|
height: c,
|
|
441
438
|
zIndex: t,
|
|
442
439
|
angle: l,
|
|
443
|
-
scaleX:
|
|
444
|
-
scaleY:
|
|
445
|
-
skewX:
|
|
446
|
-
skewY:
|
|
447
|
-
flipX:
|
|
448
|
-
flipY:
|
|
449
|
-
isTransformer: !1,
|
|
440
|
+
scaleX: f,
|
|
441
|
+
scaleY: h,
|
|
442
|
+
skewX: g,
|
|
443
|
+
skewY: d,
|
|
444
|
+
flipX: p,
|
|
445
|
+
flipY: _,
|
|
450
446
|
forceRender: !0
|
|
451
447
|
});
|
|
452
448
|
w.enableNav(), w.enableSelectedClipElement();
|
|
453
|
-
const I =
|
|
449
|
+
const I = b.getPageOrder(), S = b.getPages();
|
|
454
450
|
if (!I || !S)
|
|
455
451
|
return w;
|
|
456
452
|
this._ObjectProvider = new re(this._injector);
|
|
457
|
-
for (let
|
|
458
|
-
const
|
|
459
|
-
w.addPage(this._createScene(m, w,
|
|
453
|
+
for (let R = 0, v = I.length; R < v; R++) {
|
|
454
|
+
const P = S[I[R]], { id: m } = P;
|
|
455
|
+
w.addPage(this._createScene(m, w, P, r, b));
|
|
460
456
|
}
|
|
461
457
|
return w.activeFirstPage(), w;
|
|
462
458
|
}
|
|
463
|
-
_createScene(e, r, n, t,
|
|
464
|
-
var
|
|
459
|
+
_createScene(e, r, n, t, a) {
|
|
460
|
+
var d;
|
|
465
461
|
const { width: i, height: o } = r, c = new ie(e, r, {
|
|
466
462
|
width: i,
|
|
467
463
|
height: o
|
|
468
464
|
});
|
|
469
|
-
new
|
|
465
|
+
new N(`PageViewer_${e}`, c, {
|
|
470
466
|
left: 0,
|
|
471
467
|
top: 0,
|
|
472
468
|
bottom: 0,
|
|
473
|
-
right: 0
|
|
469
|
+
right: 0,
|
|
470
|
+
isRelativeX: !0,
|
|
471
|
+
isRelativeY: !0
|
|
474
472
|
}).closeClip();
|
|
475
|
-
const { pageElements:
|
|
476
|
-
return
|
|
473
|
+
const { pageElements: f, pageBackgroundFill: h } = n, g = (d = this._ObjectProvider) == null ? void 0 : d.convertToRenderObjects(f, t);
|
|
474
|
+
return this._addBackgroundRect(c, h, a), c.addObjects(g), g == null || g.forEach((p) => {
|
|
475
|
+
c.attachTransformerTo(p);
|
|
476
|
+
}), c;
|
|
477
477
|
}
|
|
478
478
|
_addBackgroundRect(e, r, n) {
|
|
479
|
-
const t = n.getPageSize(), { width:
|
|
479
|
+
const t = n.getPageSize(), { width: a = 0, height: i = 0 } = t, o = new H("canvas", {
|
|
480
480
|
left: 0,
|
|
481
481
|
top: 0,
|
|
482
|
-
width:
|
|
482
|
+
width: a,
|
|
483
483
|
height: i,
|
|
484
484
|
strokeWidth: 1,
|
|
485
485
|
stroke: "rgba(198,198,198, 1)",
|
|
@@ -490,202 +490,207 @@ let he = class extends B {
|
|
|
490
490
|
e.addObject(o, 0);
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
|
-
he =
|
|
494
|
-
|
|
493
|
+
he = vt([
|
|
494
|
+
wt(0, A(ae))
|
|
495
495
|
], he);
|
|
496
|
-
class
|
|
496
|
+
class St {
|
|
497
497
|
constructor() {
|
|
498
|
-
|
|
498
|
+
u(this, "zIndex", 6);
|
|
499
499
|
}
|
|
500
500
|
create(e) {
|
|
501
501
|
return e.createInstance(he);
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
|
|
505
|
-
var
|
|
506
|
-
for (var t = n > 1 ? void 0 : n ? Pt(e, r) : e,
|
|
507
|
-
(i = a
|
|
508
|
-
return n && t &&
|
|
509
|
-
}, Ie = (
|
|
504
|
+
U.add(new St());
|
|
505
|
+
var It = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, bt = (s, e, r, n) => {
|
|
506
|
+
for (var t = n > 1 ? void 0 : n ? Pt(e, r) : e, a = s.length - 1, i; a >= 0; a--)
|
|
507
|
+
(i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
508
|
+
return n && t && It(e, r, t), t;
|
|
509
|
+
}, Ie = (s, e) => (r, n) => e(r, n, s);
|
|
510
510
|
let ge = class extends B {
|
|
511
511
|
constructor(e, r) {
|
|
512
512
|
super();
|
|
513
|
-
|
|
514
|
-
|
|
513
|
+
u(this, "zIndex", 4);
|
|
514
|
+
u(this, "viewKey", F.SPREADSHEET);
|
|
515
515
|
this._localeService = e, this._contextService = r;
|
|
516
516
|
}
|
|
517
517
|
check(e) {
|
|
518
518
|
if (e === this.viewKey)
|
|
519
519
|
return this;
|
|
520
520
|
}
|
|
521
|
+
// eslint-disable-next-line max-lines-per-function
|
|
521
522
|
convert(e, r) {
|
|
522
523
|
const {
|
|
523
524
|
id: n,
|
|
524
525
|
zIndex: t,
|
|
525
|
-
left:
|
|
526
|
+
left: a = 0,
|
|
526
527
|
top: i = 0,
|
|
527
528
|
width: o,
|
|
528
529
|
height: c,
|
|
529
530
|
angle: l,
|
|
530
|
-
scaleX:
|
|
531
|
-
scaleY:
|
|
532
|
-
skewX:
|
|
533
|
-
skewY:
|
|
534
|
-
flipX:
|
|
535
|
-
flipY:
|
|
536
|
-
spreadsheet:
|
|
531
|
+
scaleX: f,
|
|
532
|
+
scaleY: h,
|
|
533
|
+
skewX: g,
|
|
534
|
+
skewY: d,
|
|
535
|
+
flipX: p,
|
|
536
|
+
flipY: _,
|
|
537
|
+
spreadsheet: D
|
|
537
538
|
} = e;
|
|
538
|
-
if (
|
|
539
|
+
if (D == null)
|
|
539
540
|
return;
|
|
540
|
-
const { worksheet:
|
|
541
|
-
new
|
|
541
|
+
const { worksheet: y, styles: T } = D, { cellData: b } = y, w = new Le(b), I = new Ve(T), S = new qe(
|
|
542
|
+
new ze(n, y, I),
|
|
542
543
|
// FIXME: worksheet in slide doesn't has a Worksheet object
|
|
543
|
-
|
|
544
|
+
y,
|
|
544
545
|
w,
|
|
545
546
|
I,
|
|
546
547
|
this._localeService,
|
|
547
548
|
this._contextService
|
|
548
|
-
), { rowTotalHeight:
|
|
549
|
+
), { rowTotalHeight: R, columnTotalWidth: v, rowHeaderWidth: P, columnHeaderHeight: m } = S, E = v + y.rowHeader.width || 0, $ = R + y.columnHeader.height || 0, Y = new me("spreadInSlideSceneViewer" + n, {
|
|
549
550
|
top: i,
|
|
550
|
-
left:
|
|
551
|
+
left: a,
|
|
551
552
|
width: o,
|
|
552
553
|
height: c,
|
|
553
554
|
zIndex: t,
|
|
554
555
|
angle: l,
|
|
555
|
-
scaleX:
|
|
556
|
-
scaleY:
|
|
557
|
-
skewX:
|
|
558
|
-
skewY:
|
|
559
|
-
flipX:
|
|
560
|
-
flipY:
|
|
561
|
-
isTransformer: !0,
|
|
556
|
+
scaleX: f,
|
|
557
|
+
scaleY: h,
|
|
558
|
+
skewX: g,
|
|
559
|
+
skewY: d,
|
|
560
|
+
flipX: p,
|
|
561
|
+
flipY: _,
|
|
562
562
|
forceRender: !0
|
|
563
|
-
}), L = new ie("spreadInSlideScene" + n,
|
|
564
|
-
width:
|
|
565
|
-
height:
|
|
563
|
+
}), L = new ie("spreadInSlideScene" + n, Y, {
|
|
564
|
+
width: E,
|
|
565
|
+
height: $
|
|
566
566
|
});
|
|
567
|
-
this._updateViewport(n,
|
|
568
|
-
const C = new Ge("testSheetViewer", S, !1), V = new Ze("spreadInSlideRow", S), K = new Je("spreadInSlideColumn", S), k = new
|
|
567
|
+
this._updateViewport(n, P, m, L, r);
|
|
568
|
+
const C = new Ge("testSheetViewer", S, !1), V = new Ze("spreadInSlideRow", S), K = new Je("spreadInSlideColumn", S), k = new H("spreadInSlideLeftTop", {
|
|
569
569
|
zIndex: 2,
|
|
570
570
|
left: -1,
|
|
571
571
|
top: -1,
|
|
572
|
-
width:
|
|
572
|
+
width: P,
|
|
573
573
|
height: m,
|
|
574
574
|
fill: we([248, 249, 250]),
|
|
575
575
|
stroke: we([217, 217, 217]),
|
|
576
576
|
strokeWidth: 1
|
|
577
577
|
});
|
|
578
|
-
return C.zIndex = 10, L.addObjects([C], 1), L.addObjects([V, K, k], 2),
|
|
578
|
+
return C.zIndex = 10, L.addObjects([C], 1), L.addObjects([V, K, k], 2), Y;
|
|
579
579
|
}
|
|
580
|
-
|
|
581
|
-
|
|
580
|
+
// eslint-disable-next-line max-lines-per-function
|
|
581
|
+
_updateViewport(e, r, n, t, a) {
|
|
582
|
+
if (a == null)
|
|
582
583
|
return;
|
|
583
|
-
const i = r * t.scaleX, o = n * t.scaleY, c = new
|
|
584
|
+
const i = r * t.scaleX, o = n * t.scaleY, c = new N("spreadInSlideViewMain" + e, t, {
|
|
584
585
|
left: i,
|
|
585
586
|
top: o,
|
|
586
587
|
bottom: 0,
|
|
587
588
|
right: 0,
|
|
589
|
+
isRelativeX: !0,
|
|
590
|
+
isRelativeY: !0,
|
|
588
591
|
isWheelPreventDefaultX: !0
|
|
589
|
-
}), l = new
|
|
592
|
+
}), l = new N("spreadInSlideViewTop" + e, t, {
|
|
590
593
|
left: i,
|
|
591
594
|
height: o,
|
|
592
595
|
top: 0,
|
|
593
596
|
right: 0,
|
|
597
|
+
isRelativeX: !0,
|
|
594
598
|
isWheelPreventDefaultX: !0
|
|
595
|
-
}),
|
|
599
|
+
}), f = new N("spreadInSlideViewLeft" + e, t, {
|
|
596
600
|
left: 0,
|
|
597
601
|
bottom: 0,
|
|
598
602
|
top: o,
|
|
599
603
|
width: i,
|
|
604
|
+
isRelativeY: !0,
|
|
600
605
|
isWheelPreventDefaultX: !0
|
|
601
606
|
});
|
|
602
|
-
new
|
|
607
|
+
new N("spreadInSlideViewLeftTop" + e, t, {
|
|
603
608
|
left: 0,
|
|
604
609
|
top: 0,
|
|
605
610
|
width: i,
|
|
606
611
|
height: o,
|
|
607
612
|
isWheelPreventDefaultX: !0
|
|
608
|
-
}), c.onScrollAfterObserver.add((
|
|
609
|
-
const { scrollX:
|
|
613
|
+
}), c.onScrollAfterObserver.add((h) => {
|
|
614
|
+
const { scrollX: g, scrollY: d, actualScrollX: p, actualScrollY: _ } = h;
|
|
610
615
|
l.updateScroll({
|
|
611
|
-
scrollX:
|
|
612
|
-
actualScrollX:
|
|
613
|
-
}),
|
|
614
|
-
scrollY:
|
|
615
|
-
actualScrollY:
|
|
616
|
+
scrollX: g,
|
|
617
|
+
actualScrollX: p
|
|
618
|
+
}), f.updateScroll({
|
|
619
|
+
scrollY: d,
|
|
620
|
+
actualScrollY: _
|
|
616
621
|
});
|
|
617
|
-
}), t.attachControl(), new
|
|
618
|
-
mainScene:
|
|
619
|
-
}), t.on(
|
|
620
|
-
const
|
|
621
|
-
if (
|
|
622
|
-
const
|
|
623
|
-
let
|
|
624
|
-
|
|
622
|
+
}), t.attachControl(), new pe(c, {
|
|
623
|
+
mainScene: a
|
|
624
|
+
}), t.on(ue.wheel, (h, g) => {
|
|
625
|
+
const d = h;
|
|
626
|
+
if (d.ctrlKey) {
|
|
627
|
+
const p = Math.abs(d.deltaX);
|
|
628
|
+
let _ = p < 40 ? 0.05 : p < 80 ? 0.02 : 0.01;
|
|
629
|
+
_ *= d.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (_ /= 2), t.scaleX + _ > 4 ? t.scale(4, 4) : t.scaleX + _ < 0.1 ? t.scale(0.1, 0.1) : (t.scaleBy(_, _), d.preventDefault());
|
|
625
630
|
} else
|
|
626
|
-
c.onMouseWheel(
|
|
631
|
+
c.onMouseWheel(d, g);
|
|
627
632
|
});
|
|
628
633
|
}
|
|
629
634
|
};
|
|
630
|
-
ge =
|
|
635
|
+
ge = bt([
|
|
631
636
|
Ie(0, A(ne)),
|
|
632
|
-
Ie(1,
|
|
637
|
+
Ie(1, Xe)
|
|
633
638
|
], ge);
|
|
634
|
-
class
|
|
639
|
+
class mt {
|
|
635
640
|
constructor() {
|
|
636
|
-
|
|
641
|
+
u(this, "zIndex", 4);
|
|
637
642
|
}
|
|
638
643
|
create(e) {
|
|
639
644
|
return e.createInstance(ge);
|
|
640
645
|
}
|
|
641
646
|
}
|
|
642
|
-
|
|
643
|
-
var
|
|
644
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
645
|
-
(i = a
|
|
646
|
-
return n && t &&
|
|
647
|
-
},
|
|
647
|
+
U.add(new mt());
|
|
648
|
+
var Tt = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, Rt = (s, e, r, n) => {
|
|
649
|
+
for (var t = n > 1 ? void 0 : n ? Ot(e, r) : e, a = s.length - 1, i; a >= 0; a--)
|
|
650
|
+
(i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
651
|
+
return n && t && Tt(e, r, t), t;
|
|
652
|
+
}, Dt = (s, e) => (r, n) => e(r, n, s);
|
|
648
653
|
let re = class {
|
|
649
|
-
constructor(
|
|
650
|
-
|
|
651
|
-
this._injector =
|
|
654
|
+
constructor(s) {
|
|
655
|
+
u(this, "_adaptors", []);
|
|
656
|
+
this._injector = s, this._adaptorLoader();
|
|
652
657
|
}
|
|
653
|
-
convertToRenderObjects(
|
|
654
|
-
const r = Object.keys(
|
|
658
|
+
convertToRenderObjects(s, e) {
|
|
659
|
+
const r = Object.keys(s), n = [];
|
|
655
660
|
return r.forEach((t) => {
|
|
656
|
-
const
|
|
661
|
+
const a = s[t], i = this._executor(a, e);
|
|
657
662
|
i != null && n.push(i);
|
|
658
663
|
}), n;
|
|
659
664
|
}
|
|
660
|
-
_executor(
|
|
665
|
+
_executor(s, e) {
|
|
661
666
|
var t;
|
|
662
|
-
const { id: r, type: n } =
|
|
663
|
-
for (const
|
|
664
|
-
const i = (t =
|
|
667
|
+
const { id: r, type: n } = s;
|
|
668
|
+
for (const a of this._adaptors) {
|
|
669
|
+
const i = (t = a.check(n)) == null ? void 0 : t.convert(s, e);
|
|
665
670
|
if (i != null)
|
|
666
671
|
return i;
|
|
667
672
|
}
|
|
668
673
|
}
|
|
669
674
|
_adaptorLoader() {
|
|
670
|
-
|
|
671
|
-
this._adaptors.push(
|
|
675
|
+
U.getData().sort(Ne).forEach((s) => {
|
|
676
|
+
this._adaptors.push(s.create(this._injector));
|
|
672
677
|
});
|
|
673
678
|
}
|
|
674
679
|
};
|
|
675
|
-
re =
|
|
676
|
-
|
|
680
|
+
re = Rt([
|
|
681
|
+
Dt(0, A(ae))
|
|
677
682
|
], re);
|
|
678
|
-
var
|
|
679
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
680
|
-
(i = a
|
|
681
|
-
return n && t &&
|
|
682
|
-
}, ce = (
|
|
683
|
+
var yt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, xt = (s, e, r, n) => {
|
|
684
|
+
for (var t = n > 1 ? void 0 : n ? Et(e, r) : e, a = s.length - 1, i; a >= 0; a--)
|
|
685
|
+
(i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
686
|
+
return n && t && yt(e, r, t), t;
|
|
687
|
+
}, ce = (s, e) => (r, n) => e(r, n, s), Ct = /* @__PURE__ */ ((s) => (s.COMPONENT = "__slideRender__", s.SCENE = "__mainScene__", s.VIEW = "__mainView__", s))(Ct || {});
|
|
683
688
|
let ee = class extends We {
|
|
684
689
|
constructor(e, r, n) {
|
|
685
690
|
super();
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
691
|
+
u(this, "_objectProvider", null);
|
|
692
|
+
u(this, "_activePageId", "");
|
|
693
|
+
u(this, "_refreshThumb", Ue(() => {
|
|
689
694
|
this.createThumbs();
|
|
690
695
|
}, 300));
|
|
691
696
|
this._univerInstanceService = e, this._injector = r, this._renderManagerService = n, this._initializeDependencies(this._injector), this._initialize();
|
|
@@ -693,14 +698,14 @@ let ee = class extends We {
|
|
|
693
698
|
_initialize() {
|
|
694
699
|
this._renderManagerService.createRender$.pipe(Se(this.dispose$)).subscribe((e) => {
|
|
695
700
|
this._create(e);
|
|
696
|
-
}), this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
701
|
+
}), this._univerInstanceService.getCurrentTypeOfUnit$(X.UNIVER_SLIDE).pipe(Se(this.dispose$)).subscribe((e) => {
|
|
697
702
|
this._create(e == null ? void 0 : e.getUnitId());
|
|
698
|
-
}), this._univerInstanceService.getAllUnitsForType(
|
|
703
|
+
}), this._univerInstanceService.getAllUnitsForType(X.UNIVER_SLIDE).forEach((e) => {
|
|
699
704
|
this._create(e.getUnitId());
|
|
700
705
|
});
|
|
701
706
|
}
|
|
702
707
|
activePage(e) {
|
|
703
|
-
const r = this._univerInstanceService.getCurrentUnitForType(
|
|
708
|
+
const r = this._univerInstanceService.getCurrentUnitForType(X.UNIVER_SLIDE);
|
|
704
709
|
let n;
|
|
705
710
|
if (e)
|
|
706
711
|
n = r.getPage(e);
|
|
@@ -713,74 +718,77 @@ let ee = class extends We {
|
|
|
713
718
|
const t = this._currentRender();
|
|
714
719
|
if (n == null || t == null || t.mainComponent == null)
|
|
715
720
|
return;
|
|
716
|
-
const { id:
|
|
717
|
-
if (this._activePageId = e, i != null && i.hasPage(
|
|
718
|
-
i.changePage(
|
|
721
|
+
const { id: a } = n, i = t.mainComponent;
|
|
722
|
+
if (this._activePageId = e, i != null && i.hasPage(a)) {
|
|
723
|
+
i.changePage(a);
|
|
719
724
|
return;
|
|
720
725
|
}
|
|
721
|
-
this._createScene(
|
|
726
|
+
this._createScene(a, n);
|
|
722
727
|
}
|
|
723
728
|
_scrollToCenter() {
|
|
724
729
|
var c;
|
|
725
730
|
const e = (c = this._currentRender()) == null ? void 0 : c.scene, r = e == null ? void 0 : e.getViewport("__mainView__"), n = this._getCenterPositionViewPort(e);
|
|
726
731
|
if (!r || !n)
|
|
727
732
|
return;
|
|
728
|
-
const { left: t, top:
|
|
733
|
+
const { left: t, top: a } = n, { x: i, y: o } = r.getBarScroll(t, a);
|
|
729
734
|
r.scrollTo({
|
|
730
735
|
x: i,
|
|
731
736
|
y: o
|
|
732
737
|
});
|
|
733
738
|
}
|
|
734
739
|
_create(e) {
|
|
735
|
-
e == null || this._univerInstanceService.getUnit(e,
|
|
740
|
+
e == null || this._univerInstanceService.getUnit(e, X.UNIVER_SLIDE) == null || this._renderManagerService.has(e) || this._addNewRender(e);
|
|
736
741
|
}
|
|
737
742
|
_currentRender() {
|
|
738
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
743
|
+
const e = this._univerInstanceService.getCurrentUnitForType(X.UNIVER_SLIDE);
|
|
739
744
|
return this._renderManagerService.getRenderById(e.getUnitId());
|
|
740
745
|
}
|
|
746
|
+
// eslint-disable-next-line max-lines-per-function
|
|
741
747
|
_addNewRender(e) {
|
|
742
|
-
const r = this._univerInstanceService.getUnit(e,
|
|
748
|
+
const r = this._univerInstanceService.getUnit(e, X.UNIVER_SLIDE);
|
|
743
749
|
if (r == null)
|
|
744
750
|
return;
|
|
745
751
|
this._renderManagerService.createRender(e);
|
|
746
752
|
const n = this._renderManagerService.getRenderById(e);
|
|
747
753
|
if (n == null)
|
|
748
754
|
return;
|
|
749
|
-
const { scene: t, engine:
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
755
|
+
const { scene: t, engine: a } = n, i = a.onTransformChangeObservable.add(() => {
|
|
756
|
+
this._scrollToCenter(), i == null || i.dispose();
|
|
757
|
+
});
|
|
758
|
+
a.onTransformChangeObservable.add(() => {
|
|
753
759
|
setTimeout(() => {
|
|
754
760
|
this.createThumbs();
|
|
755
761
|
}, 300);
|
|
756
762
|
}), t.resize(2400, 1800);
|
|
757
|
-
const
|
|
763
|
+
const o = new N("__mainView__", t, {
|
|
758
764
|
left: 0,
|
|
759
765
|
top: 0,
|
|
760
766
|
bottom: 0,
|
|
761
767
|
right: 0,
|
|
768
|
+
isRelativeX: !0,
|
|
769
|
+
isRelativeY: !0,
|
|
762
770
|
isWheelPreventDefaultX: !0
|
|
763
771
|
});
|
|
764
|
-
t.attachControl(), t.on(
|
|
765
|
-
const
|
|
766
|
-
if (
|
|
767
|
-
const
|
|
768
|
-
let d =
|
|
769
|
-
d *=
|
|
772
|
+
t.attachControl(), t.on(ue.wheel, (l, f) => {
|
|
773
|
+
const h = l;
|
|
774
|
+
if (h.ctrlKey) {
|
|
775
|
+
const g = Math.abs(h.deltaX);
|
|
776
|
+
let d = g < 40 ? 0.2 : g < 80 ? 0.4 : 0.2;
|
|
777
|
+
d *= h.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (d /= 2), t.scaleX + d > 4 ? t.scale(4, 4) : t.scaleX + d < 0.1 ? t.scale(0.1, 0.1) : (h.deltaY > 0, h.preventDefault());
|
|
770
778
|
} else
|
|
771
|
-
|
|
779
|
+
o.onMouseWheel(h, f);
|
|
772
780
|
}), t.onFileLoadedObservable.add(() => {
|
|
773
781
|
this._refreshThumb();
|
|
774
|
-
}),
|
|
775
|
-
const
|
|
776
|
-
n.mainComponent =
|
|
782
|
+
}), pe.attachTo(o), this._renderManagerService.setCurrent(e);
|
|
783
|
+
const c = this._createSlide(t);
|
|
784
|
+
n.mainComponent = c, n.components.set("__slideRender__", c), this._createSlidePages(r, c), a.runRenderLoop(() => {
|
|
777
785
|
t.render();
|
|
778
|
-
const
|
|
779
|
-
|
|
786
|
+
const l = document.getElementById("app");
|
|
787
|
+
l && (l.innerText = `fps:${Math.round(a.getFps()).toString()}`);
|
|
780
788
|
});
|
|
781
789
|
}
|
|
782
790
|
_createSlide(e) {
|
|
783
|
-
const r = this._univerInstanceService.getCurrentUnitForType(
|
|
791
|
+
const r = this._univerInstanceService.getCurrentUnitForType(X.UNIVER_SLIDE), { width: n, height: t } = e, a = r.getPageSize(), { width: i = 100, height: o = 100 } = a, c = new Oe("__slideRender__", {
|
|
784
792
|
left: (n - i) / 2,
|
|
785
793
|
top: (t - o) / 2,
|
|
786
794
|
width: i,
|
|
@@ -790,10 +798,10 @@ let ee = class extends We {
|
|
|
790
798
|
return c.enableNav(), c.enableSelectedClipElement(), e.addObject(c), c;
|
|
791
799
|
}
|
|
792
800
|
_addBackgroundRect(e, r) {
|
|
793
|
-
const t = this._univerInstanceService.getCurrentUnitForType(
|
|
801
|
+
const t = this._univerInstanceService.getCurrentUnitForType(X.UNIVER_SLIDE).getPageSize(), { width: a = 0, height: i = 0 } = t, o = new H("canvas", {
|
|
794
802
|
left: 0,
|
|
795
803
|
top: 0,
|
|
796
|
-
width:
|
|
804
|
+
width: a,
|
|
797
805
|
height: i,
|
|
798
806
|
strokeWidth: 1,
|
|
799
807
|
stroke: "rgba(198,198,198, 1)",
|
|
@@ -806,9 +814,9 @@ let ee = class extends We {
|
|
|
806
814
|
_getCenterPositionViewPort(e) {
|
|
807
815
|
if (!e)
|
|
808
816
|
return { left: 0, top: 0 };
|
|
809
|
-
const { width: r, height: n } = e, t = e.getEngine(),
|
|
817
|
+
const { width: r, height: n } = e, t = e.getEngine(), a = (t == null ? void 0 : t.width) || 0, i = (t == null ? void 0 : t.height) || 0;
|
|
810
818
|
return {
|
|
811
|
-
left: (r -
|
|
819
|
+
left: (r - a) / 2,
|
|
812
820
|
top: (n - i) / 2
|
|
813
821
|
};
|
|
814
822
|
}
|
|
@@ -819,23 +827,23 @@ let ee = class extends We {
|
|
|
819
827
|
const { engine: t } = n;
|
|
820
828
|
if (t == null)
|
|
821
829
|
return;
|
|
822
|
-
const { width:
|
|
823
|
-
r.renderToThumb(l, e, o /
|
|
830
|
+
const { width: a, height: i } = r, { width: o = a, height: c = i } = t, l = t.getCanvas().getContext();
|
|
831
|
+
r.renderToThumb(l, e, o / a, c / i);
|
|
824
832
|
}
|
|
825
833
|
_createSlidePages(e, r) {
|
|
826
834
|
const n = e.getPages(), t = e.getPageOrder();
|
|
827
835
|
if (!(!n || !t) && t.length !== 0) {
|
|
828
|
-
for (let
|
|
829
|
-
const o = t[
|
|
836
|
+
for (let a = 0, i = t.length; a < i; a++) {
|
|
837
|
+
const o = t[a];
|
|
830
838
|
this._createScene(o, n[o]), this._createThumb(o);
|
|
831
839
|
}
|
|
832
840
|
this._activePageId = t[0], r.activeFirstPage();
|
|
833
841
|
}
|
|
834
842
|
}
|
|
835
843
|
createThumbs() {
|
|
836
|
-
const r = this._univerInstanceService.getCurrentUnitForType(
|
|
844
|
+
const r = this._univerInstanceService.getCurrentUnitForType(X.UNIVER_SLIDE).getPageOrder(), n = this._currentRender();
|
|
837
845
|
if (!(!r || !n) && r.length !== 0)
|
|
838
|
-
for (let t = 0,
|
|
846
|
+
for (let t = 0, a = r.length; t < a; t++) {
|
|
839
847
|
const i = r[t];
|
|
840
848
|
this._thumbSceneRender(i, n.mainComponent);
|
|
841
849
|
}
|
|
@@ -847,24 +855,28 @@ let ee = class extends We {
|
|
|
847
855
|
const n = this._currentRender();
|
|
848
856
|
if (!n || !this._objectProvider)
|
|
849
857
|
return;
|
|
850
|
-
const { scene: t, mainComponent:
|
|
858
|
+
const { scene: t, mainComponent: a } = n, i = a, { width: o, height: c } = i, l = new ie(e, i, {
|
|
851
859
|
width: o,
|
|
852
860
|
height: c
|
|
853
861
|
});
|
|
854
|
-
new
|
|
862
|
+
new N(`PageViewer_${e}`, l, {
|
|
855
863
|
left: 0,
|
|
856
864
|
top: 0,
|
|
857
865
|
bottom: 0,
|
|
858
|
-
right: 0
|
|
866
|
+
right: 0,
|
|
867
|
+
isRelativeX: !0,
|
|
868
|
+
isRelativeY: !0
|
|
859
869
|
}).closeClip();
|
|
860
|
-
const { pageElements:
|
|
861
|
-
if (!
|
|
870
|
+
const { pageElements: h, pageBackgroundFill: g } = r, d = this._objectProvider.convertToRenderObjects(h, t);
|
|
871
|
+
if (!d || !i)
|
|
862
872
|
return;
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
873
|
+
this._addBackgroundRect(l, g), l.addObjects(d), d.forEach((_) => {
|
|
874
|
+
l.attachTransformerTo(_);
|
|
875
|
+
});
|
|
876
|
+
const p = l.getTransformer();
|
|
877
|
+
return p == null || p.onChangeEndObservable.add(() => {
|
|
866
878
|
this._thumbSceneRender(this._activePageId, i);
|
|
867
|
-
}),
|
|
879
|
+
}), p == null || p.onClearControlObservable.add(() => {
|
|
868
880
|
this._thumbSceneRender(this._activePageId, i);
|
|
869
881
|
}), i.addPage(l), l;
|
|
870
882
|
}
|
|
@@ -872,31 +884,29 @@ let ee = class extends We {
|
|
|
872
884
|
this._objectProvider = e.createInstance(re);
|
|
873
885
|
}
|
|
874
886
|
};
|
|
875
|
-
ee =
|
|
876
|
-
Ae(
|
|
877
|
-
ce(0,
|
|
878
|
-
ce(1, A(
|
|
887
|
+
ee = xt([
|
|
888
|
+
Ae(Ye.Ready, ee),
|
|
889
|
+
ce(0, be),
|
|
890
|
+
ce(1, A(ae)),
|
|
879
891
|
ce(2, Qe)
|
|
880
892
|
], ee);
|
|
881
|
-
var
|
|
882
|
-
for (var t = n > 1 ? void 0 : n ?
|
|
883
|
-
(i = a
|
|
884
|
-
return n && t &&
|
|
885
|
-
}, oe = (
|
|
886
|
-
const
|
|
893
|
+
var jt = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor, Xt = (s, e, r, n) => {
|
|
894
|
+
for (var t = n > 1 ? void 0 : n ? Mt(e, r) : e, a = s.length - 1, i; a >= 0; a--)
|
|
895
|
+
(i = s[a]) && (t = (n ? i(e, r, t) : i(t)) || t);
|
|
896
|
+
return n && t && jt(e, r, t), t;
|
|
897
|
+
}, oe = (s, e) => (r, n) => e(r, n, s);
|
|
898
|
+
const Lt = {}, Vt = "slides";
|
|
887
899
|
var Q;
|
|
888
|
-
let
|
|
900
|
+
let Pe = (Q = class extends $e {
|
|
889
901
|
constructor(e = {}, r, n, t) {
|
|
890
902
|
super();
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
this._univerInstanceService = r, this._localeService = n, this._injector = t, this._config = Object.assign(
|
|
903
|
+
u(this, "_config");
|
|
904
|
+
u(this, "_canvasEngine", null);
|
|
905
|
+
u(this, "_canvasView", null);
|
|
906
|
+
this._univerInstanceService = r, this._localeService = n, this._injector = t, this._config = Object.assign(Lt, e), this._initializeDependencies(this._injector);
|
|
895
907
|
}
|
|
896
908
|
initialize() {
|
|
897
|
-
this.
|
|
898
|
-
zhCN: tt
|
|
899
|
-
}), this.initCanvasEngine();
|
|
909
|
+
this.initCanvasEngine();
|
|
900
910
|
}
|
|
901
911
|
getConfig() {
|
|
902
912
|
return this._config;
|
|
@@ -918,17 +928,14 @@ let be = (Q = class extends He {
|
|
|
918
928
|
e.add(n);
|
|
919
929
|
});
|
|
920
930
|
}
|
|
921
|
-
},
|
|
922
|
-
|
|
923
|
-
oe(1,
|
|
931
|
+
}, u(Q, "pluginName", Vt), u(Q, "type", X.UNIVER_SLIDE), Q);
|
|
932
|
+
Pe = Xt([
|
|
933
|
+
oe(1, be),
|
|
924
934
|
oe(2, A(ne)),
|
|
925
|
-
oe(3, A(
|
|
926
|
-
],
|
|
935
|
+
oe(3, A(ae))
|
|
936
|
+
], Pe);
|
|
927
937
|
export {
|
|
928
938
|
ee as CanvasView,
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
Yt as enUS,
|
|
932
|
-
Ft as ruRU,
|
|
933
|
-
tt as zhCN
|
|
939
|
+
Ct as SLIDE_KEY,
|
|
940
|
+
Pe as UniverSlidesPlugin
|
|
934
941
|
};
|