Skip to content

Commit

Permalink
Merge pull request #44 from nzzdev/release-2.0.5
Browse files Browse the repository at this point in the history
release-2.0.5
  • Loading branch information
philipkueng authored Jun 27, 2018
2 parents d52c4d3 + d4b2fed commit 5f3d296
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 62 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "q-table",
"version": "2.0.4",
"version": "2.0.5",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
73 changes: 47 additions & 26 deletions routes/option-availability.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,38 @@ module.exports = {
}

if (request.params.optionName === "barColor") {
return {
available:
let isAvailable = false;
if (
request.payload.options.minibar !== null &&
request.payload.options.minibar !== undefined
) {
isAvailable =
request.payload.options.minibar.selectedColumn !== null &&
request.payload.options.minibar.selectedColumn !== undefined
request.payload.options.minibar.selectedColumn !== undefined;
}

return {
available: isAvailable
};
}

if (request.params.optionName === "barColorPositive") {
let isAvailable = false;

if (
request.payload.options.minibar.selectedColumn !== null &&
request.payload.options.minibar.selectedColumn !== undefined
request.payload.options.minibar != null &&
request.payload.options.minibar != undefined
) {
let type = prepareSelectedColumn(
request.payload.data,
request.payload.options.minibar.selectedColumn
).type;
if (
request.payload.options.minibar.selectedColumn !== null &&
request.payload.options.minibar.selectedColumn !== undefined
) {
let type = prepareSelectedColumn(
request.payload.data,
request.payload.options.minibar.selectedColumn
).type;

isAvailable = type === "mixed" || type === "positive";
isAvailable = type === "mixed" || type === "positive";
}
}
return {
available: isAvailable
Expand All @@ -68,17 +80,21 @@ module.exports = {

if (request.params.optionName === "barColorNegative") {
let isAvailable = false;

if (
request.payload.options.minibar.selectedColumn !== null &&
request.payload.options.minibar.selectedColumn !== undefined
request.payload.options.minibar != null &&
request.payload.options.minibar != undefined
) {
let type = prepareSelectedColumn(
request.payload.data,
request.payload.options.minibar.selectedColumn
).type;
if (
request.payload.options.minibar.selectedColumn !== null &&
request.payload.options.minibar.selectedColumn !== undefined
) {
let type = prepareSelectedColumn(
request.payload.data,
request.payload.options.minibar.selectedColumn
).type;

isAvailable = type === "mixed" || type === "negative";
isAvailable = type === "mixed" || type === "negative";
}
}
return {
available: isAvailable
Expand All @@ -88,15 +104,20 @@ module.exports = {
if (request.params.optionName === "invertColors") {
let isAvailable = false;
if (
request.payload.options.minibar.selectedColumn !== null &&
request.payload.options.minibar.selectedColumn !== undefined
request.payload.options.minibar != null &&
request.payload.options.minibar != undefined
) {
let type = prepareSelectedColumn(
request.payload.data,
request.payload.options.minibar.selectedColumn
).type;
if (
request.payload.options.minibar.selectedColumn !== null &&
request.payload.options.minibar.selectedColumn !== undefined
) {
let type = prepareSelectedColumn(
request.payload.data,
request.payload.options.minibar.selectedColumn
).type;

isAvailable = type === "mixed";
isAvailable = type === "mixed";
}
}
return {
available: isAvailable
Expand Down
73 changes: 39 additions & 34 deletions routes/rendering-info/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,42 +143,44 @@ module.exports = {
}

// if minibars active
if (
item.options.minibar.selectedColumn !== null &&
item.options.minibar.selectedColumn !== undefined
) {
context.minibar = data.getDataForMinibars(
itemDataCopy,
item.options.minibar.selectedColumn
);

if (
item.options.minibar.barColor.positive.className === "" &&
item.options.minibar.barColor.positive.colorCode === ""
) {
item.options.minibar.barColor.positive.className = getPositiveColor(
context.minibar.type
);
} else if (item.options.minibar.barColor.positive.className !== "") {
item.options.minibar.barColor.positive.colorCode = "";
}

if (item.options.minibar !== null && item.options.minibar !== undefined) {
if (
item.options.minibar.barColor.negative.className === "" &&
item.options.minibar.barColor.negative.colorCode === ""
item.options.minibar.selectedColumn !== null &&
item.options.minibar.selectedColumn !== undefined
) {
item.options.minibar.barColor.negative.className = getNegativeColor(
context.minibar.type
context.minibar = data.getDataForMinibars(
itemDataCopy,
item.options.minibar.selectedColumn
);
} else if (item.options.minibar.barColor.negative.className !== "") {
item.options.minibar.barColor.negative.colorCode = "";
}

if (context.item.options.minibar.invertColors) {
let color = context.item.options.minibar.barColor.negative;
context.item.options.minibar.barColor.negative =
context.item.options.minibar.barColor.positive;
context.item.options.minibar.barColor.positive = color;
if (
item.options.minibar.barColor.positive.className === "" &&
item.options.minibar.barColor.positive.colorCode === ""
) {
item.options.minibar.barColor.positive.className = getPositiveColor(
context.minibar.type
);
} else if (item.options.minibar.barColor.positive.className !== "") {
item.options.minibar.barColor.positive.colorCode = "";
}

if (
item.options.minibar.barColor.negative.className === "" &&
item.options.minibar.barColor.negative.colorCode === ""
) {
item.options.minibar.barColor.negative.className = getNegativeColor(
context.minibar.type
);
} else if (item.options.minibar.barColor.negative.className !== "") {
item.options.minibar.barColor.negative.colorCode = "";
}

if (context.item.options.minibar.invertColors) {
let color = context.item.options.minibar.barColor.negative;
context.item.options.minibar.barColor.negative =
context.item.options.minibar.barColor.positive;
context.item.options.minibar.barColor.positive = color;
}
}
}

Expand Down Expand Up @@ -223,7 +225,9 @@ module.exports = {
(item.options.cardLayout === false &&
item.options.cardLayoutIfSmall === true) ||
possibleToHaveToHideRows ||
item.options.minibar.selectedColumn !== null
(item.options.minibar !== undefined &&
item.options.minibar !== null &&
item.options.minibar.selectedColumn !== null)
) {
renderingInfo.scripts.push({
content: renderingInfoScripts.getDefaultScript(context)
Expand All @@ -248,7 +252,8 @@ module.exports = {
}

if (
item.options.minibar.selectedColumn !== undefined &&
item.options.minibar !== undefined &&
item.options.minibar !== null &&
item.options.minibar.selectedColumn !== null
) {
renderingInfo.scripts.push({
Expand Down

0 comments on commit 5f3d296

Please sign in to comment.