@memberjunction/ng-shared
Version:
MemberJunction: MJ Explorer Angular Shared Package - utility functions and other reusable elements used across other MJ Angular packages within the MJ Explorer App - do not use outside of MJ Explorer.
76 lines • 3.04 kB
JavaScript
import { Directive, EventEmitter, Input, Output } from '@angular/core';
import { BaseResourceComponent } from './base-resource-component';
import * as i0 from "@angular/core";
/**
* Make the base class a directive so we can use Angular functionality and sub-classes can be @Component
*/
export class BaseDashboard extends BaseResourceComponent {
/**
* Set or change the dashboard configuration. Changing this property will NOT cause the dashboard to reload. Call Refresh() to do that.
*/
set Config(value) {
this._config = value;
}
get Config() {
return this._config;
}
/**
* Subclasses can emit anytime an error occurs.
*/
Error = new EventEmitter();
/**
* Subclasses should emit this event anytime their internal state changes in a way that they'd like to persist.
*/
UserStateChanged = new EventEmitter();
/**
* Subclasses can emit this event anytime they want to communicate with the container to let it know that something has happened of significance.
*/
Interaction = new EventEmitter();
/**
* Subclasses can emit this event anytime they want to open a record within a particular entity. The container should handle this event and open the record.
*/
OpenEntityRecord = new EventEmitter();
_config = null;
async ngOnInit() {
this.initDashboard();
await this.loadData();
}
ngOnDestroy() { }
/**
* This method will result in the dashboard being reloaded.
*/
Refresh() {
this.loadData();
}
_visible = false;
/**
* This method can be used by a container to let the dashboard know that it is being opened/closed. Base class just sets a flag.
*/
SetVisible(visible) {
this._visible = visible;
}
/**
* Sub-classes can override this to provide a custom icon class
* @param data
* @returns
*/
async GetResourceIconClass(data) {
return "";
}
static ɵfac = /*@__PURE__*/ (() => { let ɵBaseDashboard_BaseFactory; return function BaseDashboard_Factory(__ngFactoryType__) { return (ɵBaseDashboard_BaseFactory || (ɵBaseDashboard_BaseFactory = i0.ɵɵgetInheritedFactory(BaseDashboard)))(__ngFactoryType__ || BaseDashboard); }; })();
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: BaseDashboard, inputs: { Config: "Config" }, outputs: { Error: "Error", UserStateChanged: "UserStateChanged", Interaction: "Interaction", OpenEntityRecord: "OpenEntityRecord" }, features: [i0.ɵɵInheritDefinitionFeature] });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseDashboard, [{
type: Directive
}], null, { Config: [{
type: Input
}], Error: [{
type: Output
}], UserStateChanged: [{
type: Output
}], Interaction: [{
type: Output
}], OpenEntityRecord: [{
type: Output
}] }); })();
//# sourceMappingURL=base-dashboard.js.map