p3x-angular-compile 2021.10.139 → 2021.10.151

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- @license p3x-angular-compile v2021.10.138
2
+ @license p3x-angular-compile v2021.10.150
3
3
 
4
4
  🆖 Angular Dynamic Compile - Convert strings to Angular components
5
5
 
package/README.md CHANGED
@@ -11,21 +11,16 @@
11
11
 
12
12
 
13
13
 
14
- # 🆖 Angular Dynamic Compile - Convert strings to Angular components v2021.10.139
14
+ # 🆖 Angular Dynamic Compile - Convert strings to Angular components v2021.10.151
15
15
 
16
16
 
17
17
 
18
18
  **Bugs are evident™ - MATRIX️**
19
19
 
20
20
 
21
- ### NodeJs version requirement
21
+ ### Built and supported on NodeJs version
22
22
  ```txt
23
- >=12.13.0
24
- ```
25
-
26
- ### Built on NodeJs
27
- ```txt
28
- v14.18.1
23
+ v16.13.0
29
24
  ```
30
25
 
31
26
 
@@ -34,7 +29,7 @@ v14.18.1
34
29
  # Built on Angular
35
30
 
36
31
  ```text
37
- 12.2.11
32
+ 13.0.0
38
33
  ```
39
34
 
40
35
 
@@ -50,6 +45,8 @@ Angular has changed, so it stricts many things for dynamic compilation. The only
50
45
 
51
46
  The code you just copy into your project is here:
52
47
  https://github.com/patrikx3/angular-compile/tree/master/projects/angular-compile/src/lib
48
+
49
+ The package on the NPM is the pure TypeScript code. Not built using Angular.
53
50
 
54
51
  # Use case
55
52
  Dynamically compile standard strings to fully functional Angular components. Supports imports, exports, and standard context.
@@ -310,7 +307,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://
310
307
 
311
308
  ---
312
309
 
