Skip to content

Commit af36c1c

Browse files
Revert "generate input/output bindings to the GridJS package"
1 parent ebe676b commit af36c1c

19 files changed

+162
-791
lines changed

apps/demo/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"polyfills": ["zone.js"],
1717
"tsConfig": "apps/demo/tsconfig.app.json",
1818
"assets": ["apps/demo/src/favicon.ico", "apps/demo/src/assets"],
19-
"styles": ["node_modules/gridjs/dist/theme/mermaid.min.css"],
19+
"styles": ["apps/demo/src/styles.css"],
2020
"scripts": []
2121
},
2222
"configurations": {

apps/demo/src/app/app.component.css

Whitespace-only changes.

apps/demo/src/app/app.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<router-outlet></router-outlet>
2+
<gridjs-angular [data]="data" [columns]="columns"></gridjs-angular>

apps/demo/src/app/app.component.ts

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,19 @@
11
import { Component } from '@angular/core';
2+
import { RouterModule } from '@angular/router';
23
import { GridJsAngularComponent } from 'gridjs-angular';
3-
import { faker } from '@faker-js/faker';
4-
import { TData } from 'gridjs/dist/src/types';
4+
import 'gridjs/dist/theme/mermaid.css';
55

66
@Component({
7-
selector: 'gridjs-angular-root',
87
standalone: true,
9-
imports: [GridJsAngularComponent],
10-
template: `<gridjs-angular
11-
[data]="data"
12-
[columns]="columns"
13-
[sort]="true"
14-
[search]="true"
15-
[pagination]="true"
16-
(gridLoad)="onLoad($event)"
17-
(beforeLoad)="onBeforeLoad($event)"
18-
(ready)="onReady($event)"
19-
(cellClick)="onCellClick($event)"
20-
(rowClick)="onRowClick($event)"
21-
></gridjs-angular>`,
8+
imports: [GridJsAngularComponent, RouterModule],
9+
selector: 'gridjs-angular-root',
10+
templateUrl: './app.component.html',
11+
styleUrl: './app.component.css',
2212
})
2313
export class AppComponent {
24-
onLoad = (event: any) => console.log('Grid loaded', event);
25-
onBeforeLoad = (event: any) => console.log('Before grid loaded', event);
26-
onReady = (event: any) => console.log('Grid ready', event);
27-
onCellClick = (event: any) => console.log('Grid cell clicked', event);
28-
onRowClick = (event: any) => console.log('Grid row clicked', event);
29-
3014
columns = ['Name', 'Email', 'Phone Number'];
31-
data: TData = new Array(20)
32-
.fill(undefined)
33-
.map(() => [
34-
faker.person.fullName(),
35-
faker.internet.email(),
36-
faker.phone.number(),
37-
]);
15+
data = [
16+
['John', '[email protected]', '(353) 01 222 3333'],
17+
['Mark', '[email protected]', '(01) 22 888 4444'],
18+
];
3819
}

apps/demo/src/app/app.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { ApplicationConfig } from '@angular/core';
2+
import { provideRouter } from '@angular/router';
3+
import { appRoutes } from './app.routes';
4+
5+
export const appConfig: ApplicationConfig = {
6+
providers: [provideRouter(appRoutes)],
7+
};

apps/demo/src/app/app.routes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Route } from '@angular/router';
2+
3+
export const appRoutes: Route[] = [];

apps/demo/src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { bootstrapApplication } from '@angular/platform-browser';
2+
import { appConfig } from './app/app.config';
23
import { AppComponent } from './app/app.component';
34

