2
0
mirror of https://github.com/frappe/books.git synced 2024-11-09 23:30:56 +00:00

refactor: markRaw pesa objects

- remove native clicks
This commit is contained in:
18alantom 2022-02-11 14:30:39 +05:30
parent 3d9344a0ed
commit 9f65a9ba9e
4 changed files with 25 additions and 22 deletions

View File

@ -56,9 +56,12 @@ module.exports = {
display = parseInt(display);
}
const moneyMaker = getMoneyMaker({ currency, precision, display });
// Pesa uses private fields, Vue does deep conversions to Proxy, ∴
this.pesa = (...args) => markRaw(moneyMaker(...args));
this.pesa = getMoneyMaker({
currency,
precision,
display,
wrapper: markRaw,
});
},
init(force) {

View File

@ -9,7 +9,7 @@
:class="{
'px-2 py-3': size === 'small',
'px-3 py-4': size !== 'small',
'text-right': isNumeric(df)
'text-right': isNumeric(df),
}"
v-for="df in tableFields"
:key="df.fieldname"
@ -31,7 +31,7 @@
:ratio="ratio"
class="text-gray-500 cursor-pointer border-transparent px-2 w-full"
v-if="!isReadOnly"
@click.native="addRow"
@click="addRow"
>
<div class="flex items-center pl-1">
<feather-icon name="plus" class="w-4 h-4 text-gray-500" />
@ -40,7 +40,7 @@
class="flex justify-between"
:class="{
'px-2 py-3': size === 'small',
'px-3 py-4': size !== 'small'
'px-3 py-4': size !== 'small',
}"
>
{{ t('Add Row') }}
@ -50,7 +50,7 @@
class="text-right"
:class="{
'px-2 py-3': size === 'small',
'px-3 py-4': size !== 'small'
'px-3 py-4': size !== 'small',
}"
v-if="maxRowsBeforeOverflow && value.length > maxRowsBeforeOverflow"
>
@ -71,15 +71,15 @@ export default {
extends: Base,
props: {
showHeader: {
default: true
default: true,
},
maxRowsBeforeOverflow: {
default: 0
}
default: 0,
},
},
components: {
Row,
TableRow
TableRow,
},
data: () => ({ rowContainerHeight: null }),
watch: {
@ -95,8 +95,8 @@ export default {
this.rowContainerHeight = `${containerHeight}px`;
});
}
}
}
},
},
},
methods: {
focus() {},
@ -109,13 +109,13 @@ export default {
},
removeRow(row) {
let rows = this.value || [];
rows = rows.filter(_row => _row !== row);
rows = rows.filter((_row) => _row !== row);
this.triggerChange(rows);
},
scrollToRow(index) {
let row = this.$refs['table-row'][index];
row && row.$el.scrollIntoView({ block: 'nearest' });
}
},
},
computed: {
ratio() {
@ -123,8 +123,8 @@ export default {
},
tableFields() {
let meta = frappe.getMeta(this.df.childtype);
return meta.tableFields.map(fieldname => meta.getField(fieldname));
}
}
return meta.tableFields.map((fieldname) => meta.getField(fieldname));
},
},
};
</script>

View File

@ -31,7 +31,7 @@
<Row
gap="1rem"
class="cursor-pointer text-gray-900 flex-1"
@click.native="openForm(doc)"
@click="openForm(doc)"
:columnCount="columns.length"
>
<ListCell

View File

@ -8564,9 +8564,9 @@ performance-now@^2.1.0:
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
pesa@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/pesa/-/pesa-1.1.3.tgz#cddd43b02a1db55cd6fb7b220257d33a268588a4"
integrity sha512-WcgR2zb5h8h+k9JQb+xkLsYkdMuoxqKgqWm5uTcbi3EGNg3r0tfzcvIBpRYLtZ6TtICbyCRZxWi0WXCh5jSw0A==
version "1.1.6"
resolved "https://registry.yarnpkg.com/pesa/-/pesa-1.1.6.tgz#a123dc7a31c977bbfb6dbbee14a9913c8385cd0f"
integrity sha512-EDs4Tj8QX7hZITkKhfHeVT/9oQRqRPyF3pVet1FqGX94/zkcqreBYb94ojUVrzZmir26+IHaKyCpTB6eqC04uw==
pg-connection-string@2.5.0:
version "2.5.0"