@sassoftware/vi-api 1.7.1 → 1.15.2

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.
Files changed (45) hide show
  1. package/api.module.js +60 -72
  2. package/component/bindings.d.ts +44 -0
  3. package/config/config-api.d.ts +57 -0
  4. package/control/control-api.d.ts +14 -0
  5. package/control/events.d.ts +1 -0
  6. package/control/page.d.ts +2 -2
  7. package/control/restrictions.d.ts +5 -1
  8. package/event/event-api.d.ts +3 -1
  9. package/event/event-api.js +2 -0
  10. package/index.d.ts +70 -65
  11. package/index.js +1 -1
  12. package/init/index.d.ts +54 -0
  13. package/init/index.js +17 -0
  14. package/init/init-api.d.ts +26 -0
  15. package/init/init-api.js +83 -0
  16. package/init/package.json +9 -0
  17. package/init/public-api.d.ts +1 -0
  18. package/init/public-api.js +1 -0
  19. package/localization/localization-api.d.ts +75 -0
  20. package/metadata/metadata-api.d.ts +40 -3
  21. package/object/object-api.d.ts +36 -9
  22. package/object/object-api.js +5 -0
  23. package/package.json +1 -1
  24. package/page-state/page-state-api.d.ts +5 -32
  25. package/property/property-api.d.ts +71 -1
  26. package/public-api.d.ts +1 -1
  27. package/public-api.js +1 -1
  28. package/resource/resource-api.d.ts +1 -0
  29. package/search/client/client-search-api.d.ts +22 -17
  30. package/sheet/sheet-api.d.ts +7 -7
  31. package/shell-tabs/package.json +9 -0
  32. package/shell-tabs/public-api.d.ts +2 -0
  33. package/shell-tabs/public-api.js +2 -0
  34. package/shell-tabs/shell-tabs-api.d.ts +199 -0
  35. package/shell-tabs/shell-tabs-api.js +6 -0
  36. package/shell-tabs/shell-tabs-lifecycle-api.d.ts +69 -0
  37. package/shell-tabs/shell-tabs-lifecycle-api.js +14 -0
  38. package/alert-reps/index.d.ts +0 -681
  39. package/alert-reps/package.json +0 -5
  40. package/score-reps/index.d.ts +0 -133
  41. package/score-reps/package.json +0 -5
  42. package/svi-datahub/index.d.ts +0 -4559
  43. package/svi-datahub/package.json +0 -5
  44. package/svi-sand/index.d.ts +0 -1064
  45. package/svi-sand/package.json +0 -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 {
@@ -41,9 +41,6 @@ export interface NetworkData {
41
41
  };
42
42
  numNodes: number;
43
43
  }
