dochub-sdk 0.1.169 → 0.1.171

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.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Класс внутренних ошибок DocHub
3
+ */
4
+ export class DocHubError extends Error {
5
+ constructor(...params) {
6
+ super(...params);
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+ export * from './errors';
@@ -0,0 +1,33 @@
1
+ import { Vue, Component } from 'vue-property-decorator';
2
+ import { DocHub, DocHubLangEvents } from '../..';
3
+
4
+ @Component
5
+ export class DocHubComponentProto extends Vue {
6
+ lang: any = null; // Подключенный языковой пакет
7
+
8
+ /**
9
+ * Монтирует языковой пакет
10
+ */
11
+ remountLangPackage() {
12
+ this.lang = DocHub.lang.getConst(this.getLangPackageID());
13
+ }
14
+
15
+ mounted() {
16
+ // Монтируем языковой пакет
17
+ this.remountLangPackage();
18
+ }
19
+
20
+ destroyed() {
21
+ // Отключаем контроль переключения языка
22
+ DocHub.eventBus.$off(DocHubLangEvents.changeLang, this.remountLangPackage);
23
+ }
24
+
25
+ /**
26
+ * Возвращает идентификатор языкового пакета.
27
+ * По умолчанию "dochub".
28
+ */
29
+ getLangPackageID(): string {
30
+ return 'dochub';
31
+ }
32
+
33
+ }
@@ -1,13 +1,15 @@
1
1
  /* eslint-disable no-unused-vars */
2
- import { Vue, Prop, Watch, Component } from 'vue-property-decorator';
2
+ import { Prop, Watch, Component } from 'vue-property-decorator';
3
+ import { DocHubComponentProto } from './Components';
3
4
  import { DocHub } from '../..';
5
+ import { DocHubError } from '..';
4
6
  import type { IDocHubEditableComponent, IDocHubPresentationProfile, IDocHubPresentationsParams } from '../..';
5
7
 
6
8
  import ajv from 'ajv';
7
9
  import ajv_localize from 'ajv-i18n/localize/ru';
8
10
 
9
11
  @Component
10
- export class DocHubDocumentProto extends Vue implements IDocHubEditableComponent {
12
+ export class DocHubDocumentProto extends DocHubComponentProto implements IDocHubEditableComponent {
11
13
  onRefresher: any = null; // Таймер отложенного выполнения обновления
12
14
  followURI: string | undefined; // URI файла за которым установлено слежение
13
15
  error: string | null = null; // Ошибка
@@ -73,20 +75,16 @@ export class DocHubDocumentProto extends Vue implements IDocHubEditableComponent
73
75
  * Обработка полученных данных документа.
74
76
  * Необходимо переопределить.
75
77
  */
76
- processingData(data: any | undefined) {}
78
+ processingData(data: any | undefined) {
79
+ throw new DocHubError('Not implemented.');
80
+ }
77
81
 
78
82
  /**
79
83
  * Возвращает схему данных для контроля структуры и состава данных.
80
84
  * Необходимо переопределить.
81
85
  */
82
- getSchemaData(): any {}
83
-
84
- /**
85
- * Определяет тип данных
86
- * @param source
87
- */
88
- getSourceType(source: any) {
89
-
86
+ getSchemaData(): any {
87
+ return {};
90
88
  }
91
89
 
92
90
  /**
@@ -1 +1,2 @@
1
- export * from './Documents';
1
+ export * from './Documents';
2
+ export * from './Components';
package/interfaces/ui.ts CHANGED
@@ -134,14 +134,12 @@ export interface IDocHubUI {
134
134
  * @returns - Список UI компонентов
135
135
  */
136
136
  get(slot: DocHubUISlot | string): Promise<IDocHubUISlotItem[]>;
137
-
138
137
  /**
139
138
  * Загружает данные на клиентское устройство
140
139
  * @param content - Данные, сохраняемые в файл
141
140
  * @param options - Параметры сохранения на клиентском устройстве
142
141
  */
143
142
  download(content: string | ArrayBuffer, options?:IDocHubUIDownloadOptions): Promise<void>;
144
-
145
143
  /**
146
144
  * Копирует данные в клипборд клиентского устройства
147
145
  * @param content - Данные, сохраняемые в файл
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dochub-sdk",
3
- "version": "0.1.169",
3
+ "version": "0.1.171",
4
4
  "description": "The DocHub System Development Kit.",
5
5
  "private": false,
6
6
  "main": "index.ts",