diff --git a/.eslintrc.js b/.eslintrc.js
index a98aff5..ff0eb8e 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -57,10 +57,82 @@ module.exports = {
"no-implied-eval": ["error"],
"no-debugger": ["warn"],
"no-unreachable": ["warn"],
- "quotes": ["warn", "single", { "avoidEscape": true }]
+ "quotes": ["warn", "single", { "avoidEscape": true }],
+ "sort-imports": ["off"],
+ "max-lines-per-function": ["off"], // marks the entire functions, a bit too noisy
+ "complexity": ["warn"],
+ "camelcase": ["warn"],
+ "max-statements": ["off"], // marks the entire functions, a bit too noisy
+ "sort-vars": ["warn"],
+ "init-declarations": ["off"],
+ "capitalized-comments": ["off"],
+ "one-var": ["off"],
+ "no-var": ["warn"],
+ "no-plusplus": ["warn"],
+ "vars-on-top": ["off"],
+ "no-magic-numbers": ["off"], // useful, but also complains for reasonable checks with actual numbers
+ "new-cap": ["warn"],
+ "block-scoped-var": ["warn"],
+ "require-unicode-regexp": ["off"],
+ "no-negated-condition": ["warn"],
+ "operator-assignment": ["off"],
+ "no-extra-parens": ["off"],
+ "quote-props": ["off"],
+ "prefer-template": ["warn"],
+ "no-lonely-if": ["warn"],
+ "sort-keys": ["warn"],
+ "no-implicit-coercion": ["warn"],
+ "no-inline-comments": ["warn"],
+ "spaced-comment": ["warn"],
+ "require-jsdoc": ["off"],
+ "func-style": ["off"],
+ "func-names": ["off"],
+ "id-length": ["warn"],
+ "prefer-arrow-callback": ["warn"],
+ "dot-location": ["off"],
+ "line-comment-position": ["off"],
+ "no-warning-comments": ["warn"],
+ "multiline-comment-style": ["off"],
+ "consistent-return": ["warn"],
+ "no-else-return": ["warn"],
+ "array-bracket-newline": ["warn"],
+ "array-element-newline": ["warn"],
+ "object-shorthand": ["warn"],
+ "eqeqeq": ["warn"],
+ "no-empty-function": ["warn"],
+ "function-paren-newline": ["warn"],
+ "no-invalid-this": ["warn"],
+ "newline-per-chained-call": ["warn"],
+ "no-unused-expressions": ["warn"],
+ "strict": ["warn"],
+ "no-ternary": ["off"],
+ "multiline-ternary": ["off"],
+ "no-param-reassign": ["warn"],
+ "prefer-destructuring": ["warn"],
+ "arrow-parens": ["off"],
+ "no-array-constructor": ["warn"],
+ "default-case": ["warn"],
+ "no-alert": ["warn"],
+ "max-params": ["warn"],
+ "brace-style": ["warn", "1tbs", { "allowSingleLine": true }],
+ "prefer-const": ["warn"],
+
+ // plugin:react
+ "react/jsx-indent": ["warn", 2],
+ "react/jsx-indent-props": ["warn", 2],
+ "react/forbid-prop-types": ["warn"],
+ "react/no-array-index-key": ["warn"],
+ "react/jsx-sort-props": ["warn"],
+ "react/require-default-props": ["warn"],
+ "react/sort-prop-types": ["warn"],
+ "react/jsx-max-props-per-line": ["warn"],
+ "react/jsx-no-literals": ["off"],
+ "react/jsx-max-depth": ["off"], // rule throws exception in single-dimension-measure
+ "react/jsx-filename-extension": ["warn"],
+ "react/prefer-stateless-function": ["warn"]
},
extends: [
- "eslint:recommended",
- "plugin:react/recommended"
+ "eslint:all",
+ "plugin:react/all"
]
}
diff --git a/src/else-dimension-measures.jsx b/src/else-dimension-measures.jsx
index 6fe8c0d..f06c7dd 100644
--- a/src/else-dimension-measures.jsx
+++ b/src/else-dimension-measures.jsx
@@ -38,8 +38,7 @@ class ElseDimensionMeasures extends React.PureComponent {
vMaskNum,
vColorSemaphore,
vColorSemaphoreText,
- vDivide
- ;
+ vDivide;
const measurementCells = [];
@@ -50,7 +49,7 @@ class ElseDimensionMeasures extends React.PureComponent {
for (var nMeasures22 = 1; nMeasures22 <= vNumMeasures2; nMeasures22++) {
nMeasure7++;
nMeasure72++;
- if (columnText.substring(0, 1) == '%') {
+ if (columnText.substring(0, 1) === '%') {
columnNumber = ApplyPreMask('0,00%', ConceptMatrixPivot[rowNumber][nMeasures22]);
var vSpecialF = '0,00%';
} else {
@@ -78,7 +77,7 @@ class ElseDimensionMeasures extends React.PureComponent {
var vSpecialF = MeasuresFormat[nMeasure72].replace(/k|K|m|M/gi, '');
if (!isNaN(ConceptMatrixPivot[rowNumber][nMeasures22])) {
vMaskNum = ConceptMatrixPivot[rowNumber][nMeasures22];
- if (vSpecialF.substring(vSpecialF.length - 1) == '%') {
+ if (vSpecialF.substring(vSpecialF.length - 1) === '%') {
vMaskNum = vMaskNum * 100;
}
@@ -98,19 +97,21 @@ class ElseDimensionMeasures extends React.PureComponent {
}
}
- if (vSeparatorCols && nMeasure7 == (measure_count + 1)) {
+ if (vSeparatorCols && nMeasure7 === (measure_count + 1)) {
const seperatorStyle = {
color: 'white',
fontFamily: vFontFamily,
fontSize: (12 + vLetterSize) + 'px'
};
const seperatorElement = (
-
* |
+
+ *
+ |
);
measurementCells.push(seperatorElement);
nMeasure7 = 1;
}
- if (nMeasure72 == (measure_count - 1)) {
+ if (nMeasure72 === (measure_count - 1)) {
nMeasure72 = -1;
nMeasure72Semaphore = measure_count;
} else {
@@ -145,7 +146,7 @@ class ElseDimensionMeasures extends React.PureComponent {
textAlign: 'right',
paddingLeft: '4px'
};
- if (vSpecialF.substring(vSpecialF.length - 1) == '%' && vNumMeasures > 1) {
+ if (vSpecialF.substring(vSpecialF.length - 1) === '%' && vNumMeasures > 1) {
cellElement = (
{columnNumber}
@@ -165,7 +166,7 @@ class ElseDimensionMeasures extends React.PureComponent {
textAlign: 'right',
paddingRight: '4px'
};
- if (vSpecialF.substring(vSpecialF.length - 1) == '%' && vNumMeasures > 1) {
+ if (vSpecialF.substring(vSpecialF.length - 1) === '%' && vNumMeasures > 1) {
cellElement = (
|
{columnNumber}
diff --git a/src/else-dimension-row-list.jsx b/src/else-dimension-row-list.jsx
deleted file mode 100644
index 7efcdc4..0000000
--- a/src/else-dimension-row-list.jsx
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- DO NOT USE
- should use row-list component instead, this is just left in here until testing conversion
-*/
-
-import React from 'react';
-import PropTypes from 'prop-types';
-import StyleBuilder from './style-builder';
-import ElseDimensionMeasures from './single-dimension-measures';
-
-class ElseDimensionRowList extends React.PureComponent {
- generatePaddingTextElement (hasCustomFileStyle) {
- const { vPadding, vFontFamily } = this.props;
- if (vPadding && !hasCustomFileStyle) {
- const paddingStyle = {
- marginLeft: '15px',
- fontFamily: vFontFamily
- };
- return (
-
- );
- } else {
- return null;
- }
- }
- generateRows () {
- const {
- vLetterSize,
- vCustomFileBool,
- vFontFamily,
- ConceptMatrixFirstClean,
- ConceptMatrixPivot,
- } = this.props;
-
- const rows = [];
- let columnText;
-
- var nPivotRows = ConceptMatrixFirstClean.length;
- for (var rowNumber = 0; rowNumber < nPivotRows; rowNumber++) {
- columnText = ConceptMatrixPivot[rowNumber][0];// the descriptive account text
- if (columnText != '-') {
- const styleBuilder = new StyleBuilder(this.props);
- if (vCustomFileBool) {
- styleBuilder.parseCustomFileStyle(columnText);
- } else {
- styleBuilder.applyStandardAttributes(rowNumber);
- styleBuilder.applyCustomStyle({ fontSize: (14 + vLetterSize) + 'px' });
- }
-
- const rowStyle = {
- fontFamily: vFontFamily,
- width: '230px',
- ...styleBuilder.getStyle()
- };
- const paddingTextElement = this.generatePaddingTextElement(styleBuilder.hasCustomFileStyle());
- const measurementsProps = { rowNumber, columnText, styleBuilder };
- const rowElement = (
- |
- |
- {paddingTextElement}{columnText}
- |
-
-
- );
-
- rows.push(rowElement);
- }
-
- return rows;
- }
- }
-
- render () {
- return (
-
- {this.generateRows()}
-
- );
- }
-}
-
-ElseDimensionRowList.propTypes = {};
-
-export default ElseDimensionRowList;
diff --git a/src/excel-export.js b/src/excel-export.js
index d4d8723..9734e8c 100644
--- a/src/excel-export.js
+++ b/src/excel-export.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
-const isIE = /*@cc_on!@*/false || !!document.documentMode;
-const isChrome = !!window.chrome && !!window.chrome.webstore;
+const isIE = /* @cc_on!@*/false || Boolean(document.documentMode);
+const isChrome = Boolean(window.chrome) && Boolean(window.chrome.webstore);
const isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
const isFirefox = typeof InstallTrigger !== 'undefined';
@@ -25,19 +25,21 @@ export function enableExcelExport (layout, f) {
myFootNote += '';
}
- $('.icon-xls').on('click', function () {
- $('.header-wrapper th').children('.tooltip').remove();// remove some popup effects when exporting
- $('.header-wrapper th').children('.icon-xls').remove();// remove the xls icon when exporting
+ $('.icon-xls').on('click', () => {
+ $('.header-wrapper th').children('.tooltip')
+ .remove(); // remove some popup effects when exporting
+ $('.header-wrapper th').children('.icon-xls')
+ .remove(); // remove the xls icon when exporting
if (isChrome || isSafari) {
- const $clonedDiv = $('.data-table').clone(true);//.kpi-table a secas exporta la 1ªcol
+ const $clonedDiv = $('.data-table').clone(true); // .kpi-table a secas exporta la 1ªcol
let vEncodeHead = '';
vEncodeHead += myTitle + mySubTitle + myFootNote;
const vEncode = encodeURIComponent($clonedDiv.html());
- let vDecode = vEncodeHead + vEncode + '';
+ let vDecode = `${vEncodeHead + vEncode}