diff --git a/jsonforms-core-2.0.2.tgz b/jsonforms-core-2.0.2.tgz index 37a66c9..6ddc12f 100644 Binary files a/jsonforms-core-2.0.2.tgz and b/jsonforms-core-2.0.2.tgz differ diff --git a/jsonforms-editor-2.0.2.tgz b/jsonforms-editor-2.0.2.tgz index 56fd954..f824702 100644 Binary files a/jsonforms-editor-2.0.2.tgz and b/jsonforms-editor-2.0.2.tgz differ diff --git a/jsonforms-material-renderers-2.0.2.tgz b/jsonforms-material-renderers-2.0.2.tgz index 4e3fb73..80f7506 100644 Binary files a/jsonforms-material-renderers-2.0.2.tgz and b/jsonforms-material-renderers-2.0.2.tgz differ diff --git a/jsonforms-react-2.0.2.tgz b/jsonforms-react-2.0.2.tgz index aa1ef12..85983fa 100644 Binary files a/jsonforms-react-2.0.2.tgz and b/jsonforms-react-2.0.2.tgz differ diff --git a/package-lock.json b/package-lock.json index 68fc6c8..4237240 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ }, "@jsonforms/core": { "version": "file:jsonforms-core-2.0.2.tgz", - "integrity": "sha512-Sl3PA+lf81vmP0iCUffdGPBQBabBVZpx2mOr58EO99Dxluj6aWxbuGpyzCfNwZJQUvmHEedPW1mnD1keYrmvcg==", + "integrity": "sha512-TKI4+Uv7EJqvaSELzpYbKSCtCC+D1zn27i9tL0WAxQ0gyPINNkP0KiSR0E4gpUj9BIVDiAohBayrlgAC+59dKw==", "requires": { "ajv": "6.4.0", "json-refs": "3.0.4", @@ -79,7 +79,7 @@ }, "@jsonforms/editor": { "version": "file:jsonforms-editor-2.0.2.tgz", - "integrity": "sha512-GmnXYl9ceO/ttO8xk/wJ2Tt7cfoe6VaKybtTZsxhq06qlyTP4jvhg5W2iJVOCP1jofyzAgcBGV18V80Eh0JUgg==", + "integrity": "sha512-PeMG+qTmIVMTZ157DI0Q9Zqtq0yVwDkm4vwS04CNlIQKeCP9h1Si5Q7yBV7PtUSeqB13LCpfZ7Tz5i/xCGPd1Q==", "requires": { "@jsonforms/core": "file:jsonforms-core-2.0.2.tgz", "@jsonforms/react": "file:jsonforms-react-2.0.2.tgz", @@ -99,70 +99,6 @@ "uuid": "3.2.1" }, "dependencies": { - "@material-ui/core": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@material-ui/core/-/core-1.2.2.tgz", - "integrity": "sha512-jg7zDmbPvZsaHkbOJJ+SVMiw1+xcv1GgKRCFV63rCh/IgLN9480K2FjfE2qeFropy2WLw0JBtTwefNzJv3BS3A==", - "requires": { - "@babel/runtime": "7.0.0-beta.47", - "@types/jss": "9.5.3", - "@types/react-transition-group": "2.0.9", - "brcast": "3.0.1", - "classnames": "2.2.5", - "csstype": "2.5.3", - "debounce": "1.1.0", - "deepmerge": "2.1.0", - "dom-helpers": "3.3.1", - "hoist-non-react-statics": "2.5.0", - "jss": "9.8.1", - "jss-camel-case": "6.1.0", - "jss-default-unit": "8.0.2", - "jss-global": "3.0.0", - "jss-nested": "6.0.1", - "jss-props-sort": "6.0.0", - "jss-vendor-prefixer": "7.0.0", - "keycode": "2.2.0", - "normalize-scroll-left": "0.1.2", - "prop-types": "15.6.1", - "react-event-listener": "0.6.1", - "react-jss": "8.4.0", - "react-popper": "1.0.0", - "react-transition-group": "2.3.1", - "recompose": "0.27.1", - "scroll": "2.0.3", - "warning": "4.0.1" - }, - "dependencies": { - "react-popper": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/react-popper/-/react-popper-1.0.0.tgz", - "integrity": "sha1-uZRSFE6P5KzHf6PZWajHngemUIQ=", - "requires": { - "babel-runtime": "6.26.0", - "create-react-context": "0.2.2", - "popper.js": "1.14.3", - "prop-types": "15.6.1", - "typed-styles": "0.0.5", - "warning": "3.0.0" - }, - "dependencies": { - "warning": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz", - "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=", - "requires": { - "loose-envify": "1.3.1" - } - } - } - } - } - }, - "csstype": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.5.3.tgz", - "integrity": "sha512-G5HnoK8nOiAq3DXIEoY2n/8Vb7Lgrms+jGJl8E4EJpQEeVONEnPFJSl8IK505wPBoxxtrtHhrRm4WX2GgdqarA==" - }, "react-dom": { "version": "16.4.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.4.1.tgz", @@ -174,16 +110,6 @@ "prop-types": "15.6.1" } }, - "react-event-listener": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/react-event-listener/-/react-event-listener-0.6.1.tgz", - "integrity": "sha1-QceoCmazmMJ91RHiJxKwLz1OzMo=", - "requires": { - "@babel/runtime": "7.0.0-beta.47", - "prop-types": "15.6.1", - "warning": "4.0.1" - } - }, "redux": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/redux/-/redux-3.7.2.tgz", @@ -194,20 +120,12 @@ "loose-envify": "1.3.1", "symbol-observable": "1.2.0" } - }, - "warning": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.1.tgz", - "integrity": "sha512-rAVtTNZw+cQPjvGp1ox0XC5Q2IBFyqoqh+QII4J/oguyu83Bax1apbo2eqB8bHRS+fqYUBagys6lqUoVwKSmXQ==", - "requires": { - "loose-envify": "1.3.1" - } } } }, "@jsonforms/material-renderers": { "version": "file:jsonforms-material-renderers-2.0.2.tgz", - "integrity": "sha512-HcQFLbgIifNQMv89Ov4T5vOe/4rUCw4RYWaBG/XwrzBvMeQ80s++erEVCy9SKACMcM2waN8KNOzOG1jLIIXRRw==", + "integrity": "sha512-JmS5bi8T9d0tVpfQNTUyGtatrGHfgTvZcF4gLMP2BtysxjgCmobMTciJ0ecczHNuIaievpEPTj1+ZB0gqu6WQQ==", "requires": { "@jsonforms/core": "file:jsonforms-core-2.0.2.tgz", "@jsonforms/react": "file:jsonforms-react-2.0.2.tgz", @@ -219,80 +137,6 @@ "redux": "3.7.2" }, "dependencies": { - "@material-ui/core": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@material-ui/core/-/core-1.2.2.tgz", - "integrity": "sha512-jg7zDmbPvZsaHkbOJJ+SVMiw1+xcv1GgKRCFV63rCh/IgLN9480K2FjfE2qeFropy2WLw0JBtTwefNzJv3BS3A==", - "requires": { - "@babel/runtime": "7.0.0-beta.47", - "@types/jss": "9.5.3", - "@types/react-transition-group": "2.0.9", - "brcast": "3.0.1", - "classnames": "2.2.5", - "csstype": "2.5.3", - "debounce": "1.1.0", - "deepmerge": "2.1.0", - "dom-helpers": "3.3.1", - "hoist-non-react-statics": "2.5.0", - "jss": "9.8.1", - "jss-camel-case": "6.1.0", - "jss-default-unit": "8.0.2", - "jss-global": "3.0.0", - "jss-nested": "6.0.1", - "jss-props-sort": "6.0.0", - "jss-vendor-prefixer": "7.0.0", - "keycode": "2.2.0", - "normalize-scroll-left": "0.1.2", - "prop-types": "15.6.1", - "react-event-listener": "0.6.1", - "react-jss": "8.4.0", - "react-popper": "1.0.0", - "react-transition-group": "2.3.1", - "recompose": "0.27.1", - "scroll": "2.0.3", - "warning": "4.0.1" - }, - "dependencies": { - "react-popper": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/react-popper/-/react-popper-1.0.0.tgz", - "integrity": "sha1-uZRSFE6P5KzHf6PZWajHngemUIQ=", - "requires": { - "babel-runtime": "6.26.0", - "create-react-context": "0.2.2", - "popper.js": "1.14.3", - "prop-types": "15.6.1", - "typed-styles": "0.0.5", - "warning": "3.0.0" - }, - "dependencies": { - "warning": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz", - "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=", - "requires": { - "loose-envify": "1.3.1" - } - } - } - } - } - }, - "csstype": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.5.3.tgz", - "integrity": "sha512-G5HnoK8nOiAq3DXIEoY2n/8Vb7Lgrms+jGJl8E4EJpQEeVONEnPFJSl8IK505wPBoxxtrtHhrRm4WX2GgdqarA==" - }, - "react-event-listener": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/react-event-listener/-/react-event-listener-0.6.1.tgz", - "integrity": "sha1-QceoCmazmMJ91RHiJxKwLz1OzMo=", - "requires": { - "@babel/runtime": "7.0.0-beta.47", - "prop-types": "15.6.1", - "warning": "4.0.1" - } - }, "redux": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/redux/-/redux-3.7.2.tgz", @@ -303,20 +147,12 @@ "loose-envify": "1.3.1", "symbol-observable": "1.2.0" } - }, - "warning": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.1.tgz", - "integrity": "sha512-rAVtTNZw+cQPjvGp1ox0XC5Q2IBFyqoqh+QII4J/oguyu83Bax1apbo2eqB8bHRS+fqYUBagys6lqUoVwKSmXQ==", - "requires": { - "loose-envify": "1.3.1" - } } } }, "@jsonforms/react": { "version": "file:jsonforms-react-2.0.2.tgz", - "integrity": "sha512-PJlu1WTSemxTbnSS0T/oudDZ7XT2VQQebzgtk+EHfTw7+vpuN8QQm403JrgaIMuiXz8fPBBuFscDOeJ0wg2TUQ==", + "integrity": "sha512-XlUsPfT0cgAy1x3Nk0gxq18Oh64Xc2xIBvbAG+DFYPbbd7ft+to094v9J6LsJZJyKIQ98l1akMaRnN+y7hFLKQ==", "requires": { "@jsonforms/core": "file:jsonforms-core-2.0.2.tgz", "lodash": "4.17.5", diff --git a/src/App.tsx b/src/App.tsx index 691b973..6a61a22 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,6 +12,10 @@ const theme = createMuiTheme({ primary: { main: '#FFFFFF' }, + secondary: { + main: '#ee6e73', + dark: '#26a69a' + }, background: { 'default': '#1e1e1e' } diff --git a/src/index.tsx b/src/index.tsx index 803c691..01f080d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -10,7 +10,7 @@ import { materialFields, materialRenderers } from '@jsonforms/material-renderers import { Actions, jsonformsReducer, - JsonSchema4, + JsonSchema7, RankedTester } from '@jsonforms/core'; import { @@ -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; } @@ -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; @@ -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]]; } diff --git a/src/models/ui-metaschema.ts b/src/models/ui-metaschema.ts index 310d2e6..3755228 100644 --- a/src/models/ui-metaschema.ts +++ b/src/models/ui-metaschema.ts @@ -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', @@ -26,7 +25,7 @@ export const uiMetaSchema: JsonSchema4 = { 'definitions': { 'elements': { 'type': 'array', - 'id': '#elements', + '$id': '#elements', 'items': { 'anyOf': [ { @@ -52,7 +51,7 @@ export const uiMetaSchema: JsonSchema4 = { }, 'control': { 'type': 'object', - 'id': '#control', + '$id': '#control', 'properties': { 'type': { 'type': 'string', @@ -79,7 +78,7 @@ export const uiMetaSchema: JsonSchema4 = { }, 'horizontallayout': { 'type': 'object', - 'id': '#horizontallayout', + '$id': '#horizontallayout', 'properties': { 'type': { 'type': 'string', @@ -100,7 +99,7 @@ export const uiMetaSchema: JsonSchema4 = { }, 'verticallayout': { 'type': 'object', - 'id': '#verticallayout', + '$id': '#verticallayout', 'properties': { 'type': { 'type': 'string', @@ -121,7 +120,7 @@ export const uiMetaSchema: JsonSchema4 = { }, 'categorization': { 'type': 'object', - 'id': '#categorization', + '$id': '#categorization', 'properties': { 'type': { 'type': 'string', @@ -142,7 +141,7 @@ export const uiMetaSchema: JsonSchema4 = { }, 'category': { 'type': 'object', - 'id': '#category', + '$id': '#category', 'properties': { 'label': { 'type': 'string' @@ -166,7 +165,7 @@ export const uiMetaSchema: JsonSchema4 = { }, 'group': { 'type': 'object', - 'id': '#group', + '$id': '#group', 'properties': { 'type': { 'type': 'string', @@ -188,7 +187,7 @@ export const uiMetaSchema: JsonSchema4 = { }, 'rule': { 'type': 'object', - 'id': '#rule', + '$id': '#rule', 'properties': { 'effect': { 'type': 'string', @@ -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' diff --git a/src/reducers/index.ts b/src/reducers/index.ts index 9a3e2d5..1c02ea0 100644 --- a/src/reducers/index.ts +++ b/src/reducers/index.ts @@ -1,4 +1,4 @@ -import { JsonSchema } from '@jsonforms/core'; +import { JsonSchema7 } from '@jsonforms/core'; export const SET_MODEL_SCHEMA: 'jsonforms/uiEditor/SET_MODEL_SCHEMA' = 'jsonforms/uiEditor/SET_MODEL_SCHEMA'; @@ -23,7 +23,7 @@ export interface UIEditorState { /** * The data schema that can be used alongside the generated UIschema */ - modelSchema: JsonSchema; + modelSchema: JsonSchema7; } export const uiEditorReducer = ( diff --git a/src/validation.ts b/src/validation.ts index e67ccf1..6b8f062 100644 --- a/src/validation.ts +++ b/src/validation.ts @@ -1,8 +1,6 @@ import * as AJV from 'ajv'; import { ErrorObject } from 'ajv'; -// TODO migrate to draft 7 -// import { JsonSchema } from './models/jsonSchema'; -import { JsonSchema4 } from '@jsonforms/core'; +import { JsonSchema7 } from '@jsonforms/core'; const ajv = new AJV({allErrors: true, verbose: true}); @@ -19,7 +17,7 @@ const extractErrors = (errors: ErrorObject[]): ValidationErrors[] => }; }); -export const validate = (uiMetaSchema: JsonSchema4) => { +export const validate = (uiMetaSchema: JsonSchema7) => { const validator = ajv.compile(uiMetaSchema); return (uischema: any) => { const valid = validator(uischema);