Skip to content

Commit d26ed77

Browse files
committed
add ag-grid demo
1 parent 3f71f55 commit d26ed77

File tree

11 files changed

+587
-4
lines changed

11 files changed

+587
-4
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"comments": [
3+
{
4+
"date": "2001-09-11",
5+
"message": "This is an example message"
6+
},
7+
{
8+
"date": "2021-08-13",
9+
"message": "Get ready for booohay"
10+
}
11+
]
12+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { ExampleInputDescription } from '@/core/types';
2+
import { registerExamples } from '../register';
3+
import data from './data.json';
4+
import schema from './schema.json';
5+
import uischema from './uischema.json';
6+
7+
export const input: ExampleInputDescription = { schema, uischema, data };
8+
9+
registerExamples([
10+
{
11+
name: 'ag-grid',
12+
label: 'AG Grid',
13+
input,
14+
},
15+
]);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"properties": {
5+
"comments": {
6+
"type": "array",
7+
"items": {
8+
"type": "object",
9+
"properties": {
10+
"date": {
11+
"type": "string",
12+
"format": "date"
13+
},
14+
"message": {
15+
"type": "string",
16+
"maxLength": 5
17+
},
18+
"enum": {
19+
"type": "string",
20+
"enum": ["foo", "bar"]
21+
}
22+
}
23+
}
24+
}
25+
}
26+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"type": "VerticalLayout",
3+
"elements": [
4+
{
5+
"type": "Control",
6+
"scope": "#/properties/comments",
7+
"options": {
8+
"variant": "ag-grid",
9+
"agGridOptions": {
10+
"columnDefs": [
11+
{ "field": "date", "rowDrag": true },
12+
{ "field": "message", "flex": 1 },
13+
{ "field": "enum", "resizable": false }
14+
]
15+
}
16+
}
17+
}
18+
]
19+
}

packages/example/src/examples/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { input as additionalProperties } from './additionalProperties';
2+
import { input as agGrid } from './ag-grid';
23
import { input as allOf } from './allOf';
34
import { input as allOfWithProps } from './allOf-with-props';
45
import { input as anyOf } from './anyOf';
@@ -67,6 +68,7 @@ export * from './register';
6768

6869
export {
6970
additionalProperties,
71+
agGrid,
7072
allOf,
7173
allOfWithProps,
7274
anyOf,

packages/jsonforms-vuetify-renderers/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
"@jsonforms/vue-vuetify": "3.6.0",
5050
"@monaco-editor/loader": "^1.4.0",
5151
"@vue/compiler-dom": "^3.4.21",
52+
"ag-grid-community": "^34.0.0",
53+
"ag-grid-vue3": "^34.0.0",
5254
"ajv": "^8.6.1",
5355
"ajv-errors": "^3.0.0",
5456
"ajv-i18n": "^4.2.0",
@@ -82,6 +84,8 @@
8284
"@vue/eslint-config-typescript": "^13.0.0",
8385
"@vue/test-utils": "^2.4.5",
8486
"@vue/tsconfig": "^0.5.1",
87+
"ag-grid-community": "^34.0.0",
88+
"ag-grid-vue3": "^34.0.0",
8589
"ajv": "^8.6.1",
8690
"ajv-errors": "^3.0.0",
8791
"ajv-i18n": "^4.2.0",

packages/jsonforms-vuetify-renderers/src/icons/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
import { IconSymbol } from '@jsonforms/vue-vuetify';
1+
import { IconSymbol, useIcons as baseUseIcons } from '@jsonforms/vue-vuetify';
22
import { computed, inject } from 'vue';
33

44
import { aliases as faIconAliases } from './fa';
55
export * from './icons';
66
import { aliases as mdiIconAliases } from './mdi';
77
import type { IconAliases } from './icons';
8+
import type { IconAliases as BaseIconAliases } from '@jsonforms/vue-vuetify';
89

910
export const useIcons = () => {
10-
const iconSet = computed<IconAliases>(() => {
11+
const iconSet = computed<IconAliases & BaseIconAliases>(() => {
1112
const icons = inject(IconSymbol);
1213
if (!icons) throw new Error('Missing Vuetify Icons provide!');
1314

1415
let result = mdiIconAliases;
15-
const overrides = icons.aliases;
16+
const base = baseUseIcons().current.value;
1617

1718
if (icons.defaultSet === 'fa') {
1819
result = faIconAliases;
1920
}
2021

21-
return overrides ? { ...result, ...overrides } : result;
22+
return { ...base, ...result };
2223
});
2324

2425
return {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {
2+
and,
3+
optionIs,
4+
rankWith,
5+
schemaTypeIs,
6+
uiTypeIs,
7+
type JsonFormsRendererRegistryEntry,
8+
} from '@jsonforms/core';
9+
import controlRenderer from './AgGridArrayControlRenderer.vue';
10+
11+
export const isArrayControl = and(uiTypeIs('Control'), schemaTypeIs('array'));
12+
13+
export const entry: JsonFormsRendererRegistryEntry = {
14+
renderer: controlRenderer,
15+
tester: rankWith(4, and(optionIs('variant', 'ag-grid'), isArrayControl)),
16+
};

0 commit comments

Comments
 (0)