Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2af1d3e
WIP
Sep 27, 2018
0646dc0
wip
Sep 27, 2018
cdb93f5
wip
Sep 27, 2018
50053fa
further down the rabbit hole..
Sep 27, 2018
fcc1edb
Merge remote-tracking branch 'origin/develop' into 3.1-refactor-cells…
Sep 27, 2018
70048e2
fix dropdown navigation regression
Sep 27, 2018
d5bed92
fix selected row regression
Sep 28, 2018
f03d02f
renaming / restructuring
Sep 28, 2018
7bebb9d
rename/restructure
Sep 28, 2018
4473467
- clean up zipping
Sep 28, 2018
966681f
rework style/ast cache
Sep 28, 2018
75736ed
clean up
Sep 28, 2018
219da49
clean up
Sep 28, 2018
1bbc70e
build update
Sep 28, 2018
172d3ab
improve rendering perf
Sep 28, 2018
ed7053c
optimize wrappers generation
Sep 28, 2018
1d93552
build config
Sep 28, 2018
b91af6a
- fix typing regression
Oct 1, 2018
72231b8
- fix navigation regression
Oct 1, 2018
61d3b74
simplify slightly the derived props / ui
Oct 1, 2018
443d380
fix copy/paste regressions
Oct 1, 2018
47be714
clean up wrapper props
Oct 1, 2018
4c16af0
clean up
Oct 1, 2018
c4a3609
merge with develop
Oct 1, 2018
54a9b49
fix regression on conditional dropdowns
Oct 2, 2018
617ce7b
wip, fp the headers
Oct 2, 2018
caecaf5
fp content, wrappers, labels, indices from header factory
Oct 2, 2018
e8b6751
fix regressions
Oct 2, 2018
f3b4671
fp the table itself
Oct 2, 2018
bf28720
fix typing and behavior for table fp
Oct 2, 2018
dd47d51
Merge remote-tracking branch 'origin/develop' into 3.1-refactor-cells…
Oct 3, 2018
b3cee9f
fix sorting icon regression
Oct 3, 2018
a177af2
fix regression
Oct 3, 2018
0c7be88
regression
Oct 3, 2018
d85c35f
fix column name regression with only 1 header row
Oct 3, 2018
1544031
fix header actions regression
Oct 3, 2018
9334516
Merge remote-tracking branch 'origin/develop' into 3.1-refactor-cells…
Oct 3, 2018
ed6c5c9
fix style application on mount
Oct 3, 2018
0cd7e2c
fix regression edit cell in n-th page
Oct 4, 2018
7a0b167
fix editing on non-first page (continued)
Oct 4, 2018
fd2ec45
merge develop into 3.1-refactor-cell-rendering
Oct 4, 2018
8033eb8
fix test
Oct 4, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dash_table/bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dash_table/demo.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion demo/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
import { Table } from 'dash-table';
import {mockData} from './data';
import { memoizeOne } from 'core/memoizer';
import Logger from 'core/Logger';

const clone = o => JSON.parse(JSON.stringify(o));

