mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) move client code to core
Summary: This moves all client code to core, and makes minimal fix-ups to get grist and grist-core to compile correctly. The client works in core, but I'm leaving clean-up around the build and bundles to follow-up. Test Plan: existing tests pass; server-dev bundle looks sane Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2627
This commit is contained in:
28
app/client/models/ClientColumnGetters.ts
Normal file
28
app/client/models/ClientColumnGetters.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import {ColumnGetters} from 'app/common/ColumnGetters';
|
||||
import * as gristTypes from 'app/common/gristTypes';
|
||||
|
||||
/**
|
||||
*
|
||||
* An implementation of ColumnGetters for the client, drawing
|
||||
* on the observables and models available in that context.
|
||||
*
|
||||
*/
|
||||
export class ClientColumnGetters implements ColumnGetters {
|
||||
|
||||
constructor(private _tableModel: any) {
|
||||
}
|
||||
|
||||
public getColGetter(colRef: number): ((rowId: number) => any) | null {
|
||||
const colId = this._tableModel.docModel.columns.getRowModel(Math.abs(colRef)).colId();
|
||||
return this._tableModel.tableData.getRowPropFunc(colId);
|
||||
}
|
||||
|
||||
public getManualSortGetter(): ((rowId: number) => any) | null {
|
||||
const manualSortCol = this._tableModel.tableMetaRow.columns().peek().find(
|
||||
(c: any) => c.colId() === gristTypes.MANUALSORT);
|
||||
if (!manualSortCol) {
|
||||
return null;
|
||||
}
|
||||
return this.getColGetter(manualSortCol.getRowId());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user