313
- [**P3X-ANGULAR-COMPILE**](https://corifeus.com/angular-compile) Build v2021.10.139
310
+ [**P3X-ANGULAR-COMPILE**](https://corifeus.com/angular-compile) Build v2021.10.151
314
311
 
315
312
  [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)
316
313
 
package/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './public-api'
@@ -1,41 +1,91 @@
1
- import { NgModule, Component, Injectable, Compiler, Input } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
1
+ import {
2
+ Compiler,
3
+ Component,
4
+ Injectable,
5
+ Input,
6
+ ModuleWithProviders,
7
+ NgModule,
8
+ NgModuleFactory,
9
+ OnChanges,
10
+ SimpleChanges,
11
+ Type,
12
+ } from '@angular/core';
3
13
 
14
+ import {CommonModule} from '@angular/common';
4
15
  //import { BrowserModule } from '@angular/platform-browser';
5
16
  //let SingletonDefaultModule: NgModule;
6
17
  //import cloneDeep from 'lodash/cloneDeep';
18
+
7
19
  //import { CorifeusMaterialModule } from 'corifeus-web-material';
8
- function reverse(str) {
9
- return str.split('').reverse().join('');
20
+
21
+ function reverse(str: string) {
22
+ return str.split('').reverse().join('')
10
23
  }
24
+
11
25
  function random() {
12
- return (Math.floor(Math.random() * (99999999999999999 - 10000000000000000)) + 10000000000000000).toString(16);
26
+ return (Math.floor(Math.random() * (99999999999999999 - 10000000000000000)) + 10000000000000000).toString(16)
13
27
  }
14
- let currentIdTime;
28
+
29
+ let currentIdTime: number;
15
30
  let currentId = 0;
16
- function nextId() {
31
+
32
+ function nextId(): string {
33
+
17
34
  const now = Date.now();
18
35
  if (currentIdTime !== now) {
19
36
  currentId = 0;
20
- currentIdTime = now;
37
+ currentIdTime = now
21
38
  }
22
39
  const comingId = ++currentId;
23
40
  const randomHex = reverse(random()).padStart(15, '0');
24
- const timeHex = reverse(currentIdTime.toString(16).padStart(12, '0'));
25
- const comingIdHex = reverse(comingId.toString(16).padStart(3, '0'));
26
- const newId = `p3x-angular-compile-${timeHex}${comingIdHex}${randomHex}`;
41
+ const timeHex = reverse(currentIdTime.toString(16).padStart(12, '0'))
42
+ const comingIdHex = reverse(comingId.toString(16).padStart(3, '0'))
43
+ const newId: string = `p3x-angular-compile-${timeHex}${comingIdHex}${randomHex}`;
27
44
  //console.log(newId)
28
- return newId;
45
+ return newId
29
46
  }
47
+
48
+
30
49
  //const cache : any = {};
31
- class CompileAttribute {
50
+
51
+ @Component({
52
+ selector: '[p3x-compile]',
53
+ template: `
54
+ <ng-container *ngIf="renderComponent">
55
+ <ng-container *ngComponentOutlet="dynamicComponent; ngModuleFactory: dynamicModule;"></ng-container>
56
+ </ng-container>
57
+ `
58
+ })
59
+ @Injectable()
60
+ export class CompileAttribute implements OnChanges {
61
+ //export class CompileAttribute implements OnChanges ,OnInit {
62
+
63
+ @Input('p3x-compile')
64
+ html: string;
65
+
66
+ @Input('p3x-compile-ctx')
67
+ context: any;
68
+
69
+ @Input('p3x-compile-error-handler')
70
+ errorHandler: Function = undefined;
71
+
72
+ dynamicComponent: any;
73
+ dynamicModule: NgModuleFactory<any> | any;
74
+
75
+ @Input('p3x-compile-module')
76
+ module: NgModule;
77
+
78
+ @Input('p3x-compile-imports')
79
+ imports: Array<Type<any> | ModuleWithProviders<any> | any[]>;
80
+
32
81
  constructor(
33
- // private container: ViewContainerRef,
34
- // private service: CompileService
35
- compiler) {
36
- this.compiler = compiler;
37
- this.errorHandler = undefined;
82
+ // private container: ViewContainerRef,
83
+ // private service: CompileService
84
+ private compiler: Compiler,
85
+ // @Inject('config') private config:CompileServiceConfig
86
+ ) {
38
87
  }
88
+
39
89
  /*
40
90
  // not requires, since ngOnChanges does it first time change
41
91
  ngOnInit() {
@@ -43,13 +93,17 @@ class CompileAttribute {
43
93
  // this.update();
44
94
  }
45
95
  */
96
+
46
97
  get renderComponent() {
47
- return typeof this.html === 'string' && this.html.trim() !== '';
98
+ return typeof this.html === 'string' && this.html.trim() !== ''
48
99
  }
49
- ngOnChanges(changes) {
100
+
101
+ ngOnChanges(changes: SimpleChanges) {
50
102
  //console.log('ng one changes')
51
103
  this.update();
52
104
  }
105
+
106
+
53
107
  update() {
54
108
  try {
55
109
  if (this.html === undefined || this.html === null || this.html.trim() === '') {
@@ -58,6 +112,7 @@ class CompileAttribute {
58
112
  this.dynamicModule = undefined;
59
113
  return;
60
114
  }
115
+
61
116
  /*
62
117
 
63
118
  // looks like Angular already is caching
@@ -74,18 +129,17 @@ class CompileAttribute {
74
129
  */
75
130
  this.dynamicComponent = this.createNewComponent(this.html, this.context);
76
131
  this.dynamicModule = this.compiler.compileModuleSync(this.createComponentModule(this.dynamicComponent));
132
+
77
133
  /*
78
134
  cache[cacheKey] = {
79
135
  dynamicComponent: this.dynamicComponent,
80
136
  dynamicModule: this.dynamicModule,
81
137
  };
82
138
  */
83
- }
84
- catch (e) {
139
+ } catch (e) {
85
140
  if (this.errorHandler === undefined) {
86
141
  throw e;
87
- }
88
- else {
142
+ } else {
89
143
  this.errorHandler(e);
90
144
  }
91
145
  }
@@ -100,8 +154,10 @@ class CompileAttribute {
100
154
  })
101
155
  */
102
156
  }
103
- createComponentModule(componentType) {
104
- let module = {};
157
+
158
+ private createComponentModule(componentType: any) {
159
+ let module: NgModule = {};
160
+
105
161
  if (this.module !== undefined) {
106
162
  module = Object.assign({}, this.module);
107
163
  }
@@ -113,87 +169,39 @@ class CompileAttribute {
113
169
  module.imports = module.imports || [];
114
170
  module.imports.push(CommonModule);
115
171
  if (this.imports !== undefined) {
116
- module.imports = module.imports.concat(this.imports);
172
+ module.imports = module.imports.concat(this.imports)
117
173
  }
118
174
  if (module.declarations === undefined) {
119
175
  module.declarations = [
120
176
  componentType
121
177
  ];
122
- }
123
- else {
178
+ } else {
124
179
  module.declarations.push(componentType);
125
180
  }
126
181
  module.entryComponents = [
127
182
  componentType
128
183
  ];
184
+
185
+ @NgModule(module)
129
186
  class RuntimeComponentModule {
130
187
  }
131
- RuntimeComponentModule.decorators = [
132
- { type: NgModule, args: [module,] }
133
- ];
188
+
134
189
  return RuntimeComponentModule;
135
190
  }
136
- createNewComponent(html, context) {
137
- const selector = nextId();
191
+
192
+
193
+ private createNewComponent(html: string, context: any) {
194
+
195
+ const selector: string = nextId()
196
+
197
+ @Component({
198
+ selector: selector,
199
+ template: html
200
+ })
138
201
  class DynamicComponent {
139
- constructor() {
140
- this.context = context;
141
- }
202
+ context: any = context;
142
203
  }
143
- DynamicComponent.decorators = [
144
- { type: Component, args: [{
145
- selector: selector,
146
- template: html
147
- },] }
148
- ];
204
+
149
205
  return DynamicComponent;
150
206
  }
151
207
  }
152
- CompileAttribute.decorators = [
153
- { type: Component, args: [{
154
- selector: '[p3x-compile]',
155
- template: `
156
- <ng-container *ngIf="renderComponent">
157
- <ng-container *ngComponentOutlet="dynamicComponent; ngModuleFactory: dynamicModule;"></ng-container>
158
- </ng-container>
159
- `
160
- },] },
161
- { type: Injectable }
162
- ];
163
- CompileAttribute.ctorParameters = () => [
164
- { type: Compiler }
165
- ];
166
- CompileAttribute.propDecorators = {
167
- html: [{ type: Input, args: ['p3x-compile',] }],
168
- context: [{ type: Input, args: ['p3x-compile-ctx',] }],
169
- errorHandler: [{ type: Input, args: ['p3x-compile-error-handler',] }],
170
- module: [{ type: Input, args: ['p3x-compile-module',] }],
171
- imports: [{ type: Input, args: ['p3x-compile-imports',] }]
172
- };
173
-
174
- class CompileModule {
175
- }
176
- CompileModule.decorators = [
177
- { type: NgModule, args: [{
178
- declarations: [
179
- CompileAttribute
180
- ],
181
- imports: [
182
- CommonModule
183
- ],
184
- exports: [
185
- CompileAttribute
186
- ]
187
- },] }
188
- ];
189
-
190
- /*
191
- * Public API Surface of angular-compile
192
- */
193
-
194
- /**
195
- * Generated bundle index. Do not edit.
196
- */
197
-
198
- export { CompileAttribute, CompileModule };
199
- //# sourceMappingURL=p3x-angular-compile.js.map
@@ -0,0 +1,19 @@
1
+ import {
2
+ NgModule,
3
+ //ModuleWithProviders,
4
+ } from '@angular/core';
5
+ import {CompileAttribute} from "./angular-compile.component";
6
+ import {CommonModule} from '@angular/common';
7
+
8
+ @NgModule({
9
+ declarations: [
10
+ CompileAttribute
11
+ ],
12
+ imports: [
13
+ CommonModule
14
+ ],
15
+ exports: [
16
+ CompileAttribute
17
+ ]
18
+ })
19
+ export class CompileModule { }
package/package.json CHANGED
@@ -1,29 +1,20 @@
1
1
  {
2
2
  "name": "p3x-angular-compile",
3
- "version": "2021.10.139",
3
+ "version": "2021.10.151",
4
4
  "peerDependencies": {
5
- "@angular/common": "^12.0.0",
6
- "@angular/core": "^12.0.0",
7
- "lodash": "^4.17.21",
8
- "@types/lodash": "^4.14.169"
5
+ "@angular/common": "^13.0.0",
6
+ "@angular/core": "^13.0.0"
9
7
  },
8
+ "main": "index.ts",
10
9
  "corifeus": {
11
10
  "publish": true
12
11
  },
12
+ "devDependencies": {
13
+ "corifeus-builder": "^2021.10.165"
14
+ },
13
15
  "dependencies": {
14
16
  "tslib": "^2.0.0"
15
17
  },
16
- "main": "bundles/p3x-angular-compile.umd.js",
17
- "module": "fesm2015/p3x-angular-compile.js",
18
- "es2015": "fesm2015/p3x-angular-compile.js",
19
- "esm2015": "esm2015/p3x-angular-compile.js",
20
- "fesm2015": "fesm2015/p3x-angular-compile.js",
21
- "typings": "p3x-angular-compile.d.ts",
22
- "metadata": "p3x-angular-compile.metadata.json",
23
- "sideEffects": false,
24
- "devDependencies": {
25
- "corifeus-builder": "^2021.10.144"
26
- },
27
18
  "description": "🆖 Angular Dynamic Compile - Convert strings to Angular components",
28
19
  "repository": {
29
20
  "type": "git",
@@ -1,2 +1,6 @@
1
+ /*
2
+ * Public API Surface of angular-compile
3
+ */
4
+
1
5
  export * from './lib/angular-compile.module';
2
6
  export * from './lib/angular-compile.component';
package/test.ts ADDED
@@ -0,0 +1,28 @@
1
+ // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+ import 'zone.js';
4
+ import 'zone.js/testing';
5
+ import { getTestBed } from '@angular/core/testing';
6
+ import {
7
+ BrowserDynamicTestingModule,
8
+ platformBrowserDynamicTesting
9
+ } from '@angular/platform-browser-dynamic/testing';
10
+
11
+ declare const require: {
12
+ context(path: string, deep?: boolean, filter?: RegExp): {
13
+ keys(): string[];
14
+ <T>(id: string): T;
15
+ };
16
+ };
17
+
18
+ // First, initialize the Angular testing environment.
19
+ getTestBed().initTestEnvironment(
20
+ BrowserDynamicTestingModule,
21
+ platformBrowserDynamicTesting(), {
22
+ teardown: { destroyAfterEach: false }
23
+ }
24
+ );
25
+ // Then we find all the tests.
26
+ const context = require.context('./', true, /\.spec\.ts$/);
27
+ // And load the modules.
28
+ context.keys().map(context);
@@ -1,215 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common')) :
3
- typeof define === 'function' && define.amd ? define('p3x-angular-compile', ['exports', '@angular/core', '@angular/common'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['p3x-angular-compile'] = {}, global.ng.core, global.ng.common));
5
- }(this, (function (exports, core, common) { 'use strict';
6
-
7
- //import { BrowserModule } from '@angular/platform-browser';
8
- //let SingletonDefaultModule: NgModule;
9
- //import cloneDeep from 'lodash/cloneDeep';
10
- //import { CorifeusMaterialModule } from 'corifeus-web-material';
11
- function reverse(str) {
12
- return str.split('').reverse().join('');
13
- }
14
- function random() {
15
- return (Math.floor(Math.random() * (99999999999999999 - 10000000000000000)) + 10000000000000000).toString(16);
16
- }
17
- var currentIdTime;
18
- var currentId = 0;
19
- function nextId() {
20
- var now = Date.now();
21
- if (currentIdTime !== now) {
22
- currentId = 0;
23
- currentIdTime = now;
24
- }
25
- var comingId = ++currentId;
26
- var randomHex = reverse(random()).padStart(15, '0');
27
- var timeHex = reverse(currentIdTime.toString(16).padStart(12, '0'));
28
- var comingIdHex = reverse(comingId.toString(16).padStart(3, '0'));
29
- var newId = "p3x-angular-compile-" + timeHex + comingIdHex + randomHex;
30
- //console.log(newId)
31
- return newId;
32
- }
33
- //const cache : any = {};
34
- var CompileAttribute = /** @class */ (function () {
35
- function CompileAttribute(
36
- // private container: ViewContainerRef,
37
- // private service: CompileService
38
- compiler) {
39
- this.compiler = compiler;
40
- this.errorHandler = undefined;
41
- }
42
- Object.defineProperty(CompileAttribute.prototype, "renderComponent", {
43
- /*
44
- // not requires, since ngOnChanges does it first time change
45
- ngOnInit() {
46
- //console.log('ng init')
47
- // this.update();
48
- }
49
- */
50
- get: function () {
51
- return typeof this.html === 'string' && this.html.trim() !== '';
52
- },
53
- enumerable: false,
54
- configurable: true
55
- });
56
- CompileAttribute.prototype.ngOnChanges = function (changes) {
57
- //console.log('ng one changes')
58
- this.update();
59
- };
60
- CompileAttribute.prototype.update = function () {
61
- try {
62
- if (this.html === undefined || this.html === null || this.html.trim() === '') {
63
- // this.container.clear();
64
- this.dynamicComponent = undefined;
65
- this.dynamicModule = undefined;
66
- return;
67
- }
68
- /*
69
-
70
- // looks like Angular already is caching
71
-
72
- //console.log('html', this.html)
73
- const cacheKey = this.html;
74
- //console.log(Object.keys(cache).indexOf(cacheKey), cache)
75
- if (cache.hasOwnProperty(cacheKey)) {
76
- const currentCache = cache[cacheKey];
77
- this.dynamicComponent = currentCache.dynamicComponent
78
- this.dynamicModule = currentCache.dynamicModule
79
- return ;
80
- }
81
- */
82
- this.dynamicComponent = this.createNewComponent(this.html, this.context);
83
- this.dynamicModule = this.compiler.compileModuleSync(this.createComponentModule(this.dynamicComponent));
84
- /*
85
- cache[cacheKey] = {
86
- dynamicComponent: this.dynamicComponent,
87
- dynamicModule: this.dynamicModule,
88
- };
89
- */
90
- }
91
- catch (e) {
92
- if (this.errorHandler === undefined) {
93
- throw e;
94
- }
95
- else {
96
- this.errorHandler(e);
97
- }
98
- }
99
- /*
100
- // now we use it with ngComponentOutlet, since about angular 5
101
- await this.service.compile({
102
- template: this.html,
103
- container: this.container,
104
- context: this.context,
105
- imports: this.imports,
106
- module: this.module
107
- })
108
- */
109
- };
110
- CompileAttribute.prototype.createComponentModule = function (componentType) {
111
- var module = {};
112
- if (this.module !== undefined) {
113
- module = Object.assign({}, this.module);
114
- }
115
- /*
116
- else if (SingletonDefaultModule !== undefined && SingletonDefaultModule !== null) {
117
- module = cloneDeep(SingletonDefaultModule);
118
- }
119
- */
120
- module.imports = module.imports || [];
121
- module.imports.push(common.CommonModule);
122
- if (this.imports !== undefined) {
123
- module.imports = module.imports.concat(this.imports);
124
- }
125
- if (module.declarations === undefined) {
126
- module.declarations = [
127
- componentType
128
- ];
129
- }
130
- else {
131
- module.declarations.push(componentType);
132
- }
133
- module.entryComponents = [
134
- componentType
135
- ];
136
- var RuntimeComponentModule = /** @class */ (function () {
137
- function RuntimeComponentModule() {
138
- }
139
- return RuntimeComponentModule;
140
- }());
141
- RuntimeComponentModule.decorators = [
142
- { type: core.NgModule, args: [module,] }
143
- ];
144
- return RuntimeComponentModule;
145
- };
146
- CompileAttribute.prototype.createNewComponent = function (html, context) {
147
- var selector = nextId();
148
- var DynamicComponent = /** @class */ (function () {
149
- function DynamicComponent() {
150
- this.context = context;
151
- }
152
- return DynamicComponent;
153
- }());
154
- DynamicComponent.decorators = [
155
- { type: core.Component, args: [{
156
- selector: selector,
157
- template: html
158
- },] }
159
- ];
160
- return DynamicComponent;
161
- };
162
- return CompileAttribute;
163
- }());
164
- CompileAttribute.decorators = [
165
- { type: core.Component, args: [{
166
- selector: '[p3x-compile]',
167
- template: "\n <ng-container *ngIf=\"renderComponent\">\n <ng-container *ngComponentOutlet=\"dynamicComponent; ngModuleFactory: dynamicModule;\"></ng-container>\n </ng-container>\n "
168
- },] },
169
- { type: core.Injectable }
170
- ];
171
- CompileAttribute.ctorParameters = function () { return [
172
- { type: core.Compiler }
173
- ]; };
174
- CompileAttribute.propDecorators = {
175
- html: [{ type: core.Input, args: ['p3x-compile',] }],
176
- context: [{ type: core.Input, args: ['p3x-compile-ctx',] }],
177
- errorHandler: [{ type: core.Input, args: ['p3x-compile-error-handler',] }],
178
- module: [{ type: core.Input, args: ['p3x-compile-module',] }],
179
- imports: [{ type: core.Input, args: ['p3x-compile-imports',] }]
180
- };
181
-
182
- var CompileModule = /** @class */ (function () {
183
- function CompileModule() {
184
- }
185
- return CompileModule;
186
- }());
187
- CompileModule.decorators = [
188
- { type: core.NgModule, args: [{
189
- declarations: [
190
- CompileAttribute
191
- ],
192
- imports: [
193
- common.CommonModule
194
- ],
195
- exports: [
196
- CompileAttribute
197
- ]
198
- },] }
199
- ];
200
-
201
- /*
202
- * Public API Surface of angular-compile
203
- */
204
-
205
- /**
206
- * Generated bundle index. Do not edit.
207
- */
208
-
209
- exports.CompileAttribute = CompileAttribute;
210
- exports.CompileModule = CompileModule;
211
-
212
- Object.defineProperty(exports, '__esModule', { value: true });
213
-
214
- })));
215
- //# sourceMappingURL=p3x-angular-compile.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"p3x-angular-compile.umd.js","sources":["../../../projects/angular-compile/src/lib/angular-compile.component.ts","../../../projects/angular-compile/src/lib/angular-compile.module.ts","../../../projects/angular-compile/src/public-api.ts","../../../projects/angular-compile/src/p3x-angular-compile.ts"],"sourcesContent":["import {\n Compiler,\n Component,\n Injectable,\n Input,\n ModuleWithProviders,\n NgModule,\n NgModuleFactory,\n OnChanges,\n SimpleChanges,\n Type,\n} from '@angular/core';\n\nimport {CommonModule} from '@angular/common';\n//import { BrowserModule } from '@angular/platform-browser';\n//let SingletonDefaultModule: NgModule;\n//import cloneDeep from 'lodash/cloneDeep';\n\n//import { CorifeusMaterialModule } from 'corifeus-web-material';\n\nfunction reverse(str: string) {\n return str.split('').reverse().join('')\n}\n\nfunction random() {\n return (Math.floor(Math.random() * (99999999999999999 - 10000000000000000)) + 10000000000000000).toString(16)\n}\n\nlet currentIdTime: number;\nlet currentId = 0;\n\nfunction nextId(): string {\n\n const now = Date.now();\n if (currentIdTime !== now) {\n currentId = 0;\n currentIdTime = now\n }\n const comingId = ++currentId;\n const randomHex = reverse(random()).padStart(15, '0');\n const timeHex = reverse(currentIdTime.toString(16).padStart(12, '0'))\n const comingIdHex = reverse(comingId.toString(16).padStart(3, '0'))\n const newId: string = `p3x-angular-compile-${timeHex}${comingIdHex}${randomHex}`;\n //console.log(newId)\n return newId\n}\n\n\n//const cache : any = {};\n\n@Component({\n selector: '[p3x-compile]',\n template: `\n <ng-container *ngIf=\"renderComponent\">\n <ng-container *ngComponentOutlet=\"dynamicComponent; ngModuleFactory: dynamicModule;\"></ng-container>\n </ng-container>\n `\n})\n@Injectable()\nexport class CompileAttribute implements OnChanges {\n//export class CompileAttribute implements OnChanges ,OnInit {\n\n @Input('p3x-compile')\n html: string;\n\n @Input('p3x-compile-ctx')\n context: any;\n\n @Input('p3x-compile-error-handler')\n errorHandler: Function = undefined;\n\n dynamicComponent: any;\n dynamicModule: NgModuleFactory<any> | any;\n\n @Input('p3x-compile-module')\n module: NgModule;\n\n @Input('p3x-compile-imports')\n imports: Array<Type<any> | ModuleWithProviders<any> | any[]>;\n\n constructor(\n // private container: ViewContainerRef,\n // private service: CompileService\n private compiler: Compiler,\n // @Inject('config') private config:CompileServiceConfig\n ) {\n }\n\n /*\n // not requires, since ngOnChanges does it first time change\n ngOnInit() {\n //console.log('ng init')\n // this.update();\n }\n */\n\n get renderComponent() {\n return typeof this.html === 'string' && this.html.trim() !== ''\n }\n\n ngOnChanges(changes: SimpleChanges) {\n //console.log('ng one changes')\n this.update();\n }\n\n\n update() {\n try {\n if (this.html === undefined || this.html === null || this.html.trim() === '') {\n // this.container.clear();\n this.dynamicComponent = undefined;\n this.dynamicModule = undefined;\n return;\n }\n\n /*\n\n // looks like Angular already is caching\n\n //console.log('html', this.html)\n const cacheKey = this.html;\n //console.log(Object.keys(cache).indexOf(cacheKey), cache)\n if (cache.hasOwnProperty(cacheKey)) {\n const currentCache = cache[cacheKey];\n this.dynamicComponent = currentCache.dynamicComponent\n this.dynamicModule = currentCache.dynamicModule\n return ;\n }\n */\n this.dynamicComponent = this.createNewComponent(this.html, this.context);\n this.dynamicModule = this.compiler.compileModuleSync(this.createComponentModule(this.dynamicComponent));\n\n /*\n cache[cacheKey] = {\n dynamicComponent: this.dynamicComponent,\n dynamicModule: this.dynamicModule,\n };\n */\n } catch (e) {\n if (this.errorHandler === undefined) {\n throw e;\n } else {\n this.errorHandler(e);\n }\n }\n /*\n // now we use it with ngComponentOutlet, since about angular 5\n await this.service.compile({\n template: this.html,\n container: this.container,\n context: this.context,\n imports: this.imports,\n module: this.module\n })\n */\n }\n\n private createComponentModule(componentType: any) {\n let module: NgModule = {};\n\n if (this.module !== undefined) {\n module = Object.assign({}, this.module);\n }\n /*\n else if (SingletonDefaultModule !== undefined && SingletonDefaultModule !== null) {\n module = cloneDeep(SingletonDefaultModule);\n }\n */\n module.imports = module.imports || [];\n module.imports.push(CommonModule);\n if (this.imports !== undefined) {\n module.imports = module.imports.concat(this.imports)\n }\n if (module.declarations === undefined) {\n module.declarations = [\n componentType\n ];\n } else {\n module.declarations.push(componentType);\n }\n module.entryComponents = [\n componentType\n ];\n\n @NgModule(module)\n class RuntimeComponentModule {\n }\n\n return RuntimeComponentModule;\n }\n\n\n private createNewComponent(html: string, context: any) {\n\n const selector: string = nextId()\n\n @Component({\n selector: selector,\n template: html\n })\n class DynamicComponent {\n context: any = context;\n }\n\n return DynamicComponent;\n }\n}\n","import {\n NgModule,\n //ModuleWithProviders,\n} from '@angular/core';\nimport {CompileAttribute} from \"./angular-compile.component\";\nimport {CommonModule} from '@angular/common';\n\n@NgModule({\n declarations: [\n CompileAttribute\n ],\n imports: [\n CommonModule\n ],\n exports: [\n CompileAttribute\n ]\n})\nexport class CompileModule { }\n","/*\n * Public API Surface of angular-compile\n */\n\nexport * from './lib/angular-compile.module';\nexport * from './lib/angular-compile.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["CommonModule","NgModule","Component","Injectable","Compiler","Input"],"mappings":";;;;;;IAcA;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BACnB;iBACF;;;ICjBD;;;;ICAA;;;;;;;;;;;;;"}
@@ -1,172 +0,0 @@
1
- import { Compiler, Component, Injectable, Input, NgModule, } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- //import { BrowserModule } from '@angular/platform-browser';
4
- //let SingletonDefaultModule: NgModule;
5
- //import cloneDeep from 'lodash/cloneDeep';
6
- //import { CorifeusMaterialModule } from 'corifeus-web-material';
7
- function reverse(str) {
8
- return str.split('').reverse().join('');
9
- }
10
- function random() {
11
- return (Math.floor(Math.random() * (99999999999999999 - 10000000000000000)) + 10000000000000000).toString(16);
12
- }
13
- let currentIdTime;
14
- let currentId = 0;
15
- function nextId() {
16
- const now = Date.now();
17
- if (currentIdTime !== now) {
18
- currentId = 0;
19
- currentIdTime = now;
20
- }
21
- const comingId = ++currentId;
22
- const randomHex = reverse(random()).padStart(15, '0');
23
- const timeHex = reverse(currentIdTime.toString(16).padStart(12, '0'));
24
- const comingIdHex = reverse(comingId.toString(16).padStart(3, '0'));
25
- const newId = `p3x-angular-compile-${timeHex}${comingIdHex}${randomHex}`;
26
- //console.log(newId)
27
- return newId;
28
- }
29
- //const cache : any = {};
30
- export class CompileAttribute {
31
- constructor(
32
- // private container: ViewContainerRef,
33
- // private service: CompileService
34
- compiler) {
35
- this.compiler = compiler;
36
- this.errorHandler = undefined;
37
- }
38
- /*
39
- // not requires, since ngOnChanges does it first time change
40
- ngOnInit() {
41
- //console.log('ng init')
42
- // this.update();
43
- }
44
- */
45
- get renderComponent() {
46
- return typeof this.html === 'string' && this.html.trim() !== '';
47
- }
48
- ngOnChanges(changes) {
49
- //console.log('ng one changes')
50
- this.update();
51
- }
52
- update() {
53
- try {
54
- if (this.html === undefined || this.html === null || this.html.trim() === '') {
55
- // this.container.clear();
56
- this.dynamicComponent = undefined;
57
- this.dynamicModule = undefined;
58
- return;
59
- }
60
- /*
61
-
62
- // looks like Angular already is caching
63
-
64
- //console.log('html', this.html)
65
- const cacheKey = this.html;
66
- //console.log(Object.keys(cache).indexOf(cacheKey), cache)
67
- if (cache.hasOwnProperty(cacheKey)) {
68
- const currentCache = cache[cacheKey];
69
- this.dynamicComponent = currentCache.dynamicComponent
70
- this.dynamicModule = currentCache.dynamicModule
71
- return ;
72
- }
73
- */
74
- this.dynamicComponent = this.createNewComponent(this.html, this.context);
75
- this.dynamicModule = this.compiler.compileModuleSync(this.createComponentModule(this.dynamicComponent));
76
- /*
77
- cache[cacheKey] = {
78
- dynamicComponent: this.dynamicComponent,
79
- dynamicModule: this.dynamicModule,
80
- };
81
- */
82
- }
83
- catch (e) {
84
- if (this.errorHandler === undefined) {
85
- throw e;
86
- }
87
- else {
88
- this.errorHandler(e);
89
- }
90
- }
91
- /*
92
- // now we use it with ngComponentOutlet, since about angular 5
93
- await this.service.compile({
94
- template: this.html,
95
- container: this.container,
96
- context: this.context,
97
- imports: this.imports,
98
- module: this.module
99
- })
100
- */
101
- }
102
- createComponentModule(componentType) {
103
- let module = {};
104
- if (this.module !== undefined) {
105
- module = Object.assign({}, this.module);
106
- }
107
- /*
108
- else if (SingletonDefaultModule !== undefined && SingletonDefaultModule !== null) {
109
- module = cloneDeep(SingletonDefaultModule);
110
- }
111
- */
112
- module.imports = module.imports || [];
113
- module.imports.push(CommonModule);
114
- if (this.imports !== undefined) {
115
- module.imports = module.imports.concat(this.imports);
116
- }
117
- if (module.declarations === undefined) {
118
- module.declarations = [
119
- componentType
120
- ];
121
- }
122
- else {
123
- module.declarations.push(componentType);
124
- }
125
- module.entryComponents = [
126
- componentType
127
- ];
128
- class RuntimeComponentModule {
129
- }
130
- RuntimeComponentModule.decorators = [
131
- { type: NgModule, args: [module,] }
132
- ];
133
- return RuntimeComponentModule;
134
- }
135
- createNewComponent(html, context) {
136
- const selector = nextId();
137
- class DynamicComponent {
138
- constructor() {
139
- this.context = context;
140
- }
141
- }
142
- DynamicComponent.decorators = [
143
- { type: Component, args: [{
144
- selector: selector,
145
- template: html
146
- },] }
147
- ];
148
- return DynamicComponent;
149
- }
150
- }
151
- CompileAttribute.decorators = [
152
- { type: Component, args: [{
153
- selector: '[p3x-compile]',
154
- template: `
155
- <ng-container *ngIf="renderComponent">
156
- <ng-container *ngComponentOutlet="dynamicComponent; ngModuleFactory: dynamicModule;"></ng-container>
157
- </ng-container>
158
- `
159
- },] },
160
- { type: Injectable }
161
- ];
162
- CompileAttribute.ctorParameters = () => [
163
- { type: Compiler }
164
- ];
165
- CompileAttribute.propDecorators = {
166
- html: [{ type: Input, args: ['p3x-compile',] }],
167
- context: [{ type: Input, args: ['p3x-compile-ctx',] }],
168
- errorHandler: [{ type: Input, args: ['p3x-compile-error-handler',] }],
169
- module: [{ type: Input, args: ['p3x-compile-module',] }],
170
- imports: [{ type: Input, args: ['p3x-compile-imports',] }]
171
- };
172
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci1jb21waWxlLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL2FuZ3VsYXItY29tcGlsZS9zcmMvbGliL2FuZ3VsYXItY29tcGlsZS5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNILFFBQVEsRUFDUixTQUFTLEVBQ1QsVUFBVSxFQUNWLEtBQUssRUFFTCxRQUFRLEdBS1gsTUFBTSxlQUFlLENBQUM7QUFFdkIsT0FBTyxFQUFDLFlBQVksRUFBQyxNQUFNLGlCQUFpQixDQUFDO0FBQzdDLDREQUE0RDtBQUM1RCx1Q0FBdUM7QUFDdkMsMkNBQTJDO0FBRTNDLGlFQUFpRTtBQUVqRSxTQUFTLE9BQU8sQ0FBQyxHQUFXO0lBQ3hCLE9BQU8sR0FBRyxDQUFDLEtBQUssQ0FBQyxFQUFFLENBQUMsQ0FBQyxPQUFPLEVBQUUsQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUE7Q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hpcy5odG1sLnRyaW0oKSAhPT0gJydcbiAgICB9XG5cbiAgICBuZ09uQ2hhbmdlcyhjaGFuZ2VzOiBTaW1wbGVDaGFuZ2VzKSB7XG4gICAgICAgIC8vY29uc29sZS5sb2coJ25nIG9uZSBjaGFuZ2VzJylcbiAgICAgICAgdGhpcy51cGRhdGUoKTtcbiAgICB9XG5cblxuICAgIHVwZGF0ZSgpIHtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGlmICh0aGlzLmh0bWwgPT09IHVuZGVmaW5lZCB8fCB0aGlzLmh0bWwgPT09IG51bGwgfHwgdGhpcy5odG1sLnRyaW0oKSA9PT0gJycpIHtcbiAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgIHRoaXMuY29udGFpbmVyLmNsZWFyKCk7XG4gICAgICAgICAgICAgICAgdGhpcy5keW5hbWljQ29tcG9uZW50ID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIHRoaXMuZHluYW1pY01vZHVsZSA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8qXG5cbiAgICAgICAgICAgIC8vIGxvb2tzIGxpa2UgQW5ndWxhciBhbHJlYWR5IGlzIGNhY2hpbmdcblxuICAgICAgICAgICAgLy9jb25zb2xlLmxvZygnaHRtbCcsIHRoaXMuaHRtbClcbiAgICAgICAgICAgIGNvbnN0IGNhY2hlS2V5ID0gdGhpcy5odG1sO1xuICAgICAgICAgICAgLy9jb25zb2xlLmxvZyhPYmplY3Qua2V5cyhjYWNoZSkuaW5kZXhPZihjYWNoZUtleSksIGNhY2hlKVxuICAgICAgICAgICAgaWYgKGNhY2hlLmhhc093blByb3BlcnR5KGNhY2hlS2V5KSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IGN1cnJlbnRDYWNoZSA9IGNhY2hlW2NhY2hlS2V5XTtcbiAgICAgICAgICAgICAgICB0aGlzLmR5bmFtaWNDb21wb25lbnQgPSBjdXJyZW50Q2FjaGUuZHluYW1pY0NvbXBvbmVudFxuICAgICAgICAgICAgICAgIHRoaXMuZHluYW1pY01vZHVsZSA9IGN1cnJlbnRDYWNoZS5keW5hbWljTW9kdWxlXG4gICAgICAgICAgICAgICAgcmV0dXJuIDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgICovXG4gICAgICAgICAgICB0aGlzLmR5bmFtaWNDb21wb25lbnQgPSB0aGlzLmNyZWF0ZU5ld0NvbXBvbmVudCh0aGlzLmh0bWwsIHRoaXMuY29udGV4dCk7XG4gICAgICAgICAgICB0aGlzLmR5bmFtaWNNb2R1bGUgPSB0aGlzLmNvbXBpbGVyLmNvbXBpbGVNb2R1bGVTeW5jKHRoaXMuY3JlYXRlQ29tcG9uZW50TW9kdWxlKHRoaXMuZHluYW1pY0NvbXBvbmVudCkpO1xuXG4gICAgICAgICAgICAvKlxuICAgICAgICAgICAgY2FjaGVbY2FjaGVLZXldID0ge1xuICAgICAgICAgICAgICAgIGR5bmFtaWNDb21wb25lbnQ6IHRoaXMuZHluYW1pY0NvbXBvbmVudCxcbiAgICAgICAgICAgICAgICBkeW5hbWljTW9kdWxlOiB0aGlzLmR5bmFtaWNNb2R1bGUsXG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgKi9cbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgaWYgKHRoaXMuZXJyb3JIYW5kbGVyID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aGlzLmVycm9ySGFuZGxlcihlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvKlxuICAgICAgICAvLyBub3cgd2UgdXNlIGl0IHdpdGggbmdDb21wb25lbnRPdXRsZXQsIHNpbmNlIGFib3V0IGFuZ3VsYXIgNVxuICAgICAgICBhd2FpdCB0aGlzLnNlcnZpY2U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lY2xhcmF0aW9ucyA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBtb2R1bGUuZGVjbGFyYXRpb25zID0gW1xuICAgICAgICAgICAgICAgIGNvbXBvbmVudFR5cGVcbiAgICAgICAgICAgIF07XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBtb2R1bGUuZGVjbGFyYXRpb25zLnB1c2goY29tcG9uZW50VHlwZSk7XG4gICAgICAgIH1cbiAgICAgICAgbW9kdWxlLmVudHJ5Q29tcG9uZW50cyA9IFtcbiAgICAgICAgICAgIGNvbXBvbmVudFR5cGVcbiAgICAgICAgXTtcblxuICAgICAgICBATmdNb2R1bGUobW9kdWxlKVxuICAgICAgICBjbGFzcyBSdW50aW1lQ29tcG9uZW50TW9kdWxlIHtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBSdW50aW1lQ29tcG9uZW50TW9kdWxlO1xuICAgIH1cblxuXG4gICAgcHJpdmF0ZSBjcmVhdGVOZXdDb21wb25lbnQoaHRtbDogc3RyaW5nLCBjb250ZXh0OiBhbnkpIHtcblxuICAgICAgICBjb25zdCBzZWxlY3Rvcjogc3RyaW5nID0gbmV4dElkKClcblxuICAgICAgICBAQ29tcG9uZW50KHtcbiAgICAgICAgICAgIHNlbGVjdG9yOiBzZWxlY3RvcixcbiAgICAgICAgICAgIHRlbXBsYXRlOiBodG1sXG4gICAgICAgIH0pXG4gICAgICAgIGNsYXNzIER5bmFtaWNDb21wb25lbnQge1xuICAgICAgICAgICAgY29udGV4dDogYW55ID0gY29udGV4dDtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBEeW5hbWljQ29tcG9uZW50O1xuICAgIH1cbn1cbiJdfQ==
@@ -1,21 +0,0 @@
1
- import { NgModule,
2
- //ModuleWithProviders,
3
- } from '@angular/core';
4
- import { CompileAttribute } from "./angular-compile.component";
5
- import { CommonModule } from '@angular/common';
6
- export class CompileModule {
7
- }
8
- CompileModule.decorators = [
9
- { type: NgModule, args: [{
10
- declarations: [
11
- CompileAttribute
12
- ],
13
- imports: [
14
- CommonModule
15
- ],
16
- exports: [
17
- CompileAttribute
18
- ]
19
- },] }
20
- ];
21
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci1jb21waWxlLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL2FuZ3VsYXItY29tcGlsZS9zcmMvbGliL2FuZ3VsYXItY29tcGlsZS5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNILFFBQVE7QUFDUixzQkFBc0I7RUFDekIsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFDLGdCQUFnQixFQUFDLE1BQU0sNkJBQTZCLENBQUM7QUFDN0QsT0FBTyxFQUFDLFlBQVksRUFBQyxNQUFNLGlCQUFpQixDQUFDO0FBYTdDLE1BQU0sT0FBTyxhQUFhOzs7WUFYekIsUUFBUSxTQUFDO2dCQUNSLFlBQVksRUFBRTtvQkFDVixnQkFBZ0I7aUJBQ25CO2dCQUNELE9BQU8sRUFBRTtvQkFDTCxZQUFZO2lCQUNmO2dCQUNELE9BQU8sRUFBRTtvQkFDTCxnQkFBZ0I7aUJBQ25CO2FBQ0YiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQge1xuICAgIE5nTW9kdWxlLFxuICAgIC8vTW9kdWxlV2l0aFByb3ZpZGVycyxcbn0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pbXBvcnQge0NvbXBpbGVBdHRyaWJ1dGV9IGZyb20gXCIuL2FuZ3VsYXItY29tcGlsZS5jb21wb25lbnRcIjtcbmltcG9ydCB7Q29tbW9uTW9kdWxlfSBmcm9tICdAYW5ndWxhci9jb21tb24nO1xuXG5ATmdNb2R1bGUoe1xuICBkZWNsYXJhdGlvbnM6IFtcbiAgICAgIENvbXBpbGVBdHRyaWJ1dGVcbiAgXSxcbiAgaW1wb3J0czogW1xuICAgICAgQ29tbW9uTW9kdWxlXG4gIF0sXG4gIGV4cG9ydHM6IFtcbiAgICAgIENvbXBpbGVBdHRyaWJ1dGVcbiAgXVxufSlcbmV4cG9ydCBjbGFzcyBDb21waWxlTW9kdWxlIHsgfVxuIl19
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './public-api';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicDN4LWFuZ3VsYXItY29tcGlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2FuZ3VsYXItY29tcGlsZS9zcmMvcDN4LWFuZ3VsYXItY29tcGlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpYy1hcGknO1xuIl19
@@ -1,6 +0,0 @@
1
- /*
2
- * Public API Surface of angular-compile
3
- */
4
- export * from './lib/angular-compile.module';
5
- export * from './lib/angular-compile.component';
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2FuZ3VsYXItY29tcGlsZS9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsOEJBQThCLENBQUM7QUFDN0MsY0FBYyxpQ0FBaUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2YgYW5ndWxhci1jb21waWxlXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvYW5ndWxhci1jb21waWxlLm1vZHVsZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9hbmd1bGFyLWNvbXBpbGUuY29tcG9uZW50JztcbiJdfQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"p3x-angular-compile.js","sources":["../../../projects/angular-compile/src/lib/angular-compile.component.ts","../../../projects/angular-compile/src/lib/angular-compile.module.ts","../../../projects/angular-compile/src/public-api.ts","../../../projects/angular-compile/src/p3x-angular-compile.ts"],"sourcesContent":["import {\n Compiler,\n Component,\n Injectable,\n Input,\n ModuleWithProviders,\n NgModule,\n NgModuleFactory,\n OnChanges,\n SimpleChanges,\n Type,\n} from '@angular/core';\n\nimport {CommonModule} from '@angular/common';\n//import { BrowserModule } from '@angular/platform-browser';\n//let SingletonDefaultModule: NgModule;\n//import cloneDeep from 'lodash/cloneDeep';\n\n//import { CorifeusMaterialModule } from 'corifeus-web-material';\n\nfunction reverse(str: string) {\n return str.split('').reverse().join('')\n}\n\nfunction random() {\n return (Math.floor(Math.random() * (99999999999999999 - 10000000000000000)) + 10000000000000000).toString(16)\n}\n\nlet currentIdTime: number;\nlet currentId = 0;\n\nfunction nextId(): string {\n\n const now = Date.now();\n if (currentIdTime !== now) {\n currentId = 0;\n currentIdTime = now\n }\n const comingId = ++currentId;\n const randomHex = reverse(random()).padStart(15, '0');\n const timeHex = reverse(currentIdTime.toString(16).padStart(12, '0'))\n const comingIdHex = reverse(comingId.toString(16).padStart(3, '0'))\n const newId: string = `p3x-angular-compile-${timeHex}${comingIdHex}${randomHex}`;\n //console.log(newId)\n return newId\n}\n\n\n//const cache : any = {};\n\n@Component({\n selector: '[p3x-compile]',\n template: `\n <ng-container *ngIf=\"renderComponent\">\n <ng-container *ngComponentOutlet=\"dynamicComponent; ngModuleFactory: dynamicModule;\"></ng-container>\n </ng-container>\n `\n})\n@Injectable()\nexport class CompileAttribute implements OnChanges {\n//export class CompileAttribute implements OnChanges ,OnInit {\n\n @Input('p3x-compile')\n html: string;\n\n @Input('p3x-compile-ctx')\n context: any;\n\n @Input('p3x-compile-error-handler')\n errorHandler: Function = undefined;\n\n dynamicComponent: any;\n dynamicModule: NgModuleFactory<any> | any;\n\n @Input('p3x-compile-module')\n module: NgModule;\n\n @Input('p3x-compile-imports')\n imports: Array<Type<any> | ModuleWithProviders<any> | any[]>;\n\n constructor(\n // private container: ViewContainerRef,\n // private service: CompileService\n private compiler: Compiler,\n // @Inject('config') private config:CompileServiceConfig\n ) {\n }\n\n /*\n // not requires, since ngOnChanges does it first time change\n ngOnInit() {\n //console.log('ng init')\n // this.update();\n }\n */\n\n get renderComponent() {\n return typeof this.html === 'string' && this.html.trim() !== ''\n }\n\n ngOnChanges(changes: SimpleChanges) {\n //console.log('ng one changes')\n this.update();\n }\n\n\n update() {\n try {\n if (this.html === undefined || this.html === null || this.html.trim() === '') {\n // this.container.clear();\n this.dynamicComponent = undefined;\n this.dynamicModule = undefined;\n return;\n }\n\n /*\n\n // looks like Angular already is caching\n\n //console.log('html', this.html)\n const cacheKey = this.html;\n //console.log(Object.keys(cache).indexOf(cacheKey), cache)\n if (cache.hasOwnProperty(cacheKey)) {\n const currentCache = cache[cacheKey];\n this.dynamicComponent = currentCache.dynamicComponent\n this.dynamicModule = currentCache.dynamicModule\n return ;\n }\n */\n this.dynamicComponent = this.createNewComponent(this.html, this.context);\n this.dynamicModule = this.compiler.compileModuleSync(this.createComponentModule(this.dynamicComponent));\n\n /*\n cache[cacheKey] = {\n dynamicComponent: this.dynamicComponent,\n dynamicModule: this.dynamicModule,\n };\n */\n } catch (e) {\n if (this.errorHandler === undefined) {\n throw e;\n } else {\n this.errorHandler(e);\n }\n }\n /*\n // now we use it with ngComponentOutlet, since about angular 5\n await this.service.compile({\n template: this.html,\n container: this.container,\n context: this.context,\n imports: this.imports,\n module: this.module\n })\n */\n }\n\n private createComponentModule(componentType: any) {\n let module: NgModule = {};\n\n if (this.module !== undefined) {\n module = Object.assign({}, this.module);\n }\n /*\n else if (SingletonDefaultModule !== undefined && SingletonDefaultModule !== null) {\n module = cloneDeep(SingletonDefaultModule);\n }\n */\n module.imports = module.imports || [];\n module.imports.push(CommonModule);\n if (this.imports !== undefined) {\n module.imports = module.imports.concat(this.imports)\n }\n if (module.declarations === undefined) {\n module.declarations = [\n componentType\n ];\n } else {\n module.declarations.push(componentType);\n }\n module.entryComponents = [\n componentType\n ];\n\n @NgModule(module)\n class RuntimeComponentModule {\n }\n\n return RuntimeComponentModule;\n }\n\n\n private createNewComponent(html: string, context: any) {\n\n const selector: string = nextId()\n\n @Component({\n selector: selector,\n template: html\n })\n class DynamicComponent {\n context: any = context;\n }\n\n return DynamicComponent;\n }\n}\n","import {\n NgModule,\n //ModuleWithProviders,\n} from '@angular/core';\nimport {CompileAttribute} from \"./angular-compile.component\";\nimport {CommonModule} from '@angular/common';\n\n@NgModule({\n declarations: [\n CompileAttribute\n ],\n imports: [\n CommonModule\n ],\n exports: [\n CompileAttribute\n ]\n})\nexport class CompileModule { }\n","/*\n * Public API Surface of angular-compile\n */\n\nexport * from './lib/angular-compile.module';\nexport * from './lib/angular-compile.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAcA;AACA;AACA;AAEA;AAEA,SAAS,OAAO,CAAC,GAAW;IACxB,OAAO,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,MAAM;IACX,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,iBAAiB,GAAG,iBAAiB,CAAC,CAAC,GAAG,iBAAiB,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAA;AACjH,CAAC;AAED,IAAI,aAA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CAAC;SAC3C;QACD,MAAM,CAAC,eAAe,GAAG;YACrB,aAAa;SAChB,CAAC;QAEF,MACM,sBAAsB;;;oBAD3B,QAAQ,SAAC,MAAM;;QAIhB,OAAO,sBAAsB,CAAC;KACjC;IAGO,kBAAkB,CAAC,IAAY,EAAE,OAAY;QAEjD,MAAM,QAAQ,GAAW,MAAM,EAAE,CAAA;QAEjC,MAIM,gBAAgB;YAJtB;gBAKI,YAAO,GAAQ,OAAO,CAAC;aAC1B;;;oBANA,SAAS,SAAC;wBACP,QAAQ,EAAE,QAAQ;wBAClB,QAAQ,EAAE,IAAI;qBACjB;;QAKD,OAAO,gBAAgB,CAAC;KAC3B;;;YA3JJ,SAAS,SAAC;gBACP,QAAQ,EAAE,eAAe;gBACzB,QAAQ,EAAE;;;;KAIT;aACJ;YACA,UAAU;;;YAzDP,QAAQ;;;mBA6DP,KAAK,SAAC,aAAa;sBAGnB,KAAK,SAAC,iBAAiB;2BAGvB,KAAK,SAAC,2BAA2B;qBAMjC,KAAK,SAAC,oBAAoB;sBAG1B,KAAK,SAAC,qBAAqB;;;MC3DnB,aAAa;;;YAXzB,QAAQ,SAAC;gBACR,YAAY,EAAE;oBACV,gBAAgB;iBACnB;gBACD,OAAO,EAAE;oBACL,YAAY;iBACf;gBACD,OAAO,EAAE;oBACL,gBAAgB;iBACnB;aACF;;;ACjBD;;;;ACAA;;;;;;"}
@@ -1,17 +0,0 @@
1
- import { Compiler, ModuleWithProviders, NgModule, NgModuleFactory, OnChanges, SimpleChanges, Type } from '@angular/core';
2
- export declare class CompileAttribute implements OnChanges {
3
- private compiler;
4
- html: string;
5
- context: any;
6
- errorHandler: Function;
7
- dynamicComponent: any;
8
- dynamicModule: NgModuleFactory<any> | any;
9
- module: NgModule;
10
- imports: Array<Type<any> | ModuleWithProviders<any> | any[]>;
11
- constructor(compiler: Compiler);
12
- get renderComponent(): boolean;
13
- ngOnChanges(changes: SimpleChanges): void;
14
- update(): void;
15
- private createComponentModule;
16
- private createNewComponent;
17
- }
@@ -1,2 +0,0 @@
1
- export declare class CompileModule {
2
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './public-api';
@@ -1 +0,0 @@
1
- {"__symbolic":"module","version":4,"metadata":{"CompileModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"CompileAttribute"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":12,"character":6}],"exports":[{"__symbolic":"reference","name":"CompileAttribute"}]}]}],"members":{}},"CompileAttribute":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":50,"character":1},"arguments":[{"selector":"[p3x-compile]","template":"\n <ng-container *ngIf=\"renderComponent\">\n <ng-container *ngComponentOutlet=\"dynamicComponent; ngModuleFactory: dynamicModule;\"></ng-container>\n </ng-container>\n "}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":58,"character":1}}],"members":{"html":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":62,"character":5},"arguments":["p3x-compile"]}]}],"context":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":65,"character":5},"arguments":["p3x-compile-ctx"]}]}],"errorHandler":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":68,"character":5},"arguments":["p3x-compile-error-handler"]}]}],"module":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":74,"character":5},"arguments":["p3x-compile-module"]}]}],"imports":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":77,"character":5},"arguments":["p3x-compile-imports"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Compiler","line":83,"character":26}]}],"ngOnChanges":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"createComponentModule":[{"__symbolic":"method"}],"createNewComponent":[{"__symbolic":"method"}]}}},"origins":{"CompileModule":"./lib/angular-compile.module","CompileAttribute":"./lib/angular-compile.component"},"importAs":"p3x-angular-compile"}