|
|
@ -45,6 +45,16 @@ export class AppComponent implements OnInit {
|
|
|
|
isExpandedField: 'expanded',
|
|
|
|
isExpandedField: 'expanded',
|
|
|
|
animateExpand: true,
|
|
|
|
animateExpand: true,
|
|
|
|
scrollOnActivate: false,
|
|
|
|
scrollOnActivate: false,
|
|
|
|
|
|
|
|
allowDrag: true,
|
|
|
|
|
|
|
|
allowDrop: (element, { parent, index }) => {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
!this.api.isOffline
|
|
|
|
|
|
|
|
&& (element.data.type === 'page' || element.data.type === 'form')
|
|
|
|
|
|
|
|
&& (parent.data.type === 'page' || parent.data.userRootPage)
|
|
|
|
|
|
|
|
&& !element.data.userRootPage
|
|
|
|
|
|
|
|
&& element.data.id !== parent.data.id
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
actionMapping: {
|
|
|
|
actionMapping: {
|
|
|
|
mouse: {
|
|
|
|
mouse: {
|
|
|
|
dblClick: (tree, node, $event) => {
|
|
|
|
dblClick: (tree, node, $event) => {
|
|
|
@ -710,4 +720,32 @@ export class AppComponent implements OnInit {
|
|
|
|
isPrefetch() {
|
|
|
|
isPrefetch() {
|
|
|
|
return !!this.session.get('user.preferences.auto_prefetch');
|
|
|
|
return !!this.session.get('user.preferences.auto_prefetch');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async onTreeNodeMove({ node, to }) {
|
|
|
|
|
|
|
|
if ( this.api.isOffline ) {
|
|
|
|
|
|
|
|
debug('Cannot move node. API is offline.');
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { parent } = to;
|
|
|
|
|
|
|
|
debug('Moving node:', { node, parent });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
await this.api.moveMenuNode(node.id, to.parent.id);
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
console.error('Error moving tree node:', error);
|
|
|
|
|
|
|
|
this.alerts.create({
|
|
|
|
|
|
|
|
header: 'Error Moving Node',
|
|
|
|
|
|
|
|
message: error.message,
|
|
|
|
|
|
|
|
buttons: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
text: 'Okay',
|
|
|
|
|
|
|
|
role: 'cancel',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
}).then(x => x.present());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await this.reloadMenuItems().toPromise();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|