@sassoftware/vi-api
Version:
Types used in the SAS Visual Investigator API
275 lines (274 loc) • 9.69 kB
TypeScript
import { SASInputBindings } from ".";
import { IdentitySummary } from "../current-user";
/**
* Properties for {@link SVICustomElement.IdentitySelect}.
*
* @category Properties
*
* @example HTML Example #1 - Provide a custom set of User/Group identities to display in dialog
* ```html
* <svi-identity-select
* [model]="selectedIdentities"
* [identities]="myIdentitiesList"
* [selectionMode]="SelectionMode.UsersAndGroups"
* [selfSelectBtn]="true"
* [filter]="{ byGroups: ['alpha', 'bravo'] }"
* (modelChanged)="onSelectionChange($event)"
* ></svi-identity-select>
* ```
*
* @example HTML Example #2 - Retrieve a list of users from the identities service in dialog
* ```html
* <svi-identity-select
* [model]="selectedIdentities"
* [ariaLabel]="'Select Users'"
* [selectionMode]="SelectionMode.Users"
* [selfSelectBtn]="true"
* (modelChanged)="onSelectionChange($event)"
* ></svi-identity-select>
* ```
*
* @example Create element via document.createElement:
* ```ts
* const identitySelect = document.createElement(SVICustomElement.IdentitySelect);
* identitySelect.identities = this.myIdentitiesList;
* identitySelect.ariaLabel = "My label";
* ```
*/
export interface IdentitySelectProperties extends SASInputBindings {
/** ARIA label for identifying the list. */
ariaLabel?: string;
/** The available users and groups to select from. If not provided, the identities are retrieved from the identities microservice. */
identities?: IIdentityOption[];
/** Does the input allow the selection of only a user, users, a group, groups, or both? (default: {@link SelectionMode.UsersAndGroups}) */
selectionMode?: SelectionMode;
/** Determines whether the select current user button is displayed. (default: false) */
selfSelectBtn?: boolean;
/** Determines if the current user button is displayed above or to the left/right of the identity-select control. (default: false) */
inlineSelectCurrentUserBtn?: boolean;
/** The filtering options used when the available identities are retrieved from the identities microservice. (default: false) */
filter?: IIdentitySelectFilterOptions;
/**
* Only members of the given group will be valid and selectable. If inclusive if true,
* the group itself is treated as a valid selection.
*
* Accepts the group id as a string, or as part of configuration object.
*/
limitSelectionToMembersOf?: string | ILimitSelectionToConfig;
/** Optional title that can be used to override the default dialog title. */
title?: string;
}
/**
* Properties for {@link SVICustomElement.IdentitySelectAction}.
*
* @category Properties
*
* @example HTML Example #1 - Select Users and Groups
* ```html
* <svi-identity-select-action
* [model]="selectedIdentities"
* [title]="'Multiple Users and Groups from Button'"
* [hideLabel]="true"
* (selectionDialogClose)="onDialogClose($event)"
* (modelChanged)="onSelectionChange($event)"
* ></svi-identity-select-action>
* ```
*
* @example HTML Example #1 - Select Users Only
* ```html
* <svi-identity-select-action
* [model]="selectedIdentities"
* [title]="'Multiple Users from Button'"
* [hideLabel]="true"
* [selectionMode]="selectionMode.Users"
* (selectionDialogClose)="onDialogClose($event)"
* (modelChanged)="onSelectionChange($event)"
* ></svi-identity-select-action>
* ```
*
* @example Create element via document.createElement:
* ```ts
* const identityAvatar = document.createElement(SVICustomElement.IdentitySelectAction);
* identitySelect.title = this.title;
* identitySelect.actionMode = this.actionMode;
* ```
*/
export interface IdentitySelectActionProperties {
/** Determines if the action is rendered as a Button or MenuItem (default: {@link ActionMode.Button}). */
actionMode?: ActionMode;
/** The tabIndex for the button (default: {@link TabIndex.Tabbable}). */
tabIndex?: string;
/** Optional title that can be used to override the default dialog title. */
title?: string;
/** Optional label that can be used to override the default button label. */
label?: string;
/** Defines if the label will be hidden. (default: false). */
hideLabel?: boolean;
/** Label for the identity select dialog "ok" button. (default: "ok") */
okButtonLabel?: string;
/** Optional icon class that can be used to override the default button icon. */
iconClass?: string;
/** Disables the component's controls. (default: false) */
disabled?: boolean;
/** The available users and groups to select from. If not provided, the identities are retrieved from the identities microservice. */
identities?: IIdentityOption[];
/** Does the input allow the selection of only a user, users, a group, groups, or both? (default: {@link SelectionMode.UsersAndGroups}) */
selectionMode?: SelectionMode;
/** Pre-select Identities. */
selectedIdentities?: IIdentityOption[];
/** The filtering options used when the available identities are retrieved from the identities microservice. */
filter?: IIdentitySelectFilterOptions;
/**
* Only members of the given group will be valid and selectable. If inclusive if true,
* the group itself is treated as a valid selection.
*
* Accepts the group id as a string, or as part of configuration object.
*/
limitSelectionToMembersOf?: string | ILimitSelectionToConfig;
/** Emits the selected identities when the dialog's ok button is clicked. */
selectionDialogClose?: (event: CustomEvent) => void;
}
/**
* Properties for {@link SVICustomElement.Avatar}.
*
* @category Properties
*
* @example HTML Example
* ```html
* <svi-avatar
* [identity]="identity"
* [size]="SizeType.XLarge"
* [isIcon]="true"
* [isButton]="true"
* ></svi-avatar>
* ```
*
* @example Create element via document.createElement:
* ```ts
* const identityAvatar = document.createElement(SVICustomElement.IdentityAvatar);
* identitySelect.identity = this.identity;
* identitySelect.size = SizeType.XLarge;
* identitySelect.isButton = true;
* ```
*/
export interface AvatarProperties {
/** The identity of the user, including name, userID, user type, and any tooltips. (required) */
identity: AvatarData;
/** Specifies the size styling the avatar should use. */
size?: SizeType;
/** Specifies if the avatar is a clickable button. */
isButton?: boolean;
/** The user's photo, if provided. */
imgSrcUrl?: string;
/** Specifies whether the avatar displays an icon (user or group) or a non-icon (initial or image). */
isIcon?: boolean;
}
/** @category Identities Types */
export declare enum SizeType {
Small = "small",
Medium = "medium",
XLarge = "x-large"
}
/** @category Identities Types */
export declare enum TabIndex {
Tabbable = "0",
NotTabbable = "-1"
}
/** @category Identities Types */
export declare enum IdentityType {
User = "user",
Group = "group"
}
/** @category Identities Types */
export declare enum IdentityState {
Active = "active",
Inactive = "inactive",
Locked = "locked"
}
/** @category Identities Types */
export interface GroupSummary extends IdentitySummary {
/** The value of "group" */
readonly type: IdentityType.Group;
}
/** @category Identities Types */
export interface UserSummary extends IdentitySummary {
/** The value of "user" */
readonly type: IdentityType.User;
}
/** @category Identities Types */
export interface AvatarData {
/** The name of the avatar file */
name?: string;
/** The content-type of the avatar file. */
type?: string;
/** Describes whether or not the avatar file for this identity is a default image. */
default?: boolean;
/** The uri location of the avatar file only if stored externally. */
uri?: string;
/** Timestamp of avatar data creation */
creationTimeStamp?: Date;
/** Timestamp of last avatar data modification */
modifiedTimeStamp?: Date;
}
/** @category Identities Types */
export declare enum ActionMode {
Button = "button",
MenuItem = "menuItem"
}
/** @category Identities Types */
export declare enum SelectionMode {
User = "user",
Group = "group",
Users = "users",
Groups = "groups",
UserOrGroup = "userOrGroup",
UsersAndGroups = "usersAndGroups"
}
/** @category Identities Types */
export type IdentitySelection = Array<{
id: string;
type: IdentityType;
}>;
/** @category Identities Types */
export interface IIdentitySelectDialogData {
identities?: IIdentityOption[];
selection?: IdentitySelection;
selectionMode: SelectionMode;
filter?: IIdentitySelectFilterOptions;
limitSelectionToMembersOf?: string | ILimitSelectionToConfig;
title?: string;
okButtonLabel?: string;
showSelectCurrentUserButton?: boolean;
}
/** @category Identities Types */
export interface IIdentityOption {
label?: string;
icon?: string;
}
/** @category Identities Types */
export declare enum IdentityTypeIcon {
User = "userIcon",
Group = "userGroupIcon",
UserAndGroup = "userGroupLimitIcon"
}
/** @category Identities Types */
export interface IIdentitySelectFilterOptions {
byGroups: string[];
includeNestedMembers?: boolean;
includeFilteredGroups?: boolean;
term?: string;
start?: number;
limit?: number;
cache?: number;
}
/** @category Identities Types */
export interface IFilterGroup {
id: string;
name?: string;
members: IdentitySummary[];
}
/** @category Identities Types */
export interface ILimitSelectionToConfig {
id: string;
inclusive?: boolean;
}