From 3c330465dd332e0d4471559ecc5fe51608788cdb Mon Sep 17 00:00:00 2001 From: ahmed-Bazzara Date: Tue, 12 Feb 2019 12:03:05 +0100 Subject: [PATCH 1/6] Definition object is Qlik standard --- src/definition/index.js | 19 ++++++++++--------- src/index.js | 12 ++++++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/definition/index.js b/src/definition/index.js index fd6a2a9..9352f61 100644 --- a/src/definition/index.js +++ b/src/definition/index.js @@ -9,15 +9,16 @@ import pijamaColorLibrary from './pijama-color-library'; const definition = { component: 'accordion', items: { - dimensions: { - max: 2, - min: 1, - uses: 'dimensions' - }, - measures: { - max: 9, - min: 1, - uses: 'measures' + data: { + items: { + dimensions: { + disabledRef: '' + }, + measures: { + disabledRef: '' + } + }, + uses: 'data' }, settings: { items: { diff --git a/src/index.js b/src/index.js index 0ead03a..e173730 100644 --- a/src/index.js +++ b/src/index.js @@ -12,6 +12,18 @@ export default { '$timeout', function () { } ], + data: { + dimensions: { + max: 2, + min: 1, + uses: 'dimensions' + }, + measures: { + max: 9, + min: 1, + uses: 'measures' + } + }, definition, initialProperties: { qHyperCubeDef: { From c47b401a1db770dc344a2278ba6ff486cd583bc2 Mon Sep 17 00:00:00 2001 From: ahmed-Bazzara Date: Tue, 12 Feb 2019 12:05:01 +0100 Subject: [PATCH 2/6] typo in definiton object --- src/definition/header.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/definition/header.js b/src/definition/header.js index ebf830a..fd61a63 100644 --- a/src/definition/header.js +++ b/src/definition/header.js @@ -27,7 +27,7 @@ const header = { ref: 'HeaderColorSchema', type: 'string', component: 'dropdown', - label: 'BackGround Header Color', + label: 'Background Header Color', options: [ { value: 'Clean', From db67b864ee84e9d91ff2d14f55ff7b244716d4a5 Mon Sep 17 00:00:00 2001 From: ahmed-Bazzara Date: Thu, 14 Feb 2019 13:54:17 +0100 Subject: [PATCH 3/6] edit mode interaction prevented --- src/main.less | 4 +++- src/paint.jsx | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.less b/src/main.less index 9f96728..e836cbb 100644 --- a/src/main.less +++ b/src/main.less @@ -1,7 +1,9 @@ .qv-object-qlik-smart-pivot { @TableBorder: 1px solid #d3d3d3; @KpiTableWidth: 230px; - + .edit-mode{ + pointer-events: none; + } ._cell(@Width: 50px) { min-width: @Width!important; max-width: @Width!important; diff --git a/src/paint.jsx b/src/paint.jsx index f16a912..e750dfb 100644 --- a/src/paint.jsx +++ b/src/paint.jsx @@ -11,10 +11,10 @@ export default async function paint ($element, layout, component) { component, layout }); - + const editmodeClass = component.inAnalysisState() ? '' : 'edit-mode'; const jsx = ( -
+
-
+
Date: Mon, 18 Feb 2019 16:42:39 +0100 Subject: [PATCH 4/6] Text alignment property added --- src/data-table/data-cell.jsx | 14 ++++++++++++-- src/definition/formatted.js | 20 ++++++++++++++++++++ src/initialize-transformed.js | 3 ++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/data-table/data-cell.jsx b/src/data-table/data-cell.jsx index adde657..deb216b 100644 --- a/src/data-table/data-cell.jsx +++ b/src/data-table/data-cell.jsx @@ -90,12 +90,22 @@ class DataCell extends React.PureComponent { if (styleBuilder.hasComments()) { formattedMeasurementValue = '.'; } + let textAlignment = 'Right'; + const textAlignmentProp = styling.options.textAlignment; + + if (textAlignmentProp === 1) { + textAlignment = 'Left'; + } else if (textAlignmentProp === 2) { + textAlignment = 'Center'; + } else { + textAlignment = 'Right'; + } let cellStyle = { fontFamily: styling.options.fontFamily, ...styleBuilder.getStyle(), paddingLeft: '4px', - textAlign: 'right' + textAlign: textAlignment }; const { semaphoreColors } = styling; @@ -109,7 +119,7 @@ class DataCell extends React.PureComponent { fontFamily: styling.options.fontFamily, fontSize: styleBuilder.getStyle().fontSize, paddingLeft: '4px', - textAlign: 'right' + textAlign: textAlignment }; } diff --git a/src/definition/formatted.js b/src/definition/formatted.js index 3e1cce6..ed9d110 100644 --- a/src/definition/formatted.js +++ b/src/definition/formatted.js @@ -183,6 +183,26 @@ const formatted = { ], defaultValue: 2 }, + textAlignment: { + ref: 'cellTextAlignment', + label: 'Cell Text alignment', + component: 'buttongroup', + options: [ + { + value: 1, + label: 'Left' + }, + { + value: 2, + label: 'Center' + }, + { + value: 3, + label: 'Right' + } + ], + defaultValue: 3 + }, ColumnWidthSlider: { type: 'number', component: 'slider', diff --git a/src/initialize-transformed.js b/src/initialize-transformed.js index f5e9585..42e38cc 100644 --- a/src/initialize-transformed.js +++ b/src/initialize-transformed.js @@ -279,7 +279,8 @@ async function initializeTransformed ({ $element, layout, component }) { backgroundColorOdd: colors[`vColLib${layout.ColorSchemaP}`], color: layout.BodyTextColorSchema, fontFamily: layout.FontFamily, - fontSizeAdjustment: getFontSizeAdjustment(layout.lettersize) + fontSizeAdjustment: getFontSizeAdjustment(layout.lettersize), + textAlignment: layout.cellTextAlignment }, semaphoreColors: { fieldsToApplyTo: { From bcb9d30237ed2ab95df6c26dcf00324e4f7a72c8 Mon Sep 17 00:00:00 2001 From: ahmed-Bazzara Date: Tue, 19 Feb 2019 14:55:50 +0100 Subject: [PATCH 5/6] sending the alignment value straight from props instead of numbers --- src/data-table/data-cell.jsx | 9 ++------- src/definition/formatted.js | 8 ++++---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/data-table/data-cell.jsx b/src/data-table/data-cell.jsx index deb216b..d176fc8 100644 --- a/src/data-table/data-cell.jsx +++ b/src/data-table/data-cell.jsx @@ -92,13 +92,8 @@ class DataCell extends React.PureComponent { } let textAlignment = 'Right'; const textAlignmentProp = styling.options.textAlignment; - - if (textAlignmentProp === 1) { - textAlignment = 'Left'; - } else if (textAlignmentProp === 2) { - textAlignment = 'Center'; - } else { - textAlignment = 'Right'; + if (textAlignmentProp) { + textAlignment = textAlignmentProp; } let cellStyle = { diff --git a/src/definition/formatted.js b/src/definition/formatted.js index ed9d110..2a41478 100644 --- a/src/definition/formatted.js +++ b/src/definition/formatted.js @@ -189,19 +189,19 @@ const formatted = { component: 'buttongroup', options: [ { - value: 1, + value: 'Left', label: 'Left' }, { - value: 2, + value: 'Center', label: 'Center' }, { - value: 3, + value: 'Right', label: 'Right' } ], - defaultValue: 3 + defaultValue: 'Right' }, ColumnWidthSlider: { type: 'number', From 24edf1c6f4de5b834dcb3a9feb22454f465b6691 Mon Sep 17 00:00:00 2001 From: ahmed-Bazzara Date: Thu, 21 Feb 2019 12:02:42 +0100 Subject: [PATCH 6/6] values of text alignement property set to have lowercase --- src/definition/formatted.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/definition/formatted.js b/src/definition/formatted.js index 2a41478..5c9f266 100644 --- a/src/definition/formatted.js +++ b/src/definition/formatted.js @@ -189,19 +189,19 @@ const formatted = { component: 'buttongroup', options: [ { - value: 'Left', + value: 'left', label: 'Left' }, { - value: 'Center', + value: 'center', label: 'Center' }, { - value: 'Right', + value: 'right', label: 'Right' } ], - defaultValue: 'Right' + defaultValue: 'right' }, ColumnWidthSlider: { type: 'number',