@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,73 @@
|
|
|
1
|
+
import { RatioMode } from "@matreshka/shared/enums/ratio-mode";
|
|
2
|
+
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
3
|
+
import type { RadiusPx } from "@matreshka/shared/types/radius-px";
|
|
4
|
+
import { type FlexItemSpec } from "@matreshka/shared/types/flex-item";
|
|
5
|
+
import { Componentable, ContextRef, StandaloneComponent } from "../../core";
|
|
6
|
+
import { ServerComponentAction } from "../component";
|
|
7
|
+
import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
|
|
8
|
+
export { RatioMode } from "@matreshka/shared/enums/ratio-mode";
|
|
9
|
+
/** @deprecated Use RatioMode instead */
|
|
10
|
+
export { RatioMode as ImageMode } from "@matreshka/shared/enums/ratio-mode";
|
|
11
|
+
/**
|
|
12
|
+
* Свойства компонента вывода изображения.
|
|
13
|
+
* @property ratio Соотношение сторон и режим вписывания (`object-fit` / аналог).
|
|
14
|
+
*/
|
|
15
|
+
export type ImageProperties = {
|
|
16
|
+
ratio?: {
|
|
17
|
+
value: number;
|
|
18
|
+
mode: RatioMode;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Скругление углов в логических пикселях; на клиенте — в rem.
|
|
22
|
+
*/
|
|
23
|
+
radius?: RadiusPx;
|
|
24
|
+
/**
|
|
25
|
+
* Поведение flex-item внутри родительского stack: `{ grow }`, `{ basis }` или явные поля.
|
|
26
|
+
*/
|
|
27
|
+
flexItem?: FlexItemSpec;
|
|
28
|
+
} & OutputProperties;
|
|
29
|
+
/**
|
|
30
|
+
* Конфигурация инициализации компонента вывода изображения.
|
|
31
|
+
* @property ratio Соотношение сторон и режим вписывания.
|
|
32
|
+
* @property radius Скругление (логические px).
|
|
33
|
+
* @property onClick Обработчики нажатия на изображение.
|
|
34
|
+
*/
|
|
35
|
+
export type ImageInitConfig<ComponentType extends Componentable = Image, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends ImageProperties = ImageProperties> = {
|
|
36
|
+
ratio?: {
|
|
37
|
+
value: number;
|
|
38
|
+
mode: RatioMode;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Скругление углов в логических пикселях; на клиенте — в rem.
|
|
42
|
+
*/
|
|
43
|
+
radius?: RadiusPx;
|
|
44
|
+
/**
|
|
45
|
+
* Поведение flex-item внутри родительского stack: `{ grow }`, `{ basis }` или явные поля.
|
|
46
|
+
*/
|
|
47
|
+
flexItem?: FlexItemSpec;
|
|
48
|
+
onClick?: ServerComponentAction<ComponentType> | ServerComponentAction<ComponentType>[];
|
|
49
|
+
} & OutputInitConfig<string, ComponentType, RefType, PropertiesType>;
|
|
50
|
+
type DefaultInitConfigType<RefType extends ContextRef<any, any>> = ImageInitConfig<any, RefType>;
|
|
51
|
+
type ImageValueOrRef<RefType extends ContextRef<any, any>> = string | CompatibleOutputRef<string, RefType>;
|
|
52
|
+
export declare function image<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: ImageValueOrRef<RefType>): Image<RefType>;
|
|
53
|
+
export declare function image<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: ImageValueOrRef<RefType>): Image<RefType>;
|
|
54
|
+
export declare function image<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: ImageInitConfig<any, RefType>): Image<RefType>;
|
|
55
|
+
/**
|
|
56
|
+
* Компонент для вывода изображения.
|
|
57
|
+
*/
|
|
58
|
+
export declare class Image<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends ImageProperties = ImageProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
|
|
59
|
+
/**
|
|
60
|
+
* Создает экземпляр изображения.
|
|
61
|
+
* @param config Конфигурация инициализации изображения.
|
|
62
|
+
*/
|
|
63
|
+
constructor(config: DefaultInitConfigType<RefType>);
|
|
64
|
+
protected class(): ServerComponentClass;
|
|
65
|
+
/**
|
|
66
|
+
* Инициализирует свойства компонента вывода изображения.
|
|
67
|
+
*
|
|
68
|
+
* @param initValues Конфигурация инициализации.
|
|
69
|
+
* @returns Объект свойств компонента.
|
|
70
|
+
*/
|
|
71
|
+
protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
|
|
72
|
+
protected serializeRuleOverrides(overrides: Partial<PropertiesType>): Record<string, unknown>;
|
|
73
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Image = exports.ImageMode = exports.RatioMode = void 0;
|
|
4
|
+
exports.image = image;
|
|
5
|
+
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
6
|
+
const flex_item_1 = require("@matreshka/shared/types/flex-item");
|
|
7
|
+
const core_1 = require("../../core");
|
|
8
|
+
const output_component_1 = require("./output-component");
|
|
9
|
+
var ratio_mode_1 = require("@matreshka/shared/enums/ratio-mode");
|
|
10
|
+
Object.defineProperty(exports, "RatioMode", { enumerable: true, get: function () { return ratio_mode_1.RatioMode; } });
|
|
11
|
+
/** @deprecated Use RatioMode instead */
|
|
12
|
+
var ratio_mode_2 = require("@matreshka/shared/enums/ratio-mode");
|
|
13
|
+
Object.defineProperty(exports, "ImageMode", { enumerable: true, get: function () { return ratio_mode_2.RatioMode; } });
|
|
14
|
+
function image(arg0, arg1) {
|
|
15
|
+
if (arg1 !== undefined) {
|
|
16
|
+
return new Image((0, output_component_1.outputValueRefToConfig)(arg1, arg0));
|
|
17
|
+
}
|
|
18
|
+
const single = arg0;
|
|
19
|
+
if (typeof single === "string" || single instanceof core_1.ContextRef) {
|
|
20
|
+
return new Image((0, output_component_1.outputValueRefToConfig)(single, {}));
|
|
21
|
+
}
|
|
22
|
+
return new Image(single);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Компонент для вывода изображения.
|
|
26
|
+
*/
|
|
27
|
+
class Image extends output_component_1.OutputComponent {
|
|
28
|
+
/**
|
|
29
|
+
* Создает экземпляр изображения.
|
|
30
|
+
* @param config Конфигурация инициализации изображения.
|
|
31
|
+
*/
|
|
32
|
+
constructor(config) {
|
|
33
|
+
super(config);
|
|
34
|
+
if (config.onClick) {
|
|
35
|
+
this.bindActions("click", config.onClick);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class() {
|
|
39
|
+
return server_component_class_1.ServerComponentClass.Image;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Инициализирует свойства компонента вывода изображения.
|
|
43
|
+
*
|
|
44
|
+
* @param initValues Конфигурация инициализации.
|
|
45
|
+
* @returns Объект свойств компонента.
|
|
46
|
+
*/
|
|
47
|
+
initProperties(initValues) {
|
|
48
|
+
return {
|
|
49
|
+
...super.initProperties(initValues),
|
|
50
|
+
ratio: initValues.ratio,
|
|
51
|
+
radius: initValues.radius,
|
|
52
|
+
flexItem: (0, flex_item_1.normalizeFlexItem)(initValues.flexItem),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
serializeRuleOverrides(overrides) {
|
|
56
|
+
const out = { ...overrides };
|
|
57
|
+
if (overrides.flexItem !== undefined) {
|
|
58
|
+
out.flexItem = (0, flex_item_1.normalizeFlexItem)(overrides.flexItem);
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.Image = Image;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
2
|
+
import { Componentable, ContextRef, StandaloneComponent } from "../../core";
|
|
3
|
+
import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
|
|
4
|
+
type NumericValue = number;
|
|
5
|
+
/**
|
|
6
|
+
* Свойства компонента вывода числа.
|
|
7
|
+
*/
|
|
8
|
+
export type NumberProperties = {} & OutputProperties;
|
|
9
|
+
/**
|
|
10
|
+
* Конфигурация инициализации компонента вывода числа.
|
|
11
|
+
*/
|
|
12
|
+
export type NumberInitConfig<ComponentType extends Componentable = Number, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends NumberProperties = NumberProperties> = {} & OutputInitConfig<NumericValue, ComponentType, RefType, PropertiesType>;
|
|
13
|
+
type DefaultInitConfigType<RefType extends ContextRef<any, any>> = NumberInitConfig<Number, RefType>;
|
|
14
|
+
type NumberValueOrRef<RefType extends ContextRef<any, any>> = NumericValue | CompatibleOutputRef<NumericValue, RefType>;
|
|
15
|
+
export declare function number<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: NumberValueOrRef<RefType>): Number<RefType>;
|
|
16
|
+
export declare function number<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: NumberValueOrRef<RefType>): Number<RefType>;
|
|
17
|
+
export declare function number<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: NumberInitConfig<Number, RefType>): Number<RefType>;
|
|
18
|
+
/**
|
|
19
|
+
* Компонент для вывода числа. Поддерживает вывод вещественных чисел и разделение на порядки с учетом локали клиента
|
|
20
|
+
*
|
|
21
|
+
* Наследуется от {@link OutputComponent}.
|
|
22
|
+
*/
|
|
23
|
+
export declare class Number<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends NumberProperties = NumberProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
|
|
24
|
+
constructor(config: DefaultInitConfigType<RefType>);
|
|
25
|
+
/**
|
|
26
|
+
* Возвращает идентификатор типа вывода.
|
|
27
|
+
*
|
|
28
|
+
* @returns Строка "number".
|
|
29
|
+
*/
|
|
30
|
+
protected class(): ServerComponentClass;
|
|
31
|
+
/**
|
|
32
|
+
* Инициализирует свойства компонента вывода текста.
|
|
33
|
+
*
|
|
34
|
+
* @param initValues Конфигурация инициализации.
|
|
35
|
+
* @returns Объект свойств компонента.
|
|
36
|
+
*/
|
|
37
|
+
protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Number = void 0;
|
|
4
|
+
exports.number = number;
|
|
5
|
+
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
6
|
+
const core_1 = require("../../core");
|
|
7
|
+
const output_component_1 = require("./output-component");
|
|
8
|
+
function number(arg0, arg1) {
|
|
9
|
+
if (arg1 !== undefined) {
|
|
10
|
+
return new Number((0, output_component_1.outputValueRefToConfig)(arg1, arg0));
|
|
11
|
+
}
|
|
12
|
+
const single = arg0;
|
|
13
|
+
if (typeof single === "number" || single instanceof core_1.ContextRef) {
|
|
14
|
+
return new Number((0, output_component_1.outputValueRefToConfig)(single, {}));
|
|
15
|
+
}
|
|
16
|
+
return new Number(single);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Компонент для вывода числа. Поддерживает вывод вещественных чисел и разделение на порядки с учетом локали клиента
|
|
20
|
+
*
|
|
21
|
+
* Наследуется от {@link OutputComponent}.
|
|
22
|
+
*/
|
|
23
|
+
class Number extends output_component_1.OutputComponent {
|
|
24
|
+
constructor(config) {
|
|
25
|
+
super(config);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Возвращает идентификатор типа вывода.
|
|
29
|
+
*
|
|
30
|
+
* @returns Строка "number".
|
|
31
|
+
*/
|
|
32
|
+
class() {
|
|
33
|
+
return server_component_class_1.ServerComponentClass.Number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Инициализирует свойства компонента вывода текста.
|
|
37
|
+
*
|
|
38
|
+
* @param initValues Конфигурация инициализации.
|
|
39
|
+
* @returns Объект свойств компонента.
|
|
40
|
+
*/
|
|
41
|
+
initProperties(initValues) {
|
|
42
|
+
return {
|
|
43
|
+
...super.initProperties(initValues),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.Number = Number;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Componentable, ContextRef, ContextRefValue, StandaloneComponent } from "../../core";
|
|
2
|
+
import { Component, ComponentInitConfig, ComponentProperties } from "../component";
|
|
3
|
+
/**
|
|
4
|
+
* Конфигурация инициализации для компонента вывода.
|
|
5
|
+
*
|
|
6
|
+
* @template T Тип значения компонента.
|
|
7
|
+
*
|
|
8
|
+
* @property ref Ссылка на значение в контексте, откуда будет браться значение.
|
|
9
|
+
* @property value Статическое значение.
|
|
10
|
+
*/
|
|
11
|
+
type RefCompatibleValue<ValueType> = Exclude<ValueType, ContextRef<any, any>>;
|
|
12
|
+
export type CompatibleOutputRef<ValueType, RefType extends ContextRef<any, any>> = RefCompatibleValue<ValueType> extends ContextRefValue<RefType> ? RefType : never;
|
|
13
|
+
export type OutputInitConfig<ValueType, ComponentType extends Componentable = OutputComponent, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends OutputProperties = OutputProperties> = ({
|
|
14
|
+
ref: CompatibleOutputRef<ValueType, RefType>;
|
|
15
|
+
} | {
|
|
16
|
+
value: ValueType;
|
|
17
|
+
}) & ComponentInitConfig<ComponentType, PropertiesType>;
|
|
18
|
+
/**
|
|
19
|
+
* Свойства компонента вывода.
|
|
20
|
+
*
|
|
21
|
+
* @property ref Ссылка на значение в контексте.
|
|
22
|
+
*/
|
|
23
|
+
export type OutputProperties = {
|
|
24
|
+
value?: unknown;
|
|
25
|
+
ref?: string;
|
|
26
|
+
} & ComponentProperties;
|
|
27
|
+
type DefaultInitConfigType<ValueType> = OutputInitConfig<ValueType, OutputComponent>;
|
|
28
|
+
/**
|
|
29
|
+
* Абстрактный базовый класс для компонентов вывода.
|
|
30
|
+
*
|
|
31
|
+
* @template InitConfigType Тип конфигурации инициализации компонента.
|
|
32
|
+
* @template PropertiesType Тип свойств компонента.
|
|
33
|
+
*
|
|
34
|
+
* Реализует интерфейс StandaloneComponent.
|
|
35
|
+
*/
|
|
36
|
+
export declare abstract class OutputComponent<InitConfigType extends OutputInitConfig<unknown, any> = DefaultInitConfigType<unknown>, PropertiesType extends OutputProperties = OutputProperties> extends Component<InitConfigType, PropertiesType> implements StandaloneComponent {
|
|
37
|
+
/**
|
|
38
|
+
* Возвращает флаг, указывающий, что компонент является самостоятельным.
|
|
39
|
+
* @returns Всегда true.
|
|
40
|
+
*/
|
|
41
|
+
standalone(): true;
|
|
42
|
+
/**
|
|
43
|
+
* Инициализирует свойства компонента на основе конфигурации.
|
|
44
|
+
*
|
|
45
|
+
* @param initValues Объект инициализации компонента.
|
|
46
|
+
* @returns Объект свойств компонента.
|
|
47
|
+
*/
|
|
48
|
+
protected initProperties(initValues: InitConfigType): PropertiesType;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Первая аргумент-мост для фабрик output: литерал `value` или экземпляр {@link ContextRef}.
|
|
52
|
+
*/
|
|
53
|
+
export declare function outputValueRefToConfig<TOpts extends object>(valueOrRef: unknown, opts: TOpts): TOpts & ({
|
|
54
|
+
ref: ContextRef<any, any>;
|
|
55
|
+
} | {
|
|
56
|
+
value: unknown;
|
|
57
|
+
});
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OutputComponent = void 0;
|
|
4
|
+
exports.outputValueRefToConfig = outputValueRefToConfig;
|
|
5
|
+
const core_1 = require("../../core");
|
|
6
|
+
const component_1 = require("../component");
|
|
7
|
+
/**
|
|
8
|
+
* Абстрактный базовый класс для компонентов вывода.
|
|
9
|
+
*
|
|
10
|
+
* @template InitConfigType Тип конфигурации инициализации компонента.
|
|
11
|
+
* @template PropertiesType Тип свойств компонента.
|
|
12
|
+
*
|
|
13
|
+
* Реализует интерфейс StandaloneComponent.
|
|
14
|
+
*/
|
|
15
|
+
class OutputComponent extends component_1.Component {
|
|
16
|
+
/**
|
|
17
|
+
* Возвращает флаг, указывающий, что компонент является самостоятельным.
|
|
18
|
+
* @returns Всегда true.
|
|
19
|
+
*/
|
|
20
|
+
standalone() {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Инициализирует свойства компонента на основе конфигурации.
|
|
25
|
+
*
|
|
26
|
+
* @param initValues Объект инициализации компонента.
|
|
27
|
+
* @returns Объект свойств компонента.
|
|
28
|
+
*/
|
|
29
|
+
initProperties(initValues) {
|
|
30
|
+
return {
|
|
31
|
+
...super.initProperties(initValues),
|
|
32
|
+
value: "value" in initValues
|
|
33
|
+
? initValues.value instanceof core_1.ContextRef
|
|
34
|
+
? initValues.value.toString()
|
|
35
|
+
: initValues.value
|
|
36
|
+
: undefined,
|
|
37
|
+
ref: "ref" in initValues ? initValues.ref : undefined,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.OutputComponent = OutputComponent;
|
|
42
|
+
/**
|
|
43
|
+
* Первая аргумент-мост для фабрик output: литерал `value` или экземпляр {@link ContextRef}.
|
|
44
|
+
*/
|
|
45
|
+
function outputValueRefToConfig(valueOrRef, opts) {
|
|
46
|
+
if (valueOrRef instanceof core_1.ContextRef) {
|
|
47
|
+
return { ...opts, ref: valueOrRef };
|
|
48
|
+
}
|
|
49
|
+
return { ...opts, value: valueOrRef };
|
|
50
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
2
|
+
import { Componentable, ContextRef, StandaloneComponent } from "../../core";
|
|
3
|
+
import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
|
|
4
|
+
/**
|
|
5
|
+
* Свойства компонента полоски прогресса.
|
|
6
|
+
*/
|
|
7
|
+
export type ProgressBarProperties = {} & OutputProperties;
|
|
8
|
+
/**
|
|
9
|
+
* Конфигурация инициализации компонента полоски прогресса.
|
|
10
|
+
*/
|
|
11
|
+
export type ProgressBarInitConfig<ComponentType extends Componentable = ProgressBar, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends ProgressBarProperties = ProgressBarProperties> = {} & OutputInitConfig<number, ComponentType, RefType, PropertiesType>;
|
|
12
|
+
type DefaultInitConfigType<RefType extends ContextRef<any, any>> = ProgressBarInitConfig<ProgressBar, RefType>;
|
|
13
|
+
type ProgressBarValueOrRef<RefType extends ContextRef<any, any>> = number | CompatibleOutputRef<number, RefType>;
|
|
14
|
+
export declare function progressBar<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: ProgressBarValueOrRef<RefType>): ProgressBar<RefType>;
|
|
15
|
+
export declare function progressBar<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: ProgressBarValueOrRef<RefType>): ProgressBar<RefType>;
|
|
16
|
+
export declare function progressBar<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: ProgressBarInitConfig<ProgressBar, RefType>): ProgressBar<RefType>;
|
|
17
|
+
/**
|
|
18
|
+
* Компонент для вывода полоски прогресса.
|
|
19
|
+
* @experimental TODO: Требуется доработка отображения в overlay.
|
|
20
|
+
* Наследуется от {@link OutputComponent}.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ProgressBar<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends ProgressBarProperties = ProgressBarProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
|
|
23
|
+
constructor(config: DefaultInitConfigType<RefType>);
|
|
24
|
+
protected class(): ServerComponentClass;
|
|
25
|
+
/**
|
|
26
|
+
* Инициализирует свойства компонента полоски прогресса.
|
|
27
|
+
*
|
|
28
|
+
* @param initValues Конфигурация инициализации.
|
|
29
|
+
* @returns Объект свойств компонента.
|
|
30
|
+
*/
|
|
31
|
+
protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProgressBar = void 0;
|
|
4
|
+
exports.progressBar = progressBar;
|
|
5
|
+
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
6
|
+
const core_1 = require("../../core");
|
|
7
|
+
const output_component_1 = require("./output-component");
|
|
8
|
+
function progressBar(arg0, arg1) {
|
|
9
|
+
if (arg1 !== undefined) {
|
|
10
|
+
return new ProgressBar((0, output_component_1.outputValueRefToConfig)(arg1, arg0));
|
|
11
|
+
}
|
|
12
|
+
const single = arg0;
|
|
13
|
+
if (typeof single === "number" || single instanceof core_1.ContextRef) {
|
|
14
|
+
return new ProgressBar((0, output_component_1.outputValueRefToConfig)(single, {}));
|
|
15
|
+
}
|
|
16
|
+
return new ProgressBar(single);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Компонент для вывода полоски прогресса.
|
|
20
|
+
* @experimental TODO: Требуется доработка отображения в overlay.
|
|
21
|
+
* Наследуется от {@link OutputComponent}.
|
|
22
|
+
*/
|
|
23
|
+
class ProgressBar extends output_component_1.OutputComponent {
|
|
24
|
+
constructor(config) {
|
|
25
|
+
super(config);
|
|
26
|
+
}
|
|
27
|
+
class() {
|
|
28
|
+
return server_component_class_1.ServerComponentClass.ProgressBar;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Инициализирует свойства компонента полоски прогресса.
|
|
32
|
+
*
|
|
33
|
+
* @param initValues Конфигурация инициализации.
|
|
34
|
+
* @returns Объект свойств компонента.
|
|
35
|
+
*/
|
|
36
|
+
initProperties(initValues) {
|
|
37
|
+
return {
|
|
38
|
+
...super.initProperties(initValues),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.ProgressBar = ProgressBar;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
2
|
+
import { Componentable, ContextRef, StandaloneComponent } from "../../core";
|
|
3
|
+
import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
|
|
4
|
+
/**
|
|
5
|
+
* Свойства компонента вывода прогресса.
|
|
6
|
+
*/
|
|
7
|
+
export type ProgressSpinnerProperties = {
|
|
8
|
+
background?: boolean;
|
|
9
|
+
} & OutputProperties;
|
|
10
|
+
/**
|
|
11
|
+
* Конфигурация инициализации компонента вывода числа.
|
|
12
|
+
*/
|
|
13
|
+
export type ProgressSpinnerInitConfig<ComponentType extends Componentable = ProgressSpinner, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends ProgressSpinnerProperties = ProgressSpinnerProperties> = {
|
|
14
|
+
background?: boolean;
|
|
15
|
+
} & OutputInitConfig<number, ComponentType, RefType, PropertiesType>;
|
|
16
|
+
type DefaultInitConfigType<RefType extends ContextRef<any, any>> = ProgressSpinnerInitConfig<ProgressSpinner, RefType>;
|
|
17
|
+
type SpinnerValueOrRef<RefType extends ContextRef<any, any>> = number | CompatibleOutputRef<number, RefType>;
|
|
18
|
+
export declare function progressSpinner<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: SpinnerValueOrRef<RefType>): ProgressSpinner<RefType>;
|
|
19
|
+
export declare function progressSpinner<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: SpinnerValueOrRef<RefType>): ProgressSpinner<RefType>;
|
|
20
|
+
export declare function progressSpinner<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: ProgressSpinnerInitConfig<ProgressSpinner, RefType>): ProgressSpinner<RefType>;
|
|
21
|
+
/**
|
|
22
|
+
* Компонент для вывода прогресса.
|
|
23
|
+
* @experimental TODO: Требуется доработка отображения в overlay.
|
|
24
|
+
* Наследуется от {@link OutputComponent}.
|
|
25
|
+
*/
|
|
26
|
+
export declare class ProgressSpinner<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends ProgressSpinnerProperties = ProgressSpinnerProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
|
|
27
|
+
constructor(config: DefaultInitConfigType<RefType>);
|
|
28
|
+
protected class(): ServerComponentClass;
|
|
29
|
+
/**
|
|
30
|
+
* Инициализирует свойства компонента вывода прогресса.
|
|
31
|
+
*
|
|
32
|
+
* @param initValues Конфигурация инициализации.
|
|
33
|
+
* @returns Объект свойств компонента.
|
|
34
|
+
*/
|
|
35
|
+
protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProgressSpinner = void 0;
|
|
4
|
+
exports.progressSpinner = progressSpinner;
|
|
5
|
+
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
6
|
+
const core_1 = require("../../core");
|
|
7
|
+
const output_component_1 = require("./output-component");
|
|
8
|
+
function progressSpinner(arg0, arg1) {
|
|
9
|
+
if (arg1 !== undefined) {
|
|
10
|
+
return new ProgressSpinner((0, output_component_1.outputValueRefToConfig)(arg1, arg0));
|
|
11
|
+
}
|
|
12
|
+
const single = arg0;
|
|
13
|
+
if (typeof single === "number" || single instanceof core_1.ContextRef) {
|
|
14
|
+
return new ProgressSpinner((0, output_component_1.outputValueRefToConfig)(single, {}));
|
|
15
|
+
}
|
|
16
|
+
return new ProgressSpinner(single);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Компонент для вывода прогресса.
|
|
20
|
+
* @experimental TODO: Требуется доработка отображения в overlay.
|
|
21
|
+
* Наследуется от {@link OutputComponent}.
|
|
22
|
+
*/
|
|
23
|
+
class ProgressSpinner extends output_component_1.OutputComponent {
|
|
24
|
+
constructor(config) {
|
|
25
|
+
super(config);
|
|
26
|
+
}
|
|
27
|
+
class() {
|
|
28
|
+
return server_component_class_1.ServerComponentClass.ProgressSpinner;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Инициализирует свойства компонента вывода прогресса.
|
|
32
|
+
*
|
|
33
|
+
* @param initValues Конфигурация инициализации.
|
|
34
|
+
* @returns Объект свойств компонента.
|
|
35
|
+
*/
|
|
36
|
+
initProperties(initValues) {
|
|
37
|
+
return {
|
|
38
|
+
...super.initProperties(initValues),
|
|
39
|
+
background: initValues.background,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.ProgressSpinner = ProgressSpinner;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
2
|
+
import { Componentable, ContextRef } from "../../core";
|
|
3
|
+
import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
|
|
4
|
+
export type QrCodeProperties = {} & OutputProperties;
|
|
5
|
+
/**
|
|
6
|
+
* Конфигурация инициализации компонента QR-кода.
|
|
7
|
+
*/
|
|
8
|
+
export type QrCodeInitConfig<ComponentType extends Componentable = QrCode, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends QrCodeProperties = QrCodeProperties> = {} & OutputInitConfig<string, ComponentType, RefType, PropertiesType>;
|
|
9
|
+
type DefaultInitConfigType<RefType extends ContextRef<any, any>> = QrCodeInitConfig<QrCode, RefType>;
|
|
10
|
+
type QrValueOrRef<RefType extends ContextRef<any, any>> = string | CompatibleOutputRef<string, RefType>;
|
|
11
|
+
export declare function qrCode<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: QrValueOrRef<RefType>): QrCode<RefType>;
|
|
12
|
+
export declare function qrCode<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: QrValueOrRef<RefType>): QrCode<RefType>;
|
|
13
|
+
export declare function qrCode<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: QrCodeInitConfig<QrCode, RefType>): QrCode<RefType>;
|
|
14
|
+
/**
|
|
15
|
+
* Компонент для отображения QR-кода.
|
|
16
|
+
*/
|
|
17
|
+
export declare class QrCode<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends QrCodeProperties = QrCodeProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
|
|
18
|
+
constructor(config: DefaultInitConfigType<RefType>);
|
|
19
|
+
protected class(): ServerComponentClass;
|
|
20
|
+
/**
|
|
21
|
+
* Инициализирует свойства компонента QR-кода.
|
|
22
|
+
*
|
|
23
|
+
* @param initValues Конфигурация инициализации.
|
|
24
|
+
* @returns Объект состояния компонента.
|
|
25
|
+
*/
|
|
26
|
+
protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QrCode = void 0;
|
|
4
|
+
exports.qrCode = qrCode;
|
|
5
|
+
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
6
|
+
const core_1 = require("../../core");
|
|
7
|
+
const output_component_1 = require("./output-component");
|
|
8
|
+
function qrCode(arg0, arg1) {
|
|
9
|
+
if (arg1 !== undefined) {
|
|
10
|
+
return new QrCode((0, output_component_1.outputValueRefToConfig)(arg1, arg0));
|
|
11
|
+
}
|
|
12
|
+
const single = arg0;
|
|
13
|
+
if (typeof single === "string" || single instanceof core_1.ContextRef) {
|
|
14
|
+
return new QrCode((0, output_component_1.outputValueRefToConfig)(single, {}));
|
|
15
|
+
}
|
|
16
|
+
return new QrCode(single);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Компонент для отображения QR-кода.
|
|
20
|
+
*/
|
|
21
|
+
class QrCode extends output_component_1.OutputComponent {
|
|
22
|
+
constructor(config) {
|
|
23
|
+
super(config);
|
|
24
|
+
}
|
|
25
|
+
class() {
|
|
26
|
+
return server_component_class_1.ServerComponentClass.QrCode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Инициализирует свойства компонента QR-кода.
|
|
30
|
+
*
|
|
31
|
+
* @param initValues Конфигурация инициализации.
|
|
32
|
+
* @returns Объект состояния компонента.
|
|
33
|
+
*/
|
|
34
|
+
initProperties(initValues) {
|
|
35
|
+
return {
|
|
36
|
+
...super.initProperties(initValues),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.QrCode = QrCode;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
2
|
+
import type { TextOutputProcessorAutolinkConfig, TextOutputProcessorConfig, TextOutputProcessorLineBreaksConfig } from "@matreshka/shared/types/text-output-processor-config";
|
|
3
|
+
import { Componentable, ContextRef, StandaloneComponent } from "../../core";
|
|
4
|
+
import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
|
|
5
|
+
export { TextOutputAutolinkScheme } from "@matreshka/shared/enums/text-output-autolink-scheme";
|
|
6
|
+
export { TextOutputAutolinkTarget } from "@matreshka/shared/enums/text-output-autolink-target";
|
|
7
|
+
export { TextOutputProcessor } from "@matreshka/shared/enums/text-output-processor";
|
|
8
|
+
/**
|
|
9
|
+
* Свойства компонента вывода текста.
|
|
10
|
+
*/
|
|
11
|
+
export type TextProperties = {
|
|
12
|
+
/**
|
|
13
|
+
* Максимальное количество строк, которое может занимать текст.
|
|
14
|
+
* При переполнении текст обрезается с многоточием.
|
|
15
|
+
*/
|
|
16
|
+
maxLines?: number;
|
|
17
|
+
processors?: TextOutputProcessorConfig[];
|
|
18
|
+
} & OutputProperties;
|
|
19
|
+
/**
|
|
20
|
+
* Конфигурация инициализации компонента вывода текста.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export type TextInitConfig<ComponentType extends Componentable = Text, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends TextProperties = TextProperties> = {
|
|
24
|
+
/**
|
|
25
|
+
* Максимальное количество строк, которое может занимать текст.
|
|
26
|
+
*/
|
|
27
|
+
maxLines?: number;
|
|
28
|
+
processors?: TextOutputProcessorConfig[];
|
|
29
|
+
} & OutputInitConfig<string, ComponentType, RefType, PropertiesType>;
|
|
30
|
+
type DefaultInitConfigType<RefType extends ContextRef<any, any>> = TextInitConfig<Text, RefType>;
|
|
31
|
+
type TextValueOrRef<RefType extends ContextRef<any, any>> = string | CompatibleOutputRef<string, RefType>;
|
|
32
|
+
export declare function lineBreaks(): TextOutputProcessorLineBreaksConfig;
|
|
33
|
+
export declare function autolink(options?: Omit<TextOutputProcessorAutolinkConfig, "processor">): TextOutputProcessorAutolinkConfig;
|
|
34
|
+
export declare function text<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: TextValueOrRef<RefType>): Text<RefType>;
|
|
35
|
+
export declare function text<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: TextValueOrRef<RefType>): Text<RefType>;
|
|
36
|
+
export declare function text<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: TextInitConfig<Text, RefType>): Text<RefType>;
|
|
37
|
+
/**
|
|
38
|
+
* Компонент для вывода текста.
|
|
39
|
+
*
|
|
40
|
+
* Наследуется от {@link OutputComponent}.
|
|
41
|
+
*/
|
|
42
|
+
export declare class Text<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends TextProperties = TextProperties> extends OutputComponent<TextInitConfig<Text, RefType>, PropertiesType> implements StandaloneComponent {
|
|
43
|
+
constructor(config: TextInitConfig<Text, RefType>);
|
|
44
|
+
/**
|
|
45
|
+
* Возвращает идентификатор типа вывода.
|
|
46
|
+
*
|
|
47
|
+
* @returns Строка "text".
|
|
48
|
+
*/
|
|
49
|
+
protected class(): ServerComponentClass;
|
|
50
|
+
/**
|
|
51
|
+
* Инициализирует свойства компонента вывода текста.
|
|
52
|
+
*
|
|
53
|
+
* @param initValues Конфигурация инициализации.
|
|
54
|
+
* @returns Объект свойств компонента.
|
|
55
|
+
*/
|
|
56
|
+
protected initProperties(initValues: TextInitConfig<Text, RefType>): PropertiesType;
|
|
57
|
+
}
|