@matreshka/bff 0.9.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/LICENSE +32 -0
- package/README.md +35 -0
- package/dist/components/actions/server-action.d.ts +30 -0
- package/dist/components/actions/server-action.js +23 -0
- package/dist/components/aliases/button.d.ts +17 -0
- package/dist/components/aliases/button.js +54 -0
- package/dist/components/aliases/column.d.ts +11 -0
- package/dist/components/aliases/column.js +31 -0
- package/dist/components/aliases/row.d.ts +11 -0
- package/dist/components/aliases/row.js +31 -0
- package/dist/components/aliases/surface.d.ts +11 -0
- package/dist/components/aliases/surface.js +30 -0
- package/dist/components/app.d.ts +5 -0
- package/dist/components/app.js +12 -0
- package/dist/components/board.d.ts +58 -0
- package/dist/components/board.js +152 -0
- package/dist/components/boot.d.ts +2 -0
- package/dist/components/boot.js +39 -0
- package/dist/components/camera.d.ts +77 -0
- package/dist/components/camera.js +116 -0
- package/dist/components/charts/bar-chart.d.ts +14 -0
- package/dist/components/charts/bar-chart.js +27 -0
- package/dist/components/charts/chart.d.ts +69 -0
- package/dist/components/charts/chart.js +42 -0
- package/dist/components/charts/doughnut-chart.d.ts +14 -0
- package/dist/components/charts/doughnut-chart.js +27 -0
- package/dist/components/charts/line-chart.d.ts +14 -0
- package/dist/components/charts/line-chart.js +27 -0
- package/dist/components/charts/pie-chart.d.ts +14 -0
- package/dist/components/charts/pie-chart.js +27 -0
- package/dist/components/charts/polar-area-chart.d.ts +14 -0
- package/dist/components/charts/polar-area-chart.js +27 -0
- package/dist/components/charts/radar-chart.d.ts +14 -0
- package/dist/components/charts/radar-chart.js +27 -0
- package/dist/components/component.d.ts +159 -0
- package/dist/components/component.js +380 -0
- package/dist/components/container.d.ts +48 -0
- package/dist/components/container.js +80 -0
- package/dist/components/dialog.d.ts +83 -0
- package/dist/components/dialog.js +120 -0
- package/dist/components/entry-component.d.ts +34 -0
- package/dist/components/entry-component.js +74 -0
- package/dist/components/enum/password-input-kind.d.ts +1 -0
- package/dist/components/enum/password-input-kind.js +5 -0
- package/dist/components/enum/popover-position-area.d.ts +1 -0
- package/dist/components/enum/popover-position-area.js +5 -0
- package/dist/components/enum/text-input-kind.d.ts +1 -0
- package/dist/components/enum/text-input-kind.js +5 -0
- package/dist/components/enum/textarea-resize.d.ts +1 -0
- package/dist/components/enum/textarea-resize.js +5 -0
- package/dist/components/file-upload-area.d.ts +79 -0
- package/dist/components/file-upload-area.js +138 -0
- package/dist/components/for-each.d.ts +188 -0
- package/dist/components/for-each.js +362 -0
- package/dist/components/form.d.ts +62 -0
- package/dist/components/form.js +92 -0
- package/dist/components/grid.d.ts +80 -0
- package/dist/components/grid.js +79 -0
- package/dist/components/index.d.ts +55 -0
- package/dist/components/index.js +76 -0
- package/dist/components/inputs/input-component.d.ts +37 -0
- package/dist/components/inputs/input-component.js +30 -0
- package/dist/components/inputs/number-input.d.ts +45 -0
- package/dist/components/inputs/number-input.js +43 -0
- package/dist/components/inputs/password-input.d.ts +28 -0
- package/dist/components/inputs/password-input.js +42 -0
- package/dist/components/inputs/text-editor.d.ts +91 -0
- package/dist/components/inputs/text-editor.js +282 -0
- package/dist/components/inputs/text-input.d.ts +48 -0
- package/dist/components/inputs/text-input.js +40 -0
- package/dist/components/inputs/textarea.d.ts +36 -0
- package/dist/components/inputs/textarea.js +42 -0
- package/dist/components/item-list/flatten-nested-items.d.ts +11 -0
- package/dist/components/item-list/flatten-nested-items.js +100 -0
- package/dist/components/item-list/index.d.ts +5 -0
- package/dist/components/item-list/index.js +21 -0
- package/dist/components/item-list/item-list-host.d.ts +10 -0
- package/dist/components/item-list/item-list-host.js +2 -0
- package/dist/components/item-list/item-list.d.ts +68 -0
- package/dist/components/item-list/item-list.js +206 -0
- package/dist/components/item-list/list-from-ref-context.d.ts +11 -0
- package/dist/components/item-list/list-from-ref-context.js +27 -0
- package/dist/components/item-list/nested-items-host-support.d.ts +36 -0
- package/dist/components/item-list/nested-items-host-support.js +109 -0
- package/dist/components/item-list/types.d.ts +40 -0
- package/dist/components/item-list/types.js +13 -0
- package/dist/components/line.d.ts +43 -0
- package/dist/components/line.js +35 -0
- package/dist/components/map.d.ts +83 -0
- package/dist/components/map.js +146 -0
- package/dist/components/outputs/currency.d.ts +63 -0
- package/dist/components/outputs/currency.js +42 -0
- package/dist/components/outputs/datetime.d.ts +69 -0
- package/dist/components/outputs/datetime.js +49 -0
- package/dist/components/outputs/icon.d.ts +43 -0
- package/dist/components/outputs/icon.js +38 -0
- package/dist/components/outputs/iframe.d.ts +48 -0
- package/dist/components/outputs/iframe.js +44 -0
- package/dist/components/outputs/image.d.ts +73 -0
- package/dist/components/outputs/image.js +63 -0
- package/dist/components/outputs/number.d.ts +39 -0
- package/dist/components/outputs/number.js +47 -0
- package/dist/components/outputs/output-component.d.ts +58 -0
- package/dist/components/outputs/output-component.js +50 -0
- package/dist/components/outputs/progress-bar.d.ts +33 -0
- package/dist/components/outputs/progress-bar.js +42 -0
- package/dist/components/outputs/progress-spinner.d.ts +37 -0
- package/dist/components/outputs/progress-spinner.js +43 -0
- package/dist/components/outputs/qr-code.d.ts +28 -0
- package/dist/components/outputs/qr-code.js +40 -0
- package/dist/components/outputs/text.d.ts +57 -0
- package/dist/components/outputs/text.js +78 -0
- package/dist/components/outputs/vector.d.ts +47 -0
- package/dist/components/outputs/vector.js +53 -0
- package/dist/components/page.d.ts +96 -0
- package/dist/components/page.js +127 -0
- package/dist/components/popover.d.ts +63 -0
- package/dist/components/popover.js +96 -0
- package/dist/components/stack.d.ts +158 -0
- package/dist/components/stack.js +146 -0
- package/dist/components/types/component-sequence.d.ts +3 -0
- package/dist/components/types/component-sequence.js +2 -0
- package/dist/components/types/container-overlay.d.ts +3 -0
- package/dist/components/types/container-overlay.js +2 -0
- package/dist/components/utils/component-factory-shared.d.ts +4 -0
- package/dist/components/utils/component-factory-shared.js +12 -0
- package/dist/core/actions/action.d.ts +35 -0
- package/dist/core/actions/action.js +45 -0
- package/dist/core/actions/animate-component.d.ts +58 -0
- package/dist/core/actions/animate-component.js +57 -0
- package/dist/core/actions/local-action.d.ts +8 -0
- package/dist/core/actions/local-action.js +12 -0
- package/dist/core/actions/set-context-value.d.ts +18 -0
- package/dist/core/actions/set-context-value.js +32 -0
- package/dist/core/actions/set-context-values.d.ts +34 -0
- package/dist/core/actions/set-context-values.js +30 -0
- package/dist/core/actions/toggle-context-value.d.ts +21 -0
- package/dist/core/actions/toggle-context-value.js +30 -0
- package/dist/core/actions/write-text-to-clipboard.d.ts +30 -0
- package/dist/core/actions/write-text-to-clipboard.js +44 -0
- package/dist/core/boot.d.ts +2 -0
- package/dist/core/boot.js +8 -0
- package/dist/core/client-context.d.ts +7 -0
- package/dist/core/client-context.js +20 -0
- package/dist/core/client.d.ts +133 -0
- package/dist/core/client.js +292 -0
- package/dist/core/conditions/condition-group.d.ts +14 -0
- package/dist/core/conditions/condition-group.js +30 -0
- package/dist/core/conditions/condition-operand.d.ts +27 -0
- package/dist/core/conditions/condition-operand.js +15 -0
- package/dist/core/conditions/condition.d.ts +27 -0
- package/dist/core/conditions/condition.js +35 -0
- package/dist/core/conditions/context-array-includes.d.ts +32 -0
- package/dist/core/conditions/context-array-includes.js +52 -0
- package/dist/core/conditions/context-array-length.d.ts +86 -0
- package/dist/core/conditions/context-array-length.js +155 -0
- package/dist/core/conditions/context-value-defined.d.ts +12 -0
- package/dist/core/conditions/context-value-defined.js +21 -0
- package/dist/core/conditions/context-value-equal.d.ts +14 -0
- package/dist/core/conditions/context-value-equal.js +26 -0
- package/dist/core/conditions/context-value-in.d.ts +17 -0
- package/dist/core/conditions/context-value-in.js +26 -0
- package/dist/core/conditions/context-value-not-equal.d.ts +14 -0
- package/dist/core/conditions/context-value-not-equal.js +26 -0
- package/dist/core/conditions/context-value-undefined.d.ts +12 -0
- package/dist/core/conditions/context-value-undefined.js +21 -0
- package/dist/core/conditions/desktop-device.d.ts +11 -0
- package/dist/core/conditions/desktop-device.js +21 -0
- package/dist/core/conditions/groups.d.ts +71 -0
- package/dist/core/conditions/groups.js +74 -0
- package/dist/core/conditions/index.d.ts +17 -0
- package/dist/core/conditions/index.js +33 -0
- package/dist/core/conditions/mobile-device.d.ts +11 -0
- package/dist/core/conditions/mobile-device.js +21 -0
- package/dist/core/conditions/not-desktop-device.d.ts +11 -0
- package/dist/core/conditions/not-desktop-device.js +21 -0
- package/dist/core/conditions/not-mobile-device.d.ts +11 -0
- package/dist/core/conditions/not-mobile-device.js +21 -0
- package/dist/core/conditions/not-tablet-device.d.ts +11 -0
- package/dist/core/conditions/not-tablet-device.js +21 -0
- package/dist/core/conditions/tablet-device.d.ts +11 -0
- package/dist/core/conditions/tablet-device.js +21 -0
- package/dist/core/context/context-ref.d.ts +48 -0
- package/dist/core/context/context-ref.js +58 -0
- package/dist/core/context/context.d.ts +121 -0
- package/dist/core/context/context.js +353 -0
- package/dist/core/entry-context.d.ts +14 -0
- package/dist/core/entry-context.js +31 -0
- package/dist/core/gateway-connection.d.ts +29 -0
- package/dist/core/gateway-connection.js +146 -0
- package/dist/core/index.d.ts +30 -0
- package/dist/core/index.js +46 -0
- package/dist/core/matreshka.d.ts +61 -0
- package/dist/core/matreshka.js +186 -0
- package/dist/core/router.d.ts +38 -0
- package/dist/core/router.js +116 -0
- package/dist/core/types/client-settings.d.ts +31 -0
- package/dist/core/types/client-settings.js +2 -0
- package/dist/core/types/component-instance.d.ts +25 -0
- package/dist/core/types/component-instance.js +42 -0
- package/dist/core/types/component-tree-node.d.ts +11 -0
- package/dist/core/types/component-tree-node.js +18 -0
- package/dist/core/types/componentable.d.ts +21 -0
- package/dist/core/types/componentable.js +2 -0
- package/dist/core/types/context-ref-primitive-value.d.ts +5 -0
- package/dist/core/types/context-ref-primitive-value.js +2 -0
- package/dist/core/types/message.d.ts +15 -0
- package/dist/core/types/message.js +2 -0
- package/dist/core/types/mixed-with-callbacks-array.d.ts +9 -0
- package/dist/core/types/mixed-with-callbacks-array.js +2 -0
- package/dist/core/types/native-picker-context-ref.d.ts +7 -0
- package/dist/core/types/native-picker-context-ref.js +2 -0
- package/dist/core/types/pageable.d.ts +15 -0
- package/dist/core/types/pageable.js +2 -0
- package/dist/core/types/standalone-component.d.ts +9 -0
- package/dist/core/types/standalone-component.js +2 -0
- package/dist/core/types/status-code.d.ts +319 -0
- package/dist/core/types/status-code.js +322 -0
- package/dist/core/utils/calculate-components.d.ts +13 -0
- package/dist/core/utils/calculate-components.js +40 -0
- package/dist/core/utils/color-token-id.d.ts +11 -0
- package/dist/core/utils/color-token-id.js +24 -0
- package/dist/core/utils/deep-pick.d.ts +2 -0
- package/dist/core/utils/deep-pick.js +54 -0
- package/dist/core/utils/hex-to-hsl.d.ts +14 -0
- package/dist/core/utils/hex-to-hsl.js +49 -0
- package/dist/core/utils/incoming-message-observer.d.ts +9 -0
- package/dist/core/utils/incoming-message-observer.js +23 -0
- package/dist/core/utils/merge-deep.d.ts +8 -0
- package/dist/core/utils/merge-deep.js +39 -0
- package/dist/core/utils/objects-diff.d.ts +13 -0
- package/dist/core/utils/objects-diff.js +56 -0
- package/dist/core/utils/parse-context-path.d.ts +4 -0
- package/dist/core/utils/parse-context-path.js +16 -0
- package/dist/core/utils/replace-context-keys.d.ts +12 -0
- package/dist/core/utils/replace-context-keys.js +90 -0
- package/dist/core/utils/serialize-component-tree.d.ts +9 -0
- package/dist/core/utils/serialize-component-tree.js +24 -0
- package/dist/core/utils/set-object-property.d.ts +2 -0
- package/dist/core/utils/set-object-property.js +29 -0
- package/dist/core/utils/track-created-instances.d.ts +10 -0
- package/dist/core/utils/track-created-instances.js +18 -0
- package/dist/core/version.d.ts +1 -0
- package/dist/core/version.js +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/platforms/android-platform.d.ts +6 -0
- package/dist/platforms/android-platform.js +10 -0
- package/dist/platforms/browser-platform.d.ts +79 -0
- package/dist/platforms/browser-platform.js +143 -0
- package/dist/platforms/client-platform.d.ts +6 -0
- package/dist/platforms/client-platform.js +10 -0
- package/dist/platforms/index.d.ts +12 -0
- package/dist/platforms/index.js +28 -0
- package/dist/platforms/ios-platform.d.ts +6 -0
- package/dist/platforms/ios-platform.js +10 -0
- package/dist/platforms/max-mini-app-platform.d.ts +45 -0
- package/dist/platforms/max-mini-app-platform.js +87 -0
- package/dist/platforms/mobile-platform.d.ts +117 -0
- package/dist/platforms/mobile-platform.js +316 -0
- package/dist/platforms/platform.d.ts +109 -0
- package/dist/platforms/platform.js +224 -0
- package/dist/platforms/pwa-platform.d.ts +6 -0
- package/dist/platforms/pwa-platform.js +10 -0
- package/dist/platforms/server-platform.d.ts +6 -0
- package/dist/platforms/server-platform.js +10 -0
- package/dist/platforms/telegram-mini-app-platform.d.ts +87 -0
- package/dist/platforms/telegram-mini-app-platform.js +166 -0
- package/dist/platforms/utils/client-platform.d.ts +4 -0
- package/dist/platforms/utils/client-platform.js +38 -0
- package/dist/platforms/utils/mobile-ble-services.d.ts +3 -0
- package/dist/platforms/utils/mobile-ble-services.js +31 -0
- package/dist/platforms/web-platform.d.ts +9 -0
- package/dist/platforms/web-platform.js +13 -0
- package/package.json +109 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
2
|
+
import { VideoFacingMode } from "@matreshka/shared/enums/video-facing-mode";
|
|
3
|
+
import { ErrorMessagePayload } from "@matreshka/shared/messages/client-to-bff/error-message";
|
|
4
|
+
import type { CameraConfig } from "@matreshka/shared/types/camera-config";
|
|
5
|
+
import { Componentable, ComponentInstance, ComponentTreeNode, MixedWithCallbacksArray, StandaloneComponent } from "../core";
|
|
6
|
+
import { VideoInputDevice } from "../platforms/platform";
|
|
7
|
+
import { Component, ComponentInitConfig, ComponentProperties, ServerComponentAction } from "./component";
|
|
8
|
+
import { Overlay } from "./types/container-overlay";
|
|
9
|
+
export { VideoFacingMode } from "@matreshka/shared/enums/video-facing-mode";
|
|
10
|
+
export type CameraProperties = {
|
|
11
|
+
content: ComponentTreeNode[];
|
|
12
|
+
overlays?: Overlay[];
|
|
13
|
+
facingMode?: VideoFacingMode;
|
|
14
|
+
} & ComponentProperties;
|
|
15
|
+
/**
|
|
16
|
+
* Конфигурация инициализации для компонента Camera.
|
|
17
|
+
*
|
|
18
|
+
* @template T Тип вложенных компонентов.
|
|
19
|
+
* @property content Массив вложенных компонентов.
|
|
20
|
+
*/
|
|
21
|
+
export type CameraInitConfig<ContentType extends ComponentTreeNode = ComponentTreeNode, ComponentType extends Componentable = Camera, PropertiesType extends CameraProperties = CameraProperties> = {
|
|
22
|
+
/**
|
|
23
|
+
* Предпочитаемая камера устройства.
|
|
24
|
+
* Пробрасывается в клиентский `getUserMedia` как `video.facingMode`.
|
|
25
|
+
*
|
|
26
|
+
* Полезно для кейсов вроде сканирования QR (обычно нужна задняя камера: `"environment"`).
|
|
27
|
+
*/
|
|
28
|
+
facingMode?: VideoFacingMode;
|
|
29
|
+
overlays?: Overlay[];
|
|
30
|
+
content: MixedWithCallbacksArray<ContentType>;
|
|
31
|
+
/**
|
|
32
|
+
* Обработчики события распознавания QR-кода на клиенте.
|
|
33
|
+
* В payload приходит строковое значение распознанного QR-кода.
|
|
34
|
+
*/
|
|
35
|
+
onQrCode?: ServerComponentAction<ComponentType, string> | ServerComponentAction<ComponentType, string>[];
|
|
36
|
+
/**
|
|
37
|
+
* Событие: на клиенте сменился активный девайс камеры.
|
|
38
|
+
* В payload приходит объект `{ deviceId: string }`.
|
|
39
|
+
*/
|
|
40
|
+
onDeviceChange?: ServerComponentAction<ComponentType, {
|
|
41
|
+
deviceId: string;
|
|
42
|
+
}> | ServerComponentAction<ComponentType, {
|
|
43
|
+
deviceId: string;
|
|
44
|
+
}>[];
|
|
45
|
+
/**
|
|
46
|
+
* Событие: ошибка работы камеры.
|
|
47
|
+
* В payload приходит объект `ErrorMessagePayload` (code, message?).
|
|
48
|
+
*/
|
|
49
|
+
onError?: ServerComponentAction<ComponentType, ErrorMessagePayload> | ServerComponentAction<ComponentType, ErrorMessagePayload>[];
|
|
50
|
+
} & ComponentInitConfig<ComponentType, PropertiesType>;
|
|
51
|
+
type DefaultInitConfigType<ContentType extends ComponentTreeNode = ComponentTreeNode> = CameraInitConfig<ContentType, Camera>;
|
|
52
|
+
export declare function camera<ContentType extends ComponentTreeNode = ComponentTreeNode>(content: DefaultInitConfigType<ContentType>["content"]): Camera<ContentType>;
|
|
53
|
+
export declare function camera<ContentType extends ComponentTreeNode = ComponentTreeNode>(options: Omit<DefaultInitConfigType<ContentType>, "content">, content: DefaultInitConfigType<ContentType>["content"]): Camera<ContentType>;
|
|
54
|
+
export declare function camera<ContentType extends ComponentTreeNode = ComponentTreeNode>(config: DefaultInitConfigType<ContentType>): Camera<ContentType>;
|
|
55
|
+
/**
|
|
56
|
+
* Компонент камеры (контейнер), на клиенте отображает видео с веб-камеры устройства.
|
|
57
|
+
*/
|
|
58
|
+
export declare class Camera<ContentType extends ComponentTreeNode = ComponentTreeNode, InitConfigType extends CameraInitConfig<ContentType, any> = DefaultInitConfigType<ContentType>, PropertiesType extends CameraProperties = CameraProperties> extends Component<InitConfigType, PropertiesType> implements StandaloneComponent {
|
|
59
|
+
constructor(config: InitConfigType);
|
|
60
|
+
/**
|
|
61
|
+
* Возвращает уникальный идентификатор класса компонента.
|
|
62
|
+
* @returns Строка `"camera"`.
|
|
63
|
+
*/
|
|
64
|
+
protected class(): ServerComponentClass;
|
|
65
|
+
/**
|
|
66
|
+
* Возвращает флаг, указывающий, что компонент является самостоятельным.
|
|
67
|
+
* @returns Всегда true.
|
|
68
|
+
*/
|
|
69
|
+
standalone(): true;
|
|
70
|
+
protected initProperties(initValues: InitConfigType): PropertiesType;
|
|
71
|
+
/**
|
|
72
|
+
* Отправляет на клиент команду переключения активной камеры устройства на указанную.
|
|
73
|
+
*/
|
|
74
|
+
switchCamera(device: VideoInputDevice, instances?: ComponentInstance[]): this;
|
|
75
|
+
protected serializeRuleOverrides(overrides: Partial<PropertiesType>): Record<string, unknown>;
|
|
76
|
+
serialize(): CameraConfig;
|
|
77
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Camera = exports.VideoFacingMode = void 0;
|
|
4
|
+
exports.camera = camera;
|
|
5
|
+
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
6
|
+
const camera_switch_message_1 = require("@matreshka/shared/messages/bff-to-client/components/camera/camera-switch-message");
|
|
7
|
+
const core_1 = require("../core");
|
|
8
|
+
const component_1 = require("./component");
|
|
9
|
+
var video_facing_mode_1 = require("@matreshka/shared/enums/video-facing-mode");
|
|
10
|
+
Object.defineProperty(exports, "VideoFacingMode", { enumerable: true, get: function () { return video_facing_mode_1.VideoFacingMode; } });
|
|
11
|
+
function camera(arg0, arg1) {
|
|
12
|
+
if (arg1 !== undefined) {
|
|
13
|
+
return new Camera({
|
|
14
|
+
...arg0,
|
|
15
|
+
content: arg1,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const single = arg0;
|
|
19
|
+
if (typeof single === "object" &&
|
|
20
|
+
single !== null &&
|
|
21
|
+
!Array.isArray(single) &&
|
|
22
|
+
"content" in single) {
|
|
23
|
+
return new Camera(single);
|
|
24
|
+
}
|
|
25
|
+
return new Camera({
|
|
26
|
+
content: single,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Компонент камеры (контейнер), на клиенте отображает видео с веб-камеры устройства.
|
|
31
|
+
*/
|
|
32
|
+
class Camera extends component_1.Component {
|
|
33
|
+
constructor(config) {
|
|
34
|
+
super(config);
|
|
35
|
+
if (config.onQrCode) {
|
|
36
|
+
// bindActions в базовом Component типизирован под payload=unknown.
|
|
37
|
+
// Здесь payload всегда строка QR-кода, поэтому безопасно расширяем тип.
|
|
38
|
+
const actions = config.onQrCode;
|
|
39
|
+
this.bindActions("qr-code", actions);
|
|
40
|
+
}
|
|
41
|
+
if (config.onDeviceChange) {
|
|
42
|
+
const actions = config.onDeviceChange;
|
|
43
|
+
this.bindActions("device-change", actions);
|
|
44
|
+
}
|
|
45
|
+
if (config.onError) {
|
|
46
|
+
const actions = config.onError;
|
|
47
|
+
this.bindActions("error", actions);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Возвращает уникальный идентификатор класса компонента.
|
|
52
|
+
* @returns Строка `"camera"`.
|
|
53
|
+
*/
|
|
54
|
+
class() {
|
|
55
|
+
return server_component_class_1.ServerComponentClass.Camera;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Возвращает флаг, указывающий, что компонент является самостоятельным.
|
|
59
|
+
* @returns Всегда true.
|
|
60
|
+
*/
|
|
61
|
+
standalone() {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
initProperties(initValues) {
|
|
65
|
+
return {
|
|
66
|
+
...super.initProperties(initValues),
|
|
67
|
+
content: (0, core_1.calculateComponents)(initValues.content),
|
|
68
|
+
overlays: initValues.overlays,
|
|
69
|
+
facingMode: initValues.facingMode,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Отправляет на клиент команду переключения активной камеры устройства на указанную.
|
|
74
|
+
*/
|
|
75
|
+
switchCamera(device, instances) {
|
|
76
|
+
if (instances) {
|
|
77
|
+
instances
|
|
78
|
+
.filter((instance) => instance.client)
|
|
79
|
+
.forEach((instance) => {
|
|
80
|
+
instance.client.outcomingMessage$.next(new camera_switch_message_1.CameraSwitchMessage(instance.id, {
|
|
81
|
+
deviceId: device.deviceId,
|
|
82
|
+
}));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.broadcast(new camera_switch_message_1.CameraSwitchMessage(this.id, {
|
|
87
|
+
deviceId: device.deviceId,
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
serializeRuleOverrides(overrides) {
|
|
93
|
+
const out = { ...overrides };
|
|
94
|
+
if (overrides.content !== undefined) {
|
|
95
|
+
out.content = (0, core_1.serializeComponentList)(overrides.content);
|
|
96
|
+
}
|
|
97
|
+
if (overrides.overlays !== undefined) {
|
|
98
|
+
out.overlays = (0, core_1.serializeOverlays)(overrides.overlays);
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
serialize() {
|
|
103
|
+
const result = super.serialize();
|
|
104
|
+
const p = this.properties;
|
|
105
|
+
return {
|
|
106
|
+
...result,
|
|
107
|
+
class: server_component_class_1.ServerComponentClass.Camera,
|
|
108
|
+
properties: {
|
|
109
|
+
...p,
|
|
110
|
+
content: (0, core_1.serializeComponentList)(p.content),
|
|
111
|
+
overlays: p.overlays ? (0, core_1.serializeOverlays)(p.overlays) : undefined,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.Camera = Camera;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Chart, ChartDataInput, ChartInitConfig, ChartType } from "./chart";
|
|
2
|
+
export declare function barChart(options: Omit<ChartInitConfig<BarChart>, "labels" | "datasets">, data: ChartDataInput): BarChart;
|
|
3
|
+
export declare function barChart(data: ChartDataInput): BarChart;
|
|
4
|
+
export declare function barChart(config: ChartInitConfig<Chart>): BarChart;
|
|
5
|
+
/**
|
|
6
|
+
* Компонент столбчатой диаграммы.
|
|
7
|
+
*/
|
|
8
|
+
export declare class BarChart extends Chart {
|
|
9
|
+
/**
|
|
10
|
+
* Возвращает тип графика.
|
|
11
|
+
* @returns Тип графика "bar".
|
|
12
|
+
*/
|
|
13
|
+
protected type(): ChartType;
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BarChart = void 0;
|
|
4
|
+
exports.barChart = barChart;
|
|
5
|
+
const chart_1 = require("./chart");
|
|
6
|
+
function barChart(arg0, arg1) {
|
|
7
|
+
if (arg1 !== undefined) {
|
|
8
|
+
return new BarChart({
|
|
9
|
+
...arg0,
|
|
10
|
+
...arg1,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return new BarChart(arg0);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Компонент столбчатой диаграммы.
|
|
17
|
+
*/
|
|
18
|
+
class BarChart extends chart_1.Chart {
|
|
19
|
+
/**
|
|
20
|
+
* Возвращает тип графика.
|
|
21
|
+
* @returns Тип графика "bar".
|
|
22
|
+
*/
|
|
23
|
+
type() {
|
|
24
|
+
return chart_1.ChartType.Bar;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.BarChart = BarChart;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ChartType } from "@matreshka/shared/enums/chart-type";
|
|
2
|
+
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
3
|
+
import type { Componentable } from "../../core/types/componentable";
|
|
4
|
+
import { StandaloneComponent } from "../../core/types/standalone-component";
|
|
5
|
+
import { Component, ComponentInitConfig, ComponentProperties } from "../component";
|
|
6
|
+
export { ChartType } from "@matreshka/shared/enums/chart-type";
|
|
7
|
+
/**
|
|
8
|
+
* Описание набора данных для графика.
|
|
9
|
+
* @property label Название набора данных.
|
|
10
|
+
* @property values Массив числовых значений.
|
|
11
|
+
*/
|
|
12
|
+
export type ChartDataset = {
|
|
13
|
+
label: string;
|
|
14
|
+
} & {
|
|
15
|
+
values: number[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Свойства компонента графика.
|
|
19
|
+
* @property type Тип графика.
|
|
20
|
+
* @property colors Цвета, используемые в графике.
|
|
21
|
+
*/
|
|
22
|
+
export type ChartProperties = {
|
|
23
|
+
type: ChartType;
|
|
24
|
+
colors: `#${string}`[];
|
|
25
|
+
labels: string[];
|
|
26
|
+
datasets: ChartDataset[];
|
|
27
|
+
} & ComponentProperties;
|
|
28
|
+
/**
|
|
29
|
+
* Конфигурация инициализации графика.
|
|
30
|
+
* @property labels Подписи для значений, длина массива labels должна совпадать с длинной массива значений в datasets, иначе на график будет выведено только labels.length значений.
|
|
31
|
+
* @property datasets Наборы данных.
|
|
32
|
+
* @property colors Цвета графика в HEX-формате.
|
|
33
|
+
*/
|
|
34
|
+
export type ChartInitConfig<ComponentType extends Componentable = Chart, PropertiesType extends ChartProperties = ChartProperties> = {
|
|
35
|
+
labels: string[];
|
|
36
|
+
datasets: ChartDataset[];
|
|
37
|
+
colors?: `#${string}`[];
|
|
38
|
+
} & ComponentInitConfig<ComponentType, PropertiesType>;
|
|
39
|
+
/**
|
|
40
|
+
* Обязательные поля данных графика для фабрик: подписи и наборы.
|
|
41
|
+
*/
|
|
42
|
+
export type ChartDataInput = Pick<ChartInitConfig<Chart>, "labels" | "datasets">;
|
|
43
|
+
type DefaultInitConfigType = ChartInitConfig<Chart>;
|
|
44
|
+
/**
|
|
45
|
+
* Абстрактный класс графика.
|
|
46
|
+
* Определяет общее поведение графических компонентов.
|
|
47
|
+
*/
|
|
48
|
+
export declare abstract class Chart<InitConfigType extends ChartInitConfig<any> = DefaultInitConfigType, PropertiesType extends ChartProperties = ChartProperties> extends Component<InitConfigType, PropertiesType> implements StandaloneComponent {
|
|
49
|
+
/**
|
|
50
|
+
* Возвращает тип графика.
|
|
51
|
+
*/
|
|
52
|
+
protected abstract type(): ChartType;
|
|
53
|
+
/**
|
|
54
|
+
* Возвращает признак, что компонент является самостоятельным.
|
|
55
|
+
* @returns Всегда true.
|
|
56
|
+
*/
|
|
57
|
+
standalone(): true;
|
|
58
|
+
/**
|
|
59
|
+
* Возвращает уникальный идентификатор класса компонента.
|
|
60
|
+
* @returns Строка "chart".
|
|
61
|
+
*/
|
|
62
|
+
protected class(): ServerComponentClass;
|
|
63
|
+
/**
|
|
64
|
+
* Инициализирует свойства графика.
|
|
65
|
+
* @param initValues Входные параметры конфигурации.
|
|
66
|
+
* @returns Свойства графика.
|
|
67
|
+
*/
|
|
68
|
+
protected initProperties(initValues: InitConfigType): PropertiesType;
|
|
69
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Chart = exports.ChartType = void 0;
|
|
4
|
+
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
5
|
+
const component_1 = require("../component");
|
|
6
|
+
var chart_type_1 = require("@matreshka/shared/enums/chart-type");
|
|
7
|
+
Object.defineProperty(exports, "ChartType", { enumerable: true, get: function () { return chart_type_1.ChartType; } });
|
|
8
|
+
/**
|
|
9
|
+
* Абстрактный класс графика.
|
|
10
|
+
* Определяет общее поведение графических компонентов.
|
|
11
|
+
*/
|
|
12
|
+
class Chart extends component_1.Component {
|
|
13
|
+
/**
|
|
14
|
+
* Возвращает признак, что компонент является самостоятельным.
|
|
15
|
+
* @returns Всегда true.
|
|
16
|
+
*/
|
|
17
|
+
standalone() {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Возвращает уникальный идентификатор класса компонента.
|
|
22
|
+
* @returns Строка "chart".
|
|
23
|
+
*/
|
|
24
|
+
class() {
|
|
25
|
+
return server_component_class_1.ServerComponentClass.Chart;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Инициализирует свойства графика.
|
|
29
|
+
* @param initValues Входные параметры конфигурации.
|
|
30
|
+
* @returns Свойства графика.
|
|
31
|
+
*/
|
|
32
|
+
initProperties(initValues) {
|
|
33
|
+
return {
|
|
34
|
+
...super.initProperties(initValues),
|
|
35
|
+
type: this.type(),
|
|
36
|
+
colors: initValues.colors ?? [],
|
|
37
|
+
labels: initValues.labels,
|
|
38
|
+
datasets: initValues.datasets,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.Chart = Chart;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Chart, ChartDataInput, ChartInitConfig, ChartType } from "./chart";
|
|
2
|
+
export declare function doughnutChart(options: Omit<ChartInitConfig<DoughnutChart>, "labels" | "datasets">, data: ChartDataInput): DoughnutChart;
|
|
3
|
+
export declare function doughnutChart(data: ChartDataInput): DoughnutChart;
|
|
4
|
+
export declare function doughnutChart(config: ChartInitConfig<Chart>): DoughnutChart;
|
|
5
|
+
/**
|
|
6
|
+
* Компонент круговой диаграммы с дыркой по центру (doughnut chart).
|
|
7
|
+
*/
|
|
8
|
+
export declare class DoughnutChart extends Chart {
|
|
9
|
+
/**
|
|
10
|
+
* Возвращает тип графика.
|
|
11
|
+
* @returns Тип графика "doughnut".
|
|
12
|
+
*/
|
|
13
|
+
protected type(): ChartType;
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DoughnutChart = void 0;
|
|
4
|
+
exports.doughnutChart = doughnutChart;
|
|
5
|
+
const chart_1 = require("./chart");
|
|
6
|
+
function doughnutChart(arg0, arg1) {
|
|
7
|
+
if (arg1 !== undefined) {
|
|
8
|
+
return new DoughnutChart({
|
|
9
|
+
...arg0,
|
|
10
|
+
...arg1,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return new DoughnutChart(arg0);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Компонент круговой диаграммы с дыркой по центру (doughnut chart).
|
|
17
|
+
*/
|
|
18
|
+
class DoughnutChart extends chart_1.Chart {
|
|
19
|
+
/**
|
|
20
|
+
* Возвращает тип графика.
|
|
21
|
+
* @returns Тип графика "doughnut".
|
|
22
|
+
*/
|
|
23
|
+
type() {
|
|
24
|
+
return chart_1.ChartType.Doughnut;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.DoughnutChart = DoughnutChart;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Chart, ChartDataInput, ChartInitConfig, ChartType } from "./chart";
|
|
2
|
+
export declare function lineChart(options: Omit<ChartInitConfig<LineChart>, "labels" | "datasets">, data: ChartDataInput): LineChart;
|
|
3
|
+
export declare function lineChart(data: ChartDataInput): LineChart;
|
|
4
|
+
export declare function lineChart(config: ChartInitConfig<Chart>): LineChart;
|
|
5
|
+
/**
|
|
6
|
+
* Компонент линейного графика.
|
|
7
|
+
*/
|
|
8
|
+
export declare class LineChart extends Chart {
|
|
9
|
+
/**
|
|
10
|
+
* Возвращает тип графика.
|
|
11
|
+
* @returns Тип графика "line".
|
|
12
|
+
*/
|
|
13
|
+
protected type(): ChartType;
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LineChart = void 0;
|
|
4
|
+
exports.lineChart = lineChart;
|
|
5
|
+
const chart_1 = require("./chart");
|
|
6
|
+
function lineChart(arg0, arg1) {
|
|
7
|
+
if (arg1 !== undefined) {
|
|
8
|
+
return new LineChart({
|
|
9
|
+
...arg0,
|
|
10
|
+
...arg1,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return new LineChart(arg0);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Компонент линейного графика.
|
|
17
|
+
*/
|
|
18
|
+
class LineChart extends chart_1.Chart {
|
|
19
|
+
/**
|
|
20
|
+
* Возвращает тип графика.
|
|
21
|
+
* @returns Тип графика "line".
|
|
22
|
+
*/
|
|
23
|
+
type() {
|
|
24
|
+
return chart_1.ChartType.Line;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.LineChart = LineChart;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Chart, ChartDataInput, ChartInitConfig, ChartType } from "./chart";
|
|
2
|
+
export declare function pieChart(options: Omit<ChartInitConfig<PieChart>, "labels" | "datasets">, data: ChartDataInput): PieChart;
|
|
3
|
+
export declare function pieChart(data: ChartDataInput): PieChart;
|
|
4
|
+
export declare function pieChart(config: ChartInitConfig<Chart>): PieChart;
|
|
5
|
+
/**
|
|
6
|
+
* Компонент круговой диаграммы.
|
|
7
|
+
*/
|
|
8
|
+
export declare class PieChart extends Chart {
|
|
9
|
+
/**
|
|
10
|
+
* Возвращает тип графика.
|
|
11
|
+
* @returns Тип графика "pie".
|
|
12
|
+
*/
|
|
13
|
+
protected type(): ChartType;
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PieChart = void 0;
|
|
4
|
+
exports.pieChart = pieChart;
|
|
5
|
+
const chart_1 = require("./chart");
|
|
6
|
+
function pieChart(arg0, arg1) {
|
|
7
|
+
if (arg1 !== undefined) {
|
|
8
|
+
return new PieChart({
|
|
9
|
+
...arg0,
|
|
10
|
+
...arg1,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return new PieChart(arg0);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Компонент круговой диаграммы.
|
|
17
|
+
*/
|
|
18
|
+
class PieChart extends chart_1.Chart {
|
|
19
|
+
/**
|
|
20
|
+
* Возвращает тип графика.
|
|
21
|
+
* @returns Тип графика "pie".
|
|
22
|
+
*/
|
|
23
|
+
type() {
|
|
24
|
+
return chart_1.ChartType.Pie;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.PieChart = PieChart;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Chart, ChartDataInput, ChartInitConfig, ChartType } from "./chart";
|
|
2
|
+
export declare function polarAreaChart(options: Omit<ChartInitConfig<PolarAreaChart>, "labels" | "datasets">, data: ChartDataInput): PolarAreaChart;
|
|
3
|
+
export declare function polarAreaChart(data: ChartDataInput): PolarAreaChart;
|
|
4
|
+
export declare function polarAreaChart(config: ChartInitConfig<Chart>): PolarAreaChart;
|
|
5
|
+
/**
|
|
6
|
+
* Компонент круговой диаграммы с радиальным распределением (polar area chart).
|
|
7
|
+
*/
|
|
8
|
+
export declare class PolarAreaChart extends Chart {
|
|
9
|
+
/**
|
|
10
|
+
* Возвращает тип графика.
|
|
11
|
+
* @returns Тип графика "polarArea".
|
|
12
|
+
*/
|
|
13
|
+
protected type(): ChartType;
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolarAreaChart = void 0;
|
|
4
|
+
exports.polarAreaChart = polarAreaChart;
|
|
5
|
+
const chart_1 = require("./chart");
|
|
6
|
+
function polarAreaChart(arg0, arg1) {
|
|
7
|
+
if (arg1 !== undefined) {
|
|
8
|
+
return new PolarAreaChart({
|
|
9
|
+
...arg0,
|
|
10
|
+
...arg1,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return new PolarAreaChart(arg0);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Компонент круговой диаграммы с радиальным распределением (polar area chart).
|
|
17
|
+
*/
|
|
18
|
+
class PolarAreaChart extends chart_1.Chart {
|
|
19
|
+
/**
|
|
20
|
+
* Возвращает тип графика.
|
|
21
|
+
* @returns Тип графика "polarArea".
|
|
22
|
+
*/
|
|
23
|
+
type() {
|
|
24
|
+
return chart_1.ChartType.PolarArea;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.PolarAreaChart = PolarAreaChart;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Chart, ChartDataInput, ChartInitConfig, ChartType } from "./chart";
|
|
2
|
+
export declare function radarChart(options: Omit<ChartInitConfig<RadarChart>, "labels" | "datasets">, data: ChartDataInput): RadarChart;
|
|
3
|
+
export declare function radarChart(data: ChartDataInput): RadarChart;
|
|
4
|
+
export declare function radarChart(config: ChartInitConfig<Chart>): RadarChart;
|
|
5
|
+
/**
|
|
6
|
+
* Компонент радиальной (радарной) диаграммы.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RadarChart extends Chart {
|
|
9
|
+
/**
|
|
10
|
+
* Возвращает тип графика.
|
|
11
|
+
* @returns Тип графика "radar".
|
|
12
|
+
*/
|
|
13
|
+
protected type(): ChartType;
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RadarChart = void 0;
|
|
4
|
+
exports.radarChart = radarChart;
|
|
5
|
+
const chart_1 = require("./chart");
|
|
6
|
+
function radarChart(arg0, arg1) {
|
|
7
|
+
if (arg1 !== undefined) {
|
|
8
|
+
return new RadarChart({
|
|
9
|
+
...arg0,
|
|
10
|
+
...arg1,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return new RadarChart(arg0);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Компонент радиальной (радарной) диаграммы.
|
|
17
|
+
*/
|
|
18
|
+
class RadarChart extends chart_1.Chart {
|
|
19
|
+
/**
|
|
20
|
+
* Возвращает тип графика.
|
|
21
|
+
* @returns Тип графика "radar".
|
|
22
|
+
*/
|
|
23
|
+
type() {
|
|
24
|
+
return chart_1.ChartType.Radar;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.RadarChart = RadarChart;
|