Compare commits

..

1 Commits

Author SHA1 Message Date
Snigdha Snigdha
fa4107ebbf fix: comsole error 2020-01-09 13:37:22 +05:30
9 changed files with 7500 additions and 77 deletions

View File

@@ -1,3 +0,0 @@
{
"json.format.enable": false
}

View File

@@ -1,16 +1,14 @@
/* eslint-disable react/sort-prop-types */
/* eslint-disable space-before-function-paren */
import React from 'react';
import PropTypes from 'prop-types';
import Tooltip from '../tooltip/index.jsx';
class DataCell extends React.PureComponent {
constructor(props) {
constructor (props) {
super(props);
this.handleSelect = this.handleSelect.bind(this);
}
handleSelect() {
handleSelect () {
const {
data: {
meta: {
@@ -28,14 +26,14 @@ class DataCell extends React.PureComponent {
if (!allowFilteringByClick) {
return;
}
// fixes the console error on selection made from data cells
component.selectValues(0, [measurement.parents.dimension1.elementNumber], false);
if (hasSecondDimension) {
component.selectValues(1, [measurement.parents.dimension2.elementNumber], false);
}
}
render() {
render () {
const {
cellWidth,
measurement,
@@ -43,9 +41,9 @@ class DataCell extends React.PureComponent {
styling
} = this.props;
const textAlignment = styling.options.textAlignment || 'Right';
let textAlignment = styling.options.textAlignment || 'Right';
const cellStyle = {
let cellStyle = {
fontFamily: styling.options.fontFamily,
...styleBuilder.getStyle(),
paddingLeft: '5px',
@@ -66,10 +64,10 @@ class DataCell extends React.PureComponent {
const { conditionalColoring } = styling;
if (conditionalColoring.enabled) {
const isValidConditionalColoringValue = !styleBuilder.hasComments() && !isNaN(measurement.value);
const isSpecifiedRow
= conditionalColoring.rows.indexOf(measurement.parents.dimension1.header) !== -1;
const isSpecifiedMeasure
= conditionalColoring.measures.indexOf(measurement.parents.measurement.index) !== -1;
const isSpecifiedRow =
conditionalColoring.rows.indexOf(measurement.parents.dimension1.header) !== -1;
const isSpecifiedMeasure =
conditionalColoring.measures.indexOf(measurement.parents.measurement.index) !== -1;
const shouldHaveConditionalColoring = (conditionalColoring.colorAllRows || isSpecifiedRow)
&& (conditionalColoring.colorAllMeasures || isSpecifiedMeasure);
if (isValidConditionalColoringValue && shouldHaveConditionalColoring) {
@@ -114,7 +112,7 @@ DataCell.propTypes = {
}).isRequired,
component: PropTypes.shape({
backendApi: PropTypes.shape({
selectValues (props, propName) {
selectValues: function (props, propName) {
if (props.isSnapshot || typeof props[propName] === 'function') {
return null;
}
@@ -132,7 +130,7 @@ DataCell.propTypes = {
export default DataCell;
function formatMeasurementValue(measurement, styling) {
function formatMeasurementValue (measurement, styling) {
if (isNaN(measurement.value)) {
return styling.symbolForNulls;
}
@@ -140,7 +138,7 @@ function formatMeasurementValue(measurement, styling) {
return measurement.displayValue;
}
function getConditionalColor(measurement, conditionalColoring) {
function getConditionalColor (measurement, conditionalColoring) {
if (measurement.value < conditionalColoring.threshold.poor) {
return conditionalColoring.colors.poor;
}

View File

@@ -33,34 +33,27 @@ class DataTable extends React.PureComponent {
};
const renderMeasurementData = (dimIndex, atEvery) => {
const injectSeparatorsArray = injectSeparators(
matrix[dimIndex],
columnSeparatorWidth,
atEvery
);
if (dimension2.length <= 0) {
return injectSeparators(
matrix[dimIndex],
columnSeparatorWidth,
atEvery
);
return injectSeparatorsArray;
}
const measurementDataRow = [];
let index = 0,
match;
dimension2.forEach(dim2 => {
dimension2.forEach((dim2) => {
measurements.forEach((measure, mesInd) => {
for (index = 0; index < matrix[dimIndex].length; index++) {
for (index = 0; index < injectSeparatorsArray.length; index++) {
match = false;
if (
matrix[dimIndex][index].parents &&
dimension1[dimIndex].displayValue ===
matrix[dimIndex][index].parents.dimension1.header
) {
if (
dim2.displayValue ===
matrix[dimIndex][index].parents.dimension2.header
) {
if (
measure.name ===
matrix[dimIndex][index].parents.measurement.header
) {
measurementDataRow.push(matrix[dimIndex][index]);
if (injectSeparatorsArray[index].parents && 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]);
match = true;
break;
}
@@ -69,7 +62,7 @@ class DataTable extends React.PureComponent {
}
if (!match) {
measurementDataRow.push({
displayValue: "",
displayValue: '',
parents: {
dimension1: {
elementNumber: dimension1[dimIndex].elementNumber,
@@ -88,14 +81,9 @@ class DataTable extends React.PureComponent {
}
});
});
return injectSeparators(
measurementDataRow,
columnSeparatorWidth,
atEvery
);
return measurementDataRow;
};
return (
<div className="row-wrapper">
<table>

View File

@@ -10,7 +10,6 @@ class RowHeader extends React.PureComponent {
this.handleSelect = this.handleSelect.bind(this);
}
// fixes the console error on row selected values
handleSelect () {
const { component, entry } = this.props;
component.selectValues(0, [entry.elementNumber], false);
@@ -43,9 +42,13 @@ class RowHeader extends React.PureComponent {
}
RowHeader.propTypes = {
entry: PropTypes.shape({
displayValue: PropTypes.string.isRequired,
elementNumber: PropTypes.number.isRequired
}).isRequired,
component: PropTypes.shape({
backendApi: PropTypes.shape({
selectValues (props, propName) {
selectValues: function (props, propName) {
if (props.isSnapshot || typeof props[propName] === 'function') {
return null;
}
@@ -53,10 +56,6 @@ RowHeader.propTypes = {
}
}).isRequired
}).isRequired,
entry: PropTypes.shape({
displayValue: PropTypes.string.isRequired,
elementNumber: PropTypes.number.isRequired
}).isRequired,
rowStyle: PropTypes.shape({}).isRequired,
styleBuilder: PropTypes.shape({}).isRequired,
styling: PropTypes.shape({}).isRequired

View File

@@ -1,23 +1,20 @@
/* eslint-disable object-shorthand */
/* eslint-disable space-before-function-paren */
import React from 'react';
import PropTypes from 'prop-types';
import { HEADER_FONT_SIZE } from '../initialize-transformed';
import Tooltip from '../tooltip/index.jsx';
class ColumnHeader extends React.PureComponent {
constructor(props) {
constructor (props) {
super(props);
this.handleSelect = this.handleSelect.bind(this);
}
// fixes console error for column selected values
handleSelect() {
handleSelect () {
const { component, entry } = this.props;
component.selectValues(1, [entry.elementNumber], false);
}
render() {
render () {
const { baseCSS, cellWidth, colSpan, component, entry, styling } = this.props;
const inEditState = component.inEditState();
const isMediumFontSize = styling.headerOptions.fontSizeAdjustment === HEADER_FONT_SIZE.MEDIUM;

View File

@@ -115,21 +115,19 @@ export default {
return menu;
}
if (typeof (this.backendApi.model.layout.qMeta.privileges[3]) !== 'undefined' && this.backendApi.model.layout.qMeta.privileges[3] === 'exportdata') {
menu.addItem({
translation: 'Export as XLS',
tid: 'export-excel',
icon: 'export',
select: () => {
exportXLS(
this.$element,
this.$scope.layout.title,
this.$scope.layout.subtitle,
this.$scope.layout.footnote
);
}
});
}
menu.addItem({
translation: 'Export as XLS',
tid: 'export-excel',
icon: 'export',
select: () => {
exportXLS(
this.$element,
this.$scope.layout.title,
this.$scope.layout.subtitle,
this.$scope.layout.footnote
);
}
});
return menu;
},
version: 1.0

View File

@@ -33,7 +33,7 @@ class Root extends React.PureComponent {
// Determine cell- and column separator width
let cellWidth = '0px';
let columnSeparatorWidth = '';
if (this.dataTableRef && !error) {
if (this.dataTableRef) {
const tableWidth = this.dataTableRef.getBoundingClientRect().width;
this.renderedTableWidth = tableWidth;

View File

@@ -4,13 +4,11 @@ const path = require('path');
const DIST = path.resolve("./dist");
const MODE = process.env.NODE_ENV || 'development';
const SOURCE_MAP = 'sourec-map';
const DEVTOOL = (process.env.NODE_ENV === 'development') ? SOURCE_MAP : false;
console.log('Webpack mode:', MODE); // eslint-disable-line no-console
const config = {
devtool: DEVTOOL,
devtool: 'source-map',
entry: ['./src/index.js'],
externals: {
jquery: {

7448
yarn.lock Normal file

File diff suppressed because it is too large Load Diff