@ng-doc/app 15.1.1 → 15.3.1
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/classes/index.d.ts +0 -1
- package/classes/root-page/root-page.d.ts +20 -5
- package/components/api-list/api-list.component.d.ts +0 -3
- package/components/demo/demo.component.d.ts +2 -2
- package/components/demo-displayer/demo-displayer.module.d.ts +2 -1
- package/components/index.d.ts +1 -0
- package/components/navbar/navbar.component.d.ts +18 -0
- package/components/navbar/navbar.module.d.ts +1 -1
- package/components/page/page.module.d.ts +2 -1
- package/components/playground/base-playground.d.ts +15 -0
- package/components/playground/index.d.ts +5 -0
- package/components/playground/playground-demo/playground-demo.component.d.ts +33 -0
- package/components/playground/playground-form.d.ts +6 -0
- package/components/playground/playground-properties/playground-properties.component.d.ts +22 -0
- package/components/{playground-property → playground/playground-property}/playground-property.component.d.ts +2 -2
- package/components/playground/playground.component.d.ts +5 -4
- package/components/playground/playground.module.d.ts +9 -6
- package/components/root/root.component.d.ts +35 -1
- package/components/root/root.module.d.ts +1 -1
- package/components/sidebar/sidebar-category/sidebar-category.component.d.ts +2 -2
- package/esm2020/classes/index.mjs +1 -2
- package/esm2020/classes/root-page/root-page.mjs +4 -1
- package/esm2020/components/api-list/api-list.component.mjs +2 -2
- package/esm2020/components/code/code.component.mjs +2 -2
- package/esm2020/components/demo/demo.component.mjs +2 -2
- package/esm2020/components/demo-displayer/demo-displayer.component.mjs +4 -3
- package/esm2020/components/demo-displayer/demo-displayer.module.mjs +7 -3
- package/esm2020/components/index.mjs +2 -1
- package/esm2020/components/navbar/navbar.component.mjs +21 -3
- package/esm2020/components/navbar/navbar.module.mjs +2 -5
- package/esm2020/components/page/page.component.mjs +3 -3
- package/esm2020/components/page/page.module.mjs +23 -4
- package/esm2020/components/playground/base-playground.mjs +18 -0
- package/esm2020/components/playground/index.mjs +6 -1
- package/esm2020/components/playground/playground-demo/playground-demo.component.mjs +116 -0
- package/esm2020/components/playground/playground-form.mjs +2 -0
- package/esm2020/components/playground/playground-properties/playground-properties.component.mjs +42 -0
- package/esm2020/components/playground/playground-property/playground-property.component.mjs +89 -0
- package/esm2020/components/playground/playground.component.mjs +13 -11
- package/esm2020/components/playground/playground.module.mjs +41 -14
- package/esm2020/components/root/root.component.mjs +50 -4
- package/esm2020/components/root/root.module.mjs +5 -5
- package/esm2020/components/sidebar/sidebar-category/sidebar-category.component.mjs +3 -3
- package/esm2020/components/sidebar/sidebar.component.mjs +2 -2
- package/esm2020/components/toc/toc.component.mjs +2 -2
- package/esm2020/helpers/format-html/format-html.mjs +12 -10
- package/esm2020/helpers/generate-toc/generate-toc.mjs +2 -10
- package/esm2020/helpers/index.mjs +2 -2
- package/esm2020/helpers/provide-playground-demo/index.mjs +2 -0
- package/esm2020/helpers/provide-playground-demo/ng-doc-app-helpers-provide-playground-demo.mjs +5 -0
- package/esm2020/helpers/provide-playground-demo/provide-playground-demo.mjs +30 -0
- package/esm2020/index.mjs +2 -1
- package/esm2020/interfaces/context.mjs +1 -1
- package/esm2020/interfaces/index.mjs +1 -2
- package/esm2020/interfaces/navigation.mjs +1 -1
- package/esm2020/interfaces/type-control-provider-options.mjs +1 -1
- package/esm2020/processors/tooltip-processor/tooltip-wrapper.component.mjs +3 -3
- package/esm2020/services/sidebar/sidebar.service.mjs +49 -8
- package/fesm2015/ng-doc-app-classes-root-page.mjs +3 -0
- package/fesm2015/ng-doc-app-classes-root-page.mjs.map +1 -1
- package/fesm2015/ng-doc-app-classes.mjs +0 -1
- package/fesm2015/ng-doc-app-classes.mjs.map +1 -1
- package/fesm2015/ng-doc-app-components-api-list.mjs +1 -1
- package/fesm2015/ng-doc-app-components-api-list.mjs.map +1 -1
- package/fesm2015/ng-doc-app-components-code.mjs +1 -1
- package/fesm2015/ng-doc-app-components-code.mjs.map +1 -1
- package/fesm2015/ng-doc-app-components-demo-displayer.mjs +9 -4
- package/fesm2015/ng-doc-app-components-demo-displayer.mjs.map +1 -1
- package/fesm2015/ng-doc-app-components-demo.mjs +2 -1
- package/fesm2015/ng-doc-app-components-demo.mjs.map +1 -1
- package/fesm2015/ng-doc-app-components-navbar.mjs +21 -6
- package/fesm2015/ng-doc-app-components-navbar.mjs.map +1 -1
- package/fesm2015/ng-doc-app-components-page.mjs +24 -5
- package/fesm2015/ng-doc-app-components-page.mjs.map +1 -1
- package/fesm2015/ng-doc-app-components-playground.mjs +306 -30
- package/fesm2015/ng-doc-app-components-playground.mjs.map +1 -1
- package/fesm2015/ng-doc-app-components-root.mjs +53 -7
- package/fesm2015/ng-doc-app-components-root.mjs.map +1 -1
- package/fesm2015/ng-doc-app-components-sidebar.mjs +4 -4
- package/fesm2015/ng-doc-app-components-sidebar.mjs.map +1 -1
- package/fesm2015/ng-doc-app-components-toc.mjs +2 -2
- package/fesm2015/ng-doc-app-components-toc.mjs.map +1 -1
- package/fesm2015/ng-doc-app-components.mjs +1 -0
- package/fesm2015/ng-doc-app-components.mjs.map +1 -1
- package/fesm2015/ng-doc-app-helpers-format-html.mjs +12 -9
- package/fesm2015/ng-doc-app-helpers-format-html.mjs.map +1 -1
- package/fesm2015/ng-doc-app-helpers-generate-toc.mjs +1 -9
- package/fesm2015/ng-doc-app-helpers-generate-toc.mjs.map +1 -1
- package/fesm2015/ng-doc-app-helpers-provide-playground-demo.mjs +37 -0
- package/fesm2015/ng-doc-app-helpers-provide-playground-demo.mjs.map +1 -0
- package/fesm2015/ng-doc-app-helpers.mjs +1 -1
- package/fesm2015/ng-doc-app-processors-tooltip-processor.mjs +2 -2
- package/fesm2015/ng-doc-app-processors-tooltip-processor.mjs.map +1 -1
- package/fesm2015/ng-doc-app-services-sidebar.mjs +50 -7
- package/fesm2015/ng-doc-app-services-sidebar.mjs.map +1 -1
- package/fesm2015/ng-doc-app.mjs +1 -0
- package/fesm2015/ng-doc-app.mjs.map +1 -1
- package/fesm2020/ng-doc-app-classes-root-page.mjs +3 -0
- package/fesm2020/ng-doc-app-classes-root-page.mjs.map +1 -1
- package/fesm2020/ng-doc-app-classes.mjs +0 -1
- package/fesm2020/ng-doc-app-classes.mjs.map +1 -1
- package/fesm2020/ng-doc-app-components-api-list.mjs +1 -1
- package/fesm2020/ng-doc-app-components-api-list.mjs.map +1 -1
- package/fesm2020/ng-doc-app-components-code.mjs +1 -1
- package/fesm2020/ng-doc-app-components-code.mjs.map +1 -1
- package/fesm2020/ng-doc-app-components-demo-displayer.mjs +9 -4
- package/fesm2020/ng-doc-app-components-demo-displayer.mjs.map +1 -1
- package/fesm2020/ng-doc-app-components-demo.mjs +1 -1
- package/fesm2020/ng-doc-app-components-demo.mjs.map +1 -1
- package/fesm2020/ng-doc-app-components-navbar.mjs +21 -6
- package/fesm2020/ng-doc-app-components-navbar.mjs.map +1 -1
- package/fesm2020/ng-doc-app-components-page.mjs +24 -5
- package/fesm2020/ng-doc-app-components-page.mjs.map +1 -1
- package/fesm2020/ng-doc-app-components-playground.mjs +297 -30
- package/fesm2020/ng-doc-app-components-playground.mjs.map +1 -1
- package/fesm2020/ng-doc-app-components-root.mjs +53 -7
- package/fesm2020/ng-doc-app-components-root.mjs.map +1 -1
- package/fesm2020/ng-doc-app-components-sidebar.mjs +4 -4
- package/fesm2020/ng-doc-app-components-sidebar.mjs.map +1 -1
- package/fesm2020/ng-doc-app-components-toc.mjs +2 -2
- package/fesm2020/ng-doc-app-components-toc.mjs.map +1 -1
- package/fesm2020/ng-doc-app-components.mjs +1 -0
- package/fesm2020/ng-doc-app-components.mjs.map +1 -1
- package/fesm2020/ng-doc-app-helpers-format-html.mjs +12 -9
- package/fesm2020/ng-doc-app-helpers-format-html.mjs.map +1 -1
- package/fesm2020/ng-doc-app-helpers-generate-toc.mjs +1 -9
- package/fesm2020/ng-doc-app-helpers-generate-toc.mjs.map +1 -1
- package/fesm2020/ng-doc-app-helpers-provide-playground-demo.mjs +37 -0
- package/fesm2020/ng-doc-app-helpers-provide-playground-demo.mjs.map +1 -0
- package/fesm2020/ng-doc-app-helpers.mjs +1 -1
- package/fesm2020/ng-doc-app-processors-tooltip-processor.mjs +2 -2
- package/fesm2020/ng-doc-app-processors-tooltip-processor.mjs.map +1 -1
- package/fesm2020/ng-doc-app-services-sidebar.mjs +48 -7
- package/fesm2020/ng-doc-app-services-sidebar.mjs.map +1 -1
- package/fesm2020/ng-doc-app.mjs +1 -0
- package/fesm2020/ng-doc-app.mjs.map +1 -1
- package/helpers/format-html/format-html.d.ts +2 -1
- package/helpers/index.d.ts +1 -1
- package/helpers/provide-playground-demo/index.d.ts +1 -0
- package/helpers/provide-playground-demo/provide-playground-demo.d.ts +18 -0
- package/index.d.ts +1 -0
- package/interfaces/context.d.ts +6 -0
- package/interfaces/index.d.ts +0 -1
- package/interfaces/navigation.d.ts +3 -0
- package/interfaces/type-control-provider-options.d.ts +7 -0
- package/package.json +11 -43
- package/services/sidebar/sidebar.service.d.ts +28 -1
- package/styles/global.css +1 -0
- package/styles/main.css +1 -0
- package/classes/html-parser/index.d.ts +0 -1
- package/components/playground-demo/demo/base-demo.component.d.ts +0 -7
- package/components/playground-demo/index.d.ts +0 -2
- package/components/playground-demo/playground-demo.component.d.ts +0 -29
- package/components/playground-demo/playground-demo.module.d.ts +0 -9
- package/components/playground-properties/index.d.ts +0 -2
- package/components/playground-properties/playground-properties.component.d.ts +0 -16
- package/components/playground-properties/playground-properties.module.d.ts +0 -11
- package/components/playground-property/index.d.ts +0 -2
- package/components/playground-property/playground-property.module.d.ts +0 -11
- package/esm2020/classes/html-parser/index.mjs +0 -2
- package/esm2020/classes/html-parser/ng-doc-app-classes-html-parser.mjs +0 -5
- package/esm2020/components/playground-demo/demo/base-demo.component.mjs +0 -3
- package/esm2020/components/playground-demo/index.mjs +0 -3
- package/esm2020/components/playground-demo/ng-doc-app-components-playground-demo.mjs +0 -5
- package/esm2020/components/playground-demo/playground-demo.component.mjs +0 -101
- package/esm2020/components/playground-demo/playground-demo.module.mjs +0 -19
- package/esm2020/components/playground-properties/index.mjs +0 -3
- package/esm2020/components/playground-properties/ng-doc-app-components-playground-properties.mjs +0 -5
- package/esm2020/components/playground-properties/playground-properties.component.mjs +0 -36
- package/esm2020/components/playground-properties/playground-properties.module.mjs +0 -50
- package/esm2020/components/playground-property/index.mjs +0 -3
- package/esm2020/components/playground-property/ng-doc-app-components-playground-property.mjs +0 -5
- package/esm2020/components/playground-property/playground-property.component.mjs +0 -88
- package/esm2020/components/playground-property/playground-property.module.mjs +0 -21
- package/esm2020/helpers/compile-template/compile-template.mjs +0 -116
- package/esm2020/helpers/compile-template/index.mjs +0 -2
- package/esm2020/helpers/compile-template/ng-doc-app-helpers-compile-template.mjs +0 -5
- package/esm2020/interfaces/playground-form.mjs +0 -2
- package/fesm2015/ng-doc-app-classes-html-parser.mjs +0 -8
- package/fesm2015/ng-doc-app-classes-html-parser.mjs.map +0 -1
- package/fesm2015/ng-doc-app-components-playground-demo.mjs +0 -123
- package/fesm2015/ng-doc-app-components-playground-demo.mjs.map +0 -1
- package/fesm2015/ng-doc-app-components-playground-properties.mjs +0 -90
- package/fesm2015/ng-doc-app-components-playground-properties.mjs.map +0 -1
- package/fesm2015/ng-doc-app-components-playground-property.mjs +0 -113
- package/fesm2015/ng-doc-app-components-playground-property.mjs.map +0 -1
- package/fesm2015/ng-doc-app-helpers-compile-template.mjs +0 -122
- package/fesm2015/ng-doc-app-helpers-compile-template.mjs.map +0 -1
- package/fesm2020/ng-doc-app-classes-html-parser.mjs +0 -8
- package/fesm2020/ng-doc-app-classes-html-parser.mjs.map +0 -1
- package/fesm2020/ng-doc-app-components-playground-demo.mjs +0 -123
- package/fesm2020/ng-doc-app-components-playground-demo.mjs.map +0 -1
- package/fesm2020/ng-doc-app-components-playground-properties.mjs +0 -89
- package/fesm2020/ng-doc-app-components-playground-properties.mjs.map +0 -1
- package/fesm2020/ng-doc-app-components-playground-property.mjs +0 -112
- package/fesm2020/ng-doc-app-components-playground-property.mjs.map +0 -1
- package/fesm2020/ng-doc-app-helpers-compile-template.mjs +0 -122
- package/fesm2020/ng-doc-app-helpers-compile-template.mjs.map +0 -1
- package/helpers/compile-template/compile-template.d.ts +0 -18
- package/helpers/compile-template/index.d.ts +0 -1
- package/interfaces/playground-form.d.ts +0 -5
|
@@ -1,24 +1,266 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
3
|
-
import * as
|
|
4
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
5
|
-
import * as i1 from '@ng-doc/app/classes';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
2
|
+
import { Directive, isDevMode, ViewContainerRef, Component, ChangeDetectionStrategy, Input, ViewChild, HostBinding, EventEmitter, Output, ChangeDetectorRef, Injector, NgModule } from '@angular/core';
|
|
3
|
+
import * as i3 from '@angular/forms';
|
|
4
|
+
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
5
|
+
import * as i1$1 from '@ng-doc/app/classes/root-page';
|
|
6
|
+
import { NgDocRootPage } from '@ng-doc/app/classes/root-page';
|
|
7
|
+
import { extractValueOrThrow, buildPlaygroundDemoTemplate, objectKeys, extractValue } from '@ng-doc/core';
|
|
8
|
+
import * as i2 from '@angular/common';
|
|
8
9
|
import { CommonModule } from '@angular/common';
|
|
9
|
-
import * as
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
10
|
+
import * as i1 from '@angular/cdk/layout';
|
|
11
|
+
import { Breakpoints } from '@angular/cdk/layout';
|
|
12
|
+
import { pluck, takeUntil } from 'rxjs/operators';
|
|
13
|
+
import * as i4 from '@ng-doc/ui-kit';
|
|
14
|
+
import { NgDocLabelModule, NgDocTooltipModule, NgDocAsArrayModule, NgDocButtonIconModule, NgDocIconModule, NgDocTextModule, NgDocCheckboxModule, NgDocButtonModule } from '@ng-doc/ui-kit';
|
|
15
|
+
import { isPlaygroundProperty } from '@ng-doc/app/helpers/is-playground-property';
|
|
16
|
+
import { getTokenForType } from '@ng-doc/app/helpers/provide-type-control';
|
|
17
|
+
import { __decorate, __metadata } from 'tslib';
|
|
18
|
+
import { formatHtml } from '@ng-doc/app/helpers/format-html';
|
|
19
|
+
import { getPlaygroundDemoToken } from '@ng-doc/app/helpers/provide-playground-demo';
|
|
20
|
+
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
|
|
21
|
+
import { of, Subject } from 'rxjs';
|
|
22
|
+
import * as i2$1 from '@ng-doc/app/components/demo-displayer';
|
|
23
|
+
import { NgDocDemoDisplayerModule } from '@ng-doc/app/components/demo-displayer';
|
|
24
|
+
import { PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Base class for playgrounds components.
|
|
28
|
+
*/
|
|
29
|
+
class NgDocBasePlayground {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.data = {};
|
|
32
|
+
this.content = {};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
NgDocBasePlayground.selector = 'unknown';
|
|
36
|
+
NgDocBasePlayground.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocBasePlayground, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
37
|
+
NgDocBasePlayground.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: NgDocBasePlayground, ngImport: i0 });
|
|
38
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocBasePlayground, decorators: [{
|
|
39
|
+
type: Directive
|
|
40
|
+
}] });
|
|
41
|
+
|
|
42
|
+
class NgDocPlaygroundPropertyComponent {
|
|
43
|
+
constructor(injector) {
|
|
44
|
+
this.injector = injector;
|
|
45
|
+
this.name = '';
|
|
46
|
+
}
|
|
47
|
+
ngOnChanges({ property, control }) {
|
|
48
|
+
if (property && this.property) {
|
|
49
|
+
this.propertyControl?.destroy();
|
|
50
|
+
this.propertyControl = undefined;
|
|
51
|
+
const type = isPlaygroundProperty(this.property) ? this.property.type : 'boolean';
|
|
52
|
+
const typeControl = this.getControlForType(type) ??
|
|
53
|
+
this.getControlForTypeAlias(isPlaygroundProperty(this.property) ? this.property.options : undefined);
|
|
54
|
+
if (typeControl && this.propertyOutlet) {
|
|
55
|
+
this.propertyControl = this.propertyOutlet.createComponent(typeControl.control);
|
|
56
|
+
this.propertyControl.instance.name = this.name;
|
|
57
|
+
this.propertyControl.instance.description = this.tooltipContent;
|
|
58
|
+
this.propertyControl.instance.options = isPlaygroundProperty(this.property)
|
|
59
|
+
? this.property.options
|
|
60
|
+
: undefined;
|
|
61
|
+
this.propertyControl.instance.default = isPlaygroundProperty(this.property)
|
|
62
|
+
? this.property.default
|
|
63
|
+
: undefined;
|
|
64
|
+
this.propertyControl.instance.writeValue(this.control?.value);
|
|
65
|
+
this.option = typeControl.options;
|
|
66
|
+
}
|
|
67
|
+
else if (isDevMode()) {
|
|
68
|
+
console.warn(`NgDocPlayground didn't find the control for the @Input "${this.name}", the type "${type}" was not recognized'`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (control) {
|
|
72
|
+
this.control?.registerOnChange((value) => this.propertyControl?.instance?.writeValue(value));
|
|
73
|
+
this.propertyControl?.instance.registerOnChange((value) => this.control?.setValue(value));
|
|
74
|
+
this.propertyControl?.instance.registerOnTouched(() => this.control?.markAsTouched());
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
get hasPropertyControl() {
|
|
78
|
+
return !!this.propertyControl;
|
|
79
|
+
}
|
|
80
|
+
get tooltipContent() {
|
|
81
|
+
return this.property && isPlaygroundProperty(this.property) ? this.property.description ?? '' : '';
|
|
82
|
+
}
|
|
83
|
+
getControlForType(type) {
|
|
84
|
+
const token = getTokenForType(type);
|
|
85
|
+
return token ? this.injector.get(token) : undefined;
|
|
86
|
+
}
|
|
87
|
+
getControlForTypeAlias(options) {
|
|
88
|
+
if (options && options.length) {
|
|
89
|
+
let optionsIsValid = true;
|
|
90
|
+
try {
|
|
91
|
+
// checking that all values are extractable
|
|
92
|
+
options.forEach((item) => extractValueOrThrow(item));
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
optionsIsValid = false;
|
|
96
|
+
}
|
|
97
|
+
if (optionsIsValid) {
|
|
98
|
+
const token = getTokenForType('NgDocTypeAlias');
|
|
99
|
+
return token ? this.injector.get(token) : undefined;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
NgDocPlaygroundPropertyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundPropertyComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
106
|
+
NgDocPlaygroundPropertyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: NgDocPlaygroundPropertyComponent, selector: "ng-doc-playground-property", inputs: { name: "name", property: "property", control: "control" }, host: { properties: { "attr.data-has-property-control": "this.hasPropertyControl" } }, viewQueries: [{ propertyName: "propertyOutlet", first: true, predicate: ["propertyOutlet"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<label [ng-doc-label]=\"option?.hideLabel ? '' : labelContent\">\n\t<ng-template #labelContent>\n\t\t<span [ngDocTooltip]=\"tooltipContent\" [canOpen]=\"!!tooltipContent\"\n\t\t\t [positions]=\"['left-center', 'top-right', 'bottom-right']\">{{name}}</span>\n\t</ng-template>\n\t<ng-container #propertyOutlet></ng-container>\n</label>\n", styles: [":host{display:block}:host[data-has-property-control=false]{display:none}\n"], dependencies: [{ kind: "component", type: i4.NgDocLabelComponent, selector: "label[ng-doc-label]", inputs: ["ng-doc-label", "align"] }, { kind: "directive", type: i4.NgDocTooltipDirective, selector: "[ngDocTooltip]", inputs: ["ngDocTooltip", "delay", "displayOrigin", "pointerOrigin", "positions", "canOpen", "panelClass", "minHeight", "maxHeight", "height", "minWidth", "maxWidth", "width"], outputs: ["beforeOpen", "afterOpen", "beforeClose", "afterClose"], exportAs: ["ngDocTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundPropertyComponent, decorators: [{
|
|
108
|
+
type: Component,
|
|
109
|
+
args: [{ selector: 'ng-doc-playground-property', changeDetection: ChangeDetectionStrategy.OnPush, template: "<label [ng-doc-label]=\"option?.hideLabel ? '' : labelContent\">\n\t<ng-template #labelContent>\n\t\t<span [ngDocTooltip]=\"tooltipContent\" [canOpen]=\"!!tooltipContent\"\n\t\t\t [positions]=\"['left-center', 'top-right', 'bottom-right']\">{{name}}</span>\n\t</ng-template>\n\t<ng-container #propertyOutlet></ng-container>\n</label>\n", styles: [":host{display:block}:host[data-has-property-control=false]{display:none}\n"] }]
|
|
110
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { name: [{
|
|
111
|
+
type: Input
|
|
112
|
+
}], property: [{
|
|
113
|
+
type: Input
|
|
114
|
+
}], control: [{
|
|
115
|
+
type: Input
|
|
116
|
+
}], propertyOutlet: [{
|
|
117
|
+
type: ViewChild,
|
|
118
|
+
args: ['propertyOutlet', { read: ViewContainerRef, static: true }]
|
|
119
|
+
}], hasPropertyControl: [{
|
|
120
|
+
type: HostBinding,
|
|
121
|
+
args: ['attr.data-has-property-control']
|
|
122
|
+
}] } });
|
|
123
|
+
|
|
124
|
+
class NgDocPlaygroundPropertiesComponent {
|
|
125
|
+
constructor(breakpointObserver) {
|
|
126
|
+
this.breakpointObserver = breakpointObserver;
|
|
127
|
+
this.recreateDemo = false;
|
|
128
|
+
this.recreateDemoChange = new EventEmitter();
|
|
129
|
+
this.resetForm = new EventEmitter();
|
|
130
|
+
this.breakpoints = [Breakpoints.XSmall];
|
|
131
|
+
this.observer = this.breakpointObserver.observe(this.breakpoints).pipe(pluck('matches'));
|
|
132
|
+
}
|
|
133
|
+
getFormControl(controlType, key) {
|
|
134
|
+
return this.form.get(controlType)?.get(key);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
NgDocPlaygroundPropertiesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundPropertiesComponent, deps: [{ token: i1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Component });
|
|
138
|
+
NgDocPlaygroundPropertiesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: NgDocPlaygroundPropertiesComponent, selector: "ng-doc-playground-properties", inputs: { form: "form", properties: "properties", dynamicContent: "dynamicContent", recreateDemo: "recreateDemo" }, outputs: { recreateDemoChange: "recreateDemoChange", resetForm: "resetForm" }, ngImport: i0, template: "<div class=\"ng-doc-playground-properties-wrapper\" [class.vertical]=\"observer | async\">\n\t<div class=\"ng-doc-playground-demos\">\n\t\t<ng-content></ng-content>\n\t</div>\n\t<div class=\"ng-doc-playground-properties\">\n\t\t<div class=\"ng-doc-playground-header\">\n\t\t\t<h4 ng-doc-text>Playground</h4>\n\t\t\t<button ng-doc-button color=\"red\" (click)=\"resetForm.emit()\">Reset</button>\n\t\t</div>\n\t\t<div class=\"ng-doc-playground-setting\">\n\t\t\t<ng-doc-checkbox [(ngModel)]=\"recreateDemo\" (ngModelChange)=\"recreateDemoChange.emit($event)\">\n\t\t\t\t<span\n\t\t\t\t\tng-doc-text\n\t\t\t\t\t[ngDocTooltip]=\"'Recreates demo everytime\\none of the input has changed'\"\n\t\t\t\t\t[positions]=\"['bottom-right', 'left-center']\"\n\t\t\t\t>\n\t\t\t\t\tRecreate\n\t\t\t\t\t<ng-doc-icon icon=\"info\" ngDocTextRight></ng-doc-icon>\n\t\t\t\t</span>\n\t\t\t</ng-doc-checkbox>\n\t\t</div>\n\t\t<div class=\"ng-doc-playground-divider\"></div>\n\t\t<ng-container *ngIf=\"(properties | keyvalue)?.length\">\n\t\t\t<h5 class=\"ng-doc-title\" ng-doc-text>Settings</h5>\n\t\t\t<ng-doc-playground-property\n\t\t\t\t*ngFor=\"let property of properties | keyvalue\"\n\t\t\t\t[name]=\"property.value.name\"\n\t\t\t\t[property]=\"property.value\"\n\t\t\t\t[control]=\"getFormControl('properties', property.key)\"\n\t\t\t>\n\t\t\t</ng-doc-playground-property>\n\t\t</ng-container>\n\n\t\t<ng-container *ngIf=\"(dynamicContent | keyvalue)?.length\">\n\t\t\t<h5 class=\"ng-doc-title\" ng-doc-text>Content</h5>\n\t\t\t<ng-doc-playground-property\n\t\t\t\t*ngFor=\"let content of dynamicContent | keyvalue\"\n\t\t\t\t[name]=\"content.value.label\"\n\t\t\t\t[property]=\"content.value\"\n\t\t\t\t[control]=\"getFormControl('content', content.key)\"\n\t\t\t>\n\t\t\t</ng-doc-playground-property>\n\t\t</ng-container>\n\t</div>\n</div>\n", styles: [":host .ng-doc-playground-properties-wrapper{position:relative;display:flex}:host .ng-doc-playground-properties-wrapper.vertical{flex-direction:column}:host .ng-doc-playground-properties-wrapper.vertical .ng-doc-playground-demos{margin-right:0;margin-bottom:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-playground-properties-wrapper.vertical .ng-doc-playground-properties{width:100%}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-demos{display:flex;flex-direction:column;width:100%;overflow:hidden;margin-right:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties{flex-shrink:0;width:300px;padding:calc(var(--ng-doc-base-gutter) * 2) calc(var(--ng-doc-base-gutter) * 3);background-color:var(--ng-doc-base-1);border-radius:var(--ng-doc-base-gutter)}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties ng-doc-playground-property:not(:last-child){margin-bottom:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties .ng-doc-playground-controls{display:flex;justify-content:flex-end}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties .ng-doc-playground-header{display:flex;align-items:center;justify-content:space-between;height:40px;margin-bottom:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties .ng-doc-playground-header h4{margin:0}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties .ng-doc-playground-setting{display:flex;flex-direction:column}:host .ng-doc-playground-properties-wrapper .ng-doc-title{margin-top:0;margin-bottom:calc(var(--ng-doc-base-gutter) + var(--ng-doc-base-gutter) / 2)}:host .ng-doc-playground-divider{margin:calc(var(--ng-doc-base-gutter) * 2) 0;height:1px;background-color:var(--ng-doc-base-2)}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgDocTooltipDirective, selector: "[ngDocTooltip]", inputs: ["ngDocTooltip", "delay", "displayOrigin", "pointerOrigin", "positions", "canOpen", "panelClass", "minHeight", "maxHeight", "height", "minWidth", "maxWidth", "width"], outputs: ["beforeOpen", "afterOpen", "beforeClose", "afterClose"], exportAs: ["ngDocTooltip"] }, { kind: "component", type: i4.NgDocIconComponent, selector: "ng-doc-icon", inputs: ["icon", "size"] }, { kind: "component", type: i4.NgDocTextComponent, selector: "[ng-doc-text]", inputs: ["size", "color", "align", "absoluteContent"] }, { kind: "directive", type: i4.NgDocTextRightDirective, selector: "[ngDocTextRight]" }, { kind: "component", type: i4.NgDocCheckboxComponent, selector: "ng-doc-checkbox", inputs: ["color"] }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.NgDocButtonComponent, selector: "button[ng-doc-button], a[ng-doc-button]", inputs: ["size", "color"] }, { kind: "component", type: NgDocPlaygroundPropertyComponent, selector: "ng-doc-playground-property", inputs: ["name", "property", "control"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
139
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundPropertiesComponent, decorators: [{
|
|
140
|
+
type: Component,
|
|
141
|
+
args: [{ selector: 'ng-doc-playground-properties', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ng-doc-playground-properties-wrapper\" [class.vertical]=\"observer | async\">\n\t<div class=\"ng-doc-playground-demos\">\n\t\t<ng-content></ng-content>\n\t</div>\n\t<div class=\"ng-doc-playground-properties\">\n\t\t<div class=\"ng-doc-playground-header\">\n\t\t\t<h4 ng-doc-text>Playground</h4>\n\t\t\t<button ng-doc-button color=\"red\" (click)=\"resetForm.emit()\">Reset</button>\n\t\t</div>\n\t\t<div class=\"ng-doc-playground-setting\">\n\t\t\t<ng-doc-checkbox [(ngModel)]=\"recreateDemo\" (ngModelChange)=\"recreateDemoChange.emit($event)\">\n\t\t\t\t<span\n\t\t\t\t\tng-doc-text\n\t\t\t\t\t[ngDocTooltip]=\"'Recreates demo everytime\\none of the input has changed'\"\n\t\t\t\t\t[positions]=\"['bottom-right', 'left-center']\"\n\t\t\t\t>\n\t\t\t\t\tRecreate\n\t\t\t\t\t<ng-doc-icon icon=\"info\" ngDocTextRight></ng-doc-icon>\n\t\t\t\t</span>\n\t\t\t</ng-doc-checkbox>\n\t\t</div>\n\t\t<div class=\"ng-doc-playground-divider\"></div>\n\t\t<ng-container *ngIf=\"(properties | keyvalue)?.length\">\n\t\t\t<h5 class=\"ng-doc-title\" ng-doc-text>Settings</h5>\n\t\t\t<ng-doc-playground-property\n\t\t\t\t*ngFor=\"let property of properties | keyvalue\"\n\t\t\t\t[name]=\"property.value.name\"\n\t\t\t\t[property]=\"property.value\"\n\t\t\t\t[control]=\"getFormControl('properties', property.key)\"\n\t\t\t>\n\t\t\t</ng-doc-playground-property>\n\t\t</ng-container>\n\n\t\t<ng-container *ngIf=\"(dynamicContent | keyvalue)?.length\">\n\t\t\t<h5 class=\"ng-doc-title\" ng-doc-text>Content</h5>\n\t\t\t<ng-doc-playground-property\n\t\t\t\t*ngFor=\"let content of dynamicContent | keyvalue\"\n\t\t\t\t[name]=\"content.value.label\"\n\t\t\t\t[property]=\"content.value\"\n\t\t\t\t[control]=\"getFormControl('content', content.key)\"\n\t\t\t>\n\t\t\t</ng-doc-playground-property>\n\t\t</ng-container>\n\t</div>\n</div>\n", styles: [":host .ng-doc-playground-properties-wrapper{position:relative;display:flex}:host .ng-doc-playground-properties-wrapper.vertical{flex-direction:column}:host .ng-doc-playground-properties-wrapper.vertical .ng-doc-playground-demos{margin-right:0;margin-bottom:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-playground-properties-wrapper.vertical .ng-doc-playground-properties{width:100%}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-demos{display:flex;flex-direction:column;width:100%;overflow:hidden;margin-right:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties{flex-shrink:0;width:300px;padding:calc(var(--ng-doc-base-gutter) * 2) calc(var(--ng-doc-base-gutter) * 3);background-color:var(--ng-doc-base-1);border-radius:var(--ng-doc-base-gutter)}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties ng-doc-playground-property:not(:last-child){margin-bottom:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties .ng-doc-playground-controls{display:flex;justify-content:flex-end}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties .ng-doc-playground-header{display:flex;align-items:center;justify-content:space-between;height:40px;margin-bottom:calc(var(--ng-doc-base-gutter) * 2)}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties .ng-doc-playground-header h4{margin:0}:host .ng-doc-playground-properties-wrapper .ng-doc-playground-properties .ng-doc-playground-setting{display:flex;flex-direction:column}:host .ng-doc-playground-properties-wrapper .ng-doc-title{margin-top:0;margin-bottom:calc(var(--ng-doc-base-gutter) + var(--ng-doc-base-gutter) / 2)}:host .ng-doc-playground-divider{margin:calc(var(--ng-doc-base-gutter) * 2) 0;height:1px;background-color:var(--ng-doc-base-2)}\n"] }]
|
|
142
|
+
}], ctorParameters: function () { return [{ type: i1.BreakpointObserver }]; }, propDecorators: { form: [{
|
|
143
|
+
type: Input
|
|
144
|
+
}], properties: [{
|
|
145
|
+
type: Input
|
|
146
|
+
}], dynamicContent: [{
|
|
147
|
+
type: Input
|
|
148
|
+
}], recreateDemo: [{
|
|
149
|
+
type: Input
|
|
150
|
+
}], recreateDemoChange: [{
|
|
151
|
+
type: Output
|
|
152
|
+
}], resetForm: [{
|
|
153
|
+
type: Output
|
|
154
|
+
}] } });
|
|
155
|
+
|
|
156
|
+
let NgDocPlaygroundDemoComponent = class NgDocPlaygroundDemoComponent {
|
|
157
|
+
constructor(rootPage, injector) {
|
|
158
|
+
this.rootPage = rootPage;
|
|
159
|
+
this.injector = injector;
|
|
160
|
+
this.id = '';
|
|
161
|
+
this.selector = '';
|
|
162
|
+
this.recreateDemo = false;
|
|
163
|
+
this.code = of('');
|
|
164
|
+
this.unsubscribe$ = new Subject();
|
|
165
|
+
}
|
|
166
|
+
ngOnChanges({ form, id }) {
|
|
167
|
+
if (form && id) {
|
|
168
|
+
this.unsubscribe$.next();
|
|
169
|
+
const demoInjector = getPlaygroundDemoToken(this.id);
|
|
170
|
+
if (demoInjector) {
|
|
171
|
+
const demos = this.injector.get(demoInjector, []);
|
|
172
|
+
this.playgroundDemo = demos.find((demo) => demo.selector === this.selector);
|
|
173
|
+
}
|
|
174
|
+
this.updateDemo();
|
|
175
|
+
this.form?.valueChanges
|
|
176
|
+
.pipe(takeUntil(this.unsubscribe$), untilDestroyed(this))
|
|
177
|
+
.subscribe((data) => this.updateDemo(data));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
updateDemo(data) {
|
|
181
|
+
if (this.recreateDemo || !this.demoRef) {
|
|
182
|
+
this.renderDemo();
|
|
183
|
+
}
|
|
184
|
+
if (data) {
|
|
185
|
+
Object.assign(this.demoRef?.instance.playground ?? {}, data.properties);
|
|
186
|
+
Object.assign(this.demoRef?.instance.content ?? {}, data.content);
|
|
187
|
+
this.demoRef?.instance?.viewContainerRef?.injector.get(ChangeDetectorRef)?.markForCheck();
|
|
188
|
+
}
|
|
189
|
+
this.updateCodeView();
|
|
190
|
+
}
|
|
191
|
+
renderDemo() {
|
|
192
|
+
if (this.playgroundDemo) {
|
|
193
|
+
this.demoRef?.destroy();
|
|
194
|
+
if (this.playgroundDemo) {
|
|
195
|
+
this.demoRef = this.demoOutlet?.createComponent(this.playgroundDemo);
|
|
196
|
+
}
|
|
197
|
+
this.demoRef?.changeDetectorRef.markForCheck();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
updateCodeView() {
|
|
201
|
+
const template = buildPlaygroundDemoTemplate(this.configuration?.template ?? '', this.selector, this.getActiveContent(), this.getActiveInputs());
|
|
202
|
+
this.code = formatHtml(template);
|
|
203
|
+
}
|
|
204
|
+
getActiveContent() {
|
|
205
|
+
const formData = this.form?.controls.content.value ?? {};
|
|
206
|
+
return objectKeys(formData).reduce((result, key) => {
|
|
207
|
+
result[key] = formData[key] ? this.configuration?.content?.[key].template ?? '' : '';
|
|
208
|
+
return result;
|
|
209
|
+
}, {});
|
|
210
|
+
}
|
|
211
|
+
getActiveInputs() {
|
|
212
|
+
const formData = this.form?.controls.properties.value ?? {};
|
|
213
|
+
return objectKeys(formData).reduce((result, key) => {
|
|
214
|
+
const property = this.properties?.[key];
|
|
215
|
+
if (property) {
|
|
216
|
+
const value = formData[key];
|
|
217
|
+
const isString = typeof value === 'string';
|
|
218
|
+
const inputValue = isString ? `'${value}'` : `${JSON.stringify(value)}`;
|
|
219
|
+
if ((property.default ?? '') !== inputValue) {
|
|
220
|
+
result[property.name] = inputValue;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return result;
|
|
224
|
+
}, {});
|
|
225
|
+
}
|
|
226
|
+
ngOnDestroy() {
|
|
227
|
+
this.unsubscribe$.next();
|
|
228
|
+
this.unsubscribe$.complete();
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
NgDocPlaygroundDemoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundDemoComponent, deps: [{ token: i1$1.NgDocRootPage }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
232
|
+
NgDocPlaygroundDemoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: NgDocPlaygroundDemoComponent, selector: "ng-doc-playground-demo", inputs: { id: "id", selector: "selector", configuration: "configuration", properties: "properties", recreateDemo: "recreateDemo", form: "form" }, viewQueries: [{ propertyName: "demoOutlet", first: true, predicate: ["demoOutlet"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-doc-demo-displayer [code]=\"(code | async) ?? ''\" [border]=\"false\" language=\"html\">\n\t<ng-container #demoOutlet></ng-container>\n</ng-doc-demo-displayer>\n", styles: [":host{display:block;border:var(--ng-doc-demo-displayer-border);border-radius:var(--ng-doc-demo-displayer-border-radius);overflow:hidden}:host:not(:last-child){border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}:host:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}\n"], dependencies: [{ kind: "component", type: i2$1.NgDocDemoDisplayerComponent, selector: "ng-doc-demo-displayer", inputs: ["codeContent", "code", "language", "container", "border"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
233
|
+
NgDocPlaygroundDemoComponent = __decorate([
|
|
234
|
+
UntilDestroy(),
|
|
235
|
+
__metadata("design:paramtypes", [NgDocRootPage, Injector])
|
|
236
|
+
], NgDocPlaygroundDemoComponent);
|
|
237
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundDemoComponent, decorators: [{
|
|
238
|
+
type: Component,
|
|
239
|
+
args: [{ selector: 'ng-doc-playground-demo', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-doc-demo-displayer [code]=\"(code | async) ?? ''\" [border]=\"false\" language=\"html\">\n\t<ng-container #demoOutlet></ng-container>\n</ng-doc-demo-displayer>\n", styles: [":host{display:block;border:var(--ng-doc-demo-displayer-border);border-radius:var(--ng-doc-demo-displayer-border-radius);overflow:hidden}:host:not(:last-child){border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}:host:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}\n"] }]
|
|
240
|
+
}], ctorParameters: function () { return [{ type: i1$1.NgDocRootPage }, { type: i0.Injector }]; }, propDecorators: { id: [{
|
|
241
|
+
type: Input
|
|
242
|
+
}], selector: [{
|
|
243
|
+
type: Input
|
|
244
|
+
}], configuration: [{
|
|
245
|
+
type: Input
|
|
246
|
+
}], properties: [{
|
|
247
|
+
type: Input
|
|
248
|
+
}], recreateDemo: [{
|
|
249
|
+
type: Input
|
|
250
|
+
}], form: [{
|
|
251
|
+
type: Input
|
|
252
|
+
}], demoOutlet: [{
|
|
253
|
+
type: ViewChild,
|
|
254
|
+
args: ['demoOutlet', { static: true, read: ViewContainerRef }]
|
|
255
|
+
}] } });
|
|
15
256
|
|
|
16
257
|
class NgDocPlaygroundComponent {
|
|
17
258
|
constructor(rootPage, formBuilder) {
|
|
18
259
|
this.rootPage = rootPage;
|
|
19
260
|
this.formBuilder = formBuilder;
|
|
261
|
+
this.id = '';
|
|
20
262
|
this.selectors = [];
|
|
21
|
-
this.
|
|
263
|
+
this.recreateDemo = false;
|
|
22
264
|
}
|
|
23
265
|
ngOnInit() {
|
|
24
266
|
const propertiesForm = this.formBuilder.group(this.getPropertiesFormValues());
|
|
@@ -29,7 +271,7 @@ class NgDocPlaygroundComponent {
|
|
|
29
271
|
});
|
|
30
272
|
}
|
|
31
273
|
get configuration() {
|
|
32
|
-
return this.
|
|
274
|
+
return this.rootPage.dependencies?.playgrounds?.[this.id];
|
|
33
275
|
}
|
|
34
276
|
getPropertiesFormValues() {
|
|
35
277
|
return objectKeys(this.properties ?? {}).reduce((controls, key) => {
|
|
@@ -40,12 +282,13 @@ class NgDocPlaygroundComponent {
|
|
|
40
282
|
}, {});
|
|
41
283
|
}
|
|
42
284
|
getContentFormValues() {
|
|
43
|
-
return objectKeys(this.configuration?.
|
|
44
|
-
if (this.configuration?.
|
|
285
|
+
return objectKeys(this.configuration?.content ?? {}).reduce((controls, key) => {
|
|
286
|
+
if (this.configuration?.content) {
|
|
45
287
|
controls[key] = false;
|
|
46
288
|
}
|
|
47
289
|
return controls;
|
|
48
290
|
}, {});
|
|
291
|
+
return {};
|
|
49
292
|
}
|
|
50
293
|
resetForm() {
|
|
51
294
|
this.formGroup?.reset({
|
|
@@ -54,38 +297,62 @@ class NgDocPlaygroundComponent {
|
|
|
54
297
|
});
|
|
55
298
|
}
|
|
56
299
|
}
|
|
57
|
-
NgDocPlaygroundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundComponent, deps: [{ token: i1.NgDocRootPage }, { token:
|
|
58
|
-
NgDocPlaygroundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: NgDocPlaygroundComponent, selector: "ng-doc-playground", ngImport: i0, template: "<ng-container *ngIf=\"configuration\">\n\t<ng-doc-playground-properties
|
|
300
|
+
NgDocPlaygroundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundComponent, deps: [{ token: i1$1.NgDocRootPage }, { token: i3.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
|
|
301
|
+
NgDocPlaygroundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: NgDocPlaygroundComponent, selector: "ng-doc-playground", ngImport: i0, template: "<ng-container *ngIf=\"configuration\">\n\t<ng-doc-playground-properties\n\t\t[form]=\"formGroup\"\n\t\t[properties]=\"properties\"\n\t\t[dynamicContent]=\"configuration.content\"\n\t\t[(recreateDemo)]=\"recreateDemo\"\n\t\t(resetForm)=\"resetForm()\"\n\t>\n\t\t<ng-doc-playground-demo\n\t\t\t*ngFor=\"let selector of configuration.selectors ?? selectors | asArray\"\n\t\t\t[id]=\"id\"\n\t\t\t[selector]=\"selector\"\n\t\t\t[properties]=\"properties\"\n\t\t\t[configuration]=\"configuration\"\n\t\t\t[recreateDemo]=\"recreateDemo\"\n\t\t\t[form]=\"formGroup\"\n\t\t>\n\t\t</ng-doc-playground-demo>\n\t</ng-doc-playground-properties>\n</ng-container>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: NgDocPlaygroundPropertiesComponent, selector: "ng-doc-playground-properties", inputs: ["form", "properties", "dynamicContent", "recreateDemo"], outputs: ["recreateDemoChange", "resetForm"] }, { kind: "component", type: NgDocPlaygroundDemoComponent, selector: "ng-doc-playground-demo", inputs: ["id", "selector", "configuration", "properties", "recreateDemo", "form"] }, { kind: "pipe", type: i4.NgDocAsArrayPipe, name: "asArray" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
59
302
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundComponent, decorators: [{
|
|
60
303
|
type: Component,
|
|
61
|
-
args: [{ selector: 'ng-doc-playground', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"configuration\">\n\t<ng-doc-playground-properties
|
|
62
|
-
}], ctorParameters: function () { return [{ type: i1.NgDocRootPage }, { type:
|
|
304
|
+
args: [{ selector: 'ng-doc-playground', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"configuration\">\n\t<ng-doc-playground-properties\n\t\t[form]=\"formGroup\"\n\t\t[properties]=\"properties\"\n\t\t[dynamicContent]=\"configuration.content\"\n\t\t[(recreateDemo)]=\"recreateDemo\"\n\t\t(resetForm)=\"resetForm()\"\n\t>\n\t\t<ng-doc-playground-demo\n\t\t\t*ngFor=\"let selector of configuration.selectors ?? selectors | asArray\"\n\t\t\t[id]=\"id\"\n\t\t\t[selector]=\"selector\"\n\t\t\t[properties]=\"properties\"\n\t\t\t[configuration]=\"configuration\"\n\t\t\t[recreateDemo]=\"recreateDemo\"\n\t\t\t[form]=\"formGroup\"\n\t\t>\n\t\t</ng-doc-playground-demo>\n\t</ng-doc-playground-properties>\n</ng-container>\n", styles: [":host{display:block}\n"] }]
|
|
305
|
+
}], ctorParameters: function () { return [{ type: i1$1.NgDocRootPage }, { type: i3.FormBuilder }]; } });
|
|
63
306
|
|
|
64
307
|
class NgDocPlaygroundModule {
|
|
65
308
|
}
|
|
66
309
|
NgDocPlaygroundModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
67
|
-
NgDocPlaygroundModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundModule, declarations: [NgDocPlaygroundComponent], imports: [CommonModule,
|
|
310
|
+
NgDocPlaygroundModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundModule, declarations: [NgDocPlaygroundComponent, NgDocPlaygroundPropertyComponent, NgDocPlaygroundPropertiesComponent, NgDocPlaygroundDemoComponent], imports: [CommonModule,
|
|
68
311
|
ReactiveFormsModule,
|
|
312
|
+
NgDocLabelModule,
|
|
313
|
+
NgDocTooltipModule,
|
|
314
|
+
PolymorpheusModule,
|
|
69
315
|
NgDocAsArrayModule,
|
|
70
|
-
|
|
71
|
-
|
|
316
|
+
NgDocButtonIconModule,
|
|
317
|
+
NgDocIconModule,
|
|
318
|
+
NgDocTextModule,
|
|
319
|
+
NgDocCheckboxModule,
|
|
320
|
+
FormsModule,
|
|
321
|
+
NgDocButtonModule,
|
|
322
|
+
NgDocDemoDisplayerModule], exports: [NgDocPlaygroundComponent, NgDocPlaygroundPropertyComponent, NgDocPlaygroundPropertiesComponent, NgDocPlaygroundDemoComponent] });
|
|
72
323
|
NgDocPlaygroundModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundModule, imports: [CommonModule,
|
|
73
324
|
ReactiveFormsModule,
|
|
325
|
+
NgDocLabelModule,
|
|
326
|
+
NgDocTooltipModule,
|
|
327
|
+
PolymorpheusModule,
|
|
74
328
|
NgDocAsArrayModule,
|
|
75
|
-
|
|
76
|
-
|
|
329
|
+
NgDocButtonIconModule,
|
|
330
|
+
NgDocIconModule,
|
|
331
|
+
NgDocTextModule,
|
|
332
|
+
NgDocCheckboxModule,
|
|
333
|
+
FormsModule,
|
|
334
|
+
NgDocButtonModule,
|
|
335
|
+
NgDocDemoDisplayerModule] });
|
|
77
336
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NgDocPlaygroundModule, decorators: [{
|
|
78
337
|
type: NgModule,
|
|
79
338
|
args: [{
|
|
80
|
-
declarations: [NgDocPlaygroundComponent],
|
|
339
|
+
declarations: [NgDocPlaygroundComponent, NgDocPlaygroundPropertyComponent, NgDocPlaygroundPropertiesComponent, NgDocPlaygroundDemoComponent],
|
|
81
340
|
imports: [
|
|
82
341
|
CommonModule,
|
|
83
342
|
ReactiveFormsModule,
|
|
343
|
+
NgDocLabelModule,
|
|
344
|
+
NgDocTooltipModule,
|
|
345
|
+
PolymorpheusModule,
|
|
84
346
|
NgDocAsArrayModule,
|
|
85
|
-
|
|
86
|
-
|
|
347
|
+
NgDocButtonIconModule,
|
|
348
|
+
NgDocIconModule,
|
|
349
|
+
NgDocTextModule,
|
|
350
|
+
NgDocCheckboxModule,
|
|
351
|
+
FormsModule,
|
|
352
|
+
NgDocButtonModule,
|
|
353
|
+
NgDocDemoDisplayerModule,
|
|
87
354
|
],
|
|
88
|
-
exports: [NgDocPlaygroundComponent],
|
|
355
|
+
exports: [NgDocPlaygroundComponent, NgDocPlaygroundPropertyComponent, NgDocPlaygroundPropertiesComponent, NgDocPlaygroundDemoComponent],
|
|
89
356
|
}]
|
|
90
357
|
}] });
|
|
91
358
|
|
|
@@ -93,5 +360,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
|
|
|
93
360
|
* Generated bundle index. Do not edit.
|
|
94
361
|
*/
|
|
95
362
|
|
|
96
|
-
export { NgDocPlaygroundComponent, NgDocPlaygroundModule };
|
|
363
|
+
export { NgDocBasePlayground, NgDocPlaygroundComponent, NgDocPlaygroundDemoComponent, NgDocPlaygroundModule, NgDocPlaygroundPropertiesComponent, NgDocPlaygroundPropertyComponent };
|
|
97
364
|
//# sourceMappingURL=ng-doc-app-components-playground.mjs.map
|