@energycap/components 0.26.11 → 0.27.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.
- package/bundles/energycap-components.umd.js +7247 -6296
- package/bundles/energycap-components.umd.js.map +1 -1
- package/bundles/energycap-components.umd.min.js +16 -1
- package/bundles/energycap-components.umd.min.js.map +1 -1
- package/energycap-components.d.ts +2 -4
- package/energycap-components.metadata.json +1 -1
- package/esm2015/energycap-components.js +3 -5
- package/esm2015/lib/components.module.js +52 -38
- package/esm2015/lib/core/cache.service.js +49 -4
- package/esm2015/lib/core/telemetry-tracker.service.js +14 -0
- package/esm2015/lib/core/telemetry.service.js +32 -7
- package/esm2015/lib/display/help/help-types.js +2 -0
- package/esm2015/lib/display/hierarchy/hierarchy-base.js +106 -0
- package/esm2015/lib/display/hierarchy/hierarchy-mocks.spec.js +58 -0
- package/esm2015/lib/display/hierarchy/hierarchy-tree/hierarchy-tree.component.js +58 -0
- package/esm2015/lib/display/resizable/resizable.component.js +57 -0
- package/esm2015/lib/display/tree/tree.component.js +83 -0
- package/esm2015/lib/shared/page/page-base/page-base.component.js +69 -12
- package/esm2015/lib/shared/page/page-statuses.js +23 -0
- package/esm2015/lib/shared/testing/hierarchy-base-test-injector-factory.spec.js +17 -0
- package/esm2015/lib/shared/testing/page-base-component-test-injector-factory.spec.js +21 -1
- package/esm2015/lib/shared/wizard/wizard-base/wizard-base.component.js +260 -0
- package/esm2015/lib/shared/wizard/wizard-buttons/wizard-buttons.component.js +52 -0
- package/esm2015/lib/shared/wizard/wizard-progress/wizard-progress.component.js +18 -0
- package/esm2015/public-api.js +15 -3
- package/fesm2015/energycap-components.js +6867 -6000
- package/fesm2015/energycap-components.js.map +1 -1
- package/lib/components.module.d.ts +2 -3
- package/lib/core/cache.service.d.ts +11 -1
- package/lib/core/telemetry-tracker.service.d.ts +10 -0
- package/lib/core/telemetry.service.d.ts +19 -2
- package/lib/display/help/help-types.d.ts +33 -0
- package/lib/display/hierarchy/hierarchy-base.d.ts +72 -0
- package/lib/display/hierarchy/hierarchy-mocks.spec.d.ts +53 -0
- package/lib/display/hierarchy/hierarchy-tree/hierarchy-tree.component.d.ts +29 -0
- package/lib/display/resizable/resizable.component.d.ts +28 -0
- package/lib/display/tree/tree.component.d.ts +51 -0
- package/lib/shared/page/page-base/page-base.component.d.ts +43 -1
- package/lib/shared/page/page-statuses.d.ts +13 -0
- package/lib/shared/testing/hierarchy-base-test-injector-factory.spec.d.ts +4 -0
- package/lib/shared/testing/page-base-component-test-injector-factory.spec.d.ts +9 -0
- package/lib/shared/wizard/wizard-base/wizard-base.component.d.ts +131 -0
- package/lib/shared/wizard/wizard-buttons/wizard-buttons.component.d.ts +23 -0
- package/lib/shared/wizard/wizard-progress/wizard-progress.component.d.ts +7 -0
- package/package.json +1 -1
- package/public-api.d.ts +14 -2
- package/src/assets/locales/en_US.json +3 -1
- package/src/styles/mixins/_resizable-base.scss +1 -2
- package/esm2015/lib/core/telemetry-base.service.js +0 -3
- package/lib/core/telemetry-base.service.d.ts +0 -25
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ModuleWithProviders,
|
|
2
|
-
import { TelemetryBaseService } from './core/telemetry-base.service';
|
|
1
|
+
import { ModuleWithProviders, Provider } from '@angular/core';
|
|
3
2
|
export declare type ComponentsModuleConfig = {
|
|
4
|
-
|
|
3
|
+
tracker: Provider;
|
|
5
4
|
};
|
|
6
5
|
export declare class ComponentsModule {
|
|
7
6
|
/**
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export declare class CacheService {
|
|
2
|
+
private localStorageAvailable;
|
|
3
|
+
private sessionStorageAvailable;
|
|
4
|
+
constructor();
|
|
5
|
+
/**Return true if the requested cache allows the user to round-trip data in the current environment.
|
|
6
|
+
* Security settings can prevent it and the app may need to know if "not found" means "never set" or "not supported"
|
|
7
|
+
*/
|
|
8
|
+
isCacheAvailable(sessionOnly?: boolean): boolean;
|
|
2
9
|
/**
|
|
3
10
|
* Retrieve an item from cache
|
|
4
11
|
*/
|
|
@@ -15,6 +22,9 @@ export declare class CacheService {
|
|
|
15
22
|
* Persists an item to cache
|
|
16
23
|
*/
|
|
17
24
|
setItem(key: string, value: object, sessionOnly?: boolean): void;
|
|
18
|
-
/**Returns the local or session storage to use for backing the given cache request
|
|
25
|
+
/**Returns the local or session storage to use for backing the given cache request.
|
|
26
|
+
* If the browser does not support the requested storage the result will be null.
|
|
27
|
+
* This can happen if the user is in Firefox for example with the setting dom.storage.enabled = false
|
|
28
|
+
*/
|
|
19
29
|
private getStorage;
|
|
20
30
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class TelemetryTrackerService {
|
|
2
|
+
trackPageView(pageName: string, url: string, properties?: {
|
|
3
|
+
[key: string]: string | number;
|
|
4
|
+
}): void;
|
|
5
|
+
trackEvent(name: string, properties?: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
}, measurements?: {
|
|
8
|
+
[val: string]: number;
|
|
9
|
+
}): void;
|
|
10
|
+
}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class TelemetryService
|
|
1
|
+
import { TelemetryTrackerService } from './telemetry-tracker.service';
|
|
2
|
+
export declare class TelemetryService {
|
|
3
|
+
private telemetryTrackerService;
|
|
4
|
+
constructor(telemetryTrackerService: TelemetryTrackerService);
|
|
5
|
+
/**
|
|
6
|
+
* Tracks a Page View / State change
|
|
7
|
+
*
|
|
8
|
+
* @param {string} pageName
|
|
9
|
+
* @param {string} url
|
|
10
|
+
* @memberof TelemetryService
|
|
11
|
+
*/
|
|
3
12
|
trackPageView(pageName: string, url: string, properties?: {
|
|
4
13
|
[key: string]: string | number;
|
|
5
14
|
}): void;
|
|
15
|
+
/**
|
|
16
|
+
* Tracks a generic event
|
|
17
|
+
*
|
|
18
|
+
* @param {string} name
|
|
19
|
+
* @param {{[key: string]:string}} [properties]
|
|
20
|
+
* @param {{[val:string]:number}} [measurements]
|
|
21
|
+
* @memberof TelemetryService
|
|
22
|
+
*/
|
|
6
23
|
trackEvent(name: string, properties?: {
|
|
7
24
|
[key: string]: string;
|
|
8
25
|
}, measurements?: {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare type Help = {
|
|
2
|
+
controls: HelpControl[];
|
|
3
|
+
overview?: string;
|
|
4
|
+
alwaysVisible?: boolean;
|
|
5
|
+
ignoreUserSetting?: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A form control in the current view to define in the help panel
|
|
9
|
+
*/
|
|
10
|
+
export declare type HelpControl = {
|
|
11
|
+
/**
|
|
12
|
+
* The controls id
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
16
|
+
/**
|
|
17
|
+
* The form control ids to match this help control
|
|
18
|
+
* If this array is defined the id's within this will take precidence over the
|
|
19
|
+
* id of the help control when trying to match up a control
|
|
20
|
+
* @type {string[]}
|
|
21
|
+
*/
|
|
22
|
+
idGroup?: Array<string>;
|
|
23
|
+
/**
|
|
24
|
+
* The name of the control
|
|
25
|
+
* @type {string}
|
|
26
|
+
*/
|
|
27
|
+
label: string;
|
|
28
|
+
/**
|
|
29
|
+
* The definition for the control
|
|
30
|
+
* @type {string}
|
|
31
|
+
*/
|
|
32
|
+
definition: string;
|
|
33
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { EventEmitter, Injector, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { Params, QueryParamsHandling } from '@angular/router';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { LinkItem } from '../../controls/navigation/link-item';
|
|
5
|
+
import { TelemetryService } from '../../core/telemetry.service';
|
|
6
|
+
import { ViewStatus } from '../../shared/display';
|
|
7
|
+
export declare class HierarchyItem implements LinkItem {
|
|
8
|
+
id: string;
|
|
9
|
+
/** Label to display for the item */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Indicates how many levels deep the item is in the parent structure */
|
|
12
|
+
level: number;
|
|
13
|
+
url?: string;
|
|
14
|
+
queryParams?: Params | null;
|
|
15
|
+
queryParamsHandling?: QueryParamsHandling;
|
|
16
|
+
icon?: string;
|
|
17
|
+
/** Display item as a link or a heading */
|
|
18
|
+
display?: 'default' | 'heading';
|
|
19
|
+
/** Set to hide toggle, even if item has children */
|
|
20
|
+
hideToggle?: boolean;
|
|
21
|
+
/** Flag to indicate whether the item has children or not, mostly drives
|
|
22
|
+
* whether you get the expand/collapse button
|
|
23
|
+
*/
|
|
24
|
+
hasChildren: boolean;
|
|
25
|
+
/** Array of children if any for the item */
|
|
26
|
+
children: Array<HierarchyItem>;
|
|
27
|
+
/** Flag to indicate if the item has been expanded */
|
|
28
|
+
expanded?: boolean;
|
|
29
|
+
/** Flag to indicate if the item is selected */
|
|
30
|
+
selected?: boolean;
|
|
31
|
+
/** Flag to indicate if the item can be selected */
|
|
32
|
+
selectable?: boolean;
|
|
33
|
+
readonly?: boolean;
|
|
34
|
+
/** Status of each item to indicate whether children lookup is pending or
|
|
35
|
+
* if an error occurred retrieving data
|
|
36
|
+
*/
|
|
37
|
+
status?: ViewStatus;
|
|
38
|
+
/** Indicates if the item is a top level entity, e.g. Organization or Cost Center */
|
|
39
|
+
topLevel?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* When checking the url for activeness, the url must match exactly or partially
|
|
42
|
+
* @see https://angular.io/guide/router#active-router-links
|
|
43
|
+
*/
|
|
44
|
+
isActiveExactMatch?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare abstract class HierarchyBase implements OnChanges, OnDestroy {
|
|
47
|
+
/** First item to start the hierarchy structure */
|
|
48
|
+
rootNode: HierarchyItem;
|
|
49
|
+
/** Event emitter to request children for a given item */
|
|
50
|
+
getItemChildren: EventEmitter<HierarchyItem>;
|
|
51
|
+
/**
|
|
52
|
+
* Used to unsubscribe from observables
|
|
53
|
+
*/
|
|
54
|
+
private _destroyed;
|
|
55
|
+
get destroyed(): Subject<any>;
|
|
56
|
+
protected telemetryService: TelemetryService;
|
|
57
|
+
constructor(injector: Injector);
|
|
58
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
59
|
+
/**
|
|
60
|
+
* Function called when the component is destroyed
|
|
61
|
+
*/
|
|
62
|
+
ngOnDestroy(): void;
|
|
63
|
+
/** Handler for the toggle button */
|
|
64
|
+
toggleItemClicked(item: HierarchyItem, expanded: boolean): void;
|
|
65
|
+
/** Method exposed to the parent component to set the items children once they are available
|
|
66
|
+
*/
|
|
67
|
+
setItemChildren(parentItem: HierarchyItem, items: Array<HierarchyItem>): void;
|
|
68
|
+
/** Method exposed to the parent component to indicate that something happened on the
|
|
69
|
+
* item that caused an error, could be retrieving children
|
|
70
|
+
*/
|
|
71
|
+
setItemError(parentItem: HierarchyItem): void;
|
|
72
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { HierarchyItem } from './hierarchy-base';
|
|
2
|
+
export declare namespace HierarchyMocks {
|
|
3
|
+
const mockRoot: () => HierarchyItem;
|
|
4
|
+
const bldgWithChildren: () => {
|
|
5
|
+
placeId: number;
|
|
6
|
+
parentId: number;
|
|
7
|
+
placeTypeId: number;
|
|
8
|
+
placeCode: string;
|
|
9
|
+
placeInfo: string;
|
|
10
|
+
hasChildren: boolean;
|
|
11
|
+
placeChildren: never[];
|
|
12
|
+
meterChildren: never[];
|
|
13
|
+
hasActiveChildren: boolean;
|
|
14
|
+
};
|
|
15
|
+
const bldgWithChildrenHierarchyItem: () => HierarchyItem;
|
|
16
|
+
const orgWithChildren: () => {
|
|
17
|
+
placeId: number;
|
|
18
|
+
parentId: number;
|
|
19
|
+
placeTypeId: number;
|
|
20
|
+
placeCode: string;
|
|
21
|
+
placeInfo: string;
|
|
22
|
+
hasChildren: boolean;
|
|
23
|
+
placeChildren: never[];
|
|
24
|
+
meterChildren: never[];
|
|
25
|
+
hasActiveChildren: boolean;
|
|
26
|
+
};
|
|
27
|
+
const orgWithChildrenHierarchyItem: () => HierarchyItem;
|
|
28
|
+
const orgWithoutChildren: () => {
|
|
29
|
+
placeId: number;
|
|
30
|
+
parentId: number;
|
|
31
|
+
placeTypeId: number;
|
|
32
|
+
placeCode: string;
|
|
33
|
+
placeInfo: string;
|
|
34
|
+
hasChildren: boolean;
|
|
35
|
+
placeChildren: never[];
|
|
36
|
+
meterChildren: never[];
|
|
37
|
+
hasActiveChildren: boolean;
|
|
38
|
+
};
|
|
39
|
+
const orgWithoutChildrenHierarchyItem: () => HierarchyItem;
|
|
40
|
+
const bldgWithoutChildren: () => {
|
|
41
|
+
placeId: number;
|
|
42
|
+
parentId: number;
|
|
43
|
+
placeTypeId: number;
|
|
44
|
+
placeCode: string;
|
|
45
|
+
placeInfo: string;
|
|
46
|
+
hasChildren: boolean;
|
|
47
|
+
placeChildren: never[];
|
|
48
|
+
meterChildren: never[];
|
|
49
|
+
hasActiveChildren: boolean;
|
|
50
|
+
};
|
|
51
|
+
const bldgWithoutChildrenHierarchyItem: () => HierarchyItem;
|
|
52
|
+
const sortedHierarchyPlaces: () => HierarchyItem[];
|
|
53
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Injector, OnInit } from '@angular/core';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
import { ScrollService } from '../../../core/scroll.service';
|
|
4
|
+
import { HierarchyBase, HierarchyItem } from '../hierarchy-base';
|
|
5
|
+
export declare class HierarchyTreeComponent extends HierarchyBase implements OnInit {
|
|
6
|
+
private scrollService;
|
|
7
|
+
/** The value of the id attribute of the tree's root HTMLUListElement, suffixed with '_root' */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Hide the root node */
|
|
10
|
+
hideRootNode?: boolean;
|
|
11
|
+
/** Emits a HierarchyItem whenever one is selected by clicking */
|
|
12
|
+
itemSelected: Subject<HierarchyItem>;
|
|
13
|
+
/** The width of the spacing before a tree node, multipled by a HierarchyItem's level. Value is in pixels */
|
|
14
|
+
indent: number;
|
|
15
|
+
/** The value of the id attribute of the tree's scroll container element, used to scroll a selected item into view. */
|
|
16
|
+
scrollContainerId: string;
|
|
17
|
+
constructor(scrollService: ScrollService, injector: Injector);
|
|
18
|
+
ngOnInit(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Scroll to the item currently marked as is-selected. Wait a tick for the
|
|
21
|
+
* NavItemActiveDirective to update the selected class.
|
|
22
|
+
*/
|
|
23
|
+
scrollToSelectedItem(): void;
|
|
24
|
+
/**
|
|
25
|
+
* When a HierarchyItem is selected, update the value of the activeUrl property with the value
|
|
26
|
+
* of that item's url property and emit the item to any subscribers.
|
|
27
|
+
*/
|
|
28
|
+
selectItem(item: HierarchyItem): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ElementRef, OnInit, Renderer2 } from '@angular/core';
|
|
2
|
+
import { CacheService } from '../../core/cache.service';
|
|
3
|
+
import { ResizableBase } from './resizable-base';
|
|
4
|
+
/**
|
|
5
|
+
* Make an element resizable horizontally by wrapping it in the ResizableComponent.
|
|
6
|
+
* Default widths / limits are applied but you can optionally override them
|
|
7
|
+
* with min-width and max-width with style attributes
|
|
8
|
+
* @example
|
|
9
|
+
* <ec-resizable [style.width.px]="200"
|
|
10
|
+
* [style.min-width.px]="75"
|
|
11
|
+
* [style.max-width.px]="300">
|
|
12
|
+
* <div> ... </div>
|
|
13
|
+
* </ec-resizable>
|
|
14
|
+
*/
|
|
15
|
+
export declare class ResizableComponent extends ResizableBase implements OnInit {
|
|
16
|
+
private el;
|
|
17
|
+
constructor(el: ElementRef, renderer: Renderer2, cacheService: CacheService, document: Document);
|
|
18
|
+
/** Store the host element to reference later */
|
|
19
|
+
ngOnInit(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Set the new width of the element and emit the new width to subscribers
|
|
22
|
+
*/
|
|
23
|
+
protected setWidth(width: number): void;
|
|
24
|
+
/**Called from the base class when cached widths are available and restoring
|
|
25
|
+
* width is enabled. We only care about the first one because we only have one width
|
|
26
|
+
*/
|
|
27
|
+
protected restoreWidths(widths: number[]): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { MenuComponent, MenuItem, MenuTemplateType } from '../../controls/menu/menu.component';
|
|
3
|
+
import { HierarchyItem } from '../hierarchy/hierarchy-base';
|
|
4
|
+
import { HierarchyTreeComponent } from '../hierarchy/hierarchy-tree/hierarchy-tree.component';
|
|
5
|
+
import { Overlay } from '../view-overlay/view-overlay.component';
|
|
6
|
+
export declare type TreeType = 'hierarchy' | 'menu';
|
|
7
|
+
export declare class TreeComponent {
|
|
8
|
+
/** The value of the host elements id attribute */
|
|
9
|
+
attrId: string;
|
|
10
|
+
/**
|
|
11
|
+
* The ID of the component, bound to the host element's id attribute and passed
|
|
12
|
+
* to child components
|
|
13
|
+
*/
|
|
14
|
+
set id(value: string);
|
|
15
|
+
get id(): string;
|
|
16
|
+
private _id;
|
|
17
|
+
/** The tree's title displayed in the header */
|
|
18
|
+
treeTitle: string;
|
|
19
|
+
/** Items to display in the tree when type is 'menu' */
|
|
20
|
+
treeItems?: MenuItem[];
|
|
21
|
+
/** Hide the root tree item when type is 'hierarchy' */
|
|
22
|
+
treeHierarchyHideRootNode?: boolean;
|
|
23
|
+
/** Items to display in the tree when type is 'hierarchy' */
|
|
24
|
+
treeHierarchy?: HierarchyItem;
|
|
25
|
+
/** Tree overlay */
|
|
26
|
+
status?: Overlay;
|
|
27
|
+
/** Display the tree items with a MenuComponent or a HierarchyTreeComponent */
|
|
28
|
+
type?: TreeType;
|
|
29
|
+
/** Items to display in the dropdown menu */
|
|
30
|
+
menuItems?: MenuItem[];
|
|
31
|
+
/** Tree dropdown menu overlay */
|
|
32
|
+
menuStatus?: Overlay;
|
|
33
|
+
/** The menu item template */
|
|
34
|
+
menuTemplateType?: MenuTemplateType;
|
|
35
|
+
/** Emits the item currently selected item in the tree */
|
|
36
|
+
treeSelection: EventEmitter<MenuItem | HierarchyItem>;
|
|
37
|
+
/** Emits when a hierarchy tree item is expanded as a hook to load the item's children */
|
|
38
|
+
getTreeItemChildren: EventEmitter<HierarchyItem>;
|
|
39
|
+
/** Reference to the MenuComponent instance in the template */
|
|
40
|
+
menuComponent?: MenuComponent;
|
|
41
|
+
/** Reference to the HierarchyTreeComponent instance in the template */
|
|
42
|
+
hierarchyTreeComponent?: HierarchyTreeComponent;
|
|
43
|
+
templateType: MenuTemplateType;
|
|
44
|
+
constructor();
|
|
45
|
+
/** Emits when a tree item is selected */
|
|
46
|
+
onItemSelected(item: MenuItem | HierarchyItem): void;
|
|
47
|
+
/** Emits when a hierarchy tree item is expanded to load the item's children */
|
|
48
|
+
onHierarchyGetItemChildren(item: HierarchyItem): void;
|
|
49
|
+
/** Scroll to the tree item that is currently selected. */
|
|
50
|
+
scrollToSelectedItem(): void;
|
|
51
|
+
}
|
|
@@ -7,10 +7,13 @@ import { NavItem } from '../../../controls/navigation/nav-item';
|
|
|
7
7
|
import { ErrorService } from '../../../core/error.service';
|
|
8
8
|
import { ScrollService } from '../../../core/scroll.service';
|
|
9
9
|
import { DialogService } from '../../../display/dialog/dialog.service';
|
|
10
|
+
import { Help } from '../../../display/help/help-types';
|
|
10
11
|
import { Overlay } from '../../../display/view-overlay/view-overlay.component';
|
|
12
|
+
import { PageStatus } from '../page-statuses';
|
|
11
13
|
export declare class PageInitResult {
|
|
12
14
|
title?: string;
|
|
13
15
|
breadcrumbs?: NavItem[];
|
|
16
|
+
help?: Help;
|
|
14
17
|
}
|
|
15
18
|
export declare abstract class PageBaseComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
16
19
|
/** Default css classes applied to host element */
|
|
@@ -22,7 +25,7 @@ export declare abstract class PageBaseComponent implements OnInit, AfterViewInit
|
|
|
22
25
|
/**
|
|
23
26
|
* Status overlay for the page
|
|
24
27
|
*/
|
|
25
|
-
status
|
|
28
|
+
status: Overlay;
|
|
26
29
|
/**
|
|
27
30
|
* Breadcrumbs displayed in the header
|
|
28
31
|
*/
|
|
@@ -31,6 +34,10 @@ export declare abstract class PageBaseComponent implements OnInit, AfterViewInit
|
|
|
31
34
|
* Result returned from the onInit function
|
|
32
35
|
*/
|
|
33
36
|
initResult: PageInitResult;
|
|
37
|
+
/**
|
|
38
|
+
* Help information for the component, which can only be set through onInit
|
|
39
|
+
*/
|
|
40
|
+
help: Help | undefined;
|
|
34
41
|
/**
|
|
35
42
|
* Form group to be used if needed by the page
|
|
36
43
|
*/
|
|
@@ -79,6 +86,12 @@ export declare abstract class PageBaseComponent implements OnInit, AfterViewInit
|
|
|
79
86
|
*/
|
|
80
87
|
private _errors;
|
|
81
88
|
get errors(): string;
|
|
89
|
+
/**
|
|
90
|
+
* Optional lifecycle hook that is called as part of the Angular ngOnInit lifecycle hook.
|
|
91
|
+
* Called before onInit is called for the first time. Add setup logic here that does
|
|
92
|
+
* not need to be run on every reload.
|
|
93
|
+
*/
|
|
94
|
+
protected onFirstInit(): void;
|
|
82
95
|
/**
|
|
83
96
|
* This method is called in the derived class as part of the Angular ngOnInit
|
|
84
97
|
* lifecycle hook. It must provide a PageInitResult back to the base class to properly
|
|
@@ -96,6 +109,16 @@ export declare abstract class PageBaseComponent implements OnInit, AfterViewInit
|
|
|
96
109
|
*/
|
|
97
110
|
protected onAfterViewInit(): Promise<void>;
|
|
98
111
|
ngAfterViewInit(): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* A lifecycle method that executes once all data has been loaded
|
|
114
|
+
* through ngAfterViewInit and from local storage if required.
|
|
115
|
+
* It is at this point that you can subscribe to changes on the form
|
|
116
|
+
* reliably
|
|
117
|
+
*
|
|
118
|
+
* @protected
|
|
119
|
+
* @memberof PageBaseComponent
|
|
120
|
+
*/
|
|
121
|
+
protected onFormLoadComplete(): Promise<any>;
|
|
99
122
|
/**
|
|
100
123
|
* A lifecycle hook that is called after every NavigationEnd event.
|
|
101
124
|
*/
|
|
@@ -164,6 +187,25 @@ export declare abstract class PageBaseComponent implements OnInit, AfterViewInit
|
|
|
164
187
|
* @param unknownErrorDefault
|
|
165
188
|
*/
|
|
166
189
|
protected getErrorMessage(e: Error | string, unknownErrorDefault?: string): Observable<string>;
|
|
190
|
+
/**
|
|
191
|
+
* Clear the errors to hide the errors banner.
|
|
192
|
+
*/
|
|
193
|
+
protected hideErrorBanner(): void;
|
|
194
|
+
/**
|
|
195
|
+
* Change the display status to overlay the whole page while loading or saving
|
|
196
|
+
* and clear it when the form is ready
|
|
197
|
+
* @protected
|
|
198
|
+
* @param {PageStatus} status
|
|
199
|
+
* @memberof FormBaseComponent
|
|
200
|
+
*/
|
|
201
|
+
protected showStatus(status: PageStatus): void;
|
|
202
|
+
/**
|
|
203
|
+
* Allows the component to enter a pending status and execute a function that on completion will return the status
|
|
204
|
+
* to hasData. If an error occurs within the callback an error banner can be shown.
|
|
205
|
+
* @param callback
|
|
206
|
+
* @returns
|
|
207
|
+
*/
|
|
208
|
+
protected runBlockingAction(callback: () => Promise<any>, pendingMessage?: string): Promise<any>;
|
|
167
209
|
/**
|
|
168
210
|
* Parses the page init result and sets the necessary properties on the page
|
|
169
211
|
* @param result
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DisplayStatus } from '../display';
|
|
2
|
+
export declare enum PageStatus {
|
|
3
|
+
Loading = "loading",
|
|
4
|
+
Loaded = "loaded",
|
|
5
|
+
Saving = "saving",
|
|
6
|
+
NoData = "noData"
|
|
7
|
+
}
|
|
8
|
+
export declare class PageStatuses {
|
|
9
|
+
static get loading(): DisplayStatus;
|
|
10
|
+
static get loaded(): DisplayStatus;
|
|
11
|
+
static get saving(): DisplayStatus;
|
|
12
|
+
static get noData(): DisplayStatus;
|
|
13
|
+
}
|
|
@@ -12,8 +12,17 @@ export declare class PageBaseComponentTestInjectorFactory {
|
|
|
12
12
|
* in addition to our core services
|
|
13
13
|
*/
|
|
14
14
|
private static ComponentProviders;
|
|
15
|
+
/**
|
|
16
|
+
* Services and such retrieved by @see WizardBaseComponent via the @see Injector
|
|
17
|
+
* in addition to our core and @see PageBaseComponent services
|
|
18
|
+
*/
|
|
19
|
+
private static WizardProviders;
|
|
15
20
|
/**
|
|
16
21
|
* Get an injector which provides spy and mock objects needed by the @see PageBaseComponent
|
|
17
22
|
*/
|
|
18
23
|
static getComponentInjector(): Injector;
|
|
24
|
+
/**
|
|
25
|
+
* Get an injector which provides spy and mock objects needed by the @see WizardBaseComponent
|
|
26
|
+
*/
|
|
27
|
+
static getWizardBaseComponentInjector(): Injector;
|
|
19
28
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { NavGroup } from '../../../controls/navigation/nav-group';
|
|
3
|
+
import { NavItem } from '../../../controls/navigation/nav-item';
|
|
4
|
+
import { TelemetryService } from '../../../core/telemetry.service';
|
|
5
|
+
import { Help } from '../../../display/help/help-types';
|
|
6
|
+
import { PageBaseComponent, PageInitResult } from '../../page/page-base/page-base.component';
|
|
7
|
+
export interface WizardTab extends NavItem {
|
|
8
|
+
/**
|
|
9
|
+
* Path to a form group/array/control contained in the form's main form group.
|
|
10
|
+
* Used to map a tab to it's form model for form validation in WizardBaseComponent.
|
|
11
|
+
* See https://angular.io/api/forms/AbstractControl#get-usage-notes for details on paths.
|
|
12
|
+
*/
|
|
13
|
+
formModelPath?: string | (string | number)[];
|
|
14
|
+
help?: Help;
|
|
15
|
+
title?: string;
|
|
16
|
+
completed?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare abstract class WizardBaseComponent extends PageBaseComponent {
|
|
19
|
+
isWizardMode: boolean;
|
|
20
|
+
showWizardSaveSuccess: boolean;
|
|
21
|
+
/** True when there are no custom fields or when in wizard mode on the custom fields tab */
|
|
22
|
+
showSave: boolean;
|
|
23
|
+
/** True when in wizard mode you do not want to show the next or save button*/
|
|
24
|
+
hideNextSaveButton: boolean;
|
|
25
|
+
/** True when in wizard mode and on the custom fields tab */
|
|
26
|
+
showBack: boolean;
|
|
27
|
+
/** Labels for the cancel, next and back buttons */
|
|
28
|
+
nextLabel?: string;
|
|
29
|
+
backLabel?: string;
|
|
30
|
+
cancelLabel: string;
|
|
31
|
+
dialogId: string;
|
|
32
|
+
/**
|
|
33
|
+
* Contains the available wizard tabs. Passed to TabsComponent.
|
|
34
|
+
* @memberof WizardBaseComponent
|
|
35
|
+
*/
|
|
36
|
+
private _tabGroup;
|
|
37
|
+
get tabGroup(): NavGroup;
|
|
38
|
+
set tabGroup(value: NavGroup);
|
|
39
|
+
/**
|
|
40
|
+
* Contains the tab that is currently selected.
|
|
41
|
+
* @memberof WizardBaseComponent
|
|
42
|
+
*/
|
|
43
|
+
private _currentTab?;
|
|
44
|
+
get currentTab(): WizardTab | undefined;
|
|
45
|
+
protected initPromise: Promise<WizardBaseComponent>;
|
|
46
|
+
protected telemetryService: TelemetryService;
|
|
47
|
+
constructor(injector: Injector);
|
|
48
|
+
protected onFirstInit(): void;
|
|
49
|
+
protected abstract onInit(): Promise<PageInitResult>;
|
|
50
|
+
protected onWizardSaveSuccess(): void;
|
|
51
|
+
protected onAfterViewInit(): Promise<void>;
|
|
52
|
+
protected applyModelUpdates(): Promise<void>;
|
|
53
|
+
protected saveToApi(): Promise<number | void>;
|
|
54
|
+
protected onSaveComplete(entityId: number): void;
|
|
55
|
+
onSave(event: Event): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Navigates to the next tab in the tab group. Calls canGoToNextTab() to determine if navigating to the next tab
|
|
58
|
+
* is allowed or not. If tab validation succeeds, enables the next tab (if it is disabled) and selects it.
|
|
59
|
+
* @memberof WizardBaseComponent
|
|
60
|
+
*/
|
|
61
|
+
nextTab(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Navigates to the previous tab in the tab group. Calls canGoToPreviousTab() to determine if navigating to the previous tab
|
|
64
|
+
* is allowed or not. Navigates to the tab if validation succeeds
|
|
65
|
+
* @memberof WizardBaseComponent
|
|
66
|
+
*/
|
|
67
|
+
previousTab(): void;
|
|
68
|
+
protected updateButtons(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Required to configure the tabs and default tab for the wizard. Runs in onFirstInit, before onInit.
|
|
71
|
+
* @memberof WizardBaseComponent
|
|
72
|
+
*/
|
|
73
|
+
protected abstract configureTabs(): NavGroup;
|
|
74
|
+
/**
|
|
75
|
+
* Used to determine whether navigation to the next tab is prevented or not. Fired in nextTab(), but not when a tab is
|
|
76
|
+
* clicked or selected programmatically. By default, this checks the validity of the current tab's form model and
|
|
77
|
+
* prevents navigation if it is invalid. Can be overridden if different logic is needed.
|
|
78
|
+
* @param nextTab - The tab being navigated to
|
|
79
|
+
* @memberof WizardBaseComponent
|
|
80
|
+
*/
|
|
81
|
+
protected canGoToNextTab(nextTab: WizardTab): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Used to determine whether navigation to the previous tab is prevented or not. Fired in previousTab(), but not when a tab is
|
|
84
|
+
* clicked or selected programmatically. By default, this checks the validity of the current tab's form model and
|
|
85
|
+
* prevents navigation if it is invalid. Can be overridden if different logic is needed.
|
|
86
|
+
* @param prevTab - The tab being navigated to
|
|
87
|
+
* @memberof WizardBaseComponent
|
|
88
|
+
*/
|
|
89
|
+
protected canGoToPreviousTab(prevTab: WizardTab): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Used to determine whether navigating away from the current tab is prevented or not. Fired any time the selected tab
|
|
92
|
+
* changes in the tabGroup. By default, this checks the validity of the current tab's form model and prevents navigation
|
|
93
|
+
* if it is invalid. Can be overridden if different logic is needed.
|
|
94
|
+
* @memberof WizardBaseComponent
|
|
95
|
+
*/
|
|
96
|
+
protected canLeaveCurrentTab(): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Triggers validation on the current wizard tab's form control. Returns true if the form control is valid, false if not.
|
|
99
|
+
* Returns true if the formModelPath for the tab is not defined or no form control is found. Can be overridden if different
|
|
100
|
+
* logic is needed to validate the form control for the current tab.
|
|
101
|
+
* @memberof WizardBaseComponent
|
|
102
|
+
*/
|
|
103
|
+
protected isCurrentTabValid(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Fired if navigation to a tab succeeds. Hides the error banner by default, but can be overridden if logic is needed.
|
|
106
|
+
* @memberof WizardBaseComponent
|
|
107
|
+
*/
|
|
108
|
+
protected onTabChangeSuccess(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Fired if navigation to a tab fails. By default, shows the error banner with the default invalid form message, but
|
|
111
|
+
* can be overridden if different logic is needed.
|
|
112
|
+
* @memberof WizardBaseComponent
|
|
113
|
+
*/
|
|
114
|
+
protected onTabChangeFailed(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Listen for when the tabGroup's selected item is changed (I.E. when a tab is clicked or selected programmatically)
|
|
117
|
+
* and navigate to that tab.
|
|
118
|
+
*/
|
|
119
|
+
private subscribeToTabChanges;
|
|
120
|
+
/**
|
|
121
|
+
* Triggered when the tabGroup's selected item changes. If the current tab passes validation, updates
|
|
122
|
+
* the current tab to the selected tab.
|
|
123
|
+
* @param tab - the tab that was selected
|
|
124
|
+
*/
|
|
125
|
+
private goToTab;
|
|
126
|
+
/**
|
|
127
|
+
* Updates the current tab, title, and help.
|
|
128
|
+
* @param tab Tab to set
|
|
129
|
+
*/
|
|
130
|
+
private setCurrentTab;
|
|
131
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { DisplayStatus } from '../../display';
|
|
3
|
+
export declare class WizardButtonsComponent {
|
|
4
|
+
nextLabel?: string;
|
|
5
|
+
backLabel?: string;
|
|
6
|
+
cancelLabel?: string;
|
|
7
|
+
cancelId?: string;
|
|
8
|
+
saveId?: string;
|
|
9
|
+
tabindex: number;
|
|
10
|
+
status?: DisplayStatus;
|
|
11
|
+
showBack?: boolean;
|
|
12
|
+
showSave?: boolean;
|
|
13
|
+
hideNextSaveButton?: boolean;
|
|
14
|
+
cancel: EventEmitter<any>;
|
|
15
|
+
save: EventEmitter<any>;
|
|
16
|
+
nextTab: EventEmitter<any>;
|
|
17
|
+
previousTab: EventEmitter<any>;
|
|
18
|
+
constructor();
|
|
19
|
+
onCancel(): void;
|
|
20
|
+
onSave(event: any): void;
|
|
21
|
+
onPreviousTab(): void;
|
|
22
|
+
onNextTab(): void;
|
|
23
|
+
}
|