Skip to content
This repository was archived by the owner on Nov 27, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file modified jsonforms-core-2.0.2.tgz
Binary file not shown.
Binary file modified jsonforms-editor-2.0.2.tgz
Binary file not shown.
Binary file modified jsonforms-material-renderers-2.0.2.tgz
Binary file not shown.
Binary file modified jsonforms-react-2.0.2.tgz
Binary file not shown.
172 changes: 4 additions & 168 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const theme = createMuiTheme({
primary: {
main: '#FFFFFF'
},
secondary: {
main: '#ee6e73',
dark: '#26a69a'
},
background: {
'default': '#1e1e1e'
}
Expand Down
18 changes: 9 additions & 9 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { materialFields, materialRenderers } from '@jsonforms/material-renderers
import {
Actions,
jsonformsReducer,
JsonSchema4,
JsonSchema7,
RankedTester
} from '@jsonforms/core';
import {
Expand Down Expand Up @@ -44,7 +44,7 @@ export const filterPredicate = (data: Object) => {
if (!_.isEmpty(modelMapping) &&
!_.isEmpty(modelMapping.mapping)) {
if (data[modelMapping.attribute]) {
return property.schema.id === modelMapping.mapping[data[modelMapping.attribute]];
return property.schema.$id === modelMapping.mapping[data[modelMapping.attribute]];
}
return true;
}
Expand All @@ -54,16 +54,16 @@ export const filterPredicate = (data: Object) => {
};

export const calculateLabel =
(schema: JsonSchema4) => (element: Object): string => {
(schema: JsonSchema7) => (element: Object): string => {

if (!_.isEmpty(labelProvider) && labelProvider[schema.id] !== undefined) {
if (!_.isEmpty(labelProvider) && labelProvider[schema.$id] !== undefined) {

if (typeof labelProvider[schema.id] === 'string') {
if (typeof labelProvider[schema.$id] === 'string') {
// To be backwards compatible: a simple string is assumed to be a property name
return element[labelProvider[schema.id]];
return element[labelProvider[schema.$id]];
}
if (typeof labelProvider[schema.id] === 'object') {
const info = labelProvider[schema.id] as LabelDefinition;
if (typeof labelProvider[schema.$id] === 'object') {
const info = labelProvider[schema.$id] as LabelDefinition;
let label;
if (info.constant !== undefined) {
label = info.constant;
Expand All @@ -81,7 +81,7 @@ export const calculateLabel =

const namingKeys = Object
.keys(schema.properties)
.filter(key => key === 'id' || key === 'name');
.filter(key => key === '$id' || key === 'name');
if (namingKeys.length !== 0) {
return element[namingKeys[0]];
}
Expand Down
28 changes: 13 additions & 15 deletions src/models/ui-metaschema.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { JsonSchema4 } from '@jsonforms/core';
// TODO add schema version 7
export const uiMetaSchema: JsonSchema4 = {
import { JsonSchema7 } from '@jsonforms/core';
export const uiMetaSchema: JsonSchema7 = {
'type': 'object',
'id': '#root',
'$id': '#root',
'properties': {
'type': {
'type': 'string',
Expand All @@ -26,7 +25,7 @@ export const uiMetaSchema: JsonSchema4 = {
'definitions': {
'elements': {
'type': 'array',
'id': '#elements',
'$id': '#elements',
'items': {
'anyOf': [
{
Expand All @@ -52,7 +51,7 @@ export const uiMetaSchema: JsonSchema4 = {
},
'control': {
'type': 'object',
'id': '#control',
'$id': '#control',
'properties': {
'type': {
'type': 'string',
Expand All @@ -79,7 +78,7 @@ export const uiMetaSchema: JsonSchema4 = {
},
'horizontallayout': {
'type': 'object',
'id': '#horizontallayout',
'$id': '#horizontallayout',
'properties': {
'type': {
'type': 'string',
Expand All @@ -100,7 +99,7 @@ export const uiMetaSchema: JsonSchema4 = {
},
'verticallayout': {
'type': 'object',
'id': '#verticallayout',
'$id': '#verticallayout',
'properties': {
'type': {
'type': 'string',
Expand All @@ -121,7 +120,7 @@ export const uiMetaSchema: JsonSchema4 = {
},
'categorization': {
'type': 'object',
'id': '#categorization',
'$id': '#categorization',
'properties': {
'type': {
'type': 'string',
Expand All @@ -142,7 +141,7 @@ export const uiMetaSchema: JsonSchema4 = {
},
'category': {
'type': 'object',
'id': '#category',
'$id': '#category',
'properties': {
'label': {
'type': 'string'
Expand All @@ -166,7 +165,7 @@ export const uiMetaSchema: JsonSchema4 = {
},
'group': {
'type': 'object',
'id': '#group',
'$id': '#group',
'properties': {
'type': {
'type': 'string',
Expand All @@ -188,7 +187,7 @@ export const uiMetaSchema: JsonSchema4 = {
},
'rule': {
'type': 'object',
'id': '#rule',
'$id': '#rule',
'properties': {
'effect': {
'type': 'string',
Expand Down Expand Up @@ -232,16 +231,15 @@ export const uiMetaSchema: JsonSchema4 = {
},
'scope': {
'type': 'string',
'id': '#scope',
'$id': '#scope',
'pattern': '^#\\/properties\\/{1}'
},
'options': {
'type': 'object',
'id': '#options',
'$id': '#options',
'additionalProperties': true
}
},
'additionalProperties': false,
'required': [
'elements',
'type'
Expand Down
Loading