From c681126d15a860bf8df86c6e3b6bcfda60829dfa Mon Sep 17 00:00:00 2001 From: smcgrath0 Date: Thu, 3 Sep 2020 15:00:54 -0700 Subject: [PATCH] #156 added row alignment --- .../themecleanflex/models/DatalistModel.java | 31 +++++++++++++++++++ fragments/datalist/hatch.js | 14 ++++++++- fragments/datalist/model.json | 21 +++++++++++++ fragments/datalist/template.vue | 24 ++++++++++++-- .../components/datalist/dialog.json | 20 ++++++++++++ .../components/datalist/template.vue | 24 ++++++++++++-- .../etc/felibs/themecleanflex/css/build.css | 8 +++++ 7 files changed, 137 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/themecleanflex/models/DatalistModel.java b/core/src/main/java/com/themecleanflex/models/DatalistModel.java index b13696f8d..55bacdf63 100644 --- a/core/src/main/java/com/themecleanflex/models/DatalistModel.java +++ b/core/src/main/java/com/themecleanflex/models/DatalistModel.java @@ -84,6 +84,27 @@ } } }, + "rowalignment": { + "type": "string", + "x-source": "inject", + "x-form-label": "Row alignment", + "x-form-type": "materialselect", + "x-default": "top", + "properties": { + "top": { + "x-form-name": "top", + "x-form-value": "top" + }, + "center": { + "x-form-name": "center", + "x-form-value": "center" + }, + "bottom": { + "x-form-name": "bottom", + "x-form-value": "bottom" + } + } + }, "stripedrows": { "type": "string", "x-source": "inject", @@ -484,6 +505,11 @@ public class DatalistModel extends AbstractComponent { @Inject private List columns; + /* {"type":"string","x-source":"inject","x-form-label":"Row alignment","x-form-type":"materialselect","x-default":"top","properties":{"top":{"x-form-name":"top","x-form-value":"top"},"center":{"x-form-name":"center","x-form-value":"center"},"bottom":{"x-form-name":"bottom","x-form-value":"bottom"}}} */ + @Inject + @Default(values ="top") + private String rowalignment; + /* {"type":"string","x-source":"inject","x-form-label":"Striped Rows","x-form-type":"materialswitch","x-default":false} */ @Inject private String stripedrows; @@ -652,6 +678,11 @@ public List getColumns() { return columns; } + /* {"type":"string","x-source":"inject","x-form-label":"Row alignment","x-form-type":"materialselect","x-default":"top","properties":{"top":{"x-form-name":"top","x-form-value":"top"},"center":{"x-form-name":"center","x-form-value":"center"},"bottom":{"x-form-name":"bottom","x-form-value":"bottom"}}} */ + public String getRowalignment() { + return rowalignment; + } + /* {"type":"string","x-source":"inject","x-form-label":"Striped Rows","x-form-type":"materialswitch","x-default":false} */ public String getStripedrows() { return stripedrows; diff --git a/fragments/datalist/hatch.js b/fragments/datalist/hatch.js index 4c25d2133..6dda8e8aa 100644 --- a/fragments/datalist/hatch.js +++ b/fragments/datalist/hatch.js @@ -35,7 +35,16 @@ module.exports = { f.mapField(mobileTd, 'data[col.value]', false) mobileTr.prepend("{{col.header}}") - f.bindAttribute($.find('.mobile-table td'), 'class', `{ 'border': model.cellborders === 'true', 'p-3': model.densetable !== 'true', 'p-1': model.densetable === 'true'}`, false) + + const mobileTdClasses = `{ + 'border': model.cellborders === 'true', + 'p-3': model.densetable !== 'true', + 'p-1': model.densetable === 'true', + 'align-top': model.rowalignment === 'top' || model.rowalignment === '', + 'align-center': model.rowalignment === 'center', + 'align-bottom': model.rowalignment === 'bottom' + }` + f.bindAttribute($.find('.mobile-table td'), 'class', mobileTdClasses, false) const table = $.find('table') const tableClasses = `{ @@ -81,6 +90,9 @@ module.exports = { 'text-left': (col && col.textalignment === 'left') || (col && col.textalignment === ''), 'text-center': col && col.textalignment === 'center', 'text-right': col && col.textalignment === 'right', + 'align-top': model.rowalignment === 'top' || model.rowalignment === '', + 'align-center': model.rowalignment === 'center', + 'align-bottom': model.rowalignment === 'bottom' }` f.bindAttribute(tdItem, 'class', tdClasses, false) f.addStyle(tdItem, 'background', "active[j] ? 'var(--color-red-500) !important' : ''") diff --git a/fragments/datalist/model.json b/fragments/datalist/model.json index aed856005..6d247b6a5 100644 --- a/fragments/datalist/model.json +++ b/fragments/datalist/model.json @@ -67,6 +67,27 @@ } } }, + "rowalignment": { + "type": "string", + "x-source": "inject", + "x-form-label": "Row alignment", + "x-form-type": "materialselect", + "x-default": "top", + "properties":{ + "top": { + "x-form-name": "top", + "x-form-value": "top" + }, + "center": { + "x-form-name": "center", + "x-form-value": "center" + }, + "bottom": { + "x-form-name": "bottom", + "x-form-value": "bottom" + } + } + }, "stripedrows": { "type": "string", "x-source": "inject", diff --git a/fragments/datalist/template.vue b/fragments/datalist/template.vue index 7185ee1f4..cc4d386a1 100644 --- a/fragments/datalist/template.vue +++ b/fragments/datalist/template.vue @@ -70,6 +70,9 @@ 'text-left': (col && col.textalignment === 'left') || (col && col.textalignment === ''), 'text-center': col && col.textalignment === 'center', 'text-right': col && col.textalignment === 'right', + 'align-top': model.rowalignment === 'top' || model.rowalignment === '', + 'align-center': model.rowalignment === 'center', + 'align-bottom': model.rowalignment === 'bottom' }"> @@ -91,6 +94,9 @@ 'text-left': (col && col.textalignment === 'left') || (col && col.textalignment === ''), 'text-center': col && col.textalignment === 'center', 'text-right': col && col.textalignment === 'right', + 'align-top': model.rowalignment === 'top' || model.rowalignment === '', + 'align-center': model.rowalignment === 'center', + 'align-bottom': model.rowalignment === 'bottom' }" v-bind:style="`background:${active[j] ? 'var(--color-red-500) !important' : ''};`"> {{data[col.value]}} @@ -114,9 +120,23 @@ }"> - {{col.header}} + {{col.header}} {{data[col.value]}} + v-bind:class="{ + 'border': model.cellborders === 'true', + 'p-3': model.densetable !== 'true', + 'p-1': model.densetable === 'true', + 'align-top': model.rowalignment === 'top' || model.rowalignment === '', + 'align-center': model.rowalignment === 'center', + 'align-bottom': model.rowalignment === 'bottom' + }">{{data[col.value]}} @@ -91,6 +94,9 @@ 'text-left': (col && col.textalignment === 'left') || (col && col.textalignment === ''), 'text-center': col && col.textalignment === 'center', 'text-right': col && col.textalignment === 'right', + 'align-top': model.rowalignment === 'top' || model.rowalignment === '', + 'align-center': model.rowalignment === 'center', + 'align-bottom': model.rowalignment === 'bottom' }" v-bind:style="`background:${active[j] ? 'var(--color-red-500) !important' : ''};`"> {{data[col.value]}} @@ -114,9 +120,23 @@ }"> - {{col.header}} + {{col.header}} {{data[col.value]}} + v-bind:class="{ + 'border': model.cellborders === 'true', + 'p-3': model.densetable !== 'true', + 'p-1': model.densetable === 'true', + 'align-top': model.rowalignment === 'top' || model.rowalignment === '', + 'align-center': model.rowalignment === 'center', + 'align-bottom': model.rowalignment === 'bottom' + }">{{data[col.value]}}