Exemplo n.º 1
0
        public override IFormBuilder <JObject> Field(string name, ActiveDelegate <JObject> active = null, ValidateAsyncDelegate <JObject> validate = null)
        {
            var field = new FieldJson(this, name);

            field.SetActive(active);
            field.SetValidate(validate);
            AddSteps(field.Before);
            Field(field);
            AddSteps(field.After);
            return(this);
        }
Exemplo n.º 2
0
        public override IFormBuilder <JObject> Field(string name, PromptAttribute prompt, ActiveDelegate <JObject> active = null, ValidateAsyncDelegate <JObject> validate = null)
        {
            var field = new FieldJson(this, name);

            field.SetPrompt(prompt);
            if (active != null)
            {
                field.SetActive(active);
            }
            if (validate != null)
            {
                field.SetValidate(validate);
            }
            return(Field(field));
        }
Exemplo n.º 3
0
 private void Fields(JObject schema, string prefix, IList <string> fields)
 {
     if (schema["properties"] != null)
     {
         foreach (JProperty property in schema["properties"])
         {
             var path        = (prefix == null ? property.Name : $"{prefix}.{property.Name}");
             var childSchema = (JObject)property.Value;
             var eltSchema   = FieldJson.ElementSchema(childSchema);
             if (FieldJson.IsPrimitiveType(eltSchema))
             {
                 fields.Add(path);
             }
             else
             {
                 Fields(childSchema, path, fields);
             }
         }
     }
 }