Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial contribution for vue-vuetify renderer set #2341

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8b22433
intiial contribution for vue-vuetify renderer set
kchobantonov May 30, 2024
848a9b9
fix icons change example
kchobantonov May 30, 2024
0ab7fe7
export icon aliases, add documentation how to setup icon fonts
kchobantonov May 30, 2024
9801dc4
add example how to handle a simple data such as string
kchobantonov May 30, 2024
806c403
document that renderers should not be proxied
kchobantonov May 30, 2024
7ac09e6
make ajv raw
kchobantonov May 31, 2024
92205b8
allow actions in the demo
kchobantonov May 31, 2024
12b46d0
fix translations the way how the jsonforms core does it, ui changes o…
kchobantonov May 31, 2024
ff3cafc
use older version of the lock to match pnpm 8x version used during build
kchobantonov Jun 6, 2024
1a262ca
fix doc
kchobantonov Jun 6, 2024
77f2714
increase the heap to test the build
kchobantonov Jun 6, 2024
576a1a9
Apply - Touch error filtering - from the requested PRs
kchobantonov Jun 6, 2024
cfe1e57
export all renderer entries
kchobantonov Jun 6, 2024
406ecc1
use useJsonFormsCategorization, vertical category fixes, fix typescri…
kchobantonov Jun 7, 2024
6e302e0
fix layout and allow setting labels and translations
kchobantonov Jun 7, 2024
0b6b65a
synchronize the component when the data changes from outside like fro…
kchobantonov Jun 7, 2024
2a2b3e0
use computed to make sure that the data that was sent to the control …
kchobantonov Jun 7, 2024
a9c3213
use v-container instead of v-toolbar to not truncate children
kchobantonov Jun 7, 2024
0b0b8e7
the internationalization support is already supported by the core so …
kchobantonov Jun 7, 2024
4695dc8
add support for predefine list of property names
kchobantonov Jun 7, 2024
1c4ffa4
update the AdditionalProperties to reuse any registered renderers in …
kchobantonov Jun 11, 2024
f9733f9
reinitialize the state when appstore jsonforms changes
kchobantonov Jun 11, 2024
8cffca6
Update packages/core/src/util/schema.ts
kchobantonov Jun 13, 2024
ada9ce0
Merge branch 'master' into vue-vuetify
kchobantonov Jun 13, 2024
fccbce5
update version after merge with master
kchobantonov Jun 13, 2024
d0e1354
export types
kchobantonov Jun 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ In this case, you can try to clean the repository with `git clean -dfx`. Beware
- Run React Material examples: `cd packages/material-renderers && pnpm run dev`
- Run Angular Material examples: `cd packages/angular-material && pnpm run dev`
- Run Vue Vanilla dev setup: `cd packages/vue-vanilla && pnpm run serve`
- Run Vue Vuetify dev setup: `cd packages/vue-vuetify && pnpm run dev`

### Dependency & Release management

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/util/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import find from 'lodash/find';
import { JsonSchema } from '../models';