44
- export interface ResolvedObjectIdentifier extends ObjectIdentifier {
45
- compoundValues: string[];
46
- }
47
44
  export interface SearchAndCreateDialogModel {
48
45
  entityName: string;
49
46
  entityLabel: string;
@@ -52,16 +49,14 @@ export interface SearchAndCreateDialogModel {
52
49
  canCreate?: boolean;
53
50
  linkReasons?: Relationship[];
54
51
  /**
55
- * Values returned on the close of the dialog. May be undefined when dialog is cancelled.
52
+ * Values returned on the close of the dialog box. May be undefined when dialog box is cancelled.
56
53
  */
57
54
  result?: SearchAndCreateResponse;
58
55
  }
59
56
  export interface SearchObject extends ObjectIdentifier {
60
57
  title?: string;
61
- isResolvedEntity?: boolean;
62
58
  typeLabel?: string;
63
59
  uniqueKey?: string;
64
- compoundValues?: string[];
65
60
  }
66
61
  export interface SearchAndCreateRelateToModel {
67
62
  linkReason?: Relationship;
@@ -92,7 +87,7 @@ export interface ClientSearchApi extends SearchApi {
92
87
  * @param queryText {string} Text used to form the query.
93
88
  * @param visualizationName {"summary" | "map" | "table"} Visualization to query for and then display to the user.
94
89
  * @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".
90
+ * @param [queryMode] {"standard" | "phonetic" | "synonym"} Used to perform phonetic and synonym searches. Default: "standard".
96
91
  */
97
92
  navigateSearch(queryText: string, visualizationName: SearchVisualization, mapFilters?: MapFilter[], queryMode?: QueryMode[]): Promise<void>;
98
93
  /**
@@ -119,18 +114,18 @@ export interface ClientSearchApi extends SearchApi {
119
114
  * @description Sets the query builder model for the given ID. If no ID is given, it sets the query model for SEARCH.
120
115
  * When stored, the query model is used to initially populate a Query Builder opened with the given ID.
121
116
  * @param queryModel {QueryBuilderModel} A query builder model.
122
- * @param [id] {string} ID of the model to set. Defaults to SEARCH.
117
+ * @param [id] {string} ID of the model to set. Default: SEARCH.
123
118
  */
124
119
  setQueryBuilderModel(queryModel: QueryBuilderModel, id?: string): void;
125
120
  /**
126
121
  * @method
127
122
  * @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.
129
- * @param objects {Array<ObjectIdentifier | ResolvedObjectIdentifier>} Objects to add to the workspace.
123
+ * @param visualizationName {Visualization} Visualization to display after the objects have been added.
124
+ * @param objects {ObjectIdentifier[]} Objects to add to the workspace.
130
125
  * @param [currentObject] {ObjectIdentifier} The document the user is currently viewing. This is used as a visual aid in the dialog box.
131
126
  * @param [networkData] {NetworkData} Network visualization data to be copied to the workspace.
132
127
  */
133
- openAddObjectsToWorkspaceDialog(visualizationName: Visualization, objects: Array<ObjectIdentifier | ResolvedObjectIdentifier>, currentObject?: ObjectIdentifier, networkData?: NetworkData): Promise<void>;
128
+ openAddObjectsToWorkspaceDialog(visualizationName: Visualization, objects: ObjectIdentifier[], currentObject?: ObjectIdentifier, networkData?: NetworkData): Promise<void>;
134
129
  /**
135
130
  * @method
136
131
  * @description Adds an image to the Insights selected in the "Add image to Insights" dialog box.
@@ -144,20 +139,30 @@ export interface ClientSearchApi extends SearchApi {
144
139
  * @method
145
140
  * @description Creates a new workspace in the target object, populating it with an initial set of objects.
146
141
  * Allows the creation of new objects assuming create mode is supported for the object type.
147
- * @param objectsToAdd {Array<ObjectIdentifier | ResolvedObjectIdentifier>} Objects to add to the workspace.
142
+ * @param objectsToAdd {ObjectIdentifier[]} Objects to add to the workspace.
148
143
  * @param targetObjectType {string} Object type where the workspace is created.
149
144
  * @param [targetObjectId] {string} Object to add to the workspace. If undefined, a new object is created.
150
145
  * @param [visualization] {"summary" | "map" | "table" | "timeline" | "networkDiagram"} Visualization to initially display in the new workspace.
151
146
  * @param [workspaceName] {string} Name of the new workspace.
152
147
  * @param [networkData] {NetworkData} Network visualization data to be copied to the new workspace.
153
148
  */
154
- addToNewWorkspace(objectsToAdd: Array<ObjectIdentifier | ResolvedObjectIdentifier>, targetObjectType: string, targetObjectId?: string, visualization?: Visualization, workspaceName?: string, networkData?: NetworkData): Promise<void>;
149
+ addToNewWorkspace(objectsToAdd: ObjectIdentifier[], targetObjectType: string, targetObjectId?: string, visualization?: Visualization, workspaceName?: string, networkData?: NetworkData): Promise<void>;
155
150
  /**
156
151
  * @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.
152
+ * @description Launches a wizard allowing users to search, before creating an object/relationship.
153
+ * The relationship wizard is determined by the relateToParentLabel or relateToParentName defined in the wizardValues parameter.
159
154
  * @param wizardValues {SearchAndCreateDialogModel} Object containing entity and relationship data.
160
- * @returns A Promise which resolves when the dialog is closed.
155
+ * @returns A Promise which resolves when the dialog box is closed.
161
156
  */
162
157
  openSearchAndCreateDialog(wizardValues: SearchAndCreateDialogModel): Promise<SearchAndCreateDialogModel>;
158
+ /**
159
+ * @method
160
+ * @description Gets the selected items within the search result or specified workspace.
161
+ * @param selectionId {string} The selection ID for the currently selected objects. Default: "SEARCH".
162
+ * @param maxItems {number} The maximum number of items to get in the selection. Default: 50.
163
+ * @param textAnalytics {boolean} Boolean value to determine whether the current visualization is Text Analytics. Default: false.
164
+ */
165
+ getSelectedItems(selectionId: string, maxItems: number, textAnalytics: boolean): Promise<{
166
+ [index: string]: SummaryVisualizationResponse;
167
+ } | undefined>;
163
168
  }
@@ -1,5 +1,5 @@
1
1
  import { ObjectIdentifier, ObjectSheetSettings, VIObject } from "../object/object-api";
2
- import { NetworkData, ResolvedObjectIdentifier, Visualization } from "../search/client/client-search-api";
2
+ import { NetworkData, Visualization } from "../search/client/client-search-api";
3
3
  /**
4
4
  * This API pertains to functionality related to SAS Visual Investigator's sheet capabilities.
5
5
  * Accessed from the window at window.sas.vi.sheet.
@@ -59,10 +59,10 @@ export interface SheetApi {
59
59
  /**
60
60
  * @method
61
61
  * @description Adds objects to a workspace selected in the "Add Objects to Workspace" dialog box.
62
- * @param objects {Array<ObjectIdentifier> | ResolvedObjectIdentifier} Objects to add to a workspace.
62
+ * @param objects {ObjectIdentifier[]} Objects to add to a workspace.
63
63
  * @param [options] {AddAllObjectsToWorkspaceDialogOptions} Additional options to customize the dialog box and select the Visualization to display after the objects are added.
64
64
  */
65
- openAddAllObjectsToWorkspaceDialog(objects: Array<ObjectIdentifier | ResolvedObjectIdentifier>, options?: AddAllObjectsToWorkspaceDialogOptions): Promise<void>;
65
+ openAddAllObjectsToWorkspaceDialog(objects: ObjectIdentifier[], options?: AddAllObjectsToWorkspaceDialogOptions): Promise<void>;
66
66
  /**
67
67
  * @method
68
68
  * @description Adds an image to the Insights selected in the "Add image to Insights" dialog box.
@@ -77,21 +77,21 @@ export interface SheetApi {
77
77
  * @description Creates a new workspace in the target object, populating it with an initial set of objects.
78
78
  * Allows the creation of new objects assuming create mode is supported for the object type.
79
79
  * If options.targetObjectId is undefined, then a new object is created.
80
- * @param objectsToAdd {Array<ObjectIdentifier | ResolvedObjectIdentifier>} Objects to add to the new workspace.
80
+ * @param objectsToAdd {ObjectIdentifier[]} Objects to add to the new workspace.
81
81
  * @param targetObjectType {string} Object type where the workspace is created.
82
82
  * @param [options] {AddToNewWorkspaceOptions} Additional options to set a target object ID, workspace name and so on.
83
83
  */
84
- addToNewWorkspace(objectsToAdd: Array<ObjectIdentifier | ResolvedObjectIdentifier>, targetObjectType: string, options: AddToNewWorkspaceOptions): Promise<void>;
84
+ addToNewWorkspace(objectsToAdd: ObjectIdentifier[], targetObjectType: string, options: AddToNewWorkspaceOptions): Promise<void>;
85
85
  /**
86
86
  * @method
87
87
  * @description Adds objects to an existing workspace.
88
88
  * @param targetObject {VIObject} Object containing the existing workspace.
89
89
  * @param workspaceClientId {string} Client ID of the workspace to add to.
90
- * @param objectsToAdd {Array<ObjectIdentifier | ResolvedObjectIdentifier>} Objects to add. It is safe to pass objects that are already in the workspace.
90
+ * @param objectsToAdd {ObjectIdentifier[]} Objects to add. It is safe to pass objects that are already in the workspace.
91
91
  * @param [networkData] {NetworkData} If provided, network data that will be merged into any existing network data on the workspace.
92
92
  * @param [isUndoRedo] {boolean} Specifies if the function was called as part of an undo/redo operation.
93
93
  */
94
- addToExistingWorkspace(targetObject: VIObject, workspaceClientId: string, objectsToAdd: Array<ObjectIdentifier | ResolvedObjectIdentifier>, networkData?: NetworkData, isUndoRedo?: boolean): Promise<void>;
94
+ addToExistingWorkspace(targetObject: VIObject, workspaceClientId: string, objectsToAdd: ObjectIdentifier[], networkData?: NetworkData, isUndoRedo?: boolean): Promise<void>;
95
95
  }
96
96
  export interface AddAllObjectsToWorkspaceDialogOptions {
97
97
  /**
@@ -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);