@univerjs/docs-ui 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +16 -0
- package/lib/cjs/index.js +514 -0
- package/lib/cjs/locale/en-US.js +26 -0
- package/lib/cjs/locale/zh-CN.js +26 -0
- package/lib/esm/index.js +500 -0
- package/lib/esm/locale/en-US.js +5 -0
- package/lib/esm/locale/zh-CN.js +5 -0
- package/lib/types/basics/const/default-univer-doc-config.d.ts +65 -0
- package/lib/types/basics/const/default-univer-doc-config.d.ts.map +1 -0
- package/lib/types/basics/const/index.d.ts +3 -0
- package/lib/types/basics/const/index.d.ts.map +1 -0
- package/lib/types/basics/const/plugin-name.d.ts +2 -0
- package/lib/types/basics/const/plugin-name.d.ts.map +1 -0
- package/lib/types/basics/index.d.ts +3 -0
- package/lib/types/basics/index.d.ts.map +1 -0
- package/lib/types/basics/interfaces/component-config/i-doc-ui-plugin-config.d.ts +48 -0
- package/lib/types/basics/interfaces/component-config/i-doc-ui-plugin-config.d.ts.map +1 -0
- package/lib/types/basics/interfaces/component-config/index.d.ts +2 -0
- package/lib/types/basics/interfaces/component-config/index.d.ts.map +1 -0
- package/lib/types/basics/interfaces/index.d.ts +2 -0
- package/lib/types/basics/interfaces/index.d.ts.map +1 -0
- package/lib/types/controllers/app-ui-controller.d.ts +20 -0
- package/lib/types/controllers/app-ui-controller.d.ts.map +1 -0
- package/lib/types/controllers/doc-container-ui-controller.d.ts +31 -0
- package/lib/types/controllers/doc-container-ui-controller.d.ts.map +1 -0
- package/lib/types/controllers/doc-ui.controller.d.ts +15 -0
- package/lib/types/controllers/doc-ui.controller.d.ts.map +1 -0
- package/lib/types/controllers/index.d.ts +3 -0
- package/lib/types/controllers/index.d.ts.map +1 -0
- package/lib/types/controllers/menu/menu.d.ts +7 -0
- package/lib/types/controllers/menu/menu.d.ts.map +1 -0
- package/lib/types/docs-ui-plugin.d.ts +16 -0
- package/lib/types/docs-ui-plugin.d.ts.map +1 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/locale/en-US.d.ts +3 -0
- package/lib/types/locale/en-US.d.ts.map +1 -0
- package/lib/types/locale/index.d.ts +3 -0
- package/lib/types/locale/index.d.ts.map +1 -0
- package/lib/types/locale/zh-CN.d.ts +3 -0
- package/lib/types/locale/zh-CN.d.ts.map +1 -0
- package/lib/types/views/doc-container/DocContainer.d.ts +49 -0
- package/lib/types/views/doc-container/DocContainer.d.ts.map +1 -0
- package/lib/types/views/doc-container/index.d.ts +2 -0
- package/lib/types/views/doc-container/index.d.ts.map +1 -0
- package/package.json +64 -0
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
function _assert_this_initialized(self) {
|
|
2
|
+
if (self === void 0) {
|
|
3
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
|
+
}
|
|
5
|
+
return self;
|
|
6
|
+
}
|
|
7
|
+
function _class_call_check(instance, Constructor) {
|
|
8
|
+
if (!(instance instanceof Constructor)) {
|
|
9
|
+
throw new TypeError("Cannot call a class as a function");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function _construct(Parent, args, Class) {
|
|
13
|
+
if (_is_native_reflect_construct()) {
|
|
14
|
+
_construct = Reflect.construct;
|
|
15
|
+
} else {
|
|
16
|
+
_construct = function construct(Parent, args, Class) {
|
|
17
|
+
var a = [
|
|
18
|
+
null
|
|
19
|
+
];
|
|
20
|
+
a.push.apply(a, args);
|
|
21
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
22
|
+
var instance = new Constructor();
|
|
23
|
+
if (Class) _set_prototype_of(instance, Class.prototype);
|
|
24
|
+
return instance;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return _construct.apply(null, arguments);
|
|
28
|
+
}
|
|
29
|
+
function _defineProperties(target, props) {
|
|
30
|
+
for(var i = 0; i < props.length; i++){
|
|
31
|
+
var descriptor = props[i];
|
|
32
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
33
|
+
descriptor.configurable = true;
|
|
34
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
35
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
39
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
40
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
41
|
+
return Constructor;
|
|
42
|
+
}
|
|
43
|
+
function _define_property(obj, key, value) {
|
|
44
|
+
if (key in obj) {
|
|
45
|
+
Object.defineProperty(obj, key, {
|
|
46
|
+
value: value,
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
obj[key] = value;
|
|
53
|
+
}
|
|
54
|
+
return obj;
|
|
55
|
+
}
|
|
56
|
+
function _get_prototype_of(o) {
|
|
57
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
58
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
59
|
+
};
|
|
60
|
+
return _get_prototype_of(o);
|
|
61
|
+
}
|
|
62
|
+
function _inherits(subClass, superClass) {
|
|
63
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
64
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
65
|
+
}
|
|
66
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
67
|
+
constructor: {
|
|
68
|
+
value: subClass,
|
|
69
|
+
writable: true,
|
|
70
|
+
configurable: true
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
74
|
+
}
|
|
75
|
+
function _is_native_function(fn) {
|
|
76
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
77
|
+
}
|
|
78
|
+
function _possible_constructor_return(self, call) {
|
|
79
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
80
|
+
return call;
|
|
81
|
+
}
|
|
82
|
+
return _assert_this_initialized(self);
|
|
83
|
+
}
|
|
84
|
+
function _set_prototype_of(o, p) {
|
|
85
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
86
|
+
o.__proto__ = p;
|
|
87
|
+
return o;
|
|
88
|
+
};
|
|
89
|
+
return _set_prototype_of(o, p);
|
|
90
|
+
}
|
|
91
|
+
function _type_of(obj) {
|
|
92
|
+
"@swc/helpers - typeof";
|
|
93
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
94
|
+
}
|
|
95
|
+
function _wrap_native_super(Class) {
|
|
96
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
97
|
+
_wrap_native_super = function wrapNativeSuper(Class) {
|
|
98
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
99
|
+
if (typeof Class !== "function") {
|
|
100
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
101
|
+
}
|
|
102
|
+
if (typeof _cache !== "undefined") {
|
|
103
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
104
|
+
_cache.set(Class, Wrapper);
|
|
105
|
+
}
|
|
106
|
+
function Wrapper() {
|
|
107
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
108
|
+
}
|
|
109
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
110
|
+
constructor: {
|
|
111
|
+
value: Wrapper,
|
|
112
|
+
enumerable: false,
|
|
113
|
+
writable: true,
|
|
114
|
+
configurable: true
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return _set_prototype_of(Wrapper, Class);
|
|
118
|
+
};
|
|
119
|
+
return _wrap_native_super(Class);
|
|
120
|
+
}
|
|
121
|
+
function _is_native_reflect_construct() {
|
|
122
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
123
|
+
if (Reflect.construct.sham) return false;
|
|
124
|
+
if (typeof Proxy === "function") return true;
|
|
125
|
+
try {
|
|
126
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
127
|
+
return true;
|
|
128
|
+
} catch (e) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function _create_super(Derived) {
|
|
133
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
134
|
+
return function _createSuperInternal() {
|
|
135
|
+
var Super = _get_prototype_of(Derived), result;
|
|
136
|
+
if (hasNativeReflectConstruct) {
|
|
137
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
138
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
139
|
+
} else {
|
|
140
|
+
result = Super.apply(this, arguments);
|
|
141
|
+
}
|
|
142
|
+
return _possible_constructor_return(this, result);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
var _class;
|
|
146
|
+
var __defProp = Object.defineProperty;
|
|
147
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
148
|
+
var __decorateClass = function(decorators, target, key, kind) {
|
|
149
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
150
|
+
for(var i = decorators.length - 1, decorator; i >= 0; i--)if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
151
|
+
if (kind && result) __defProp(target, key, result);
|
|
152
|
+
return result;
|
|
153
|
+
};
|
|
154
|
+
var __decorateParam = function(index, decorator) {
|
|
155
|
+
return function(target, key) {
|
|
156
|
+
return decorator(target, key, index);
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
// src/basics/const/default-univer-doc-config.ts
|
|
160
|
+
var DefaultToolbarConfig = {
|
|
161
|
+
undo: true,
|
|
162
|
+
redo: true,
|
|
163
|
+
// Undo redo
|
|
164
|
+
font: true,
|
|
165
|
+
// 'font'
|
|
166
|
+
fontSize: true,
|
|
167
|
+
// 'Font size'
|
|
168
|
+
bold: true,
|
|
169
|
+
// 'Bold (Ctrl+B)'
|
|
170
|
+
italic: true,
|
|
171
|
+
// 'Italic (Ctrl+I)'
|
|
172
|
+
strikethrough: true,
|
|
173
|
+
// 'Strikethrough (Alt+Shift+5)'
|
|
174
|
+
underline: true,
|
|
175
|
+
// 'Underline (Alt+Shift+6)'
|
|
176
|
+
textColor: true,
|
|
177
|
+
// 'Text color'
|
|
178
|
+
fillColor: true,
|
|
179
|
+
// 'Cell color'
|
|
180
|
+
horizontalAlignMode: true,
|
|
181
|
+
// 'Horizontal alignment'
|
|
182
|
+
verticalAlignMode: true,
|
|
183
|
+
// 'Vertical alignment'
|
|
184
|
+
textWrapMode: true,
|
|
185
|
+
// 'Wrap mode'
|
|
186
|
+
textRotateMode: true
|
|
187
|
+
};
|
|
188
|
+
var DefaultDocContainerConfig = {
|
|
189
|
+
outerLeft: false,
|
|
190
|
+
outerRight: false,
|
|
191
|
+
header: true,
|
|
192
|
+
footer: true,
|
|
193
|
+
innerLeft: false,
|
|
194
|
+
innerRight: false,
|
|
195
|
+
frozenHeaderLT: false,
|
|
196
|
+
frozenHeaderRT: false,
|
|
197
|
+
frozenHeaderLM: false,
|
|
198
|
+
frozenContent: false,
|
|
199
|
+
infoBar: true,
|
|
200
|
+
toolbar: true
|
|
201
|
+
};
|
|
202
|
+
var DefaultDocUiConfig = {
|
|
203
|
+
layout: {
|
|
204
|
+
docContainerConfig: DefaultDocContainerConfig,
|
|
205
|
+
toolbarConfig: DefaultToolbarConfig
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
// src/basics/const/plugin-name.ts
|
|
209
|
+
var DOC_UI_PLUGIN_NAME = "DocUI";
|
|
210
|
+
// src/docs-ui-plugin.ts
|
|
211
|
+
import { DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, IUniverInstanceService, LocaleService as LocaleService3, Plugin, PluginType, Tools } from "@univerjs/core";
|
|
212
|
+
import { Inject as Inject4, Injector as Injector4 } from "@wendellhu/redi";
|
|
213
|
+
// src/controllers/app-ui-controller.ts
|
|
214
|
+
import { LocaleService as LocaleService2 } from "@univerjs/core";
|
|
215
|
+
import { Inject as Inject2, Injector as Injector2 } from "@wendellhu/redi";
|
|
216
|
+
// src/controllers/doc-container-ui-controller.ts
|
|
217
|
+
import { LocaleService } from "@univerjs/core";
|
|
218
|
+
import { Inject, Injector } from "@wendellhu/redi";
|
|
219
|
+
var DocContainerUIController = /*#__PURE__*/ function() {
|
|
220
|
+
"use strict";
|
|
221
|
+
function DocContainerUIController(_config, _localeService, _injector) {
|
|
222
|
+
var _this = this;
|
|
223
|
+
_class_call_check(this, DocContainerUIController);
|
|
224
|
+
_define_property(this, "_docContainer", void 0);
|
|
225
|
+
// 获取SheetContainer组件
|
|
226
|
+
_define_property(this, "getComponent", function(ref) {
|
|
227
|
+
_this._docContainer = ref;
|
|
228
|
+
var container = ref.getContentRef().current;
|
|
229
|
+
if (!container) {
|
|
230
|
+
throw new Error("container is not ready");
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* Change language
|
|
235
|
+
* @param {String} lang new language
|
|
236
|
+
*
|
|
237
|
+
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
238
|
+
*
|
|
239
|
+
*/ _define_property(this, "changeLocale", function(locale) {
|
|
240
|
+
_this._localeService.setLocale(locale);
|
|
241
|
+
});
|
|
242
|
+
this._config = _config;
|
|
243
|
+
this._localeService = _localeService;
|
|
244
|
+
this._injector = _injector;
|
|
245
|
+
}
|
|
246
|
+
_create_class(DocContainerUIController, [
|
|
247
|
+
{
|
|
248
|
+
key: "getUIConfig",
|
|
249
|
+
value: function getUIConfig() {
|
|
250
|
+
var config = {
|
|
251
|
+
injector: this._injector,
|
|
252
|
+
config: this._config,
|
|
253
|
+
changeLocale: this.changeLocale,
|
|
254
|
+
getComponent: this.getComponent
|
|
255
|
+
};
|
|
256
|
+
return config;
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
key: "getContentRef",
|
|
261
|
+
value: function getContentRef() {
|
|
262
|
+
return this._docContainer.getContentRef();
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
key: "UIDidMount",
|
|
267
|
+
value: function UIDidMount(cb) {
|
|
268
|
+
if (this._docContainer) {
|
|
269
|
+
return cb(this._docContainer);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
key: "getDocContainer",
|
|
275
|
+
value: function getDocContainer() {
|
|
276
|
+
return this._docContainer;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
]);
|
|
280
|
+
return DocContainerUIController;
|
|
281
|
+
}();
|
|
282
|
+
DocContainerUIController = __decorateClass([
|
|
283
|
+
__decorateParam(1, Inject(LocaleService)),
|
|
284
|
+
__decorateParam(2, Inject(Injector))
|
|
285
|
+
], DocContainerUIController);
|
|
286
|
+
// src/controllers/app-ui-controller.ts
|
|
287
|
+
var AppUIController = /*#__PURE__*/ function() {
|
|
288
|
+
"use strict";
|
|
289
|
+
function AppUIController(_config, _localeService, _injector) {
|
|
290
|
+
var _this = this;
|
|
291
|
+
_class_call_check(this, AppUIController);
|
|
292
|
+
_define_property(this, "_docContainerController", void 0);
|
|
293
|
+
/**
|
|
294
|
+
* Change language
|
|
295
|
+
* @param {String} locale new language
|
|
296
|
+
*
|
|
297
|
+
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
298
|
+
*
|
|
299
|
+
*/ _define_property(this, "changeLocale", function(locale) {
|
|
300
|
+
_this._localeService.setLocale(locale);
|
|
301
|
+
});
|
|
302
|
+
this._localeService = _localeService;
|
|
303
|
+
this._injector = _injector;
|
|
304
|
+
this._docContainerController = this._injector.createInstance(DocContainerUIController, _config);
|
|
305
|
+
}
|
|
306
|
+
_create_class(AppUIController, [
|
|
307
|
+
{
|
|
308
|
+
key: "getDocContainerController",
|
|
309
|
+
value: function getDocContainerController() {
|
|
310
|
+
return this._docContainerController;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
]);
|
|
314
|
+
return AppUIController;
|
|
315
|
+
}();
|
|
316
|
+
AppUIController = __decorateClass([
|
|
317
|
+
__decorateParam(1, Inject2(LocaleService2)),
|
|
318
|
+
__decorateParam(2, Inject2(Injector2))
|
|
319
|
+
], AppUIController);
|
|
320
|
+
// src/controllers/doc-ui.controller.ts
|
|
321
|
+
import { Disposable, ICommandService, LifecycleStages, OnLifecycle } from "@univerjs/core";
|
|
322
|
+
import { ComponentManager, IMenuService, IShortcutService, IUIController } from "@univerjs/ui";
|
|
323
|
+
import { Inject as Inject3, Injector as Injector3 } from "@wendellhu/redi";
|
|
324
|
+
// src/controllers/menu/menu.ts
|
|
325
|
+
import { SetInlineFormatBoldCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatUnderlineCommand } from "@univerjs/docs";
|
|
326
|
+
import { MenuItemType, MenuPosition } from "@univerjs/ui";
|
|
327
|
+
function BoldMenuItemFactory(accessor) {
|
|
328
|
+
return {
|
|
329
|
+
id: SetInlineFormatBoldCommand.id,
|
|
330
|
+
type: MenuItemType.BUTTON,
|
|
331
|
+
icon: "BoldSingle",
|
|
332
|
+
title: "Set bold",
|
|
333
|
+
tooltip: "toolbar.bold",
|
|
334
|
+
positions: [
|
|
335
|
+
MenuPosition.TOOLBAR_START
|
|
336
|
+
]
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function ItalicMenuItemFactory(accessor) {
|
|
340
|
+
return {
|
|
341
|
+
id: SetInlineFormatItalicCommand.id,
|
|
342
|
+
type: MenuItemType.BUTTON,
|
|
343
|
+
icon: "ItalicSingle",
|
|
344
|
+
title: "Set italic",
|
|
345
|
+
tooltip: "toolbar.italic",
|
|
346
|
+
positions: [
|
|
347
|
+
MenuPosition.TOOLBAR_START
|
|
348
|
+
]
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function UnderlineMenuItemFactory(accessor) {
|
|
352
|
+
return {
|
|
353
|
+
id: SetInlineFormatUnderlineCommand.id,
|
|
354
|
+
type: MenuItemType.BUTTON,
|
|
355
|
+
icon: "UnderlineSingle",
|
|
356
|
+
title: "Set underline",
|
|
357
|
+
tooltip: "toolbar.underline",
|
|
358
|
+
positions: [
|
|
359
|
+
MenuPosition.TOOLBAR_START
|
|
360
|
+
]
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function StrikeThroughMenuItemFactory(accessor) {
|
|
364
|
+
return {
|
|
365
|
+
id: SetInlineFormatStrikethroughCommand.id,
|
|
366
|
+
type: MenuItemType.BUTTON,
|
|
367
|
+
icon: "StrikethroughSingle",
|
|
368
|
+
title: "Set strike through",
|
|
369
|
+
tooltip: "toolbar.strikethrough",
|
|
370
|
+
positions: [
|
|
371
|
+
MenuPosition.TOOLBAR_START
|
|
372
|
+
]
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
// src/controllers/doc-ui.controller.ts
|
|
376
|
+
var DocUIController = /*#__PURE__*/ function(Disposable) {
|
|
377
|
+
"use strict";
|
|
378
|
+
_inherits(DocUIController, Disposable);
|
|
379
|
+
var _super = _create_super(DocUIController);
|
|
380
|
+
function DocUIController(_injector, _componentManager, _commandService, _shortcutService, _menuService, _uiController) {
|
|
381
|
+
_class_call_check(this, DocUIController);
|
|
382
|
+
var _this;
|
|
383
|
+
_this = _super.call(this);
|
|
384
|
+
_this._injector = _injector;
|
|
385
|
+
_this._componentManager = _componentManager;
|
|
386
|
+
_this._commandService = _commandService;
|
|
387
|
+
_this._shortcutService = _shortcutService;
|
|
388
|
+
_this._menuService = _menuService;
|
|
389
|
+
_this._uiController = _uiController;
|
|
390
|
+
_this._init();
|
|
391
|
+
return _this;
|
|
392
|
+
}
|
|
393
|
+
_create_class(DocUIController, [
|
|
394
|
+
{
|
|
395
|
+
key: "_init",
|
|
396
|
+
value: function _init() {
|
|
397
|
+
var _this = this;
|
|
398
|
+
[
|
|
399
|
+
BoldMenuItemFactory,
|
|
400
|
+
ItalicMenuItemFactory,
|
|
401
|
+
UnderlineMenuItemFactory,
|
|
402
|
+
StrikeThroughMenuItemFactory
|
|
403
|
+
].forEach(function(factory) {
|
|
404
|
+
_this.disposeWithMe(_this._menuService.addMenuItem(_this._injector.invoke(factory)));
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
]);
|
|
409
|
+
return DocUIController;
|
|
410
|
+
}(Disposable);
|
|
411
|
+
DocUIController = __decorateClass([
|
|
412
|
+
OnLifecycle(LifecycleStages.Rendered, DocUIController),
|
|
413
|
+
__decorateParam(0, Inject3(Injector3)),
|
|
414
|
+
__decorateParam(1, Inject3(ComponentManager)),
|
|
415
|
+
__decorateParam(2, ICommandService),
|
|
416
|
+
__decorateParam(3, IShortcutService),
|
|
417
|
+
__decorateParam(4, IMenuService),
|
|
418
|
+
__decorateParam(5, IUIController)
|
|
419
|
+
], DocUIController);
|
|
420
|
+
// src/locale/en-US.ts
|
|
421
|
+
var en_US_default = {};
|
|
422
|
+
// src/docs-ui-plugin.ts
|
|
423
|
+
var DocsUIPlugin = (_class = /*#__PURE__*/ function(Plugin) {
|
|
424
|
+
"use strict";
|
|
425
|
+
_inherits(_class, Plugin);
|
|
426
|
+
var _super = _create_super(_class);
|
|
427
|
+
function _class(_config, _injector, _localeService) {
|
|
428
|
+
_class_call_check(this, _class);
|
|
429
|
+
var _this;
|
|
430
|
+
_this = _super.call(this, DOC_UI_PLUGIN_NAME);
|
|
431
|
+
_this._config = _config;
|
|
432
|
+
_this._injector = _injector;
|
|
433
|
+
_this._localeService = _localeService;
|
|
434
|
+
_this._localeService.load({
|
|
435
|
+
enUS: en_US_default
|
|
436
|
+
});
|
|
437
|
+
_this._config = Tools.deepMerge({}, DefaultDocUiConfig, _this._config);
|
|
438
|
+
_this._initDependencies(_injector);
|
|
439
|
+
return _this;
|
|
440
|
+
}
|
|
441
|
+
_create_class(_class, [
|
|
442
|
+
{
|
|
443
|
+
key: "onRendered",
|
|
444
|
+
value: function onRendered() {
|
|
445
|
+
this._initModules();
|
|
446
|
+
this._markDocAsFocused();
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
key: "onDestroy",
|
|
451
|
+
value: function onDestroy() {}
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
key: "_initDependencies",
|
|
455
|
+
value: function _initDependencies(injector) {
|
|
456
|
+
var _this = this;
|
|
457
|
+
var dependencies = [
|
|
458
|
+
[
|
|
459
|
+
DocUIController
|
|
460
|
+
],
|
|
461
|
+
[
|
|
462
|
+
// controllers
|
|
463
|
+
AppUIController,
|
|
464
|
+
{
|
|
465
|
+
useFactory: function() {
|
|
466
|
+
return _this._injector.createInstance(AppUIController, _this._config);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
]
|
|
470
|
+
];
|
|
471
|
+
dependencies.forEach(function(d) {
|
|
472
|
+
injector.add(d);
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
key: "_markDocAsFocused",
|
|
478
|
+
value: function _markDocAsFocused() {
|
|
479
|
+
var currentService = this._injector.get(IUniverInstanceService);
|
|
480
|
+
var doc = currentService.getCurrentUniverDocInstance();
|
|
481
|
+
var id = doc.getUnitId();
|
|
482
|
+
if (id !== DOCS_NORMAL_EDITOR_UNIT_ID_KEY && id !== DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) {
|
|
483
|
+
currentService.focusUniverInstance(doc.getUnitId());
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
key: "_initModules",
|
|
489
|
+
value: function _initModules() {
|
|
490
|
+
this._injector.get(AppUIController);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
]);
|
|
494
|
+
return _class;
|
|
495
|
+
}(_wrap_native_super(Plugin)), _define_property(_class, "type", PluginType.Doc), _class);
|
|
496
|
+
DocsUIPlugin = __decorateClass([
|
|
497
|
+
__decorateParam(1, Inject4(Injector4)),
|
|
498
|
+
__decorateParam(2, Inject4(LocaleService3))
|
|
499
|
+
], DocsUIPlugin);
|
|
500
|
+
export { DOC_UI_PLUGIN_NAME, DefaultDocContainerConfig, DefaultDocUiConfig, DefaultToolbarConfig, DocsUIPlugin };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export declare const DefaultToolbarConfig: {
|
|
2
|
+
undo: boolean;
|
|
3
|
+
redo: boolean;
|
|
4
|
+
font: boolean;
|
|
5
|
+
fontSize: boolean;
|
|
6
|
+
bold: boolean;
|
|
7
|
+
italic: boolean;
|
|
8
|
+
strikethrough: boolean;
|
|
9
|
+
underline: boolean;
|
|
10
|
+
textColor: boolean;
|
|
11
|
+
fillColor: boolean;
|
|
12
|
+
horizontalAlignMode: boolean;
|
|
13
|
+
verticalAlignMode: boolean;
|
|
14
|
+
textWrapMode: boolean;
|
|
15
|
+
textRotateMode: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const DefaultDocContainerConfig: {
|
|
18
|
+
outerLeft: boolean;
|
|
19
|
+
outerRight: boolean;
|
|
20
|
+
header: boolean;
|
|
21
|
+
footer: boolean;
|
|
22
|
+
innerLeft: boolean;
|
|
23
|
+
innerRight: boolean;
|
|
24
|
+
frozenHeaderLT: boolean;
|
|
25
|
+
frozenHeaderRT: boolean;
|
|
26
|
+
frozenHeaderLM: boolean;
|
|
27
|
+
frozenContent: boolean;
|
|
28
|
+
infoBar: boolean;
|
|
29
|
+
toolbar: boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare const DefaultDocUiConfig: {
|
|
32
|
+
layout: {
|
|
33
|
+
docContainerConfig: {
|
|
34
|
+
outerLeft: boolean;
|
|
35
|
+
outerRight: boolean;
|
|
36
|
+
header: boolean;
|
|
37
|
+
footer: boolean;
|
|
38
|
+
innerLeft: boolean;
|
|
39
|
+
innerRight: boolean;
|
|
40
|
+
frozenHeaderLT: boolean;
|
|
41
|
+
frozenHeaderRT: boolean;
|
|
42
|
+
frozenHeaderLM: boolean;
|
|
43
|
+
frozenContent: boolean;
|
|
44
|
+
infoBar: boolean;
|
|
45
|
+
toolbar: boolean;
|
|
46
|
+
};
|
|
47
|
+
toolbarConfig: {
|
|
48
|
+
undo: boolean;
|
|
49
|
+
redo: boolean;
|
|
50
|
+
font: boolean;
|
|
51
|
+
fontSize: boolean;
|
|
52
|
+
bold: boolean;
|
|
53
|
+
italic: boolean;
|
|
54
|
+
strikethrough: boolean;
|
|
55
|
+
underline: boolean;
|
|
56
|
+
textColor: boolean;
|
|
57
|
+
fillColor: boolean;
|
|
58
|
+
horizontalAlignMode: boolean;
|
|
59
|
+
verticalAlignMode: boolean;
|
|
60
|
+
textWrapMode: boolean;
|
|
61
|
+
textRotateMode: boolean;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=default-univer-doc-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-univer-doc-config.d.ts","sourceRoot":"","sources":["../../../../src/basics/const/default-univer-doc-config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;CAehC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;CAarC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAK9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/basics/const/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-name.d.ts","sourceRoot":"","sources":["../../../../src/basics/const/plugin-name.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/basics/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface ILayout {
|
|
2
|
+
docContainerConfig?: DocContainerConfig;
|
|
3
|
+
toolbarConfig?: DocToolbarConfig;
|
|
4
|
+
}
|
|
5
|
+
export interface IDocsUIPluginConfig {
|
|
6
|
+
container?: HTMLElement | string;
|
|
7
|
+
layout?: ILayout;
|
|
8
|
+
}
|
|
9
|
+
export interface DocContainerConfig {
|
|
10
|
+
outerLeft?: boolean;
|
|
11
|
+
outerRight?: boolean;
|
|
12
|
+
header?: boolean;
|
|
13
|
+
footer?: boolean;
|
|
14
|
+
innerLeft?: boolean;
|
|
15
|
+
innerRight?: boolean;
|
|
16
|
+
frozenHeaderLT?: boolean;
|
|
17
|
+
frozenHeaderRT?: boolean;
|
|
18
|
+
frozenHeaderLM?: boolean;
|
|
19
|
+
frozenContent?: boolean;
|
|
20
|
+
infoBar?: boolean;
|
|
21
|
+
toolbar?: boolean;
|
|
22
|
+
contentSplit?: boolean | string;
|
|
23
|
+
}
|
|
24
|
+
export interface DocToolbarConfig {
|
|
25
|
+
undo?: boolean;
|
|
26
|
+
redo?: boolean;
|
|
27
|
+
paintFormat?: boolean;
|
|
28
|
+
currencyFormat?: boolean;
|
|
29
|
+
percentageFormat?: boolean;
|
|
30
|
+
numberDecrease?: boolean;
|
|
31
|
+
numberIncrease?: boolean;
|
|
32
|
+
font?: boolean;
|
|
33
|
+
moreFormats?: boolean;
|
|
34
|
+
fontSize?: boolean;
|
|
35
|
+
bold?: boolean;
|
|
36
|
+
italic?: boolean;
|
|
37
|
+
strikethrough?: boolean;
|
|
38
|
+
underline?: boolean;
|
|
39
|
+
textColor?: boolean;
|
|
40
|
+
fillColor?: boolean;
|
|
41
|
+
border?: boolean;
|
|
42
|
+
horizontalAlignMode?: boolean;
|
|
43
|
+
verticalAlignMode?: boolean;
|
|
44
|
+
textWrapMode?: boolean;
|
|
45
|
+
textRotateMode?: boolean;
|
|
46
|
+
mergeCell?: boolean;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=i-doc-ui-plugin-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i-doc-ui-plugin-config.d.ts","sourceRoot":"","sources":["../../../../../src/basics/interfaces/component-config/i-doc-ui-plugin-config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACpB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,aAAa,CAAC,EAAE,gBAAgB,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAChC,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACnC;AAGD,MAAM,WAAW,gBAAgB;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/basics/interfaces/component-config/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/basics/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|