{"version":3,"file":"covalent-echarts-toolbox.mjs","sources":["../../../../libs/angular-echarts/toolbox/src/toolbox.component.ts","../../../../libs/angular-echarts/toolbox/src/toolbox.component.html","../../../../libs/angular-echarts/toolbox/src/toolbox.module.ts","../../../../libs/angular-echarts/toolbox/src/covalent-echarts-toolbox.ts"],"sourcesContent":["import {\n  Component,\n  Input,\n  Directive,\n  TemplateRef,\n  ChangeDetectionStrategy,\n  ElementRef,\n  ChangeDetectorRef,\n  OnChanges,\n  ContentChild,\n  ViewChild,\n  OnDestroy,\n} from '@angular/core';\n\nimport {\n  TdChartOptionsService,\n  assignDefined,\n  ITdLabel,\n  ITdShadow,\n  ITdItemStyle,\n  TdTextPosition,\n  TdTextAlign,\n} from '@covalent/echarts/base';\n\nexport type TdToolboxOrient = 'horizontal' | 'vertical';\nexport type TdImageType = 'png' | 'jpeg';\n\nexport interface ITdAcceptedBrushTypes {\n  rect?: string;\n  polygon?: string;\n  lineX?: string;\n  lineY?: string;\n  keep?: string;\n  clear?: string;\n}\n\nexport interface ITdAcceptedMagicTypes {\n  line?: string;\n  bar?: string;\n  stack?: string;\n  tiled?: string;\n}\n\nexport interface ITdToolboxIconEmphasis extends ITdItemStyle, ITdShadow {}\n\nexport interface ITdFeatureIconStyle extends ITdItemStyle, ITdShadow {\n  textPosition?: TdTextPosition;\n  textAlign?: TdTextAlign;\n  emphasis?: ITdToolboxIconEmphasis;\n}\n\nexport interface ITdZoomTitles {\n  zoom?: string;\n  back?: string;\n}\n\nexport interface ITdSaveAsImage {\n  type?: TdImageType;\n  name?: string;\n  backgroundColor?: any;\n  excludeComponents?: string[]; // defaults to ['toolbox']\n  show?: boolean;\n  title?: string;\n  icon?: string;\n  iconStyle?: ITdFeatureIconStyle;\n  pixelRatio?: number;\n}\n\nexport interface ITdRestore {\n  show?: boolean;\n  title?: string;\n  icon?: string;\n  iconStyle?: ITdFeatureIconStyle;\n}\n\nexport interface ITdDataView {\n  show?: boolean;\n  title?: string;\n  icon?: string;\n  iconStyle?: ITdFeatureIconStyle;\n  readOnly?: boolean;\n  optionToContent?: Function;\n  contentToOption?: Function;\n  lang?: string[]; // Defaults to Chinese, there are 3 names in data view, which are ['data view', 'turn off' and 'refresh'].\n  textareaColor?: string;\n  textareaBorderColor?: string;\n  textColor?: string;\n  buttonColor?: string;\n  buttonTextColor?: string;\n}\n\nexport interface ITdDataZoom {\n  show?: boolean;\n  title?: ITdZoomTitles;\n  icon?: ITdZoomTitles;\n  iconStyle?: ITdFeatureIconStyle;\n  xAxisIndex?: number | number[] | boolean;\n  yAxisIndex?: number | number[] | boolean;\n}\n\nexport interface ITdMagicType {\n  show?: boolean;\n  type?: string[]; // only expects 'line' | 'bar' | 'stack' | 'tiled';\n  title?: ITdAcceptedMagicTypes;\n  icon?: ITdAcceptedMagicTypes;\n  iconStyle?: ITdFeatureIconStyle;\n  option?: {\n    line?: object;\n    bar?: object;\n    stack?: object;\n    tiled?: object;\n  };\n  seriesIndex?: {\n    line?: any[];\n    bar?: any[];\n    stack?: any[];\n    tiled?: any[];\n  };\n}\n\nexport interface ITdBrush {\n  type?: any[];\n  icon?: ITdAcceptedBrushTypes;\n  title?: ITdAcceptedBrushTypes;\n}\n\nexport interface ITdToolboxFeature {\n  saveAsImage?: ITdSaveAsImage;\n  restore?: ITdRestore;\n  dataView?: ITdDataView;\n  dataZoom?: ITdDataZoom;\n  magicType?: ITdMagicType;\n  brush?: ITdBrush;\n}\n\n@Directive({\n  selector: 'ng-template[tdViewDataFormatter]',\n})\nexport class TdChartViewDataFormatterDirective {}\n\n@Component({\n  selector: 'td-chart-toolbox',\n  templateUrl: './toolbox.component.html',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TdChartToolboxComponent implements OnChanges, OnDestroy {\n  private _state: any = {};\n\n  @Input() config: any = {};\n\n  @Input() show = true;\n  @Input() trigger?: string;\n  @Input() orient?: TdToolboxOrient;\n  @Input() itemSize?: number;\n  @Input() itemGap?: number;\n  @Input() showTitle? = true;\n  @Input() label?: ITdLabel;\n  @Input() feature?: ITdToolboxFeature;\n  @Input() iconStyle?: ITdFeatureIconStyle;\n  @Input() zlevel?: number;\n  @Input() z?: number;\n  @Input() transitionDuration = 0.5;\n  @Input() left: string | number = 'auto';\n  @Input() top: string | number = 'auto';\n  @Input() right: string | number = 'auto';\n  @Input() bottom: string | number = 'auto';\n  @Input() width: string | number = 'auto';\n  @Input() height: string | number = 'auto';\n\n  @ContentChild(TdChartViewDataFormatterDirective, { read: TemplateRef })\n  formatterTemplate!: TemplateRef<any>;\n  @ViewChild('toolboxContent', { static: true })\n  fullTemplate!: TemplateRef<any>;\n\n  constructor(\n    private _changeDetectorRef: ChangeDetectorRef,\n    private _elementRef: ElementRef,\n    private _optionsService: TdChartOptionsService\n  ) {}\n\n  ngOnChanges(): void {\n    this._setOptions();\n  }\n\n  ngOnDestroy(): void {\n    this._removeOption();\n  }\n\n  private _setOptions(): void {\n    this._checkFormatterTemplate();\n\n    const config: any = assignDefined(\n      this._state,\n      {\n        show: this.show,\n        name: this.trigger,\n        orient: this.orient,\n        itemSize: this.itemSize,\n        itemGap: this.itemGap,\n        showTitle: this.showTitle,\n        label: this.label,\n        feature: this.feature,\n        iconStyle: this.iconStyle,\n        zlevel: this.zlevel,\n        z: this.z,\n        transitionDuration: this.transitionDuration,\n        left: this.left,\n        top: this.top,\n        right: this.right,\n        bottom: this.bottom,\n        width: this.width,\n        height: this.height,\n      },\n      this.config ? this.config : {}\n    );\n    // set toolbox configuration in parent chart and render new configurations\n    this._optionsService.setOption('toolbox', config);\n  }\n\n  private _removeOption(): void {\n    this._optionsService.clearOption('toolbox');\n  }\n\n  private _checkFormatterTemplate(): void {\n    if (this.formatterTemplate) {\n      this.feature = {\n        ...this.feature,\n        dataView: {\n          ...this.feature?.dataView,\n          optionToContent: this._optionToContentFormatter(),\n        },\n      };\n    }\n  }\n\n  private _optionToContentFormatter(): () => string {\n    return () => {\n      this._changeDetectorRef.markForCheck();\n      return (<HTMLElement>this._elementRef.nativeElement).innerHTML;\n    };\n  }\n}\n","<ng-template\n  #toolboxContent\n  [ngTemplateOutlet]=\"formatterTemplate\"\n></ng-template>\n","import { NgModule, Type } from '@angular/core';\nimport {\n  TdChartToolboxComponent,\n  TdChartViewDataFormatterDirective,\n} from './toolbox.component';\n\nexport const TOOLBOX_MODULE_COMPONENTS: Type<any>[] = [\n  TdChartToolboxComponent,\n  TdChartViewDataFormatterDirective,\n];\n\n/**\n * @deprecated This module is deprecated and will be removed in future versions.\n * Please migrate to using standalone components as soon as possible.\n */\n@NgModule({\n  imports: [TOOLBOX_MODULE_COMPONENTS],\n  exports: [TOOLBOX_MODULE_COMPONENTS],\n})\nexport class CovalentToolboxEchartsModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;MA0Ia,iCAAiC,CAAA;2HAAjC,iCAAiC,GAAA,CAAA,EAAA;6DAAjC,iCAAiC,EAAA,SAAA,EAAA,CAAA,CAAA,aAAA,EAAA,qBAAA,EAAA,EAAA,CAAA,CAAA,EAAA,CAAA;;iFAAjC,iCAAiC,EAAA,CAAA;cAH7C,SAAS;AAAC,QAAA,IAAA,EAAA,CAAA;AACT,gBAAA,QAAQ,EAAE,kCAAkC;AAC7C,aAAA;;MAQY,uBAAuB,CAAA;AA8BxB,IAAA,kBAAA;AACA,IAAA,WAAA;AACA,IAAA,eAAA;IA/BF,MAAM,GAAQ,EAAE;IAEf,MAAM,GAAQ,EAAE;IAEhB,IAAI,GAAG,IAAI;AACX,IAAA,OAAO;AACP,IAAA,MAAM;AACN,IAAA,QAAQ;AACR,IAAA,OAAO;IACP,SAAS,GAAI,IAAI;AACjB,IAAA,KAAK;AACL,IAAA,OAAO;AACP,IAAA,SAAS;AACT,IAAA,MAAM;AACN,IAAA,CAAC;IACD,kBAAkB,GAAG,GAAG;IACxB,IAAI,GAAoB,MAAM;IAC9B,GAAG,GAAoB,MAAM;IAC7B,KAAK,GAAoB,MAAM;IAC/B,M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