function collapsedServers(state: List<ServerId> = List<ServerId>(), action: Action): List<ServerId> { switch (action.type) { case ActionType.TOGGLE_SERVER_COLLAPSE: let serverId = action.payload.serverId if (state.includes(serverId)) { return state.filterNot(it => it == serverId) as List<ServerId> } else { return state.push(serverId) } default: return state } }
/** * Function that intented to be used by the table plugin manager to * perform the sorting process. It supports sorting with mutiple sorter, * which will be performed in ASC order. * * NOTE: the sorting process will short circuit on any non-zero sorter * result. */ process(tableData: TableData, columns: List<ColumnDef>) { const columnSorters: Iterable<number, TableSorter> = columns .filterNot(s => _.isUndefined(s.sortable)) .map(columnDef => { const sorter = columnDef.sortable const selector = columnDef.field const type = columnDef.type const order = sorter.order const comparator = sorter.comparator || this.getComparator(type) return { order, selector, comparator } }) const sorters = this.sorters.concat(columnSorters) .filter(s => this.getSortOrder(s.order) !== NONE) if (sorters.size > 1 && !this.multiSortable) { if (process.env.NODE_ENV === 'development') { throw new Error(`[RCBOX] Found multiple sorter enabled while this` + `feature is disabled. To enable this feature, set 'multiSortable' ` + `property to 'true' on TableSortPlugin. Those unexpected sorters ` + `are: ${sorters.toJS()}`) } // NOTE: Returns unsorted table data as fallback to avoid uncertain // data will be used in production environment. return tableData } const sorted = tableData.sort((row1, row2) => { const reducer = (result: number, sorter: TableSorter) => { const { selector, comparator } = sorter const order = this.getSortOrder(sorter.order) const factor = order === DESC ? -1 : 1 return result !== 0 ? result : comparator(selector(row1), selector(row2)) * factor } return sorters.reduce(reducer, 0) }) return sorted }
(v: List<ITransactionRecord>)=>{ return v.filterNot((t)=>t.id === id).toList(); });
(tByAccount:List<ITransactionRecord>)=>{ return tByAccount .filterNot(matchesTransactionId) .toList() .push(modifiedTransaction); }
(tByAccount:List<ITransactionRecord>)=>{ return tByAccount.filterNot(matchesTransactionId).toList(); });