Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6ae86220e | ||
|
|
3397bd419d | ||
|
|
2dd11ad24c | ||
|
|
1099be87fa | ||
|
|
13c5b9613d | ||
|
|
32890ba3db | ||
|
|
8f7465dd8d | ||
|
|
be710cb17b | ||
|
|
2729321f40 | ||
|
|
2710d4629f | ||
|
|
8c093a4692 | ||
|
|
ec822b843b | ||
|
|
5dc8bb49a4 | ||
|
|
0d98553a71 | ||
|
|
6513a294b3 | ||
|
|
79e753c2b2 | ||
|
|
468598540f | ||
|
|
045d0db215 | ||
|
|
73011d0388 | ||
|
|
41cf77e8d2 | ||
|
|
1355381346 | ||
|
|
730f35a83c | ||
|
|
71bf25e8fb | ||
|
|
9b4fe54239 | ||
|
|
e59c594215 | ||
|
|
97a54e6f5a | ||
|
|
eac9fd2a5f | ||
|
|
96f09f9323 | ||
|
|
2ab340f3f1 | ||
|
|
58d0f542eb | ||
|
|
8ba826a0ea | ||
|
|
d2446395e2 | ||
|
|
f17a7b7714 | ||
|
|
8aa86275f0 | ||
|
|
3ebc2b9e29 | ||
|
|
ce81549011 | ||
|
|
e64af66dab | ||
|
|
fd9e645fc1 | ||
|
|
ca1b1a9b53 | ||
|
|
a65f843008 | ||
|
|
be9570e0aa | ||
|
|
41d3a7c9af | ||
|
|
1e0a7c1204 | ||
|
|
17b5df296c |
@@ -20,7 +20,7 @@ jobs:
|
||||
command: npm install
|
||||
- run:
|
||||
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.trust.cert=true \
|
||||
--blackduck.username="svc-blackduck" \
|
||||
|
||||
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"json.format.enable": false
|
||||
}
|
||||
BIN
assets/Excel.png
BIN
assets/Excel.png
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,14 +1,16 @@
|
||||
/* 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: {
|
||||
@@ -26,14 +28,14 @@ class DataCell extends React.PureComponent {
|
||||
if (!allowFilteringByClick) {
|
||||
return;
|
||||
}
|
||||
|
||||
component.backendApi.selectValues(0, [measurement.parents.dimension1.elementNumber], false);
|
||||
// fixes the console error on selection made from data cells
|
||||
component.selectValues(0, [measurement.parents.dimension1.elementNumber], false);
|
||||
if (hasSecondDimension) {
|
||||
component.backendApi.selectValues(1, [measurement.parents.dimension2.elementNumber], false);
|
||||
component.selectValues(1, [measurement.parents.dimension2.elementNumber], false);
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
render() {
|
||||
const {
|
||||
cellWidth,
|
||||
measurement,
|
||||
@@ -41,9 +43,9 @@ class DataCell extends React.PureComponent {
|
||||
styling
|
||||
} = this.props;
|
||||
|
||||
let textAlignment = styling.options.textAlignment || 'Right';
|
||||
const textAlignment = styling.options.textAlignment || 'Right';
|
||||
|
||||
let cellStyle = {
|
||||
const cellStyle = {
|
||||
fontFamily: styling.options.fontFamily,
|
||||
...styleBuilder.getStyle(),
|
||||
paddingLeft: '5px',
|
||||
@@ -64,10 +66,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) {
|
||||
@@ -112,7 +114,7 @@ DataCell.propTypes = {
|
||||
}).isRequired,
|
||||
component: PropTypes.shape({
|
||||
backendApi: PropTypes.shape({
|
||||
selectValues: function (props, propName) {
|
||||
selectValues (props, propName) {
|
||||
if (props.isSnapshot || typeof props[propName] === 'function') {
|
||||
return null;
|
||||
}
|
||||
@@ -130,7 +132,7 @@ DataCell.propTypes = {
|
||||
|
||||
export default DataCell;
|
||||
|
||||
function formatMeasurementValue (measurement, styling) {
|
||||
function formatMeasurementValue(measurement, styling) {
|
||||
if (isNaN(measurement.value)) {
|
||||
return styling.symbolForNulls;
|
||||
}
|
||||
@@ -138,7 +140,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;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import DataCell from './data-cell.jsx';
|
||||
import RowHeader from './row-header.jsx';
|
||||
import { injectSeparators } from '../utilities';
|
||||
|
||||
// eslint-disable-next-line react/prefer-stateless-function
|
||||
class DataTable extends React.PureComponent {
|
||||
render () {
|
||||
const {
|
||||
@@ -20,6 +21,7 @@ class DataTable extends React.PureComponent {
|
||||
const {
|
||||
headers: {
|
||||
dimension1,
|
||||
dimension2,
|
||||
measurements
|
||||
},
|
||||
matrix
|
||||
@@ -30,6 +32,70 @@ class DataTable extends React.PureComponent {
|
||||
maxWidth: columnSeparatorWidth
|
||||
};
|
||||
|
||||
const renderMeasurementData = (dimIndex, atEvery) => {
|
||||
if (dimension2.length <= 0) {
|
||||
return injectSeparators(
|
||||
matrix[dimIndex],
|
||||
columnSeparatorWidth,
|
||||
atEvery
|
||||
);
|
||||
}
|
||||
const measurementDataRow = [];
|
||||
let index = 0,
|
||||
match;
|
||||
dimension2.forEach(dim2 => {
|
||||
measurements.forEach((measure, mesInd) => {
|
||||
for (index = 0; index < matrix[dimIndex].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]);
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!match) {
|
||||
measurementDataRow.push({
|
||||
displayValue: "",
|
||||
parents: {
|
||||
dimension1: {
|
||||
elementNumber: dimension1[dimIndex].elementNumber,
|
||||
header: dimension1[dimIndex].displayValue
|
||||
},
|
||||
dimension2: {
|
||||
elementNumber: dim2.elementNumber,
|
||||
header: dim2.displayValue
|
||||
},
|
||||
measurement: {
|
||||
header: measure.name,
|
||||
index: mesInd
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
return injectSeparators(
|
||||
measurementDataRow,
|
||||
columnSeparatorWidth,
|
||||
atEvery
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div className="row-wrapper">
|
||||
<table>
|
||||
@@ -55,7 +121,7 @@ class DataTable extends React.PureComponent {
|
||||
};
|
||||
|
||||
return (
|
||||
<tr key={dimensionEntry.displayValue}>
|
||||
<tr key={`${dimensionEntry.displayValue}-${dimensionIndex}-separator`}>
|
||||
{!renderData ?
|
||||
<RowHeader
|
||||
component={component}
|
||||
@@ -65,11 +131,7 @@ class DataTable extends React.PureComponent {
|
||||
styling={styling}
|
||||
/> : null
|
||||
}
|
||||
{renderData && injectSeparators(
|
||||
matrix[dimensionIndex],
|
||||
columnSeparatorWidth,
|
||||
{ atEvery: measurements.length }
|
||||
).map((measurementData, index) => {
|
||||
{renderData && renderMeasurementData(dimensionIndex, { atEvery: measurements.length }).map((measurementData, index) => {
|
||||
if (measurementData.isSeparator) {
|
||||
return (
|
||||
<td
|
||||
@@ -80,6 +142,7 @@ class DataTable extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
const { dimension1: dimension1Info, dimension2, measurement } = measurementData.parents;
|
||||
const id = `${dimension1Info.elementNumber}-${dimension2 && dimension2.elementNumber}-${measurement.header}-${measurement.index}`;
|
||||
return (
|
||||
@@ -112,6 +175,7 @@ DataTable.defaultProps = {
|
||||
DataTable.propTypes = {
|
||||
cellWidth: PropTypes.string.isRequired,
|
||||
columnSeparatorWidth: PropTypes.string.isRequired,
|
||||
component: PropTypes.shape({}).isRequired,
|
||||
data: PropTypes.shape({
|
||||
headers: PropTypes.shape({
|
||||
dimension1: PropTypes.array.isRequired
|
||||
@@ -119,7 +183,6 @@ DataTable.propTypes = {
|
||||
matrix: PropTypes.arrayOf(PropTypes.array.isRequired).isRequired
|
||||
}).isRequired,
|
||||
general: PropTypes.shape({}).isRequired,
|
||||
component: PropTypes.shape({}).isRequired,
|
||||
renderData: PropTypes.bool,
|
||||
styling: PropTypes.shape({
|
||||
hasCustomFileStyle: PropTypes.bool.isRequired
|
||||
|
||||
@@ -10,9 +10,10 @@ 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.backendApi.selectValues(0, [entry.elementNumber], false);
|
||||
component.selectValues(0, [entry.elementNumber], false);
|
||||
}
|
||||
|
||||
render () {
|
||||
@@ -42,13 +43,9 @@ 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: function (props, propName) {
|
||||
selectValues (props, propName) {
|
||||
if (props.isSnapshot || typeof props[propName] === 'function') {
|
||||
return null;
|
||||
}
|
||||
@@ -56,6 +53,10 @@ 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
|
||||
|
||||
@@ -6,12 +6,15 @@ function createCube (definition, app) {
|
||||
});
|
||||
}
|
||||
|
||||
async function buildDataCube (originCubeDefinition, originCube, app) {
|
||||
async function buildDataCube (originCubeDefinition, originCube, app, requestPage) {
|
||||
const cubeDefinition = {
|
||||
...originCubeDefinition,
|
||||
qInitialDataFetch: [
|
||||
{
|
||||
qHeight: originCube.qSize.qcy,
|
||||
// eslint-disable-next-line no-undefined
|
||||
qTop: requestPage === undefined ? 0 : requestPage[0].qTop,
|
||||
qLeft: 0,
|
||||
qHeight: 1000,
|
||||
qWidth: originCube.qSize.qcx
|
||||
}
|
||||
],
|
||||
@@ -28,12 +31,15 @@ async function buildDataCube (originCubeDefinition, originCube, app) {
|
||||
}
|
||||
|
||||
export async function initializeDataCube (component, layout) {
|
||||
|
||||
if (component.backendApi.isSnapshot) {
|
||||
return layout.snapshotData.dataCube;
|
||||
}
|
||||
|
||||
const app = qlik.currApp(component);
|
||||
const properties = (await component.backendApi.getProperties());
|
||||
const rowCount = component.backendApi.getRowCount();
|
||||
const cellCount = rowCount * layout.qHyperCube.qSize.qcx;
|
||||
const maxLoops = layout.maxloops;
|
||||
|
||||
// If this is a master object, fetch the hyperCubeDef of the original object
|
||||
let hyperCubeDef = properties.qExtendsId
|
||||
@@ -41,8 +47,25 @@ export async function initializeDataCube (component, layout) {
|
||||
: properties.qHyperCubeDef;
|
||||
hyperCubeDef = JSON.parse(JSON.stringify(hyperCubeDef));
|
||||
hyperCubeDef.qStateName = layout.qStateName;
|
||||
|
||||
return buildDataCube(hyperCubeDef, layout.qHyperCube, app);
|
||||
const pagedCube = {};
|
||||
let lastRow = 0;
|
||||
if (cellCount < (maxLoops * 10000)) {
|
||||
for (let index = 0; cellCount > lastRow; index += 1) {
|
||||
const requestPage = [
|
||||
{
|
||||
qHeight: 1000,
|
||||
qLeft: 0,
|
||||
qTop: lastRow,
|
||||
qWidth: 10 // should be # of columns
|
||||
}
|
||||
];
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
pagedCube[index] = await buildDataCube(hyperCubeDef, layout.qHyperCube, app, requestPage);
|
||||
lastRow = lastRow + 1000;
|
||||
}
|
||||
return pagedCube;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function initializeDesignList (component, layout) {
|
||||
@@ -63,6 +86,6 @@ export function initializeDesignList (component, layout) {
|
||||
resolve(data);
|
||||
};
|
||||
stylingField.OnData.bind(listener);
|
||||
stylingField.getData();
|
||||
stylingField.getData({ rows: 5000 });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ const definition = {
|
||||
component: 'text'
|
||||
},
|
||||
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.`,
|
||||
component: 'text'
|
||||
},
|
||||
|
||||
@@ -23,30 +23,6 @@ const pagination = {
|
||||
{
|
||||
value: 4,
|
||||
label: '40k cells'
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
label: '50k cells'
|
||||
},
|
||||
{
|
||||
value: 6,
|
||||
label: '60k cells'
|
||||
},
|
||||
{
|
||||
value: 7,
|
||||
label: '70k cells'
|
||||
},
|
||||
{
|
||||
value: 8,
|
||||
label: '80k cells'
|
||||
},
|
||||
{
|
||||
value: 9,
|
||||
label: '90k cells'
|
||||
},
|
||||
{
|
||||
value: 10,
|
||||
label: '100k cells'
|
||||
}
|
||||
],
|
||||
defaultValue: 2
|
||||
@@ -55,7 +31,8 @@ const pagination = {
|
||||
ref: 'errormessage',
|
||||
label: 'Default error message',
|
||||
type: 'string',
|
||||
defaultValue: 'Unable to display all the data. Apply more filters to limit the amount of displayed data.'
|
||||
defaultValue: `Unable to display all the data.
|
||||
Change the pagination size supported or apply more filters to limit the amount of displayed data.`
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { exportXLS } from './excel-export';
|
||||
|
||||
class ExportButton extends React.PureComponent {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
this.handleExport = this.handleExport.bind(this);
|
||||
}
|
||||
|
||||
handleExport () {
|
||||
const { component, excelExport, general } = this.props;
|
||||
const { title, subtitle, footnote } = general;
|
||||
if (excelExport) {
|
||||
exportXLS(component.$element, title, subtitle, footnote);
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
const { excelExport } = this.props;
|
||||
return excelExport === true && (
|
||||
<input
|
||||
className="icon-xls"
|
||||
onClick={this.handleExport}
|
||||
src="/Extensions/qlik-smart-pivot/Excel.png"
|
||||
type="image"
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ExportButton.defaultProps = {
|
||||
excelExport: false
|
||||
};
|
||||
|
||||
ExportButton.propTypes = {
|
||||
component: PropTypes.shape({}).isRequired,
|
||||
excelExport: PropTypes.bool,
|
||||
general: PropTypes.shape({}).isRequired
|
||||
};
|
||||
|
||||
export default ExportButton;
|
||||
@@ -1,20 +1,23 @@
|
||||
/* 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);
|
||||
}
|
||||
|
||||
handleSelect () {
|
||||
// fixes console error for column selected values
|
||||
handleSelect() {
|
||||
const { component, entry } = this.props;
|
||||
component.backendApi.selectValues(1, [entry.elementNumber], false);
|
||||
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;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ExportButton from '../export-button.jsx';
|
||||
import { HEADER_FONT_SIZE } from '../initialize-transformed';
|
||||
import Tooltip from '../tooltip/index.jsx';
|
||||
|
||||
const ExportColumnHeader = ({ component, baseCSS, general, title, allowExcelExport, hasSecondDimension, styling }) => {
|
||||
const Dim1Header = ({ component, baseCSS, title, hasSecondDimension, styling }) => {
|
||||
const inEditState = component.inEditState();
|
||||
const rowSpan = hasSecondDimension ? 2 : 1;
|
||||
const isMediumFontSize = styling.headerOptions.fontSizeAdjustment === HEADER_FONT_SIZE.MEDIUM;
|
||||
const style = {
|
||||
@@ -21,21 +22,20 @@ const ExportColumnHeader = ({ component, baseCSS, general, title, allowExcelExpo
|
||||
rowSpan={rowSpan}
|
||||
style={style}
|
||||
>
|
||||
<ExportButton
|
||||
component={component}
|
||||
excelExport={allowExcelExport}
|
||||
general={general}
|
||||
/>
|
||||
{title}
|
||||
<Tooltip
|
||||
isTooltipActive={!inEditState}
|
||||
styling={styling}
|
||||
tooltipText={title}
|
||||
>
|
||||
{title}
|
||||
</Tooltip>
|
||||
</th>
|
||||
);
|
||||
};
|
||||
|
||||
ExportColumnHeader.propTypes = {
|
||||
component: PropTypes.shape({}).isRequired,
|
||||
allowExcelExport: PropTypes.bool.isRequired,
|
||||
Dim1Header.propTypes = {
|
||||
baseCSS: PropTypes.shape({}).isRequired,
|
||||
general: PropTypes.shape({}).isRequired,
|
||||
component: PropTypes.shape({}).isRequired,
|
||||
hasSecondDimension: PropTypes.bool.isRequired,
|
||||
styling: PropTypes.shape({
|
||||
headerOptions: PropTypes.shape({
|
||||
@@ -45,4 +45,4 @@ ExportColumnHeader.propTypes = {
|
||||
title: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
export default ExportColumnHeader;
|
||||
export default Dim1Header;
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ExportColumnHeader from './export-column-header.jsx';
|
||||
import Dim1Header from './dim1-header.jsx';
|
||||
import ColumnHeader from './column-header.jsx';
|
||||
import MeasurementColumnHeader from './measurement-column-header.jsx';
|
||||
import { injectSeparators } from '../utilities';
|
||||
@@ -12,7 +12,6 @@ class HeadersTable extends React.PureComponent {
|
||||
columnSeparatorWidth,
|
||||
component,
|
||||
data,
|
||||
general,
|
||||
isKpi,
|
||||
styling
|
||||
} = this.props;
|
||||
@@ -43,11 +42,9 @@ class HeadersTable extends React.PureComponent {
|
||||
<tbody>
|
||||
<tr>
|
||||
{isKpi ?
|
||||
<ExportColumnHeader
|
||||
allowExcelExport={general.allowExcelExport}
|
||||
<Dim1Header
|
||||
baseCSS={baseCSS}
|
||||
component={component}
|
||||
general={general}
|
||||
hasSecondDimension={hasSecondDimension}
|
||||
styling={styling}
|
||||
title={dimension1[0].name}
|
||||
@@ -80,7 +77,7 @@ class HeadersTable extends React.PureComponent {
|
||||
colSpan={measurements.length}
|
||||
component={component}
|
||||
entry={entry}
|
||||
key={entry.displayValue}
|
||||
key={`${entry.displayValue}-${index}-separator`}
|
||||
styling={styling}
|
||||
/>
|
||||
);
|
||||
@@ -129,7 +126,6 @@ HeadersTable.propTypes = {
|
||||
measurements: PropTypes.array
|
||||
})
|
||||
}).isRequired,
|
||||
general: PropTypes.shape({}).isRequired,
|
||||
component: PropTypes.shape({}).isRequired,
|
||||
styling: PropTypes.shape({
|
||||
headerOptions: PropTypes.shape({}),
|
||||
|
||||
120
src/index.js
120
src/index.js
@@ -1,21 +1,19 @@
|
||||
import definition from './definition';
|
||||
import { initializeDataCube, initializeDesignList } from './dataset';
|
||||
import initializeStore from './store';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import Root from './root.jsx';
|
||||
import './main.less';
|
||||
import definition from "./definition";
|
||||
import { exportXLS } from "./excel-export";
|
||||
import { initializeDataCube, initializeDesignList } from "./dataset";
|
||||
import initializeStore from "./store";
|
||||
import qlik from "qlik";
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import Root from "./root.jsx";
|
||||
import "./main.less";
|
||||
|
||||
if (!window._babelPolyfill) { // eslint-disable-line no-underscore-dangle
|
||||
require('@babel/polyfill'); // eslint-disable-line global-require
|
||||
if (!window._babelPolyfill) {
|
||||
// eslint-disable-line no-underscore-dangle
|
||||
require("@babel/polyfill"); // eslint-disable-line global-require
|
||||
}
|
||||
|
||||
export default {
|
||||
controller: [
|
||||
'$scope',
|
||||
'$timeout',
|
||||
function controller () {}
|
||||
],
|
||||
design: {
|
||||
dimensions: {
|
||||
max: 1,
|
||||
@@ -24,20 +22,23 @@ export default {
|
||||
},
|
||||
data: {
|
||||
dimensions: {
|
||||
max: function (nMeasures) {
|
||||
max (nMeasures) {
|
||||
return nMeasures < 9 ? 2 : 1;
|
||||
},
|
||||
min: 1,
|
||||
uses: 'dimensions'
|
||||
},
|
||||
measures: {
|
||||
max: function (nDims) {
|
||||
max (nDims) {
|
||||
return nDims < 2 ? 9 : 8;
|
||||
},
|
||||
min: 1,
|
||||
uses: 'measures'
|
||||
}
|
||||
},
|
||||
// Prevent conversion from and to this object
|
||||
exportProperties: null,
|
||||
importProperties: null,
|
||||
definition,
|
||||
initialProperties: {
|
||||
version: 1.0,
|
||||
@@ -45,12 +46,13 @@ export default {
|
||||
qDimensions: [],
|
||||
qInitialDataFetch: [
|
||||
{
|
||||
qHeight: 1,
|
||||
qWidth: 10
|
||||
qTop: 0,
|
||||
qLeft: 0,
|
||||
qWidth: 50,
|
||||
qHeight: 50
|
||||
}
|
||||
],
|
||||
qMeasures: [],
|
||||
qSuppressMissing: true,
|
||||
qSuppressZero: false
|
||||
}
|
||||
},
|
||||
@@ -59,23 +61,32 @@ export default {
|
||||
exportData: true,
|
||||
snapshot: true
|
||||
},
|
||||
paint: async function ($element, layout) {
|
||||
const dataCube = await initializeDataCube(this, layout);
|
||||
const designList = await initializeDesignList(this, layout);
|
||||
const state = await initializeStore({
|
||||
$element,
|
||||
component: this,
|
||||
dataCube,
|
||||
designList,
|
||||
layout
|
||||
});
|
||||
async paint ($element, layout, requestPage) {
|
||||
const dataCube = await initializeDataCube(this, layout, requestPage);
|
||||
const editmodeClass = this.inAnalysisState() ? '' : 'edit-mode';
|
||||
let state, designList;
|
||||
if (dataCube === null) {
|
||||
state = {
|
||||
$element,
|
||||
component: this,
|
||||
dataCube,
|
||||
designList,
|
||||
layout,
|
||||
error: true
|
||||
};
|
||||
} else {
|
||||
designList = await initializeDesignList(this, layout);
|
||||
state = await initializeStore({
|
||||
$element,
|
||||
component: this,
|
||||
dataCube,
|
||||
designList,
|
||||
layout,
|
||||
error: false
|
||||
});
|
||||
}
|
||||
const jsx = (
|
||||
<Root
|
||||
editmodeClass={editmodeClass}
|
||||
component={this}
|
||||
state={state}
|
||||
/>
|
||||
<Root editmodeClass={editmodeClass} component={this} state={state} />
|
||||
);
|
||||
|
||||
ReactDOM.render(jsx, $element[0]);
|
||||
@@ -83,10 +94,45 @@ export default {
|
||||
snapshot: {
|
||||
canTakeSnapshot: true
|
||||
},
|
||||
setSnapshotData: async function (snapshotLayout) {
|
||||
snapshotLayout.snapshotData.dataCube = await initializeDataCube(this, snapshotLayout);
|
||||
snapshotLayout.snapshotData.designList = await initializeDesignList(this, snapshotLayout);
|
||||
async setSnapshotData (snapshotLayout) {
|
||||
snapshotLayout.snapshotData.dataCube = await initializeDataCube(
|
||||
this,
|
||||
snapshotLayout
|
||||
);
|
||||
snapshotLayout.snapshotData.designList = await initializeDesignList(
|
||||
this,
|
||||
snapshotLayout
|
||||
);
|
||||
return snapshotLayout;
|
||||
},
|
||||
async getContextMenu (obj, menu) {
|
||||
const app = qlik.currApp(this);
|
||||
const isPersonalResult = await app.global.isPersonalMode();
|
||||
// This check is done because the desktop wrapper blocks downloads.
|
||||
// It also blocks this feature in QCS currently as isPersonalMode returns true
|
||||
if (
|
||||
!this.$scope.layout.allowexportxls ||
|
||||
(isPersonalResult && isPersonalResult.qReturn)
|
||||
) {
|
||||
return menu;
|
||||
}
|
||||
|
||||
if (this.backendApi.model.layout.qMeta.privileges.indexOf('exportdata') !== -1) {
|
||||
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
|
||||
};
|
||||
|
||||
@@ -64,92 +64,69 @@ function generateMatrixCell ({ cell, dimension1Information, dimension2Informatio
|
||||
|
||||
if (dimension2Information) {
|
||||
matrixCell.parents.dimension2 = {
|
||||
elementNumber: dimension2Information.qElemNumber
|
||||
elementNumber: dimension2Information.qElemNumber,
|
||||
header: dimension2Information.qText
|
||||
};
|
||||
}
|
||||
|
||||
return matrixCell;
|
||||
}
|
||||
|
||||
let lastRow = 0;
|
||||
function generateDataSet (
|
||||
component, dimensionsInformation, measurementsInformation, dataCube) {
|
||||
|
||||
function generateDataSet (component, dimensionsInformation, measurementsInformation, dataCube) {
|
||||
const measurements = generateMeasurements(measurementsInformation);
|
||||
let dimension1 = [];
|
||||
let dimension2 = [];
|
||||
let matrix = [];
|
||||
|
||||
const hasSecondDimension = dimensionsInformation.length > 1;
|
||||
dataCube.forEach(row => {
|
||||
lastRow += 1;
|
||||
const dimension1Entry = generateDimensionEntry(dimensionsInformation[0], row[0]);
|
||||
dimension1.push(dimension1Entry);
|
||||
let dimension2Entry;
|
||||
let firstDataCell = 1;
|
||||
if (hasSecondDimension) {
|
||||
dimension2Entry = generateDimensionEntry(dimensionsInformation[1], row[1]);
|
||||
dimension2.push(dimension2Entry);
|
||||
firstDataCell = 2;
|
||||
}
|
||||
let matrixRow = row
|
||||
.slice(firstDataCell, row.length)
|
||||
.map((cell, cellIndex) => {
|
||||
const measurementInformation = measurements[cellIndex];
|
||||
measurementInformation.index = cellIndex;
|
||||
const dimension1Information = row[0]; // eslint-disable-line prefer-destructuring
|
||||
const dimension2Information = hasSecondDimension ? row[1] : null;
|
||||
const generatedCell = generateMatrixCell({
|
||||
cell,
|
||||
dimension1Information,
|
||||
dimension2Information,
|
||||
measurementInformation
|
||||
// eslint-disable-next-line no-undefined
|
||||
for (let index = 0; dataCube[index] !== undefined; index++) {
|
||||
// eslint-disable-next-line no-loop-func
|
||||
dataCube[index].forEach(row => {
|
||||
const dimension1Entry = generateDimensionEntry(dimensionsInformation[0], row[0]);
|
||||
dimension1.push(dimension1Entry);
|
||||
let dimension2Entry;
|
||||
let firstDataCell = 1;
|
||||
if (hasSecondDimension) {
|
||||
dimension2Entry = generateDimensionEntry(dimensionsInformation[1], row[1]);
|
||||
dimension2.push(dimension2Entry);
|
||||
firstDataCell = 2;
|
||||
}
|
||||
let matrixRow = row
|
||||
.slice(firstDataCell, row.length)
|
||||
.map((cell, cellIndex) => {
|
||||
const measurementInformation = measurements[cellIndex];
|
||||
measurementInformation.index = cellIndex;
|
||||
const dimension1Information = row[0]; // eslint-disable-line prefer-destructuring
|
||||
const dimension2Information = hasSecondDimension ? row[1] : null;
|
||||
const generatedCell = generateMatrixCell({
|
||||
cell,
|
||||
dimension1Information,
|
||||
dimension2Information,
|
||||
measurementInformation
|
||||
});
|
||||
return generatedCell;
|
||||
});
|
||||
|
||||
return generatedCell;
|
||||
});
|
||||
|
||||
let appendToRowIndex = matrix.length;
|
||||
if (hasSecondDimension) {
|
||||
let appendToRowIndex = matrix.length;
|
||||
if (hasSecondDimension) {
|
||||
// See if there already is a row for the current dim1
|
||||
for (let i = 0; i < matrix.length; i++) {
|
||||
if (matrix[i][0].parents.dimension1.header === matrixRow[0].parents.dimension1.header) {
|
||||
appendToRowIndex = i;
|
||||
matrixRow = matrix[i].concat(matrixRow);
|
||||
for (let i = 0; i < matrix.length; i++) {
|
||||
if (matrix[i][0].parents.dimension1.header === matrixRow[0].parents.dimension1.header) {
|
||||
appendToRowIndex = i;
|
||||
matrixRow = matrix[i].concat(matrixRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
matrix[appendToRowIndex] = matrixRow;
|
||||
});
|
||||
matrix[appendToRowIndex] = matrixRow;
|
||||
});
|
||||
}
|
||||
|
||||
// filter header dimensions to only have distinct values
|
||||
dimension1 = distinctArray(dimension1);
|
||||
dimension2 = distinctArray(dimension2);
|
||||
|
||||
// Make sure all rows are saturated, otherwise data risks being displayed in the wrong column
|
||||
matrix = matrix.map((row, rowIndex) => {
|
||||
if ((hasSecondDimension && row.length == (dimension2.length * measurements.length))
|
||||
|| (!hasSecondDimension && row.length == measurements.length)) {
|
||||
// Row is saturated
|
||||
return row;
|
||||
}
|
||||
|
||||
// Row is not saturated, so must add empty cells to fill the gaps
|
||||
let newRow = [];
|
||||
if (hasSecondDimension) {
|
||||
// Got a second dimension, so need to add measurements for all values of the second dimension
|
||||
let rowDataIndex = 0;
|
||||
dimension2.forEach(dim => {
|
||||
rowDataIndex = appendMissingCells(
|
||||
row, newRow, rowDataIndex, measurements, rowIndex, dim.elementNumber);
|
||||
});
|
||||
} else {
|
||||
appendMissingCells(row, newRow, 0, measurements, rowIndex);
|
||||
}
|
||||
|
||||
return newRow;
|
||||
});
|
||||
|
||||
return {
|
||||
dimension1: dimension1,
|
||||
dimension2: dimension2,
|
||||
@@ -158,48 +135,10 @@ function generateDataSet (
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* Appends the cells of the source row, as well as those missing, to the destination row, starting
|
||||
* from the given source index. Returns the source index of the next source cell after this has
|
||||
* completed. If there is a second dimension the dim2ElementNumber should be set to the current
|
||||
* index of the dimension2 value being processed.
|
||||
*/
|
||||
function appendMissingCells (
|
||||
sourceRow, destRow, sourceIndex, measurements, dim1ElementNumber, dim2ElementNumber = -1) {
|
||||
|
||||
let index = sourceIndex;
|
||||
measurements.forEach((measurement, measureIndex) => {
|
||||
if (index < sourceRow.length
|
||||
&& (dim2ElementNumber === -1
|
||||
|| sourceRow[index].parents.dimension2.elementNumber === dim2ElementNumber)
|
||||
&& sourceRow[index].parents.measurement.header === measurement.name) {
|
||||
// Source contains the expected cell
|
||||
destRow.push(sourceRow[index]);
|
||||
index++;
|
||||
} else {
|
||||
// Source doesn't contain the expected cell, so add empty
|
||||
destRow.push({
|
||||
displayValue: '',
|
||||
parents: {
|
||||
dimension1: { elementNumber: dim1ElementNumber },
|
||||
dimension2: { elementNumber: dim2ElementNumber },
|
||||
measurement: {
|
||||
header: measurement.name,
|
||||
index: measureIndex
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return index;
|
||||
}
|
||||
|
||||
function initializeTransformed ({ $element, component, dataCube, designList, layout }) {
|
||||
function initializeTransformed ({ component, dataCube, designList, layout }) {
|
||||
const dimensionsInformation = component.backendApi.getDimensionInfos();
|
||||
const measurementsInformation = component.backendApi.getMeasureInfos();
|
||||
const dimensionCount = layout.qHyperCube.qDimensionInfo.length;
|
||||
const rowCount = component.backendApi.getRowCount();
|
||||
const maxLoops = layout.maxloops;
|
||||
const {
|
||||
dimension1,
|
||||
dimension2,
|
||||
@@ -259,7 +198,6 @@ function initializeTransformed ({ $element, component, dataCube, designList, lay
|
||||
cellWidth: cellWidth,
|
||||
errorMessage: layout.errormessage,
|
||||
footnote: layout.footnote,
|
||||
maxLoops,
|
||||
subtitle: layout.subtitle,
|
||||
title: layout.title,
|
||||
useColumnSeparator: layout.separatorcols && dimensionCount > 1
|
||||
@@ -320,20 +258,6 @@ function initializeTransformed ({ $element, component, dataCube, designList, lay
|
||||
}
|
||||
};
|
||||
|
||||
if (rowCount > lastRow && rowCount <= (maxLoops * 1000)) {
|
||||
const requestPage = [
|
||||
{
|
||||
qHeight: Math.min(1000, rowCount - lastRow),
|
||||
qLeft: 0,
|
||||
qTop: matrix.length,
|
||||
qWidth: 10 // should be # of columns
|
||||
}
|
||||
];
|
||||
component.backendApi.getData(requestPage).then(() => {
|
||||
component.paint($element, layout);
|
||||
});
|
||||
}
|
||||
|
||||
return transformedProperties;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class LinkedScrollWrapper extends React.PureComponent {
|
||||
unlinkComponent (component) {
|
||||
const componentIndex = this.scrollElements.map(element => element.component).indexOf(component);
|
||||
if (componentIndex !== -1) {
|
||||
this.scrollElements.removeAt(componentIndex);
|
||||
this.scrollElements.splice(componentIndex, 1);
|
||||
// eslint-disable-next-line react/no-find-dom-node
|
||||
const node = ReactDOM.findDOMNode(component);
|
||||
node.onscroll = null;
|
||||
|
||||
@@ -105,6 +105,20 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.error {
|
||||
position: absolute; /*Define position */
|
||||
width: 100%; /* Full width (cover the whole page) */
|
||||
height: 100%; /* Full height (cover the whole page) */
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1000; /* Specify a stack order in case you're using a different order for other elements */
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.kpi-table .fdim-cells,
|
||||
.data-table td {
|
||||
line-height: 1em !important;
|
||||
|
||||
133
src/root.jsx
133
src/root.jsx
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import HeadersTable from './headers-table/index.jsx';
|
||||
import DataTable from './data-table/index.jsx';
|
||||
import { LinkedScrollWrapper, LinkedScrollSection } from './linked-scroll';
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import HeadersTable from "./headers-table/index.jsx";
|
||||
import DataTable from "./data-table/index.jsx";
|
||||
import { LinkedScrollWrapper, LinkedScrollSection } from "./linked-scroll";
|
||||
|
||||
class Root extends React.PureComponent {
|
||||
constructor (props) {
|
||||
@@ -12,9 +12,12 @@ class Root extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidUpdate () {
|
||||
const tableWidth = this.dataTableRef.getBoundingClientRect().width;
|
||||
if (this.renderedTableWidth !== tableWidth) {
|
||||
this.forceUpdate();
|
||||
let tableWidth;
|
||||
if (this.dataTableRef) {
|
||||
tableWidth = this.dataTableRef.getBoundingClientRect().width;
|
||||
if (this.renderedTableWidth !== tableWidth) {
|
||||
this.forceUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +28,12 @@ class Root extends React.PureComponent {
|
||||
|
||||
render () {
|
||||
const { editmodeClass, component, state } = this.props;
|
||||
const { data, general, styling } = state;
|
||||
const { data, general, styling, error } = state;
|
||||
|
||||
// Determine cell- and column separator width
|
||||
let cellWidth = '0px';
|
||||
let columnSeparatorWidth = '';
|
||||
if (this.dataTableRef) {
|
||||
if (this.dataTableRef && !error) {
|
||||
const tableWidth = this.dataTableRef.getBoundingClientRect().width;
|
||||
this.renderedTableWidth = tableWidth;
|
||||
|
||||
@@ -48,72 +51,80 @@ class Root extends React.PureComponent {
|
||||
let separatorWidth = 0;
|
||||
if (general.useColumnSeparator) {
|
||||
separatorCount = data.headers.dimension2.length - 1;
|
||||
separatorWidth = Math.min(Math.floor(tableWidth * 0.2 / separatorCount), 8);
|
||||
separatorWidth = Math.min(
|
||||
Math.floor((tableWidth * 0.2) / separatorCount),
|
||||
8
|
||||
);
|
||||
columnSeparatorWidth = `${separatorWidth}px`;
|
||||
}
|
||||
|
||||
const separatorWidthSum = (separatorWidth + borderWidth) * separatorCount;
|
||||
cellWidth = `${Math.floor((tableWidth - separatorWidthSum - headerMarginRight - borderWidth)
|
||||
/ rowCellCount) - borderWidth}px`;
|
||||
const separatorWidthSum =
|
||||
(separatorWidth + borderWidth) * separatorCount;
|
||||
cellWidth = `${Math.floor(
|
||||
(tableWidth - separatorWidthSum - headerMarginRight - borderWidth) /
|
||||
rowCellCount) - borderWidth}px`;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="root">
|
||||
<LinkedScrollWrapper>
|
||||
<div className={`kpi-table ${editmodeClass}`}>
|
||||
<HeadersTable
|
||||
cellWidth={cellWidth}
|
||||
columnSeparatorWidth={columnSeparatorWidth}
|
||||
component={component}
|
||||
data={data}
|
||||
general={general}
|
||||
isKpi
|
||||
styling={styling}
|
||||
/>
|
||||
<LinkedScrollSection linkVertical>
|
||||
<DataTable
|
||||
cellWidth={cellWidth}
|
||||
columnSeparatorWidth={columnSeparatorWidth}
|
||||
component={component}
|
||||
data={data}
|
||||
general={general}
|
||||
renderData={false}
|
||||
styling={styling}
|
||||
/>
|
||||
</LinkedScrollSection>
|
||||
{error ? (
|
||||
<div className={`error ${editmodeClass}`}>
|
||||
{state.layout.errormessage}
|
||||
</div>
|
||||
<div
|
||||
className={`data-table ${editmodeClass}`}
|
||||
style={{ width: general.cellWidth ? 'auto' : '100%' }}
|
||||
ref={this.onDataTableRefSet}
|
||||
>
|
||||
<LinkedScrollSection linkHorizontal>
|
||||
) : (
|
||||
<LinkedScrollWrapper>
|
||||
<div className={`kpi-table ${editmodeClass}`}>
|
||||
<HeadersTable
|
||||
cellWidth={cellWidth}
|
||||
columnSeparatorWidth={columnSeparatorWidth}
|
||||
component={component}
|
||||
data={data}
|
||||
general={general}
|
||||
isKpi={false}
|
||||
isKpi
|
||||
styling={styling}
|
||||
/>
|
||||
</LinkedScrollSection>
|
||||
<LinkedScrollSection
|
||||
linkHorizontal
|
||||
linkVertical
|
||||
<LinkedScrollSection linkVertical>
|
||||
<DataTable
|
||||
cellWidth={cellWidth}
|
||||
columnSeparatorWidth={columnSeparatorWidth}
|
||||
component={component}
|
||||
data={data}
|
||||
general={general}
|
||||
renderData={false}
|
||||
styling={styling}
|
||||
/>
|
||||
</LinkedScrollSection>
|
||||
</div>
|
||||
<div
|
||||
className={`data-table ${editmodeClass}`}
|
||||
style={{ width: general.cellWidth ? 'auto' : '100%' }}
|
||||
ref={this.onDataTableRefSet}
|
||||
>
|
||||
<DataTable
|
||||
cellWidth={cellWidth}
|
||||
columnSeparatorWidth={columnSeparatorWidth}
|
||||
component={component}
|
||||
data={data}
|
||||
general={general}
|
||||
styling={styling}
|
||||
/>
|
||||
</LinkedScrollSection>
|
||||
</div>
|
||||
</LinkedScrollWrapper>
|
||||
<LinkedScrollSection linkHorizontal>
|
||||
<HeadersTable
|
||||
cellWidth={cellWidth}
|
||||
columnSeparatorWidth={columnSeparatorWidth}
|
||||
component={component}
|
||||
data={data}
|
||||
general={general}
|
||||
isKpi={false}
|
||||
styling={styling}
|
||||
/>
|
||||
</LinkedScrollSection>
|
||||
<LinkedScrollSection linkHorizontal linkVertical>
|
||||
<DataTable
|
||||
cellWidth={cellWidth}
|
||||
columnSeparatorWidth={columnSeparatorWidth}
|
||||
component={component}
|
||||
data={data}
|
||||
general={general}
|
||||
styling={styling}
|
||||
/>
|
||||
</LinkedScrollSection>
|
||||
</div>
|
||||
</LinkedScrollWrapper>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -123,9 +134,9 @@ Root.propTypes = {
|
||||
component: PropTypes.shape({}).isRequired,
|
||||
editmodeClass: PropTypes.string.isRequired,
|
||||
state: PropTypes.shape({
|
||||
data: PropTypes.object.isRequired,
|
||||
general: PropTypes.object.isRequired,
|
||||
styling: PropTypes.object.isRequired
|
||||
data: PropTypes.object,
|
||||
general: PropTypes.object,
|
||||
styling: PropTypes.object
|
||||
}).isRequired
|
||||
};
|
||||
|
||||
|
||||
@@ -4,11 +4,13 @@ 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: 'source-map',
|
||||
devtool: DEVTOOL,
|
||||
entry: ['./src/index.js'],
|
||||
externals: {
|
||||
jquery: {
|
||||
|
||||
Reference in New Issue
Block a user