@firestitch/content 12.3.5 → 13.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/app/modules/content-layouts/components/content-layout/content-layout.component.d.ts +1 -1
  2. package/app/modules/content-pages/components/content-page-editor/content-page-editor.component.d.ts +1 -0
  3. package/app/modules/content-pages/fs-content-pages.module.d.ts +21 -20
  4. package/{esm2015/app/modules/content/components/content/content.component.js → esm2020/app/modules/content/components/content/content.component.mjs} +5 -10
  5. package/{esm2015/app/modules/content/components/content-renderer/content-renderer.component.js → esm2020/app/modules/content/components/content-renderer/content-renderer.component.mjs} +5 -10
  6. package/{esm2015/app/modules/content/fs-content.module.js → esm2020/app/modules/content/fs-content.module.mjs} +5 -5
  7. package/esm2020/app/modules/content-layouts/components/content-layout/content-layout.component.mjs +68 -0
  8. package/esm2020/app/modules/content-layouts/components/content-layout-editor/content-layout-editor.component.mjs +162 -0
  9. package/esm2020/app/modules/content-layouts/components/content-layouts/content-layouts.component.mjs +116 -0
  10. package/{esm2015/app/modules/content-layouts/fs-content-layouts.module.js → esm2020/app/modules/content-layouts/fs-content-layouts.module.mjs} +5 -5
  11. package/esm2020/app/modules/content-pages/components/content-page/content-page.component.mjs +81 -0
  12. package/esm2020/app/modules/content-pages/components/content-page-editor/content-page-editor.component.mjs +179 -0
  13. package/esm2020/app/modules/content-pages/components/content-pages/content-pages.component.mjs +125 -0
  14. package/esm2020/app/modules/content-pages/fs-content-pages.module.mjs +121 -0
  15. package/esm2020/app/modules/content-style/components/content-style/content-style.component.mjs +69 -0
  16. package/{esm2015/app/modules/content-style/fs-content-style.module.js → esm2020/app/modules/content-style/fs-content-style.module.mjs} +5 -5
  17. package/esm2020/app/modules/editor/components/editor/editor.component.mjs +144 -0
  18. package/esm2020/app/modules/editor/components/editor-label/editor-label.component.mjs +16 -0
  19. package/{esm2015/app/modules/editor/fs-content-editor.module.js → esm2020/app/modules/editor/fs-content-editor.module.mjs} +5 -5
  20. package/fesm2015/firestitch-content.mjs +1344 -0
  21. package/fesm2015/firestitch-content.mjs.map +1 -0
  22. package/fesm2020/firestitch-content.mjs +1345 -0
  23. package/fesm2020/firestitch-content.mjs.map +1 -0
  24. package/package.json +21 -8
  25. package/bundles/firestitch-content.umd.js +0 -1482
  26. package/bundles/firestitch-content.umd.js.map +0 -1
  27. package/esm2015/app/modules/content-layouts/components/content-layout/content-layout.component.js +0 -72
  28. package/esm2015/app/modules/content-layouts/components/content-layout-editor/content-layout-editor.component.js +0 -160
  29. package/esm2015/app/modules/content-layouts/components/content-layouts/content-layouts.component.js +0 -121
  30. package/esm2015/app/modules/content-pages/components/content-page/content-page.component.js +0 -83
  31. package/esm2015/app/modules/content-pages/components/content-page-editor/content-page-editor.component.js +0 -176
  32. package/esm2015/app/modules/content-pages/components/content-pages/content-pages.component.js +0 -130
  33. package/esm2015/app/modules/content-pages/fs-content-pages.module.js +0 -117
  34. package/esm2015/app/modules/content-style/components/content-style/content-style.component.js +0 -71
  35. package/esm2015/app/modules/editor/components/editor/editor.component.js +0 -149
  36. package/esm2015/app/modules/editor/components/editor-label/editor-label.component.js +0 -21
  37. package/fesm2015/firestitch-content.js +0 -1376
  38. package/fesm2015/firestitch-content.js.map +0 -1
  39. /package/{esm2015/app/consts/index.js → esm2020/app/consts/index.mjs} +0 -0
  40. /package/{esm2015/app/consts/page-types.const.js → esm2020/app/consts/page-types.const.mjs} +0 -0
  41. /package/{esm2015/app/enums/editor-type.js → esm2020/app/enums/editor-type.mjs} +0 -0
  42. /package/{esm2015/app/enums/index.js → esm2020/app/enums/index.mjs} +0 -0
  43. /package/{esm2015/app/enums/page-type.enum.js → esm2020/app/enums/page-type.enum.mjs} +0 -0
  44. /package/{esm2015/app/injectors/content-config.injector.js → esm2020/app/injectors/content-config.injector.mjs} +0 -0
  45. /package/{esm2015/app/injectors/index.js → esm2020/app/injectors/index.mjs} +0 -0
  46. /package/{esm2015/app/interfaces/content-config.js → esm2020/app/interfaces/content-config.mjs} +0 -0
  47. /package/{esm2015/app/interfaces/content-layout.js → esm2020/app/interfaces/content-layout.mjs} +0 -0
  48. /package/{esm2015/app/interfaces/content-page.js → esm2020/app/interfaces/content-page.mjs} +0 -0
  49. /package/{esm2015/app/interfaces/content-style.js → esm2020/app/interfaces/content-style.mjs} +0 -0
  50. /package/{esm2015/app/interfaces/index.js → esm2020/app/interfaces/index.mjs} +0 -0
  51. /package/{esm2015/app/modules/content/components/content/index.js → esm2020/app/modules/content/components/content/index.mjs} +0 -0
  52. /package/{esm2015/app/modules/content/components/content-renderer/index.js → esm2020/app/modules/content/components/content-renderer/index.mjs} +0 -0
  53. /package/{esm2015/app/modules/content-layouts/components/content-layout/index.js → esm2020/app/modules/content-layouts/components/content-layout/index.mjs} +0 -0
  54. /package/{esm2015/app/modules/content-layouts/components/content-layout-editor/index.js → esm2020/app/modules/content-layouts/components/content-layout-editor/index.mjs} +0 -0
  55. /package/{esm2015/app/modules/content-layouts/components/content-layouts/index.js → esm2020/app/modules/content-layouts/components/content-layouts/index.mjs} +0 -0
  56. /package/{esm2015/app/modules/content-layouts/components/index.js → esm2020/app/modules/content-layouts/components/index.mjs} +0 -0
  57. /package/{esm2015/app/modules/content-pages/components/content-page/index.js → esm2020/app/modules/content-pages/components/content-page/index.mjs} +0 -0
  58. /package/{esm2015/app/modules/content-pages/components/content-page-editor/index.js → esm2020/app/modules/content-pages/components/content-page-editor/index.mjs} +0 -0
  59. /package/{esm2015/app/modules/content-pages/components/content-pages/index.js → esm2020/app/modules/content-pages/components/content-pages/index.mjs} +0 -0
  60. /package/{esm2015/app/modules/content-pages/components/index.js → esm2020/app/modules/content-pages/components/index.mjs} +0 -0
  61. /package/{esm2015/app/modules/content-style/components/content-style/index.js → esm2020/app/modules/content-style/components/content-style/index.mjs} +0 -0
  62. /package/{esm2015/app/modules/editor/components/editor/index.js → esm2020/app/modules/editor/components/editor/index.mjs} +0 -0
  63. /package/{esm2015/app/modules/editor/components/editor-label/index.js → esm2020/app/modules/editor/components/editor-label/index.mjs} +0 -0
  64. /package/{esm2015/app/modules/editor/index.js → esm2020/app/modules/editor/index.mjs} +0 -0
  65. /package/{esm2015/firestitch-content.js → esm2020/firestitch-content.mjs} +0 -0
  66. /package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
