@stratusjs/angular 0.4.7 → 0.4.9
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 +2 -2
- package/src/editor/editor.component.js +31 -23
- package/src/editor/editor.component.js.map +1 -1
- package/src/editor/editor.component.min.js +1 -1
- package/src/editor/editor.component.ts +71 -47
- package/src/editor/media-dialog.component.js +48 -20
- 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 +58 -15
- package/src/froala/plugins/linkManager.js +10 -4
- package/src/froala/plugins/linkManager.js.map +1 -1
- package/src/froala/plugins/linkManager.min.js +1 -1
- package/src/froala/plugins/linkManager.ts +14 -6
- package/src/froala/plugins/mediaManager.js +10 -4
- package/src/froala/plugins/mediaManager.js.map +1 -1
- package/src/froala/plugins/mediaManager.min.js +1 -1
- package/src/froala/plugins/mediaManager.ts +22 -6
- package/src/tree/tree-dialog.component.js +35 -5
- 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 +51 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["@stratusjs/angular/froala/plugins/inputButton","froala-editor"],function(n,e){"use strict";var t,i;e&&e.id;return{setters:[function(n){t=n},function(n){i=n}],execute:function(){i.default.DEFAULTS=Object.assign(i.default.DEFAULTS,{endpoint:"/Api/Content"}),i.default.PLUGINS.linkManager=function(n){let e;const a=i.default.PLUGINS.link(n);return{_init:function(){e=new t.InputButtonPlugin({name:"Link Manager",eventName:"link-library",editor:n,insert:n=>{const e={};n.id&&(e["data-content-id"]=n.id),n.target&&(e.target="_blank"),a.insert(n.url,n.text,e)},autoSaveSelection:!0,autoRestoreSelection:!0,debug:false})},onClick:function(){n.el?e.onClick(n.el,a.get()):console.warn("linkManager.onClick(): unable to find element")}}},i.default.RegisterCommand("linkManager",{title:"Insert from Link Library",undo:!1,focus:!1,modal:!0,callback(){this.linkManager.onClick(void 0,i.default.PLUGINS.link(this).get())},plugin:"linkManager"}),i.default.DefineIcon("linkManager",{NAME:"folder",SVG_KEY:"insertLink"}),i.default.DefineIcon("linkManagerEdit",{NAME:"edit",SVG_KEY:"edit"}),i.default.DefineIcon("linkManagerInsert",{NAME:"plus",SVG_KEY:"add"}),i.default.DefineIcon("linkManagerDelete",{NAME:"trash",SVG_KEY:"remove"}),i.default.RegisterQuickInsertButton("link",{icon:"linkManager",title:"Insert from Link Library",callback:function(){const n=new t.InputButtonPlugin({name:"Link Manager",eventName:"link-library",editor:this,insert:n=>{i.default.PLUGINS.link(this).insert(n.url,"",{"aria-label":n.title})},autoSaveSelection:!0,autoRestoreSelection:!0,debug:!1});this.el?n.onClick(this.el):console.warn("linkManager.onClick(): unable to find element")},undo:!0})}}});
|
|
1
|
+
System.register(["@stratusjs/angular/froala/plugins/inputButton","froala-editor"],function(n,e){"use strict";var t,i;e&&e.id;return{setters:[function(n){t=n},function(n){i=n}],execute:function(){i.default.DEFAULTS=Object.assign(i.default.DEFAULTS,{endpoint:"/Api/Content"}),i.default.PLUGINS.linkManager=function(n){let e;const a=i.default.PLUGINS.link(n);return{_init:function(){e=new t.InputButtonPlugin({name:"Link Manager",eventName:"link-library",editor:n,insert:n=>{const e={};n.id&&(e["data-content-id"]=n.id),n.target&&(e.target="_blank"),a.insert(n.url,n.text,e)},autoSaveSelection:!0,autoRestoreSelection:!0,debug:false})},onClick:function(){n.el?e.onClick(n.el,a.get()):console.warn("linkManager.onClick(): unable to find element")}}},i.default.RegisterCommand("linkManager",{title:"Insert from Link Library",undo:!1,focus:!1,modal:!0,callback(){this.linkManager.onClick(void 0,i.default.PLUGINS.link(this).get())},plugin:"linkManager"}),i.default.DefineIcon("linkManager",{NAME:"folder",SVG_KEY:"insertLink"}),i.default.RegisterCommand("linkManagerEdit",{title:"Edit Link",undo:!1,focus:!1,modal:!0,callback(){this.linkManager.onClick(void 0,i.default.PLUGINS.link(this).get())},plugin:"linkManager"}),i.default.DefineIcon("linkManagerEdit",{NAME:"edit",SVG_KEY:"edit"}),i.default.DefineIcon("linkManagerInsert",{NAME:"plus",SVG_KEY:"add"}),i.default.DefineIcon("linkManagerDelete",{NAME:"trash",SVG_KEY:"remove"}),i.default.RegisterQuickInsertButton("link",{icon:"linkManager",title:"Insert from Link Library",callback:function(){const n=new t.InputButtonPlugin({name:"Link Manager",eventName:"link-library",editor:this,insert:n=>{i.default.PLUGINS.link(this).insert(n.url,"",{"aria-label":n.title})},autoSaveSelection:!0,autoRestoreSelection:!0,debug:!1});this.el?n.onClick(this.el):console.warn("linkManager.onClick(): unable to find element")},undo:!0})}}});
|
|
@@ -87,18 +87,26 @@ FroalaEditor.RegisterCommand('linkManager', {
|
|
|
87
87
|
focus: false,
|
|
88
88
|
modal: true,
|
|
89
89
|
callback() {
|
|
90
|
-
// debug info (move variable elsewhere)
|
|
91
|
-
const debug = false
|
|
92
|
-
if (debug) {
|
|
93
|
-
console.log('clicked:', this.linkManager)
|
|
94
|
-
}
|
|
95
|
-
// initiate click
|
|
96
90
|
this.linkManager.onClick(undefined, FroalaEditor.PLUGINS.link(this).get())
|
|
97
91
|
},
|
|
98
92
|
plugin: 'linkManager',
|
|
99
93
|
}),
|
|
100
94
|
FroalaEditor.DefineIcon('linkManager', {NAME: 'folder', SVG_KEY: 'insertLink'}),
|
|
95
|
+
|
|
96
|
+
// Link Edit Icon
|
|
97
|
+
FroalaEditor.RegisterCommand('linkManagerEdit', {
|
|
98
|
+
title: 'Edit Link',
|
|
99
|
+
undo: false,
|
|
100
|
+
focus: false,
|
|
101
|
+
modal: true,
|
|
102
|
+
callback() {
|
|
103
|
+
this.linkManager.onClick(undefined, FroalaEditor.PLUGINS.link(this).get())
|
|
104
|
+
},
|
|
105
|
+
plugin: 'linkManager',
|
|
106
|
+
}),
|
|
101
107
|
FroalaEditor.DefineIcon('linkManagerEdit', {NAME: 'edit', SVG_KEY: 'edit'}),
|
|
108
|
+
|
|
109
|
+
// Other Icons
|
|
102
110
|
FroalaEditor.DefineIcon('linkManagerInsert', {NAME: 'plus', SVG_KEY: 'add'}),
|
|
103
111
|
FroalaEditor.DefineIcon('linkManagerDelete', {NAME: 'trash', SVG_KEY: 'remove'})
|
|
104
112
|
|
|
@@ -23,6 +23,11 @@ System.register(["@stratusjs/angular/froala/plugins/inputButton", "froala-editor
|
|
|
23
23
|
name: 'Media Manager',
|
|
24
24
|
eventName: 'media-library',
|
|
25
25
|
editor,
|
|
26
|
+
insert: (media) => {
|
|
27
|
+
editor.html.insert(media.html);
|
|
28
|
+
},
|
|
29
|
+
autoSaveSelection: true,
|
|
30
|
+
autoRestoreSelection: true,
|
|
26
31
|
debug
|
|
27
32
|
});
|
|
28
33
|
if (debug) {
|
|
@@ -51,10 +56,6 @@ System.register(["@stratusjs/angular/froala/plugins/inputButton", "froala-editor
|
|
|
51
56
|
focus: false,
|
|
52
57
|
modal: true,
|
|
53
58
|
callback() {
|
|
54
|
-
const debug = false;
|
|
55
|
-
if (debug) {
|
|
56
|
-
console.log('clicked:', this.mediaManager);
|
|
57
|
-
}
|
|
58
59
|
this.mediaManager.onClick();
|
|
59
60
|
},
|
|
60
61
|
plugin: 'mediaManager',
|
|
@@ -71,6 +72,11 @@ System.register(["@stratusjs/angular/froala/plugins/inputButton", "froala-editor
|
|
|
71
72
|
name: 'Media Manager',
|
|
72
73
|
eventName: 'media-library',
|
|
73
74
|
editor: this,
|
|
75
|
+
insert: (media) => {
|
|
76
|
+
this.html.insert(media.html);
|
|
77
|
+
},
|
|
78
|
+
autoSaveSelection: true,
|
|
79
|
+
autoRestoreSelection: true,
|
|
74
80
|
debug
|
|
75
81
|
});
|
|
76
82
|
if (!this.el) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["mediaManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["mediaManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;YAYA,uBAAY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","file":"mediaManager.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["@stratusjs/angular/froala/plugins/inputButton","froala-editor"],function(e,
|
|
1
|
+
System.register(["@stratusjs/angular/froala/plugins/inputButton","froala-editor"],function(e,n){"use strict";var a,t;n&&n.id;return{setters:[function(e){a=e},function(e){t=e}],execute:function(){t.default.DEFAULTS=Object.assign(t.default.DEFAULTS,{endpoint:"/Api/Media"}),t.default.PLUGINS.mediaManager=function(e){let n;return{_init:function(){n=new a.InputButtonPlugin({name:"Media Manager",eventName:"media-library",editor:e,insert:n=>{e.html.insert(n.html)},autoSaveSelection:!0,autoRestoreSelection:!0,debug:false})},onClick:function(){e.el?n.onClick(e.el):console.warn("mediaManager.onClick(): unable to find element")}}},t.default.DEFAULTS.imageInsertButtons.push("mediaManager"),t.default.RegisterCommand("mediaManager",{title:"Insert from Media Library",undo:!1,focus:!1,modal:!0,callback(){this.mediaManager.onClick()},plugin:"mediaManager"}),t.default.DefineIcon("mediaManager",{NAME:"folder",SVG_KEY:"imageManager"}),t.default.DefineIcon("mediaManagerInsert",{NAME:"plus",SVG_KEY:"add"}),t.default.DefineIcon("mediaManagerDelete",{NAME:"trash",SVG_KEY:"remove"}),t.default.RegisterQuickInsertButton("media",{icon:"mediaManager",title:"Insert from Media Library",callback:function(){const e=new a.InputButtonPlugin({name:"Media Manager",eventName:"media-library",editor:this,insert:e=>{this.html.insert(e.html)},autoSaveSelection:!0,autoRestoreSelection:!0,debug:!1});this.el?e.onClick(this.el):console.warn("mediaManager.onClick(): unable to find element")},undo:!0})}}});
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
InputButtonPlugin
|
|
4
4
|
} from '@stratusjs/angular/froala/plugins/inputButton'
|
|
5
|
+
import {
|
|
6
|
+
MediaEmbed
|
|
7
|
+
} from '@stratusjs/angular/editor/media-dialog.component'
|
|
5
8
|
|
|
6
9
|
// @ts-ignore
|
|
7
10
|
import FroalaEditor from 'froala-editor'
|
|
@@ -17,14 +20,25 @@ FroalaEditor.DEFAULTS = Object.assign(FroalaEditor.DEFAULTS, {
|
|
|
17
20
|
FroalaEditor.PLUGINS.mediaManager = function mediaManager (editor: any) {
|
|
18
21
|
let inputButton: InputButtonPlugin
|
|
19
22
|
|
|
23
|
+
// const imagePlugin = FroalaEditor.PLUGINS.image(editor)
|
|
20
24
|
const debug = false
|
|
21
25
|
|
|
22
26
|
// When the plugin is initialized,this will be called.
|
|
23
27
|
function _init() {
|
|
24
|
-
inputButton = new InputButtonPlugin({
|
|
28
|
+
inputButton = new InputButtonPlugin<MediaEmbed>({
|
|
25
29
|
name: 'Media Manager',
|
|
26
30
|
eventName: 'media-library',
|
|
27
31
|
editor,
|
|
32
|
+
insert: (media: MediaEmbed) => {
|
|
33
|
+
// if (media.type === 'image') {
|
|
34
|
+
// imagePlugin.insert(media.url, true, media.attrs)
|
|
35
|
+
// } else {
|
|
36
|
+
// editor.html.insert(media.html)
|
|
37
|
+
// }
|
|
38
|
+
editor.html.insert(media.html)
|
|
39
|
+
},
|
|
40
|
+
autoSaveSelection: true,
|
|
41
|
+
autoRestoreSelection: true,
|
|
28
42
|
debug
|
|
29
43
|
})
|
|
30
44
|
|
|
@@ -68,10 +82,6 @@ FroalaEditor.DEFAULTS.imageInsertButtons.push('mediaManager'),
|
|
|
68
82
|
focus: false,
|
|
69
83
|
modal: true,
|
|
70
84
|
callback() {
|
|
71
|
-
const debug = false
|
|
72
|
-
if (debug) {
|
|
73
|
-
console.log('clicked:', this.mediaManager)
|
|
74
|
-
}
|
|
75
85
|
this.mediaManager.onClick()
|
|
76
86
|
},
|
|
77
87
|
plugin: 'mediaManager',
|
|
@@ -91,11 +101,17 @@ FroalaEditor.RegisterQuickInsertButton('media', {
|
|
|
91
101
|
// Callback for the button.
|
|
92
102
|
callback: function mediaManagerCallback () {
|
|
93
103
|
const debug = false
|
|
94
|
-
const inputButton = new InputButtonPlugin({
|
|
104
|
+
const inputButton = new InputButtonPlugin<MediaEmbed>({
|
|
95
105
|
name: 'Media Manager',
|
|
96
106
|
eventName: 'media-library',
|
|
97
107
|
// Contextual `this` is equivalent to the editor instance
|
|
98
108
|
editor: this,
|
|
109
|
+
insert: (media: MediaEmbed) => {
|
|
110
|
+
// console.log('media to insert directly:', media)
|
|
111
|
+
this.html.insert(media.html)
|
|
112
|
+
},
|
|
113
|
+
autoSaveSelection: true,
|
|
114
|
+
autoRestoreSelection: true,
|
|
99
115
|
debug
|
|
100
116
|
})
|
|
101
117
|
if (!this.el) {
|
|
@@ -63,9 +63,12 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
63
63
|
this.isStyled = false;
|
|
64
64
|
this._ = lodash_1.default;
|
|
65
65
|
this.Stratus = stratus_1.Stratus;
|
|
66
|
+
this.apiBase = '/Api/Content';
|
|
67
|
+
this.isSingleContentLoading = false;
|
|
68
|
+
this.limit = 20;
|
|
66
69
|
this.isContentLoading = false;
|
|
67
70
|
this.isContentLoaded = false;
|
|
68
|
-
this.
|
|
71
|
+
this.basicContentQueryAttributes = 'options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true';
|
|
69
72
|
}
|
|
70
73
|
ngOnInit() {
|
|
71
74
|
this.uid = lodash_1.default.uniqueId(`sa_${lodash_1.default.snakeCase(moduleName)}_component_`);
|
|
@@ -91,13 +94,13 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
91
94
|
.valueChanges
|
|
92
95
|
.pipe(operators_1.debounceTime(300), operators_1.tap(() => this.isContentLoading = true), operators_1.switchMap((value) => {
|
|
93
96
|
if (lodash_1.default.isString(value)) {
|
|
94
|
-
this.lastContentSelectorQuery =
|
|
97
|
+
this.lastContentSelectorQuery = this.getQueryUrl(value);
|
|
95
98
|
}
|
|
96
99
|
else {
|
|
97
100
|
this.data.content = value;
|
|
98
101
|
this.data.url = null;
|
|
99
102
|
}
|
|
100
|
-
return this.backend.get(this.lastContentSelectorQuery || this.
|
|
103
|
+
return this.backend.get(this.lastContentSelectorQuery || this.getQueryUrl())
|
|
101
104
|
.pipe(operators_1.finalize(() => {
|
|
102
105
|
this.isContentLoading = false;
|
|
103
106
|
this.isContentLoaded = true;
|
|
@@ -105,9 +108,31 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
105
108
|
}))
|
|
106
109
|
.subscribe((response) => this.handleContent(response));
|
|
107
110
|
this.backend
|
|
108
|
-
.get(this.
|
|
111
|
+
.get(this.getQueryUrl())
|
|
109
112
|
.pipe(operators_1.finalize(() => this.isContentLoading = false))
|
|
110
113
|
.subscribe((response) => this.handleContent(response));
|
|
114
|
+
if (this.data.content && this.data.content.id) {
|
|
115
|
+
this.isSingleContentLoading = true;
|
|
116
|
+
this.backend
|
|
117
|
+
.get(this.getQueryUrl(null, this.data.content.id))
|
|
118
|
+
.pipe(operators_1.finalize(() => this.isSingleContentLoading = false))
|
|
119
|
+
.subscribe((response) => {
|
|
120
|
+
if (!response.ok || response.status !== 200 || lodash_1.default.isEmpty(response.body)) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
const payload = lodash_1.default.get(response.body, 'payload') || response.body;
|
|
124
|
+
if (lodash_1.default.isEmpty(payload) || Array.isArray(payload) || !lodash_1.default.isObject(payload)) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
this.contentEntity = payload;
|
|
128
|
+
this.isSingleContentLoading = false;
|
|
129
|
+
this.dialogContentForm
|
|
130
|
+
.get('contentSelectorInput')
|
|
131
|
+
.patchValue(this.contentEntity);
|
|
132
|
+
this.refresh();
|
|
133
|
+
return this.contentEntity;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
111
136
|
this.isInitialized = true;
|
|
112
137
|
}
|
|
113
138
|
ngOnDestroy() {
|
|
@@ -145,7 +170,7 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
145
170
|
this.filteredContent = [];
|
|
146
171
|
return this.filteredContent;
|
|
147
172
|
}
|
|
148
|
-
this.filteredContent =
|
|
173
|
+
this.filteredContent = payload;
|
|
149
174
|
return this.filteredContent;
|
|
150
175
|
}
|
|
151
176
|
destroy() {
|
|
@@ -173,6 +198,11 @@ System.register(["@angular/core", "@angular/forms", "@angular/cdk/drag-drop", "@
|
|
|
173
198
|
getSvg(url, options) {
|
|
174
199
|
return this.tree.getSvg(url, options);
|
|
175
200
|
}
|
|
201
|
+
getQueryUrl(query, id) {
|
|
202
|
+
query = (!lodash_1.default.isString(query) || lodash_1.default.isEmpty(query)) ? '' : `"${query}"`;
|
|
203
|
+
id = !lodash_1.default.isString(id) && !lodash_1.default.isNumber(id) ? '' : `/${id}`;
|
|
204
|
+
return `${this.apiBase}${id}?limit=${this.limit}&${this.basicContentQueryAttributes}&q=${query}`;
|
|
205
|
+
}
|
|
176
206
|
selectedOnTop(list, selected) {
|
|
177
207
|
if (!list || !list.length) {
|
|
178
208
|
return list;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tree-dialog.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuFM,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,aAAa,CAAC,KAAK,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAA;YAU3F,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,0CAAmB;
|
|
1
|
+
{"version":3,"sources":["tree-dialog.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;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js"}
|
|
@@ -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","@stratusjs/angular/core/responsive.component"],function(t,e){"use strict";var n,i,s,o,r,a,d,
|
|
1
|
+
System.register(["@angular/core","@angular/forms","@angular/cdk/drag-drop","@angular/material/dialog","rxjs/operators","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/angular/core/responsive.component"],function(t,e){"use strict";var n,i,s,o,r,a,l,d,u,h,c,f,g,p=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},y=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C=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){u=t}],execute:function(){"@stratusjs/angular",h="tree-dialog","tree",c=d.cookie("env")?"":".min",f=`${l.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"")}`,g=class extends u.ResponsiveComponent{constructor(t,e,n,i){super(),this.dialogRef=t,this.data=e,this.fb=n,this.ref=i,this.title="tree-dialog_component",this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1,this._=a.default,this.Stratus=l.Stratus,this.apiBase="/Api/Content",this.isSingleContentLoading=!1,this.limit=20,this.isContentLoading=!1,this.isContentLoaded=!1,this.basicContentQueryAttributes="options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true"}ngOnInit(){this.uid=a.default.uniqueId(`sa_${a.default.snakeCase(h)}_component_`),l.Stratus.Instances[this.uid]=this,l.Stratus.Internals.CssLoader(`${f}/tree/tree-dialog.component${c}.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.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.default.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.default.isEmpty(t.body))return null;const e=a.default.get(t.body,"payload")||t.body;return a.default.isEmpty(e)||Array.isArray(e)||!a.default.isObject(e)?null:(this.contentEntity=e,this.isSingleContentLoading=!1,this.dialogContentForm.get("contentSelectorInput").patchValue(this.contentEntity),this.refresh(),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=this.browserTarget?"_blank":null}displayContentText(t){if(!t)return;const e=a.default.get(t,"routing[0].url"),n=a.default.isUndefined(e)?" (No route!)":` (/${e})`,i=a.default.get(t,"id"),s=a.default.isUndefined(i)?null:`Content: ${i}`;return(a.default.get(t,"version.title")||s)+n}handleContent(t){if(!t.ok||200!==t.status||a.default.isEmpty(t.body))return this.filteredContent=[],this.filteredContent;const e=a.default.get(t.body,"payload")||t.body;return a.default.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){return t=!a.default.isString(t)||a.default.isEmpty(t)?"":`"${t}"`,e=a.default.isString(e)||a.default.isNumber(e)?`/${e}`:"",`${this.apiBase}${e}?limit=${this.limit}&${this.basicContentQueryAttributes}&q=${t}`}selectedOnTop(t,e){if(!t||!t.length)return t;if(!e||!e.id)return t;const n=a.default.clone(t),i=t.findIndex(t=>t.id===e.id);return-1===i?(n.unshift(e),n):(s.moveItemInArray(n,i,0),n)}},g=p([n.Component({selector:"sa-tree-dialog",templateUrl:`${f}/tree/tree-dialog.component${c}.html`}),C(1,n.Inject(o.MAT_DIALOG_DATA)),y("design:paramtypes",[o.MatDialogRef,Object,i.FormBuilder,n.ChangeDetectorRef])],g),t("TreeDialogComponent",g)}}});
|
|
@@ -131,10 +131,16 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
131
131
|
// AutoComplete Data
|
|
132
132
|
filteredContent: Array<ContentEntity>
|
|
133
133
|
dialogContentForm: FormGroup
|
|
134
|
+
|
|
135
|
+
// API Data
|
|
136
|
+
apiBase = '/Api/Content'
|
|
137
|
+
isSingleContentLoading = false
|
|
138
|
+
limit = 20
|
|
134
139
|
isContentLoading = false
|
|
135
140
|
isContentLoaded = false
|
|
136
141
|
lastContentSelectorQuery: string
|
|
137
|
-
|
|
142
|
+
basicContentQueryAttributes = 'options[isContent]=null&options[isCollection]=null&options[showRoutable]=true&options[showRouting]=true'
|
|
143
|
+
contentEntity: ContentEntity
|
|
138
144
|
|
|
139
145
|
// Normalized Data
|
|
140
146
|
browserTarget: boolean
|
|
@@ -208,12 +214,13 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
208
214
|
tap(() => this.isContentLoading = true),
|
|
209
215
|
switchMap((value: any) => {
|
|
210
216
|
if (_.isString(value)) {
|
|
211
|
-
this.lastContentSelectorQuery =
|
|
217
|
+
this.lastContentSelectorQuery = this.getQueryUrl(value)
|
|
212
218
|
} else {
|
|
219
|
+
// console.log('switchMap value is not a string:', value)
|
|
213
220
|
this.data.content = value
|
|
214
221
|
this.data.url = null
|
|
215
222
|
}
|
|
216
|
-
return this.backend.get(this.lastContentSelectorQuery || this.
|
|
223
|
+
return this.backend.get(this.lastContentSelectorQuery || this.getQueryUrl())
|
|
217
224
|
.pipe(
|
|
218
225
|
finalize(() => {
|
|
219
226
|
this.isContentLoading = false
|
|
@@ -232,12 +239,44 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
232
239
|
|
|
233
240
|
// Initial Call for Content
|
|
234
241
|
this.backend
|
|
235
|
-
.get(this.
|
|
242
|
+
.get(this.getQueryUrl())
|
|
236
243
|
.pipe(
|
|
237
244
|
finalize(() => this.isContentLoading = false),
|
|
238
245
|
)
|
|
239
246
|
.subscribe((response: HttpResponse<Convoy<ContentEntity>>) => this.handleContent(response))
|
|
240
247
|
|
|
248
|
+
// Hydrate Selected Content
|
|
249
|
+
if (this.data.content && this.data.content.id) {
|
|
250
|
+
this.isSingleContentLoading = true
|
|
251
|
+
this.backend
|
|
252
|
+
.get(
|
|
253
|
+
this.getQueryUrl(
|
|
254
|
+
null,
|
|
255
|
+
this.data.content.id
|
|
256
|
+
)
|
|
257
|
+
)
|
|
258
|
+
.pipe(
|
|
259
|
+
finalize(() => this.isSingleContentLoading = false),
|
|
260
|
+
)
|
|
261
|
+
.subscribe((response: HttpResponse<Convoy<ContentEntity>>) => {
|
|
262
|
+
if (!response.ok || response.status !== 200 || _.isEmpty(response.body)) {
|
|
263
|
+
return null
|
|
264
|
+
}
|
|
265
|
+
const payload = _.get(response.body, 'payload') || response.body
|
|
266
|
+
if (_.isEmpty(payload) || Array.isArray(payload) || !_.isObject(payload)) {
|
|
267
|
+
return null
|
|
268
|
+
}
|
|
269
|
+
// @ts-ignore
|
|
270
|
+
this.contentEntity = payload
|
|
271
|
+
this.isSingleContentLoading = false
|
|
272
|
+
this.dialogContentForm
|
|
273
|
+
.get('contentSelectorInput')
|
|
274
|
+
.patchValue(this.contentEntity)
|
|
275
|
+
this.refresh()
|
|
276
|
+
return this.contentEntity
|
|
277
|
+
})
|
|
278
|
+
}
|
|
279
|
+
|
|
241
280
|
// Handle Parent Selector
|
|
242
281
|
// this.dialogParentForm = this.fb.group({
|
|
243
282
|
// parentSelectorInput: this.data.nestParent
|
|
@@ -340,7 +379,8 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
340
379
|
// this.refresh()
|
|
341
380
|
return this.filteredContent
|
|
342
381
|
}
|
|
343
|
-
this.filteredContent = this.selectedOnTop(payload, this.data.content)
|
|
382
|
+
// this.filteredContent = this.selectedOnTop(payload, this.data.content)
|
|
383
|
+
this.filteredContent = payload
|
|
344
384
|
// FIXME: We have to go in this roundabout way to force changes to be detected since the
|
|
345
385
|
// Dialog Sub-Components don't seem to have the right timing for ngOnInit
|
|
346
386
|
// this.refresh()
|
|
@@ -377,6 +417,12 @@ export class TreeDialogComponent extends ResponsiveComponent implements OnInit,
|
|
|
377
417
|
return this.tree.getSvg(url, options)
|
|
378
418
|
}
|
|
379
419
|
|
|
420
|
+
getQueryUrl(query?: string, id?: string|number): string {
|
|
421
|
+
query = (!_.isString(query) || _.isEmpty(query)) ? '' : `"${query}"`
|
|
422
|
+
id = !_.isString(id) && !_.isNumber(id) ? '' : `/${id}`
|
|
423
|
+
return `${this.apiBase}${id}?limit=${this.limit}&${this.basicContentQueryAttributes}&q=${query}`
|
|
424
|
+
}
|
|
425
|
+
|
|
380
426
|
selectedOnTop(list?: Array<ContentEntity>, selected?: ContentEntity): Array<ContentEntity> {
|
|
381
427
|
if (!list || !list.length) {
|
|
382
428
|
return list
|