-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add on market table * wire up FilterTableFeature * fix type issues
- Loading branch information
Showing
49 changed files
with
908 additions
and
496 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.vuuBasketTableLive .vuuTableNextCell:has(.vuuBasketSpreadCell), | ||
.vuuBasketTableLive .vuuTableNextCell:has(.vuuBasketTradingStatusCell){ | ||
align-items: center;; | ||
display: inline-flex; | ||
} |
153 changes: 151 additions & 2 deletions
153
vuu-ui/sample-apps/feature-basket-trading/src/basket-table-live/BasketTableLive.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,156 @@ | ||
import { TableSchema } from "@finos/vuu-data"; | ||
import { ColumnDescriptor, TableConfig } from "@finos/vuu-datagrid-types"; | ||
import { TableNext, TableProps } from "@finos/vuu-table"; | ||
import { useMemo } from "react"; | ||
import { StatusCell } from "../cell-renderers"; | ||
|
||
console.log(`component loaded StatusCell ${typeof StatusCell}`); | ||
import "./BasketTableLive.css"; | ||
|
||
const classBase = "vuuBasketTableLive"; | ||
|
||
export const BasketTableLive = () => { | ||
return <div className={classBase} />; | ||
export interface BasketTableLiveProps extends Omit<TableProps, "config"> { | ||
tableSchema: TableSchema; | ||
} | ||
|
||
const labels: { [key: string]: string } = { | ||
ask: "Ask", | ||
bid: "Bid", | ||
filled: "Pct Filled", | ||
limitPrice: "Limit Price", | ||
priceSpread: "Price Spread", | ||
priceStrategy: "Price Strategy", | ||
quantity: "Quantity", | ||
weighting: "Weighting", | ||
}; | ||
|
||
const applyColumnDefaults = (tableSchema: TableSchema) => | ||
tableSchema.columns.map<ColumnDescriptor>((column) => { | ||
switch (column.name) { | ||
case "ric": | ||
return { | ||
...column, | ||
label: "Ticker", | ||
pin: "left", | ||
}; | ||
case "status": | ||
return { | ||
...column, | ||
label: labels[column.name] ?? column.name, | ||
type: { | ||
name: "string", | ||
renderer: { | ||
name: "basket-status", | ||
}, | ||
}, | ||
} as ColumnDescriptor; | ||
case "ask": | ||
case "bid": | ||
case "last": | ||
return { | ||
...column, | ||
label: labels[column.name] ?? column.name, | ||
type: { | ||
name: "number", | ||
formatting: { | ||
alignOnDecimals: true, | ||
decimals: 2, | ||
zeroPad: true, | ||
}, | ||
}, | ||
} as ColumnDescriptor; | ||
case "limitPrice": | ||
return { | ||
...column, | ||
label: labels[column.name] ?? column.name, | ||
type: { | ||
name: "number", | ||
formatting: { | ||
alignOnDecimals: true, | ||
decimals: 2, | ||
zeroPad: true, | ||
}, | ||
}, | ||
} as ColumnDescriptor; | ||
case "priceStrategy": | ||
return { | ||
...column, | ||
label: labels[column.name] ?? column.name, | ||
type: { | ||
name: "string", | ||
}, | ||
}; | ||
case "priceSpread": | ||
return { | ||
...column, | ||
label: labels[column.name] ?? column.name, | ||
type: { | ||
name: "number", | ||
renderer: { | ||
name: "basket-spread", | ||
}, | ||
}, | ||
}; | ||
case "quantity": | ||
return { | ||
...column, | ||
label: labels[column.name] ?? column.name, | ||
type: { | ||
name: "number", | ||
formatting: { | ||
decimals: 0, | ||
}, | ||
}, | ||
}; | ||
case "filled": | ||
return { | ||
...column, | ||
label: labels[column.name] ?? column.name, | ||
type: { | ||
name: "number", | ||
renderer: { | ||
name: "basket-progress", | ||
associatedField: "quantity", | ||
}, | ||
}, | ||
}; | ||
case "weighting": | ||
return { | ||
...column, | ||
label: labels[column.name] ?? column.name, | ||
type: { | ||
name: "number", | ||
formatting: { | ||
alignOnDecimals: true, | ||
decimals: 2, | ||
zeroPad: true, | ||
}, | ||
}, | ||
}; | ||
default: | ||
return column; | ||
} | ||
}); | ||
|
||
export const BasketTableLive = ({ | ||
tableSchema, | ||
...props | ||
}: BasketTableLiveProps) => { | ||
const tableConfig = useMemo<TableConfig>( | ||
() => ({ | ||
columns: applyColumnDefaults(tableSchema), | ||
rowSeparators: true, | ||
}), | ||
[tableSchema] | ||
); | ||
|
||
return ( | ||
<TableNext | ||
{...props} | ||
renderBufferSize={20} | ||
className={classBase} | ||
config={tableConfig} | ||
rowHeight={21} | ||
/> | ||
); | ||
}; |
Oops, something went wrong.