- fix: width to 100%

flex: 1;  // get all space
  order: 1;
- focus to InsertTask
This commit is contained in:
Paolo Arena
2019-01-28 20:39:40 +01:00
parent d8f0ead522
commit 0161e6c7e9
7 changed files with 94 additions and 34 deletions

View File

@@ -130,6 +130,10 @@
} }
} }
.fixed-left:hover{
cursor: ew-resize;
}
/* /*
@-webkit-keyframes moveFromLeftFade { @-webkit-keyframes moveFromLeftFade {
from { from {

View File

@@ -12,6 +12,7 @@
.flex-container2 { .flex-container2 {
flex-flow: row nowrap; flex-flow: row nowrap;
justify-content: space-between; justify-content: space-between;
margin: 2px 5px 2px 5px; // top right bottom left
} }
// Set visibility: visible to the icon menu of pos-item-popover // Set visibility: visible to the icon menu of pos-item-popover
@@ -86,7 +87,7 @@
.pos-item:hover, .pos-item-popover:hover { .pos-item:hover, .pos-item-popover:hover {
cursor: col-resize; cursor: grab;
} }
.priority-item-popover { .priority-item-popover {
@@ -128,11 +129,13 @@
} }
.data-item { .data-item {
max-width: 100px; //max-width: 100px;
min-width: 100px; //min-width: 100px;
display: block; //display: flex;
visibility: initial; //visibility: initial;
color: #ccc; color: #ccc;
order: 1;
flex: 1;
} }
@@ -159,7 +162,7 @@
text-align: left; text-align: left;
flex: 1; flex: 1;
order: 1; //order: 2;
//height: 24px; //height: 24px;
//line-height: 24px; /* same as height! */ //line-height: 24px; /* same as height! */
@@ -245,6 +248,14 @@
} }
} }
.after_textarea {
display: none;
visibility: hidden;
}
.after_textarea:hover {
visibility: visible;
}
/* /*
@@ -269,3 +280,5 @@
flex: 1; flex: 1;
} }
*/ */

View File

