@stratusjs/angular 0.3.5 → 0.3.7
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/package.json +1 -1
- package/src/angular.modules.js.map +1 -1
- package/src/app.module.js +7 -2
- package/src/app.module.js.map +1 -1
- package/src/app.module.min.js +1 -1
- package/src/app.module.ts +6 -1
- package/src/backend.service.js +9 -1
- package/src/backend.service.js.map +1 -1
- package/src/backend.service.min.js +1 -1
- package/src/backend.service.ts +9 -1
- package/src/base/base.component.js.map +1 -1
- package/src/boot.js.map +1 -1
- package/src/boot.ts +1 -0
- package/src/changeset-viewer/changeset-viewer-dialog.component.js.map +1 -1
- package/src/changeset-viewer/changeset-viewer-dialog.component.min.js +1 -1
- package/src/changeset-viewer/changeset-viewer.component.js.map +1 -1
- package/src/confirm-dialog/confirm-dialog.component.js.map +1 -1
- package/src/confirm-dialog/confirm-dialog.component.min.js +1 -1
- package/src/editor/code-view-dialog.component.js.map +1 -1
- package/src/editor/code-view-dialog.component.min.js +1 -1
- package/src/editor/editor.component.js +42 -3
- package/src/editor/editor.component.js.map +1 -1
- package/src/editor/editor.component.min.js +1 -1
- package/src/editor/editor.component.ts +51 -0
- package/src/editor/link-dialog.component.css +18 -0
- package/src/editor/link-dialog.component.css.map +1 -0
- package/src/editor/link-dialog.component.html +208 -0
- package/src/editor/link-dialog.component.js +271 -0
- package/src/editor/link-dialog.component.js.map +1 -0
- package/src/editor/link-dialog.component.min.css +1 -0
- package/src/editor/link-dialog.component.min.html +7 -0
- package/src/editor/link-dialog.component.min.js +1 -0
- package/src/editor/link-dialog.component.scss +26 -0
- package/src/editor/link-dialog.component.ts +363 -0
- package/src/editor/media-dialog.component.js +1 -1
- package/src/editor/media-dialog.component.js.map +1 -1
- package/src/editor/media-dialog.component.min.js +1 -1
- package/src/editor/media-dialog.component.ts +1 -1
- package/src/froala/plugins/inputButton.js +1 -1
- package/src/froala/plugins/inputButton.js.map +1 -1
- package/src/froala/plugins/inputButton.min.js +1 -1
- package/src/froala/plugins/inputButton.ts +1 -2
- package/src/froala/plugins/linkManager.js +88 -0
- package/src/froala/plugins/linkManager.js.map +1 -0
- package/src/froala/plugins/linkManager.min.js +1 -0
- package/src/froala/plugins/linkManager.ts +110 -0
- package/src/froala/plugins/mediaManager.min.js +1 -1
- package/src/froala/plugins/menuButton.min.js +1 -1
- package/src/material.js.map +1 -1
- package/src/media-selector/media-selector.component.js.map +1 -1
- package/src/media-selector/media-selector.component.min.js +1 -1
- package/src/quill-plugins/quill-html-edit.plugin.min.js +1 -1
- package/src/quill-plugins/quill-image-format.plugin.min.js +1 -1
- package/src/selector/selector.component.js.map +1 -1
- package/src/selector/selector.component.min.js +1 -1
- package/src/test/test.directive.js.map +1 -1
- package/src/tree/tree-dialog.component.js +1 -1
- package/src/tree/tree-dialog.component.js.map +1 -1
- package/src/tree/tree-dialog.component.min.js +1 -1
- package/src/tree/tree-dialog.component.ts +1 -1
- package/src/tree/tree-node.component.js.map +1 -1
- package/src/tree/tree-node.component.min.js +1 -1
- package/src/tree/tree.component.js.map +1 -1
- package/src/tree/tree.component.min.js +1 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
System.register(["@angular/core", "@angular/forms", "@angular/material/dialog", "@angular/material/snack-bar", "rxjs", "rxjs/operators", "lodash", "@stratusjs/runtime/stratus", "@stratusjs/core/environment", "@stratusjs/angular/backend.service", "@stratusjs/angularjs/services/model", "@stratusjs/angular/core/responsive.component", "@angular/material/icon", "@angular/platform-browser"], function (exports_1, context_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8
|
+
};
|
|
9
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11
|
+
};
|
|
12
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
13
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
14
|
+
};
|
|
15
|
+
var core_1, forms_1, dialog_1, snack_bar_1, rxjs_1, operators_1, lodash_1, stratus_1, environment_1, backend_service_1, model_1, responsive_component_1, icon_1, platform_browser_1, systemDir, moduleName, parentModuleName, min, localDir, LinkDialogComponent;
|
|
16
|
+
var __moduleName = context_1 && context_1.id;
|
|
17
|
+
return {
|
|
18
|
+
setters: [
|
|
19
|
+
function (core_1_1) {
|
|
20
|
+
core_1 = core_1_1;
|
|
21
|
+
},
|
|
22
|
+
function (forms_1_1) {
|
|
23
|
+
forms_1 = forms_1_1;
|
|
24
|
+
},
|
|
25
|
+
function (dialog_1_1) {
|
|
26
|
+
dialog_1 = dialog_1_1;
|
|
27
|
+
},
|
|
28
|
+
function (snack_bar_1_1) {
|
|
29
|
+
snack_bar_1 = snack_bar_1_1;
|
|
30
|
+
},
|
|
31
|
+
function (rxjs_1_1) {
|
|
32
|
+
rxjs_1 = rxjs_1_1;
|
|
33
|
+
},
|
|
34
|
+
function (operators_1_1) {
|
|
35
|
+
operators_1 = operators_1_1;
|
|
36
|
+
},
|
|
37
|
+
function (lodash_1_1) {
|
|
38
|
+
lodash_1 = lodash_1_1;
|
|
39
|
+
},
|
|
40
|
+
function (stratus_1_1) {
|
|
41
|
+
stratus_1 = stratus_1_1;
|
|
42
|
+
},
|
|
43
|
+
function (environment_1_1) {
|
|
44
|
+
environment_1 = environment_1_1;
|
|
45
|
+
},
|
|
46
|
+
function (backend_service_1_1) {
|
|
47
|
+
backend_service_1 = backend_service_1_1;
|
|
48
|
+
},
|
|
49
|
+
function (model_1_1) {
|
|
50
|
+
model_1 = model_1_1;
|
|
51
|
+
},
|
|
52
|
+
function (responsive_component_1_1) {
|
|
53
|
+
responsive_component_1 = responsive_component_1_1;
|
|
54
|
+
},
|
|
55
|
+
function (icon_1_1) {
|
|
56
|
+
icon_1 = icon_1_1;
|
|
57
|
+
},
|
|
58
|
+
function (platform_browser_1_1) {
|
|
59
|
+
platform_browser_1 = platform_browser_1_1;
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
execute: function () {
|
|
63
|
+
systemDir = '@stratusjs/angular';
|
|
64
|
+
moduleName = 'link-dialog';
|
|
65
|
+
parentModuleName = 'editor';
|
|
66
|
+
min = !environment_1.cookie('env') ? '.min' : '';
|
|
67
|
+
localDir = `${stratus_1.Stratus.BaseUrl}${boot.configuration.paths[`${systemDir}/*`].replace(/[^/]*$/, '')}`;
|
|
68
|
+
LinkDialogComponent = class LinkDialogComponent extends responsive_component_1.ResponsiveComponent {
|
|
69
|
+
constructor(dialogRef, data, fb, backend, snackBar, iconRegistry, sanitizer, ref) {
|
|
70
|
+
super();
|
|
71
|
+
this.dialogRef = dialogRef;
|
|
72
|
+
this.data = data;
|
|
73
|
+
this.fb = fb;
|
|
74
|
+
this.backend = backend;
|
|
75
|
+
this.snackBar = snackBar;
|
|
76
|
+
this.iconRegistry = iconRegistry;
|
|
77
|
+
this.sanitizer = sanitizer;
|
|
78
|
+
this.ref = ref;
|
|
79
|
+
this.title = moduleName + '_component';
|
|
80
|
+
this._ = lodash_1.default;
|
|
81
|
+
this.Stratus = stratus_1.Stratus;
|
|
82
|
+
this.apiBase = '/Api/Content';
|
|
83
|
+
this.contentEntities = [];
|
|
84
|
+
this.isContentLoading = true;
|
|
85
|
+
this.limit = 20;
|
|
86
|
+
this.eventInsert = true;
|
|
87
|
+
this.selected = [];
|
|
88
|
+
this.svgIcons = {};
|
|
89
|
+
}
|
|
90
|
+
ngOnInit() {
|
|
91
|
+
this.uid = lodash_1.default.uniqueId(`sa_${lodash_1.default.snakeCase(moduleName)}_component_`);
|
|
92
|
+
stratus_1.Stratus.Instances[this.uid] = this;
|
|
93
|
+
stratus_1.Stratus.Internals.CssLoader(`${localDir}${parentModuleName}/${moduleName}.component${min}.css`);
|
|
94
|
+
this.model = this.data.model;
|
|
95
|
+
this.property = this.data.property;
|
|
96
|
+
this.editor = this.data.editor;
|
|
97
|
+
this.eventManager = this.data.eventManager;
|
|
98
|
+
if (lodash_1.default.isBoolean(this.data.eventInsert)) {
|
|
99
|
+
this.eventInsert = this.data.eventInsert;
|
|
100
|
+
}
|
|
101
|
+
this.dialogLinkForm = this.fb.group({
|
|
102
|
+
linkQueryInput: ''
|
|
103
|
+
});
|
|
104
|
+
this.dialogLinkForm
|
|
105
|
+
.get('linkQueryInput')
|
|
106
|
+
.valueChanges
|
|
107
|
+
.pipe(operators_1.debounceTime(300), operators_1.tap(() => {
|
|
108
|
+
}), operators_1.switchMap((value) => {
|
|
109
|
+
return this.getQuery(value);
|
|
110
|
+
}))
|
|
111
|
+
.subscribe((response) => this.processContent(response));
|
|
112
|
+
this.getQuery().subscribe((response) => this.processContent(response));
|
|
113
|
+
this.refresh();
|
|
114
|
+
}
|
|
115
|
+
onCancelClick() {
|
|
116
|
+
this.dialogRef.close();
|
|
117
|
+
this.refresh();
|
|
118
|
+
}
|
|
119
|
+
onPage(event) {
|
|
120
|
+
this.pageEvent = event;
|
|
121
|
+
this.getQuery(this.lastContentQuery).subscribe((response) => this.processContent(response));
|
|
122
|
+
}
|
|
123
|
+
getQueryUrl(query) {
|
|
124
|
+
let limit = this.limit;
|
|
125
|
+
let paging = 1;
|
|
126
|
+
if (this.pageEvent) {
|
|
127
|
+
limit = this.pageEvent.pageSize;
|
|
128
|
+
paging = this.pageEvent.pageIndex + 1;
|
|
129
|
+
}
|
|
130
|
+
query = (lodash_1.default.isString(query) && !lodash_1.default.isEmpty(query)) ? `"${query}"` : '';
|
|
131
|
+
return `${this.apiBase}?limit=${limit}&p=${paging}&q=${query}`;
|
|
132
|
+
}
|
|
133
|
+
getQuery(query) {
|
|
134
|
+
this.lastContentQuery = query;
|
|
135
|
+
this.isContentLoading = true;
|
|
136
|
+
return this.backend.get(this.getQueryUrl(query))
|
|
137
|
+
.pipe(operators_1.finalize(() => this.isContentLoading = false));
|
|
138
|
+
}
|
|
139
|
+
processContent(response) {
|
|
140
|
+
if (!response.ok || response.status !== 200 || lodash_1.default.isEmpty(response.body)) {
|
|
141
|
+
this.meta = {};
|
|
142
|
+
this.contentEntities = [];
|
|
143
|
+
this.refresh();
|
|
144
|
+
return this.contentEntities;
|
|
145
|
+
}
|
|
146
|
+
this.meta = lodash_1.default.get(response.body, 'meta') || {};
|
|
147
|
+
const payload = lodash_1.default.get(response.body, 'payload') || response.body;
|
|
148
|
+
if (lodash_1.default.isEmpty(payload) || !Array.isArray(payload)) {
|
|
149
|
+
this.contentEntities = [];
|
|
150
|
+
this.isContentLoading = false;
|
|
151
|
+
this.refresh();
|
|
152
|
+
return this.contentEntities;
|
|
153
|
+
}
|
|
154
|
+
this.contentEntities = payload;
|
|
155
|
+
this.isContentLoading = false;
|
|
156
|
+
this.refresh();
|
|
157
|
+
return this.contentEntities;
|
|
158
|
+
}
|
|
159
|
+
select(content) {
|
|
160
|
+
if (lodash_1.default.isUndefined(content)) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const linkElement = this.createLink(content);
|
|
164
|
+
if (!linkElement) {
|
|
165
|
+
console.warn(`${moduleName}: unable to build link for Content ID: ${content.id}`);
|
|
166
|
+
this.snackBar.open(`Unable to build link for Content ID: ${content.id}.`, 'dismiss', {
|
|
167
|
+
duration: 5000,
|
|
168
|
+
horizontalPosition: 'right',
|
|
169
|
+
verticalPosition: 'bottom'
|
|
170
|
+
});
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
this.selected.push(content.id);
|
|
174
|
+
if (!this.eventInsert) {
|
|
175
|
+
if (!(this.model instanceof model_1.Model)) {
|
|
176
|
+
console.warn(`${moduleName}: event manager not available.`);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (!lodash_1.default.isString(this.property)) {
|
|
180
|
+
console.warn(`${moduleName}: event manager not available.`);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
console.warn(`${moduleName}: disabling eventInsert is not recommended.`);
|
|
184
|
+
this.model.set(this.property, this.model.get(this.property) + linkElement);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (!this.eventManager) {
|
|
188
|
+
console.warn(`${moduleName}: event manager is not set.`);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
this.eventManager.trigger('insert', linkElement, this.editor);
|
|
192
|
+
}
|
|
193
|
+
isSelected(content) {
|
|
194
|
+
if (lodash_1.default.isUndefined(content)) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
return lodash_1.default.includes(this.selected, content.id);
|
|
198
|
+
}
|
|
199
|
+
createLink(content) {
|
|
200
|
+
if (!content) {
|
|
201
|
+
console.warn(`${moduleName}: unable to create link for empty content`);
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
if (!content.contentType || !content.contentType.name) {
|
|
205
|
+
console.warn(`${moduleName}: unable to find content type for content id: ${content.id}`);
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
if (!content.routing || !content.routing.length || !content.routing[0]) {
|
|
209
|
+
console.warn(`${moduleName}: unable to find routing for ${content.contentType.name} id: ${content.id}`);
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
if (!content.routing[0].url) {
|
|
213
|
+
console.warn(`${moduleName}: unable to find url for ${content.contentType.name} id: ${content.id}`);
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
if (!content.version) {
|
|
217
|
+
console.warn(`${moduleName}: unable to find content version for ${content.contentType.name} id: ${content.id}`);
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
if (!content.version.title || !content.version.title.length) {
|
|
221
|
+
console.warn(`${moduleName}: unable to find title for ${content.contentType.name} id: ${content.id}`);
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
return `<a href="/${content.routing[0].url}" aria-label="${content.version.title}">${content.version.title}</a>`;
|
|
225
|
+
}
|
|
226
|
+
getSvg(url, options) {
|
|
227
|
+
const uid = this.addSvgIcon(url, options);
|
|
228
|
+
return new rxjs_1.Observable((subscriber) => {
|
|
229
|
+
this.iconRegistry
|
|
230
|
+
.getNamedSvgIcon(uid)
|
|
231
|
+
.subscribe({
|
|
232
|
+
error(err) {
|
|
233
|
+
console.error(`getSvg(${url}): ${err}`);
|
|
234
|
+
},
|
|
235
|
+
complete() {
|
|
236
|
+
subscriber.next(uid);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
addSvgIcon(url, options) {
|
|
242
|
+
if (url in this.svgIcons) {
|
|
243
|
+
return this.svgIcons[url];
|
|
244
|
+
}
|
|
245
|
+
if (!options) {
|
|
246
|
+
options = {};
|
|
247
|
+
}
|
|
248
|
+
const uid = this.svgIcons[url] = lodash_1.default.uniqueId('selector_svg');
|
|
249
|
+
this.iconRegistry.addSvgIcon(uid, this.sanitizer.bypassSecurityTrustResourceUrl(url), options);
|
|
250
|
+
return uid;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
LinkDialogComponent = __decorate([
|
|
254
|
+
core_1.Component({
|
|
255
|
+
selector: `sa-${moduleName}`,
|
|
256
|
+
templateUrl: `${localDir}/${parentModuleName}/${moduleName}.component${min}.html`,
|
|
257
|
+
}),
|
|
258
|
+
__param(1, core_1.Inject(dialog_1.MAT_DIALOG_DATA)),
|
|
259
|
+
__metadata("design:paramtypes", [dialog_1.MatDialogRef, Object, forms_1.FormBuilder,
|
|
260
|
+
backend_service_1.BackendService,
|
|
261
|
+
snack_bar_1.MatSnackBar,
|
|
262
|
+
icon_1.MatIconRegistry,
|
|
263
|
+
platform_browser_1.DomSanitizer,
|
|
264
|
+
core_1.ChangeDetectorRef])
|
|
265
|
+
], LinkDialogComponent);
|
|
266
|
+
exports_1("LinkDialogComponent", LinkDialogComponent);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
//# sourceMappingURL=link-dialog.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["link-dialog.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiEM,SAAS,GAAG,oBAAoB,CAAA;YAChC,UAAU,GAAG,aAAa,CAAA;YAC1B,gBAAgB,GAAG,QAAQ,CAAA;YAG3B,GAAG,GAAG,CAAC,oBAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;YAClC,QAAQ,GAAG,GAAG,iBAAO,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAA;YAU3F,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,0CAAmB;gBAwCxD,YACW,SAA4C,EACnB,IAAoB,EAC5C,EAAe,EACf,OAAuB,EACvB,QAAqB,EACrB,YAA6B,EAC7B,SAAuB,EACrB,GAAsB;oBAGhC,KAAK,EAAE,CAAA;oBAVA,cAAS,GAAT,SAAS,CAAmC;oBACnB,SAAI,GAAJ,IAAI,CAAgB;oBAC5C,OAAE,GAAF,EAAE,CAAa;oBACf,YAAO,GAAP,OAAO,CAAgB;oBACvB,aAAQ,GAAR,QAAQ,CAAa;oBACrB,iBAAY,GAAZ,YAAY,CAAiB;oBAC7B,cAAS,GAAT,SAAS,CAAc;oBACrB,QAAG,GAAH,GAAG,CAAmB;oBA7CpC,U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AAS,CAAC;4BAMP,KAAK,CAAC,GAAG;gCACL,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,GAAG,EAAE,CAAC,CAAA;4BAC3C,CAAC;4BACD,QAAQ;gCAEJ,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;4BACxB,CAAC;yBACJ,CAAC,CAAA;oBACV,CAAC,CAAC,CAAA;gBACN,CAAC;gBAMD,UAAU,CAAC,GAAW,EAAE,OAAqB;oBACzC,IAAI,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE;wBACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;qBAC5B;oBACD,IAAI,CAAC,OAAO,EAAE;wBACV,OAAO,GAAG,EAAE,CAAA;qBACf;oBACD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,gBAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;oBAC3D,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAA;oBAC9F,OAAO,GAAG,CAAA;gBACd,CAAC;aACJ,CAAA;YA/QY,mBAAmB;gBAL/B,gBAAS,CAAC;oBACP,QAAQ,EAAE,MAAM,UAAU,EAAE;oBAC5B,WAAW,EAAE,GAAG,QAAQ,IAAI,gBAAgB,IAAI,UAAU,aAAa,GAAG,OAAO;iBAEpF,CAAC;gBA2CO,WAAA,aAAM,CAAC,wBAAe,CAAC,CAAA;iDADN,qBAAY,UAElB,mBAAW;oBACN,gCAAc;oBACb,uBAAW;oBACP,sBAAe;oBAClB,+BAAY;oBAChB,wBAAiB;eAhD3B,mBAAmB,CA+Q/B;;QAWD,CAAC","file":"link-dialog.component.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.link-dialog-content .radio-group{display:flex;flex-direction:column;margin:15px 0}.link-dialog-content .radio-button{margin:5px}.link-dialog-content img.selected{opacity:.5}.link-dialog-content .link-card{max-width:400px}.link-dialog-content .link-header-image{background-size:cover}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<h1 mat-dialog-title>Link Selector</h1><div mat-dialog-content class="link-dialog-content"><form class="dialog-form" [formGroup]="dialogLinkForm"><mat-form-field class="form-field"><input matInput placeholder="Search Content" aria-label="Search Content" formControlName="linkQueryInput"></mat-form-field></form><mat-progress-bar mode="indeterminate" *ngIf="isContentLoading"></mat-progress-bar><div class="content" fxLayout="row wrap" fxLayoutGap="16px grid"><div fxFlex="25%" fxFlex.xs="100%" fxFlex.sm="33%" *ngFor="let contentEntity of contentEntities"><mat-card class="content-card"><mat-card-header><mat-card-title><ng-container *ngIf="contentEntity.version.title && contentEntity.version.title.length > 16; else defaultTitle"><span [matTooltip]="contentEntity.version.title" [innerText]="(contentEntity.version.title | slice:0:13) + '...'" [style.cursor]="'help'"></span></ng-container><ng-template #defaultTitle><span [innerText]="contentEntity.version.title || 'Untitled'" [style.cursor]="'default'"></span></ng-template></mat-card-title><mat-card-subtitle><ng-container *ngIf="contentEntity.contentType.name && contentEntity.contentType.name.length > 24; else defaultSubtitle"><span [matTooltip]="contentEntity.contentType.name" [innerText]="(contentEntity.contentType.name | slice:0:21) + '...'" [style.cursor]="'help'"></span></ng-container><ng-template #defaultSubtitle><span [innerText]="contentEntity.contentType.name" [style.cursor]="'default'"></span></ng-template></mat-card-subtitle></mat-card-header><ng-template #defaultBody><mat-icon aria-hidden="true" [svgIcon]="getSvg(Stratus.BaseUrl + contentEntity.contentType.iconResourcePath) | async">ContentType Icon</mat-icon></ng-template><ng-container *ngIf="contentEntity.version && contentEntity.version.bestImage; else defaultBody"><ng-container *ngIf="contentEntity.version.bestImage._thumbnailUrl"><img mat-card-image class="generic-thumb basic-image" [src]="contentEntity.version.bestImage.mime !== 'image/gif' ? contentEntity.version.bestImage._thumbnailUrl : contentEntity.version.bestImage._directUrl" [alt]="contentEntity.version.title" [ngClass]="{'selected' : isSelected(contentEntity)}"></ng-container><ng-container *ngIf="!contentEntity.version.bestImage._thumbnailUrl
|
|
2
|
+
&& contentEntity.version.bestImage.mime === 'video'"><ng-container *ngIf="contentEntity.version.bestImage.service === 'vimeo'"><ng-container *ngIf="contentEntity.version.bestImage.meta && contentEntity.version.bestImage.meta.thumbnail_large; else basicVimeoButton"><img mat-card-image class="vimeo" [src]="contentEntity.version.bestImage.meta.thumbnail_large" [alt]="contentEntity.version.title" [ngClass]="{'selected' : isSelected(contentEntity)}"></ng-container><ng-template #basicVimeoButton><img mat-card-image class="vimeo basic-image" [src]="Stratus.BaseUrl + 'sitetheorymedia/images/mediaTypeIcons/media-icon-video.png'" style="background: #4e4e4e;" [alt]="contentEntity.version.title" [ngClass]="{'selected' : isSelected(contentEntity)}"></ng-template></ng-container><ng-container *ngIf="contentEntity.version.bestImage.service === 'youtube'"><ng-container *ngIf="contentEntity.version.bestImage.serviceMediaId; else basicYoutubeButton"><img mat-card-image class="youtube" [src]="'https://img.youtube.com/vi/' + contentEntity.version.bestImage.serviceMediaId + '/hqdefault.jpg'" [alt]="contentEntity.version.title" [ngClass]="{'selected' : isSelected(contentEntity)}"></ng-container><ng-template #basicYoutubeButton><img mat-card-image class="youtube basic-image" [src]="Stratus.BaseUrl + 'sitetheorymedia/images/mediaTypeIcons/media-icon-video.png'" style="background: #4e4e4e;" [alt]="contentEntity.version.title" [ngClass]="{'selected' : isSelected(contentEntity)}"></ng-template></ng-container><ng-container *ngIf="contentEntity.version.bestImage.service === 'facebook'"><img mat-card-image class="facebook-video basic-image" [src]="Stratus.BaseUrl + 'sitetheorymedia/images/mediaTypeIcons/media-icon-video.png'" style="background: #4e4e4e;" [alt]="contentEntity.version.title" [ngClass]="{'selected' : isSelected(contentEntity)}"></ng-container><ng-container *ngIf="!['vimeo', 'youtube', 'facebook'].includes(contentEntity.version.bestImage.service)"><img mat-card-image class="generic-video basic-image" [src]="Stratus.BaseUrl + 'sitetheorymedia/images/mediaTypeIcons/media-icon-video.png'" style="background: #4e4e4e;" [alt]="contentEntity.version.title" [ngClass]="{'selected' : isSelected(contentEntity)}"></ng-container></ng-container><ng-container *ngIf="!contentEntity.version.bestImage._thumbnailUrl
|
|
3
|
+
&& _.startsWith(contentEntity.version.bestImage.mime, 'audio')"><img mat-card-image class="generic-audio" [src]="Stratus.BaseUrl + 'sitetheorymedia/images/mediaTypeGraphics/media-graphic-audio.png'" style="background: #4e4e4e;" [alt]="contentEntity.version.title" [ngClass]="{'selected' : isSelected(contentEntity)}"></ng-container><ng-container *ngIf="!contentEntity.version.bestImage._thumbnailUrl
|
|
4
|
+
&& contentEntity.version.bestImage.mime === 'application/pdf'"><img mat-card-image class="generic-pdf basic-image" [src]="Stratus.BaseUrl + 'sitetheorymedia/images/mediaTypeGraphics/media-graphic-pdf.png'" [alt]="contentEntity.version.title" [ngClass]="{'selected' : isSelected(contentEntity)}"></ng-container><ng-container *ngIf="!contentEntity.version.bestImage._thumbnailUrl
|
|
5
|
+
&& contentEntity.version.bestImage.mime === 'application/msword'"><img mat-card-image class="generic-word basic-image" [src]="Stratus.BaseUrl + 'sitetheorymedia/images/mediaTypeGraphics/media-graphic-doc.png'" [alt]="contentEntity.version.title" [ngClass]="{'selected' : isSelected(contentEntity)}"></ng-container><ng-container *ngIf="!contentEntity.version.bestImage._thumbnailUrl
|
|
6
|
+
&& contentEntity.version.bestImage.service === 'directLink'
|
|
7
|
+
&& contentEntity.version.bestImage.file"><img mat-card-image class="direct-link" [src]="contentEntity.version.bestImage.file" [alt]="contentEntity.version.title" [ngClass]="{'selected' : isSelected(contentEntity)}"></ng-container></ng-container><mat-card-actions><button mat-button [disabled]="isSelected(contentEntity)" (click)="select(contentEntity)"><span [innerText]="isSelected(contentEntity) ? 'Selected' : 'Insert'"></span></button></mat-card-actions></mat-card></div></div><mat-paginator [length]="(!meta || !meta.pagination) ? contentEntities.length : (meta.pagination.countTotal || contentEntities.length)" [pageSize]="(!meta || !meta.pagination) ? limit : (meta.pagination.limit || limit)" [pageSizeOptions]="[5, 10, 25, 50, 100]" (page)="onPage($event)"></mat-paginator></div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
System.register(["@angular/core","@angular/forms","@angular/material/dialog","@angular/material/snack-bar","rxjs","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/backend.service","@stratusjs/angularjs/services/model","@stratusjs/angular/core/responsive.component","@angular/material/icon","@angular/platform-browser"],function(t,e){"use strict";var n,i,s,o,r,a,l,c,u,d,h,g,f,p,m,v,y,b,k=this&&this.__decorate||function(t,e,n,i){var s,o=arguments.length,r=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(o<3?s(r):o>3?s(e,n,r):s(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},$=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},I=this&&this.__param||function(t,e){return function(n,i){e(n,i,t)}};e&&e.id;return{setters:[function(t){n=t},function(t){i=t},function(t){s=t},function(t){o=t},function(t){r=t},function(t){a=t},function(t){l=t},function(t){c=t},function(t){u=t},function(t){d=t},function(t){h=t},function(t){g=t},function(t){f=t},function(t){p=t}],execute:function(){"@stratusjs/angular",m="link-dialog","editor",v=u.cookie("env")?"":".min",y=`${c.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,b=class extends g.ResponsiveComponent{constructor(t,e,n,i,s,o,r,a){super(),this.dialogRef=t,this.data=e,this.fb=n,this.backend=i,this.snackBar=s,this.iconRegistry=o,this.sanitizer=r,this.ref=a,this.title="link-dialog_component",this._=l.default,this.Stratus=c.Stratus,this.apiBase="/Api/Content",this.contentEntities=[],this.isContentLoading=!0,this.limit=20,this.eventInsert=!0,this.selected=[],this.svgIcons={}}ngOnInit(){this.uid=l.default.uniqueId(`sa_${l.default.snakeCase(m)}_component_`),c.Stratus.Instances[this.uid]=this,c.Stratus.Internals.CssLoader(`${y}editor/link-dialog.component${v}.css`),this.model=this.data.model,this.property=this.data.property,this.editor=this.data.editor,this.eventManager=this.data.eventManager,l.default.isBoolean(this.data.eventInsert)&&(this.eventInsert=this.data.eventInsert),this.dialogLinkForm=this.fb.group({linkQueryInput:""}),this.dialogLinkForm.get("linkQueryInput").valueChanges.pipe(a.debounceTime(300),a.tap(()=>{}),a.switchMap(t=>this.getQuery(t))).subscribe(t=>this.processContent(t)),this.getQuery().subscribe(t=>this.processContent(t)),this.refresh()}onCancelClick(){this.dialogRef.close(),this.refresh()}onPage(t){this.pageEvent=t,this.getQuery(this.lastContentQuery).subscribe(t=>this.processContent(t))}getQueryUrl(t){let e=this.limit,n=1;return this.pageEvent&&(e=this.pageEvent.pageSize,n=this.pageEvent.pageIndex+1),t=l.default.isString(t)&&!l.default.isEmpty(t)?`"${t}"`:"",`${this.apiBase}?limit=${e}&p=${n}&q=${t}`}getQuery(t){return this.lastContentQuery=t,this.isContentLoading=!0,this.backend.get(this.getQueryUrl(t)).pipe(a.finalize(()=>this.isContentLoading=!1))}processContent(t){if(!t.ok||200!==t.status||l.default.isEmpty(t.body))return this.meta={},this.contentEntities=[],this.refresh(),this.contentEntities;this.meta=l.default.get(t.body,"meta")||{};const e=l.default.get(t.body,"payload")||t.body;return l.default.isEmpty(e)||!Array.isArray(e)?(this.contentEntities=[],this.isContentLoading=!1,this.refresh(),this.contentEntities):(this.contentEntities=e,this.isContentLoading=!1,this.refresh(),this.contentEntities)}select(t){if(l.default.isUndefined(t))return;const e=this.createLink(t);return e?(this.selected.push(t.id),this.eventInsert?void(this.eventManager?this.eventManager.trigger("insert",e,this.editor):console.warn("link-dialog: event manager is not set.")):this.model instanceof h.Model&&l.default.isString(this.property)?(console.warn("link-dialog: disabling eventInsert is not recommended."),void this.model.set(this.property,this.model.get(this.property)+e)):void console.warn("link-dialog: event manager not available.")):(console.warn(`link-dialog: unable to build link for Content ID: ${t.id}`),void this.snackBar.open(`Unable to build link for Content ID: ${t.id}.`,"dismiss",{duration:5e3,horizontalPosition:"right",verticalPosition:"bottom"}))}isSelected(t){if(!l.default.isUndefined(t))return l.default.includes(this.selected,t.id)}createLink(t){return t?t.contentType&&t.contentType.name?t.routing&&t.routing.length&&t.routing[0]?t.routing[0].url?t.version?t.version.title&&t.version.title.length?`<a href="/${t.routing[0].url}" aria-label="${t.version.title}">${t.version.title}</a>`:(console.warn(`link-dialog: unable to find title for ${t.contentType.name} id: ${t.id}`),null):(console.warn(`link-dialog: unable to find content version for ${t.contentType.name} id: ${t.id}`),null):(console.warn(`link-dialog: unable to find url for ${t.contentType.name} id: ${t.id}`),null):(console.warn(`link-dialog: unable to find routing for ${t.contentType.name} id: ${t.id}`),null):(console.warn(`link-dialog: unable to find content type for content id: ${t.id}`),null):(console.warn("link-dialog: unable to create link for empty content"),null)}getSvg(t,e){const n=this.addSvgIcon(t,e);return new r.Observable(e=>{this.iconRegistry.getNamedSvgIcon(n).subscribe({error(e){console.error(`getSvg(${t}): ${e}`)},complete(){e.next(n)}})})}addSvgIcon(t,e){if(t in this.svgIcons)return this.svgIcons[t];e||(e={});const n=this.svgIcons[t]=l.default.uniqueId("selector_svg");return this.iconRegistry.addSvgIcon(n,this.sanitizer.bypassSecurityTrustResourceUrl(t),e),n}},b=k([n.Component({selector:"sa-link-dialog",templateUrl:`${y}/editor/link-dialog.component${v}.html`}),I(1,n.Inject(s.MAT_DIALOG_DATA)),$("design:paramtypes",[s.MatDialogRef,Object,i.FormBuilder,d.BackendService,o.MatSnackBar,f.MatIconRegistry,p.DomSanitizer,n.ChangeDetectorRef])],b),t("LinkDialogComponent",b)}}});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.link {
|
|
2
|
+
&-dialog {
|
|
3
|
+
&-content {
|
|
4
|
+
.radio {
|
|
5
|
+
&-group {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
margin: 15px 0;
|
|
9
|
+
}
|
|
10
|
+
&-button {
|
|
11
|
+
margin: 5px;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
img.selected {
|
|
15
|
+
opacity: 0.5;
|
|
16
|
+
}
|
|
17
|
+
.link-card {
|
|
18
|
+
max-width: 400px;
|
|
19
|
+
}
|
|
20
|
+
.link-header-image {
|
|
21
|
+
//background-image: url('');
|
|
22
|
+
background-size: cover;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|