Skip to content

Commit a0425f7

Browse files
authored
chore(angular): add toggle subtitle on all examples & improve eslint (#1984)
* chore(angular): add toggle subtitle on all examples & improve eslint
1 parent 5902854 commit a0425f7

102 files changed

Lines changed: 819 additions & 286 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

frameworks/angular-slickgrid/eslint.config.mjs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
import angular from 'angular-eslint';
22
import eslint from '@eslint/js';
33
import cypress from 'eslint-plugin-cypress/flat';
4+
import globals from 'globals';
45
import n from 'eslint-plugin-n';
56
import tseslint from 'typescript-eslint';
67

78
export default tseslint.config(
89
{
9-
ignores: ['.angular/*', 'coverage/'],
10+
ignores: [
11+
'**/*.spec.ts',
12+
'**/*.cy.ts',
13+
'.angular/*',
14+
'dist/',
15+
'coverage/',
16+
'test/',
17+
'**/environment.*.ts',
18+
'**/grid-remote.component.ts',
19+
'**/public_api.ts',
20+
],
1021
},
1122
{
1223
extends: [
@@ -22,12 +33,25 @@ export default tseslint.config(
2233
},
2334
// Everything in this config object targets our TypeScript files (Components, Directives, Pipes etc)
2435
files: ['**/*.ts'],
36+
languageOptions: {
37+
globals: {
38+
...globals.es2021,
39+
...globals.browser,
40+
},
41+
parser: tseslint.parser,
42+
parserOptions: {
43+
project: ['./tsconfig.app.json'],
44+
tsconfigRootDir: import.meta.dirname,
45+
},
46+
},
2547
// Set the custom processor which will allow us to have our inline Component templates extracted
2648
// and treated as if they are HTML files (and therefore have the .html config below applied to them)
2749
processor: angular.processInlineTemplates,
2850
rules: {
2951
'@angular-eslint/directive-selector': ['error', { type: 'attribute', prefix: 'app', style: 'camelCase' }],
3052
'@angular-eslint/component-selector': ['error', { type: 'element', style: 'kebab-case' }],
53+
'@typescript-eslint/consistent-type-exports': 'error',
54+
// '@typescript-eslint/consistent-type-imports': ['warn', { prefer: 'type-imports' }],
3155
'@typescript-eslint/array-type': 'off',
3256
'@typescript-eslint/ban-ts-comment': 'off',
3357
'@typescript-eslint/no-empty-function': 'off',

frameworks/angular-slickgrid/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"@angular/platform-browser": "^19.2.11",
8888
"@angular/platform-browser-dynamic": "^19.2.11",
8989
"@angular/router": "^19.2.11",
90+
"@eslint/js": "catalog:",
9091
"@faker-js/faker": "catalog:",
9192
"@fnando/sparkline": "catalog:",
9293
"@formkit/tempo": "catalog:",
@@ -116,6 +117,7 @@
116117
"eslint": "^9.26.0",
117118
"eslint-plugin-cypress": "^4.3.0",
118119
"eslint-plugin-n": "^17.18.0",
120+
"globals": "catalog:",
119121
"jsdom": "catalog:",
120122
"native-copyfiles": "catalog:",
121123
"ng-packagr": "^19.2.2",

frameworks/angular-slickgrid/src/demos/app-routing.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgModule } from '@angular/core';
2-
import { Routes, RouterModule, provideRouter } from '@angular/router';
2+
import { type Routes, RouterModule, provideRouter } from '@angular/router';
33
import { TranslateModule } from '@ngx-translate/core';
44

55
import { HomeComponent } from './examples/home.component';

frameworks/angular-slickgrid/src/demos/examples/custom-angularComponentEditor.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { ComponentRef } from '@angular/core';
2-
import { Subscription } from 'rxjs';
1+
import type { ComponentRef } from '@angular/core';
2+
import type { Subscription } from 'rxjs';
33
import {
44
AngularUtilService,
5-
Column,
6-
ColumnEditor,
7-
Editor,
8-
EditorValidator,
9-
EditorValidationResult,
10-
GridOption,
11-
SlickGrid,
5+
type Column,
6+
type ColumnEditor,
7+
type Editor,
8+
type EditorValidator,
9+
type EditorValidationResult,
10+
type GridOption,
11+
type SlickGrid,
1212
unsubscribeAllObservables,
1313
} from '../../library';
1414

frameworks/angular-slickgrid/src/demos/examples/custom-angularComponentFilter.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { ComponentRef } from '@angular/core';
2-
import { Subscription } from 'rxjs';
1+
import type { ComponentRef } from '@angular/core';
2+
import type { Subscription } from 'rxjs';
33
import {
44
AngularUtilService,
5-
Column,
6-
ColumnFilter,
7-
Filter,
8-
FilterArguments,
9-
FilterCallback,
10-
GridOption,
5+
type Column,
6+
type ColumnFilter,
7+
type Filter,
8+
type FilterArguments,
9+
type FilterCallback,
10+
type GridOption,
1111
OperatorType,
12-
OperatorString,
13-
SearchTerm,
14-
SlickGrid,
12+
type OperatorString,
13+
type SearchTerm,
14+
type SlickGrid,
1515
unsubscribeAllObservables,
1616
} from '../../library';
1717

frameworks/angular-slickgrid/src/demos/examples/custom-inputEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Column, ColumnEditor, Editor, EditorValidator, EditorValidationResult } from '../../library';
1+
import type { Column, ColumnEditor, Editor, EditorValidator, EditorValidationResult } from '../../library';
22

33
/*
44
* An example of a 'detached' editor.

frameworks/angular-slickgrid/src/demos/examples/custom-inputFilter.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {
2-
Column,
3-
ColumnFilter,
4-
Filter,
5-
FilterArguments,
6-
FilterCallback,
7-
GridOption,
2+
type Column,
3+
type ColumnFilter,
4+
type Filter,
5+
type FilterArguments,
6+
type FilterCallback,
7+
type GridOption,
88
OperatorType,
9-
OperatorString,
10-
SearchTerm,
11-
SlickGrid,
9+
type OperatorString,
10+
type SearchTerm,
11+
type SlickGrid,
1212
} from '../../library';
1313

1414
export class CustomInputFilter implements Filter {

frameworks/angular-slickgrid/src/demos/examples/example01.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Component, OnDestroy, OnInit } from '@angular/core';
2-
import { Column, GridOption, Formatters, AngularGridInstance } from '../../library';
1+
import { Component, type OnDestroy, type OnInit } from '@angular/core';
2+
import { type AngularGridInstance, type Column, type GridOption, Formatters } from '../../library';
33

44
import { zeroPadding } from './utilities';
55

frameworks/angular-slickgrid/src/demos/examples/example02.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ <h2>
1010
<span class="mdi mdi-link-variant"></span> code
1111
</a>
1212
</span>
13+
<button class="ms-2 btn btn-outline-secondary btn-sm btn-icon" type="button" data-test="toggle-subtitle" (click)="toggleSubTitle()">
14+
<span class="mdi mdi-information-outline" title="Toggle example sub-title details"></span>
15+
</button>
1316
</h2>
17+
1418
<div class="subtitle">
1519
Grid with Custom and/or included Slickgrid Formatters (<a
1620
href="https://ghiscoding.gitbook.io/angular-slickgrid/column-functionalities/formatters"

frameworks/angular-slickgrid/src/demos/examples/example02.component.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Component, OnInit } from '@angular/core';
2-
import { AngularGridInstance, Column, Formatter, Formatters, GridOption } from '../../library';
1+
import { Component, type OnInit } from '@angular/core';
2+
import { type AngularGridInstance, type Column, type Formatter, Formatters, type GridOption } from '../../library';
33

44
interface DataItem {
55
id: number;
@@ -35,10 +35,11 @@ const customEnableButtonFormatter: Formatter<DataItem> = (_row: number, _cell: n
3535
standalone: false,
3636
})
3737
export class Example2Component implements OnInit {
38+
angularGrid!: AngularGridInstance;
3839
columnDefinitions: Column<DataItem>[] = [];
3940
gridOptions!: GridOption;
4041
dataset!: any[];
41-
angularGrid!: AngularGridInstance;
42+
hideSubTitle = false;
4243
resizerPaused = false;
4344

4445
angularGridReady(angularGrid: AngularGridInstance) {
@@ -215,4 +216,11 @@ export class Example2Component implements OnInit {
215216
}, 250);
216217
}
217218
}
219+
220+
toggleSubTitle() {
221+
this.hideSubTitle = !this.hideSubTitle;
222+
const action = this.hideSubTitle ? 'add' : 'remove';
223+
document.querySelector('.subtitle')?.classList[action]('hidden');
224+
this.angularGrid.resizerService.resizeGrid(0);
225+
}
218226
}

0 commit comments

Comments
 (0)