2
0
mirror of https://github.com/frappe/books.git synced 2024-11-12 16:36:27 +00:00

fix(ui): scroll when readonly

This commit is contained in:
18alantom 2022-07-07 17:52:14 +05:30 committed by Alan
parent 4723d169f9
commit d268255c4a
5 changed files with 11 additions and 15 deletions

View File

@ -29,8 +29,8 @@
:value="linkValue"
:placeholder="inputPlaceholder"
:readonly="isReadOnly"
@focus="(e) => onFocus(e, toggleDropdown)"
@blur="(e) => onBlur(e.target.value)"
@focus="(e) => !isReadOnly && onFocus(e, toggleDropdown)"
@blur="(e) => !isReadOnly && onBlur(e.target.value)"
@input="onInput"
@keydown.up="highlightItemUp"
@keydown.down="highlightItemDown"
@ -189,6 +189,10 @@ export default {
}
},
onInput(e) {
if (this.isReadOnly) {
return;
}
this.toggleDropdown(true);
this.updateSuggestions(e.target.value);
},

View File

@ -13,9 +13,9 @@
:readonly="isReadOnly"
:max="df.maxvalue"
:min="df.minvalue"
@blur="(e) => triggerChange(e.target.value)"
@focus="(e) => $emit('focus', e)"
@input="(e) => $emit('input', e)"
@blur="(e) => !isReadOnly && triggerChange(e.target.value)"
@focus="(e) => !isReadOnly && $emit('focus', e)"
@input="(e) => !isReadOnly && $emit('input', e)"
/>
</div>
</template>
@ -61,7 +61,6 @@ export default {
{
'px-3 py-2': this.size !== 'small',
'px-2 py-1': this.size === 'small',
'pointer-events-none': this.isReadOnly,
},
'focus:outline-none focus:bg-gray-200 rounded w-full placeholder-gray-400',
this.isReadOnly ? 'text-gray-800' : 'text-gray-900',

View File

@ -33,7 +33,6 @@
>
<TableRow
v-for="row in value"
:class="{ 'pointer-events-none': isReadOnly }"
ref="table-row"
:key="row.name"
v-bind="{ row, tableFields, size, ratio, isNumeric }"

View File

@ -15,14 +15,14 @@
>
<!-- Index or Remove button -->
<div class="flex items-center pl-2 text-gray-600">
<span class="hidden group-hover:inline-block">
<span class="hidden" :class="{ 'group-hover:inline-block': !readOnly }">
<feather-icon
name="x"
class="w-4 h-4 -ml-1 cursor-pointer"
@click="$emit('remove')"
/>
</span>
<span class="group-hover:hidden">
<span :class="{ 'group-hover:hidden': !readOnly }">
{{ row.idx + 1 }}
</span>
</div>

View File

@ -53,7 +53,6 @@
class="bg-gray-100 rounded"
input-class="p-2 text-base bg-transparent"
:read-only="!doc.notInserted || doc.submitted"
:class="doc.submitted && 'pointer-events-none'"
/>
<FormControl
:df="getField('date')"
@ -62,7 +61,6 @@
@change="(value) => doc.set('date', value)"
input-class="bg-gray-100 px-3 py-2 text-base"
:read-only="doc.submitted"
:class="doc.submitted && 'pointer-events-none'"
/>
<FormControl
:df="getField('entryType')"
@ -71,7 +69,6 @@
@change="(value) => doc.set('entryType', value)"
input-class="bg-gray-100 px-3 py-2 text-base"
:read-only="doc.submitted"
:class="doc.submitted && 'pointer-events-none'"
/>
<FormControl
:df="getField('referenceNumber')"
@ -80,7 +77,6 @@
@change="(value) => doc.set('referenceNumber', value)"
input-class="bg-gray-100 p-2 text-base"
:read-only="doc.submitted"
:class="doc.submitted && 'pointer-events-none'"
/>
<FormControl
:df="getField('referenceDate')"
@ -89,7 +85,6 @@
@change="(value) => doc.set('referenceDate', value)"
input-class="bg-gray-100 px-3 py-2 text-base"
:read-only="doc.submitted"
:class="doc.submitted && 'pointer-events-none'"
/>
</div>
<hr />
@ -117,7 +112,6 @@
:df="getField('userRemark')"
:value="doc.userRemark"
@change="(value) => doc.set('userRemark', value)"
:class="doc.submitted && 'pointer-events-none'"
:read-only="doc.submitted"
/>