1#ifndef SENSESP_UI_UI_CONTROLS_H
2#define SENSESP_UI_UI_CONTROLS_H
17 virtual bool to_json(JsonObject& doc)
override;
18 virtual bool from_json(
const JsonObject& config)
override;
28 return R
"({"type":"object","properties":{"value":{"title":"Value","type":"string"}}})";
38 virtual bool to_json(JsonObject& doc)
override;
39 virtual bool from_json(
const JsonObject& config)
override;
50 String schema = R
"({"type":"object","properties":{"value":{"title":"{{title}}","type":"number"}}})";
51 schema.replace("{{title}}", obj.
title_);
52 return schema.c_str();
62 virtual bool to_json(JsonObject& doc)
override;
63 virtual bool from_json(
const JsonObject& config)
override;
75 String schema = R
"({"type":"object","properties":{"value":{"title":"{{title}}","type":"boolean"}}})";
76 schema.replace("{{title}}", obj.
title_);
77 return schema.c_str();
89 std::vector<String> options,
SelectType format)
98 virtual bool to_json(JsonObject& doc)
override;
99 virtual bool from_json(
const JsonObject& config)
override;
113 String schema = R
"({"type":"object","properties":{"value":{"title":"<<title>>","type":"array","format":"<<format>>","uniqueItems":true,"items":{"type":"string","enum":[<<options>>]}}}})";
114 schema.replace("<<title>>", obj.
title_);
116 for (
size_t i = 0; i < obj.
options_.size(); i++) {
117 options +=
"\"" + obj.
options_[i] +
"\"";
122 schema.replace(
"<<options>>", options);
125 format =
"undefined";
131 schema.replace(
"<<format>>", format);
132 return schema.c_str();
virtual bool from_json(const JsonObject &config) override
friend const String ConfigSchema(const CheckboxConfig &obj)
virtual bool to_json(JsonObject &doc) override
CheckboxConfig(bool value, String title, String config_path)
virtual bool load() override
Load and populate the object from a persistent storage.
virtual bool to_json(JsonObject &doc) override
friend const String ConfigSchema(const NumberConfig &obj)
NumberConfig(float &value, String &config_path)
virtual bool from_json(const JsonObject &config) override
SelectConfig(String value, String title, String config_path, std::vector< String > options, SelectType format)
friend const String ConfigSchema(const SelectConfig &obj)
virtual bool from_json(const JsonObject &config) override
virtual bool to_json(JsonObject &doc) override
std::vector< String > options_
virtual bool from_json(const JsonObject &config) override
StringConfig(String &value, String &config_path)
virtual bool to_json(JsonObject &doc) override
const String ConfigSchema(const SmartSwitchController &obj)