Skip to content

Commit

Permalink
Merge 4e62d39 into 5ef638a
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro-Gonzalez committed Aug 4, 2023
2 parents 5ef638a + 4e62d39 commit b011aee
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/schemas/common/mapper.js
Expand Up @@ -159,6 +159,29 @@ const baseMapperSchema = [
required: ['props', 'name']
}
},
{
if: {
type: 'object',
properties: {
name: { const: 'addStaticValue' }
}
},
then: {
properties: {
name: { const: 'addStaticValue' },
props: {
type: 'object',
properties: {
value: { type: 'string' },
translate: { type: 'boolean' }
},
required: ['value'],
additionalProperties: false
}
},
required: ['props', 'name']
}
},
{
if: {
type: 'object',
Expand Down
8 changes: 8 additions & 0 deletions tests/mocks/schemas/edit.yml
Expand Up @@ -445,6 +445,14 @@ sections:
iconColor: colorName
fontWeight: normal

- name: exampleStaticValueMapper
component: Text
mapper:
name: addStaticValue
props:
value: common.action.viewMore
translate: true

- name: exampleImage
translateLabel: false
component: Image
Expand Down
12 changes: 12 additions & 0 deletions tests/mocks/schemas/expected/edit.json
Expand Up @@ -709,6 +709,18 @@
"fontWeight": "normal"
}
},
{
"name": "exampleStaticValueMapper",
"component": "Text",
"componentAttributes": {},
"mapper": {
"name": "addStaticValue",
"props": {
"value": "common.action.viewMore",
"translate": true
}
}
},
{
"name": "exampleImage",
"component": "Image",
Expand Down

0 comments on commit b011aee

Please sign in to comment.