Skip to content

Commit

Permalink
Merge pull request #492 from valor-software/feature/handsontable-fixes
Browse files Browse the repository at this point in the history
Numeric format fix
  • Loading branch information
rene-leanix authored Dec 15, 2017
2 parents e8cb386 + 05ebc23 commit 1d12711
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 21 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<a name="2.0.1"></a>
## [2.0.1](https://github.com/valor-software/ng2-handsontable/compare/2.0.0...v2.0.1) (2017-12-15)


### Bug Fixes

* **demo:** Update numeric formats ([8a7b278](https://github.com/valor-software/ng2-handsontable/commit/8a7b278))



<a name="2.0.0"></a>
# [2.0.0](https://github.com/valor-software/ng2-handsontable/compare/v1.0.4...v2.0.0) (2017-12-12)

Expand Down
10 changes: 5 additions & 5 deletions demo/src/components/handsontable/advanced-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ export class AdvancedDemoComponent {
this.colHeaders = ['Country', 'Level', 'Units', 'As Of', '1Y Chg', '5Y Ago', '10Y Ago', '25Y Ago'];
this.columns = [
{data: 0, type: 'text'},
{data: 1, type: 'numeric', format: '0,0.00[0000]'},
{data: 1, type: 'numeric', numericFormat: { pattern: '0,0.00[0000]' }},
{data: 2, type: 'text'},
{data: 3, type: 'numeric', format: '0'},
{data: 4, type: 'numeric', format: '0.00%', renderer:
{data: 3, type: 'numeric', numericFormat: { pattern: '0' }},
{data: 4, type: 'numeric', numericFormat: { pattern: '0.00%' }, renderer:
function percentRenderer(instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.NumericRenderer.apply(this, arguments);
td.style.color = (value < 0) ? 'red' : 'green';
}
},
{data: 5, type: 'numeric', format: '0,0.00[0000]'},
{data: 6, type: 'numeric', format: '0,0.00[0000]'}
{data: 5, type: 'numeric', numericFormat: { pattern: '0,0.00[0000]' }},
{data: 6, type: 'numeric', numericFormat: { pattern: '0,0.00[0000]' }}
];
this.options = {
height: 396,
Expand Down
2 changes: 1 addition & 1 deletion demo/src/components/handsontable/basic-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class BasicDemoComponent {
{
data: 'price',
type: 'numeric',
format: '$ 0,0.00'
numericFormat: { pattern: '$0,0.00', culture: 'en-US' }
},
{
data: 'isActive',
Expand Down
8 changes: 4 additions & 4 deletions demo/src/components/handsontable/finance-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export class FinanceDemoComponent {
this.data = getFinanceData();
this.colHeaders = ['Price', 'Date', '1D Chg', 'YTD Chg', 'Vol BTC'];
this.columns = [
{type: 'numeric', format: '$0,0.00'},
{type: 'numeric', numericFormat: { pattern: '$0,0.00', culture: 'en-US' }},
{type: 'date', dateFormat: 'DD/MM/YYYY', correctFormat: true},
{type: 'numeric', format: '0.00%'},
{type: 'numeric', format: '0.00%'},
{type: 'numeric', format: '0.00'}
{type: 'numeric', numericFormat: { pattern: '0.00%' }},
{type: 'numeric', numericFormat: { pattern: '0.00%' }},
{type: 'numeric', numericFormat: { pattern: '0.00' }}
];
this.options = {
height: 396,
Expand Down
2 changes: 1 addition & 1 deletion demo/src/components/handsontable/personal-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class PersonalDemoComponent {
const a42 = Array.apply(0, Array(42)).map((x, y) => y + 1);
if (a42.indexOf(row) !== -1 && col >= 1) {
cellProperties.type = 'numeric';
cellProperties.format = '$0,0.00';
cellProperties.numericFormat = { pattern: '$0,0.00', culture: 'en-US' };
}

return cellProperties;
Expand Down
8 changes: 4 additions & 4 deletions demo/src/components/handsontable/science-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export class ScienceDemoComponent {
columnSorting: true,
columns: [
{data: 0, renderer: 'html'},
{data: 1, type: 'numeric', format: '0[.]000000000000000'},
{data: 2, type: 'numeric', format: '0[.]000000000000000', renderer: heatmapRenderer},
{data: 3, type: 'numeric', format: '0[.]000000000000000'},
{data: 4, type: 'numeric', format: '0[.]000000000000000', renderer: heatmapRenderer}
{data: 1, type: 'numeric', numericFormat: { pattern: '0[.]000000000000000' }},
{data: 2, type: 'numeric', numericFormat: { pattern: '0[.]000000000000000' }, renderer: heatmapRenderer},
{data: 3, type: 'numeric', numericFormat: { pattern: '0[.]000000000000000' }},
{data: 4, type: 'numeric', numericFormat: { pattern: '0[.]000000000000000' }, renderer: heatmapRenderer}
],
afterLoadData: updateHeatmap,
beforeChangeRender: updateHeatmap,
Expand Down
10 changes: 5 additions & 5 deletions demo/src/components/handsontable/sport-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export class SportDemoComponent {
{data: 0, type: 'numeric'},
{data: 1, type: 'text'},
{data: 2, renderer: 'html', width: 200},
{data: 3, type: 'numeric', format: '$0,0.00'},
{data: 4, type: 'numeric', format: '0.00%'},
{data: 5, type: 'numeric', format: '0.00%'},
{data: 6, type: 'numeric', format: '$0,0.00'},
{data: 7, type: 'numeric', format: '$0,0.00'}
{data: 3, type: 'numeric', numericFormat: { pattern: '$0,0.00', culture: 'en-US' }},
{data: 4, type: 'numeric', numericFormat: { pattern: '0.00%' }},
{data: 5, type: 'numeric', numericFormat: { pattern: '0.00%' }},
{data: 6, type: 'numeric', numericFormat: { pattern: '$0,0.00', culture: 'en-US' }},
{data: 7, type: 'numeric', numericFormat: { pattern: '$0,0.00', culture: 'en-US' }}
],
cells: (row, col, prop) => {
const cellProperties: any = {};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng2-handsontable-base",
"version": "2.0.0",
"version": "2.0.1",
"description": "Angular4 Handsontable components",
"private": true,
"scripts": {
Expand Down

0 comments on commit 1d12711

Please sign in to comment.