diff --git a/packages/examples/src/examples/1169.ts b/packages/examples/src/examples/1169.ts deleted file mode 100644 index 76d324289..000000000 --- a/packages/examples/src/examples/1169.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - 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'; -import { UISchemaElement } from '@jsonforms/core'; - -export const schema = { - type: 'object', - properties: { - Level1: { - type: 'array', - items: { - type: 'object', - properties: { - Level2: { - type: 'object', - properties: { - Level3: { - type: 'string' - } - } - } - } - } - } - } -}; - -export const uischema: UISchemaElement = undefined; - -export const data = {}; - -registerExamples([ - { - name: '1169', - label: 'Issue 1169', - data, - schema, - uischema - } -]); diff --git a/packages/examples/src/examples/1220.ts b/packages/examples/src/examples/1220.ts deleted file mode 100644 index 9adcf0608..000000000 --- a/packages/examples/src/examples/1220.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* - 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'; -import { JsonFormsUISchemaRegistryEntry, JsonSchema, NOT_APPLICABLE } from '@jsonforms/core'; -import { StateProps } from '../example'; - -const data = { - orders: [ - { - title: '42 killer robots', - ordered: true, - assignee: 'Philip J. Fry' - } - ] -}; - -const schema = { - definitions: { - order: { - type: 'object', - properties: { - title: { - type: 'string', - minLength: 5 - }, - ordered: { type: 'boolean' }, - assignee: { type: 'string' }, - // needed to enforce nested layout instead of table - choices: { - type: 'array', - items: { - type: 'string' - } - } - }, - required: ['title'] - } - }, - type: 'object', - properties: { - orders: { - type: 'array', - items: { - $ref: '#/definitions/order' - } - } - } -}; - -export const uischema = { - type: 'Control', - scope: '#/properties/orders' -}; - -const uischemas = [ - { - tester: (_jsonSchema: JsonSchema, schemaPath: string) => { - return schemaPath === '#/properties/orders' ? 2 : NOT_APPLICABLE; - }, - uischema: { - type: 'VerticalLayout', - elements: [ - { - type: 'Control', - scope: '#/properties/title' - }, - { - type: 'Control', - scope: '#/properties/ordered' - }, - { - type: 'VerticalLayout', - elements: [ - { - type: 'Control', - scope: '#/properties/assignee' - } - ], - rule: { - effect: 'SHOW', - condition: { - type: 'LEAF', - scope: '#/properties/ordered', - expectedValue: true - } - } - } - ] - }, - }, -]; - -const actions = [ - { - 'label': 'Register Issue 1220 UISchema', - 'apply': (props: StateProps) => { - return { - ...props, - uischemas: uischemas - } - } - }, - { - 'label': 'Unregister Issue 1220 UISchema', - 'apply': (props: StateProps) => { - const uischemas: JsonFormsUISchemaRegistryEntry[] = undefined; - return { - ...props, - uischemas: uischemas - } - } - }, -]; - -registerExamples([ - { - name: '1220', - label: 'Issue 1220', - data, - schema, - uischema, - actions - } -]); diff --git a/packages/examples/src/examples/1253.ts b/packages/examples/src/examples/1253.ts deleted file mode 100644 index d0e16c9f0..000000000 --- a/packages/examples/src/examples/1253.ts +++ /dev/null @@ -1,212 +0,0 @@ -/* - 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: { - value: { - oneOf: [ - { - title: 'String', - type: 'string' - }, - { - title: 'Number', - type: 'number' - } - ] - } - } -}; - -export const uischema = { - type: 'Control', - label: 'Value', - scope: '#/properties/value' -}; - -const data = {}; - -const schema2 = { - type: 'object', - properties: { - oneOrMoreThings: { - oneOf: [ - { - $ref: '#/definitions/thing' - }, - { - $ref: '#/definitions/thingArray' - } - ] - } - }, - definitions: { - thing: { - title: 'Thing', - type: 'string' - }, - thingArray: { - title: 'Things', - type: 'array', - items: { - $ref: '#/definitions/thing' - } - } - } -}; - -const schema3 = { - type: 'object', - properties: { - thingOrThings: { - oneOf: [ - { - title: 'Thing', - type: 'object', - properties: { - thing: { - $ref: '#/definitions/thing' - } - } - }, - { - $ref: '#/definitions/thingArray' - } - ] - } - }, - definitions: { - thing: { - title: 'Thing', - type: 'string' - }, - thingArray: { - title: 'Things', - type: 'array', - items: { - $ref: '#/definitions/thing' - } - } - } -}; - -const uischema2 = { - type: 'Control', - label: 'Value', - scope: '#/properties/oneOrMoreThings' -}; - -const uischema3 = { - type: 'Control', - label: 'Value', - scope: '#/properties/thingOrThings' -}; - -const schema4 = { - definitions: { - color: { - type: 'string', - enum: ['red', 'green', 'blue'] - } - }, - type: 'object', - properties: { - things: { - type: 'array', - items: { - type: 'object', - properties: { - somethingElse: { - type: 'string' - }, - thing: { - type: 'string', - enum: ['thing'] - }, - anotherThing: { - $ref: '#/definitions/color' - } - } - } - } - } -}; - -const uischema4 = { - type: 'Control', - scope: '#/properties/things' -}; - -registerExamples([ - { - name: 'issue-1253', - label: 'issue 1253 (oneOf)', - data, - schema, - uischema - } -]); - -registerExamples([ - { - name: 'issue-1253-wrong-path-binding', - label: 'issue 1253 (oneOf) - wrong path binding', - data, - schema: schema, - uischema: uischema - } -]); - -registerExamples([ - { - name: 'issue-1253-cell-missing-cell', - label: 'issue 1253 (oneOf) - missing cell renderer', - data, - schema: schema2, - uischema: uischema2 - } -]); - -registerExamples([ - { - name: 'issue-1253-add-button-empty-row', - label: 'issue 1253 (oneOf) - add button does nothing', - data, - schema: schema3, - uischema: uischema3 - } -]); - -registerExamples([ - { - name: 'issue-1253-enum-error', - label: 'issue 1253 (enum)', - data, - schema: schema4, - uischema: uischema4 - } -]); diff --git a/packages/examples/src/examples/1254.ts b/packages/examples/src/examples/1254.ts deleted file mode 100644 index 25cfe7e3e..000000000 --- a/packages/examples/src/examples/1254.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* - 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: { - name: { - type: 'string', - minLength: 1 - }, - version: { - const: '1.0' - } - }, - required: ['version'] -}; - -export const uischema = { - type: 'HorizontalLayout', - elements: [ - { - type: 'Control', - label: 'Name', - scope: '#/properties/name' - }, - { - type: 'Control', - label: 'Version', - scope: '#/properties/version' - } - ] -}; - -const data = {}; - -registerExamples([ - { - name: 'issue-1254', - label: 'issue 1254 (JSONSchema constants)', - data, - schema, - uischema - } -]); diff --git a/packages/examples/src/examples/1645.ts b/packages/examples/src/examples/1645.ts deleted file mode 100644 index f1cadee69..000000000 --- a/packages/examples/src/examples/1645.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* - The MIT License - - Copyright (c) 2021 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'; -import { UISchemaElement } from '@jsonforms/core'; - -export const schema = { - type: 'object', - properties: { - propText0: {type: 'string'}, - propText1: {type: 'string'}, - propText2: {type: 'string'}, - propText3: {type: 'string'}, - propText4: {type: 'string'}, - propText5: {type: 'string'}, - propText6: {type: 'string'}, - propText7: {type: 'string'}, - propText8: {type: 'string'}, - propText9: {type: 'string'}, - propNumber0: {type: 'number'}, - propNumber1: {type: 'number'}, - propNumber2: {type: 'number'}, - propNumber3: {type: 'number'}, - propNumber4: {type: 'number'}, - propNumber5: {type: 'number'}, - propNumber6: {type: 'number'}, - propNumber7: {type: 'number'}, - propNumber8: {type: 'number'}, - propNumber9: {type: 'number'}, - } -}; - -export const uischema: UISchemaElement = undefined; - -export const data = {}; - -registerExamples([ - { - name: '1645', - label: 'Issue 1645', - data, - schema, - uischema - } -]); diff --git a/packages/examples/src/examples/1884.ts b/packages/examples/src/examples/1884.ts index e95cd4ec3..7f27ecead 100644 --- a/packages/examples/src/examples/1884.ts +++ b/packages/examples/src/examples/1884.ts @@ -83,6 +83,10 @@ export const schema = { export const uischema = { type: 'VerticalLayout', elements: [ + { + type: 'Label', + text: 'Toggle the committer boolean to enable/disable the address block.' + }, { type: 'HorizontalLayout', elements: [ @@ -179,7 +183,7 @@ export const data = { registerExamples([ { name: '1884', - label: 'Issue 1884 - Committer enable/disable Address', + label: 'Issue 1884 - Nested enable/disable', data, schema, uischema diff --git a/packages/examples/src/examples/1948.ts b/packages/examples/src/examples/1948.ts index a4d8abbde..042a1b438 100644 --- a/packages/examples/src/examples/1948.ts +++ b/packages/examples/src/examples/1948.ts @@ -72,14 +72,14 @@ export const data = { registerExamples([ { name: '1948_with', - label: 'Issue 1948 with schema', + label: 'Issue 1948 - Array renderer selection (with schema)', data, schema, uischema }, { name: '1948_without', - label: 'Issue 1948 w/o schema', + label: 'Issue 1948 - Array renderer selection (w/o schema)', data, schema: undefined, uischema diff --git a/packages/examples/src/examples/1996.ts b/packages/examples/src/examples/1996.ts deleted file mode 100644 index 195ae22b4..000000000 --- a/packages/examples/src/examples/1996.ts +++ /dev/null @@ -1,102 +0,0 @@ -/* - The MIT License - - Copyright (c) 2022 EclipseSource - 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'; -import { ControlElement } from '@jsonforms/core'; - -export const schemaAnyOf = { - type: "array", - items: { - anyOf: [ - { - type: "object", - properties: { - value: { - type: "string" - } - }, - required: ["value"] - }, - { - type: "object", - properties: { - value: { - type: "number" - } - }, - required: ["value"] - } - ] - } -}; - -export const schemaOneOf = { - type: "array", - items: { - oneOf: [ - { - type: "object", - properties: { - value: { - type: "string" - } - }, - required: ["value"] - }, - { - type: "object", - properties: { - value: { - type: "number" - } - }, - required: ["value"] - } - ] - } -}; - -export const uischema: ControlElement = { - type: 'Control', - scope: '#' -}; - -export const data: any[] = []; - -registerExamples([ - { - name: '1996_anyOf', - label: 'Issue 1996 - array with anyOf items', - data, - schema: schemaAnyOf, - uischema - }, - { - name: '1996_oneOf', - label: 'Issue 1996 - array with oneOf items', - data, - schema: schemaOneOf, - uischema - } -]); diff --git a/packages/examples/src/examples/anyOf.ts b/packages/examples/src/examples/anyOf.ts index bdb8d5cf3..10caf2f44 100644 --- a/packages/examples/src/examples/anyOf.ts +++ b/packages/examples/src/examples/anyOf.ts @@ -66,6 +66,15 @@ export const schema = { { $ref: '#/definitions/addresses' }, { $ref: '#/definitions/users' } ] + }, + addressesOrUsersAnyOfItems: { + type: 'array', + items: { + anyOf: [ + { $ref: '#/definitions/addresses' }, + { $ref: '#/definitions/users' } + ] + } } } }; @@ -79,7 +88,13 @@ export const uischema = { }, { type: 'Control', - scope: '#/properties/addressesOrUsers' + scope: '#/properties/addressesOrUsers', + label: 'Addresses or Users (AnyOf Schema)' + }, + { + type: 'Control', + scope: '#/properties/addressesOrUsersAnyOfItems', + label: 'Addresses or Users (AnyOf Array Items)' } ] }; diff --git a/packages/examples/src/examples/booleanToggle.ts b/packages/examples/src/examples/booleanToggle.ts deleted file mode 100644 index 630c2844f..000000000 --- a/packages/examples/src/examples/booleanToggle.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - The MIT License - - Copyright (c) 2017-2021 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: { - checkbox: { - type: 'boolean' - }, - toggle: { - type: 'boolean' - } - } -}; - -export const uischema = { - type: 'VerticalLayout', - elements: [ - { - type: 'Control', - scope: '#/properties/checkbox' - }, - { - type: 'Control', - scope: '#/properties/toggle', - options: { - toggle: true - } - } - ] -}; - -export const data = { - checkbox: false, - toggle: false -}; - -export const booleanToggleExample = { - name: 'booleanToggle', - label: 'Boolean Toggle', - data, - schema, - uischema -}; - -registerExamples([booleanToggleExample]); diff --git a/packages/examples/src/examples/steppershownav.ts b/packages/examples/src/examples/categorization-stepper-nav-buttons.ts similarity index 97% rename from packages/examples/src/examples/steppershownav.ts rename to packages/examples/src/examples/categorization-stepper-nav-buttons.ts index 52050eeea..88abe35c9 100644 --- a/packages/examples/src/examples/steppershownav.ts +++ b/packages/examples/src/examples/categorization-stepper-nav-buttons.ts @@ -43,7 +43,7 @@ export const data = categorizationData; registerExamples([ { - name: 'categorizationsteppernavbuttons', + name: 'categorization-stepper-nav-buttons', label: 'Categorization (Stepper - Nav Buttons)', data, schema, diff --git a/packages/examples/src/examples/stepper.ts b/packages/examples/src/examples/categorization-stepper.ts similarity index 100% rename from packages/examples/src/examples/stepper.ts rename to packages/examples/src/examples/categorization-stepper.ts diff --git a/packages/examples/src/examples/categorization.ts b/packages/examples/src/examples/categorization.ts index affb7a860..5156968b4 100644 --- a/packages/examples/src/examples/categorization.ts +++ b/packages/examples/src/examples/categorization.ts @@ -306,8 +306,8 @@ registerExamples([ i18n: { locale: 'en', translate: translate } }, { - name: '1713', - label: 'Bug 1713', + name: 'categorization_1713', + label: 'Categorization - Issue 1713', data, schema:schema_1713, uischema:uischema_1713 diff --git a/packages/examples/src/examples/day1.ts b/packages/examples/src/examples/day1.ts deleted file mode 100644 index bd6288c43..000000000 --- a/packages/examples/src/examples/day1.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - 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'; -import { UISchemaElement } from '@jsonforms/core'; - -export const schema = { - type: 'object', - properties: { - name: { - type: 'string', - minLength: 1 - }, - description: { - type: 'string' - }, - done: { - type: 'boolean' - } - }, - required: ['name'] -}; - -export const uischema: UISchemaElement = undefined; - -export const data = { - name: 'Send email to Adrian', - description: 'Confirm if you have passed the subject\nHereby ...', - done: true -}; - -registerExamples([ - { - name: 'day1', - label: 'Day 1', - data, - schema, - uischema - } -]); diff --git a/packages/examples/src/examples/day2.ts b/packages/examples/src/examples/day2.ts deleted file mode 100644 index 077d5aacd..000000000 --- a/packages/examples/src/examples/day2.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - 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'; -import { data as day1Data, schema as day1Schema } from './day1'; - -export const schema = day1Schema; - -export const uischema = { - type: 'VerticalLayout', - elements: [ - { - type: 'Control', - scope: '#/properties/name' - }, - { - type: 'Control', - label: false, - scope: '#/properties/done' - }, - { - type: 'Control', - scope: '#/properties/description', - options: { - multi: true - } - } - ] -}; - -export const data = day1Data; - -registerExamples([ - { - name: 'day2', - label: 'Day 2', - data, - schema, - uischema - } -]); diff --git a/packages/examples/src/examples/day3.ts b/packages/examples/src/examples/day3.ts deleted file mode 100644 index 9da91b9b4..000000000 --- a/packages/examples/src/examples/day3.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* - 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'; -import { - data as day2Data, - schema as day2Schema, - uischema as day2UiSchema -} from './day2'; - -export const schema = { - type: 'object', - properties: { - ...day2Schema.properties, - dueDate: { - type: 'string', - format: 'date' - }, - rating: { - type: 'integer', - maximum: 5 - } - }, - required: ['name'] -}; - -export const uischema = { - type: 'VerticalLayout', - elements: [ - ...day2UiSchema.elements, - { - type: 'Control', - scope: '#/properties/dueDate' - }, - { - type: 'Control', - scope: '#/properties/rating' - } - ] -}; - -export const data = { - ...day2Data, - rating: 3 -}; - -registerExamples([ - { - name: 'day3', - label: 'Day 3', - data, - schema, - uischema - } -]); diff --git a/packages/examples/src/examples/day4.ts b/packages/examples/src/examples/day4.ts deleted file mode 100644 index 0d69eecf0..000000000 --- a/packages/examples/src/examples/day4.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - 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'; -import { - data as day3Data, - schema as day3Schema, - uischema as day3UiSchema -} from './day3'; - -export const schema = { - type: 'object', - properties: { - ...day3Schema.properties, - recurrence: { - type: 'string', - enum: ['Never', 'Daily', 'Weekly', 'Monthly'] - }, - recurrenceInterval: { - type: 'integer' - } - }, - required: ['name'] -}; - -export const uischema = { - type: 'VerticalLayout', - elements: [ - ...day3UiSchema.elements, - { - type: 'Control', - scope: '#/properties/recurrence' - }, - { - type: 'Control', - scope: '#/properties/recurrenceInterval', - rule: { - effect: 'HIDE', - condition: { - scope: '#/properties/recurrence', - schema: { enum: ['Never'] } - } - } - } - ] -}; - -export const data = { - ...day3Data, - recurrence: 'Daily', - recurrenceInterval: 5 -}; - -registerExamples([ - { - name: 'day4', - label: 'Day 4', - data, - schema, - uischema - } -]); diff --git a/packages/examples/src/examples/day5.ts b/packages/examples/src/examples/day5.ts deleted file mode 100644 index c04ca0d6e..000000000 --- a/packages/examples/src/examples/day5.ts +++ /dev/null @@ -1,169 +0,0 @@ -/* - 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'; -import { data as day4Data, schema as day4Schema } from './day4'; - -export const schema = day4Schema; - -export const uischema = { - type: 'VerticalLayout', - elements: [ - { - type: 'Control', - label: false, - scope: '#/properties/done' - }, - { - type: 'Control', - scope: '#/properties/name' - }, - { - type: 'HorizontalLayout', - elements: [ - { - type: 'Control', - scope: '#/properties/dueDate' - }, - { - type: 'Control', - scope: '#/properties/rating' - } - ] - }, - { - type: 'Control', - scope: '#/properties/description', - options: { - multi: true - } - }, - { - type: 'HorizontalLayout', - elements: [ - { - type: 'Control', - scope: '#/properties/recurrence' - }, - { - type: 'Control', - scope: '#/properties/recurrenceInterval', - rule: { - effect: 'HIDE', - condition: { - scope: '#/properties/recurrence', - schema: { enum: ['Never'] } - } - } - } - ] - } - ] -}; - -export const categoryUiSchema = { - type: 'Categorization', - elements: [ - { - type: 'Category', - label: 'Main', - elements: [ - { - type: 'Control', - label: false, - scope: '#/properties/done' - }, - { - type: 'Control', - scope: '#/properties/name' - }, - { - type: 'Control', - scope: '#/properties/description', - options: { - multi: true - } - } - ] - }, - { - type: 'Category', - label: 'Additional', - elements: [ - { - type: 'HorizontalLayout', - elements: [ - { - type: 'Control', - scope: '#/properties/dueDate' - }, - { - type: 'Control', - scope: '#/properties/rating' - } - ] - }, - { - type: 'HorizontalLayout', - elements: [ - { - type: 'Control', - scope: '#/properties/recurrence' - }, - { - type: 'Control', - scope: '#/properties/recurrenceInterval', - rule: { - effect: 'HIDE', - condition: { - scope: '#/properties/recurrence', - schema: { enum: ['Never'] } - } - } - } - ] - } - ] - } - ] -}; - -export const data = day4Data; - -registerExamples([ - { - name: 'day5', - label: 'Day 5', - data, - schema, - uischema - }, - { - name: 'day5_category', - label: 'Day 5 With Category', - data, - schema, - uischema: categoryUiSchema - } -]); diff --git a/packages/examples/src/examples/day6.ts b/packages/examples/src/examples/day6.ts deleted file mode 100644 index ad26db6f5..000000000 --- a/packages/examples/src/examples/day6.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - 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'; -import { - data as day5Data, - schema as day5Schema, - uischema as day5UiSchema -} from './day5'; - -export const schema = day5Schema; -export const uischema = day5UiSchema; -export const data = day5Data; - -registerExamples([ - { - name: 'day6', - label: 'Day 6', - data, - schema, - uischema - } -]); diff --git a/packages/examples/src/examples/multi-enum.ts b/packages/examples/src/examples/enum-multi.ts similarity index 98% rename from packages/examples/src/examples/multi-enum.ts rename to packages/examples/src/examples/enum-multi.ts index 1bf7e5530..acd98f8b9 100644 --- a/packages/examples/src/examples/multi-enum.ts +++ b/packages/examples/src/examples/enum-multi.ts @@ -68,7 +68,7 @@ export const data = { oneOfMultiEnum: ['foo'], multiEnum: ['bar'] }; registerExamples([ { name: 'multi-enum', - label: 'Multi Enum', + label: 'Enum - Multi selection', data, schema, uischema diff --git a/packages/examples/src/examples/enum.ts b/packages/examples/src/examples/enum.ts index 8376577d8..1b0e8301d 100644 --- a/packages/examples/src/examples/enum.ts +++ b/packages/examples/src/examples/enum.ts @@ -50,7 +50,10 @@ export const schema = { {const: 'bar', title: 'Bar'}, {const: 'foobar', title: 'FooBar'} ] - } + }, + constEnum: { + const: 'Const Value' + } } }; @@ -61,6 +64,10 @@ export const uischema = { type: 'Group', label: 'Enums', elements: [ + { + type: 'Control', + scope: '#/properties/constEnum' + }, { type: 'Control', scope: '#/properties/plainEnum' diff --git a/packages/examples/src/examples/dynamic.ts b/packages/examples/src/examples/generate-dynamic.ts similarity index 96% rename from packages/examples/src/examples/dynamic.ts rename to packages/examples/src/examples/generate-dynamic.ts index 1eaa05f4e..1ff2950aa 100644 --- a/packages/examples/src/examples/dynamic.ts +++ b/packages/examples/src/examples/generate-dynamic.ts @@ -40,7 +40,7 @@ const actions = [ registerExamples([ { name: 'dynamic', - label: 'Dynamic Change', + label: 'Generate both schemas - Dynamic data change', schema: undefined, uischema: undefined, data: { name: 'bla' }, diff --git a/packages/examples/src/examples/1779.ts b/packages/examples/src/examples/list-with-detail-primitives.ts similarity index 95% rename from packages/examples/src/examples/1779.ts rename to packages/examples/src/examples/list-with-detail-primitives.ts index 325f171ea..93ebb01d0 100644 --- a/packages/examples/src/examples/1779.ts +++ b/packages/examples/src/examples/list-with-detail-primitives.ts @@ -45,7 +45,7 @@ const uischema = { registerExamples([ { - name: '1779-string', + name: 'list-with-detail-primitive-string', label: 'List With Detail primitive (string)', data, schema, @@ -74,7 +74,7 @@ const uischema_number = { registerExamples([ { - name: '1779-number', + name: 'list-with-detail-primitive-number', label: 'List With Detail primitive (number)', data: data_number, schema: schema_number, diff --git a/packages/examples/src/examples/list-with-detail-registered.ts b/packages/examples/src/examples/list-with-detail-registered.ts index 57915b534..8a2e5946c 100644 --- a/packages/examples/src/examples/list-with-detail-registered.ts +++ b/packages/examples/src/examples/list-with-detail-registered.ts @@ -97,7 +97,7 @@ const uischema = { registerExamples([ { name: 'list-with-detail-registered', - label: 'List With Detail (Registered)', + label: 'List With Detail (Registered Detail UISchema)', data, schema, uischema diff --git a/packages/examples/src/examples/object.ts b/packages/examples/src/examples/object.ts index 46b7278c4..d1bce2bef 100644 --- a/packages/examples/src/examples/object.ts +++ b/packages/examples/src/examples/object.ts @@ -101,7 +101,7 @@ const data = { registerExamples([ { name: 'rootObject', - label: 'Root Object', + label: 'Object - Root Scope', data, schema, uischema: uischemaRoot diff --git a/packages/examples/src/examples/onChange.ts b/packages/examples/src/examples/onChange.ts index 44908309c..b20c0fe64 100644 --- a/packages/examples/src/examples/onChange.ts +++ b/packages/examples/src/examples/onChange.ts @@ -67,7 +67,7 @@ export const data = {}; registerExamples([ { name: 'onChange', - label: 'On Change', + label: 'On Change Listener', data, schema, uischema diff --git a/packages/examples/src/examples/oneOf.ts b/packages/examples/src/examples/oneOf.ts index 1c9237622..19c117703 100644 --- a/packages/examples/src/examples/oneOf.ts +++ b/packages/examples/src/examples/oneOf.ts @@ -308,36 +308,36 @@ registerExamples([ uischema }, { - name: '1265_array', - label: '1265 Array', + name: 'oneOf_1265_array', + label: 'oneOf - Validation for Arrays (Issue 1265)', data: { coloursOrNumbers: ['Foo'] }, schema: schema_1265_array, uischema: undefined }, { - name: '1265_object', - label: '1265 Object', + name: 'oneOf_1265_object', + label: 'oneOf - Validation for Objects (Issue 1265)', data: { coloursOrNumbers: { colour: 'Foo' } }, schema: schema_1265_object, uischema: undefined }, { - name: '1265_simple', - label: '1265 Simple', + name: 'oneOf_1265_simple', + label: 'oneOf - Validation for Primitives (Issue 1265)', data: { coloursOrNumbers: 'Foo' }, schema: schema_1265_simple, uischema: undefined }, { - name: '1273', - label: '1273', + name: 'oneOf_1273', + label: 'oneOf - Preselection for Objects (Issue 1273)', data: data_1273, schema: schema_1273, uischema: undefined }, { - name: '1273_simple', - label: 'Simple 1273', + name: 'oneOf_1273_simple', + label: 'oneOf - Preselection for Primitives (Issue 1273 )', data: { quantity: 5 }, schema: schema_1273_simple, uischema: undefined diff --git a/packages/examples/src/examples/oneOfArray.ts b/packages/examples/src/examples/oneOfArray.ts index 01740565a..6f8a8c15d 100644 --- a/packages/examples/src/examples/oneOfArray.ts +++ b/packages/examples/src/examples/oneOfArray.ts @@ -91,7 +91,7 @@ const data = { registerExamples([ { name: 'oneOfArray', - label: 'oneOf (in array)', + label: 'oneOf - Inside array items', data, schema, uischema diff --git a/packages/examples/src/examples/text.ts b/packages/examples/src/examples/text.ts index 784d6529e..bbaee349a 100644 --- a/packages/examples/src/examples/text.ts +++ b/packages/examples/src/examples/text.ts @@ -89,7 +89,7 @@ export const data = { registerExamples([ { name: 'text', - label: 'Text', + label: 'Text Control Options', data, schema, uischema diff --git a/packages/examples/src/index.ts b/packages/examples/src/index.ts index d27050a3c..73b9c3d84 100644 --- a/packages/examples/src/index.ts +++ b/packages/examples/src/index.ts @@ -35,17 +35,11 @@ import * as arrayWithCustomChildLabel from './examples/arrays-with-custom-elemen import * as arrayWithSorting from './examples/arrays-with-sorting'; import * as stringArray from './examples/stringArray'; import * as categorization from './examples/categorization'; -import * as stepper from './examples/stepper'; -import * as steppershownav from './examples/steppershownav'; +import * as stepper from './examples/categorization-stepper'; +import * as steppershownav from './examples/categorization-stepper-nav-buttons'; import * as controlOptions from './examples/control-options'; -import * as day1 from './examples/day1'; -import * as day2 from './examples/day2'; -import * as day3 from './examples/day3'; -import * as day4 from './examples/day4'; -import * as day5 from './examples/day5'; -import * as day6 from './examples/day6'; import * as dates from './examples/dates'; -import * as dynamic from './examples/dynamic'; +import * as generateDynamic from './examples/generate-dynamic'; import * as generateSchema from './examples/generate'; import * as generateUISchema from './examples/generateUI'; import * as layout from './examples/layout'; @@ -62,23 +56,16 @@ import * as listWithDetailRegistered from './examples/list-with-detail-registere import * as object from './examples/object'; import * as i18n from './examples/i18n'; import * as issue_1948 from './examples/1948'; -import * as issue_1996 from './examples/1996'; -import * as issue_1169 from './examples/1169'; -import * as issue_1220 from './examples/1220'; -import * as issue_1253 from './examples/1253'; -import * as issue_1254 from './examples/1254'; import * as oneOfRecursive from './examples/oneOf-recursive'; import * as huge from './examples/huge'; import * as defaultExample from './examples/default'; import * as onChange from './examples/onChange'; import * as enumExample from './examples/enum'; import * as radioGroupExample from './examples/radioGroup'; -import * as booleanToggle from './examples/booleanToggle'; -import * as multiEnum from './examples/multi-enum'; +import * as multiEnum from './examples/enum-multi'; import * as enumInArray from './examples/enumInArray'; import * as readonly from './examples/readonly'; -import * as bug_1779 from './examples/1779'; -import * as bug_1645 from './examples/1645'; +import * as listWithDetailPrimitives from './examples/list-with-detail-primitives'; import * as conditionalSchemaComposition from './examples/conditional-schema-compositions'; import * as additionalErrors from './examples/additional-errors'; export * from './register'; @@ -88,7 +75,6 @@ import * as ifThenElse from './examples/if_then_else'; export { issue_1948, - issue_1996, defaultExample, allOf, anyOf, @@ -106,12 +92,6 @@ export { stepper, steppershownav, controlOptions, - day1, - day2, - day3, - day4, - day5, - day6, generateSchema, generateUISchema, layout, @@ -119,7 +99,7 @@ export { rule, ruleInheritance, dates, - dynamic, + generateDynamic, config, text, numbers, @@ -128,22 +108,16 @@ export { listWithDetailRegistered, object, i18n, - issue_1169, - issue_1220, - issue_1253, - issue_1254, oneOfRecursive, huge, ifThenElse, onChange, enumExample, radioGroupExample, - booleanToggle, multiEnum, enumInArray, readonly, - bug_1779, - bug_1645, + listWithDetailPrimitives, conditionalSchemaComposition, additionalErrors, issue_1884, diff --git a/packages/examples/src/register.ts b/packages/examples/src/register.ts index cd59d3500..75e4c971c 100644 --- a/packages/examples/src/register.ts +++ b/packages/examples/src/register.ts @@ -30,5 +30,8 @@ export const registerExamples = (examples: ExampleDescription[]): void => { examples.forEach(example => (knownExamples[example.name] = example)); }; -export const getExamples: () => ExampleDescription[] = () => - Object.keys(knownExamples).map(key => knownExamples[key]); +export const getExamples: () => ExampleDescription[] = () => { + const examples = Object.keys(knownExamples).map(key => knownExamples[key]); + examples.sort((a, b) => a.label.localeCompare(b.label)); + return examples; +}