Skip to content

Commit 4779819

Browse files
committed
feat: upgrade ag-grid to 32 (#4410)
* feat: upgrade ag-grid to 32 * fix(ag-grid): improve UI and build * chore(ag-grid): bump 1.2.0
1 parent 6caec76 commit 4779819

20 files changed

+573
-762
lines changed

packages/ag-grid-theme/.npmignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
demo.html
2-
rollup.config.js
1+
build.ts
2+
playground

packages/ag-grid-theme/README.md

+22-82
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,6 @@
11
<h1 align="center">AG Theme Vuestic</h1>
22
<p align="center"><img src="https://img.shields.io/npm/v/@vuestic/ag-grid-theme?label=ag-grid-theme"></p>
3-
Custom theme with Vuestic UI styles for AG Grid Vue 3.
4-
5-
## Installation
6-
7-
#### npm
8-
```
9-
npm i @vuestic/ag-grid-theme
10-
```
11-
#### yarn
12-
```
13-
yarn add @vuestic/ag-grid-theme
14-
```
15-
Import styles to project via entry js/ts file:
16-
17-
```js
18-
// main.js
19-
20-
import '@vuestic/ag-grid-theme/index.scss'
21-
```
22-
or via a scss:
23-
```scss
24-
// *.scss or <styles lang="scss">
25-
26-
@import "~@vuestic/ag-grid-theme";
27-
```
28-
29-
## Usage
30-
```vue
31-
<template>
32-
<div>
33-
<ag-grid-vue
34-
class="ag-theme-vuestic"
35-
style="width: 100%; height: 100%;"
36-
:columnDefs="columnDefs"
37-
:rowData="rowData"
38-
:modules="modules"
39-
/>
40-
</div>
41-
</template>
42-
```
43-
44-
```js
45-
<script>
46-
import { AgGridVue } from '@ag-grid-community/vue3'
47-
import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model'
48-
49-
export default {
50-
components: { AgGridVue },
51-
data () {
52-
return {
53-
modules: [ClientSideRowModelModule],
54-
rowData: null,
55-
columnDefs: [
56-
{ field: 'athlete' },
57-
{ field: 'age' },
58-
{ field: 'country' },
59-
{ field: 'year' },
60-
{ field: 'date' },
61-
{ field: 'sport' },
62-
{ field: 'gold' },
63-
{ field: 'silver' },
64-
{ field: 'bronze' },
65-
{ field: 'total' },
66-
],
67-
}
68-
},
69-
beforeMount () {
70-
fetch('https://www.ag-grid.com/example-assets/olympic-winners.json')
71-
.then(result => result.json())
72-
.then(rowData => { this.rowData = rowData })
73-
},
74-
}
75-
</script>
76-
```
77-
78-
```scss
79-
<style lang="scss">
80-
@import "~@vuestic/ag-grid-theme";
81-
</style>
82-
```
83-
84-
3+
Vuestic UI styles for AG Grid Vue 3.
854

865
## Documentation
876

@@ -90,6 +9,27 @@ on [vuestic.dev](https://vuestic.dev/en/extensions/ag-grid)
909

9110
For more information about AG Grid for Vue 3, visit [ag-grid.com](https://www.ag-grid.com/vue-data-grid/getting-started/)
9211

12+
13+
## Installation
14+
15+
1. Install package
16+
#### npm
17+
```
18+
npm i @vuestic/ag-grid-theme
19+
```
20+
#### yarn
21+
```
22+
yarn add @vuestic/ag-grid-theme
23+
```
24+
2. Import styles to project via entry js/ts file:
25+
```js
26+
import '@vuestic/ag-grid-theme'
27+
```
28+
or via a scss:
29+
```scss
30+
@import "@vuestic/ag-grid-theme";
31+
```
32+
9333
## License
9434
9535
[MIT](https://github.com/epicmaxco/vuestic-ui/blob/develop/LICENSE.MD) license

packages/ag-grid-theme/build.ts

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { dirname } from 'pathe';
2+
import { compileAsync, FileImporter } from 'sass'
3+
import { writeFile, stat, mkdir } from 'fs/promises'
4+
import { existsSync } from 'fs';
5+
6+
const nodeImporter: FileImporter = {
7+
findFileUrl(url, context) {
8+
if (url.startsWith('.') || url.startsWith('url') || url.startsWith('http')) {
9+
return null
10+
}
11+
12+
try {
13+
const resolved = import.meta.resolve(url)
14+
return new URL(resolved)
15+
} catch (e) {
16+
return null
17+
}
18+
},
19+
}
20+
21+
const compileScss = async (inputPath: string, outputPath: string) => {
22+
const result = await compileAsync(inputPath, {
23+
style: 'compressed',
24+
importers: [nodeImporter],
25+
})
26+
27+
const dirName = dirname(outputPath)
28+
29+
if (!existsSync(dirName)) {
30+
await mkdir(dirName, { recursive: true })
31+
}
32+
33+
// Write result to output file
34+
await writeFile(outputPath, result.css, {
35+
flag: 'w',
36+
})
37+
}
38+
39+
Promise.all([
40+
compileScss('./src/styles/index.scss', './dist/ag-theme-vuestic.css'),
41+
compileScss('./src/styles/theme.scss', './dist/ag-theme-vuestic-clean.css'),
42+
])

packages/ag-grid-theme/demo.html

-170
This file was deleted.

packages/ag-grid-theme/package.json

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
{
22
"name": "@vuestic/ag-grid-theme",
3-
"version": "1.1.4",
3+
"version": "1.2.0",
44
"description": "Custom theme with Vuestic UI styles for AG Grid Vue 3.",
55
"homepage": "https://vuestic.dev",
66
"repository": "https://github.com/epicmaxco/vuestic-ui",
77
"license": "MIT",
88
"type": "module",
99
"scripts": {
10-
"build": "rollup --config rollup.config.js --bundleConfigAsCjs",
11-
"prepack": "npm run build"
10+
"build": "tsx ./build.ts",
11+
"prepack": "npm run build",
12+
"play": "cd playground && npm run dev"
1213
},
1314
"dependencies": {
14-
"@ag-grid-community/client-side-row-model": "^29.0.0",
15-
"@ag-grid-community/core": "^29.0.0",
16-
"@ag-grid-community/styles": "^29.0.0",
17-
"@ag-grid-community/vue3": "^29.0.0"
15+
"@ag-grid-community/client-side-row-model": "^32.2.2",
16+
"@ag-grid-community/core": "^32.2.2",
17+
"@ag-grid-community/styles": "^32.2.2",
18+
"@ag-grid-community/vue3": "^32.2.2"
1819
},
1920
"peerDependencies": {
20-
"vuestic-ui": "^1.3.0"
21+
"vuestic-ui": "^1.10.0"
2122
},
2223
"devDependencies": {
2324
"sass": "^1.57.1",
@@ -35,6 +36,8 @@
3536
"main": "dist/ag-theme-vuestic.css",
3637
"exports": {
3738
".": "./dist/ag-theme-vuestic.css",
38-
"./scss": "./src/styles/index.scss"
39+
"./scss": "./src/styles/index.scss",
40+
"./clean": "./dist/ag-theme-vuestic-clean.css",
41+
"./clean/scss": "./src/styles/clean.scss"
3942
}
4043
}

0 commit comments

Comments
 (0)