feat: add map module

This commit is contained in:
Jovan Krunić
2021-07-13 07:57:09 +00:00
parent d696215d08
commit c1c9a92ec9
44 changed files with 2138 additions and 93 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019, 2020 StApps
* Copyright (C) 2018-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.
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, OnDestroy} from '@angular/core';
import {Component, Input, OnDestroy} from '@angular/core';
import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
import {
SCLanguage,
@@ -38,6 +38,12 @@ import {FilterContext, SortContext, SortContextOption} from './context-type';
templateUrl: 'context-menu.html',
})
export class ContextMenuComponent implements OnDestroy {
/**
* Id of the content the menu is used for
*/
@Input()
contentId: string;
/**
* Amount of filter options shown on compact view
*/
@@ -145,7 +151,6 @@ export class ContextMenuComponent implements OnDestroy {
for (const filterBucket of filterFacet.buckets) {
filterBucket.checked = false;
}
this.contextMenuService.contextFilterChanged(this.filterOption);
};

View File

@@ -1,4 +1,9 @@
<ion-menu type="overlay" menuId="context" contentId="data-list" side="end">
<ion-menu
type="overlay"
menuId="context"
contentId="{{ contentId }}"
side="end"
>
<ion-list-header>
<ion-toolbar>
<h3>{{ 'menu.context.title' | translate | titlecase }}</h3>

View File

@@ -1,7 +0,0 @@
stapps-navigation {
ion-radio {
.radio-icon {
}
}
}

View File

@@ -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();
/**