@sassoftware/vi-api 1.7.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- // Generated using typescript-generator version 2.15.527 on 2023-01-24 10:52:40.
3
+ // Generated using typescript-generator version 2.15.527 on 2023-07-07 09:34:28.
4
4
 
5
5
  export interface ActionRequestRep {
6
6
  version?: number;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@types/alert-reps",
3
- "version": "15.3.20",
3
+ "version": "16.0.12",
4
4
  "types": "index.d.ts"
5
5
  }
@@ -14,6 +14,7 @@ export interface SolutionExtension extends ControlMetadata {
14
14
  metadata?: SolutionExtensionMetadata;
15
15
  resolvedDisplayName?: string;
16
16
  resolvedDescription?: string;
17
+ clientApplication?: string;
17
18
  name: string;
18
19
  }
19
20
  export interface SolutionExtensionConfigTypeAttributes {
@@ -166,6 +166,21 @@ export interface ControlStateApi {
166
166
  * True if the control is hidden, otherwise false.
167
167
  */
168
168
  readonly hidden: boolean;
169
+ /**
170
+ * Returns the masked state of the calling control.
171
+ * True if the control is masked, otherwise false.
172
+ */
173
+ readonly masked: boolean;
174
+ /**
175
+ * Returns the authorization state of a masked field of the calling control.
176
+ * True if the control is masked, otherwise false.
177
+ */
178
+ readonly authorizedToUnmask: boolean;
179
+ /**
180
+ * Returns the disabled state of the calling control.
181
+ * True if the control is disabled, otherwise false.
182
+ */
183
+ readonly disabled: boolean;
169
184
  /**
170
185
  * Registers a function to be invoked whenever a state change event occurs.
171
186
  * This function receives an object that contains information about the change event.
@@ -1,4 +1,4 @@
1
- import { FieldType } from "./data-types";
1
+ import { FieldType, NumberDataType } from "./data-types";
2
2
  export interface RequirableRestriction {
3
3
  required: boolean;
4
4
  }
@@ -16,6 +16,10 @@ export interface NumericRestrictions extends FieldRestrictions {
16
16
  scale?: number;
17
17
  precision?: number;
18
18
  }
19
+ export interface NumberRestrictions extends FieldRestrictions {
20
+ fieldDataType: NumberDataType;
21
+ precision?: number;
22
+ }
19
23
  export interface ReferenceDataRestrictions extends FieldRestrictions {
20
24
  constrainingListName: string;
21
25
  cascadingReferenceDataName?: string;
@@ -16,7 +16,9 @@ export declare enum PageEvents {
16
16
  SelectNodeEvent = "spb::selectNode",
17
17
  UpdateSubDocumentTypeEvent = "spb::updateSubDocumentType",
18
18
  TabSelectedEvent = "spb::tabSelected",
19
- VisitAllTabs = "spb::mark-all-tabs-visited"
19
+ VisitAllTabs = "spb::mark-all-tabs-visited",
20
+ MaskToggleEvent = "spb::mask-toggle",
21
+ MaskAllEvent = "spb::mask-all"
20
22
  }
21
23
  export interface Subscription {
22
24
  unsubscribe(): void;
@@ -18,6 +18,8 @@ export var PageEvents;
18
18
  PageEvents["UpdateSubDocumentTypeEvent"] = "spb::updateSubDocumentType";
19
19
  PageEvents["TabSelectedEvent"] = "spb::tabSelected";
20
20
  PageEvents["VisitAllTabs"] = "spb::mark-all-tabs-visited";
21
+ PageEvents["MaskToggleEvent"] = "spb::mask-toggle";
22
+ PageEvents["MaskAllEvent"] = "spb::mask-all";
21
23
  })(PageEvents || (PageEvents = {}));
22
24
  /**
23
25
  * Callback function executed when subscription is triggered by an event.
package/index.d.ts CHANGED
@@ -20,6 +20,7 @@ import { SheetApi } from "./sheet/sheet-api";
20
20
  import { TabApi } from "./tab/tab-api";
21
21
  import { ThemeApi } from "./theme/theme-api";
22
22
  import { TraversalApi } from "./traversal/traversal-api";
23
+ import { ShellTabsApi } from "./shell-tabs/shell-tabs-api";
23
24
  /**
24
25
  * Common API Functions.
25
26
  */
@@ -41,6 +42,7 @@ export interface SviCommonApi {
41
42
  theme: ThemeApi;
42
43
  traversal: TraversalApi;
43
44
  config: ConfigApi;
45
+ shellTabs: ShellTabsApi;
44
46
  }
45
47
  /**
46
48
  * The Client API.
@@ -1,3 +1,4 @@
1
+ import { IIdentityOption } from "@sas/nexus-shared-ui/identities/input";
1
2
  import { CoreStoredObjectField, Entity, Relationship, RelationshipDTO, StoredObjectDTO } from "../svi-datahub";
2
3
  export interface NodeShapeMultipliers {
3
4
  square: number;
@@ -28,8 +29,8 @@ export interface SandDataObject extends DataObject {
28
29
  }
29
30
  export interface DataObject extends PersistableObject {
30
31
  name: string;
31
- dataStoreName: string;
32
- tableName: string;
32
+ dataStoreName?: string;
33
+ tableName?: string;
33
34
  deleteTableName?: string;
34
35
  readOnly: boolean;
35
36
  archived: boolean;
@@ -78,6 +79,8 @@ export interface DataObjectField extends PersistableObject, LocalizableObject {
78
79
  cascadingReferenceDataName?: string;
79
80
  cascadingReferenceDataFilterByCode?: string;
80
81
  cascadingReferenceDataFilterByField?: string;
82
+ masked?: boolean;
83
+ authorizedToRevealMasked?: IIdentityOption[];
81
84
  [index: string]: any;
82
85
  }
83
86
  export interface LocalizableObject {
@@ -1,4 +1,4 @@
1
- import { Relationship, StoredObjectFieldDTO, Comment } from "../svi-datahub";
1
+ import { Comment, Relationship, StoredObjectFieldDTO } from "../svi-datahub";
2
2
  import { FileOperation } from "../file/file-api";
3
3
  import { PageModel } from "../page-model/page-model-api";
4
4
  import { ClientSheet, Sheet } from "../sheet/sheet-api";
@@ -84,6 +84,19 @@ export interface ObjectApi {
84
84
  * @return A Promise that resolves to the updated object when the object has successfully been updated.
85
85
  */
86
86
  updateObject(objectType: string, objectId: string, objectTypeId: number, objectTypeVersion: number, fieldValues: FieldValues, options?: UpdateObjectOptions): Promise<VIObject>;
87
+ /**
88
+ * @method
89
+ * @description Updates an existing object with the provided data.
90
+ * @param objectType {string} Object type.
91
+ * @param objectId {string} Object ID.
92
+ * @param objectTypeId {number} Object type ID.
93
+ * @param objectTypeVersion {number} Object type version.
94
+ * @param originalFieldValues {FieldValues} Field values before the object was edited
95
+ * @param newFieldValues {FieldValues} Field values after the object was edited
96
+ * @param [options] {UpdateObjectOptions} Optional extra parameters.
97
+ * @return A Promise that resolves to the updated object when the object has successfully been updated.
98
+ */
99
+ patchObject(objectType: string, objectId: string, objectTypeId: number, objectTypeVersion: number, originalFieldValues: FieldValues, newFieldValues: FieldValues, options?: UpdateObjectOptions): Promise<VIObject>;
87
100
  /**
88
101
  * @method
89
102
  * @description Deletes an object.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sassoftware/vi-api",
3
- "version": "1.7.1",
3
+ "version": "1.9.0",
4
4
  "description": "Types used in the SAS Visual Investigator API",
5
5
  "keywords": [
6
6
  "SAS",
@@ -1,31 +1,4 @@
1
- import { Template, StoredObjectDTO } from "../svi-datahub";
2
- /**
3
- * SAS Visual Investigator API's representation of a UI-Router state.
4
- * Accessed from the window at window.sas.vi.pageState.
5
- */
6
- export interface StateObject {
7
- /** The parent StateObject. */
8
- parent: StateObject;
9
- /** Name used to register the state. */
10
- name: string;
11
- /** Parent StateObject array from this state up to the root. */
12
- path: StateObject[];
13
- data: any;
14
- /**
15
- * An object containing the parent States' names as keys and
16
- * true as their values.
17
- */
18
- includes: {
19
- [name: string]: boolean;
20
- };
21
- /**
22
- * Function to return the root node of this state's tree.
23
- *
24
- * @returns The root of this state's tree.
25
- */
26
- root(): StateObject;
27
- toString(): string;
28
- }
1
+ import { StoredObjectDTO, Template } from "../svi-datahub";
29
2
  export interface HomepageDesignerState {
30
3
  isNew: boolean;
31
4
  page: Template;
@@ -48,21 +21,21 @@ export interface PageStateApi {
48
21
  * @description Returns the state of the current page.
49
22
  * @returns An object containing the page state data or undefined if no page exists.
50
23
  */
51
- getCurrent(): StateObject | undefined;
24
+ getCurrent(): HomepageDesignerState | ObjectPageDesignerState | undefined;
52
25
  /**
53
26
  * @method
54
27
  * @description Returns the state of the page matching the ID.
55
28
  * @param id {string | number} Page ID for which the state will be returned.
56
29
  * @returns An object containing the page state data or undefined if the ID doesn't exist.
57
30
  */
58
- get(id: string | number): StateObject | undefined;
31
+ get(id: string | number): HomepageDesignerState | ObjectPageDesignerState | undefined;
59
32
  /**
60
33
  * @method
61
34
  * @description Creates a page state.
62
35
  * @param id {string | number} Page ID to be created.
63
- * @param state {StateObject} Object containing the state data required to create the page.
36
+ * @param state {HomepageDesignerState | ObjectPageDesignerState} Object containing the state data required to create the page.
64
37
  */
65
- add(id: string | number, state: StateObject): void;
38
+ add(id: string | number, state: HomepageDesignerState | ObjectPageDesignerState): void;
66
39
  /**
67
40
  * @method
68
41
  * @description Deletes a page state.
@@ -1,6 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- // Generated using typescript-generator version 2.15.527 on 2023-01-24 10:52:36.
3
+ // Generated using typescript-generator version 2.15.527 on 2023-07-07 09:38:54.
4
4
 
5
5
  export interface BaseRep extends TrackedResource {
6
6
  links?: Link[];
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@types/score-reps",
3
- "version": "3.3.20",
3
+ "version": "4.0.12",
4
4
  "types": "index.d.ts"
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { Relationship } from "../../svi-datahub";
2
- import { MapBoundedBoxFilter, MapBoundedPolygonFilter, MapRadiusFilter, MapShapeFilter, QueryMode, SearchRepresentation, SearchResponse } from "../../svi-sand";
2
+ import { MapBoundedBoxFilter, MapBoundedPolygonFilter, MapRadiusFilter, MapShapeFilter, QueryMode, SearchRepresentation, SearchResponse, SummaryVisualizationResponse } from "../../svi-sand";
3
3
  import { ObjectIdentifier } from "../../object/object-api";
4
4
  import { QueryBuilderModel, SearchApi } from "../search-api";
5
5
  export declare enum SearchVisualization {
@@ -52,7 +52,7 @@ export interface SearchAndCreateDialogModel {
52
52
  canCreate?: boolean;
53
53
  linkReasons?: Relationship[];
54
54
  /**
55
- * Values returned on the close of the dialog. May be undefined when dialog is cancelled.
55
+ * Values returned on the close of the dialog box. May be undefined when dialog box is cancelled.
56
56
  */
57
57
  result?: SearchAndCreateResponse;
58
58
  }
@@ -92,7 +92,7 @@ export interface ClientSearchApi extends SearchApi {
92
92
  * @param queryText {string} Text used to form the query.
93
93
  * @param visualizationName {"summary" | "map" | "table"} Visualization to query for and then display to the user.
94
94
  * @param [mapFilters] {MapFilter[]} The map filter object to include with the search query. This can consist of MapBoundedPolygonFilter, MapRadiusFilter, MapBoundedBoxFilter or MapShapeFilter.
95
- * @param [queryMode] {"standard" | "phonetic" | "synonym"} Used to perform phonetic and synonym searches. Default is "standard".
95
+ * @param [queryMode] {"standard" | "phonetic" | "synonym"} Used to perform phonetic and synonym searches. Default: "standard".
96
96
  */
97
97
  navigateSearch(queryText: string, visualizationName: SearchVisualization, mapFilters?: MapFilter[], queryMode?: QueryMode[]): Promise<void>;
98
98
  /**
@@ -119,13 +119,13 @@ export interface ClientSearchApi extends SearchApi {
119
119
  * @description Sets the query builder model for the given ID. If no ID is given, it sets the query model for SEARCH.
120
120
  * When stored, the query model is used to initially populate a Query Builder opened with the given ID.
121
121
  * @param queryModel {QueryBuilderModel} A query builder model.
122
- * @param [id] {string} ID of the model to set. Defaults to SEARCH.
122
+ * @param [id] {string} ID of the model to set. Default: SEARCH.
123
123
  */
124
124
  setQueryBuilderModel(queryModel: QueryBuilderModel, id?: string): void;
125
125
  /**
126
126
  * @method
127
127
  * @description Opens the "Add Objects to Workspace" dialog box and then performs the action after a document and workspace have been selected.
128
- * @param visualizationName {Visualization} Visualization to initially display after the objects have been added.
128
+ * @param visualizationName {Visualization} Visualization to display after the objects have been added.
129
129
  * @param objects {Array<ObjectIdentifier | ResolvedObjectIdentifier>} Objects to add to the workspace.
130
130
  * @param [currentObject] {ObjectIdentifier} The document the user is currently viewing. This is used as a visual aid in the dialog box.
131
131
  * @param [networkData] {NetworkData} Network visualization data to be copied to the workspace.
@@ -154,10 +154,20 @@ export interface ClientSearchApi extends SearchApi {
154
154
  addToNewWorkspace(objectsToAdd: Array<ObjectIdentifier | ResolvedObjectIdentifier>, targetObjectType: string, targetObjectId?: string, visualization?: Visualization, workspaceName?: string, networkData?: NetworkData): Promise<void>;
155
155
  /**
156
156
  * @method
157
- * @description Launches a wizard allowing users to search first, before creating an object/relationship.
158
- * Relationship wizard is determined by relateToParentLabel or relateToParentName being defined within the wizardValues parameter.
157
+ * @description Launches a wizard allowing users to search, before creating an object/relationship.
158
+ * The relationship wizard is determined by the relateToParentLabel or relateToParentName defined in the wizardValues parameter.
159
159
  * @param wizardValues {SearchAndCreateDialogModel} Object containing entity and relationship data.
160
- * @returns A Promise which resolves when the dialog is closed.
160
+ * @returns A Promise which resolves when the dialog box is closed.
161
161
  */
162
162
  openSearchAndCreateDialog(wizardValues: SearchAndCreateDialogModel): Promise<SearchAndCreateDialogModel>;
163
+ /**
164
+ * @method
165
+ * @description Gets the selected items within the search result or specified workspace.
166
+ * @param selectionId {string} The selection ID for the currently selected objects. Default: "SEARCH".
167
+ * @param maxItems {number} The maximum number of items to get in the selection. Default: 50.
168
+ * @param textAnalytics {boolean} Boolean value to determine whether the current visualization is Text Analytics. Default: false.
169
+ */
170
+ getSelectedItems(selectionId: string, maxItems: number, textAnalytics: boolean): Promise<{
171
+ [index: string]: SummaryVisualizationResponse;
172
+ } | undefined>;
163
173
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@sassoftware/vi-api/shell-tabs",
3
+ "files": [
4
+ "**/*.d.ts",
5
+ "**/*.js"
6
+ ],
7
+ "main": "public-api.js",
8
+ "types": "public-api.d.ts"
9
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./shell-tabs-api";
2
+ export * from "./shell-tabs-lifecycle-api";
@@ -0,0 +1,2 @@
1
+ export * from "./shell-tabs-api";
2
+ export * from "./shell-tabs-lifecycle-api";
@@ -0,0 +1,199 @@
1
+ import { Observable } from "rxjs";
2
+ import { INavigationBarTabSaveOptions } from "./shell-tabs-lifecycle-api";
3
+ export interface WebElementData {
4
+ elementName: string;
5
+ doNotReuse?: boolean;
6
+ }
7
+ export interface INavigationBarTabs<D1 = any, D2 = D1> {
8
+ primary: INavigationBarTab<D1>;
9
+ secondary?: INavigationBarTab<D2>;
10
+ }
11
+ export interface INavigationBarTab<D = {
12
+ [key: string]: any;
13
+ }, SecondaryData = D> {
14
+ /** unique tab id */
15
+ id: string;
16
+ /** url relative to shell root e.g. /user/123 - this must start with a / */
17
+ routeUrl: string;
18
+ /** label for the tab, can be String or the resource.key (if .isLabelResourceKey:true) */
19
+ label: string;
20
+ /** a weight used during .sort to order the tabs; will default to the order the tabs came as
21
+ * doesnt mean their array index, as many can be the same, negatives, fractions
22
+ * */
23
+ sortIndex?: number;
24
+ /** when true, will use resourceService.get to resolve INavigationBarTab.label */
25
+ isLabelResourceKey?: boolean;
26
+ /** font icon */
27
+ icon?: string;
28
+ /** image url */
29
+ img?: string;
30
+ /** aria-controls id */
31
+ controlsId?: string;
32
+ /** list of secondary tabs which will be displayed under the top-level tab */
33
+ secondaryTabs?: Array<ISecondaryNavigationBarTab<SecondaryData>>;
34
+ /** keep track of the currently selected secondary tab */
35
+ selectedSecondaryTab?: ISecondaryNavigationBarTab<SecondaryData>;
36
+ /** callback to configure save confirm actions on close. */
37
+ getSaveOptions?(tab: INavigationBarTab): INavigationBarTabSaveOptions | undefined;
38
+ /** callback when tab is removed */
39
+ onClose?(tab: INavigationBarTab): Promise<boolean> | Observable<boolean> | boolean;
40
+ /** mark tab as dirty */
41
+ dirty?: boolean;
42
+ /** visually disable and make tab unselectable */
43
+ disabled?: boolean;
44
+ /** visually hide tab and make unselectable */
45
+ hidden?: boolean;
46
+ /** exclude tab from appearing in the navigation bar system tab menu */
47
+ excludedFromSystemMenu?: boolean;
48
+ /** visually hide secondary tabs bar for a tab */
49
+ hideSecondaryTabs?: boolean;
50
+ /** indicate that the tab is associated with some new object being created. */
51
+ creating?: boolean;
52
+ /** any extra data to be associated with the tab */
53
+ data?: D;
54
+ }
55
+ export declare type ISecondaryNavigationBarTab<D = {
56
+ [key: string]: any;
57
+ }> = Omit<INavigationBarTab<D>, "secondaryTabs" | "selectedSecondaryTab">;
58
+ export interface ExternalTabConfig<T = any, P = any> {
59
+ /**
60
+ * will try to place at this index, can be negative, fraction, etc to put before/between existing tabs
61
+ */
62
+ sortIndex?: number;
63
+ /**
64
+ * finds TabId, and adds this as a secondaryTab to that tab
65
+ */
66
+ mainTabId?: string;
67
+ /**
68
+ * this is the element/tag name that will get presented
69
+ */
70
+ elementName: string;
71
+ /**
72
+ * this is the URL that the tab will be registered under,
73
+ * technically it's just a unique ID as this will be used to unregister a route and close any related tab(s)
74
+ */
75
+ configUrl: string;
76
+ /**
77
+ * function to return {@link INavigationBarTab} , remember routeUrl is from baseURL with a leading /
78
+ * fullUrl is the full URL that relates to the tab, useful when catching wildcards
79
+ * params is constructed as of /:param1/:param2, so {param1: string, param2: string}
80
+ * be aware fullUrl/params will be undefined if buildOnRegister true
81
+ */
82
+ buildTab: (fullUrl?: string, params?: P) => INavigationBarTab<T>;
83
+ /**
84
+ * add as a systemTab?, if left out will default to applicationTab, ignored if mainTabId is defined
85
+ */
86
+ systemTab?: boolean;
87
+ /**
88
+ * set this to true if you want the component to reset every time you navigate away
89
+ */
90
+ doNotReuse?: boolean;
91
+ /**
92
+ * set this to true if you want buildTab to run when registered (e.g. for a system tab that's always there)
93
+ * if your buildTab takes params, this can not be provided and must be assumed undefined
94
+ * a secondaryTab (one that has mainTabId) will be created regardless of this flag.
95
+ */
96
+ buildOnRegister?: boolean;
97
+ }
98
+ export declare type ShellTabsApi = {
99
+ /**
100
+ * this is used to expose any {@link PotentialTabItem} hooks on a component up to the Tab Service
101
+ * @param context pass "this"
102
+ * @param elRef pass the ElementRef for the component
103
+ *
104
+ * onTabClose {@link OnTabClose}, optional, can be used to prevent closing of a tab or close async
105
+ * onAttachTab {@link OnAttachTab}, will always trigger when currentNavigationBarTab has set
106
+ * onAttachToolbar {@link TabWithToolbar}, optional, will set currentToolbar if there was a toolbar in the VI Router
107
+ * onTabEnter {@link OnTabEnter}, optional, will trigger when tab is entered
108
+ * onTabLeave {@link OnTabLeave}, optional, will trigger when tab is left
109
+ * onTabSaveConfirm {@link OnTabSaveConfirm}, optional, basic dialog can be created whe closing a dirty tab
110
+ */
111
+ createTabApiForElement: (context: any, nativeElement: HTMLElement) => void;
112
+ /**
113
+ * Use this function to register new routes for tabs
114
+ * @param tabsToAdd - see {@link ExternalTabConfig}
115
+ */
116
+ registerExternalTabs: (tab: ExternalTabConfig[]) => void;
117
+ /**
118
+ * Use this function to remove routes added via registerTabFn
119
+ * @param tabsToAdd - see {@link ExternalTabConfig}
120
+ */
121
+ unregisterExternalTabs: (tabsToRemove: ExternalTabConfig[]) => void;
122
+ /**
123
+ * this will return the current primary and secondary tabs
124
+ */
125
+ getSelectedTab: () => {
126
+ primaryTab: INavigationBarTab;
127
+ secondaryTab?: INavigationBarTab;
128
+ };
129
+ /**
130
+ * this stream will track the current top level tab
131
+ */
132
+ selectedPrimaryTabChanged$: Observable<INavigationBarTab>;
133
+ /**
134
+ * this stream will track the current second level tab
135
+ */
136
+ selectedSecondaryTabChanged$: Observable<INavigationBarTab | undefined>;
137
+ /**
138
+ * this stream will update after any additions/removals to either system or application tabs
139
+ */
140
+ openTabsChanged$: Observable<{
141
+ systemTabs: INavigationBarTab[];
142
+ applicationTabs: INavigationBarTab[];
143
+ }>;
144
+ /**
145
+ * this stream will emit any removed tabs
146
+ */
147
+ tabRemoved$: Observable<INavigationBarTab>;
148
+ /**
149
+ * @param tabId will be ID of an existing tab
150
+ */
151
+ getTabById: (tabId: string) => INavigationBarTab | undefined;
152
+ /**
153
+ * will return a slice of the current system and application tabs
154
+ */
155
+ getAllTabs: () => {
156
+ system: INavigationBarTab[];
157
+ application: INavigationBarTab[];
158
+ };
159
+ /**
160
+ * will move user to the default tab
161
+ */
162
+ selectDefaultTab: () => Promise<boolean>;
163
+ /**
164
+ * will attempt to open+select a matching INavigationBarTab and optional secondaryTab, returning false on failure
165
+ * in the event the tab doesn't exist already, it will add the tab assuming an appropriate route has been registered for it
166
+ * @param tabToSelect {@link INavigationBarTab}
167
+ * @param secondaryTab {@link INavigationBarTab} if left undefined, this will select the previously
168
+ * selected secondary tab of the primary tab or it's first index secondary tab
169
+ */
170
+ openTab: (tabToSelect: INavigationBarTab, secondaryTab?: INavigationBarTab) => Promise<boolean>;
171
+ /**
172
+ * will attempt to select a tab by its id, returning false on failure
173
+ * @param tabId will be ID of an existing tab
174
+ */
175
+ selectTabById: (tabId: string) => Promise<boolean>;
176
+ /**
177
+ * will remove an application tab, if allowed, and will trigger any closing and saving logic beforehand
178
+ * @param tabIdToRemove will be ID of an existing tab
179
+ * @param suppressNavigation if you are closing a tab that isn't open, you want to supressNavigation=true
180
+ */
181
+ removeApplicationTabById: (tabIdToRemove: string, suppressNavigation?: boolean) => Promise<boolean>;
182
+ /**
183
+ * will remove an existing application tab then replace with another, if {@link removeApplicationTabById} is unsuccessful this will fail
184
+ * use case can be saving a tab which has a temporary ID, and reopening it with a saved payload.
185
+ * @param tabId will be ID of an existing tab
186
+ * @param newTab {@link INavigationBarTab}
187
+ *
188
+ */
189
+ replaceApplicationTab: (tabId: string, newTab: INavigationBarTab) => Promise<boolean>;
190
+ /**
191
+ * will run {@link removeApplicationTabById} on all tabs, will stop if any fail to close, will wait for each close to complete
192
+ */
193
+ removeAllApplicationTabs: () => Promise<boolean>;
194
+ /**
195
+ * will run same as {@link removeAllApplicationTabs}, but not on the provided tabIdToKeep
196
+ * @param tabIdToKeep
197
+ */
198
+ removeOtherApplicationTabs: (tabIdToKeep?: string) => Promise<boolean>;
199
+ };
@@ -0,0 +1,6 @@
1
+ import { expectType } from "../../shared/util/helper-functions";
2
+ expectType(true);
3
+ expectType(true);
4
+ expectType(true);
5
+ expectType(true);
6
+ expectType(true);
@@ -0,0 +1,69 @@
1
+ import { OnDestroy } from "@angular/core";
2
+ import { INavigationBarTab, INavigationBarTabs } from "./shell-tabs-api";
3
+ import { Observable } from "rxjs";
4
+ export declare type PotentialTabItem<T = any, U = any> = Partial<OnAttachTab<T> & OnTabEnter & OnTabLeave & OnTabSaveConfirm & OnTabClose & TabWithToolbar<U> & OnDestroy>;
5
+ export interface OnAttachTab<T = any> {
6
+ currentNavigationBarTab?: INavigationBarTab<T>;
7
+ /**
8
+ * Runs when a navigation bar tab is first attached to the implementing component.
9
+ * If the tab is recycled, it will only run once.
10
+ */
11
+ onAttachTab?(): void;
12
+ }
13
+ export interface OnTabEnterParams {
14
+ from?: INavigationBarTab;
15
+ fromSecondary?: INavigationBarTab;
16
+ to: INavigationBarTab;
17
+ toSecondary?: INavigationBarTab;
18
+ recycled: boolean;
19
+ }
20
+ export declare type OnTabLeaveParams = Omit<OnTabEnterParams, "recycled">;
21
+ export interface OnTabEnter {
22
+ /**
23
+ * Function to run when the Tab is entered, this happens on first load as well
24
+ * @param params - from is previous tab (possibly undefined on first load), to is always this tab;
25
+ * type {@link INavigationBarTab}, recycled is whether the component was recycled or not
26
+ */
27
+ onTabEnter(params: OnTabEnterParams): void;
28
+ }
29
+ export interface OnTabLeave {
30
+ /**
31
+ * Function to run when the Tab is left
32
+ * @param params - from is always this tab, to is where the user is going; type {@link INavigationBarTab}
33
+ */
34
+ onTabLeave(params: OnTabLeaveParams): void;
35
+ }
36
+ export interface TabToolbarFor<T = any> {
37
+ currentComponentAndTab?: {
38
+ tab: INavigationBarTabs;
39
+ component: T;
40
+ };
41
+ onAttachComponent?(): void;
42
+ }
43
+ export interface TabWithToolbar<T> {
44
+ currentToolbar?: T;
45
+ onAttachToolbar?(): void;
46
+ }
47
+ export interface OnTabClose {
48
+ /**
49
+ * @param tab the current tab model that is closing.
50
+ */
51
+ onTabClose(tab: INavigationBarTab): boolean | Promise<boolean> | Observable<boolean>;
52
+ }
53
+ export interface OnTabSaveConfirm {
54
+ /**
55
+ * @param tab the current tab model that is closing.
56
+ */
57
+ onTabSaveConfirm(tab: INavigationBarTab): INavigationBarTabSaveOptions | undefined;
58
+ }
59
+ export interface INavigationBarTabSaveOptions {
60
+ dialogTitle: string;
61
+ dialogMessage: string;
62
+ saveFunction(): Promise<boolean> | Observable<boolean> | boolean;
63
+ }
64
+ export declare type WebElementTabApi<NavBarDataType = any, ComponentType = any> = Omit<PotentialTabItem<NavBarDataType, ComponentType>, "onAttachTab" | keyof TabWithToolbar<ComponentType>> & {
65
+ onAttachTab?(tab: INavigationBarTab<NavBarDataType>): void;
66
+ };
67
+ export declare type WebTabApiElement = HTMLElement & {
68
+ tabApi?: WebElementTabApi;
69
+ };
@@ -0,0 +1,14 @@
1
+ import { expectType } from "../../shared/util/helper-functions";
2
+ expectType(true);
3
+ expectType(true);
4
+ expectType(true);
5
+ expectType(true);
6
+ expectType(true);
7
+ expectType(true);
8
+ expectType(true);
9
+ expectType(true);
10
+ expectType(true);
11
+ expectType(true);
12
+ expectType(true);
13
+ expectType(true);
14
+ expectType(true);