Browse Source
Merge pull request #16561 from abpframework/issue-16494-1
Fix Mvc dynamic Form DateTimePicker Error
pull/16564/head
Yunus Emre Kalkan
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
16 additions and
13 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelper.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelperService.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js
|
|
|
@ -9,7 +9,7 @@ public abstract class |
|
|
|
where TTagHelper : AbpDatePickerBaseTagHelper<TTagHelper> |
|
|
|
|
|
|
|
{ |
|
|
|
private readonly IAbpDatePickerOptions _abpDatePickerOptionsImplementation; |
|
|
|
private IAbpDatePickerOptions _abpDatePickerOptionsImplementation; |
|
|
|
|
|
|
|
public string Label { get; set; } |
|
|
|
|
|
|
|
@ -47,6 +47,11 @@ public abstract class |
|
|
|
{ |
|
|
|
_abpDatePickerOptionsImplementation = new AbpDatePickerOptions(); |
|
|
|
} |
|
|
|
|
|
|
|
public void SetDatePickerOptions(IAbpDatePickerOptions options) |
|
|
|
{ |
|
|
|
_abpDatePickerOptionsImplementation = options; |
|
|
|
} |
|
|
|
|
|
|
|
public string PickerId { |
|
|
|
get => _abpDatePickerOptionsImplementation.PickerId; |
|
|
|
|
|
|
|
@ -84,6 +84,11 @@ public abstract class AbpDatePickerBaseTagHelperService<TTagHelper> : AbpTagHelp |
|
|
|
AddReadOnlyAttribute(TagHelperOutput); |
|
|
|
AddPlaceholderAttribute(TagHelperOutput); |
|
|
|
AddInfoTextId(TagHelperOutput); |
|
|
|
var optionsAttribute = GetAttributeAndModelExpression<DatePickerOptionsAttribute>(out var modelExpression); |
|
|
|
if (optionsAttribute != null) |
|
|
|
{ |
|
|
|
TagHelper.SetDatePickerOptions(optionsAttribute.GetDatePickerOptions(modelExpression.ModelExplorer)); |
|
|
|
} |
|
|
|
|
|
|
|
// Open and close button
|
|
|
|
var openButtonContent = TagHelper.OpenButton |
|
|
|
@ -426,15 +431,6 @@ public abstract class AbpDatePickerBaseTagHelperService<TTagHelper> : AbpTagHelp |
|
|
|
attrList.Add(attr); |
|
|
|
} |
|
|
|
|
|
|
|
var optionsAttribute = GetAttributeAndModelExpression<DatePickerOptionsAttribute>(out var modelExpression); |
|
|
|
if (optionsAttribute != null) |
|
|
|
{ |
|
|
|
foreach (var attr in ConvertDatePickerOptionsToAttributeList(optionsAttribute.GetDatePickerOptions(modelExpression.ModelExplorer))) |
|
|
|
{ |
|
|
|
attrList.Add(attr); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
AddBaseTagAttributes(attrList); |
|
|
|
|
|
|
|
return attrList; |
|
|
|
@ -591,7 +587,7 @@ public abstract class AbpDatePickerBaseTagHelperService<TTagHelper> : AbpTagHelp |
|
|
|
abpButtonTagHelper.ButtonType = AbpButtonType.Outline_Secondary; |
|
|
|
abpButtonTagHelper.Icon = icon; |
|
|
|
|
|
|
|
abpButtonTagHelper.Disabled = TagHelper.IsDisabled; |
|
|
|
abpButtonTagHelper.Disabled = TagHelper.IsDisabled || GetAttribute<DisabledInput>() != null; |
|
|
|
|
|
|
|
if (!visible) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -643,8 +643,9 @@ |
|
|
|
var momentEndDate = getMoment(endDate, options); |
|
|
|
if (momentStartDate.isValid()) { |
|
|
|
picker.setStartDate(momentStartDate); |
|
|
|
picker.setEndDate(momentEndDate); |
|
|
|
} |
|
|
|
if (momentEndDate.isValid()) { |
|
|
|
if (momentEndDate.isValid() && !singleDatePicker) { |
|
|
|
picker.setEndDate(momentEndDate); |
|
|
|
} |
|
|
|
}); |
|
|
|
@ -761,6 +762,7 @@ |
|
|
|
abp.dom.initializers.initializeForms(args.$el.findWithSelf('form'), true); |
|
|
|
abp.dom.initializers.initializeScript(args.$el); |
|
|
|
abp.dom.initializers.initializeAutocompleteSelects(args.$el.findWithSelf('.auto-complete-select')); |
|
|
|
abp.dom.initializers.initializeDateRangePickers(args.$el); |
|
|
|
}); |
|
|
|
|
|
|
|
abp.dom.onNodeRemoved(function (args) { |
|
|
|
@ -772,6 +774,7 @@ |
|
|
|
abp.event.on('abp.configurationInitialized', function () { |
|
|
|
abp.libs.bootstrapDatepicker.normalizeLanguageConfig(); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$(function () { |
|
|
|
abp.dom.initializers.initializeToolTips($('[data-toggle="tooltip"]')); |
|
|
|
@ -782,7 +785,6 @@ |
|
|
|
abp.dom.initializers.initializeForms($('form')); |
|
|
|
abp.dom.initializers.initializeAutocompleteSelects($('.auto-complete-select')); |
|
|
|
$('[data-auto-focus="true"]').first().findWithSelf('input,select').focus(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
})(jQuery); |
|
|
|
|