Expand Down Expand Up @@ -49,7 +50,7 @@ class App extends Component {

const setProps = memoizeOne(() => {
return newProps => {
console.info('--->', newProps);
Logger.debug('--->', newProps);
this.setState(prevState => ({
tableProps: R.merge(prevState.tableProps, newProps)
}));
Expand Down
2 changes: 1 addition & 1 deletion demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import App from './App';
import Logger, { DebugLevel, LogLevel } from 'core/Logger';

Logger.setDebugLevel(DebugLevel.DEBUG);
Logger.setLogLevel(LogLevel.WARNING);
Logger.setLogLevel(LogLevel.NONE);

ReactDOM.render(<App />, document.getElementById('root'));
37 changes: 37 additions & 0 deletions src/core/math/arrayZipMap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as R from 'ramda';

type Array<T> = T[];

export function arrayMap<T1, T2, TR>(
a1: Array<T1>,
a2: Array<T2>,
cb: (d1: T1, d2: T2, i: number) => TR
) {
const mapArray = R.addIndex<T1, TR>(R.map);

return mapArray((iValue, i) => cb(iValue, a2[i], i), a1);
}

export function arrayMap3<T1, T2, T3, TR>(
a1: Array<T1>,
a2: Array<T2>,
a3: Array<T3>,
cb: (d1: T1, d2: T2, d3: T3, i: number) => TR
) {
const mapArray = R.addIndex<T1, TR>(R.map);

return mapArray((iValue, i) => cb(iValue, a2[i], a3[i], i), a1);

}

export function arrayMapN<TR>(
cb: (i: number, ...args: any[]) => TR,
...arrays: (any[])[]
) {
const a1 = arrays.slice(0, 1);
const as = arrays.slice(1);

const mapArray = R.addIndex<any, TR>(R.map);

return mapArray((iValue, i) => cb(i, [iValue, ...as.map(a => a[i])]), a1);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helper functions for combined zip/map of n-arrays together.. less expensive than chaining (n-1) zips + mapping after.. still based off ramda

72 changes: 72 additions & 0 deletions src/core/math/matrixZipMap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import * as R from 'ramda';

type Matrix<T> = T[][];

export function matrixMap<T1, T2, TR>(
m1: Matrix<T1>,
m2: Matrix<T2>,
cb: (d1: T1, d2: T2, i: number, j: number) => TR
) {
const mapMatrix = R.addIndex<T1[], TR[]>(R.map);
const mapRow = R.addIndex<T1, TR>(R.map);

return mapMatrix((iRow, i) =>
mapRow(
(ijValue, j) => cb(ijValue, m2[i][j], i, j),
iRow
), m1
);
}

export function matrixMap3<T1, T2, T3, TR>(
m1: Matrix<T1>,
m2: Matrix<T2>,
m3: Matrix<T3>,
cb: (d1: T1, d2: T2, d3: T3, i: number, j: number) => TR
) {
const mapMatrix = R.addIndex<T1[], TR[]>(R.map);
const mapRow = R.addIndex<T1, TR>(R.map);

return mapMatrix((iRow, i) =>
mapRow(
(ijValue, j) => cb(ijValue, m2[i][j], m3[i][j], i, j),
iRow
), m1
);
}

export function matrixMap4<T1, T2, T3, T4, TR>(
m1: Matrix<T1>,
m2: Matrix<T2>,
m3: Matrix<T3>,
m4: Matrix<T4>,
cb: (d1: T1, d2: T2, d3: T3, d4: T4, i: number, j: number) => TR
) {
const mapMatrix = R.addIndex<T1[], TR[]>(R.map);
const mapRow = R.addIndex<T1, TR>(R.map);

return mapMatrix((iRow, i) =>
mapRow(
(ijValue, j) => cb(ijValue, m2[i][j], m3[i][j], m4[i][j], i, j),
iRow
), m1
);
}

export function matrixMapN<TR>(
cb: (i: number, j: number, ...args: any[]) => TR,
...matrices: (any[][])[]
) {
const m1 = matrices.slice(0, 1);
const ms = matrices.slice(1);

const mapMatrix = R.addIndex<any[], TR[]>(R.map);
const mapRow = R.addIndex<any, TR>(R.map);

return mapMatrix((iRow, i) =>
mapRow(
(ijValue, j) => cb(i, j, [ijValue, ...ms.map(m => m[i][j])]),
iRow
), m1
);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helper functions for combined zip/map of n-matrices together.. less expensive than chaining (n-1) (zip+zip) + mapping after.. still based off ramda

5 changes: 2 additions & 3 deletions src/core/memoizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ export function memoizeOne<
let lastArgs: any[] | null = null;
let lastResult: any;

return (...args: TArgs): TEntry => {
return isEqualArgs(lastArgs, args) ?
return (...args: TArgs): TEntry =>
isEqualArgs(lastArgs, args) ?
lastResult :
(lastArgs = args) && (lastResult = fn(...args));
};
}

export function memoizeOneFactory<
Expand Down
2 changes: 1 addition & 1 deletion src/core/memoizerCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function memoizerCache<
{
const cache = new Map<CacheKeyFragment, any>();

return (key: TKey, args: TArgs): TEntry => {
return (key: TKey, ...args: TArgs): TEntry => {
const lastKey = key.slice(-1)[0];
const cacheKeys = key.slice(0, -1);

Expand Down
Loading