matrices: add spacing option

This commit is contained in:
jean-emmanuel 2017-07-21 20:56:27 +02:00
parent feee5a363c
commit 669de6d32e
6 changed files with 87 additions and 9 deletions

View file

@ -12,8 +12,9 @@ module.exports = class Multipush extends _matrices_base {
matrix: [2,2],
start:0,
spacing:0,
style:'style',
_style:'style',
label:'auto',
left:'auto',
@ -46,6 +47,10 @@ module.exports = class Multipush extends _matrices_base {
super(options)
this.widget[0].style.setProperty('--columns', this.getProp('matrix')[0])
this.widget[0].style.setProperty('--rows', this.getProp('matrix')[1])
this.widget[0].style.setProperty('--spacing', this.getProp('spacing') + 'rem')
var strData = JSON.stringify(options.props)
var parsers = require('../../parser'),
@ -65,7 +70,6 @@ module.exports = class Multipush extends _matrices_base {
data.css = ''
var element = parsewidgets([data],this.widget)
element[0].style.setProperty('width', 100/this.getProp('matrix')[0] + '%')
element[0].classList.add('not-editable')
this.value[i-this.start] = this.getProp('off')

View file

@ -12,6 +12,7 @@ module.exports = class Multitoggle extends _matrices_base {
matrix: [2,2],
start:0,
spacing:0,
_style:'style',
@ -46,6 +47,10 @@ module.exports = class Multitoggle extends _matrices_base {
super(options)
this.widget[0].style.setProperty('--columns', this.getProp('matrix')[0])
this.widget[0].style.setProperty('--rows', this.getProp('matrix')[1])
this.widget[0].style.setProperty('--spacing', this.getProp('spacing') + 'rem')
var strData = JSON.stringify(options.props)
var parsers = require('../../parser'),
@ -65,7 +70,6 @@ module.exports = class Multitoggle extends _matrices_base {
data.css = ''
var element = parsewidgets([data],this.widget)
element[0].style.setProperty('width', 100/this.getProp('matrix')[0] + '%')
element[0].classList.add('not-editable')
this.value[i-this.start] = this.getProp('off')

View file

@ -20,12 +20,13 @@
flex-direction: row;
padding:1rem 2rem 2rem 1rem;
> .widget {
min-height: 0;
min-width: 0;
margin:0!important;
height: auto;
// margin:0!important;
height: calc( 100% / var(--rows) - var(--spacing));
width: calc( 100% / var(--columns) - var(--spacing));
margin: calc(var(--spacing) / 2);
.label {
background:none;
border:0;