Compare commits

...

8 Commits

Author SHA1 Message Date
Purwa Shrivastava
8aa86275f0 Changed the rendering of each data cell to check for the headers of each dimesnsion and measure where it shall be written. 2019-12-04 11:15:14 +01:00
Purwa Shrivastava
3ebc2b9e29 Adding Dim 2 to the rendering logic. 2019-11-29 16:17:49 +01:00
Purwa Shrivastava
ce81549011 Merge pull request #78 from qlik-oss/QB-498/disableConversion
Conversion led to different sort orders of data in different objects …
2019-11-28 13:40:45 +01:00
Purwa Shrivastava
e64af66dab Conversion led to different sort orders of data in different objects so disabling it. 2019-11-27 14:54:42 +01:00
Philip Olsén
ca1b1a9b53 Merge pull request #75 from qlik-oss/pol/bd
Update black duck link
2019-09-20 15:33:56 +02:00
Philip Olsén
a65f843008 Update black duck link 2019-09-20 14:23:37 +02:00
Purwa Shrivastava
be9570e0aa Merge pull request #74 from qlik-oss/atq/about
Updated the About info for the smart pivot.
2019-07-12 12:40:29 +02:00
Purwa Shrivastava
41d3a7c9af Updated the About info for the smart pivot. 2019-07-11 11:01:42 +02:00
5 changed files with 53 additions and 18 deletions

View File

@@ -20,7 +20,7 @@ jobs:
command: npm install command: npm install
- run: - run:
name: BlackDuck scan name: BlackDuck scan
command: curl -s https://blackducksoftware.github.io/hub-detect/hub-detect.sh | bash -s -- \ command: curl -s https://detect.synopsys.com/detect.sh | bash -s -- \
--blackduck.url="https://qliktech.blackducksoftware.com" \ --blackduck.url="https://qliktech.blackducksoftware.com" \
--blackduck.trust.cert=true \ --blackduck.trust.cert=true \
--blackduck.username="svc-blackduck" \ --blackduck.username="svc-blackduck" \

View File

