Skip to content

Commit

Permalink
Fix and restructure rule example
Browse files Browse the repository at this point in the history
  • Loading branch information
sdirix committed Jul 10, 2020
1 parent 108bd6c commit 54e3814
Showing 1 changed file with 44 additions and 36 deletions.
80 changes: 44 additions & 36 deletions packages/examples/src/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const schema = {
name: {
type: 'string'
},
alive: {
dead: {
type: 'boolean'
},
kindOfDead: {
Expand All @@ -42,7 +42,7 @@ export const schema = {
},
kindOfVegetables: {
type: 'string',
enum: ['All', 'Some', 'Only potato']
enum: ['All', 'Some', 'Only potatoes']
}
}
};
Expand All @@ -56,52 +56,60 @@ export const uischema = {
scope: '#/properties/name'
},
{
type: 'Control',
label: 'Is Alive?',
scope: '#/properties/alive'
},
{
type: 'Control',
label: 'Kind of dead',
scope: '#/properties/kindOfDead',
rule: {
effect: 'DISABLE',
condition: {
scope: '#/properties/alive',
schema: {
const: true
type: 'Group',
elements: [
{
type: 'Control',
label: 'Is Dead?',
scope: '#/properties/dead'
},
{
type: 'Control',
label: 'Kind of dead',
scope: '#/properties/kindOfDead',
rule: {
effect: 'ENABLE',
condition: {
scope: '#/properties/dead',
schema: {
const: true
}
}
}
}
}
]
},
{
type: 'Control',
label: 'Eats vegetables?',
scope: '#/properties/vegetables'
},
{
type: 'Control',
label: 'Kind of vegetables',
scope: '#/properties/kindOfVegetables',
rule: {
effect: 'HIDE',
condition: {
scope: '#/properties/vegetables',
schema: {
const: false
type: 'Group',
elements: [
{
type: 'Control',
label: 'Eats vegetables?',
scope: '#/properties/vegetables'
},
{
type: 'Control',
label: 'Kind of vegetables',
scope: '#/properties/kindOfVegetables',
rule: {
effect: 'HIDE',
condition: {
scope: '#/properties/vegetables',
schema: {
const: false
}
}
}
}
}
]
}
]
};

export const data = {
name: 'John Doe',
alive: true,
kindOfDead: 'Zombie',
vegetables: true,
kindOfVegetables: 'Only potatos'
dead: false,
vegetables: false,
};

registerExamples([
Expand Down

0 comments on commit 54e3814

Please sign in to comment.