@matreshka/bff 0.19.0 → 0.21.0
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/dist/components/board.d.ts +4 -4
- package/dist/components/board.js +4 -40
- package/dist/components/camera.d.ts +1 -1
- package/dist/components/camera.js +2 -15
- package/dist/components/component.d.ts +9 -4
- package/dist/components/component.js +16 -0
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/dialog.js +1 -10
- package/dist/components/for-each.d.ts +3 -3
- package/dist/components/for-each.js +18 -26
- package/dist/components/inputs/text-editor.d.ts +14 -14
- package/dist/components/inputs/text-editor.js +14 -154
- package/dist/components/item-list/item-list.js +11 -11
- package/dist/components/item-list/list-from-ref-context.d.ts +4 -1
- package/dist/components/item-list/list-from-ref-context.js +6 -4
- package/dist/components/item-list/types.d.ts +5 -5
- package/dist/components/item-list/types.js +1 -1
- package/dist/components/map.d.ts +4 -4
- package/dist/components/map.js +4 -40
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.js +1 -10
- package/dist/components/stack.d.ts +1 -1
- package/dist/components/stack.js +2 -17
- package/dist/components/utils/targeted-client-component-action.d.ts +5 -0
- package/dist/components/utils/targeted-client-component-action.js +25 -0
- package/dist/core/context/context-ref.d.ts +5 -4
- package/dist/core/context/context-ref.js +9 -8
- package/dist/core/context/context.d.ts +42 -10
- package/dist/core/context/context.js +76 -13
- package/dist/core/types/context-value-ref.d.ts +3 -3
- package/dist/core/utils/replace-context-keys.js +1 -2
- package/dist/core/utils/targeted-client-action.d.ts +19 -0
- package/dist/core/utils/targeted-client-action.js +68 -0
- package/dist/platforms/utils/targeted-client-platform-action.js +9 -64
- package/dist/platforms/utils/targeted-client-platform-stream.js +2 -2
- package/package.json +2 -2
|
@@ -36,10 +36,10 @@ type DefaultInitConfigType = BoardInitConfig<Board>;
|
|
|
36
36
|
export declare class Board<InitConfigType extends BoardInitConfig<any> = DefaultInitConfigType, PropertiesType extends BoardProperties = BoardProperties> extends Component<InitConfigType, PropertiesType> implements StandaloneComponent, ItemListHost {
|
|
37
37
|
private readonly itemsSlot;
|
|
38
38
|
private readonly itemListHostAdapter;
|
|
39
|
-
setCenter(center: BoardPoint, instances?: ComponentInstance[]): void
|
|
40
|
-
setZoom(zoom: number, instances?: ComponentInstance[]): void
|
|
41
|
-
zoomIn(instances?: ComponentInstance[]): void
|
|
42
|
-
zoomOut(instances?: ComponentInstance[]): void
|
|
39
|
+
setCenter(center: BoardPoint, instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
40
|
+
setZoom(zoom: number, instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
41
|
+
zoomIn(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
42
|
+
zoomOut(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
43
43
|
constructor(config: InitConfigType);
|
|
44
44
|
get hostInstances(): readonly ComponentInstance[];
|
|
45
45
|
syncNestedItems(slot: string, items: NestedItemBase[]): void;
|
package/dist/components/board.js
CHANGED
|
@@ -18,52 +18,16 @@ const board = (config) => new Board(config);
|
|
|
18
18
|
exports.board = board;
|
|
19
19
|
class Board extends component_1.Component {
|
|
20
20
|
setCenter(center, instances) {
|
|
21
|
-
|
|
22
|
-
instances
|
|
23
|
-
.filter((instance) => instance.client)
|
|
24
|
-
.forEach((instance) => {
|
|
25
|
-
instance.client.outcomingMessage$.next(new board_set_center_message_1.BoardSetCenterMessage(instance.id, center));
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
this.broadcast(new board_set_center_message_1.BoardSetCenterMessage(this.id, center));
|
|
30
|
-
}
|
|
21
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new board_set_center_message_1.BoardSetCenterMessage(target, { ...center, actionScope }));
|
|
31
22
|
}
|
|
32
23
|
setZoom(zoom, instances) {
|
|
33
|
-
|
|
34
|
-
instances
|
|
35
|
-
.filter((instance) => instance.client)
|
|
36
|
-
.forEach((instance) => {
|
|
37
|
-
instance.client.outcomingMessage$.next(new board_set_zoom_message_1.BoardSetZoomMessage(instance.id, zoom));
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
this.broadcast(new board_set_zoom_message_1.BoardSetZoomMessage(this.id, zoom));
|
|
42
|
-
}
|
|
24
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new board_set_zoom_message_1.BoardSetZoomMessage(target, { zoom, actionScope }));
|
|
43
25
|
}
|
|
44
26
|
zoomIn(instances) {
|
|
45
|
-
|
|
46
|
-
instances
|
|
47
|
-
.filter((instance) => instance.client)
|
|
48
|
-
.forEach((instance) => {
|
|
49
|
-
instance.client.outcomingMessage$.next(new board_zoom_in_message_1.BoardZoomInMessage(instance.id));
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
this.broadcast(new board_zoom_in_message_1.BoardZoomInMessage(this.id));
|
|
54
|
-
}
|
|
27
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new board_zoom_in_message_1.BoardZoomInMessage(target, actionScope));
|
|
55
28
|
}
|
|
56
29
|
zoomOut(instances) {
|
|
57
|
-
|
|
58
|
-
instances
|
|
59
|
-
.filter((instance) => instance.client)
|
|
60
|
-
.forEach((instance) => {
|
|
61
|
-
instance.client.outcomingMessage$.next(new board_zoom_out_message_1.BoardZoomOutMessage(instance.id));
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
this.broadcast(new board_zoom_out_message_1.BoardZoomOutMessage(this.id));
|
|
66
|
-
}
|
|
30
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new board_zoom_out_message_1.BoardZoomOutMessage(target, actionScope));
|
|
67
31
|
}
|
|
68
32
|
constructor(config) {
|
|
69
33
|
const itemsSlot = (0, item_list_1.createNestedItemsSlotState)(config.items);
|
|
@@ -68,7 +68,7 @@ export declare class Camera<ContentType extends ComponentTreeNode = ComponentTre
|
|
|
68
68
|
/**
|
|
69
69
|
* Отправляет на клиент команду переключения активной камеры устройства на указанную.
|
|
70
70
|
*/
|
|
71
|
-
switchCamera(device: VideoInputDevice, instances?: ComponentInstance[]):
|
|
71
|
+
switchCamera(device: VideoInputDevice, instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
72
72
|
protected serializeRuleOverrides(overrides: Partial<PropertiesType>): Record<string, unknown>;
|
|
73
73
|
serialize(): CameraConfig;
|
|
74
74
|
}
|
|
@@ -72,21 +72,8 @@ class Camera extends component_1.Component {
|
|
|
72
72
|
* Отправляет на клиент команду переключения активной камеры устройства на указанную.
|
|
73
73
|
*/
|
|
74
74
|
switchCamera(device, instances) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
.filter((instance) => instance.client)
|
|
78
|
-
.forEach((instance) => {
|
|
79
|
-
instance.client.outcomingMessage$.next(new camera_switch_message_1.CameraSwitchMessage(instance.id, {
|
|
80
|
-
deviceId: device.deviceId,
|
|
81
|
-
}));
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
this.broadcast(new camera_switch_message_1.CameraSwitchMessage(this.id, {
|
|
86
|
-
deviceId: device.deviceId,
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
89
|
-
return this;
|
|
75
|
+
const payload = { deviceId: device.deviceId };
|
|
76
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new camera_switch_message_1.CameraSwitchMessage(target, { ...payload, actionScope }));
|
|
90
77
|
}
|
|
91
78
|
serializeRuleOverrides(overrides) {
|
|
92
79
|
const out = super.serializeRuleOverrides(overrides);
|
|
@@ -8,7 +8,7 @@ import type { Overlay as ClientOverlayShape } from "@matreshka/shared/types/cont
|
|
|
8
8
|
import type { FontStackToken } from "@matreshka/shared/types/fonts";
|
|
9
9
|
import type { GridItem } from "@matreshka/shared/types/grid-item";
|
|
10
10
|
import type { ServerComponentConfig } from "@matreshka/shared/types/server-component-config";
|
|
11
|
-
import { Subscription } from "rxjs";
|
|
11
|
+
import { Observable, Subscription } from "rxjs";
|
|
12
12
|
import { Client, Componentable, ComponentInstance, LocalAction } from "../core";
|
|
13
13
|
import { Condition } from "../core/conditions";
|
|
14
14
|
import { ServerAction, ServerActionHandler } from "./actions/server-action";
|
|
@@ -119,13 +119,13 @@ export declare abstract class Component<InitConfigType extends ComponentInitConf
|
|
|
119
119
|
private destroyHandlers;
|
|
120
120
|
private _destroyInstance$;
|
|
121
121
|
/** Сигнал о том, что инстанс компонента прекращено */
|
|
122
|
-
readonly destroyInstance$:
|
|
122
|
+
readonly destroyInstance$: Observable<ComponentInstance<Componentable>>;
|
|
123
123
|
private _startUsing$;
|
|
124
124
|
/** Сигнал о том, что инстанс компонента началось (появилось первое инстанс) */
|
|
125
|
-
readonly startUsing$:
|
|
125
|
+
readonly startUsing$: Observable<void>;
|
|
126
126
|
private _stopUsing$;
|
|
127
127
|
/** Сигнал о том, что инстанс компонента прекращено (завершилось последнее инстанс) */
|
|
128
|
-
readonly stopUsing$:
|
|
128
|
+
readonly stopUsing$: Observable<void>;
|
|
129
129
|
constructor(config: InitConfigType);
|
|
130
130
|
/** Инициализация свойств, происходит при первом обращении к свойствам */
|
|
131
131
|
protected initProperties(initValues: InitConfigType): PropertiesType;
|
|
@@ -136,6 +136,11 @@ export declare abstract class Component<InitConfigType extends ComponentInitConf
|
|
|
136
136
|
protected bindActions(event: string, actions: ServerComponentAction<Componentable> | ServerComponentAction<Componentable>[]): void;
|
|
137
137
|
/** Массовая установка внутренних server-only cleanup-обработчиков release stage. */
|
|
138
138
|
protected bindDestroyActions(actions: ServerDestroyAction<Componentable> | ServerDestroyAction<Componentable>[]): void;
|
|
139
|
+
/**
|
|
140
|
+
* Hot Observable: команда pingable component command с ack клиента.
|
|
141
|
+
* По одному сообщению на каждый instance с подключённым клиентом.
|
|
142
|
+
*/
|
|
143
|
+
protected dispatchComponentCommand(instances: ComponentInstance[] | undefined, createMessage: (instanceTarget: string, actionScope: string) => ComponentCommandMessage): Observable<void>;
|
|
139
144
|
/** Рассылка сообщения всем подписанным клиентам данного компонента */
|
|
140
145
|
protected broadcast(message: ComponentCommandMessage): void;
|
|
141
146
|
/** Обработка взаимодействия */
|
|
@@ -43,6 +43,7 @@ const incoming_message_observer_1 = require("../core/utils/incoming-message-obse
|
|
|
43
43
|
const serialize_component_tree_1 = require("../core/utils/serialize-component-tree");
|
|
44
44
|
const track_created_instances_1 = require("../core/utils/track-created-instances");
|
|
45
45
|
const server_action_1 = require("./actions/server-action");
|
|
46
|
+
const targeted_client_component_action_1 = require("./utils/targeted-client-component-action");
|
|
46
47
|
/**
|
|
47
48
|
* @typeParam InitConfigType - Тип конфигурации, используемой в конструкторе компонента
|
|
48
49
|
* @typeParam PropertiesType - Тип свойств компонента
|
|
@@ -125,6 +126,21 @@ class Component {
|
|
|
125
126
|
this.destroyHandlers.push(this.parseDestroyAction(action));
|
|
126
127
|
});
|
|
127
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Hot Observable: команда pingable component command с ack клиента.
|
|
131
|
+
* По одному сообщению на каждый instance с подключённым клиентом.
|
|
132
|
+
*/
|
|
133
|
+
dispatchComponentCommand(instances, createMessage) {
|
|
134
|
+
const targets = (instances ?? this.instances).filter((instance) => instance.client);
|
|
135
|
+
if (targets.length === 0) {
|
|
136
|
+
return (0, rxjs_1.of)(undefined);
|
|
137
|
+
}
|
|
138
|
+
const actions = targets.map((instance) => (0, targeted_client_component_action_1.targetedClientComponentAction)(instance.client, (actionScope) => createMessage(instance.id, actionScope)));
|
|
139
|
+
if (actions.length === 1) {
|
|
140
|
+
return actions[0];
|
|
141
|
+
}
|
|
142
|
+
return (0, rxjs_1.forkJoin)(actions).pipe((0, rxjs_1.map)(() => undefined));
|
|
143
|
+
}
|
|
128
144
|
/** Рассылка сообщения всем подписанным клиентам данного компонента */
|
|
129
145
|
broadcast(message) {
|
|
130
146
|
new Set(this.instances
|
|
@@ -72,7 +72,7 @@ export declare class Dialog<InitConfigType extends DialogInitConfig<any> = Defau
|
|
|
72
72
|
/**
|
|
73
73
|
* Закрывает диалог, инициируя событие взаимодействия "close".
|
|
74
74
|
*/
|
|
75
|
-
close(instances?: ComponentInstance[]): void
|
|
75
|
+
close(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
76
76
|
protected serializeRuleOverrides(overrides: Partial<PropertiesType>): Record<string, unknown>;
|
|
77
77
|
protected serializeEntry(instance: ComponentInstance<this>): DialogConfig;
|
|
78
78
|
serialize(instance?: ComponentInstance<this>): DialogConfig;
|
|
@@ -78,16 +78,7 @@ class Dialog extends entry_component_1.EntryComponent {
|
|
|
78
78
|
* Закрывает диалог, инициируя событие взаимодействия "close".
|
|
79
79
|
*/
|
|
80
80
|
close(instances) {
|
|
81
|
-
|
|
82
|
-
instances
|
|
83
|
-
.filter((instance) => instance.client)
|
|
84
|
-
.forEach((instance) => {
|
|
85
|
-
instance.client.outcomingMessage$.next(new dialog_close_message_1.DialogCloseMessage(instance.id));
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
this.broadcast(new dialog_close_message_1.DialogCloseMessage(this.id));
|
|
90
|
-
}
|
|
81
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new dialog_close_message_1.DialogCloseMessage(target, actionScope));
|
|
91
82
|
}
|
|
92
83
|
serializeRuleOverrides(overrides) {
|
|
93
84
|
const out = super.serializeRuleOverrides(overrides);
|
|
@@ -9,12 +9,12 @@ export type CompatibleForEachRef<RefType extends ContextRef<any, any>> = [
|
|
|
9
9
|
ForEachItemArray<RefType>
|
|
10
10
|
] extends [never] ? never : RefType;
|
|
11
11
|
type ForEachItemData<RefType extends ContextRef<any, any>> = ForEachItemArray<RefType>[number];
|
|
12
|
-
type ForEachTypedItemRef<ContextType extends JsonObject, PathType extends string, ValueType> = Omit<ContextRef<any, any>, "context" | "path" | "ref" | "
|
|
12
|
+
type ForEachTypedItemRef<ContextType extends JsonObject, PathType extends string, ValueType> = Omit<ContextRef<any, any>, "context" | "path" | "ref" | "get"> & {
|
|
13
13
|
readonly context: Context<ContextType>;
|
|
14
14
|
readonly path: PathType;
|
|
15
15
|
readonly __valueType?: ValueType;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
get(): ValueType;
|
|
17
|
+
get(): JsonObject;
|
|
18
18
|
ref<K extends Paths<ValueType>>(path: K): ForEachTypedItemRef<ContextType, `${PathType}.${K & string}`, PathValue<ValueType, K>>;
|
|
19
19
|
ref<P2 extends string>(path: ContextRef<ContextType, P2>): ContextRef<ContextType, `${PathType}.${P2}`>;
|
|
20
20
|
};
|
|
@@ -11,14 +11,14 @@ const track_created_instances_1 = require("../core/utils/track-created-instances
|
|
|
11
11
|
const component_1 = require("./component");
|
|
12
12
|
/** Возвращает массив элементов списка из ref; не-массив даёт пустой массив. */
|
|
13
13
|
function getForEachValue(ref) {
|
|
14
|
-
const rawValue = ref.
|
|
14
|
+
const rawValue = ref.get();
|
|
15
15
|
return Array.isArray(rawValue)
|
|
16
16
|
? rawValue
|
|
17
17
|
: [];
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Связывает ref элемента списка с ref индекса в {@link ForEachContext},
|
|
21
|
-
* чтобы генератор мог читать `ref.
|
|
21
|
+
* чтобы генератор мог читать `ref.get()` и вложенные поля элемента.
|
|
22
22
|
*/
|
|
23
23
|
function createForEachItemLink(ref, indexRef) {
|
|
24
24
|
return ref.strictRef(indexRef);
|
|
@@ -27,22 +27,16 @@ const forEach = (config) => new ForEach(config);
|
|
|
27
27
|
exports.forEach = forEach;
|
|
28
28
|
class ForEachContext extends core_1.Context {
|
|
29
29
|
/**
|
|
30
|
-
* Синхронно поднимает
|
|
30
|
+
* Синхронно поднимает хранилище до async {@link init} (preload-сериализация индексов).
|
|
31
31
|
* @returns Тот же экземпляр контекста.
|
|
32
32
|
*/
|
|
33
33
|
initSync() {
|
|
34
|
-
|
|
35
|
-
if (this.inited())
|
|
34
|
+
if (this.inited()) {
|
|
36
35
|
return this;
|
|
36
|
+
}
|
|
37
37
|
this.data$ = new rxjs_1.BehaviorSubject({});
|
|
38
38
|
this.subscribeToDataChanges();
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* После in-place обновления карты индексов в `data$` — одна синхронизация с клиентом.
|
|
42
|
-
* @see Context.emitAfterInPlaceMutation
|
|
43
|
-
*/
|
|
44
|
-
syncIndexStoreFromMutations() {
|
|
45
|
-
super.emitAfterInPlaceMutation();
|
|
39
|
+
return this;
|
|
46
40
|
}
|
|
47
41
|
/**
|
|
48
42
|
* Контекст индексов элементов ForEach; данные не загружаются снаружи (`schema` пустой).
|
|
@@ -173,15 +167,14 @@ class ForEach extends component_1.Component {
|
|
|
173
167
|
const value = getForEachValue(this.config.ref);
|
|
174
168
|
const itemsCheckSum = value.map(this.config.track).join("|");
|
|
175
169
|
this.lastItemsCheckSum = itemsCheckSum;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
delete store[key];
|
|
170
|
+
const items = Array.isArray(value) ? value : [];
|
|
171
|
+
const store = {};
|
|
172
|
+
for (let index = 0; index < items.length; index++) {
|
|
173
|
+
store[this.itemId(items[index])] = { index: `${index}` };
|
|
181
174
|
}
|
|
182
|
-
|
|
175
|
+
this.componentContext.replace(store);
|
|
176
|
+
return items.map((item) => {
|
|
183
177
|
const itemId = this.itemId(item);
|
|
184
|
-
store[itemId] = { index: `${index}` };
|
|
185
178
|
if (cache.has(itemId)) {
|
|
186
179
|
return cache.get(itemId);
|
|
187
180
|
}
|
|
@@ -192,8 +185,6 @@ class ForEach extends component_1.Component {
|
|
|
192
185
|
cache.set(itemId, result);
|
|
193
186
|
return result;
|
|
194
187
|
});
|
|
195
|
-
this.componentContext.syncIndexStoreFromMutations();
|
|
196
|
-
return components;
|
|
197
188
|
}
|
|
198
189
|
/**
|
|
199
190
|
* Синхронизирует элементы списка с клиентом для одного instance ForEach.
|
|
@@ -249,10 +240,11 @@ class ForEach extends component_1.Component {
|
|
|
249
240
|
if (this.instanceCount === 1) {
|
|
250
241
|
const contextSubscription = new rxjs_1.Subscription();
|
|
251
242
|
this.contextSubscription = contextSubscription;
|
|
252
|
-
contextSubscription.add(this.config.ref.context
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
243
|
+
contextSubscription.add(this.config.ref.context
|
|
244
|
+
.watch()
|
|
245
|
+
.pipe((0, rxjs_1.skip)(1))
|
|
246
|
+
.subscribe(() => {
|
|
247
|
+
void this.syncComponents(true);
|
|
256
248
|
}));
|
|
257
249
|
}
|
|
258
250
|
});
|
|
@@ -289,7 +281,7 @@ class ForEach extends component_1.Component {
|
|
|
289
281
|
this.stopUsing$.subscribe(() => {
|
|
290
282
|
this.instanceStates.clear();
|
|
291
283
|
});
|
|
292
|
-
// Инициализируем контекст сразу, чтобы при ранней сериализации
|
|
284
|
+
// Инициализируем контекст сразу, чтобы при ранней сериализации хранилище уже существовало.
|
|
293
285
|
void this.componentContext.initSync();
|
|
294
286
|
}
|
|
295
287
|
/**
|
|
@@ -32,60 +32,60 @@ export declare class TextEditor<RefType extends StringInputContextRef = StringIn
|
|
|
32
32
|
*
|
|
33
33
|
* @param value Строка HTML.
|
|
34
34
|
*/
|
|
35
|
-
insertHTML(value: string, instances?: ComponentInstance[]):
|
|
35
|
+
insertHTML(value: string, instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
36
36
|
/**
|
|
37
37
|
* Переключает курсивное начертание текста.
|
|
38
38
|
*/
|
|
39
|
-
toggleItalic(instances?: ComponentInstance[]):
|
|
39
|
+
toggleItalic(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
40
40
|
/**
|
|
41
41
|
* Переключает полужирное начертание текста.
|
|
42
42
|
*/
|
|
43
|
-
toggleBold(instances?: ComponentInstance[]):
|
|
43
|
+
toggleBold(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
44
44
|
/**
|
|
45
45
|
* Переключает подчеркивание текста.
|
|
46
46
|
*/
|
|
47
|
-
toggleUnderline(instances?: ComponentInstance[]):
|
|
47
|
+
toggleUnderline(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
48
48
|
/**
|
|
49
49
|
* Выполняет операцию отмены последнего действия.
|
|
50
50
|
*/
|
|
51
|
-
undo(instances?: ComponentInstance[]):
|
|
51
|
+
undo(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
52
52
|
/**
|
|
53
53
|
* Выполняет операцию повтора последнего отмененного действия.
|
|
54
54
|
*/
|
|
55
|
-
redo(instances?: ComponentInstance[]):
|
|
55
|
+
redo(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
56
56
|
/**
|
|
57
57
|
* Применяет формат верхнего индекса к выделенному тексту.
|
|
58
58
|
*/
|
|
59
|
-
superscript(instances?: ComponentInstance[]):
|
|
59
|
+
superscript(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
60
60
|
/**
|
|
61
61
|
* Вставляет нумерованный список.
|
|
62
62
|
*/
|
|
63
|
-
insertOrderedList(instances?: ComponentInstance[]):
|
|
63
|
+
insertOrderedList(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
64
64
|
/**
|
|
65
65
|
* Вставляет маркированный список.
|
|
66
66
|
*/
|
|
67
|
-
insertUnorderedList(instances?: ComponentInstance[]):
|
|
67
|
+
insertUnorderedList(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
68
68
|
/**
|
|
69
69
|
* Выравнивает текст по левому краю.
|
|
70
70
|
*/
|
|
71
|
-
justifyLeft(instances?: ComponentInstance[]):
|
|
71
|
+
justifyLeft(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
72
72
|
/**
|
|
73
73
|
* Выравнивает текст по центру.
|
|
74
74
|
*/
|
|
75
|
-
justifyCenter(instances?: ComponentInstance[]):
|
|
75
|
+
justifyCenter(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
76
76
|
/**
|
|
77
77
|
* Выравнивает текст по правому краю.
|
|
78
78
|
*/
|
|
79
|
-
justifyRight(instances?: ComponentInstance[]):
|
|
79
|
+
justifyRight(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
80
80
|
/**
|
|
81
81
|
* Выравнивает текст по ширине.
|
|
82
82
|
*/
|
|
83
|
-
justifyFull(instances?: ComponentInstance[]):
|
|
83
|
+
justifyFull(instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
84
84
|
/**
|
|
85
85
|
* Форматирует блок с указанным тегом.
|
|
86
86
|
*
|
|
87
87
|
* @param tag Тег HTML для форматирования блока.
|
|
88
88
|
*/
|
|
89
|
-
formatBlock(tag: string, instances?: ComponentInstance[]):
|
|
89
|
+
formatBlock(tag: string, instances?: ComponentInstance[]): import("rxjs").Observable<void>;
|
|
90
90
|
}
|
|
91
91
|
export {};
|
|
@@ -55,209 +55,79 @@ class TextEditor extends input_component_1.InputComponent {
|
|
|
55
55
|
*/
|
|
56
56
|
insertHTML(value, instances) {
|
|
57
57
|
const payload = { value };
|
|
58
|
-
|
|
59
|
-
instances
|
|
60
|
-
.filter((instance) => instance.client)
|
|
61
|
-
.forEach((instance) => {
|
|
62
|
-
instance.client.outcomingMessage$.next(new text_editor_insert_html_message_1.TextEditorInsertHtmlMessage(instance.id, payload));
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
this.broadcast(new text_editor_insert_html_message_1.TextEditorInsertHtmlMessage(this.id, payload));
|
|
67
|
-
}
|
|
68
|
-
return this;
|
|
58
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_insert_html_message_1.TextEditorInsertHtmlMessage(target, { ...payload, actionScope }));
|
|
69
59
|
}
|
|
70
60
|
/**
|
|
71
61
|
* Переключает курсивное начертание текста.
|
|
72
62
|
*/
|
|
73
63
|
toggleItalic(instances) {
|
|
74
|
-
|
|
75
|
-
instances
|
|
76
|
-
.filter((instance) => instance.client)
|
|
77
|
-
.forEach((instance) => {
|
|
78
|
-
instance.client.outcomingMessage$.next(new text_editor_toggle_italic_message_1.TextEditorToggleItalicMessage(instance.id));
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
this.broadcast(new text_editor_toggle_italic_message_1.TextEditorToggleItalicMessage(this.id));
|
|
83
|
-
}
|
|
84
|
-
return this;
|
|
64
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_toggle_italic_message_1.TextEditorToggleItalicMessage(target, actionScope));
|
|
85
65
|
}
|
|
86
66
|
/**
|
|
87
67
|
* Переключает полужирное начертание текста.
|
|
88
68
|
*/
|
|
89
69
|
toggleBold(instances) {
|
|
90
|
-
|
|
91
|
-
instances
|
|
92
|
-
.filter((instance) => instance.client)
|
|
93
|
-
.forEach((instance) => {
|
|
94
|
-
instance.client.outcomingMessage$.next(new text_editor_toggle_bold_message_1.TextEditorToggleBoldMessage(instance.id));
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
this.broadcast(new text_editor_toggle_bold_message_1.TextEditorToggleBoldMessage(this.id));
|
|
99
|
-
}
|
|
100
|
-
return this;
|
|
70
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_toggle_bold_message_1.TextEditorToggleBoldMessage(target, actionScope));
|
|
101
71
|
}
|
|
102
72
|
/**
|
|
103
73
|
* Переключает подчеркивание текста.
|
|
104
74
|
*/
|
|
105
75
|
toggleUnderline(instances) {
|
|
106
|
-
|
|
107
|
-
instances
|
|
108
|
-
.filter((instance) => instance.client)
|
|
109
|
-
.forEach((instance) => {
|
|
110
|
-
instance.client.outcomingMessage$.next(new text_editor_toggle_underline_message_1.TextEditorToggleUnderlineMessage(instance.id));
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
this.broadcast(new text_editor_toggle_underline_message_1.TextEditorToggleUnderlineMessage(this.id));
|
|
115
|
-
}
|
|
116
|
-
return this;
|
|
76
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_toggle_underline_message_1.TextEditorToggleUnderlineMessage(target, actionScope));
|
|
117
77
|
}
|
|
118
78
|
/**
|
|
119
79
|
* Выполняет операцию отмены последнего действия.
|
|
120
80
|
*/
|
|
121
81
|
undo(instances) {
|
|
122
|
-
|
|
123
|
-
instances
|
|
124
|
-
.filter((instance) => instance.client)
|
|
125
|
-
.forEach((instance) => {
|
|
126
|
-
instance.client.outcomingMessage$.next(new text_editor_undo_message_1.TextEditorUndoMessage(instance.id));
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
this.broadcast(new text_editor_undo_message_1.TextEditorUndoMessage(this.id));
|
|
131
|
-
}
|
|
132
|
-
return this;
|
|
82
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_undo_message_1.TextEditorUndoMessage(target, actionScope));
|
|
133
83
|
}
|
|
134
84
|
/**
|
|
135
85
|
* Выполняет операцию повтора последнего отмененного действия.
|
|
136
86
|
*/
|
|
137
87
|
redo(instances) {
|
|
138
|
-
|
|
139
|
-
instances
|
|
140
|
-
.filter((instance) => instance.client)
|
|
141
|
-
.forEach((instance) => {
|
|
142
|
-
instance.client.outcomingMessage$.next(new text_editor_redo_message_1.TextEditorRedoMessage(instance.id));
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
this.broadcast(new text_editor_redo_message_1.TextEditorRedoMessage(this.id));
|
|
147
|
-
}
|
|
148
|
-
return this;
|
|
88
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_redo_message_1.TextEditorRedoMessage(target, actionScope));
|
|
149
89
|
}
|
|
150
90
|
/**
|
|
151
91
|
* Применяет формат верхнего индекса к выделенному тексту.
|
|
152
92
|
*/
|
|
153
93
|
superscript(instances) {
|
|
154
|
-
|
|
155
|
-
instances
|
|
156
|
-
.filter((instance) => instance.client)
|
|
157
|
-
.forEach((instance) => {
|
|
158
|
-
instance.client.outcomingMessage$.next(new text_editor_superscript_message_1.TextEditorSuperscriptMessage(instance.id));
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
this.broadcast(new text_editor_superscript_message_1.TextEditorSuperscriptMessage(this.id));
|
|
163
|
-
}
|
|
164
|
-
return this;
|
|
94
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_superscript_message_1.TextEditorSuperscriptMessage(target, actionScope));
|
|
165
95
|
}
|
|
166
96
|
/**
|
|
167
97
|
* Вставляет нумерованный список.
|
|
168
98
|
*/
|
|
169
99
|
insertOrderedList(instances) {
|
|
170
|
-
|
|
171
|
-
instances
|
|
172
|
-
.filter((instance) => instance.client)
|
|
173
|
-
.forEach((instance) => {
|
|
174
|
-
instance.client.outcomingMessage$.next(new text_editor_insert_ordered_list_message_1.TextEditorInsertOrderedListMessage(instance.id));
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
this.broadcast(new text_editor_insert_ordered_list_message_1.TextEditorInsertOrderedListMessage(this.id));
|
|
179
|
-
}
|
|
180
|
-
return this;
|
|
100
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_insert_ordered_list_message_1.TextEditorInsertOrderedListMessage(target, actionScope));
|
|
181
101
|
}
|
|
182
102
|
/**
|
|
183
103
|
* Вставляет маркированный список.
|
|
184
104
|
*/
|
|
185
105
|
insertUnorderedList(instances) {
|
|
186
|
-
|
|
187
|
-
instances
|
|
188
|
-
.filter((instance) => instance.client)
|
|
189
|
-
.forEach((instance) => {
|
|
190
|
-
instance.client.outcomingMessage$.next(new text_editor_insert_unordered_list_message_1.TextEditorInsertUnorderedListMessage(instance.id));
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
this.broadcast(new text_editor_insert_unordered_list_message_1.TextEditorInsertUnorderedListMessage(this.id));
|
|
195
|
-
}
|
|
196
|
-
return this;
|
|
106
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_insert_unordered_list_message_1.TextEditorInsertUnorderedListMessage(target, actionScope));
|
|
197
107
|
}
|
|
198
108
|
/**
|
|
199
109
|
* Выравнивает текст по левому краю.
|
|
200
110
|
*/
|
|
201
111
|
justifyLeft(instances) {
|
|
202
|
-
|
|
203
|
-
instances
|
|
204
|
-
.filter((instance) => instance.client)
|
|
205
|
-
.forEach((instance) => {
|
|
206
|
-
instance.client.outcomingMessage$.next(new text_editor_justify_left_message_1.TextEditorJustifyLeftMessage(instance.id));
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
this.broadcast(new text_editor_justify_left_message_1.TextEditorJustifyLeftMessage(this.id));
|
|
211
|
-
}
|
|
212
|
-
return this;
|
|
112
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_justify_left_message_1.TextEditorJustifyLeftMessage(target, actionScope));
|
|
213
113
|
}
|
|
214
114
|
/**
|
|
215
115
|
* Выравнивает текст по центру.
|
|
216
116
|
*/
|
|
217
117
|
justifyCenter(instances) {
|
|
218
|
-
|
|
219
|
-
instances
|
|
220
|
-
.filter((instance) => instance.client)
|
|
221
|
-
.forEach((instance) => {
|
|
222
|
-
instance.client.outcomingMessage$.next(new text_editor_justify_center_message_1.TextEditorJustifyCenterMessage(instance.id));
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
this.broadcast(new text_editor_justify_center_message_1.TextEditorJustifyCenterMessage(this.id));
|
|
227
|
-
}
|
|
228
|
-
return this;
|
|
118
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_justify_center_message_1.TextEditorJustifyCenterMessage(target, actionScope));
|
|
229
119
|
}
|
|
230
120
|
/**
|
|
231
121
|
* Выравнивает текст по правому краю.
|
|
232
122
|
*/
|
|
233
123
|
justifyRight(instances) {
|
|
234
|
-
|
|
235
|
-
instances
|
|
236
|
-
.filter((instance) => instance.client)
|
|
237
|
-
.forEach((instance) => {
|
|
238
|
-
instance.client.outcomingMessage$.next(new text_editor_justify_right_message_1.TextEditorJustifyRightMessage(instance.id));
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
this.broadcast(new text_editor_justify_right_message_1.TextEditorJustifyRightMessage(this.id));
|
|
243
|
-
}
|
|
244
|
-
return this;
|
|
124
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_justify_right_message_1.TextEditorJustifyRightMessage(target, actionScope));
|
|
245
125
|
}
|
|
246
126
|
/**
|
|
247
127
|
* Выравнивает текст по ширине.
|
|
248
128
|
*/
|
|
249
129
|
justifyFull(instances) {
|
|
250
|
-
|
|
251
|
-
instances
|
|
252
|
-
.filter((instance) => instance.client)
|
|
253
|
-
.forEach((instance) => {
|
|
254
|
-
instance.client.outcomingMessage$.next(new text_editor_justify_full_message_1.TextEditorJustifyFullMessage(instance.id));
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
this.broadcast(new text_editor_justify_full_message_1.TextEditorJustifyFullMessage(this.id));
|
|
259
|
-
}
|
|
260
|
-
return this;
|
|
130
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_justify_full_message_1.TextEditorJustifyFullMessage(target, actionScope));
|
|
261
131
|
}
|
|
262
132
|
/**
|
|
263
133
|
* Форматирует блок с указанным тегом.
|
|
@@ -266,17 +136,7 @@ class TextEditor extends input_component_1.InputComponent {
|
|
|
266
136
|
*/
|
|
267
137
|
formatBlock(tag, instances) {
|
|
268
138
|
const payload = { tag };
|
|
269
|
-
|
|
270
|
-
instances
|
|
271
|
-
.filter((instance) => instance.client)
|
|
272
|
-
.forEach((instance) => {
|
|
273
|
-
instance.client.outcomingMessage$.next(new text_editor_format_block_message_1.TextEditorFormatBlockMessage(instance.id, payload));
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
this.broadcast(new text_editor_format_block_message_1.TextEditorFormatBlockMessage(this.id, payload));
|
|
278
|
-
}
|
|
279
|
-
return this;
|
|
139
|
+
return this.dispatchComponentCommand(instances, (target, actionScope) => new text_editor_format_block_message_1.TextEditorFormatBlockMessage(target, { ...payload, actionScope }));
|
|
280
140
|
}
|
|
281
141
|
}
|
|
282
142
|
exports.TextEditor = TextEditor;
|