@@ -5,6 +5,7 @@ import DataCell from './data-cell.jsx';
import RowHeader from './row-header.jsx'; import RowHeader from './row-header.jsx';
import { injectSeparators } from '../utilities'; import { injectSeparators } from '../utilities';
// eslint-disable-next-line react/prefer-stateless-function
class DataTable extends React.PureComponent { class DataTable extends React.PureComponent {
render () { render () {
const { const {
@@ -20,6 +21,7 @@ class DataTable extends React.PureComponent {
const { const {
headers: { headers: {
dimension1, dimension1,
dimension2,
measurements measurements
}, },
matrix matrix
@@ -30,6 +32,36 @@ class DataTable extends React.PureComponent {
maxWidth: columnSeparatorWidth maxWidth: columnSeparatorWidth
}; };
const renderMeasurementData = (dimIndex, atEvery) => {
const injectSeparatorsArray = injectSeparators(
matrix[dimIndex],
columnSeparatorWidth,
atEvery
);
if (dimension2.length <= 0) {
return injectSeparatorsArray;
}
let measurementDataRow = [],
index = 0;
dimension2.forEach((dim2) => {
measurements.forEach((measure) => {
for (index = 0; index < injectSeparatorsArray.length; index++) {
if (dimension1[dimIndex].displayValue === injectSeparatorsArray[index].parents.dimension1.header) {
if (dim2.displayValue === injectSeparatorsArray[index].parents.dimension2.header) {
if (measure.name === injectSeparatorsArray[index].parents.measurement.header) {
measurementDataRow.push(injectSeparatorsArray[index]);
break;
}
}
}
}
});
});
return measurementDataRow;
};
return ( return (
<div className="row-wrapper"> <div className="row-wrapper">
<table> <table>
@@ -65,11 +97,7 @@ class DataTable extends React.PureComponent {
styling={styling} styling={styling}
/> : null /> : null
} }
{renderData && injectSeparators( {renderData && renderMeasurementData(dimensionIndex, { atEvery: measurements.length }).map((measurementData, index) => {
matrix[dimensionIndex],
columnSeparatorWidth,
{ atEvery: measurements.length }
).map((measurementData, index) => {
if (measurementData.isSeparator) { if (measurementData.isSeparator) {
return ( return (
<td <td
@@ -80,6 +108,7 @@ class DataTable extends React.PureComponent {
); );
} }
// eslint-disable-next-line no-shadow
const { dimension1: dimension1Info, dimension2, measurement } = measurementData.parents; const { dimension1: dimension1Info, dimension2, measurement } = measurementData.parents;
const id = `${dimension1Info.elementNumber}-${dimension2 && dimension2.elementNumber}-${measurement.header}-${measurement.index}`; const id = `${dimension1Info.elementNumber}-${dimension2 && dimension2.elementNumber}-${measurement.header}-${measurement.index}`;
return ( return (
@@ -112,6 +141,7 @@ DataTable.defaultProps = {
DataTable.propTypes = { DataTable.propTypes = {
cellWidth: PropTypes.string.isRequired, cellWidth: PropTypes.string.isRequired,
columnSeparatorWidth: PropTypes.string.isRequired, columnSeparatorWidth: PropTypes.string.isRequired,
component: PropTypes.shape({}).isRequired,
data: PropTypes.shape({ data: PropTypes.shape({
headers: PropTypes.shape({ headers: PropTypes.shape({
dimension1: PropTypes.array.isRequired dimension1: PropTypes.array.isRequired
@@ -119,7 +149,6 @@ DataTable.propTypes = {
matrix: PropTypes.arrayOf(PropTypes.array.isRequired).isRequired matrix: PropTypes.arrayOf(PropTypes.array.isRequired).isRequired
}).isRequired, }).isRequired,
general: PropTypes.shape({}).isRequired, general: PropTypes.shape({}).isRequired,
component: PropTypes.shape({}).isRequired,
renderData: PropTypes.bool, renderData: PropTypes.bool,
styling: PropTypes.shape({ styling: PropTypes.shape({
hasCustomFileStyle: PropTypes.bool.isRequired hasCustomFileStyle: PropTypes.bool.isRequired

View File

@@ -39,7 +39,7 @@ const definition = {
component: 'text' component: 'text'
}, },
paragraph1: { paragraph1: {
label: `P&L pivot is a Qlik Sense extension which allows you to display Profit & Loss label: `P&L pivot is a Qlik Sense chart which allows you to display Profit & Loss
reporting with color and font customizations.`, reporting with color and font customizations.`,
component: 'text' component: 'text'
}, },

View File

@@ -35,6 +35,9 @@ export default {
uses: 'measures' uses: 'measures'
} }
}, },
// Prevent conversion from and to this object
exportProperties: null,
importProperties: null,
definition, definition,
initialProperties: { initialProperties: {
version: 1.0, version: 1.0,
@@ -47,7 +50,6 @@ export default {
} }
], ],
qMeasures: [], qMeasures: [],
qSuppressMissing: true,
qSuppressZero: false qSuppressZero: false
} }
}, },

View File

@@ -64,7 +64,8 @@ function generateMatrixCell ({ cell, dimension1Information, dimension2Informatio
if (dimension2Information) { if (dimension2Information) {
matrixCell.parents.dimension2 = { matrixCell.parents.dimension2 = {
elementNumber: dimension2Information.qElemNumber elementNumber: dimension2Information.qElemNumber,
header: dimension2Information.qText
}; };
} }
@@ -141,7 +142,7 @@ function generateDataSet (
let rowDataIndex = 0; let rowDataIndex = 0;
dimension2.forEach(dim => { dimension2.forEach(dim => {
rowDataIndex = appendMissingCells( rowDataIndex = appendMissingCells(
row, newRow, rowDataIndex, measurements, rowIndex, dim.elementNumber); row, newRow, rowDataIndex, measurements, rowIndex, dim, dimension1);
}); });
} else { } else {
appendMissingCells(row, newRow, 0, measurements, rowIndex); appendMissingCells(row, newRow, 0, measurements, rowIndex);
@@ -165,14 +166,11 @@ function generateDataSet (
* index of the dimension2 value being processed. * index of the dimension2 value being processed.
*/ */
function appendMissingCells ( function appendMissingCells (
sourceRow, destRow, sourceIndex, measurements, dim1ElementNumber, dim2ElementNumber = -1) { sourceRow, destRow, sourceIndex, measurements, matrixIndex, dim2, dim1) {
let index = sourceIndex; let index = sourceIndex;
measurements.forEach((measurement, measureIndex) => { measurements.forEach((measurement, measureIndex) => {
if (index < sourceRow.length if (index < sourceRow.length) {
&& (dim2ElementNumber === -1
|| sourceRow[index].parents.dimension2.elementNumber === dim2ElementNumber)
&& sourceRow[index].parents.measurement.header === measurement.name) {
// Source contains the expected cell // Source contains the expected cell
destRow.push(sourceRow[index]); destRow.push(sourceRow[index]);
index++; index++;
@@ -181,8 +179,14 @@ function appendMissingCells (
destRow.push({ destRow.push({
displayValue: '', displayValue: '',
parents: { parents: {
dimension1: { elementNumber: dim1ElementNumber }, dimension1: {
dimension2: { elementNumber: dim2ElementNumber }, elementNumber: dim1[matrixIndex].elementNumber,
header: dim1[matrixIndex].displayValue
},
dimension2: {
elementNumber: dim2.elementNumber,
header: dim2.displayValue
},
measurement: { measurement: {
header: measurement.name, header: measurement.name,
index: measureIndex index: measureIndex