@anglr/dynamic 1.0.0-beta.20220908092437 → 1.0.0-beta.20220908101526
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/basic-components/src/dynamicItems/transformData/node/transformDataNode.component.d.ts +4 -0
- package/basic-components/src/dynamicItems/transformData/node/transformDataNode.component.d.ts.map +1 -1
- package/basic-components/src/dynamicItems/transformData/node/transformDataNode.component.html +1 -1
- package/basic-components/src/dynamicItems/transformData/transformData.interface.d.ts +3 -8
- package/basic-components/src/dynamicItems/transformData/transformData.interface.d.ts.map +1 -1
- package/basic-components/src/dynamicItems/transformData/transformData.options.d.ts +4 -0
- package/basic-components/src/dynamicItems/transformData/transformData.options.d.ts.map +1 -1
- package/basic-components/src/dynamicItems/transformData/transformData.relations.d.ts +21 -2
- package/basic-components/src/dynamicItems/transformData/transformData.relations.d.ts.map +1 -1
- package/es2015/basic-components/src/dynamicItems/transformData/node/transformDataNode.component.js +20 -12
- package/es2015/basic-components/src/dynamicItems/transformData/node/transformDataNode.component.js.map +1 -1
- package/es2015/basic-components/src/dynamicItems/transformData/transformData.interface.js.map +1 -1
- package/es2015/basic-components/src/dynamicItems/transformData/transformData.options.js.map +1 -1
- package/es2015/basic-components/src/dynamicItems/transformData/transformData.relations.js +45 -3
- package/es2015/basic-components/src/dynamicItems/transformData/transformData.relations.js.map +1 -1
- package/es2015/relations/src/misc/utils.js +2 -1
- package/es2015/relations/src/misc/utils.js.map +1 -1
- package/es2015/relations/src/services/codeExecutor/codeExecutor.service.js +64 -0
- package/es2015/relations/src/services/codeExecutor/codeExecutor.service.js.map +1 -0
- package/es2015/relations/src/services/index.js +1 -0
- package/es2015/relations/src/services/index.js.map +1 -1
- package/es2015/src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.js +2 -2
- package/es2015/src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.js.map +1 -1
- package/es2020/basic-components/src/dynamicItems/transformData/node/transformDataNode.component.js +19 -12
- package/es2020/basic-components/src/dynamicItems/transformData/node/transformDataNode.component.js.map +1 -1
- package/es2020/basic-components/src/dynamicItems/transformData/transformData.interface.js.map +1 -1
- package/es2020/basic-components/src/dynamicItems/transformData/transformData.options.js.map +1 -1
- package/es2020/basic-components/src/dynamicItems/transformData/transformData.relations.js +43 -3
- package/es2020/basic-components/src/dynamicItems/transformData/transformData.relations.js.map +1 -1
- package/es2020/relations/src/misc/utils.js +2 -1
- package/es2020/relations/src/misc/utils.js.map +1 -1
- package/es2020/relations/src/services/codeExecutor/codeExecutor.service.js +61 -0
- package/es2020/relations/src/services/codeExecutor/codeExecutor.service.js.map +1 -0
- package/es2020/relations/src/services/index.js +1 -0
- package/es2020/relations/src/services/index.js.map +1 -1
- package/es2020/src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.js +2 -2
- package/es2020/src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.js.map +1 -1
- package/package.json +1 -1
- package/relations/src/misc/utils.d.ts.map +1 -1
- package/relations/src/services/codeExecutor/codeExecutor.service.d.ts +22 -0
- package/relations/src/services/codeExecutor/codeExecutor.service.d.ts.map +1 -0
- package/relations/src/services/index.d.ts +1 -0
- package/relations/src/services/index.d.ts.map +1 -1
- package/src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.html +2 -2
- package/version.bak +1 -1
package/basic-components/src/dynamicItems/transformData/node/transformDataNode.component.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ export declare class TransformDataNodeSAComponent extends RelationsNodeBase<Tran
|
|
|
13
13
|
* Shows code editor
|
|
14
14
|
*/
|
|
15
15
|
protected showCodeEditor(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* @inheritdoc
|
|
18
|
+
*/
|
|
19
|
+
protected metadataSet(): void;
|
|
16
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<TransformDataNodeSAComponent, never>;
|
|
17
21
|
static ɵcmp: i0.ɵɵComponentDeclaration<TransformDataNodeSAComponent, "transform-data-node", never, {}, {}, never, never, true>;
|
|
18
22
|
}
|
package/basic-components/src/dynamicItems/transformData/node/transformDataNode.component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformDataNode.component.d.ts","sourceRoot":"","sources":["transformDataNode.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,iBAAiB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAEhG,OAAO,EAAC,aAAa,EAAE,iBAAiB,EAA8F,MAAM,iCAAiC,CAAC;AAC9K,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"transformDataNode.component.d.ts","sourceRoot":"","sources":["transformDataNode.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,iBAAiB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAEhG,OAAO,EAAC,aAAa,EAAE,iBAAiB,EAA8F,MAAM,iCAAiC,CAAC;AAC9K,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAM3D,OAAO,EAAC,mCAAmC,EAAE,6BAA6B,EAAC,MAAM,0BAA0B,CAAC;;AAI5G;;GAEG;AACH,qBAaa,4BAA6B,SAAQ,iBAAiB,CAAC,6BAA6B,EAAE,mCAAmC,CAAE,YAAW,aAAa,CAAC,6BAA6B,EAAE,mCAAmC,CAAC;IAKpN,SAAS,CAAC,MAAM,EAAE,mBAAmB;gBAFrC,cAAc,EAAE,iBAAiB,EACjC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,EACtB,MAAM,EAAE,mBAAmB;IAOjD;;OAEG;cACa,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAsC/C;;OAEG;cACgB,WAAW,IAAI,IAAI;yCAxD7B,4BAA4B;2CAA5B,4BAA4B;CA+DxC"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Transforms data to another form of data
|
|
3
|
+
* @param data - Data to be transformed
|
|
3
4
|
*/
|
|
4
|
-
export
|
|
5
|
-
/**
|
|
6
|
-
* Transforms data to another form of data
|
|
7
|
-
* @param data - Data to be transformed
|
|
8
|
-
*/
|
|
9
|
-
transformData(data: TData): TResult;
|
|
10
|
-
}
|
|
5
|
+
export declare type TransformData<TData = any, TResult = any> = (data: TData) => TResult;
|
|
11
6
|
//# sourceMappingURL=transformData.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformData.interface.d.ts","sourceRoot":"","sources":["transformData.interface.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"transformData.interface.d.ts","sourceRoot":"","sources":["transformData.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,aAAa,CAAC,KAAK,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformData.options.d.ts","sourceRoot":"","sources":["transformData.options.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAE1C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAEhD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB"}
|
|
1
|
+
{"version":3,"file":"transformData.options.d.ts","sourceRoot":"","sources":["transformData.options.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAE1C;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAEhD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1,18 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Injector, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { CodeExecutor, RelationsComponent } from '@anglr/dynamic/relations';
|
|
2
3
|
import { TransformDataRelationsOptions } from './transformData.options';
|
|
3
4
|
/**
|
|
4
5
|
* Transform data relations component
|
|
5
6
|
*/
|
|
6
|
-
export declare class TransformDataRelations implements RelationsComponent<TransformDataRelationsOptions> {
|
|
7
|
+
export declare class TransformDataRelations<TData = any, TTransformedData = any> implements RelationsComponent<TransformDataRelationsOptions> {
|
|
8
|
+
protected injector: Injector;
|
|
7
9
|
/**
|
|
8
10
|
* Options used in this relations component
|
|
9
11
|
*/
|
|
10
12
|
protected ɵRelationsOptions: TransformDataRelationsOptions | undefined | null;
|
|
13
|
+
/**
|
|
14
|
+
* Code executor used for execution o
|
|
15
|
+
*/
|
|
16
|
+
protected codeExecutor: CodeExecutor;
|
|
11
17
|
/**
|
|
12
18
|
* @inheritdoc
|
|
13
19
|
*/
|
|
14
20
|
get relationsOptions(): TransformDataRelationsOptions | undefined | null;
|
|
15
21
|
set relationsOptions(value: TransformDataRelationsOptions | undefined | null);
|
|
22
|
+
/**
|
|
23
|
+
* Data to be transformed
|
|
24
|
+
*/
|
|
25
|
+
data: TData | undefined | null;
|
|
26
|
+
/**
|
|
27
|
+
* Transformed data
|
|
28
|
+
*/
|
|
29
|
+
transformedData: TTransformedData | undefined | null;
|
|
30
|
+
constructor(injector: Injector);
|
|
31
|
+
/**
|
|
32
|
+
* Called when input value changes
|
|
33
|
+
*/
|
|
34
|
+
ngOnChanges(changes: SimpleChanges): Promise<void>;
|
|
16
35
|
/**
|
|
17
36
|
* @inheritdoc
|
|
18
37
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformData.relations.d.ts","sourceRoot":"","sources":["transformData.relations.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"transformData.relations.d.ts","sourceRoot":"","sources":["transformData.relations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAS,aAAa,EAAC,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAC,YAAY,EAAyC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAKjH,OAAO,EAAC,6BAA6B,EAAC,MAAM,yBAAyB,CAAC;AAGtE;;GAEG;AACH,qBAEa,sBAAsB,CAAC,KAAK,GAAG,GAAG,EAAE,gBAAgB,GAAG,GAAG,CAAE,YAAW,kBAAkB,CAAC,6BAA6B,CAAC;IA6CrH,SAAS,CAAC,QAAQ,EAAE,QAAQ;IAzCxC;;OAEG;IACH,SAAS,CAAC,iBAAiB,EAAE,6BAA6B,GAAC,SAAS,GAAC,IAAI,CAAC;IAE1E;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,YAAY,CAAmC;IAIvE;;OAEG;IACH,IAAW,gBAAgB,IAAI,6BAA6B,GAAC,SAAS,GAAC,IAAI,CAG1E;IACD,IAAW,gBAAgB,CAAC,KAAK,EAAE,6BAA6B,GAAC,SAAS,GAAC,IAAI,EAG9E;IAID;;OAEG;IAEI,IAAI,EAAE,KAAK,GAAC,SAAS,GAAC,IAAI,CAAC;IAIlC;;OAEG;IAEI,eAAe,EAAE,gBAAgB,GAAC,SAAS,GAAC,IAAI,CAAC;gBAGlC,QAAQ,EAAE,QAAQ;IAMxC;;OAEG;IACU,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IA6B/D;;OAEG;IACI,iBAAiB,IAAI,IAAI;CAGnC"}
|
package/es2015/basic-components/src/dynamicItems/transformData/node/transformDataNode.component.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Component, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef } fro
|
|
|
3
3
|
import { CodeEditorDialogComponent, TypescriptLanguageModel } from '@anglr/dynamic';
|
|
4
4
|
import { RelationsNodeBase, RelationNodeOutputSAComponent, RelationsNodeHeaderSAComponent, RelationNodeInputSAComponent } from '@anglr/dynamic/relations-editor';
|
|
5
5
|
import { TitledDialogService } from '@anglr/common/material';
|
|
6
|
+
import { generateId } from '@jscrpt/common';
|
|
6
7
|
import typings from '!!raw-loader?esModule!../transformData.interface';
|
|
7
8
|
import { languages } from 'monaco-editor';
|
|
8
9
|
import { lastValueFrom } from 'rxjs';
|
|
@@ -35,18 +36,14 @@ export class TransformDataNodeSAComponent extends RelationsNodeBase {
|
|
|
35
36
|
languageModel: TypescriptLanguageModel(`import {TransformData} from 'transformData';
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
|
-
*
|
|
39
|
+
* Transformer function that performs transformation
|
|
39
40
|
*/
|
|
40
|
-
|
|
41
|
+
const transformer: TransformData<any, any> = data =>
|
|
41
42
|
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
43
|
+
return data;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default transformer;
|
|
50
47
|
`),
|
|
51
48
|
}
|
|
52
49
|
}).afterClosed());
|
|
@@ -58,15 +55,26 @@ export default class Transformer implements TransformData
|
|
|
58
55
|
this.metadata.nodeMetadata.options.content = result.content;
|
|
59
56
|
});
|
|
60
57
|
}
|
|
58
|
+
//######################### protected methods - overrides #########################
|
|
59
|
+
/**
|
|
60
|
+
* @inheritdoc
|
|
61
|
+
*/
|
|
62
|
+
metadataSet() {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
var _c;
|
|
65
|
+
if ((_a = this.metadata) === null || _a === void 0 ? void 0 : _a.relationsOptions) {
|
|
66
|
+
(_b = (_c = this.metadata.relationsOptions).id) !== null && _b !== void 0 ? _b : (_c.id = generateId(12));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
70
|
TransformDataNodeSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TransformDataNodeSAComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i1.TitledDialogService }], target: i0.ɵɵFactoryTarget.Component });
|
|
63
|
-
TransformDataNodeSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: TransformDataNodeSAComponent, isStandalone: true, selector: "transform-data-node", usesInheritance: true, ngImport: i0, template: "<relations-node-header [parent]=\"this\" [destroySubject]=\"destroySubject\" name=\"transform code\"></relations-node-header>\n\n<div class=\"node-content\">\n <div class=\"inputs-outputs\">\n <div class=\"inputs\">\n <div class=\"input\">\n <relation-node-input [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"data\" [parent]=\"this\"></relation-node-input>\n <div>data</div>\n </div>\n </div>\n\n <div class=\"outputs\">\n <div class=\"output\">\n <div>transformed data</div>\n <relation-node-output [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"transformedData\" [parent]=\"this\"></relation-node-output>\n </div>\n </div>\n </div>\n\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"showCodeEditor()\">\n <span>
|
|
71
|
+
TransformDataNodeSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: TransformDataNodeSAComponent, isStandalone: true, selector: "transform-data-node", usesInheritance: true, ngImport: i0, template: "<relations-node-header [parent]=\"this\" [destroySubject]=\"destroySubject\" name=\"transform code\"></relations-node-header>\n\n<div class=\"node-content\">\n <div class=\"inputs-outputs\">\n <div class=\"inputs\">\n <div class=\"input\">\n <relation-node-input [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"data\" [parent]=\"this\"></relation-node-input>\n <div>data</div>\n </div>\n </div>\n\n <div class=\"outputs\">\n <div class=\"output\">\n <div>transformed data</div>\n <relation-node-output [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"transformedData\" [parent]=\"this\"></relation-node-output>\n </div>\n </div>\n </div>\n\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"showCodeEditor()\">\n <span>code</span>\n </button>\n</div>", dependencies: [{ kind: "component", type: RelationsNodeHeaderSAComponent, selector: "relations-node-header", inputs: ["parent", "destroySubject", "name"] }, { kind: "component", type: RelationNodeInputSAComponent, selector: "relation-node-input" }, { kind: "component", type: RelationNodeOutputSAComponent, selector: "relation-node-output" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
64
72
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TransformDataNodeSAComponent, decorators: [{
|
|
65
73
|
type: Component,
|
|
66
74
|
args: [{ selector: 'transform-data-node', standalone: true, imports: [
|
|
67
75
|
RelationsNodeHeaderSAComponent,
|
|
68
76
|
RelationNodeInputSAComponent,
|
|
69
77
|
RelationNodeOutputSAComponent,
|
|
70
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<relations-node-header [parent]=\"this\" [destroySubject]=\"destroySubject\" name=\"transform code\"></relations-node-header>\n\n<div class=\"node-content\">\n <div class=\"inputs-outputs\">\n <div class=\"inputs\">\n <div class=\"input\">\n <relation-node-input [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"data\" [parent]=\"this\"></relation-node-input>\n <div>data</div>\n </div>\n </div>\n\n <div class=\"outputs\">\n <div class=\"output\">\n <div>transformed data</div>\n <relation-node-output [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"transformedData\" [parent]=\"this\"></relation-node-output>\n </div>\n </div>\n </div>\n\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"showCodeEditor()\">\n <span>
|
|
78
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<relations-node-header [parent]=\"this\" [destroySubject]=\"destroySubject\" name=\"transform code\"></relations-node-header>\n\n<div class=\"node-content\">\n <div class=\"inputs-outputs\">\n <div class=\"inputs\">\n <div class=\"input\">\n <relation-node-input [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"data\" [parent]=\"this\"></relation-node-input>\n <div>data</div>\n </div>\n </div>\n\n <div class=\"outputs\">\n <div class=\"output\">\n <div>transformed data</div>\n <relation-node-output [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"transformedData\" [parent]=\"this\"></relation-node-output>\n </div>\n </div>\n </div>\n\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"showCodeEditor()\">\n <span>code</span>\n </button>\n</div>" }]
|
|
71
79
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i1.TitledDialogService }]; } });
|
|
72
80
|
//# sourceMappingURL=transformDataNode.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformDataNode.component.js","sourceRoot":"","sources":["../../../../../../basic-components/src/dynamicItems/transformData/node/transformDataNode.component.ts","../../../../../../basic-components/src/dynamicItems/transformData/node/transformDataNode.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAChG,OAAO,EAAoB,yBAAyB,EAAwB,uBAAuB,EAAC,MAAM,gBAAgB,CAAC;AAC3H,OAAO,EAAgB,iBAAiB,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,4BAA4B,EAAC,MAAM,iCAAiC,CAAC;AAC9K,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,OAAO,MAAM,kDAAkD,CAAC;AACvE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,MAAM,CAAC;;;AAInC,SAAS,CAAC,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,OAAO,EAAE,sDAAsD,CAAC,CAAC;AAErH;;GAEG;AAcH,MAAM,OAAO,4BAA6B,SAAQ,iBAAqF;IAEvI,iEAAiE;IAC7D,YAAY,cAAiC,EACjC,OAAgC,EACtB,MAA2B;QAE7C,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAFb,WAAM,GAAN,MAAM,CAAqB;IAGjD,CAAC;IAED,2FAA2F;IAE3F;;OAEG;IACa,cAAc;;;;YAE1B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAA0E,yBAAyB,EACtJ;gBACI,KAAK,EAAE,aAAa;gBACpB,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,MAAM;gBACd,IAAI,EACJ;oBACI,OAAO,EAAE,MAAA,MAAA,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,YAAY,0CAAE,OAAO,0CAAE,OAAO,mCAAI,EAAE;oBAC5D,aAAa,EAAE,uBAAuB,CACtD
|
|
1
|
+
{"version":3,"file":"transformDataNode.component.js","sourceRoot":"","sources":["../../../../../../basic-components/src/dynamicItems/transformData/node/transformDataNode.component.ts","../../../../../../basic-components/src/dynamicItems/transformData/node/transformDataNode.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAChG,OAAO,EAAoB,yBAAyB,EAAwB,uBAAuB,EAAC,MAAM,gBAAgB,CAAC;AAC3H,OAAO,EAAgB,iBAAiB,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,4BAA4B,EAAC,MAAM,iCAAiC,CAAC;AAC9K,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,OAAO,MAAM,kDAAkD,CAAC;AACvE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,MAAM,CAAC;;;AAInC,SAAS,CAAC,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,OAAO,EAAE,sDAAsD,CAAC,CAAC;AAErH;;GAEG;AAcH,MAAM,OAAO,4BAA6B,SAAQ,iBAAqF;IAEvI,iEAAiE;IAC7D,YAAY,cAAiC,EACjC,OAAgC,EACtB,MAA2B;QAE7C,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAFb,WAAM,GAAN,MAAM,CAAqB;IAGjD,CAAC;IAED,2FAA2F;IAE3F;;OAEG;IACa,cAAc;;;;YAE1B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAA0E,yBAAyB,EACtJ;gBACI,KAAK,EAAE,aAAa;gBACpB,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,MAAM;gBACd,IAAI,EACJ;oBACI,OAAO,EAAE,MAAA,MAAA,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,YAAY,0CAAE,OAAO,0CAAE,OAAO,mCAAI,EAAE;oBAC5D,aAAa,EAAE,uBAAuB,CACtD;;;;;;;;;;;CAWC,CAAC;iBACW;aACJ,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YAElB,IAAG,CAAC,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,gBAAgB,CAAA,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,EAC7E;gBACI,OAAO;aACV;YAED,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;YAClD,YAAA,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAC,OAAO,uCAAP,OAAO,GAAK,EAAC,OAAO,EAAE,EAAE,EAAC,EAAC;YACrD,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;;KAC/D;IAED,mFAAmF;IAEnF;;OAEG;IACgB,WAAW;;;QAE1B,IAAG,MAAA,IAAI,CAAC,QAAQ,0CAAE,gBAAgB,EAClC;YACI,YAAA,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAC,EAAE,uCAAF,EAAE,GAAK,UAAU,CAAC,EAAE,CAAC,EAAC;SACxD;IACL,CAAC;;yHA9DQ,4BAA4B;6GAA5B,4BAA4B,sGC7BzC,67BAsBM,4CDCE,8BAA8B,gHAC9B,4BAA4B,gEAC5B,6BAA6B;2FAIxB,4BAA4B;kBAbxC,SAAS;+BAEI,qBAAqB,cAEnB,IAAI,WAEhB;wBACI,8BAA8B;wBAC9B,4BAA4B;wBAC5B,6BAA6B;qBAChC,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef} from '@angular/core';\nimport {CodeEditorContent, CodeEditorDialogComponent, CodeEditorDialogData, TypescriptLanguageModel} from '@anglr/dynamic';\nimport {RelationsNode, RelationsNodeBase, RelationNodeOutputSAComponent, RelationsNodeHeaderSAComponent, RelationNodeInputSAComponent} from '@anglr/dynamic/relations-editor';\nimport {TitledDialogService} from '@anglr/common/material';\nimport {generateId} from '@jscrpt/common';\nimport typings from '!!raw-loader?esModule!../transformData.interface';\nimport {languages} from 'monaco-editor';\nimport {lastValueFrom} from 'rxjs';\n\nimport {TransformDataRelationsEditorOptions, TransformDataRelationsOptions} from '../transformData.options';\n\nlanguages.typescript.typescriptDefaults.addExtraLib(typings, 'file:///node_modules/@types/transformData/index.d.ts');\n\n/**\n * Relations node component for transform data\n */\n@Component(\n{\n selector: 'transform-data-node',\n templateUrl: 'transformDataNode.component.html',\n standalone: true,\n imports:\n [\n RelationsNodeHeaderSAComponent,\n RelationNodeInputSAComponent,\n RelationNodeOutputSAComponent,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class TransformDataNodeSAComponent extends RelationsNodeBase<TransformDataRelationsOptions, TransformDataRelationsEditorOptions> implements RelationsNode<TransformDataRelationsOptions, TransformDataRelationsEditorOptions>\n{\n//######################### constructor #########################\n constructor(changeDetector: ChangeDetectorRef,\n element: ElementRef<HTMLElement>,\n protected dialog: TitledDialogService,)\n {\n super(changeDetector, element);\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Shows code editor\n */\n protected async showCodeEditor(): Promise<void>\n {\n const result = await lastValueFrom(this.dialog.open<CodeEditorDialogComponent, CodeEditorDialogData, CodeEditorContent|null>(CodeEditorDialogComponent,\n {\n title: 'Code editor',\n width: '75vw',\n height: '75vh',\n data: \n {\n content: this.metadata?.nodeMetadata?.options?.content ?? '',\n languageModel: TypescriptLanguageModel(\n`import {TransformData} from 'transformData';\n\n/**\n * Transformer function that performs transformation\n */\nconst transformer: TransformData<any, any> = data =>\n{\n return data;\n};\n \nexport default transformer;\n`),\n }\n }).afterClosed());\n\n if(!this.metadata?.relationsOptions || !result || !this.metadata.nodeMetadata)\n {\n return;\n }\n\n this.metadata.relationsOptions.code = result.code;\n this.metadata.nodeMetadata.options ??= {content: ''};\n this.metadata.nodeMetadata.options.content = result.content;\n }\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected override metadataSet(): void\n {\n if(this.metadata?.relationsOptions)\n {\n this.metadata.relationsOptions.id ??= generateId(12);\n }\n }\n}","<relations-node-header [parent]=\"this\" [destroySubject]=\"destroySubject\" name=\"transform code\"></relations-node-header>\n\n<div class=\"node-content\">\n <div class=\"inputs-outputs\">\n <div class=\"inputs\">\n <div class=\"input\">\n <relation-node-input [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"data\" [parent]=\"this\"></relation-node-input>\n <div>data</div>\n </div>\n </div>\n\n <div class=\"outputs\">\n <div class=\"output\">\n <div>transformed data</div>\n <relation-node-output [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"transformedData\" [parent]=\"this\"></relation-node-output>\n </div>\n </div>\n </div>\n\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"showCodeEditor()\">\n <span>code</span>\n </button>\n</div>"]}
|
package/es2015/basic-components/src/dynamicItems/transformData/transformData.interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformData.interface.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"file":"transformData.interface.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Transforms data to another form of data\n * @param data - Data to be transformed\n */\nexport type TransformData<TData = any, TResult = any> = (data: TData) => TResult;"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformData.options.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Options for transform data relations\n */\nexport interface TransformDataRelationsOptions\n{\n /**\n * Code that should be executed for data transformation\n */\n code: string;\n}\n\n/**\n * Options for transform data relations\n */\nexport interface TransformDataRelationsEditorOptions\n{\n /**\n * Contents of code editor that is being compiled\n */\n content: string;\n}"]}
|
|
1
|
+
{"version":3,"file":"transformData.options.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Options for transform data relations\n */\nexport interface TransformDataRelationsOptions\n{\n /**\n * Unique id that is generated for code\n */\n id: string;\n\n /**\n * Code that should be executed for data transformation\n */\n code: string;\n}\n\n/**\n * Options for transform data relations\n */\nexport interface TransformDataRelationsEditorOptions\n{\n /**\n * Contents of code editor that is being compiled\n */\n content: string;\n}"]}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
1
|
+
import { __awaiter, __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Injector, Input } from '@angular/core';
|
|
3
|
+
import { CodeExecutor, DynamicOutput, PureRelationsComponent } from '@anglr/dynamic/relations';
|
|
3
4
|
import { RelationsEditorMetadata } from '@anglr/dynamic/relations-editor';
|
|
5
|
+
import { nameof } from '@jscrpt/common';
|
|
4
6
|
import { TransformDataRelationsMetadataLoader } from './transformData.metadata';
|
|
5
7
|
/**
|
|
6
8
|
* Transform data relations component
|
|
7
9
|
*/
|
|
8
10
|
let TransformDataRelations = class TransformDataRelations {
|
|
11
|
+
//######################### constructor #########################
|
|
12
|
+
constructor(injector) {
|
|
13
|
+
this.injector = injector;
|
|
14
|
+
/**
|
|
15
|
+
* Code executor used for execution o
|
|
16
|
+
*/
|
|
17
|
+
this.codeExecutor = this.injector.get(CodeExecutor);
|
|
18
|
+
}
|
|
9
19
|
//######################### public properties - implementation of RelationsComponent #########################
|
|
10
20
|
/**
|
|
11
21
|
* @inheritdoc
|
|
@@ -16,6 +26,29 @@ let TransformDataRelations = class TransformDataRelations {
|
|
|
16
26
|
set relationsOptions(value) {
|
|
17
27
|
this.ɵRelationsOptions = value;
|
|
18
28
|
}
|
|
29
|
+
//######################### public methods - implementation of OnChanges #########################
|
|
30
|
+
/**
|
|
31
|
+
* Called when input value changes
|
|
32
|
+
*/
|
|
33
|
+
ngOnChanges(changes) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
if (nameof('data') in changes) {
|
|
36
|
+
if (!this.relationsOptions) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const transformer = yield this.codeExecutor.loadData(this.relationsOptions.id, this.relationsOptions.code);
|
|
40
|
+
if (!transformer) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
this.transformedData = transformer(this.data);
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
console.error(e);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
19
52
|
//######################### public properties - dynamic outputs #########################
|
|
20
53
|
/**
|
|
21
54
|
* @inheritdoc
|
|
@@ -23,9 +56,18 @@ let TransformDataRelations = class TransformDataRelations {
|
|
|
23
56
|
invalidateVisuals() {
|
|
24
57
|
}
|
|
25
58
|
};
|
|
59
|
+
__decorate([
|
|
60
|
+
Input(),
|
|
61
|
+
__metadata("design:type", Object)
|
|
62
|
+
], TransformDataRelations.prototype, "data", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
DynamicOutput(),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], TransformDataRelations.prototype, "transformedData", void 0);
|
|
26
67
|
TransformDataRelations = __decorate([
|
|
27
68
|
PureRelationsComponent(),
|
|
28
|
-
RelationsEditorMetadata(TransformDataRelationsMetadataLoader)
|
|
69
|
+
RelationsEditorMetadata(TransformDataRelationsMetadataLoader),
|
|
70
|
+
__metadata("design:paramtypes", [Injector])
|
|
29
71
|
], TransformDataRelations);
|
|
30
72
|
export { TransformDataRelations };
|
|
31
73
|
//# sourceMappingURL=transformData.relations.js.map
|
package/es2015/basic-components/src/dynamicItems/transformData/transformData.relations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformData.relations.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.relations.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,sBAAsB,EAAqB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"transformData.relations.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.relations.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAC,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAqB,MAAM,0BAA0B,CAAC;AACjH,OAAO,EAAC,uBAAuB,EAAC,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,oCAAoC,EAAC,MAAM,0BAA0B,CAAC;AAI9E;;GAEG;AAGH,IAAa,sBAAsB,GAAnC,MAAa,sBAAsB;IA4C/B,iEAAiE;IACjE,YAAsB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;QApCxC;;WAEG;QACO,iBAAY,GAAiB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAmCvE,CAAC;IAjCD,8GAA8G;IAE9G;;OAEG;IACH,IAAW,gBAAgB;QAEvB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IACD,IAAW,gBAAgB,CAAC,KAAmD;QAE3E,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACnC,CAAC;IAuBD,kGAAkG;IAElG;;OAEG;IACU,WAAW,CAAC,OAAsB;;YAE3C,IAAG,MAAM,CAAyB,MAAM,CAAC,IAAI,OAAO,EACpD;gBACI,IAAG,CAAC,IAAI,CAAC,gBAAgB,EACzB;oBACI,OAAO;iBACV;gBAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAgB,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBAE1H,IAAG,CAAC,WAAW,EACf;oBACI,OAAO;iBACV;gBAED,IACA;oBACI,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACjD;gBACD,OAAM,CAAC,EACP;oBACI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBACpB;aACJ;QACL,CAAC;KAAA;IAED,yFAAyF;IAEzF;;OAEG;IACI,iBAAiB;IAExB,CAAC;CACJ,CAAA;AAvDG;IADC,KAAK,EAAE;;oDAC0B;AAQlC;IADC,aAAa,EAAE;;+DACwC;AA1C/C,sBAAsB;IAFlC,sBAAsB,EAAE;IACxB,uBAAuB,CAAC,oCAAoC,CAAC;qCA8C1B,QAAQ;GA7C/B,sBAAsB,CAyFlC;SAzFY,sBAAsB","sourcesContent":["import {Injector, Input, SimpleChanges} from '@angular/core';\nimport {CodeExecutor, DynamicOutput, PureRelationsComponent, RelationsComponent} from '@anglr/dynamic/relations';\nimport {RelationsEditorMetadata} from '@anglr/dynamic/relations-editor';\nimport {nameof} from '@jscrpt/common';\n\nimport {TransformDataRelationsMetadataLoader} from './transformData.metadata';\nimport {TransformDataRelationsOptions} from './transformData.options';\nimport {TransformData} from './transformData.interface';\n\n/**\n * Transform data relations component\n */\n@PureRelationsComponent()\n@RelationsEditorMetadata(TransformDataRelationsMetadataLoader)\nexport class TransformDataRelations<TData = any, TTransformedData = any> implements RelationsComponent<TransformDataRelationsOptions>\n{\n //######################### protected properties #########################\n\n /**\n * Options used in this relations component\n */\n protected ɵRelationsOptions: TransformDataRelationsOptions|undefined|null;\n\n /**\n * Code executor used for execution o\n */\n protected codeExecutor: CodeExecutor = this.injector.get(CodeExecutor);\n\n //######################### public properties - implementation of RelationsComponent #########################\n\n /**\n * @inheritdoc\n */\n public get relationsOptions(): TransformDataRelationsOptions|undefined|null\n {\n return this.ɵRelationsOptions;\n }\n public set relationsOptions(value: TransformDataRelationsOptions|undefined|null)\n {\n this.ɵRelationsOptions = value;\n }\n\n //######################### public properties - inputs #########################\n\n /**\n * Data to be transformed\n */\n @Input()\n public data: TData|undefined|null;\n\n //######################### public properties - outputs #########################\n\n /**\n * Transformed data\n */\n @DynamicOutput()\n public transformedData: TTransformedData|undefined|null;\n\n //######################### constructor #########################\n constructor(protected injector: Injector,)\n {\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public async ngOnChanges(changes: SimpleChanges): Promise<void>\n {\n if(nameof<TransformDataRelations>('data') in changes)\n {\n if(!this.relationsOptions)\n {\n return;\n }\n\n const transformer = await this.codeExecutor.loadData<TransformData>(this.relationsOptions.id, this.relationsOptions.code);\n\n if(!transformer)\n {\n return;\n }\n\n try\n {\n this.transformedData = transformer(this.data);\n }\n catch(e)\n {\n console.error(e);\n }\n }\n }\n\n //######################### public properties - dynamic outputs #########################\n\n /**\n * @inheritdoc\n */\n public invalidateVisuals(): void\n {\n }\n}"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isBlank, isType } from '@jscrpt/common';
|
|
2
2
|
import { DEFAULT_RELATIONS_COMPONENTS_PROVIDER, DEFAULT_RELATIONS_COMPONENTS_EXTRACTOR, RELATIONS_COMPONENTS_LOADER_PROVIDER } from './providers';
|
|
3
|
-
import { RelationsComponentManager, RelationsManager, RelationsProcessor } from '../services';
|
|
3
|
+
import { CodeExecutor, RelationsComponentManager, RelationsManager, RelationsProcessor } from '../services';
|
|
4
4
|
/**
|
|
5
5
|
* Checks whether data is relations component def
|
|
6
6
|
* @param data - Data to be checked
|
|
@@ -23,6 +23,7 @@ export function provideRelations() {
|
|
|
23
23
|
RelationsComponentManager,
|
|
24
24
|
RelationsManager,
|
|
25
25
|
RelationsProcessor,
|
|
26
|
+
CodeExecutor,
|
|
26
27
|
];
|
|
27
28
|
}
|
|
28
29
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../relations/src/misc/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAC,qCAAqC,EAAE,sCAAsC,EAAE,oCAAoC,EAAC,MAAM,aAAa,CAAC;AAChJ,OAAO,EAAC,yBAAyB,EAAE,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../relations/src/misc/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAC,qCAAqC,EAAE,sCAAsC,EAAE,oCAAoC,EAAC,MAAM,aAAa,CAAC;AAChJ,OAAO,EAAC,YAAY,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAE1G;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwD,UAAS,IAAI;IAErG,mCAAmC;IACnC,IAAG,OAAO,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAC5C;QACI,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAE5B,OAAO;QACH,qCAAqC;QACrC,sCAAsC;QACtC,oCAAoC;QACpC,yBAAyB;QACzB,gBAAgB;QAChB,kBAAkB;QAClB,YAAY;KACf,CAAC;AACN,CAAC","sourcesContent":["import {Provider} from '@angular/core';\nimport {DynamicItemLoaderValidatorFn} from '@anglr/dynamic';\nimport {isBlank, isType} from '@jscrpt/common';\n\nimport {RelationsComponentDef} from './types';\nimport {DEFAULT_RELATIONS_COMPONENTS_PROVIDER, DEFAULT_RELATIONS_COMPONENTS_EXTRACTOR, RELATIONS_COMPONENTS_LOADER_PROVIDER} from './providers';\nimport {CodeExecutor, RelationsComponentManager, RelationsManager, RelationsProcessor} from '../services';\n\n/**\n * Checks whether data is relations component def\n * @param data - Data to be checked\n */\nexport const isRelationsComponentDef: DynamicItemLoaderValidatorFn<RelationsComponentDef> = function(data): data is RelationsComponentDef\n{\n //type is required and must be type\n if(isBlank(data?.data) || !isType(data.data))\n {\n return false;\n }\n\n return true;\n};\n\n/**\n * Default providers for relations subpackage\n */\nexport function provideRelations(): Provider[]\n{\n return [\n DEFAULT_RELATIONS_COMPONENTS_PROVIDER,\n DEFAULT_RELATIONS_COMPONENTS_EXTRACTOR,\n RELATIONS_COMPONENTS_LOADER_PROVIDER,\n RelationsComponentManager,\n RelationsManager,\n RelationsProcessor,\n CodeExecutor,\n ];\n}"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { Injectable, Inject } from '@angular/core';
|
|
3
|
+
import { DOCUMENT } from '@angular/common';
|
|
4
|
+
import { generateId } from '@jscrpt/common';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* Class used for executing javascript code and obtaining types from executed javascript code
|
|
8
|
+
*/
|
|
9
|
+
export class CodeExecutor {
|
|
10
|
+
//######################### constructor #########################
|
|
11
|
+
constructor(document) {
|
|
12
|
+
this.document = document;
|
|
13
|
+
//######################### protected fields #########################
|
|
14
|
+
/**
|
|
15
|
+
* Loaded data cache for relations id
|
|
16
|
+
*/
|
|
17
|
+
this.loadedDataCache = {};
|
|
18
|
+
}
|
|
19
|
+
//######################### public methods #########################
|
|
20
|
+
/**
|
|
21
|
+
* Loads data from dynamicaly executed code
|
|
22
|
+
* @param relationsId - Id of relations for which is data loaded from code
|
|
23
|
+
* @param code - Code used for obtaining data
|
|
24
|
+
*/
|
|
25
|
+
loadData(relationsId, code) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
if (this.loadedDataCache[relationsId]) {
|
|
28
|
+
return this.loadedDataCache[relationsId];
|
|
29
|
+
}
|
|
30
|
+
const scriptElement = this.document.createElement('script');
|
|
31
|
+
const loadHelper = `loadType${generateId(12)}`;
|
|
32
|
+
let result = null;
|
|
33
|
+
scriptElement.innerText = `
|
|
34
|
+
(function(exports, loadType, require)
|
|
35
|
+
{
|
|
36
|
+
${code}
|
|
37
|
+
|
|
38
|
+
loadType(exports);
|
|
39
|
+
})({}, ${loadHelper}.loadType, ${loadHelper}.require);`;
|
|
40
|
+
window[loadHelper] =
|
|
41
|
+
{
|
|
42
|
+
loadType: (exp) => { var _a; return result = (_a = exp.default) !== null && _a !== void 0 ? _a : null; },
|
|
43
|
+
require: (requireName) => {
|
|
44
|
+
console.log(requireName);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.document.getElementsByTagName('head')[0].appendChild(scriptElement);
|
|
49
|
+
delete window[loadHelper];
|
|
50
|
+
scriptElement.remove();
|
|
51
|
+
this.loadedDataCache[relationsId] = result;
|
|
52
|
+
return result;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
CodeExecutor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CodeExecutor, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
57
|
+
CodeExecutor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CodeExecutor });
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CodeExecutor, decorators: [{
|
|
59
|
+
type: Injectable
|
|
60
|
+
}], ctorParameters: function () { return [{ type: Document, decorators: [{
|
|
61
|
+
type: Inject,
|
|
62
|
+
args: [DOCUMENT]
|
|
63
|
+
}] }]; } });
|
|
64
|
+
//# sourceMappingURL=codeExecutor.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeExecutor.service.js","sourceRoot":"","sources":["../../../../../relations/src/services/codeExecutor/codeExecutor.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,UAAU,EAAa,MAAM,gBAAgB,CAAC;;AAEtD;;GAEG;AAEH,MAAM,OAAO,YAAY;IASrB,iEAAiE;IACjE,YAAwC,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;QAR1D,sEAAsE;QAEtE;;WAEG;QACO,oBAAe,GAAoB,EAAE,CAAC;IAKhD,CAAC;IAED,oEAAoE;IAEpE;;;;OAIG;IACU,QAAQ,CAAU,WAAmB,EAAE,IAAY;;YAE5D,IAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,EACpC;gBACI,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;aAC5C;YAED,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC5D,MAAM,UAAU,GAAG,WAAW,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;YAC/C,IAAI,MAAM,GAAiB,IAAI,CAAC;YAEhC,aAAa,CAAC,SAAS,GAAG;;;cAGpB,IAAI;;;iBAGD,UAAU,cAAc,UAAU,YAAY,CAAC;YAEvD,MAAc,CAAC,UAAU,CAAC;gBAC3B;oBACI,QAAQ,EAAE,CAAC,GAAmB,EAAE,EAAE,WAAC,OAAA,MAAM,GAAG,MAAA,GAAG,CAAC,OAAO,mCAAI,IAAI,CAAA,EAAA;oBAC/D,OAAO,EAAE,CAAC,WAAmB,EAAE,EAAE;wBAE7B,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;wBAEzB,OAAO,IAAI,CAAC;oBAChB,CAAC;iBACJ,CAAC;YAEF,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;YACzE,OAAQ,MAAc,CAAC,UAAU,CAAC,CAAC;YACnC,aAAa,CAAC,MAAM,EAAE,CAAC;YAEvB,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC;YAE3C,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;;yGA1DQ,YAAY,kBAUD,QAAQ;6GAVnB,YAAY;2FAAZ,YAAY;kBADxB,UAAU;0DAW2C,QAAQ;0BAA7C,MAAM;2BAAC,QAAQ","sourcesContent":["import {Injectable, Inject} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {generateId, Dictionary} from '@jscrpt/common';\n\n/**\n * Class used for executing javascript code and obtaining types from executed javascript code\n */\n@Injectable()\nexport class CodeExecutor\n{\n //######################### protected fields #########################\n\n /**\n * Loaded data cache for relations id\n */\n protected loadedDataCache: Dictionary<any> = {};\n\n //######################### constructor #########################\n constructor(@Inject(DOCUMENT) protected document: Document)\n {\n }\n\n //######################### public methods #########################\n\n /**\n * Loads data from dynamicaly executed code\n * @param relationsId - Id of relations for which is data loaded from code\n * @param code - Code used for obtaining data\n */\n public async loadData<TResult>(relationsId: string, code: string): Promise<TResult|null>\n {\n if(this.loadedDataCache[relationsId])\n {\n return this.loadedDataCache[relationsId];\n }\n\n const scriptElement = this.document.createElement('script');\n const loadHelper = `loadType${generateId(12)}`;\n let result: TResult|null = null;\n\n scriptElement.innerText = `\n (function(exports, loadType, require)\n {\n ${code}\n\n loadType(exports);\n })({}, ${loadHelper}.loadType, ${loadHelper}.require);`;\n\n (window as any)[loadHelper] =\n {\n loadType: (exp: {default: any}) => result = exp.default ?? null,\n require: (requireName: string) =>\n {\n console.log(requireName);\n\n return null;\n }\n };\n\n this.document.getElementsByTagName('head')[0].appendChild(scriptElement);\n delete (window as any)[loadHelper];\n scriptElement.remove();\n\n this.loadedDataCache[relationsId] = result;\n\n return result;\n }\n}"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './codeExecutor/codeExecutor.service';
|
|
1
2
|
export * from './relationsComponentManager/relationsComponentManager.interface';
|
|
2
3
|
export * from './relationsComponentManager/relationsComponentManager.service';
|
|
3
4
|
export * from './relationsManager/relationsManager.service';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../relations/src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iEAAiE,CAAC;AAChF,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,iDAAiD,CAAC","sourcesContent":["export * from './relationsComponentManager/relationsComponentManager.interface';\nexport * from './relationsComponentManager/relationsComponentManager.service';\nexport * from './relationsManager/relationsManager.service';\nexport * from './relationsProcessor/relationsProcessor.interface';\nexport * from './relationsProcessor/relationsProcessor.service';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../relations/src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,iEAAiE,CAAC;AAChF,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,iDAAiD,CAAC","sourcesContent":["export * from './codeExecutor/codeExecutor.service';\nexport * from './relationsComponentManager/relationsComponentManager.interface';\nexport * from './relationsComponentManager/relationsComponentManager.service';\nexport * from './relationsManager/relationsManager.service';\nexport * from './relationsProcessor/relationsProcessor.interface';\nexport * from './relationsProcessor/relationsProcessor.service';\n"]}
|
package/es2015/src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.js
CHANGED
|
@@ -32,10 +32,10 @@ export class CodeEditorDialogComponent {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
CodeEditorDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CodeEditorDialogComponent, deps: [{ token: TITLED_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
35
|
-
CodeEditorDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: CodeEditorDialogComponent, selector: "code-editor-dialog", ngImport: i0, template: "<code-editor #editor style=\"height: calc(75vh - 32px); width: calc(75vw - 20px);\" [content]=\"data.content\" [languageModel]=\"data.languageModel\" (save)=\"editorContent = $event\"></code-editor>\n\n<div class=\"flex-row flex-end\">\n <button type=\"button\" class=\"btn btn-info\" type=\"button\" [mat-dialog-close]=\"null\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"btn btn-primary\" type=\"button\" (click)=\"saveAndClose(editor)\">\n <span>ok</span>\n </button>\n</div>", dependencies: [{ kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: i2.CodeEditorComponent, selector: "code-editor", inputs: ["content", "languageModel"], outputs: ["save", "contentChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
35
|
+
CodeEditorDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: CodeEditorDialogComponent, selector: "code-editor-dialog", ngImport: i0, template: "<code-editor #editor style=\"height: calc(75vh - 32px); width: calc(75vw - 20px);\" [content]=\"data.content\" [languageModel]=\"data.languageModel\" (save)=\"editorContent = $event\"></code-editor>\n\n<div class=\"flex-row flex-end margin-top-extra-small\">\n <button type=\"button\" class=\"btn btn-info margin-right-extra-small\" type=\"button\" [mat-dialog-close]=\"null\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"btn btn-primary\" type=\"button\" (click)=\"saveAndClose(editor)\">\n <span>ok</span>\n </button>\n</div>", dependencies: [{ kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: i2.CodeEditorComponent, selector: "code-editor", inputs: ["content", "languageModel"], outputs: ["save", "contentChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
36
36
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CodeEditorDialogComponent, decorators: [{
|
|
37
37
|
type: Component,
|
|
38
|
-
args: [{ selector: 'code-editor-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<code-editor #editor style=\"height: calc(75vh - 32px); width: calc(75vw - 20px);\" [content]=\"data.content\" [languageModel]=\"data.languageModel\" (save)=\"editorContent = $event\"></code-editor>\n\n<div class=\"flex-row flex-end\">\n <button type=\"button\" class=\"btn btn-info\" type=\"button\" [mat-dialog-close]=\"null\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"btn btn-primary\" type=\"button\" (click)=\"saveAndClose(editor)\">\n <span>ok</span>\n </button>\n</div>" }]
|
|
38
|
+
args: [{ selector: 'code-editor-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<code-editor #editor style=\"height: calc(75vh - 32px); width: calc(75vw - 20px);\" [content]=\"data.content\" [languageModel]=\"data.languageModel\" (save)=\"editorContent = $event\"></code-editor>\n\n<div class=\"flex-row flex-end margin-top-extra-small\">\n <button type=\"button\" class=\"btn btn-info margin-right-extra-small\" type=\"button\" [mat-dialog-close]=\"null\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"btn btn-primary\" type=\"button\" (click)=\"saveAndClose(editor)\">\n <span>ok</span>\n </button>\n</div>" }]
|
|
39
39
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
40
40
|
type: Inject,
|
|
41
41
|
args: [TITLED_DIALOG_DATA]
|
package/es2015/src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeEditorDialog.component.js","sourceRoot":"","sources":["../../../../../../src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.ts","../../../../../../src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;;;;AAM1D;;GAEG;AAOH,MAAM,OAAO,yBAAyB;IASlC,iEAAiE;IACjE,YAAkD,IAA0B,EACtD,MAAuE;QAD3C,SAAI,GAAJ,IAAI,CAAsB;QACtD,WAAM,GAAN,MAAM,CAAiE;QAT7F,8FAA8F;QAE9F;;WAEG;QACO,kBAAa,GAA2B,IAAI,CAAC;IAMvD,CAAC;IAED,2FAA2F;IAE3F;;;OAGG;IACa,YAAY,CAAC,MAA2B;;YAEpD,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1C,CAAC;KAAA;;sHAzBQ,yBAAyB,kBAUd,kBAAkB;0GAV7B,yBAAyB,0DCjBtC,
|
|
1
|
+
{"version":3,"file":"codeEditorDialog.component.js","sourceRoot":"","sources":["../../../../../../src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.ts","../../../../../../src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.html"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;;;;AAM1D;;GAEG;AAOH,MAAM,OAAO,yBAAyB;IASlC,iEAAiE;IACjE,YAAkD,IAA0B,EACtD,MAAuE;QAD3C,SAAI,GAAJ,IAAI,CAAsB;QACtD,WAAM,GAAN,MAAM,CAAiE;QAT7F,8FAA8F;QAE9F;;WAEG;QACO,kBAAa,GAA2B,IAAI,CAAC;IAMvD,CAAC;IAED,2FAA2F;IAE3F;;;OAGG;IACa,YAAY,CAAC,MAA2B;;YAEpD,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1C,CAAC;KAAA;;sHAzBQ,yBAAyB,kBAUd,kBAAkB;0GAV7B,yBAAyB,0DCjBtC,qkBAUM;2FDOO,yBAAyB;kBANrC,SAAS;+BAEI,oBAAoB,mBAEb,uBAAuB,CAAC,MAAM;;0BAYlC,MAAM;2BAAC,kBAAkB","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject} from '@angular/core';\nimport {MatDialogRef} from '@angular/material/dialog';\nimport {TITLED_DIALOG_DATA} from '@anglr/common/material';\n\nimport {CodeEditorDialogData} from './codeEditorDialog.interface';\nimport {CodeEditorContent} from '../codeEditor/codeEditor.interface';\nimport {CodeEditorComponent} from '../codeEditor/codeEditor.component';\n\n/**\n * Component used as dialog displaying code editor\n */\n@Component(\n{\n selector: 'code-editor-dialog',\n templateUrl: 'codeEditorDialog.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class CodeEditorDialogComponent\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Current content of code editor\n */\n protected editorContent: CodeEditorContent|null = null;\n\n //######################### constructor #########################\n constructor(@Inject(TITLED_DIALOG_DATA) protected data: CodeEditorDialogData,\n protected dialog: MatDialogRef<CodeEditorDialogComponent, CodeEditorContent|null>,)\n {\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Saves content of code editor and closes dialog\n * @param editor - Instance of code editor\n */\n protected async saveAndClose(editor: CodeEditorComponent): Promise<void>\n {\n await editor.saveContent();\n this.dialog.close(this.editorContent);\n }\n}","<code-editor #editor style=\"height: calc(75vh - 32px); width: calc(75vw - 20px);\" [content]=\"data.content\" [languageModel]=\"data.languageModel\" (save)=\"editorContent = $event\"></code-editor>\n\n<div class=\"flex-row flex-end margin-top-extra-small\">\n <button type=\"button\" class=\"btn btn-info margin-right-extra-small\" type=\"button\" [mat-dialog-close]=\"null\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"btn btn-primary\" type=\"button\" (click)=\"saveAndClose(editor)\">\n <span>ok</span>\n </button>\n</div>"]}
|
package/es2020/basic-components/src/dynamicItems/transformData/node/transformDataNode.component.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Component, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef } fro
|
|
|
2
2
|
import { CodeEditorDialogComponent, TypescriptLanguageModel } from '@anglr/dynamic';
|
|
3
3
|
import { RelationsNodeBase, RelationNodeOutputSAComponent, RelationsNodeHeaderSAComponent, RelationNodeInputSAComponent } from '@anglr/dynamic/relations-editor';
|
|
4
4
|
import { TitledDialogService } from '@anglr/common/material';
|
|
5
|
+
import { generateId } from '@jscrpt/common';
|
|
5
6
|
import typings from '!!raw-loader?esModule!../transformData.interface';
|
|
6
7
|
import { languages } from 'monaco-editor';
|
|
7
8
|
import { lastValueFrom } from 'rxjs';
|
|
@@ -32,18 +33,14 @@ export class TransformDataNodeSAComponent extends RelationsNodeBase {
|
|
|
32
33
|
languageModel: TypescriptLanguageModel(`import {TransformData} from 'transformData';
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
+
* Transformer function that performs transformation
|
|
36
37
|
*/
|
|
37
|
-
|
|
38
|
+
const transformer: TransformData<any, any> = data =>
|
|
38
39
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
return data;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
40
|
+
return data;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default transformer;
|
|
47
44
|
`),
|
|
48
45
|
}
|
|
49
46
|
}).afterClosed());
|
|
@@ -54,15 +51,25 @@ export default class Transformer implements TransformData
|
|
|
54
51
|
(_a = this.metadata.nodeMetadata).options ?? (_a.options = { content: '' });
|
|
55
52
|
this.metadata.nodeMetadata.options.content = result.content;
|
|
56
53
|
}
|
|
54
|
+
//######################### protected methods - overrides #########################
|
|
55
|
+
/**
|
|
56
|
+
* @inheritdoc
|
|
57
|
+
*/
|
|
58
|
+
metadataSet() {
|
|
59
|
+
var _a;
|
|
60
|
+
if (this.metadata?.relationsOptions) {
|
|
61
|
+
(_a = this.metadata.relationsOptions).id ?? (_a.id = generateId(12));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
57
64
|
}
|
|
58
65
|
TransformDataNodeSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TransformDataNodeSAComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i1.TitledDialogService }], target: i0.ɵɵFactoryTarget.Component });
|
|
59
|
-
TransformDataNodeSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: TransformDataNodeSAComponent, isStandalone: true, selector: "transform-data-node", usesInheritance: true, ngImport: i0, template: "<relations-node-header [parent]=\"this\" [destroySubject]=\"destroySubject\" name=\"transform code\"></relations-node-header>\n\n<div class=\"node-content\">\n <div class=\"inputs-outputs\">\n <div class=\"inputs\">\n <div class=\"input\">\n <relation-node-input [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"data\" [parent]=\"this\"></relation-node-input>\n <div>data</div>\n </div>\n </div>\n\n <div class=\"outputs\">\n <div class=\"output\">\n <div>transformed data</div>\n <relation-node-output [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"transformedData\" [parent]=\"this\"></relation-node-output>\n </div>\n </div>\n </div>\n\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"showCodeEditor()\">\n <span>
|
|
66
|
+
TransformDataNodeSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: TransformDataNodeSAComponent, isStandalone: true, selector: "transform-data-node", usesInheritance: true, ngImport: i0, template: "<relations-node-header [parent]=\"this\" [destroySubject]=\"destroySubject\" name=\"transform code\"></relations-node-header>\n\n<div class=\"node-content\">\n <div class=\"inputs-outputs\">\n <div class=\"inputs\">\n <div class=\"input\">\n <relation-node-input [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"data\" [parent]=\"this\"></relation-node-input>\n <div>data</div>\n </div>\n </div>\n\n <div class=\"outputs\">\n <div class=\"output\">\n <div>transformed data</div>\n <relation-node-output [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"transformedData\" [parent]=\"this\"></relation-node-output>\n </div>\n </div>\n </div>\n\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"showCodeEditor()\">\n <span>code</span>\n </button>\n</div>", dependencies: [{ kind: "component", type: RelationsNodeHeaderSAComponent, selector: "relations-node-header", inputs: ["parent", "destroySubject", "name"] }, { kind: "component", type: RelationNodeInputSAComponent, selector: "relation-node-input" }, { kind: "component", type: RelationNodeOutputSAComponent, selector: "relation-node-output" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
60
67
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TransformDataNodeSAComponent, decorators: [{
|
|
61
68
|
type: Component,
|
|
62
69
|
args: [{ selector: 'transform-data-node', standalone: true, imports: [
|
|
63
70
|
RelationsNodeHeaderSAComponent,
|
|
64
71
|
RelationNodeInputSAComponent,
|
|
65
72
|
RelationNodeOutputSAComponent,
|
|
66
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<relations-node-header [parent]=\"this\" [destroySubject]=\"destroySubject\" name=\"transform code\"></relations-node-header>\n\n<div class=\"node-content\">\n <div class=\"inputs-outputs\">\n <div class=\"inputs\">\n <div class=\"input\">\n <relation-node-input [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"data\" [parent]=\"this\"></relation-node-input>\n <div>data</div>\n </div>\n </div>\n\n <div class=\"outputs\">\n <div class=\"output\">\n <div>transformed data</div>\n <relation-node-output [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"transformedData\" [parent]=\"this\"></relation-node-output>\n </div>\n </div>\n </div>\n\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"showCodeEditor()\">\n <span>
|
|
73
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<relations-node-header [parent]=\"this\" [destroySubject]=\"destroySubject\" name=\"transform code\"></relations-node-header>\n\n<div class=\"node-content\">\n <div class=\"inputs-outputs\">\n <div class=\"inputs\">\n <div class=\"input\">\n <relation-node-input [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"data\" [parent]=\"this\"></relation-node-input>\n <div>data</div>\n </div>\n </div>\n\n <div class=\"outputs\">\n <div class=\"output\">\n <div>transformed data</div>\n <relation-node-output [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"transformedData\" [parent]=\"this\"></relation-node-output>\n </div>\n </div>\n </div>\n\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"showCodeEditor()\">\n <span>code</span>\n </button>\n</div>" }]
|
|
67
74
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i1.TitledDialogService }]; } });
|
|
68
75
|
//# sourceMappingURL=transformDataNode.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformDataNode.component.js","sourceRoot":"","sources":["../../../../../../basic-components/src/dynamicItems/transformData/node/transformDataNode.component.ts","../../../../../../basic-components/src/dynamicItems/transformData/node/transformDataNode.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAChG,OAAO,EAAoB,yBAAyB,EAAwB,uBAAuB,EAAC,MAAM,gBAAgB,CAAC;AAC3H,OAAO,EAAgB,iBAAiB,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,4BAA4B,EAAC,MAAM,iCAAiC,CAAC;AAC9K,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,OAAO,MAAM,kDAAkD,CAAC;AACvE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,MAAM,CAAC;;;AAInC,SAAS,CAAC,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,OAAO,EAAE,sDAAsD,CAAC,CAAC;AAErH;;GAEG;AAcH,MAAM,OAAO,4BAA6B,SAAQ,iBAAqF;IAEvI,iEAAiE;IAC7D,YAAY,cAAiC,EACjC,OAAgC,EACtB,MAA2B;QAE7C,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAFb,WAAM,GAAN,MAAM,CAAqB;IAGjD,CAAC;IAED,2FAA2F;IAE3F;;OAEG;IACO,KAAK,CAAC,cAAc;;QAE1B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAA0E,yBAAyB,EACtJ;YACI,KAAK,EAAE,aAAa;YACpB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,IAAI,EACJ;gBACI,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE;gBAC5D,aAAa,EAAE,uBAAuB,CACtD
|
|
1
|
+
{"version":3,"file":"transformDataNode.component.js","sourceRoot":"","sources":["../../../../../../basic-components/src/dynamicItems/transformData/node/transformDataNode.component.ts","../../../../../../basic-components/src/dynamicItems/transformData/node/transformDataNode.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAChG,OAAO,EAAoB,yBAAyB,EAAwB,uBAAuB,EAAC,MAAM,gBAAgB,CAAC;AAC3H,OAAO,EAAgB,iBAAiB,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,4BAA4B,EAAC,MAAM,iCAAiC,CAAC;AAC9K,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,OAAO,MAAM,kDAAkD,CAAC;AACvE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,MAAM,CAAC;;;AAInC,SAAS,CAAC,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,OAAO,EAAE,sDAAsD,CAAC,CAAC;AAErH;;GAEG;AAcH,MAAM,OAAO,4BAA6B,SAAQ,iBAAqF;IAEvI,iEAAiE;IAC7D,YAAY,cAAiC,EACjC,OAAgC,EACtB,MAA2B;QAE7C,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAFb,WAAM,GAAN,MAAM,CAAqB;IAGjD,CAAC;IAED,2FAA2F;IAE3F;;OAEG;IACO,KAAK,CAAC,cAAc;;QAE1B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAA0E,yBAAyB,EACtJ;YACI,KAAK,EAAE,aAAa;YACpB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,IAAI,EACJ;gBACI,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE;gBAC5D,aAAa,EAAE,uBAAuB,CACtD;;;;;;;;;;;CAWC,CAAC;aACW;SACJ,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QAElB,IAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,EAC7E;YACI,OAAO;SACV;QAED,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QAClD,MAAA,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAC,OAAO,QAAP,OAAO,GAAK,EAAC,OAAO,EAAE,EAAE,EAAC,EAAC;QACrD,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAChE,CAAC;IAED,mFAAmF;IAEnF;;OAEG;IACgB,WAAW;;QAE1B,IAAG,IAAI,CAAC,QAAQ,EAAE,gBAAgB,EAClC;YACI,MAAA,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAC,EAAE,QAAF,EAAE,GAAK,UAAU,CAAC,EAAE,CAAC,EAAC;SACxD;IACL,CAAC;;yHA9DQ,4BAA4B;6GAA5B,4BAA4B,sGC7BzC,67BAsBM,4CDCE,8BAA8B,gHAC9B,4BAA4B,gEAC5B,6BAA6B;2FAIxB,4BAA4B;kBAbxC,SAAS;+BAEI,qBAAqB,cAEnB,IAAI,WAEhB;wBACI,8BAA8B;wBAC9B,4BAA4B;wBAC5B,6BAA6B;qBAChC,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef} from '@angular/core';\nimport {CodeEditorContent, CodeEditorDialogComponent, CodeEditorDialogData, TypescriptLanguageModel} from '@anglr/dynamic';\nimport {RelationsNode, RelationsNodeBase, RelationNodeOutputSAComponent, RelationsNodeHeaderSAComponent, RelationNodeInputSAComponent} from '@anglr/dynamic/relations-editor';\nimport {TitledDialogService} from '@anglr/common/material';\nimport {generateId} from '@jscrpt/common';\nimport typings from '!!raw-loader?esModule!../transformData.interface';\nimport {languages} from 'monaco-editor';\nimport {lastValueFrom} from 'rxjs';\n\nimport {TransformDataRelationsEditorOptions, TransformDataRelationsOptions} from '../transformData.options';\n\nlanguages.typescript.typescriptDefaults.addExtraLib(typings, 'file:///node_modules/@types/transformData/index.d.ts');\n\n/**\n * Relations node component for transform data\n */\n@Component(\n{\n selector: 'transform-data-node',\n templateUrl: 'transformDataNode.component.html',\n standalone: true,\n imports:\n [\n RelationsNodeHeaderSAComponent,\n RelationNodeInputSAComponent,\n RelationNodeOutputSAComponent,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class TransformDataNodeSAComponent extends RelationsNodeBase<TransformDataRelationsOptions, TransformDataRelationsEditorOptions> implements RelationsNode<TransformDataRelationsOptions, TransformDataRelationsEditorOptions>\n{\n//######################### constructor #########################\n constructor(changeDetector: ChangeDetectorRef,\n element: ElementRef<HTMLElement>,\n protected dialog: TitledDialogService,)\n {\n super(changeDetector, element);\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Shows code editor\n */\n protected async showCodeEditor(): Promise<void>\n {\n const result = await lastValueFrom(this.dialog.open<CodeEditorDialogComponent, CodeEditorDialogData, CodeEditorContent|null>(CodeEditorDialogComponent,\n {\n title: 'Code editor',\n width: '75vw',\n height: '75vh',\n data: \n {\n content: this.metadata?.nodeMetadata?.options?.content ?? '',\n languageModel: TypescriptLanguageModel(\n`import {TransformData} from 'transformData';\n\n/**\n * Transformer function that performs transformation\n */\nconst transformer: TransformData<any, any> = data =>\n{\n return data;\n};\n \nexport default transformer;\n`),\n }\n }).afterClosed());\n\n if(!this.metadata?.relationsOptions || !result || !this.metadata.nodeMetadata)\n {\n return;\n }\n\n this.metadata.relationsOptions.code = result.code;\n this.metadata.nodeMetadata.options ??= {content: ''};\n this.metadata.nodeMetadata.options.content = result.content;\n }\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected override metadataSet(): void\n {\n if(this.metadata?.relationsOptions)\n {\n this.metadata.relationsOptions.id ??= generateId(12);\n }\n }\n}","<relations-node-header [parent]=\"this\" [destroySubject]=\"destroySubject\" name=\"transform code\"></relations-node-header>\n\n<div class=\"node-content\">\n <div class=\"inputs-outputs\">\n <div class=\"inputs\">\n <div class=\"input\">\n <relation-node-input [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"data\" [parent]=\"this\"></relation-node-input>\n <div>data</div>\n </div>\n </div>\n\n <div class=\"outputs\">\n <div class=\"output\">\n <div>transformed data</div>\n <relation-node-output [parentCoordiantes]=\"nodePosition\" [zoomLevel]=\"zoomLevel\" name=\"transformedData\" [parent]=\"this\"></relation-node-output>\n </div>\n </div>\n </div>\n\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"showCodeEditor()\">\n <span>code</span>\n </button>\n</div>"]}
|
package/es2020/basic-components/src/dynamicItems/transformData/transformData.interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformData.interface.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"file":"transformData.interface.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Transforms data to another form of data\n * @param data - Data to be transformed\n */\nexport type TransformData<TData = any, TResult = any> = (data: TData) => TResult;"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformData.options.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Options for transform data relations\n */\nexport interface TransformDataRelationsOptions\n{\n /**\n * Code that should be executed for data transformation\n */\n code: string;\n}\n\n/**\n * Options for transform data relations\n */\nexport interface TransformDataRelationsEditorOptions\n{\n /**\n * Contents of code editor that is being compiled\n */\n content: string;\n}"]}
|
|
1
|
+
{"version":3,"file":"transformData.options.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Options for transform data relations\n */\nexport interface TransformDataRelationsOptions\n{\n /**\n * Unique id that is generated for code\n */\n id: string;\n\n /**\n * Code that should be executed for data transformation\n */\n code: string;\n}\n\n/**\n * Options for transform data relations\n */\nexport interface TransformDataRelationsEditorOptions\n{\n /**\n * Contents of code editor that is being compiled\n */\n content: string;\n}"]}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Injector, Input } from '@angular/core';
|
|
3
|
+
import { CodeExecutor, DynamicOutput, PureRelationsComponent } from '@anglr/dynamic/relations';
|
|
3
4
|
import { RelationsEditorMetadata } from '@anglr/dynamic/relations-editor';
|
|
5
|
+
import { nameof } from '@jscrpt/common';
|
|
4
6
|
import { TransformDataRelationsMetadataLoader } from './transformData.metadata';
|
|
5
7
|
/**
|
|
6
8
|
* Transform data relations component
|
|
7
9
|
*/
|
|
8
10
|
let TransformDataRelations = class TransformDataRelations {
|
|
11
|
+
//######################### constructor #########################
|
|
12
|
+
constructor(injector) {
|
|
13
|
+
this.injector = injector;
|
|
14
|
+
/**
|
|
15
|
+
* Code executor used for execution o
|
|
16
|
+
*/
|
|
17
|
+
this.codeExecutor = this.injector.get(CodeExecutor);
|
|
18
|
+
}
|
|
9
19
|
//######################### public properties - implementation of RelationsComponent #########################
|
|
10
20
|
/**
|
|
11
21
|
* @inheritdoc
|
|
@@ -16,6 +26,27 @@ let TransformDataRelations = class TransformDataRelations {
|
|
|
16
26
|
set relationsOptions(value) {
|
|
17
27
|
this.ɵRelationsOptions = value;
|
|
18
28
|
}
|
|
29
|
+
//######################### public methods - implementation of OnChanges #########################
|
|
30
|
+
/**
|
|
31
|
+
* Called when input value changes
|
|
32
|
+
*/
|
|
33
|
+
async ngOnChanges(changes) {
|
|
34
|
+
if (nameof('data') in changes) {
|
|
35
|
+
if (!this.relationsOptions) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const transformer = await this.codeExecutor.loadData(this.relationsOptions.id, this.relationsOptions.code);
|
|
39
|
+
if (!transformer) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
this.transformedData = transformer(this.data);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
console.error(e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
19
50
|
//######################### public properties - dynamic outputs #########################
|
|
20
51
|
/**
|
|
21
52
|
* @inheritdoc
|
|
@@ -23,9 +54,18 @@ let TransformDataRelations = class TransformDataRelations {
|
|
|
23
54
|
invalidateVisuals() {
|
|
24
55
|
}
|
|
25
56
|
};
|
|
57
|
+
__decorate([
|
|
58
|
+
Input(),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], TransformDataRelations.prototype, "data", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
DynamicOutput(),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], TransformDataRelations.prototype, "transformedData", void 0);
|
|
26
65
|
TransformDataRelations = __decorate([
|
|
27
66
|
PureRelationsComponent(),
|
|
28
|
-
RelationsEditorMetadata(TransformDataRelationsMetadataLoader)
|
|
67
|
+
RelationsEditorMetadata(TransformDataRelationsMetadataLoader),
|
|
68
|
+
__metadata("design:paramtypes", [Injector])
|
|
29
69
|
], TransformDataRelations);
|
|
30
70
|
export { TransformDataRelations };
|
|
31
71
|
//# sourceMappingURL=transformData.relations.js.map
|
package/es2020/basic-components/src/dynamicItems/transformData/transformData.relations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformData.relations.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.relations.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,sBAAsB,EAAqB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"transformData.relations.js","sourceRoot":"","sources":["../../../../../basic-components/src/dynamicItems/transformData/transformData.relations.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAC,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAqB,MAAM,0BAA0B,CAAC;AACjH,OAAO,EAAC,uBAAuB,EAAC,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,oCAAoC,EAAC,MAAM,0BAA0B,CAAC;AAI9E;;GAEG;AAGH,IAAa,sBAAsB,GAAnC,MAAa,sBAAsB;IA4C/B,iEAAiE;IACjE,YAAsB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;QApCxC;;WAEG;QACO,iBAAY,GAAiB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAmCvE,CAAC;IAjCD,8GAA8G;IAE9G;;OAEG;IACH,IAAW,gBAAgB;QAEvB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IACD,IAAW,gBAAgB,CAAC,KAAmD;QAE3E,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACnC,CAAC;IAuBD,kGAAkG;IAElG;;OAEG;IACI,KAAK,CAAC,WAAW,CAAC,OAAsB;QAE3C,IAAG,MAAM,CAAyB,MAAM,CAAC,IAAI,OAAO,EACpD;YACI,IAAG,CAAC,IAAI,CAAC,gBAAgB,EACzB;gBACI,OAAO;aACV;YAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAgB,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YAE1H,IAAG,CAAC,WAAW,EACf;gBACI,OAAO;aACV;YAED,IACA;gBACI,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACjD;YACD,OAAM,CAAC,EACP;gBACI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aACpB;SACJ;IACL,CAAC;IAED,yFAAyF;IAEzF;;OAEG;IACI,iBAAiB;IAExB,CAAC;CACJ,CAAA;AAvDG;IADC,KAAK,EAAE;;oDAC0B;AAQlC;IADC,aAAa,EAAE;;+DACwC;AA1C/C,sBAAsB;IAFlC,sBAAsB,EAAE;IACxB,uBAAuB,CAAC,oCAAoC,CAAC;qCA8C1B,QAAQ;GA7C/B,sBAAsB,CAyFlC;SAzFY,sBAAsB","sourcesContent":["import {Injector, Input, SimpleChanges} from '@angular/core';\nimport {CodeExecutor, DynamicOutput, PureRelationsComponent, RelationsComponent} from '@anglr/dynamic/relations';\nimport {RelationsEditorMetadata} from '@anglr/dynamic/relations-editor';\nimport {nameof} from '@jscrpt/common';\n\nimport {TransformDataRelationsMetadataLoader} from './transformData.metadata';\nimport {TransformDataRelationsOptions} from './transformData.options';\nimport {TransformData} from './transformData.interface';\n\n/**\n * Transform data relations component\n */\n@PureRelationsComponent()\n@RelationsEditorMetadata(TransformDataRelationsMetadataLoader)\nexport class TransformDataRelations<TData = any, TTransformedData = any> implements RelationsComponent<TransformDataRelationsOptions>\n{\n //######################### protected properties #########################\n\n /**\n * Options used in this relations component\n */\n protected ɵRelationsOptions: TransformDataRelationsOptions|undefined|null;\n\n /**\n * Code executor used for execution o\n */\n protected codeExecutor: CodeExecutor = this.injector.get(CodeExecutor);\n\n //######################### public properties - implementation of RelationsComponent #########################\n\n /**\n * @inheritdoc\n */\n public get relationsOptions(): TransformDataRelationsOptions|undefined|null\n {\n return this.ɵRelationsOptions;\n }\n public set relationsOptions(value: TransformDataRelationsOptions|undefined|null)\n {\n this.ɵRelationsOptions = value;\n }\n\n //######################### public properties - inputs #########################\n\n /**\n * Data to be transformed\n */\n @Input()\n public data: TData|undefined|null;\n\n //######################### public properties - outputs #########################\n\n /**\n * Transformed data\n */\n @DynamicOutput()\n public transformedData: TTransformedData|undefined|null;\n\n //######################### constructor #########################\n constructor(protected injector: Injector,)\n {\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public async ngOnChanges(changes: SimpleChanges): Promise<void>\n {\n if(nameof<TransformDataRelations>('data') in changes)\n {\n if(!this.relationsOptions)\n {\n return;\n }\n\n const transformer = await this.codeExecutor.loadData<TransformData>(this.relationsOptions.id, this.relationsOptions.code);\n\n if(!transformer)\n {\n return;\n }\n\n try\n {\n this.transformedData = transformer(this.data);\n }\n catch(e)\n {\n console.error(e);\n }\n }\n }\n\n //######################### public properties - dynamic outputs #########################\n\n /**\n * @inheritdoc\n */\n public invalidateVisuals(): void\n {\n }\n}"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isBlank, isType } from '@jscrpt/common';
|
|
2
2
|
import { DEFAULT_RELATIONS_COMPONENTS_PROVIDER, DEFAULT_RELATIONS_COMPONENTS_EXTRACTOR, RELATIONS_COMPONENTS_LOADER_PROVIDER } from './providers';
|
|
3
|
-
import { RelationsComponentManager, RelationsManager, RelationsProcessor } from '../services';
|
|
3
|
+
import { CodeExecutor, RelationsComponentManager, RelationsManager, RelationsProcessor } from '../services';
|
|
4
4
|
/**
|
|
5
5
|
* Checks whether data is relations component def
|
|
6
6
|
* @param data - Data to be checked
|
|
@@ -23,6 +23,7 @@ export function provideRelations() {
|
|
|
23
23
|
RelationsComponentManager,
|
|
24
24
|
RelationsManager,
|
|
25
25
|
RelationsProcessor,
|
|
26
|
+
CodeExecutor,
|
|
26
27
|
];
|
|
27
28
|
}
|
|
28
29
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../relations/src/misc/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAC,qCAAqC,EAAE,sCAAsC,EAAE,oCAAoC,EAAC,MAAM,aAAa,CAAC;AAChJ,OAAO,EAAC,yBAAyB,EAAE,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../relations/src/misc/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAC,qCAAqC,EAAE,sCAAsC,EAAE,oCAAoC,EAAC,MAAM,aAAa,CAAC;AAChJ,OAAO,EAAC,YAAY,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAE1G;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwD,UAAS,IAAI;IAErG,mCAAmC;IACnC,IAAG,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAC5C;QACI,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAE5B,OAAO;QACH,qCAAqC;QACrC,sCAAsC;QACtC,oCAAoC;QACpC,yBAAyB;QACzB,gBAAgB;QAChB,kBAAkB;QAClB,YAAY;KACf,CAAC;AACN,CAAC","sourcesContent":["import {Provider} from '@angular/core';\nimport {DynamicItemLoaderValidatorFn} from '@anglr/dynamic';\nimport {isBlank, isType} from '@jscrpt/common';\n\nimport {RelationsComponentDef} from './types';\nimport {DEFAULT_RELATIONS_COMPONENTS_PROVIDER, DEFAULT_RELATIONS_COMPONENTS_EXTRACTOR, RELATIONS_COMPONENTS_LOADER_PROVIDER} from './providers';\nimport {CodeExecutor, RelationsComponentManager, RelationsManager, RelationsProcessor} from '../services';\n\n/**\n * Checks whether data is relations component def\n * @param data - Data to be checked\n */\nexport const isRelationsComponentDef: DynamicItemLoaderValidatorFn<RelationsComponentDef> = function(data): data is RelationsComponentDef\n{\n //type is required and must be type\n if(isBlank(data?.data) || !isType(data.data))\n {\n return false;\n }\n\n return true;\n};\n\n/**\n * Default providers for relations subpackage\n */\nexport function provideRelations(): Provider[]\n{\n return [\n DEFAULT_RELATIONS_COMPONENTS_PROVIDER,\n DEFAULT_RELATIONS_COMPONENTS_EXTRACTOR,\n RELATIONS_COMPONENTS_LOADER_PROVIDER,\n RelationsComponentManager,\n RelationsManager,\n RelationsProcessor,\n CodeExecutor,\n ];\n}"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Injectable, Inject } from '@angular/core';
|
|
2
|
+
import { DOCUMENT } from '@angular/common';
|
|
3
|
+
import { generateId } from '@jscrpt/common';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Class used for executing javascript code and obtaining types from executed javascript code
|
|
7
|
+
*/
|
|
8
|
+
export class CodeExecutor {
|
|
9
|
+
//######################### constructor #########################
|
|
10
|
+
constructor(document) {
|
|
11
|
+
this.document = document;
|
|
12
|
+
//######################### protected fields #########################
|
|
13
|
+
/**
|
|
14
|
+
* Loaded data cache for relations id
|
|
15
|
+
*/
|
|
16
|
+
this.loadedDataCache = {};
|
|
17
|
+
}
|
|
18
|
+
//######################### public methods #########################
|
|
19
|
+
/**
|
|
20
|
+
* Loads data from dynamicaly executed code
|
|
21
|
+
* @param relationsId - Id of relations for which is data loaded from code
|
|
22
|
+
* @param code - Code used for obtaining data
|
|
23
|
+
*/
|
|
24
|
+
async loadData(relationsId, code) {
|
|
25
|
+
if (this.loadedDataCache[relationsId]) {
|
|
26
|
+
return this.loadedDataCache[relationsId];
|
|
27
|
+
}
|
|
28
|
+
const scriptElement = this.document.createElement('script');
|
|
29
|
+
const loadHelper = `loadType${generateId(12)}`;
|
|
30
|
+
let result = null;
|
|
31
|
+
scriptElement.innerText = `
|
|
32
|
+
(function(exports, loadType, require)
|
|
33
|
+
{
|
|
34
|
+
${code}
|
|
35
|
+
|
|
36
|
+
loadType(exports);
|
|
37
|
+
})({}, ${loadHelper}.loadType, ${loadHelper}.require);`;
|
|
38
|
+
window[loadHelper] =
|
|
39
|
+
{
|
|
40
|
+
loadType: (exp) => result = exp.default ?? null,
|
|
41
|
+
require: (requireName) => {
|
|
42
|
+
console.log(requireName);
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
this.document.getElementsByTagName('head')[0].appendChild(scriptElement);
|
|
47
|
+
delete window[loadHelper];
|
|
48
|
+
scriptElement.remove();
|
|
49
|
+
this.loadedDataCache[relationsId] = result;
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
CodeExecutor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CodeExecutor, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
54
|
+
CodeExecutor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CodeExecutor });
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CodeExecutor, decorators: [{
|
|
56
|
+
type: Injectable
|
|
57
|
+
}], ctorParameters: function () { return [{ type: Document, decorators: [{
|
|
58
|
+
type: Inject,
|
|
59
|
+
args: [DOCUMENT]
|
|
60
|
+
}] }]; } });
|
|
61
|
+
//# sourceMappingURL=codeExecutor.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeExecutor.service.js","sourceRoot":"","sources":["../../../../../relations/src/services/codeExecutor/codeExecutor.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,UAAU,EAAa,MAAM,gBAAgB,CAAC;;AAEtD;;GAEG;AAEH,MAAM,OAAO,YAAY;IASrB,iEAAiE;IACjE,YAAwC,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;QAR1D,sEAAsE;QAEtE;;WAEG;QACO,oBAAe,GAAoB,EAAE,CAAC;IAKhD,CAAC;IAED,oEAAoE;IAEpE;;;;OAIG;IACI,KAAK,CAAC,QAAQ,CAAU,WAAmB,EAAE,IAAY;QAE5D,IAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,EACpC;YACI,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;SAC5C;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC5D,MAAM,UAAU,GAAG,WAAW,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;QAC/C,IAAI,MAAM,GAAiB,IAAI,CAAC;QAEhC,aAAa,CAAC,SAAS,GAAG;;;cAGpB,IAAI;;;iBAGD,UAAU,cAAc,UAAU,YAAY,CAAC;QAEvD,MAAc,CAAC,UAAU,CAAC;YAC3B;gBACI,QAAQ,EAAE,CAAC,GAAmB,EAAE,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,IAAI,IAAI;gBAC/D,OAAO,EAAE,CAAC,WAAmB,EAAE,EAAE;oBAE7B,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;oBAEzB,OAAO,IAAI,CAAC;gBAChB,CAAC;aACJ,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QACzE,OAAQ,MAAc,CAAC,UAAU,CAAC,CAAC;QACnC,aAAa,CAAC,MAAM,EAAE,CAAC;QAEvB,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC;QAE3C,OAAO,MAAM,CAAC;IAClB,CAAC;;yGA1DQ,YAAY,kBAUD,QAAQ;6GAVnB,YAAY;2FAAZ,YAAY;kBADxB,UAAU;0DAW2C,QAAQ;0BAA7C,MAAM;2BAAC,QAAQ","sourcesContent":["import {Injectable, Inject} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {generateId, Dictionary} from '@jscrpt/common';\n\n/**\n * Class used for executing javascript code and obtaining types from executed javascript code\n */\n@Injectable()\nexport class CodeExecutor\n{\n //######################### protected fields #########################\n\n /**\n * Loaded data cache for relations id\n */\n protected loadedDataCache: Dictionary<any> = {};\n\n //######################### constructor #########################\n constructor(@Inject(DOCUMENT) protected document: Document)\n {\n }\n\n //######################### public methods #########################\n\n /**\n * Loads data from dynamicaly executed code\n * @param relationsId - Id of relations for which is data loaded from code\n * @param code - Code used for obtaining data\n */\n public async loadData<TResult>(relationsId: string, code: string): Promise<TResult|null>\n {\n if(this.loadedDataCache[relationsId])\n {\n return this.loadedDataCache[relationsId];\n }\n\n const scriptElement = this.document.createElement('script');\n const loadHelper = `loadType${generateId(12)}`;\n let result: TResult|null = null;\n\n scriptElement.innerText = `\n (function(exports, loadType, require)\n {\n ${code}\n\n loadType(exports);\n })({}, ${loadHelper}.loadType, ${loadHelper}.require);`;\n\n (window as any)[loadHelper] =\n {\n loadType: (exp: {default: any}) => result = exp.default ?? null,\n require: (requireName: string) =>\n {\n console.log(requireName);\n\n return null;\n }\n };\n\n this.document.getElementsByTagName('head')[0].appendChild(scriptElement);\n delete (window as any)[loadHelper];\n scriptElement.remove();\n\n this.loadedDataCache[relationsId] = result;\n\n return result;\n }\n}"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './codeExecutor/codeExecutor.service';
|
|
1
2
|
export * from './relationsComponentManager/relationsComponentManager.interface';
|
|
2
3
|
export * from './relationsComponentManager/relationsComponentManager.service';
|
|
3
4
|
export * from './relationsManager/relationsManager.service';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../relations/src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iEAAiE,CAAC;AAChF,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,iDAAiD,CAAC","sourcesContent":["export * from './relationsComponentManager/relationsComponentManager.interface';\nexport * from './relationsComponentManager/relationsComponentManager.service';\nexport * from './relationsManager/relationsManager.service';\nexport * from './relationsProcessor/relationsProcessor.interface';\nexport * from './relationsProcessor/relationsProcessor.service';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../relations/src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,iEAAiE,CAAC;AAChF,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,iDAAiD,CAAC","sourcesContent":["export * from './codeExecutor/codeExecutor.service';\nexport * from './relationsComponentManager/relationsComponentManager.interface';\nexport * from './relationsComponentManager/relationsComponentManager.service';\nexport * from './relationsManager/relationsManager.service';\nexport * from './relationsProcessor/relationsProcessor.interface';\nexport * from './relationsProcessor/relationsProcessor.service';\n"]}
|
package/es2020/src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.js
CHANGED
|
@@ -29,10 +29,10 @@ export class CodeEditorDialogComponent {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
CodeEditorDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CodeEditorDialogComponent, deps: [{ token: TITLED_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
32
|
-
CodeEditorDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: CodeEditorDialogComponent, selector: "code-editor-dialog", ngImport: i0, template: "<code-editor #editor style=\"height: calc(75vh - 32px); width: calc(75vw - 20px);\" [content]=\"data.content\" [languageModel]=\"data.languageModel\" (save)=\"editorContent = $event\"></code-editor>\n\n<div class=\"flex-row flex-end\">\n <button type=\"button\" class=\"btn btn-info\" type=\"button\" [mat-dialog-close]=\"null\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"btn btn-primary\" type=\"button\" (click)=\"saveAndClose(editor)\">\n <span>ok</span>\n </button>\n</div>", dependencies: [{ kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: i2.CodeEditorComponent, selector: "code-editor", inputs: ["content", "languageModel"], outputs: ["save", "contentChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
32
|
+
CodeEditorDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: CodeEditorDialogComponent, selector: "code-editor-dialog", ngImport: i0, template: "<code-editor #editor style=\"height: calc(75vh - 32px); width: calc(75vw - 20px);\" [content]=\"data.content\" [languageModel]=\"data.languageModel\" (save)=\"editorContent = $event\"></code-editor>\n\n<div class=\"flex-row flex-end margin-top-extra-small\">\n <button type=\"button\" class=\"btn btn-info margin-right-extra-small\" type=\"button\" [mat-dialog-close]=\"null\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"btn btn-primary\" type=\"button\" (click)=\"saveAndClose(editor)\">\n <span>ok</span>\n </button>\n</div>", dependencies: [{ kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: i2.CodeEditorComponent, selector: "code-editor", inputs: ["content", "languageModel"], outputs: ["save", "contentChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
33
33
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: CodeEditorDialogComponent, decorators: [{
|
|
34
34
|
type: Component,
|
|
35
|
-
args: [{ selector: 'code-editor-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<code-editor #editor style=\"height: calc(75vh - 32px); width: calc(75vw - 20px);\" [content]=\"data.content\" [languageModel]=\"data.languageModel\" (save)=\"editorContent = $event\"></code-editor>\n\n<div class=\"flex-row flex-end\">\n <button type=\"button\" class=\"btn btn-info\" type=\"button\" [mat-dialog-close]=\"null\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"btn btn-primary\" type=\"button\" (click)=\"saveAndClose(editor)\">\n <span>ok</span>\n </button>\n</div>" }]
|
|
35
|
+
args: [{ selector: 'code-editor-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<code-editor #editor style=\"height: calc(75vh - 32px); width: calc(75vw - 20px);\" [content]=\"data.content\" [languageModel]=\"data.languageModel\" (save)=\"editorContent = $event\"></code-editor>\n\n<div class=\"flex-row flex-end margin-top-extra-small\">\n <button type=\"button\" class=\"btn btn-info margin-right-extra-small\" type=\"button\" [mat-dialog-close]=\"null\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"btn btn-primary\" type=\"button\" (click)=\"saveAndClose(editor)\">\n <span>ok</span>\n </button>\n</div>" }]
|
|
36
36
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
37
37
|
type: Inject,
|
|
38
38
|
args: [TITLED_DIALOG_DATA]
|
package/es2020/src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeEditorDialog.component.js","sourceRoot":"","sources":["../../../../../../src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.ts","../../../../../../src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;;;;AAM1D;;GAEG;AAOH,MAAM,OAAO,yBAAyB;IASlC,iEAAiE;IACjE,YAAkD,IAA0B,EACtD,MAAuE;QAD3C,SAAI,GAAJ,IAAI,CAAsB;QACtD,WAAM,GAAN,MAAM,CAAiE;QAT7F,8FAA8F;QAE9F;;WAEG;QACO,kBAAa,GAA2B,IAAI,CAAC;IAMvD,CAAC;IAED,2FAA2F;IAE3F;;;OAGG;IACO,KAAK,CAAC,YAAY,CAAC,MAA2B;QAEpD,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC1C,CAAC;;sHAzBQ,yBAAyB,kBAUd,kBAAkB;0GAV7B,yBAAyB,0DCjBtC,
|
|
1
|
+
{"version":3,"file":"codeEditorDialog.component.js","sourceRoot":"","sources":["../../../../../../src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.ts","../../../../../../src/modules/codeEditor/components/codeEditorDialog/codeEditorDialog.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;;;;AAM1D;;GAEG;AAOH,MAAM,OAAO,yBAAyB;IASlC,iEAAiE;IACjE,YAAkD,IAA0B,EACtD,MAAuE;QAD3C,SAAI,GAAJ,IAAI,CAAsB;QACtD,WAAM,GAAN,MAAM,CAAiE;QAT7F,8FAA8F;QAE9F;;WAEG;QACO,kBAAa,GAA2B,IAAI,CAAC;IAMvD,CAAC;IAED,2FAA2F;IAE3F;;;OAGG;IACO,KAAK,CAAC,YAAY,CAAC,MAA2B;QAEpD,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC1C,CAAC;;sHAzBQ,yBAAyB,kBAUd,kBAAkB;0GAV7B,yBAAyB,0DCjBtC,qkBAUM;2FDOO,yBAAyB;kBANrC,SAAS;+BAEI,oBAAoB,mBAEb,uBAAuB,CAAC,MAAM;;0BAYlC,MAAM;2BAAC,kBAAkB","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject} from '@angular/core';\nimport {MatDialogRef} from '@angular/material/dialog';\nimport {TITLED_DIALOG_DATA} from '@anglr/common/material';\n\nimport {CodeEditorDialogData} from './codeEditorDialog.interface';\nimport {CodeEditorContent} from '../codeEditor/codeEditor.interface';\nimport {CodeEditorComponent} from '../codeEditor/codeEditor.component';\n\n/**\n * Component used as dialog displaying code editor\n */\n@Component(\n{\n selector: 'code-editor-dialog',\n templateUrl: 'codeEditorDialog.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class CodeEditorDialogComponent\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Current content of code editor\n */\n protected editorContent: CodeEditorContent|null = null;\n\n //######################### constructor #########################\n constructor(@Inject(TITLED_DIALOG_DATA) protected data: CodeEditorDialogData,\n protected dialog: MatDialogRef<CodeEditorDialogComponent, CodeEditorContent|null>,)\n {\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * Saves content of code editor and closes dialog\n * @param editor - Instance of code editor\n */\n protected async saveAndClose(editor: CodeEditorComponent): Promise<void>\n {\n await editor.saveContent();\n this.dialog.close(this.editorContent);\n }\n}","<code-editor #editor style=\"height: calc(75vh - 32px); width: calc(75vw - 20px);\" [content]=\"data.content\" [languageModel]=\"data.languageModel\" (save)=\"editorContent = $event\"></code-editor>\n\n<div class=\"flex-row flex-end margin-top-extra-small\">\n <button type=\"button\" class=\"btn btn-info margin-right-extra-small\" type=\"button\" [mat-dialog-close]=\"null\">\n <span>cancel</span>\n </button>\n\n <button type=\"button\" class=\"btn btn-primary\" type=\"button\" (click)=\"saveAndClose(editor)\">\n <span>ok</span>\n </button>\n</div>"]}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,4BAA4B,EAAC,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAI9C;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,4BAA4B,CAAC,qBAAqB,CASvF,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,4BAA4B,EAAC,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAI9C;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,4BAA4B,CAAC,qBAAqB,CASvF,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,QAAQ,EAAE,CAW7C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Dictionary } from '@jscrpt/common';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Class used for executing javascript code and obtaining types from executed javascript code
|
|
5
|
+
*/
|
|
6
|
+
export declare class CodeExecutor {
|
|
7
|
+
protected document: Document;
|
|
8
|
+
/**
|
|
9
|
+
* Loaded data cache for relations id
|
|
10
|
+
*/
|
|
11
|
+
protected loadedDataCache: Dictionary<any>;
|
|
12
|
+
constructor(document: Document);
|
|
13
|
+
/**
|
|
14
|
+
* Loads data from dynamicaly executed code
|
|
15
|
+
* @param relationsId - Id of relations for which is data loaded from code
|
|
16
|
+
* @param code - Code used for obtaining data
|
|
17
|
+
*/
|
|
18
|
+
loadData<TResult>(relationsId: string, code: string): Promise<TResult | null>;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CodeExecutor, never>;
|
|
20
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CodeExecutor>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=codeExecutor.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeExecutor.service.d.ts","sourceRoot":"","sources":["codeExecutor.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,UAAU,EAAC,MAAM,gBAAgB,CAAC;;AAEtD;;GAEG;AACH,qBACa,YAAY;IAUS,SAAS,CAAC,QAAQ,EAAE,QAAQ;IAN1D;;OAEG;IACH,SAAS,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG,CAAC,CAAM;gBAGR,QAAQ,EAAE,QAAQ;IAM1D;;;;OAIG;IACU,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAC,IAAI,CAAC;yCArB/E,YAAY;6CAAZ,YAAY;CA2DxB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './codeExecutor/codeExecutor.service';
|
|
1
2
|
export * from './relationsComponentManager/relationsComponentManager.interface';
|
|
2
3
|
export * from './relationsComponentManager/relationsComponentManager.service';
|
|
3
4
|
export * from './relationsManager/relationsManager.service';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,iEAAiE,CAAC;AAChF,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,iDAAiD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,iEAAiE,CAAC;AAChF,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,iDAAiD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<code-editor #editor style="height: calc(75vh - 32px); width: calc(75vw - 20px);" [content]="data.content" [languageModel]="data.languageModel" (save)="editorContent = $event"></code-editor>
|
|
2
2
|
|
|
3
|
-
<div class="flex-row flex-end">
|
|
4
|
-
<button type="button" class="btn btn-info" type="button" [mat-dialog-close]="null">
|
|
3
|
+
<div class="flex-row flex-end margin-top-extra-small">
|
|
4
|
+
<button type="button" class="btn btn-info margin-right-extra-small" type="button" [mat-dialog-close]="null">
|
|
5
5
|
<span>cancel</span>
|
|
6
6
|
</button>
|
|
7
7
|
|
package/version.bak
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.0-beta.
|
|
1
|
+
1.0.0-beta.20220908101526
|