Skip to content

Commit

Permalink
Merge pull request #42 from nzzdev/release-2.0.4
Browse files Browse the repository at this point in the history
Release 2.0.4
  • Loading branch information
philipkueng authored Jun 27, 2018
2 parents a2f8d53 + 940a001 commit d52c4d3
Show file tree
Hide file tree
Showing 13 changed files with 162 additions and 62 deletions.
11 changes: 3 additions & 8 deletions helpers/renderingInfoScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,10 @@ function getCardLayoutScript(context) {

let renderMinibarsFunction = "";
if (
context.item.options.minibar != null &&
context.item.options.minibar !== undefined
context.item.options.minibar.selectedColumn !== null &&
context.item.options.minibar.selectedColumn !== undefined
) {
if (
context.item.options.minibar.selectedColumn !== null &&
context.item.options.minibar.selectedColumn !== undefined
) {
renderMinibarsFunction = `renderMinibars${context.id}()`;
}
renderMinibarsFunction = `renderMinibars${context.id}()`;
}

return `
Expand Down
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.3",
"version": "2.0.4",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
16 changes: 15 additions & 1 deletion resources/fixtures/data/four-column-no-header.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@
"options": {
"hideTableHeader": true,
"cardLayout": false,
"cardLayoutIfSmall": true
"cardLayoutIfSmall": true,
"minibar": {
"invertColors": false,
"barColor": {
"positive": {
"className": "",
"colorCode": ""
},
"negative": {
"className": "",
"colorCode": ""
}
},
"selectedColumn": null
}
}
}
16 changes: 15 additions & 1 deletion resources/fixtures/data/four-column.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@
"sources": [],
"options": {
"cardLayout": false,
"cardLayoutIfSmall": true
"cardLayoutIfSmall": true,
"minibar": {
"invertColors": false,
"barColor": {
"positive": {
"className": "",
"colorCode": ""
},
"negative": {
"className": "",
"colorCode": ""
}
},
"selectedColumn": null
}
}
}
16 changes: 15 additions & 1 deletion resources/fixtures/data/hyphen-sign-as-number.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@
"sources": [],
"options": {
"cardLayout": false,
"cardLayoutIfSmall": true
"cardLayoutIfSmall": true,
"minibar": {
"invertColors": false,
"barColor": {
"positive": {
"className": "",
"colorCode": ""
},
"negative": {
"className": "",
"colorCode": ""
}
},
"selectedColumn": null
}
}
}
16 changes: 15 additions & 1 deletion resources/fixtures/data/mixed-numbers-and-text-in-cell.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@
"options": {
"hideTableHeader": true,
"cardLayout": false,
"cardLayoutIfSmall": false
"cardLayoutIfSmall": false,
"minibar": {
"invertColors": false,
"barColor": {
"positive": {
"className": "",
"colorCode": ""
},
"negative": {
"className": "",
"colorCode": ""
}
},
"selectedColumn": null
}
}
}
16 changes: 15 additions & 1 deletion resources/fixtures/data/multiline-text.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@
"options": {
"hideTableHeader": false,
"cardLayout": false,
"cardLayoutIfSmall": true
"cardLayoutIfSmall": true,
"minibar": {
"invertColors": false,
"barColor": {
"positive": {
"className": "",
"colorCode": ""
},
"negative": {
"className": "",
"colorCode": ""
}
},
"selectedColumn": null
}
}
}
16 changes: 15 additions & 1 deletion resources/fixtures/data/show-more-button.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,21 @@
"options": {
"hideTableHeader": false,
"cardLayout": false,
"cardLayoutIfSmall": true
"cardLayoutIfSmall": true,
"minibar": {
"invertColors": false,
"barColor": {
"positive": {
"className": "",
"colorCode": ""
},
"negative": {
"className": "",
"colorCode": ""
}
},
"selectedColumn": null
}
},
"tool": "table",
"subtitle": "State by state breakdown"
Expand Down
16 changes: 15 additions & 1 deletion resources/fixtures/data/two-column.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,21 @@
],
"options": {
"cardLayout": false,
"cardLayoutIfSmall": false
"cardLayoutIfSmall": false,
"minibar": {
"invertColors": false,
"barColor": {
"positive": {
"className": "",
"colorCode": ""
},
"negative": {
"className": "",
"colorCode": ""
}
},
"selectedColumn": null
}
},
"notes": "Anmerkungen",
"sources": [
Expand Down
22 changes: 14 additions & 8 deletions resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"properties": {
"title": {
"title": "Titel",
"type": "string"
"type": "string",
"Q:options": {
"placeholder": "Der Titel bringt die Kernaussage der Tabelle auf den Punkt."
}
},
"subtitle": {
"title": "Untertitel",
Expand Down Expand Up @@ -34,20 +37,23 @@
"minItems": 1
},
"sources": {
"title": "Quellen",
"title": "Quelle(n)",
"type": "array",
"items": {
"type": "object",
"title": "Quelle",
"properties": {
"text": {
"title": "Text",
"title": "Quelle",
"type": "string"
},
"link": {
"Q:type": "link",
"title": "Link",
"type": "object",
"Q:options": {
"placeholder": "Direktlink zur Quelle, http://..."
},
"properties": {
"url": {
"title": "Url",
Expand Down Expand Up @@ -147,7 +153,7 @@
}
},
"barColor": {
"title": "Farben",
"title": "Farben manuell festlegen",
"type": "object",
"Q:options": {
"availabilityChecks": [
Expand All @@ -164,7 +170,7 @@
},
"properties": {
"positive": {
"title": "Positiv",
"title": "Positive Werte",
"type": "object",
"Q:options": {
"availabilityChecks": [
Expand All @@ -177,7 +183,7 @@
},
"properties": {
"className": {
"title": "CSS Klassenname",
"title": "CSS-Klassenname",
"default": "",
"type": "string"
},
Expand All @@ -190,7 +196,7 @@
}
},
"negative": {
"title": "Negativ",
"title": "Negative Werte",
"type": "object",
"Q:options": {
"availabilityChecks": [
Expand All @@ -203,7 +209,7 @@
},
"properties": {
"className": {
"title": "CSS Klassenname",
"title": "CSS-Klassenname",
"default": "",
"type": "string"
},
Expand Down
73 changes: 37 additions & 36 deletions routes/rendering-info/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,44 +143,42 @@ module.exports = {
}

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

if (
item.options.minibar.selectedColumn !== null &&
item.options.minibar.selectedColumn !== undefined
item.options.minibar.barColor.positive.className === "" &&
item.options.minibar.barColor.positive.colorCode === ""
) {
context.minibar = data.getDataForMinibars(
itemDataCopy,
item.options.minibar.selectedColumn
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.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;
}
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 @@ -225,7 +223,7 @@ module.exports = {
(item.options.cardLayout === false &&
item.options.cardLayoutIfSmall === true) ||
possibleToHaveToHideRows ||
item.options.minibar !== null
item.options.minibar.selectedColumn !== null
) {
renderingInfo.scripts.push({
content: renderingInfoScripts.getDefaultScript(context)
Expand All @@ -249,7 +247,10 @@ module.exports = {
});
}

if (item.options.minibar !== undefined && item.options.minibar !== null) {
if (
item.options.minibar.selectedColumn !== undefined &&
item.options.minibar.selectedColumn !== null
) {
renderingInfo.scripts.push({
content: renderingInfoScripts.getMinibarsScript(context)
});
Expand Down
2 changes: 1 addition & 1 deletion views/minibar.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<td
{% if item.options.hideTableHeader !== true %}
data-label="{{ item.data[0][loop.index0].value }}"
data-minibar="{{minibar.type}}"
{% endif %}
data-minibar="{{minibar.type}}"
class="q-table__cell
{% if item.options.minibar.selectedColumn+1 === loop.index and item.options.minibar.selectedColumn != null and not initWithCardLayout %}
q-table-minibar--{{minibar.values[row_loop.index].type}}">
Expand Down

0 comments on commit d52c4d3

Please sign in to comment.