@covalent/echarts
Version:
Teradata UI Platform Echarts Module
159 lines (154 loc) • 8.2 kB
JavaScript
import * as i0 from '@angular/core';
import { Directive, TemplateRef, Component, ChangeDetectionStrategy, Input, ContentChild, ViewChild, NgModule } from '@angular/core';
import * as i2 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i1 from '@covalent/echarts/base';
import { assignDefined } from '@covalent/echarts/base';
class TdChartViewDataFormatterDirective {
}
TdChartViewDataFormatterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TdChartViewDataFormatterDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
TdChartViewDataFormatterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: TdChartViewDataFormatterDirective, selector: "ng-template[tdViewDataFormatter]", ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TdChartViewDataFormatterDirective, decorators: [{
type: Directive,
args: [{
selector: 'ng-template[tdViewDataFormatter]',
}]
}] });
class TdChartToolboxComponent {
constructor(_changeDetectorRef, _elementRef, _optionsService) {
this._changeDetectorRef = _changeDetectorRef;
this._elementRef = _elementRef;
this._optionsService = _optionsService;
this._state = {};
this.config = {};
this.show = true;
this.showTitle = true;
this.transitionDuration = 0.5;
this.left = 'auto';
this.top = 'auto';
this.right = 'auto';
this.bottom = 'auto';
this.width = 'auto';
this.height = 'auto';
}
ngOnChanges() {
this._setOptions();
}
ngOnDestroy() {
this._removeOption();
}
_setOptions() {
this._checkFormatterTemplate();
const config = assignDefined(this._state, {
show: this.show,
name: this.trigger,
orient: this.orient,
itemSize: this.itemSize,
itemGap: this.itemGap,
showTitle: this.showTitle,
label: this.label,
feature: this.feature,
iconStyle: this.iconStyle,
zlevel: this.zlevel,
z: this.z,
transitionDuration: this.transitionDuration,
left: this.left,
top: this.top,
right: this.right,
bottom: this.bottom,
width: this.width,
height: this.height,
}, this.config ? this.config : {});
// set toolbox configuration in parent chart and render new configurations
this._optionsService.setOption('toolbox', config);
}
_removeOption() {
this._optionsService.clearOption('toolbox');
}
_checkFormatterTemplate() {
var _a;
if (this.formatterTemplate) {
this.feature = Object.assign(Object.assign({}, this.feature), { dataView: Object.assign(Object.assign({}, (_a = this.feature) === null || _a === void 0 ? void 0 : _a.dataView), { optionToContent: this._optionToContentFormatter() }) });
}
}
_optionToContentFormatter() {
return () => {
this._changeDetectorRef.markForCheck();
return this._elementRef.nativeElement.innerHTML;
};
}
}
TdChartToolboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TdChartToolboxComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i1.TdChartOptionsService }], target: i0.ɵɵFactoryTarget.Component });
TdChartToolboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TdChartToolboxComponent, selector: "td-chart-toolbox", inputs: { config: "config", show: "show", trigger: "trigger", orient: "orient", itemSize: "itemSize", itemGap: "itemGap", showTitle: "showTitle", label: "label", feature: "feature", iconStyle: "iconStyle", zlevel: "zlevel", z: "z", transitionDuration: "transitionDuration", left: "left", top: "top", right: "right", bottom: "bottom", width: "width", height: "height" }, queries: [{ propertyName: "formatterTemplate", first: true, predicate: TdChartViewDataFormatterDirective, descendants: true, read: TemplateRef }], viewQueries: [{ propertyName: "fullTemplate", first: true, predicate: ["toolboxContent"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-template\n #toolboxContent\n [ngTemplateOutlet]=\"formatterTemplate\"\n></ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TdChartToolboxComponent, decorators: [{
type: Component,
args: [{ selector: 'td-chart-toolbox', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template\n #toolboxContent\n [ngTemplateOutlet]=\"formatterTemplate\"\n></ng-template>\n" }]
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i1.TdChartOptionsService }]; }, propDecorators: { config: [{
type: Input
}], show: [{
type: Input
}], trigger: [{
type: Input
}], orient: [{
type: Input
}], itemSize: [{
type: Input
}], itemGap: [{
type: Input
}], showTitle: [{
type: Input
}], label: [{
type: Input
}], feature: [{
type: Input
}], iconStyle: [{
type: Input
}], zlevel: [{
type: Input
}], z: [{
type: Input
}], transitionDuration: [{
type: Input
}], left: [{
type: Input
}], top: [{
type: Input
}], right: [{
type: Input
}], bottom: [{
type: Input
}], width: [{
type: Input
}], height: [{
type: Input
}], formatterTemplate: [{
type: ContentChild,
args: [TdChartViewDataFormatterDirective, { read: TemplateRef }]
}], fullTemplate: [{
type: ViewChild,
args: ['toolboxContent', { static: true }]
}] } });
const TOOLBOX_MODULE_COMPONENTS = [
TdChartToolboxComponent,
TdChartViewDataFormatterDirective,
];
class CovalentToolboxEchartsModule {
}
CovalentToolboxEchartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentToolboxEchartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
CovalentToolboxEchartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CovalentToolboxEchartsModule, declarations: [TdChartToolboxComponent,
TdChartViewDataFormatterDirective], imports: [CommonModule], exports: [TdChartToolboxComponent,
TdChartViewDataFormatterDirective] });
CovalentToolboxEchartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentToolboxEchartsModule, imports: [CommonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentToolboxEchartsModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule],
declarations: [TOOLBOX_MODULE_COMPONENTS],
exports: [TOOLBOX_MODULE_COMPONENTS],
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { CovalentToolboxEchartsModule, TOOLBOX_MODULE_COMPONENTS, TdChartToolboxComponent, TdChartViewDataFormatterDirective };
//# sourceMappingURL=covalent-echarts-toolbox.mjs.map