2023-04-19 20:16:22 +08:00
|
|
|
|
|
|
|
import Vue from 'vue/dist/vue.esm';
|
|
|
|
import NavigatorContainer from '../../../vue/navigation/navigator.vue';
|
|
|
|
import PerfectScrollbar from 'vue2-perfect-scrollbar';
|
|
|
|
import 'vue2-perfect-scrollbar/dist/vue2-perfect-scrollbar.css';
|
|
|
|
|
|
|
|
Vue.use(PerfectScrollbar);
|
|
|
|
|
|
|
|
Vue.prototype.i18n = window.I18n;
|
|
|
|
|
2023-08-23 21:49:00 +08:00
|
|
|
function addNavigationNavigatorContainer() {
|
2023-04-25 18:30:45 +08:00
|
|
|
let navigator = new Vue({
|
2023-04-19 20:16:22 +08:00
|
|
|
el: '#sciNavigationNavigatorContainer',
|
|
|
|
components: {
|
|
|
|
'navigator-container': NavigatorContainer
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2023-04-26 16:24:50 +08:00
|
|
|
reloadCurrentLevel: false,
|
|
|
|
reloadChildrenLevel: false
|
2023-04-19 20:16:22 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
2023-04-26 16:24:50 +08:00
|
|
|
$(document).on('inlineEditing:fieldUpdated', '.title-row .inline-editing-container', () => {
|
|
|
|
this.reloadCurrentLevel = true;
|
|
|
|
})
|
2023-04-19 20:16:22 +08:00
|
|
|
},
|
2023-08-02 22:45:06 +08:00
|
|
|
methods: {
|
2023-08-02 23:02:11 +08:00
|
|
|
toggleNavigatorState: function(newNavigatorState) {
|
2023-08-02 22:45:06 +08:00
|
|
|
let stateUrl = $('#sciNavigationNavigatorContainer').attr('data-navigator-state-url');
|
2023-08-21 15:09:40 +08:00
|
|
|
$.post(stateUrl, { state: newNavigatorState ? 'collapsed' : 'open' });
|
2023-08-02 22:45:06 +08:00
|
|
|
$('.sci--layout').attr('data-navigator-collapsed', newNavigatorState);
|
|
|
|
$('body').toggleClass('navigator-collapsed', newNavigatorState);
|
|
|
|
|
|
|
|
// refresh action toolbar width on navigator toggle, take into account transition time of .4s
|
|
|
|
if (window.actionToolbarComponent) setTimeout(window.actionToolbarComponent.setWidth, 401);
|
|
|
|
}
|
|
|
|
},
|
2023-04-19 20:16:22 +08:00
|
|
|
watch: {
|
2023-04-26 16:24:50 +08:00
|
|
|
reloadCurrentLevel: function () {
|
|
|
|
if (this.reloadCurrentLevel) {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.reloadCurrentLevel = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
reloadChildrenLevel: function () {
|
|
|
|
if (this.reloadChildrenLevel) {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.reloadChildrenLevel = false;
|
|
|
|
});
|
|
|
|
}
|
2023-04-19 20:16:22 +08:00
|
|
|
}
|
2023-08-02 23:02:11 +08:00
|
|
|
}
|
|
|
|
});
|
2023-04-19 20:16:22 +08:00
|
|
|
|
|
|
|
window.navigatorContainer = navigator
|
2023-08-23 21:49:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (document.readyState !== 'loading') {
|
|
|
|
addNavigationNavigatorContainer();
|
|
|
|
} else {
|
|
|
|
window.addEventListener('DOMContentLoaded', () => {
|
|
|
|
addNavigationNavigatorContainer();
|
|
|
|
});
|
|
|
|
}
|