UNPKG

@alauda-fe/common

Version:

Alauda frontend team common codes.

90 lines 11.3 kB
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { ChartSeriesComponent } from './series.component'; import * as i0 from "@angular/core"; const _c0 = ["aclAreaSeries", ""]; function ChartAreaSeriesComponent__svg_ng_container_1__svg_stop_3_Template(rf, ctx) { if (rf & 1) { i0.ɵɵnamespaceSVG(); i0.ɵɵelement(0, "stop"); } if (rf & 2) { const stop_r1 = ctx.$implicit; i0.ɵɵattribute("offset", stop_r1.offset + "%")("stop-color", stop_r1.color)("stop-opacity", stop_r1.opacity); } } function ChartAreaSeriesComponent__svg_ng_container_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵnamespaceSVG(); i0.ɵɵelementContainerStart(0); i0.ɵɵelementStart(1, "defs")(2, "linearGradient", 2); i0.ɵɵtemplate(3, ChartAreaSeriesComponent__svg_ng_container_1__svg_stop_3_Template, 1, 3, "stop", 1); i0.ɵɵpipe(4, "pure"); i0.ɵɵelementEnd()(); i0.ɵɵelement(5, "path", 3); i0.ɵɵpipe(6, "pure"); i0.ɵɵpipe(7, "pure"); i0.ɵɵpipe(8, "pure"); i0.ɵɵelement(9, "path", 4); i0.ɵɵpipe(10, "pure"); i0.ɵɵpipe(11, "pure"); i0.ɵɵelementContainerEnd(); } if (rf & 2) { const item_r2 = ctx.$implicit; const ctx_r2 = i0.ɵɵnextContext(); i0.ɵɵadvance(2); i0.ɵɵproperty("id", item_r2.gradientFillId); i0.ɵɵattribute("x1", ctx_r2.linearGradientXY.x1)("y1", ctx_r2.linearGradientXY.y1)("x2", ctx_r2.linearGradientXY.x2)("y2", ctx_r2.linearGradientXY.y2); i0.ɵɵadvance(); i0.ɵɵproperty("ngForOf", i0.ɵɵpipeBind2(4, 16, item_r2.color, ctx_r2.gradient)); i0.ɵɵadvance(2); i0.ɵɵattribute("d", item_r2.areaPath)("fill", i0.ɵɵpipeBind2(6, 19, item_r2.gradientFillId, ctx_r2.getGradientFillId))("visibility", item_r2.visibility)("opacity", i0.ɵɵpipeBind3(7, 22, item_r2.name, ctx_r2.handleOpacity, ctx_r2.activateLegend))("stroke-width", i0.ɵɵpipeBind4(8, 26, item_r2.name, ctx_r2.handleStrokeWidth, ctx_r2.activateLegend, ctx_r2.lineWidth) + "px"); i0.ɵɵadvance(4); i0.ɵɵattribute("d", item_r2.path)("stroke", item_r2.color)("visibility", item_r2.visibility)("opacity", i0.ɵɵpipeBind3(10, 31, item_r2.name, ctx_r2.handleOpacity, ctx_r2.activateLegend))("stroke-width", i0.ɵɵpipeBind4(11, 35, item_r2.name, ctx_r2.handleStrokeWidth, ctx_r2.activateLegend, ctx_r2.lineWidth) + "px"); } } export class ChartAreaSeriesComponent extends ChartSeriesComponent { constructor() { super(...arguments); this.seriesType = 'area'; this.startOpacity = 0.2; this.endOpacity = 0; this.linearGradientXY = { x1: '0%', x2: '0%', y1: '0%', y2: '100%', }; this.gradient = (color) => [ { offset: 0, color, opacity: this.startOpacity, }, { offset: 100, color, opacity: this.endOpacity, }, ]; } getGradientFillId(id) { return `url(#${id})`; } static { this.ɵfac = /*@__PURE__*/ (() => { let ɵChartAreaSeriesComponent_BaseFactory; return function ChartAreaSeriesComponent_Factory(t) { returnChartAreaSeriesComponent_BaseFactory ||ChartAreaSeriesComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ChartAreaSeriesComponent)))(t || ChartAreaSeriesComponent); }; })(); } static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ChartAreaSeriesComponent, selectors: [["g", "aclAreaSeries", ""]], inputs: { seriesType: "seriesType", startOpacity: "startOpacity", endOpacity: "endOpacity" }, features: [i0.ɵɵInheritDefinitionFeature], attrs: _c0, decls: 2, vars: 1, consts: [[1, "acl-series"], [4, "ngFor", "ngForOf"], [3, "id"], [1, "area"], ["fill", "none", 1, "line"]], template: function ChartAreaSeriesComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵnamespaceSVG(); i0.ɵɵelementStart(0, "g", 0); i0.ɵɵtemplate(1, ChartAreaSeriesComponent__svg_ng_container_1_Template, 12, 40, "ng-container", 1); i0.ɵɵelementEnd(); } if (rf & 2) { i0.ɵɵadvance(); i0.ɵɵproperty("ngForOf", ctx.seriesData); } }, encapsulation: 2, changeDetection: 0 }); } } (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ChartAreaSeriesComponent, [{ type: Component, args: [{ selector: 'g[aclAreaSeries]', changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:g class=\"acl-series\">\n <ng-container *ngFor=\"let item of seriesData\">\n <svg:defs>\n <svg:linearGradient\n [id]=\"item.gradientFillId\"\n [attr.x1]=\"linearGradientXY.x1\"\n [attr.y1]=\"linearGradientXY.y1\"\n [attr.x2]=\"linearGradientXY.x2\"\n [attr.y2]=\"linearGradientXY.y2\"\n >\n <svg:stop\n *ngFor=\"let stop of item.color | pure: gradient\"\n [attr.offset]=\"stop.offset + '%'\"\n [attr.stop-color]=\"stop.color\"\n [attr.stop-opacity]=\"stop.opacity\"\n />\n </svg:linearGradient>\n </svg:defs>\n\n <svg:path\n class=\"area\"\n [attr.d]=\"item.areaPath\"\n [attr.fill]=\"item.gradientFillId | pure: getGradientFillId\"\n [attr.visibility]=\"item.visibility\"\n [attr.opacity]=\"item.name | pure: handleOpacity:activateLegend\"\n [attr.stroke-width]=\"\n (item.name | pure: handleStrokeWidth:activateLegend:lineWidth) + 'px'\n \"\n ></svg:path>\n\n <svg:path\n class=\"line\"\n [attr.d]=\"item.path\"\n [attr.stroke]=\"item.color\"\n [attr.visibility]=\"item.visibility\"\n [attr.opacity]=\"item.name | pure: handleOpacity:activateLegend\"\n [attr.stroke-width]=\"\n (item.name | pure: handleStrokeWidth:activateLegend:lineWidth) + 'px'\n \"\n fill=\"none\"\n ></svg:path>\n </ng-container>\n</svg:g>\n" }] }], null, { seriesType: [{ type: Input }], startOpacity: [{ type: Input }], endOpacity: [{ type: Input }] }); })(); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ChartAreaSeriesComponent, { className: "ChartAreaSeriesComponent" }); })(); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJlYS1zZXJpZXMuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb21tb24vc3JjL2NoYXJ0L2NvbW1vbi9zZXJpZXMvYXJlYS1zZXJpZXMuY29tcG9uZW50LnRzIiwiLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb21tb24vc3JjL2NoYXJ0L2NvbW1vbi9zZXJpZXMvYXJlYS1zZXJpZXMuY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLHVCQUF1QixFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFMUUsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7Ozs7O0lDUWxELHVCQUtFOzs7Ozs7O0lBZFIsNkJBQThDO0lBRTFDLEFBREYsNEJBQVUsd0JBT1A7SUFDQyxvR0FLRTs7SUFFTixBQURFLGlCQUFxQixFQUNaO0lBRVgsMEJBU1k7Ozs7SUFFWiwwQkFVWTs7Ozs7OztJQXBDUixlQUEwQjtJQUExQiwyQ0FBMEI7O0lBT1AsY0FBOEI7SUFBOUIsK0VBQThCO0lBVW5ELGVBQXdCOztJQVd4QixlQUFvQjs7O0FEdEIxQixNQUFNLE9BQU8sd0JBQXlCLFNBQVEsb0JBQW9CO0lBTmxFOztRQU9vQixlQUFVLEdBQTRCLE1BQU0sQ0FBQztRQUV0RCxpQkFBWSxHQUFHLEdBQUcsQ0FBQztRQUVuQixlQUFVLEdBQUcsQ0FBQyxDQUFDO1FBRXhCLHFCQUFnQixHQUFHO1lBQ2pCLEVB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