我正在根据给定行中的单元格值将一列移至另一张纸。我能够对行执行此操作,但对列不行。
import { Subject, Observable, BehaviorSubject, of } from 'rxjs';
interface SelectorMap {
[key: string]: Function;
}
interface SubjectMap {
[key: string]: Subject<any>;
}
const mockedValueShowMailingAddress = true;
const storeSubjectMock = new
BehaviorSubject(mockedValueShowMailingAddress);
export class MockStore {
public selectStreams: SubjectMap = {};
constructor(private selectors: SelectorMap) {}
public pipe() {
return storeSubjectMock.asObservable();
}
public reset() {
Object.values(this.selectStreams).map(subject =>
subject.complete());
this.selectStreams = {};
this.selectors = {};
}
public dispatch(obj) {}
public select(selector): Observable<any> {
const selectKey = getKeyByValue(this.selectors, selector);
if (!this.selectStreams[selectKey]) {
this.selectStreams[selectKey] = new Subject();
}
return this.selectStreams[selectKey];
}
}
function getKeyByValue(object, value) {
return Object.keys(object).find(key => object[key] === value);
}