@@ -0,0 +1,1344 @@
1
+ import * as i1 from '@angular/common';
2
+ import { CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { Component, ChangeDetectionStrategy, Input, EventEmitter, Output, NgModule, InjectionToken, Inject, ViewChildren, ViewChild, ElementRef } from '@angular/core';
5
+ import * as i9 from '@angular/forms';
6
+ import { FormsModule } from '@angular/forms';
7
+ import * as i5$1 from '@angular/material/button';
8
+ import { MatButtonModule } from '@angular/material/button';
9
+ import * as i8$2 from '@angular/material/button-toggle';
10
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
11
+ import * as i1$1 from '@angular/material/dialog';
12
+ import { MatDialogModule, MAT_DIALOG_DATA } from '@angular/material/dialog';
13
+ import * as i4$1 from '@angular/material/form-field';
14
+ import { MatFormFieldModule } from '@angular/material/form-field';
15
+ import * as i6 from '@angular/material/icon';
16
+ import { MatIconModule } from '@angular/material/icon';
17
+ import * as i8$1 from '@angular/material/input';
18
+ import { MatInputModule } from '@angular/material/input';
19
+ import * as i5$2 from '@angular/material/select';
20
+ import { MatSelectModule } from '@angular/material/select';
21
+ import { MatTabsModule } from '@angular/material/tabs';
22
+ import * as i3$2 from '@firestitch/date';
23
+ import { FsDateModule } from '@firestitch/date';
24
+ import * as i3 from '@firestitch/dialog';
25
+ import { FsDialogModule } from '@firestitch/dialog';
26
+ import * as i5 from '@firestitch/form';
27
+ import { FsFormModule, FsFormDirective } from '@firestitch/form';
28
+ import { FsHtmlEditorModule } from '@firestitch/html-editor';
29
+ import { FsLabelModule } from '@firestitch/label';
30
+ import * as i2$2 from '@firestitch/list';
31
+ import { FsListModule, FsListComponent } from '@firestitch/list';
32
+ import * as i8 from '@firestitch/skeleton';
33
+ import { FsSkeletonModule } from '@firestitch/skeleton';
34
+ import * as i4 from '@firestitch/text-editor';
35
+ import { FsTextEditorModule, FsTextEditorComponent } from '@firestitch/text-editor';
36
+ import * as i7 from '@firestitch/common';
37
+ import { FsCommonModule, index } from '@firestitch/common';
38
+ import * as i2$1 from 'angular-split';
39
+ import { AngularSplitModule } from 'angular-split';
40
+ import { Subject, of, throwError, fromEvent } from 'rxjs';
41
+ import { tap, switchMap, takeUntil, filter, map, finalize } from 'rxjs/operators';
42
+ import * as i2 from '@firestitch/message';
43
+ import * as i3$1 from '@firestitch/prompt';
44
+ import { ItemType } from '@firestitch/filter';
45
+ import * as i2$3 from '@angular/router';
46
+ import { RouterModule, NavigationEnd } from '@angular/router';
47
+ import * as i12 from '@angular/material/tooltip';
48
+ import { MatTooltipModule } from '@angular/material/tooltip';
49
+ import * as i6$1 from '@angular/material/core';
50
+ import * as i1$2 from '@angular/platform-browser';
51
+ import * as i3$3 from '@firestitch/html';
52
+
53
+ var EditorType;
54
+ (function (EditorType) {
55
+ EditorType["Js"] = "js";
56
+ EditorType["Html"] = "html";
57
+ EditorType["Scss"] = "scss";
58
+ EditorType["GlobalScss"] = "globalScss";
59
+ })(EditorType || (EditorType = {}));
60
+
61
+ var PageType;
62
+ (function (PageType) {
63
+ PageType["StandardPage"] = "standardPage";
64
+ PageType["BlogPost"] = "blogPost";
65
+ PageType["HomePage"] = "homePage";
66
+ PageType["NotFoundPage"] = "notFoundPage";
67
+ })(PageType || (PageType = {}));
68
+
69
+ class EditorLabelComponent {
70
+ }
71
+ EditorLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: EditorLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
72
+ EditorLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: EditorLabelComponent, selector: "app-editor-label", inputs: { changed: "changed", focused: "focused" }, ngImport: i0, template: "<div class=\"label\" [ngClass]=\"{ focused: focused }\">\n <ng-content></ng-content>\n <span *ngIf=\"changed\" class=\"changed\">&nbsp;&#9679;</span>\n</div>\n", styles: [".label{display:inline-block;background-color:#1e1e1e;color:#c8c8c8;padding:3px 9px 2px;border-top-left-radius:6px;border-top-right-radius:6px;font-size:80%;text-transform:uppercase}.label.focused{color:#fff}.label .changed{font-size:110%;line-height:0}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
73
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: EditorLabelComponent, decorators: [{
74
+ type: Component,
75
+ args: [{ selector: 'app-editor-label', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"label\" [ngClass]=\"{ focused: focused }\">\n <ng-content></ng-content>\n <span *ngIf=\"changed\" class=\"changed\">&nbsp;&#9679;</span>\n</div>\n", styles: [".label{display:inline-block;background-color:#1e1e1e;color:#c8c8c8;padding:3px 9px 2px;border-top-left-radius:6px;border-top-right-radius:6px;font-size:80%;text-transform:uppercase}.label.focused{color:#fff}.label .changed{font-size:110%;line-height:0}\n"] }]
76
+ }], propDecorators: { changed: [{
77
+ type: Input
78
+ }], focused: [{
79
+ type: Input
80
+ }] } });
81
+
82
+ class EditorComponent {
83
+ constructor(_cdRef, _message) {
84
+ this._cdRef = _cdRef;
85
+ this._message = _message;
86
+ this.showHtml = false;
87
+ this.showScss = false;
88
+ this.showJs = false;
89
+ this.showGlobalScss = false;
90
+ this.changed = new EventEmitter();
91
+ this.focused = new EventEmitter();
92
+ this.blured = new EventEmitter();
93
+ this.changes = {};
94
+ this.EditorType = EditorType;
95
+ this.resizing = false;
96
+ this._destroy$ = new Subject();
97
+ }
98
+ ngOnInit() {
99
+ this.initTextEditors();
100
+ this.initGlobalContentStyle();
101
+ }
102
+ ngOnDestroy() {
103
+ this._destroy$.next();
104
+ this._destroy$.complete();
105
+ }
106
+ change(type, value) {
107
+ this.changed.emit({ type, value });
108
+ this.changes[type] = value;
109
+ }
110
+ get hasChanges() {
111
+ return Object.keys(this.changes)
112
+ .filter((name) => !!this.changes[name])
113
+ .length !== 0;
114
+ }
115
+ clearChange(type) {
116
+ this.changes[type] = undefined;
117
+ this._cdRef.markForCheck();
118
+ }
119
+ initTextEditors() {
120
+ this.scssConfig = {
121
+ tabSize: 2,
122
+ language: 'scss',
123
+ height: '100%',
124
+ focus: () => {
125
+ this._onFocus(EditorType.Scss);
126
+ },
127
+ blur: () => {
128
+ this.blured.emit(EditorType.Scss);
129
+ },
130
+ };
131
+ this.jsConfig = {
132
+ tabSize: 2,
133
+ language: 'js',
134
+ height: '100%',
135
+ focus: () => {
136
+ this._onFocus(EditorType.Js);
137
+ },
138
+ blur: () => {
139
+ this.blured.emit(EditorType.Js);
140
+ },
141
+ };
142
+ this.htmlConfig = {
143
+ tabSize: 2,
144
+ language: 'html',
145
+ height: '100%',
146
+ focus: () => {
147
+ this._onFocus(EditorType.Html);
148
+ },
149
+ blur: () => {
150
+ this.blured.emit(EditorType.Html);
151
+ },
152
+ };
153
+ this.globalScssConfig = {
154
+ tabSize: 2,
155
+ language: 'scss',
156
+ height: '100%',
157
+ focus: () => {
158
+ this._onFocus(EditorType.GlobalScss);
159
+ },
160
+ blur: () => {
161
+ this.blured.emit(EditorType.GlobalScss);
162
+ },
163
+ };
164
+ }
165
+ initGlobalContentStyle() {
166
+ this.contentConfig.loadContentStyle()
167
+ .subscribe((contentStyle) => {
168
+ this.contentStyle = contentStyle || {};
169
+ this._cdRef.markForCheck();
170
+ });
171
+ }
172
+ saveGlobalScss() {
173
+ return this.contentConfig.saveContentStyle(this.contentStyle)
174
+ .pipe(tap(() => {
175
+ this._message.success('Saved Changes');
176
+ }));
177
+ }
178
+ _onFocus(type) {
179
+ this.focusedArea = type;
180
+ this.focused.emit(type);
181
+ }
182
+ }
183
+ EditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: EditorComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i2.FsMessage }], target: i0.ɵɵFactoryTarget.Component });
184
+ EditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: EditorComponent, selector: "app-editor", inputs: { showHtml: "showHtml", showScss: "showScss", showJs: "showJs", showGlobalScss: "showGlobalScss", html: "html", scss: "scss", js: "js", contentConfig: "contentConfig" }, outputs: { changed: "changed", focused: "focused", blured: "blured" }, ngImport: i0, template: "<as-split [unit]=\"'percent'\" [gutterSize]=\"25\"> \n <as-split-area [size]=\"70\" [visible]=\"showHtml\" [order]=\"1\">\n <div class=\"editor-container\">\n <app-editor-label\n [changed]=\"changes.html !== undefined\"\n [focused]=\"focusedArea === 'html'\">\n HTML\n </app-editor-label>\n <fs-text-editor \n [(ngModel)]=\"html\" \n name=\"html\"\n [fsModelChangeOptions]=\"{ debounce: 0 }\"\n (fsModelChange)=\"change(EditorType.Html, $event)\"\n [config]=\"htmlConfig\">\n </fs-text-editor> \n </div>\n </as-split-area>\n <as-split-area [size]=\"30\" [visible]=\"showScss\" [order]=\"2\">\n <div class=\"editor-container\">\n <app-editor-label\n [changed]=\"changes.scss !== undefined\"\n [focused]=\"focusedArea === 'scss'\">\n SCSS\n </app-editor-label>\n <fs-text-editor \n [(ngModel)]=\"scss\" \n name=\"scss\"\n [fsModelChangeOptions]=\"{ debounce: 0 }\"\n (fsModelChange)=\"change(EditorType.Scss, $event)\"\n [config]=\"scssConfig\">\n </fs-text-editor> \n </div>\n </as-split-area>\n <as-split-area [size]=\"30\" [visible]=\"showJs\" [order]=\"3\">\n <div class=\"editor-container\">\n <app-editor-label\n [changed]=\"changes.js !== undefined\"\n [focused]=\"focusedArea === 'js'\">\n JS\n </app-editor-label>\n <fs-text-editor \n [(ngModel)]=\"js\" \n name=\"js\"\n [fsModelChangeOptions]=\"{ debounce: 0 }\"\n (fsModelChange)=\"change(EditorType.Js, $event)\"\n [config]=\"jsConfig\">\n </fs-text-editor> \n </div>\n </as-split-area>\n <as-split-area [size]=\"30\" [visible]=\"showGlobalScss\" [order]=\"4\">\n <div class=\"editor-container\">\n <app-editor-label\n [changed]=\"changes.globalScss !== undefined\"\n [focused]=\"focusedArea === 'globalScss'\">\n Global SCSS\n </app-editor-label>\n <ng-container *fsSkeleton=\"contentStyle\">\n <fs-text-editor \n [(ngModel)]=\"contentStyle.scss\" \n name=\"globalScss\"\n [fsModelChangeOptions]=\"{ debounce: 300 }\"\n (fsModelChange)=\"change(EditorType.GlobalScss, $event)\"\n [config]=\"globalScssConfig\">\n </fs-text-editor> \n </ng-container> \n </div>\n </as-split-area>\n</as-split>\n", styles: [":host ::ng-deep .as-split-gutter{background-color:unset!important}.editor-container{height:100%;border-radius:5px;display:flex;flex-direction:column}.editor-container fs-text-editor{flex:1}\n"], components: [{ type: i2$1.SplitComponent, selector: "as-split", inputs: ["direction", "unit", "gutterSize", "gutterStep", "restrictMove", "useTransition", "disabled", "dir", "gutterDblClickDuration", "gutterClickDeltaPx", "gutterAriaLabel"], outputs: ["transitionEnd", "dragStart", "dragEnd", "gutterClick", "gutterDblClick"], exportAs: ["asSplit"] }, { type: EditorLabelComponent, selector: "app-editor-label", inputs: ["changed", "focused"] }, { type: i4.FsTextEditorComponent, selector: "fs-text-editor", inputs: ["config", "scrollable"], outputs: ["ready", "blur"] }], directives: [{ type: i2$1.SplitAreaDirective, selector: "as-split-area, [as-split-area]", inputs: ["order", "size", "minSize", "maxSize", "lockSize", "visible"], exportAs: ["asSplitArea"] }, { type: i9.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i9.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i5.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i7.FsModelChangeDirective, selector: "[fsModelChange]", inputs: ["fsModelChangeOptions"], outputs: ["fsModelChange"] }, { type: i8.FsSkeletonContentDirective, selector: "[fsSkeleton]", inputs: ["fsSkeleton", "fsSkeletonPattern"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
185
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: EditorComponent, decorators: [{
186
+ type: Component,
187
+ args: [{ selector: 'app-editor', changeDetection: ChangeDetectionStrategy.OnPush, template: "<as-split [unit]=\"'percent'\" [gutterSize]=\"25\"> \n <as-split-area [size]=\"70\" [visible]=\"showHtml\" [order]=\"1\">\n <div class=\"editor-container\">\n <app-editor-label\n [changed]=\"changes.html !== undefined\"\n [focused]=\"focusedArea === 'html'\">\n HTML\n </app-editor-label>\n <fs-text-editor \n [(ngModel)]=\"html\" \n name=\"html\"\n [fsModelChangeOptions]=\"{ debounce: 0 }\"\n (fsModelChange)=\"change(EditorType.Html, $event)\"\n [config]=\"htmlConfig\">\n </fs-text-editor> \n </div>\n </as-split-area>\n <as-split-area [size]=\"30\" [visible]=\"showScss\" [order]=\"2\">\n <div class=\"editor-container\">\n <app-editor-label\n [changed]=\"changes.scss !== undefined\"\n [focused]=\"focusedArea === 'scss'\">\n SCSS\n </app-editor-label>\n <fs-text-editor \n [(ngModel)]=\"scss\" \n name=\"scss\"\n [fsModelChangeOptions]=\"{ debounce: 0 }\"\n (fsModelChange)=\"change(EditorType.Scss, $event)\"\n [config]=\"scssConfig\">\n </fs-text-editor> \n </div>\n </as-split-area>\n <as-split-area [size]=\"30\" [visible]=\"showJs\" [order]=\"3\">\n <div class=\"editor-container\">\n <app-editor-label\n [changed]=\"changes.js !== undefined\"\n [focused]=\"focusedArea === 'js'\">\n JS\n </app-editor-label>\n <fs-text-editor \n [(ngModel)]=\"js\" \n name=\"js\"\n [fsModelChangeOptions]=\"{ debounce: 0 }\"\n (fsModelChange)=\"change(EditorType.Js, $event)\"\n [config]=\"jsConfig\">\n </fs-text-editor> \n </div>\n </as-split-area>\n <as-split-area [size]=\"30\" [visible]=\"showGlobalScss\" [order]=\"4\">\n <div class=\"editor-container\">\n <app-editor-label\n [changed]=\"changes.globalScss !== undefined\"\n [focused]=\"focusedArea === 'globalScss'\">\n Global SCSS\n </app-editor-label>\n <ng-container *fsSkeleton=\"contentStyle\">\n <fs-text-editor \n [(ngModel)]=\"contentStyle.scss\" \n name=\"globalScss\"\n [fsModelChangeOptions]=\"{ debounce: 300 }\"\n (fsModelChange)=\"change(EditorType.GlobalScss, $event)\"\n [config]=\"globalScssConfig\">\n </fs-text-editor> \n </ng-container> \n </div>\n </as-split-area>\n</as-split>\n", styles: [":host ::ng-deep .as-split-gutter{background-color:unset!important}.editor-container{height:100%;border-radius:5px;display:flex;flex-direction:column}.editor-container fs-text-editor{flex:1}\n"] }]
188
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i2.FsMessage }]; }, propDecorators: { showHtml: [{
189
+ type: Input
190
+ }], showScss: [{
191
+ type: Input
192
+ }], showJs: [{
193
+ type: Input
194
+ }], showGlobalScss: [{
195
+ type: Input
196
+ }], html: [{
197
+ type: Input
198
+ }], scss: [{
199
+ type: Input
200
+ }], js: [{
201
+ type: Input
202
+ }], contentConfig: [{
203
+ type: Input
204
+ }], changed: [{
205
+ type: Output
206
+ }], focused: [{
207
+ type: Output
208
+ }], blured: [{
209
+ type: Output
210
+ }] } });
211
+
212
+ class FsContentEditorModule {
213
+ }
214
+ FsContentEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
215
+ FsContentEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentEditorModule, declarations: [EditorComponent,
216
+ EditorLabelComponent], imports: [CommonModule,
217
+ FormsModule,
218
+ MatDialogModule,
219
+ MatButtonModule,
220
+ MatTabsModule,
221
+ MatIconModule,
222
+ MatButtonToggleModule,
223
+ FsListModule,
224
+ FsFormModule,
225
+ FsSkeletonModule,
226
+ FsLabelModule,
227
+ FsHtmlEditorModule,
228
+ FsCommonModule,
229
+ FsDialogModule,
230
+ FsTextEditorModule,
231
+ AngularSplitModule], exports: [EditorComponent] });
232
+ FsContentEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentEditorModule, imports: [[
233
+ CommonModule,
234
+ FormsModule,
235
+ MatDialogModule,
236
+ MatButtonModule,
237
+ MatTabsModule,
238
+ MatIconModule,
239
+ MatButtonToggleModule,
240
+ FsListModule,
241
+ FsFormModule,
242
+ FsSkeletonModule,
243
+ FsLabelModule,
244
+ FsHtmlEditorModule,
245
+ FsCommonModule,
246
+ FsDialogModule,
247
+ FsTextEditorModule,
248
+ AngularSplitModule,
249
+ ]] });
250
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentEditorModule, decorators: [{
251
+ type: NgModule,
252
+ args: [{
253
+ imports: [
254
+ CommonModule,
255
+ FormsModule,
256
+ MatDialogModule,
257
+ MatButtonModule,
258
+ MatTabsModule,
259
+ MatIconModule,
260
+ MatButtonToggleModule,
261
+ FsListModule,
262
+ FsFormModule,
263
+ FsSkeletonModule,
264
+ FsLabelModule,
265
+ FsHtmlEditorModule,
266
+ FsCommonModule,
267
+ FsDialogModule,
268
+ FsTextEditorModule,
269
+ AngularSplitModule,
270
+ ],
271
+ exports: [
272
+ EditorComponent,
273
+ ],
274
+ declarations: [
275
+ EditorComponent,
276
+ EditorLabelComponent,
277
+ ],
278
+ }]
279
+ }] });
280
+
281
+ const FS_CONTENT_CONFIG = new InjectionToken('fs-content-config');
282
+
283
+ class ContentLayoutComponent {
284
+ constructor(_config, _data, _dialogRef, _message, _cdRef) {
285
+ this._config = _config;
286
+ this._data = _data;
287
+ this._dialogRef = _dialogRef;
288
+ this._message = _message;
289
+ this._cdRef = _cdRef;
290
+ this.contentLayout = null;
291
+ this.editors = { content: true, styles: true };
292
+ this._destroy$ = new Subject();
293
+ this.save = () => {
294
+ return this._config.saveContentLayout(this.contentLayout)
295
+ .pipe(tap((contentLayout) => {
296
+ this._message.success('Saved Changes');
297
+ this._dialogRef.close(contentLayout);
298
+ }));
299
+ };
300
+ }
301
+ ngOnInit() {
302
+ this._fetchData();
303
+ }
304
+ ngOnDestroy() {
305
+ this._destroy$.next();
306
+ this._destroy$.complete();
307
+ }
308
+ _fetchData() {
309
+ of(this._data.contentLayout)
310
+ .pipe(switchMap((contentLayout) => {
311
+ return of(contentLayout);
312
+ }), takeUntil(this._destroy$))
313
+ .subscribe((contentLayout) => {
314
+ this.contentLayout = Object.assign({}, contentLayout);
315
+ this._cdRef.markForCheck();
316
+ });
317
+ }
318
+ }
319
+ ContentLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentLayoutComponent, deps: [{ token: FS_CONTENT_CONFIG }, { token: MAT_DIALOG_DATA }, { token: i1$1.MatDialogRef }, { token: i2.FsMessage }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
320
+ ContentLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: ContentLayoutComponent, selector: "ng-component", viewQueries: [{ propertyName: "textEditors", predicate: FsTextEditorComponent, descendants: true }], ngImport: i0, template: "<form fsForm [submit]=\"save\" *fsSkeletonForm=\"contentLayout\">\n <fs-dialog>\n <h1 mat-dialog-title>{{contentLayout.id ? 'Layout' : 'Layout Page'}}</h1>\n <div mat-dialog-content>\n <div class=\"fs-column\">\n <mat-form-field>\n <mat-label>Name</mat-label>\n <input\n matInput\n [(ngModel)]=\"contentLayout.name\"\n name=\"name\"\n required>\n </mat-form-field>\n <mat-form-field>\n <mat-label>Tag</mat-label>\n <input\n matInput\n [(ngModel)]=\"contentLayout.tag\"\n name=\"tag\">\n </mat-form-field>\n </div>\n </div>\n\n <div mat-dialog-actions>\n <fs-form-dialog-actions>\n </fs-form-dialog-actions>\n </div>\n </fs-dialog>\n</form>\n", styles: [""], components: [{ type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }, { type: i4$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i5.FsFormDialogActionsComponent, selector: "fs-form-dialog-actions", inputs: ["save", "create", "close", "done", "closeData", "name"] }], directives: [{ type: i8.FsSkeletonFormDirective, selector: "[fsSkeletonForm]", inputs: ["fsSkeletonForm", "fsSkeletonFormLines"] }, { type: i9.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i9.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i9.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup", "deactivationGuard"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"], exportAs: ["fsForm"] }, { type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i4$1.MatLabel, selector: "mat-label" }, { type: i8$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i9.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i9.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i9.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i9.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i5.FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: ["fsFormRequired", "required", "fsFormRequiredMessage"] }, { type: i5.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
321
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentLayoutComponent, decorators: [{
322
+ type: Component,
323
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<form fsForm [submit]=\"save\" *fsSkeletonForm=\"contentLayout\">\n <fs-dialog>\n <h1 mat-dialog-title>{{contentLayout.id ? 'Layout' : 'Layout Page'}}</h1>\n <div mat-dialog-content>\n <div class=\"fs-column\">\n <mat-form-field>\n <mat-label>Name</mat-label>\n <input\n matInput\n [(ngModel)]=\"contentLayout.name\"\n name=\"name\"\n required>\n </mat-form-field>\n <mat-form-field>\n <mat-label>Tag</mat-label>\n <input\n matInput\n [(ngModel)]=\"contentLayout.tag\"\n name=\"tag\">\n </mat-form-field>\n </div>\n </div>\n\n <div mat-dialog-actions>\n <fs-form-dialog-actions>\n </fs-form-dialog-actions>\n </div>\n </fs-dialog>\n</form>\n", styles: [""] }]
324
+ }], ctorParameters: function () {
325
+ return [{ type: undefined, decorators: [{
326
+ type: Inject,
327
+ args: [FS_CONTENT_CONFIG]
328
+ }] }, { type: undefined, decorators: [{
329
+ type: Inject,
330
+ args: [MAT_DIALOG_DATA]
331
+ }] }, { type: i1$1.MatDialogRef }, { type: i2.FsMessage }, { type: i0.ChangeDetectorRef }];
332
+ }, propDecorators: { textEditors: [{
333
+ type: ViewChildren,
334
+ args: [FsTextEditorComponent]
335
+ }] } });
336
+
337
+ class ContentLayoutEditorComponent {
338
+ constructor(_data, _dialogRef, _message, _dialog, _cdRef, _prompt) {
339
+ this._data = _data;
340
+ this._dialogRef = _dialogRef;
341
+ this._message = _message;
342
+ this._dialog = _dialog;
343
+ this._cdRef = _cdRef;
344
+ this._prompt = _prompt;
345
+ this.EditorType = EditorType;
346
+ this.focused = null;
347
+ this.editors = {
348
+ [EditorType.Html]: true,
349
+ [EditorType.Scss]: true,
350
+ [EditorType.GlobalScss]: false,
351
+ };
352
+ this._destroy$ = new Subject();
353
+ this.save = () => {
354
+ return of(null)
355
+ .pipe(filter(() => this.focused), switchMap(() => {
356
+ switch (this.focused) {
357
+ case EditorType.Html:
358
+ case EditorType.Scss:
359
+ return this.saveContentPage();
360
+ case EditorType.GlobalScss:
361
+ return this.editor.saveGlobalScss();
362
+ }
363
+ return throwError('Invalid focus');
364
+ }), tap(() => {
365
+ this.editor.clearChange(this.focused);
366
+ this._cdRef.markForCheck();
367
+ }));
368
+ };
369
+ }
370
+ ngOnInit() {
371
+ this._dialogRef.addPanelClass('fs-content-editor-overlay-pane');
372
+ this._dialogRef.disableClose = true;
373
+ this.config = this._data.contentConfig;
374
+ this._initContentLayout(this._data.contentLayout);
375
+ this._initEscape();
376
+ }
377
+ editorToggleChange(event) {
378
+ this.editors[event.value] = !this.editors[event.value];
379
+ }
380
+ ngOnDestroy() {
381
+ this._destroy$.next();
382
+ this._destroy$.complete();
383
+ }
384
+ _initContentLayout(contentLayout) {
385
+ this.config.loadContentLayout(contentLayout.id)
386
+ .subscribe((data) => {
387
+ this.contentLayout = data;
388
+ this._cdRef.markForCheck();
389
+ });
390
+ }
391
+ editorFocused(type) {
392
+ this.focused = type;
393
+ }
394
+ saveContentPage() {
395
+ const names = {
396
+ [EditorType.Scss]: 'styles',
397
+ [EditorType.Html]: 'content',
398
+ };
399
+ const data = {
400
+ id: this.contentLayout.id,
401
+ [names[this.focused]]: this.editor.changes[this.focused],
402
+ };
403
+ return this.config.saveContentLayout(Object.assign({ id: this.contentLayout.id }, data))
404
+ .pipe(tap(() => {
405
+ this._message.success('Saved Changes');
406
+ }));
407
+ }
408
+ close() {
409
+ if (!this.editor.hasChanges) {
410
+ return this._dialogRef.close();
411
+ }
412
+ this._prompt.confirm({
413
+ dialogConfig: {
414
+ width: null,
415
+ },
416
+ title: 'You have unsaved changes',
417
+ template: 'What would you like to do with your changes?',
418
+ buttons: [
419
+ {
420
+ label: 'Review Changes',
421
+ value: 'review',
422
+ },
423
+ {
424
+ label: 'Discard Changes',
425
+ value: 'discard',
426
+ },
427
+ ],
428
+ })
429
+ .pipe(takeUntil(this._destroy$))
430
+ .subscribe((value) => {
431
+ if (value === 'discard') {
432
+ this._dialogRef.close();
433
+ }
434
+ });
435
+ }
436
+ openSettings() {
437
+ this._dialog.open(ContentLayoutComponent, {
438
+ data: {
439
+ contentLayout: this.contentLayout,
440
+ },
441
+ })
442
+ .afterClosed()
443
+ .pipe(takeUntil(this._destroy$))
444
+ .subscribe((contentLayout) => {
445
+ this.contentLayout = Object.assign(Object.assign({}, this.contentLayout), contentLayout);
446
+ this._cdRef.markForCheck();
447
+ });
448
+ }
449
+ _initEscape() {
450
+ fromEvent(document, 'keydown')
451
+ .pipe(filter((event) => event.code === 'Escape'), takeUntil(this._destroy$)).subscribe(() => {
452
+ const dialogRef = this._dialog.openDialogs.reverse()[0];
453
+ if ((dialogRef === null || dialogRef === void 0 ? void 0 : dialogRef.componentInstance) === this) {
454
+ this.close();
455
+ }
456
+ });
457
+ }
458
+ }
459
+ ContentLayoutEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentLayoutEditorComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1$1.MatDialogRef }, { token: i2.FsMessage }, { token: i1$1.MatDialog }, { token: i0.ChangeDetectorRef }, { token: i3$1.FsPrompt }], target: i0.ɵɵFactoryTarget.Component });
460
+ ContentLayoutEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: ContentLayoutEditorComponent, selector: "ng-component", viewQueries: [{ propertyName: "editor", first: true, predicate: EditorComponent, descendants: true }], ngImport: i0, template: "<form fsForm [submit]=\"save\" [dirtySubmitButton]=\"false\" [confirm]=\"false\">\n <fs-dialog *fsSkeletonForm=\"contentLayout\">\n <h1 mat-dialog-title>\n <div class=\"title-container\">\n <div class=\"title\">\n Layout Editor\n <div class=\"small\">{{contentLayout.name}}</div> \n </div>\n <a\n (click)=\"openSettings()\"\n mat-icon-button>\n <mat-icon>settings</mat-icon>\n </a> \n </div>\n </h1>\n <div mat-dialog-content>\n <app-editor\n [contentConfig]=\"config\"\n [showHtml]=\"editors.html\"\n [showScss]=\"editors.scss\"\n [showGlobalScss]=\"editors.globalScss\"\n [html]=\"contentLayout.content\"\n [scss]=\"contentLayout.styles\"\n (focused)=\"editorFocused($event)\">\n </app-editor>\n </div>\n\n <div mat-dialog-actions>\n <button \n mat-button\n color=\"primary\"\n (click)=\"close()\"\n type=\"button\"> \n Done \n </button>\n <div class=\"toggles\">\n <mat-button-toggle-group multiple>\n <mat-button-toggle value=\"html\" [checked]=\"editors.html\" (change)=\"editorToggleChange($event)\">HTML</mat-button-toggle>\n <mat-button-toggle value=\"scss\" [checked]=\"editors.scss\" (change)=\"editorToggleChange($event)\">SCSS</mat-button-toggle>\n <mat-button-toggle value=\"globalScss\" [checked]=\"editors.globalScss\" (change)=\"editorToggleChange($event)\">Global SCSS</mat-button-toggle>\n </mat-button-toggle-group> \n </div>\n </div>\n </fs-dialog>\n</form>", styles: ["::ng-deep .fs-content-editor-overlay-pane .mat-dialog-container{border-radius:0}form{height:100%}fs-dialog{display:flex;height:100%;flex-direction:column}fs-dialog ::ng-deep .mat-dialog-content{max-height:none;flex:1;overflow:hidden}fs-dialog ::ng-deep .mat-button-toggle-label-content{line-height:36px}.mat-dialog-actions .toggles{display:flex;justify-content:flex-end;justify-self:baseline;flex:1}.title-container{display:flex;align-items:center}.title-container .title{flex:1}.title-container .title .small{line-height:normal}\n"], components: [{ type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }, { type: i5$1.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab], a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }, { type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: EditorComponent, selector: "app-editor", inputs: ["showHtml", "showScss", "showJs", "showGlobalScss", "html", "scss", "js", "contentConfig"], outputs: ["changed", "focused", "blured"] }, { type: i5$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i8$2.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "appearance", "checked", "disabled"], outputs: ["change"], exportAs: ["matButtonToggle"] }], directives: [{ type: i9.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i9.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i9.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup", "deactivationGuard"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"], exportAs: ["fsForm"] }, { type: i8.FsSkeletonFormDirective, selector: "[fsSkeletonForm]", inputs: ["fsSkeletonForm", "fsSkeletonFormLines"] }, { type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i5.FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit", "form"] }, { type: i8$2.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
461
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentLayoutEditorComponent, decorators: [{
462
+ type: Component,
463
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<form fsForm [submit]=\"save\" [dirtySubmitButton]=\"false\" [confirm]=\"false\">\n <fs-dialog *fsSkeletonForm=\"contentLayout\">\n <h1 mat-dialog-title>\n <div class=\"title-container\">\n <div class=\"title\">\n Layout Editor\n <div class=\"small\">{{contentLayout.name}}</div> \n </div>\n <a\n (click)=\"openSettings()\"\n mat-icon-button>\n <mat-icon>settings</mat-icon>\n </a> \n </div>\n </h1>\n <div mat-dialog-content>\n <app-editor\n [contentConfig]=\"config\"\n [showHtml]=\"editors.html\"\n [showScss]=\"editors.scss\"\n [showGlobalScss]=\"editors.globalScss\"\n [html]=\"contentLayout.content\"\n [scss]=\"contentLayout.styles\"\n (focused)=\"editorFocused($event)\">\n </app-editor>\n </div>\n\n <div mat-dialog-actions>\n <button \n mat-button\n color=\"primary\"\n (click)=\"close()\"\n type=\"button\"> \n Done \n </button>\n <div class=\"toggles\">\n <mat-button-toggle-group multiple>\n <mat-button-toggle value=\"html\" [checked]=\"editors.html\" (change)=\"editorToggleChange($event)\">HTML</mat-button-toggle>\n <mat-button-toggle value=\"scss\" [checked]=\"editors.scss\" (change)=\"editorToggleChange($event)\">SCSS</mat-button-toggle>\n <mat-button-toggle value=\"globalScss\" [checked]=\"editors.globalScss\" (change)=\"editorToggleChange($event)\">Global SCSS</mat-button-toggle>\n </mat-button-toggle-group> \n </div>\n </div>\n </fs-dialog>\n</form>", styles: ["::ng-deep .fs-content-editor-overlay-pane .mat-dialog-container{border-radius:0}form{height:100%}fs-dialog{display:flex;height:100%;flex-direction:column}fs-dialog ::ng-deep .mat-dialog-content{max-height:none;flex:1;overflow:hidden}fs-dialog ::ng-deep .mat-button-toggle-label-content{line-height:36px}.mat-dialog-actions .toggles{display:flex;justify-content:flex-end;justify-self:baseline;flex:1}.title-container{display:flex;align-items:center}.title-container .title{flex:1}.title-container .title .small{line-height:normal}\n"] }]
464
+ }], ctorParameters: function () {
465
+ return [{ type: undefined, decorators: [{
466
+ type: Inject,
467
+ args: [MAT_DIALOG_DATA]
468
+ }] }, { type: i1$1.MatDialogRef }, { type: i2.FsMessage }, { type: i1$1.MatDialog }, { type: i0.ChangeDetectorRef }, { type: i3$1.FsPrompt }];
469
+ }, propDecorators: { editor: [{
470
+ type: ViewChild,
471
+ args: [EditorComponent]
472
+ }] } });
473
+
474
+ class FsContentLayoutsComponent {
475
+ constructor(_config, _dialog) {
476
+ this._config = _config;
477
+ this._dialog = _dialog;
478
+ this._destroy$ = new Subject();
479
+ }
480
+ ngOnInit() {
481
+ this._initListConfig();
482
+ }
483
+ openEditor(contentLayout) {
484
+ this._dialog.open(ContentLayoutEditorComponent, {
485
+ maxWidth: '100vw',
486
+ width: '100%',
487
+ height: '100%',
488
+ data: {
489
+ contentLayout,
490
+ contentConfig: this._config,
491
+ },
492
+ })
493
+ .afterClosed()
494
+ .pipe(takeUntil(this._destroy$))
495
+ .subscribe(() => {
496
+ this.listComponent.reload();
497
+ });
498
+ }
499
+ openLayout(contentLayout) {
500
+ return this._dialog.open(ContentLayoutComponent, {
501
+ data: {
502
+ contentLayout,
503
+ },
504
+ })
505
+ .afterClosed()
506
+ .pipe(filter((_contentLayout) => !!_contentLayout), takeUntil(this._destroy$));
507
+ }
508
+ ngOnDestroy() {
509
+ this._destroy$.next();
510
+ this._destroy$.complete();
511
+ }
512
+ _initListConfig() {
513
+ this.listConfig = {
514
+ paging: false,
515
+ filters: [
516
+ {
517
+ name: 'keyword',
518
+ type: ItemType.Keyword,
519
+ label: 'Search',
520
+ },
521
+ ],
522
+ actions: [
523
+ {
524
+ label: 'Create',
525
+ click: () => {
526
+ this.openLayout({})
527
+ .subscribe(() => {
528
+ this.listComponent.reload();
529
+ });
530
+ },
531
+ },
532
+ ],
533
+ rowActions: [
534
+ {
535
+ click: (data) => {
536
+ return this._config.deleteContentLayout(data);
537
+ },
538
+ remove: {
539
+ title: 'Confirm',
540
+ template: 'Are you sure you would like to delete this record?',
541
+ },
542
+ menu: true,
543
+ label: 'Delete',
544
+ },
545
+ ],
546
+ fetch: (query) => {
547
+ return this._config.loadContentLayouts(query)
548
+ .pipe(map((contentLayouts) => {
549
+ return { data: contentLayouts };
550
+ }));
551
+ },
552
+ restore: {
553
+ query: { state: 'deleted' },
554
+ filterLabel: 'Show Deleted',
555
+ menuLabel: 'Restore',
556
+ reload: true,
557
+ click: (row) => {
558
+ return this._config.saveContentLayout({ id: row.id, state: 'active' });
559
+ },
560
+ },
561
+ };
562
+ }
563
+ }
564
+ FsContentLayoutsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentLayoutsComponent, deps: [{ token: FS_CONTENT_CONFIG }, { token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
565
+ FsContentLayoutsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsContentLayoutsComponent, selector: "fs-content-layouts", viewQueries: [{ propertyName: "listComponent", first: true, predicate: FsListComponent, descendants: true }], ngImport: i0, template: "<fs-list [config]=\"listConfig\">\n <fs-list-column name=\"name\" title=\"Name\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <a (click)=\"openEditor(row)\">{{row.name}}</a>\n </ng-template>\n </fs-list-column>\n <fs-list-column name=\"modify_date\" title=\"Modified\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.modifyDate | fsDate: 'date-time-yearless'}}\n </ng-template>\n </fs-list-column>\n</fs-list>\n", styles: [""], components: [{ type: i2$2.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }], directives: [{ type: i2$2.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i2$2.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }], pipes: { "fsDate": i3$2.FsDatePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
566
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentLayoutsComponent, decorators: [{
567
+ type: Component,
568
+ args: [{ selector: 'fs-content-layouts', changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-list [config]=\"listConfig\">\n <fs-list-column name=\"name\" title=\"Name\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <a (click)=\"openEditor(row)\">{{row.name}}</a>\n </ng-template>\n </fs-list-column>\n <fs-list-column name=\"modify_date\" title=\"Modified\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.modifyDate | fsDate: 'date-time-yearless'}}\n </ng-template>\n </fs-list-column>\n</fs-list>\n", styles: [""] }]
569
+ }], ctorParameters: function () {
570
+ return [{ type: undefined, decorators: [{
571
+ type: Inject,
572
+ args: [FS_CONTENT_CONFIG]
573
+ }] }, { type: i1$1.MatDialog }];
574
+ }, propDecorators: { listComponent: [{
575
+ type: ViewChild,
576
+ args: [FsListComponent]
577
+ }] } });
578
+
579
+ class FsContentLayoutsModule {
580
+ }
581
+ FsContentLayoutsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentLayoutsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
582
+ FsContentLayoutsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentLayoutsModule, declarations: [ContentLayoutComponent,
583
+ FsContentLayoutsComponent,
584
+ ContentLayoutEditorComponent], imports: [CommonModule,
585
+ FormsModule,
586
+ MatDialogModule,
587
+ MatInputModule,
588
+ MatFormFieldModule,
589
+ MatButtonModule,
590
+ MatTabsModule,
591
+ MatIconModule,
592
+ MatSelectModule,
593
+ MatButtonToggleModule,
594
+ FsListModule,
595
+ FsDateModule,
596
+ FsFormModule,
597
+ FsLabelModule,
598
+ FsSkeletonModule,
599
+ FsHtmlEditorModule,
600
+ FsDialogModule,
601
+ FsTextEditorModule,
602
+ FsContentEditorModule], exports: [FsContentLayoutsComponent] });
603
+ FsContentLayoutsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentLayoutsModule, imports: [[
604
+ CommonModule,
605
+ FormsModule,
606
+ MatDialogModule,
607
+ MatInputModule,
608
+ MatFormFieldModule,
609
+ MatButtonModule,
610
+ MatTabsModule,
611
+ MatIconModule,
612
+ MatSelectModule,
613
+ MatButtonToggleModule,
614
+ FsListModule,
615
+ FsDateModule,
616
+ FsFormModule,
617
+ FsLabelModule,
618
+ FsSkeletonModule,
619
+ FsHtmlEditorModule,
620
+ FsDialogModule,
621
+ FsTextEditorModule,
622
+ FsContentEditorModule,
623
+ ]] });
624
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentLayoutsModule, decorators: [{
625
+ type: NgModule,
626
+ args: [{
627
+ imports: [
628
+ CommonModule,
629
+ FormsModule,
630
+ MatDialogModule,
631
+ MatInputModule,
632
+ MatFormFieldModule,
633
+ MatButtonModule,
634
+ MatTabsModule,
635
+ MatIconModule,
636
+ MatSelectModule,
637
+ MatButtonToggleModule,
638
+ FsListModule,
639
+ FsDateModule,
640
+ FsFormModule,
641
+ FsLabelModule,
642
+ FsSkeletonModule,
643
+ FsHtmlEditorModule,
644
+ FsDialogModule,
645
+ FsTextEditorModule,
646
+ FsContentEditorModule,
647
+ ],
648
+ exports: [
649
+ FsContentLayoutsComponent,
650
+ ],
651
+ declarations: [
652
+ ContentLayoutComponent,
653
+ FsContentLayoutsComponent,
654
+ ContentLayoutEditorComponent,
655
+ ],
656
+ }]
657
+ }] });
658
+
659
+ const PageTypes = [
660
+ { name: 'Standard Page', value: PageType.StandardPage },
661
+ { name: 'Home Page', value: PageType.HomePage },
662
+ { name: 'Not Found Page', value: PageType.NotFoundPage },
663
+ { name: 'Blog Post', value: PageType.BlogPost },
664
+ ];
665
+
666
+ class ContentPageComponent {
667
+ constructor(_config, _data, _dialogRef, _message, _cdRef) {
668
+ this._config = _config;
669
+ this._data = _data;
670
+ this._dialogRef = _dialogRef;
671
+ this._message = _message;
672
+ this._cdRef = _cdRef;
673
+ this.contentPage = null;
674
+ this.PageTypes = PageTypes;
675
+ this.editors = { content: true, styles: true };
676
+ this._destroy$ = new Subject();
677
+ this.save = () => {
678
+ return this._config.saveContentPage(this.contentPage)
679
+ .pipe(tap((contentPage) => {
680
+ this._message.success('Saved Changes');
681
+ this._dialogRef.close(contentPage);
682
+ }));
683
+ };
684
+ }
685
+ ngOnInit() {
686
+ this._dialogRef.updateSize('600px');
687
+ this._fetchData();
688
+ }
689
+ ngOnDestroy() {
690
+ this._destroy$.next();
691
+ this._destroy$.complete();
692
+ }
693
+ _fetchData() {
694
+ this._config.loadContentLayouts()
695
+ .subscribe((contentLayouts) => {
696
+ this.contentLayouts = contentLayouts;
697
+ this._cdRef.markForCheck();
698
+ });
699
+ of(this._data.contentPage)
700
+ .pipe(switchMap((contentPage) => {
701
+ return of(contentPage);
702
+ }), takeUntil(this._destroy$))
703
+ .subscribe((contentPage) => {
704
+ this.contentPage = Object.assign({}, contentPage);
705
+ this._cdRef.markForCheck();
706
+ });
707
+ }
708
+ }
709
+ ContentPageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentPageComponent, deps: [{ token: FS_CONTENT_CONFIG }, { token: MAT_DIALOG_DATA }, { token: i1$1.MatDialogRef }, { token: i2.FsMessage }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
710
+ ContentPageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: ContentPageComponent, selector: "ng-component", viewQueries: [{ propertyName: "textEditors", predicate: FsTextEditorComponent, descendants: true }], ngImport: i0, template: "<form fsForm [submit]=\"save\" *fsSkeletonForm=\"contentPage\">\n <fs-dialog>\n <h1 mat-dialog-title>{{contentPage.id ? 'Page' : 'Create Page'}}</h1>\n <div mat-dialog-content>\n <div class=\"fs-column\">\n <mat-form-field>\n <mat-label>Type</mat-label>\n <mat-select\n [(ngModel)]=\"contentPage.type\"\n name=\"type\"\n required>\n <mat-option\n *ngFor=\"let item of PageTypes\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n <mat-form-field *ngIf=\"contentLayouts\">\n <mat-label>Layout</mat-label>\n <mat-select\n [(ngModel)]=\"contentPage.contentLayoutId\"\n required\n name=\"contentLayoutId\">\n <mat-option\n *ngFor=\"let item of contentLayouts\"\n [value]=\"item.id\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n <mat-form-field>\n <mat-label>Name</mat-label>\n <input\n matInput\n [(ngModel)]=\"contentPage.name\"\n name=\"name\"\n required>\n </mat-form-field>\n <mat-form-field>\n <mat-label>Path</mat-label>\n <input\n matInput\n [(ngModel)]=\"contentPage.path\"\n name=\"path\"\n required>\n </mat-form-field>\n <mat-form-field>\n <mat-label>Title</mat-label>\n <input\n matInput\n [(ngModel)]=\"contentPage.title\"\n name=\"title\">\n </mat-form-field>\n </div>\n </div>\n\n <div mat-dialog-actions>\n <fs-form-dialog-actions>\n </fs-form-dialog-actions>\n </div>\n </fs-dialog>\n</form>\n", styles: [""], components: [{ type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }, { type: i4$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i5$2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i6$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i5.FsFormDialogActionsComponent, selector: "fs-form-dialog-actions", inputs: ["save", "create", "close", "done", "closeData", "name"] }], directives: [{ type: i8.FsSkeletonFormDirective, selector: "[fsSkeletonForm]", inputs: ["fsSkeletonForm", "fsSkeletonFormLines"] }, { type: i9.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i9.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i9.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup", "deactivationGuard"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"], exportAs: ["fsForm"] }, { type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i4$1.MatLabel, selector: "mat-label" }, { type: i9.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i9.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i9.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i5.FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: ["fsFormRequired", "required", "fsFormRequiredMessage"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i9.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
711
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentPageComponent, decorators: [{
712
+ type: Component,
713
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<form fsForm [submit]=\"save\" *fsSkeletonForm=\"contentPage\">\n <fs-dialog>\n <h1 mat-dialog-title>{{contentPage.id ? 'Page' : 'Create Page'}}</h1>\n <div mat-dialog-content>\n <div class=\"fs-column\">\n <mat-form-field>\n <mat-label>Type</mat-label>\n <mat-select\n [(ngModel)]=\"contentPage.type\"\n name=\"type\"\n required>\n <mat-option\n *ngFor=\"let item of PageTypes\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n <mat-form-field *ngIf=\"contentLayouts\">\n <mat-label>Layout</mat-label>\n <mat-select\n [(ngModel)]=\"contentPage.contentLayoutId\"\n required\n name=\"contentLayoutId\">\n <mat-option\n *ngFor=\"let item of contentLayouts\"\n [value]=\"item.id\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n <mat-form-field>\n <mat-label>Name</mat-label>\n <input\n matInput\n [(ngModel)]=\"contentPage.name\"\n name=\"name\"\n required>\n </mat-form-field>\n <mat-form-field>\n <mat-label>Path</mat-label>\n <input\n matInput\n [(ngModel)]=\"contentPage.path\"\n name=\"path\"\n required>\n </mat-form-field>\n <mat-form-field>\n <mat-label>Title</mat-label>\n <input\n matInput\n [(ngModel)]=\"contentPage.title\"\n name=\"title\">\n </mat-form-field>\n </div>\n </div>\n\n <div mat-dialog-actions>\n <fs-form-dialog-actions>\n </fs-form-dialog-actions>\n </div>\n </fs-dialog>\n</form>\n", styles: [""] }]
714
+ }], ctorParameters: function () {
715
+ return [{ type: undefined, decorators: [{
716
+ type: Inject,
717
+ args: [FS_CONTENT_CONFIG]
718
+ }] }, { type: undefined, decorators: [{
719
+ type: Inject,
720
+ args: [MAT_DIALOG_DATA]
721
+ }] }, { type: i1$1.MatDialogRef }, { type: i2.FsMessage }, { type: i0.ChangeDetectorRef }];
722
+ }, propDecorators: { textEditors: [{
723
+ type: ViewChildren,
724
+ args: [FsTextEditorComponent]
725
+ }] } });
726
+
727
+ class ContentPageEditorComponent {
728
+ constructor(_data, _dialogRef, _message, _dialog, _cdRef, _prompt) {
729
+ this._data = _data;
730
+ this._dialogRef = _dialogRef;
731
+ this._message = _message;
732
+ this._dialog = _dialog;
733
+ this._cdRef = _cdRef;
734
+ this._prompt = _prompt;
735
+ this.focused = null;
736
+ this.resizing = false;
737
+ this.editors = {
738
+ [EditorType.Html]: true,
739
+ [EditorType.Scss]: true,
740
+ [EditorType.Js]: false,
741
+ [EditorType.GlobalScss]: false,
742
+ };
743
+ this._destroy$ = new Subject();
744
+ this.submit = () => {
745
+ this.submitting = true;
746
+ return of(null)
747
+ .pipe(filter(() => this.focused), switchMap(() => {
748
+ switch (this.focused) {
749
+ case EditorType.Js:
750
+ case EditorType.Html:
751
+ case EditorType.Scss:
752
+ return this.saveContentPage();
753
+ case EditorType.GlobalScss:
754
+ return this.editor.saveGlobalScss();
755
+ }
756
+ return throwError('Invalid focus');
757
+ }), tap(() => {
758
+ this.editor.clearChange(this.focused);
759
+ this._cdRef.markForCheck();
760
+ }), finalize(() => {
761
+ this.submitting = false;
762
+ this._cdRef.markForCheck();
763
+ }))
764
+ .pipe(takeUntil(this._destroy$));
765
+ };
766
+ }
767
+ get isMac() {
768
+ return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
769
+ }
770
+ ngOnInit() {
771
+ this._dialogRef.addPanelClass('fs-content-editor-overlay-pane');
772
+ this._dialogRef.disableClose = true;
773
+ this.config = this._data.contentConfig;
774
+ this._initContentPage(this._data.contentPage);
775
+ this._initEscape();
776
+ }
777
+ editorToggleChange(event) {
778
+ this.editors[event.value] = !this.editors[event.value];
779
+ }
780
+ ngOnDestroy() {
781
+ this._destroy$.next();
782
+ this._destroy$.complete();
783
+ }
784
+ _initContentPage(contentPage) {
785
+ this.config.loadContentPage(contentPage.id)
786
+ .subscribe((data) => {
787
+ this.contentPage = data;
788
+ this._cdRef.markForCheck();
789
+ });
790
+ }
791
+ editorFocused(type) {
792
+ this.focused = type;
793
+ }
794
+ save() {
795
+ this.submit()
796
+ .subscribe();
797
+ }
798
+ saveContentPage() {
799
+ const names = {
800
+ [EditorType.Js]: 'js',
801
+ [EditorType.Scss]: 'styles',
802
+ [EditorType.Html]: 'content',
803
+ };
804
+ const data = {
805
+ id: this.contentPage.id,
806
+ [names[this.focused]]: this.editor.changes[this.focused],
807
+ };
808
+ return this.config.saveContentPage(Object.assign({ id: this.contentPage.id }, data))
809
+ .pipe(tap(() => {
810
+ this._message.success('Saved Changes');
811
+ }));
812
+ }
813
+ close() {
814
+ if (!this.editor.hasChanges) {
815
+ return this._dialogRef.close();
816
+ }
817
+ this._prompt.confirm({
818
+ dialogConfig: {
819
+ width: null,
820
+ },
821
+ title: 'You have unsaved changes',
822
+ template: 'What would you like to do with your changes?',
823
+ buttons: [
824
+ {
825
+ label: 'Review Changes',
826
+ value: 'review',
827
+ },
828
+ {
829
+ label: 'Discard Changes',
830
+ value: 'discard',
831
+ },
832
+ ],
833
+ })
834
+ .pipe(takeUntil(this._destroy$))
835
+ .subscribe((value) => {
836
+ if (value === 'discard') {
837
+ this._dialogRef.close();
838
+ }
839
+ });
840
+ }
841
+ openSettings() {
842
+ this._dialog.open(ContentPageComponent, {
843
+ data: {
844
+ contentPage: this.contentPage,
845
+ },
846
+ })
847
+ .afterClosed()
848
+ .pipe(takeUntil(this._destroy$))
849
+ .subscribe((contentPage) => {
850
+ this.contentPage = Object.assign(Object.assign({}, this.contentPage), contentPage);
851
+ this._cdRef.markForCheck();
852
+ });
853
+ }
854
+ _initEscape() {
855
+ fromEvent(document, 'keydown')
856
+ .pipe(filter((event) => event.code === 'Escape'), takeUntil(this._destroy$)).subscribe(() => {
857
+ const dialogRef = this._dialog.openDialogs.reverse()[0];
858
+ if ((dialogRef === null || dialogRef === void 0 ? void 0 : dialogRef.componentInstance) === this) {
859
+ this.close();
860
+ }
861
+ });
862
+ }
863
+ }
864
+ ContentPageEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentPageEditorComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1$1.MatDialogRef }, { token: i2.FsMessage }, { token: i1$1.MatDialog }, { token: i0.ChangeDetectorRef }, { token: i3$1.FsPrompt }], target: i0.ɵɵFactoryTarget.Component });
865
+ ContentPageEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: ContentPageEditorComponent, selector: "ng-component", viewQueries: [{ propertyName: "editor", first: true, predicate: EditorComponent, descendants: true }], ngImport: i0, template: "<form fsForm [submit]=\"submit\" [dirtySubmitButton]=\"false\" [confirm]=\"false\">\n <fs-dialog *fsSkeletonForm=\"contentPage\">\n <h1 mat-dialog-title>\n <div class=\"title-container\">\n <div class=\"title\">\n Page Editor\n <div class=\"small\">{{contentPage.name}}</div> \n </div>\n <a\n (click)=\"openSettings()\"\n mat-icon-button>\n <mat-icon>settings</mat-icon>\n </a>\n\n <div class=\"toggles\">\n <mat-button-toggle-group multiple>\n <mat-button-toggle value=\"html\" [checked]=\"editors.html\" (change)=\"editorToggleChange($event)\">HTML</mat-button-toggle>\n <mat-button-toggle value=\"scss\" [checked]=\"editors.scss\" (change)=\"editorToggleChange($event)\">SCSS</mat-button-toggle>\n <mat-button-toggle value=\"js\" [checked]=\"editors.js\" (change)=\"editorToggleChange($event)\">JS</mat-button-toggle>\n <mat-button-toggle value=\"globalScss\" [checked]=\"editors.globalScss\" (change)=\"editorToggleChange($event)\">Global SCSS</mat-button-toggle>\n </mat-button-toggle-group> \n </div>\n\n <div class=\"actions\">\n <button\n #submit\n mat-stroked-button\n color=\"primary\"\n [disabled]=\"!editor?.hasChanges || submitting\"\n [matTooltip]=\"isMac ? 'cmd+s' : 'ctrl+s'\"\n type=\"button\"\n (click)=\"save()\"> \n Save\n </button>\n\n <a \n mat-stroked-button\n target=\"_blank\"\n [routerLink]=\"contentPage.path\"\n type=\"button\"> \n Preview\n </a>\n\n <button \n mat-stroked-button\n (click)=\"close()\"\n type=\"button\"> \n Done\n </button>\n </div>\n </div>\n </h1>\n <div mat-dialog-content>\n <app-editor\n [contentConfig]=\"config\"\n [showHtml]=\"editors.html\"\n [showJs]=\"editors.js\"\n [showScss]=\"editors.scss\"\n [showGlobalScss]=\"editors.globalScss\"\n [html]=\"contentPage.content\"\n [scss]=\"contentPage.styles\"\n [js]=\"contentPage.js\"\n (focused)=\"editorFocused($event)\">\n </app-editor>\n </div>\n </fs-dialog>\n</form>\n", styles: ["::ng-deep .fs-content-editor-overlay-pane .mat-dialog-container{border-radius:0}form{height:100%}fs-dialog{display:flex;height:100%;flex-direction:column}fs-dialog ::ng-deep .mat-dialog-content{max-height:none;flex:1;overflow:hidden}fs-dialog ::ng-deep .mat-button-toggle-label-content{line-height:36px}h1 .toggles{display:flex;justify-content:flex-end;justify-self:baseline;font-size:13px}h1 .actions{margin-left:30px}h1 .actions .mat-stroked-button{margin-left:5px}.title-container{display:flex;align-items:center}.title-container .title{flex:1}.title-container .title .small{line-height:normal}\n"], components: [{ type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }, { type: i5$1.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab], a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }, { type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i8$2.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "appearance", "checked", "disabled"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { type: i5$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: EditorComponent, selector: "app-editor", inputs: ["showHtml", "showScss", "showJs", "showGlobalScss", "html", "scss", "js", "contentConfig"], outputs: ["changed", "focused", "blured"] }], directives: [{ type: i9.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i9.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i9.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup", "deactivationGuard"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"], exportAs: ["fsForm"] }, { type: i8.FsSkeletonFormDirective, selector: "[fsSkeletonForm]", inputs: ["fsSkeletonForm", "fsSkeletonFormLines"] }, { type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i8$2.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { type: i5.FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit", "form"] }, { type: i12.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i2$3.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
866
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentPageEditorComponent, decorators: [{
867
+ type: Component,
868
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<form fsForm [submit]=\"submit\" [dirtySubmitButton]=\"false\" [confirm]=\"false\">\n <fs-dialog *fsSkeletonForm=\"contentPage\">\n <h1 mat-dialog-title>\n <div class=\"title-container\">\n <div class=\"title\">\n Page Editor\n <div class=\"small\">{{contentPage.name}}</div> \n </div>\n <a\n (click)=\"openSettings()\"\n mat-icon-button>\n <mat-icon>settings</mat-icon>\n </a>\n\n <div class=\"toggles\">\n <mat-button-toggle-group multiple>\n <mat-button-toggle value=\"html\" [checked]=\"editors.html\" (change)=\"editorToggleChange($event)\">HTML</mat-button-toggle>\n <mat-button-toggle value=\"scss\" [checked]=\"editors.scss\" (change)=\"editorToggleChange($event)\">SCSS</mat-button-toggle>\n <mat-button-toggle value=\"js\" [checked]=\"editors.js\" (change)=\"editorToggleChange($event)\">JS</mat-button-toggle>\n <mat-button-toggle value=\"globalScss\" [checked]=\"editors.globalScss\" (change)=\"editorToggleChange($event)\">Global SCSS</mat-button-toggle>\n </mat-button-toggle-group> \n </div>\n\n <div class=\"actions\">\n <button\n #submit\n mat-stroked-button\n color=\"primary\"\n [disabled]=\"!editor?.hasChanges || submitting\"\n [matTooltip]=\"isMac ? 'cmd+s' : 'ctrl+s'\"\n type=\"button\"\n (click)=\"save()\"> \n Save\n </button>\n\n <a \n mat-stroked-button\n target=\"_blank\"\n [routerLink]=\"contentPage.path\"\n type=\"button\"> \n Preview\n </a>\n\n <button \n mat-stroked-button\n (click)=\"close()\"\n type=\"button\"> \n Done\n </button>\n </div>\n </div>\n </h1>\n <div mat-dialog-content>\n <app-editor\n [contentConfig]=\"config\"\n [showHtml]=\"editors.html\"\n [showJs]=\"editors.js\"\n [showScss]=\"editors.scss\"\n [showGlobalScss]=\"editors.globalScss\"\n [html]=\"contentPage.content\"\n [scss]=\"contentPage.styles\"\n [js]=\"contentPage.js\"\n (focused)=\"editorFocused($event)\">\n </app-editor>\n </div>\n </fs-dialog>\n</form>\n", styles: ["::ng-deep .fs-content-editor-overlay-pane .mat-dialog-container{border-radius:0}form{height:100%}fs-dialog{display:flex;height:100%;flex-direction:column}fs-dialog ::ng-deep .mat-dialog-content{max-height:none;flex:1;overflow:hidden}fs-dialog ::ng-deep .mat-button-toggle-label-content{line-height:36px}h1 .toggles{display:flex;justify-content:flex-end;justify-self:baseline;font-size:13px}h1 .actions{margin-left:30px}h1 .actions .mat-stroked-button{margin-left:5px}.title-container{display:flex;align-items:center}.title-container .title{flex:1}.title-container .title .small{line-height:normal}\n"] }]
869
+ }], ctorParameters: function () {
870
+ return [{ type: undefined, decorators: [{
871
+ type: Inject,
872
+ args: [MAT_DIALOG_DATA]
873
+ }] }, { type: i1$1.MatDialogRef }, { type: i2.FsMessage }, { type: i1$1.MatDialog }, { type: i0.ChangeDetectorRef }, { type: i3$1.FsPrompt }];
874
+ }, propDecorators: { editor: [{
875
+ type: ViewChild,
876
+ args: [EditorComponent]
877
+ }] } });
878
+
879
+ class FsContentPagesComponent {
880
+ constructor(_config, _dialog) {
881
+ this._config = _config;
882
+ this._dialog = _dialog;
883
+ this.pageTypes = index(PageTypes, 'value', 'name');
884
+ this._destroy$ = new Subject();
885
+ }
886
+ ngOnInit() {
887
+ this._initListConfig();
888
+ }
889
+ openEditor(contentPage) {
890
+ this._dialog.open(ContentPageEditorComponent, {
891
+ data: {
892
+ contentPage,
893
+ config: this._config,
894
+ contentConfig: this._config,
895
+ },
896
+ maxWidth: '100vw',
897
+ width: '100%',
898
+ height: '100%',
899
+ autoFocus: false,
900
+ })
901
+ .afterClosed()
902
+ .pipe(takeUntil(this._destroy$))
903
+ .subscribe(() => {
904
+ this.listComponent.reload();
905
+ });
906
+ }
907
+ ngOnDestroy() {
908
+ this._destroy$.next();
909
+ this._destroy$.complete();
910
+ }
911
+ openContentPage(contentPage) {
912
+ return this._dialog.open(ContentPageComponent, {
913
+ data: { contentPage },
914
+ })
915
+ .afterClosed()
916
+ .pipe(takeUntil(this._destroy$));
917
+ }
918
+ _initListConfig() {
919
+ this.listConfig = {
920
+ filters: [
921
+ {
922
+ name: 'keyword',
923
+ type: ItemType.Keyword,
924
+ label: 'Search',
925
+ },
926
+ ],
927
+ actions: [
928
+ {
929
+ label: 'Create',
930
+ click: () => {
931
+ this.openContentPage({
932
+ type: PageType.StandardPage,
933
+ })
934
+ .pipe(filter((contentPage) => !!contentPage))
935
+ .subscribe((contentPage) => {
936
+ this.openEditor(contentPage);
937
+ this.listComponent.reload();
938
+ });
939
+ },
940
+ },
941
+ ],
942
+ rowActions: [
943
+ {
944
+ click: (data) => {
945
+ return this._config.deleteContentPage(data);
946
+ },
947
+ remove: {
948
+ title: 'Confirm',
949
+ template: 'Are you sure you would like to delete this record?',
950
+ },
951
+ menu: true,
952
+ label: 'Delete',
953
+ },
954
+ ],
955
+ fetch: (query) => {
956
+ return this._config.loadContentPages(query)
957
+ .pipe(map((response) => {
958
+ return { data: response.contentPages, paging: response.paging };
959
+ }));
960
+ },
961
+ restore: {
962
+ query: { state: 'deleted' },
963
+ filterLabel: 'Show Deleted',
964
+ menuLabel: 'Restore',
965
+ reload: true,
966
+ click: (row) => {
967
+ return this._config.saveContentPage({ id: row.id, state: 'active' });
968
+ },
969
+ },
970
+ };
971
+ }
972
+ }
973
+ FsContentPagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentPagesComponent, deps: [{ token: FS_CONTENT_CONFIG }, { token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
974
+ FsContentPagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsContentPagesComponent, selector: "fs-content-pages", inputs: { htmlEditorConfig: "htmlEditorConfig" }, viewQueries: [{ propertyName: "listComponent", first: true, predicate: FsListComponent, descendants: true }], ngImport: i0, template: "<fs-list [config]=\"listConfig\">\n <fs-list-column name=\"name\" title=\"Name\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <a (click)=\"openEditor(row)\">{{row.name}}</a>\n </ng-template>\n </fs-list-column>\n <fs-list-column name=\"path\" title=\"Path\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <a [href]=\"'/' + row.path\" target=\"_black\">/{{row.path}}</a>\n </ng-template>\n </fs-list-column>\n <fs-list-column name=\"type\" title=\"Type\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n {{pageTypes[row.type]}}\n </ng-template>\n </fs-list-column>\n <fs-list-column name=\"modify_date\" title=\"Modified\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.modifyDate | fsDate: 'date-time-yearless'}}\n </ng-template>\n </fs-list-column>\n</fs-list>\n", styles: [":host ::ng-deep .modified,:host ::ng-deep .name{width:1%;white-space:nowrap}:host ::ng-deep .preview-content img{display:none}.preview-content{position:relative;max-height:100px;max-width:100%;overflow:hidden;-webkit-mask-image:-webkit-gradient(linear,left 60%,left bottom,from(black),to(rgba(0,0,0,0)))}\n"], components: [{ type: i2$2.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }], directives: [{ type: i2$2.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i2$2.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }], pipes: { "fsDate": i3$2.FsDatePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
975
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentPagesComponent, decorators: [{
976
+ type: Component,
977
+ args: [{ selector: 'fs-content-pages', changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-list [config]=\"listConfig\">\n <fs-list-column name=\"name\" title=\"Name\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <a (click)=\"openEditor(row)\">{{row.name}}</a>\n </ng-template>\n </fs-list-column>\n <fs-list-column name=\"path\" title=\"Path\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <a [href]=\"'/' + row.path\" target=\"_black\">/{{row.path}}</a>\n </ng-template>\n </fs-list-column>\n <fs-list-column name=\"type\" title=\"Type\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n {{pageTypes[row.type]}}\n </ng-template>\n </fs-list-column>\n <fs-list-column name=\"modify_date\" title=\"Modified\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.modifyDate | fsDate: 'date-time-yearless'}}\n </ng-template>\n </fs-list-column>\n</fs-list>\n", styles: [":host ::ng-deep .modified,:host ::ng-deep .name{width:1%;white-space:nowrap}:host ::ng-deep .preview-content img{display:none}.preview-content{position:relative;max-height:100px;max-width:100%;overflow:hidden;-webkit-mask-image:-webkit-gradient(linear,left 60%,left bottom,from(black),to(rgba(0,0,0,0)))}\n"] }]
978
+ }], ctorParameters: function () {
979
+ return [{ type: undefined, decorators: [{
980
+ type: Inject,
981
+ args: [FS_CONTENT_CONFIG]
982
+ }] }, { type: i1$1.MatDialog }];
983
+ }, propDecorators: { htmlEditorConfig: [{
984
+ type: Input
985
+ }], listComponent: [{
986
+ type: ViewChild,
987
+ args: [FsListComponent]
988
+ }] } });
989
+
990
+ class FsContentPagesModule {
991
+ static forRoot() {
992
+ return {
993
+ ngModule: FsContentPagesModule,
994
+ };
995
+ }
996
+ }
997
+ FsContentPagesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentPagesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
998
+ FsContentPagesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentPagesModule, declarations: [FsContentPagesComponent,
999
+ ContentPageComponent,
1000
+ ContentPageEditorComponent], imports: [CommonModule,
1001
+ FormsModule,
1002
+ RouterModule,
1003
+ MatDialogModule,
1004
+ MatInputModule,
1005
+ MatFormFieldModule,
1006
+ MatButtonModule,
1007
+ MatTabsModule,
1008
+ MatIconModule,
1009
+ MatSelectModule,
1010
+ MatButtonToggleModule,
1011
+ MatTooltipModule,
1012
+ FsListModule,
1013
+ FsDateModule,
1014
+ FsCommonModule,
1015
+ FsFormModule,
1016
+ FsLabelModule,
1017
+ FsSkeletonModule,
1018
+ FsHtmlEditorModule,
1019
+ FsDialogModule,
1020
+ FsTextEditorModule,
1021
+ FsContentEditorModule], exports: [FsContentPagesComponent] });
1022
+ FsContentPagesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentPagesModule, imports: [[
1023
+ CommonModule,
1024
+ FormsModule,
1025
+ RouterModule,
1026
+ MatDialogModule,
1027
+ MatInputModule,
1028
+ MatFormFieldModule,
1029
+ MatButtonModule,
1030
+ MatTabsModule,
1031
+ MatIconModule,
1032
+ MatSelectModule,
1033
+ MatButtonToggleModule,
1034
+ MatTooltipModule,
1035
+ FsListModule,
1036
+ FsDateModule,
1037
+ FsCommonModule,
1038
+ FsFormModule,
1039
+ FsLabelModule,
1040
+ FsSkeletonModule,
1041
+ FsHtmlEditorModule,
1042
+ FsDialogModule,
1043
+ FsTextEditorModule,
1044
+ FsContentEditorModule,
1045
+ ]] });
1046
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentPagesModule, decorators: [{
1047
+ type: NgModule,
1048
+ args: [{
1049
+ imports: [
1050
+ CommonModule,
1051
+ FormsModule,
1052
+ RouterModule,
1053
+ MatDialogModule,
1054
+ MatInputModule,
1055
+ MatFormFieldModule,
1056
+ MatButtonModule,
1057
+ MatTabsModule,
1058
+ MatIconModule,
1059
+ MatSelectModule,
1060
+ MatButtonToggleModule,
1061
+ MatTooltipModule,
1062
+ FsListModule,
1063
+ FsDateModule,
1064
+ FsCommonModule,
1065
+ FsFormModule,
1066
+ FsLabelModule,
1067
+ FsSkeletonModule,
1068
+ FsHtmlEditorModule,
1069
+ FsDialogModule,
1070
+ FsTextEditorModule,
1071
+ FsContentEditorModule,
1072
+ ],
1073
+ exports: [
1074
+ FsContentPagesComponent,
1075
+ ],
1076
+ declarations: [
1077
+ FsContentPagesComponent,
1078
+ ContentPageComponent,
1079
+ ContentPageEditorComponent,
1080
+ ],
1081
+ }]
1082
+ }] });
1083
+
1084
+ class ContentStyleComponent {
1085
+ constructor(_config, _message, _cdRef) {
1086
+ this._config = _config;
1087
+ this._message = _message;
1088
+ this._cdRef = _cdRef;
1089
+ this.height = '100%';
1090
+ this.contentStyle = null;
1091
+ this.styleConfig = {
1092
+ tabSize: 2,
1093
+ language: 'scss',
1094
+ height: '100%',
1095
+ };
1096
+ this._destroy$ = new Subject();
1097
+ }
1098
+ ngOnInit() {
1099
+ this.styleConfig.height = this.height;
1100
+ this._config.loadContentStyle()
1101
+ .subscribe((contentStyle) => {
1102
+ this.contentStyle = contentStyle;
1103
+ this._cdRef.markForCheck();
1104
+ });
1105
+ }
1106
+ ngOnDestroy() {
1107
+ this._destroy$.next();
1108
+ this._destroy$.complete();
1109
+ }
1110
+ save() {
1111
+ this._config.saveContentStyle(this.contentStyle)
1112
+ .pipe(tap((contentStyle) => {
1113
+ this.contentStyle = Object.assign(Object.assign({}, this.contentStyle), contentStyle);
1114
+ this._cdRef.markForCheck();
1115
+ this._message.success('Saved Changes');
1116
+ })).subscribe();
1117
+ }
1118
+ }
1119
+ ContentStyleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentStyleComponent, deps: [{ token: FS_CONTENT_CONFIG }, { token: i2.FsMessage }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1120
+ ContentStyleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: ContentStyleComponent, selector: "fs-content-style", inputs: { height: "height" }, viewQueries: [{ propertyName: "textEditors", first: true, predicate: FsTextEditorComponent, descendants: true }, { propertyName: "form", first: true, predicate: FsFormDirective, descendants: true }], ngImport: i0, template: "<ng-container *fsSkeletonForm=\"contentStyle\">\n <fs-text-editor \n [(ngModel)]=\"contentStyle.scss\" \n name=\"contentStyle\"\n [fsModelChangeOptions]=\"{ debounce: 300 }\"\n (fsModelChange)=\"save()\"\n [config]=\"styleConfig\">\n </fs-text-editor> \n</ng-container>\n", styles: [""], components: [{ type: i4.FsTextEditorComponent, selector: "fs-text-editor", inputs: ["config", "scrollable"], outputs: ["ready", "blur"] }], directives: [{ type: i8.FsSkeletonFormDirective, selector: "[fsSkeletonForm]", inputs: ["fsSkeletonForm", "fsSkeletonFormLines"] }, { type: i9.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i9.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsModelChangeDirective, selector: "[fsModelChange]", inputs: ["fsModelChangeOptions"], outputs: ["fsModelChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentStyleComponent, decorators: [{
1122
+ type: Component,
1123
+ args: [{ selector: 'fs-content-style', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *fsSkeletonForm=\"contentStyle\">\n <fs-text-editor \n [(ngModel)]=\"contentStyle.scss\" \n name=\"contentStyle\"\n [fsModelChangeOptions]=\"{ debounce: 300 }\"\n (fsModelChange)=\"save()\"\n [config]=\"styleConfig\">\n </fs-text-editor> \n</ng-container>\n", styles: [""] }]
1124
+ }], ctorParameters: function () {
1125
+ return [{ type: undefined, decorators: [{
1126
+ type: Inject,
1127
+ args: [FS_CONTENT_CONFIG]
1128
+ }] }, { type: i2.FsMessage }, { type: i0.ChangeDetectorRef }];
1129
+ }, propDecorators: { textEditors: [{
1130
+ type: ViewChild,
1131
+ args: [FsTextEditorComponent]
1132
+ }], form: [{
1133
+ type: ViewChild,
1134
+ args: [FsFormDirective]
1135
+ }], height: [{
1136
+ type: Input
1137
+ }] } });
1138
+
1139
+ class FsContentStyleModule {
1140
+ }
1141
+ FsContentStyleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentStyleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1142
+ FsContentStyleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentStyleModule, declarations: [ContentStyleComponent], imports: [CommonModule,
1143
+ FormsModule,
1144
+ MatButtonModule,
1145
+ FsTextEditorModule,
1146
+ FsSkeletonModule,
1147
+ FsCommonModule,
1148
+ FsContentEditorModule], exports: [ContentStyleComponent] });
1149
+ FsContentStyleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentStyleModule, imports: [[
1150
+ CommonModule,
1151
+ FormsModule,
1152
+ MatButtonModule,
1153
+ FsTextEditorModule,
1154
+ FsSkeletonModule,
1155
+ FsCommonModule,
1156
+ FsContentEditorModule,
1157
+ ]] });
1158
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentStyleModule, decorators: [{
1159
+ type: NgModule,
1160
+ args: [{
1161
+ imports: [
1162
+ CommonModule,
1163
+ FormsModule,
1164
+ MatButtonModule,
1165
+ FsTextEditorModule,
1166
+ FsSkeletonModule,
1167
+ FsCommonModule,
1168
+ FsContentEditorModule,
1169
+ ],
1170
+ exports: [
1171
+ ContentStyleComponent,
1172
+ ],
1173
+ declarations: [
1174
+ ContentStyleComponent,
1175
+ ],
1176
+ }]
1177
+ }] });
1178
+
1179
+ class ContentRendererComponent {
1180
+ constructor(_sanitizer, _router, _el, _htmlRenderer) {
1181
+ this._sanitizer = _sanitizer;
1182
+ this._router = _router;
1183
+ this._el = _el;
1184
+ this._htmlRenderer = _htmlRenderer;
1185
+ this._destroy$ = new Subject();
1186
+ }
1187
+ ngOnChanges(changes) {
1188
+ if (changes.contentPage.currentValue) {
1189
+ this._htmlRenderer.addStyle(this.contentPage.styles, { id: 'contentPageStyles' });
1190
+ this.content = this._sanitizer.bypassSecurityTrustHtml(this.contentPage.content);
1191
+ }
1192
+ }
1193
+ ngAfterViewChecked() {
1194
+ this.registerHrefs();
1195
+ if (this.contentPage.js) {
1196
+ const script = document.createElement('script');
1197
+ script.text = this.contentPage.js;
1198
+ this.script.nativeElement.after(script);
1199
+ }
1200
+ }
1201
+ registerHrefs() {
1202
+ Array.from(this.el.querySelectorAll('a[href]'))
1203
+ .filter((el) => {
1204
+ return el.getAttribute('href').match(/^\//);
1205
+ })
1206
+ .forEach((el) => {
1207
+ el.addEventListener('click', (event) => {
1208
+ if (!event.shiftKey && !event.ctrlKey) {
1209
+ event.preventDefault();
1210
+ const href = el.getAttribute('href');
1211
+ this._router.navigateByUrl(href);
1212
+ }
1213
+ });
1214
+ });
1215
+ }
1216
+ get el() {
1217
+ return this._el.nativeElement;
1218
+ }
1219
+ ngOnDestroy() {
1220
+ this.removeStyles();
1221
+ this._destroy$.next();
1222
+ this._destroy$.complete();
1223
+ }
1224
+ removeStyles() {
1225
+ const el = document.querySelector('#contentPageStyles');
1226
+ if (el) {
1227
+ el.remove();
1228
+ }
1229
+ }
1230
+ }
1231
+ ContentRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentRendererComponent, deps: [{ token: i1$2.DomSanitizer }, { token: i2$3.Router }, { token: i0.ElementRef }, { token: i3$3.HtmlRenderer }], target: i0.ɵɵFactoryTarget.Component });
1232
+ ContentRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: ContentRendererComponent, selector: "fs-content-renderer", inputs: { contentPage: "contentPage" }, viewQueries: [{ propertyName: "script", first: true, predicate: ["script"], descendants: true, read: ElementRef }], usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"content\" [innerHTML]=\"content\"></div>\n<span #script></span>", styles: [""], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1233
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentRendererComponent, decorators: [{
1234
+ type: Component,
1235
+ args: [{ selector: 'fs-content-renderer', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"content\" [innerHTML]=\"content\"></div>\n<span #script></span>", styles: [""] }]
1236
+ }], ctorParameters: function () { return [{ type: i1$2.DomSanitizer }, { type: i2$3.Router }, { type: i0.ElementRef }, { type: i3$3.HtmlRenderer }]; }, propDecorators: { script: [{
1237
+ type: ViewChild,
1238
+ args: ['script', { read: ElementRef }]
1239
+ }], contentPage: [{
1240
+ type: Input
1241
+ }] } });
1242
+
1243
+ class FsContentComponent {
1244
+ constructor(_config, _title, _cdRef, _router, _el, _htmlRenderer) {
1245
+ this._config = _config;
1246
+ this._title = _title;
1247
+ this._cdRef = _cdRef;
1248
+ this._router = _router;
1249
+ this._el = _el;
1250
+ this._htmlRenderer = _htmlRenderer;
1251
+ this._destroy$ = new Subject();
1252
+ }
1253
+ ngOnInit() {
1254
+ this._initContent();
1255
+ this._initStyles();
1256
+ }
1257
+ get el() {
1258
+ return this._el.nativeElement;
1259
+ }
1260
+ ngOnDestroy() {
1261
+ this._destroy$.next();
1262
+ this._destroy$.complete();
1263
+ this._title.setTitle('');
1264
+ }
1265
+ _initStyles() {
1266
+ if (this._config.loadContentStyleCss) {
1267
+ this._config.loadContentStyleCss()
1268
+ .subscribe((styles) => {
1269
+ this._htmlRenderer.addStyle(styles, { id: 'content-sytle' });
1270
+ });
1271
+ }
1272
+ }
1273
+ _initContent() {
1274
+ this._loadContent();
1275
+ this._router.events
1276
+ .pipe(filter((e) => e instanceof NavigationEnd), takeUntil(this._destroy$))
1277
+ .subscribe((e) => {
1278
+ this._loadContent();
1279
+ });
1280
+ }
1281
+ _loadContent() {
1282
+ const path = window.location.pathname;
1283
+ this._config.loadContent(path)
1284
+ .subscribe((contentPage) => {
1285
+ if (contentPage.title) {
1286
+ this._title.setTitle(contentPage.title);
1287
+ let ogTitleEl = document.querySelector('head meta[property="og:title"]');
1288
+ if (!ogTitleEl) {
1289
+ ogTitleEl = document.createElement('meta');
1290
+ ogTitleEl.setAttribute('property', 'og:title');
1291
+ document.getElementsByTagName('head')[0].appendChild(ogTitleEl);
1292
+ }
1293
+ ogTitleEl.setAttribute('content', contentPage.title);
1294
+ }
1295
+ this.contentPage = contentPage;
1296
+ this._cdRef.markForCheck();
1297
+ });
1298
+ }
1299
+ }
1300
+ FsContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentComponent, deps: [{ token: FS_CONTENT_CONFIG }, { token: i1$2.Title }, { token: i0.ChangeDetectorRef }, { token: i2$3.Router }, { token: i0.ElementRef }, { token: i3$3.HtmlRenderer }], target: i0.ɵɵFactoryTarget.Component });
1301
+ FsContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsContentComponent, selector: "fs-content", ngImport: i0, template: "<ng-container *ngIf=\"contentPage\">\n <fs-content-renderer [contentPage]=\"contentPage\"></fs-content-renderer>\n</ng-container>", styles: [""], components: [{ type: ContentRendererComponent, selector: "fs-content-renderer", inputs: ["contentPage"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentComponent, decorators: [{
1303
+ type: Component,
1304
+ args: [{ selector: 'fs-content', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"contentPage\">\n <fs-content-renderer [contentPage]=\"contentPage\"></fs-content-renderer>\n</ng-container>", styles: [""] }]
1305
+ }], ctorParameters: function () {
1306
+ return [{ type: undefined, decorators: [{
1307
+ type: Inject,
1308
+ args: [FS_CONTENT_CONFIG]
1309
+ }] }, { type: i1$2.Title }, { type: i0.ChangeDetectorRef }, { type: i2$3.Router }, { type: i0.ElementRef }, { type: i3$3.HtmlRenderer }];
1310
+ } });
1311
+
1312
+ class FsContentModule {
1313
+ }
1314
+ FsContentModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1315
+ FsContentModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentModule, declarations: [FsContentComponent,
1316
+ ContentRendererComponent], imports: [CommonModule,
1317
+ FsHtmlEditorModule], exports: [FsContentComponent] });
1318
+ FsContentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentModule, imports: [[
1319
+ CommonModule,
1320
+ FsHtmlEditorModule,
1321
+ ]] });
1322
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentModule, decorators: [{
1323
+ type: NgModule,
1324
+ args: [{
1325
+ imports: [
1326
+ CommonModule,
1327
+ FsHtmlEditorModule,
1328
+ ],
1329
+ exports: [
1330
+ FsContentComponent,
1331
+ ],
1332
+ declarations: [
1333
+ FsContentComponent,
1334
+ ContentRendererComponent,
1335
+ ],
1336
+ }]
1337
+ }] });
1338
+
1339
+ /**
1340
+ * Generated bundle index. Do not edit.
1341
+ */
1342
+
1343
+ export { ContentStyleComponent, FS_CONTENT_CONFIG, FsContentComponent, FsContentLayoutsComponent, FsContentLayoutsModule, FsContentModule, FsContentPagesComponent, FsContentPagesModule, FsContentStyleModule };
1344
+ //# sourceMappingURL=firestitch-content.mjs.map