@stratusjs/angular 0.9.3 → 0.10.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/dist/angular.bundle.js +237 -222
- package/dist/angular.bundle.min.js +1 -1
- package/package.json +3 -3
- package/src/selector/selector.component.html +15 -15
- package/src/selector/selector.component.js +27 -24
- package/src/selector/selector.component.js.map +1 -1
- package/src/selector/selector.component.min.html +1 -1
- package/src/selector/selector.component.min.js +1 -1
- package/src/selector/selector.component.ts +41 -28
- package/src/tree/tree-dialog.component.html +2 -2
- package/src/tree/tree-dialog.component.js +31 -22
- package/src/tree/tree-dialog.component.js.map +1 -1
- package/src/tree/tree-dialog.component.min.html +1 -1
- package/src/tree/tree-dialog.component.min.js +1 -1
- package/src/tree/tree-dialog.component.ts +48 -25
- package/src/tree/tree-node.component.js +19 -19
- package/src/tree/tree-node.component.js.map +1 -1
- package/src/tree/tree-node.component.min.js +1 -1
- package/src/tree/tree-node.component.ts +28 -20
- package/src/tree/tree.component.js +27 -28
- package/src/tree/tree.component.js.map +1 -1
- package/src/tree/tree.component.min.js +1 -1
- package/src/tree/tree.component.ts +45 -33
|
@@ -27,11 +27,20 @@ import {
|
|
|
27
27
|
import {DomSanitizer} from '@angular/platform-browser'
|
|
28
28
|
import {IconOptions, MatIconRegistry} from '@angular/material/icon'
|
|
29
29
|
|
|
30
|
-
// RXJS
|
|
31
|
-
|
|
32
30
|
// External Dependencies
|
|
33
31
|
import {Stratus} from '@stratusjs/runtime/stratus'
|
|
34
|
-
import
|
|
32
|
+
import {
|
|
33
|
+
forEach,
|
|
34
|
+
get,
|
|
35
|
+
has,
|
|
36
|
+
head,
|
|
37
|
+
isArray,
|
|
38
|
+
isEmpty,
|
|
39
|
+
isObject,
|
|
40
|
+
isUndefined,
|
|
41
|
+
snakeCase,
|
|
42
|
+
uniqueId
|
|
43
|
+
} from 'lodash'
|
|
35
44
|
import {keys} from 'ts-transformer-keys'
|
|
36
45
|
import {cookie} from '@stratusjs/core/environment'
|
|
37
46
|
|
|
@@ -61,7 +70,7 @@ const min = !cookie('env') ? '.min' : ''
|
|
|
61
70
|
const localDir = `${Stratus.BaseUrl}${boot.configuration.paths[`${systemDir}/*`].replace(/[^/]*$/, '').replace(/\/dist\/$/, '/src/')}`
|
|
62
71
|
|
|
63
72
|
// Utility Functions
|
|
64
|
-
const
|
|
73
|
+
const hasNotEmpty = (object: object, path: string) => has(object, path) && !isEmpty(get(object, path))
|
|
65
74
|
|
|
66
75
|
// export interface Model {
|
|
67
76
|
// completed: boolean;
|
|
@@ -106,8 +115,8 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
106
115
|
@Input() ignorePriority: boolean
|
|
107
116
|
|
|
108
117
|
// Dependencies
|
|
109
|
-
|
|
110
|
-
has =
|
|
118
|
+
get = get
|
|
119
|
+
has = hasNotEmpty
|
|
111
120
|
log = console.log
|
|
112
121
|
Stratus = Stratus
|
|
113
122
|
|
|
@@ -151,14 +160,14 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
151
160
|
super()
|
|
152
161
|
|
|
153
162
|
// Initialization
|
|
154
|
-
this.uid =
|
|
163
|
+
this.uid = uniqueId(`sa_${snakeCase(moduleName)}_component_`)
|
|
155
164
|
Stratus.Instances[this.uid] = this
|
|
156
165
|
|
|
157
166
|
// Declare Observable with Subscriber (Only Happens Once)
|
|
158
167
|
this.dataSub = new Observable(subscriber => this.dataDefer(subscriber))
|
|
159
168
|
|
|
160
169
|
// SVG Icons
|
|
161
|
-
|
|
170
|
+
forEach({
|
|
162
171
|
selector_delete: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/delete.svg`,
|
|
163
172
|
selector_status: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/visibility.svg`,
|
|
164
173
|
selector_edit: `${Stratus.BaseUrl}sitetheorycore/images/icons/actionButtons/edit.svg`
|
|
@@ -169,13 +178,13 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
169
178
|
Stratus.Internals.CssLoader(`${localDir}${moduleName}/${moduleName}.component${min}.css`)
|
|
170
179
|
.then(() => {
|
|
171
180
|
this.styled = true
|
|
172
|
-
this.refresh()
|
|
181
|
+
this.refresh().then()
|
|
173
182
|
})
|
|
174
183
|
.catch((err: any) => {
|
|
175
184
|
console.warn('Issue detected in CSS Loader for Component:', this)
|
|
176
185
|
console.error(err)
|
|
177
186
|
this.styled = true
|
|
178
|
-
this.refresh()
|
|
187
|
+
this.refresh().then()
|
|
179
188
|
})
|
|
180
189
|
|
|
181
190
|
// Hydrate Root App Inputs
|
|
@@ -197,7 +206,7 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
197
206
|
// this.onDataChange();
|
|
198
207
|
this.dataDefer(this.subscriber)
|
|
199
208
|
this.prioritize()
|
|
200
|
-
this.refresh()
|
|
209
|
+
this.refresh().then()
|
|
201
210
|
}
|
|
202
211
|
data.on('change', onDataChange)
|
|
203
212
|
onDataChange()
|
|
@@ -246,7 +255,7 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
246
255
|
moveItemInArray(models, event.previousIndex, event.currentIndex)
|
|
247
256
|
if (!this.ignorePriority) {
|
|
248
257
|
let priority = 0
|
|
249
|
-
|
|
258
|
+
forEach(models, (model: any) => model.priority = priority++)
|
|
250
259
|
}
|
|
251
260
|
this.model.trigger('change')
|
|
252
261
|
}
|
|
@@ -263,6 +272,10 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
263
272
|
// model is not directly a model, but just a sub entity of content.version.modules
|
|
264
273
|
// so we have to create a special API call to update just this one model
|
|
265
274
|
// 'Content/' + model.id
|
|
275
|
+
let meta = {}
|
|
276
|
+
if (!isUndefined(this.data)) {
|
|
277
|
+
meta = get(this.data, 'meta.data.api')
|
|
278
|
+
}
|
|
266
279
|
const statusOriginal = model.status
|
|
267
280
|
model.status = statusOriginal === 1 ? 0 : 1
|
|
268
281
|
// Create a direct XHR
|
|
@@ -271,7 +284,7 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
271
284
|
url: '/Api/Content/' + model.id,
|
|
272
285
|
data: {
|
|
273
286
|
route: {},
|
|
274
|
-
meta
|
|
287
|
+
meta,
|
|
275
288
|
payload: {
|
|
276
289
|
status: model.status
|
|
277
290
|
}
|
|
@@ -280,18 +293,18 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
280
293
|
})
|
|
281
294
|
xhr.send()
|
|
282
295
|
.then((response: LooseObject | Array<LooseObject> | string) => {
|
|
283
|
-
if (!
|
|
296
|
+
if (!isObject(response) || get(response, 'meta.status[0].code') !== 'SUCCESS') {
|
|
284
297
|
console.error('error[toggleStatus]:', response)
|
|
285
298
|
model.status = statusOriginal
|
|
286
|
-
this.refresh()
|
|
299
|
+
this.refresh().then()
|
|
287
300
|
return
|
|
288
301
|
}
|
|
289
|
-
console.log('success[toggleStatus]:', response)
|
|
302
|
+
// console.log('success[toggleStatus]:', response)
|
|
290
303
|
})
|
|
291
304
|
.catch((error: any) => {
|
|
292
305
|
console.error('error[toggleStatus]:', error)
|
|
293
306
|
model.status = statusOriginal
|
|
294
|
-
this.refresh()
|
|
307
|
+
this.refresh().then()
|
|
295
308
|
})
|
|
296
309
|
return
|
|
297
310
|
}
|
|
@@ -301,7 +314,7 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
301
314
|
if (!models || !models.length) {
|
|
302
315
|
console.error('unable to remove model from selection:', models)
|
|
303
316
|
// Still refresh if empty
|
|
304
|
-
this.refresh()
|
|
317
|
+
this.refresh().then()
|
|
305
318
|
return
|
|
306
319
|
}
|
|
307
320
|
let index: number = models.indexOf(model)
|
|
@@ -310,9 +323,9 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
310
323
|
const mirrorModels = models
|
|
311
324
|
.map((m: any) => model.id === m.id ? m : null)
|
|
312
325
|
.filter((m: any) => m)
|
|
313
|
-
if (
|
|
326
|
+
if (isArray(mirrorModels) && mirrorModels.length) {
|
|
314
327
|
index = models.indexOf(
|
|
315
|
-
|
|
328
|
+
head(mirrorModels)
|
|
316
329
|
)
|
|
317
330
|
}
|
|
318
331
|
}
|
|
@@ -365,7 +378,7 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
365
378
|
console.log('pushed models to subscriber:', models)
|
|
366
379
|
}
|
|
367
380
|
/* */
|
|
368
|
-
this.refresh()
|
|
381
|
+
this.refresh().then()
|
|
369
382
|
// TODO: Add a returned Promise to ensure async/await can use this defer directly.
|
|
370
383
|
}
|
|
371
384
|
|
|
@@ -374,7 +387,7 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
374
387
|
return []
|
|
375
388
|
}
|
|
376
389
|
const models = this.model.get(this.property)
|
|
377
|
-
if (!models || !
|
|
390
|
+
if (!models || !isArray(models)) {
|
|
378
391
|
return []
|
|
379
392
|
}
|
|
380
393
|
return models
|
|
@@ -422,7 +435,7 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
422
435
|
// FIXME: This is not in use due to contextual issues.
|
|
423
436
|
this.prioritize()
|
|
424
437
|
this.dataDefer(this.subscriber)
|
|
425
|
-
this.refresh()
|
|
438
|
+
this.refresh().then()
|
|
426
439
|
}
|
|
427
440
|
|
|
428
441
|
prioritize() {
|
|
@@ -432,7 +445,7 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
432
445
|
}
|
|
433
446
|
if (!this.ignorePriority) {
|
|
434
447
|
let priority = 0
|
|
435
|
-
|
|
448
|
+
forEach(models, (model) => model.priority = priority++)
|
|
436
449
|
}
|
|
437
450
|
}
|
|
438
451
|
|
|
@@ -469,20 +482,20 @@ export class SelectorComponent extends RootComponent { // implements OnInit, OnC
|
|
|
469
482
|
if (!options) {
|
|
470
483
|
options = {}
|
|
471
484
|
}
|
|
472
|
-
const uid = this.svgIcons[url] =
|
|
485
|
+
const uid = this.svgIcons[url] = uniqueId('selector_svg')
|
|
473
486
|
this.iconRegistry.addSvgIcon(uid, this.sanitizer.bypassSecurityTrustResourceUrl(url), options)
|
|
474
487
|
return uid
|
|
475
488
|
}
|
|
476
489
|
|
|
477
490
|
// findImage(model: any): string {
|
|
478
|
-
// const mime =
|
|
491
|
+
// const mime = get(model, 'version.images[0].mime');
|
|
479
492
|
// if (mime === undefined) {
|
|
480
493
|
// return '';
|
|
481
494
|
// }
|
|
482
495
|
// if (mime.indexOf('image') !== -1) {
|
|
483
|
-
// return
|
|
496
|
+
// return get(model, 'version.images[0].src') || get(model, 'version.shellImages[0].src') || '';
|
|
484
497
|
// } else if (mime.indexOf('video') !== -1) {
|
|
485
|
-
// return
|
|
498
|
+
// return get(model, 'version.images[0].meta.thumbnail_small') || '';
|
|
486
499
|
// }
|
|
487
500
|
// return '';
|
|
488
501
|
// }
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
|
|
95
95
|
<!-- Content Type Icon -->
|
|
96
96
|
<mat-icon aria-hidden="true"
|
|
97
|
-
*ngIf="
|
|
98
|
-
[svgIcon]="getSvg(Stratus.BaseUrl +
|
|
97
|
+
*ngIf="get(model, 'contentType.iconResourcePath')"
|
|
98
|
+
[svgIcon]="getSvg(Stratus.BaseUrl + get(model, 'contentType.iconResourcePath')) | async">
|
|
99
99
|
Icon
|
|
100
100
|
</mat-icon>
|
|
101
101
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@angular/material/dialog", "rxjs/operators", "lodash", "@stratusjs/runtime/stratus", "@stratusjs/core/environment", "../core/responsive.component"], function (exports_1, context_1) {
|
|
1
|
+
System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@angular/material/dialog", "rxjs/operators", "lodash", "@stratusjs/runtime/stratus", "@stratusjs/core/environment", "../core/responsive.component", "@stratusjs/core/misc"], function (exports_1, context_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4
4
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -12,7 +12,7 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
12
12
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
13
13
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
14
14
|
};
|
|
15
|
-
var core_1, forms_1, drag_drop_1, dialog_1, operators_1, lodash_1, stratus_1, environment_1, responsive_component_1, systemDir, moduleName, parentModuleName, min, localDir, TreeDialogComponent;
|
|
15
|
+
var core_1, forms_1, drag_drop_1, dialog_1, operators_1, lodash_1, stratus_1, environment_1, responsive_component_1, misc_1, systemDir, moduleName, parentModuleName, min, localDir, TreeDialogComponent;
|
|
16
16
|
var __moduleName = context_1 && context_1.id;
|
|
17
17
|
return {
|
|
18
18
|
setters: [
|
|
@@ -42,6 +42,9 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
42
42
|
},
|
|
43
43
|
function (responsive_component_1_1) {
|
|
44
44
|
responsive_component_1 = responsive_component_1_1;
|
|
45
|
+
},
|
|
46
|
+
function (misc_1_1) {
|
|
47
|
+
misc_1 = misc_1_1;
|
|
45
48
|
}
|
|
46
49
|
],
|
|
47
50
|
execute: function () {
|
|
@@ -61,17 +64,22 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
61
64
|
this.isInitialized = false;
|
|
62
65
|
this.isDestroyed = false;
|
|
63
66
|
this.isStyled = false;
|
|
64
|
-
this.
|
|
67
|
+
this.get = lodash_1.get;
|
|
65
68
|
this.Stratus = stratus_1.Stratus;
|
|
66
69
|
this.apiBase = '/Api/Content';
|
|
67
70
|
this.isSingleContentLoading = false;
|
|
68
71
|
this.limit = 20;
|
|
69
72
|
this.isContentLoading = false;
|
|
70
73
|
this.isContentLoaded = false;
|
|
71
|
-
this.
|
|
74
|
+
this.basicContentQueryAttributesObject = {
|
|
75
|
+
isContent: true,
|
|
76
|
+
isCollection: null,
|
|
77
|
+
showRoutable: true,
|
|
78
|
+
showRouting: true
|
|
79
|
+
};
|
|
72
80
|
}
|
|
73
81
|
ngOnInit() {
|
|
74
|
-
this.uid = lodash_1.
|
|
82
|
+
this.uid = lodash_1.uniqueId(`sa_${lodash_1.snakeCase(moduleName)}_component_`);
|
|
75
83
|
stratus_1.Stratus.Instances[this.uid] = this;
|
|
76
84
|
stratus_1.Stratus.Internals.CssLoader(`${localDir}/${parentModuleName}/${moduleName}.component${min}.css`)
|
|
77
85
|
.then(() => {
|
|
@@ -94,7 +102,7 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
94
102
|
.get('contentSelectorInput')
|
|
95
103
|
.valueChanges
|
|
96
104
|
.pipe(operators_1.debounceTime(300), operators_1.tap(() => this.isContentLoading = true), operators_1.switchMap((value) => {
|
|
97
|
-
if (lodash_1.
|
|
105
|
+
if (lodash_1.isString(value)) {
|
|
98
106
|
this.lastContentSelectorQuery = this.getQueryUrl(value);
|
|
99
107
|
}
|
|
100
108
|
else {
|
|
@@ -118,11 +126,11 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
118
126
|
.get(this.getQueryUrl(null, this.data.content.id))
|
|
119
127
|
.pipe(operators_1.finalize(() => this.isSingleContentLoading = false))
|
|
120
128
|
.subscribe((response) => {
|
|
121
|
-
if (!response.ok || response.status !== 200 || lodash_1.
|
|
129
|
+
if (!response.ok || response.status !== 200 || lodash_1.isEmpty(response.body)) {
|
|
122
130
|
return null;
|
|
123
131
|
}
|
|
124
|
-
const payload = lodash_1.
|
|
125
|
-
if (lodash_1.
|
|
132
|
+
const payload = lodash_1.get(response.body, 'payload') || response.body;
|
|
133
|
+
if (lodash_1.isEmpty(payload) || Array.isArray(payload) || !lodash_1.isObject(payload)) {
|
|
126
134
|
return null;
|
|
127
135
|
}
|
|
128
136
|
this.contentEntity = payload;
|
|
@@ -130,7 +138,7 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
130
138
|
this.dialogContentForm
|
|
131
139
|
.get('contentSelectorInput')
|
|
132
140
|
.patchValue(this.contentEntity);
|
|
133
|
-
this.refresh();
|
|
141
|
+
this.refresh().then();
|
|
134
142
|
return this.contentEntity;
|
|
135
143
|
});
|
|
136
144
|
}
|
|
@@ -155,19 +163,19 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
155
163
|
if (!content) {
|
|
156
164
|
return;
|
|
157
165
|
}
|
|
158
|
-
const routing = lodash_1.
|
|
159
|
-
const routingText = !lodash_1.
|
|
160
|
-
const contentId = lodash_1.
|
|
161
|
-
const contentIdText = !lodash_1.
|
|
162
|
-
return (lodash_1.
|
|
166
|
+
const routing = lodash_1.get(content, 'routing[0].url');
|
|
167
|
+
const routingText = !lodash_1.isUndefined(routing) ? ` (/${routing})` : ' (No route!)';
|
|
168
|
+
const contentId = lodash_1.get(content, 'id');
|
|
169
|
+
const contentIdText = !lodash_1.isUndefined(contentId) ? `Content: ${contentId}` : null;
|
|
170
|
+
return (lodash_1.get(content, 'version.title') || contentIdText) + routingText;
|
|
163
171
|
}
|
|
164
172
|
handleContent(response) {
|
|
165
|
-
if (!response.ok || response.status !== 200 || lodash_1.
|
|
173
|
+
if (!response.ok || response.status !== 200 || lodash_1.isEmpty(response.body)) {
|
|
166
174
|
this.filteredContent = [];
|
|
167
175
|
return this.filteredContent;
|
|
168
176
|
}
|
|
169
|
-
const payload = lodash_1.
|
|
170
|
-
if (lodash_1.
|
|
177
|
+
const payload = lodash_1.get(response.body, 'payload') || response.body;
|
|
178
|
+
if (lodash_1.isEmpty(payload) || !Array.isArray(payload)) {
|
|
171
179
|
this.filteredContent = [];
|
|
172
180
|
return this.filteredContent;
|
|
173
181
|
}
|
|
@@ -200,9 +208,10 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
200
208
|
return this.tree.getSvg(url, options);
|
|
201
209
|
}
|
|
202
210
|
getQueryUrl(query, id) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
211
|
+
const fullApiOptions = { options: lodash_1.assignIn(this.basicContentQueryAttributesObject, this.data.api) };
|
|
212
|
+
query = (!lodash_1.isString(query) || lodash_1.isEmpty(query)) ? '' : query;
|
|
213
|
+
id = !lodash_1.isString(id) && !lodash_1.isNumber(id) ? '' : `/${id}`;
|
|
214
|
+
return `${this.apiBase}${id}?limit=${this.limit}&${misc_1.serializeUrlParams(fullApiOptions)}&q=${query}`;
|
|
206
215
|
}
|
|
207
216
|
selectedOnTop(list, selected) {
|
|
208
217
|
if (!list || !list.length) {
|
|
@@ -211,7 +220,7 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
211
220
|
if (!selected || !selected.id) {
|
|
212
221
|
return list;
|
|
213
222
|
}
|
|
214
|
-
const orderedList = lodash_1.
|
|
223
|
+
const orderedList = lodash_1.clone(list);
|
|
215
224
|
const index = list.findIndex((v) => v.id === selected.id);
|
|
216
225
|
if (index === -1) {
|
|
217
226
|
orderedList.unshift(selected);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tree-dialog.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["tree-dialog.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuGM,SAAS,GAAG,oBAAoB,CAAA;YAChC,UAAU,GAAG,aAAa,CAAA;YAC1B,gBAAgB,GAAG,MAAM,CAAA;YAGzB,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,a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E,UAAU,IAAI,CAAC,KAAK,IAAI,yBAAkB,CAAC,cAAc,CAAC,MAAM,KAAK,EAAE,CAAA;gBACtG,CAAC;gBAED,aAAa,CAAC,IAA2B,EAAE,QAAwB;oBAC/D,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;wBACvB,OAAO,IAAI,CAAA;qBACd;oBACD,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;wBAC3B,OAAO,IAAI,CAAA;qBACd;oBACD,MAAM,WAAW,GAAG,cAAK,CAAC,IAAI,CAAC,CAAA;oBAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAA;oBACzD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;wBAEd,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;wBAC7B,OAAO,WAAW,CAAA;qBACrB;oBACD,2BAAe,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;oBACtC,OAAO,WAAW,CAAA;gBACtB,CAAC;aACJ,CAAA;YA/VY,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;gBA6DO,WAAA,aAAM,CAAC,wBAAe,CAAC,CAAA;iDADN,qBAAY,UAElB,mBAAW;oBAER,wBAAiB;eA/D3B,mBAAmB,CA+V/B;;QACD,CAAC","file":"tree-dialog.component.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<h1 mat-dialog-title>Menu Link Editor</h1><div class="tree-dialog-content" *ngIf="isInitialized" mat-dialog-content><mat-form-field class="form-field"><input #nameInput matInput type="text" placeholder="Name" [(ngModel)]="data.name"></mat-form-field><h4><label id="link-type-label">Link Type:</label></h4><mat-radio-group class="radio-group" aria-labelledby="link-type-label" [(ngModel)]="data.target"><mat-radio-button class="radio-button" value="content">Website Page</mat-radio-button><mat-radio-button class="radio-button" value="url">Custom Link</mat-radio-button></mat-radio-group><form class="dialog-form" [formGroup]="dialogContentForm"><ng-container *ngIf="data.target == 'content'"><mat-form-field class="form-field"><input matInput placeholder="Link Content" aria-label="Link Content" [matAutocomplete]="auto" formControlName="contentSelectorInput"></mat-form-field><mat-autocomplete autoActiveFirstOption #auto="matAutocomplete" [displayWith]="displayContentText"><mat-option *ngIf="isContentLoading" class="is-loading"><mat-progress-bar mode="indeterminate"></mat-progress-bar></mat-option><ng-container *ngIf="!isContentLoading"><mat-option *ngFor="let model of filteredContent" [value]="model"><mat-icon aria-hidden="true" *ngIf="
|
|
1
|
+
<h1 mat-dialog-title>Menu Link Editor</h1><div class="tree-dialog-content" *ngIf="isInitialized" mat-dialog-content><mat-form-field class="form-field"><input #nameInput matInput type="text" placeholder="Name" [(ngModel)]="data.name"></mat-form-field><h4><label id="link-type-label">Link Type:</label></h4><mat-radio-group class="radio-group" aria-labelledby="link-type-label" [(ngModel)]="data.target"><mat-radio-button class="radio-button" value="content">Website Page</mat-radio-button><mat-radio-button class="radio-button" value="url">Custom Link</mat-radio-button></mat-radio-group><form class="dialog-form" [formGroup]="dialogContentForm"><ng-container *ngIf="data.target == 'content'"><mat-form-field class="form-field"><input matInput placeholder="Link Content" aria-label="Link Content" [matAutocomplete]="auto" formControlName="contentSelectorInput"></mat-form-field><mat-autocomplete autoActiveFirstOption #auto="matAutocomplete" [displayWith]="displayContentText"><mat-option *ngIf="isContentLoading" class="is-loading"><mat-progress-bar mode="indeterminate"></mat-progress-bar></mat-option><ng-container *ngIf="!isContentLoading"><mat-option *ngFor="let model of filteredContent" [value]="model"><mat-icon aria-hidden="true" *ngIf="get(model, 'contentType.iconResourcePath')" [svgIcon]="getSvg(Stratus.BaseUrl + get(model, 'contentType.iconResourcePath')) | async">Icon</mat-icon>{{(model && model.version) ? model.version.title : 'Untitled'}} <small *ngIf="model.routing && model.routing.length">{{'/' + model.routing[0].url}}</small></mat-option></ng-container></mat-autocomplete></ng-container></form><mat-form-field class="form-field" [style.width.px]="320" *ngIf="data.target == 'url'"><input matInput type="text" placeholder="URL" [(ngModel)]="data.url"> <a mat-button *ngIf="data.url" matSuffix mat-icon-button aria-label="Clear" (click)="data.url=''"><mat-icon>close</mat-icon></a></mat-form-field><mat-checkbox [(ngModel)]="browserTarget" (change)="onBrowserTargetChange($event)">Open in new window</mat-checkbox><h4>Actions:</h4><a mat-button class="svg-grey" (click)="destroy()"><mat-icon svgIcon="tree_delete" aria-hidden="false" aria-label="Delete Item">Delete</mat-icon></a><a mat-button class="svg-grey" [class.visibility-off]="data.model.get('status') === 0" (click)="toggleStatus()"><mat-icon svgIcon="tree_visibility" aria-hidden="false" aria-label="Toggle Visibility">Visibility</mat-icon></a><a mat-button class="svg-grey" [disabled]="!data.id" (click)="addChild()"><mat-icon svgIcon="tree_add" aria-hidden="false" aria-label="Add Child">Add Child</mat-icon></a><mat-divider></mat-divider></div><div mat-dialog-actions><a mat-button (click)="onCancelClick()">Cancel </a><a mat-button [mat-dialog-close]="data" cdkFocusInitial>Ok</a></div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["@angular/core","@angular/forms","@angular/cdk/drag-drop","@angular/material/dialog","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","../core/responsive.component"],function(t,e){"use strict";var n,i,s,o,r,a,l,d,
|
|
1
|
+
System.register(["@angular/core","@angular/forms","@angular/cdk/drag-drop","@angular/material/dialog","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","../core/responsive.component","@stratusjs/core/misc"],function(t,e){"use strict";var n,i,s,o,r,a,l,d,h,c,u,g,f,p,y,C=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},b=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},m=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){d=t},function(t){h=t},function(t){c=t}],execute:function(){"@stratusjs/angular",u="tree-dialog",g="tree",f=d.cookie("env")?"":".min",p=`${l.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"").replace(/\/dist\/$/,"/src/")}`,y=class extends h.ResponsiveComponent{constructor(t,e,n,i){super(),this.dialogRef=t,this.data=e,this.fb=n,this.ref=i,this.title=u+"_component",this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1,this.get=a.get,this.Stratus=l.Stratus,this.apiBase="/Api/Content",this.isSingleContentLoading=!1,this.limit=20,this.isContentLoading=!1,this.isContentLoaded=!1,this.basicContentQueryAttributesObject={isContent:!0,isCollection:null,showRoutable:!0,showRouting:!0}}ngOnInit(){this.uid=a.uniqueId(`sa_${a.snakeCase(u)}_component_`),l.Stratus.Instances[this.uid]=this,l.Stratus.Internals.CssLoader(`${p}/${g}/${u}.component${f}.css`).then(()=>{this.isStyled=!0}).catch(t=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(t),this.isStyled=!0}),this.tree=this.data.tree,this.treeNode=this.data.treeNode,this.browserTarget=null!==this.data.browserTarget,this.backend=this.data.backend,this.iconRegistry=this.data.iconRegistry,this.dialogContentForm=this.fb.group({contentSelectorInput:this.data.content||null}),this.dialogContentForm.get("contentSelectorInput").valueChanges.pipe(r.debounceTime(300),r.tap(()=>this.isContentLoading=!0),r.switchMap(t=>(a.isString(t)?this.lastContentSelectorQuery=this.getQueryUrl(t):(this.data.content=t,this.data.url=null),this.backend.get(this.lastContentSelectorQuery||this.getQueryUrl()).pipe(r.finalize(()=>{this.isContentLoading=!1,this.isContentLoaded=!0}))))).subscribe(t=>this.handleContent(t)),this.backend.get(this.getQueryUrl()).pipe(r.finalize(()=>this.isContentLoading=!1)).subscribe(t=>this.handleContent(t)),this.data.content&&this.data.content.id&&(this.isSingleContentLoading=!0,this.backend.get(this.getQueryUrl(null,this.data.content.id)).pipe(r.finalize(()=>this.isSingleContentLoading=!1)).subscribe(t=>{if(!t.ok||200!==t.status||a.isEmpty(t.body))return null;const e=a.get(t.body,"payload")||t.body;return a.isEmpty(e)||Array.isArray(e)||!a.isObject(e)?null:(this.contentEntity=e,this.isSingleContentLoading=!1,this.dialogContentForm.get("contentSelectorInput").patchValue(this.contentEntity),this.refresh().then(),this.contentEntity)})),this.isInitialized=!0}ngOnDestroy(){this.isDestroyed=!0}refresh(){return this.isDestroyed?new Promise(t=>t()):super.refresh()}onCancelClick(){this.dialogRef.close()}onBrowserTargetChange(t){this.data.browserTarget=t.checked?"_blank":null}displayContentText(t){if(!t)return;const e=a.get(t,"routing[0].url"),n=a.isUndefined(e)?" (No route!)":` (/${e})`,i=a.get(t,"id"),s=a.isUndefined(i)?null:`Content: ${i}`;return(a.get(t,"version.title")||s)+n}handleContent(t){if(!t.ok||200!==t.status||a.isEmpty(t.body))return this.filteredContent=[],this.filteredContent;const e=a.get(t.body,"payload")||t.body;return a.isEmpty(e)||!Array.isArray(e)?(this.filteredContent=[],this.filteredContent):(this.filteredContent=e,this.filteredContent)}destroy(){this.treeNode.destroy().afterClosed().subscribe(t=>{t&&this.onCancelClick()})}toggleStatus(){this.treeNode.toggleStatus()}addChild(){this.treeNode.addChild()}isSelected(t){return!!this.data.content&&this.data.content.id===t.id}getSvg(t,e){return this.tree.getSvg(t,e)}getQueryUrl(t,e){const n={options:a.assignIn(this.basicContentQueryAttributesObject,this.data.api)};return t=!a.isString(t)||a.isEmpty(t)?"":t,e=a.isString(e)||a.isNumber(e)?`/${e}`:"",`${this.apiBase}${e}?limit=${this.limit}&${c.serializeUrlParams(n)}&q=${t}`}selectedOnTop(t,e){if(!t||!t.length)return t;if(!e||!e.id)return t;const n=a.clone(t),i=t.findIndex(t=>t.id===e.id);return-1===i?(n.unshift(e),n):(s.moveItemInArray(n,i,0),n)}},y=C([n.Component({selector:`sa-${u}`,templateUrl:`${p}/${g}/${u}.component${f}.html`}),m(1,n.Inject(o.MAT_DIALOG_DATA)),b("design:paramtypes",[o.MatDialogRef,Object,i.FormBuilder,n.ChangeDetectorRef])],y),t("TreeDialogComponent",y)}}});
|
|
@@ -39,7 +39,18 @@ import {
|
|
|
39
39
|
} from 'rxjs/operators'
|
|
40
40
|
|
|
41
41
|
// External
|
|
42
|
-
import
|
|
42
|
+
import {
|
|
43
|
+
assignIn,
|
|
44
|
+
clone,
|
|
45
|
+
get,
|
|
46
|
+
isEmpty,
|
|
47
|
+
isObject,
|
|
48
|
+
isNumber,
|
|
49
|
+
isString,
|
|
50
|
+
isUndefined,
|
|
51
|
+
snakeCase,
|
|
52
|
+
uniqueId
|
|
53
|
+
} from 'lodash'
|
|
43
54
|
import {Stratus} from '@stratusjs/runtime/stratus'
|
|
44
55
|
import {cookie} from '@stratusjs/core/environment'
|
|
45
56
|
|
|
@@ -67,6 +78,7 @@ import {
|
|
|
67
78
|
import {
|
|
68
79
|
ResponsiveComponent
|
|
69
80
|
} from '../core/responsive.component'
|
|
81
|
+
import {serializeUrlParams} from '@stratusjs/core/misc'
|
|
70
82
|
|
|
71
83
|
// Data Types
|
|
72
84
|
export interface DialogData {
|
|
@@ -80,6 +92,7 @@ export interface DialogData {
|
|
|
80
92
|
level: string
|
|
81
93
|
content: any
|
|
82
94
|
url: string
|
|
95
|
+
api: object
|
|
83
96
|
model: Model
|
|
84
97
|
collection: Collection
|
|
85
98
|
parent: any
|
|
@@ -116,7 +129,8 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
116
129
|
isStyled = false
|
|
117
130
|
|
|
118
131
|
// Dependencies
|
|
119
|
-
_ = _
|
|
132
|
+
// _ = _
|
|
133
|
+
get = get
|
|
120
134
|
Stratus = Stratus
|
|
121
135
|
|
|
122
136
|
// Root Component
|
|
@@ -142,7 +156,15 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
142
156
|
isContentLoading = false
|
|
143
157
|
isContentLoaded = false
|
|
144
158
|
lastContentSelectorQuery: string
|
|
159
|
+
/*
|
|
145
160
|
basicContentQueryAttributes = 'options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true'
|
|
161
|
+
*/
|
|
162
|
+
basicContentQueryAttributesObject: LooseObject = {
|
|
163
|
+
isContent:true,
|
|
164
|
+
isCollection: null,
|
|
165
|
+
showRoutable: true,
|
|
166
|
+
showRouting: true
|
|
167
|
+
}
|
|
146
168
|
contentEntity: ContentEntity
|
|
147
169
|
|
|
148
170
|
// Normalized Data
|
|
@@ -170,7 +192,7 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
170
192
|
// TODO: Consider making the Custom Link field the default
|
|
171
193
|
ngOnInit() {
|
|
172
194
|
// Initialization
|
|
173
|
-
this.uid =
|
|
195
|
+
this.uid = uniqueId(`sa_${snakeCase(moduleName)}_component_`)
|
|
174
196
|
Stratus.Instances[this.uid] = this
|
|
175
197
|
|
|
176
198
|
// TODO: Assess & Possibly Remove when the System.js ecosystem is complete
|
|
@@ -218,7 +240,7 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
218
240
|
debounceTime(300),
|
|
219
241
|
tap(() => this.isContentLoading = true),
|
|
220
242
|
switchMap((value: any) => {
|
|
221
|
-
if (
|
|
243
|
+
if (isString(value)) {
|
|
222
244
|
this.lastContentSelectorQuery = this.getQueryUrl(value)
|
|
223
245
|
} else {
|
|
224
246
|
// console.log('switchMap value is not a string:', value)
|
|
@@ -264,11 +286,11 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
264
286
|
finalize(() => this.isSingleContentLoading = false),
|
|
265
287
|
)
|
|
266
288
|
.subscribe((response: HttpResponse<Convoy<ContentEntity>>) => {
|
|
267
|
-
if (!response.ok || response.status !== 200 ||
|
|
289
|
+
if (!response.ok || response.status !== 200 || isEmpty(response.body)) {
|
|
268
290
|
return null
|
|
269
291
|
}
|
|
270
|
-
const payload =
|
|
271
|
-
if (
|
|
292
|
+
const payload = get(response.body, 'payload') || response.body
|
|
293
|
+
if (isEmpty(payload) || Array.isArray(payload) || !isObject(payload)) {
|
|
272
294
|
return null
|
|
273
295
|
}
|
|
274
296
|
// @ts-ignore
|
|
@@ -277,7 +299,7 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
277
299
|
this.dialogContentForm
|
|
278
300
|
.get('contentSelectorInput')
|
|
279
301
|
.patchValue(this.contentEntity)
|
|
280
|
-
this.refresh()
|
|
302
|
+
this.refresh().then()
|
|
281
303
|
return this.contentEntity
|
|
282
304
|
})
|
|
283
305
|
}
|
|
@@ -294,7 +316,7 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
294
316
|
// debounceTime(300),
|
|
295
317
|
// tap(() => this.isParentLoading = true),
|
|
296
318
|
// switchMap(value => {
|
|
297
|
-
// if (
|
|
319
|
+
// if (isString(value)) {
|
|
298
320
|
// this.lastParentSelectorQuery = `/Api/MenuLink?q=${value}`
|
|
299
321
|
// } else {
|
|
300
322
|
// this.data.nestParent = value
|
|
@@ -307,11 +329,11 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
307
329
|
// )
|
|
308
330
|
// )
|
|
309
331
|
// .subscribe(response => {
|
|
310
|
-
// if (!response.ok || response.status !== 200 ||
|
|
332
|
+
// if (!response.ok || response.status !== 200 || isEmpty(response.body)) {
|
|
311
333
|
// return this.filteredParentOptions = []
|
|
312
334
|
// }
|
|
313
|
-
// const payload =
|
|
314
|
-
// if (
|
|
335
|
+
// const payload = get(response.body, 'payload') || response.body
|
|
336
|
+
// if (isEmpty(payload) || !Array.isArray(payload)) {
|
|
315
337
|
// return this.filteredParentOptions = []
|
|
316
338
|
// }
|
|
317
339
|
// return this.filteredParentOptions = payload
|
|
@@ -353,31 +375,31 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
353
375
|
return
|
|
354
376
|
}
|
|
355
377
|
// Routing Display
|
|
356
|
-
const routing =
|
|
357
|
-
const routingText = !
|
|
378
|
+
const routing = get(content, 'routing[0].url')
|
|
379
|
+
const routingText = !isUndefined(routing) ? ` (/${routing})` : ' (No route!)'
|
|
358
380
|
// ContentId Fallback
|
|
359
|
-
const contentId =
|
|
360
|
-
const contentIdText = !
|
|
381
|
+
const contentId = get(content, 'id')
|
|
382
|
+
const contentIdText = !isUndefined(contentId) ? `Content: ${contentId}` : null
|
|
361
383
|
// Return Version Title or Fallback Text
|
|
362
|
-
return (
|
|
384
|
+
return (get(content, 'version.title') || contentIdText) + routingText
|
|
363
385
|
}
|
|
364
386
|
|
|
365
387
|
// displayName(option: any) {
|
|
366
388
|
// if (option) {
|
|
367
|
-
// return
|
|
389
|
+
// return get(option, 'name')
|
|
368
390
|
// }
|
|
369
391
|
// }
|
|
370
392
|
|
|
371
393
|
private handleContent(response: HttpResponse<Convoy<ContentEntity>>) {
|
|
372
|
-
if (!response.ok || response.status !== 200 ||
|
|
394
|
+
if (!response.ok || response.status !== 200 || isEmpty(response.body)) {
|
|
373
395
|
this.filteredContent = []
|
|
374
396
|
// FIXME: We have to go in this roundabout way to force changes to be detected since the
|
|
375
397
|
// Dialog Sub-Components don't seem to have the right timing for ngOnInit
|
|
376
398
|
// this.refresh()
|
|
377
399
|
return this.filteredContent
|
|
378
400
|
}
|
|
379
|
-
const payload =
|
|
380
|
-
if (
|
|
401
|
+
const payload = get(response.body, 'payload') || response.body
|
|
402
|
+
if (isEmpty(payload) || !Array.isArray(payload)) {
|
|
381
403
|
this.filteredContent = []
|
|
382
404
|
// FIXME: We have to go in this roundabout way to force changes to be detected since the
|
|
383
405
|
// Dialog Sub-Components don't seem to have the right timing for ngOnInit
|
|
@@ -423,9 +445,10 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
423
445
|
}
|
|
424
446
|
|
|
425
447
|
getQueryUrl(query?: string, id?: string|number): string {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
448
|
+
const fullApiOptions = { options: assignIn(this.basicContentQueryAttributesObject, this.data.api)}
|
|
449
|
+
query = (!isString(query) || isEmpty(query)) ? '' : query
|
|
450
|
+
id = !isString(id) && !isNumber(id) ? '' : `/${id}`
|
|
451
|
+
return `${this.apiBase}${id}?limit=${this.limit}&${serializeUrlParams(fullApiOptions)}&q=${query}`
|
|
429
452
|
}
|
|
430
453
|
|
|
431
454
|
selectedOnTop(list?: Array<ContentEntity>, selected?: ContentEntity): Array<ContentEntity> {
|
|
@@ -435,7 +458,7 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
435
458
|
if (!selected || !selected.id) {
|
|
436
459
|
return list
|
|
437
460
|
}
|
|
438
|
-
const orderedList =
|
|
461
|
+
const orderedList = clone(list)
|
|
439
462
|
const index = list.findIndex((v) => v.id === selected.id)
|
|
440
463
|
if (index === -1) {
|
|
441
464
|
// If Selected is not present, inject as first element
|