Skip to content

Commit

Permalink
wiring together calculated column pieces (#931)
Browse files Browse the repository at this point in the history
* wiring together calculated column pieces

* remove logging

* re-enable all tests
  • Loading branch information
heswell authored Oct 26, 2023
1 parent ba1c0af commit 39cf5c0
Show file tree
Hide file tree
Showing 53 changed files with 757 additions and 2,777 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
buildColumnMap,
ColumnMap,
EventEmitter,
getAddedItems,
getMissingItems,
getSelectionStatus,
KeySet,
logger,
Expand Down Expand Up @@ -57,7 +59,6 @@ export interface ArrayDataSourceConstructorProps
data: Array<VuuRowDataItemType[]>;
rangeChangeRowset?: "delta" | "full";
}

const { debug } = logger("ArrayDataSource");

const { RENDER_IDX, SELECTED } = metadataKeys;
Expand Down Expand Up @@ -148,6 +149,10 @@ export class ArrayDataSource
}: ArrayDataSourceConstructorProps) {
super();

console.log(`ArrayDataSource`, {
columnDescriptors,
});

if (!data || !columnDescriptors) {
throw Error(
"ArrayDataSource constructor called without data or without columnDescriptors"
Expand Down Expand Up @@ -293,6 +298,10 @@ export class ArrayDataSource
return this.processedData ?? this.#data;
}

get table() {
return this.tableSchema.table;
}

get config() {
return this.#config;
}
Expand Down Expand Up @@ -434,6 +443,17 @@ export class ArrayDataSource
}

set columns(columns: string[]) {
const addedColumns = getAddedItems(this.config.columns, columns);
if (addedColumns.length > 0) {
const columnsWithoutDescriptors = getMissingItems(
this.columnDescriptors,
addedColumns,
(col) => col.name
);
console.log(`columnsWithoutDescriptors`, {
columnsWithoutDescriptors,
});
}
this.config = {
...this.#config,
columns,
Expand Down
3 changes: 2 additions & 1 deletion vuu-ui/packages/vuu-data/src/data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const equivalentColumns: DataConfigPredicate = (
(cols1 === undefined && cols2?.length === 0) ||
(cols2 === undefined && cols1?.length === 0);

const columnsChanged: DataConfigPredicate = (config, newConfig) => {
export const columnsChanged: DataConfigPredicate = (config, newConfig) => {
const { columns: cols1 } = config;
const { columns: cols2 } = newConfig;

Expand Down Expand Up @@ -510,6 +510,7 @@ export interface DataSource extends EventEmitter<DataSourceEvents> {
props: SubscribeProps,
callback: SubscribeCallback
) => Promise<void>;
table?: VuuTable;
title?: string;
unsubscribe: () => void;
viewport?: string;
Expand Down
Loading

0 comments on commit 39cf5c0

Please sign in to comment.