@stratusjs/angular 0.5.0 → 0.5.2
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 +30609 -2673
- package/dist/angular.bundle.min.js +1 -1
- package/package.json +5 -4
- package/src/angular.modules.js +18 -33
- package/src/angular.modules.js.map +1 -1
- package/src/app.module.js +181 -227
- package/src/app.module.js.map +1 -1
- package/src/app.module.min.js +1 -1
- package/src/app.module.ts +17 -17
- package/src/backend.service.js +66 -87
- package/src/backend.service.js.map +1 -1
- package/src/base/base.component.js +101 -124
- package/src/base/base.component.js.map +1 -1
- package/src/boot.js +42 -55
- package/src/boot.js.map +1 -1
- package/src/confirm-dialog/confirm-dialog.component.js +41 -60
- package/src/confirm-dialog/confirm-dialog.component.js.map +1 -1
- package/src/core/base.interface.js +1 -9
- package/src/core/base.interface.js.map +1 -1
- package/src/core/dialog.interface.js.map +1 -0
- package/src/core/refresh.interface.js +1 -9
- package/src/core/refresh.interface.js.map +1 -1
- package/src/core/responsive.component.js +40 -58
- package/src/core/responsive.component.js.map +1 -1
- package/src/core/responsive.interface.js +1 -9
- package/src/core/responsive.interface.js.map +1 -1
- package/src/core/root.component.js +24 -43
- package/src/core/root.component.js.map +1 -1
- package/src/core/trigger.interface.js +1 -9
- package/src/core/trigger.interface.js.map +1 -1
- package/src/data/contact-meta.interface.js +1 -9
- package/src/data/contact-meta.interface.js.map +1 -1
- package/src/data/content.interface.js +1 -9
- package/src/data/content.interface.js.map +1 -1
- package/src/data/convoy.interface.js +1 -9
- package/src/data/convoy.interface.js.map +1 -1
- package/src/editor/citation-dialog.component.js +174 -207
- package/src/editor/citation-dialog.component.js.map +1 -1
- package/src/editor/code-mirror-bridge.js +63 -0
- package/src/editor/code-mirror-bridge.js.map +1 -0
- package/src/editor/code-mirror-bridge.min.js +1 -0
- package/src/editor/code-mirror-bridge.ts +85 -0
- package/src/editor/code-view-dialog.component.js +87 -116
- package/src/editor/code-view-dialog.component.js.map +1 -1
- package/src/editor/editor.component.js +903 -925
- package/src/editor/editor.component.js.map +1 -1
- package/src/editor/editor.component.min.js +1 -1
- package/src/editor/editor.component.ts +60 -21
- package/src/editor/link-dialog.component.js +356 -395
- package/src/editor/link-dialog.component.js.map +1 -1
- package/src/editor/media-dialog.component.js +270 -303
- package/src/editor/media-dialog.component.js.map +1 -1
- package/src/froala/plugins/citationManager.js +170 -191
- package/src/froala/plugins/citationManager.js.map +1 -1
- package/src/froala/plugins/inputButton.js +122 -138
- package/src/froala/plugins/inputButton.js.map +1 -1
- package/src/froala/plugins/linkManager.js +89 -104
- package/src/froala/plugins/linkManager.js.map +1 -1
- package/src/froala/plugins/mediaManager.js +72 -87
- package/src/froala/plugins/mediaManager.js.map +1 -1
- package/src/froala/plugins/menuButton.js +71 -86
- package/src/froala/plugins/menuButton.js.map +1 -1
- package/src/main.js +13 -33
- package/src/main.js.map +1 -1
- package/src/material.js +99 -194
- package/src/material.js.map +1 -1
- package/src/media-selector/media-selector.component.js +406 -441
- package/src/media-selector/media-selector.component.js.map +1 -1
- package/src/polyfills.js +3 -16
- package/src/polyfills.js.map +1 -1
- package/src/quill-plugins/quill-break-blot.plugin.js +19 -35
- package/src/quill-plugins/quill-break-blot.plugin.js.map +1 -1
- package/src/quill-plugins/quill-html-edit.plugin.js +140 -153
- package/src/quill-plugins/quill-html-edit.plugin.js.map +1 -1
- package/src/quill-plugins/quill-image-format.plugin.js +33 -47
- package/src/quill-plugins/quill-image-format.plugin.js.map +1 -1
- package/src/quill-plugins/quill-input-button.plugin.js +77 -95
- package/src/quill-plugins/quill-input-button.plugin.js.map +1 -1
- package/src/selector/selector.component.js +241 -276
- package/src/selector/selector.component.js.map +1 -1
- package/src/test/test.directive.js +49 -66
- package/src/test/test.directive.js.map +1 -1
- package/src/tree/tree-dialog.component.js +202 -231
- package/src/tree/tree-dialog.component.js.map +1 -1
- package/src/tree/tree-node.component.js +253 -279
- 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 +10 -18
- package/src/tree/tree.component.js +531 -568
- package/src/tree/tree.component.js.map +1 -1
- package/src/tree/tree.component.min.js +1 -1
- package/src/tree/tree.component.ts +7 -10
|
@@ -1,285 +1,259 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { ChangeDetectorRef, Component, Input, } from '@angular/core';
|
|
11
|
+
import { MatDialog } from '@angular/material/dialog';
|
|
12
|
+
import { TreeComponent } from './tree.component';
|
|
13
|
+
import { TreeDialogComponent } from './tree-dialog.component';
|
|
14
|
+
import { ConfirmDialogComponent } from '../confirm-dialog/confirm-dialog.component';
|
|
15
|
+
import _ from 'lodash';
|
|
16
|
+
import { Stratus } from '@stratusjs/runtime/stratus';
|
|
17
|
+
import { cookie } from '@stratusjs/core/environment';
|
|
18
|
+
import { ResponsiveComponent } from '../core/responsive.component';
|
|
19
|
+
const systemDir = '@stratusjs/angular';
|
|
20
|
+
const moduleName = 'tree-node';
|
|
21
|
+
const parentModuleName = 'tree';
|
|
22
|
+
const min = !cookie('env') ? '.min' : '';
|
|
23
|
+
const localDir = `${Stratus.BaseUrl}${boot.configuration.paths[`${systemDir}/*`].replace(/[^/]*$/, '').replace(/\/dist\/$/, '/src/')}`;
|
|
24
|
+
let TreeNodeComponent = class TreeNodeComponent extends ResponsiveComponent {
|
|
25
|
+
constructor(dialog, ref) {
|
|
26
|
+
super();
|
|
27
|
+
this.dialog = dialog;
|
|
28
|
+
this.ref = ref;
|
|
29
|
+
this.title = moduleName + '_component';
|
|
30
|
+
this.isInitialized = false;
|
|
31
|
+
this.isDestroyed = false;
|
|
32
|
+
this.isStyled = false;
|
|
33
|
+
this._ = _;
|
|
34
|
+
this.Stratus = Stratus;
|
|
35
|
+
this.hasChild = (node) => node.children && node.children.length > 0;
|
|
36
|
+
this.isExpanded = (node) => node.meta ? node.meta.expanded : true;
|
|
37
|
+
}
|
|
38
|
+
ngOnInit() {
|
|
39
|
+
this.uid = _.uniqueId(`sa_${_.snakeCase(moduleName)}_component_`);
|
|
40
|
+
Stratus.Instances[this.uid] = this;
|
|
41
|
+
Stratus.Internals.CssLoader(`${localDir}/${parentModuleName}/${moduleName}.component${min}.css`)
|
|
42
|
+
.then(() => {
|
|
43
|
+
this.isStyled = true;
|
|
44
|
+
this.refresh();
|
|
45
|
+
})
|
|
46
|
+
.catch((err) => {
|
|
47
|
+
console.warn('Issue detected in CSS Loader for Component:', this);
|
|
48
|
+
console.error(err);
|
|
49
|
+
this.isStyled = true;
|
|
50
|
+
this.refresh();
|
|
51
|
+
});
|
|
52
|
+
this.node.meta.component = this;
|
|
53
|
+
this.isInitialized = true;
|
|
54
|
+
this.refresh();
|
|
55
|
+
this.onPostPersist();
|
|
56
|
+
}
|
|
57
|
+
ngOnDestroy() {
|
|
58
|
+
this.node.meta.component = null;
|
|
59
|
+
this.isDestroyed = true;
|
|
60
|
+
}
|
|
61
|
+
refresh() {
|
|
62
|
+
if (this.isDestroyed) {
|
|
63
|
+
return new Promise(resolve => resolve());
|
|
64
|
+
}
|
|
65
|
+
return super.refresh();
|
|
66
|
+
}
|
|
67
|
+
onPostPersist() {
|
|
68
|
+
if (!this.node) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (!this.node.model) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!this.node.model.meta.get('postPersist')) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.node.model.meta.set('postPersist', false);
|
|
78
|
+
this.openDialog();
|
|
79
|
+
}
|
|
80
|
+
destroy() {
|
|
81
|
+
const dialog = this.dialog
|
|
82
|
+
.open(ConfirmDialogComponent, {
|
|
83
|
+
maxWidth: '400px',
|
|
84
|
+
data: {
|
|
85
|
+
title: 'Delete MenuLink',
|
|
86
|
+
message: 'Are you sure you want to do this?'
|
|
39
87
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return 'Untitled';
|
|
128
|
-
}
|
|
129
|
-
return this.node.model.get('name');
|
|
130
|
-
}
|
|
131
|
-
getDragPreview() {
|
|
132
|
-
return `name: ${this.getName()}<br>children: ${this.node.children ? this.node.children.length : 0}`;
|
|
133
|
-
}
|
|
134
|
-
toggleExpanded() {
|
|
135
|
-
if (!this.node.meta) {
|
|
136
|
-
console.error('node meta not found:', this.node);
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
this.node.meta.expanded = !this.node.meta.expanded;
|
|
140
|
-
this.refresh();
|
|
141
|
-
}
|
|
142
|
-
toggleExpandedClick() {
|
|
143
|
-
this.isSingleClick = true;
|
|
144
|
-
setTimeout(() => {
|
|
145
|
-
if (!this.isSingleClick) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
this.toggleExpanded();
|
|
149
|
-
}, this.tree.dblClickWait);
|
|
150
|
-
}
|
|
151
|
-
toggleExpandedDblClick() {
|
|
152
|
-
this.isSingleClick = false;
|
|
153
|
-
this.toggleExpanded();
|
|
154
|
-
}
|
|
155
|
-
openDialog() {
|
|
156
|
-
if (!this.node.model || !lodash_1.default.has(this.node.model, 'data')) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
const dialogRef = this.dialog.open(tree_dialog_component_1.TreeDialogComponent, {
|
|
160
|
-
width: '400px',
|
|
161
|
-
autoFocus: true,
|
|
162
|
-
disableClose: true,
|
|
163
|
-
restoreFocus: false,
|
|
164
|
-
data: {
|
|
165
|
-
tree: this.tree,
|
|
166
|
-
treeNode: this,
|
|
167
|
-
backend: this.tree.backend,
|
|
168
|
-
iconRegistry: this.tree.iconRegistry,
|
|
169
|
-
id: this.node.model.data.id || null,
|
|
170
|
-
name: this.node.model.data.name || '',
|
|
171
|
-
target: this.node.model.data.url ? 'url' : 'content',
|
|
172
|
-
content: this.node.model.data.content || null,
|
|
173
|
-
url: this.node.model.data.url || null,
|
|
174
|
-
browserTarget: this.node.model.data.browserTarget || null,
|
|
175
|
-
model: this.node.model || null,
|
|
176
|
-
collection: this.tree.collection || null,
|
|
177
|
-
parent: this.node.model.data.parent || null,
|
|
178
|
-
nestParent: this.node.model.data.nestParent || null,
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
this.refresh();
|
|
182
|
-
const that = this;
|
|
183
|
-
dialogRef.afterClosed().subscribe((result) => {
|
|
184
|
-
if (!result || lodash_1.default.isEmpty(result)) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
this.tree.unsettled = true;
|
|
188
|
-
const attrs = [
|
|
189
|
-
'name',
|
|
190
|
-
'content',
|
|
191
|
-
'url',
|
|
192
|
-
'priority',
|
|
193
|
-
'browserTarget'
|
|
194
|
-
];
|
|
195
|
-
attrs.forEach(attr => {
|
|
196
|
-
if (!lodash_1.default.has(result, attr)) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
if ('content' === attr) {
|
|
200
|
-
const value = lodash_1.default.get(result, attr);
|
|
201
|
-
this.node.model.set(attr, !value ? null : { id: lodash_1.default.get(value, 'id') });
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
this.node.model.set(attr, lodash_1.default.get(result, attr));
|
|
205
|
-
});
|
|
206
|
-
that.refresh();
|
|
207
|
-
that.tree.refresh();
|
|
208
|
-
this.node.model.save();
|
|
209
|
-
this.tree.unsettled = false;
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
openDialogClick() {
|
|
213
|
-
this.isSingleClick = true;
|
|
214
|
-
setTimeout(() => {
|
|
215
|
-
if (!this.isSingleClick) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
this.openDialog();
|
|
219
|
-
}, this.tree.dblClickWait);
|
|
220
|
-
}
|
|
221
|
-
openDialogDblClick() {
|
|
222
|
-
this.isSingleClick = false;
|
|
223
|
-
this.openDialog();
|
|
224
|
-
}
|
|
225
|
-
getSvg(url, options) {
|
|
226
|
-
return this.tree.getSvg(url, options);
|
|
227
|
-
}
|
|
228
|
-
toggleStatus() {
|
|
229
|
-
if (!this.node || !this.node.model) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
const model = this.node.model;
|
|
233
|
-
model.set('status', model.get('status') ? 0 : 1);
|
|
234
|
-
model.save();
|
|
88
|
+
});
|
|
89
|
+
dialog
|
|
90
|
+
.afterClosed()
|
|
91
|
+
.subscribe((dialogResult) => {
|
|
92
|
+
if (!dialogResult) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (!this.node || !this.node.model) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
this.node.model.destroy();
|
|
99
|
+
});
|
|
100
|
+
return dialog;
|
|
101
|
+
}
|
|
102
|
+
getName() {
|
|
103
|
+
if (!this.node.model || !this.node.model.get || !this.node.model.get('name')) {
|
|
104
|
+
return 'Untitled';
|
|
105
|
+
}
|
|
106
|
+
return this.node.model.get('name');
|
|
107
|
+
}
|
|
108
|
+
getDragPreview() {
|
|
109
|
+
return `name: ${this.getName()}<br>children: ${this.node.children ? this.node.children.length : 0}`;
|
|
110
|
+
}
|
|
111
|
+
toggleExpanded() {
|
|
112
|
+
if (!this.node.meta) {
|
|
113
|
+
console.error('node meta not found:', this.node);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
this.node.meta.expanded = !this.node.meta.expanded;
|
|
117
|
+
this.refresh();
|
|
118
|
+
}
|
|
119
|
+
toggleExpandedClick() {
|
|
120
|
+
this.isSingleClick = true;
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
if (!this.isSingleClick) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
this.toggleExpanded();
|
|
126
|
+
}, this.tree.dblClickWait);
|
|
127
|
+
}
|
|
128
|
+
toggleExpandedDblClick() {
|
|
129
|
+
this.isSingleClick = false;
|
|
130
|
+
this.toggleExpanded();
|
|
131
|
+
}
|
|
132
|
+
openDialog() {
|
|
133
|
+
if (!this.node.model || !_.has(this.node.model, 'data')) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const dialogRef = this.dialog.open(TreeDialogComponent, {
|
|
137
|
+
width: '400px',
|
|
138
|
+
autoFocus: true,
|
|
139
|
+
disableClose: true,
|
|
140
|
+
restoreFocus: false,
|
|
141
|
+
data: {
|
|
142
|
+
tree: this.tree,
|
|
143
|
+
treeNode: this,
|
|
144
|
+
backend: this.tree.backend,
|
|
145
|
+
iconRegistry: this.tree.iconRegistry,
|
|
146
|
+
id: this.node.model.data.id || null,
|
|
147
|
+
name: this.node.model.data.name || '',
|
|
148
|
+
target: this.node.model.data.url ? 'url' : 'content',
|
|
149
|
+
content: this.node.model.data.content || null,
|
|
150
|
+
url: this.node.model.data.url || null,
|
|
151
|
+
browserTarget: this.node.model.data.browserTarget || null,
|
|
152
|
+
model: this.node.model || null,
|
|
153
|
+
collection: this.tree.collection || null,
|
|
154
|
+
parent: this.node.model.data.parent || null,
|
|
155
|
+
nestParent: this.node.model.data.nestParent || null,
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
this.refresh();
|
|
159
|
+
const that = this;
|
|
160
|
+
dialogRef.afterClosed().subscribe((result) => {
|
|
161
|
+
if (!result || _.isEmpty(result)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this.tree.unsettled = true;
|
|
165
|
+
const attrs = [
|
|
166
|
+
'name',
|
|
167
|
+
'content',
|
|
168
|
+
'url',
|
|
169
|
+
'priority',
|
|
170
|
+
'browserTarget'
|
|
171
|
+
];
|
|
172
|
+
attrs.forEach(attr => {
|
|
173
|
+
if (!_.has(result, attr)) {
|
|
174
|
+
return;
|
|
235
175
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
return nestParent.id === this.node.id;
|
|
243
|
-
}).map((model) => model.get('priority'))) || -1;
|
|
244
|
-
if (typeof priority === 'number') {
|
|
245
|
-
priority++;
|
|
246
|
-
}
|
|
247
|
-
this.tree.collection.add({
|
|
248
|
-
name: 'Untitled Child',
|
|
249
|
-
parent: this.node.model.data.parent,
|
|
250
|
-
nestParent: {
|
|
251
|
-
id: this.node.model.data.id
|
|
252
|
-
},
|
|
253
|
-
priority
|
|
254
|
-
}, {
|
|
255
|
-
save: true,
|
|
256
|
-
trigger: true
|
|
257
|
-
});
|
|
176
|
+
if ('content' === attr) {
|
|
177
|
+
const value = _.get(result, attr);
|
|
178
|
+
this.node.model.set(attr, !value ? null : { id: _.get(value, 'id') });
|
|
179
|
+
return;
|
|
258
180
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
181
|
+
this.node.model.set(attr, _.get(result, attr));
|
|
182
|
+
});
|
|
183
|
+
that.refresh();
|
|
184
|
+
that.tree.refresh();
|
|
185
|
+
this.node.model.save();
|
|
186
|
+
this.tree.unsettled = false;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
openDialogClick() {
|
|
190
|
+
this.isSingleClick = true;
|
|
191
|
+
setTimeout(() => {
|
|
192
|
+
if (!this.isSingleClick) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
this.openDialog();
|
|
196
|
+
}, this.tree.dblClickWait);
|
|
197
|
+
}
|
|
198
|
+
openDialogDblClick() {
|
|
199
|
+
this.isSingleClick = false;
|
|
200
|
+
this.openDialog();
|
|
201
|
+
}
|
|
202
|
+
getSvg(url, options) {
|
|
203
|
+
return this.tree.getSvg(url, options);
|
|
204
|
+
}
|
|
205
|
+
toggleStatus() {
|
|
206
|
+
if (!this.node || !this.node.model) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const model = this.node.model;
|
|
210
|
+
model.set('status', model.get('status') ? 0 : 1);
|
|
211
|
+
model.save();
|
|
212
|
+
}
|
|
213
|
+
addChild() {
|
|
214
|
+
let priority = _.max(this.tree.collection.models.filter((model) => {
|
|
215
|
+
const nestParent = model.get('nestParent');
|
|
216
|
+
if (!nestParent) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
return nestParent.id === this.node.id;
|
|
220
|
+
}).map((model) => model.get('priority'))) || -1;
|
|
221
|
+
if (typeof priority === 'number') {
|
|
222
|
+
priority++;
|
|
281
223
|
}
|
|
282
|
-
|
|
283
|
-
|
|
224
|
+
this.tree.collection.add({
|
|
225
|
+
name: 'Untitled Child',
|
|
226
|
+
parent: this.node.model.data.parent,
|
|
227
|
+
nestParent: {
|
|
228
|
+
id: this.node.model.data.id
|
|
229
|
+
},
|
|
230
|
+
priority
|
|
231
|
+
}, {
|
|
232
|
+
save: true,
|
|
233
|
+
trigger: true
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
__decorate([
|
|
238
|
+
Input(),
|
|
239
|
+
__metadata("design:type", TreeComponent)
|
|
240
|
+
], TreeNodeComponent.prototype, "tree", void 0);
|
|
241
|
+
__decorate([
|
|
242
|
+
Input(),
|
|
243
|
+
__metadata("design:type", Object)
|
|
244
|
+
], TreeNodeComponent.prototype, "parent", void 0);
|
|
245
|
+
__decorate([
|
|
246
|
+
Input(),
|
|
247
|
+
__metadata("design:type", Object)
|
|
248
|
+
], TreeNodeComponent.prototype, "node", void 0);
|
|
249
|
+
TreeNodeComponent = __decorate([
|
|
250
|
+
Component({
|
|
251
|
+
selector: `sa-${moduleName}`,
|
|
252
|
+
templateUrl: `${localDir}/${parentModuleName}/${moduleName}.component${min}.html`,
|
|
253
|
+
}),
|
|
254
|
+
__metadata("design:paramtypes", [MatDialog,
|
|
255
|
+
ChangeDetectorRef])
|
|
256
|
+
], TreeNodeComponent);
|
|
257
|
+
export { TreeNodeComponent };
|
|
284
258
|
|
|
285
259
|
//# sourceMappingURL=tree-node.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tree-node.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["tree-node.component.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAEH,iBAAiB,EACjB,SAAS,EACT,KAAK,GAGR,MAAM,eAAe,CAAA;AAGtB,OAAO,EACH,SAAS,EAEZ,MAAM,0BAA0B,CAAA;AAIjC,OAAO,EAEH,aAAa,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAEH,mBAAmB,EACtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACH,sBAAsB,EACzB,MAAM,4CAA4C,CAAA;AAQnD,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,E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IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YACrB,IAAI,EAAC,gBAAgB;YACrB,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM;YACnC,UAAU,EAAE;gBACR,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;aAC9B;YACD,QAAQ;SACX,EAAE;YACC,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI;SAChB,CAAC,CAAA;IACN,CAAC;CACJ,CAAA;AA7QY;IAAR,KAAK,EAAE;8BAAO,aAAa;+CAAA;AACnB;IAAR,KAAK,EAAE;;iDAAa;AACZ;IAAR,KAAK,EAAE;;+CAAW;AAlBV,iBAAiB;IAL7B,SAAS,CAAC;QACP,QAAQ,EAAE,MAAM,UAAU,EAAE;QAC5B,WAAW,EAAE,GAAG,QAAQ,IAAI,gBAAgB,IAAI,UAAU,aAAa,GAAG,OAAO;KAEpF,CAAC;qCA6BqB,SAAS;QACT,iBAAiB;GA7B3B,iBAAiB,CA6R7B;SA7RY,iBAAiB","file":"tree-node.component.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["@angular/core","@angular/material/dialog","./tree-dialog.component","../confirm-dialog/confirm-dialog.component","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","../core/responsive.component"],function(e,t){"use strict";var n,o,i,s,r,d,a,l,h,c,u,m=this&&this.__decorate||function(e,t,n,o){var i,s=arguments.length,r=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,o);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(r=(s<3?i(r):s>3?i(t,n,r):i(t,n))||r);return s>3&&r&&Object.defineProperty(t,n,r),r},
|
|
1
|
+
System.register(["@angular/core","@angular/material/dialog","./tree.component","./tree-dialog.component","../confirm-dialog/confirm-dialog.component","lodash","@stratusjs/runtime/stratus","@stratusjs/core/environment","../core/responsive.component"],function(e,t){"use strict";var n,o,i,s,r,d,a,l,h,c,u,m,g=this&&this.__decorate||function(e,t,n,o){var i,s=arguments.length,r=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,o);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(r=(s<3?i(r):s>3?i(t,n,r):i(t,n))||r);return s>3&&r&&Object.defineProperty(t,n,r),r},p=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};t&&t.id;return{setters:[function(e){n=e},function(e){o=e},function(e){i=e},function(e){s=e},function(e){r=e},function(e){d=e},function(e){a=e},function(e){l=e},function(e){h=e}],execute:function(){"@stratusjs/angular","tree-node","tree",c=l.cookie("env")?"":".min",u=`${a.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"").replace(/\/dist\/$/,"/src/")}`,m=class extends h.ResponsiveComponent{constructor(e,t){super(),this.dialog=e,this.ref=t,this.title="tree-node_component",this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1,this._=d.default,this.Stratus=a.Stratus,this.hasChild=e=>e.children&&e.children.length>0,this.isExpanded=e=>!e.meta||e.meta.expanded}ngOnInit(){this.uid=d.default.uniqueId(`sa_${d.default.snakeCase("tree-node")}_component_`),a.Stratus.Instances[this.uid]=this,a.Stratus.Internals.CssLoader(`${u}/tree/tree-node.component${c}.css`).then(()=>{this.isStyled=!0,this.refresh()}).catch(e=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(e),this.isStyled=!0,this.refresh()}),this.node.meta.component=this,this.isInitialized=!0,this.refresh(),this.onPostPersist()}ngOnDestroy(){this.node.meta.component=null,this.isDestroyed=!0}refresh(){return this.isDestroyed?new Promise(e=>e()):super.refresh()}onPostPersist(){this.node&&this.node.model&&this.node.model.meta.get("postPersist")&&(this.node.model.meta.set("postPersist",!1),this.openDialog())}destroy(){const e=this.dialog.open(r.ConfirmDialogComponent,{maxWidth:"400px",data:{title:"Delete MenuLink",message:"Are you sure you want to do this?"}});return e.afterClosed().subscribe(e=>{e&&this.node&&this.node.model&&this.node.model.destroy()}),e}getName(){return this.node.model&&this.node.model.get&&this.node.model.get("name")?this.node.model.get("name"):"Untitled"}getDragPreview(){return`name: ${this.getName()}<br>children: ${this.node.children?this.node.children.length:0}`}toggleExpanded(){this.node.meta?(this.node.meta.expanded=!this.node.meta.expanded,this.refresh()):console.error("node meta not found:",this.node)}toggleExpandedClick(){this.isSingleClick=!0,setTimeout(()=>{this.isSingleClick&&this.toggleExpanded()},this.tree.dblClickWait)}toggleExpandedDblClick(){this.isSingleClick=!1,this.toggleExpanded()}openDialog(){if(!this.node.model||!d.default.has(this.node.model,"data"))return;const e=this.dialog.open(s.TreeDialogComponent,{width:"400px",autoFocus:!0,disableClose:!0,restoreFocus:!1,data:{tree:this.tree,treeNode:this,backend:this.tree.backend,iconRegistry:this.tree.iconRegistry,id:this.node.model.data.id||null,name:this.node.model.data.name||"",target:this.node.model.data.url?"url":"content",content:this.node.model.data.content||null,url:this.node.model.data.url||null,browserTarget:this.node.model.data.browserTarget||null,model:this.node.model||null,collection:this.tree.collection||null,parent:this.node.model.data.parent||null,nestParent:this.node.model.data.nestParent||null}});this.refresh();const t=this;e.afterClosed().subscribe(e=>{if(!e||d.default.isEmpty(e))return;this.tree.unsettled=!0;["name","content","url","priority","browserTarget"].forEach(t=>{if(d.default.has(e,t))if("content"!==t)this.node.model.set(t,d.default.get(e,t));else{const n=d.default.get(e,t);this.node.model.set(t,n?{id:d.default.get(n,"id")}:null)}}),t.refresh(),t.tree.refresh(),this.node.model.save(),this.tree.unsettled=!1})}openDialogClick(){this.isSingleClick=!0,setTimeout(()=>{this.isSingleClick&&this.openDialog()},this.tree.dblClickWait)}openDialogDblClick(){this.isSingleClick=!1,this.openDialog()}getSvg(e,t){return this.tree.getSvg(e,t)}toggleStatus(){if(!this.node||!this.node.model)return;const e=this.node.model;e.set("status",e.get("status")?0:1),e.save()}addChild(){let e=d.default.max(this.tree.collection.models.filter(e=>{const t=e.get("nestParent");return!!t&&t.id===this.node.id}).map(e=>e.get("priority")))||-1;"number"==typeof e&&e++,this.tree.collection.add({name:"Untitled Child",parent:this.node.model.data.parent,nestParent:{id:this.node.model.data.id},priority:e},{save:!0,trigger:!0})}},g([n.Input(),p("design:type",i.TreeComponent)],m.prototype,"tree",void 0),g([n.Input(),p("design:type",Object)],m.prototype,"parent",void 0),g([n.Input(),p("design:type",Object)],m.prototype,"node",void 0),m=g([n.Component({selector:"sa-tree-node",templateUrl:`${u}/tree/tree-node.component${c}.html`}),p("design:paramtypes",[o.MatDialog,n.ChangeDetectorRef])],m),e("TreeNodeComponent",m)}}});
|