From 037e80b5df209632b54deb68a9a949c0a655fde1 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Fri, 19 Apr 2024 11:55:08 +0300 Subject: [PATCH 01/15] Implement getColumnsMinWidths helper --- src/utils/columns.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/columns.js b/src/utils/columns.js index 0e4e3ad11..e342b3887 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -624,11 +624,17 @@ export const MIN_COLUMN_WIDTH = 100 export const DEFAULT_CONTAINER_WIDTH = 1000 +const getColumnsMinWidths = (columns) => _map(columns, + (column) => COLUMN_WIDTHS?.[column.id] ?? MIN_COLUMN_WIDTH) + export const getCalculatedColumnWidths = (columns, containerWidth) => { if (columns.length === 0) { return [] } + console.log('++columns', columns) + console.log('+++MIN_WIDTH', getColumnsMinWidths(columns)) + const avgWidth = Math.floor(containerWidth / columns.length) if (avgWidth < MIN_COLUMN_WIDTH) { return _map(columns, () => MIN_COLUMN_WIDTH) From 39bcf48a27de9388164126109c95f2ea3fead6be Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 22 Apr 2024 13:20:48 +0300 Subject: [PATCH 02/15] Fix columns util export --- src/utils/columns.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index e342b3887..da029c2ee 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -624,7 +624,7 @@ export const MIN_COLUMN_WIDTH = 100 export const DEFAULT_CONTAINER_WIDTH = 1000 -const getColumnsMinWidths = (columns) => _map(columns, +export const getColumnsMinWidths = (columns) => _map(columns, (column) => COLUMN_WIDTHS?.[column.id] ?? MIN_COLUMN_WIDTH) export const getCalculatedColumnWidths = (columns, containerWidth) => { @@ -632,7 +632,7 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { return [] } - console.log('++columns', columns) + console.log('++containerWidth', containerWidth) console.log('+++MIN_WIDTH', getColumnsMinWidths(columns)) const avgWidth = Math.floor(containerWidth / columns.length) From d8df55904e66caf343e69022c631a3f64c439c61 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 22 Apr 2024 13:36:22 +0300 Subject: [PATCH 03/15] Update first cols defult calculations --- src/utils/columns.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index da029c2ee..5b87a827c 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -641,7 +641,6 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { } const columnWidths = _map(columns, () => avgWidth) - columnWidths[0] = containerWidth - ((columns.length - 1) * avgWidth) return columnWidths } From 0f5bd28028dd3eb0c8ddaac5fc307009c8f904ba Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 22 Apr 2024 13:48:15 +0300 Subject: [PATCH 04/15] Implement getIsDefaultsWiderThanContainer checker utility --- src/utils/columns.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils/columns.js b/src/utils/columns.js index 5b87a827c..67a230335 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -1,5 +1,6 @@ import React from 'react' import _map from 'lodash/map' +import _sum from 'lodash/sum' import _head from 'lodash/head' import _filter from 'lodash/filter' import { Cell } from '@blueprintjs/table' @@ -627,11 +628,17 @@ export const DEFAULT_CONTAINER_WIDTH = 1000 export const getColumnsMinWidths = (columns) => _map(columns, (column) => COLUMN_WIDTHS?.[column.id] ?? MIN_COLUMN_WIDTH) +const getIsDefaultsWiderThanContainer = (columns, container) => _sum(getColumnsMinWidths(columns)) > container + + export const getCalculatedColumnWidths = (columns, containerWidth) => { if (columns.length === 0) { return [] } + const isDefaultsWiderThanContainer = getIsDefaultsWiderThanContainer(columns, containerWidth) + + console.log('++isDefaultsWiderThanContainer', isDefaultsWiderThanContainer) console.log('++containerWidth', containerWidth) console.log('+++MIN_WIDTH', getColumnsMinWidths(columns)) From 2e7b6eec019d0c5ac095baa7d9d3bc5d60eef550 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 22 Apr 2024 13:55:01 +0300 Subject: [PATCH 05/15] Cleanup --- src/utils/columns.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index 67a230335..54908cf5b 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -639,8 +639,6 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { const isDefaultsWiderThanContainer = getIsDefaultsWiderThanContainer(columns, containerWidth) console.log('++isDefaultsWiderThanContainer', isDefaultsWiderThanContainer) - console.log('++containerWidth', containerWidth) - console.log('+++MIN_WIDTH', getColumnsMinWidths(columns)) const avgWidth = Math.floor(containerWidth / columns.length) if (avgWidth < MIN_COLUMN_WIDTH) { From babacc16b12d68ad69b9d75419704f5aff102d84 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 22 Apr 2024 14:50:26 +0300 Subject: [PATCH 06/15] Implement wide/small columns checking flow --- src/utils/columns.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index 54908cf5b..dd3942b86 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -3,6 +3,7 @@ import _map from 'lodash/map' import _sum from 'lodash/sum' import _head from 'lodash/head' import _filter from 'lodash/filter' +import _forEach from 'lodash/forEach' import { Cell } from '@blueprintjs/table' import { get, pick, isEqual } from '@bitfinex/lib-js-util-base' @@ -622,7 +623,7 @@ export const formatSumUpValue = value => { } export const MIN_COLUMN_WIDTH = 100 - +export const WIDE_COLUMN_DEFAULT_WIDTH = 400 export const DEFAULT_CONTAINER_WIDTH = 1000 export const getColumnsMinWidths = (columns) => _map(columns, @@ -638,6 +639,23 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { const isDefaultsWiderThanContainer = getIsDefaultsWiderThanContainer(columns, containerWidth) + if (isDefaultsWiderThanContainer) { + const colsDefaults = getColumnsMinWidths(columns) + const smallColsIndexes = [] + const wideColsIndexes = [] + + _forEach(colsDefaults, (value, index) => { + if (value < MIN_COLUMN_WIDTH) smallColsIndexes.push(index) + if (value > WIDE_COLUMN_DEFAULT_WIDTH) wideColsIndexes.push(index) + }) + + + console.log('+++smallColsIndexes', smallColsIndexes) + console.log('+++wideColsIndexes', wideColsIndexes) + } + + + console.log('++def', getColumnsMinWidths(columns)) console.log('++isDefaultsWiderThanContainer', isDefaultsWiderThanContainer) const avgWidth = Math.floor(containerWidth / columns.length) From 7fee0170dc357efd7fd0826039776b85d09d3cc0 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Tue, 23 Apr 2024 12:05:34 +0300 Subject: [PATCH 07/15] Update average width calc flow --- src/utils/columns.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index dd3942b86..d1844e418 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -1,6 +1,7 @@ import React from 'react' import _map from 'lodash/map' import _sum from 'lodash/sum' +import _size from 'lodash/size' import _head from 'lodash/head' import _filter from 'lodash/filter' import _forEach from 'lodash/forEach' @@ -633,14 +634,15 @@ const getIsDefaultsWiderThanContainer = (columns, container) => _sum(getColumnsM export const getCalculatedColumnWidths = (columns, containerWidth) => { - if (columns.length === 0) { + if (_size(columns) === 0) { return [] } + const colsDefaults = getColumnsMinWidths(columns) + let avgWidth = Math.floor(containerWidth / _size(columns)) const isDefaultsWiderThanContainer = getIsDefaultsWiderThanContainer(columns, containerWidth) if (isDefaultsWiderThanContainer) { - const colsDefaults = getColumnsMinWidths(columns) const smallColsIndexes = [] const wideColsIndexes = [] @@ -649,7 +651,6 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { if (value > WIDE_COLUMN_DEFAULT_WIDTH) wideColsIndexes.push(index) }) - console.log('+++smallColsIndexes', smallColsIndexes) console.log('+++wideColsIndexes', wideColsIndexes) } @@ -658,7 +659,6 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { console.log('++def', getColumnsMinWidths(columns)) console.log('++isDefaultsWiderThanContainer', isDefaultsWiderThanContainer) - const avgWidth = Math.floor(containerWidth / columns.length) if (avgWidth < MIN_COLUMN_WIDTH) { return _map(columns, () => MIN_COLUMN_WIDTH) } From a5d81d97a8c00c7d0efa25fcc1639873d009d8c3 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Tue, 23 Apr 2024 12:19:52 +0300 Subject: [PATCH 08/15] Add small/wide cols precalculation flow --- src/utils/columns.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index d1844e418..d1fe6d9a5 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -3,6 +3,7 @@ import _map from 'lodash/map' import _sum from 'lodash/sum' import _size from 'lodash/size' import _head from 'lodash/head' +import _fill from 'lodash/fill' import _filter from 'lodash/filter' import _forEach from 'lodash/forEach' import { Cell } from '@blueprintjs/table' @@ -641,6 +642,8 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { const colsDefaults = getColumnsMinWidths(columns) let avgWidth = Math.floor(containerWidth / _size(columns)) const isDefaultsWiderThanContainer = getIsDefaultsWiderThanContainer(columns, containerWidth) + const preparedColsWidths = _fill(Array(_size(columns)), 0) + if (isDefaultsWiderThanContainer) { const smallColsIndexes = [] @@ -651,13 +654,19 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { if (value > WIDE_COLUMN_DEFAULT_WIDTH) wideColsIndexes.push(index) }) - console.log('+++smallColsIndexes', smallColsIndexes) - console.log('+++wideColsIndexes', wideColsIndexes) + _forEach(smallColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = avgWidth * 0.5 }) + _forEach(wideColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = avgWidth * 3 }) + + console.log('++avgWidth', avgWidth) + console.log('++preparedColsWidths', preparedColsWidths) + + // console.log('+++smallColsIndexes', smallColsIndexes) + // console.log('+++wideColsIndexes', wideColsIndexes) } - console.log('++def', getColumnsMinWidths(columns)) - console.log('++isDefaultsWiderThanContainer', isDefaultsWiderThanContainer) + // console.log('++def', getColumnsMinWidths(columns)) + // console.log('++isDefaultsWiderThanContainer', isDefaultsWiderThanContainer) if (avgWidth < MIN_COLUMN_WIDTH) { return _map(columns, () => MIN_COLUMN_WIDTH) From cab700e400f3154ac2eab8110a374363dcc482cb Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Tue, 23 Apr 2024 12:41:57 +0300 Subject: [PATCH 09/15] Implement columns widths adjustments flow --- src/utils/columns.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index d1fe6d9a5..4b8297674 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -641,8 +641,10 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { const colsDefaults = getColumnsMinWidths(columns) let avgWidth = Math.floor(containerWidth / _size(columns)) + if (avgWidth < MIN_COLUMN_WIDTH) return _map(columns, () => MIN_COLUMN_WIDTH) + console.log('++avgWidth1', avgWidth) const isDefaultsWiderThanContainer = getIsDefaultsWiderThanContainer(columns, containerWidth) - const preparedColsWidths = _fill(Array(_size(columns)), 0) + let preparedColsWidths = _fill(Array(_size(columns)), 0) if (isDefaultsWiderThanContainer) { @@ -654,27 +656,30 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { if (value > WIDE_COLUMN_DEFAULT_WIDTH) wideColsIndexes.push(index) }) - _forEach(smallColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = avgWidth * 0.5 }) - _forEach(wideColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = avgWidth * 3 }) + _forEach(smallColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = avgWidth * 0.7 }) + _forEach(wideColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = avgWidth * 2 }) - console.log('++avgWidth', avgWidth) + const calculatedCols = _size(smallColsIndexes) + _size(wideColsIndexes) + + avgWidth = Math.floor((containerWidth - _sum(preparedColsWidths)) / (_size(columns) - calculatedCols)) + + _forEach(preparedColsWidths, (value, index) => { + if (isEqual(value, 0)) preparedColsWidths[index] = avgWidth + }) + + console.log('++avgWidth2', avgWidth) console.log('++preparedColsWidths', preparedColsWidths) // console.log('+++smallColsIndexes', smallColsIndexes) // console.log('+++wideColsIndexes', wideColsIndexes) - } - + } else preparedColsWidths = _map(columns, () => avgWidth) // console.log('++def', getColumnsMinWidths(columns)) // console.log('++isDefaultsWiderThanContainer', isDefaultsWiderThanContainer) - if (avgWidth < MIN_COLUMN_WIDTH) { - return _map(columns, () => MIN_COLUMN_WIDTH) - } - - const columnWidths = _map(columns, () => avgWidth) + // const columnWidths = _map(columns, () => avgWidth) - return columnWidths + return preparedColsWidths } export default { From 44faf5718b5cf4067456b8f7d0c7efbfa074689d Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Tue, 23 Apr 2024 12:49:11 +0300 Subject: [PATCH 10/15] Adjust small multiplier --- src/utils/columns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index 4b8297674..671016a04 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -656,7 +656,7 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { if (value > WIDE_COLUMN_DEFAULT_WIDTH) wideColsIndexes.push(index) }) - _forEach(smallColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = avgWidth * 0.7 }) + _forEach(smallColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = avgWidth * 0.8 }) _forEach(wideColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = avgWidth * 2 }) const calculatedCols = _size(smallColsIndexes) + _size(wideColsIndexes) From 24fc56223d6c673ad4f4253b7729f7ea8a071c7d Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Tue, 23 Apr 2024 13:15:37 +0300 Subject: [PATCH 11/15] Enhance average width calcs flow --- src/utils/columns.js | 64 +++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 42 deletions(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index 671016a04..1cb1aaceb 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -4,6 +4,7 @@ import _sum from 'lodash/sum' import _size from 'lodash/size' import _head from 'lodash/head' import _fill from 'lodash/fill' +import _floor from 'lodash/floor' import _filter from 'lodash/filter' import _forEach from 'lodash/forEach' import { Cell } from '@blueprintjs/table' @@ -624,60 +625,39 @@ export const formatSumUpValue = value => { return parseFloat(value).toFixed(8).replace(/\d(?=(\d{3})+\.)/g, '$&,') } -export const MIN_COLUMN_WIDTH = 100 +export const MIN_COLUMN_WIDTH = 125 export const WIDE_COLUMN_DEFAULT_WIDTH = 400 export const DEFAULT_CONTAINER_WIDTH = 1000 export const getColumnsMinWidths = (columns) => _map(columns, (column) => COLUMN_WIDTHS?.[column.id] ?? MIN_COLUMN_WIDTH) -const getIsDefaultsWiderThanContainer = (columns, container) => _sum(getColumnsMinWidths(columns)) > container - - export const getCalculatedColumnWidths = (columns, containerWidth) => { if (_size(columns) === 0) { return [] } const colsDefaults = getColumnsMinWidths(columns) - let avgWidth = Math.floor(containerWidth / _size(columns)) - if (avgWidth < MIN_COLUMN_WIDTH) return _map(columns, () => MIN_COLUMN_WIDTH) - console.log('++avgWidth1', avgWidth) - const isDefaultsWiderThanContainer = getIsDefaultsWiderThanContainer(columns, containerWidth) - let preparedColsWidths = _fill(Array(_size(columns)), 0) - - - if (isDefaultsWiderThanContainer) { - const smallColsIndexes = [] - const wideColsIndexes = [] - - _forEach(colsDefaults, (value, index) => { - if (value < MIN_COLUMN_WIDTH) smallColsIndexes.push(index) - if (value > WIDE_COLUMN_DEFAULT_WIDTH) wideColsIndexes.push(index) - }) - - _forEach(smallColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = avgWidth * 0.8 }) - _forEach(wideColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = avgWidth * 2 }) - - const calculatedCols = _size(smallColsIndexes) + _size(wideColsIndexes) - - avgWidth = Math.floor((containerWidth - _sum(preparedColsWidths)) / (_size(columns) - calculatedCols)) - - _forEach(preparedColsWidths, (value, index) => { - if (isEqual(value, 0)) preparedColsWidths[index] = avgWidth - }) - - console.log('++avgWidth2', avgWidth) - console.log('++preparedColsWidths', preparedColsWidths) - - // console.log('+++smallColsIndexes', smallColsIndexes) - // console.log('+++wideColsIndexes', wideColsIndexes) - } else preparedColsWidths = _map(columns, () => avgWidth) - - // console.log('++def', getColumnsMinWidths(columns)) - // console.log('++isDefaultsWiderThanContainer', isDefaultsWiderThanContainer) - - // const columnWidths = _map(columns, () => avgWidth) + let avgWidth = _floor(containerWidth / _size(columns)) + if (avgWidth < MIN_COLUMN_WIDTH) avgWidth = MIN_COLUMN_WIDTH + const preparedColsWidths = _fill(Array(_size(columns)), 0) + const wideColsIndexes = [] + const smallColsIndexes = [] + + _forEach(colsDefaults, (value, index) => { + if (value < MIN_COLUMN_WIDTH) smallColsIndexes.push(index) + if (value > WIDE_COLUMN_DEFAULT_WIDTH) wideColsIndexes.push(index) + }) + _forEach(wideColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = _floor(avgWidth * 2) }) + _forEach(smallColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = _floor(avgWidth * 0.7) }) + + const calculatedCols = _size(smallColsIndexes) + _size(wideColsIndexes) + avgWidth = _floor((containerWidth - _sum(preparedColsWidths)) / (_size(columns) - calculatedCols)) + if (avgWidth < MIN_COLUMN_WIDTH) avgWidth = MIN_COLUMN_WIDTH + _forEach(preparedColsWidths, (value, index) => { if (isEqual(value, 0)) preparedColsWidths[index] = avgWidth }) + + console.log('++avgWidth2', avgWidth) + console.log('++preparedColsWidths', preparedColsWidths) return preparedColsWidths } From 000298019a0320debbcfbb2f6a31346b7c7e5447 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Tue, 23 Apr 2024 13:33:19 +0300 Subject: [PATCH 12/15] Cleanup --- src/utils/columns.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index 1cb1aaceb..3a3b6e317 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -656,9 +656,6 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { if (avgWidth < MIN_COLUMN_WIDTH) avgWidth = MIN_COLUMN_WIDTH _forEach(preparedColsWidths, (value, index) => { if (isEqual(value, 0)) preparedColsWidths[index] = avgWidth }) - console.log('++avgWidth2', avgWidth) - console.log('++preparedColsWidths', preparedColsWidths) - return preparedColsWidths } From bb47b52bb60f37b985aac451d48c676d4c197143 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 24 Apr 2024 12:39:27 +0300 Subject: [PATCH 13/15] Optimize avg width calculation flow --- src/utils/columns.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index 3a3b6e317..ecf341ad9 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -632,14 +632,17 @@ export const DEFAULT_CONTAINER_WIDTH = 1000 export const getColumnsMinWidths = (columns) => _map(columns, (column) => COLUMN_WIDTHS?.[column.id] ?? MIN_COLUMN_WIDTH) +export const getAverageWidth = (avgWidth) => (avgWidth < MIN_COLUMN_WIDTH + ? MIN_COLUMN_WIDTH + : avgWidth) + export const getCalculatedColumnWidths = (columns, containerWidth) => { if (_size(columns) === 0) { return [] } const colsDefaults = getColumnsMinWidths(columns) - let avgWidth = _floor(containerWidth / _size(columns)) - if (avgWidth < MIN_COLUMN_WIDTH) avgWidth = MIN_COLUMN_WIDTH + let avgWidth = getAverageWidth(_floor(containerWidth / _size(columns))) const preparedColsWidths = _fill(Array(_size(columns)), 0) const wideColsIndexes = [] const smallColsIndexes = [] @@ -652,8 +655,9 @@ export const getCalculatedColumnWidths = (columns, containerWidth) => { _forEach(smallColsIndexes, (colIndex) => { preparedColsWidths[colIndex] = _floor(avgWidth * 0.7) }) const calculatedCols = _size(smallColsIndexes) + _size(wideColsIndexes) - avgWidth = _floor((containerWidth - _sum(preparedColsWidths)) / (_size(columns) - calculatedCols)) - if (avgWidth < MIN_COLUMN_WIDTH) avgWidth = MIN_COLUMN_WIDTH + avgWidth = getAverageWidth( + _floor((containerWidth - _sum(preparedColsWidths)) / (_size(columns) - calculatedCols)), + ) _forEach(preparedColsWidths, (value, index) => { if (isEqual(value, 0)) preparedColsWidths[index] = avgWidth }) return preparedColsWidths From efb18bc9288e7f5ee675e29aed506f03099689c7 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 24 Apr 2024 12:49:18 +0300 Subject: [PATCH 14/15] Adjust defaults --- src/utils/columns.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index ecf341ad9..bfa534a26 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -58,7 +58,7 @@ const COLUMN_WIDTH_STANDARD = { marginFunding: 132, marginFundingType: 130, marginFundingPayment: 178, - moreDetails: 95, + moreDetails: 130, meta: 160, merchantName: 120, mobile: 90, @@ -88,7 +88,7 @@ const COLUMN_WIDTH_STANDARD = { side: 100, sellingAmount: 132, sellingWeightedPrice: 160, - status: 105, + status: 135, symbol: 92, swap: 132, time: 150, @@ -625,8 +625,8 @@ export const formatSumUpValue = value => { return parseFloat(value).toFixed(8).replace(/\d(?=(\d{3})+\.)/g, '$&,') } -export const MIN_COLUMN_WIDTH = 125 -export const WIDE_COLUMN_DEFAULT_WIDTH = 400 +export const MIN_COLUMN_WIDTH = 127 +export const WIDE_COLUMN_DEFAULT_WIDTH = 300 export const DEFAULT_CONTAINER_WIDTH = 1000 export const getColumnsMinWidths = (columns) => _map(columns, From 4046d1516c7c776f7b0920b25f14f81b9a0fc1be Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 24 Apr 2024 15:59:38 +0300 Subject: [PATCH 15/15] Minor tweak --- src/utils/columns.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/columns.js b/src/utils/columns.js index bfa534a26..55b990761 100644 --- a/src/utils/columns.js +++ b/src/utils/columns.js @@ -82,7 +82,7 @@ const COLUMN_WIDTH_STANDARD = { priceLiq: 132, priceSpot: 132, priceTrailing: 132, - rate: 120, + rate: 130, redirectUrl: 300, sale: 152, side: 100, @@ -625,7 +625,7 @@ export const formatSumUpValue = value => { return parseFloat(value).toFixed(8).replace(/\d(?=(\d{3})+\.)/g, '$&,') } -export const MIN_COLUMN_WIDTH = 127 +export const MIN_COLUMN_WIDTH = 125 export const WIDE_COLUMN_DEFAULT_WIDTH = 300 export const DEFAULT_CONTAINER_WIDTH = 1000