defaultValue, dependsOn, subNavigation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Sebastian Frank 2022-10-18 16:48:16 +02:00
parent 5664ae00db
commit 5fccea7513
4 changed files with 194 additions and 121 deletions

View File

@ -1,6 +1,5 @@
name: testfield
type: string
meta:
label:
de: test
label:
de: test

View File

@ -26,130 +26,31 @@
"type": "object",
"description": "meta object used for admin ui configuration",
"additionalProperties": true,
"allOf": [{ "$ref": "collectionNavigation.json" }],
"properties": {
"label": {
"$ref": "field.json#/definitions/i18nString"
},
"muiIcon": {
"type": "string",
"description": "material ui icon name"
},
"rowIdentTpl": {
"description": "template which evaluates to short string to identify entry in pe. select boxes",
"$ref": "field.json#/definitions/evalExpressions"
},
"defaultSort": {
"type": "object",
"description": "default sort in admin ui lists",
"additionalProperties": false,
"properties": {
"field": {
"$ref": "field.json#/definitions/fieldSource"
},
"order": {
"description": "sort order",
"enum": ["ASC", "DESC"]
"subNavigation": {
"oneOf": [
{ "$comment": "for include tag", "type": "string" },
{
"type": "array",
"description": "sub navigation of collection",
"items": {
"oneOf": [
{
"$comment": "for include tag",
"type": "string"
},
{
"$ref": "collectionNavigation.json"
}
]
}
}
}
},
"views": {
"type": "array",
"description": "list views",
"items": {
"type": "object",
"properties": {
"mediaQuery": {
"type": "string",
"description": "css media query to select this view in ui"
}
},
"oneOf": [
{
"properties": {
"type": {
"const": "simpleList"
},
"primaryText": {
"oneOf": [
{
"$ref": "field.json#/definitions/fieldSource"
},
{
"$ref": "field.json#/definitions/evalExpressions"
}
]
},
"secondaryText": {
"oneOf": [
{
"$ref": "field.json#/definitions/fieldSource"
},
{
"$ref": "field.json#/definitions/evalExpressions"
}
]
},
"tertiaryText": {
"oneOf": [
{
"$ref": "field.json#/definitions/fieldSource"
},
{
"$ref": "field.json#/definitions/evalExpressions"
}
]
}
},
"required": ["type", "primaryText"]
},
{
"properties": {
"type": {
"const": "table"
},
"columns": {
"type": "array",
"items": {
"oneOf": [
{
"anyOf": [
{
"$ref": "field.json#/definitions/fieldSource"
},
{
"type": "object",
"properties": {
"label": {
"$ref": "field.json#/definitions/i18nString"
}
}
}
]
},
{
"allOf": [
{
"$ref": "field.json#/definitions/evalExpressions"
},
{
"properties": {
"label": {
"$ref": "field.json#/definitions/i18nString"
}
}
}
]
}
]
},
"minItems": 1
}
},
"required": ["type", "columns"]
}
],
"required": ["type"]
}
]
}
}
},

View File

@ -0,0 +1,143 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "JSON Schema tibi-server collection meta navigation configuration",
"description": "tibi-server collection navigation linter",
"type": "object",
"additionalProperties": true,
"patternProperties": {
"^x\\-": {
"description": "template property"
}
},
"required": ["label"],
"properties": {
"name": {
"type": "string",
"description": "name of navigation"
},
"label": {
"$ref": "field.json#/definitions/i18nString"
},
"muiIcon": {
"type": "string",
"description": "material ui icon name"
},
"defaultSort": {
"type": "object",
"description": "default sort in admin ui lists",
"additionalProperties": false,
"properties": {
"field": {
"$ref": "field.json#/definitions/fieldSource"
},
"order": {
"description": "sort order",
"enum": ["ASC", "DESC"]
}
}
},
"filter": {
"type": "object",
"description": "filter for prefiltering collection view"
},
"views": {
"type": "array",
"description": "list views",
"items": {
"type": "object",
"properties": {
"mediaQuery": {
"type": "string",
"description": "css media query to select this view in ui"
}
},
"oneOf": [
{
"properties": {
"type": {
"const": "simpleList"
},
"primaryText": {
"oneOf": [
{
"$ref": "field.json#/definitions/fieldSource"
},
{
"$ref": "field.json#/definitions/evalExpressions"
}
]
},
"secondaryText": {
"oneOf": [
{
"$ref": "field.json#/definitions/fieldSource"
},
{
"$ref": "field.json#/definitions/evalExpressions"
}
]
},
"tertiaryText": {
"oneOf": [
{
"$ref": "field.json#/definitions/fieldSource"
},
{
"$ref": "field.json#/definitions/evalExpressions"
}
]
}
},
"required": ["type", "primaryText"]
},
{
"properties": {
"type": {
"const": "table"
},
"columns": {
"type": "array",
"items": {
"oneOf": [
{
"anyOf": [
{
"$ref": "field.json#/definitions/fieldSource"
},
{
"type": "object",
"properties": {
"label": {
"$ref": "field.json#/definitions/i18nString"
}
}
}
]
},
{
"allOf": [
{
"$ref": "field.json#/definitions/evalExpressions"
},
{
"properties": {
"label": {
"$ref": "field.json#/definitions/i18nString"
}
}
}
]
}
]
},
"minItems": 1
}
},
"required": ["type", "columns"]
}
],
"required": ["type"]
}
}
}
}

View File

@ -172,6 +172,36 @@
]
}
}
},
"dependsOn": {
"description": "depends on rule",
"oneOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"eval": {
"type": "string",
"description": "js code with $, $this, $parent and $stack variables"
}
}
}
]
},
"defaultValue": {
"description": "default value or code to get the value",
"oneOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"eval": {
"type": "string",
"description": "js code with $navigation variable"
}
}
}
]
}
}
}