@@ -17,7 +17,7 @@ export default class SingleTodo extends Vue {
public iconCompleted: string = '' public iconCompleted: string = ''
public classCompleted: string = '' public classCompleted: string = ''
public classDescr: string = '' public classDescr: string = ''
public classDescrEdit:string = '' public classDescrEdit: string = ''
public classExpiring: string = '' public classExpiring: string = ''
public classExpiringEx: string = '' public classExpiringEx: string = ''
public iconPriority: string = '' public iconPriority: string = ''
@@ -26,6 +26,7 @@ export default class SingleTodo extends Vue {
public classRow: string = '' public classRow: string = ''
public sel: boolean = false public sel: boolean = false
public inEdit: boolean = false public inEdit: boolean = false
public precDescr: string = ''
$q: any $q: any
@Prop({ required: true }) itemtodo: ITodo @Prop({ required: true }) itemtodo: ITodo
@@ -47,11 +48,15 @@ export default class SingleTodo extends Vue {
this.watchupdate() this.watchupdate()
} }
isTodo () { @Watch('itemtodo.descr') valueChanged5() {
this.precDescr = this.itemtodo.descr
}
isTodo() {
return this.isTodoByElem(this.itemtodo) return this.isTodoByElem(this.itemtodo)
} }
isTodoByElem (elem) { isTodoByElem(elem) {
return elem.descr.slice(-1) !== ':' return elem.descr.slice(-1) !== ':'
} }
@@ -87,8 +92,8 @@ export default class SingleTodo extends Vue {
// this.getinputdescr = 'inputdescr' + this.itemtodo.id // this.getinputdescr = 'inputdescr' + this.itemtodo.id
console.log('classDescrEdit = ', this.classDescrEdit) // console.log('classDescrEdit = ', this.classDescrEdit)
console.log('classDescr', this.classDescr) // console.log('classDescr', this.classDescr)
if (this.isTodo()) if (this.isTodo())
this.menuPopupTodo = rescodes.menuPopupTodo[UserStore.state.lang] this.menuPopupTodo = rescodes.menuPopupTodo[UserStore.state.lang]
@@ -100,6 +105,7 @@ export default class SingleTodo extends Vue {
} }
created() { created() {
this.precDescr = this.itemtodo.descr
this.updateicon() this.updateicon()
this.updateClasses() this.updateClasses()
@@ -113,8 +119,8 @@ export default class SingleTodo extends Vue {
return 'row flex-container2 ' + this.classRow return 'row flex-container2 ' + this.classRow
} }
clickRiga () { clickRiga() {
console.log('CLICK RIGA ************') // console.log('CLICK RIGA ************')
if (!this.inEdit) { if (!this.inEdit) {
this.$emit('deselectAllRows', this.itemtodo, true) this.$emit('deselectAllRows', this.itemtodo, true)
@@ -127,22 +133,22 @@ export default class SingleTodo extends Vue {
} }
selectRiga() { selectRiga() {
console.log('selectRiga', this.itemtodo.descr) // console.log('selectRiga', this.itemtodo.descr)
this.sel = true this.sel = true
this.classRow = 'rowselected' this.classRow = 'rowselected'
this.updateClasses() this.updateClasses()
console.log('FINE selectRiga', this.itemtodo.descr) // console.log('FINE selectRiga', this.itemtodo.descr)
} }
deselectRiga() { deselectRiga() {
console.log('DeselectRiga', this.itemtodo.descr) // console.log('DeselectRiga', this.itemtodo.descr)
this.sel = false this.sel = false
this.classRow = '' this.classRow = ''
this.inEdit = false this.inEdit = false
this.updateClasses() this.updateClasses()
} }
deselectAndExitEdit () { deselectAndExitEdit() {
this.deselectRiga() this.deselectRiga()
this.exitEdit() this.exitEdit()
} }
@@ -157,28 +163,38 @@ export default class SingleTodo extends Vue {
} }
} }
editTodo () { editTodo() {
console.log('INIZIO - editTodo') // console.log('INIZIO - editTodo')
this.$emit('click') this.$emit('click')
this.precDescr = this.itemtodo.descr
this.inEdit = true this.inEdit = true
if (!this.sel) if (!this.sel)
this.selectRiga() this.selectRiga()
else else
this.updateClasses() this.updateClasses()
let mythis = this this.faiFocus('inputdescr')
setTimeout(() => {
let theField = <HTMLInputElement>mythis.$refs.inputdescr
theField.focus()
console.log('focus()')
}, 100)
console.log('FINE - editTodo')
// console.log('FINE - editTodo')
} }
exitEdit (singola: boolean = false) { faiFocus(elem, isparent: boolean = false) {
let mythis = this
setTimeout(() => {
let theField = null
if (isparent)
theField = <HTMLInputElement>mythis.$parent.$parent.$parent.$parent.$refs[elem]
else
theField = <HTMLInputElement>mythis.$refs[elem]
theField.focus()
// console.log('focus()')
}, 100)
}
exitEdit(singola: boolean = false) {
if (this.inEdit) { if (this.inEdit) {
console.log('exitEdit') // console.log('exitEdit')
this.inEdit = false this.inEdit = false
this.updateClasses this.updateClasses
this.$emit('deselectAllRows', this.itemtodo, false, singola) this.$emit('deselectAllRows', this.itemtodo, false, singola)
@@ -186,9 +202,30 @@ export default class SingleTodo extends Vue {
} }
updateTodo () { keyDownArea(e) {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault()
this.updateTodo()
this.deselectRiga()
this.faiFocus('insertTask', true)
}
// console.log('keyDownArea', e)
if (e.key === 'Escape') {
this.deselectRiga()
this.faiFocus('insertTask', true)
console.log('LOAD this.precDescr', this.precDescr)
this.precDescr = this.itemtodo.descr
}
}
updateTodo() {
this.itemtodo.descr = this.precDescr
console.log('updateTodo', this.precDescr, this.itemtodo.descr)
this.watchupdate() this.watchupdate()
this.inEdit = false this.inEdit = false
// this.precDescr = this.itemtodo.descr
this.updateClasses() this.updateClasses()
} }

View File

@@ -1,5 +1,5 @@
<template> <template>
<div :class="getClassRow()" @mouseup.left="mouseUp" @mousedown="clickRiga"> <div :class="getClassRow()" >
<q-context-menu> <q-context-menu>
<q-list link separator no-border class="todo-menu"> <q-list link separator no-border class="todo-menu">
<q-item v-for="field in menuPopupTodo" :key="field.value" <q-item v-for="field in menuPopupTodo" :key="field.value"
@@ -19,7 +19,7 @@
</q-item> </q-item>
</q-list> </q-list>
</q-context-menu> </q-context-menu>
<div v-if="isTodo()" class="flex-item pos-item" > <div v-if="isTodo()" class="flex-item pos-item" @mouseup.left="mouseUp" @mousedown="clickRiga">
<q-btn flat <q-btn flat
class="pos-item-popover" class="pos-item-popover"
icon="menu"> icon="menu">
@@ -80,10 +80,11 @@
@click.native="setCompleted"/>--> @click.native="setCompleted"/>-->
</div> </div>
<q-input type="textarea" autofocus ref="inputdescr" :value="itemtodo.descr" @change="val => itemtodo.descr = val" <q-input type="textarea" ref="inputdescr" v-model="precDescr"
:class="classDescr" :max-height="50" :class="classDescr" :max-height="50"
v-on:keyup.enter="updateTodo" v-on:keydown.esc="exitEdit" @blur="exitEdit(true)" @mousedown.left="editTodo()"/> @keydown="keyDownArea" v-on:keydown.esc="exitEdit" @blur="exitEdit(true)" @click="editTodo()"/>
<!--:after="[{icon: 'arrow_forward', content: true, handler () {}}]"-->
<!--<div :class="classDescr" @mousedown.left="editTodo()">--> <!--<div :class="classDescr" @mousedown.left="editTodo()">-->
<!--<q-field>{{ itemtodo.descr }}</q-field>--> <!--<q-field>{{ itemtodo.descr }}</q-field>-->

View File

@@ -58,3 +58,4 @@
.dragArea { .dragArea {
min-height: 10px; min-height: 10px;
} }

View File

@@ -3,7 +3,7 @@
<div class="panel"> <div class="panel">
<p class="caption"></p> <p class="caption"></p>
<q-input v-model="todo" inverted :float-label="$t('todo.insert')" <q-input ref="insertTask" v-model="todo" inverted :float-label="$t('todo.insert')"
:after="[{icon: 'arrow_forward', content: true, handler () {}}]" :after="[{icon: 'arrow_forward', content: true, handler () {}}]"
v-on:keyup.enter="insertTodo"/> v-on:keyup.enter="insertTodo"/>

View File

@@ -140,6 +140,10 @@
margin-top: 5%; margin-top: 5%;
} }
.fixed-left:hover{
cursor: ew-resize;
}
footer { footer {
small { small {
color: red; color: red;