From 6621a2c7aff2ec469de4c128dc554993b570d38a Mon Sep 17 00:00:00 2001 From: thefalconx33 Date: Fri, 19 Jul 2019 18:52:32 +0530 Subject: [PATCH] - Dynamic doctype hidden prop - Table UI Fix: Column expands when active. --- ui/components/Form/FormLayout.vue | 7 ++++- ui/components/controls/Table.vue | 47 ++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/ui/components/Form/FormLayout.vue b/ui/components/Form/FormLayout.vue index bc702ea8..0a1d1651 100644 --- a/ui/components/Form/FormLayout.vue +++ b/ui/components/Form/FormLayout.vue @@ -55,7 +55,12 @@ export default { return this.fields.find(df => df.fieldname === fieldname); }, shouldRenderField(fieldname) { - const hidden = Boolean(this.getDocField(fieldname).hidden); + let hidden; + try { + hidden = Boolean(this.getDocField(fieldname).hidden(this.doc)); + } catch (e) { + hidden = Boolean(this.getDocField(fieldname).hidden) || false; + } if (hidden) { return false; diff --git a/ui/components/controls/Table.vue b/ui/components/controls/Table.vue index 4f4adeb0..b9472af0 100644 --- a/ui/components/controls/Table.vue +++ b/ui/components/controls/Table.vue @@ -4,12 +4,10 @@ - + # - - {{ column.label }} - + {{ column.label }} @@ -20,10 +18,12 @@ type="checkbox" :checked="checkedRows.includes(i)" @change="e => onCheck(e, i)" - > + /> {{ i + 1 }} - -
+
-
- {{ row[column.fieldname] || ' ' }} -
+
{{ row[column.fieldname] || ' ' }}
@@ -57,9 +62,7 @@ -
- No Data -
+
No Data
@@ -104,7 +107,10 @@ export default { }, focusPreviousCell() { let { index, fieldname } = this.currentlyFocused; - if (this.isFocused(index, fieldname) && !this.isEditing(index, fieldname)) { + if ( + this.isFocused(index, fieldname) && + !this.isEditing(index, fieldname) + ) { let pos = this._getColumnIndex(fieldname); pos -= 1; if (pos < 0) { @@ -120,8 +126,10 @@ export default { }, focusNextCell() { let { index, fieldname } = this.currentlyFocused; - if (this.isFocused(index, fieldname) && !this.isEditing(index, fieldname)) { - + if ( + this.isFocused(index, fieldname) && + !this.isEditing(index, fieldname) + ) { let pos = this._getColumnIndex(fieldname); pos += 1; if (pos > this.columns.length - 1) { @@ -292,7 +300,7 @@ export default {