Skip to content

Commit

Permalink
Merge branch 'refs/heads/release/8.x.x' into pw/chen
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
#	package.json
#	projects/fusion-ui/package.json
  • Loading branch information
AndyKIron committed Apr 25, 2024
2 parents 0f024ad + a7bb1fc commit 5eb779f
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .storybook/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export default create({
brandTitle: 'IronSource Fusion UI',
brandUrl: 'https://fusion.ironsrc.net',
brandImage:
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAAAgCAMAAADt/IAXAAACuFBMVEUAAAAAAP8AAIAAAKoAAIAAAJkAAIAAJJIAIIAAHI4aGoAXF4sVFZUSEpIREYgQEI8PD4cODo4NDYYNGowMGJIMF4sLFpALFYoKFI8KFIkJE44JEokJEo0REYgQEIwQGI8PF4sPF48PFooOFY4OFYoNFI0NFIkME48MEowMEo4MEYsLF44LFosLFo0LFYoKFY0PFIwPFI4OE4wOE44OEo0NEosNFo0NFooNFYoMFYwMFI4MFIsMFI0ME4sLE40LE4sPEowPEooOFowOFY4OFYwOFY0OFIsNFI0NFIsNFI0NE4sNE4wNE4sME4wMFo0MFYwMFY0MFYsMFY0OFIsOFIwOE40OE4wOE40NE4wNFY0NFYsNFY0NFIwNFIsNFIwMFIwME40ME4wME40OE4sOFYwOFYsOFYwOFIsOFIwNFI0NFIwNFI0NFIsNE4wNE4sNE4sNFYwMFY0MFYwMFI0MFIwMFI0OFIsOFIwOFIsOE4wOE4sNE4wNFY0NFYwNFY0NFIwNFIsNFIwNFIsMFI0ME4wME40ME4wOFYwOFYwOFIsOFIwNFIsNFIwNFI0NE4wNE4wNE4wNFYwNFIwNFIsMFIwMFIwOFIwOFIwOFIwNE4wNE4sNFYwNFY0NFI0NFIwNFIwNFIwNFIwNFIsNFIwME4wMFY0MFYwOFIwOFIwNFIwNFIwNF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JHiALoTw6OKFKfa/WaAAAAAElFTkSuQmCC',
'https://fusion.ironsrc.net/assets/images/v4/unity-is-logo.svg',
});
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [8.0.0](https://github.com/ironSource/fusion-ui/compare/v8.0.0-rc.39...v8.0.0) (2024-04-25)

## [8.0.0-rc.39](https://github.com/ironSource/fusion-ui/compare/v8.0.0-rc.38...v8.0.0-rc.39) (2024-04-24)

## [8.0.0-rc.38](https://github.com/ironSource/fusion-ui/compare/v8.0.0-rc.37...v8.0.0-rc.38) (2024-04-24)

## [8.0.0-rc.37](https://github.com/ironSource/fusion-ui/compare/v8.0.0-rc.36...v8.0.0-rc.37) (2024-04-21)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fusion-ui",
"version": "8.0.0-test.1",
"version": "8.0.0",
"description": "UI library created by ironSource",
"license": "MIT",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {ChangeDetectionStrategy, Component, EventEmitter, inject, Input, Output} from '@angular/core';
import {ChangeDetectionStrategy, Component, EventEmitter, inject, Input, OnDestroy, OnInit, Output} from '@angular/core';
import {CommonModule} from '@angular/common';
import {ReactiveFormsModule} from '@angular/forms';
import {Subject} from 'rxjs';
import {debounceTime, takeUntil} from 'rxjs/operators';
import {ChartLabel} from '@ironsource/fusion-ui/components/chart/common/base';
import {IconModule} from '@ironsource/fusion-ui/components/icon/v1';
import {TooltipDirective} from '@ironsource/fusion-ui/components/tooltip/v4';
Expand All @@ -19,7 +21,7 @@ import {TestIdsService} from '@ironsource/fusion-ui/services/test-ids';
styleUrls: ['./chart-labels-v4.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ChartLabelsV4Component {
export class ChartLabelsV4Component implements OnInit, OnDestroy {
@Input() set labels(value: ChartLabel[]) {
this._labels = value;
}
Expand All @@ -36,6 +38,31 @@ export class ChartLabelsV4Component {
@Output() labelHover = new EventEmitter<ChartLabel>();

colorsService = inject(ColorsService);
private labelClick$ = new Subject();
private onDestroy$ = new Subject<void>();

ngOnInit() {
this.labelClick$.pipe(takeUntil(this.onDestroy$), debounceTime(100)).subscribe((chartLabel: ChartLabel) => {
if (!isNullOrUndefined(chartLabel.labelVisible)) {
if (!chartLabel.typeCheckbox) {
chartLabel.labelVisible.setValue(!chartLabel.labelVisible.value, {emitEvent: true});
}
this.labelClick.emit(chartLabel);
if (!chartLabel.typeCheckbox) {
if (chartLabel.labelVisible.value) {
this.labelHover.emit(chartLabel);
} else {
this.labelHover.emit(null);
}
}
}
});
}

ngOnDestroy(): void {
this.onDestroy$.next();
this.onDestroy$.complete();
}

getLabelBGColor(hexColor: string): string {
return hexColor.startsWith('#') ? this.colorsService.toRgba(hexColor, this.bgOpacity) : hexColor;
Expand All @@ -52,18 +79,8 @@ export class ChartLabelsV4Component {
}

chartLabelClicked($event: Event, chartLabel: ChartLabel): void {
$event.preventDefault();
if (!isNullOrUndefined(chartLabel.labelVisible)) {
chartLabel.labelVisible.setValue(!chartLabel.labelVisible.value, {emitEvent: true});
this.labelClick.emit(chartLabel);
if (!chartLabel.typeCheckbox) {
if (chartLabel.labelVisible.value) {
this.labelHover.emit(chartLabel);
} else {
this.labelHover.emit(null);
}
}
}
$event.stopPropagation();
this.labelClick$.next(chartLabel);
}

protected readonly ChartLabelTestIdModifiers = ChartLabelTestIdModifiers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,13 @@ export abstract class ChartBaseComponent implements OnInit, OnDestroy, OnChanges
this.originalBarData = structuredClone(this.chart.data.datasets);
}
if (!label.labelVisible.value) {
const otherDataIndex = this.chart.data.labels.indexOf(label.id);
Object.keys(this.chart.data.datasets).forEach(key => {
this.chart.data.datasets[key].data.splice(otherDataIndex, 1);
});
this.chart.data.labels.splice(otherDataIndex, 1);
const otherDataIndex = this.getLabelIndex(label.id);
if (otherDataIndex !== -1) {
Object.keys(this.chart.data.datasets).forEach(key => {
this.chart.data.datasets[key].data.splice(otherDataIndex, 1);
});
this.chart.data.labels.splice(otherDataIndex, 1);
}
} else {
this.chart.data.labels = [...this.originalLabels] as string[];
this.chart.data.datasets = structuredClone(this.originalBarData);
Expand All @@ -217,6 +219,21 @@ export abstract class ChartBaseComponent implements OnInit, OnDestroy, OnChanges
this.chart.update();
}

private getLabelIndex(labelId: string | number): number {
let index = -1;
this.chart.data.labels.find((item, idx) => {
if (index === -1) {
if (Array.isArray(item) && item[0] === labelId) {
index = idx;
} else {
console.log('item', item);
index = item === labelId ? idx : -1;
}
}
});
return index;
}

private toggleLineDataset(label: ChartLabel, recalculateYMax = false): void {
this.chart.data.datasets
.filter(item => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class ChartV4WrapperComponent {
}
if (this.labelOther) {
chartDataLabels.push({
id: 'Other',
id: 'Others',
label: 'Show All',
labelVisible: new FormControl(true),
alignToRight: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,63 @@ export const CHART_BAR_GROUPED_DATA_MOCK: ChartData = {

export const CHART_BAR_GROUPED_DATA_OTHER_MOCK: ChartData = {
data: {
'Unity Ads': [2033, 804.16, 1688.59, 1383.47, 1037.83, 899.56],
'ironSource Ads': [1823, 456.16, 1290.59, 678.47, 659.83, 344.56]
'Unity Ads': [86257.75730499999, 29461.370534, 11882.475274, 87808.91530700003, 17251.551461, 45689.544187],
'ironSource Ads': [610234.3170500001, 198672.08078, 189211.81293, 107574.70432000002, 122046.86341, 59686.691540000014]
},
legends: [
{id: 0, displayName: 'Other', displayFormat: 'shortCurrency'},
{id: 9930, displayName: 'Australia', displayFormat: 'shortCurrency'},
{id: 9928, displayName: 'United States', displayFormat: 'shortCurrency'},
{id: 9935, displayName: 'Germany', displayFormat: 'shortCurrency'},
{id: 9936, displayName: 'United Kingdom', displayFormat: 'shortCurrency'},
{id: 9899, displayName: 'China', displayFormat: 'shortCurrency'}
{
id: 1,
displayName: ['Others'],
displayFormat: 'shortCurrency'
},
{
id: 1,
displayName: ['Going Balls', '(iOS)'],
displayFormat: 'shortCurrency',
imageUrl: 'https://icon-uap.iads.unity3d.com/demand-creatives/icons/icon_8de05b1a361bb7fa64c95aa67d8f814c_93009.jpeg'
},
{
id: 1,
displayName: ['Bridge Race', '(iOS)'],
displayFormat: 'shortCurrency',
imageUrl: 'https://icon-uap.iads.unity3d.com/demand-creatives/icons/icon_565bc88a61e6a38aaa34d39b4f87cdcd_70865.jpeg'
},
{
id: 1,
displayName: ['Build A Queen', '(Android)'],
displayFormat: 'shortCurrency',
imageUrl:
'https://icon-uap.iads.unity3d.com/demand-creatives/icons/icon_e0e0a727de113cc2c6e1d2d6d7e6f109_transformed_13858.jpeg'
},
{
id: 1,
displayName: ['Build A Queen', '(iOS)'],
displayFormat: 'shortCurrency',
imageUrl: 'https://icon-uap.iads.unity3d.com/demand-creatives/icons/icon_32528c4b1a6c44324054f658d24587ef_42835.jpeg'
},
{
id: 1,
displayName: ['Family Life', '(Android)'],
displayFormat: 'shortCurrency',
imageUrl:
'https://icon-uap.iads.unity3d.com/demand-creatives/icons/icon_9f03ef9fddf1eafaf1d804ffc07fb7b1_transformed_18086.jpeg'
}
]
};
/*{
data: {
'Unity Ads': [2033, 804.16, 1688.59, 1383.47, 1037.83, 899.56],
'ironSource Ads': [1823, 456.16, 1290.59, 678.47, 659.83, 344.56]
},
legends: [
{id: 0, displayName: 'Others', displayFormat: 'shortCurrency'},
{id: 9930, displayName: 'Australia', displayFormat: 'shortCurrency'},
{id: 9928, displayName: 'United States', displayFormat: 'shortCurrency'},
{id: 9935, displayName: 'Germany', displayFormat: 'shortCurrency'},
{id: 9936, displayName: 'United Kingdom', displayFormat: 'shortCurrency'},
{id: 9899, displayName: 'China', displayFormat: 'shortCurrency'}
]
};*/

const sortChartData = (data: ChartData): ChartData => {
const dataGroups = Object.keys(data.data);
Expand Down
2 changes: 1 addition & 1 deletion projects/fusion-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ironsource/fusion-ui",
"version": "8.0.0-test.1",
"version": "8.0.0",
"dependencies": {
"chart.js": "4.4.2",
"@floating-ui/dom": "^1.0.9",
Expand Down
Binary file added public/_favicon._ico
Binary file not shown.
Binary file modified public/favicon.ico
Binary file not shown.

0 comments on commit 5eb779f

Please sign in to comment.