@smartsoft001/angular 1.1.653 → 1.1.657
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/bundles/smartsoft001-angular.umd.js +311 -194
- package/bundles/smartsoft001-angular.umd.js.map +1 -1
- package/esm2015/lib/components/base/base.component.js +58 -1
- package/esm2015/lib/components/base/base.component.js.map +1 -1
- package/esm2015/lib/components/base/base.component.metadata.json +1 -1
- package/esm2015/lib/components/button/base/base.component.js +36 -0
- package/esm2015/lib/components/button/base/base.component.js.map +1 -0
- package/esm2015/lib/components/button/base/base.component.metadata.json +1 -0
- package/esm2015/lib/components/button/button.component.js +23 -33
- package/esm2015/lib/components/button/button.component.js.map +1 -1
- package/esm2015/lib/components/button/button.component.metadata.json +1 -1
- package/esm2015/lib/components/button/index.js +2 -0
- package/esm2015/lib/components/button/index.js.map +1 -1
- package/esm2015/lib/components/button/index.metadata.json +1 -1
- package/esm2015/lib/components/button/standard/standard.component.js +15 -0
- package/esm2015/lib/components/button/standard/standard.component.js.map +1 -0
- package/esm2015/lib/components/button/standard/standard.component.metadata.json +1 -0
- package/esm2015/lib/components/button/standard/standard.component.ngfactory.js.map +1 -0
- package/esm2015/lib/components/button/standard/standard.component.scss.ngstyle.js.map +1 -0
- package/esm2015/lib/components/components.module.js +2 -1
- package/esm2015/lib/components/components.module.js.map +1 -1
- package/esm2015/lib/components/components.module.metadata.json +1 -1
- package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
- package/esm2015/lib/components/details/base/base.component.js +2 -0
- package/esm2015/lib/components/details/base/base.component.js.map +1 -1
- package/esm2015/lib/components/details/base/base.component.metadata.json +1 -1
- package/esm2015/lib/components/details/details.component.js +13 -6
- package/esm2015/lib/components/details/details.component.js.map +1 -1
- package/esm2015/lib/components/details/details.component.metadata.json +1 -1
- package/esm2015/lib/components/details/index.js +1 -0
- package/esm2015/lib/components/details/index.js.map +1 -1
- package/esm2015/lib/components/details/index.metadata.json +1 -1
- package/esm2015/lib/components/form/base/base.component.js +3 -2
- package/esm2015/lib/components/form/base/base.component.js.map +1 -1
- package/esm2015/lib/components/form/base/base.component.metadata.json +1 -1
- package/esm2015/lib/components/form/form.component.js +25 -28
- package/esm2015/lib/components/form/form.component.js.map +1 -1
- package/esm2015/lib/components/form/form.component.metadata.json +1 -1
- package/esm2015/lib/components/page/page.component.js +8 -18
- package/esm2015/lib/components/page/page.component.js.map +1 -1
- package/esm2015/lib/components/page/page.component.metadata.json +1 -1
- package/esm2015/lib/models/interfaces.js.map +1 -1
- package/esm2015/lib/ngrx-shared.module.ngfactory.js.map +1 -1
- package/esm2015/lib/pages/pages.module.ngfactory.js.map +1 -1
- package/esm2015/lib/services/dynamic-component-storage/dynamic-component-storage.service.js +8 -3
- package/esm2015/lib/services/dynamic-component-storage/dynamic-component-storage.service.js.map +1 -1
- package/esm2015/smartsoft001-angular.js +56 -54
- package/esm2015/smartsoft001-angular.js.map +1 -1
- package/esm2015/smartsoft001-angular.metadata.json +1 -1
- package/fesm2015/smartsoft001-angular.js +217 -123
- package/fesm2015/smartsoft001-angular.js.map +1 -1
- package/lib/components/base/base.component.d.ts +13 -3
- package/lib/components/button/base/base.component.d.ts +12 -0
- package/lib/components/button/button.component.d.ts +12 -10
- package/lib/components/button/index.d.ts +2 -0
- package/lib/components/button/standard/standard.component.d.ts +3 -0
- package/lib/components/components.module.d.ts +3 -2
- package/lib/components/details/base/base.component.d.ts +3 -1
- package/lib/components/details/details.component.d.ts +5 -1
- package/lib/components/details/index.d.ts +1 -0
- package/lib/components/form/base/base.component.d.ts +2 -1
- package/lib/components/form/form.component.d.ts +5 -1
- package/lib/components/page/page.component.d.ts +6 -6
- package/lib/models/interfaces.d.ts +1 -1
- package/package.json +5 -5
- package/smartsoft001-angular.d.ts +56 -54
- package/smartsoft001-angular.metadata.json +1 -1
- package/esm2015/lib/components/button/button.component.scss.ngstyle.js.map +0 -1
|
@@ -74,6 +74,7 @@ export class DetailsBaseComponent {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
DetailsBaseComponent.smartType = 'details';
|
|
77
78
|
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
78
79
|
DetailsBaseComponent.decorators = [
|
|
79
80
|
{ type: Directive }
|
|
@@ -90,6 +91,7 @@ DetailsBaseComponent.ctorParameters = () => [
|
|
|
90
91
|
];
|
|
91
92
|
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
92
93
|
DetailsBaseComponent.propDecorators = {
|
|
94
|
+
contentTpl: [{ type: ViewChild, args: ["contentTpl", { read: ViewContainerRef, static: true },] }],
|
|
93
95
|
topTpl: [{ type: ViewChild, args: ["topTpl", { read: ViewContainerRef, static: true },] }],
|
|
94
96
|
bottomTpl: [{ type: ViewChild, args: ["bottomTpl", { read: ViewContainerRef, static: true },] }],
|
|
95
97
|
options: [{ type: Input }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/shared/angular/src/lib/components/details/base/base.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,SAAS,GACV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EACL,yBAAyB,GAI1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG1E,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGlE,MAAM,OAAgB,oBAAoB;
|
|
1
|
+
{"version":3,"file":"base.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/shared/angular/src/lib/components/details/base/base.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,SAAS,GACV,MAAM,eAAe,CAAC;A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CAAC,yBAAyB,EAAE,CAAC;IACnC,CAAC;IAID,eAAe;QACb,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACnC,CAAC;IAES,yBAAyB;QACjC,IAAI,CAAC,IAAI,CAAC,kBAAkB;YAAE,OAAO;QAErC,IAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE;YAC9C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBACvB,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;aAC1D;SACF;QAED,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE;YACpD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBAC1B,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;aAChE;SACF;IACH,CAAC;;AAxGM,8BAAS,GAAyB,SAAS,CAAC;;;YAHpD,SAAS;;;;;;;;;;YAFD,WAAW;;;;yBAwBjB,SAAS,SAAC,YAAY,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE;qBAGhE,SAAS,SAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE;wBAG5D,SAAS,SAAC,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE;sBAG/D,KAAK","sourcesContent":["import {\n AfterViewInit,\n Input,\n ViewChild,\n ViewContainerRef,\n Directive,\n} from \"@angular/core\";\nimport { Observable } from \"rxjs\";\nimport { map } from \"rxjs/operators\";\n\nimport {\n getModelFieldsWithOptions,\n IFieldDetailsMetadata,\n IFieldOptions,\n ISpecification,\n} from \"@smartsoft001/models\";\nimport { IEntity } from \"@smartsoft001/domain-core\";\nimport { ObjectService, SpecificationService } from \"@smartsoft001/utils\";\n\nimport {DynamicComponentType, ICellPipe, IDetailsComponentFactories, IDetailsOptions} from \"../../../models\";\nimport { AuthService } from \"../../../services/auth/auth.service\";\n\n@Directive()\nexport abstract class DetailsBaseComponent<T extends IEntity<string>>\n implements AfterViewInit {\n static smartType: DynamicComponentType = 'details';\n\n private _fields: Array<{ key: string; options: IFieldOptions }>;\n private _type: any;\n\n componentFactories: IDetailsComponentFactories<T>;\n cellPipe: ICellPipe<T>;\n\n get fields(): Array<{ key: string; options: IFieldOptions }> {\n return this._fields;\n }\n\n get type(): any {\n return this._type;\n }\n\n item$: Observable<T>;\n loading$: Observable<boolean>;\n\n @ViewChild(\"contentTpl\", { read: ViewContainerRef, static: true })\n contentTpl: ViewContainerRef;\n\n @ViewChild(\"topTpl\", { read: ViewContainerRef, static: true })\n topTpl: ViewContainerRef;\n\n @ViewChild(\"bottomTpl\", { read: ViewContainerRef, static: true })\n bottomTpl: ViewContainerRef;\n\n @Input() set options(obj: IDetailsOptions<T>) {\n this._type = obj.type;\n\n const enabledDefinitions: Array<{ key: string; spec: ISpecification }> = [];\n\n this._fields = getModelFieldsWithOptions(new this._type())\n .filter((f) => f.options.details)\n .filter((field) => {\n if ((field.options.details as IFieldDetailsMetadata).enabled) {\n enabledDefinitions.push({\n key: field.key,\n spec: (field.options.details as IFieldDetailsMetadata).enabled,\n });\n } else if (field.options.enabled) {\n enabledDefinitions.push({\n key: field.key,\n spec: field.options.enabled,\n });\n }\n\n if (\n (field.options.details as IFieldDetailsMetadata).permissions &&\n !this.authService.expectPermissions(\n (field.options.details as IFieldDetailsMetadata).permissions\n )\n ) {\n return false;\n }\n\n return true;\n });\n this.item$ = obj.item$.pipe(\n map((item) => {\n if (!item) return item;\n\n let result = null;\n\n if (item instanceof obj.type) result = item;\n else result = ObjectService.createByType(item, obj.type);\n\n const removeFields = enabledDefinitions.filter((def) => {\n return SpecificationService.invalid(result, def.spec);\n }).map(def => def.key);\n\n this._fields = this._fields.filter(f => !removeFields.some(rf => rf === f.key));\n\n return result;\n })\n );\n this.loading$ = obj.loading$;\n this.componentFactories = obj.componentFactories;\n this.cellPipe = obj.cellPipe;\n\n this.generateDynamicComponents();\n }\n\n constructor(private authService: AuthService) {}\n\n ngAfterViewInit(): void {\n this.generateDynamicComponents();\n }\n\n protected generateDynamicComponents(): void {\n if (!this.componentFactories) return;\n\n if (this.componentFactories.top && this.topTpl) {\n if (!this.topTpl.get(0)) {\n this.topTpl.createComponent(this.componentFactories.top);\n }\n }\n\n if (this.componentFactories.bottom && this.bottomTpl) {\n if (!this.bottomTpl.get(0)) {\n this.bottomTpl.createComponent(this.componentFactories.bottom);\n }\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"DetailsBaseComponent":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":22,"character":1}}],"members":{"topTpl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"DetailsBaseComponent":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":22,"character":1}}],"members":{"contentTpl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":44,"character":3},"arguments":["contentTpl",{"read":{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":44,"character":35},"static":true}]}]}],"topTpl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":47,"character":3},"arguments":["topTpl",{"read":{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":47,"character":31},"static":true}]}]}],"bottomTpl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":50,"character":3},"arguments":["bottomTpl",{"read":{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":50,"character":34},"static":true}]}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":53,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../../../services/auth/auth.service","name":"AuthService","line":109,"character":35}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"generateDynamicComponents":[{"__symbolic":"method"}]},"statics":{"smartType":"details"}}}}]
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { ChangeDetectionStrategy, Component, Input, } from "@angular/core";
|
|
2
2
|
import { Subscription } from "rxjs";
|
|
3
|
-
|
|
3
|
+
import { CreateDynamicComponent } from "../base";
|
|
4
|
+
export class DetailsComponent extends CreateDynamicComponent("details") {
|
|
4
5
|
constructor() {
|
|
6
|
+
super(...arguments);
|
|
5
7
|
this._subscription = new Subscription();
|
|
6
8
|
}
|
|
7
9
|
set options(val) {
|
|
8
10
|
this._options = val;
|
|
9
|
-
this._subscription.add(this._options.item$.subscribe(item => {
|
|
11
|
+
this._subscription.add(this._options.item$.subscribe((item) => {
|
|
10
12
|
this.item = item;
|
|
11
13
|
}));
|
|
14
|
+
this.refreshDynamicInstance();
|
|
12
15
|
}
|
|
13
16
|
get options() {
|
|
14
17
|
return this._options;
|
|
@@ -18,16 +21,20 @@ export class DetailsComponent {
|
|
|
18
21
|
this._subscription.unsubscribe();
|
|
19
22
|
}
|
|
20
23
|
}
|
|
24
|
+
refreshProperties() {
|
|
25
|
+
this.baseInstance.options = this.options;
|
|
26
|
+
}
|
|
21
27
|
}
|
|
22
28
|
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
23
29
|
DetailsComponent.decorators = [
|
|
24
30
|
{ type: Component, args: [{
|
|
25
31
|
selector: "smart-details",
|
|
26
32
|
template: `
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
<smart-details-standard
|
|
34
|
+
*ngIf="options && template === 'default'"
|
|
35
|
+
[options]="options"
|
|
36
|
+
></smart-details-standard>
|
|
37
|
+
<div #customTpl></div>
|
|
31
38
|
`,
|
|
32
39
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
33
40
|
},] }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"details.component.js","sourceRoot":"","sources":["../../../../../../../../libs/shared/angular/src/lib/components/details/details.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,KAAK,
|
|
1
|
+
{"version":3,"file":"details.component.js","sourceRoot":"","sources":["../../../../../../../../libs/shared/angular/src/lib/components/details/details.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,KAAK,GAEN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAIpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAcjD,MAAM,OAAO,gBACX,SAAQ,sBAAsB,CAA4B,SAAS,CAAC;IAZtE;;QAgBU,kBAAa,GAAG,IAAI,YAAY,EAAE,CAAC;IA4B7C,CAAC;IAxBC,IAAa,OAAO,CAAC,GAAuB;QAC1C,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;QAEpB,IAAI,CAAC,aAAa,CAAC,GAAG,CACpB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;YACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC,CACH,CAAC;QAEF,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAChC,CAAC;IACD,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,WAAW;QACT,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;SAClC;IACH,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC3C,CAAC;;;;YA3CF,SAAS,SAAC;gBACT,QAAQ,EAAE,eAAe;gBACzB,QAAQ,EAAE;;;;;;GAMT;gBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;aAChD;;;;sBAUE,KAAK","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n Input,\n OnDestroy,\n} from \"@angular/core\";\nimport { Subscription } from \"rxjs\";\n\nimport { IDetailsOptions } from \"../../models\";\nimport { IEntity } from \"@smartsoft001/domain-core\";\nimport { CreateDynamicComponent } from \"../base\";\nimport { DetailsBaseComponent } from \"./base/base.component\";\n\n@Component({\n selector: \"smart-details\",\n template: `\n <smart-details-standard\n *ngIf=\"options && template === 'default'\"\n [options]=\"options\"\n ></smart-details-standard>\n <div #customTpl></div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DetailsComponent<T extends IEntity<string>>\n extends CreateDynamicComponent<DetailsBaseComponent<any>>(\"details\")\n implements OnDestroy\n{\n private _options: IDetailsOptions<T>;\n private _subscription = new Subscription();\n\n item: T;\n\n @Input() set options(val: IDetailsOptions<T>) {\n this._options = val;\n\n this._subscription.add(\n this._options.item$.subscribe((item) => {\n this.item = item;\n })\n );\n\n this.refreshDynamicInstance();\n }\n get options(): IDetailsOptions<T> {\n return this._options;\n }\n\n ngOnDestroy(): void {\n if (this._subscription) {\n this._subscription.unsubscribe();\n }\n }\n\n refreshProperties(): void {\n this.baseInstance.options = this.options;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"DetailsComponent":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"DetailsComponent":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":25,"character":10},"arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":13,"character":1},"arguments":[{"selector":"smart-details","template":"\n <smart-details-standard\n *ngIf=\"options && template === 'default'\"\n [options]=\"options\"\n ></smart-details-standard>\n <div #customTpl></div>\n ","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":22,"character":19},"member":"OnPush"}}]}],"members":{"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"ngOnDestroy":[{"__symbolic":"method"}],"refreshProperties":[{"__symbolic":"method"}]}}}}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/shared/angular/src/lib/components/details/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './standard/standard.component';\nexport * from './details.component';\n\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/shared/angular/src/lib/components/details/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC","sourcesContent":["export * from './standard/standard.component';\nexport * from './details.component';\nexport * from './base/base.component';\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./standard/standard.component"},{"from":"./details.component"}]}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./standard/standard.component"},{"from":"./details.component"},{"from":"./base/base.component"}]}]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventEmitter, Input, Output, Directive, ChangeDetectorRef } from '@angular/core';
|
|
1
|
+
import { EventEmitter, Input, Output, Directive, ChangeDetectorRef, ViewChild, ViewContainerRef } from '@angular/core';
|
|
2
2
|
import { FormGroup } from "@angular/forms";
|
|
3
3
|
import { Subscription } from "rxjs";
|
|
4
4
|
import { delay } from "rxjs/operators";
|
|
@@ -69,6 +69,7 @@ FormBaseComponent.ctorParameters = () => [
|
|
|
69
69
|
FormBaseComponent.propDecorators = {
|
|
70
70
|
form: [{ type: Input }],
|
|
71
71
|
options: [{ type: Input }],
|
|
72
|
-
invokeSubmit: [{ type: Output }]
|
|
72
|
+
invokeSubmit: [{ type: Output }],
|
|
73
|
+
contentTpl: [{ type: ViewChild, args: ["contentTpl", { read: ViewContainerRef, static: true },] }]
|
|
73
74
|
};
|
|
74
75
|
//# sourceMappingURL=base.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/shared/angular/src/lib/components/form/base/base.component.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"base.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/shared/angular/src/lib/components/form/base/base.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,EACL,MAAM,EACN,SAAS,EAET,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAa,YAAY,EAAC,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAGxD,MAAM,OAAgB,iBAAqB,SAAQ,aAAa;IAuE9D,YAAsB,EAAqB;QACzC,KAAK,E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C,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;QACjE,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;QAEvE,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;QAE/B,IAAI,CAAC,eAAe,EAAE,CAAC;IAC3B,CAAC;IAWD,MAAM;QACJ,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IAES,eAAe,KAAW,CAAC;IAE3B,YAAY,KAAW,CAAC;;AAhF3B,2BAAS,GAAyB,MAAM,CAAC;;;YAFjD,SAAS;;;;;;;;;;YAZR,iBAAiB;;;;mBA8ChB,KAAK;sBAsBL,KAAK;2BAWL,MAAM;yBAEN,SAAS,SAAC,YAAY,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE","sourcesContent":["import {\n EventEmitter,\n Input,\n Output,\n Directive,\n Type,\n ChangeDetectorRef,\n ViewChild,\n ViewContainerRef\n} from '@angular/core';\nimport {FormGroup} from \"@angular/forms\";\nimport {Observable, Subscription} from \"rxjs\";\nimport {delay} from \"rxjs/operators\";\n\nimport {DynamicComponentType, IFormOptions} from \"../../../models\";\nimport {InputBaseComponent} from \"../../input/base/base.component\";\nimport {BaseComponent} from \"../../base/base.component\";\n\n@Directive()\nexport abstract class FormBaseComponent<T> extends BaseComponent {\n static smartType: DynamicComponentType = \"form\";\n\n private _fields: Array<string>;\n private _subscription: Subscription;\n private _model: any;\n private _form: FormGroup;\n private _possibilities: {\n [key: string]: Observable<{ id: any, text: string }[]>;\n };\n private _inputComponents: { [key: string]: Type<InputBaseComponent<T>>; };\n\n mode: string;\n treeLevel: number;\n\n get fields(): Array<string> {\n return this._fields;\n }\n\n get model(): any {\n return this._model;\n }\n\n get possibilities(): {\n [key: string]: Observable<{ id: any, text: string }[]>;\n } {\n return this._possibilities;\n }\n\n get inputComponents(): { [key: string]: Type<InputBaseComponent<T>>; } {\n return this._inputComponents;\n }\n\n @Input() set form(val: FormGroup) {\n if (this._subscription) {\n this._subscription.unsubscribe();\n }\n\n this._subscription = new Subscription();\n\n this._form = val;\n this._fields = Object.keys(this._form.controls);\n\n this._subscription.add(this._form.valueChanges.pipe(\n delay(0)\n ).subscribe(() => {\n this.cd.detectChanges();\n }));\n\n this.afterSetForm();\n }\n get form(): FormGroup {\n return this._form;\n }\n\n @Input() set options(obj: IFormOptions<T>) {\n this._model = obj.model;\n this.mode = obj.mode;\n this._possibilities = obj.possibilities ? obj.possibilities : {};\n this._inputComponents = obj.inputComponents ? obj.inputComponents : {};\n\n this.treeLevel = obj.treeLevel;\n\n this.afterSetOptions();\n }\n\n @Output() invokeSubmit = new EventEmitter();\n\n @ViewChild(\"contentTpl\", { read: ViewContainerRef, static: true })\n contentTpl: ViewContainerRef;\n\n constructor(protected cd: ChangeDetectorRef) {\n super();\n }\n\n submit(): void {\n this.invokeSubmit.emit(this.form.value);\n }\n\n protected afterSetOptions(): void { }\n\n protected afterSetForm(): void { }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"FormBaseComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../base/base.component","name":"BaseComponent","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"FormBaseComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../base/base.component","name":"BaseComponent","line":19,"character":51},"arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":18,"character":1}}],"members":{"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":52,"character":3}}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":74,"character":3}}]}],"invokeSubmit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":85,"character":3}}]}],"contentTpl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":87,"character":3},"arguments":["contentTpl",{"read":{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":87,"character":35},"static":true}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":90,"character":28}]}],"submit":[{"__symbolic":"method"}],"afterSetOptions":[{"__symbolic":"method"}],"afterSetForm":[{"__symbolic":"method"}]},"statics":{"smartType":"form"}}}}]
|
|
@@ -7,9 +7,10 @@ import { ObjectService } from "@smartsoft001/utils";
|
|
|
7
7
|
import { FormFactory } from "../../factories/form/form.factory";
|
|
8
8
|
import { IModelExportProvider, MODEL_EXPORT_PROVIDER } from "../../providers/model-export.provider";
|
|
9
9
|
import { IModelImportProvider, MODEL_IMPORT_PROVIDER } from "../../providers/model-import.provider";
|
|
10
|
-
import {
|
|
11
|
-
export class FormComponent {
|
|
10
|
+
import { CreateDynamicComponent } from "../base";
|
|
11
|
+
export class FormComponent extends CreateDynamicComponent("form") {
|
|
12
12
|
constructor(formFactory, cd, elementRef, exportProvider, importProvider, moduleRef, componentFactoryResolver) {
|
|
13
|
+
super(cd, moduleRef, componentFactoryResolver);
|
|
13
14
|
this.formFactory = formFactory;
|
|
14
15
|
this.cd = cd;
|
|
15
16
|
this.elementRef = elementRef;
|
|
@@ -51,6 +52,9 @@ export class FormComponent {
|
|
|
51
52
|
this.cd.detectChanges();
|
|
52
53
|
});
|
|
53
54
|
}
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
this.refreshDynamicInstance();
|
|
57
|
+
});
|
|
54
58
|
}
|
|
55
59
|
get options() {
|
|
56
60
|
return this._options;
|
|
@@ -71,6 +75,11 @@ export class FormComponent {
|
|
|
71
75
|
});
|
|
72
76
|
});
|
|
73
77
|
}
|
|
78
|
+
refreshProperties() {
|
|
79
|
+
this.baseInstance.options = this.options;
|
|
80
|
+
this.baseInstance.form = this.form;
|
|
81
|
+
this._subscription.add(this.baseInstance.invokeSubmit.subscribe(e => this.invokeSubmit.emit(e)));
|
|
82
|
+
}
|
|
74
83
|
ngOnDestroy() {
|
|
75
84
|
if (this._subscription) {
|
|
76
85
|
this._subscription.unsubscribe();
|
|
@@ -106,20 +115,6 @@ export class FormComponent {
|
|
|
106
115
|
}
|
|
107
116
|
initType() {
|
|
108
117
|
const fieldWithOptions = getModelFieldsWithOptions(this._options.model);
|
|
109
|
-
const component = DynamicComponentStorageService.get("form", this.moduleRef)[0];
|
|
110
|
-
if (component) {
|
|
111
|
-
setTimeout(() => {
|
|
112
|
-
const factory = this.componentFactoryResolver.resolveComponentFactory(component);
|
|
113
|
-
if (!this.customTpl.get(0)) {
|
|
114
|
-
const instance = this.customTpl.createComponent(factory).instance;
|
|
115
|
-
instance.options = this.options;
|
|
116
|
-
instance.form = this.form;
|
|
117
|
-
this._subscription.add(instance.invokeSubmit.subscribe(e => this.invokeSubmit.emit(e)));
|
|
118
|
-
this.cd.detectChanges();
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
118
|
if (fieldWithOptions.some(fwo => fwo.options.step)) {
|
|
124
119
|
this.type = "stepper";
|
|
125
120
|
return;
|
|
@@ -167,19 +162,21 @@ FormComponent.decorators = [
|
|
|
167
162
|
></smart-import>
|
|
168
163
|
</div>
|
|
169
164
|
<form *ngIf="form" [formGroup]="form" (ngSubmit)="invokeSubmit.emit(form.value)" (keyup.enter)="invokeSubmit.emit(form.value)">
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
165
|
+
<ng-container *ngIf="template === 'default'">
|
|
166
|
+
<smart-form-standard
|
|
167
|
+
*ngIf="options && type === 'standard'"
|
|
168
|
+
[options]="options"
|
|
169
|
+
[form]="form"
|
|
170
|
+
(invokeSubmit)="invokeSubmit.emit($event)"
|
|
171
|
+
></smart-form-standard>
|
|
176
172
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
173
|
+
<smart-form-stepper
|
|
174
|
+
*ngIf="options && type === 'stepper'"
|
|
175
|
+
[options]="options"
|
|
176
|
+
[form]="form"
|
|
177
|
+
(invokeSubmit)="invokeSubmit.emit($event)"
|
|
178
|
+
></smart-form-stepper>
|
|
179
|
+
</ng-container>
|
|
183
180
|
|
|
184
181
|
<div #customTpl></div>
|
|
185
182
|
</form>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.component.js","sourceRoot":"","sources":["../../../../../../../../libs/shared/angular/src/lib/components/form/form.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,uBAAuB,EAAE,iBAAiB,EAC1C,SAAS,EAAE,wBAAwB,EAAE,UAAU,EAC/C,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,WAAW,EAAa,QAAQ,EACvC,MAAM,EACA,SAAS,EAAE,gBAAgB,GAClC,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,yBAAyB,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAC,WAAW,EAAC,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAC,oBAAoB,EAAE,qBAAqB,EAAC,MAAM,uCAAuC,CAAC;AAClG,OAAO,EAAC,oBAAoB,EAAE,qBAAqB,EAAC,MAAM,uCAAuC,CAAC;AAElG,OAAO,EAAC,8BAA8B,EAAC,MAAM,4EAA4E,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;GA4BT;gBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;aAChD;;;;;;;;;;YAvCO,WAAW;YAfQ,iBAAiB;YACL,UAAU;YAezC,oBAAoB,uBAqGrB,QAAQ,YACR,MAAM,SAAC,qBAAqB;YArG3B,oBAAoB,uBAsGrB,QAAQ,YACR,MAAM,SAAC,qBAAqB;YArH1B,WAAW;YAFP,wBAAwB;;;;wBAmElC,SAAS,SAAC,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE;sBAGhE,KAAK;2BAqCL,MAAM;0BACN,MAAM;iCACN,MAAM;0BACN,MAAM","sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy, ChangeDetectorRef,\n Component, ComponentFactoryResolver, ElementRef,\n EventEmitter, Inject,\n Input, NgModuleRef, OnDestroy, Optional,\n Output,\n Type, ViewChild, ViewContainerRef,\n} from \"@angular/core\";\nimport { FormGroup } from \"@angular/forms\";\nimport {Subscription} from \"rxjs\";\nimport {filter} from \"rxjs/operators\";\n\nimport {getModelFieldsWithOptions, getModelOptions} from \"@smartsoft001/models\";\nimport {ObjectService} from \"@smartsoft001/utils\";\n\nimport { IFormOptions } from \"../../models/interfaces\";\nimport {FormFactory} from \"../../factories/form/form.factory\";\nimport {IModelExportProvider, MODEL_EXPORT_PROVIDER} from \"../../providers/model-export.provider\";\nimport {IModelImportProvider, MODEL_IMPORT_PROVIDER} from \"../../providers/model-import.provider\";\nimport {SmartFormGroup} from \"../../services/form/form.group\";\nimport {DynamicComponentStorageService} from \"../../services/dynamic-component-storage/dynamic-component-storage.service\";\nimport {FormBaseComponent} from \"./base/base.component\";\n\n@Component({\n selector: \"smart-form\",\n template: `\n <div *ngIf=\"export || import\" style=\"text-align: right\">\n <smart-export *ngIf=\"export\"\n [value]=\"options?.control?.value\"\n [handler]=\"exportHandler\"\n ></smart-export>\n <smart-import *ngIf=\"import\"\n (set)=\"onSetValue($event)\"\n [accept]=\"importAccept\"\n ></smart-import>\n </div>\n <form *ngIf=\"form\" [formGroup]=\"form\" (ngSubmit)=\"invokeSubmit.emit(form.value)\" (keyup.enter)=\"invokeSubmit.emit(form.value)\">\n <smart-form-standard\n *ngIf=\"options && type === 'standard'\"\n [options]=\"options\"\n [form]=\"form\"\n (invokeSubmit)=\"invokeSubmit.emit($event)\"\n ></smart-form-standard>\n\n <smart-form-stepper\n *ngIf=\"options && type === 'stepper'\"\n [options]=\"options\"\n [form]=\"form\"\n (invokeSubmit)=\"invokeSubmit.emit($event)\"\n ></smart-form-stepper>\n \n <div #customTpl></div>\n </form>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FormComponent<T> implements OnDestroy {\n private _options: IFormOptions<T>;\n private _subscription = new Subscription();\n private _mode: \"create\" | \"update\" | string;\n private _uniqueProvider: (values: Record<keyof T, any>) => Promise<boolean>;\n\n form: SmartFormGroup;\n type: \"standard\" | \"stepper\" | \"custom\";\n export: boolean;\n exportHandler: (val) => void;\n import: boolean;\n importAccept: string;\n\n @ViewChild(\"customTpl\", { read: ViewContainerRef, static: false })\n customTpl: ViewContainerRef;\n\n @Input() set options(val: IFormOptions<T>) {\n if (!val) return;\n\n if (!val.treeLevel) val.treeLevel = 1;\n (this.elementRef.nativeElement as HTMLElement).setAttribute('tree-level', val.treeLevel.toString());\n\n this._options = val;\n\n this.initLoading();\n this.initType();\n\n this.initExportImport();\n\n this._mode = val.mode;\n this._uniqueProvider = val.uniqueProvider;\n\n if (val.control) {\n this.form = val.control as SmartFormGroup;\n this.registerChanges();\n this.cd.detectChanges();\n } else {\n this.formFactory.create(this._options.model, {\n mode: this._mode,\n uniqueProvider: this._uniqueProvider\n })\n .then(res => {\n this.form = res;\n this.registerChanges();\n this.cd.detectChanges();\n });\n }\n }\n\n get options(): IFormOptions<T> {\n return this._options;\n }\n\n @Output() invokeSubmit = new EventEmitter();\n @Output() valueChange = new EventEmitter<T>();\n @Output() valuePartialChange = new EventEmitter<Partial<T>>();\n @Output() validChange = new EventEmitter<boolean>();\n\n constructor(\n private formFactory: FormFactory,\n private cd: ChangeDetectorRef,\n private elementRef: ElementRef,\n @Optional()\n @Inject(MODEL_EXPORT_PROVIDER) public exportProvider: IModelExportProvider,\n @Optional()\n @Inject(MODEL_IMPORT_PROVIDER) public importProvider: IModelImportProvider,\n private moduleRef: NgModuleRef<any>,\n private componentFactoryResolver: ComponentFactoryResolver\n ) {\n\n }\n\n async onSetValue(file: File): Promise<void> {\n let result;\n\n result = await this.importProvider.convert(this._options.model.constructor as Type<any>, file);\n\n this._options.model = ObjectService.createByType(result, this.options.model.constructor);\n\n this.formFactory.create(this._options.model, {\n mode: this._mode,\n uniqueProvider: this._uniqueProvider\n })\n .then(res => {\n this.form.setForm(res);\n this.registerChanges();\n this.cd.detectChanges();\n });\n }\n\n ngOnDestroy(): void {\n if (this._subscription){\n this._subscription.unsubscribe();\n }\n }\n\n private initLoading(): void {\n if (this._options.loading$) {\n this._subscription.add(this._options.loading$\n .pipe(filter(() => !!this.form))\n .subscribe(val => {\n if (val) {\n this.form.disable();\n } else {\n this.form.enable();\n }\n }));\n }\n }\n\n private registerChanges(): void {\n this._subscription.add(this.form.valueChanges.subscribe(() => {\n this.validChange.emit(this.form.valid);\n this.valueChange.emit(this.form.value);\n\n const partialModel = {} as Partial<T>;\n Object.keys(this.form.controls)\n .filter(key => !key.endsWith('Confirm') && this.form.controls[key].dirty)\n .forEach(key => {\n partialModel[key] = this.form.controls[key].value;\n });\n\n this.valuePartialChange.emit(partialModel);\n }));\n\n this.form.updateValueAndValidity();\n }\n\n private initType() {\n const fieldWithOptions = getModelFieldsWithOptions(this._options.model);\n\n const component = DynamicComponentStorageService.get(\"form\", this.moduleRef)[0];\n\n if (component) {\n setTimeout(() => {\n const factory = this.componentFactoryResolver.resolveComponentFactory(component);\n if (!this.customTpl.get(0)) {\n const instance: FormBaseComponent<any> = this.customTpl.createComponent(factory).instance;\n instance.options = this.options;\n instance.form = this.form;\n this._subscription.add(instance.invokeSubmit.subscribe(e => this.invokeSubmit.emit(e)));\n\n this.cd.detectChanges();\n }\n });\n\n return;\n }\n\n if (fieldWithOptions.some(fwo => fwo.options.step)) {\n this.type = \"stepper\";\n return;\n }\n\n this.type = 'standard';\n }\n\n private async initExportImport() {\n const modelOptions = getModelOptions(this._options.model.constructor);\n if (modelOptions.export && !this.exportProvider) {\n console.error(\"exportProvider is not provided\");\n }\n\n if (modelOptions.import && !this.importProvider) {\n console.error(\"importProvider is not provided\");\n }\n\n this.export = modelOptions.export && !!this.exportProvider;\n this.import = modelOptions.import && !!this.importProvider;\n\n if (this.import) {\n this.importAccept = await this.importProvider.getAccept(this._options.model.constructor as Type<any>);\n if (this.importProvider) this.cd.detectChanges();\n }\n\n if (this.export) {\n this.exportHandler = val => {\n this.exportProvider.execute(this._options.model.constructor as Type<any>, val);\n }\n }\n\n this.cd.detectChanges();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"form.component.js","sourceRoot":"","sources":["../../../../../../../../libs/shared/angular/src/lib/components/form/form.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,uBAAuB,EAAE,iBAAiB,EAC1C,SAAS,EAAE,wBAAwB,EAAE,UAAU,EAC/C,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,WAAW,EAAa,QAAQ,EACvC,MAAM,EACA,SAAS,EAAE,gBAAgB,GAClC,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,yBAAyB,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAC,WAAW,EAAC,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAC,oBAAoB,EAAE,qBAAqB,EAAC,MAAM,uCAAuC,CAAC;AACl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,QAAQ,YACR,MAAM,SAAC,qBAAqB;YA7G3B,oBAAoB,uBA8GrB,QAAQ,YACR,MAAM,SAAC,qBAAqB;YA7H1B,WAAW;YAFP,wBAAwB;;;;wBAuElC,SAAS,SAAC,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE;sBAGhE,KAAK;2BAyCL,MAAM;0BACN,MAAM;iCACN,MAAM;0BACN,MAAM","sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy, ChangeDetectorRef,\n Component, ComponentFactoryResolver, ElementRef,\n EventEmitter, Inject,\n Input, NgModuleRef, OnDestroy, Optional,\n Output,\n Type, ViewChild, ViewContainerRef,\n} from \"@angular/core\";\nimport { FormGroup } from \"@angular/forms\";\nimport {Subscription} from \"rxjs\";\nimport {filter} from \"rxjs/operators\";\n\nimport {getModelFieldsWithOptions, getModelOptions} from \"@smartsoft001/models\";\nimport {ObjectService} from \"@smartsoft001/utils\";\n\nimport { IFormOptions } from \"../../models/interfaces\";\nimport {FormFactory} from \"../../factories/form/form.factory\";\nimport {IModelExportProvider, MODEL_EXPORT_PROVIDER} from \"../../providers/model-export.provider\";\nimport {IModelImportProvider, MODEL_IMPORT_PROVIDER} from \"../../providers/model-import.provider\";\nimport {SmartFormGroup} from \"../../services/form/form.group\";\nimport {DynamicComponentStorageService} from \"../../services/dynamic-component-storage/dynamic-component-storage.service\";\nimport {FormBaseComponent} from \"./base/base.component\";\nimport {CreateDynamicComponent} from \"../base\";\nimport {ButtonBaseComponent} from \"../button\";\n\n@Component({\n selector: \"smart-form\",\n template: `\n <div *ngIf=\"export || import\" style=\"text-align: right\">\n <smart-export *ngIf=\"export\"\n [value]=\"options?.control?.value\"\n [handler]=\"exportHandler\"\n ></smart-export>\n <smart-import *ngIf=\"import\"\n (set)=\"onSetValue($event)\"\n [accept]=\"importAccept\"\n ></smart-import>\n </div>\n <form *ngIf=\"form\" [formGroup]=\"form\" (ngSubmit)=\"invokeSubmit.emit(form.value)\" (keyup.enter)=\"invokeSubmit.emit(form.value)\">\n <ng-container *ngIf=\"template === 'default'\">\n <smart-form-standard\n *ngIf=\"options && type === 'standard'\"\n [options]=\"options\"\n [form]=\"form\"\n (invokeSubmit)=\"invokeSubmit.emit($event)\"\n ></smart-form-standard>\n\n <smart-form-stepper\n *ngIf=\"options && type === 'stepper'\"\n [options]=\"options\"\n [form]=\"form\"\n (invokeSubmit)=\"invokeSubmit.emit($event)\"\n ></smart-form-stepper>\n </ng-container>\n \n <div #customTpl></div>\n </form>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class FormComponent<T> extends CreateDynamicComponent<FormBaseComponent<any>>(\"form\") implements OnDestroy {\n private _options: IFormOptions<T>;\n private _subscription = new Subscription();\n private _mode: \"create\" | \"update\" | string;\n private _uniqueProvider: (values: Record<keyof T, any>) => Promise<boolean>;\n\n form: SmartFormGroup;\n type: \"standard\" | \"stepper\" | \"custom\";\n export: boolean;\n exportHandler: (val) => void;\n import: boolean;\n importAccept: string;\n\n @ViewChild(\"customTpl\", { read: ViewContainerRef, static: false })\n customTpl: ViewContainerRef;\n\n @Input() set options(val: IFormOptions<T>) {\n if (!val) return;\n\n if (!val.treeLevel) val.treeLevel = 1;\n (this.elementRef.nativeElement as HTMLElement).setAttribute('tree-level', val.treeLevel.toString());\n\n this._options = val;\n\n this.initLoading();\n this.initType();\n\n this.initExportImport();\n\n this._mode = val.mode;\n this._uniqueProvider = val.uniqueProvider;\n\n if (val.control) {\n this.form = val.control as SmartFormGroup;\n this.registerChanges();\n this.cd.detectChanges();\n } else {\n this.formFactory.create(this._options.model, {\n mode: this._mode,\n uniqueProvider: this._uniqueProvider\n })\n .then(res => {\n this.form = res;\n this.registerChanges();\n this.cd.detectChanges();\n });\n }\n\n setTimeout(() => {\n this.refreshDynamicInstance();\n });\n }\n\n get options(): IFormOptions<T> {\n return this._options;\n }\n\n @Output() invokeSubmit = new EventEmitter();\n @Output() valueChange = new EventEmitter<T>();\n @Output() valuePartialChange = new EventEmitter<Partial<T>>();\n @Output() validChange = new EventEmitter<boolean>();\n\n constructor(\n private formFactory: FormFactory,\n private cd: ChangeDetectorRef,\n private elementRef: ElementRef,\n @Optional()\n @Inject(MODEL_EXPORT_PROVIDER) public exportProvider: IModelExportProvider,\n @Optional()\n @Inject(MODEL_IMPORT_PROVIDER) public importProvider: IModelImportProvider,\n private moduleRef: NgModuleRef<any>,\n private componentFactoryResolver: ComponentFactoryResolver\n ) {\n super(cd, moduleRef, componentFactoryResolver);\n }\n\n async onSetValue(file: File): Promise<void> {\n let result;\n\n result = await this.importProvider.convert(this._options.model.constructor as Type<any>, file);\n\n this._options.model = ObjectService.createByType(result, this.options.model.constructor);\n\n this.formFactory.create(this._options.model, {\n mode: this._mode,\n uniqueProvider: this._uniqueProvider\n })\n .then(res => {\n this.form.setForm(res);\n this.registerChanges();\n this.cd.detectChanges();\n });\n }\n\n refreshProperties(): void {\n this.baseInstance.options = this.options;\n this.baseInstance.form = this.form;\n this._subscription.add(this.baseInstance.invokeSubmit.subscribe(e => this.invokeSubmit.emit(e)));\n }\n\n ngOnDestroy(): void {\n if (this._subscription){\n this._subscription.unsubscribe();\n }\n }\n\n private initLoading(): void {\n if (this._options.loading$) {\n this._subscription.add(this._options.loading$\n .pipe(filter(() => !!this.form))\n .subscribe(val => {\n if (val) {\n this.form.disable();\n } else {\n this.form.enable();\n }\n }));\n }\n }\n\n private registerChanges(): void {\n this._subscription.add(this.form.valueChanges.subscribe(() => {\n this.validChange.emit(this.form.valid);\n this.valueChange.emit(this.form.value);\n\n const partialModel = {} as Partial<T>;\n Object.keys(this.form.controls)\n .filter(key => !key.endsWith('Confirm') && this.form.controls[key].dirty)\n .forEach(key => {\n partialModel[key] = this.form.controls[key].value;\n });\n\n this.valuePartialChange.emit(partialModel);\n }));\n\n this.form.updateValueAndValidity();\n }\n\n private initType() {\n const fieldWithOptions = getModelFieldsWithOptions(this._options.model);\n\n if (fieldWithOptions.some(fwo => fwo.options.step)) {\n this.type = \"stepper\";\n return;\n }\n\n this.type = 'standard';\n }\n\n private async initExportImport() {\n const modelOptions = getModelOptions(this._options.model.constructor);\n if (modelOptions.export && !this.exportProvider) {\n console.error(\"exportProvider is not provided\");\n }\n\n if (modelOptions.import && !this.importProvider) {\n console.error(\"importProvider is not provided\");\n }\n\n this.export = modelOptions.export && !!this.exportProvider;\n this.import = modelOptions.import && !!this.importProvider;\n\n if (this.import) {\n this.importAccept = await this.importProvider.getAccept(this._options.model.constructor as Type<any>);\n if (this.importProvider) this.cd.detectChanges();\n }\n\n if (this.export) {\n this.exportHandler = val => {\n this.exportProvider.execute(this._options.model.constructor as Type<any>, val);\n }\n }\n\n this.cd.detectChanges();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"FormComponent":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"FormComponent":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":61,"character":38},"arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":26,"character":1},"arguments":[{"selector":"smart-form","template":"\n <div *ngIf=\"export || import\" style=\"text-align: right\">\n <smart-export *ngIf=\"export\"\n [value]=\"options?.control?.value\"\n [handler]=\"exportHandler\"\n ></smart-export>\n <smart-import *ngIf=\"import\"\n (set)=\"onSetValue($event)\"\n [accept]=\"importAccept\"\n ></smart-import>\n </div>\n <form *ngIf=\"form\" [formGroup]=\"form\" (ngSubmit)=\"invokeSubmit.emit(form.value)\" (keyup.enter)=\"invokeSubmit.emit(form.value)\">\n <ng-container *ngIf=\"template === 'default'\">\n <smart-form-standard\n *ngIf=\"options && type === 'standard'\"\n [options]=\"options\"\n [form]=\"form\"\n (invokeSubmit)=\"invokeSubmit.emit($event)\"\n ></smart-form-standard>\n\n <smart-form-stepper\n *ngIf=\"options && type === 'stepper'\"\n [options]=\"options\"\n [form]=\"form\"\n (invokeSubmit)=\"invokeSubmit.emit($event)\"\n ></smart-form-stepper>\n </ng-container>\n \n <div #customTpl></div>\n </form>\n ","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":59,"character":19},"member":"OnPush"}}]}],"members":{"customTpl":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":74,"character":3},"arguments":["customTpl",{"read":{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":74,"character":34},"static":false}]}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":77,"character":3}}]}],"invokeSubmit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":118,"character":3}}]}],"valueChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":119,"character":3}}]}],"valuePartialChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":120,"character":3}}]}],"validChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":121,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":127,"character":7}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":128,"character":7},"arguments":[{"__symbolic":"reference","module":"../../providers/model-export.provider","name":"MODEL_EXPORT_PROVIDER","line":128,"character":14}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":129,"character":7}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":130,"character":7},"arguments":[{"__symbolic":"reference","module":"../../providers/model-import.provider","name":"MODEL_IMPORT_PROVIDER","line":130,"character":14}]}],null,null],"parameters":[{"__symbolic":"reference","module":"../../factories/form/form.factory","name":"FormFactory","line":124,"character":27},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":125,"character":18},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":126,"character":26},{"__symbolic":"reference","module":"../../providers/model-export.provider","name":"IModelExportProvider","line":128,"character":60},{"__symbolic":"reference","module":"../../providers/model-import.provider","name":"IModelImportProvider","line":130,"character":60},{"__symbolic":"reference","module":"@angular/core","name":"NgModuleRef","line":131,"character":25,"arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"@angular/core","name":"ComponentFactoryResolver","line":132,"character":40}]}],"onSetValue":[{"__symbolic":"method"}],"refreshProperties":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"initLoading":[{"__symbolic":"method"}],"registerChanges":[{"__symbolic":"method"}],"initType":[{"__symbolic":"method"}],"initExportImport":[{"__symbolic":"method"}]}}}}]
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ComponentFactoryResolver, ElementRef, Input, NgModuleRef, Renderer2,
|
|
2
|
-
import {
|
|
3
|
-
export class PageComponent {
|
|
1
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ComponentFactoryResolver, ElementRef, Input, NgModuleRef, Renderer2, } from "@angular/core";
|
|
2
|
+
import { CreateDynamicComponent } from "../base";
|
|
3
|
+
export class PageComponent extends CreateDynamicComponent('page') {
|
|
4
4
|
constructor(el, cd, renderer, moduleRef, componentFactoryResolver) {
|
|
5
|
+
super(cd, moduleRef, componentFactoryResolver);
|
|
5
6
|
this.el = el;
|
|
6
7
|
this.cd = cd;
|
|
7
8
|
this.renderer = renderer;
|
|
@@ -10,6 +11,7 @@ export class PageComponent {
|
|
|
10
11
|
}
|
|
11
12
|
set options(val) {
|
|
12
13
|
this._options = val;
|
|
14
|
+
this.refreshDynamicInstance();
|
|
13
15
|
}
|
|
14
16
|
get options() {
|
|
15
17
|
return this._options;
|
|
@@ -17,18 +19,8 @@ export class PageComponent {
|
|
|
17
19
|
ngOnInit() {
|
|
18
20
|
this.renderer.setStyle(this.el.nativeElement, 'height', '100%');
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.template = component ? "custom" : "default";
|
|
23
|
-
if (component) {
|
|
24
|
-
const factory = this.componentFactoryResolver.resolveComponentFactory(component);
|
|
25
|
-
if (!this.customTpl.get(0)) {
|
|
26
|
-
const instance = this.customTpl.createComponent(factory).instance;
|
|
27
|
-
instance.options = this.options;
|
|
28
|
-
instance.contentTpl.createEmbeddedView(this.contentTpl);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
this.cd.detectChanges();
|
|
22
|
+
refreshProperties() {
|
|
23
|
+
this.baseInstance.options = this.options;
|
|
32
24
|
}
|
|
33
25
|
}
|
|
34
26
|
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
@@ -63,8 +55,6 @@ PageComponent.ctorParameters = () => [
|
|
|
63
55
|
];
|
|
64
56
|
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
65
57
|
PageComponent.propDecorators = {
|
|
66
|
-
options: [{ type: Input }]
|
|
67
|
-
customTpl: [{ type: ViewChild, args: ["customTpl", { read: ViewContainerRef, static: false },] }],
|
|
68
|
-
contentTpl: [{ type: ViewChild, args: ["contentTpl", { read: TemplateRef, static: false },] }]
|
|
58
|
+
options: [{ type: Input }]
|
|
69
59
|
};
|
|
70
60
|
//# sourceMappingURL=page.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.component.js","sourceRoot":"","sources":["../../../../../../../../libs/shared/angular/src/lib/components/page/page.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,uBAAuB,EAAE,iBAAiB,EAC1C,SAAS,EAAE,wBAAwB,EACnC,UAAU,EACV,KAAK,EAAE,WAAW,EAElB,SAAS,
|
|
1
|
+
{"version":3,"file":"page.component.js","sourceRoot":"","sources":["../../../../../../../../libs/shared/angular/src/lib/components/page/page.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,uBAAuB,EAAE,iBAAiB,EAC1C,SAAS,EAAE,wBAAwB,EACnC,UAAU,EACV,KAAK,EAAE,WAAW,EAElB,SAAS,GACZ,MAAM,eAAe,CAAC;AAMvB,OAAO,EAAC,sBAAsB,EAAC,MAAM,SAAS,CAAC;AAe/C,MAAM,OAAO,aAAc,SAAQ,sBAAsB,CAAoB,MAAM,CAAC;IAWhF,YACY,EAAc,EACd,EAAqB,EACrB,QAAmB,EACnB,SAA2B,EAC3B,wBAAkD;QAE1D,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,wBAAwB,CAAC,CAAC;QANvC,OAAE,GAAF,EAAE,CAAY;QACd,OAAE,GAAF,EAAE,CAAmB;QACrB,aAAQ,GAAR,QAAQ,CAAW;QACnB,cAAS,GAAT,SAAS,CAAkB;QAC3B,6BAAwB,GAAxB,wBAAwB,CAA0B;IAG9D,CAAC;IAhBD,IAAa,OAAO,CAAC,GAAiB;QAClC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;QACpB,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAClC,CAAC;IACD,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAYD,QAAQ;QACJ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;IAED,iBAAiB;QACb,IAAI,CAAC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC7C,CAAC;;;;YAxCJ,SAAS,SAAC;gBACP,QAAQ,EAAE,YAAY;gBACtB,QAAQ,EAAE;;;;;;;;KAQT;gBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;aAClD;;;;;;;;;;YAxBG,UAAU;YAFe,iBAAiB;YAK1C,SAAS;YAFF,WAAW;YAFP,wBAAwB;;;;sBA6BlC,KAAK","sourcesContent":["import {\n AfterViewInit,\n ChangeDetectionStrategy, ChangeDetectorRef,\n Component, ComponentFactoryResolver, ComponentRef,\n ElementRef,\n Input, NgModuleRef,\n OnInit,\n Renderer2, TemplateRef, ViewChild, ViewContainerRef,\n} from \"@angular/core\";\n\nimport {IPageOptions} from \"../../models/interfaces\";\nimport {DynamicComponentStorageService} from \"../../services/dynamic-component-storage/dynamic-component-storage.service\";\nimport {FormBaseComponent} from \"../form\";\nimport {PageBaseComponent} from \"./base/base.component\";\nimport {CreateDynamicComponent} from \"../base\";\n\n@Component({\n selector: 'smart-page',\n template: `\n <smart-page-standard *ngIf=\"template === 'default'\" [options]=\"options\">\n <ng-container [ngTemplateOutlet]=\"contentTpl\"></ng-container>\n </smart-page-standard>\n <ng-template #contentTpl>\n <ng-content></ng-content>\n </ng-template>\n <div #customTpl></div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class PageComponent extends CreateDynamicComponent<PageBaseComponent>('page') implements OnInit {\n private _options: IPageOptions;\n\n @Input() set options(val: IPageOptions) {\n this._options = val;\n this.refreshDynamicInstance();\n }\n get options(): IPageOptions {\n return this._options;\n }\n\n constructor(\n private el: ElementRef,\n private cd: ChangeDetectorRef,\n private renderer: Renderer2,\n private moduleRef: NgModuleRef<any>,\n private componentFactoryResolver: ComponentFactoryResolver\n ) {\n super(cd, moduleRef, componentFactoryResolver);\n }\n\n ngOnInit() {\n this.renderer.setStyle(this.el.nativeElement, 'height', '100%');\n }\n\n refreshProperties(): void {\n this.baseInstance.options = this.options;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"PageComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"PageComponent":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":29,"character":35},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":16,"character":1},"arguments":[{"selector":"smart-page","template":"\n <smart-page-standard *ngIf=\"template === 'default'\" [options]=\"options\">\n <ng-container [ngTemplateOutlet]=\"contentTpl\"></ng-container>\n </smart-page-standard>\n <ng-template #contentTpl>\n <ng-content></ng-content>\n </ng-template>\n <div #customTpl></div>\n ","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":27,"character":21},"member":"OnPush"}}]}],"members":{"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":41,"character":20},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":42,"character":20},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":43,"character":26},{"__symbolic":"reference","module":"@angular/core","name":"NgModuleRef","line":44,"character":27,"arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"@angular/core","name":"ComponentFactoryResolver","line":45,"character":42}]}],"ngOnInit":[{"__symbolic":"method"}],"refreshProperties":[{"__symbolic":"method"}]}}}}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../../../libs/shared/angular/src/lib/models/interfaces.ts"],"names":[],"mappings":"AAoIA,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,+BAAmB,CAAA;IACnB,uCAA2B,CAAA;AAC7B,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB","sourcesContent":["import { AbstractControl } from \"@angular/forms\";\nimport {Observable} from \"rxjs\";\nimport {ComponentFactory, PipeTransform, Type} from \"@angular/core\";\n\nimport { IFieldOptions } from \"@smartsoft001/models\";\nimport { IEntity } from \"@smartsoft001/domain-core\";\n\nimport { IAppProvider } from \"../providers/interfaces\";\nimport {IStyle} from \"./style\";\nimport {InputBaseComponent} from \"../components\";\n\nexport interface IAppOptions {\n provider: IAppProvider;\n logo?: string;\n menu?: {\n showForAnonymous?: boolean;\n items?: IMenuItem[];\n };\n style?: IStyle;\n}\n\nexport interface IButtonOptions {\n type?: \"submit\" | \"button\";\n expand?: \"block\" | \"full\" | undefined;\n confirm?: boolean;\n color?: 'primary' | 'light' | string;\n click: () => void;\n loading$?: Observable<boolean>;\n}\n\nexport interface ICardOptions {\n title?: string;\n buttons?: Array<IIconButtonOptions>;\n}\n\nexport interface IDetailsComponentFactories<T> {\n top?: ComponentFactory<any>;\n bottom?: ComponentFactory<any>;\n}\n\nexport interface IDetailsOptions<T extends IEntity<string>> {\n title?: string;\n cellPipe?: ICellPipe<T>;\n type: any;\n item$: Observable<T>;\n loading$?: Observable<boolean>;\n itemHandler?: (id: string) => void;\n removeHandler?: (item: T) => void;\n componentFactories?: IDetailsComponentFactories<T>;\n}\n\nexport interface IDetailOptions<T> {\n key: string;\n item$: Observable<T>;\n cellPipe?: ICellPipe<T>;\n options: IFieldOptions;\n loading$?: Observable<boolean>;\n}\n\nexport interface IDetailsProvider<T> {\n getData: (id: string) => void;\n clearData: () => void;\n item$: Observable<T>;\n loading$: Observable<boolean>;\n}\n\nexport interface IFormOptions<T> {\n treeLevel?: number;\n model: T;\n control?: AbstractControl;\n mode?: \"create\" | \"update\" | string;\n loading$?: Observable<boolean>;\n uniqueProvider?: (values: Record<keyof T, any>) => Promise<boolean>,\n possibilities?: {\n [key: string]: Observable<{ id: any, text: string }[]>;\n }\n inputComponents?: {\n [key: string]: Type<InputBaseComponent<T>>;\n }\n}\n\nexport interface IMenuItem {\n mode?: 'divider' | 'default';\n route?: string;\n caption?: string;\n component?: any;\n icon?: string;\n infos?: Array<{ text: string }>;\n}\n\nexport interface IPageOptions {\n title: string;\n hideHeader?: boolean;\n hideMenuButton?: boolean;\n showBackButton?: boolean;\n endButtons?: Array<IIconButtonOptions>;\n search?: { text$: Observable<string>, set: (txt) => void }\n}\n\nexport interface IIconButtonOptions {\n icon: string;\n text?: string;\n handler?: () => void;\n component?: any;\n type?: 'default' | 'popover'\n disabled$?: Observable<boolean>;\n number?: number;\n}\n\nexport type InputOptions<T> = IInputOptions & IInputFromFieldOptions<T>;\n\nexport interface IInputOptions {\n treeLevel: number;\n control: AbstractControl;\n possibilities$?: Observable<{ id: any, text: string }[]>;\n component?: Type<InputBaseComponent<any>>;\n}\n\nexport interface IInputFromFieldOptions<T> {\n model: T;\n fieldKey: string;\n mode?: \"create\" | \"update\" | string;\n}\n\nexport interface IListPaginationOptions {\n limit: number,\n loadNextPage: () => Promise<boolean>,\n loadPrevPage: () => Promise<boolean>,\n page$: Observable<number>,\n totalPages$: Observable<number>\n}\n\nexport enum ListMode {\n mobile = \"mobile\",\n desktop = \"desktop\",\n masonryGrid = \"masonryGrid\"\n}\n\nexport interface IListOptions<T> {\n provider: IListProvider<T>;\n type: any;\n mode?: ListMode;\n\n pagination?: IListPaginationOptions;\n\n cellPipe?: ICellPipe<T>;\n componentFactories?: IListComponentFactories<T>,\n sort?: boolean | {\n default?: string;\n defaultDesc?: boolean;\n }\n\n details?:\n | boolean\n | {\n provider?: IDetailsProvider<T>;\n componentFactories?: IDetailsComponentFactories<T>;\n };\n\n item?:\n | boolean\n | {\n options?: ItemOptions;\n };\n\n remove?:\n | boolean\n | {\n provider?: IRemoveProvider<T>;\n };\n\n select?: 'multi'\n}\n\nexport interface ICellPipe<T> extends PipeTransform {\n transform(value: T, columnName: string, translate?: (val: string) => string): string;\n}\n\nexport interface IListComponentFactories<T> {\n top?: ComponentFactory<any>;\n}\n\nexport interface IItemOptionsForPage {\n routingPrefix: string;\n edit: boolean;\n}\n\nexport interface IItemOptionsForCustom {\n select: (id: string) => void;\n edit: boolean;\n}\n\nexport type ItemOptions = IItemOptionsForPage | IItemOptionsForCustom;\n\nexport interface IListProvider<T> {\n getData: (filter) => void;\n onChangeMultiSelected?: (list: Array<T>) => void;\n list$: Observable<T[]>;\n loading$: Observable<boolean>;\n}\n\nexport interface IRemoveProvider<T> {\n invoke: (id: string) => void;\n}\n\nexport type DynamicComponentType = \"form\" | \"page\";\nexport interface IDynamicComponentData {\n key: DynamicComponentType;\n component: Type<any>;\n data?: any;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../../../libs/shared/angular/src/lib/models/interfaces.ts"],"names":[],"mappings":"AAoIA,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,+BAAmB,CAAA;IACnB,uCAA2B,CAAA;AAC7B,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB","sourcesContent":["import { AbstractControl } from \"@angular/forms\";\nimport {Observable} from \"rxjs\";\nimport {ComponentFactory, PipeTransform, Type} from \"@angular/core\";\n\nimport { IFieldOptions } from \"@smartsoft001/models\";\nimport { IEntity } from \"@smartsoft001/domain-core\";\n\nimport { IAppProvider } from \"../providers/interfaces\";\nimport {IStyle} from \"./style\";\nimport {InputBaseComponent} from \"../components\";\n\nexport interface IAppOptions {\n provider: IAppProvider;\n logo?: string;\n menu?: {\n showForAnonymous?: boolean;\n items?: IMenuItem[];\n };\n style?: IStyle;\n}\n\nexport interface IButtonOptions {\n type?: \"submit\" | \"button\";\n expand?: \"block\" | \"full\" | undefined;\n confirm?: boolean;\n color?: 'primary' | 'light' | string;\n click: () => void;\n loading$?: Observable<boolean>;\n}\n\nexport interface ICardOptions {\n title?: string;\n buttons?: Array<IIconButtonOptions>;\n}\n\nexport interface IDetailsComponentFactories<T> {\n top?: ComponentFactory<any>;\n bottom?: ComponentFactory<any>;\n}\n\nexport interface IDetailsOptions<T extends IEntity<string>> {\n title?: string;\n cellPipe?: ICellPipe<T>;\n type: any;\n item$: Observable<T>;\n loading$?: Observable<boolean>;\n itemHandler?: (id: string) => void;\n removeHandler?: (item: T) => void;\n componentFactories?: IDetailsComponentFactories<T>;\n}\n\nexport interface IDetailOptions<T> {\n key: string;\n item$: Observable<T>;\n cellPipe?: ICellPipe<T>;\n options: IFieldOptions;\n loading$?: Observable<boolean>;\n}\n\nexport interface IDetailsProvider<T> {\n getData: (id: string) => void;\n clearData: () => void;\n item$: Observable<T>;\n loading$: Observable<boolean>;\n}\n\nexport interface IFormOptions<T> {\n treeLevel?: number;\n model: T;\n control?: AbstractControl;\n mode?: \"create\" | \"update\" | string;\n loading$?: Observable<boolean>;\n uniqueProvider?: (values: Record<keyof T, any>) => Promise<boolean>,\n possibilities?: {\n [key: string]: Observable<{ id: any, text: string }[]>;\n }\n inputComponents?: {\n [key: string]: Type<InputBaseComponent<T>>;\n }\n}\n\nexport interface IMenuItem {\n mode?: 'divider' | 'default';\n route?: string;\n caption?: string;\n component?: any;\n icon?: string;\n infos?: Array<{ text: string }>;\n}\n\nexport interface IPageOptions {\n title: string;\n hideHeader?: boolean;\n hideMenuButton?: boolean;\n showBackButton?: boolean;\n endButtons?: Array<IIconButtonOptions>;\n search?: { text$: Observable<string>, set: (txt) => void }\n}\n\nexport interface IIconButtonOptions {\n icon: string;\n text?: string;\n handler?: () => void;\n component?: any;\n type?: 'default' | 'popover'\n disabled$?: Observable<boolean>;\n number?: number;\n}\n\nexport type InputOptions<T> = IInputOptions & IInputFromFieldOptions<T>;\n\nexport interface IInputOptions {\n treeLevel: number;\n control: AbstractControl;\n possibilities$?: Observable<{ id: any, text: string }[]>;\n component?: Type<InputBaseComponent<any>>;\n}\n\nexport interface IInputFromFieldOptions<T> {\n model: T;\n fieldKey: string;\n mode?: \"create\" | \"update\" | string;\n}\n\nexport interface IListPaginationOptions {\n limit: number,\n loadNextPage: () => Promise<boolean>,\n loadPrevPage: () => Promise<boolean>,\n page$: Observable<number>,\n totalPages$: Observable<number>\n}\n\nexport enum ListMode {\n mobile = \"mobile\",\n desktop = \"desktop\",\n masonryGrid = \"masonryGrid\"\n}\n\nexport interface IListOptions<T> {\n provider: IListProvider<T>;\n type: any;\n mode?: ListMode;\n\n pagination?: IListPaginationOptions;\n\n cellPipe?: ICellPipe<T>;\n componentFactories?: IListComponentFactories<T>,\n sort?: boolean | {\n default?: string;\n defaultDesc?: boolean;\n }\n\n details?:\n | boolean\n | {\n provider?: IDetailsProvider<T>;\n componentFactories?: IDetailsComponentFactories<T>;\n };\n\n item?:\n | boolean\n | {\n options?: ItemOptions;\n };\n\n remove?:\n | boolean\n | {\n provider?: IRemoveProvider<T>;\n };\n\n select?: 'multi'\n}\n\nexport interface ICellPipe<T> extends PipeTransform {\n transform(value: T, columnName: string, translate?: (val: string) => string): string;\n}\n\nexport interface IListComponentFactories<T> {\n top?: ComponentFactory<any>;\n}\n\nexport interface IItemOptionsForPage {\n routingPrefix: string;\n edit: boolean;\n}\n\nexport interface IItemOptionsForCustom {\n select: (id: string) => void;\n edit: boolean;\n}\n\nexport type ItemOptions = IItemOptionsForPage | IItemOptionsForCustom;\n\nexport interface IListProvider<T> {\n getData: (filter) => void;\n onChangeMultiSelected?: (list: Array<T>) => void;\n list$: Observable<T[]>;\n loading$: Observable<boolean>;\n}\n\nexport interface IRemoveProvider<T> {\n invoke: (id: string) => void;\n}\n\nexport type DynamicComponentType = \"form\" | \"page\" | \"button\" | \"details\";\nexport interface IDynamicComponentData {\n key: DynamicComponentType;\n component: Type<any>;\n data?: any;\n}\n"]}
|