From 7dc9b8516543e72410e5dc5ed6ebc10c198df45b Mon Sep 17 00:00:00 2001 From: Tanner Linsley Date: Fri, 14 Feb 2020 12:12:24 -0700 Subject: [PATCH] Polish merge conflicts and changelog updates --- .huskyrc.js | 2 +- .size-snapshot.json | 12 +++++----- CHANGELOG.md | 7 ++++++ .../full-width-resizable-table/src/App.js | 18 ++++---------- src/plugin-hooks/tests/useFlexLayout.test.js | 14 +++++------ src/plugin-hooks/useFilters.js | 4 ++-- src/utils.js | 6 ++--- yarn.lock | 24 ------------------- 8 files changed, 30 insertions(+), 57 deletions(-) diff --git a/.huskyrc.js b/.huskyrc.js index 8f4da5c..a92ecf3 100644 --- a/.huskyrc.js +++ b/.huskyrc.js @@ -1,6 +1,6 @@ module.exports = { hooks: { - // 'pre-commit': 'lint-staged && yarn test:ci', + 'pre-commit': 'lint-staged && yarn test:ci', // 'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS', }, } diff --git a/.size-snapshot.json b/.size-snapshot.json index d2118df..4493b6c 100644 --- a/.size-snapshot.json +++ b/.size-snapshot.json @@ -1,13 +1,13 @@ { "dist/index.js": { - "bundled": 113233, - "minified": 52524, - "gzipped": 13836 + "bundled": 126701, + "minified": 59700, + "gzipped": 15373 }, "dist/index.es.js": { - "bundled": 112296, - "minified": 51688, - "gzipped": 13670, + "bundled": 125788, + "minified": 58888, + "gzipped": 15205, "treeshaked": { "rollup": { "code": 80, diff --git a/CHANGELOG.md b/CHANGELOG.md index bd98143..65bfc2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,13 @@ - Removed the concept of complex aggregations (eg. `column.aggregate = ['sum', 'count']`). Instead, a better aggregation function signature is now used to allow for leaf node aggregation when needed. - Added the `column.aggregateValue` option which allows resolving (or pre-aggregating) a cell's value before it is grouped and aggregated across rows. This is useful for cell values that are not primitive, eg. an array of values that you may want to unique and count before summing that count across your groupings - The function signature for aggregation functions has changed to be `(leafValues, aggregatedValues) => aggregatedValue` where `leafValues` is a flat array containing all leaf rows currently grouped at the aggregation level and `aggregatedValues` is an array containing the aggregated values from the immediate child sub rows. Each has purpose in the types of aggregations they power where optimizations are made for either accuracy or performance. +- Fixed an issue where `setGlobalFilter` was not a stable callback +- Added a Bootstrap UI example +- Added fixed with column support for useFlexLayout +- Fixed an issue where `manualGlobalFilter` was not resetting pagination properly +- Fixed an issue where `useGlobalFilter` could be placed after `usePagination` +- Added the sort order direction as a parameter to the sortMethod function +- Fixed an issue where user filter types were not being referenced correctly ## 7.0.0-rc.15 diff --git a/examples/full-width-resizable-table/src/App.js b/examples/full-width-resizable-table/src/App.js index 2801afb..e00f118 100755 --- a/examples/full-width-resizable-table/src/App.js +++ b/examples/full-width-resizable-table/src/App.js @@ -58,7 +58,7 @@ const Styles = styled.div` } .resizer { - right: -5px; + right: 0; background: blue; width: 10px; height: 100%; @@ -66,23 +66,13 @@ const Styles = styled.div` top: 0; z-index: 1; ${'' /* prevents from scrolling while dragging on touch devices */} - touch-action:none; + touch-action :none; &.isResizing { background: red; } } } - - .th { - &:last-of-type { - .resizer { - ${'' /* note that the 15 is the scroll width and if also referenced in the getHeaderGroupProps for the header row below */} - ${'' /* todo: resolve this value dynamicaly from element.scrollWidth to account for OS/Browser differences */} - right: -15px; - } - } - } } ` @@ -145,7 +135,7 @@ function Table({ columns, data }) { useFlexLayout, useRowSelect, hooks => { - hooks.flatColumns.push(columns => [ + hooks.allColumns.push(columns => [ // Let's make a column for selection { id: 'selection', @@ -184,7 +174,7 @@ function Table({ columns, data }) { {headerGroups.map(headerGroup => (
diff --git a/src/plugin-hooks/tests/useFlexLayout.test.js b/src/plugin-hooks/tests/useFlexLayout.test.js index adc69f2..593ffc4 100644 --- a/src/plugin-hooks/tests/useFlexLayout.test.js +++ b/src/plugin-hooks/tests/useFlexLayout.test.js @@ -138,7 +138,7 @@ function App() { test('renders a table', () => { const rendered = render() - const [headerRow, firstRow] = rendered.queryAllByRole('row') + const [headerRow, , firstRow] = rendered.queryAllByRole('row') expect(headerRow.getAttribute('style')).toEqual( 'display: flex; flex: 1 0 auto; min-width: 800px;' @@ -147,11 +147,11 @@ test('renders a table', () => { expect( Array.from(firstRow.children).map(d => d.getAttribute('style')) ).toEqual([ - 'box-sizing: border-box; flex: 250 0 auto; min-width: 100px; width: 250px;', - 'box-sizing: border-box; flex: 300 0 auto; min-width: 100px; width: 300px;', - 'box-sizing: border-box; flex: 300 0 auto; min-width: 300px; width: 300px;', - 'box-sizing: border-box; flex: 150 0 auto; min-width: 100px; width: 150px;', - 'box-sizing: border-box; flex: 200 0 auto; min-width: 100px; width: 200px;', - 'box-sizing: border-box; flex: 200 0 auto; min-width: 100px; width: 200px;', + 'box-sizing: border-box; flex: 0 0 auto; min-width: 100px; width: 250px;', + 'box-sizing: border-box; flex: 0 0 auto; min-width: 100px; width: 300px;', + 'box-sizing: border-box; flex: 0 0 auto; min-width: 300px; width: 300px;', + 'box-sizing: border-box; flex: 0 0 auto; min-width: 100px; width: 150px;', + 'box-sizing: border-box; flex: 0 0 auto; min-width: 100px; width: 200px;', + 'box-sizing: border-box; flex: 0 0 auto; min-width: 100px; width: 200px;', ]) }) diff --git a/src/plugin-hooks/useFilters.js b/src/plugin-hooks/useFilters.js index 54b41da..aa6179b 100755 --- a/src/plugin-hooks/useFilters.js +++ b/src/plugin-hooks/useFilters.js @@ -44,9 +44,9 @@ function reducer(state, action, previousState, instance) { if (action.type === actions.setFilter) { const { columnId, filterValue } = action - const { flatColumns, filterTypes: userFilterTypes } = instance + const { allColumns, filterTypes: userFilterTypes } = instance - const column = flatColumns.find(d => d.id === columnId) + const column = allColumns.find(d => d.id === columnId) if (!column) { throw new Error( diff --git a/src/utils.js b/src/utils.js index 0a5c038..480f6cb 100755 --- a/src/utils.js +++ b/src/utils.js @@ -319,12 +319,12 @@ export function isFunction(a) { } export function flattenBy(arr, key) { - const flatColumns = [] + const flat = [] const recurse = arr => { arr.forEach(d => { if (!d[key]) { - flatColumns.push(d) + flat.push(d) } else { recurse(d[key]) } @@ -333,7 +333,7 @@ export function flattenBy(arr, key) { recurse(arr) - return flatColumns + return flat } export function expandRows( diff --git a/yarn.lock b/yarn.lock index c70b960..31e594a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2617,11 +2617,6 @@ commander@^2.12.1: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.1.tgz#3863ce3ca92d0831dcf2a102f5fb4b5926afd0f9" integrity sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg== -commander@~2.20.3: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - commitizen@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/commitizen/-/commitizen-4.0.3.tgz#c19a4213257d0525b85139e2f36db7cc3b4f6dae" @@ -4370,17 +4365,6 @@ gzip-size@^5.0.0, gzip-size@^5.1.1: duplexer "^0.1.1" pify "^4.0.1" -handlebars@^4.1.2: - version "4.6.0" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.6.0.tgz#33af6c3eda930d7a924f5d8f1c6d8edc3180512e" - integrity sha512-i1ZUP7Qp2JdkMaFon2a+b0m5geE8Z4ZTLaGkgrObkEd+OkUKyRbRWw4KxuFCoHfdETSY1yf9/574eVoNSiK7pw== - dependencies: - neo-async "^2.6.0" - optimist "^0.6.1" - source-map "^0.6.1" - optionalDependencies: - uglify-js "^3.1.4" - har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" @@ -8488,14 +8472,6 @@ typescript@next: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.0-dev.20191009.tgz#852e49dca797bb35acf930583ef65e7b3b23fc01" integrity sha512-Vk/wZedTpVd3QAhr3mG1+sbUHcpJ1wfw49Wo1NCQvzMa0vHCJeocEwWzaV2yWprsuuFv4+e8tjCj1Vnme2CMHg== -uglify-js@^3.1.4: - version "3.7.4" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.7.4.tgz#e6d83a1aa32ff448bd1679359ab13d8db0fe0743" - integrity sha512-tinYWE8X1QfCHxS1lBS8yiDekyhSXOO6R66yNOCdUJeojxxw+PX2BHAz/BWyW7PQ7pkiWVxJfIEbiDxyLWvUGg== - dependencies: - commander "~2.20.3" - source-map "~0.6.1" - unicode-canonical-property-names-ecmascript@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818"