@candy-kingdom/bonnie-cms 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/index.mjs +3 -5
- package/esm2022/lib/bonnie-cms.module.mjs +45 -22
- package/esm2022/lib/core-components/form-base.component.mjs +4 -7
- package/esm2022/lib/file-uploader/file-uploader.component.mjs +118 -0
- package/esm2022/lib/file-uploader/index.mjs +2 -0
- package/esm2022/lib/forms/file-form/file-form.component.mjs +43 -0
- package/esm2022/lib/forms/file-form/index.mjs +2 -0
- package/esm2022/lib/forms/index.mjs +8 -0
- package/esm2022/lib/forms/lottie-form/index.mjs +2 -0
- package/esm2022/lib/forms/lottie-form/lottie-form.component.mjs +45 -0
- package/esm2022/lib/forms/seo-form/index.mjs +2 -0
- package/esm2022/lib/{seo-form → forms/seo-form}/seo-form.component.mjs +6 -6
- package/esm2022/lib/forms/svg-form/index.mjs +2 -0
- package/esm2022/lib/forms/svg-form/svg-form.component.mjs +49 -0
- package/esm2022/lib/forms/text-form/TextInputStyle.mjs +7 -0
- package/esm2022/lib/forms/text-form/index.mjs +3 -0
- package/esm2022/lib/forms/text-form/text-form.component.mjs +33 -0
- package/esm2022/lib/forms/translation-form/index.mjs +2 -0
- package/esm2022/lib/forms/translation-form/translation-form.component.mjs +32 -0
- package/esm2022/lib/forms/unknown-form/index.mjs +2 -0
- package/esm2022/lib/forms/unknown-form/unknown-form.component.mjs +23 -0
- package/esm2022/lib/generated/file-setting-data.mjs +6 -0
- package/esm2022/lib/generated/i-setting.mjs +1 -1
- package/esm2022/lib/generated/index.mjs +4 -1
- package/esm2022/lib/generated/lottie-setting-data.mjs +6 -0
- package/esm2022/lib/generated/svg-setting-data.mjs +6 -0
- package/esm2022/lib/media-uploader/media-uploader.component.mjs +3 -3
- package/esm2022/lib/translation-textarea/translation-textarea.component.mjs +1 -1
- package/fesm2022/candy-kingdom-bonnie-cms.mjs +528 -273
- package/fesm2022/candy-kingdom-bonnie-cms.mjs.map +1 -1
- package/index.d.ts +2 -4
- package/lib/bonnie-cms.module.d.ts +26 -21
- package/lib/core-components/form-base.component.d.ts +3 -5
- package/lib/file-uploader/file-uploader.component.d.ts +32 -0
- package/lib/file-uploader/index.d.ts +1 -0
- package/lib/forms/file-form/file-form.component.d.ts +14 -0
- package/lib/forms/file-form/index.d.ts +1 -0
- package/lib/forms/index.d.ts +7 -0
- package/lib/forms/lottie-form/index.d.ts +1 -0
- package/lib/forms/lottie-form/lottie-form.component.d.ts +16 -0
- package/lib/{seo-form → forms/seo-form}/seo-form.component.d.ts +2 -2
- package/lib/forms/svg-form/index.d.ts +1 -0
- package/lib/forms/svg-form/svg-form.component.d.ts +19 -0
- package/lib/{text-form → forms/text-form}/text-form.component.d.ts +3 -3
- package/lib/{translation-form → forms/translation-form}/translation-form.component.d.ts +4 -4
- package/lib/{unknown-form → forms/unknown-form}/unknown-form.component.d.ts +2 -2
- package/lib/generated/file-setting-data.d.ts +10 -0
- package/lib/generated/i-setting.d.ts +2 -0
- package/lib/generated/index.d.ts +3 -0
- package/lib/generated/lottie-setting-data.d.ts +9 -0
- package/lib/generated/svg-setting-data.d.ts +9 -0
- package/package.json +1 -1
- package/esm2022/lib/seo-form/index.mjs +0 -2
- package/esm2022/lib/text-form/TextInputStyle.mjs +0 -7
- package/esm2022/lib/text-form/index.mjs +0 -3
- package/esm2022/lib/text-form/text-form.component.mjs +0 -33
- package/esm2022/lib/translation-form/index.mjs +0 -2
- package/esm2022/lib/translation-form/translation-form.component.mjs +0 -32
- package/esm2022/lib/unknown-form/index.mjs +0 -2
- package/esm2022/lib/unknown-form/unknown-form.component.mjs +0 -23
- /package/lib/{seo-form → forms/seo-form}/index.d.ts +0 -0
- /package/lib/{text-form → forms/text-form}/TextInputStyle.d.ts +0 -0
- /package/lib/{text-form → forms/text-form}/index.d.ts +0 -0
- /package/lib/{translation-form → forms/translation-form}/index.d.ts +0 -0
- /package/lib/{unknown-form → forms/unknown-form}/index.d.ts +0 -0
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import * as i1 from '@angular/common/http';
|
|
2
|
-
import { HttpRequest, HttpEventType } from '@angular/common/http';
|
|
3
1
|
import * as i0 from '@angular/core';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { EventEmitter, forwardRef, Directive, Output, Component, ContentChildren, Host, Input, ViewChildren, ViewChild, ChangeDetectorRef, inject, Injectable, Inject, HostBinding, NgModule } from '@angular/core';
|
|
3
|
+
import { Subject, debounceTime, map, last, catchError, Observable, of, combineLatest, merge, mergeMap } from 'rxjs';
|
|
4
|
+
import * as i1 from '@angular/forms';
|
|
5
|
+
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
6
6
|
import * as i2$1 from '@angular/common';
|
|
7
7
|
import { APP_BASE_HREF, CommonModule } from '@angular/common';
|
|
8
|
-
import * as i1$1 from '@angular/forms';
|
|
9
|
-
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
10
8
|
import * as i2 from '@angular/cdk/text-field';
|
|
11
9
|
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
|
12
10
|
import { take } from 'rxjs/operators';
|
|
13
|
-
import * as i1$
|
|
11
|
+
import * as i1$1 from '@angular/platform-browser';
|
|
12
|
+
import * as i1$2 from '@angular/common/http';
|
|
13
|
+
import { HttpRequest, HttpEventType } from '@angular/common/http';
|
|
14
|
+
import * as i3 from 'ngx-lottie';
|
|
15
|
+
import { LottieComponent } from 'ngx-lottie';
|
|
14
16
|
import * as i4 from '@candy-kingdom/bonnie';
|
|
15
17
|
import { MediaObjectFit, BonnieModule } from '@candy-kingdom/bonnie';
|
|
16
18
|
|
|
@@ -54,6 +56,21 @@ import { MediaObjectFit, BonnieModule } from '@candy-kingdom/bonnie';
|
|
|
54
56
|
* Any changes made to this file can be lost when this file is regenerated.
|
|
55
57
|
*/
|
|
56
58
|
|
|
59
|
+
/**
|
|
60
|
+
* This is a TypeGen auto-generated file.
|
|
61
|
+
* Any changes made to this file can be lost when this file is regenerated.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* This is a TypeGen auto-generated file.
|
|
66
|
+
* Any changes made to this file can be lost when this file is regenerated.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* This is a TypeGen auto-generated file.
|
|
71
|
+
* Any changes made to this file can be lost when this file is regenerated.
|
|
72
|
+
*/
|
|
73
|
+
|
|
57
74
|
/**
|
|
58
75
|
* This is a TypeGen auto-generated file.
|
|
59
76
|
* Any changes made to this file can be lost when this file is regenerated.
|
|
@@ -111,107 +128,6 @@ var DeviceVisibility;
|
|
|
111
128
|
DeviceVisibility[DeviceVisibility["All"] = 7] = "All";
|
|
112
129
|
})(DeviceVisibility || (DeviceVisibility = {}));
|
|
113
130
|
|
|
114
|
-
class DataService {
|
|
115
|
-
constructor(http, baseHref) {
|
|
116
|
-
this.http = http;
|
|
117
|
-
this.baseHref = baseHref;
|
|
118
|
-
}
|
|
119
|
-
getView(viewCode) {
|
|
120
|
-
const pageOb = this.getSkeleton(`${this.baseHref}api/views/${viewCode}`);
|
|
121
|
-
return pageOb;
|
|
122
|
-
}
|
|
123
|
-
getPage(pageRoute) {
|
|
124
|
-
const pageUrl = `/${pageRoute}`;
|
|
125
|
-
const pageOb = this.getSkeleton(`${this.baseHref}api/pages/?url=${encodeURIComponent(pageUrl)}`);
|
|
126
|
-
return pageOb;
|
|
127
|
-
}
|
|
128
|
-
getSettings(ids) {
|
|
129
|
-
const pageOb = this.http.get(`${this.baseHref}api/settings`, {
|
|
130
|
-
params: { ids: ids }
|
|
131
|
-
});
|
|
132
|
-
return pageOb;
|
|
133
|
-
}
|
|
134
|
-
getSkeleton(url) {
|
|
135
|
-
const skeletonOb = this.http.get(url);
|
|
136
|
-
const routeDataObs = skeletonOb
|
|
137
|
-
.pipe(map(x => {
|
|
138
|
-
const notEmptyDataRoutes = x.bones
|
|
139
|
-
.map(b => ('dataRoute' in b) && typeof (b.dataRoute) === 'string' ? b.dataRoute : '')
|
|
140
|
-
.filter(x => x.length > 0);
|
|
141
|
-
if (notEmptyDataRoutes.length === 0) {
|
|
142
|
-
const emptyData = {};
|
|
143
|
-
return { page: of(x), data: of(emptyData) };
|
|
144
|
-
}
|
|
145
|
-
return {
|
|
146
|
-
page: of(x),
|
|
147
|
-
data: combineLatest(notEmptyDataRoutes
|
|
148
|
-
.map(dataRoute => {
|
|
149
|
-
const url = `${this.baseHref}api/Pages/Children/?url=${dataRoute}`;
|
|
150
|
-
return {
|
|
151
|
-
route: dataRoute,
|
|
152
|
-
json: this.http.get(url)
|
|
153
|
-
};
|
|
154
|
-
})
|
|
155
|
-
.reduce((prev, curr) => {
|
|
156
|
-
prev[curr.route] = curr.json;
|
|
157
|
-
return prev;
|
|
158
|
-
}, {}))
|
|
159
|
-
};
|
|
160
|
-
}), map(x => combineLatest(x)), mergeMap(res => merge(res)), map(x => {
|
|
161
|
-
for (const bone of x.page.bones) {
|
|
162
|
-
if (!('dataRoute' in bone) || typeof bone.dataRoute !== 'string' || bone.dataRoute.length === 0)
|
|
163
|
-
continue;
|
|
164
|
-
const data = x.data[bone.dataRoute];
|
|
165
|
-
if (data === undefined || data === null)
|
|
166
|
-
throw new Error(`Data ${bone.dataRoute} have not been preloaded`);
|
|
167
|
-
bone.data = data; // todo: fix
|
|
168
|
-
}
|
|
169
|
-
return x.page;
|
|
170
|
-
}));
|
|
171
|
-
return routeDataObs;
|
|
172
|
-
}
|
|
173
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: DataService, deps: [{ token: i1.HttpClient }, { token: APP_BASE_HREF }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
174
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: DataService }); }
|
|
175
|
-
}
|
|
176
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: DataService, decorators: [{
|
|
177
|
-
type: Injectable
|
|
178
|
-
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
179
|
-
type: Inject,
|
|
180
|
-
args: [APP_BASE_HREF]
|
|
181
|
-
}] }] });
|
|
182
|
-
|
|
183
|
-
class AdminDataService {
|
|
184
|
-
constructor(http, baseHref) {
|
|
185
|
-
this.http = http;
|
|
186
|
-
this.baseHref = baseHref;
|
|
187
|
-
console.log('baseHref: ' + baseHref);
|
|
188
|
-
}
|
|
189
|
-
getSettingGroups() {
|
|
190
|
-
const pageOb = this.http.get(`${this.baseHref}api/admin/settings`);
|
|
191
|
-
return pageOb;
|
|
192
|
-
}
|
|
193
|
-
getPage(url) {
|
|
194
|
-
const pageOb = this.http.get(`${this.baseHref}api/admin/pages/${url}`);
|
|
195
|
-
return pageOb;
|
|
196
|
-
}
|
|
197
|
-
storePage(page) {
|
|
198
|
-
const ob = this.http.post(`${this.baseHref}api/admin/pages`, page);
|
|
199
|
-
return ob;
|
|
200
|
-
}
|
|
201
|
-
updateSettings(settings) {
|
|
202
|
-
const ob = this.http.post(`${this.baseHref}api/admin/settings`, settings);
|
|
203
|
-
return ob;
|
|
204
|
-
}
|
|
205
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: AdminDataService, deps: [{ token: i1.HttpClient }, { token: APP_BASE_HREF }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
206
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: AdminDataService }); }
|
|
207
|
-
}
|
|
208
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: AdminDataService, decorators: [{
|
|
209
|
-
type: Injectable
|
|
210
|
-
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
211
|
-
type: Inject,
|
|
212
|
-
args: [APP_BASE_HREF]
|
|
213
|
-
}] }] });
|
|
214
|
-
|
|
215
131
|
class EditableDirective {
|
|
216
132
|
constructor() {
|
|
217
133
|
this.saved = new EventEmitter();
|
|
@@ -464,9 +380,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
464
380
|
|
|
465
381
|
class FormBaseComponent {
|
|
466
382
|
static { this.inputs = ['locale']; }
|
|
467
|
-
constructor(editable
|
|
383
|
+
constructor(editable) {
|
|
468
384
|
this.editable = editable;
|
|
469
|
-
this.http = http;
|
|
470
385
|
this.name = '';
|
|
471
386
|
this._locale = '';
|
|
472
387
|
}
|
|
@@ -476,7 +391,7 @@ class FormBaseComponent {
|
|
|
476
391
|
get locale() {
|
|
477
392
|
return this._locale;
|
|
478
393
|
}
|
|
479
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: FormBaseComponent, deps: [{ token: EditableDirective, host: true }
|
|
394
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: FormBaseComponent, deps: [{ token: EditableDirective, host: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
480
395
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: FormBaseComponent, selector: "ng-component", inputs: { locale: "locale" }, ngImport: i0, template: '', isInline: true }); }
|
|
481
396
|
}
|
|
482
397
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: FormBaseComponent, decorators: [{
|
|
@@ -486,7 +401,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
486
401
|
}]
|
|
487
402
|
}], ctorParameters: () => [{ type: EditableDirective, decorators: [{
|
|
488
403
|
type: Host
|
|
489
|
-
}] }
|
|
404
|
+
}] }], propDecorators: { locale: [{
|
|
490
405
|
type: Input
|
|
491
406
|
}] } });
|
|
492
407
|
|
|
@@ -507,7 +422,7 @@ class TranslationInputComponent {
|
|
|
507
422
|
this.blurred.emit();
|
|
508
423
|
}
|
|
509
424
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslationInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
510
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: TranslationInputComponent, selector: "bonc-translation-input", inputs: { text: "text", locale: "locale", device: "device" }, outputs: { startEditing: "startEditing", changed: "changed", blurred: "blurred" }, ngImport: i0, template: "<input [(ngModel)]=\"text[locale]\"\r\n (click)=\"onClick()\"\r\n (keyup)=\"onKeyPress()\"\r\n (blur)=\"onBlur()\" />\r\n", styles: [":host{padding:6px 12px;border:1px solid silver;display:block}:host:hover{background-color:#333}:host:focus-within{background-color:#555}:host input{background-color:#8080801a;color:var(--text-color);padding:6px;color:silver;border:1px solid silver;background-color:transparent;display:block;box-sizing:border-box;font-family:inherit;width:100%;border:none}:host input:hover{background-color:#d3d3d3;cursor:pointer}:host input:focus{outline:none;color:#000;background-color:#cf0}:host input:hover{border-color:transparent;background-color:#333;cursor:pointer}:host input:focus{outline:none;color:#fff;border-color:transparent;background-color:#555}\n"], dependencies: [{ kind: "directive", type: i1
|
|
425
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: TranslationInputComponent, selector: "bonc-translation-input", inputs: { text: "text", locale: "locale", device: "device" }, outputs: { startEditing: "startEditing", changed: "changed", blurred: "blurred" }, ngImport: i0, template: "<input [(ngModel)]=\"text[locale]\"\r\n (click)=\"onClick()\"\r\n (keyup)=\"onKeyPress()\"\r\n (blur)=\"onBlur()\" />\r\n", styles: [":host{padding:6px 12px;border:1px solid silver;display:block}:host:hover{background-color:#333}:host:focus-within{background-color:#555}:host input{background-color:#8080801a;color:var(--text-color);padding:6px;color:silver;border:1px solid silver;background-color:transparent;display:block;box-sizing:border-box;font-family:inherit;width:100%;border:none}:host input:hover{background-color:#d3d3d3;cursor:pointer}:host input:focus{outline:none;color:#000;background-color:#cf0}:host input:hover{border-color:transparent;background-color:#333;cursor:pointer}:host input:focus{outline:none;color:#fff;border-color:transparent;background-color:#555}\n"], dependencies: [{ kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
511
426
|
}
|
|
512
427
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslationInputComponent, decorators: [{
|
|
513
428
|
type: Component,
|
|
@@ -559,7 +474,7 @@ class TranslationTextareaComponent {
|
|
|
559
474
|
});
|
|
560
475
|
}
|
|
561
476
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslationTextareaComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
562
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: TranslationTextareaComponent, selector: "bonc-translation-textarea", inputs: { minRows: "minRows", maxRows: "maxRows", text: "text", locale: "locale", device: "device" }, outputs: { startEditing: "startEditing", changed: "changed", blurred: "blurred" }, viewQueries: [{ propertyName: "autosizeList", predicate: CdkTextareaAutosize, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<textarea [(ngModel)]=\"text[locale]\"\r\n [cdkAutosizeMinRows]=\"minRows\"\r\n [cdkAutosizeMaxRows]=\"maxRows\"\r\n (click)=\"onClick()\"\r\n (keyup)=\"onKeyPress()\"\r\n (blur)=\"onBlur()\"\r\n matInput\r\n cdkTextareaAutosize>\r\n</textarea>\r\n", styles: [":host{display:block;padding:6px 12px;border:1px solid silver}:host:hover{background-color:#333}:host:focus-within{background-color:#555}textarea{display:block;width:100%;line-height:140%;padding:2px 0;margin:0;box-sizing:content-box;border:none;resize:none;color:silver;background-color:transparent}textarea:focus{outline:none}textarea[readonly]{cursor:pointer}textarea[readonly]::selection{-webkit-user-select:none;user-select:none}textarea[readonly]:hover{background:repeating-linear-gradient(-45deg,#ccff00,#ccff00 10px,rgba(0,0,0,0) 10px,rgba(0,0,0,0) 20px) fixed bottom;color:#000}textarea:hover{cursor:pointer}textarea:focus{outline:none;color:#fff;cursor:default}\n"], dependencies: [{ kind: "directive", type: i1
|
|
477
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: TranslationTextareaComponent, selector: "bonc-translation-textarea", inputs: { minRows: "minRows", maxRows: "maxRows", text: "text", locale: "locale", device: "device" }, outputs: { startEditing: "startEditing", changed: "changed", blurred: "blurred" }, viewQueries: [{ propertyName: "autosizeList", predicate: CdkTextareaAutosize, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<textarea [(ngModel)]=\"text[locale]\"\r\n [cdkAutosizeMinRows]=\"minRows\"\r\n [cdkAutosizeMaxRows]=\"maxRows\"\r\n (click)=\"onClick()\"\r\n (keyup)=\"onKeyPress()\"\r\n (blur)=\"onBlur()\"\r\n matInput\r\n cdkTextareaAutosize>\r\n</textarea>\r\n", styles: [":host{display:block;padding:6px 12px;border:1px solid silver}:host:hover{background-color:#333}:host:focus-within{background-color:#555}textarea{display:block;width:100%;line-height:140%;padding:2px 0;margin:0;box-sizing:content-box;border:none;resize:none;color:silver;background-color:transparent}textarea:focus{outline:none}textarea[readonly]{cursor:pointer}textarea[readonly]::selection{-webkit-user-select:none;user-select:none}textarea[readonly]:hover{background:repeating-linear-gradient(-45deg,#ccff00,#ccff00 10px,rgba(0,0,0,0) 10px,rgba(0,0,0,0) 20px) fixed bottom;color:#000}textarea:hover{cursor:pointer}textarea:focus{outline:none;color:#fff;cursor:default}\n"], dependencies: [{ kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }] }); }
|
|
563
478
|
}
|
|
564
479
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslationTextareaComponent, decorators: [{
|
|
565
480
|
type: Component,
|
|
@@ -618,7 +533,7 @@ class LinkPopupComponent {
|
|
|
618
533
|
this.closed.emit();
|
|
619
534
|
}
|
|
620
535
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LinkPopupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
621
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: LinkPopupComponent, selector: "bonc-link-popup", inputs: { field: "field", maxRows: "maxRows", minRows: "minRows", linkTitle: "linkTitle", locale: "locale", link: "link" }, outputs: { linkChange: "linkChange", startEditing: "startEditing", changed: "changed", blurred: "blurred", open: "open", closed: "closed" }, ngImport: i0, template: "<bonc-translation-input *ngIf=\"field === TextEditorField.Input\"\r\n (click)=\"showPopup()\"\r\n [text]=\"linkTitle\"\r\n [locale]=\"locale\"\r\n (startEditing)=\"onClick()\"\r\n (changed)=\"onChange()\"\r\n (blurred)=\"onBlur()\">\r\n</bonc-translation-input>\r\n\r\n<bonc-translation-textarea *ngIf=\"field === TextEditorField.Textarea\"\r\n (click)=\"showPopup()\"\r\n [text]=\"linkTitle\"\r\n [locale]=\"locale\"\r\n [minRows]=\"minRows\"\r\n [maxRows]=\"maxRows\"\r\n (startEditing)=\"onClick()\"\r\n (changed)=\"onChange()\"\r\n (blurred)=\"onBlur()\">\r\n</bonc-translation-textarea>\r\n\r\n<div *ngIf=\"popupIsShown\">\r\n <div class=\"popup\">\r\n <a (click)=\"hidePopup()\" class=\"close\">close</a>\r\n\r\n <label>Link\r\n <input [(ngModel)]=\"link[locale]\"\r\n (click)=\"onClick()\"\r\n (keyup)=\"onChange()\"\r\n (blur)=\"onBlur()\">\r\n </label>\r\n\r\n </div>\r\n</div>\r\n", styles: [":host{display:flex;flex-direction:column;position:relative}:host translation-input{z-index:1}.popup{position:absolute;display:flex;flex-direction:column;justify-content:center;width:350px;padding:20px;box-sizing:border-box;color:#000;background-color:#fff;z-index:5;border:2px solid black}.popup a{cursor:pointer}.popup a:hover{background-color:#cf0}.popup a.close{position:absolute;top:10px;right:10px}.popup label+label{margin-top:20px}.popup input{width:100%;margin-top:5px;padding:6px;font-size:12px;box-sizing:border-box;border:1px solid #222}.popup input:hover,.popup input:focus{background-color:silver;color:#333;border-color:silver;outline:none}button{display:block;color:#fff;background-color:transparent;box-shadow:none;border:none;outline:none;text-decoration:none;padding:3pt 10pt;text-align:center;-webkit-user-select:none;user-select:none;color:#000;cursor:pointer}button:hover{border-color:#333;background-color:#333}button:disabled{color:gray}button:hover{background-color:#cf0}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1
|
|
536
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: LinkPopupComponent, selector: "bonc-link-popup", inputs: { field: "field", maxRows: "maxRows", minRows: "minRows", linkTitle: "linkTitle", locale: "locale", link: "link" }, outputs: { linkChange: "linkChange", startEditing: "startEditing", changed: "changed", blurred: "blurred", open: "open", closed: "closed" }, ngImport: i0, template: "<bonc-translation-input *ngIf=\"field === TextEditorField.Input\"\r\n (click)=\"showPopup()\"\r\n [text]=\"linkTitle\"\r\n [locale]=\"locale\"\r\n (startEditing)=\"onClick()\"\r\n (changed)=\"onChange()\"\r\n (blurred)=\"onBlur()\">\r\n</bonc-translation-input>\r\n\r\n<bonc-translation-textarea *ngIf=\"field === TextEditorField.Textarea\"\r\n (click)=\"showPopup()\"\r\n [text]=\"linkTitle\"\r\n [locale]=\"locale\"\r\n [minRows]=\"minRows\"\r\n [maxRows]=\"maxRows\"\r\n (startEditing)=\"onClick()\"\r\n (changed)=\"onChange()\"\r\n (blurred)=\"onBlur()\">\r\n</bonc-translation-textarea>\r\n\r\n<div *ngIf=\"popupIsShown\">\r\n <div class=\"popup\">\r\n <a (click)=\"hidePopup()\" class=\"close\">close</a>\r\n\r\n <label>Link\r\n <input [(ngModel)]=\"link[locale]\"\r\n (click)=\"onClick()\"\r\n (keyup)=\"onChange()\"\r\n (blur)=\"onBlur()\">\r\n </label>\r\n\r\n </div>\r\n</div>\r\n", styles: [":host{display:flex;flex-direction:column;position:relative}:host translation-input{z-index:1}.popup{position:absolute;display:flex;flex-direction:column;justify-content:center;width:350px;padding:20px;box-sizing:border-box;color:#000;background-color:#fff;z-index:5;border:2px solid black}.popup a{cursor:pointer}.popup a:hover{background-color:#cf0}.popup a.close{position:absolute;top:10px;right:10px}.popup label+label{margin-top:20px}.popup input{width:100%;margin-top:5px;padding:6px;font-size:12px;box-sizing:border-box;border:1px solid #222}.popup input:hover,.popup input:focus{background-color:silver;color:#333;border-color:silver;outline:none}button{display:block;color:#fff;background-color:transparent;box-shadow:none;border:none;outline:none;text-decoration:none;padding:3pt 10pt;text-align:center;-webkit-user-select:none;user-select:none;color:#000;cursor:pointer}button:hover{border-color:#333;background-color:#333}button:disabled{color:gray}button:hover{background-color:#cf0}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: TranslationInputComponent, selector: "bonc-translation-input", inputs: ["text", "locale", "device"], outputs: ["startEditing", "changed", "blurred"] }, { kind: "component", type: TranslationTextareaComponent, selector: "bonc-translation-textarea", inputs: ["minRows", "maxRows", "text", "locale", "device"], outputs: ["startEditing", "changed", "blurred"] }] }); }
|
|
622
537
|
}
|
|
623
538
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LinkPopupComponent, decorators: [{
|
|
624
539
|
type: Component,
|
|
@@ -653,45 +568,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
653
568
|
args: [{ required: true }]
|
|
654
569
|
}] } });
|
|
655
570
|
|
|
656
|
-
class AdminControlsComponent {
|
|
657
|
-
constructor() {
|
|
658
|
-
this.DeviceType = DeviceType;
|
|
659
|
-
this.deviceControls = false;
|
|
660
|
-
this.locale = 'en';
|
|
661
|
-
this.device = this.DeviceType.Desktop;
|
|
662
|
-
}
|
|
663
|
-
changeLocale() {
|
|
664
|
-
this.locale = this.locale === 'en' ? 'ru' : 'en';
|
|
665
|
-
}
|
|
666
|
-
changeDevice() {
|
|
667
|
-
switch (this.device) {
|
|
668
|
-
case DeviceType.Desktop:
|
|
669
|
-
this.device = DeviceType.Tablet;
|
|
670
|
-
return;
|
|
671
|
-
case DeviceType.Tablet:
|
|
672
|
-
this.device = DeviceType.Mobile;
|
|
673
|
-
return;
|
|
674
|
-
case DeviceType.Mobile:
|
|
675
|
-
this.device = DeviceType.Desktop;
|
|
676
|
-
return;
|
|
677
|
-
default:
|
|
678
|
-
this.device = DeviceType.Desktop;
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: AdminControlsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
683
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: AdminControlsComponent, selector: "bonc-admin-controls", inputs: { editableGroup: "editableGroup", deviceControls: "deviceControls" }, ngImport: i0, template: "<div class=\"page-controls\">\r\n <a (click)=\"changeLocale()\" class=\"locale\">Locale: {{locale}}</a>\r\n\r\n <!-- todo: return this functionality -->\r\n <!-- <a *ngIf=\"deviceControls\" (click)=\"changeDevice()\" class=\"device\">\r\n <span *ngIf=\"device === DeviceType.Desktop\">DESKTOP</span>\r\n <span *ngIf=\"device === DeviceType.Tablet\">TABLET</span>\r\n <span *ngIf=\"device === DeviceType.Mobile\">MOBILE</span>\r\n </a> -->\r\n\r\n <a *ngIf=\"editableGroup && editableGroup.inEditMode\"\r\n (click)=\"editableGroup.saveAll()\"\r\n class=\"save\">Save all</a>\r\n\r\n <a *ngIf=\"editableGroup && editableGroup.inEditMode\"\r\n (click)=\"editableGroup.cancelAll()\"\r\n class=\"cancel\">Cancel all</a>\r\n</div>\r\n", styles: [":host{display:block;position:sticky;top:0;width:100%;z-index:1000}.page-controls{background-color:#111;height:60px;display:flex;align-items:center;justify-content:center}.page-controls a{color:silver;padding:4px;cursor:pointer;-webkit-user-select:none;user-select:none;text-align:center}.page-controls a:hover{color:#000;background-color:#cf0}.page-controls a.device{width:80px}.page-controls a+a{margin-left:6px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
684
|
-
}
|
|
685
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: AdminControlsComponent, decorators: [{
|
|
686
|
-
type: Component,
|
|
687
|
-
args: [{ selector: 'bonc-admin-controls', template: "<div class=\"page-controls\">\r\n <a (click)=\"changeLocale()\" class=\"locale\">Locale: {{locale}}</a>\r\n\r\n <!-- todo: return this functionality -->\r\n <!-- <a *ngIf=\"deviceControls\" (click)=\"changeDevice()\" class=\"device\">\r\n <span *ngIf=\"device === DeviceType.Desktop\">DESKTOP</span>\r\n <span *ngIf=\"device === DeviceType.Tablet\">TABLET</span>\r\n <span *ngIf=\"device === DeviceType.Mobile\">MOBILE</span>\r\n </a> -->\r\n\r\n <a *ngIf=\"editableGroup && editableGroup.inEditMode\"\r\n (click)=\"editableGroup.saveAll()\"\r\n class=\"save\">Save all</a>\r\n\r\n <a *ngIf=\"editableGroup && editableGroup.inEditMode\"\r\n (click)=\"editableGroup.cancelAll()\"\r\n class=\"cancel\">Cancel all</a>\r\n</div>\r\n", styles: [":host{display:block;position:sticky;top:0;width:100%;z-index:1000}.page-controls{background-color:#111;height:60px;display:flex;align-items:center;justify-content:center}.page-controls a{color:silver;padding:4px;cursor:pointer;-webkit-user-select:none;user-select:none;text-align:center}.page-controls a:hover{color:#000;background-color:#cf0}.page-controls a.device{width:80px}.page-controls a+a{margin-left:6px}\n"] }]
|
|
688
|
-
}], propDecorators: { editableGroup: [{
|
|
689
|
-
type: Input,
|
|
690
|
-
args: [{ required: true }]
|
|
691
|
-
}], deviceControls: [{
|
|
692
|
-
type: Input
|
|
693
|
-
}] } });
|
|
694
|
-
|
|
695
571
|
class FormControlsComponent {
|
|
696
572
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: FormControlsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
697
573
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: FormControlsComponent, selector: "bonc-form-controls", inputs: { editable: "editable" }, ngImport: i0, template: "<div [class.edit]=\"editable.inEditMode\" class=\"content\">\r\n <ng-content></ng-content>\r\n</div>\r\n\r\n<div [class.hidden]=\"!editable.inEditMode\" class=\"controls\">\r\n <a *ngIf=\"!editable.isDirty\" (click)=\"editable.cancel()\" class=\"close\">close</a>\r\n <ng-container *ngIf=\"editable.isDirty\">\r\n <a (click)=\"editable.cancel()\">reset</a>\r\n <a (click)=\"editable.requestSave()\" class=\"apply\">apply</a>\r\n </ng-container>\r\n</div>\r\n", styles: [":host{display:flex;background-color:#222;color:silver}.content{flex:1;padding:10px}.content.edit{background-color:#111}.controls{display:flex;flex-direction:column;width:100px;background-color:#111}.controls.hidden{opacity:0;pointer-events:none}.controls a{display:block}.controls a.apply{flex:1}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
@@ -704,21 +580,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
704
580
|
args: [{ required: true }]
|
|
705
581
|
}] } });
|
|
706
582
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
583
|
+
class SeoFormComponent extends FormBaseComponent {
|
|
584
|
+
constructor() {
|
|
585
|
+
super(...arguments);
|
|
586
|
+
this._pageId = '';
|
|
587
|
+
this.ogImageUploadUrl = '';
|
|
588
|
+
this.label = '';
|
|
589
|
+
}
|
|
590
|
+
ngOnInit() {
|
|
591
|
+
this.editable.externalSaveCall.subscribe(() => {
|
|
592
|
+
this.editable.save();
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
set pageId(value) {
|
|
596
|
+
this._pageId = value;
|
|
597
|
+
this.ogImageUploadUrl = `/api/admin/page/Og-Image?pageId=${this.pageId}`; // todo: replace with link to single image api
|
|
598
|
+
}
|
|
599
|
+
get pageId() {
|
|
600
|
+
return this._pageId;
|
|
601
|
+
}
|
|
602
|
+
ResToSrc(res) {
|
|
603
|
+
return res.url;
|
|
604
|
+
}
|
|
605
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: SeoFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
606
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: SeoFormComponent, selector: "bonc-seo-form", inputs: { label: "label", pageId: "pageId" }, usesInheritance: true, hostDirectives: [{ directive: EditableDirective }], ngImport: i0, template: "<bonc-form-controls *ngIf=\"editable.value\" [editable]=\"editable\">\r\n <h2 *ngIf=\"label\">{{label}}</h2>\r\n\r\n <div class=\"form-group\">\r\n <label>Title</label>\r\n <bonc-translation-input [text]=\"editable.value.title\"\r\n [locale]=\"locale\"\r\n (startEditing)=\"editable.startEditing()\"\r\n (changed)=\"editable.updateDirty()\"\r\n (blurred)=\"editable.updateDirty()\">\r\n </bonc-translation-input>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Description</label>\r\n <bonc-translation-textarea [text]=\"editable.value.description\"\r\n [locale]=\"locale\"\r\n (startEditing)=\"editable.startEditing()\"\r\n (changed)=\"editable.updateDirty()\"\r\n (blurred)=\"editable.updateDirty()\">\r\n </bonc-translation-textarea>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Share image | 1200x630px</label>\r\n <!-- <simple-file-uploader *ngIf=\"locale === 'en'\"\r\n [(src)]=\"editable.value.ogImage.en\"\r\n [forceUploadUrl]=\"ogImageUploadUrl\"\r\n [uploadType]=\"MediaType.Image\"\r\n [needDelete]=\"true\"\r\n (deleteFile)=\"deleteOgImage()\"\r\n [ratio]=\"1200/630\"\r\n [resToSrc]=\"ResToSrc\"\r\n (srcChange)=\"editable.startEditing(); editable.patchSave('ogImage',editable.value.ogImage)\">\r\n </simple-file-uploader>\r\n\r\n <simple-file-uploader *ngIf=\"locale === 'ru'\"\r\n [(src)]=\"editable.value.ogImage.ru\"\r\n [forceUploadUrl]=\"ogImageUploadUrl\"\r\n [uploadType]=\"MediaType.Image\"\r\n [needDelete]=\"true\"\r\n (deleteFile)=\"deleteOgImage()\"\r\n [ratio]=\"1200/630\"\r\n [resToSrc]=\"ResToSrc\"\r\n (srcChange)=\"editable.startEditing(); editable.patchSave('ogImage',editable.value.ogImage)\">\r\n </simple-file-uploader> -->\r\n\r\n </div>\r\n\r\n</bonc-form-controls>\r\n\r\n<div *ngIf=\"!editable.value\">Editable Value canot be null or undefined</div>\r\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TranslationInputComponent, selector: "bonc-translation-input", inputs: ["text", "locale", "device"], outputs: ["startEditing", "changed", "blurred"] }, { kind: "component", type: TranslationTextareaComponent, selector: "bonc-translation-textarea", inputs: ["minRows", "maxRows", "text", "locale", "device"], outputs: ["startEditing", "changed", "blurred"] }, { kind: "component", type: FormControlsComponent, selector: "bonc-form-controls", inputs: ["editable"] }] }); }
|
|
607
|
+
}
|
|
608
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: SeoFormComponent, decorators: [{
|
|
609
|
+
type: Component,
|
|
610
|
+
args: [{ selector: 'bonc-seo-form', hostDirectives: [EditableDirective], template: "<bonc-form-controls *ngIf=\"editable.value\" [editable]=\"editable\">\r\n <h2 *ngIf=\"label\">{{label}}</h2>\r\n\r\n <div class=\"form-group\">\r\n <label>Title</label>\r\n <bonc-translation-input [text]=\"editable.value.title\"\r\n [locale]=\"locale\"\r\n (startEditing)=\"editable.startEditing()\"\r\n (changed)=\"editable.updateDirty()\"\r\n (blurred)=\"editable.updateDirty()\">\r\n </bonc-translation-input>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Description</label>\r\n <bonc-translation-textarea [text]=\"editable.value.description\"\r\n [locale]=\"locale\"\r\n (startEditing)=\"editable.startEditing()\"\r\n (changed)=\"editable.updateDirty()\"\r\n (blurred)=\"editable.updateDirty()\">\r\n </bonc-translation-textarea>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Share image | 1200x630px</label>\r\n <!-- <simple-file-uploader *ngIf=\"locale === 'en'\"\r\n [(src)]=\"editable.value.ogImage.en\"\r\n [forceUploadUrl]=\"ogImageUploadUrl\"\r\n [uploadType]=\"MediaType.Image\"\r\n [needDelete]=\"true\"\r\n (deleteFile)=\"deleteOgImage()\"\r\n [ratio]=\"1200/630\"\r\n [resToSrc]=\"ResToSrc\"\r\n (srcChange)=\"editable.startEditing(); editable.patchSave('ogImage',editable.value.ogImage)\">\r\n </simple-file-uploader>\r\n\r\n <simple-file-uploader *ngIf=\"locale === 'ru'\"\r\n [(src)]=\"editable.value.ogImage.ru\"\r\n [forceUploadUrl]=\"ogImageUploadUrl\"\r\n [uploadType]=\"MediaType.Image\"\r\n [needDelete]=\"true\"\r\n (deleteFile)=\"deleteOgImage()\"\r\n [ratio]=\"1200/630\"\r\n [resToSrc]=\"ResToSrc\"\r\n (srcChange)=\"editable.startEditing(); editable.patchSave('ogImage',editable.value.ogImage)\">\r\n </simple-file-uploader> -->\r\n\r\n </div>\r\n\r\n</bonc-form-controls>\r\n\r\n<div *ngIf=\"!editable.value\">Editable Value canot be null or undefined</div>\r\n", styles: [":host{display:block}\n"] }]
|
|
611
|
+
}], propDecorators: { label: [{
|
|
612
|
+
type: Input
|
|
613
|
+
}], pageId: [{
|
|
614
|
+
type: Input
|
|
615
|
+
}] } });
|
|
616
|
+
|
|
617
|
+
class FileUploaderComponent {
|
|
618
|
+
constructor(sanitizer, http, cd) {
|
|
714
619
|
this.sanitizer = sanitizer;
|
|
715
620
|
this.http = http;
|
|
716
|
-
this.
|
|
621
|
+
this.cd = cd;
|
|
717
622
|
this.srcChange = new EventEmitter();
|
|
718
623
|
this.progress = 0;
|
|
719
624
|
this.isUploading = false;
|
|
720
625
|
this.autoplay = true;
|
|
721
|
-
this.fileTypeMask =
|
|
626
|
+
this.fileTypeMask = undefined;
|
|
627
|
+
this._uploadTypes = [];
|
|
722
628
|
}
|
|
723
629
|
set src(newSrc) {
|
|
724
630
|
if (this._src === newSrc)
|
|
@@ -728,52 +634,26 @@ class MediaUploaderComponent {
|
|
|
728
634
|
get src() {
|
|
729
635
|
return this._src;
|
|
730
636
|
}
|
|
731
|
-
set
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
break;
|
|
737
|
-
case "video":
|
|
738
|
-
this._uploadType = newUploadType;
|
|
739
|
-
this.fileTypeMask = videoFileTypes;
|
|
740
|
-
break;
|
|
741
|
-
case undefined:
|
|
742
|
-
default:
|
|
743
|
-
this._uploadType = newUploadType;
|
|
744
|
-
this.fileTypeMask = allMediaFileTypes;
|
|
745
|
-
break;
|
|
746
|
-
}
|
|
637
|
+
set uploadTypes(newUploadType) {
|
|
638
|
+
this._uploadTypes.splice(0, this._uploadTypes.length);
|
|
639
|
+
this._uploadTypes.push(...newUploadType);
|
|
640
|
+
this.fileTypeMask = this._uploadTypes.length === 0 ? undefined : this._uploadTypes.join(',');
|
|
641
|
+
this.cd.detectChanges();
|
|
747
642
|
}
|
|
748
|
-
get
|
|
749
|
-
return this.
|
|
643
|
+
get uploadTypes() {
|
|
644
|
+
return this._uploadTypes;
|
|
750
645
|
}
|
|
751
646
|
onFileSelect(fileInput) {
|
|
752
647
|
if (fileInput.files === undefined || fileInput.files === null || fileInput.files.length !== 1)
|
|
753
648
|
return;
|
|
754
649
|
const file = fileInput.files[0];
|
|
755
|
-
|
|
756
|
-
if (this._uploadType !== undefined && this._uploadType !== null) {
|
|
757
|
-
uploadingMediaType = this._uploadType;
|
|
758
|
-
}
|
|
759
|
-
else if (imageMimeTypes.includes(file.type)) {
|
|
760
|
-
uploadingMediaType = 'image';
|
|
761
|
-
}
|
|
762
|
-
else if (videoMimeTypes.includes(file.type)) {
|
|
763
|
-
uploadingMediaType = 'video';
|
|
764
|
-
}
|
|
765
|
-
else {
|
|
766
|
-
console.error(`unknown media type ${file.type} (${file.name})`);
|
|
767
|
-
return;
|
|
768
|
-
}
|
|
769
|
-
const uploadUrl = this.uploadUrlMap.get(uploadingMediaType);
|
|
650
|
+
const uploadUrl = this.uploadUrlMap.get(file.type) ?? this.uploadUrlMap.get("");
|
|
770
651
|
if (uploadUrl === undefined || uploadUrl === null) {
|
|
771
|
-
console.error(`upload map doesn't have url for type ${
|
|
652
|
+
console.error(`upload map doesn't have url for type '${file.type}'`);
|
|
772
653
|
return;
|
|
773
654
|
}
|
|
774
655
|
const formData = new FormData();
|
|
775
656
|
formData.append('file', file);
|
|
776
|
-
formData.append('ratio', `${this.forceRatio ?? 0}`);
|
|
777
657
|
this.progress = 0;
|
|
778
658
|
this.isUploading = true;
|
|
779
659
|
this.updateClip();
|
|
@@ -802,18 +682,11 @@ class MediaUploaderComponent {
|
|
|
802
682
|
this.updateClip();
|
|
803
683
|
return;
|
|
804
684
|
case HttpEventType.Response:
|
|
805
|
-
if (event.body ===
|
|
806
|
-
console.
|
|
807
|
-
|
|
808
|
-
else {
|
|
809
|
-
// remove this
|
|
810
|
-
// needed for C# deserialization
|
|
811
|
-
const pixmedia = {
|
|
812
|
-
$type: event.body.type,
|
|
813
|
-
...event.body,
|
|
814
|
-
};
|
|
815
|
-
this.srcChange.emit(pixmedia);
|
|
685
|
+
if (event.body === null || event.body === undefined) {
|
|
686
|
+
console.warn(`empty body from uploader`);
|
|
687
|
+
return;
|
|
816
688
|
}
|
|
689
|
+
this.srcChange.emit(event.body);
|
|
817
690
|
return;
|
|
818
691
|
default:
|
|
819
692
|
return;
|
|
@@ -831,13 +704,13 @@ class MediaUploaderComponent {
|
|
|
831
704
|
};
|
|
832
705
|
return func;
|
|
833
706
|
}
|
|
834
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type:
|
|
835
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type:
|
|
707
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: FileUploaderComponent, deps: [{ token: i1$1.DomSanitizer }, { token: i1$2.HttpClient }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
708
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: FileUploaderComponent, selector: "bonc-file-uploader", inputs: { uploadUrlMap: "uploadUrlMap", src: "src", uploadTypes: "uploadTypes" }, outputs: { srcChange: "srcChange" }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], ngImport: i0, template: "<div *ngIf=\"src?.url?.length === undefined || src?.url?.length === 0\">Upload file</div>\r\n\r\n<ng-content></ng-content>\r\n\r\n<div (click)=\"selectFile($event)\" class=\"media-container\">\r\n <input #fileInput [accept]=\"fileTypeMask\" (change)=\"onFileSelect(fileInput)\" name=\"media\" type=\"file\" />\r\n <span *ngIf=\"isUploading\"\r\n [style.clip-path]=\"clipStyle\"\r\n [style.-webkit-clip-path]=\"clipStyle\"\r\n class=\"loader\"></span>\r\n\r\n <span *ngIf=\"isUploading\" class=\"loader-text\">\r\n <span *ngIf=\"progress < 1\">{{100 * progress | number: '1.0-0'}}%</span>\r\n <span *ngIf=\"progress >= 1\">converting</span>\r\n </span>\r\n</div>\r\n", styles: [":host{display:block;background-color:#000;position:relative}.media-container{display:block;position:absolute;inset:0;cursor:pointer}.media-container:hover:hover:after{display:flex;justify-content:center;align-items:center;content:\"\";position:absolute;color:silver;inset:0;font-weight:700;font-size:50pt;pointer-events:none;background-color:#ccff00b3}.media-container img,.media-container video{display:block;position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover}input[type=file]{display:none}.loader{position:absolute;inset:0;background-color:#cf0}.loader-text{background-color:#000;position:absolute;top:50%;left:0;right:0;text-align:center;font-size:20pt;margin-top:-10pt;color:#fff}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2$1.DecimalPipe, name: "number" }] }); }
|
|
836
709
|
}
|
|
837
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type:
|
|
710
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: FileUploaderComponent, decorators: [{
|
|
838
711
|
type: Component,
|
|
839
|
-
args: [{ selector: 'bonc-
|
|
840
|
-
}], ctorParameters: () => [{ type: i1$
|
|
712
|
+
args: [{ selector: 'bonc-file-uploader', template: "<div *ngIf=\"src?.url?.length === undefined || src?.url?.length === 0\">Upload file</div>\r\n\r\n<ng-content></ng-content>\r\n\r\n<div (click)=\"selectFile($event)\" class=\"media-container\">\r\n <input #fileInput [accept]=\"fileTypeMask\" (change)=\"onFileSelect(fileInput)\" name=\"media\" type=\"file\" />\r\n <span *ngIf=\"isUploading\"\r\n [style.clip-path]=\"clipStyle\"\r\n [style.-webkit-clip-path]=\"clipStyle\"\r\n class=\"loader\"></span>\r\n\r\n <span *ngIf=\"isUploading\" class=\"loader-text\">\r\n <span *ngIf=\"progress < 1\">{{100 * progress | number: '1.0-0'}}%</span>\r\n <span *ngIf=\"progress >= 1\">converting</span>\r\n </span>\r\n</div>\r\n", styles: [":host{display:block;background-color:#000;position:relative}.media-container{display:block;position:absolute;inset:0;cursor:pointer}.media-container:hover:hover:after{display:flex;justify-content:center;align-items:center;content:\"\";position:absolute;color:silver;inset:0;font-weight:700;font-size:50pt;pointer-events:none;background-color:#ccff00b3}.media-container img,.media-container video{display:block;position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover}input[type=file]{display:none}.loader{position:absolute;inset:0;background-color:#cf0}.loader-text{background-color:#000;position:absolute;top:50%;left:0;right:0;text-align:center;font-size:20pt;margin-top:-10pt;color:#fff}\n"] }]
|
|
713
|
+
}], ctorParameters: () => [{ type: i1$1.DomSanitizer }, { type: i1$2.HttpClient }, { type: i0.ChangeDetectorRef }], propDecorators: { fileInput: [{
|
|
841
714
|
type: ViewChild,
|
|
842
715
|
args: ['fileInput', { static: true }]
|
|
843
716
|
}], srcChange: [{
|
|
@@ -845,20 +718,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
845
718
|
}], uploadUrlMap: [{
|
|
846
719
|
type: Input,
|
|
847
720
|
args: [{ required: true }]
|
|
848
|
-
}], forceRatio: [{
|
|
849
|
-
type: Input
|
|
850
721
|
}], src: [{
|
|
851
722
|
type: Input
|
|
852
|
-
}],
|
|
723
|
+
}], uploadTypes: [{
|
|
853
724
|
type: Input
|
|
854
725
|
}] } });
|
|
855
726
|
|
|
856
|
-
|
|
857
|
-
(
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
727
|
+
class SvgFormComponent extends FormBaseComponent {
|
|
728
|
+
constructor(editable) {
|
|
729
|
+
super(editable);
|
|
730
|
+
this.cd = inject(ChangeDetectorRef);
|
|
731
|
+
this.SvgMime = 'image/svg+xml';
|
|
732
|
+
this.label = '';
|
|
733
|
+
this.uploadMap = new Map();
|
|
734
|
+
this._uploadUrl = '/api/admin/upload/image/svg';
|
|
735
|
+
this.uploadMap.set(this.SvgMime, this._uploadUrl);
|
|
736
|
+
}
|
|
737
|
+
ngOnInit() {
|
|
738
|
+
this.editable.externalSaveCall.subscribe(() => {
|
|
739
|
+
this.editable.save();
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
set uploadUrl(newValue) {
|
|
743
|
+
this._uploadUrl = newValue;
|
|
744
|
+
this.uploadMap.set(this.SvgMime, this._uploadUrl);
|
|
745
|
+
this.cd.detectChanges();
|
|
746
|
+
}
|
|
747
|
+
onFileUploaded(fileSrc) {
|
|
748
|
+
this.editable.startEditing();
|
|
749
|
+
const svgSrc = fileSrc;
|
|
750
|
+
this.editable.value = svgSrc;
|
|
751
|
+
this.editable.updateDirty();
|
|
752
|
+
}
|
|
753
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: SvgFormComponent, deps: [{ token: EditableDirective, host: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
754
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: SvgFormComponent, selector: "bonc-svg-form", inputs: { label: "label", uploadUrl: "uploadUrl" }, usesInheritance: true, hostDirectives: [{ directive: EditableDirective }], ngImport: i0, template: "<bonc-form-controls [editable]=\"editable\">\r\n <label *ngIf=\"label\">{{label}}</label>\r\n <bonc-file-uploader [src]=\"editable.value\"\r\n [uploadTypes]=\"[SvgMime]\"\r\n [uploadUrlMap]=\"uploadMap\"\r\n (srcChange)=\"onFileUploaded($event)\">\r\n <img *ngIf=\"editable.value?.url?.length ?? 0 > 0\" [src]=\"editable.value?.url\" />\r\n </bonc-file-uploader>\r\n\r\n <a *ngIf=\"editable.value?.url?.length ?? 0 > 0\" [href]=\"editable.value!.url\" download target=\"_blank\">Download</a>\r\n\r\n</bonc-form-controls>\r\n", styles: [":host{display:block}a{color:silver}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormControlsComponent, selector: "bonc-form-controls", inputs: ["editable"] }, { kind: "component", type: FileUploaderComponent, selector: "bonc-file-uploader", inputs: ["uploadUrlMap", "src", "uploadTypes"], outputs: ["srcChange"] }] }); }
|
|
755
|
+
}
|
|
756
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: SvgFormComponent, decorators: [{
|
|
757
|
+
type: Component,
|
|
758
|
+
args: [{ selector: 'bonc-svg-form', hostDirectives: [EditableDirective], template: "<bonc-form-controls [editable]=\"editable\">\r\n <label *ngIf=\"label\">{{label}}</label>\r\n <bonc-file-uploader [src]=\"editable.value\"\r\n [uploadTypes]=\"[SvgMime]\"\r\n [uploadUrlMap]=\"uploadMap\"\r\n (srcChange)=\"onFileUploaded($event)\">\r\n <img *ngIf=\"editable.value?.url?.length ?? 0 > 0\" [src]=\"editable.value?.url\" />\r\n </bonc-file-uploader>\r\n\r\n <a *ngIf=\"editable.value?.url?.length ?? 0 > 0\" [href]=\"editable.value!.url\" download target=\"_blank\">Download</a>\r\n\r\n</bonc-form-controls>\r\n", styles: [":host{display:block}a{color:silver}\n"] }]
|
|
759
|
+
}], ctorParameters: () => [{ type: EditableDirective, decorators: [{
|
|
760
|
+
type: Host
|
|
761
|
+
}] }], propDecorators: { label: [{
|
|
762
|
+
type: Input
|
|
763
|
+
}], uploadUrl: [{
|
|
764
|
+
type: Input
|
|
765
|
+
}] } });
|
|
766
|
+
|
|
767
|
+
class FileFormComponent extends FormBaseComponent {
|
|
768
|
+
constructor() {
|
|
769
|
+
super(...arguments);
|
|
770
|
+
this.label = '';
|
|
771
|
+
this.uploadTypes = [];
|
|
772
|
+
this.uploadMap = new Map();
|
|
773
|
+
}
|
|
774
|
+
ngOnInit() {
|
|
775
|
+
this.editable.externalSaveCall.subscribe(() => {
|
|
776
|
+
this.editable.save();
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
;
|
|
780
|
+
onFileUploaded(fileSrc) {
|
|
781
|
+
this.editable.startEditing();
|
|
782
|
+
const svgSrc = fileSrc;
|
|
783
|
+
this.editable.value = svgSrc;
|
|
784
|
+
this.editable.updateDirty();
|
|
785
|
+
}
|
|
786
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: FileFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
787
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: FileFormComponent, selector: "bonc-file-form", inputs: { label: "label", uploadTypes: "uploadTypes", uploadMap: "uploadMap" }, usesInheritance: true, hostDirectives: [{ directive: EditableDirective }], ngImport: i0, template: "<bonc-form-controls [editable]=\"editable\">\r\n <label *ngIf=\"label\">{{label}}</label>\r\n <bonc-file-uploader [src]=\"editable.value\"\r\n [uploadTypes]=\"uploadTypes\"\r\n [uploadUrlMap]=\"uploadMap\"\r\n (srcChange)=\"onFileUploaded($event)\">\r\n <div *ngIf=\"editable.value?.url?.length ?? 0 > 0\">{{editable.value?.url}}</div>\r\n </bonc-file-uploader>\r\n\r\n <a *ngIf=\"editable.value?.url?.length ?? 0 > 0\" [href]=\"editable.value!.url\" download target=\"_blank\">Download</a>\r\n</bonc-form-controls>\r\n", styles: [":host{display:block}a{color:silver}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormControlsComponent, selector: "bonc-form-controls", inputs: ["editable"] }, { kind: "component", type: FileUploaderComponent, selector: "bonc-file-uploader", inputs: ["uploadUrlMap", "src", "uploadTypes"], outputs: ["srcChange"] }] }); }
|
|
788
|
+
}
|
|
789
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: FileFormComponent, decorators: [{
|
|
790
|
+
type: Component,
|
|
791
|
+
args: [{ selector: 'bonc-file-form', hostDirectives: [EditableDirective], template: "<bonc-form-controls [editable]=\"editable\">\r\n <label *ngIf=\"label\">{{label}}</label>\r\n <bonc-file-uploader [src]=\"editable.value\"\r\n [uploadTypes]=\"uploadTypes\"\r\n [uploadUrlMap]=\"uploadMap\"\r\n (srcChange)=\"onFileUploaded($event)\">\r\n <div *ngIf=\"editable.value?.url?.length ?? 0 > 0\">{{editable.value?.url}}</div>\r\n </bonc-file-uploader>\r\n\r\n <a *ngIf=\"editable.value?.url?.length ?? 0 > 0\" [href]=\"editable.value!.url\" download target=\"_blank\">Download</a>\r\n</bonc-form-controls>\r\n", styles: [":host{display:block}a{color:silver}\n"] }]
|
|
792
|
+
}], propDecorators: { label: [{
|
|
793
|
+
type: Input
|
|
794
|
+
}], uploadTypes: [{
|
|
795
|
+
type: Input,
|
|
796
|
+
args: [{ required: true }]
|
|
797
|
+
}], uploadMap: [{
|
|
798
|
+
type: Input,
|
|
799
|
+
args: [{ required: true }]
|
|
800
|
+
}] } });
|
|
801
|
+
|
|
802
|
+
var TextInputStyle;
|
|
803
|
+
(function (TextInputStyle) {
|
|
804
|
+
TextInputStyle[TextInputStyle["NotSet"] = 0] = "NotSet";
|
|
805
|
+
TextInputStyle[TextInputStyle["SingleLine"] = 1] = "SingleLine";
|
|
806
|
+
TextInputStyle[TextInputStyle["MultiLine"] = 2] = "MultiLine";
|
|
807
|
+
})(TextInputStyle || (TextInputStyle = {}));
|
|
862
808
|
|
|
863
809
|
class TextFormComponent extends FormBaseComponent {
|
|
864
810
|
constructor() {
|
|
@@ -873,48 +819,73 @@ class TextFormComponent extends FormBaseComponent {
|
|
|
873
819
|
});
|
|
874
820
|
}
|
|
875
821
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TextFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
876
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: TextFormComponent, selector: "bonc-text-form", inputs: {
|
|
822
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: TextFormComponent, selector: "bonc-text-form", inputs: { label: "label", type: "type" }, usesInheritance: true, hostDirectives: [{ directive: EditableDirective }], ngImport: i0, template: "<bonc-form-controls [editable]=\"editable\">\r\n <label *ngIf=\"label\">{{label}}</label>\r\n\r\n <input *ngIf=\"editable && type === TextInputStyle.SingleLine\"\r\n [(ngModel)]=\"editable.value\"\r\n (click)=\"editable.startEditing()\"\r\n (keyup)=\"editable.updateDirty()\"\r\n (blur)=\"editable.updateDirty()\" />\r\n\r\n <textarea *ngIf=\"editable && type === TextInputStyle.MultiLine\"\r\n [(ngModel)]=\"editable.value\"\r\n (click)=\"editable.startEditing()\"\r\n (keyup)=\"editable.updateDirty()\"\r\n (blur)=\"editable.updateDirty()\">\r\n </textarea>\r\n</bonc-form-controls>\r\n", styles: [":host{display:block}input,textarea{display:block;width:100%;padding:6px;color:silver;border:1px solid silver;background-color:transparent;box-sizing:border-box;font-size:inherit}input:hover,textarea:hover{border-color:transparent;background-color:#333;cursor:pointer}input:focus,textarea:focus{outline:none;color:#fff;border-color:transparent;background-color:#555}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: FormControlsComponent, selector: "bonc-form-controls", inputs: ["editable"] }] }); }
|
|
877
823
|
}
|
|
878
824
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TextFormComponent, decorators: [{
|
|
879
825
|
type: Component,
|
|
880
|
-
args: [{ selector: 'bonc-text-form',
|
|
826
|
+
args: [{ selector: 'bonc-text-form', hostDirectives: [EditableDirective], template: "<bonc-form-controls [editable]=\"editable\">\r\n <label *ngIf=\"label\">{{label}}</label>\r\n\r\n <input *ngIf=\"editable && type === TextInputStyle.SingleLine\"\r\n [(ngModel)]=\"editable.value\"\r\n (click)=\"editable.startEditing()\"\r\n (keyup)=\"editable.updateDirty()\"\r\n (blur)=\"editable.updateDirty()\" />\r\n\r\n <textarea *ngIf=\"editable && type === TextInputStyle.MultiLine\"\r\n [(ngModel)]=\"editable.value\"\r\n (click)=\"editable.startEditing()\"\r\n (keyup)=\"editable.updateDirty()\"\r\n (blur)=\"editable.updateDirty()\">\r\n </textarea>\r\n</bonc-form-controls>\r\n", styles: [":host{display:block}input,textarea{display:block;width:100%;padding:6px;color:silver;border:1px solid silver;background-color:transparent;box-sizing:border-box;font-size:inherit}input:hover,textarea:hover{border-color:transparent;background-color:#333;cursor:pointer}input:focus,textarea:focus{outline:none;color:#fff;border-color:transparent;background-color:#555}\n"] }]
|
|
881
827
|
}], propDecorators: { label: [{
|
|
882
828
|
type: Input
|
|
883
829
|
}], type: [{
|
|
884
830
|
type: Input
|
|
885
831
|
}] } });
|
|
886
832
|
|
|
887
|
-
class
|
|
833
|
+
class LottieFormComponent extends FormBaseComponent {
|
|
888
834
|
constructor() {
|
|
889
835
|
super(...arguments);
|
|
890
|
-
this.
|
|
891
|
-
this.ogImageUploadUrl = '';
|
|
836
|
+
this.LottieMimeType = 'application/json';
|
|
892
837
|
this.label = '';
|
|
838
|
+
this.uploadMap = new Map();
|
|
893
839
|
}
|
|
894
840
|
ngOnInit() {
|
|
895
841
|
this.editable.externalSaveCall.subscribe(() => {
|
|
896
842
|
this.editable.save();
|
|
897
843
|
});
|
|
844
|
+
this.editable.valueChange.subscribe(x => {
|
|
845
|
+
const url = x?.url ?? '';
|
|
846
|
+
this.animOptions = url.length === 0 ? undefined : { path: url };
|
|
847
|
+
});
|
|
898
848
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
this.
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
}
|
|
906
|
-
ResToSrc(res) {
|
|
907
|
-
return res.url;
|
|
849
|
+
;
|
|
850
|
+
onFileUploaded(fileSrc) {
|
|
851
|
+
this.editable.startEditing();
|
|
852
|
+
const svgSrc = fileSrc;
|
|
853
|
+
this.editable.value = svgSrc;
|
|
854
|
+
this.editable.updateDirty();
|
|
908
855
|
}
|
|
909
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type:
|
|
910
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type:
|
|
856
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LottieFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
857
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: LottieFormComponent, selector: "bonc-lottie-form", inputs: { label: "label", uploadMap: "uploadMap" }, usesInheritance: true, hostDirectives: [{ directive: EditableDirective }], ngImport: i0, template: "<bonc-form-controls [editable]=\"editable\">\r\n <label *ngIf=\"label\">{{label}}</label>\r\n <bonc-file-uploader [src]=\"editable.value\"\r\n [uploadTypes]=\"[LottieMimeType]\"\r\n [uploadUrlMap]=\"uploadMap\"\r\n (srcChange)=\"onFileUploaded($event)\">\r\n\r\n <ng-lottie *ngIf=\"animOptions\"\r\n [options]=\"animOptions\"></ng-lottie>\r\n\r\n\r\n </bonc-file-uploader>\r\n\r\n <a *ngIf=\"editable.value?.url?.length ?? 0 > 0\" [href]=\"editable.value!.url\" download target=\"_blank\">Download</a>\r\n</bonc-form-controls>\r\n", styles: [":host{display:block;max-width:600px}a{color:silver}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LottieComponent, selector: "ng-lottie", inputs: ["width", "height"] }, { kind: "component", type: FormControlsComponent, selector: "bonc-form-controls", inputs: ["editable"] }, { kind: "component", type: FileUploaderComponent, selector: "bonc-file-uploader", inputs: ["uploadUrlMap", "src", "uploadTypes"], outputs: ["srcChange"] }] }); }
|
|
911
858
|
}
|
|
912
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type:
|
|
859
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LottieFormComponent, decorators: [{
|
|
913
860
|
type: Component,
|
|
914
|
-
args: [{ selector: 'bonc-
|
|
861
|
+
args: [{ selector: 'bonc-lottie-form', hostDirectives: [EditableDirective], template: "<bonc-form-controls [editable]=\"editable\">\r\n <label *ngIf=\"label\">{{label}}</label>\r\n <bonc-file-uploader [src]=\"editable.value\"\r\n [uploadTypes]=\"[LottieMimeType]\"\r\n [uploadUrlMap]=\"uploadMap\"\r\n (srcChange)=\"onFileUploaded($event)\">\r\n\r\n <ng-lottie *ngIf=\"animOptions\"\r\n [options]=\"animOptions\"></ng-lottie>\r\n\r\n\r\n </bonc-file-uploader>\r\n\r\n <a *ngIf=\"editable.value?.url?.length ?? 0 > 0\" [href]=\"editable.value!.url\" download target=\"_blank\">Download</a>\r\n</bonc-form-controls>\r\n", styles: [":host{display:block;max-width:600px}a{color:silver}\n"] }]
|
|
915
862
|
}], propDecorators: { label: [{
|
|
916
863
|
type: Input
|
|
917
|
-
}],
|
|
864
|
+
}], uploadMap: [{
|
|
865
|
+
type: Input,
|
|
866
|
+
args: [{ required: true }]
|
|
867
|
+
}] } });
|
|
868
|
+
|
|
869
|
+
class TranslationFormComponent extends FormBaseComponent {
|
|
870
|
+
constructor() {
|
|
871
|
+
super(...arguments);
|
|
872
|
+
this.TextEditorField = TextEditorField;
|
|
873
|
+
}
|
|
874
|
+
ngOnInit() {
|
|
875
|
+
this.editable.externalSaveCall.subscribe(() => {
|
|
876
|
+
this.editable.save();
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslationFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
880
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: TranslationFormComponent, selector: "bonc-translation-form", inputs: { field: "field", label: "label" }, usesInheritance: true, hostDirectives: [{ directive: EditableDirective }], ngImport: i0, template: "<bonc-form-controls *ngIf=\"editable.value\" [editable]=\"editable\">\r\n <label *ngIf=\"label\">{{label}}</label>\r\n\r\n <bonc-translation-input *ngIf=\"field === TextEditorField.Input\"\r\n [text]=\"editable.value\"\r\n [locale]=\"locale\"\r\n (startEditing)=\"editable.startEditing()\"\r\n (changed)=\"editable.updateDirty()\"\r\n (blurred)=\"editable.updateDirty()\">\r\n </bonc-translation-input>\r\n\r\n\r\n <bonc-translation-textarea *ngIf=\"field === TextEditorField.Textarea\"\r\n [text]=\"editable.value\"\r\n [minRows]=\"2\"\r\n [locale]=\"locale\"\r\n (startEditing)=\"editable.startEditing()\"\r\n (changed)=\"editable.updateDirty()\"\r\n (blurred)=\"editable.updateDirty()\">\r\n </bonc-translation-textarea>\r\n</bonc-form-controls>\r\n\r\n<div *ngIf=\"editable.value===undefined\">Editable value canot be undefined</div>\r\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TranslationInputComponent, selector: "bonc-translation-input", inputs: ["text", "locale", "device"], outputs: ["startEditing", "changed", "blurred"] }, { kind: "component", type: TranslationTextareaComponent, selector: "bonc-translation-textarea", inputs: ["minRows", "maxRows", "text", "locale", "device"], outputs: ["startEditing", "changed", "blurred"] }, { kind: "component", type: FormControlsComponent, selector: "bonc-form-controls", inputs: ["editable"] }] }); }
|
|
881
|
+
}
|
|
882
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslationFormComponent, decorators: [{
|
|
883
|
+
type: Component,
|
|
884
|
+
args: [{ selector: 'bonc-translation-form', hostDirectives: [EditableDirective], template: "<bonc-form-controls *ngIf=\"editable.value\" [editable]=\"editable\">\r\n <label *ngIf=\"label\">{{label}}</label>\r\n\r\n <bonc-translation-input *ngIf=\"field === TextEditorField.Input\"\r\n [text]=\"editable.value\"\r\n [locale]=\"locale\"\r\n (startEditing)=\"editable.startEditing()\"\r\n (changed)=\"editable.updateDirty()\"\r\n (blurred)=\"editable.updateDirty()\">\r\n </bonc-translation-input>\r\n\r\n\r\n <bonc-translation-textarea *ngIf=\"field === TextEditorField.Textarea\"\r\n [text]=\"editable.value\"\r\n [minRows]=\"2\"\r\n [locale]=\"locale\"\r\n (startEditing)=\"editable.startEditing()\"\r\n (changed)=\"editable.updateDirty()\"\r\n (blurred)=\"editable.updateDirty()\">\r\n </bonc-translation-textarea>\r\n</bonc-form-controls>\r\n\r\n<div *ngIf=\"editable.value===undefined\">Editable value canot be undefined</div>\r\n", styles: [":host{display:block}\n"] }]
|
|
885
|
+
}], propDecorators: { field: [{
|
|
886
|
+
type: Input,
|
|
887
|
+
args: [{ required: true }]
|
|
888
|
+
}], label: [{
|
|
918
889
|
type: Input
|
|
919
890
|
}] } });
|
|
920
891
|
|
|
@@ -929,35 +900,301 @@ class UnknownFormComponent extends FormBaseComponent {
|
|
|
929
900
|
});
|
|
930
901
|
}
|
|
931
902
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: UnknownFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
932
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: UnknownFormComponent, selector: "bonc-unknown-form", inputs: {
|
|
903
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: UnknownFormComponent, selector: "bonc-unknown-form", inputs: { label: "label" }, usesInheritance: true, ngImport: i0, template: "<label>Unknown form:<b>{{label}}</b></label>\r\n<pre><ng-content></ng-content></pre>\r\n", styles: [":host{display:block;color:#000;padding:20px;background-color:#dc143c;margin-bottom:10px}\n"] }); }
|
|
933
904
|
}
|
|
934
905
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: UnknownFormComponent, decorators: [{
|
|
935
906
|
type: Component,
|
|
936
|
-
args: [{ selector: 'bonc-unknown-form',
|
|
907
|
+
args: [{ selector: 'bonc-unknown-form', template: "<label>Unknown form:<b>{{label}}</b></label>\r\n<pre><ng-content></ng-content></pre>\r\n", styles: [":host{display:block;color:#000;padding:20px;background-color:#dc143c;margin-bottom:10px}\n"] }]
|
|
937
908
|
}], propDecorators: { label: [{
|
|
938
909
|
type: Input
|
|
939
910
|
}] } });
|
|
940
911
|
|
|
941
|
-
class
|
|
912
|
+
class DataService {
|
|
913
|
+
constructor(http, baseHref) {
|
|
914
|
+
this.http = http;
|
|
915
|
+
this.baseHref = baseHref;
|
|
916
|
+
}
|
|
917
|
+
getView(viewCode) {
|
|
918
|
+
const pageOb = this.getSkeleton(`${this.baseHref}api/views/${viewCode}`);
|
|
919
|
+
return pageOb;
|
|
920
|
+
}
|
|
921
|
+
getPage(pageRoute) {
|
|
922
|
+
const pageUrl = `/${pageRoute}`;
|
|
923
|
+
const pageOb = this.getSkeleton(`${this.baseHref}api/pages/?url=${encodeURIComponent(pageUrl)}`);
|
|
924
|
+
return pageOb;
|
|
925
|
+
}
|
|
926
|
+
getSettings(ids) {
|
|
927
|
+
const pageOb = this.http.get(`${this.baseHref}api/settings`, {
|
|
928
|
+
params: { ids: ids }
|
|
929
|
+
});
|
|
930
|
+
return pageOb;
|
|
931
|
+
}
|
|
932
|
+
getSkeleton(url) {
|
|
933
|
+
const skeletonOb = this.http.get(url);
|
|
934
|
+
const routeDataObs = skeletonOb
|
|
935
|
+
.pipe(map(x => {
|
|
936
|
+
const notEmptyDataRoutes = x.bones
|
|
937
|
+
.map(b => ('dataRoute' in b) && typeof (b.dataRoute) === 'string' ? b.dataRoute : '')
|
|
938
|
+
.filter(x => x.length > 0);
|
|
939
|
+
if (notEmptyDataRoutes.length === 0) {
|
|
940
|
+
const emptyData = {};
|
|
941
|
+
return { page: of(x), data: of(emptyData) };
|
|
942
|
+
}
|
|
943
|
+
return {
|
|
944
|
+
page: of(x),
|
|
945
|
+
data: combineLatest(notEmptyDataRoutes
|
|
946
|
+
.map(dataRoute => {
|
|
947
|
+
const url = `${this.baseHref}api/Pages/Children/?url=${dataRoute}`;
|
|
948
|
+
return {
|
|
949
|
+
route: dataRoute,
|
|
950
|
+
json: this.http.get(url)
|
|
951
|
+
};
|
|
952
|
+
})
|
|
953
|
+
.reduce((prev, curr) => {
|
|
954
|
+
prev[curr.route] = curr.json;
|
|
955
|
+
return prev;
|
|
956
|
+
}, {}))
|
|
957
|
+
};
|
|
958
|
+
}), map(x => combineLatest(x)), mergeMap(res => merge(res)), map(x => {
|
|
959
|
+
for (const bone of x.page.bones) {
|
|
960
|
+
if (!('dataRoute' in bone) || typeof bone.dataRoute !== 'string' || bone.dataRoute.length === 0)
|
|
961
|
+
continue;
|
|
962
|
+
const data = x.data[bone.dataRoute];
|
|
963
|
+
if (data === undefined || data === null)
|
|
964
|
+
throw new Error(`Data ${bone.dataRoute} have not been preloaded`);
|
|
965
|
+
bone.data = data; // todo: fix
|
|
966
|
+
}
|
|
967
|
+
return x.page;
|
|
968
|
+
}));
|
|
969
|
+
return routeDataObs;
|
|
970
|
+
}
|
|
971
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: DataService, deps: [{ token: i1$2.HttpClient }, { token: APP_BASE_HREF }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
972
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: DataService }); }
|
|
973
|
+
}
|
|
974
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: DataService, decorators: [{
|
|
975
|
+
type: Injectable
|
|
976
|
+
}], ctorParameters: () => [{ type: i1$2.HttpClient }, { type: undefined, decorators: [{
|
|
977
|
+
type: Inject,
|
|
978
|
+
args: [APP_BASE_HREF]
|
|
979
|
+
}] }] });
|
|
980
|
+
|
|
981
|
+
class AdminDataService {
|
|
982
|
+
constructor(http, baseHref) {
|
|
983
|
+
this.http = http;
|
|
984
|
+
this.baseHref = baseHref;
|
|
985
|
+
console.log('baseHref: ' + baseHref);
|
|
986
|
+
}
|
|
987
|
+
getSettingGroups() {
|
|
988
|
+
const pageOb = this.http.get(`${this.baseHref}api/admin/settings`);
|
|
989
|
+
return pageOb;
|
|
990
|
+
}
|
|
991
|
+
getPage(url) {
|
|
992
|
+
const pageOb = this.http.get(`${this.baseHref}api/admin/pages/${url}`);
|
|
993
|
+
return pageOb;
|
|
994
|
+
}
|
|
995
|
+
storePage(page) {
|
|
996
|
+
const ob = this.http.post(`${this.baseHref}api/admin/pages`, page);
|
|
997
|
+
return ob;
|
|
998
|
+
}
|
|
999
|
+
updateSettings(settings) {
|
|
1000
|
+
const ob = this.http.post(`${this.baseHref}api/admin/settings`, settings);
|
|
1001
|
+
return ob;
|
|
1002
|
+
}
|
|
1003
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: AdminDataService, deps: [{ token: i1$2.HttpClient }, { token: APP_BASE_HREF }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1004
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: AdminDataService }); }
|
|
1005
|
+
}
|
|
1006
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: AdminDataService, decorators: [{
|
|
1007
|
+
type: Injectable
|
|
1008
|
+
}], ctorParameters: () => [{ type: i1$2.HttpClient }, { type: undefined, decorators: [{
|
|
1009
|
+
type: Inject,
|
|
1010
|
+
args: [APP_BASE_HREF]
|
|
1011
|
+
}] }] });
|
|
1012
|
+
|
|
1013
|
+
class AdminControlsComponent {
|
|
942
1014
|
constructor() {
|
|
943
|
-
|
|
944
|
-
this.
|
|
1015
|
+
this.DeviceType = DeviceType;
|
|
1016
|
+
this.deviceControls = false;
|
|
1017
|
+
this.locale = 'en';
|
|
1018
|
+
this.device = this.DeviceType.Desktop;
|
|
945
1019
|
}
|
|
946
|
-
|
|
947
|
-
this.
|
|
948
|
-
|
|
1020
|
+
changeLocale() {
|
|
1021
|
+
this.locale = this.locale === 'en' ? 'ru' : 'en';
|
|
1022
|
+
}
|
|
1023
|
+
changeDevice() {
|
|
1024
|
+
switch (this.device) {
|
|
1025
|
+
case DeviceType.Desktop:
|
|
1026
|
+
this.device = DeviceType.Tablet;
|
|
1027
|
+
return;
|
|
1028
|
+
case DeviceType.Tablet:
|
|
1029
|
+
this.device = DeviceType.Mobile;
|
|
1030
|
+
return;
|
|
1031
|
+
case DeviceType.Mobile:
|
|
1032
|
+
this.device = DeviceType.Desktop;
|
|
1033
|
+
return;
|
|
1034
|
+
default:
|
|
1035
|
+
this.device = DeviceType.Desktop;
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: AdminControlsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1040
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: AdminControlsComponent, selector: "bonc-admin-controls", inputs: { editableGroup: "editableGroup", deviceControls: "deviceControls" }, ngImport: i0, template: "<div class=\"page-controls\">\r\n <a (click)=\"changeLocale()\" class=\"locale\">Locale: {{locale}}</a>\r\n\r\n <!-- todo: return this functionality -->\r\n <!-- <a *ngIf=\"deviceControls\" (click)=\"changeDevice()\" class=\"device\">\r\n <span *ngIf=\"device === DeviceType.Desktop\">DESKTOP</span>\r\n <span *ngIf=\"device === DeviceType.Tablet\">TABLET</span>\r\n <span *ngIf=\"device === DeviceType.Mobile\">MOBILE</span>\r\n </a> -->\r\n\r\n <a *ngIf=\"editableGroup && editableGroup.inEditMode\"\r\n (click)=\"editableGroup.saveAll()\"\r\n class=\"save\">Save all</a>\r\n\r\n <a *ngIf=\"editableGroup && editableGroup.inEditMode\"\r\n (click)=\"editableGroup.cancelAll()\"\r\n class=\"cancel\">Cancel all</a>\r\n</div>\r\n", styles: [":host{display:block;position:sticky;top:0;width:100%;z-index:1000}.page-controls{background-color:#111;height:60px;display:flex;align-items:center;justify-content:center}.page-controls a{color:silver;padding:4px;cursor:pointer;-webkit-user-select:none;user-select:none;text-align:center}.page-controls a:hover{color:#000;background-color:#cf0}.page-controls a.device{width:80px}.page-controls a+a{margin-left:6px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
1041
|
+
}
|
|
1042
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: AdminControlsComponent, decorators: [{
|
|
1043
|
+
type: Component,
|
|
1044
|
+
args: [{ selector: 'bonc-admin-controls', template: "<div class=\"page-controls\">\r\n <a (click)=\"changeLocale()\" class=\"locale\">Locale: {{locale}}</a>\r\n\r\n <!-- todo: return this functionality -->\r\n <!-- <a *ngIf=\"deviceControls\" (click)=\"changeDevice()\" class=\"device\">\r\n <span *ngIf=\"device === DeviceType.Desktop\">DESKTOP</span>\r\n <span *ngIf=\"device === DeviceType.Tablet\">TABLET</span>\r\n <span *ngIf=\"device === DeviceType.Mobile\">MOBILE</span>\r\n </a> -->\r\n\r\n <a *ngIf=\"editableGroup && editableGroup.inEditMode\"\r\n (click)=\"editableGroup.saveAll()\"\r\n class=\"save\">Save all</a>\r\n\r\n <a *ngIf=\"editableGroup && editableGroup.inEditMode\"\r\n (click)=\"editableGroup.cancelAll()\"\r\n class=\"cancel\">Cancel all</a>\r\n</div>\r\n", styles: [":host{display:block;position:sticky;top:0;width:100%;z-index:1000}.page-controls{background-color:#111;height:60px;display:flex;align-items:center;justify-content:center}.page-controls a{color:silver;padding:4px;cursor:pointer;-webkit-user-select:none;user-select:none;text-align:center}.page-controls a:hover{color:#000;background-color:#cf0}.page-controls a.device{width:80px}.page-controls a+a{margin-left:6px}\n"] }]
|
|
1045
|
+
}], propDecorators: { editableGroup: [{
|
|
1046
|
+
type: Input,
|
|
1047
|
+
args: [{ required: true }]
|
|
1048
|
+
}], deviceControls: [{
|
|
1049
|
+
type: Input
|
|
1050
|
+
}] } });
|
|
1051
|
+
|
|
1052
|
+
const imageMimeTypes = ['image/png', 'image/jpeg'];
|
|
1053
|
+
const videoMimeTypes = ['video/mp4'];
|
|
1054
|
+
const imageFileTypes = imageMimeTypes.join(',');
|
|
1055
|
+
const videoFileTypes = videoMimeTypes.join(',');
|
|
1056
|
+
const allMediaFileTypes = `${imageFileTypes},${videoFileTypes}`;
|
|
1057
|
+
class MediaUploaderComponent {
|
|
1058
|
+
constructor(sanitizer, http) {
|
|
1059
|
+
this.sanitizer = sanitizer;
|
|
1060
|
+
this.http = http;
|
|
1061
|
+
this.MediaObjectFit = MediaObjectFit;
|
|
1062
|
+
this.srcChange = new EventEmitter();
|
|
1063
|
+
this.progress = 0;
|
|
1064
|
+
this.isUploading = false;
|
|
1065
|
+
this.autoplay = true;
|
|
1066
|
+
this.fileTypeMask = allMediaFileTypes;
|
|
1067
|
+
}
|
|
1068
|
+
set src(newSrc) {
|
|
1069
|
+
if (this._src === newSrc)
|
|
1070
|
+
return;
|
|
1071
|
+
this._src = newSrc;
|
|
1072
|
+
}
|
|
1073
|
+
get src() {
|
|
1074
|
+
return this._src;
|
|
1075
|
+
}
|
|
1076
|
+
set uploadType(newUploadType) {
|
|
1077
|
+
switch (newUploadType) {
|
|
1078
|
+
case "image":
|
|
1079
|
+
this._uploadType = newUploadType;
|
|
1080
|
+
this.fileTypeMask = imageFileTypes;
|
|
1081
|
+
break;
|
|
1082
|
+
case "video":
|
|
1083
|
+
this._uploadType = newUploadType;
|
|
1084
|
+
this.fileTypeMask = videoFileTypes;
|
|
1085
|
+
break;
|
|
1086
|
+
case undefined:
|
|
1087
|
+
default:
|
|
1088
|
+
this._uploadType = newUploadType;
|
|
1089
|
+
this.fileTypeMask = allMediaFileTypes;
|
|
1090
|
+
break;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
get uploadType() {
|
|
1094
|
+
return this._uploadType;
|
|
1095
|
+
}
|
|
1096
|
+
onFileSelect(fileInput) {
|
|
1097
|
+
if (fileInput.files === undefined || fileInput.files === null || fileInput.files.length !== 1)
|
|
1098
|
+
return;
|
|
1099
|
+
const file = fileInput.files[0];
|
|
1100
|
+
let uploadingMediaType;
|
|
1101
|
+
if (this._uploadType !== undefined && this._uploadType !== null) {
|
|
1102
|
+
uploadingMediaType = this._uploadType;
|
|
1103
|
+
}
|
|
1104
|
+
else if (imageMimeTypes.includes(file.type)) {
|
|
1105
|
+
uploadingMediaType = 'image';
|
|
1106
|
+
}
|
|
1107
|
+
else if (videoMimeTypes.includes(file.type)) {
|
|
1108
|
+
uploadingMediaType = 'video';
|
|
1109
|
+
}
|
|
1110
|
+
else {
|
|
1111
|
+
console.error(`unknown media type ${file.type} (${file.name})`);
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
const uploadUrl = this.uploadUrlMap.get(uploadingMediaType);
|
|
1115
|
+
if (uploadUrl === undefined || uploadUrl === null) {
|
|
1116
|
+
console.error(`upload map doesn't have url for type ${uploadingMediaType}`);
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
const formData = new FormData();
|
|
1120
|
+
formData.append('file', file);
|
|
1121
|
+
formData.append('ratio', `${this.forceRatio ?? 0}`);
|
|
1122
|
+
this.progress = 0;
|
|
1123
|
+
this.isUploading = true;
|
|
1124
|
+
this.updateClip();
|
|
1125
|
+
const request = new HttpRequest('POST', uploadUrl, formData, {
|
|
1126
|
+
reportProgress: true
|
|
949
1127
|
});
|
|
1128
|
+
this.http
|
|
1129
|
+
.request(request)
|
|
1130
|
+
.pipe(map(event => this.getEventMessage(event)),
|
|
1131
|
+
// tap(message => this.showProgress(message)),
|
|
1132
|
+
last(), // return last (completed) message to caller
|
|
1133
|
+
catchError(this.handleError(file))).subscribe(() => { this.isUploading = false; });
|
|
950
1134
|
}
|
|
951
|
-
|
|
952
|
-
|
|
1135
|
+
selectFile(event) {
|
|
1136
|
+
// ignore buble click on file picker
|
|
1137
|
+
if (event.target === this.fileInput.nativeElement)
|
|
1138
|
+
return;
|
|
1139
|
+
this.fileInput.nativeElement.click();
|
|
1140
|
+
}
|
|
1141
|
+
getEventMessage(event) {
|
|
1142
|
+
switch (event.type) {
|
|
1143
|
+
case HttpEventType.Sent:
|
|
1144
|
+
return;
|
|
1145
|
+
case HttpEventType.UploadProgress:
|
|
1146
|
+
this.progress = event.total === undefined ? 0.5 : event.loaded / event.total;
|
|
1147
|
+
this.updateClip();
|
|
1148
|
+
return;
|
|
1149
|
+
case HttpEventType.Response:
|
|
1150
|
+
if (event.body === undefined || event.body === null) {
|
|
1151
|
+
console.error('media deserialization error. Response body in undefined');
|
|
1152
|
+
}
|
|
1153
|
+
else {
|
|
1154
|
+
// remove this
|
|
1155
|
+
// needed for C# deserialization
|
|
1156
|
+
const pixmedia = {
|
|
1157
|
+
$type: event.body.type,
|
|
1158
|
+
...event.body,
|
|
1159
|
+
};
|
|
1160
|
+
this.srcChange.emit(pixmedia);
|
|
1161
|
+
}
|
|
1162
|
+
return;
|
|
1163
|
+
default:
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
updateClip() {
|
|
1168
|
+
this.clipStyle = this.sanitizer.bypassSecurityTrustStyle(`inset(0px 100% 0px 0%)`);
|
|
1169
|
+
}
|
|
1170
|
+
handleError(file) {
|
|
1171
|
+
const func = (error, p2) => {
|
|
1172
|
+
const message = `error uploadingFile ${file.name}.`;
|
|
1173
|
+
console.error(message, error, p2);
|
|
1174
|
+
alert(message);
|
|
1175
|
+
return new Observable();
|
|
1176
|
+
};
|
|
1177
|
+
return func;
|
|
1178
|
+
}
|
|
1179
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: MediaUploaderComponent, deps: [{ token: i1$1.DomSanitizer }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1180
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: MediaUploaderComponent, selector: "bonc-media-uploader", inputs: { uploadUrlMap: "uploadUrlMap", forceRatio: "forceRatio", src: "src", uploadType: "uploadType" }, outputs: { srcChange: "srcChange" }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], ngImport: i0, template: "<bon-media [src]=\"src\" [objectFit]=\"MediaObjectFit.Cover\"></bon-media>\r\n\r\n<div *ngIf=\"src?.sources?.length===0\">Upload media</div>\r\n\r\n<div (click)=\"selectFile($event)\" class=\"media-container\">\r\n <input #fileInput [accept]=\"fileTypeMask\" (change)=\"onFileSelect(fileInput)\" name=\"media\" type=\"file\" />\r\n <span *ngIf=\"isUploading\"\r\n [style.clip-path]=\"clipStyle\"\r\n [style.-webkit-clip-path]=\"clipStyle\"\r\n class=\"loader\"></span>\r\n\r\n <span *ngIf=\"isUploading\" class=\"loader-text\">\r\n <span *ngIf=\"progress < 1\">{{100 * progress | number: '1.0-0'}}%</span>\r\n <span *ngIf=\"progress >= 1\">converting</span>\r\n </span>\r\n</div>\r\n", styles: [":host{display:block;background-color:#000;position:relative}.media-container{display:block;position:absolute;inset:0;cursor:pointer}.media-container:hover:hover:after{display:flex;justify-content:center;align-items:center;content:\"\";position:absolute;color:silver;inset:0;font-weight:700;font-size:50pt;pointer-events:none;background-color:#ccff00b3}.media-container img,.media-container video{display:block;position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover}input[type=file]{display:none}.loader{position:absolute;inset:0;background-color:#cf0}.loader-text{background-color:#000;position:absolute;top:50%;left:0;right:0;text-align:center;font-size:20pt;margin-top:-10pt;color:#fff}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.MarcyMediaComponent, selector: "bon-media", inputs: ["src", "objectFit"], outputs: ["isLoaded"] }, { kind: "pipe", type: i2$1.DecimalPipe, name: "number" }] }); }
|
|
953
1181
|
}
|
|
954
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type:
|
|
1182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: MediaUploaderComponent, decorators: [{
|
|
955
1183
|
type: Component,
|
|
956
|
-
args: [{ selector: 'bonc-
|
|
957
|
-
}], propDecorators: {
|
|
1184
|
+
args: [{ selector: 'bonc-media-uploader', template: "<bon-media [src]=\"src\" [objectFit]=\"MediaObjectFit.Cover\"></bon-media>\r\n\r\n<div *ngIf=\"src?.sources?.length===0\">Upload media</div>\r\n\r\n<div (click)=\"selectFile($event)\" class=\"media-container\">\r\n <input #fileInput [accept]=\"fileTypeMask\" (change)=\"onFileSelect(fileInput)\" name=\"media\" type=\"file\" />\r\n <span *ngIf=\"isUploading\"\r\n [style.clip-path]=\"clipStyle\"\r\n [style.-webkit-clip-path]=\"clipStyle\"\r\n class=\"loader\"></span>\r\n\r\n <span *ngIf=\"isUploading\" class=\"loader-text\">\r\n <span *ngIf=\"progress < 1\">{{100 * progress | number: '1.0-0'}}%</span>\r\n <span *ngIf=\"progress >= 1\">converting</span>\r\n </span>\r\n</div>\r\n", styles: [":host{display:block;background-color:#000;position:relative}.media-container{display:block;position:absolute;inset:0;cursor:pointer}.media-container:hover:hover:after{display:flex;justify-content:center;align-items:center;content:\"\";position:absolute;color:silver;inset:0;font-weight:700;font-size:50pt;pointer-events:none;background-color:#ccff00b3}.media-container img,.media-container video{display:block;position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover}input[type=file]{display:none}.loader{position:absolute;inset:0;background-color:#cf0}.loader-text{background-color:#000;position:absolute;top:50%;left:0;right:0;text-align:center;font-size:20pt;margin-top:-10pt;color:#fff}\n"] }]
|
|
1185
|
+
}], ctorParameters: () => [{ type: i1$1.DomSanitizer }, { type: i1$2.HttpClient }], propDecorators: { fileInput: [{
|
|
1186
|
+
type: ViewChild,
|
|
1187
|
+
args: ['fileInput', { static: true }]
|
|
1188
|
+
}], srcChange: [{
|
|
1189
|
+
type: Output
|
|
1190
|
+
}], uploadUrlMap: [{
|
|
958
1191
|
type: Input,
|
|
959
1192
|
args: [{ required: true }]
|
|
960
|
-
}],
|
|
1193
|
+
}], forceRatio: [{
|
|
1194
|
+
type: Input
|
|
1195
|
+
}], src: [{
|
|
1196
|
+
type: Input
|
|
1197
|
+
}], uploadType: [{
|
|
961
1198
|
type: Input
|
|
962
1199
|
}] } });
|
|
963
1200
|
|
|
@@ -1350,21 +1587,28 @@ function createPreset(params) {
|
|
|
1350
1587
|
};
|
|
1351
1588
|
}
|
|
1352
1589
|
|
|
1590
|
+
const formComponents = [
|
|
1591
|
+
TranslationFormComponent,
|
|
1592
|
+
TextFormComponent,
|
|
1593
|
+
SeoFormComponent,
|
|
1594
|
+
SvgFormComponent,
|
|
1595
|
+
FileFormComponent,
|
|
1596
|
+
LottieFormComponent,
|
|
1597
|
+
UnknownFormComponent
|
|
1598
|
+
];
|
|
1353
1599
|
const components = [
|
|
1600
|
+
...formComponents,
|
|
1354
1601
|
TranslationInputComponent,
|
|
1355
1602
|
TranslationTextareaComponent,
|
|
1356
1603
|
AdminControlsComponent,
|
|
1357
1604
|
EditableGroupComponent,
|
|
1358
1605
|
FormControlsComponent,
|
|
1359
|
-
TranslationFormComponent,
|
|
1360
|
-
TextFormComponent,
|
|
1361
|
-
SeoFormComponent,
|
|
1362
|
-
UnknownFormComponent,
|
|
1363
1606
|
SkeletonEditorComponent,
|
|
1364
1607
|
SkeletonEditorAnchorDirective,
|
|
1365
1608
|
BoneEditorContainerComponent,
|
|
1366
1609
|
UnknownBoneEditorComponent,
|
|
1367
1610
|
MediaUploaderComponent,
|
|
1611
|
+
FileUploaderComponent,
|
|
1368
1612
|
LinkPopupComponent
|
|
1369
1613
|
];
|
|
1370
1614
|
const standaloneDirectives = [
|
|
@@ -1372,46 +1616,55 @@ const standaloneDirectives = [
|
|
|
1372
1616
|
];
|
|
1373
1617
|
class BonnieCmsModule {
|
|
1374
1618
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: BonnieCmsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1375
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: BonnieCmsModule, declarations: [
|
|
1619
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: BonnieCmsModule, declarations: [TranslationFormComponent,
|
|
1620
|
+
TextFormComponent,
|
|
1621
|
+
SeoFormComponent,
|
|
1622
|
+
SvgFormComponent,
|
|
1623
|
+
FileFormComponent,
|
|
1624
|
+
LottieFormComponent,
|
|
1625
|
+
UnknownFormComponent, TranslationInputComponent,
|
|
1376
1626
|
TranslationTextareaComponent,
|
|
1377
1627
|
AdminControlsComponent,
|
|
1378
1628
|
EditableGroupComponent,
|
|
1379
1629
|
FormControlsComponent,
|
|
1380
|
-
TranslationFormComponent,
|
|
1381
|
-
TextFormComponent,
|
|
1382
|
-
SeoFormComponent,
|
|
1383
|
-
UnknownFormComponent,
|
|
1384
1630
|
SkeletonEditorComponent,
|
|
1385
1631
|
SkeletonEditorAnchorDirective,
|
|
1386
1632
|
BoneEditorContainerComponent,
|
|
1387
1633
|
UnknownBoneEditorComponent,
|
|
1388
1634
|
MediaUploaderComponent,
|
|
1635
|
+
FileUploaderComponent,
|
|
1389
1636
|
LinkPopupComponent], imports: [CommonModule,
|
|
1390
1637
|
FormsModule,
|
|
1391
1638
|
CdkTextareaAutosize,
|
|
1392
|
-
BonnieModule,
|
|
1639
|
+
BonnieModule,
|
|
1640
|
+
LottieComponent, EditableDirective], exports: [CommonModule,
|
|
1393
1641
|
FormsModule,
|
|
1394
|
-
BonnieModule,
|
|
1642
|
+
BonnieModule,
|
|
1643
|
+
LottieFormComponent, TranslationFormComponent,
|
|
1644
|
+
TextFormComponent,
|
|
1645
|
+
SeoFormComponent,
|
|
1646
|
+
SvgFormComponent,
|
|
1647
|
+
FileFormComponent,
|
|
1648
|
+
LottieFormComponent,
|
|
1649
|
+
UnknownFormComponent, TranslationInputComponent,
|
|
1395
1650
|
TranslationTextareaComponent,
|
|
1396
1651
|
AdminControlsComponent,
|
|
1397
1652
|
EditableGroupComponent,
|
|
1398
1653
|
FormControlsComponent,
|
|
1399
|
-
TranslationFormComponent,
|
|
1400
|
-
TextFormComponent,
|
|
1401
|
-
SeoFormComponent,
|
|
1402
|
-
UnknownFormComponent,
|
|
1403
1654
|
SkeletonEditorComponent,
|
|
1404
1655
|
SkeletonEditorAnchorDirective,
|
|
1405
1656
|
BoneEditorContainerComponent,
|
|
1406
1657
|
UnknownBoneEditorComponent,
|
|
1407
1658
|
MediaUploaderComponent,
|
|
1659
|
+
FileUploaderComponent,
|
|
1408
1660
|
LinkPopupComponent, EditableDirective] }); }
|
|
1409
1661
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: BonnieCmsModule, providers: [
|
|
1410
1662
|
DataService,
|
|
1411
1663
|
AdminDataService
|
|
1412
1664
|
], imports: [CommonModule,
|
|
1413
1665
|
FormsModule,
|
|
1414
|
-
BonnieModule,
|
|
1666
|
+
BonnieModule,
|
|
1667
|
+
LottieComponent, CommonModule,
|
|
1415
1668
|
FormsModule,
|
|
1416
1669
|
BonnieModule] }); }
|
|
1417
1670
|
} // todo: move to standalone
|
|
@@ -1430,12 +1683,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
1430
1683
|
FormsModule,
|
|
1431
1684
|
CdkTextareaAutosize,
|
|
1432
1685
|
BonnieModule,
|
|
1686
|
+
LottieComponent,
|
|
1433
1687
|
...standaloneDirectives
|
|
1434
1688
|
],
|
|
1435
1689
|
exports: [
|
|
1436
1690
|
CommonModule,
|
|
1437
1691
|
FormsModule,
|
|
1438
1692
|
BonnieModule,
|
|
1693
|
+
LottieFormComponent,
|
|
1439
1694
|
...components,
|
|
1440
1695
|
...standaloneDirectives
|
|
1441
1696
|
]
|
|
@@ -1446,5 +1701,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
1446
1701
|
* Generated bundle index. Do not edit.
|
|
1447
1702
|
*/
|
|
1448
1703
|
|
|
1449
|
-
export { AdminControlsComponent, AdminDataService, BoneEditorBaseComponent, BoneEditorContainerComponent, BonnieCmsModule, DataService, DeviceType, DeviceVisibility, EditableDirective, EditableGroupComponent, FormBaseComponent, FormControlsComponent, LinkPopupComponent, MediaUploaderComponent, SeoFormComponent, SkeletonEditorAnchorDirective, SkeletonEditorComponent, TextEditorField, TextFormComponent, TextInputStyle, TextSettingType, TranslationFormComponent, TranslationInputComponent, TranslationTextareaComponent, UnknownBoneEditorComponent, UnknownFormComponent, createPreset, hasFlag, isLocalUrlString, regExpIsMobile, setOrRemoveFlag };
|
|
1704
|
+
export { AdminControlsComponent, AdminDataService, BoneEditorBaseComponent, BoneEditorContainerComponent, BonnieCmsModule, DataService, DeviceType, DeviceVisibility, EditableDirective, EditableGroupComponent, FileFormComponent, FileUploaderComponent, FormBaseComponent, FormControlsComponent, LinkPopupComponent, LottieFormComponent, MediaUploaderComponent, SeoFormComponent, SkeletonEditorAnchorDirective, SkeletonEditorComponent, SvgFormComponent, TextEditorField, TextFormComponent, TextInputStyle, TextSettingType, TranslationFormComponent, TranslationInputComponent, TranslationTextareaComponent, UnknownBoneEditorComponent, UnknownFormComponent, createPreset, hasFlag, isLocalUrlString, regExpIsMobile, setOrRemoveFlag };
|
|
1450
1705
|
//# sourceMappingURL=candy-kingdom-bonnie-cms.mjs.map
|