dochub-sdk 0.1.207 → 0.1.210
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/classes/vue2/Components.ts +45 -0
- package/classes/vue2/Documents.ts +0 -45
- package/classes/vue2/Editor.ts +15 -0
- package/interfaces/ui.ts +5 -0
- package/package.json +1 -1
@@ -1,9 +1,16 @@
|
|
1
1
|
import { Vue, Component } from 'vue-property-decorator';
|
2
2
|
import { DocHub, DocHubLangEvents } from '../..';
|
3
3
|
|
4
|
+
export interface IDocHubDocumentUIState {
|
5
|
+
styleHeight: string;
|
6
|
+
styleWidth: string;
|
7
|
+
styleFilter: string;
|
8
|
+
}
|
9
|
+
|
4
10
|
@Component
|
5
11
|
export class DocHubComponentProto extends Vue {
|
6
12
|
lang: any = null; // Подключенный языковой пакет
|
13
|
+
savedUIState: IDocHubDocumentUIState | null = null; // Хранит текущее UI состояние для последующего восстановления
|
7
14
|
|
8
15
|
/**
|
9
16
|
* Монтирует языковой пакет
|
@@ -38,4 +45,42 @@ export class DocHubComponentProto extends Vue {
|
|
38
45
|
*/
|
39
46
|
onLangSwitch() {}
|
40
47
|
|
48
|
+
/**
|
49
|
+
* Сохраняет текущие параметры визуализации для исключения дерганий при обновлении контента
|
50
|
+
*/
|
51
|
+
saveUISate() {
|
52
|
+
const element: any = this['$el'];
|
53
|
+
this.savedUIState = {
|
54
|
+
styleHeight: element.style.height,
|
55
|
+
styleWidth: element.style.width,
|
56
|
+
styleFilter: element.style.filter
|
57
|
+
}
|
58
|
+
}
|
59
|
+
/**
|
60
|
+
* Восстанавливает параметры визуализации из ранее сохраненных
|
61
|
+
*/
|
62
|
+
loadUISate() {
|
63
|
+
const element: any = this['$el'];
|
64
|
+
if (element?.style) {
|
65
|
+
element.style.height = this.savedUIState?.styleHeight;
|
66
|
+
element.style.width = this.savedUIState?.styleWidth;
|
67
|
+
element.style.filter = this.savedUIState?.styleFilter;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* "Замораживает" представление на период обновления
|
72
|
+
*/
|
73
|
+
freezeView() {
|
74
|
+
this.saveUISate();
|
75
|
+
const element: any = this['$el'];
|
76
|
+
element.style.height = `${element.clientHeight}px !important`;
|
77
|
+
element.style.width = `${element.clientWidth}px !important`;
|
78
|
+
element.style.filter = 'blur(8px)';
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* "Размораживает" представление после загрузки
|
82
|
+
*/
|
83
|
+
unfreezeView() {
|
84
|
+
this.loadUISate();
|
85
|
+
}
|
41
86
|
}
|
@@ -26,12 +26,6 @@ export enum DocHubDocumentType {
|
|
26
26
|
// В результате работы вызовет метод processingData
|
27
27
|
}
|
28
28
|
|
29
|
-
export interface IDocHubDocumentUIState {
|
30
|
-
styleHeight: string;
|
31
|
-
styleWidth: string;
|
32
|
-
styleFilter: string;
|
33
|
-
}
|
34
|
-
|
35
29
|
@Component
|
36
30
|
export class DocHubDocumentProto extends DocHubComponentProto implements IDocHubEditableComponent {
|
37
31
|
onRefresher: any = null; // Таймер отложенного выполнения обновления
|
@@ -39,7 +33,6 @@ export class DocHubDocumentProto extends DocHubComponentProto implements IDocHub
|
|
39
33
|
baseURI: string | undefined; // URI документа от которого должны разрешаться все относительные ссылки
|
40
34
|
error: string | null = null; // Ошибка
|
41
35
|
isPending = true; // Признак внутренней работы. Например загрузка данных.
|
42
|
-
savedUIState: IDocHubDocumentUIState | null = null; // Хранит текущее UI состояние для последующего восстановления
|
43
36
|
/**
|
44
37
|
* Профиль документа
|
45
38
|
*/
|
@@ -148,44 +141,6 @@ export class DocHubDocumentProto extends DocHubComponentProto implements IDocHub
|
|
148
141
|
onLangSwitch() {
|
149
142
|
this.onRefresh();
|
150
143
|
}
|
151
|
-
/**
|
152
|
-
* Сохраняет текущие параметры визуализации для исключения дерганий при обновлении контента
|
153
|
-
*/
|
154
|
-
saveUISate() {
|
155
|
-
const element: any = this['$el'];
|
156
|
-
this.savedUIState = {
|
157
|
-
styleHeight: element.style.height,
|
158
|
-
styleWidth: element.style.width,
|
159
|
-
styleFilter: element.style.filter
|
160
|
-
}
|
161
|
-
}
|
162
|
-
/**
|
163
|
-
* Восстанавливает параметры визуализации из ранее сохраненных
|
164
|
-
*/
|
165
|
-
loadUISate() {
|
166
|
-
const element: any = this['$el'];
|
167
|
-
if (element?.style) {
|
168
|
-
element.style.height = this.savedUIState?.styleHeight;
|
169
|
-
element.style.width = this.savedUIState?.styleWidth;
|
170
|
-
element.style.filter = this.savedUIState?.styleFilter;
|
171
|
-
}
|
172
|
-
}
|
173
|
-
/**
|
174
|
-
* "Замораживает" представление на период обновления
|
175
|
-
*/
|
176
|
-
freezeView() {
|
177
|
-
this.saveUISate();
|
178
|
-
const element: any = this['$el'];
|
179
|
-
element.style.height = `${element.clientHeight}px !important`;
|
180
|
-
element.style.width = `${element.clientWidth}px !important`;
|
181
|
-
element.style.filter = 'blur(8px)';
|
182
|
-
}
|
183
|
-
/**
|
184
|
-
* "Размораживает" представление после загрузки
|
185
|
-
*/
|
186
|
-
unfreezeView() {
|
187
|
-
this.loadUISate();
|
188
|
-
}
|
189
144
|
/**
|
190
145
|
* Для переопределения
|
191
146
|
*/
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
2
|
+
import { Prop, Watch, Component } from 'vue-property-decorator';
|
3
|
+
import { DocHubComponentProto } from './Components';
|
4
|
+
import { DocHubEditorContext } from '../..';
|
5
|
+
|
6
|
+
@Component
|
7
|
+
export class DocHubEditorProto extends DocHubComponentProto {
|
8
|
+
/**
|
9
|
+
* Контекст редактирования
|
10
|
+
*/
|
11
|
+
@Prop({
|
12
|
+
type: Object,
|
13
|
+
default: null
|
14
|
+
}) readonly context: DocHubEditorContext | null;
|
15
|
+
}
|
package/interfaces/ui.ts
CHANGED
@@ -44,6 +44,11 @@ export interface IDocHubUISlotOptions {
|
|
44
44
|
* Определяет состояние развернутого виджета при первом использовании
|
45
45
|
*/
|
46
46
|
expanded?: boolean;
|
47
|
+
/**
|
48
|
+
* Виджет реализующий минимальный функционал компонента.
|
49
|
+
* Используется для компактного представления в соответствии со стратегией слота.
|
50
|
+
*/
|
51
|
+
widget?: IDocHubUIComponent;
|
47
52
|
}
|
48
53
|
|
49
54
|
export interface IDocHubUISlotItem {
|