
* Add component backbone * Make step component generic and typed * Add step tabs * Add settings view * Encapsulate all dialog components in one directory * Move types to separate file * Add mutations * Use gql types * Add error handling * Do not keep separate types file * Allow products to be exported * Fix types * Update snapshots * Update to latest schema * Add disabled option * Use wizard hook * Update type definitions * Queue export check task * Fix bug causing jobs to be endless and duplicated * Fix minor bugs * Add accordion component * Allow selection of fields to be exported * Add attribute export * Update snapshots * Update messages * Update changelog * Add missing key * Add quick peek to accordioin * Sort imports * Remove unused files * Add chiips to attribute selection * Change menu positioning * Add product counter * Add select all option * Update snapshots * Update messages * Remove unused import * Add chips * Add test tags * Update snapshots * Change number of max chips * Add accordion tags * Update messages
20 lines
538 B
TypeScript
20 lines
538 B
TypeScript
import { IFilter } from "@saleor/components/Filter";
|
|
import clone from "lodash-es/clone";
|
|
|
|
export function getExistingKeys(o: object): string[] {
|
|
return Object.keys(o).filter(key => o[key] !== undefined && o[key] !== null);
|
|
}
|
|
|
|
export function setFilterOptsStatus<T extends string>(
|
|
opts: IFilter<T>,
|
|
status: boolean
|
|
): IFilter<T> {
|
|
const newOpts = clone(opts);
|
|
for (const optName in opts) {
|
|
if (Object.prototype.hasOwnProperty.call(newOpts, optName)) {
|
|
newOpts[optName].active = status;
|
|
}
|
|
}
|
|
|
|
return newOpts;
|
|
}
|