private static string DefineAttr(TableInfo tableInfo, Info info, string propertyName) { var attrFieldConfig = HelperFieldConfig.GetAttr(tableInfo, propertyName); var attr = string.Format("{0}", attrFieldConfig); return(attr); }
protected string FormFieldReplace(Context configContext, TableInfo tableInfo, Info info, string textTemplateForm, string str = "") { var cols = "col-md-12"; if (tableInfo.TwoCols || configContext.TwoCols) { cols = "col-md-6"; } if (IsStringLengthBig(info, configContext)) { cols = "col-md-12"; } var colSize = HelperFieldConfig.GetColSizeField(tableInfo, info.PropertyName); if (colSize.IsSent()) { cols = string.Format("col-md-{0}", colSize); } return(textTemplateForm .Replace("<#formField#>", str) .Replace("<#colformField#>", cols.ToString())); }
private static string DefineAttr(Context configContext, TableInfo tableInfo, Info info, string propertyName) { var mask = string.Empty; if (configContext.ApplyMasksDefault) { mask = DefineMask(info.Type); if (info.PropertyName.ToLower().Contains("cpf")) { mask = "[textMask]='{ mask: vm.masks.maskCPF }'"; } if (info.PropertyName.ToLower().Contains("cnpj")) { mask = "[textMask]='{ mask: vm.masks.maskCNPJ }'"; } if (info.PropertyName.ToLower().Contains("telefone") || info.PropertyName.ToLower().Contains("phone")) { mask = "[textMask]='{ mask: vm.masks.maskTelefone }'"; } if (info.PropertyName.ToLower().Contains("celular") || info.PropertyName.ToLower().Contains("cellphone")) { mask = "[textMask]='{ mask: vm.masks.maskCelular }'"; } } var maxLength = ""; if (info.Type == "string") { maxLength = " maxlength=" + info.Length; } var attrFieldConfig = HelperFieldConfig.GetAttr(tableInfo, propertyName); if (attrFieldConfig.Contains("maskm")) { mask = ""; } if (attrFieldConfig.Contains("textMask")) { mask = ""; } if (attrFieldConfig.Contains("maski")) { mask = ""; } var attr = string.Format("{0} {1} {2}", attrFieldConfig, mask, maxLength); return(attr); }
public static string MakeInputHtml(Context configContext, TableInfo tableInfo, Info info, bool isStringLengthBig, string propertyName) { var _isPassword = HelperFieldConfig.IsPassword(tableInfo, propertyName); var _isPasswordConfirmation = HelperFieldConfig.IsPasswordConfirmation(tableInfo, propertyName); var _isEmail = HelperFieldConfig.IsEmail(tableInfo, propertyName); var _isRequired = info.IsNullable == 0; var required = _isRequired ? "required" : string.Empty; var attr = DefineAttr(configContext, tableInfo, info, propertyName); if (isStringLengthBig) { return(MakeTextArea(required)); } if (_isPassword) { return(MakeInputType(required, "password", info.Type)); } if (_isPasswordConfirmation) { return(MakeInputPasswordConfirmation(required, "password")); } if (_isEmail) { return(MakeInputType(required, "email", "email")); } if (info.PropertyName.ToLower().Contains("email")) { return(MakeInputType(required, "email", "email")); } if (info.PropertyName.ToLower().Contains("cep") || info.PropertyName.ToLower().Contains("zipcode")) { return(MakeCEP(_isRequired, attr)); } if (info.PropertyName.ToLower().Contains("cpfcnpj") || info.PropertyName.ToLower().Contains("cpf_cnpj") || info.PropertyName.ToLower().Contains("cpf-cnpj")) { return(MakeCPFCNPJTab(required, attr)); } return(MakeInputType(required, "text", attr)); }
public static string MakeInputHtml(TableInfo tableInfo, Info info, bool isStringLengthBig, string propertyName) { var ng_required = info.IsNullable == 0 ? "ng-required='true'" : string.Empty; var _isPassword = HelperFieldConfig.IsPassword(tableInfo, propertyName); var _isPasswordConfirmation = HelperFieldConfig.IsPasswordConfirmation(tableInfo, propertyName); var _isEmail = HelperFieldConfig.IsEmail(tableInfo, propertyName); var _length = info.Length; if (isStringLengthBig) { return(MakeTextArea(ng_required)); } if (_isPassword) { return(MakeInputType(ng_required, "password")); } if (_isPasswordConfirmation) { return(MakeInputPasswordConfirmation(ng_required, "password")); } if (_isEmail) { return(MakeInputType(ng_required, "email")); } var attr = DefineAttr(tableInfo, info, propertyName); if (Convert.ToInt32(_length) > 0 && info.Type == "string") { if (!attr.Contains("maxlength")) { attr += " maxlength='" + _length + "'"; } } return(MakeInputType(ng_required, "text", attr)); }
protected string FormFieldReplace(Context configContext, TableInfo tableInfo, Info info, string textTemplateForm, string str = "") { var attrSectionFieldConfig = HelperFieldConfig.GetAttrSection(tableInfo, info.PropertyName); if (IsPropertyNavigationTypeInstance(tableInfo, info.PropertyName)) { if (!attrSectionFieldConfig.Contains("ngIf")) { var conditionalParent = "*ngIf=\"!vm.isParent || vm.ParentIdField != '<#propertyName#>'\""; attrSectionFieldConfig += " " + conditionalParent; } } var cols = "col-md-12"; if (tableInfo.TwoCols || configContext.TwoCols) { cols = "col-md-6"; } if (IsStringLengthBig(info, configContext)) { cols = "col-md-12"; } var colSize = HelperFieldConfig.GetColSizeField(tableInfo, info.PropertyName); if (colSize.IsSent()) { cols = string.Format("col-md-{0}", colSize); } return(textTemplateForm .Replace("<#formField#>", str) .Replace("<#colformField#>", cols.ToString()) .Replace("<#attrSection#>", attrSectionFieldConfig)); }