@zambezi/grid
Advanced tools
Comparing version 0.4.0 to 0.5.0
{ | ||
"name": "@zambezi/grid", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "D3 component for drawing financial grids.", | ||
@@ -30,2 +30,3 @@ "keywords": [ | ||
"babelrc-rollup": "2.0.0", | ||
"d3": "^4.2.3", | ||
"faker": "1.0.0", | ||
@@ -41,3 +42,3 @@ "mkdirp": "0.5.1", | ||
"dependencies": { | ||
"@zambezi/d3-utils": "^3.1.0", | ||
"@zambezi/d3-utils": "^3.2.0", | ||
"@zambezi/fun": "^2.0.1", | ||
@@ -44,0 +45,0 @@ "d3-array": "^1.0.1", |
@@ -11,2 +11,7 @@ Zambezi Grid | ||
Documentation | ||
------------- | ||
See [SUMMARY](SUMMARY.md) for detailed usage. | ||
Found an issue, or want to contribute? | ||
@@ -13,0 +18,0 @@ -------------------------------------- |
@@ -12,3 +12,3 @@ import { basicPrecisionPxFormatter as px } from './basic-precision-px-formatter' | ||
import { select } from 'd3-selection' | ||
import { selectionChanged, rebind } from '@zambezi/d3-utils' | ||
import { selectionChanged, rebind, redispatch } from '@zambezi/d3-utils' | ||
@@ -35,2 +35,16 @@ import './body.css' | ||
, dispatch = createDispatch('visible-lines-change') | ||
, redispatcher = redispatch() | ||
.from(dispatch, 'visible-lines-change') | ||
.from( | ||
cells | ||
, 'cell-enter' | ||
, 'cell-exit' | ||
, 'cell-update' | ||
, 'row-changed' | ||
, 'row-enter' | ||
, 'row-exit' | ||
, 'row-update' | ||
) | ||
.create() | ||
, ensureSize = createEnsureSize() | ||
@@ -40,3 +54,3 @@ , api = rebind() | ||
.from(bodyBlockLayout, 'virtualizeRows', 'virtualizeColumns') | ||
.from(dispatch, 'on') | ||
.from(redispatcher, 'on') | ||
@@ -43,0 +57,0 @@ let sizeValidationRound = 0 |
@@ -1,2 +0,4 @@ | ||
import { appendFromTemplate, selectionChanged } from '@zambezi/d3-utils' | ||
import { appendFromTemplate, selectionChanged, rebind, forward } from '@zambezi/d3-utils' | ||
import { dispatch as createDispatch } from 'd3-dispatch' | ||
import { partial } from 'underscore' | ||
import { property, batch } from '@zambezi/fun' | ||
@@ -19,2 +21,14 @@ import { select } from 'd3-selection' | ||
export function createCells() { | ||
const dispatcher = createDispatch( | ||
'cell-enter' | ||
, 'cell-exit' | ||
, 'cell-update' | ||
, 'row-changed' | ||
, 'row-enter' | ||
, 'row-exit' | ||
, 'row-update' | ||
) | ||
, api = rebind().from(dispatcher, 'on') | ||
let rowKey | ||
@@ -53,3 +67,3 @@ , rowChangedKey | ||
return cells | ||
return api(cells) | ||
@@ -62,7 +76,7 @@ function cellsEach(d, i) { | ||
runColumnComponents | ||
// , dispatcher['cell-update'] | ||
, forward(dispatcher, 'cell-update') | ||
) | ||
, columnClassAndNotifyEnter = batch( | ||
columnClass | ||
// , dispatcher['cell-enter'] | ||
, forward(dispatcher, 'cell-enter') | ||
) | ||
@@ -75,11 +89,11 @@ | ||
.remove() | ||
// .each(dispatcher['row-exit']) | ||
.each(forward(dispatcher, 'row-exit')) | ||
, rowsEnter = rows.enter() | ||
.select(appendRow) | ||
// .each(dispatcher['row-enter']) | ||
.each(forward(dispatcher, 'row-enter')) | ||
, rowChanged = rows | ||
.merge(rowsEnter) | ||
// .each(dispatcher['row-update']) | ||
.each(forward(dispatcher, 'row-update')) | ||
.select( | ||
@@ -91,3 +105,3 @@ changed.key( | ||
.each(updateRow) | ||
// .each(dispatcher['row-changed']) | ||
.each(forward(dispatcher, 'row-changed')) | ||
@@ -99,3 +113,3 @@ , cellsUpdate = rowChanged.selectAll('.zambezi-grid-cell') | ||
.remove() | ||
// .each(dispatcher['cell-exit']) | ||
.each(forward(dispatcher, 'cell-exit')) | ||
@@ -141,3 +155,2 @@ , cellsEnter = cellsUpdate.enter() | ||
if (!d.column.components) return | ||
// d.dispatcher = dispatcher | ||
d.column.components.forEach(runColumnComponent) | ||
@@ -144,0 +157,0 @@ function runColumnComponent(component) { |
import { select } from 'd3-selection' | ||
export function ensureData(d, i) { | ||
if (!d) select(this).datum([]) | ||
let rows = d || [] | ||
rows.rows = null | ||
select(this).datum(rows) | ||
} |
@@ -7,2 +7,3 @@ import { calculateColumnLayout } from './calculate-column-layout' | ||
import { createEnsureColumns } from './ensure-columns' | ||
import { createExportServerSideFilterAndSort } from './export-server-side-filter-and-sort' | ||
import { createHeaders } from './headers' | ||
@@ -22,3 +23,3 @@ import { createLayOutBodyAndOverlays } from './lay-out-body-and-overlays' | ||
import { rebind, redispatch, call, each, redraw, createResize, createAutoDirty, | ||
throttle, throttleToAnimationFrame } from '@zambezi/d3-utils' | ||
throttle, throttleToAnimationFrame } from '@zambezi/d3-utils' | ||
@@ -39,2 +40,3 @@ import './grid.css' | ||
, sortRowHeaders = createSortRowHeaders() | ||
, serverSideFilterAndSort = createExportServerSideFilterAndSort() | ||
, autodirty = createAutoDirty() | ||
@@ -59,2 +61,3 @@ , grid = compose( | ||
, call(ensureColumns) | ||
, call(serverSideFilterAndSort) | ||
, each(ensureData) | ||
@@ -66,3 +69,14 @@ , each(ensureId) | ||
.from(dispatchDraw, 'draw') | ||
.from(body, 'visible-lines-change') | ||
.from(sortRowHeaders, 'sort-changed') | ||
.from( | ||
body | ||
, 'visible-lines-change' | ||
, 'cell-enter' | ||
, 'cell-exit' | ||
, 'cell-update' | ||
, 'row-changed' | ||
, 'row-enter' | ||
, 'row-exit' | ||
, 'row-update' | ||
) | ||
.create() | ||
@@ -73,7 +87,8 @@ | ||
.from(columnSizers, 'resizeColumnsByDefault') | ||
.from(redispatcher, 'on') | ||
.from(ensureColumns, 'columns') | ||
.from(processRowData, 'filters', 'filtersUse', 'skipRowLocking') | ||
.from(processSizeAndClipping, 'scroll') | ||
.from(redispatcher, 'on') | ||
.from(resize, 'wait:resizeWait') | ||
.from(serverSideFilterAndSort, 'serverSideFilterAndSort') | ||
.from(setupTemplate, 'template') | ||
@@ -80,0 +95,0 @@ .from(sortRowHeaders, 'sortableByDefault') |
@@ -0,4 +1,5 @@ | ||
import { dispatch as createDispatch } from 'd3-dispatch' | ||
import { property } from '@zambezi/fun' | ||
import { select } from 'd3-selection' | ||
import { selectionChanged } from '@zambezi/d3-utils' | ||
import { selectionChanged, rebind } from '@zambezi/d3-utils' | ||
@@ -12,2 +13,4 @@ import './sort-row-headers.css' | ||
const changed = selectionChanged().key(sortDirection) | ||
, dispatch = createDispatch('sort-changed') | ||
let sortableByDefault = true | ||
@@ -25,3 +28,3 @@ | ||
return sortRowHeaders | ||
return rebind().from(dispatch, 'on')(sortRowHeaders) | ||
@@ -56,5 +59,6 @@ function sortRowHeadersEach(d, i) { | ||
dispatch.call('sort-changed', this, d) | ||
target | ||
.dispatch('data-dirty') | ||
.dispatch('sort-changed', { detail: d }) | ||
.dispatch('redraw') | ||
@@ -61,0 +65,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
373506
60
4551
27
13
Updated@zambezi/d3-utils@^3.2.0