Skip to content

Commit

Permalink
refactor: rename classes in addon-charts
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Jun 19, 2024
1 parent 009aaaf commit 5e0313c
Show file tree
Hide file tree
Showing 42 changed files with 97 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Input,
ViewChildren,
} from '@angular/core';
import {TuiBarSetComponent} from '@taiga-ui/addon-charts/components/bar-set';
import {TuiBarSet} from '@taiga-ui/addon-charts/components/bar-set';
import {EMPTY_QUERY} from '@taiga-ui/cdk/constants';
import {TuiMapperPipe} from '@taiga-ui/cdk/pipes/mapper';
import {TuiIdService} from '@taiga-ui/cdk/services';
Expand All @@ -27,13 +27,13 @@ import type {Observable} from 'rxjs';
@Component({
standalone: true,
selector: 'tui-bar-chart',
imports: [NgForOf, TuiHint, TuiMapperPipe, AsyncPipe, TuiBarSetComponent],
imports: [NgForOf, TuiHint, TuiMapperPipe, AsyncPipe, TuiBarSet],
templateUrl: './bar-chart.template.html',
styleUrls: ['./bar-chart.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
viewProviders: [tuiHintOptionsProvider({direction: 'top'})],
})
export class TuiBarChartComponent {
export class TuiBarChart {
private readonly hintOptions = inject(TuiHintOptionsDirective, {optional: true});
private readonly autoIdString = inject(TuiIdService).generate();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {Component, ViewChild} from '@angular/core';
import type {ComponentFixture} from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import {TuiBarChartComponent} from '@taiga-ui/addon-charts';
import {TuiBarChart} from '@taiga-ui/addon-charts';

describe('BarChart', () => {
@Component({
standalone: true,
imports: [TuiBarChartComponent],
imports: [TuiBarChart],
template: `
<tui-bar-chart
[max]="max"
Expand All @@ -15,8 +15,8 @@ describe('BarChart', () => {
`,
})
class Test {
@ViewChild(TuiBarChartComponent)
public readonly component!: TuiBarChartComponent;
@ViewChild(TuiBarChart)
public readonly component!: TuiBarChart;

public readonly value = [
[1, 2, 3],
Expand Down
6 changes: 3 additions & 3 deletions projects/addon-charts/components/bar-set/bar-set.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {NgForOf, NgIf, NgTemplateOutlet} from '@angular/common';
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
import type {SafeValue} from '@angular/platform-browser';
import {TuiBarComponent} from '@taiga-ui/addon-charts/components/bar';
import {TuiBar} from '@taiga-ui/addon-charts/components/bar';
import {tuiPure} from '@taiga-ui/cdk/utils/miscellaneous';
import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types';

Expand All @@ -12,12 +12,12 @@ const FILLER_ARRAY: readonly number[] = [1];
@Component({
standalone: true,
selector: 'tui-bar-set',
imports: [NgIf, NgForOf, NgTemplateOutlet, TuiBarComponent],
imports: [NgIf, NgForOf, NgTemplateOutlet, TuiBar],
templateUrl: './bar-set.template.html',
styleUrls: ['./bar-set.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TuiBarSetComponent {
export class TuiBarSet {
@Input()
public value: readonly number[] = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import {Component, ViewChild} from '@angular/core';
import type {ComponentFixture} from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {TuiBarSetComponent} from '@taiga-ui/addon-charts';
import {TuiBarSet} from '@taiga-ui/addon-charts';

describe('BarSet', () => {
@Component({
standalone: true,
imports: [TuiBarSetComponent],
imports: [TuiBarSet],
template: `
<tui-bar-set
[collapsed]="collapsed"
Expand All @@ -16,8 +16,8 @@ describe('BarSet', () => {
`,
})
class Test {
@ViewChild(TuiBarSetComponent)
public readonly component!: TuiBarSetComponent;
@ViewChild(TuiBarSet)
public readonly component!: TuiBarSet;

public readonly value = [10, 20, 30, 40];
public collapsed = false;
Expand Down
2 changes: 1 addition & 1 deletion projects/addon-charts/components/bar/bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types';
styleUrls: ['./bar.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TuiBarComponent {
export class TuiBar {
@Input()
public value: readonly number[] = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {TuiSizeS} from '@taiga-ui/core/types';
styleUrls: ['./legend-item.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TuiLegendItemComponent {
export class TuiLegendItem {
@Input()
public active = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ import {
switchMap,
} from 'rxjs';

import {TuiLineChartComponent} from './line-chart.component';
import {TuiLineChart} from './line-chart.component';

@Directive({
standalone: true,
selector: '[tuiLineChartHint]',
providers: [TuiHoveredService],
})
export class TuiLineChartHintDirective implements AfterViewInit {
@ContentChildren(forwardRef(() => TuiLineChartComponent))
private readonly charts: QueryList<TuiLineChartComponent> = EMPTY_QUERY;
@ContentChildren(forwardRef(() => TuiLineChart))
private readonly charts: QueryList<TuiLineChart> = EMPTY_QUERY;

@ContentChildren(forwardRef(() => TuiLineChartComponent), {read: ElementRef})
@ContentChildren(forwardRef(() => TuiLineChart), {read: ElementRef})
private readonly chartsRef: QueryList<ElementRef<HTMLElement>> = EMPTY_QUERY;

private readonly renderer = inject(Renderer2);
Expand All @@ -63,12 +63,12 @@ export class TuiLineChartHintDirective implements AfterViewInit {
}

// _chart is required by TuiLineDaysChartComponent that impersonates this directive
public getContext(index: number, _chart: TuiLineChartComponent): readonly TuiPoint[] {
public getContext(index: number, _chart: TuiLineChart): readonly TuiPoint[] {
return this.computeContext(...this.charts.map(({value}) => value))[index];
}

// _chart is required by TuiLineDaysChartComponent that impersonates this directive
public raise(index: number, _chart: TuiLineChartComponent): void {
public raise(index: number, _chart: TuiLineChart): void {
const current = this.charts.map(chart => chart.value[index]);
const sorted = [...current].sort((a, b) => a[1] - b[1]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {TuiLineChartHintDirective} from './line-chart-hint.directive';
changeDetection: ChangeDetectionStrategy.OnPush,
viewProviders: [tuiHintOptionsProvider({direction: 'top', hideDelay: 0})],
})
export class TuiLineChartComponent {
export class TuiLineChart {
private readonly zone = inject(NgZone);
private readonly options = inject(TUI_LINE_CHART_OPTIONS);
private readonly hover$ = new Subject<number>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {
TUI_LINE_CHART_OPTIONS,
TuiLineChartComponent,
TuiLineChart,
tuiLineChartDrivers,
TuiLineChartHintDirective,
} from '@taiga-ui/addon-charts/components/line-chart';
Expand All @@ -37,7 +37,7 @@ const DUMMY: TuiPoint = [NaN, NaN];
standalone: true,
selector: 'tui-line-days-chart',
imports: [
TuiLineChartComponent,
TuiLineChart,
NgForOf,
TuiHint,
PolymorpheusOutlet,
Expand All @@ -63,8 +63,8 @@ export class TuiLineDaysChartComponent implements AfterViewInit {
optional: true,
});

@ViewChildren(TuiLineChartComponent)
public readonly charts: QueryList<TuiLineChartComponent> = EMPTY_QUERY;
@ViewChildren(TuiLineChart)
public readonly charts: QueryList<TuiLineChart> = EMPTY_QUERY;

@Input()
public y = 0;
Expand Down Expand Up @@ -178,7 +178,7 @@ export class TuiLineDaysChartComponent implements AfterViewInit {
return index - offset;
}

protected raise(index: number, {value}: TuiLineChartComponent): void {
protected raise(index: number, {value}: TuiLineChart): void {
const x = value[index][0];
const month = this.getDay(x);

Expand All @@ -193,7 +193,7 @@ export class TuiLineDaysChartComponent implements AfterViewInit {
return this.getDay(index).daysCount * this.months.length;
}

protected getContext(index: number, {value}: TuiLineChartComponent): unknown {
protected getContext(index: number, {value}: TuiLineChart): unknown {
const x = value[index][0];

return this.hintDirective
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const TRANSFORM = {
changeDetection: ChangeDetectionStrategy.OnPush,
viewProviders: [tuiHintOptionsProvider({direction: 'top-right', appearance: 'dark'})],
})
export class TuiPieChartComponent {
export class TuiPieChart {
private readonly hintOptions = inject(TuiHintOptionsDirective, {optional: true});
private readonly autoIdString = inject(TuiIdService).generate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import {Location} from '@angular/common';
import {Component} from '@angular/core';
import type {ComponentFixture} from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import {TuiPieChartComponent} from '@taiga-ui/addon-charts';
import {TuiPieChart} from '@taiga-ui/addon-charts';
import {TuiPageObject} from '@taiga-ui/testing';

describe('PieChart', () => {
@Component({
standalone: true,
imports: [TuiPieChartComponent],
imports: [TuiPieChart],
template: `
<tui-pie-chart [value]="value"></tui-pie-chart>
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import {
Input,
Output,
} from '@angular/core';
import {TuiPieChartComponent} from '@taiga-ui/addon-charts/components/pie-chart';
import {TuiPieChart} from '@taiga-ui/addon-charts/components/pie-chart';
import type {TuiSizeXL, TuiSizeXS} from '@taiga-ui/core/types';

@Component({
standalone: true,
selector: 'tui-ring-chart',
imports: [TuiPieChartComponent],
imports: [TuiPieChart],
templateUrl: './ring-chart.template.html',
styleUrls: ['./ring-chart.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TuiRingChartComponent {
export class TuiRingChart {
@Input()
public value: readonly number[] = [];

Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/axes/examples/2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TUI_ALWAYS_DASHED,
TUI_ALWAYS_NONE,
TuiAxes,
TuiBarChartComponent,
TuiBarChart,
} from '@taiga-ui/addon-charts';
import {TuiAmountPipe} from '@taiga-ui/addon-commerce';
import {tuiCeil, tuiPure} from '@taiga-ui/cdk';
Expand All @@ -16,7 +16,7 @@ const BENJI = 100;

@Component({
standalone: true,
imports: [TuiAxes, TuiBarChartComponent, TuiHint, TuiAmountPipe, AsyncPipe, NgForOf],
imports: [TuiAxes, TuiBarChart, TuiHint, TuiAmountPipe, AsyncPipe, NgForOf],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/axes/examples/3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import {NgForOf} from '@angular/common';
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiAxes, TuiBarComponent} from '@taiga-ui/addon-charts';
import {TuiAxes, TuiBar} from '@taiga-ui/addon-charts';

@Component({
standalone: true,
imports: [TuiAxes, TuiBarComponent, NgForOf],
imports: [TuiAxes, TuiBar, NgForOf],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiAxes, TuiBarChartComponent} from '@taiga-ui/addon-charts';
import {TuiAxes, TuiBarChart} from '@taiga-ui/addon-charts';
import {tuiCeil} from '@taiga-ui/cdk';

@Component({
standalone: true,
imports: [TuiAxes, TuiBarChartComponent],
imports: [TuiAxes, TuiBarChart],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Component} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiAxes, TuiBarChartComponent} from '@taiga-ui/addon-charts';
import {TuiAxes, TuiBarChart} from '@taiga-ui/addon-charts';
import type {TuiContext} from '@taiga-ui/cdk';
import {tuiFormatNumber, TuiHint} from '@taiga-ui/core';
import {TuiDataListWrapper} from '@taiga-ui/kit';
Expand All @@ -12,7 +12,7 @@ import {TuiSelectModule} from '@taiga-ui/legacy';
standalone: true,
imports: [
TuiAxes,
TuiBarChartComponent,
TuiBarChart,
TuiSelectModule,
FormsModule,
TuiDataListWrapper,
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/bar-chart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {DemoRoute} from '@demo/routes';
import {TuiDemo} from '@demo/utils';
import {TuiBarChartComponent} from '@taiga-ui/addon-charts';
import {TuiBarChart} from '@taiga-ui/addon-charts';
import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core';
import {TuiLink, TuiNotification} from '@taiga-ui/core';

@Component({
standalone: true,
imports: [TuiLink, TuiNotification, TuiBarChartComponent, TuiDemo],
imports: [TuiLink, TuiNotification, TuiBarChart, TuiDemo],
templateUrl: './index.html',
styleUrls: ['./index.less'],
changeDetection,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiBarSetComponent} from '@taiga-ui/addon-charts';
import {TuiBarSet} from '@taiga-ui/addon-charts';

@Component({
standalone: true,
imports: [TuiBarSetComponent],
imports: [TuiBarSet],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiBarSetComponent} from '@taiga-ui/addon-charts';
import {TuiBarSet} from '@taiga-ui/addon-charts';

@Component({
standalone: true,
imports: [TuiBarSetComponent],
imports: [TuiBarSet],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiBarSetComponent} from '@taiga-ui/addon-charts';
import {TuiBarSet} from '@taiga-ui/addon-charts';

@Component({
standalone: true,
imports: [TuiBarSetComponent],
imports: [TuiBarSet],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiBarSetComponent} from '@taiga-ui/addon-charts';
import {TuiBarSet} from '@taiga-ui/addon-charts';

@Component({
standalone: true,
imports: [TuiBarSetComponent],
imports: [TuiBarSet],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
Loading

0 comments on commit 5e0313c

Please sign in to comment.