@linid-dm/directory-manager-client-core
Version:
Core package by providing a set of angular components for the Directory Manager app.
268 lines (267 loc) • 8.96 kB
TypeScript
/**
* Copyright (C) 2020-2024 Linagora
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version, provided you comply with the Additional Terms applicable for
* LinID Directory Manager software by LINAGORA pursuant to Section 7 of the GNU
* Affero General Public License, subsections (b), (c), and (e), pursuant to
* which these Appropriate Legal Notices must notably (i) retain the display of
* the "LinID™" trademark/logo at the top of the interface window, the display
* of the “You are using the Open Source and free version of LinID™, powered by
* Linagora © 2009–2013. Contribute to LinID R&D by subscribing to an Enterprise
* offer!” infobox and in the e-mails sent with the Program, notice appended to
* any type of outbound messages (e.g. e-mail and meeting requests) as well as
* in the LinID Directory Manager user interface, (ii) retain all hypertext
* links between LinID Directory Manager and https://linid.org/, as well as
* between LINAGORA and LINAGORA.com, and (iii) refrain from infringing LINAGORA
* intellectual property rights over its trademarks and commercial brands. Other
* Additional Terms apply, see <http://www.linagora.com/licenses/> for more
* details.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License and
* its applicable Additional Terms for LinID Directory Manager along with this
* program. If not, see <http://www.gnu.org/licenses/> for the GNU Affero
* General Public License version 3 and <http://www.linagora.com/licenses/> for
* the Additional Terms applicable to the LinID Directory Manager software.
*/
import { HttpErrorResponse } from '@angular/common/http';
import { IArrayAccessibility, IArrayAttributeUpdateParams, IAttribute, IConfig, IGetDataListParams } from './configs.interface';
import { FormFieldsExtendedSingleTypes } from './form.interface';
import { IAdvancedSearchChip } from './ui.interface';
import { MatDialogRef } from '@angular/material/dialog';
export interface IData {
schemas: string[];
totalResults: number;
itemsPerPage: number;
startIndex: number;
Resources: any[];
}
export type FormDataValueTypes = string | string[] | boolean | ILink | ILink[];
export interface IFormData extends Partial<IAttribute> {
dataValue: FormDataValueTypes;
}
export interface ILink {
id: string;
label: string;
value?: FormFieldsExtendedSingleTypes;
canBeRead?: boolean;
parentId?: string;
parentLabel?: string;
parentCanBeRead?: boolean;
}
export interface IScimProperties {
schemas: string[];
}
export declare enum EComponentName {
array = "array",
input = "input",
inputChipsAutocomplete = "input-chips-autocomplete",
autocomplete = "autocomplete",
select = "select",
textarea = "textarea",
datepicker = "datepicker",
slideToggle = "slide-toggle",
imgInput = "img-input",
fileInput = "file-input"
}
export interface IDataItem {
ids: IEntryIds;
name: string;
link: string;
canDelete: boolean;
}
export interface IDataNode {
ids: IEntryIds;
name: string;
children?: IDataNode[];
link: string;
type: string;
childrenType: string;
canDelete: boolean;
levelForPadding: number;
parentIdForDisplay: string;
parentIds: IEntryIds;
}
export interface IEntryIds {
id: string;
externalId: string;
}
export interface IErrorDetail {
handledError: Error | HttpErrorResponse;
userActionOnError: EUserAction;
}
export declare enum EUserAction {
TREE_ADD = "treeAdd",
TREE_GET = "treeGet",
TREE_DELETE = "treeDelete",
TREE_UPDATE = "treeUpdate",
TREE_MOVE_NODE = "moveNode",
ARRAY_GET = "arrayGet",
ARRAY_ADD = "arrayAdd",
ARRAY_DELETE = "arrayDelete",
ARRAY_SEARCH = "arraySearch",
LIST_ADD = "listAdd",
LIST_GET = "listGet",
LIST_DELETE = "listDelete",
LIST_UPDATE = "listUpdate",
DETAIL_GET = "detailGet",
DETAIL_GET_ARRAY = "detailGetArray",
DETAIL_EDIT = "detailEdit",
DETAIL_PATCH = "detailPatch",
DETAIL_UPDATE_ARRAY = "detailUpdateArray",
DETAIL_UPDATE_OTHER_RESOURCE = "detailUpdateOtherResource"
}
export interface IAdvancedSearchValues {
searchForm: string;
advancedSearchChips: IAdvancedSearchChip[];
}
export interface IPersistentUiData extends IAdvancedSearchValues {
filterValue: string;
expandedTreeNodesUuids: string[];
}
export interface IUiEntryIds extends IEntryIds {
label: string;
}
export interface IDeleteSingleEntry {
entry: IUiEntryIds;
dialogRef?: MatDialogRef<unknown>;
}
export interface IGenericArrayColumn {
id: string;
label?: string;
isBackendLinkObject?: boolean;
width?: string;
type?: string;
}
export interface IDataTableRow {
[id: string]: any | IDataTableCellElement[] | IClickableDataTableCellElement[];
}
export interface IDataSourceRow extends IDataTableRow {
isRowEditable: boolean;
selectionIds: IUiEntryIds;
}
export interface IDataTableCellElement {
id: string;
value: string;
isClickable: boolean;
}
export interface IClickableDataTableCellElement extends IDataTableCellElement {
routerLinkValue: string;
}
export interface IArrayAttributeDoingRequest {
idField: string;
attributeConfig: IAttribute;
getDataListParams: IGetDataListParams;
updateArrayAttributeParams: IArrayAttributeUpdateParams;
data: any[];
}
export interface IEditableArrayProperties {
selectedEntryExternalId?: string;
selectedEntryParentExternalId?: string;
}
export interface IAssignArrayViewProperties {
columns: IGenericArrayColumn[];
displayedColumns: string[];
name: string;
icon: string;
resourceTypeConfig: IConfig;
accessibility: IArrayAccessibility;
noFilterResult: string;
}
export interface IRequestsProperties {
resourceTypeId: string;
valueForFilterRegex: string;
filtersRegex: string;
}
export type ActionsTypes = IAddActionOnList | IDeleteActionOnList | IUpdateActionOnList | IAddActionOnTree | IDeleteActionOnTree | IUpdateActionOnTree | IMoveNodeActionOnTree;
export interface IActionOnList<T> {
actionType: T;
}
export type IAddActionOnList = IActionOnList<EUserAction.LIST_ADD>;
export type IDeleteActionOnList = IActionOnList<EUserAction.LIST_DELETE>;
export type IUpdateActionOnList = IActionOnList<EUserAction.LIST_UPDATE>;
export interface IActionOnTree<T> {
actionType: T;
triggerNodeId: string;
}
export interface IAddActionOnTree extends IActionOnTree<EUserAction.TREE_ADD> {
addedNode: IDataNode;
isAddingDifferentTypeChild?: boolean;
}
export interface IDeleteActionOnTree extends IActionOnTree<EUserAction.TREE_DELETE> {
removedNodesIds: string[];
hasRemovedSelectedNode: boolean;
}
export interface IUpdateActionOnTree extends IActionOnTree<EUserAction.TREE_UPDATE> {
newNodeName?: string;
newNodeExternalId?: string;
}
export interface IMoveNodeActionOnTree extends IActionOnTree<EUserAction.TREE_MOVE_NODE> {
destinationNode: IDataNode;
hasMovedSelectedNode: boolean;
}
export interface IFlatDataNode extends IDataNode {
expandable: boolean;
level: number;
}
export interface IDataNodeIdsFields {
ids: IEntryIds;
name: string;
parentId: string;
}
export declare enum EScimOperator {
EQ = "eq",
NE = "ne",
CO = "co",
SW = "sw",
EW = "ew",
PR = "pr",
GT = "gt",
GE = "ge",
LT = "lt",
LE = "le"
}
export type DetailDataValueTypes = string | boolean | string[] | IDataDetailResource | IDataDetailResource[];
export interface IDataDetailResource {
id: string;
value: string;
isClickable: boolean;
}
export interface IDataDetail {
id: string;
isVisible: boolean;
isBackendLinkObject: boolean;
isExternalLink: boolean;
isMultiple: boolean;
componentName: string;
icon: string;
label: {
long: string;
short: string;
};
dataValue: DetailDataValueTypes;
booleanDisplayedValue?: string;
}
export declare const CHECK_ATTRIBUTE_PRESENCE = "CHECK_ATTRIBUTE_PRESENCE";
export interface IClickableDataDetailResource extends IDataDetailResource {
routerLinkValue: string;
}
export interface IEditSingleDataSourceRow {
row: IDataSourceRow;
dialogRef?: MatDialogRef<unknown>;
}
export interface IDeleteMultipleEntries {
entries: IUiEntryIds[];
dialogRef?: MatDialogRef<unknown>;
}
export interface IEditMultipleDataSourceRow {
rows: IDataSourceRow[];
dialogRef?: MatDialogRef<unknown>;
}