public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagMode = TagMode.SelfClosing; output.TagName = ""; var htmlAttributes = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase) { { "name", For.Name }, { "class", "form-control" } }; for (int i = 0; i < output.Attributes.Count; i++) { var item = output.Attributes[i]; if (!htmlAttributes.ContainsKey(item.Name)) { htmlAttributes.Add(item.Name, item.Value); } } var inputTag = _htmlGenerator.GenerateTextBox(ViewContext, For.ModelExplorer, For.Name, For.ModelExplorer.Model, null, htmlAttributes); output.Content.AppendHtml(inputTag); var script = $@" $(function () {{ $('#{inputTag.Attributes["id"]}').datepicker({{dateFormat:'{Format}'}}); $('#{inputTag.Attributes["id"]}').datepicker('setDate','{For.ModelExplorer.Model}'); }}); "; _scriptHelper.AddScriptText(script); }
public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "canvas"; output.Attributes.Add(new TagHelperAttribute("id", Id)); var script = $@"$(function () {{ var lineChartData{Id} = {{ labels: ['{String.Join("','", ChartData.Labels)}'], datasets:[{this.ConstructDataSet(ChartData.DataSet)}] }} var options{Id} = {{ responsive: true, title: {{ display: true, text: '{ChartData.Title}' }}, tooltips: {{ mode: 'index', intersect: false, }}, hover: {{ mode: 'nearest', intersect: true }}, scales: {{ xAxes: [{{ display: true, scaleLabel: {{ display: true, labelString: '{ChartData.X_Lable}' }} }}], yAxes: [{{ display: true, scaleLabel: {{ display: true, labelString: '{ChartData.Y_Lable}' }} }}] }} }} var config{Id} = {{ type: 'line', data: lineChartData{Id}, options: options{Id} }}; this.{Id} = new Chart(document.getElementById('{Id}').getContext('2d'), config{Id}); }})" ; _scriptHelper.AddScriptText(script); }
public override void Process(TagHelperContext context, TagHelperOutput output) { var ddType = output.TagName.Split("-")[1]; output.TagName = string.Empty; if (ddType.Equals("simple") || !(For.ModelExplorer.ModelType.IsGenericType && For.ModelExplorer.ModelType.GetGenericTypeDefinition() == typeof(List <>))) { AllowMultiple = false; } var htmlAttributes = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase) { { "name", For.Name }, { "class", "form-control" } }; for (int i = 0; i < output.Attributes.Count; i++) { var item = output.Attributes[i]; if (!htmlAttributes.ContainsKey(item.Name)) { htmlAttributes.Add(item.Name, item.Value); } } var inputTag = _htmlGenerator.GenerateSelect(Context, For.ModelExplorer, null, For.Name, Items, AllowMultiple, htmlAttributes); output.Content.AppendHtml(inputTag); var script = $@"$(function () {{ $('#{inputTag.Attributes["id"]}').select2({{ placeholder: '{Default_Select}', theme: 'bootstrap4', width: 'resolve', minimumResultsForSearch: -1 }}); }}); "; _scriptHelper.AddScriptText(script); }
public override void Process(TagHelperContext context, TagHelperOutput output) { var chartType = output.TagName.Split("-")[1]; output.TagName = "canvas"; output.Attributes.Add(new TagHelperAttribute("id", Id)); var script = $@"$(function () {{ var config{Id} = {{ type: '{chartType}', data: {{ datasets: [{this.ConstructDataSet(ChartData.DataSet)}], labels: ['{string.Join("','", ChartData.Labels)}'] }}, options: {{ responsive: true, legend: {{ position: 'top', }}, title: {{ display: true, text: '{ChartData.Title}' }}, animation: {{ animateScale: true, animateRotate: true }} }} }}; this.{Id} = new Chart(document.getElementById('{Id}').getContext('2d'), config{Id}); }})" ; _scriptHelper.AddScriptText(script); }