mirror of
https://github.com/frappe/books.git
synced 2025-02-02 20:18:26 +00:00
incr: allow edit without close
- remove bg if readonly
This commit is contained in:
parent
099324217d
commit
02825c4e9c
@ -12,14 +12,8 @@
|
|||||||
{{ df.label }}
|
{{ df.label }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="
|
class="flex items-center justify-between pr-2 rounded"
|
||||||
flex
|
:class="isReadOnly ? '' : 'focus-within:bg-gray-200'"
|
||||||
items-center
|
|
||||||
justify-between
|
|
||||||
focus-within:bg-gray-200
|
|
||||||
pr-2
|
|
||||||
rounded
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
ref="input"
|
ref="input"
|
||||||
|
@ -62,8 +62,10 @@ export default {
|
|||||||
'px-3 py-2': this.size !== 'small',
|
'px-3 py-2': this.size !== 'small',
|
||||||
'px-2 py-1': this.size === 'small',
|
'px-2 py-1': this.size === 'small',
|
||||||
},
|
},
|
||||||
'focus:outline-none focus:bg-gray-200 rounded w-full placeholder-gray-500',
|
'focus:outline-none rounded w-full placeholder-gray-500',
|
||||||
this.isReadOnly ? 'text-gray-800' : 'text-gray-900',
|
this.isReadOnly
|
||||||
|
? 'text-gray-800 focus:bg-transparent'
|
||||||
|
: 'text-gray-900 focus:bg-gray-200',
|
||||||
];
|
];
|
||||||
|
|
||||||
return this.getInputClassesFromProp(classes);
|
return this.getInputClassesFromProp(classes);
|
||||||
|
@ -172,7 +172,7 @@ export default {
|
|||||||
return 2;
|
return 2;
|
||||||
},
|
},
|
||||||
canEditRow() {
|
canEditRow() {
|
||||||
return !this.doc?.isSubmitted && this.df.edit;
|
return this.df.edit;
|
||||||
},
|
},
|
||||||
ratio() {
|
ratio() {
|
||||||
const ratio = [0.3].concat(this.tableFields.map(() => 1));
|
const ratio = [0.3].concat(this.tableFields.map(() => 1));
|
||||||
|
@ -46,7 +46,6 @@
|
|||||||
:background="false"
|
:background="false"
|
||||||
@click="openRowQuickEdit"
|
@click="openRowQuickEdit"
|
||||||
v-if="canEditRow"
|
v-if="canEditRow"
|
||||||
:disabled="isEditing"
|
|
||||||
>
|
>
|
||||||
<feather-icon name="edit" class="w-4 h-4 text-gray-600" />
|
<feather-icon name="edit" class="w-4 h-4 text-gray-600" />
|
||||||
</Button>
|
</Button>
|
||||||
@ -98,9 +97,6 @@ export default {
|
|||||||
doc: this.row,
|
doc: this.row,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
inject: {
|
|
||||||
isEditing: { default: false },
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
onChange(df, value) {
|
onChange(df, value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
:value="value"
|
:value="value"
|
||||||
:placeholder="inputPlaceholder"
|
:placeholder="inputPlaceholder"
|
||||||
style="vertical-align: top"
|
style="vertical-align: top"
|
||||||
|
:readonly="isReadOnly"
|
||||||
@blur="(e) => triggerChange(e.target.value)"
|
@blur="(e) => triggerChange(e.target.value)"
|
||||||
@focus="(e) => $emit('focus', e)"
|
@focus="(e) => $emit('focus', e)"
|
||||||
@input="(e) => $emit('input', e)"
|
@input="(e) => $emit('input', e)"
|
||||||
|
@ -188,7 +188,7 @@ export default {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.submitted) {
|
if (this.submitted || this.doc.parentdoc?.isSubmitted) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
:icon="true"
|
:icon="true"
|
||||||
v-if="!doc?.isSubmitted && !quickEditDoc && doc.enableDiscounting"
|
v-if="!doc?.isSubmitted && doc.enableDiscounting"
|
||||||
@click="toggleInvoiceSettings"
|
@click="toggleInvoiceSettings"
|
||||||
>
|
>
|
||||||
<feather-icon name="settings" class="w-4 h-4" />
|
<feather-icon name="settings" class="w-4 h-4" />
|
||||||
@ -308,6 +308,7 @@ getActionsForDocument,
|
|||||||
routeTo,
|
routeTo,
|
||||||
showMessageDialog
|
showMessageDialog
|
||||||
} from 'src/utils/ui';
|
} from 'src/utils/ui';
|
||||||
|
import { nextTick } from 'vue';
|
||||||
import { handleErrorWithDialog } from '../errorHandling';
|
import { handleErrorWithDialog } from '../errorHandling';
|
||||||
import QuickEditForm from './QuickEditForm.vue';
|
import QuickEditForm from './QuickEditForm.vue';
|
||||||
|
|
||||||
@ -328,7 +329,6 @@ export default {
|
|||||||
schemaName: this.schemaName,
|
schemaName: this.schemaName,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
doc: computed(() => this.doc),
|
doc: computed(() => this.doc),
|
||||||
isEditing: computed(() => !!this.quickEditDoc),
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -413,7 +413,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
routeTo,
|
routeTo,
|
||||||
toggleInvoiceSettings() {
|
toggleInvoiceSettings() {
|
||||||
if (this.quickEditDoc || !this.schemaName) {
|
if (!this.schemaName) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,7 +423,13 @@ export default {
|
|||||||
|
|
||||||
this.toggleQuickEditDoc(this.doc, fields);
|
this.toggleQuickEditDoc(this.doc, fields);
|
||||||
},
|
},
|
||||||
toggleQuickEditDoc(doc, fields = []) {
|
async toggleQuickEditDoc(doc, fields = []) {
|
||||||
|
if (this.quickEditDoc && doc) {
|
||||||
|
this.quickEditDoc = null;
|
||||||
|
this.quickEditFields = [];
|
||||||
|
await nextTick();
|
||||||
|
}
|
||||||
|
|
||||||
this.quickEditDoc = doc;
|
this.quickEditDoc = doc;
|
||||||
this.quickEditFields = fields;
|
this.quickEditFields = fields;
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user