cats-charts 0.0.95 → 0.0.96
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/fesm2022/cats-charts.mjs +81 -6
- package/fesm2022/cats-charts.mjs.map +1 -1
- package/index.d.ts +18 -2
- package/package.json +1 -1
package/fesm2022/cats-charts.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { LineChart, BarChart as BarChart$1, PieChart as PieChart$1, CustomChart,
|
|
|
6
6
|
import { GridComponent, TooltipComponent, LegendComponent, TitleComponent, ToolboxComponent, DataZoomInsideComponent, DataZoomComponent, MarkAreaComponent, MarkLineComponent, DatasetComponent, VisualMapComponent, GraphicComponent } from 'echarts/components';
|
|
7
7
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
8
8
|
import * as i2 from '@angular/common';
|
|
9
|
-
import { isPlatformBrowser, CommonModule } from '@angular/common';
|
|
9
|
+
import { isPlatformBrowser, CommonModule, DOCUMENT } from '@angular/common';
|
|
10
10
|
|
|
11
11
|
class RightClickCard {
|
|
12
12
|
cardPosition;
|
|
@@ -1694,7 +1694,7 @@ class LinesChart {
|
|
|
1694
1694
|
confine: true,
|
|
1695
1695
|
formatter: (params) => this.config?.tooltipFormatter
|
|
1696
1696
|
? this.config?.tooltipFormatter(params)
|
|
1697
|
-
: this.chartService.barLineTooltipFormatter(params, 'line'),
|
|
1697
|
+
: this.chartService.barLineTooltipFormatter(params, 'line', this.config),
|
|
1698
1698
|
},
|
|
1699
1699
|
legend: {
|
|
1700
1700
|
show: false,
|
|
@@ -2388,7 +2388,7 @@ class BarChart {
|
|
|
2388
2388
|
confine: true,
|
|
2389
2389
|
formatter: (params) => this.config.tooltipFormatter
|
|
2390
2390
|
? this.config.tooltipFormatter(params)
|
|
2391
|
-
: this.chartService.barLineTooltipFormatter(params),
|
|
2391
|
+
: this.chartService.barLineTooltipFormatter(params, 'bar', this.config),
|
|
2392
2392
|
},
|
|
2393
2393
|
legend: {
|
|
2394
2394
|
show: false,
|
|
@@ -6330,6 +6330,7 @@ const COLLAPSED_GROUP_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org
|
|
|
6330
6330
|
class GanttChart {
|
|
6331
6331
|
chartService;
|
|
6332
6332
|
cdr;
|
|
6333
|
+
document;
|
|
6333
6334
|
config = { series: [], groups: [] };
|
|
6334
6335
|
theme;
|
|
6335
6336
|
events = [];
|
|
@@ -6348,11 +6349,18 @@ class GanttChart {
|
|
|
6348
6349
|
horizontalZoomLayoutFrame;
|
|
6349
6350
|
isApplyingHorizontalZoomLayout = false;
|
|
6350
6351
|
zoomWheelHandler;
|
|
6352
|
+
dataZoomPointerDownHandler;
|
|
6353
|
+
nativeDragStartHandler;
|
|
6354
|
+
nativePointerEndHandler;
|
|
6355
|
+
dataZoomGestureActive = false;
|
|
6356
|
+
isBrowser;
|
|
6351
6357
|
visibleRows = [];
|
|
6352
6358
|
rowIndexMap = new Map();
|
|
6353
|
-
constructor(chartService, cdr) {
|
|
6359
|
+
constructor(chartService, cdr, document, platformId) {
|
|
6354
6360
|
this.chartService = chartService;
|
|
6355
6361
|
this.cdr = cdr;
|
|
6362
|
+
this.document = document;
|
|
6363
|
+
this.isBrowser = isPlatformBrowser(platformId);
|
|
6356
6364
|
}
|
|
6357
6365
|
get deafultColors() {
|
|
6358
6366
|
return this.chartService.defaultColors;
|
|
@@ -6550,6 +6558,7 @@ class GanttChart {
|
|
|
6550
6558
|
if (this.horizontalZoomLayoutFrame) {
|
|
6551
6559
|
cancelAnimationFrame(this.horizontalZoomLayoutFrame);
|
|
6552
6560
|
}
|
|
6561
|
+
this.unbindDataZoomDragIsolation();
|
|
6553
6562
|
// ngx-echarts can dispose the ECharts instance before this component's
|
|
6554
6563
|
// destroy hook runs. A disposed instance no longer has a ZRender surface,
|
|
6555
6564
|
// so do not try to remove the wheel listener from it.
|
|
@@ -6986,6 +6995,7 @@ class GanttChart {
|
|
|
6986
6995
|
this.buildOption();
|
|
6987
6996
|
this.bindEvents();
|
|
6988
6997
|
this.bindZoomWheel();
|
|
6998
|
+
this.bindDataZoomDragIsolation();
|
|
6989
6999
|
this.chartInstance.on('finished', () => {
|
|
6990
7000
|
this.scheduleVerticalZoomLayout();
|
|
6991
7001
|
this.scheduleHorizontalZoomLayout();
|
|
@@ -7024,6 +7034,65 @@ class GanttChart {
|
|
|
7024
7034
|
};
|
|
7025
7035
|
zr.on('mousewheel', this.zoomWheelHandler);
|
|
7026
7036
|
}
|
|
7037
|
+
/**
|
|
7038
|
+
* A native draggable ancestor starts its drag after the slider's mousedown
|
|
7039
|
+
* event. Since the native `dragstart` targets that ancestor rather than the
|
|
7040
|
+
* canvas, suppress it at document capture phase while a data-zoom gesture is
|
|
7041
|
+
* active. This keeps the fix inside the chart library and leaves parent drag
|
|
7042
|
+
* behaviour unchanged everywhere else.
|
|
7043
|
+
*/
|
|
7044
|
+
bindDataZoomDragIsolation() {
|
|
7045
|
+
if (!this.chartInstance || !this.isBrowser)
|
|
7046
|
+
return;
|
|
7047
|
+
const zr = this.chartInstance.getZr();
|
|
7048
|
+
if (this.dataZoomPointerDownHandler) {
|
|
7049
|
+
zr.off('mousedown', this.dataZoomPointerDownHandler);
|
|
7050
|
+
}
|
|
7051
|
+
this.dataZoomPointerDownHandler = (event) => {
|
|
7052
|
+
this.dataZoomGestureActive = this.isDataZoomTarget(event?.target);
|
|
7053
|
+
};
|
|
7054
|
+
zr.on('mousedown', this.dataZoomPointerDownHandler);
|
|
7055
|
+
if (!this.nativeDragStartHandler) {
|
|
7056
|
+
this.nativeDragStartHandler = (event) => {
|
|
7057
|
+
if (!this.dataZoomGestureActive)
|
|
7058
|
+
return;
|
|
7059
|
+
event.preventDefault();
|
|
7060
|
+
event.stopPropagation();
|
|
7061
|
+
this.dataZoomGestureActive = false;
|
|
7062
|
+
};
|
|
7063
|
+
this.document.addEventListener('dragstart', this.nativeDragStartHandler, true);
|
|
7064
|
+
}
|
|
7065
|
+
if (!this.nativePointerEndHandler) {
|
|
7066
|
+
this.nativePointerEndHandler = () => {
|
|
7067
|
+
this.dataZoomGestureActive = false;
|
|
7068
|
+
};
|
|
7069
|
+
this.document.addEventListener('pointerup', this.nativePointerEndHandler, true);
|
|
7070
|
+
this.document.addEventListener('pointercancel', this.nativePointerEndHandler, true);
|
|
7071
|
+
}
|
|
7072
|
+
}
|
|
7073
|
+
unbindDataZoomDragIsolation() {
|
|
7074
|
+
if (this.chartInstance && !this.chartInstance.isDisposed() && this.dataZoomPointerDownHandler) {
|
|
7075
|
+
this.chartInstance.getZr()?.off('mousedown', this.dataZoomPointerDownHandler);
|
|
7076
|
+
}
|
|
7077
|
+
if (this.nativeDragStartHandler) {
|
|
7078
|
+
this.document.removeEventListener('dragstart', this.nativeDragStartHandler, true);
|
|
7079
|
+
}
|
|
7080
|
+
if (this.nativePointerEndHandler) {
|
|
7081
|
+
this.document.removeEventListener('pointerup', this.nativePointerEndHandler, true);
|
|
7082
|
+
this.document.removeEventListener('pointercancel', this.nativePointerEndHandler, true);
|
|
7083
|
+
}
|
|
7084
|
+
this.dataZoomPointerDownHandler = undefined;
|
|
7085
|
+
this.nativeDragStartHandler = undefined;
|
|
7086
|
+
this.nativePointerEndHandler = undefined;
|
|
7087
|
+
this.dataZoomGestureActive = false;
|
|
7088
|
+
}
|
|
7089
|
+
isDataZoomTarget(target) {
|
|
7090
|
+
for (let element = target; element; element = element.parent) {
|
|
7091
|
+
if (element.__ecComponentInfo?.mainType === 'dataZoom')
|
|
7092
|
+
return true;
|
|
7093
|
+
}
|
|
7094
|
+
return false;
|
|
7095
|
+
}
|
|
7027
7096
|
moveDataZoomWindow(sliderId, insideId, delta) {
|
|
7028
7097
|
const option = this.chartInstance.getOption();
|
|
7029
7098
|
const slider = option.dataZoom?.find((zoom) => zoom['id'] === sliderId);
|
|
@@ -7352,13 +7421,19 @@ class GanttChart {
|
|
|
7352
7421
|
...(customStyle || {}),
|
|
7353
7422
|
};
|
|
7354
7423
|
}
|
|
7355
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: GanttChart, deps: [{ token: Charts }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
7424
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: GanttChart, deps: [{ token: Charts }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
|
|
7356
7425
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: GanttChart, isStandalone: true, selector: "lib-gantt-chart", inputs: { config: "config", theme: "theme", events: "events", contextMenuOptions: "contextMenuOptions", showContextMenu: "showContextMenu" }, outputs: { contextMenuClick: "contextMenuClick", chartEvent: "chartEvent", legendEvent: "legendEvent" }, host: { listeners: { "document:click": "closeCard()", "window:resize": "refreshAxisNameSpace()" } }, providers: [provideEchartsCore({ echarts })], viewQueries: [{ propertyName: "chartContainer", first: true, predicate: ["chartContainer"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\n class=\"gantt-chart-shell\"\n [class.gantt-chart-shell--legend-left]=\"config.customLegend?.position === 'left'\"\n [class.gantt-chart-shell--legend-right]=\"config.customLegend?.position === 'right'\"\n [class.gantt-chart-shell--legend-bottom]=\"config.customLegend?.position === 'bottom'\"\n>\n @if (\n !config.hideLegend &&\n config.customLegend?.position !== 'bottom' &&\n config.customLegend?.position !== 'right'\n ) {\n <lib-chart-legend\n class=\"gantt-chart-shell__legend\"\n [class.gantt-chart-shell__legend--custom-width]=\"hasSideLegendWidth\"\n [style.--gantt-chart-legend-max-width]=\"legendShellMaxWidth\"\n [chart]=\"chartInstance\"\n [series]=\"config.series\"\n [colors]=\"config.colors || deafultColors\"\n [config]=\"config.customLegend || {}\"\n (legendEvent)=\"onLegendEvent($event)\"\n ></lib-chart-legend>\n }\n\n <div\n #chartContainer\n echarts\n [options]=\"chartOption\"\n [theme]=\"theme\"\n (chartInit)=\"onChartInit($event)\"\n class=\"chart-container\"\n ></div>\n\n @if (\n !config.hideLegend &&\n (config.customLegend?.position === 'bottom' || config.customLegend?.position === 'right')\n ) {\n <lib-chart-legend\n class=\"gantt-chart-shell__legend\"\n [class.gantt-chart-shell__legend--custom-width]=\"hasSideLegendWidth\"\n [style.--gantt-chart-legend-max-width]=\"legendShellMaxWidth\"\n [chart]=\"chartInstance\"\n [series]=\"config.series\"\n [colors]=\"config.colors || deafultColors\"\n [config]=\"config.customLegend || {}\"\n (legendEvent)=\"onLegendEvent($event)\"\n ></lib-chart-legend>\n }\n</div>\n@if (openCard) {\n <lib-right-click-card\n [cardOptions]=\"contextMenuOptions\"\n (contextMenuClick)=\"onMenuClick($event)\"\n [cardPosition]=\"cardPosition\"\n ></lib-right-click-card>\n}\n", styles: [".gantt-chart-shell{display:flex;flex-direction:column;gap:8px;height:100%;min-height:0;min-width:0;width:100%}.gantt-chart-shell--legend-left,.gantt-chart-shell--legend-right{flex-direction:row}.gantt-chart-shell--legend-bottom{flex-direction:column}.gantt-chart-shell__legend{flex:0 0 auto;min-width:0}.gantt-chart-shell--legend-left .gantt-chart-shell__legend,.gantt-chart-shell--legend-right .gantt-chart-shell__legend{height:100%;max-width:min(var(--gantt-chart-legend-max-width, 360px),70%);min-height:0}.chart-container{width:100%;height:100%;position:relative;flex:1 1 auto;min-height:0;min-width:0}@media (max-width: 640px){.gantt-chart-shell,.gantt-chart-shell--legend-left,.gantt-chart-shell--legend-right{flex-direction:column}.gantt-chart-shell--legend-left .gantt-chart-shell__legend,.gantt-chart-shell--legend-right .gantt-chart-shell__legend{flex-basis:auto;max-width:none;width:auto}}\n"], dependencies: [{ kind: "directive", type: NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "initOpts", "merge", "autoResize", "loading", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartHighlight", "chartDownplay", "chartSelectChanged", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendLegendSelectAll", "chartLegendLegendInverseSelect", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartGraphRoam", "chartGeoRoam", "chartTreeRoam", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartGeoSelectChanged", "chartGeoSelected", "chartGeoUnselected", "chartAxisAreaSelected", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartGlobalCursorTaken", "chartRendered", "chartFinished"], exportAs: ["echarts"] }, { kind: "component", type: RightClickCard, selector: "lib-right-click-card", inputs: ["cardPosition", "cardOptions"], outputs: ["contextMenuClick"] }, { kind: "component", type: ChartLegendComponent, selector: "lib-chart-legend", inputs: ["chart", "series", "colors", "config", "itemTemplate"], outputs: ["legendEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7357
7426
|
}
|
|
7358
7427
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: GanttChart, decorators: [{
|
|
7359
7428
|
type: Component,
|
|
7360
7429
|
args: [{ selector: 'lib-gantt-chart', imports: [NgxEchartsDirective, RightClickCard, ChartLegendComponent], providers: [provideEchartsCore({ echarts })], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"gantt-chart-shell\"\n [class.gantt-chart-shell--legend-left]=\"config.customLegend?.position === 'left'\"\n [class.gantt-chart-shell--legend-right]=\"config.customLegend?.position === 'right'\"\n [class.gantt-chart-shell--legend-bottom]=\"config.customLegend?.position === 'bottom'\"\n>\n @if (\n !config.hideLegend &&\n config.customLegend?.position !== 'bottom' &&\n config.customLegend?.position !== 'right'\n ) {\n <lib-chart-legend\n class=\"gantt-chart-shell__legend\"\n [class.gantt-chart-shell__legend--custom-width]=\"hasSideLegendWidth\"\n [style.--gantt-chart-legend-max-width]=\"legendShellMaxWidth\"\n [chart]=\"chartInstance\"\n [series]=\"config.series\"\n [colors]=\"config.colors || deafultColors\"\n [config]=\"config.customLegend || {}\"\n (legendEvent)=\"onLegendEvent($event)\"\n ></lib-chart-legend>\n }\n\n <div\n #chartContainer\n echarts\n [options]=\"chartOption\"\n [theme]=\"theme\"\n (chartInit)=\"onChartInit($event)\"\n class=\"chart-container\"\n ></div>\n\n @if (\n !config.hideLegend &&\n (config.customLegend?.position === 'bottom' || config.customLegend?.position === 'right')\n ) {\n <lib-chart-legend\n class=\"gantt-chart-shell__legend\"\n [class.gantt-chart-shell__legend--custom-width]=\"hasSideLegendWidth\"\n [style.--gantt-chart-legend-max-width]=\"legendShellMaxWidth\"\n [chart]=\"chartInstance\"\n [series]=\"config.series\"\n [colors]=\"config.colors || deafultColors\"\n [config]=\"config.customLegend || {}\"\n (legendEvent)=\"onLegendEvent($event)\"\n ></lib-chart-legend>\n }\n</div>\n@if (openCard) {\n <lib-right-click-card\n [cardOptions]=\"contextMenuOptions\"\n (contextMenuClick)=\"onMenuClick($event)\"\n [cardPosition]=\"cardPosition\"\n ></lib-right-click-card>\n}\n", styles: [".gantt-chart-shell{display:flex;flex-direction:column;gap:8px;height:100%;min-height:0;min-width:0;width:100%}.gantt-chart-shell--legend-left,.gantt-chart-shell--legend-right{flex-direction:row}.gantt-chart-shell--legend-bottom{flex-direction:column}.gantt-chart-shell__legend{flex:0 0 auto;min-width:0}.gantt-chart-shell--legend-left .gantt-chart-shell__legend,.gantt-chart-shell--legend-right .gantt-chart-shell__legend{height:100%;max-width:min(var(--gantt-chart-legend-max-width, 360px),70%);min-height:0}.chart-container{width:100%;height:100%;position:relative;flex:1 1 auto;min-height:0;min-width:0}@media (max-width: 640px){.gantt-chart-shell,.gantt-chart-shell--legend-left,.gantt-chart-shell--legend-right{flex-direction:column}.gantt-chart-shell--legend-left .gantt-chart-shell__legend,.gantt-chart-shell--legend-right .gantt-chart-shell__legend{flex-basis:auto;max-width:none;width:auto}}\n"] }]
|
|
7361
|
-
}], ctorParameters: () => [{ type: Charts }, { type: i0.ChangeDetectorRef }
|
|
7430
|
+
}], ctorParameters: () => [{ type: Charts }, { type: i0.ChangeDetectorRef }, { type: Document, decorators: [{
|
|
7431
|
+
type: Inject,
|
|
7432
|
+
args: [DOCUMENT]
|
|
7433
|
+
}] }, { type: undefined, decorators: [{
|
|
7434
|
+
type: Inject,
|
|
7435
|
+
args: [PLATFORM_ID]
|
|
7436
|
+
}] }], propDecorators: { config: [{
|
|
7362
7437
|
type: Input
|
|
7363
7438
|
}], theme: [{
|
|
7364
7439
|
type: Input
|