mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 09:03:02 +00:00
feat: add map module
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020 StApps
|
||||
* Copyright (C) 2020-2021 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -13,14 +13,92 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {SCFacet, SCSearchFilter, SCSearchSort} from '@openstapps/core';
|
||||
import {Subject} from 'rxjs';
|
||||
import {
|
||||
FilterBucket,
|
||||
FilterContext,
|
||||
FilterFacet,
|
||||
SortContext,
|
||||
} from './context-type';
|
||||
SCFacet,
|
||||
SCFacetBucket,
|
||||
SCSearchFilter,
|
||||
SCSearchSort,
|
||||
} from '@openstapps/core';
|
||||
import {Subject} from 'rxjs';
|
||||
|
||||
export type ContextType = FilterContext | SortContext;
|
||||
|
||||
/**
|
||||
* A sort context
|
||||
*/
|
||||
interface SortContext {
|
||||
/**
|
||||
* Name of the context
|
||||
*/
|
||||
name: 'sort';
|
||||
|
||||
/**
|
||||
* Reverse option
|
||||
*/
|
||||
reversed: boolean;
|
||||
|
||||
/**
|
||||
* sort value
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/**
|
||||
* Sort options
|
||||
*/
|
||||
values: SortContextOption[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A sort context option
|
||||
*/
|
||||
interface SortContextOption {
|
||||
/**
|
||||
* sort option is reversible
|
||||
*/
|
||||
reversible: boolean;
|
||||
|
||||
/**
|
||||
* sort option value
|
||||
*/
|
||||
value: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A filter context
|
||||
*/
|
||||
interface FilterContext {
|
||||
/**
|
||||
* Compact view of the filter options
|
||||
*/
|
||||
compact?: boolean;
|
||||
/**
|
||||
* Name of the context
|
||||
*/
|
||||
name: 'filter';
|
||||
|
||||
/**
|
||||
* Filter values
|
||||
*/
|
||||
options: FilterFacet[];
|
||||
}
|
||||
|
||||
interface FilterFacet extends SCFacet {
|
||||
/**
|
||||
* FilterBuckets of a FilterFacet
|
||||
*/
|
||||
buckets: FilterBucket[];
|
||||
/**
|
||||
* Compact view of the option buckets
|
||||
*/
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
interface FilterBucket extends SCFacetBucket {
|
||||
/**
|
||||
* Sets the Filter active
|
||||
*/
|
||||
checked: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* ContextMenuService provides bidirectional communication of context menu options and search queries
|
||||
@@ -35,13 +113,13 @@ export class ContextMenuService {
|
||||
/**
|
||||
* Container for the filter context
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/member-ordering
|
||||
// tslint:disable-next-line:member-ordering
|
||||
filterOptions = new Subject<FilterContext>();
|
||||
|
||||
/**
|
||||
* Observable filterContext streams
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/member-ordering
|
||||
// tslint:disable-next-line:member-ordering
|
||||
filterContextChanged$ = this.filterOptions.asObservable();
|
||||
|
||||
/**
|
||||
@@ -52,19 +130,19 @@ export class ContextMenuService {
|
||||
/**
|
||||
* Observable filterContext streams
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/member-ordering
|
||||
// tslint:disable-next-line:member-ordering
|
||||
filterQueryChanged$ = this.filterQuery.asObservable();
|
||||
|
||||
/**
|
||||
* Container for the sort context
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/member-ordering
|
||||
// tslint:disable-next-line:member-ordering
|
||||
sortOptions = new Subject<SortContext>();
|
||||
|
||||
/**
|
||||
* Observable SortContext streams
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/member-ordering
|
||||
// tslint:disable-next-line:member-ordering
|
||||
sortContextChanged$ = this.sortOptions.asObservable();
|
||||
|
||||
/**
|
||||
@@ -75,7 +153,7 @@ export class ContextMenuService {
|
||||
/**
|
||||
* Observable SortContext streams
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/member-ordering
|
||||
// tslint:disable-next-line:member-ordering
|
||||
sortQueryChanged$ = this.sortQuery.asObservable();
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user