@firestitch/content 12.3.4 → 13.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/app/consts/index.d.ts +1 -1
  2. package/app/consts/page-types.const.d.ts +5 -5
  3. package/app/enums/editor-type.d.ts +6 -6
  4. package/app/enums/index.d.ts +2 -2
  5. package/app/enums/page-type.enum.d.ts +6 -6
  6. package/app/injectors/content-config.injector.d.ts +2 -2
  7. package/app/injectors/index.d.ts +1 -1
  8. package/app/interfaces/content-config.d.ts +21 -21
  9. package/app/interfaces/content-layout.d.ts +10 -10
  10. package/app/interfaces/content-page.d.ts +14 -14
  11. package/app/interfaces/content-style.d.ts +4 -4
  12. package/app/interfaces/index.d.ts +4 -4
  13. package/app/modules/content/components/content/content.component.d.ts +25 -25
  14. package/app/modules/content/components/content/index.d.ts +1 -1
  15. package/app/modules/content/components/content-renderer/content-renderer.component.d.ts +24 -24
  16. package/app/modules/content/components/content-renderer/index.d.ts +1 -1
  17. package/app/modules/content/fs-content.module.d.ts +10 -10
  18. package/app/modules/content-layouts/components/content-layout/content-layout.component.d.ts +27 -27
  19. package/app/modules/content-layouts/components/content-layout/index.d.ts +1 -1
  20. package/app/modules/content-layouts/components/content-layout-editor/content-layout-editor.component.d.ts +50 -50
  21. package/app/modules/content-layouts/components/content-layout-editor/index.d.ts +1 -1
  22. package/app/modules/content-layouts/components/content-layouts/content-layouts.component.d.ts +21 -21
  23. package/app/modules/content-layouts/components/content-layouts/index.d.ts +1 -1
  24. package/app/modules/content-layouts/components/index.d.ts +3 -3
  25. package/app/modules/content-layouts/fs-content-layouts.module.d.ts +28 -28
  26. package/app/modules/content-pages/components/content-page/content-page.component.d.ts +32 -32
  27. package/app/modules/content-pages/components/content-page/index.d.ts +1 -1
  28. package/app/modules/content-pages/components/content-page-editor/content-page-editor.component.d.ts +56 -55
  29. package/app/modules/content-pages/components/content-page-editor/index.d.ts +1 -1
  30. package/app/modules/content-pages/components/content-pages/content-pages.component.d.ts +24 -24
  31. package/app/modules/content-pages/components/content-pages/index.d.ts +1 -1
  32. package/app/modules/content-pages/components/index.d.ts +3 -3
  33. package/app/modules/content-pages/fs-content-pages.module.d.ts +33 -32
  34. package/app/modules/content-style/components/content-style/content-style.component.d.ts +27 -27
  35. package/app/modules/content-style/components/content-style/index.d.ts +1 -1
  36. package/app/modules/content-style/fs-content-style.module.d.ts +14 -14
  37. package/app/modules/editor/components/editor/editor.component.d.ts +49 -49
  38. package/app/modules/editor/components/editor/index.d.ts +1 -1
  39. package/app/modules/editor/components/editor-label/editor-label.component.d.ts +7 -7
  40. package/app/modules/editor/components/editor-label/index.d.ts +1 -1
  41. package/app/modules/editor/fs-content-editor.module.d.ts +24 -24
  42. package/app/modules/editor/index.d.ts +1 -1
  43. package/{esm2015/app/consts/index.js → esm2020/app/consts/index.mjs} +1 -1
  44. package/{esm2015/app/consts/page-types.const.js → esm2020/app/consts/page-types.const.mjs} +7 -7
  45. package/{esm2015/app/enums/editor-type.js → esm2020/app/enums/editor-type.mjs} +7 -7
  46. package/{esm2015/app/enums/index.js → esm2020/app/enums/index.mjs} +3 -3
  47. package/{esm2015/app/enums/page-type.enum.js → esm2020/app/enums/page-type.enum.mjs} +7 -7
  48. package/{esm2015/app/injectors/content-config.injector.js → esm2020/app/injectors/content-config.injector.mjs} +2 -2
  49. package/{esm2015/app/injectors/index.js → esm2020/app/injectors/index.mjs} +1 -1
  50. package/{esm2015/app/interfaces/content-config.js → esm2020/app/interfaces/content-config.mjs} +1 -1
  51. package/{esm2015/app/interfaces/content-layout.js → esm2020/app/interfaces/content-layout.mjs} +1 -1
  52. package/{esm2015/app/interfaces/content-page.js → esm2020/app/interfaces/content-page.mjs} +1 -1
  53. package/{esm2015/app/interfaces/content-style.js → esm2020/app/interfaces/content-style.mjs} +1 -1
  54. package/{esm2015/app/interfaces/index.js → esm2020/app/interfaces/index.mjs} +5 -5
  55. package/{esm2015/app/modules/content/components/content/content.component.js → esm2020/app/modules/content/components/content/content.component.mjs} +80 -85
  56. package/{esm2015/app/modules/content/components/content/index.js → esm2020/app/modules/content/components/content/index.mjs} +1 -1
  57. package/esm2020/app/modules/content/components/content-renderer/content-renderer.component.mjs +74 -0
  58. package/{esm2015/app/modules/content/components/content-renderer/index.js → esm2020/app/modules/content/components/content-renderer/index.mjs} +1 -1
  59. package/{esm2015/app/modules/content/fs-content.module.js → esm2020/app/modules/content/fs-content.module.mjs} +33 -33
  60. package/esm2020/app/modules/content-layouts/components/content-layout/content-layout.component.mjs +68 -0
  61. package/{esm2015/app/modules/content-layouts/components/content-layout/index.js → esm2020/app/modules/content-layouts/components/content-layout/index.mjs} +1 -1
  62. package/esm2020/app/modules/content-layouts/components/content-layout-editor/content-layout-editor.component.mjs +162 -0
  63. package/{esm2015/app/modules/content-layouts/components/content-layout-editor/index.js → esm2020/app/modules/content-layouts/components/content-layout-editor/index.mjs} +1 -1
  64. package/esm2020/app/modules/content-layouts/components/content-layouts/content-layouts.component.mjs +116 -0
  65. package/{esm2015/app/modules/content-layouts/components/content-layouts/index.js → esm2020/app/modules/content-layouts/components/content-layouts/index.mjs} +1 -1
  66. package/{esm2015/app/modules/content-layouts/components/index.js → esm2020/app/modules/content-layouts/components/index.mjs} +4 -4
  67. package/{esm2015/app/modules/content-layouts/fs-content-layouts.module.js → esm2020/app/modules/content-layouts/fs-content-layouts.module.mjs} +104 -104
  68. package/esm2020/app/modules/content-pages/components/content-page/content-page.component.mjs +81 -0
  69. package/{esm2015/app/modules/content-pages/components/content-page/index.js → esm2020/app/modules/content-pages/components/content-page/index.mjs} +1 -1
  70. package/esm2020/app/modules/content-pages/components/content-page-editor/content-page-editor.component.mjs +179 -0
  71. package/{esm2015/app/modules/content-pages/components/content-page-editor/index.js → esm2020/app/modules/content-pages/components/content-page-editor/index.mjs} +1 -1
  72. package/esm2020/app/modules/content-pages/components/content-pages/content-pages.component.mjs +125 -0
  73. package/{esm2015/app/modules/content-pages/components/content-pages/index.js → esm2020/app/modules/content-pages/components/content-pages/index.mjs} +1 -1
  74. package/{esm2015/app/modules/content-pages/components/index.js → esm2020/app/modules/content-pages/components/index.mjs} +4 -4
  75. package/esm2020/app/modules/content-pages/fs-content-pages.module.mjs +121 -0
  76. package/esm2020/app/modules/content-style/components/content-style/content-style.component.mjs +69 -0
  77. package/{esm2015/app/modules/content-style/components/content-style/index.js → esm2020/app/modules/content-style/components/content-style/index.mjs} +1 -1
  78. package/{esm2015/app/modules/content-style/fs-content-style.module.js → esm2020/app/modules/content-style/fs-content-style.module.mjs} +50 -50
  79. package/esm2020/app/modules/editor/components/editor/editor.component.mjs +144 -0
  80. package/{esm2015/app/modules/editor/components/editor/index.js → esm2020/app/modules/editor/components/editor/index.mjs} +1 -1
  81. package/esm2020/app/modules/editor/components/editor-label/editor-label.component.mjs +16 -0
  82. package/{esm2015/app/modules/editor/components/editor-label/index.js → esm2020/app/modules/editor/components/editor-label/index.mjs} +1 -1
  83. package/{esm2015/app/modules/editor/fs-content-editor.module.js → esm2020/app/modules/editor/fs-content-editor.module.mjs} +89 -89
  84. package/{esm2015/app/modules/editor/index.js → esm2020/app/modules/editor/index.mjs} +1 -1
  85. package/{esm2015/firestitch-content.js → esm2020/firestitch-content.mjs} +4 -4
  86. package/{esm2015/public_api.js → esm2020/public_api.mjs} +10 -10
  87. package/fesm2015/firestitch-content.mjs +1344 -0
  88. package/fesm2015/firestitch-content.mjs.map +1 -0
  89. package/fesm2020/firestitch-content.mjs +1345 -0
  90. package/fesm2020/firestitch-content.mjs.map +1 -0
  91. package/firestitch-content.d.ts +5 -5
  92. package/package.json +21 -8
  93. package/public_api.d.ts +10 -10
  94. package/bundles/firestitch-content.umd.js +0 -1480
  95. package/bundles/firestitch-content.umd.js.map +0 -1
  96. package/esm2015/app/modules/content/components/content-renderer/content-renderer.component.js +0 -77
  97. package/esm2015/app/modules/content-layouts/components/content-layout/content-layout.component.js +0 -72
  98. package/esm2015/app/modules/content-layouts/components/content-layout-editor/content-layout-editor.component.js +0 -160
  99. package/esm2015/app/modules/content-layouts/components/content-layouts/content-layouts.component.js +0 -121
  100. package/esm2015/app/modules/content-pages/components/content-page/content-page.component.js +0 -83
  101. package/esm2015/app/modules/content-pages/components/content-page-editor/content-page-editor.component.js +0 -176
  102. package/esm2015/app/modules/content-pages/components/content-pages/content-pages.component.js +0 -130
  103. package/esm2015/app/modules/content-pages/fs-content-pages.module.js +0 -117
  104. package/esm2015/app/modules/content-style/components/content-style/content-style.component.js +0 -71
  105. package/esm2015/app/modules/editor/components/editor/editor.component.js +0 -149
  106. package/esm2015/app/modules/editor/components/editor-label/editor-label.component.js +0 -21
  107. package/fesm2015/firestitch-content.js +0 -1374
  108. package/fesm2015/firestitch-content.js.map +0 -1
