Skip to content

Commit

Permalink
Added Additional Conditional Formatting (#287)
Browse files Browse the repository at this point in the history
* Put this in the wrong spot.......

Whoops

* Update config.schema.json

* Update config.schema.json

---------

Co-authored-by: gaosen <[email protected]>
  • Loading branch information
donavanbecker and 0x5e authored Apr 20, 2023
1 parent e8bd446 commit 4ecdc75
Showing 1 changed file with 56 additions and 16 deletions.
72 changes: 56 additions & 16 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"footerDisplay": "",
"customUi": false,
"schema": {
"name": {
"type": "string",
"title": "Name",
"required": true,
"default": "Tuya"
},
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "Name",
"required": true,
"default": "Tuya"
},
"options": {
"title": "Project Info",
"type": "object",
Expand Down Expand Up @@ -125,12 +125,18 @@
"category": {
"title": "Category",
"description": "Category Code or `hidden`",
"type": "string"
"type": "string",
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides);"
}
},
"unbridged": {
"title": "Unbridge",
"description": "Would you like to make this device be an external device?",
"type": "boolean"
"type": "boolean",
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides);"
}
},
"schema": {
"title": "Schema Overriding Configs",
Expand All @@ -141,11 +147,17 @@
"code": {
"title": "DP Code",
"type": "string",
"required": true
"required": true,
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides);"
}
},
"newCode": {
"title": "New DP Code",
"type": "string"
"type": "string",
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides && model.options.deviceOverrides[arrayIndices[0]].schema && model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].code && !model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].hidden);"
}
},
"type": {
"title": "New DP Type",
Expand Down Expand Up @@ -188,43 +200,70 @@
"Raw"
]
}
]
],
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides && model.options.deviceOverrides[arrayIndices[0]].schema && model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].code && !model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].hidden);"
}
},
"property": {
"title": "New DP Property",
"type": "object",
"properties": {
"min": {
"title": "min",
"type": "integer"
"type": "integer",
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides && model.options.deviceOverrides[arrayIndices[0]].schema && model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].type === 'Integer' && !model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].hidden);"
}
},
"max": {
"title": "max",
"type": "integer"
"type": "integer",
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides && model.options.deviceOverrides[arrayIndices[0]].schema && model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].type === 'Integer' && !model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].hidden);"
}
},
"scale": {
"title": "scale",
"type": "integer"
"type": "integer",
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides && model.options.deviceOverrides[arrayIndices[0]].schema && model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].type === 'Integer' && !model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].hidden);"
}
},
"step": {
"title": "step",
"type": "integer"
"type": "integer",
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides && model.options.deviceOverrides[arrayIndices[0]].schema && model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].type === 'Integer' && !model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].hidden);"
}
},
"range": {
"title": "range",
"type": "array",
"items": {
"title": "value",
"type": "string"
},
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides && model.options.deviceOverrides[arrayIndices[0]].schema && model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].type === 'Enum' && !model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].hidden);"
}
}
},
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides && model.options.deviceOverrides[arrayIndices[0]].schema && model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].code && !model.options.deviceOverrides[arrayIndices[0]].schema[arrayIndices[1]].hidden);"
}
},
"hidden": {
"title": "Hidden",
"type": "boolean"
"type": "boolean",
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides);"
}
}
}
},
"condition": {
"functionBody": "return (model.options && model.options.deviceOverrides);"
}
}
}
Expand Down Expand Up @@ -340,6 +379,7 @@
},
{
"key": "options.deviceOverrides[].schema[].property",
"notitle": false,
"items": [
"options.deviceOverrides[].schema[].property.min",
"options.deviceOverrides[].schema[].property.max",
Expand Down

0 comments on commit 4ecdc75

Please sign in to comment.