4-
bootstrapApplication(AppComponent).catch((err) =>
5+
bootstrapApplication(AppComponent, appConfig).catch((err) =>
56
console.error(err)
67
);

apps/demo/src/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* You can add global styles to this file, and also import other style files */

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"@angular/cli": "~17.1.2",
3333
"@angular/compiler-cli": "~17.1.2",
3434
"@angular/language-service": "~17.1.2",
35-
"@faker-js/faker": "^8.4.0",
3635
"@nx/devkit": "17.3.1",
3736
"@nx/eslint": "17.3.1",
3837
"@nx/eslint-plugin": "17.3.1",
@@ -50,15 +49,13 @@
5049
"@typescript-eslint/eslint-plugin": "^6.20.0",
5150
"@typescript-eslint/parser": "^6.20.0",
5251
"autoprefixer": "^10.4.17",
53-
"change-case": "^5.4.2",
5452
"eslint": "~8.56.0",
5553
"eslint-config-prettier": "^9.1.0",
5654
"eslint-plugin-playwright": "^0.22.1",
5755
"jest": "^29.7.0",
5856
"jest-environment-jsdom": "^29.7.0",
5957
"jest-preset-angular": "~14.0.0",
6058
"jsonc-eslint-parser": "^2.4.0",
61-
"mustache": "^4.2.0",
6259
"ng-packagr": "~17.1.2",
6360
"nx": "17.3.1",
6461
"postcss": "^8.4.33",

packages/gridjs-angular/README.md

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
Angular wrapper for [Grid.js](https://github.com/grid-js/gridjs)
44

5-
[![gridjs-angular repository on GitHub](https://img.shields.io/badge/github-gridjs--angular-green?logo=github&link=https%3A%2F%2Fgithub.com%2Fgrid-js%2Fgridjs-angular)](https://github.com/grid-js/gridjs-angular)
6-
![GridJS peer Dependency Version](https://img.shields.io/npm/dependency-version/gridjs-angular/peer/gridjs)
7-
85
## Install
96

107
```bash
@@ -30,7 +27,7 @@ In your component template
3027

3128
```ts
3229
import { Component } from '@angular/core';
33-
import { Config } from 'gridjs';
30+
import { UserConfig } from 'gridjs';
3431

3532
@Component({
3633
template: `
@@ -44,7 +41,7 @@ import { Config } from 'gridjs';
4441
`
4542
})
4643
class ExampleComponent {
47-
public gridConfig: Config = {
44+
public gridConfig: UserConfig = {
4845
columns: ['Name', 'Email', 'Phone Number'],
4946
data: [
5047
['John', '[email protected]', '(353) 01 222 3333'],
@@ -73,10 +70,13 @@ class ExampleComponent {
7370
}
7471
```
7572

76-
Finally don't forget to add gridjs theme to your `angular.json` file, or import it some other way.
73+
Finally don't forget to add gridjs theme in your index.html
7774

78-
```json
79-
styles: ["node_modules/gridjs/dist/theme/mermaid.min.css"]
75+
```html
76+
<link
77+
href="https://unpkg.com/gridjs/dist/theme/mermaid.min.css"
78+
rel="stylesheet"
79+
/>
8080
```
8181

8282
## Inputs
@@ -89,7 +89,7 @@ styles: ["node_modules/gridjs/dist/theme/mermaid.min.css"]
8989

9090
## Outputs
9191

92-
- You can bind to all Grid.js events as outputs. Additionally, the `load` event can also be accessed via `gridLoad` (to avoid conflict with the native DOM `load` event). See [Grid.js Events](https://gridjs.io/docs/examples/event-handler)
92+
- You can pass all Grid.js events as outputs with a little difference `load` event renamed to `beforeLoad`. See [Grid.js Events](https://gridjs.io/docs/examples/event-handler)
9393

9494
### Can I Grid.js rendering helpers? Yes
9595

@@ -114,19 +114,4 @@ styles: ["node_modules/gridjs/dist/theme/mermaid.min.css"]
114114
}
115115
```
116116

117-
### Can I use Angular template syntax in plugins, formatters, etc?
118-
119-
Not currently.
120-
121-
You can't use Angular template syntax in Grid.js plugins, formatters, etc. because they cannot be connected to Angular's change detection system. You can use `h` function or `html` function to create custom HTML for your grid.
122-
123-
## Development
124-
125-
The `gridjs-angular` repository is a monorepo that uses [Nx](https://nx.dev) and [pnpm](https://pnpm.io/).
126-
127-
### Useful commands
128-
129-
- `pnpm install` - Install all dependencies
130-
- `nx serve demo` - Run demo app
131-
- `nx migrate latest` - Update Nx to the latest version, and upgrade all packages from package.json to their latest version
132-
- `nx update-bindings gridjs-angular` - Update the input and output bindings from GridJS to the Angular component. This command should be run after updating the GridJS version.
117+
### Can I use Angular components in plugins, formatters, etc? Not yet

0 commit comments

Comments
 (0)