export const getFirstPrimitiveProp = (schema: any) => {
if (schema.properties) {
if (schema && schema.properties) {
kchobantonov marked this conversation as resolved.
Show resolved Hide resolved
return find(Object.keys(schema.properties), (propName) => {
const prop = schema.properties[propName];
return (
Expand Down
1 change: 1 addition & 0 deletions packages/examples-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ <h1>JSON Forms Examples</h1>
<li><a href="react-material">React Material Renderers</a></li>
<li><a href="angular-material">Angular Material Renderers</a></li>
<li><a href="vue-vanilla">Vue Vanilla Renderers</a></li>
<li><a href="vue-vuetify">Vue Vuetify Renderers</a></li>
</ul>
</body>
</html>
1 change: 1 addition & 0 deletions packages/examples-app/prepare-examples-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const examples = {
'react-material': join(packagesDir, 'material-renderers', 'example', 'dist'),
'angular-material': join(packagesDir, 'angular-material', 'example', 'dist'),
'vue-vanilla': join(packagesDir, 'vue-vanilla', 'example', 'dist'),
'vue-vuetify': join(packagesDir, 'vue-vuetify', 'example', 'dist'),
};

// Clean and recreate dist dir
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"doc": "typedoc --name 'JSON Forms Examples' --excludeExternals --out docs src"
},
"dependencies": {
"ajv-i18n": "^3.5.0",
"ajv-i18n": "^4.2.0",
"lodash": "^4.17.21"
},
"peerDependencies": {
Expand Down
131 changes: 131 additions & 0 deletions packages/examples/src/examples/additional-properties.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*
The MIT License

Copyright (c) 2017-2019 EclipseSource Munich
https://github.com/eclipsesource/jsonforms

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
import { registerExamples } from '../register';

export const schema = {
$schema: 'http://json-schema.org/draft-07/schema#',
type: 'object',
properties: {
propertiesString: {
type: 'string',
},
},
propertyNames: {
minLength: 2,
},
patternProperties: {
'^string$': {
type: 'string',
},
'^number$': {
type: 'number',
},
'^integer$': {
type: 'integer',
},
'^object$': {
type: 'object',
properties: {
prop1: {
type: 'string',
},
},
},
'^boolean$': {
type: 'boolean',
},
'^stringArray$': {
type: 'array',
items: {
type: 'string',
},
},
'^numberArray$': {
type: 'array',
items: {
type: 'number',
},
},
'^integerArray$': {
type: 'array',
items: {
type: 'integer',
},
},
'^objectArray$': {
type: 'array',
items: {
type: 'object',
properties: {
prop1: {
type: 'string',
},
},
},
},
'^booleanArray$': {
type: 'array',
items: {
type: 'boolean',
},
},
},
additionalProperties: {
type: 'string',
title: 'Additional Properties',
},
maxProperties: 15,
};

export const uischema = {
type: 'Control',
scope: '#/',
};

const data = {
propertiesString: 'data',
string: 'string value',
number: 10.2,
integer: 11,
object: {
prop1: 'prop 1 value',
},
boolean: true,
stringArray: ['value1', 'value2'],
numberArray: [12.2],
integerArray: [33],
objectArray: [{ prop1: 'prop1 val' }, {}],
booleanArray: [false, true],
};

registerExamples([
{
name: 'additional-properties',
label: 'Additional Properties',
data,
schema,
uischema,
},
]);
7 changes: 3 additions & 4 deletions packages/examples/src/examples/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ import {
Translator,
} from '@jsonforms/core';
import get from 'lodash/get';
// TODO change import when types are available for ajv-i18n (from v4.x)
// eslint-disable-next-line @typescript-eslint/no-var-requires
const localize = require('ajv-i18n');
import localize from 'ajv-i18n/localize';

export const onChange =
(dispatch: Dispatch<AnyAction>) =>
Expand All @@ -43,7 +41,8 @@ export const onChange =
if (!extensionState) {
return;
}
const localiseFunc = localize[extensionState.locale.split('-')[0]];
const localiseFunc =
localize[extensionState.locale.split('-')[0] as keyof typeof localize];
localiseFunc(errors);
dispatch(updateErrors(errors));
};
Expand Down
78 changes: 78 additions & 0 deletions packages/examples/src/examples/login.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
The MIT License

Copyright (c) 2017-2019 EclipseSource Munich
https://github.com/eclipsesource/jsonforms

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
import { registerExamples } from '../register';

export const schema = {
type: 'object',
properties: {
username: {
type: 'string',
description: 'Login Name',
},
password: {
type: 'string',
format: 'password',
description: 'Login password',
},
},
required: ['username', 'password'],
};

export const uischema = {
type: 'VerticalLayout',
elements: [
{
type: 'Label',
text: 'Login Information',
},
{
type: 'HorizontalLayout',
elements: [
{
type: 'Control',
scope: '#/properties/username',
},
{
type: 'Control',
scope: '#/properties/password',
},
],
},
],
};

const data = {
username: 'john.doe@email.com',
};

registerExamples([
{
name: 'login',
label: 'Login Form',
data,
schema,
uischema,
},
]);
22 changes: 12 additions & 10 deletions packages/examples/src/examples/person.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,18 @@ export const uischema = {
{
type: 'Control',
scope: '#/properties/occupation',
suggestion: [
'Accountant',
'Engineer',
'Freelancer',
'Journalism',
'Physician',
'Student',
'Teacher',
'Other',
],
options: {
suggestion: [
'Accountant',
'Engineer',
'Freelancer',
'Journalism',
'Physician',
'Student',
'Teacher',
'Other',
],
},
},
],
},
Expand Down
48 changes: 48 additions & 0 deletions packages/examples/src/examples/string.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
The MIT License

Copyright (c) 2017-2019 EclipseSource Munich
https://github.com/eclipsesource/jsonforms

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
import { registerExamples } from '../register';

export const schema = {
type: 'string',
title: 'String',
description: 'The form output will be a string',
};

export const uischema = {
type: 'Control',
scope: '#/',
};

export const data = 'This is a test string';

registerExamples([
{
name: 'string',
label: 'String',
data,
schema,
uischema,
},
]);
6 changes: 6 additions & 0 deletions packages/examples/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ import * as listWithDetailPrimitives from './examples/list-with-detail-primitive
import * as conditionalSchemaComposition from './examples/conditional-schema-compositions';
import * as additionalErrors from './examples/additional-errors';
import * as multiEnumWithLabelAndDesc from './examples/enum-multi-with-label-and-desc';
import * as additionalProperties from './examples/additional-properties';
import * as login from './examples/login';
import * as string from './examples/string';
export * from './register';
export * from './example';

Expand Down Expand Up @@ -129,6 +132,9 @@ export {
listWithDetailPrimitives,
conditionalSchemaComposition,
additionalErrors,
additionalProperties,
login,
issue_1884,
arrayWithDefaults,
string,
};
27 changes: 27 additions & 0 deletions packages/vue-vuetify/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require('@rushstack/eslint-patch/modern-module-resolution');

module.exports = {
root: true,
env: {
node: true,
},
// There is no file include in ESLint. Thus, ignore all and include files via negative ignore (!)
ignorePatterns: ['/*', '!/src', '!/tests', '!/example', '/example/dist'],
extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting',
'plugin:vue-scoped-css/vue3-recommended',
],
parserOptions: {
ecmaVersion: 2020,
},
rules: {
'no-console': 'warn',
'no-debugger': 'warn',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
};
Loading