Skip to content

Commit

Permalink
Fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
OS-giulianasilva committed May 12, 2023
1 parent 7a68c5b commit 039f2ce
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 57 deletions.
16 changes: 8 additions & 8 deletions src/OSFramework/DataGrid/Feature/IColumnAggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ namespace OSFramework.DataGrid.Feature {
*/
addClass(columnBinding: string, className: string): void;

/**
* Function that will set the conditional format to the aggregate rows
*
* @param columnID {string} => The columnID of the aggregate to add the new conditional format rules
* @param conditionalFormat {string} => String containing the conditional format rules
*/
setConditionalFormat(columnID: string, conditionalFormat: string);

/**
* Function to remove the aggregate cell class
*
* @param columnBinding {string} => The column binding of the aggregate to add the class
* @param className {string} => Classname to be added
*/
removeClass(columnBinding: string, className: string): void;

/**
* Function that will set the conditional format to the aggregate rows
*
* @param columnID {string} => The columnID of the aggregate to add the new conditional format rules
* @param conditionalFormat {string} => String containing the conditional format rules
*/
setConditionalFormat(columnID: string, conditionalFormat: string);
}
}
18 changes: 9 additions & 9 deletions src/OSFramework/DataGrid/Feature/IConditionalFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@
namespace OSFramework.DataGrid.Feature {
export interface IConditionalFormat {
/**
* Adds new conditional format rules to the desired binding.
* Adds new conditional format rules to the desired binding from the aggregate rows
*
* @param binding {string} => The column binding to add the new conditional format rules
* @param rules {Array<OSFramework.DataGrid.OSStructure.ConditionalFormat>} => Array containing the conditional format rules
* @param refresh (optional) => True if it should clear the classes previously added
*/
addRules(
addAggregateRules(
binding: string,
rules: Array<OSFramework.DataGrid.OSStructure.ConditionalFormat>,
refresh?: boolean
rules: Array<OSFramework.DataGrid.OSStructure.ConditionalFormat>
): void;

/**
* Adds new conditional format rules to the desired binding from the aggregate rows.
* Adds new conditional format rules to the desired binding.
*
* @param binding {string} => The column binding to add the new conditional format rules
* @param rules {Array<OSFramework.DataGrid.OSStructure.ConditionalFormat>} => Array containing the conditional format rules
* @param refresh (optional) => True if it should clear the classes previously added
*/
addAggregateRules(
addRules(
binding: string,
rules: Array<OSFramework.DataGrid.OSStructure.ConditionalFormat>
rules: Array<OSFramework.DataGrid.OSStructure.ConditionalFormat>,
refresh?: boolean
): void;

/**
* Removes rules of desired binding.
*
*
* @param binding {string} => The column binding to remove the conditional format rules
*/
removeRules(binding: string);
Expand Down
8 changes: 4 additions & 4 deletions src/Providers/DataGrid/Wijmo/Features/ColumnAggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace Providers.DataGrid.Wijmo.Feature {
{
private _aggregateRow: wijmo.grid.GroupRow;
private _grid: Grid.IGridWijmo;
private _showAggregateValue: boolean;
private _cellClasses: Map<string, Array<string>>;

Check warning on line 12 in src/Providers/DataGrid/Wijmo/Features/ColumnAggregate.ts

View workflow job for this annotation

GitHub Actions / eslint

Member "_cellClasses" should be declared before member "_grid"
private _showAggregateValue: boolean;

constructor(grid: Grid.IGridWijmo, showAggregateValue: boolean) {
this._grid = grid;
Expand All @@ -37,7 +37,7 @@ namespace Providers.DataGrid.Wijmo.Feature {
* @param columnBinding {string} => The column binding of the aggregate to add the class
* @param className {string} => Classname to be added
*/
public addClass(columnBinding: string, className: string) {
public addClass(columnBinding: string, className: string): void {
let cellClassArray = [];

// Get the array associated with the column binding, if it exists.
Expand Down Expand Up @@ -79,7 +79,7 @@ namespace Providers.DataGrid.Wijmo.Feature {
public setConditionalFormat(
columnID: string,
conditionalFormat: string
) {
): void {
const column = this._grid.getColumn(columnID);

if (!column) {
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace Providers.DataGrid.Wijmo.Feature {
* @param columnBinding {string} => The column binding of the aggregate to add the class
* @param className {string} => Classname to be added
*/
public removeClass(columnBinding: string, className: string) {
public removeClass(columnBinding: string, className: string): void {
// If the columnBinding does not in the _cellClasses, no action is required
if (!this._cellClasses.has(columnBinding)) return;

Expand Down
79 changes: 43 additions & 36 deletions src/Providers/DataGrid/Wijmo/Features/ConditionalFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,33 @@ namespace Providers.DataGrid.Wijmo.Feature {
this._isAggregate = isAggregate;
}

/**
* Adds or removes a ColumnAggregate cell class based on the condition. If the condition is true, we'll add the class, if it's false we'll remove it.
* @param columnBinding
* @param rowClass
* @param rowNumber
* @param shouldAdd
*/
private _addOrRemoveAggregateClass(
columnBinding: string,
className: string,
shouldAdd: boolean
) {
if (className) {
if (shouldAdd) {
this._grid.features.columnAggregate.addClass(
columnBinding,
className
);
} else {
this._grid.features.columnAggregate.removeClass(
columnBinding,
className
);
}
}
}

/**
* Adds or removes a cell class based on the condition. If the condition is true, we'll add the class, if it's false we'll remove it.
* @param columnBinding
Expand Down Expand Up @@ -233,26 +260,6 @@ namespace Providers.DataGrid.Wijmo.Feature {
}
}

private _addOrRemoveAggregateClass(
columnBinding: string,
className: string,
shouldAdd: boolean
) {
if (className) {
if (shouldAdd) {
this._grid.features.columnAggregate.addClass(
columnBinding,
className
);
} else {
this._grid.features.columnAggregate.removeClass(
columnBinding,
className
);
}
}
}

public execute(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
cellValue: any,
Expand Down Expand Up @@ -420,6 +427,22 @@ namespace Providers.DataGrid.Wijmo.Feature {
this._updateAggregateRows(s);
}

/**
* Adds new conditional format rules to the desired binding from the aggregate rows.
*
* @param binding {string} => The column binding to add the new conditional format rules
* @param rules {Array<OSFramework.DataGrid.OSStructure.ConditionalFormat>} => Array containing the conditional format rules
*/
public addAggregateRules(
binding: string,
rules: Array<OSFramework.DataGrid.OSStructure.ConditionalFormat>
): void {
this._mappedRulesAggregate.set(
binding,
this._parseRule(rules, true)
);
}

/**
* Adds new conditional format rules to the desired binding.
*
Expand All @@ -441,22 +464,6 @@ namespace Providers.DataGrid.Wijmo.Feature {
this._mappedRules.set(binding, this._parseRule(rules));
}

/**
* Adds new conditional format rules to the desired binding from the aggregate rows.
*
* @param binding {string} => The column binding to add the new conditional format rules
* @param rules {Array<OSFramework.DataGrid.OSStructure.ConditionalFormat>} => Array containing the conditional format rules
*/
public addAggregateRules(
binding: string,
rules: Array<OSFramework.DataGrid.OSStructure.ConditionalFormat>
): void {
this._mappedRulesAggregate.set(
binding,
this._parseRule(rules, true)
);
}

public build(): void {
this._grid.provider.updatingView.addHandler(
this._updatingViewHandler.bind(this)
Expand Down

0 comments on commit 039f2ce

Please sign in to comment.