This commit is contained in:
2020-09-01 22:08:47 +00:00
parent e13898dd95
commit 8d180fcd66
2 changed files with 50 additions and 8 deletions

View File

@@ -470,16 +470,13 @@ export default {
selectedRowIds = vm.selected.map(z => {
return z.id;
});
selectedRowIds.reverse();//destructive but in this case doesn't matter at all
//reverse them non destructively
// return array.map((item,idx) => array[array.length-1-idx])
selectedRowIds.reverse();
}
/* public AyaType ObjectType { get; set; }
public long[] SelectedRowIds { get; set; }
public string DataListKey { get; set; }
public string ListView { get; set; }//optional, if null or empty will use default list view built into DataList
*/
*/
return {
ObjectType: ayaType,
selectedRowIds: selectedRowIds,

View File

@@ -1,5 +1,6 @@
<template>
<div v-resize="onResize">
{{ formState }}
<v-row>
<v-col cols="12" sm="6" class="py-2">
<v-btn-toggle
@@ -115,8 +116,7 @@ import * as monaco from "monaco-editor";
//https://github.com/egoist/vue-monaco/blob/master/src/MonacoEditor.js
/*TODO:
Get data from list
needs work at this end in widget list form (or is it in the data-list control?)
template roundtrip save and open template from server
@@ -231,8 +231,19 @@ export default {
vm.formState.ready = true;
}
},
async beforeRouteLeave(to, from, next) {
if (!this.formState.dirty || JUST_DELETED) {
next();
return;
}
if ((await window.$gz.dialog.confirmLeaveUnsaved()) === true) {
next();
} else {
next(false);
}
},
beforeDestroy() {
window.$gz.eventBus.$off("menu-click", clickHandler);
//TODO: dispose all models and editor
editor && editor.dispose();
},
@@ -304,6 +315,40 @@ Handlebars.registerHelper('loud', function (aString) {
ayaType: window.$gz.type.Report
};
},
//WATCHERS
watch: {
formState: {
handler: function(val) {
//,oldval is available here too if necessary
if (this.formState.loading) {
return;
}
//enable / disable save button
if (val.dirty && val.valid && !val.readOnly) {
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save");
} else {
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
}
//enable / disable duplicate / new button
if (!val.dirty && val.valid && !val.readOnly) {
window.$gz.eventBus.$emit(
"menu-enable-item",
FORM_KEY + ":duplicate"
);
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":new");
} else {
window.$gz.eventBus.$emit(
"menu-disable-item",
FORM_KEY + ":duplicate"
);
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":new");
}
},
deep: true
}
},
methods: {
//alternate method, one editor with tabs example
//probably should do this way