import { Button, InputNumber, Popover } from "antd"; import { observer } from "mobx-react"; import React from "react"; import { AutoSizer, Column, Table, TableCellRenderer } from "react-virtualized"; import { huntOptimizerStore, WantedItem } from "../../stores/HuntOptimizerStore"; import { itemKindStores } from "../../stores/ItemKindStore"; import { BigSelect } from "../BigSelect"; import './WantedItemsComponent.less'; @observer export class WantedItemsComponent extends React.Component { state = { helpVisible: false } render() { // Make sure render is called on updates. huntOptimizerStore.wantedItems.slice(0, 0); return (

Wanted Items } trigger="click" visible={this.state.helpVisible} onVisibleChange={this.onHelpVisibleChange} >

({ label: itemKind.name, value: itemKind.id }))} onChange={this.addWanted} />
{({ width, height }) => ( huntOptimizerStore.wantedItems[index]} noRowsRenderer={this.noRowsRenderer} > } /> (rowData as WantedItem).itemKind.name } />
)}
); } private addWanted = (selected: any) => { if (selected) { let added = huntOptimizerStore.wantedItems.find(w => w.itemKind.id === selected.value); if (!added) { const itemKind = itemKindStores.current.value.getById(selected.value)!; huntOptimizerStore.wantedItems.push(new WantedItem(itemKind, 1)); } } } private removeWanted = (wanted: WantedItem) => () => { const i = huntOptimizerStore.wantedItems.findIndex(w => w === wanted); if (i !== -1) { huntOptimizerStore.wantedItems.splice(i, 1); } } private tableRemoveCellRenderer: TableCellRenderer = ({ rowData }) => { return