diff --git a/schemas/api-config/collectionNavigation.json b/schemas/api-config/collectionNavigation.json index a23479b..021a09b 100644 --- a/schemas/api-config/collectionNavigation.json +++ b/schemas/api-config/collectionNavigation.json @@ -132,6 +132,10 @@ "properties": { "label": { "$ref": "definitions.json#/definitions/i18nString" + }, + "renderValue": { + "description": "render value based on entry ($ variable)", + "$ref": "definitions.json#/definitions/evalObjectWithRaw" } } } diff --git a/schemas/api-config/definitions.json b/schemas/api-config/definitions.json index af03347..b29d13a 100644 --- a/schemas/api-config/definitions.json +++ b/schemas/api-config/definitions.json @@ -11,6 +11,20 @@ } }, + "evalObjectWithRaw": { + "type": "object", + "properties": { + "eval": { + "type": "string", + "description": "js code which must return same schema as value if directly defined" + }, + "raw": { + "type": "boolean", + "description": "if true, the result of the eval passed as pure html" + } + } + }, + "i18nString": { "oneOf": [ { diff --git a/schemas/api-config/fieldMeta.json b/schemas/api-config/fieldMeta.json index 5185a94..595c455 100644 --- a/schemas/api-config/fieldMeta.json +++ b/schemas/api-config/fieldMeta.json @@ -189,6 +189,57 @@ } ] }, + { + "$ref": "#/definitions/minimum", + "patternProperties": { + "^x-.*|widget|foreign$": { "$comment": "stub for allOf" } + }, + "allOf": [ + { + "properties": { + "widget": { + "enum": ["foreignKey"] + }, + "foreign": { + "additionalProperties": false, + "description": "foreign key configuration", + "type": "object", + "properties": { + "collection": { + "type": "string", + "description": "collection name" + }, + "id": { + "type": "string", + "description": "id field name" + }, + "projection": { + "type": "string", + "description": "projection name used for fetching initial foreign entries from database" + }, + "sort": { + "type": "string", + "description": "sort field name (-field for descending)" + }, + "subNavigation": { + "type": "number", + "description": "sub navigation index in foreign collection" + }, + "render": { + "description": "field name or eval object which returns string", + "oneOf": [ + { "type": "string" }, + { + "$ref": "definitions.json#/definitions/evalObjectWithRaw" + } + ] + } + } + } + } + } + ] + }, { "$ref": "#/definitions/minimum", "patternProperties": { @@ -291,10 +342,103 @@ "$ref": "definitions.json#/definitions/i18nString", "description": "label for field" }, + "addElementLabel": { + "$ref": "definitions.json#/definitions/i18nString", + "description": "label for adding element to list" + }, "helperText": { "$ref": "definitions.json#/definitions/i18nString", "description": "helper text for field" }, + "filter": { + "type": "object", + "description": "filter configuration for list view of this field", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "description": "filter type", + "enum": [ + "default", + "select", + "bool", + "boolean", + "input", + "number", + "foreignKey" + ] + } + } + }, + "folding": { + "type": "object", + "description": "folding configuration for array fields", + "additionalProperties": false, + "properties": { + "previewUnfolded": { + "description": "preview for unfolded array element", + "oneOf": [ + { "type": "string" }, + { + "$ref": "definitions.json#/definitions/evalObjectWithRaw" + } + ] + }, + "previewFolded": { + "description": "preview for folded array element", + "oneOf": [ + { "type": "string" }, + { + "$ref": "definitions.json#/definitions/evalObjectWithRaw" + } + ] + } + } + }, + "css": { + "description": "css styles for field widgets", + "type": "object", + "properties": { + "input": { + "type": "object", + "description": "css styles for input widget", + "additionalProperties": false, + "properties": { + "wrapper": { + "description": "css styles for input widget wrapper", + "$ref": "#/definitions/css" + }, + "element": { + "description": "css styles for input widget sub elements", + "$ref": "#/definitions/css" + }, + "foreignEntry": { + "description": "css styles for input widget linked foreign entries", + "$ref": "#/definitions/css" + } + } + }, + "view": { + "type": "object", + "description": "css styles for input widget", + "additionalProperties": false, + "properties": { + "wrapper": { + "description": "css styles for view widget wrapper", + "$ref": "#/definitions/css" + }, + "element": { + "description": "css styles for view widget sub elements", + "$ref": "#/definitions/css" + }, + "foreignEntry": { + "description": "css styles for input widget linked foreign entries", + "$ref": "#/definitions/css" + } + } + } + } + }, "dependsOn": { "description": "depends on rule", "oneOf": [ @@ -378,6 +522,23 @@ "$ref": "definitions.json#/definitions/evalObject" } ] + }, + "css": { + "anyOf": [ + { "type": "string" }, + { + "$ref": "https://raw.githubusercontent.com/rcorp/css-schema/master/schema.json" + }, + { + "type": "object", + "properties": { + "eval": { + "type": "string", + "description": "javascript code evaled to string or css object" + } + } + } + ] } } }