@univerjs/docs-ui 0.6.7 → 0.6.8
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 +20 -20
- package/lib/es/index.js +4554 -4169
- package/lib/facade.js +105 -0
- package/lib/index.css +1 -1
- package/lib/index.js +11771 -0
- package/lib/locale/en-US.js +86 -0
- package/lib/locale/fa-IR.js +86 -0
- package/lib/locale/fr-FR.js +86 -0
- package/lib/locale/ru-RU.js +86 -0
- package/lib/locale/vi-VN.js +86 -0
- package/lib/locale/zh-CN.js +86 -0
- package/lib/locale/zh-TW.js +86 -0
- package/lib/types/basics/interfaces/component-config/i-doc-ui-plugin-config.d.ts +1 -0
- package/lib/types/commands/commands/list.command.d.ts +0 -2
- package/lib/types/commands/commands/set-heading.command.d.ts +13 -0
- package/lib/types/controllers/doc-auto-format.controller.d.ts +1 -1
- package/lib/types/controllers/menu/menu.d.ts +1 -0
- package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +1 -0
- package/lib/types/index.d.ts +2 -2
- package/lib/types/services/doc-event-manager.service.d.ts +26 -1
- package/lib/types/views/paragraph-setting/hook/utils.d.ts +1 -1
- package/lib/types/views/side-menu/index.d.ts +16 -0
- package/lib/umd/index.js +21 -21
- package/package.json +11 -11
package/lib/facade.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var v = (n, e, t) => e in n ? h(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var m = (n, e, t) => v(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Inject as _, Injector as g, IUniverInstanceService as I, ICommandService as p, IResourceManagerService as S, UniverInstanceType as a, UndoCommand as l, RedoCommand as D, DOC_RANGE_TYPE as U } from "@univerjs/core";
|
|
5
|
+
import { FUniver as u } from "@univerjs/core/facade";
|
|
6
|
+
import { InsertCommand as f, DocSelectionRenderService as C } from "@univerjs/docs-ui";
|
|
7
|
+
import { IRenderManagerService as y } from "@univerjs/engine-render";
|
|
8
|
+
var M = Object.getOwnPropertyDescriptor, R = (n, e, t, r) => {
|
|
9
|
+
for (var i = r > 1 ? void 0 : r ? M(e, t) : e, s = n.length - 1, d; s >= 0; s--)
|
|
10
|
+
(d = n[s]) && (i = d(i) || i);
|
|
11
|
+
return i;
|
|
12
|
+
}, c = (n, e) => (t, r) => e(t, r, n);
|
|
13
|
+
let o = class {
|
|
14
|
+
constructor(n, e, t, r, i, s) {
|
|
15
|
+
m(this, "id");
|
|
16
|
+
this._documentDataModel = n, this._injector = e, this._univerInstanceService = t, this._commandService = r, this._resourceManagerService = i, this._renderManagerService = s, this.id = this._documentDataModel.getUnitId();
|
|
17
|
+
}
|
|
18
|
+
getId() {
|
|
19
|
+
return this._documentDataModel.getUnitId();
|
|
20
|
+
}
|
|
21
|
+
getName() {
|
|
22
|
+
return this.getSnapshot().title || "";
|
|
23
|
+
}
|
|
24
|
+
getSnapshot() {
|
|
25
|
+
const n = this._resourceManagerService.getResourcesByType(this.id, a.UNIVER_DOC), e = this._documentDataModel.getSnapshot();
|
|
26
|
+
return e.resources = n, e;
|
|
27
|
+
}
|
|
28
|
+
undo() {
|
|
29
|
+
return this._univerInstanceService.focusUnit(this.id), this._commandService.executeCommand(l.id);
|
|
30
|
+
}
|
|
31
|
+
redo() {
|
|
32
|
+
return this._univerInstanceService.focusUnit(this.id), this._commandService.executeCommand(D.id);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Adds the specified text to the end of this text region.
|
|
36
|
+
* @param text - The text to be added to the end of this text region.
|
|
37
|
+
*/
|
|
38
|
+
appendText(n) {
|
|
39
|
+
const e = this.id, { body: t } = this.getSnapshot();
|
|
40
|
+
if (!t)
|
|
41
|
+
throw new Error("The document body is empty");
|
|
42
|
+
const r = t.dataStream.length - 2, i = {
|
|
43
|
+
startOffset: r,
|
|
44
|
+
endOffset: r,
|
|
45
|
+
collapsed: !0,
|
|
46
|
+
segmentId: ""
|
|
47
|
+
}, { segmentId: s } = i;
|
|
48
|
+
return this._commandService.executeCommand(f.id, {
|
|
49
|
+
unitId: e,
|
|
50
|
+
body: {
|
|
51
|
+
dataStream: n
|
|
52
|
+
},
|
|
53
|
+
range: i,
|
|
54
|
+
segmentId: s
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sets the selection to a specified text range in the document.
|
|
59
|
+
* @param startOffset - The starting offset of the selection in the document.
|
|
60
|
+
* @param endOffset - The ending offset of the selection in the document.
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* document.setSelection(10, 20);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
setSelection(n, e) {
|
|
67
|
+
var r;
|
|
68
|
+
const t = (r = this._renderManagerService.getRenderById(this.getId())) == null ? void 0 : r.with(C);
|
|
69
|
+
t == null || t.removeAllRanges(), t == null || t.addDocRanges(
|
|
70
|
+
[
|
|
71
|
+
{
|
|
72
|
+
startOffset: n,
|
|
73
|
+
endOffset: e,
|
|
74
|
+
rangeType: U.TEXT
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
!0
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
o = R([
|
|
82
|
+
c(1, _(g)),
|
|
83
|
+
c(2, I),
|
|
84
|
+
c(3, p),
|
|
85
|
+
c(4, S),
|
|
86
|
+
c(5, y)
|
|
87
|
+
], o);
|
|
88
|
+
class O extends u {
|
|
89
|
+
createUniverDoc(e) {
|
|
90
|
+
const t = this._univerInstanceService.createUnit(a.UNIVER_DOC, e);
|
|
91
|
+
return this._injector.createInstance(o, t);
|
|
92
|
+
}
|
|
93
|
+
getActiveDocument() {
|
|
94
|
+
const e = this._univerInstanceService.getCurrentUnitForType(a.UNIVER_DOC);
|
|
95
|
+
return e ? this._injector.createInstance(o, e) : null;
|
|
96
|
+
}
|
|
97
|
+
getUniverDoc(e) {
|
|
98
|
+
const t = this._univerInstanceService.getUniverDocInstance(e);
|
|
99
|
+
return t ? this._injector.createInstance(o, t) : null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
u.extend(O);
|
|
103
|
+
export {
|
|
104
|
+
o as FDocument
|
|
105
|
+
};
|
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-left-\[5px\]{left:5px}.univer-top-\[5px\]{top:5px}.univer-mb-1{margin-bottom:.25rem}.univer-mt-1\.5{margin-top:.375rem}.univer-mt-3{margin-top:.75rem}.univer-mt-4{margin-top:1rem}.univer-box-border{box-sizing:border-box}.univer-block{display:block}.univer-flex{display:flex}.univer-grid{display:grid}.univer-size-full{width:100%;height:100%}.univer-h-20{height:5rem}.univer-h-8{height:2rem}.univer-w-28{width:7rem}.univer-w-4\/5{width:80%}.univer-w-\[72px\]{width:72px}.univer-w-full{width:100%}.univer-flex-shrink-0{flex-shrink:0}.univer-flex-grow-0{flex-grow:0}.univer-basis-\[260px\]{flex-basis:260px}.univer-cursor-pointer{cursor:pointer}.univer-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.univer-flex-col{flex-direction:column}.univer-flex-nowrap{flex-wrap:nowrap}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-justify-around{justify-content:space-around}.univer-gap-1{gap:.25rem}.univer-gap-1\.5{gap:.375rem}.univer-gap-2{gap:.5rem}.univer-gap-4{gap:1rem}.univer-overflow-hidden{overflow:hidden}.univer-rounded{border-radius:.25rem}.univer-rounded-md{border-radius:.375rem}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-gray-200{--tw-border-opacity: 1;border-color:#e3e5ea;border-color:rgba(227,229,234,var(--tw-border-opacity, 1))}.univer-border-primary-500{--tw-border-opacity: 1;border-color:#466af7;border-color:rgba(70,106,247,var(--tw-border-opacity, 1))}.univer-bg-white{--tw-bg-opacity: 1;background-color:#fff;background-color:rgba(255,255,255,var(--tw-bg-opacity, 1))}.univer-bg-none{background-image:none}.univer-p-1{padding:.25rem}.univer-p-1\.5{padding:.375rem}.univer-px-2{padding-left:.5rem;padding-right:.5rem}.univer-px-3{padding-left:.75rem;padding-right:.75rem}.univer-px-5{padding-left:1.25rem;padding-right:1.25rem}.univer-py-1{padding-top:.25rem;padding-bottom:.25rem}.univer-py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.univer-pb-0\.5{padding-bottom:.125rem}.univer-pl-1\.5{padding-left:.375rem}.univer-pr-2{padding-right:.5rem}.univer-pt-1\.5{padding-top:.375rem}.univer-text-\[13px\]{font-size:13px}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.univer-text-xs{font-size:.75rem;line-height:1rem}.univer-font-medium{font-weight:500}.univer-text-gray-400{--tw-text-opacity: 1;color:#979dac;color:rgba(151,157,172,var(--tw-text-opacity, 1))}.univer-text-gray-500{--tw-text-opacity: 1;color:#5f6574;color:rgba(95,101,116,var(--tw-text-opacity, 1))}.univer-shadow-\[0_1px_6px_-2px_rgba\(30\,40\,77\,0\.08\)\,0_2px_6px_-1px_rgba\(30\,40\,77\,0\.10\)\]{--tw-shadow: 0 1px 6px -2px rgba(30,40,77,.08),0 2px 6px -1px rgba(30,40,77,.1);--tw-shadow-colored: 0 1px 6px -2px var(--tw-shadow-color), 0 2px 6px -1px var(--tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 6px -2px #1e284d14,0 2px 6px -1px #1e284d1a;box-shadow:var(--tw-ring-offset-shadow, 0 0 rgba(0,0,0,0)),var(--tw-ring-shadow, 0 0 rgba(0,0,0,0)),var(--tw-shadow)}.univer-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:univer-border-primary-500:hover{--tw-border-opacity: 1;border-color:#466af7;border-color:rgba(70,106,247,var(--tw-border-opacity, 1))}.hover\:univer-bg-black\/60:hover{background-color:#0009}
|
|
1
|
+
.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-bottom-0{bottom:0}.univer-left-0{left:0}.univer-left-\[5px\]{left:5px}.univer-top-0{top:0}.univer-top-\[5px\]{top:5px}.univer-z-\[100\]{z-index:100}.univer-mb-1{margin-bottom:.25rem}.univer-mt-1\.5{margin-top:.375rem}.univer-mt-12{margin-top:3rem}.univer-mt-3{margin-top:.75rem}.univer-mt-4{margin-top:1rem}.univer-box-border{box-sizing:border-box}.univer-block{display:block}.univer-flex{display:flex}.univer-grid{display:grid}.univer-size-full{width:100%;height:100%}.univer-h-20{height:5rem}.univer-h-8{height:2rem}.univer-w-28{width:7rem}.univer-w-4\/5{width:80%}.univer-w-\[0px\]{width:0px}.univer-w-\[72px\]{width:72px}.univer-w-full{width:100%}.univer-flex-shrink-0{flex-shrink:0}.univer-flex-grow-0{flex-grow:0}.univer-basis-\[260px\]{flex-basis:260px}.univer-cursor-pointer{cursor:pointer}.univer-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.univer-flex-col{flex-direction:column}.univer-flex-nowrap{flex-wrap:nowrap}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-justify-around{justify-content:space-around}.univer-gap-1{gap:.25rem}.univer-gap-1\.5{gap:.375rem}.univer-gap-2{gap:.5rem}.univer-gap-4{gap:1rem}.univer-overflow-hidden{overflow:hidden}.univer-rounded{border-radius:.25rem}.univer-rounded-md{border-radius:.375rem}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-gray-200{--tw-border-opacity: 1;border-color:#e3e5ea;border-color:rgba(227,229,234,var(--tw-border-opacity, 1))}.univer-border-primary-500{--tw-border-opacity: 1;border-color:#466af7;border-color:rgba(70,106,247,var(--tw-border-opacity, 1))}.univer-bg-white{--tw-bg-opacity: 1;background-color:#fff;background-color:rgba(255,255,255,var(--tw-bg-opacity, 1))}.univer-bg-none{background-image:none}.univer-p-1{padding:.25rem}.univer-p-1\.5{padding:.375rem}.univer-px-2{padding-left:.5rem;padding-right:.5rem}.univer-px-3{padding-left:.75rem;padding-right:.75rem}.univer-px-5{padding-left:1.25rem;padding-right:1.25rem}.univer-py-1{padding-top:.25rem;padding-bottom:.25rem}.univer-py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.univer-pb-0\.5{padding-bottom:.125rem}.univer-pl-1\.5{padding-left:.375rem}.univer-pr-2{padding-right:.5rem}.univer-pt-1\.5{padding-top:.375rem}.univer-text-\[13px\]{font-size:13px}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.univer-text-xs{font-size:.75rem;line-height:1rem}.univer-font-medium{font-weight:500}.univer-text-gray-400{--tw-text-opacity: 1;color:#979dac;color:rgba(151,157,172,var(--tw-text-opacity, 1))}.univer-text-gray-500{--tw-text-opacity: 1;color:#5f6574;color:rgba(95,101,116,var(--tw-text-opacity, 1))}.univer-shadow-\[0_1px_6px_-2px_rgba\(30\,40\,77\,0\.08\)\,0_2px_6px_-1px_rgba\(30\,40\,77\,0\.10\)\]{--tw-shadow: 0 1px 6px -2px rgba(30,40,77,.08),0 2px 6px -1px rgba(30,40,77,.1);--tw-shadow-colored: 0 1px 6px -2px var(--tw-shadow-color), 0 2px 6px -1px var(--tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 6px -2px #1e284d14,0 2px 6px -1px #1e284d1a;box-shadow:var(--tw-ring-offset-shadow, 0 0 rgba(0,0,0,0)),var(--tw-ring-shadow, 0 0 rgba(0,0,0,0)),var(--tw-shadow)}.univer-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:univer-border-primary-500:hover{--tw-border-opacity: 1;border-color:#466af7;border-color:rgba(70,106,247,var(--tw-border-opacity, 1))}.hover\:univer-bg-black\/60:hover{background-color:#0009}
|