UNPKG

@netgrif/components-core

Version:

Netgrif Application engine frontend core Angular library

55 lines (54 loc) 3.09 kB
import { GroupNavigationItemLabel } from '../model/group-navigation-item-label'; import { DataGroup } from '../../resources/interface/data-groups'; import { Filter } from '../../filter/models/filter'; import { FilterField } from '../../data-fields/filter-field/models/filter-field'; import { SearchMode } from "../../search/models/component-configuration/search-mode"; import { TranslateService } from "@ngx-translate/core"; /** * Extracts the item name and item icon (if any) rom a section of the navigation item task data. * @param dataSection an array containing the data groups that correspond to a single navigation entry * @param translateService is a service to translate label name */ export declare function extractIconAndTitle(dataSection: Array<DataGroup>, translateService: TranslateService): GroupNavigationItemLabel; /** * Based on provided parameter extracts allowed or banned roles into an Array of strings from a section of the navigation item task data. * Each item has format ROLE_IMPORT_ID:NET_IMPORT_ID * @param dataSection an array containing the data groups that correspond to a single navigation entry * @param roleFieldId ID of field containing banned or allowed role IDs * @returns an Array of string values representing role IDs */ export declare function extractRoles(dataSection: Array<DataGroup>, roleFieldId: string): Array<string>; /** * Extracts the data and creates a filter object from the navigation item task data. * @param dataSection an array containing the data groups that correspond to a single navigation entry */ export declare function extractFilterFromData(dataSection: Array<DataGroup>): Filter; /** * Extracts the filter field from the navigation item task data. * @param dataSection an array containing the data groups that correspond to a single navigation entry * @returns The extracted {@link FilterField} or `undefined` if it could not be extracted. */ export declare function extractFilterFieldFromData(dataSection: Array<DataGroup>): FilterField | undefined; /** * @returns a {@link SimpleFilter} containing the filter stored in the provided {@link FilterField}. * Throws an error if this is not possible. */ export declare function extractFilterFromFilterField(filterField: FilterField): Filter; /** * Extracts the selected search type from enumeration field of the navigation item task data. * @returns a {@link SearchMode} containing {@link SearchMode.ADVANCED} or {@link SearchMode.FULLTEXT} or {@link undefined} * if unexpected value is found * */ export declare function extractSearchTypeFromData(dataSection: Array<DataGroup>, typeFieldId: string): SearchMode; /** * Extracts field value from data * @returns value of extracted field * @throws Error if no field is found * */ export declare function extractFieldValueFromData<T>(dataSection: Array<DataGroup>, fieldId: string): T; /** * Checks if the data groups contain view * @returns true if the data contains filter * @throws Error if filter field is not found * */ export declare function hasView(dataSection: Array<DataGroup>): boolean;