@tetacom/ng-components 1.0.10 → 1.0.14
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/assets/intersect.svg +3 -0
- package/assets/lithotype-icons.svg +7 -1
- package/component/chart/chart/chart.component.d.ts +2 -1
- package/component/chart/core/chart.d.ts +2 -0
- package/component/chart/model/enum/dispatch-type.d.ts +2 -1
- package/component/chart/model/enum/drag-point-type.d.ts +5 -0
- package/component/chart/model/plot-band.d.ts +2 -0
- package/component/chart/model/point/base-point.d.ts +2 -0
- package/component/chart/model/point/marker-options.d.ts +11 -0
- package/component/icon/icon-sprite.directive.d.ts +1 -1
- package/esm2020/component/chart/chart/chart.component.mjs +11 -4
- package/esm2020/component/chart/core/chart.mjs +25 -7
- package/esm2020/component/chart/drawer/line-drawer.mjs +49 -3
- package/esm2020/component/chart/drawer/spline-drawer.mjs +2 -1
- package/esm2020/component/chart/model/enum/dispatch-type.mjs +2 -1
- package/esm2020/component/chart/model/enum/drag-point-type.mjs +7 -0
- package/esm2020/component/chart/model/plot-band.mjs +2 -1
- package/esm2020/component/chart/model/point/base-point.mjs +1 -1
- package/esm2020/component/chart/model/point/marker-options.mjs +2 -0
- package/esm2020/component/icon/icon-sprite.directive.mjs +9 -2
- package/fesm2015/tetacom-ng-components.mjs +100 -13
- package/fesm2015/tetacom-ng-components.mjs.map +1 -1
- package/fesm2020/tetacom-ng-components.mjs +99 -12
- package/fesm2020/tetacom-ng-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -240,7 +240,14 @@ class IconSpriteDirective {
|
|
|
240
240
|
this.bypassInterceptors = true;
|
|
241
241
|
}
|
|
242
242
|
ngOnInit() {
|
|
243
|
-
|
|
243
|
+
if (typeof this.tetaIconSprite === 'string') {
|
|
244
|
+
this._iconService.addSprite(this.tetaIconSprite, this.bypassInterceptors);
|
|
245
|
+
}
|
|
246
|
+
if (this.tetaIconSprite instanceof Array && this.tetaIconSprite?.length) {
|
|
247
|
+
this.tetaIconSprite.forEach((sprite) => {
|
|
248
|
+
this._iconService.addSprite(sprite, this.bypassInterceptors);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
244
251
|
}
|
|
245
252
|
}
|
|
246
253
|
IconSpriteDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconSpriteDirective, deps: [{ token: IconService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -9975,14 +9982,23 @@ class BarDrawer {
|
|
|
9975
9982
|
var DispatchType;
|
|
9976
9983
|
(function (DispatchType) {
|
|
9977
9984
|
DispatchType["moveLine"] = "moveLine";
|
|
9985
|
+
DispatchType["movePoint"] = "movePoint";
|
|
9978
9986
|
})(DispatchType || (DispatchType = {}));
|
|
9979
9987
|
|
|
9988
|
+
var DragPointType;
|
|
9989
|
+
(function (DragPointType) {
|
|
9990
|
+
DragPointType[DragPointType["x"] = 0] = "x";
|
|
9991
|
+
DragPointType[DragPointType["y"] = 1] = "y";
|
|
9992
|
+
DragPointType[DragPointType["xy"] = 2] = "xy";
|
|
9993
|
+
})(DragPointType || (DragPointType = {}));
|
|
9994
|
+
|
|
9980
9995
|
class LineDrawer {
|
|
9981
9996
|
constructor() {
|
|
9982
|
-
this.dispatch = d3.dispatch(DispatchType.moveLine);
|
|
9997
|
+
this.dispatch = d3.dispatch(DispatchType.moveLine, DispatchType.movePoint);
|
|
9983
9998
|
}
|
|
9984
9999
|
draw(series, context, scaleX, scaleY, options) {
|
|
9985
10000
|
const points = series.data;
|
|
10001
|
+
const markerPoints = points.filter((_) => _.marker);
|
|
9986
10002
|
const path = d3
|
|
9987
10003
|
.line()
|
|
9988
10004
|
.curve(series.curveType)
|
|
@@ -9992,7 +10008,7 @@ class LineDrawer {
|
|
|
9992
10008
|
const seriesIndex = options.series.findIndex((_) => _.id === series.id);
|
|
9993
10009
|
context
|
|
9994
10010
|
.append('path')
|
|
9995
|
-
.attr('class', (d) => series?.drag.enable ? 'draggable' :
|
|
10011
|
+
.attr('class', (d) => series?.drag.enable ? 'draggable' : `series-${seriesIndex}`)
|
|
9996
10012
|
.attr('data-draggable-id', seriesIndex)
|
|
9997
10013
|
.attr('fill', 'none')
|
|
9998
10014
|
.attr('stroke', series.color)
|
|
@@ -10078,6 +10094,50 @@ class LineDrawer {
|
|
|
10078
10094
|
if (series?.drag?.extendLine && points?.length) {
|
|
10079
10095
|
drawExtendedLine();
|
|
10080
10096
|
}
|
|
10097
|
+
if (markerPoints?.length) {
|
|
10098
|
+
const emit = (event, target) => {
|
|
10099
|
+
this.dispatch.apply(DispatchType.movePoint, {
|
|
10100
|
+
target: series,
|
|
10101
|
+
point: {
|
|
10102
|
+
...target,
|
|
10103
|
+
},
|
|
10104
|
+
event,
|
|
10105
|
+
});
|
|
10106
|
+
};
|
|
10107
|
+
context
|
|
10108
|
+
.selectAll(`draggable-marker-${seriesIndex}`)
|
|
10109
|
+
.data(markerPoints)
|
|
10110
|
+
.enter()
|
|
10111
|
+
.append('circle')
|
|
10112
|
+
.attr('class', `draggable-marker-${seriesIndex}`)
|
|
10113
|
+
.attr('r', (d) => d.marker?.style?.radius || 5)
|
|
10114
|
+
.attr('cx', function (d) {
|
|
10115
|
+
return scaleX(d.x);
|
|
10116
|
+
})
|
|
10117
|
+
.attr('cy', function (d) {
|
|
10118
|
+
return scaleY(d.y);
|
|
10119
|
+
})
|
|
10120
|
+
.style('cursor', 'pointer')
|
|
10121
|
+
.style('fill', (d) => d.marker?.style?.color || 'red')
|
|
10122
|
+
.attr('stroke', (d) => d.marker?.style?.stroke || 'none')
|
|
10123
|
+
.attr('stroke-width', (d) => d.marker?.style?.strokeWidth || 0);
|
|
10124
|
+
context.selectAll(`.draggable-marker-${seriesIndex}`).call(d3.drag().on('drag start end', function dragged(event, d) {
|
|
10125
|
+
const node = d3.select(this);
|
|
10126
|
+
if (event.type === 'start') {
|
|
10127
|
+
node.raise().classed('active', true);
|
|
10128
|
+
}
|
|
10129
|
+
if (d.marker?.dragType === DragPointType.x) {
|
|
10130
|
+
d.x = scaleX.invert(event.sourceEvent?.offsetX);
|
|
10131
|
+
node.attr('cx', scaleX(d.x));
|
|
10132
|
+
}
|
|
10133
|
+
if (d.marker?.dragType === DragPointType.y) {
|
|
10134
|
+
d.y = scaleY.invert(event.sourceEvent?.offsetY);
|
|
10135
|
+
node.attr('cy', scaleY(d.y));
|
|
10136
|
+
}
|
|
10137
|
+
context.select(`.series-${seriesIndex}`).attr('d', path);
|
|
10138
|
+
emit(event, d);
|
|
10139
|
+
}));
|
|
10140
|
+
}
|
|
10081
10141
|
}
|
|
10082
10142
|
}
|
|
10083
10143
|
|
|
@@ -10091,6 +10151,7 @@ class SplineDrawer {
|
|
|
10091
10151
|
const path = d3
|
|
10092
10152
|
.line()
|
|
10093
10153
|
.curve(d3.curveCatmullRom)
|
|
10154
|
+
.defined((d) => d.x != null && d.y != null)
|
|
10094
10155
|
.x((d) => scaleX(d.x))
|
|
10095
10156
|
.y((d) => scaleY(d.y));
|
|
10096
10157
|
context
|
|
@@ -10454,6 +10515,7 @@ class TetaChart {
|
|
|
10454
10515
|
this.plotLinesMove$ = new Subject();
|
|
10455
10516
|
this.plotBandsMove$ = new Subject();
|
|
10456
10517
|
this.seriesMove$ = new Subject();
|
|
10518
|
+
this.pointMove$ = new Subject();
|
|
10457
10519
|
this.zoom$ = new Subject();
|
|
10458
10520
|
this._container = null;
|
|
10459
10521
|
this._width = 0;
|
|
@@ -10475,6 +10537,7 @@ class TetaChart {
|
|
|
10475
10537
|
this.plotLinesMove = this.plotLinesMove$.asObservable();
|
|
10476
10538
|
this.plotBandsMove = this.plotBandsMove$.asObservable();
|
|
10477
10539
|
this.seriesMove = this.seriesMove$.asObservable();
|
|
10540
|
+
this.pointMove = this.pointMove$.asObservable();
|
|
10478
10541
|
this.zoom = this.zoom$.asObservable();
|
|
10479
10542
|
}
|
|
10480
10543
|
redraw(options) {
|
|
@@ -10584,11 +10647,11 @@ class TetaChart {
|
|
|
10584
10647
|
this.visibleChartWindowWidth = this.caluclateChartWidth();
|
|
10585
10648
|
}
|
|
10586
10649
|
_redraw() {
|
|
10650
|
+
this.drawPlotBands();
|
|
10651
|
+
this.drawPlotLines();
|
|
10587
10652
|
this.drawChart();
|
|
10588
10653
|
this.drawAxis();
|
|
10589
10654
|
this.drawGridLines();
|
|
10590
|
-
this.drawPlotBands();
|
|
10591
|
-
this.drawPlotLines();
|
|
10592
10655
|
this.drawAnnotations();
|
|
10593
10656
|
}
|
|
10594
10657
|
addZoom() {
|
|
@@ -10930,7 +10993,12 @@ class TetaChart {
|
|
|
10930
10993
|
.attr('x', (d) => x(d.from))
|
|
10931
10994
|
.attr('y', 0)
|
|
10932
10995
|
.attr('width', (d) => Math.abs(x(d.to) - x(d.from)))
|
|
10933
|
-
.attr('fill', (d) =>
|
|
10996
|
+
.attr('fill', (d) => {
|
|
10997
|
+
if (d.image) {
|
|
10998
|
+
return `url(#${d.image})`;
|
|
10999
|
+
}
|
|
11000
|
+
return d.color;
|
|
11001
|
+
})
|
|
10934
11002
|
.style('opacity', (d) => d.opacity ?? 1)
|
|
10935
11003
|
.attr('height', plotBandHeight > 0 ? plotBandHeight : 0)
|
|
10936
11004
|
.attr('transform', `translate(0, ${this._options.bounds.top})`);
|
|
@@ -11170,7 +11238,12 @@ class TetaChart {
|
|
|
11170
11238
|
.attr('x', 0)
|
|
11171
11239
|
.attr('y', (d) => y(d.from))
|
|
11172
11240
|
.attr('width', (d) => plotBandWidth)
|
|
11173
|
-
.attr('fill', (d) =>
|
|
11241
|
+
.attr('fill', (d) => {
|
|
11242
|
+
if (d.image) {
|
|
11243
|
+
return `url(#${d.image})`;
|
|
11244
|
+
}
|
|
11245
|
+
return d.color;
|
|
11246
|
+
})
|
|
11174
11247
|
.style('opacity', (d) => d.opacity ?? 1)
|
|
11175
11248
|
.attr('height', (d) => Math.abs(y(d.to) - y(d.from)))
|
|
11176
11249
|
.attr('cursor', (d) => (d.draggable ? 'move' : 'default'));
|
|
@@ -11313,9 +11386,15 @@ class TetaChart {
|
|
|
11313
11386
|
const emit = (event) => {
|
|
11314
11387
|
this.seriesMove$.next(event);
|
|
11315
11388
|
};
|
|
11389
|
+
const emitPoint = (event) => {
|
|
11390
|
+
this.pointMove$.next(event);
|
|
11391
|
+
};
|
|
11316
11392
|
drawer?.dispatch?.on(DispatchType.moveLine, function () {
|
|
11317
11393
|
emit(this);
|
|
11318
11394
|
});
|
|
11395
|
+
drawer?.dispatch?.on(DispatchType.movePoint, function () {
|
|
11396
|
+
emitPoint(this);
|
|
11397
|
+
});
|
|
11319
11398
|
});
|
|
11320
11399
|
}
|
|
11321
11400
|
createTooltip() {
|
|
@@ -11362,7 +11441,7 @@ class TetaChart {
|
|
|
11362
11441
|
color: d.color,
|
|
11363
11442
|
name: d.name,
|
|
11364
11443
|
});
|
|
11365
|
-
return `translate(${!isNaN(data?.x) ? foundX(data.x) : -10}, ${!isNaN(data?.y) ? foundY(data.y) : -10})`;
|
|
11444
|
+
return `translate(${!isNaN(data?.x) && data?.x != null ? foundX(data.x) : -10}, ${!isNaN(data?.y) && data?.y != null ? foundY(data.y) : -10})`;
|
|
11366
11445
|
}
|
|
11367
11446
|
if (this._options.tooltip.tracking === 'y') {
|
|
11368
11447
|
const sorted = [...d.data].sort((a, b) => d3.ascending(a.y, b.y));
|
|
@@ -11375,7 +11454,7 @@ class TetaChart {
|
|
|
11375
11454
|
color: d.color,
|
|
11376
11455
|
name: d.name,
|
|
11377
11456
|
});
|
|
11378
|
-
return `translate(${foundX(data.x)}, ${foundY(data.y)})`;
|
|
11457
|
+
return `translate(${!isNaN(data?.x) && data?.x != null ? foundX(data.x) : -10}, ${!isNaN(data?.y) && data?.y != null ? foundY(data.y) : -10})`;
|
|
11379
11458
|
}
|
|
11380
11459
|
});
|
|
11381
11460
|
if (this._options.tooltip?.format) {
|
|
@@ -11760,6 +11839,7 @@ class ChartComponent {
|
|
|
11760
11839
|
this.plotLinesMove = new EventEmitter();
|
|
11761
11840
|
this.plotBandsMove = new EventEmitter();
|
|
11762
11841
|
this.seriesMove = new EventEmitter();
|
|
11842
|
+
this.pointMove = new EventEmitter();
|
|
11763
11843
|
this.zoomChange = new EventEmitter();
|
|
11764
11844
|
this._alive = true;
|
|
11765
11845
|
this.size$ = new Subject();
|
|
@@ -11811,8 +11891,7 @@ class ChartComponent {
|
|
|
11811
11891
|
this._chart?.setZoom(this.zoom);
|
|
11812
11892
|
}
|
|
11813
11893
|
}
|
|
11814
|
-
ngOnInit() {
|
|
11815
|
-
}
|
|
11894
|
+
ngOnInit() { }
|
|
11816
11895
|
ngAfterViewInit() {
|
|
11817
11896
|
this._observer = new ResizeObserver((entries) => {
|
|
11818
11897
|
const { contentRect } = entries[0];
|
|
@@ -11858,6 +11937,11 @@ class ChartComponent {
|
|
|
11858
11937
|
this._chart.seriesMove
|
|
11859
11938
|
.pipe(takeWhile((_) => this._alive))
|
|
11860
11939
|
.subscribe((_) => this.seriesMove.emit(_));
|
|
11940
|
+
this._chart.pointMove
|
|
11941
|
+
.pipe(takeWhile((_) => this._alive))
|
|
11942
|
+
.subscribe((_) => {
|
|
11943
|
+
this.pointMove.emit(_);
|
|
11944
|
+
});
|
|
11861
11945
|
this._chart.zoom
|
|
11862
11946
|
.pipe(takeWhile((_) => this._alive), map((_) => {
|
|
11863
11947
|
this.zoomChange.emit(_);
|
|
@@ -11875,7 +11959,7 @@ class ChartComponent {
|
|
|
11875
11959
|
}
|
|
11876
11960
|
}
|
|
11877
11961
|
ChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
11878
|
-
ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ChartComponent, selector: "teta-chart", inputs: { zoom: "zoom", config: "config" }, outputs: { plotLinesMove: "plotLinesMove", plotBandsMove: "plotBandsMove", seriesMove: "seriesMove", zoomChange: "zoomChange" }, host: { listeners: { "click": "click($event)" } }, viewQueries: [{ propertyName: "chart", first: true, predicate: ["chart"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div [style.display]=\"hasSeriesData ? 'contents' : 'none'\">\n <div #chart class=\"chart-container\"></div>\n <div class=\"legend-container\"></div>\n</div>\n<div [style.display]=\"!hasSeriesData ? 'block' : 'none'\" class=\"chart-placeholder text-align-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n</div>\n\n\n", styles: [":host{display:flex;width:100%;height:100%;flex-direction:column}.chart-container{position:relative;min-height:0;flex-grow:1;flex-basis:1px}.chart-placeholder{margin:auto;width:100%}.chart-placeholder span{text-overflow:ellipsis;overflow:hidden;display:block}.legend-container{flex-shrink:0;flex-basis:1px}::ng-deep .grid line{stroke-dasharray:1,4}::ng-deep .tooltip-chart{padding:8px 12px;border-radius:2px}::ng-deep .legend{grid-gap:8px;padding-bottom:5px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-evenly}::ng-deep .legend .item{display:flex;align-items:center;cursor:pointer}::ng-deep .legend .item .swatch{width:10px;height:10px}::ng-deep .legend .item .line{width:12px;height:2px}::ng-deep .legend .item .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-left:5px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
11962
|
+
ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ChartComponent, selector: "teta-chart", inputs: { zoom: "zoom", config: "config" }, outputs: { plotLinesMove: "plotLinesMove", plotBandsMove: "plotBandsMove", seriesMove: "seriesMove", pointMove: "pointMove", zoomChange: "zoomChange" }, host: { listeners: { "click": "click($event)" } }, viewQueries: [{ propertyName: "chart", first: true, predicate: ["chart"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div [style.display]=\"hasSeriesData ? 'contents' : 'none'\">\n <div #chart class=\"chart-container\"></div>\n <div class=\"legend-container\"></div>\n</div>\n<div [style.display]=\"!hasSeriesData ? 'block' : 'none'\" class=\"chart-placeholder text-align-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n</div>\n\n\n", styles: [":host{display:flex;width:100%;height:100%;flex-direction:column}.chart-container{position:relative;min-height:0;flex-grow:1;flex-basis:1px}.chart-placeholder{margin:auto;width:100%}.chart-placeholder span{text-overflow:ellipsis;overflow:hidden;display:block}.legend-container{flex-shrink:0;flex-basis:1px}::ng-deep .grid line{stroke-dasharray:1,4}::ng-deep .tooltip-chart{padding:8px 12px;border-radius:2px}::ng-deep .legend{grid-gap:8px;padding-bottom:5px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-evenly}::ng-deep .legend .item{display:flex;align-items:center;cursor:pointer}::ng-deep .legend .item .swatch{width:10px;height:10px}::ng-deep .legend .item .line{width:12px;height:2px}::ng-deep .legend .item .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-left:5px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
11879
11963
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartComponent, decorators: [{
|
|
11880
11964
|
type: Component,
|
|
11881
11965
|
args: [{ selector: 'teta-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.display]=\"hasSeriesData ? 'contents' : 'none'\">\n <div #chart class=\"chart-container\"></div>\n <div class=\"legend-container\"></div>\n</div>\n<div [style.display]=\"!hasSeriesData ? 'block' : 'none'\" class=\"chart-placeholder text-align-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n</div>\n\n\n", styles: [":host{display:flex;width:100%;height:100%;flex-direction:column}.chart-container{position:relative;min-height:0;flex-grow:1;flex-basis:1px}.chart-placeholder{margin:auto;width:100%}.chart-placeholder span{text-overflow:ellipsis;overflow:hidden;display:block}.legend-container{flex-shrink:0;flex-basis:1px}::ng-deep .grid line{stroke-dasharray:1,4}::ng-deep .tooltip-chart{padding:8px 12px;border-radius:2px}::ng-deep .legend{grid-gap:8px;padding-bottom:5px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-evenly}::ng-deep .legend .item{display:flex;align-items:center;cursor:pointer}::ng-deep .legend .item .swatch{width:10px;height:10px}::ng-deep .legend .item .line{width:12px;height:2px}::ng-deep .legend .item .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-left:5px}\n"] }]
|
|
@@ -11889,6 +11973,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
11889
11973
|
type: Output
|
|
11890
11974
|
}], seriesMove: [{
|
|
11891
11975
|
type: Output
|
|
11976
|
+
}], pointMove: [{
|
|
11977
|
+
type: Output
|
|
11892
11978
|
}], zoomChange: [{
|
|
11893
11979
|
type: Output
|
|
11894
11980
|
}], chart: [{
|
|
@@ -12073,6 +12159,7 @@ class PlotBand {
|
|
|
12073
12159
|
this.to = options?.to;
|
|
12074
12160
|
this.label = options?.label;
|
|
12075
12161
|
this.color = options?.color || '#59AE501A';
|
|
12162
|
+
this.image = options?.image;
|
|
12076
12163
|
this.showGrabbers =
|
|
12077
12164
|
options?.showGrabbers != null ? options.showGrabbers : true;
|
|
12078
12165
|
this.draggable = options?.draggable != null ? options?.draggable : false;
|