From 211fbf9679a4b0217c71a73f963bb13f90525069 Mon Sep 17 00:00:00 2001 From: heswell Date: Fri, 27 Oct 2023 22:42:11 +0100 Subject: [PATCH] move date generators to test data package (#938) --- .../vuu-data-test/src}/UpdateGenerator.ts | 0 .../basket-definitions-generator.ts | 2 +- .../basket-design-generator.ts | 2 +- .../src}/data-generators/basket-generator.ts | 2 +- .../basket-orders-generator.ts | 2 +- .../data-generators/child-order-generator.ts | 8 +--- .../data-generators/generate-data-utils.ts | 0 .../src}/data-generators/generatedData.ts | 0 .../src}/data-generators/index.ts | 0 .../data-generators/instrument-generator.ts | 5 +- .../instrument-prices-generator.ts | 2 +- .../src}/data-generators/order-generator.ts | 5 +- .../data-generators/parent-order-generator.ts | 9 +--- .../src}/data-generators/prices-generator.ts | 9 +--- .../src}/data-generators/vuu-row-generator.ts | 3 +- vuu-ui/packages/vuu-data-test/src/index.ts | 1 + .../src}/reference-data/basket-definitions.ts | 0 .../src}/reference-data/basket-design.ts | 0 .../src}/reference-data/basket-orders.ts | 0 .../src}/reference-data/basket.ts | 0 .../src}/reference-data/currencies.ts | 0 .../src}/reference-data/index.ts | 0 .../src}/reference-data/instrument-prices.ts | 0 .../src}/reference-data/instruments.ts | 0 .../src}/reference-data/locations.ts | 0 .../src}/reference-data/lotsizes.ts | 0 .../src}/reference-data/priceStrategies.ts | 0 .../src}/reference-data/prices.ts | 0 .../src}/reference-data/utils.ts | 0 .../vuu-data-test/src}/rowUpdates.ts | 0 vuu-ui/packages/vuu-data-test/tsconfig.json | 6 +++ vuu-ui/scripts/publish.mjs | 1 + .../examples/utils/TickingArrayDataSource.ts | 5 +- .../examples/utils/createArrayDataSource.ts | 5 +- vuu-ui/showcase/src/examples/utils/index.ts | 1 - .../showcase/src/examples/utils/useColumns.ts | 46 ------------------- .../src/examples/utils/useTableConfig.ts | 5 +- vuu-ui/tsconfig.json | 2 +- 38 files changed, 34 insertions(+), 87 deletions(-) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/UpdateGenerator.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/basket-definitions-generator.ts (97%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/basket-design-generator.ts (96%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/basket-generator.ts (96%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/basket-orders-generator.ts (96%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/child-order-generator.ts (90%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/generate-data-utils.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/generatedData.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/index.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/instrument-generator.ts (93%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/instrument-prices-generator.ts (97%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/order-generator.ts (95%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/parent-order-generator.ts (87%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/prices-generator.ts (81%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/data-generators/vuu-row-generator.ts (97%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/basket-definitions.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/basket-design.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/basket-orders.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/basket.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/currencies.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/index.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/instrument-prices.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/instruments.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/locations.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/lotsizes.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/priceStrategies.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/prices.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/reference-data/utils.ts (100%) rename vuu-ui/{showcase/src/examples/utils => packages/vuu-data-test/src}/rowUpdates.ts (100%) create mode 100644 vuu-ui/packages/vuu-data-test/tsconfig.json delete mode 100644 vuu-ui/showcase/src/examples/utils/useColumns.ts diff --git a/vuu-ui/showcase/src/examples/utils/UpdateGenerator.ts b/vuu-ui/packages/vuu-data-test/src/UpdateGenerator.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/UpdateGenerator.ts rename to vuu-ui/packages/vuu-data-test/src/UpdateGenerator.ts diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/basket-definitions-generator.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/basket-definitions-generator.ts similarity index 97% rename from vuu-ui/showcase/src/examples/utils/data-generators/basket-definitions-generator.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/basket-definitions-generator.ts index 5d0c65799..176de8e0d 100644 --- a/vuu-ui/showcase/src/examples/utils/data-generators/basket-definitions-generator.ts +++ b/vuu-ui/packages/vuu-data-test/src/data-generators/basket-definitions-generator.ts @@ -5,7 +5,7 @@ import { BasketDefinitionsReferenceData, } from "../reference-data"; import { BaseUpdateGenerator } from "../UpdateGenerator"; -import { getSchema } from "@finos/vuu-data-test"; +import { getSchema } from "../tableSchemas"; import { ColumnGeneratorFn, RowGeneratorFactory } from "./vuu-row-generator"; export const RowGenerator: RowGeneratorFactory = diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/basket-design-generator.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/basket-design-generator.ts similarity index 96% rename from vuu-ui/showcase/src/examples/utils/data-generators/basket-design-generator.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/basket-design-generator.ts index e9d33e316..78bdd46a7 100644 --- a/vuu-ui/showcase/src/examples/utils/data-generators/basket-design-generator.ts +++ b/vuu-ui/packages/vuu-data-test/src/data-generators/basket-design-generator.ts @@ -1,6 +1,6 @@ import { ColumnDescriptor } from "@finos/vuu-datagrid-types"; import { ColumnGeneratorFn, RowGeneratorFactory } from "./vuu-row-generator"; -import { getSchema } from "@finos/vuu-data-test"; +import { getSchema } from "../tableSchemas"; import { BasketDesignReferenceData, BasketDesignColumnMap, diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/basket-generator.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/basket-generator.ts similarity index 96% rename from vuu-ui/showcase/src/examples/utils/data-generators/basket-generator.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/basket-generator.ts index 2d45bf31f..df0929d03 100644 --- a/vuu-ui/showcase/src/examples/utils/data-generators/basket-generator.ts +++ b/vuu-ui/packages/vuu-data-test/src/data-generators/basket-generator.ts @@ -1,6 +1,6 @@ import { ColumnDescriptor } from "@finos/vuu-datagrid-types"; import { BasketColumnMap, BasketReferenceData } from "../reference-data"; -import { getSchema } from "@finos/vuu-data-test"; +import { getSchema } from "../tableSchemas"; import { ColumnGeneratorFn, RowGeneratorFactory } from "./vuu-row-generator"; export const RowGenerator: RowGeneratorFactory = diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/basket-orders-generator.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/basket-orders-generator.ts similarity index 96% rename from vuu-ui/showcase/src/examples/utils/data-generators/basket-orders-generator.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/basket-orders-generator.ts index fb052c8d3..f199c8b82 100644 --- a/vuu-ui/showcase/src/examples/utils/data-generators/basket-orders-generator.ts +++ b/vuu-ui/packages/vuu-data-test/src/data-generators/basket-orders-generator.ts @@ -1,6 +1,6 @@ import { ColumnDescriptor } from "@finos/vuu-datagrid-types"; import { ColumnGeneratorFn, RowGeneratorFactory } from "./vuu-row-generator"; -import { getSchema } from "@finos/vuu-data-test"; +import { getSchema } from "../tableSchemas"; import { BasketOrdersReferenceData, BasketOrdersColumnMap, diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/child-order-generator.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/child-order-generator.ts similarity index 90% rename from vuu-ui/showcase/src/examples/utils/data-generators/child-order-generator.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/child-order-generator.ts index 2ba1fbc75..aec24f606 100644 --- a/vuu-ui/showcase/src/examples/utils/data-generators/child-order-generator.ts +++ b/vuu-ui/packages/vuu-data-test/src/data-generators/child-order-generator.ts @@ -1,7 +1,6 @@ import { ColumnDescriptor } from "@finos/vuu-datagrid-types"; -import { ExtendedColumnConfig } from "../useTableConfig"; import { ColumnGeneratorFn, RowGeneratorFactory } from "./vuu-row-generator"; -import { getSchema } from "@finos/vuu-data-test"; +import { getSchema } from "../tableSchemas"; import { currencies, locations, suffixes } from "./generatedData"; function random(min: number, max: number) { @@ -75,10 +74,7 @@ export const RowGenerator: RowGeneratorFactory = () => (index: number) => { ]; }; -export const ColumnGenerator: ColumnGeneratorFn = ( - columns = [], - columnConfig: ExtendedColumnConfig = {} -) => { +export const ColumnGenerator: ColumnGeneratorFn = (columns = []) => { const schema = getSchema("childOrders"); const schemaColumns: ColumnDescriptor[] = schema.columns; if (typeof columns === "number") { diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/generate-data-utils.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/generate-data-utils.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/data-generators/generate-data-utils.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/generate-data-utils.ts diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/generatedData.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/generatedData.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/data-generators/generatedData.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/generatedData.ts diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/index.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/index.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/data-generators/index.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/index.ts diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/instrument-generator.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/instrument-generator.ts similarity index 93% rename from vuu-ui/showcase/src/examples/utils/data-generators/instrument-generator.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/instrument-generator.ts index dd941fdc1..779c35612 100644 --- a/vuu-ui/showcase/src/examples/utils/data-generators/instrument-generator.ts +++ b/vuu-ui/packages/vuu-data-test/src/data-generators/instrument-generator.ts @@ -1,12 +1,13 @@ import { ColumnDescriptor } from "@finos/vuu-datagrid-types"; import { ColumnGeneratorFn, RowGeneratorFactory } from "./vuu-row-generator"; -import { getSchema } from "@finos/vuu-data-test"; +import { getSchema } from "../tableSchemas"; import { InstrumentReferenceData, InstrumentColumnMap, } from "../reference-data"; import { getCalculatedColumnType, isCalculatedColumn } from "@finos/vuu-utils"; -import { ExtendedColumnConfig } from "../useTableConfig"; + +export type ExtendedColumnConfig = { [key: string]: Partial }; export const RowGenerator: RowGeneratorFactory = (columnNames?: string[]) => (index: number) => { diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/instrument-prices-generator.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/instrument-prices-generator.ts similarity index 97% rename from vuu-ui/showcase/src/examples/utils/data-generators/instrument-prices-generator.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/instrument-prices-generator.ts index 7dc4a18c0..17b25cd1f 100644 --- a/vuu-ui/showcase/src/examples/utils/data-generators/instrument-prices-generator.ts +++ b/vuu-ui/packages/vuu-data-test/src/data-generators/instrument-prices-generator.ts @@ -5,7 +5,7 @@ import { InstrumentPricesReferenceData, } from "../reference-data"; import { BaseUpdateGenerator } from "../UpdateGenerator"; -import { getSchema } from "@finos/vuu-data-test"; +import { getSchema } from "../tableSchemas"; import { ColumnGeneratorFn, RowGeneratorFactory } from "./vuu-row-generator"; const instrumentPriceSchema = getSchema("instrumentPrices"); diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/order-generator.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/order-generator.ts similarity index 95% rename from vuu-ui/showcase/src/examples/utils/data-generators/order-generator.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/order-generator.ts index 2342c6cb7..b1d612d39 100644 --- a/vuu-ui/showcase/src/examples/utils/data-generators/order-generator.ts +++ b/vuu-ui/packages/vuu-data-test/src/data-generators/order-generator.ts @@ -1,7 +1,8 @@ import { ColumnDescriptor } from "@finos/vuu-datagrid-types"; -import { ExtendedColumnConfig } from "../useTableConfig"; import { ColumnGeneratorFn, RowGeneratorFactory } from "./vuu-row-generator"; -import { getSchema } from "@finos/vuu-data-test"; +import { getSchema } from "../tableSchemas"; + +export type ExtendedColumnConfig = { [key: string]: Partial }; function random(min: number, max: number) { min = Math.ceil(min); diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/parent-order-generator.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/parent-order-generator.ts similarity index 87% rename from vuu-ui/showcase/src/examples/utils/data-generators/parent-order-generator.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/parent-order-generator.ts index 72b7a6afa..c21135399 100644 --- a/vuu-ui/showcase/src/examples/utils/data-generators/parent-order-generator.ts +++ b/vuu-ui/packages/vuu-data-test/src/data-generators/parent-order-generator.ts @@ -1,7 +1,6 @@ import { ColumnDescriptor } from "@finos/vuu-datagrid-types"; -import { ExtendedColumnConfig } from "../useTableConfig"; import { ColumnGeneratorFn, RowGeneratorFactory } from "./vuu-row-generator"; -import { getSchema } from "@finos/vuu-data-test"; +import { getSchema } from "../tableSchemas"; import { currencies, locations, suffixes } from "./generatedData"; function random(min: number, max: number) { @@ -67,11 +66,7 @@ export const RowGenerator: RowGeneratorFactory = () => (index: number) => { ]; }; -export const ColumnGenerator: ColumnGeneratorFn = ( - columns = [], - columnConfig: ExtendedColumnConfig = {} -) => { - console.log({ columnConfig }); +export const ColumnGenerator: ColumnGeneratorFn = (columns = []) => { const schema = getSchema("parentOrders"); const schemaColumns: ColumnDescriptor[] = schema.columns; if (typeof columns === "number") { diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/prices-generator.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/prices-generator.ts similarity index 81% rename from vuu-ui/showcase/src/examples/utils/data-generators/prices-generator.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/prices-generator.ts index 9d111016b..cb6c28de3 100644 --- a/vuu-ui/showcase/src/examples/utils/data-generators/prices-generator.ts +++ b/vuu-ui/packages/vuu-data-test/src/data-generators/prices-generator.ts @@ -1,10 +1,9 @@ import { ColumnDescriptor } from "@finos/vuu-datagrid-types"; import { buildColumnMap } from "@finos/vuu-utils"; import { PriceReferenceData } from "../reference-data"; -import { ExtendedColumnConfig } from "../useTableConfig"; import { ColumnGeneratorFn, RowGeneratorFactory } from "./vuu-row-generator"; import { BaseUpdateGenerator } from "../UpdateGenerator"; -import { getAllSchemas } from "@finos/vuu-data-test"; +import { getAllSchemas } from "../tableSchemas"; export const RowGenerator: RowGeneratorFactory = () => (index: number) => { if (index >= PriceReferenceData.length) { @@ -21,11 +20,7 @@ const tickingColumns = [bid, bidSize, ask, askSize]; export const createUpdateGenerator = () => new BaseUpdateGenerator(tickingColumns); -export const ColumnGenerator: ColumnGeneratorFn = ( - columns = [], - columnConfig: ExtendedColumnConfig = {} -) => { - console.log({ columnConfig }); +export const ColumnGenerator: ColumnGeneratorFn = (columns = []) => { const schemaColumns: ColumnDescriptor[] = pricesSchema.columns; if (typeof columns === "number") { throw Error("PricesColumnGenerator must be passed columns (strings)"); diff --git a/vuu-ui/showcase/src/examples/utils/data-generators/vuu-row-generator.ts b/vuu-ui/packages/vuu-data-test/src/data-generators/vuu-row-generator.ts similarity index 97% rename from vuu-ui/showcase/src/examples/utils/data-generators/vuu-row-generator.ts rename to vuu-ui/packages/vuu-data-test/src/data-generators/vuu-row-generator.ts index 7bc5a9f16..6a75e76d0 100644 --- a/vuu-ui/showcase/src/examples/utils/data-generators/vuu-row-generator.ts +++ b/vuu-ui/packages/vuu-data-test/src/data-generators/vuu-row-generator.ts @@ -1,9 +1,10 @@ import { ColumnDescriptor } from "@finos/vuu-datagrid-types"; import { VuuRowDataItemType, VuuTable } from "@finos/vuu-protocol-types"; -import { RowAtIndexFunc } from "../ArrayProxy"; import * as dataGenerators from "."; import { UpdateGenerator } from "../rowUpdates"; +type RowAtIndexFunc = (index: number) => T | undefined; + export const VuuColumnGenerator = (columnCount: number): string[] => ["Row No"].concat( Array(columnCount) diff --git a/vuu-ui/packages/vuu-data-test/src/index.ts b/vuu-ui/packages/vuu-data-test/src/index.ts index 8aa66f675..cf554a60b 100644 --- a/vuu-ui/packages/vuu-data-test/src/index.ts +++ b/vuu-ui/packages/vuu-data-test/src/index.ts @@ -1 +1,2 @@ export * from "./tableSchemas"; +export * from "./data-generators/vuu-row-generator"; diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/basket-definitions.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/basket-definitions.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/basket-definitions.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/basket-definitions.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/basket-design.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/basket-design.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/basket-design.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/basket-design.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/basket-orders.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/basket-orders.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/basket-orders.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/basket-orders.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/basket.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/basket.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/basket.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/basket.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/currencies.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/currencies.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/currencies.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/currencies.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/index.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/index.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/index.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/index.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/instrument-prices.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/instrument-prices.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/instrument-prices.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/instrument-prices.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/instruments.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/instruments.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/instruments.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/instruments.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/locations.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/locations.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/locations.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/locations.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/lotsizes.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/lotsizes.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/lotsizes.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/lotsizes.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/priceStrategies.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/priceStrategies.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/priceStrategies.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/priceStrategies.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/prices.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/prices.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/prices.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/prices.ts diff --git a/vuu-ui/showcase/src/examples/utils/reference-data/utils.ts b/vuu-ui/packages/vuu-data-test/src/reference-data/utils.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/reference-data/utils.ts rename to vuu-ui/packages/vuu-data-test/src/reference-data/utils.ts diff --git a/vuu-ui/showcase/src/examples/utils/rowUpdates.ts b/vuu-ui/packages/vuu-data-test/src/rowUpdates.ts similarity index 100% rename from vuu-ui/showcase/src/examples/utils/rowUpdates.ts rename to vuu-ui/packages/vuu-data-test/src/rowUpdates.ts diff --git a/vuu-ui/packages/vuu-data-test/tsconfig.json b/vuu-ui/packages/vuu-data-test/tsconfig.json new file mode 100644 index 000000000..db9582a16 --- /dev/null +++ b/vuu-ui/packages/vuu-data-test/tsconfig.json @@ -0,0 +1,6 @@ +{ +"extends": "../../tsconfig.json", +"compilerOptions":{ + "composite": true +}, +} diff --git a/vuu-ui/scripts/publish.mjs b/vuu-ui/scripts/publish.mjs index 8ab713d5a..433c3c330 100644 --- a/vuu-ui/scripts/publish.mjs +++ b/vuu-ui/scripts/publish.mjs @@ -6,6 +6,7 @@ const packages = [ "vuu-codemirror", "vuu-data", "vuu-data-react", + "vuu-data-test", "vuu-data-ag-grid", "vuu-data-test", "vuu-data-types", diff --git a/vuu-ui/showcase/src/examples/utils/TickingArrayDataSource.ts b/vuu-ui/showcase/src/examples/utils/TickingArrayDataSource.ts index 65e43e7b4..1f41da04c 100644 --- a/vuu-ui/showcase/src/examples/utils/TickingArrayDataSource.ts +++ b/vuu-ui/showcase/src/examples/utils/TickingArrayDataSource.ts @@ -6,7 +6,10 @@ import { } from "@finos/vuu-data"; import { VuuRange } from "@finos/vuu-protocol-types"; import { DataSourceRow } from "@finos/vuu-data-types"; -import { RowUpdates, UpdateGenerator } from "./rowUpdates"; +import { + RowUpdates, + UpdateGenerator, +} from "@finos/vuu-data-test/src/rowUpdates"; export interface TickingArrayDataSourceConstructorProps extends ArrayDataSourceConstructorProps { diff --git a/vuu-ui/showcase/src/examples/utils/createArrayDataSource.ts b/vuu-ui/showcase/src/examples/utils/createArrayDataSource.ts index 41b51f820..fce1c3185 100644 --- a/vuu-ui/showcase/src/examples/utils/createArrayDataSource.ts +++ b/vuu-ui/showcase/src/examples/utils/createArrayDataSource.ts @@ -1,8 +1,5 @@ import { TickingArrayDataSource } from "./TickingArrayDataSource"; -import { - getColumnAndRowGenerator, - populateArray, -} from "./data-generators/vuu-row-generator"; +import { getColumnAndRowGenerator, populateArray } from "@finos/vuu-data-test"; import { VuuTable } from "@finos/vuu-protocol-types"; export const createArrayDataSource = ({ diff --git a/vuu-ui/showcase/src/examples/utils/index.ts b/vuu-ui/showcase/src/examples/utils/index.ts index 089a8431f..cf42024c2 100644 --- a/vuu-ui/showcase/src/examples/utils/index.ts +++ b/vuu-ui/showcase/src/examples/utils/index.ts @@ -4,4 +4,3 @@ export * from "./ErrorDisplay"; export * from "./useAutoLoginToVuuServer"; export * from "./useTableConfig"; export * from "./useTestDataSource"; -export * from "./data-generators/vuu-row-generator"; diff --git a/vuu-ui/showcase/src/examples/utils/useColumns.ts b/vuu-ui/showcase/src/examples/utils/useColumns.ts deleted file mode 100644 index bbbad9fe1..000000000 --- a/vuu-ui/showcase/src/examples/utils/useColumns.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { ColumnDescriptor } from "@finos/vuu-datagrid-types"; -import { Reducer, useReducer } from "react"; - -export interface ColumnActionAdd { - type: "addColumn"; - column: ColumnDescriptor; - index?: number; -} -export interface ColumnActionUpdate { - type: "updateColumn"; - column: ColumnDescriptor; -} - -export type ColumnAction = ColumnActionAdd | ColumnActionUpdate; -export type ColumnReducer = Reducer; - -const columnReducer: ColumnReducer = (state, action) => { - switch (action.type) { - case "addColumn": - return addColumn(state, action); - case "updateColumn": - return state; - default: - return state; - } -}; - -export const useColumns = (columns: ColumnDescriptor[]) => { - const [state, dispatch] = useReducer(columnReducer, columns); - - return { - columns: state, - dispatch, - }; -}; - -function addColumn( - columns: ColumnDescriptor[], - { column, index = -1 }: ColumnActionAdd -) { - if (index === -1) { - return columns.concat(column); - } else { - return columns; - } -} diff --git a/vuu-ui/showcase/src/examples/utils/useTableConfig.ts b/vuu-ui/showcase/src/examples/utils/useTableConfig.ts index 53d2cbff6..36a4c5720 100644 --- a/vuu-ui/showcase/src/examples/utils/useTableConfig.ts +++ b/vuu-ui/showcase/src/examples/utils/useTableConfig.ts @@ -10,10 +10,7 @@ import { useMemo } from "react"; import { ArrayProxy } from "./ArrayProxy"; import { makeSuggestions } from "./makeSuggestions"; import { TickingArrayDataSource } from "./TickingArrayDataSource"; -import { - getColumnAndRowGenerator, - populateArray, -} from "./data-generators/vuu-row-generator"; +import { getColumnAndRowGenerator, populateArray } from "@finos/vuu-data-test"; const NO_CONFIG = {} as const; const NO_COLUMNS: number[] = []; diff --git a/vuu-ui/tsconfig.json b/vuu-ui/tsconfig.json index ef94552ef..028e09c31 100644 --- a/vuu-ui/tsconfig.json +++ b/vuu-ui/tsconfig.json @@ -26,7 +26,7 @@ "sample-apps/*/index.ts", "sample-apps/*/src", "global.d.ts" - ], +, "packages/vuu-data-test/src/UpdateGenerator.ts" ], "exclude": ["**/*.cy.*", "**/*.test.*"], "references": [ {"path" : "packages/vuu-codemirror"},