/// <summary> /// 解析属性表达式 /// </summary> private void ResolveExpression() { if (_config.Contains(UiConst.For) == false) { return; } var expression = _config.GetValue <ModelExpression>(UiConst.For); TextBoxExpressionResolver.Init(expression, _config, IsTableEdit()); }
/// <summary> /// 初始化输入控件生成器 /// </summary> private void InitInputBuilder(FormFieldBuilder formFieldBuilder, InputBuilder inputBuilder) { inputBuilder.SetText(); inputBuilder.AddOtherAttributes(_config); inputBuilder.Id(_config); inputBuilder.AddAttribute(UiConst.Name, _config.GetValue(UiConst.Name)); inputBuilder.AddAttribute("placeholder", _config.GetValue(UiConst.Placeholder)); inputBuilder.AddAttribute("type", _config.Type); inputBuilder.AddAttribute("[(ngModel)]", _config.GetValue(UiConst.Model)); AddValidations(formFieldBuilder, inputBuilder); }
/// <summary> /// 获取渲染器 /// </summary> /// <param name="context">上下文</param> protected override IRender GetRender(Context context) { var config = new TextBoxConfig(context); if (config.GetValue <TextBoxType?>(UiConst.Type) == TextBoxType.Multiple) { config.IsTextArea = true; } return(new TextBoxRender(config)); }
/// <summary> /// 获取渲染器 /// </summary> /// <param name="context">上下文</param> protected override IRender GetRender(Context context) { var config = new TextBoxConfig(context); var type = config.GetValue <TextBoxType?>(UiConst.Type); switch (type) { case TextBoxType.Multiple: config.IsTextArea = true; break; case TextBoxType.Number: config.IsNumber = true; break; } return(new TextBoxRender(config)); }
/// <summary> /// 配置多行文本框 /// </summary> private void ConfigTextArea(TagBuilder builder) { if (_config.IsTextArea == false) { return; } builder.AddAttribute("[minRows]", _config.GetValue(MaterialConst.MinRows)); builder.AddAttribute("[maxRows]", _config.GetValue(MaterialConst.MaxRows)); }
/// <summary> /// 解析属性表达式 /// </summary> protected void ResolveExpression() { if (_config.Contains(UiConst.For) == false) { return; } var expression = _config.GetValue <ModelExpression>(UiConst.For); TextBoxExpressionResolver.Init(expression, _config); }