(core) Fixing cursor position for filtered linked section.

Summary:
In a selector table, when a selected row is filtered out of view, linked widgets should update based on the newly selected row.
There were a few bugs that contributed to this wrong behavior:
- Gridview wasn't subscribing to the current row id, and the row with id 'new' was being converted to the first row
- Cursor was keeping track of the currently selected row id, it was hiding a problem behind the proper rowIndex
- Undo/redo somehow leveraged the wrong rowId from the cursor during the position restore.

The `No data` text was also changed to be more meaningful.

Test Plan: Added and updated.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3937
This commit is contained in:
Jarosław Sadziński
2023-07-07 10:54:01 +02:00
parent 9a80f4bdf5
commit 75d979abdb
25 changed files with 418 additions and 138 deletions

View File

@@ -10,7 +10,7 @@ import {ColumnFilter, NEW_FILTER_JSON} from 'app/client/models/ColumnFilter';
import {ColumnFilterMenuModel, IFilterCount} from 'app/client/models/ColumnFilterMenuModel';
import {ColumnRec, ViewFieldRec} from 'app/client/models/DocModel';
import {FilterInfo} from 'app/client/models/entities/ViewSectionRec';
import {RowId, RowSource} from 'app/client/models/rowset';
import {RowSource} from 'app/client/models/rowset';
import {ColumnFilterFunc, SectionFilter} from 'app/client/models/SectionFilter';
import {TableData} from 'app/client/models/TableData';
import {cssInput} from 'app/client/ui/cssInput';
@@ -46,6 +46,7 @@ import {relativeDatesControl} from 'app/client/ui/ColumnFilterMenuUtils';
import {FocusLayer} from 'app/client/lib/FocusLayer';
import {DateRangeOptions, IDateRangeOption} from 'app/client/ui/DateRangeOptions';
import {createFormatter} from 'app/common/ValueFormatter';
import {UIRowId} from 'app/common/TableData';
const t = makeT('ColumnFilterMenu');
@@ -833,7 +834,7 @@ interface ICountOptions {
* the possible choices as keys).
* Note that this logic is replicated in BaseView.prototype.filterByThisCellValue.
*/
function addCountsToMap(valueMap: Map<CellValue, IFilterCount>, rowIds: RowId[],
function addCountsToMap(valueMap: Map<CellValue, IFilterCount>, rowIds: UIRowId[],
{ keyMapFunc = identity, labelMapFunc = identity, columnType,
areHiddenRows = false, valueMapFunc }: ICountOptions) {

View File

@@ -217,10 +217,12 @@ export class VisibleFieldsConfig extends Disposable {
primaryButton(
dom.text((use) => t("Hide {{label}}", {label: use(this._fieldLabel)})),
dom.on('click', () => this._removeSelectedFields()),
testId('visible-hide')
),
basicButton(
t("Clear"),
dom.on('click', () => this._setVisibleCheckboxes(fieldsDraggable, false)),
testId('visible-clear')
),
testId('visible-batch-buttons')
),
@@ -259,10 +261,12 @@ export class VisibleFieldsConfig extends Disposable {
primaryButton(
dom.text((use) => t("Show {{label}}", {label: use(this._fieldLabel)})),
dom.on('click', () => this._addSelectedFields()),
testId('hidden-show')
),
basicButton(
t("Clear"),
dom.on('click', () => this._setHiddenCheckboxes(hiddenFieldsDraggable, false)),
testId('hidden-clear')
),
testId('hidden-batch-buttons')
)