@anglr/dynamic 1.0.0-beta.20221109053949 → 1.0.0-beta.20221109083513
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/es2015/layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.component.js +143 -0
- package/es2015/layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.component.js.map +1 -0
- package/es2015/layout-relations/src/{dynamicItems/customComponent/misc/components → components}/contentOptionsSelection/contentOptionsSelection.interface.js +0 -0
- package/es2015/layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.interface.js.map +1 -0
- package/es2015/layout-relations/src/components/index.js +2 -0
- package/es2015/layout-relations/src/components/index.js.map +1 -1
- package/es2015/layout-relations/src/directives/index.js +2 -0
- package/es2015/layout-relations/src/directives/index.js.map +1 -0
- package/es2015/layout-relations/src/directives/showContentOptionsSelection/showContentOptionsSelection.directive.js +32 -0
- package/es2015/layout-relations/src/directives/showContentOptionsSelection/showContentOptionsSelection.directive.js.map +1 -0
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsPropertiesControl/contentOptionsPropertiesControl.component.js +11 -7
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsPropertiesControl/contentOptionsPropertiesControl.component.js.map +1 -1
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/index.js +0 -5
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/index.js.map +1 -1
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/pipes/getControls/getControls.pipe.js.map +1 -1
- package/es2015/layout-relations/src/index.js +2 -0
- package/es2015/layout-relations/src/index.js.map +1 -1
- package/es2015/layout-relations/src/misc/utils.js.map +1 -1
- package/es2015/layout-relations/src/{dynamicItems/customComponent/misc/pipes → pipes}/getModel/getModel.pipe.js +0 -0
- package/es2015/layout-relations/src/pipes/getModel/getModel.pipe.js.map +1 -0
- package/es2015/layout-relations/src/pipes/index.js +4 -0
- package/es2015/layout-relations/src/pipes/index.js.map +1 -0
- package/{es2020/layout-relations/src/dynamicItems/customComponent/misc → es2015/layout-relations/src}/pipes/propertiesMetadata/propertiesMetadata.pipe.js +12 -4
- package/es2015/layout-relations/src/pipes/propertiesMetadata/propertiesMetadata.pipe.js.map +1 -0
- package/es2015/layout-relations/src/pipes/propertySelected/propertySelected.pipe.js +28 -0
- package/es2015/layout-relations/src/pipes/propertySelected/propertySelected.pipe.js.map +1 -0
- package/es2015/layout-relations/src/services/customComponentsRegister/customComponentsRegister.interface.js.map +1 -1
- package/es2020/layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.component.js +140 -0
- package/es2020/layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.component.js.map +1 -0
- package/es2020/layout-relations/src/{dynamicItems/customComponent/misc/components → components}/contentOptionsSelection/contentOptionsSelection.interface.js +0 -0
- package/es2020/layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.interface.js.map +1 -0
- package/es2020/layout-relations/src/components/index.js +2 -0
- package/es2020/layout-relations/src/components/index.js.map +1 -1
- package/es2020/layout-relations/src/directives/index.js +2 -0
- package/es2020/layout-relations/src/directives/index.js.map +1 -0
- package/es2020/layout-relations/src/directives/showContentOptionsSelection/showContentOptionsSelection.directive.js +29 -0
- package/es2020/layout-relations/src/directives/showContentOptionsSelection/showContentOptionsSelection.directive.js.map +1 -0
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsPropertiesControl/contentOptionsPropertiesControl.component.js +11 -7
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsPropertiesControl/contentOptionsPropertiesControl.component.js.map +1 -1
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/index.js +0 -5
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/index.js.map +1 -1
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/pipes/getControls/getControls.pipe.js.map +1 -1
- package/es2020/layout-relations/src/index.js +2 -0
- package/es2020/layout-relations/src/index.js.map +1 -1
- package/es2020/layout-relations/src/misc/utils.js.map +1 -1
- package/es2020/layout-relations/src/{dynamicItems/customComponent/misc/pipes → pipes}/getModel/getModel.pipe.js +0 -0
- package/es2020/layout-relations/src/pipes/getModel/getModel.pipe.js.map +1 -0
- package/es2020/layout-relations/src/pipes/index.js +4 -0
- package/es2020/layout-relations/src/pipes/index.js.map +1 -0
- package/{es2015/layout-relations/src/dynamicItems/customComponent/misc → es2020/layout-relations/src}/pipes/propertiesMetadata/propertiesMetadata.pipe.js +11 -4
- package/es2020/layout-relations/src/pipes/propertiesMetadata/propertiesMetadata.pipe.js.map +1 -0
- package/es2020/layout-relations/src/pipes/propertySelected/propertySelected.pipe.js +27 -0
- package/es2020/layout-relations/src/pipes/propertySelected/propertySelected.pipe.js.map +1 -0
- package/es2020/layout-relations/src/services/customComponentsRegister/customComponentsRegister.interface.js.map +1 -1
- package/layout-relations/src/{dynamicItems/customComponent/misc/components → components}/contentOptionsSelection/contentOptionsSelection.component.d.ts +14 -6
- package/layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.component.d.ts.map +1 -0
- package/layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.component.html +45 -0
- package/layout-relations/src/{dynamicItems/customComponent/misc/components → components}/contentOptionsSelection/contentOptionsSelection.interface.d.ts +7 -3
- package/layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.interface.d.ts.map +1 -0
- package/layout-relations/src/components/index.d.ts +2 -0
- package/layout-relations/src/components/index.d.ts.map +1 -1
- package/layout-relations/src/directives/index.d.ts +2 -0
- package/layout-relations/src/directives/index.d.ts.map +1 -0
- package/layout-relations/src/directives/showContentOptionsSelection/showContentOptionsSelection.directive.d.ts +14 -0
- package/layout-relations/src/directives/showContentOptionsSelection/showContentOptionsSelection.directive.d.ts.map +1 -0
- package/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsPropertiesControl/contentOptionsPropertiesControl.component.d.ts +7 -3
- package/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsPropertiesControl/contentOptionsPropertiesControl.component.d.ts.map +1 -1
- package/layout-relations/src/dynamicItems/customComponent/misc/index.d.ts +0 -5
- package/layout-relations/src/dynamicItems/customComponent/misc/index.d.ts.map +1 -1
- package/layout-relations/src/dynamicItems/customComponent/misc/pipes/getControls/getControls.pipe.d.ts +2 -2
- package/layout-relations/src/dynamicItems/customComponent/misc/pipes/getControls/getControls.pipe.d.ts.map +1 -1
- package/layout-relations/src/index.d.ts +2 -0
- package/layout-relations/src/index.d.ts.map +1 -1
- package/layout-relations/src/misc/utils.d.ts +1 -1
- package/layout-relations/src/misc/utils.d.ts.map +1 -1
- package/layout-relations/src/{dynamicItems/customComponent/misc/pipes → pipes}/getModel/getModel.pipe.d.ts +2 -2
- package/layout-relations/src/{dynamicItems/customComponent/misc/pipes → pipes}/getModel/getModel.pipe.d.ts.map +1 -1
- package/layout-relations/src/pipes/index.d.ts +4 -0
- package/layout-relations/src/pipes/index.d.ts.map +1 -0
- package/layout-relations/src/{dynamicItems/customComponent/misc/pipes → pipes}/propertiesMetadata/propertiesMetadata.pipe.d.ts +5 -4
- package/layout-relations/src/pipes/propertiesMetadata/propertiesMetadata.pipe.d.ts.map +1 -0
- package/layout-relations/src/pipes/propertySelected/propertySelected.pipe.d.ts +19 -0
- package/layout-relations/src/pipes/propertySelected/propertySelected.pipe.d.ts.map +1 -0
- package/layout-relations/src/services/customComponentsRegister/customComponentsRegister.interface.d.ts +4 -0
- package/layout-relations/src/services/customComponentsRegister/customComponentsRegister.interface.d.ts.map +1 -1
- package/package.json +1 -1
- package/version.bak +1 -1
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsSelection/contentOptionsSelection.component.js +0 -91
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsSelection/contentOptionsSelection.component.js.map +0 -1
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsSelection/contentOptionsSelection.interface.js.map +0 -1
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/pipes/getModel/getModel.pipe.js.map +0 -1
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/pipes/modelSelected/modelSelected.pipe.js +0 -25
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/pipes/modelSelected/modelSelected.pipe.js.map +0 -1
- package/es2015/layout-relations/src/dynamicItems/customComponent/misc/pipes/propertiesMetadata/propertiesMetadata.pipe.js.map +0 -1
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsSelection/contentOptionsSelection.component.js +0 -90
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsSelection/contentOptionsSelection.component.js.map +0 -1
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsSelection/contentOptionsSelection.interface.js.map +0 -1
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/pipes/getModel/getModel.pipe.js.map +0 -1
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/pipes/modelSelected/modelSelected.pipe.js +0 -25
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/pipes/modelSelected/modelSelected.pipe.js.map +0 -1
- package/es2020/layout-relations/src/dynamicItems/customComponent/misc/pipes/propertiesMetadata/propertiesMetadata.pipe.js.map +0 -1
- package/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsSelection/contentOptionsSelection.component.d.ts.map +0 -1
- package/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsSelection/contentOptionsSelection.component.html +0 -39
- package/layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsSelection/contentOptionsSelection.interface.d.ts.map +0 -1
- package/layout-relations/src/dynamicItems/customComponent/misc/pipes/modelSelected/modelSelected.pipe.d.ts +0 -17
- package/layout-relations/src/dynamicItems/customComponent/misc/pipes/modelSelected/modelSelected.pipe.d.ts.map +0 -1
- package/layout-relations/src/dynamicItems/customComponent/misc/pipes/propertiesMetadata/propertiesMetadata.pipe.d.ts.map +0 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, Inject } from '@angular/core';
|
|
2
|
+
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { DialogRef } from '@angular/cdk/dialog';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import { MatDialogModule } from '@angular/material/dialog';
|
|
6
|
+
import { TITLED_DIALOG_DATA } from '@anglr/common/material';
|
|
7
|
+
import { TooltipModule } from '@anglr/common';
|
|
8
|
+
import { GetModelSAPipe, PropertySelectedSAPipe, PropertiesMetadataSAPipe } from '../../pipes';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
import * as i1 from "@angular/cdk/dialog";
|
|
11
|
+
import * as i2 from "@angular/common";
|
|
12
|
+
import * as i3 from "@angular/material/dialog";
|
|
13
|
+
import * as i4 from "@angular/forms";
|
|
14
|
+
import * as i5 from "@anglr/common";
|
|
15
|
+
/**
|
|
16
|
+
* Component used for displaying selection of components and their options to be editable
|
|
17
|
+
*/
|
|
18
|
+
export class ContentOptionsSelectionSAComponent {
|
|
19
|
+
//######################### constructor #########################
|
|
20
|
+
constructor(data, dialog) {
|
|
21
|
+
var _a, _b, _c, _d, _e;
|
|
22
|
+
var _f, _g, _h;
|
|
23
|
+
this.data = data;
|
|
24
|
+
this.dialog = dialog;
|
|
25
|
+
//######################### protected properties - template bindings #########################
|
|
26
|
+
/**
|
|
27
|
+
* Instance of form control that is used for selection of component
|
|
28
|
+
*/
|
|
29
|
+
this.component = new FormControl();
|
|
30
|
+
/**
|
|
31
|
+
* Array of used properties for components and their models
|
|
32
|
+
*/
|
|
33
|
+
this.usedProperties = {};
|
|
34
|
+
/**
|
|
35
|
+
* Array of available properties for components and their models
|
|
36
|
+
*/
|
|
37
|
+
this.availableProperties = {};
|
|
38
|
+
/**
|
|
39
|
+
* Array of content components that are available
|
|
40
|
+
*/
|
|
41
|
+
this.contentComponents = [];
|
|
42
|
+
this.contentComponents = Object.keys(data.customComponentContentMetadata);
|
|
43
|
+
for (const id in this.data.usedProperties) {
|
|
44
|
+
const models = this.data.usedProperties[id];
|
|
45
|
+
(_a = (_f = this.availableProperties)[id]) !== null && _a !== void 0 ? _a : (_f[id] = {});
|
|
46
|
+
for (const modelName in models) {
|
|
47
|
+
const properties = models[modelName];
|
|
48
|
+
this.availableProperties[id][modelName] = [...properties];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const usedComponents = Object.keys(this.usedProperties);
|
|
52
|
+
this.contentComponents = this.contentComponents.filter(itm => usedComponents.indexOf(itm) < 0);
|
|
53
|
+
for (const id in data.customComponentContentMetadata) {
|
|
54
|
+
const meta = data.customComponentContentMetadata[id];
|
|
55
|
+
if (!((_c = (_b = meta === null || meta === void 0 ? void 0 : meta.editorMetadata.metaInfo) === null || _b === void 0 ? void 0 : _b.optionsMetadata) === null || _c === void 0 ? void 0 : _c.propertiesMetadata)) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
for (const propMeta of meta.editorMetadata.metaInfo.optionsMetadata.propertiesMetadata) {
|
|
59
|
+
const model = new propMeta.modelType(undefined);
|
|
60
|
+
if (!Object.keys(model).length) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const modelName = propMeta.modelType.name;
|
|
64
|
+
(_d = (_g = this.availableProperties)[id]) !== null && _d !== void 0 ? _d : (_g[id] = {});
|
|
65
|
+
(_e = (_h = this.availableProperties[id])[modelName]) !== null && _e !== void 0 ? _e : (_h[modelName] = []);
|
|
66
|
+
for (const prop in model) {
|
|
67
|
+
this.availableProperties[id][modelName].push(prop);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//######################### protected methods - template bindings #########################
|
|
73
|
+
/**
|
|
74
|
+
* Adds component from custom component layout
|
|
75
|
+
*/
|
|
76
|
+
addComponent() {
|
|
77
|
+
var _a;
|
|
78
|
+
if (!this.component.value) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.usedProperties[this.component.value] = {};
|
|
82
|
+
const index = this.contentComponents.indexOf(this.component.value);
|
|
83
|
+
if (index >= 0) {
|
|
84
|
+
this.contentComponents.splice(index, 1);
|
|
85
|
+
this.component.setValue((_a = this.contentComponents[0]) !== null && _a !== void 0 ? _a : null);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Removes component options
|
|
90
|
+
* @param id - Id of component that should be removed
|
|
91
|
+
*/
|
|
92
|
+
removeComponent(id) {
|
|
93
|
+
delete this.usedProperties[id];
|
|
94
|
+
this.contentComponents.push(id);
|
|
95
|
+
if (this.contentComponents.length == 1) {
|
|
96
|
+
this.component.setValue(this.contentComponents[0]);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Toggle selected property in component in model
|
|
101
|
+
* @param id - Id of component to be edited
|
|
102
|
+
* @param modelName - Name of model to be edited
|
|
103
|
+
* @param propertyName - Name of property to be toggled
|
|
104
|
+
*/
|
|
105
|
+
toggleSelected(id, modelName, propertyName) {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
var _c, _d;
|
|
108
|
+
(_a = (_c = this.usedProperties)[id]) !== null && _a !== void 0 ? _a : (_c[id] = {});
|
|
109
|
+
(_b = (_d = this.usedProperties[id])[modelName]) !== null && _b !== void 0 ? _b : (_d[modelName] = []);
|
|
110
|
+
const index = this.usedProperties[id][modelName].indexOf(propertyName);
|
|
111
|
+
//remove
|
|
112
|
+
if (index >= 0) {
|
|
113
|
+
this.usedProperties[id][modelName].splice(index, 1);
|
|
114
|
+
this.usedProperties[id][modelName] = [...this.usedProperties[id][modelName]];
|
|
115
|
+
}
|
|
116
|
+
//add
|
|
117
|
+
else {
|
|
118
|
+
this.usedProperties[id][modelName] =
|
|
119
|
+
[
|
|
120
|
+
...this.usedProperties[id][modelName],
|
|
121
|
+
propertyName,
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
ContentOptionsSelectionSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ContentOptionsSelectionSAComponent, deps: [{ token: TITLED_DIALOG_DATA }, { token: i1.DialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
127
|
+
ContentOptionsSelectionSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: ContentOptionsSelectionSAComponent, isStandalone: true, selector: "content-options-selection", ngImport: i0, template: "<div class=\"dynamic-margin-bottom-small dynamic-flex-row\">\n <div class=\"dynamic-flex-1 dynamic-margin-right-small\">\n <label class=\"dynamic-control-label\">Available components</label>\n\n <select class=\"dynamic-form-control\" [formControl]=\"component\">\n <option *ngFor=\"let component of contentComponents\" [value]=\"component\">{{data.customComponentContentMetadata[component]?.metadata?.displayName}}</option>\n </select>\n </div>\n\n <a class=\"dynamic-btn-icon dynamic-margin-left-small dynamic-large-text\" (click)=\"addComponent()\">\n <span class=\"fas fa-plus\"></span>\n </a>\n</div>\n\n<div>\n <div *ngFor=\"let component of usedProperties | keyvalue\" class=\"dynamic-margin-bottom-small\">\n <div class=\"dynamic-bold dynamic-flex-row \">\n <span class=\"dynamic-margin-right-small\">{{data.customComponentContentMetadata[component.key]?.metadata?.displayName}}</span>\n \n <a class=\"dynamic-btn-icon\" (click)=\"removeComponent(component.key)\">\n <span class=\"fas fa-times\"></span>\n </a>\n </div>\n \n <ng-container *ngFor=\"let modelProps of availableProperties[component.key] | keyvalue\">\n <div *ngFor=\"let prop of modelProps.value\">\n <label>\n <input type=\"checkbox\" (change)=\"toggleSelected(component.key, modelProps.key, prop)\" [checked]=\"usedProperties | propertySelected: component.key: modelProps.key: prop\">\n <span>{{(modelProps.key | getModel: data.customComponentContentMetadata[component.key] | propertiesMetadata: data.propsMetadataExtractor)?.[prop]?.name ?? prop}}</span>\n <span class=\"fas fa-info-circle dynamic-margin-left-extra-small\" *ngIf=\"(modelProps.key | getModel: data.customComponentContentMetadata[component.key] | propertiesMetadata: data.propsMetadataExtractor)?.[prop]?.description as description\" [tooltip]=\"description\" ></span>\n </label>\n </div>\n </ng-container>\n </div>\n</div>\n\n<div class=\"dynamic-flex-row dynamic-flex-end\">\n <button type=\"button\" class=\"dynamic-btn dynamic-btn-info dynamic-margin-right-extra-small\" [mat-dialog-close]=\"undefined\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"dynamic-btn dynamic-btn-primary\" [mat-dialog-close]=\"usedProperties\">\n <span>ok</span>\n </button>\n</div>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.KeyValuePipe, name: "keyvalue" }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i3.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i4.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: PropertySelectedSAPipe, name: "propertySelected" }, { kind: "pipe", type: GetModelSAPipe, name: "getModel" }, { kind: "pipe", type: PropertiesMetadataSAPipe, name: "propertiesMetadata" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i5.TooltipDirective, selector: "[tooltip]", inputs: ["tooltip", "allowHtml", "template", "tooltipOptions", "tooltipVisible"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ContentOptionsSelectionSAComponent, decorators: [{
|
|
129
|
+
type: Component,
|
|
130
|
+
args: [{ selector: 'content-options-selection', standalone: true, imports: [
|
|
131
|
+
CommonModule,
|
|
132
|
+
MatDialogModule,
|
|
133
|
+
ReactiveFormsModule,
|
|
134
|
+
PropertySelectedSAPipe,
|
|
135
|
+
GetModelSAPipe,
|
|
136
|
+
PropertiesMetadataSAPipe,
|
|
137
|
+
TooltipModule,
|
|
138
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"dynamic-margin-bottom-small dynamic-flex-row\">\n <div class=\"dynamic-flex-1 dynamic-margin-right-small\">\n <label class=\"dynamic-control-label\">Available components</label>\n\n <select class=\"dynamic-form-control\" [formControl]=\"component\">\n <option *ngFor=\"let component of contentComponents\" [value]=\"component\">{{data.customComponentContentMetadata[component]?.metadata?.displayName}}</option>\n </select>\n </div>\n\n <a class=\"dynamic-btn-icon dynamic-margin-left-small dynamic-large-text\" (click)=\"addComponent()\">\n <span class=\"fas fa-plus\"></span>\n </a>\n</div>\n\n<div>\n <div *ngFor=\"let component of usedProperties | keyvalue\" class=\"dynamic-margin-bottom-small\">\n <div class=\"dynamic-bold dynamic-flex-row \">\n <span class=\"dynamic-margin-right-small\">{{data.customComponentContentMetadata[component.key]?.metadata?.displayName}}</span>\n \n <a class=\"dynamic-btn-icon\" (click)=\"removeComponent(component.key)\">\n <span class=\"fas fa-times\"></span>\n </a>\n </div>\n \n <ng-container *ngFor=\"let modelProps of availableProperties[component.key] | keyvalue\">\n <div *ngFor=\"let prop of modelProps.value\">\n <label>\n <input type=\"checkbox\" (change)=\"toggleSelected(component.key, modelProps.key, prop)\" [checked]=\"usedProperties | propertySelected: component.key: modelProps.key: prop\">\n <span>{{(modelProps.key | getModel: data.customComponentContentMetadata[component.key] | propertiesMetadata: data.propsMetadataExtractor)?.[prop]?.name ?? prop}}</span>\n <span class=\"fas fa-info-circle dynamic-margin-left-extra-small\" *ngIf=\"(modelProps.key | getModel: data.customComponentContentMetadata[component.key] | propertiesMetadata: data.propsMetadataExtractor)?.[prop]?.description as description\" [tooltip]=\"description\" ></span>\n </label>\n </div>\n </ng-container>\n </div>\n</div>\n\n<div class=\"dynamic-flex-row dynamic-flex-end\">\n <button type=\"button\" class=\"dynamic-btn dynamic-btn-info dynamic-margin-right-extra-small\" [mat-dialog-close]=\"undefined\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"dynamic-btn dynamic-btn-primary\" [mat-dialog-close]=\"usedProperties\">\n <span>ok</span>\n </button>\n</div>" }]
|
|
139
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
140
|
+
type: Inject,
|
|
141
|
+
args: [TITLED_DIALOG_DATA]
|
|
142
|
+
}] }, { type: i1.DialogRef }]; } });
|
|
143
|
+
//# sourceMappingURL=contentOptionsSelection.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentOptionsSelection.component.js","sourceRoot":"","sources":["../../../../../layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.component.ts","../../../../../layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,EAAC,WAAW,EAAE,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CA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AAC,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;SAChF;QACD,KAAK;aAEL;YACI,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;gBAClC;oBACI,GAAG,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;oBACrC,YAAY;iBACf,CAAC;SACL;IACL,CAAC;;+HA/IQ,kCAAkC,kBAyBvB,kBAAkB;mHAzB7B,kCAAkC,qFChC/C,q9EA4CM,2CDtBE,YAAY,0TACZ,eAAe,oOACf,mBAAmB,gtBACnB,sBAAsB,oDACtB,cAAc,4CACd,wBAAwB,0DACxB,aAAa;2FAIR,kCAAkC;kBAjB9C,SAAS;+BAEI,2BAA2B,cAEzB,IAAI,WAEhB;wBACI,YAAY;wBACZ,eAAe;wBACf,mBAAmB;wBACnB,sBAAsB;wBACtB,cAAc;wBACd,wBAAwB;wBACxB,aAAa;qBAChB,mBACgB,uBAAuB,CAAC,MAAM;;0BA2BlC,MAAM;2BAAC,kBAAkB","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject} from '@angular/core';\nimport {FormControl, ReactiveFormsModule} from '@angular/forms';\nimport {DialogRef} from '@angular/cdk/dialog';\nimport {CommonModule} from '@angular/common';\nimport {MatDialogModule} from '@angular/material/dialog';\nimport {TITLED_DIALOG_DATA} from '@anglr/common/material';\nimport {TooltipModule} from '@anglr/common';\nimport {Dictionary} from '@jscrpt/common';\n\nimport {ContentOptionsSelectionData} from './contentOptionsSelection.interface';\nimport {GetModelSAPipe, PropertySelectedSAPipe, PropertiesMetadataSAPipe} from '../../pipes';\n\n/**\n * Component used for displaying selection of components and their options to be editable\n */\n@Component(\n{\n selector: 'content-options-selection',\n templateUrl: 'contentOptionsSelection.component.html',\n standalone: true,\n imports:\n [\n CommonModule,\n MatDialogModule,\n ReactiveFormsModule,\n PropertySelectedSAPipe,\n GetModelSAPipe,\n PropertiesMetadataSAPipe,\n TooltipModule,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentOptionsSelectionSAComponent\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Instance of form control that is used for selection of component\n */\n protected component: FormControl<string> = new FormControl();\n\n /**\n * Array of used properties for components and their models\n */\n protected usedProperties: Dictionary<Dictionary<string[]>> = {};\n\n /**\n * Array of available properties for components and their models\n */\n protected availableProperties: Dictionary<Dictionary<string[]>> = {};\n\n /**\n * Array of content components that are available\n */\n protected contentComponents: string[] = [];\n\n //######################### constructor #########################\n constructor(@Inject(TITLED_DIALOG_DATA) protected data: ContentOptionsSelectionData,\n protected dialog: DialogRef<ContentOptionsSelectionSAComponent, Dictionary<string[]>>,)\n {\n this.contentComponents = Object.keys(data.customComponentContentMetadata);\n\n for(const id in this.data.usedProperties)\n {\n const models = this.data.usedProperties[id];\n\n this.availableProperties[id] ??= {};\n\n for(const modelName in models)\n {\n const properties = models[modelName];\n\n this.availableProperties[id][modelName] = [...properties];\n }\n }\n\n const usedComponents = Object.keys(this.usedProperties);\n this.contentComponents = this.contentComponents.filter(itm => usedComponents.indexOf(itm) < 0);\n\n for(const id in data.customComponentContentMetadata)\n {\n const meta = data.customComponentContentMetadata[id];\n\n if(!meta?.editorMetadata.metaInfo?.optionsMetadata?.propertiesMetadata)\n {\n continue;\n }\n\n for(const propMeta of meta.editorMetadata.metaInfo.optionsMetadata.propertiesMetadata)\n {\n const model = new propMeta.modelType(undefined);\n\n if(!Object.keys(model).length)\n {\n continue;\n }\n\n const modelName = propMeta.modelType.name;\n\n this.availableProperties[id] ??= {};\n this.availableProperties[id][modelName] ??= [];\n\n for(const prop in model)\n {\n this.availableProperties[id][modelName].push(prop);\n }\n }\n }\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Adds component from custom component layout\n */\n protected addComponent(): void\n {\n if(!this.component.value)\n {\n return;\n }\n\n this.usedProperties[this.component.value] = {};\n const index = this.contentComponents.indexOf(this.component.value);\n\n if(index >= 0)\n {\n this.contentComponents.splice(index, 1);\n this.component.setValue(this.contentComponents[0] ?? null);\n }\n }\n\n /**\n * Removes component options\n * @param id - Id of component that should be removed\n */\n protected removeComponent(id: string): void\n {\n delete this.usedProperties[id];\n this.contentComponents.push(id);\n\n if(this.contentComponents.length == 1)\n {\n this.component.setValue(this.contentComponents[0]);\n }\n }\n\n /**\n * Toggle selected property in component in model\n * @param id - Id of component to be edited\n * @param modelName - Name of model to be edited\n * @param propertyName - Name of property to be toggled\n */\n protected toggleSelected(id: string, modelName: string, propertyName: string): void\n {\n this.usedProperties[id] ??= {};\n this.usedProperties[id][modelName] ??= [];\n\n const index = this.usedProperties[id][modelName].indexOf(propertyName);\n\n //remove\n if(index >= 0)\n {\n this.usedProperties[id][modelName].splice(index, 1);\n this.usedProperties[id][modelName] = [...this.usedProperties[id][modelName]];\n }\n //add\n else\n {\n this.usedProperties[id][modelName] =\n [\n ...this.usedProperties[id][modelName],\n propertyName,\n ];\n }\n }\n}","<div class=\"dynamic-margin-bottom-small dynamic-flex-row\">\n <div class=\"dynamic-flex-1 dynamic-margin-right-small\">\n <label class=\"dynamic-control-label\">Available components</label>\n\n <select class=\"dynamic-form-control\" [formControl]=\"component\">\n <option *ngFor=\"let component of contentComponents\" [value]=\"component\">{{data.customComponentContentMetadata[component]?.metadata?.displayName}}</option>\n </select>\n </div>\n\n <a class=\"dynamic-btn-icon dynamic-margin-left-small dynamic-large-text\" (click)=\"addComponent()\">\n <span class=\"fas fa-plus\"></span>\n </a>\n</div>\n\n<div>\n <div *ngFor=\"let component of usedProperties | keyvalue\" class=\"dynamic-margin-bottom-small\">\n <div class=\"dynamic-bold dynamic-flex-row \">\n <span class=\"dynamic-margin-right-small\">{{data.customComponentContentMetadata[component.key]?.metadata?.displayName}}</span>\n \n <a class=\"dynamic-btn-icon\" (click)=\"removeComponent(component.key)\">\n <span class=\"fas fa-times\"></span>\n </a>\n </div>\n \n <ng-container *ngFor=\"let modelProps of availableProperties[component.key] | keyvalue\">\n <div *ngFor=\"let prop of modelProps.value\">\n <label>\n <input type=\"checkbox\" (change)=\"toggleSelected(component.key, modelProps.key, prop)\" [checked]=\"usedProperties | propertySelected: component.key: modelProps.key: prop\">\n <span>{{(modelProps.key | getModel: data.customComponentContentMetadata[component.key] | propertiesMetadata: data.propsMetadataExtractor)?.[prop]?.name ?? prop}}</span>\n <span class=\"fas fa-info-circle dynamic-margin-left-extra-small\" *ngIf=\"(modelProps.key | getModel: data.customComponentContentMetadata[component.key] | propertiesMetadata: data.propsMetadataExtractor)?.[prop]?.description as description\" [tooltip]=\"description\" ></span>\n </label>\n </div>\n </ng-container>\n </div>\n</div>\n\n<div class=\"dynamic-flex-row dynamic-flex-end\">\n <button type=\"button\" class=\"dynamic-btn dynamic-btn-info dynamic-margin-right-extra-small\" [mat-dialog-close]=\"undefined\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"dynamic-btn dynamic-btn-primary\" [mat-dialog-close]=\"usedProperties\">\n <span>ok</span>\n </button>\n</div>"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentOptionsSelection.interface.js","sourceRoot":"","sources":["../../../../../layout-relations/src/components/contentOptionsSelection/contentOptionsSelection.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {LayoutComponentMetadata} from '@anglr/dynamic/layout';\nimport {LayoutEditorMetadataDescriptor, LayoutEditorPropertyMetadataExtractor} from '@anglr/dynamic/layout-editor';\nimport {Dictionary} from '@jscrpt/common';\n\n/**\n * Data that are stored for content component\n */\nexport interface ContentComponentData\n{\n /**\n * Metadata of component\n */\n metadata: LayoutComponentMetadata;\n\n /**\n * Editor metadata of component\n */\n editorMetadata: LayoutEditorMetadataDescriptor;\n}\n\n/**\n * Data that are passed to content options selection dialog\n */\nexport interface ContentOptionsSelectionData\n{\n /**\n * Metadata for each component in custom component\n */\n customComponentContentMetadata: Dictionary<ContentComponentData|undefined|null>;\n\n /**\n * Array of used components and their model names\n */\n usedProperties: Dictionary<Dictionary<string[]>>;\n\n /**\n * Instance of property metadata extractor for models\n */\n propsMetadataExtractor: LayoutEditorPropertyMetadataExtractor;\n}"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export * from './configureNodeEndpoint/configureNodeEndpoint.component';
|
|
2
2
|
export * from './configureNodeEndpoint/configureNodeEndpoint.model';
|
|
3
|
+
export * from './contentOptionsSelection/contentOptionsSelection.component';
|
|
4
|
+
export * from './contentOptionsSelection/contentOptionsSelection.interface';
|
|
3
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../layout-relations/src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,yDAAyD,CAAC;AACxE,cAAc,qDAAqD,CAAC","sourcesContent":["export * from './configureNodeEndpoint/configureNodeEndpoint.component';\nexport * from './configureNodeEndpoint/configureNodeEndpoint.model';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../layout-relations/src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,yDAAyD,CAAC;AACxE,cAAc,qDAAqD,CAAC;AACpE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,6DAA6D,CAAC","sourcesContent":["export * from './configureNodeEndpoint/configureNodeEndpoint.component';\nexport * from './configureNodeEndpoint/configureNodeEndpoint.model';\nexport * from './contentOptionsSelection/contentOptionsSelection.component';\nexport * from './contentOptionsSelection/contentOptionsSelection.interface';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../layout-relations/src/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,qEAAqE,CAAC","sourcesContent":["export * from './showContentOptionsSelection/showContentOptionsSelection.directive';\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { Directive, HostListener } from '@angular/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Directive that is used for displaying content options selection
|
|
6
|
+
*/
|
|
7
|
+
export class ShowContentOptionsSelectionSADirective {
|
|
8
|
+
//######################### protected methods - host #########################
|
|
9
|
+
/**
|
|
10
|
+
* Shows content options selection dialog
|
|
11
|
+
* @param event - Event that occured
|
|
12
|
+
*/
|
|
13
|
+
show(event) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
ShowContentOptionsSelectionSADirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ShowContentOptionsSelectionSADirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
21
|
+
ShowContentOptionsSelectionSADirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: ShowContentOptionsSelectionSADirective, isStandalone: true, selector: "showContentOptionsSelection", host: { listeners: { "click": "show($event)" } }, ngImport: i0 });
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ShowContentOptionsSelectionSADirective, decorators: [{
|
|
23
|
+
type: Directive,
|
|
24
|
+
args: [{
|
|
25
|
+
selector: 'showContentOptionsSelection',
|
|
26
|
+
standalone: true,
|
|
27
|
+
}]
|
|
28
|
+
}], propDecorators: { show: [{
|
|
29
|
+
type: HostListener,
|
|
30
|
+
args: ['click', ['$event']]
|
|
31
|
+
}] } });
|
|
32
|
+
//# sourceMappingURL=showContentOptionsSelection.directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"showContentOptionsSelection.directive.js","sourceRoot":"","sources":["../../../../../layout-relations/src/directives/showContentOptionsSelection/showContentOptionsSelection.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;;AAEtD;;GAEG;AAMH,MAAM,OAAO,sCAAsC;IAE/C,8EAA8E;IAE9E;;;OAGG;IAEa,IAAI,CAAC,KAAiB;;YAElC,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,eAAe,EAAE,CAAC;QAC5B,CAAC;KAAA;;mIAbQ,sCAAsC;uHAAtC,sCAAsC;2FAAtC,sCAAsC;kBALlD,SAAS;mBACV;oBACI,QAAQ,EAAE,6BAA6B;oBACvC,UAAU,EAAE,IAAI;iBACnB;8BAUmB,IAAI;sBADnB,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC","sourcesContent":["import {Directive, HostListener} from '@angular/core';\n\n/**\n * Directive that is used for displaying content options selection\n */\n@Directive(\n{\n selector: 'showContentOptionsSelection',\n standalone: true,\n})\nexport class ShowContentOptionsSelectionSADirective\n{\n //######################### protected methods - host #########################\n\n /**\n * Shows content options selection dialog\n * @param event - Event that occured\n */\n @HostListener('click', ['$event'])\n protected async show(event: MouseEvent): Promise<void>\n {\n event.preventDefault();\n event.stopPropagation();\n }\n}"]}
|
|
@@ -3,15 +3,14 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
import { FormModelBuilder } from '@anglr/common/forms';
|
|
5
5
|
import { LOGGER } from '@anglr/common';
|
|
6
|
-
import { LayoutComponentsIteratorService, LayoutEditorMetadataExtractor, PropertiesControlBase, PropertiesControlsModule } from '@anglr/dynamic/layout-editor';
|
|
6
|
+
import { LayoutComponentsIteratorService, LayoutEditorMetadataExtractor, LayoutEditorPropertyMetadataExtractor, PropertiesControlBase, PropertiesControlsModule } from '@anglr/dynamic/layout-editor';
|
|
7
7
|
import { TitledDialogService } from '@anglr/common/material';
|
|
8
8
|
import { LAYOUT_METADATA_STORAGE } from '@anglr/dynamic/layout';
|
|
9
9
|
import { extend } from '@jscrpt/common';
|
|
10
10
|
import { lastValueFrom } from '@jscrpt/common/rxjs';
|
|
11
|
-
import { ContentOptionsSelectionSAComponent } from '../contentOptionsSelection/contentOptionsSelection.component';
|
|
12
11
|
import { GetControlsSAPipe } from '../../pipes/getControls/getControls.pipe';
|
|
13
|
-
import {
|
|
14
|
-
import { GetModelSAPipe } from '
|
|
12
|
+
import { ContentOptionsSelectionSAComponent } from '../../../../../components';
|
|
13
|
+
import { GetModelSAPipe, PropertiesMetadataSAPipe } from '../../../../../pipes';
|
|
15
14
|
import * as i0 from "@angular/core";
|
|
16
15
|
import * as i1 from "@angular/common";
|
|
17
16
|
import * as i2 from "../../../../../../../layout-editor/src/modules/propertiesControls/directives/propertiesControlRenderer/propertiesControlRenderer.directive";
|
|
@@ -38,6 +37,10 @@ export class ContentOptionsPropertiesControlSAComponent extends PropertiesContro
|
|
|
38
37
|
* Extractor for obtaining layout metadata for components
|
|
39
38
|
*/
|
|
40
39
|
this.metadataExtractor = inject(LayoutEditorMetadataExtractor);
|
|
40
|
+
/**
|
|
41
|
+
* Property metadata extractor for models
|
|
42
|
+
*/
|
|
43
|
+
this.propsMetadataExtractor = inject(LayoutEditorPropertyMetadataExtractor);
|
|
41
44
|
/**
|
|
42
45
|
* Instance of logger used for logging
|
|
43
46
|
*/
|
|
@@ -122,7 +125,8 @@ export class ContentOptionsPropertiesControlSAComponent extends PropertiesContro
|
|
|
122
125
|
width: '75vw',
|
|
123
126
|
data: {
|
|
124
127
|
customComponentContentMetadata: this.customComponentContentMetadata,
|
|
125
|
-
|
|
128
|
+
usedProperties: {},
|
|
129
|
+
propsMetadataExtractor: this.propsMetadataExtractor,
|
|
126
130
|
}
|
|
127
131
|
}).afterClosed());
|
|
128
132
|
if (result) {
|
|
@@ -164,14 +168,14 @@ export class ContentOptionsPropertiesControlSAComponent extends PropertiesContro
|
|
|
164
168
|
ContentOptionsPropertiesControlSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ContentOptionsPropertiesControlSAComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
165
169
|
ContentOptionsPropertiesControlSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: ContentOptionsPropertiesControlSAComponent, isStandalone: true, selector: "content-options", providers: [
|
|
166
170
|
FormModelBuilder,
|
|
167
|
-
], usesInheritance: true, ngImport: i0, template: "<button class=\"dynamic-btn dynamic-btn-primary dynamic-margin-vertical-small\" type=\"button\" (click)=\"showOptionsSelection()\">\n <span>content options selection</span>\n</button>\n\n<ng-container *ngFor=\"let cmp of usedComponents | keyvalue\">\n <div class=\"dynamic-margin-top-small dynamic-bold dynamic-text-uppercase dynamic-margin-left-extra-small\">{{customComponentContentMetadata[cmp.key]?.metadata?.displayName}}</div>\n\n <ng-container *ngFor=\"let modelName of cmp.value\">\n <ng-container *ngFor=\"let ctrl of modelName | getControls: customComponentContentMetadata[cmp.key]\">\n <ng-container [propertiesControl]=\"ctrl\" [form]=\"usedComponentsForms[cmp.key][modelName]\" [propertiesMetadata]=\"modelName | getModel: customComponentContentMetadata[cmp.key] | propertiesMetadata\"></ng-container>\n </ng-container>\n </ng-container>\n</ng-container>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "pipe", type: i1.KeyValuePipe, name: "keyvalue" }, { kind: "
|
|
171
|
+
], usesInheritance: true, ngImport: i0, template: "<button class=\"dynamic-btn dynamic-btn-primary dynamic-margin-vertical-small\" type=\"button\" (click)=\"showOptionsSelection()\">\n <span>content options selection</span>\n</button>\n\n<ng-container *ngFor=\"let cmp of usedComponents | keyvalue\">\n <div class=\"dynamic-margin-top-small dynamic-bold dynamic-text-uppercase dynamic-margin-left-extra-small\">{{customComponentContentMetadata[cmp.key]?.metadata?.displayName}}</div>\n\n <ng-container *ngFor=\"let modelName of cmp.value\">\n <ng-container *ngFor=\"let ctrl of modelName | getControls: customComponentContentMetadata[cmp.key]\">\n <ng-container [propertiesControl]=\"ctrl\" [form]=\"usedComponentsForms[cmp.key][modelName]\" [propertiesMetadata]=\"modelName | getModel: customComponentContentMetadata[cmp.key] | propertiesMetadata\"></ng-container>\n </ng-container>\n </ng-container>\n</ng-container>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "pipe", type: i1.KeyValuePipe, name: "keyvalue" }, { kind: "ngmodule", type: PropertiesControlsModule }, { kind: "directive", type: i2.PropertiesControlRendererDirective, selector: "[propertiesControl]", inputs: ["form", "propertiesMetadata", "propertiesControl"] }, { kind: "pipe", type: GetControlsSAPipe, name: "getControls" }, { kind: "pipe", type: GetModelSAPipe, name: "getModel" }, { kind: "pipe", type: PropertiesMetadataSAPipe, name: "propertiesMetadata" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
168
172
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ContentOptionsPropertiesControlSAComponent, decorators: [{
|
|
169
173
|
type: Component,
|
|
170
174
|
args: [{ selector: 'content-options', standalone: true, imports: [
|
|
171
175
|
CommonModule,
|
|
176
|
+
PropertiesControlsModule,
|
|
172
177
|
GetControlsSAPipe,
|
|
173
178
|
GetModelSAPipe,
|
|
174
|
-
PropertiesControlsModule,
|
|
175
179
|
PropertiesMetadataSAPipe,
|
|
176
180
|
], providers: [
|
|
177
181
|
FormModelBuilder,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentOptionsPropertiesControl.component.js","sourceRoot":"","sources":["../../../../../../../../layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsPropertiesControl/contentOptionsPropertiesControl.component.ts","../../../../../../../../layout-relations/src/dynamicItems/customComponent/misc/components/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BAE1B,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;oBAElC,MAAA,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;gBAC/D,CAAC,CAAC,CAAC;aACN;SACJ;IACL,CAAC;;uIAlLQ,0CAA0C;2HAA1C,0CAA0C,8DALnD;QACI,gBAAgB;KACnB,iDCtCL,04BAYe,2CDiBP,YAAY,kNACZ,iBAAiB,+CACjB,cAAc,gDACd,wBAAwB,4LACxB,wBAAwB;2FAQnB,0CAA0C;kBAnBtD,SAAS;+BAEI,iBAAiB,cAEf,IAAI,WAEhB;wBACI,YAAY;wBACZ,iBAAiB;wBACjB,cAAc;wBACd,wBAAwB;wBACxB,wBAAwB;qBAC3B,aAED;wBACI,gBAAgB;qBACnB,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import {ChangeDetectionStrategy, Component, inject} from '@angular/core';\nimport {FormGroup} from '@angular/forms';\nimport {CommonModule} from '@angular/common';\nimport {FormModelBuilder} from '@anglr/common/forms';\nimport {LOGGER, Logger} from '@anglr/common';\nimport {LayoutComponentsIteratorService, LayoutEditorMetadataExtractor, LayoutPropertiesModelType, PropertiesControl, PropertiesControlBase, PropertiesControlsModule} from '@anglr/dynamic/layout-editor';\nimport {TitledDialogService} from '@anglr/common/material';\nimport {MetadataStorage} from '@anglr/dynamic';\nimport {LayoutComponentMetadata, LAYOUT_METADATA_STORAGE} from '@anglr/dynamic/layout';\nimport {Dictionary, extend} from '@jscrpt/common';\nimport {lastValueFrom} from '@jscrpt/common/rxjs';\n\nimport {CustomComponentComponentOptions} from '../../../customComponent.options';\nimport {ContentOptionsSelectionSAComponent} from '../contentOptionsSelection/contentOptionsSelection.component';\nimport {ContentComponentData, ContentOptionsSelectionData} from '../contentOptionsSelection/contentOptionsSelection.interface';\nimport {GetControlsSAPipe} from '../../pipes/getControls/getControls.pipe';\nimport {PropertiesMetadataSAPipe} from '../../pipes/propertiesMetadata/propertiesMetadata.pipe';\nimport {GetModelSAPipe} from '../../pipes/getModel/getModel.pipe';\n\n/**\n * Component used for displaying editation of content options\n */\n@Component(\n{\n selector: 'content-options',\n templateUrl: 'contentOptionsPropertiesControl.component.html',\n standalone: true,\n imports:\n [\n CommonModule,\n GetControlsSAPipe,\n GetModelSAPipe,\n PropertiesControlsModule,\n PropertiesMetadataSAPipe,\n ],\n providers:\n [\n FormModelBuilder,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentOptionsPropertiesControlSAComponent extends PropertiesControlBase<CustomComponentComponentOptions> implements PropertiesControl<CustomComponentComponentOptions>\n{\n //######################### protected properties #########################\n\n /**\n * Instance of titled dialog service\n */\n protected dialogSvc: TitledDialogService = inject(TitledDialogService);\n\n /**\n * Storage for layout metadata\n */\n protected layoutMetadataStorage: MetadataStorage<LayoutComponentMetadata> = inject(LAYOUT_METADATA_STORAGE);\n\n /**\n * Service used for obtaining iterators that goes over all components in metadata\n */\n protected layoutMetadataIterator: LayoutComponentsIteratorService = inject(LayoutComponentsIteratorService);\n\n /**\n * Extractor for obtaining layout metadata for components\n */\n protected metadataExtractor: LayoutEditorMetadataExtractor = inject(LayoutEditorMetadataExtractor);\n\n /**\n * Instance of logger used for logging\n */\n protected logger: Logger = inject(LOGGER);\n\n /**\n * Form model builder\n */\n protected formModelBuilder: FormModelBuilder = inject(FormModelBuilder);\n\n /**\n * Metadata for each component in custom component\n */\n protected customComponentContentMetadata: Dictionary<ContentComponentData> = {};\n\n /**\n * Custom component layout metadata\n */\n protected customComponentMetadata: LayoutComponentMetadata|undefined|null;\n\n /**\n * Represents components that have custom options and what properties are set\n */\n protected usedComponents: Dictionary<string[]> = {};\n\n /**\n * Stores components and their form groups\n */\n protected usedComponentsForms: Dictionary<Dictionary<FormGroup>> = {};\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected override async _initialize(): Promise<void>\n {\n if(!this.form)\n {\n return;\n }\n\n const options: Partial<CustomComponentComponentOptions> = this.form.value;\n const name = options.name ?? '';\n this.usedComponents = options.usedComponents ?? {};\n\n this.customComponentMetadata = await this.layoutMetadataStorage.getMetadata(name);\n\n if(!this.customComponentMetadata)\n {\n this.logger.warn('ContentOptionsPropertiesControlSAComponent: missing layout metadata for custom component!');\n\n return;\n }\n\n const iterator = this.layoutMetadataIterator.getIteratorFor(this.customComponentMetadata);\n\n for await(const component of iterator)\n {\n const metadata = await this.metadataExtractor.extractMetadata(component.metadata);\n\n if(!metadata)\n {\n this.logger.warn('ContentOptionsPropertiesControlSAComponent: missing metadata for component!');\n\n continue;\n }\n\n this.customComponentContentMetadata[component.metadata.id] =\n {\n metadata: component.metadata,\n editorMetadata: metadata,\n };\n }\n\n for(const id in this.usedComponents)\n {\n if(!this.customComponentContentMetadata[id])\n {\n delete this.usedComponents[id];\n this.form?.controls.usedComponents.setValue(this.usedComponents);\n }\n }\n\n this.initForms();\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Opens dialog for options selection\n */\n protected async showOptionsSelection(): Promise<void>\n {\n const result = await lastValueFrom(this.dialogSvc.open<ContentOptionsSelectionSAComponent, ContentOptionsSelectionData, Dictionary<string[]>|undefined|null>(ContentOptionsSelectionSAComponent,\n {\n title: 'content options selection',\n width: '75vw',\n data:\n {\n customComponentContentMetadata: this.customComponentContentMetadata,\n usedComponents: this.usedComponents,\n }\n }).afterClosed());\n\n if(result)\n {\n this.usedComponents = result;\n this.form?.controls.usedComponents.setValue(result);\n\n this.initForms();\n\n this._changeDetector.detectChanges();\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Initialize forms for properties\n */\n protected initForms(): void\n {\n this.usedComponentsForms = {};\n\n for(const cmpId in this.usedComponents)\n {\n const models = this.usedComponents[cmpId]\n .map(modelName => this.customComponentContentMetadata[cmpId]?.editorMetadata.metaInfo?.optionsMetadata?.propertiesMetadata?.find(itm => itm.modelType.name == modelName)?.modelType)\n .filter(itm => !!itm) as LayoutPropertiesModelType[];\n\n for(const model of models)\n {\n const options = extend(true,\n {},\n this.customComponentContentMetadata[cmpId]?.editorMetadata.metaInfo?.defaultOptions,\n this.customComponentContentMetadata[cmpId]?.metadata.options,\n this.form?.controls.contentOptions.value[cmpId]);\n\n this.usedComponentsForms[cmpId] ??= {};\n const form = this.usedComponentsForms[cmpId][model.name] = this.formModelBuilder\n .build(new model(options));\n\n form.valueChanges.subscribe(value =>\n {\n const currentOpts = this.form?.controls.contentOptions.value ?? {};\n currentOpts[cmpId] ??= {};\n\n extend(currentOpts[cmpId], value);\n\n this.form?.controls.contentOptions.patchValue(currentOpts);\n });\n }\n }\n }\n}\n","<button class=\"dynamic-btn dynamic-btn-primary dynamic-margin-vertical-small\" type=\"button\" (click)=\"showOptionsSelection()\">\n <span>content options selection</span>\n</button>\n\n<ng-container *ngFor=\"let cmp of usedComponents | keyvalue\">\n <div class=\"dynamic-margin-top-small dynamic-bold dynamic-text-uppercase dynamic-margin-left-extra-small\">{{customComponentContentMetadata[cmp.key]?.metadata?.displayName}}</div>\n\n <ng-container *ngFor=\"let modelName of cmp.value\">\n <ng-container *ngFor=\"let ctrl of modelName | getControls: customComponentContentMetadata[cmp.key]\">\n <ng-container [propertiesControl]=\"ctrl\" [form]=\"usedComponentsForms[cmp.key][modelName]\" [propertiesMetadata]=\"modelName | getModel: customComponentContentMetadata[cmp.key] | propertiesMetadata\"></ng-container>\n </ng-container>\n </ng-container>\n</ng-container>"]}
|
|
1
|
+
{"version":3,"file":"contentOptionsPropertiesControl.component.js","sourceRoot":"","sources":["../../../../../../../../layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsPropertiesControl/contentOptionsPropertiesControl.component.ts","../../../../../../../../layout-relations/src/dynamicItems/customComponent/misc/components/contentOptionsPropertiesControl/contentOptionsPropertiesControl.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,uBAAuB,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAEzE,OAAO,E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AElC,MAAA,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;gBAC/D,CAAC,CAAC,CAAC;aACN;SACJ;IACL,CAAC;;uIAxLQ,0CAA0C;2HAA1C,0CAA0C,8DALnD;QACI,gBAAgB;KACnB,iDCpCL,04BAYe,2CDeP,YAAY,sNACZ,wBAAwB,4LACxB,iBAAiB,+CACjB,cAAc,4CACd,wBAAwB;2FAQnB,0CAA0C;kBAnBtD,SAAS;+BAEI,iBAAiB,cAEf,IAAI,WAEhB;wBACI,YAAY;wBACZ,wBAAwB;wBACxB,iBAAiB;wBACjB,cAAc;wBACd,wBAAwB;qBAC3B,aAED;wBACI,gBAAgB;qBACnB,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import {ChangeDetectionStrategy, Component, inject} from '@angular/core';\nimport {FormGroup} from '@angular/forms';\nimport {CommonModule} from '@angular/common';\nimport {FormModelBuilder} from '@anglr/common/forms';\nimport {LOGGER, Logger} from '@anglr/common';\nimport {LayoutComponentsIteratorService, LayoutEditorMetadataExtractor, LayoutEditorPropertyMetadataExtractor, LayoutPropertiesModelType, PropertiesControl, PropertiesControlBase, PropertiesControlsModule} from '@anglr/dynamic/layout-editor';\nimport {TitledDialogService} from '@anglr/common/material';\nimport {MetadataStorage} from '@anglr/dynamic';\nimport {LayoutComponentMetadata, LAYOUT_METADATA_STORAGE} from '@anglr/dynamic/layout';\nimport {Dictionary, extend} from '@jscrpt/common';\nimport {lastValueFrom} from '@jscrpt/common/rxjs';\n\nimport {CustomComponentComponentOptions} from '../../../customComponent.options';\nimport {GetControlsSAPipe} from '../../pipes/getControls/getControls.pipe';\nimport {ContentComponentData, ContentOptionsSelectionData, ContentOptionsSelectionSAComponent} from '../../../../../components';\nimport {GetModelSAPipe, PropertiesMetadataSAPipe} from '../../../../../pipes';\n\n/**\n * Component used for displaying editation of content options\n */\n@Component(\n{\n selector: 'content-options',\n templateUrl: 'contentOptionsPropertiesControl.component.html',\n standalone: true,\n imports:\n [\n CommonModule,\n PropertiesControlsModule,\n GetControlsSAPipe,\n GetModelSAPipe,\n PropertiesMetadataSAPipe,\n ],\n providers:\n [\n FormModelBuilder,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ContentOptionsPropertiesControlSAComponent extends PropertiesControlBase<CustomComponentComponentOptions> implements PropertiesControl<CustomComponentComponentOptions>\n{\n //######################### protected properties #########################\n\n /**\n * Instance of titled dialog service\n */\n protected dialogSvc: TitledDialogService = inject(TitledDialogService);\n\n /**\n * Storage for layout metadata\n */\n protected layoutMetadataStorage: MetadataStorage<LayoutComponentMetadata> = inject(LAYOUT_METADATA_STORAGE);\n\n /**\n * Service used for obtaining iterators that goes over all components in metadata\n */\n protected layoutMetadataIterator: LayoutComponentsIteratorService = inject(LayoutComponentsIteratorService);\n\n /**\n * Extractor for obtaining layout metadata for components\n */\n protected metadataExtractor: LayoutEditorMetadataExtractor = inject(LayoutEditorMetadataExtractor);\n\n /**\n * Property metadata extractor for models\n */\n protected propsMetadataExtractor: LayoutEditorPropertyMetadataExtractor = inject(LayoutEditorPropertyMetadataExtractor);\n\n /**\n * Instance of logger used for logging\n */\n protected logger: Logger = inject(LOGGER);\n\n /**\n * Form model builder\n */\n protected formModelBuilder: FormModelBuilder = inject(FormModelBuilder);\n\n /**\n * Metadata for each component in custom component\n */\n protected customComponentContentMetadata: Dictionary<ContentComponentData|undefined|null> = {};\n\n /**\n * Custom component layout metadata\n */\n protected customComponentMetadata: LayoutComponentMetadata|undefined|null;\n\n /**\n * Represents components that have custom options and what properties are set\n */\n protected usedComponents: Dictionary<string[]> = {};\n\n /**\n * Stores components and their form groups\n */\n protected usedComponentsForms: Dictionary<Dictionary<FormGroup>> = {};\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected override async _initialize(): Promise<void>\n {\n if(!this.form)\n {\n return;\n }\n\n const options: Partial<CustomComponentComponentOptions> = this.form.value;\n const name = options.name ?? '';\n this.usedComponents = options.usedComponents ?? {};\n\n this.customComponentMetadata = await this.layoutMetadataStorage.getMetadata(name);\n\n if(!this.customComponentMetadata)\n {\n this.logger.warn('ContentOptionsPropertiesControlSAComponent: missing layout metadata for custom component!');\n\n return;\n }\n\n const iterator = this.layoutMetadataIterator.getIteratorFor(this.customComponentMetadata);\n\n for await(const component of iterator)\n {\n const metadata = await this.metadataExtractor.extractMetadata(component.metadata);\n\n if(!metadata)\n {\n this.logger.warn('ContentOptionsPropertiesControlSAComponent: missing metadata for component!');\n\n continue;\n }\n\n this.customComponentContentMetadata[component.metadata.id] =\n {\n metadata: component.metadata,\n editorMetadata: metadata,\n };\n }\n\n for(const id in this.usedComponents)\n {\n if(!this.customComponentContentMetadata[id])\n {\n delete this.usedComponents[id];\n this.form?.controls.usedComponents.setValue(this.usedComponents);\n }\n }\n\n this.initForms();\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Opens dialog for options selection\n */\n protected async showOptionsSelection(): Promise<void>\n {\n const result = await lastValueFrom(this.dialogSvc.open<ContentOptionsSelectionSAComponent, ContentOptionsSelectionData, Dictionary<string[]>|undefined|null>(ContentOptionsSelectionSAComponent,\n {\n title: 'content options selection',\n width: '75vw',\n data:\n {\n customComponentContentMetadata: this.customComponentContentMetadata,\n usedProperties: {},\n propsMetadataExtractor: this.propsMetadataExtractor,\n }\n }).afterClosed());\n\n if(result)\n {\n this.usedComponents = result;\n this.form?.controls.usedComponents.setValue(result);\n\n this.initForms();\n\n this._changeDetector.detectChanges();\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Initialize forms for properties\n */\n protected initForms(): void\n {\n this.usedComponentsForms = {};\n\n for(const cmpId in this.usedComponents)\n {\n const models = this.usedComponents[cmpId]\n .map(modelName => this.customComponentContentMetadata[cmpId]?.editorMetadata.metaInfo?.optionsMetadata?.propertiesMetadata?.find(itm => itm.modelType.name == modelName)?.modelType)\n .filter(itm => !!itm) as LayoutPropertiesModelType[];\n\n for(const model of models)\n {\n const options = extend(true,\n {},\n this.customComponentContentMetadata[cmpId]?.editorMetadata.metaInfo?.defaultOptions,\n this.customComponentContentMetadata[cmpId]?.metadata.options,\n this.form?.controls.contentOptions.value[cmpId]);\n\n this.usedComponentsForms[cmpId] ??= {};\n const form = this.usedComponentsForms[cmpId][model.name] = this.formModelBuilder\n .build(new model(options));\n\n form.valueChanges.subscribe(value =>\n {\n const currentOpts = this.form?.controls.contentOptions.value ?? {};\n currentOpts[cmpId] ??= {};\n\n extend(currentOpts[cmpId], value);\n\n this.form?.controls.contentOptions.patchValue(currentOpts);\n });\n }\n }\n }\n}\n","<button class=\"dynamic-btn dynamic-btn-primary dynamic-margin-vertical-small\" type=\"button\" (click)=\"showOptionsSelection()\">\n <span>content options selection</span>\n</button>\n\n<ng-container *ngFor=\"let cmp of usedComponents | keyvalue\">\n <div class=\"dynamic-margin-top-small dynamic-bold dynamic-text-uppercase dynamic-margin-left-extra-small\">{{customComponentContentMetadata[cmp.key]?.metadata?.displayName}}</div>\n\n <ng-container *ngFor=\"let modelName of cmp.value\">\n <ng-container *ngFor=\"let ctrl of modelName | getControls: customComponentContentMetadata[cmp.key]\">\n <ng-container [propertiesControl]=\"ctrl\" [form]=\"usedComponentsForms[cmp.key][modelName]\" [propertiesMetadata]=\"modelName | getModel: customComponentContentMetadata[cmp.key] | propertiesMetadata\"></ng-container>\n </ng-container>\n </ng-container>\n</ng-container>"]}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
export * from './components/contentOptionsPropertiesControl/contentOptionsPropertiesControl.component';
|
|
2
|
-
export * from './components/contentOptionsSelection/contentOptionsSelection.component';
|
|
3
|
-
export * from './components/contentOptionsSelection/contentOptionsSelection.interface';
|
|
4
2
|
export * from './pipes/getControls/getControls.pipe';
|
|
5
|
-
export * from './pipes/getModel/getModel.pipe';
|
|
6
|
-
export * from './pipes/modelSelected/modelSelected.pipe';
|
|
7
|
-
export * from './pipes/propertiesMetadata/propertiesMetadata.pipe';
|
|
8
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../layout-relations/src/dynamicItems/customComponent/misc/index.ts"],"names":[],"mappings":"AAAA,cAAc,wFAAwF,CAAC;AACvG,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../layout-relations/src/dynamicItems/customComponent/misc/index.ts"],"names":[],"mappings":"AAAA,cAAc,wFAAwF,CAAC;AACvG,cAAc,sCAAsC,CAAC","sourcesContent":["export * from './components/contentOptionsPropertiesControl/contentOptionsPropertiesControl.component';\nexport * from './pipes/getControls/getControls.pipe';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getControls.pipe.js","sourceRoot":"","sources":["../../../../../../../../layout-relations/src/dynamicItems/customComponent/misc/pipes/getControls/getControls.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAsB,MAAM,eAAe,CAAC;;AAKxD;;GAEG;AAEH,MAAM,OAAO,iBAAiB;IAE1B;;;;OAIG;IACI,SAAS,CAAC,KAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"getControls.pipe.js","sourceRoot":"","sources":["../../../../../../../../layout-relations/src/dynamicItems/customComponent/misc/pipes/getControls/getControls.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAsB,MAAM,eAAe,CAAC;;AAKxD;;GAEG;AAEH,MAAM,OAAO,iBAAiB;IAE1B;;;;OAIG;IACI,SAAS,CAAC,KAAa,EAAE,QAA6C;;QAEzE,OAAO,MAAA,MAAA,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,cAAc,CAAC,QAAQ,0CAAE,eAAe,0CAAE,kBAAkB,0CAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,IAAI,KAAK,CAAC,0CAAE,kBAAkB,mCAAI,EAAE,CAAC;IACtJ,CAAC;;8GAVQ,iBAAiB;4GAAjB,iBAAiB;2FAAjB,iBAAiB;kBAD7B,IAAI;mBAAC,EAAC,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAC","sourcesContent":["import {Pipe, PipeTransform, Type} from '@angular/core';\nimport {PropertiesControl} from '@anglr/dynamic/layout-editor';\n\nimport {ContentComponentData} from '../../../../../components';\n\n/**\n * Gets properties controls that are used for setting model value\n */\n@Pipe({name: 'getControls', standalone: true})\nexport class GetControlsSAPipe implements PipeTransform\n{\n /**\n * Gets properties controls that are used for setting model value\n * @param value - Name of model class\n * @param metadata - Metadata containing properties controls for model\n */\n public transform(value: string, metadata: ContentComponentData|undefined|null,): Type<PropertiesControl>[]\n {\n return metadata?.editorMetadata.metaInfo?.optionsMetadata?.propertiesMetadata?.find(itm => itm.modelType.name == value)?.propertiesControls ?? [];\n }\n}"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
+
export * from './directives';
|
|
2
3
|
export * from './dynamicItems';
|
|
3
4
|
export * from './interfaces';
|
|
4
5
|
export * from './misc/extensions';
|
|
@@ -6,5 +7,6 @@ export * from './misc/providers';
|
|
|
6
7
|
export * from './misc/tokens';
|
|
7
8
|
export * from './misc/utils';
|
|
8
9
|
export * from './modules';
|
|
10
|
+
export * from './pipes';
|
|
9
11
|
export * from './services';
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../layout-relations/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC","sourcesContent":["export * from './components';\nexport * from './dynamicItems';\nexport * from './interfaces';\nexport * from './misc/extensions';\nexport * from './misc/providers';\nexport * from './misc/tokens';\nexport * from './misc/utils';\nexport * from './modules';\nexport * from './services';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../layout-relations/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC","sourcesContent":["export * from './components';\nexport * from './directives';\nexport * from './dynamicItems';\nexport * from './interfaces';\nexport * from './misc/extensions';\nexport * from './misc/providers';\nexport * from './misc/tokens';\nexport * from './misc/utils';\nexport * from './modules';\nexport * from './pipes';\nexport * from './services';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../layout-relations/src/misc/utils.ts"],"names":[],"mappings":";AACA,OAAO,EAA0B,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAC,sBAAsB,EAAE,2BAA2B,EAAE,aAAa,IAAI,sBAAsB,EAAE,wBAAwB,EAAE,iDAAiD,EAAE,0CAA0C,EAAC,MAAM,iCAAiC,CAAC;AACtQ,OAAO,EAAC,+BAA+B,EAAE,6BAA6B,EAAE,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AACjI,OAAO,EAAC,eAAe,EAAE,0BAA0B,EAAC,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAGrC,OAAO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AAC,6BAA6B,CAAC,CAAC;QACtE,MAAM,8BAA8B,GAAqC,EAAE,CAAC;;YAE5E,KAA6B,IAAA,aAAA,cAAA,QAAQ,CAAA,cAAA;gBAA3B,MAAM,SAAS,qBAAA,CAAA;gBAErB,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAE7E,IAAG,CAAC,QAAQ,EACZ;oBACI,MAAM,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;oBAE3F,SAAS;iBACZ;gBAED,8BAA8B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;oBACrD;wBACI,QAAQ,EAAE,SAAS,CAAC,QAAQ;wBAC5B,cAAc,EAAE,QAAQ;qBAC3B,CAAC;aACL;;;;;;;;;QAED,OAAO;YACH,eAAe,EAAE,8BAA8B;YAC/C,QAAQ,EAAE,uBAAuB;SACpC,CAAC;;CACL","sourcesContent":["import {ClassProvider, FactoryProvider, Injector, Provider, Type} from '@angular/core';\nimport {LayoutComponentMetadata, provideLayout} from '@anglr/dynamic/layout';\nimport {provideRelations} from '@anglr/dynamic/relations';\nimport {provideRelationsEditor, REFRESH_PALETTE_OBSERVABLES, ScopeRegister as RelationsScopeRegister, StaticComponentsRegister, STATIC_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER, STATIC_COMPONENTS_RELATIONS_NODES_PROVIDER} from '@anglr/dynamic/relations-editor';\nimport {LayoutComponentsIteratorService, LayoutEditorMetadataExtractor, provideLayoutEditor} from '@anglr/dynamic/layout-editor';\nimport {MetadataStorage, provideStaticPackageSource} from '@anglr/dynamic';\nimport {LOGGER} from '@anglr/common';\nimport {Dictionary} from '@jscrpt/common';\n\nimport {LAYOUT_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER, LAYOUT_COMPONENTS_RELATIONS_NODES_PROVIDER, CUSTOM_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER, CUSTOM_COMPONENTS_RELATIONS_NODES_PROVIDER, CUSTOM_COMPONENTS_LAYOUT_MODULE_TYPES_PROVIDER, CUSTOM_COMPONENTS_LAYOUT_COMPONENTS_PROVIDER} from './providers';\nimport {LayoutComponentsRegister, LayoutManager, CustomComponentsRegister, ScopeRegister} from '../services';\nimport {ContentComponentData} from '../dynamicItems/customComponent/misc';\n\n/**\n * Providers for relations subpackage that works with layout metadata\n */\nexport function provideLayoutRelations(): Provider[]\n{\n return [\n ...provideLayout(),\n ...provideRelations(),\n ];\n}\n\n/**\n * Providers for relations subpackage that works with layout metadata\n */\nexport function provideLayoutRelationsCustomComponents(): Provider[]\n{\n return [\n ...provideLayoutRelations(),\n CUSTOM_COMPONENTS_LAYOUT_COMPONENTS_PROVIDER,\n ];\n}\n\n/**\n * Providers for relations editor subpackage that works with layout metadata\n */\nexport function provideLayoutRelationsEditor(): Provider[]\n{\n const relationsProviders = provideRelationsEditor();\n relationsProviders.splice(relationsProviders.indexOf(RelationsScopeRegister), 1);\n\n return [\n ...provideLayoutEditor(false),\n ...relationsProviders,\n LAYOUT_COMPONENTS_RELATIONS_NODES_PROVIDER,\n LAYOUT_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER,\n LayoutManager,\n LayoutComponentsRegister,\n LayoutComponentsIteratorService,\n <ClassProvider>\n {\n provide: RelationsScopeRegister,\n useClass: ScopeRegister,\n },\n <FactoryProvider>\n {\n provide: REFRESH_PALETTE_OBSERVABLES,\n useFactory: (layoutManager: LayoutManager) =>\n {\n return layoutManager.layoutChange;\n },\n deps: [LayoutManager],\n multi: true\n },\n provideStaticPackageSource('layout-components'),\n ];\n}\n\n/**\n * Providers that enables use of custom relations components in relations editor\n * @param layoutRelationsEditorProviders - Array of providers for layout relations editor\n * @param customComponentRegister - Type that represents implementation of custom components register\n */\nexport function provideEditorRelationsCustomComponents(layoutRelationsEditorProviders: Provider[],\n customComponentRegister: Type<CustomComponentsRegister> = CustomComponentsRegister,): Provider[]\n{\n return [\n CUSTOM_COMPONENTS_RELATIONS_NODES_PROVIDER,\n CUSTOM_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER,\n CUSTOM_COMPONENTS_LAYOUT_COMPONENTS_PROVIDER,\n provideStaticPackageSource('custom-components'),\n <ClassProvider>\n {\n provide: CustomComponentsRegister,\n useClass: customComponentRegister,\n },\n ...layoutRelationsEditorProviders,\n ];\n}\n\n/**\n * Providers that enables use of custom layout components in layout editor\n * @param layoutRelationsEditorProviders - Array of providers for layout relations editor\n * @param customComponentRegister - Type that represents implementation of custom components register\n */\nexport function provideEditorLayoutCustomComponents(layoutRelationsEditorProviders: Provider[],\n customComponentRegister: Type<CustomComponentsRegister> = CustomComponentsRegister,): Provider[]\n{\n //TODO: maybe remove first parameter\n\n return [\n CUSTOM_COMPONENTS_LAYOUT_COMPONENTS_PROVIDER,\n CUSTOM_COMPONENTS_LAYOUT_MODULE_TYPES_PROVIDER,\n provideStaticPackageSource('custom-components'),\n <ClassProvider>\n {\n provide: CustomComponentsRegister,\n useClass: customComponentRegister,\n },\n ...layoutRelationsEditorProviders,\n ];\n}\n\n/**\n * Providers for relations editor subpackage, that works with layout metadata, with support of static components\n * @param staticRegister - Type that represents implementation of static components register\n */\nexport function provideLayoutRelationsEditorWithStatic(staticRegister: Type<StaticComponentsRegister>): Provider[]\n{\n return [\n ...provideLayoutRelationsEditor(),\n STATIC_COMPONENTS_RELATIONS_NODES_PROVIDER,\n STATIC_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER,\n <ClassProvider>\n {\n provide: StaticComponentsRegister,\n useClass: staticRegister\n },\n provideStaticPackageSource('static-components'),\n ];\n}\n\n/**\n * Gets custom component metadata info\n * @param name - Name of component which metadata are obtained\n * @param injector - Instance of injector used for obtaining required services\n */\nexport async function getCustomComponentMeta(name: string, injector: Injector): Promise<{contentMetadata: Dictionary<ContentComponentData>, metadata: LayoutComponentMetadata|undefined|null}|null>\n{\n const layoutMetadataStorage: MetadataStorage<LayoutComponentMetadata> = injector.get(MetadataStorage);\n const customComponentMetadata = await layoutMetadataStorage.getMetadata(name);\n const logger = injector.get(LOGGER);\n\n if(!customComponentMetadata)\n {\n logger.warn('ContentOptionsPropertiesControlSAComponent: missing layout metadata for custom component!');\n\n return null;\n }\n\n const layoutMetadataIterator = injector.get(LayoutComponentsIteratorService);\n const iterator = layoutMetadataIterator.getIteratorFor(customComponentMetadata);\n const metadataExtractor = injector.get(LayoutEditorMetadataExtractor);\n const customComponentContentMetadata: Dictionary<ContentComponentData> = {};\n\n for await(const component of iterator)\n {\n const metadata = await metadataExtractor.extractMetadata(component.metadata);\n\n if(!metadata)\n {\n logger.warn('ContentOptionsPropertiesControlSAComponent: missing metadata for component!');\n\n continue;\n }\n\n customComponentContentMetadata[component.metadata.id] =\n {\n metadata: component.metadata,\n editorMetadata: metadata,\n };\n }\n\n return {\n contentMetadata: customComponentContentMetadata,\n metadata: customComponentMetadata,\n };\n}"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../layout-relations/src/misc/utils.ts"],"names":[],"mappings":";AACA,OAAO,EAA0B,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAC,sBAAsB,EAAE,2BAA2B,EAAE,aAAa,IAAI,sBAAsB,EAAE,wBAAwB,EAAE,iDAAiD,EAAE,0CAA0C,EAAC,MAAM,iCAAiC,CAAC;AACtQ,OAAO,EAAC,+BAA+B,EAAE,6BAA6B,EAAE,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AACjI,OAAO,EAAC,eAAe,EAAE,0BAA0B,EAAC,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAC,iDAAiD,EAAE,0CAA0C,EAAE,iDAAiD,EAAE,0CAA0C,EAAE,8CAA8C,EAAE,4CAA4C,EAAC,MAAM,aAAa,CAAC;AACvT,OAAO,E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,MAAM,SAAS,qBAAA,CAAA;gBAErB,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAE7E,IAAG,CAAC,QAAQ,EACZ;oBACI,MAAM,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;oBAE3F,SAAS;iBACZ;gBAED,8BAA8B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;oBACrD;wBACI,QAAQ,EAAE,SAAS,CAAC,QAAQ;wBAC5B,cAAc,EAAE,QAAQ;qBAC3B,CAAC;aACL;;;;;;;;;QAED,OAAO;YACH,eAAe,EAAE,8BAA8B;YAC/C,QAAQ,EAAE,uBAAuB;SACpC,CAAC;;CACL","sourcesContent":["import {ClassProvider, FactoryProvider, Injector, Provider, Type} from '@angular/core';\nimport {LayoutComponentMetadata, provideLayout} from '@anglr/dynamic/layout';\nimport {provideRelations} from '@anglr/dynamic/relations';\nimport {provideRelationsEditor, REFRESH_PALETTE_OBSERVABLES, ScopeRegister as RelationsScopeRegister, StaticComponentsRegister, STATIC_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER, STATIC_COMPONENTS_RELATIONS_NODES_PROVIDER} from '@anglr/dynamic/relations-editor';\nimport {LayoutComponentsIteratorService, LayoutEditorMetadataExtractor, provideLayoutEditor} from '@anglr/dynamic/layout-editor';\nimport {MetadataStorage, provideStaticPackageSource} from '@anglr/dynamic';\nimport {LOGGER} from '@anglr/common';\nimport {Dictionary} from '@jscrpt/common';\n\nimport {LAYOUT_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER, LAYOUT_COMPONENTS_RELATIONS_NODES_PROVIDER, CUSTOM_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER, CUSTOM_COMPONENTS_RELATIONS_NODES_PROVIDER, CUSTOM_COMPONENTS_LAYOUT_MODULE_TYPES_PROVIDER, CUSTOM_COMPONENTS_LAYOUT_COMPONENTS_PROVIDER} from './providers';\nimport {LayoutComponentsRegister, LayoutManager, CustomComponentsRegister, ScopeRegister} from '../services';\nimport {ContentComponentData} from '../components';\n\n/**\n * Providers for relations subpackage that works with layout metadata\n */\nexport function provideLayoutRelations(): Provider[]\n{\n return [\n ...provideLayout(),\n ...provideRelations(),\n ];\n}\n\n/**\n * Providers for relations subpackage that works with layout metadata\n */\nexport function provideLayoutRelationsCustomComponents(): Provider[]\n{\n return [\n ...provideLayoutRelations(),\n CUSTOM_COMPONENTS_LAYOUT_COMPONENTS_PROVIDER,\n ];\n}\n\n/**\n * Providers for relations editor subpackage that works with layout metadata\n */\nexport function provideLayoutRelationsEditor(): Provider[]\n{\n const relationsProviders = provideRelationsEditor();\n relationsProviders.splice(relationsProviders.indexOf(RelationsScopeRegister), 1);\n\n return [\n ...provideLayoutEditor(false),\n ...relationsProviders,\n LAYOUT_COMPONENTS_RELATIONS_NODES_PROVIDER,\n LAYOUT_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER,\n LayoutManager,\n LayoutComponentsRegister,\n LayoutComponentsIteratorService,\n <ClassProvider>\n {\n provide: RelationsScopeRegister,\n useClass: ScopeRegister,\n },\n <FactoryProvider>\n {\n provide: REFRESH_PALETTE_OBSERVABLES,\n useFactory: (layoutManager: LayoutManager) =>\n {\n return layoutManager.layoutChange;\n },\n deps: [LayoutManager],\n multi: true\n },\n provideStaticPackageSource('layout-components'),\n ];\n}\n\n/**\n * Providers that enables use of custom relations components in relations editor\n * @param layoutRelationsEditorProviders - Array of providers for layout relations editor\n * @param customComponentRegister - Type that represents implementation of custom components register\n */\nexport function provideEditorRelationsCustomComponents(layoutRelationsEditorProviders: Provider[],\n customComponentRegister: Type<CustomComponentsRegister> = CustomComponentsRegister,): Provider[]\n{\n return [\n CUSTOM_COMPONENTS_RELATIONS_NODES_PROVIDER,\n CUSTOM_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER,\n CUSTOM_COMPONENTS_LAYOUT_COMPONENTS_PROVIDER,\n provideStaticPackageSource('custom-components'),\n <ClassProvider>\n {\n provide: CustomComponentsRegister,\n useClass: customComponentRegister,\n },\n ...layoutRelationsEditorProviders,\n ];\n}\n\n/**\n * Providers that enables use of custom layout components in layout editor\n * @param layoutRelationsEditorProviders - Array of providers for layout relations editor\n * @param customComponentRegister - Type that represents implementation of custom components register\n */\nexport function provideEditorLayoutCustomComponents(layoutRelationsEditorProviders: Provider[],\n customComponentRegister: Type<CustomComponentsRegister> = CustomComponentsRegister,): Provider[]\n{\n //TODO: maybe remove first parameter\n\n return [\n CUSTOM_COMPONENTS_LAYOUT_COMPONENTS_PROVIDER,\n CUSTOM_COMPONENTS_LAYOUT_MODULE_TYPES_PROVIDER,\n provideStaticPackageSource('custom-components'),\n <ClassProvider>\n {\n provide: CustomComponentsRegister,\n useClass: customComponentRegister,\n },\n ...layoutRelationsEditorProviders,\n ];\n}\n\n/**\n * Providers for relations editor subpackage, that works with layout metadata, with support of static components\n * @param staticRegister - Type that represents implementation of static components register\n */\nexport function provideLayoutRelationsEditorWithStatic(staticRegister: Type<StaticComponentsRegister>): Provider[]\n{\n return [\n ...provideLayoutRelationsEditor(),\n STATIC_COMPONENTS_RELATIONS_NODES_PROVIDER,\n STATIC_COMPONENTS_RELATIONS_MODULE_TYPES_PROVIDER,\n <ClassProvider>\n {\n provide: StaticComponentsRegister,\n useClass: staticRegister\n },\n provideStaticPackageSource('static-components'),\n ];\n}\n\n/**\n * Gets custom component metadata info\n * @param name - Name of component which metadata are obtained\n * @param injector - Instance of injector used for obtaining required services\n */\nexport async function getCustomComponentMeta(name: string, injector: Injector): Promise<{contentMetadata: Dictionary<ContentComponentData>, metadata: LayoutComponentMetadata|undefined|null}|null>\n{\n const layoutMetadataStorage: MetadataStorage<LayoutComponentMetadata> = injector.get(MetadataStorage);\n const customComponentMetadata = await layoutMetadataStorage.getMetadata(name);\n const logger = injector.get(LOGGER);\n\n if(!customComponentMetadata)\n {\n logger.warn('ContentOptionsPropertiesControlSAComponent: missing layout metadata for custom component!');\n\n return null;\n }\n\n const layoutMetadataIterator = injector.get(LayoutComponentsIteratorService);\n const iterator = layoutMetadataIterator.getIteratorFor(customComponentMetadata);\n const metadataExtractor = injector.get(LayoutEditorMetadataExtractor);\n const customComponentContentMetadata: Dictionary<ContentComponentData> = {};\n\n for await(const component of iterator)\n {\n const metadata = await metadataExtractor.extractMetadata(component.metadata);\n\n if(!metadata)\n {\n logger.warn('ContentOptionsPropertiesControlSAComponent: missing metadata for component!');\n\n continue;\n }\n\n customComponentContentMetadata[component.metadata.id] =\n {\n metadata: component.metadata,\n editorMetadata: metadata,\n };\n }\n\n return {\n contentMetadata: customComponentContentMetadata,\n metadata: customComponentMetadata,\n };\n}"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getModel.pipe.js","sourceRoot":"","sources":["../../../../../layout-relations/src/pipes/getModel/getModel.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAgB,MAAM,eAAe,CAAC;;AAKlD;;GAEG;AAEH,MAAM,OAAO,cAAc;IAEvB;;;;OAIG;IACI,SAAS,CAAC,KAAa,EAAE,QAA6C;;QAEzE,OAAO,MAAA,MAAA,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,cAAc,CAAC,QAAQ,0CAAE,eAAe,0CAAE,kBAAkB,0CAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,IAAI,KAAK,CAAC,0CAAE,SAAS,mCAAI,IAAI,CAAC;IAC/I,CAAC;;2GAVQ,cAAc;yGAAd,cAAc;2FAAd,cAAc;kBAD1B,IAAI;mBAAC,EAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAC","sourcesContent":["import {Pipe, PipeTransform} from '@angular/core';\nimport {LayoutPropertiesModelType} from '@anglr/dynamic/layout-editor';\n\nimport {ContentComponentData} from '../../components';\n\n/**\n * Gets properties model using its name\n */\n@Pipe({name: 'getModel', standalone: true})\nexport class GetModelSAPipe implements PipeTransform\n{\n /**\n * Gets properties model using its name\n * @param value - Name of model class\n * @param metadata - Metadata containing model\n */\n public transform(value: string, metadata: ContentComponentData|undefined|null,): LayoutPropertiesModelType|null\n {\n return metadata?.editorMetadata.metaInfo?.optionsMetadata?.propertiesMetadata?.find(itm => itm.modelType.name == value)?.modelType ?? null;\n }\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../layout-relations/src/pipes/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC","sourcesContent":["export * from './getModel/getModel.pipe';\nexport * from './propertySelected/propertySelected.pipe';\nexport * from './propertiesMetadata/propertiesMetadata.pipe';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Pipe } from '@angular/core';
|
|
1
|
+
import { Optional, Pipe } from '@angular/core';
|
|
2
2
|
import { LayoutEditorPropertyMetadataExtractor } from '@anglr/dynamic/layout-editor';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
import * as i1 from "@anglr/dynamic/layout-editor";
|
|
@@ -14,18 +14,26 @@ export class PropertiesMetadataSAPipe {
|
|
|
14
14
|
/**
|
|
15
15
|
* Gets properties metadata for for model type
|
|
16
16
|
* @param value - Type of properties model
|
|
17
|
+
* @param propertyExtractor - Extractor used for obtaining metadata for model
|
|
17
18
|
*/
|
|
18
|
-
transform(value) {
|
|
19
|
+
transform(value, propertyExtractor) {
|
|
20
|
+
var _a;
|
|
19
21
|
if (!value) {
|
|
20
22
|
return null;
|
|
21
23
|
}
|
|
24
|
+
(_a = this.propertyExtractor) !== null && _a !== void 0 ? _a : (this.propertyExtractor = propertyExtractor);
|
|
25
|
+
if (!this.propertyExtractor) {
|
|
26
|
+
throw new Error('Please provide LayoutEditorPropertyMetadataExtractor for propertiesMetadata pipe!');
|
|
27
|
+
}
|
|
22
28
|
return this.propertyExtractor.extract(value);
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
|
-
PropertiesMetadataSAPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PropertiesMetadataSAPipe, deps: [{ token: i1.LayoutEditorPropertyMetadataExtractor }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
31
|
+
PropertiesMetadataSAPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PropertiesMetadataSAPipe, deps: [{ token: i1.LayoutEditorPropertyMetadataExtractor, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
26
32
|
PropertiesMetadataSAPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: PropertiesMetadataSAPipe, isStandalone: true, name: "propertiesMetadata" });
|
|
27
33
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PropertiesMetadataSAPipe, decorators: [{
|
|
28
34
|
type: Pipe,
|
|
29
35
|
args: [{ name: 'propertiesMetadata', standalone: true, }]
|
|
30
|
-
}], ctorParameters: function () { return [{ type: i1.LayoutEditorPropertyMetadataExtractor
|
|
36
|
+
}], ctorParameters: function () { return [{ type: i1.LayoutEditorPropertyMetadataExtractor, decorators: [{
|
|
37
|
+
type: Optional
|
|
38
|
+
}] }]; } });
|
|
31
39
|
//# sourceMappingURL=propertiesMetadata.pipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertiesMetadata.pipe.js","sourceRoot":"","sources":["../../../../../layout-relations/src/pipes/propertiesMetadata/propertiesMetadata.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAA+B,qCAAqC,EAA4B,MAAM,8BAA8B,CAAC;;;AAG5I;;GAEG;AAEH,MAAM,OAAO,wBAAwB;IAEjC,iEAAiE;IACjE,YAAkC,iBAAyD;QAAzD,sBAAiB,GAAjB,iBAAiB,CAAwC;IAE3F,CAAC;IAED,sGAAsG;IAEtG;;;;OAIG;IACI,SAAS,CAAC,KAAqC,EAAE,iBAAyD;;QAE7G,IAAG,CAAC,KAAK,EACT;YACI,OAAO,IAAI,CAAC;SACf;QAED,MAAA,IAAI,CAAC,iBAAiB,oCAAtB,IAAI,CAAC,iBAAiB,GAAK,iBAAiB,EAAC;QAE7C,IAAG,CAAC,IAAI,CAAC,iBAAiB,EAC1B;YACI,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;SACxG;QAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;;qHA7BQ,wBAAwB;mHAAxB,wBAAwB;2FAAxB,wBAAwB;kBADpC,IAAI;mBAAC,EAAC,IAAI,EAAE,oBAAoB,EAAE,UAAU,EAAE,IAAI,GAAE;;0BAIpC,QAAQ","sourcesContent":["import {Optional, Pipe, PipeTransform} from '@angular/core';\nimport {LayoutEditorPropertyMetadata, LayoutEditorPropertyMetadataExtractor, LayoutPropertiesModelType} from '@anglr/dynamic/layout-editor';\nimport {Dictionary} from '@jscrpt/common';\n\n/**\n * Gets properties metadata for for model type\n */\n@Pipe({name: 'propertiesMetadata', standalone: true,})\nexport class PropertiesMetadataSAPipe implements PipeTransform\n{\n //######################### constructor #########################\n constructor(@Optional() protected propertyExtractor?: LayoutEditorPropertyMetadataExtractor,)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Gets properties metadata for for model type\n * @param value - Type of properties model\n * @param propertyExtractor - Extractor used for obtaining metadata for model\n */\n public transform(value: LayoutPropertiesModelType|null, propertyExtractor?: LayoutEditorPropertyMetadataExtractor): Dictionary<LayoutEditorPropertyMetadata>|null\n {\n if(!value)\n {\n return null;\n }\n\n this.propertyExtractor ??= propertyExtractor;\n\n if(!this.propertyExtractor)\n {\n throw new Error('Please provide LayoutEditorPropertyMetadataExtractor for propertiesMetadata pipe!');\n }\n\n return this.propertyExtractor.extract(value);\n }\n}"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Pipe } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Gets indication whether is property selected
|
|
5
|
+
*/
|
|
6
|
+
export class PropertySelectedSAPipe {
|
|
7
|
+
/**
|
|
8
|
+
* Gets indication whether is property selected
|
|
9
|
+
* @param value - Stores selected properties in their models and components
|
|
10
|
+
* @param component - Name of component
|
|
11
|
+
* @param model - Name of model
|
|
12
|
+
* @param property - Name of property
|
|
13
|
+
*/
|
|
14
|
+
transform(value, component, model, property) {
|
|
15
|
+
var _a;
|
|
16
|
+
if (!((_a = value[component]) === null || _a === void 0 ? void 0 : _a[model])) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return value[component][model].indexOf(property) >= 0;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
PropertySelectedSAPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PropertySelectedSAPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
23
|
+
PropertySelectedSAPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: PropertySelectedSAPipe, isStandalone: true, name: "propertySelected" });
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PropertySelectedSAPipe, decorators: [{
|
|
25
|
+
type: Pipe,
|
|
26
|
+
args: [{ name: 'propertySelected', standalone: true }]
|
|
27
|
+
}] });
|
|
28
|
+
//# sourceMappingURL=propertySelected.pipe.js.map
|