@@ -0,0 +1,1345 @@
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 * as i2 from '@firestitch/message';
41
+ import { Subject, of, throwError, fromEvent } from 'rxjs';
42
+ import { tap, switchMap, takeUntil, filter, map, finalize } from 'rxjs/operators';
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 = { ...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 () { return [{ type: undefined, decorators: [{
325
+ type: Inject,
326
+ args: [FS_CONTENT_CONFIG]
327
+ }] }, { type: undefined, decorators: [{
328
+ type: Inject,
329
+ args: [MAT_DIALOG_DATA]
330
+ }] }, { type: i1$1.MatDialogRef }, { type: i2.FsMessage }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { textEditors: [{
331
+ type: ViewChildren,
332
+ args: [FsTextEditorComponent]
333
+ }] } });
334
+
335
+ class ContentLayoutEditorComponent {
336
+ constructor(_data, _dialogRef, _message, _dialog, _cdRef, _prompt) {
337
+ this._data = _data;
338
+ this._dialogRef = _dialogRef;
339
+ this._message = _message;
340
+ this._dialog = _dialog;
341
+ this._cdRef = _cdRef;
342
+ this._prompt = _prompt;
343
+ this.EditorType = EditorType;
344
+ this.focused = null;
345
+ this.editors = {
346
+ [EditorType.Html]: true,
347
+ [EditorType.Scss]: true,
348
+ [EditorType.GlobalScss]: false,
349
+ };
350
+ this._destroy$ = new Subject();
351
+ this.save = () => {
352
+ return of(null)
353
+ .pipe(filter(() => this.focused), switchMap(() => {
354
+ switch (this.focused) {
355
+ case EditorType.Html:
356
+ case EditorType.Scss:
357
+ return this.saveContentPage();
358
+ case EditorType.GlobalScss:
359
+ return this.editor.saveGlobalScss();
360
+ }
361
+ return throwError('Invalid focus');
362
+ }), tap(() => {
363
+ this.editor.clearChange(this.focused);
364
+ this._cdRef.markForCheck();
365
+ }));
366
+ };
367
+ }
368
+ ngOnInit() {
369
+ this._dialogRef.addPanelClass('fs-content-editor-overlay-pane');
370
+ this._dialogRef.disableClose = true;
371
+ this.config = this._data.contentConfig;
372
+ this._initContentLayout(this._data.contentLayout);
373
+ this._initEscape();
374
+ }
375
+ editorToggleChange(event) {
376
+ this.editors[event.value] = !this.editors[event.value];
377
+ }
378
+ ngOnDestroy() {
379
+ this._destroy$.next();
380
+ this._destroy$.complete();
381
+ }
382
+ _initContentLayout(contentLayout) {
383
+ this.config.loadContentLayout(contentLayout.id)
384
+ .subscribe((data) => {
385
+ this.contentLayout = data;
386
+ this._cdRef.markForCheck();
387
+ });
388
+ }
389
+ editorFocused(type) {
390
+ this.focused = type;
391
+ }
392
+ saveContentPage() {
393
+ const names = {
394
+ [EditorType.Scss]: 'styles',
395
+ [EditorType.Html]: 'content',
396
+ };
397
+ const data = {
398
+ id: this.contentLayout.id,
399
+ [names[this.focused]]: this.editor.changes[this.focused],
400
+ };
401
+ return this.config.saveContentLayout({
402
+ id: this.contentLayout.id,
403
+ ...data,
404
+ })
405
+ .pipe(tap(() => {
406
+ this._message.success('Saved Changes');
407
+ }));
408
+ }
409
+ close() {
410
+ if (!this.editor.hasChanges) {
411
+ return this._dialogRef.close();
412
+ }
413
+ this._prompt.confirm({
414
+ dialogConfig: {
415
+ width: null,
416
+ },
417
+ title: 'You have unsaved changes',
418
+ template: 'What would you like to do with your changes?',
419
+ buttons: [
420
+ {
421
+ label: 'Review Changes',
422
+ value: 'review',
423
+ },
424
+ {
425
+ label: 'Discard Changes',
426
+ value: 'discard',
427
+ },
428
+ ],
429
+ })
430
+ .pipe(takeUntil(this._destroy$))
431
+ .subscribe((value) => {
432
+ if (value === 'discard') {
433
+ this._dialogRef.close();
434
+ }
435
+ });
436
+ }
437
+ openSettings() {
438
+ this._dialog.open(ContentLayoutComponent, {
439
+ data: {
440
+ contentLayout: this.contentLayout,
441
+ },
442
+ })
443
+ .afterClosed()
444
+ .pipe(takeUntil(this._destroy$))
445
+ .subscribe((contentLayout) => {
446
+ this.contentLayout = {
447
+ ...this.contentLayout,
448
+ ...contentLayout,
449
+ };
450
+ this._cdRef.markForCheck();
451
+ });
452
+ }
453
+ _initEscape() {
454
+ fromEvent(document, 'keydown')
455
+ .pipe(filter((event) => event.code === 'Escape'), takeUntil(this._destroy$)).subscribe(() => {
456
+ const dialogRef = this._dialog.openDialogs.reverse()[0];
457
+ if (dialogRef?.componentInstance === this) {
458
+ this.close();
459
+ }
460
+ });
461
+ }
462
+ }
463
+ 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 });
464
+ 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 });
465
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentLayoutEditorComponent, decorators: [{
466
+ type: Component,
467
+ 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"] }]
468
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
469
+ type: Inject,
470
+ args: [MAT_DIALOG_DATA]
471
+ }] }, { type: i1$1.MatDialogRef }, { type: i2.FsMessage }, { type: i1$1.MatDialog }, { type: i0.ChangeDetectorRef }, { type: i3$1.FsPrompt }]; }, propDecorators: { editor: [{
472
+ type: ViewChild,
473
+ args: [EditorComponent]
474
+ }] } });
475
+
476
+ class FsContentLayoutsComponent {
477
+ constructor(_config, _dialog) {
478
+ this._config = _config;
479
+ this._dialog = _dialog;
480
+ this._destroy$ = new Subject();
481
+ }
482
+ ngOnInit() {
483
+ this._initListConfig();
484
+ }
485
+ openEditor(contentLayout) {
486
+ this._dialog.open(ContentLayoutEditorComponent, {
487
+ maxWidth: '100vw',
488
+ width: '100%',
489
+ height: '100%',
490
+ data: {
491
+ contentLayout,
492
+ contentConfig: this._config,
493
+ },
494
+ })
495
+ .afterClosed()
496
+ .pipe(takeUntil(this._destroy$))
497
+ .subscribe(() => {
498
+ this.listComponent.reload();
499
+ });
500
+ }
501
+ openLayout(contentLayout) {
502
+ return this._dialog.open(ContentLayoutComponent, {
503
+ data: {
504
+ contentLayout,
505
+ },
506
+ })
507
+ .afterClosed()
508
+ .pipe(filter((_contentLayout) => !!_contentLayout), takeUntil(this._destroy$));
509
+ }
510
+ ngOnDestroy() {
511
+ this._destroy$.next();
512
+ this._destroy$.complete();
513
+ }
514
+ _initListConfig() {
515
+ this.listConfig = {
516
+ paging: false,
517
+ filters: [
518
+ {
519
+ name: 'keyword',
520
+ type: ItemType.Keyword,
521
+ label: 'Search',
522
+ },
523
+ ],
524
+ actions: [
525
+ {
526
+ label: 'Create',
527
+ click: () => {
528
+ this.openLayout({})
529
+ .subscribe(() => {
530
+ this.listComponent.reload();
531
+ });
532
+ },
533
+ },
534
+ ],
535
+ rowActions: [
536
+ {
537
+ click: (data) => {
538
+ return this._config.deleteContentLayout(data);
539
+ },
540
+ remove: {
541
+ title: 'Confirm',
542
+ template: 'Are you sure you would like to delete this record?',
543
+ },
544
+ menu: true,
545
+ label: 'Delete',
546
+ },
547
+ ],
548
+ fetch: (query) => {
549
+ return this._config.loadContentLayouts(query)
550
+ .pipe(map((contentLayouts) => {
551
+ return { data: contentLayouts };
552
+ }));
553
+ },
554
+ restore: {
555
+ query: { state: 'deleted' },
556
+ filterLabel: 'Show Deleted',
557
+ menuLabel: 'Restore',
558
+ reload: true,
559
+ click: (row) => {
560
+ return this._config.saveContentLayout({ id: row.id, state: 'active' });
561
+ },
562
+ },
563
+ };
564
+ }
565
+ }
566
+ 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 });
567
+ 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 });
568
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentLayoutsComponent, decorators: [{
569
+ type: Component,
570
+ 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: [""] }]
571
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
572
+ type: Inject,
573
+ args: [FS_CONTENT_CONFIG]
574
+ }] }, { type: i1$1.MatDialog }]; }, 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 = {
705
+ ...contentPage,
706
+ };
707
+ this._cdRef.markForCheck();
708
+ });
709
+ }
710
+ }
711
+ 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 });
712
+ 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 });
713
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentPageComponent, decorators: [{
714
+ type: Component,
715
+ 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: [""] }]
716
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
717
+ type: Inject,
718
+ args: [FS_CONTENT_CONFIG]
719
+ }] }, { type: undefined, decorators: [{
720
+ type: Inject,
721
+ args: [MAT_DIALOG_DATA]
722
+ }] }, { type: i1$1.MatDialogRef }, { type: i2.FsMessage }, { type: i0.ChangeDetectorRef }]; }, 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({
809
+ id: this.contentPage.id,
810
+ ...data,
811
+ })
812
+ .pipe(tap(() => {
813
+ this._message.success('Saved Changes');
814
+ }));
815
+ }
816
+ close() {
817
+ if (!this.editor.hasChanges) {
818
+ return this._dialogRef.close();
819
+ }
820
+ this._prompt.confirm({
821
+ dialogConfig: {
822
+ width: null,
823
+ },
824
+ title: 'You have unsaved changes',
825
+ template: 'What would you like to do with your changes?',
826
+ buttons: [
827
+ {
828
+ label: 'Review Changes',
829
+ value: 'review',
830
+ },
831
+ {
832
+ label: 'Discard Changes',
833
+ value: 'discard',
834
+ },
835
+ ],
836
+ })
837
+ .pipe(takeUntil(this._destroy$))
838
+ .subscribe((value) => {
839
+ if (value === 'discard') {
840
+ this._dialogRef.close();
841
+ }
842
+ });
843
+ }
844
+ openSettings() {
845
+ this._dialog.open(ContentPageComponent, {
846
+ data: {
847
+ contentPage: this.contentPage,
848
+ },
849
+ })
850
+ .afterClosed()
851
+ .pipe(takeUntil(this._destroy$))
852
+ .subscribe((contentPage) => {
853
+ this.contentPage = {
854
+ ...this.contentPage,
855
+ ...contentPage,
856
+ };
857
+ this._cdRef.markForCheck();
858
+ });
859
+ }
860
+ _initEscape() {
861
+ fromEvent(document, 'keydown')
862
+ .pipe(filter((event) => event.code === 'Escape'), takeUntil(this._destroy$)).subscribe(() => {
863
+ const dialogRef = this._dialog.openDialogs.reverse()[0];
864
+ if (dialogRef?.componentInstance === this) {
865
+ this.close();
866
+ }
867
+ });
868
+ }
869
+ }
870
+ 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 });
871
+ 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 });
872
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentPageEditorComponent, decorators: [{
873
+ type: Component,
874
+ 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"] }]
875
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
876
+ type: Inject,
877
+ args: [MAT_DIALOG_DATA]
878
+ }] }, { type: i1$1.MatDialogRef }, { type: i2.FsMessage }, { type: i1$1.MatDialog }, { type: i0.ChangeDetectorRef }, { type: i3$1.FsPrompt }]; }, propDecorators: { editor: [{
879
+ type: ViewChild,
880
+ args: [EditorComponent]
881
+ }] } });
882
+
883
+ class FsContentPagesComponent {
884
+ constructor(_config, _dialog) {
885
+ this._config = _config;
886
+ this._dialog = _dialog;
887
+ this.pageTypes = index(PageTypes, 'value', 'name');
888
+ this._destroy$ = new Subject();
889
+ }
890
+ ngOnInit() {
891
+ this._initListConfig();
892
+ }
893
+ openEditor(contentPage) {
894
+ this._dialog.open(ContentPageEditorComponent, {
895
+ data: {
896
+ contentPage,
897
+ config: this._config,
898
+ contentConfig: this._config,
899
+ },
900
+ maxWidth: '100vw',
901
+ width: '100%',
902
+ height: '100%',
903
+ autoFocus: false,
904
+ })
905
+ .afterClosed()
906
+ .pipe(takeUntil(this._destroy$))
907
+ .subscribe(() => {
908
+ this.listComponent.reload();
909
+ });
910
+ }
911
+ ngOnDestroy() {
912
+ this._destroy$.next();
913
+ this._destroy$.complete();
914
+ }
915
+ openContentPage(contentPage) {
916
+ return this._dialog.open(ContentPageComponent, {
917
+ data: { contentPage },
918
+ })
919
+ .afterClosed()
920
+ .pipe(takeUntil(this._destroy$));
921
+ }
922
+ _initListConfig() {
923
+ this.listConfig = {
924
+ filters: [
925
+ {
926
+ name: 'keyword',
927
+ type: ItemType.Keyword,
928
+ label: 'Search',
929
+ },
930
+ ],
931
+ actions: [
932
+ {
933
+ label: 'Create',
934
+ click: () => {
935
+ this.openContentPage({
936
+ type: PageType.StandardPage,
937
+ })
938
+ .pipe(filter((contentPage) => !!contentPage))
939
+ .subscribe((contentPage) => {
940
+ this.openEditor(contentPage);
941
+ this.listComponent.reload();
942
+ });
943
+ },
944
+ },
945
+ ],
946
+ rowActions: [
947
+ {
948
+ click: (data) => {
949
+ return this._config.deleteContentPage(data);
950
+ },
951
+ remove: {
952
+ title: 'Confirm',
953
+ template: 'Are you sure you would like to delete this record?',
954
+ },
955
+ menu: true,
956
+ label: 'Delete',
957
+ },
958
+ ],
959
+ fetch: (query) => {
960
+ return this._config.loadContentPages(query)
961
+ .pipe(map((response) => {
962
+ return { data: response.contentPages, paging: response.paging };
963
+ }));
964
+ },
965
+ restore: {
966
+ query: { state: 'deleted' },
967
+ filterLabel: 'Show Deleted',
968
+ menuLabel: 'Restore',
969
+ reload: true,
970
+ click: (row) => {
971
+ return this._config.saveContentPage({ id: row.id, state: 'active' });
972
+ },
973
+ },
974
+ };
975
+ }
976
+ }
977
+ 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 });
978
+ 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 });
979
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentPagesComponent, decorators: [{
980
+ type: Component,
981
+ 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"] }]
982
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
983
+ type: Inject,
984
+ args: [FS_CONTENT_CONFIG]
985
+ }] }, { type: i1$1.MatDialog }]; }, propDecorators: { htmlEditorConfig: [{
986
+ type: Input
987
+ }], listComponent: [{
988
+ type: ViewChild,
989
+ args: [FsListComponent]
990
+ }] } });
991
+
992
+ class FsContentPagesModule {
993
+ static forRoot() {
994
+ return {
995
+ ngModule: FsContentPagesModule,
996
+ };
997
+ }
998
+ }
999
+ FsContentPagesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentPagesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1000
+ FsContentPagesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentPagesModule, declarations: [FsContentPagesComponent,
1001
+ ContentPageComponent,
1002
+ ContentPageEditorComponent], imports: [CommonModule,
1003
+ FormsModule,
1004
+ RouterModule,
1005
+ MatDialogModule,
1006
+ MatInputModule,
1007
+ MatFormFieldModule,
1008
+ MatButtonModule,
1009
+ MatTabsModule,
1010
+ MatIconModule,
1011
+ MatSelectModule,
1012
+ MatButtonToggleModule,
1013
+ MatTooltipModule,
1014
+ FsListModule,
1015
+ FsDateModule,
1016
+ FsCommonModule,
1017
+ FsFormModule,
1018
+ FsLabelModule,
1019
+ FsSkeletonModule,
1020
+ FsHtmlEditorModule,
1021
+ FsDialogModule,
1022
+ FsTextEditorModule,
1023
+ FsContentEditorModule], exports: [FsContentPagesComponent] });
1024
+ FsContentPagesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentPagesModule, imports: [[
1025
+ CommonModule,
1026
+ FormsModule,
1027
+ RouterModule,
1028
+ MatDialogModule,
1029
+ MatInputModule,
1030
+ MatFormFieldModule,
1031
+ MatButtonModule,
1032
+ MatTabsModule,
1033
+ MatIconModule,
1034
+ MatSelectModule,
1035
+ MatButtonToggleModule,
1036
+ MatTooltipModule,
1037
+ FsListModule,
1038
+ FsDateModule,
1039
+ FsCommonModule,
1040
+ FsFormModule,
1041
+ FsLabelModule,
1042
+ FsSkeletonModule,
1043
+ FsHtmlEditorModule,
1044
+ FsDialogModule,
1045
+ FsTextEditorModule,
1046
+ FsContentEditorModule,
1047
+ ]] });
1048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentPagesModule, decorators: [{
1049
+ type: NgModule,
1050
+ args: [{
1051
+ imports: [
1052
+ CommonModule,
1053
+ FormsModule,
1054
+ RouterModule,
1055
+ MatDialogModule,
1056
+ MatInputModule,
1057
+ MatFormFieldModule,
1058
+ MatButtonModule,
1059
+ MatTabsModule,
1060
+ MatIconModule,
1061
+ MatSelectModule,
1062
+ MatButtonToggleModule,
1063
+ MatTooltipModule,
1064
+ FsListModule,
1065
+ FsDateModule,
1066
+ FsCommonModule,
1067
+ FsFormModule,
1068
+ FsLabelModule,
1069
+ FsSkeletonModule,
1070
+ FsHtmlEditorModule,
1071
+ FsDialogModule,
1072
+ FsTextEditorModule,
1073
+ FsContentEditorModule,
1074
+ ],
1075
+ exports: [
1076
+ FsContentPagesComponent,
1077
+ ],
1078
+ declarations: [
1079
+ FsContentPagesComponent,
1080
+ ContentPageComponent,
1081
+ ContentPageEditorComponent,
1082
+ ],
1083
+ }]
1084
+ }] });
1085
+
1086
+ class ContentStyleComponent {
1087
+ constructor(_config, _message, _cdRef) {
1088
+ this._config = _config;
1089
+ this._message = _message;
1090
+ this._cdRef = _cdRef;
1091
+ this.height = '100%';
1092
+ this.contentStyle = null;
1093
+ this.styleConfig = {
1094
+ tabSize: 2,
1095
+ language: 'scss',
1096
+ height: '100%',
1097
+ };
1098
+ this._destroy$ = new Subject();
1099
+ }
1100
+ ngOnInit() {
1101
+ this.styleConfig.height = this.height;
1102
+ this._config.loadContentStyle()
1103
+ .subscribe((contentStyle) => {
1104
+ this.contentStyle = contentStyle;
1105
+ this._cdRef.markForCheck();
1106
+ });
1107
+ }
1108
+ ngOnDestroy() {
1109
+ this._destroy$.next();
1110
+ this._destroy$.complete();
1111
+ }
1112
+ save() {
1113
+ this._config.saveContentStyle(this.contentStyle)
1114
+ .pipe(tap((contentStyle) => {
1115
+ this.contentStyle = {
1116
+ ...this.contentStyle,
1117
+ ...contentStyle,
1118
+ };
1119
+ this._cdRef.markForCheck();
1120
+ this._message.success('Saved Changes');
1121
+ })).subscribe();
1122
+ }
1123
+ }
1124
+ 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 });
1125
+ 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 });
1126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentStyleComponent, decorators: [{
1127
+ type: Component,
1128
+ 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: [""] }]
1129
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1130
+ type: Inject,
1131
+ args: [FS_CONTENT_CONFIG]
1132
+ }] }, { type: i2.FsMessage }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { textEditors: [{
1133
+ type: ViewChild,
1134
+ args: [FsTextEditorComponent]
1135
+ }], form: [{
1136
+ type: ViewChild,
1137
+ args: [FsFormDirective]
1138
+ }], height: [{
1139
+ type: Input
1140
+ }] } });
1141
+
1142
+ class FsContentStyleModule {
1143
+ }
1144
+ FsContentStyleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentStyleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1145
+ FsContentStyleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentStyleModule, declarations: [ContentStyleComponent], imports: [CommonModule,
1146
+ FormsModule,
1147
+ MatButtonModule,
1148
+ FsTextEditorModule,
1149
+ FsSkeletonModule,
1150
+ FsCommonModule,
1151
+ FsContentEditorModule], exports: [ContentStyleComponent] });
1152
+ FsContentStyleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentStyleModule, imports: [[
1153
+ CommonModule,
1154
+ FormsModule,
1155
+ MatButtonModule,
1156
+ FsTextEditorModule,
1157
+ FsSkeletonModule,
1158
+ FsCommonModule,
1159
+ FsContentEditorModule,
1160
+ ]] });
1161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentStyleModule, decorators: [{
1162
+ type: NgModule,
1163
+ args: [{
1164
+ imports: [
1165
+ CommonModule,
1166
+ FormsModule,
1167
+ MatButtonModule,
1168
+ FsTextEditorModule,
1169
+ FsSkeletonModule,
1170
+ FsCommonModule,
1171
+ FsContentEditorModule,
1172
+ ],
1173
+ exports: [
1174
+ ContentStyleComponent,
1175
+ ],
1176
+ declarations: [
1177
+ ContentStyleComponent,
1178
+ ],
1179
+ }]
1180
+ }] });
1181
+
1182
+ class ContentRendererComponent {
1183
+ constructor(_sanitizer, _router, _el, _htmlRenderer) {
1184
+ this._sanitizer = _sanitizer;
1185
+ this._router = _router;
1186
+ this._el = _el;
1187
+ this._htmlRenderer = _htmlRenderer;
1188
+ this._destroy$ = new Subject();
1189
+ }
1190
+ ngOnChanges(changes) {
1191
+ if (changes.contentPage.currentValue) {
1192
+ this._htmlRenderer.addStyle(this.contentPage.styles, { id: 'contentPageStyles' });
1193
+ this.content = this._sanitizer.bypassSecurityTrustHtml(this.contentPage.content);
1194
+ }
1195
+ }
1196
+ ngAfterViewChecked() {
1197
+ this.registerHrefs();
1198
+ if (this.contentPage.js) {
1199
+ const script = document.createElement('script');
1200
+ script.text = this.contentPage.js;
1201
+ this.script.nativeElement.after(script);
1202
+ }
1203
+ }
1204
+ registerHrefs() {
1205
+ Array.from(this.el.querySelectorAll('a[href]'))
1206
+ .filter((el) => {
1207
+ return el.getAttribute('href').match(/^\//);
1208
+ })
1209
+ .forEach((el) => {
1210
+ el.addEventListener('click', (event) => {
1211
+ if (!event.shiftKey && !event.ctrlKey) {
1212
+ event.preventDefault();
1213
+ const href = el.getAttribute('href');
1214
+ this._router.navigateByUrl(href);
1215
+ }
1216
+ });
1217
+ });
1218
+ }
1219
+ get el() {
1220
+ return this._el.nativeElement;
1221
+ }
1222
+ ngOnDestroy() {
1223
+ this.removeStyles();
1224
+ this._destroy$.next();
1225
+ this._destroy$.complete();
1226
+ }
1227
+ removeStyles() {
1228
+ const el = document.querySelector('#contentPageStyles');
1229
+ if (el) {
1230
+ el.remove();
1231
+ }
1232
+ }
1233
+ }
1234
+ 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 });
1235
+ 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 });
1236
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ContentRendererComponent, decorators: [{
1237
+ type: Component,
1238
+ args: [{ selector: 'fs-content-renderer', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"content\" [innerHTML]=\"content\"></div>\n<span #script></span>", styles: [""] }]
1239
+ }], ctorParameters: function () { return [{ type: i1$2.DomSanitizer }, { type: i2$3.Router }, { type: i0.ElementRef }, { type: i3$3.HtmlRenderer }]; }, propDecorators: { script: [{
1240
+ type: ViewChild,
1241
+ args: ['script', { read: ElementRef }]
1242
+ }], contentPage: [{
1243
+ type: Input
1244
+ }] } });
1245
+
1246
+ class FsContentComponent {
1247
+ constructor(_config, _title, _cdRef, _router, _el, _htmlRenderer) {
1248
+ this._config = _config;
1249
+ this._title = _title;
1250
+ this._cdRef = _cdRef;
1251
+ this._router = _router;
1252
+ this._el = _el;
1253
+ this._htmlRenderer = _htmlRenderer;
1254
+ this._destroy$ = new Subject();
1255
+ }
1256
+ ngOnInit() {
1257
+ this._initContent();
1258
+ this._initStyles();
1259
+ }
1260
+ get el() {
1261
+ return this._el.nativeElement;
1262
+ }
1263
+ ngOnDestroy() {
1264
+ this._destroy$.next();
1265
+ this._destroy$.complete();
1266
+ this._title.setTitle('');
1267
+ }
1268
+ _initStyles() {
1269
+ if (this._config.loadContentStyleCss) {
1270
+ this._config.loadContentStyleCss()
1271
+ .subscribe((styles) => {
1272
+ this._htmlRenderer.addStyle(styles, { id: 'content-sytle' });
1273
+ });
1274
+ }
1275
+ }
1276
+ _initContent() {
1277
+ this._loadContent();
1278
+ this._router.events
1279
+ .pipe(filter((e) => e instanceof NavigationEnd), takeUntil(this._destroy$))
1280
+ .subscribe((e) => {
1281
+ this._loadContent();
1282
+ });
1283
+ }
1284
+ _loadContent() {
1285
+ const path = window.location.pathname;
1286
+ this._config.loadContent(path)
1287
+ .subscribe((contentPage) => {
1288
+ if (contentPage.title) {
1289
+ this._title.setTitle(contentPage.title);
1290
+ let ogTitleEl = document.querySelector('head meta[property="og:title"]');
1291
+ if (!ogTitleEl) {
1292
+ ogTitleEl = document.createElement('meta');
1293
+ ogTitleEl.setAttribute('property', 'og:title');
1294
+ document.getElementsByTagName('head')[0].appendChild(ogTitleEl);
1295
+ }
1296
+ ogTitleEl.setAttribute('content', contentPage.title);
1297
+ }
1298
+ this.contentPage = contentPage;
1299
+ this._cdRef.markForCheck();
1300
+ });
1301
+ }
1302
+ }
1303
+ 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 });
1304
+ 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 });
1305
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentComponent, decorators: [{
1306
+ type: Component,
1307
+ 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: [""] }]
1308
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1309
+ type: Inject,
1310
+ args: [FS_CONTENT_CONFIG]
1311
+ }] }, { type: i1$2.Title }, { type: i0.ChangeDetectorRef }, { type: i2$3.Router }, { type: i0.ElementRef }, { type: i3$3.HtmlRenderer }]; } });
1312
+
1313
+ class FsContentModule {
1314
+ }
1315
+ FsContentModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1316
+ FsContentModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentModule, declarations: [FsContentComponent,
1317
+ ContentRendererComponent], imports: [CommonModule,
1318
+ FsHtmlEditorModule], exports: [FsContentComponent] });
1319
+ FsContentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentModule, imports: [[
1320
+ CommonModule,
1321
+ FsHtmlEditorModule,
1322
+ ]] });
1323
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsContentModule, decorators: [{
1324
+ type: NgModule,
1325
+ args: [{
1326
+ imports: [
1327
+ CommonModule,
1328
+ FsHtmlEditorModule,
1329
+ ],
1330
+ exports: [
1331
+ FsContentComponent,
1332
+ ],
1333
+ declarations: [
1334
+ FsContentComponent,
1335
+ ContentRendererComponent,
1336
+ ],
1337
+ }]
1338
+ }] });
1339
+
1340
+ /**
1341
+ * Generated bundle index. Do not edit.
1342
+ */
1343
+
1344
+ export { ContentStyleComponent, FS_CONTENT_CONFIG, FsContentComponent, FsContentLayoutsComponent, FsContentLayoutsModule, FsContentModule, FsContentPagesComponent, FsContentPagesModule, FsContentStyleModule };
1345
+ //# sourceMappingURL=firestitch-content.mjs.map