@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,83 @@
|
|
|
1
|
+
import { MapMarkerHorizontalAnchor } from "@matreshka/shared/enums/map-marker-horizontal-anchor";
|
|
2
|
+
import { MapMarkerVerticalAnchor } from "@matreshka/shared/enums/map-marker-vertical-anchor";
|
|
3
|
+
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
4
|
+
import type { MapConfig } from "@matreshka/shared/types/map-config";
|
|
5
|
+
import type { NestedItemBase } from "@matreshka/shared/types/nested-item-base";
|
|
6
|
+
import { type FlexItemSpec } from "@matreshka/shared/types/flex-item";
|
|
7
|
+
import { Componentable, ComponentInstance, ComponentTreeNode, StandaloneComponent } from "../core";
|
|
8
|
+
import { Component, ComponentInitConfig, ComponentProperties, ServerComponentAction } from "./component";
|
|
9
|
+
import type { ItemList } from "./item-list/item-list";
|
|
10
|
+
import type { ItemListHost } from "./item-list/item-list-host";
|
|
11
|
+
import { Overlay } from "./types/container-overlay";
|
|
12
|
+
export declare const map: (config: MapInitConfig<Map>) => Map;
|
|
13
|
+
export type MapMarker = {
|
|
14
|
+
coordinates: {
|
|
15
|
+
latitude: number;
|
|
16
|
+
longitude: number;
|
|
17
|
+
};
|
|
18
|
+
width: number;
|
|
19
|
+
anchor?: {
|
|
20
|
+
vertical?: MapMarkerVerticalAnchor;
|
|
21
|
+
horizontal?: MapMarkerHorizontalAnchor;
|
|
22
|
+
};
|
|
23
|
+
component: ComponentTreeNode;
|
|
24
|
+
};
|
|
25
|
+
export type MapMarkerEntry = MapMarker | ItemList<any, MapMarker>;
|
|
26
|
+
export type MapProperties = {
|
|
27
|
+
apiKey: string;
|
|
28
|
+
center: {
|
|
29
|
+
latitude: number;
|
|
30
|
+
longitude: number;
|
|
31
|
+
altitude?: number;
|
|
32
|
+
};
|
|
33
|
+
zoom: number;
|
|
34
|
+
overlays?: Overlay[];
|
|
35
|
+
flexItem?: FlexItemSpec;
|
|
36
|
+
} & ComponentProperties;
|
|
37
|
+
export type MapInitConfig<ComponentType extends Componentable = Map, PropertiesType extends MapProperties = MapProperties> = {
|
|
38
|
+
center: {
|
|
39
|
+
latitude: number;
|
|
40
|
+
longitude: number;
|
|
41
|
+
altitude?: number;
|
|
42
|
+
};
|
|
43
|
+
overlays?: Overlay[];
|
|
44
|
+
apiKey: string;
|
|
45
|
+
zoom?: number;
|
|
46
|
+
flexItem?: FlexItemSpec;
|
|
47
|
+
markers?: MapMarkerEntry[];
|
|
48
|
+
onCenterChange?: ServerComponentAction<ComponentType, {
|
|
49
|
+
latitude: number;
|
|
50
|
+
longitude: number;
|
|
51
|
+
altitude?: number;
|
|
52
|
+
}> | ServerComponentAction<ComponentType, {
|
|
53
|
+
latitude: number;
|
|
54
|
+
longitude: number;
|
|
55
|
+
altitude?: number;
|
|
56
|
+
}>[];
|
|
57
|
+
onZoomChange?: ServerComponentAction<ComponentType, number> | ServerComponentAction<ComponentType, number>[];
|
|
58
|
+
} & ComponentInitConfig<ComponentType, PropertiesType>;
|
|
59
|
+
type DefaultInitConfigType = MapInitConfig<Map>;
|
|
60
|
+
export declare class Map<InitConfigType extends MapInitConfig<any> = DefaultInitConfigType, PropertiesType extends MapProperties = MapProperties> extends Component<InitConfigType, PropertiesType> implements StandaloneComponent, ItemListHost {
|
|
61
|
+
private readonly markersSlot;
|
|
62
|
+
private readonly itemListHostAdapter;
|
|
63
|
+
setCenter(center: {
|
|
64
|
+
latitude: number;
|
|
65
|
+
longitude: number;
|
|
66
|
+
altitude?: number;
|
|
67
|
+
}, instances?: ComponentInstance[]): void;
|
|
68
|
+
setZoom(zoom: number, instances?: ComponentInstance[]): void;
|
|
69
|
+
zoomIn(instances?: ComponentInstance[]): void;
|
|
70
|
+
zoomOut(instances?: ComponentInstance[]): void;
|
|
71
|
+
constructor(config: InitConfigType);
|
|
72
|
+
get hostInstances(): readonly ComponentInstance[];
|
|
73
|
+
syncNestedItems(slot: string, items: NestedItemBase[]): void;
|
|
74
|
+
resyncNestedSlot(slot: string): void;
|
|
75
|
+
protected class(): ServerComponentClass;
|
|
76
|
+
standalone(): true;
|
|
77
|
+
protected initProperties(initValues: InitConfigType): PropertiesType;
|
|
78
|
+
protected serializeRuleOverrides(overrides: Partial<PropertiesType & {
|
|
79
|
+
markers?: MapMarkerEntry[];
|
|
80
|
+
}>): Record<string, unknown>;
|
|
81
|
+
serialize(instance?: ComponentInstance<this>): MapConfig;
|
|
82
|
+
}
|
|
83
|
+
export { itemList } from "./item-list";
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.itemList = exports.Map = exports.map = void 0;
|
|
4
|
+
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
5
|
+
const map_set_center_message_1 = require("@matreshka/shared/messages/bff-to-client/components/map/map-set-center-message");
|
|
6
|
+
const map_set_zoom_message_1 = require("@matreshka/shared/messages/bff-to-client/components/map/map-set-zoom-message");
|
|
7
|
+
const map_zoom_in_message_1 = require("@matreshka/shared/messages/bff-to-client/components/map/map-zoom-in-message");
|
|
8
|
+
const map_zoom_out_message_1 = require("@matreshka/shared/messages/bff-to-client/components/map/map-zoom-out-message");
|
|
9
|
+
const flex_item_1 = require("@matreshka/shared/types/flex-item");
|
|
10
|
+
const core_1 = require("../core");
|
|
11
|
+
const component_1 = require("./component");
|
|
12
|
+
const item_list_1 = require("./item-list");
|
|
13
|
+
const flatten_nested_items_1 = require("./item-list/flatten-nested-items");
|
|
14
|
+
const map = (config) => new Map(config);
|
|
15
|
+
exports.map = map;
|
|
16
|
+
class Map extends component_1.Component {
|
|
17
|
+
setCenter(center, instances) {
|
|
18
|
+
if (instances) {
|
|
19
|
+
instances
|
|
20
|
+
.filter((instance) => instance.client)
|
|
21
|
+
.forEach((instance) => {
|
|
22
|
+
instance.client.outcomingMessage$.next(new map_set_center_message_1.MapSetCenterMessage(instance.id, center));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.broadcast(new map_set_center_message_1.MapSetCenterMessage(this.id, center));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
setZoom(zoom, instances) {
|
|
30
|
+
if (instances) {
|
|
31
|
+
instances
|
|
32
|
+
.filter((instance) => instance.client)
|
|
33
|
+
.forEach((instance) => {
|
|
34
|
+
instance.client.outcomingMessage$.next(new map_set_zoom_message_1.MapSetZoomMessage(instance.id, zoom));
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.broadcast(new map_set_zoom_message_1.MapSetZoomMessage(this.id, zoom));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
zoomIn(instances) {
|
|
42
|
+
if (instances) {
|
|
43
|
+
instances
|
|
44
|
+
.filter((instance) => instance.client)
|
|
45
|
+
.forEach((instance) => {
|
|
46
|
+
instance.client.outcomingMessage$.next(new map_zoom_in_message_1.MapZoomInMessage(instance.id));
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.broadcast(new map_zoom_in_message_1.MapZoomInMessage(this.id));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
zoomOut(instances) {
|
|
54
|
+
if (instances) {
|
|
55
|
+
instances
|
|
56
|
+
.filter((instance) => instance.client)
|
|
57
|
+
.forEach((instance) => {
|
|
58
|
+
instance.client.outcomingMessage$.next(new map_zoom_out_message_1.MapZoomOutMessage(instance.id));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.broadcast(new map_zoom_out_message_1.MapZoomOutMessage(this.id));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
constructor(config) {
|
|
66
|
+
const markersSlot = (0, item_list_1.createNestedItemsSlotState)(config.markers);
|
|
67
|
+
(0, item_list_1.wireNestedItemsHostLifecycle)(config, markersSlot.itemLists);
|
|
68
|
+
super(config);
|
|
69
|
+
this.markersSlot = {
|
|
70
|
+
slot: '',
|
|
71
|
+
source: [],
|
|
72
|
+
itemLists: [],
|
|
73
|
+
};
|
|
74
|
+
this.markersSlot.source = markersSlot.source;
|
|
75
|
+
this.markersSlot.itemLists = markersSlot.itemLists;
|
|
76
|
+
(0, item_list_1.attachItemListsToHost)(this, "markers", this.markersSlot);
|
|
77
|
+
this.itemListHostAdapter = (0, item_list_1.createItemListHostAdapter)(() => this.instances, (slot) => (slot === "markers" ? this.markersSlot : undefined));
|
|
78
|
+
if (config.onCenterChange) {
|
|
79
|
+
const actions = config.onCenterChange;
|
|
80
|
+
this.bindActions("center-change", actions);
|
|
81
|
+
}
|
|
82
|
+
if (config.onZoomChange) {
|
|
83
|
+
const actions = config.onZoomChange;
|
|
84
|
+
this.bindActions("zoom-change", actions);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
get hostInstances() {
|
|
88
|
+
return this.instances;
|
|
89
|
+
}
|
|
90
|
+
syncNestedItems(slot, items) {
|
|
91
|
+
this.itemListHostAdapter.syncNestedItems(slot, items);
|
|
92
|
+
}
|
|
93
|
+
resyncNestedSlot(slot) {
|
|
94
|
+
this.itemListHostAdapter.resyncNestedSlot(slot);
|
|
95
|
+
}
|
|
96
|
+
class() {
|
|
97
|
+
return server_component_class_1.ServerComponentClass.Map;
|
|
98
|
+
}
|
|
99
|
+
standalone() {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
initProperties(initValues) {
|
|
103
|
+
return {
|
|
104
|
+
...super.initProperties(initValues),
|
|
105
|
+
apiKey: initValues.apiKey,
|
|
106
|
+
center: initValues.center,
|
|
107
|
+
zoom: initValues.zoom ?? 17,
|
|
108
|
+
overlays: initValues.overlays,
|
|
109
|
+
flexItem: (0, flex_item_1.normalizeFlexItem)(initValues.flexItem),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
serializeRuleOverrides(overrides) {
|
|
113
|
+
const out = { ...overrides };
|
|
114
|
+
if (overrides.overlays !== undefined) {
|
|
115
|
+
out.overlays = (0, core_1.serializeOverlays)(overrides.overlays);
|
|
116
|
+
}
|
|
117
|
+
if (overrides.markers !== undefined) {
|
|
118
|
+
const instance = this.createInstance();
|
|
119
|
+
out.markers = (0, flatten_nested_items_1.flattenNestedItems)(overrides.markers, instance);
|
|
120
|
+
}
|
|
121
|
+
if (overrides.flexItem !== undefined) {
|
|
122
|
+
out.flexItem = (0, flex_item_1.normalizeFlexItem)(overrides.flexItem);
|
|
123
|
+
}
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
126
|
+
serialize(instance) {
|
|
127
|
+
if (!instance) {
|
|
128
|
+
instance = this.createInstance();
|
|
129
|
+
}
|
|
130
|
+
const result = super.serialize(instance);
|
|
131
|
+
const p = this.properties;
|
|
132
|
+
const markers = (0, item_list_1.flattenNestedItemsForSerialize)(this.markersSlot, instance);
|
|
133
|
+
return {
|
|
134
|
+
...result,
|
|
135
|
+
class: server_component_class_1.ServerComponentClass.Map,
|
|
136
|
+
properties: {
|
|
137
|
+
...p,
|
|
138
|
+
overlays: p.overlays ? (0, core_1.serializeOverlays)(p.overlays) : [],
|
|
139
|
+
markers,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.Map = Map;
|
|
145
|
+
var item_list_2 = require("./item-list");
|
|
146
|
+
Object.defineProperty(exports, "itemList", { enumerable: true, get: function () { return item_list_2.itemList; } });
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
* @property color Цвет текста из палитры.
|
|
8
|
+
*/
|
|
9
|
+
export type CurrencyProperties = {
|
|
10
|
+
/**
|
|
11
|
+
* Код валюты (например, "USD", "EUR").
|
|
12
|
+
*/
|
|
13
|
+
currency: string;
|
|
14
|
+
/**
|
|
15
|
+
* Минимальное количество целых разрядов.
|
|
16
|
+
*
|
|
17
|
+
* Прокидывается на клиент в `Intl.NumberFormat` как `minimumIntegerDigits`.
|
|
18
|
+
*/
|
|
19
|
+
minIntegerDigits?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Минимальное количество дробных разрядов.
|
|
22
|
+
*
|
|
23
|
+
* Прокидывается на клиент в `Intl.NumberFormat` как `minimumFractionDigits`.
|
|
24
|
+
*/
|
|
25
|
+
minFractionDigits?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Максимальное количество дробных разрядов.
|
|
28
|
+
*
|
|
29
|
+
* Прокидывается на клиент в `Intl.NumberFormat` как `maximumFractionDigits`.
|
|
30
|
+
*/
|
|
31
|
+
maxFractionDigits?: number;
|
|
32
|
+
} & OutputProperties;
|
|
33
|
+
/**
|
|
34
|
+
* Конфигурация инициализации компонента валюты.
|
|
35
|
+
*/
|
|
36
|
+
export type CurrencyInitConfig<ComponentType extends Componentable = Currency, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends CurrencyProperties = CurrencyProperties> = {
|
|
37
|
+
currency: string;
|
|
38
|
+
minIntegerDigits?: number;
|
|
39
|
+
minFractionDigits?: number;
|
|
40
|
+
maxFractionDigits?: number;
|
|
41
|
+
} & OutputInitConfig<number, ComponentType, RefType, PropertiesType>;
|
|
42
|
+
type DefaultInitConfigType<RefType extends ContextRef<any, any>> = CurrencyInitConfig<Currency, RefType>;
|
|
43
|
+
type CurrencyValueOrRef<RefType extends ContextRef<any, any>> = number | CompatibleOutputRef<number, RefType>;
|
|
44
|
+
export declare function currency<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: CurrencyValueOrRef<RefType>): Currency<RefType>;
|
|
45
|
+
export declare function currency<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: CurrencyInitConfig<Currency, RefType>): Currency<RefType>;
|
|
46
|
+
/**
|
|
47
|
+
* Компонент отображения валюты.
|
|
48
|
+
*
|
|
49
|
+
* Представляет числовое значение с привязкой к конкретной валюте.
|
|
50
|
+
* Поддерживает встроенное отображение.
|
|
51
|
+
*/
|
|
52
|
+
export declare class Currency<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends CurrencyProperties = CurrencyProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
|
|
53
|
+
constructor(config: DefaultInitConfigType<RefType>);
|
|
54
|
+
protected class(): ServerComponentClass;
|
|
55
|
+
/**
|
|
56
|
+
* Инициализирует свойства компонента вывода текста.
|
|
57
|
+
*
|
|
58
|
+
* @param initValues Конфигурация инициализации.
|
|
59
|
+
* @returns Объект свойств компонента.
|
|
60
|
+
*/
|
|
61
|
+
protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Currency = void 0;
|
|
4
|
+
exports.currency = currency;
|
|
5
|
+
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
6
|
+
const output_component_1 = require("./output-component");
|
|
7
|
+
function currency(arg0, arg1) {
|
|
8
|
+
if (arg1 !== undefined) {
|
|
9
|
+
return new Currency((0, output_component_1.outputValueRefToConfig)(arg1, arg0));
|
|
10
|
+
}
|
|
11
|
+
return new Currency(arg0);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Компонент отображения валюты.
|
|
15
|
+
*
|
|
16
|
+
* Представляет числовое значение с привязкой к конкретной валюте.
|
|
17
|
+
* Поддерживает встроенное отображение.
|
|
18
|
+
*/
|
|
19
|
+
class Currency extends output_component_1.OutputComponent {
|
|
20
|
+
constructor(config) {
|
|
21
|
+
super(config);
|
|
22
|
+
}
|
|
23
|
+
class() {
|
|
24
|
+
return server_component_class_1.ServerComponentClass.Currency;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Инициализирует свойства компонента вывода текста.
|
|
28
|
+
*
|
|
29
|
+
* @param initValues Конфигурация инициализации.
|
|
30
|
+
* @returns Объект свойств компонента.
|
|
31
|
+
*/
|
|
32
|
+
initProperties(initValues) {
|
|
33
|
+
return {
|
|
34
|
+
...super.initProperties(initValues),
|
|
35
|
+
currency: initValues.currency,
|
|
36
|
+
minIntegerDigits: initValues.minIntegerDigits,
|
|
37
|
+
minFractionDigits: initValues.minFractionDigits,
|
|
38
|
+
maxFractionDigits: initValues.maxFractionDigits,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.Currency = Currency;
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
* Соответствуют параметрам {@link Intl.DateTimeFormatOptions}.
|
|
8
|
+
*/
|
|
9
|
+
export type DateTimeOptions = {
|
|
10
|
+
timeZone?: string;
|
|
11
|
+
weekday?: "long" | "short" | "narrow";
|
|
12
|
+
era?: "long" | "short" | "narrow";
|
|
13
|
+
year?: "numeric" | "2-digit";
|
|
14
|
+
month?: "numeric" | "2-digit" | "long" | "short" | "narrow";
|
|
15
|
+
day?: "numeric" | "2-digit";
|
|
16
|
+
hour?: "numeric" | "2-digit";
|
|
17
|
+
minute?: "numeric" | "2-digit";
|
|
18
|
+
second?: "numeric" | "2-digit";
|
|
19
|
+
timeZoneName?: "long" | "short" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric";
|
|
20
|
+
dateStyle?: "full" | "long" | "medium" | "short";
|
|
21
|
+
timeStyle?: "full" | "long" | "medium" | "short";
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Свойства компонента вывода даты и времени.
|
|
25
|
+
*
|
|
26
|
+
* @property locales Список локалей.
|
|
27
|
+
* @property options Параметры форматирования даты и времени.
|
|
28
|
+
*/
|
|
29
|
+
export type DatetimeProperties = {
|
|
30
|
+
locales?: string[];
|
|
31
|
+
options?: DateTimeOptions;
|
|
32
|
+
} & OutputProperties;
|
|
33
|
+
/**
|
|
34
|
+
* Конфигурация инициализации компонента вывода даты и времени.
|
|
35
|
+
*
|
|
36
|
+
* @property locales Список локалей для форматирования.
|
|
37
|
+
* @property options Параметры форматирования даты и времени.
|
|
38
|
+
*/
|
|
39
|
+
export type DatetimeInitConfig<ComponentType extends Componentable = Datetime, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends DatetimeProperties = DatetimeProperties> = {
|
|
40
|
+
locales?: string[];
|
|
41
|
+
options?: DateTimeOptions;
|
|
42
|
+
} & OutputInitConfig<string, ComponentType, RefType, PropertiesType>;
|
|
43
|
+
type DefaultInitConfigType<RefType extends ContextRef<any, any>> = DatetimeInitConfig<Datetime, RefType>;
|
|
44
|
+
type DatetimeValueOrRef<RefType extends ContextRef<any, any>> = string | CompatibleOutputRef<string, RefType>;
|
|
45
|
+
export declare function datetime<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: DatetimeValueOrRef<RefType>): Datetime<RefType>;
|
|
46
|
+
export declare function datetime<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: DatetimeValueOrRef<RefType>): Datetime<RefType>;
|
|
47
|
+
export declare function datetime<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: DatetimeInitConfig<Datetime, RefType>): Datetime<RefType>;
|
|
48
|
+
/**
|
|
49
|
+
* Компонент вывода отформатированной даты и времени.
|
|
50
|
+
*
|
|
51
|
+
* Наследуется от {@link OutputComponent} и реализует {@link StandaloneComponent}.
|
|
52
|
+
*/
|
|
53
|
+
export declare class Datetime<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends DatetimeProperties = DatetimeProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
|
|
54
|
+
constructor(config: DefaultInitConfigType<RefType>);
|
|
55
|
+
/**
|
|
56
|
+
* Возвращает идентификатор типа вывода.
|
|
57
|
+
*
|
|
58
|
+
* @returns Строка "datetime".
|
|
59
|
+
*/
|
|
60
|
+
protected class(): ServerComponentClass;
|
|
61
|
+
/**
|
|
62
|
+
* Инициализирует свойства компонента на основе конфигурации.
|
|
63
|
+
*
|
|
64
|
+
* @param initValues Объект начальной конфигурации компонента.
|
|
65
|
+
* @returns Свойства компонента с локалью и параметрами форматирования.
|
|
66
|
+
*/
|
|
67
|
+
protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Datetime = void 0;
|
|
4
|
+
exports.datetime = datetime;
|
|
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 datetime(arg0, arg1) {
|
|
9
|
+
if (arg1 !== undefined) {
|
|
10
|
+
return new Datetime((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 Datetime((0, output_component_1.outputValueRefToConfig)(single, {}));
|
|
15
|
+
}
|
|
16
|
+
return new Datetime(single);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Компонент вывода отформатированной даты и времени.
|
|
20
|
+
*
|
|
21
|
+
* Наследуется от {@link OutputComponent} и реализует {@link StandaloneComponent}.
|
|
22
|
+
*/
|
|
23
|
+
class Datetime extends output_component_1.OutputComponent {
|
|
24
|
+
constructor(config) {
|
|
25
|
+
super(config);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Возвращает идентификатор типа вывода.
|
|
29
|
+
*
|
|
30
|
+
* @returns Строка "datetime".
|
|
31
|
+
*/
|
|
32
|
+
class() {
|
|
33
|
+
return server_component_class_1.ServerComponentClass.Datetime;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Инициализирует свойства компонента на основе конфигурации.
|
|
37
|
+
*
|
|
38
|
+
* @param initValues Объект начальной конфигурации компонента.
|
|
39
|
+
* @returns Свойства компонента с локалью и параметрами форматирования.
|
|
40
|
+
*/
|
|
41
|
+
initProperties(initValues) {
|
|
42
|
+
return {
|
|
43
|
+
...super.initProperties(initValues),
|
|
44
|
+
locales: initValues.locales,
|
|
45
|
+
options: initValues.options,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.Datetime = Datetime;
|
|
@@ -0,0 +1,43 @@
|
|
|
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 IconValue = string;
|
|
5
|
+
/**
|
|
6
|
+
* Свойства компонента вывода иконки.
|
|
7
|
+
*/
|
|
8
|
+
export type IconProperties = {
|
|
9
|
+
/**
|
|
10
|
+
* Размер иконки в логических пикселях; на клиенте конвертируется в rem и задаёт ширину/высоту.
|
|
11
|
+
*/
|
|
12
|
+
size: number;
|
|
13
|
+
} & OutputProperties;
|
|
14
|
+
/**
|
|
15
|
+
* Конфигурация инициализации компонента вывода иконки.
|
|
16
|
+
*/
|
|
17
|
+
export type IconInitConfig<ComponentType extends Componentable = Icon, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends IconProperties = IconProperties> = {
|
|
18
|
+
/**
|
|
19
|
+
* Размер иконки в логических пикселях; на клиенте конвертируется в rem и задаёт ширину/высоту.
|
|
20
|
+
*/
|
|
21
|
+
size: number;
|
|
22
|
+
} & OutputInitConfig<IconValue, ComponentType, RefType, PropertiesType>;
|
|
23
|
+
type DefaultInitConfigType<RefType extends ContextRef<any, any>> = IconInitConfig<Icon, RefType>;
|
|
24
|
+
type IconValueOrRef<RefType extends ContextRef<any, any>> = IconValue | CompatibleOutputRef<IconValue, RefType>;
|
|
25
|
+
export declare function icon<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: IconValueOrRef<RefType>): Icon<RefType>;
|
|
26
|
+
export declare function icon<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: IconInitConfig<Icon, RefType>): Icon<RefType>;
|
|
27
|
+
/**
|
|
28
|
+
* Компонент для отображения иконки.
|
|
29
|
+
*
|
|
30
|
+
* Наследуется от {@link OutputComponent}.
|
|
31
|
+
*/
|
|
32
|
+
export declare class Icon<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends IconProperties = IconProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> implements StandaloneComponent {
|
|
33
|
+
constructor(config: DefaultInitConfigType<RefType>);
|
|
34
|
+
protected class(): ServerComponentClass;
|
|
35
|
+
/**
|
|
36
|
+
* Инициализирует свойства компонента вывода иконки.
|
|
37
|
+
*
|
|
38
|
+
* @param initValues Конфигурация инициализации.
|
|
39
|
+
* @returns Объект свойств компонента.
|
|
40
|
+
*/
|
|
41
|
+
protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Icon = void 0;
|
|
4
|
+
exports.icon = icon;
|
|
5
|
+
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
6
|
+
const output_component_1 = require("./output-component");
|
|
7
|
+
function icon(arg0, arg1) {
|
|
8
|
+
if (arg1 !== undefined) {
|
|
9
|
+
return new Icon((0, output_component_1.outputValueRefToConfig)(arg1, arg0));
|
|
10
|
+
}
|
|
11
|
+
return new Icon(arg0);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Компонент для отображения иконки.
|
|
15
|
+
*
|
|
16
|
+
* Наследуется от {@link OutputComponent}.
|
|
17
|
+
*/
|
|
18
|
+
class Icon extends output_component_1.OutputComponent {
|
|
19
|
+
constructor(config) {
|
|
20
|
+
super(config);
|
|
21
|
+
}
|
|
22
|
+
class() {
|
|
23
|
+
return server_component_class_1.ServerComponentClass.Icon;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Инициализирует свойства компонента вывода иконки.
|
|
27
|
+
*
|
|
28
|
+
* @param initValues Конфигурация инициализации.
|
|
29
|
+
* @returns Объект свойств компонента.
|
|
30
|
+
*/
|
|
31
|
+
initProperties(initValues) {
|
|
32
|
+
return {
|
|
33
|
+
...super.initProperties(initValues),
|
|
34
|
+
size: initValues.size,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Icon = Icon;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { IframeAllow } from "@matreshka/shared/enums/iframe-allow";
|
|
2
|
+
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
3
|
+
import { Componentable, ContextRef } from "../../core";
|
|
4
|
+
import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
|
|
5
|
+
export { IframeAllow } from "@matreshka/shared/enums/iframe-allow";
|
|
6
|
+
/**
|
|
7
|
+
* Свойства компонента вывода iframe.
|
|
8
|
+
*
|
|
9
|
+
* @property allow Список разрешённых возможностей для атрибута `allow` iframe.
|
|
10
|
+
* @property ratio Соотношение сторон iframe через CSS `aspect-ratio`.
|
|
11
|
+
*/
|
|
12
|
+
export type IframeProperties = {
|
|
13
|
+
allow?: IframeAllow[];
|
|
14
|
+
ratio?: {
|
|
15
|
+
value: number;
|
|
16
|
+
};
|
|
17
|
+
} & OutputProperties;
|
|
18
|
+
/**
|
|
19
|
+
* Конфигурация инициализации компонента вывода iframe.
|
|
20
|
+
*
|
|
21
|
+
* @property allow Список разрешённых возможностей для атрибута `allow` iframe.
|
|
22
|
+
* @property ratio Соотношение сторон iframe через CSS `aspect-ratio`.
|
|
23
|
+
*/
|
|
24
|
+
export type IframeInitConfig<ComponentType extends Componentable = Iframe, RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends IframeProperties = IframeProperties> = {
|
|
25
|
+
allow?: IframeAllow[];
|
|
26
|
+
ratio?: {
|
|
27
|
+
value: number;
|
|
28
|
+
};
|
|
29
|
+
} & OutputInitConfig<string, ComponentType, RefType, PropertiesType>;
|
|
30
|
+
type DefaultInitConfigType<RefType extends ContextRef<any, any>> = IframeInitConfig<Iframe, RefType>;
|
|
31
|
+
type IframeValueOrRef<RefType extends ContextRef<any, any>> = string | CompatibleOutputRef<string, RefType>;
|
|
32
|
+
export declare function iframe<RefType extends ContextRef<any, any> = ContextRef<any, any>>(options: Omit<DefaultInitConfigType<RefType>, "value" | "ref">, valueOrRef: IframeValueOrRef<RefType>): Iframe<RefType>;
|
|
33
|
+
export declare function iframe<RefType extends ContextRef<any, any> = ContextRef<any, any>>(valueOrRef: IframeValueOrRef<RefType>): Iframe<RefType>;
|
|
34
|
+
export declare function iframe<RefType extends ContextRef<any, any> = ContextRef<any, any>>(config: IframeInitConfig<Iframe, RefType>): Iframe<RefType>;
|
|
35
|
+
/**
|
|
36
|
+
* Компонент вывода iframe.
|
|
37
|
+
*/
|
|
38
|
+
export declare class Iframe<RefType extends ContextRef<any, any> = ContextRef<any, any>, PropertiesType extends IframeProperties = IframeProperties> extends OutputComponent<DefaultInitConfigType<RefType>, PropertiesType> {
|
|
39
|
+
constructor(config: DefaultInitConfigType<RefType>);
|
|
40
|
+
protected class(): ServerComponentClass;
|
|
41
|
+
/**
|
|
42
|
+
* Инициализирует свойства компонента на основе конфигурации.
|
|
43
|
+
*
|
|
44
|
+
* @param initValues Объект конфигурации инициализации.
|
|
45
|
+
* @returns Объект свойств компонента.
|
|
46
|
+
*/
|
|
47
|
+
protected initProperties(initValues: DefaultInitConfigType<RefType>): PropertiesType;
|
|
48
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Iframe = exports.IframeAllow = void 0;
|
|
4
|
+
exports.iframe = iframe;
|
|
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
|
+
var iframe_allow_1 = require("@matreshka/shared/enums/iframe-allow");
|
|
9
|
+
Object.defineProperty(exports, "IframeAllow", { enumerable: true, get: function () { return iframe_allow_1.IframeAllow; } });
|
|
10
|
+
function iframe(arg0, arg1) {
|
|
11
|
+
if (arg1 !== undefined) {
|
|
12
|
+
return new Iframe((0, output_component_1.outputValueRefToConfig)(arg1, arg0));
|
|
13
|
+
}
|
|
14
|
+
const single = arg0;
|
|
15
|
+
if (typeof single === "string" || single instanceof core_1.ContextRef) {
|
|
16
|
+
return new Iframe((0, output_component_1.outputValueRefToConfig)(single, {}));
|
|
17
|
+
}
|
|
18
|
+
return new Iframe(single);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Компонент вывода iframe.
|
|
22
|
+
*/
|
|
23
|
+
class Iframe extends output_component_1.OutputComponent {
|
|
24
|
+
constructor(config) {
|
|
25
|
+
super(config);
|
|
26
|
+
}
|
|
27
|
+
class() {
|
|
28
|
+
return server_component_class_1.ServerComponentClass.Iframe;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Инициализирует свойства компонента на основе конфигурации.
|
|
32
|
+
*
|
|
33
|
+
* @param initValues Объект конфигурации инициализации.
|
|
34
|
+
* @returns Объект свойств компонента.
|
|
35
|
+
*/
|
|
36
|
+
initProperties(initValues) {
|
|
37
|
+
return {
|
|
38
|
+
...super.initProperties(initValues),
|
|
39
|
+
allow: initValues.allow,
|
|
40
|
+
ratio: initValues.ratio,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Iframe = Iframe;
|