Browse Source
Merge pull request #6167 from abpframework/extra-property-improvements
Add filterparam name to lookup config.
pull/6176/head
Halil İbrahim Kalkan
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with
20 additions and
6 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyUiLookupDto.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelper.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/CachedObjectExtensionsDtoService.cs
-
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ExtensionPropertyLookupConfiguration.cs
-
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml
-
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml
-
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml
-
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml
-
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml
-
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml
|
|
|
@ -9,5 +9,6 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending |
|
|
|
public string ResultListPropertyName { get; set; } |
|
|
|
public string DisplayPropertyName { get; set; } |
|
|
|
public string ValuePropertyName { get; set; } |
|
|
|
public string FilterParamName { get; set; } |
|
|
|
} |
|
|
|
} |
|
|
|
@ -29,6 +29,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form |
|
|
|
|
|
|
|
public string AutocompleteValuePropertyName { get; set; } |
|
|
|
|
|
|
|
public string AutocompleteFilterParamName { get; set; } |
|
|
|
|
|
|
|
public AbpSelectTagHelper(AbpSelectTagHelperService tagHelperService) |
|
|
|
: base(tagHelperService) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -106,6 +106,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form |
|
|
|
output.Attributes.Add("data-autocomplete-items-property", TagHelper.AutocompleteItemsPropertyName); |
|
|
|
output.Attributes.Add("data-autocomplete-display-property", TagHelper.AutocompleteDisplayPropertyName); |
|
|
|
output.Attributes.Add("data-autocomplete-value-property", TagHelper.AutocompleteValuePropertyName); |
|
|
|
output.Attributes.Add("data-autocomplete-filter-param-name", TagHelper.AutocompleteFilterParamName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -79,14 +79,14 @@ |
|
|
|
var displayName = $(this).data("autocompleteDisplayProperty"); |
|
|
|
var displayValue = $(this).data("autocompleteValueProperty"); |
|
|
|
var itemsPropertyName = $(this).data("autocompleteItemsProperty"); |
|
|
|
var filterParamName = $(this).data("autocompleteFilterParamName"); |
|
|
|
$select.select2({ |
|
|
|
ajax: { |
|
|
|
url: url, |
|
|
|
dataType: "json", |
|
|
|
data: function (params) { |
|
|
|
var query = { |
|
|
|
search: params.term |
|
|
|
}; |
|
|
|
var query = {}; |
|
|
|
query[filterParamName] = params.term; |
|
|
|
return query; |
|
|
|
}, |
|
|
|
processResults: function (data) { |
|
|
|
@ -95,7 +95,7 @@ |
|
|
|
if (itemsPropertyName) { |
|
|
|
items = data[itemsPropertyName]; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
items.forEach(function (item, index) { |
|
|
|
retVal.push({ |
|
|
|
id: item[displayValue], |
|
|
|
|
|
|
|
@ -148,7 +148,8 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending |
|
|
|
Url = propertyConfig.UI.Lookup.Url, |
|
|
|
ResultListPropertyName = propertyConfig.UI.Lookup.ResultListPropertyName, |
|
|
|
DisplayPropertyName = propertyConfig.UI.Lookup.DisplayPropertyName, |
|
|
|
ValuePropertyName = propertyConfig.UI.Lookup.ValuePropertyName |
|
|
|
ValuePropertyName = propertyConfig.UI.Lookup.ValuePropertyName, |
|
|
|
FilterParamName = propertyConfig.UI.Lookup.FilterParamName |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
@ -1,4 +1,6 @@ |
|
|
|
namespace Volo.Abp.ObjectExtending.Modularity |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
|
|
|
|
namespace Volo.Abp.ObjectExtending.Modularity |
|
|
|
{ |
|
|
|
public class ExtensionPropertyLookupConfiguration |
|
|
|
{ |
|
|
|
@ -6,5 +8,6 @@ |
|
|
|
public string ResultListPropertyName { get; set; } = "items"; |
|
|
|
public string DisplayPropertyName { get; set; } = "text"; |
|
|
|
public string ValuePropertyName { get; set; } = "id"; |
|
|
|
public string FilterParamName { get; set; } = "filter"; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -29,6 +29,7 @@ |
|
|
|
<abp-select asp-for="Role.ExtraProperties[propertyInfo.Name]" |
|
|
|
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)" |
|
|
|
autocomplete-api-url="@propertyInfo.Lookup.Url" |
|
|
|
autocomplete-filter-param-name="@propertyInfo.Lookup.FilterParamName" |
|
|
|
autocomplete-items-property-name="@propertyInfo.Lookup.ResultListPropertyName" |
|
|
|
autocomplete-display-property-name="@propertyInfo.Lookup.DisplayPropertyName" |
|
|
|
autocomplete-value-property-name="@propertyInfo.Lookup.ValuePropertyName"></abp-select> |
|
|
|
|
|
|
|
@ -40,6 +40,7 @@ |
|
|
|
<abp-select asp-for="Role.ExtraProperties[propertyInfo.Name]" |
|
|
|
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)" |
|
|
|
autocomplete-api-url="@propertyInfo.Lookup.Url" |
|
|
|
autocomplete-filter-param-name="@propertyInfo.Lookup.FilterParamName" |
|
|
|
autocomplete-items-property-name="@propertyInfo.Lookup.ResultListPropertyName" |
|
|
|
autocomplete-display-property-name="@propertyInfo.Lookup.DisplayPropertyName" |
|
|
|
autocomplete-value-property-name="@propertyInfo.Lookup.ValuePropertyName"></abp-select> |
|
|
|
|
|
|
|
@ -34,6 +34,7 @@ |
|
|
|
<abp-select asp-for="UserInfo.ExtraProperties[propertyInfo.Name]" |
|
|
|
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)" |
|
|
|
autocomplete-api-url="@propertyInfo.Lookup.Url" |
|
|
|
autocomplete-filter-param-name="@propertyInfo.Lookup.FilterParamName" |
|
|
|
autocomplete-items-property-name="@propertyInfo.Lookup.ResultListPropertyName" |
|
|
|
autocomplete-display-property-name="@propertyInfo.Lookup.DisplayPropertyName" |
|
|
|
autocomplete-value-property-name="@propertyInfo.Lookup.ValuePropertyName"></abp-select> |
|
|
|
|
|
|
|
@ -36,6 +36,7 @@ |
|
|
|
<abp-select asp-for="UserInfo.ExtraProperties[propertyInfo.Name]" |
|
|
|
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)" |
|
|
|
autocomplete-api-url="@propertyInfo.Lookup.Url" |
|
|
|
autocomplete-filter-param-name="@propertyInfo.Lookup.FilterParamName" |
|
|
|
autocomplete-items-property-name="@propertyInfo.Lookup.ResultListPropertyName" |
|
|
|
autocomplete-display-property-name="@propertyInfo.Lookup.DisplayPropertyName" |
|
|
|
autocomplete-value-property-name="@propertyInfo.Lookup.ValuePropertyName"></abp-select> |
|
|
|
|
|
|
|
@ -29,6 +29,7 @@ |
|
|
|
<abp-select asp-for="Tenant.ExtraProperties[propertyInfo.Name]" |
|
|
|
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)" |
|
|
|
autocomplete-api-url="@propertyInfo.Lookup.Url" |
|
|
|
autocomplete-filter-param-name="@propertyInfo.Lookup.FilterParamName" |
|
|
|
autocomplete-items-property-name="@propertyInfo.Lookup.ResultListPropertyName" |
|
|
|
autocomplete-display-property-name="@propertyInfo.Lookup.DisplayPropertyName" |
|
|
|
autocomplete-value-property-name="@propertyInfo.Lookup.ValuePropertyName"></abp-select> |
|
|
|
|
|
|
|
@ -25,6 +25,7 @@ |
|
|
|
<abp-select asp-for="Tenant.ExtraProperties[propertyInfo.Name]" |
|
|
|
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)" |
|
|
|
autocomplete-api-url="@propertyInfo.Lookup.Url" |
|
|
|
autocomplete-filter-param-name="@propertyInfo.Lookup.FilterParamName" |
|
|
|
autocomplete-items-property-name="@propertyInfo.Lookup.ResultListPropertyName" |
|
|
|
autocomplete-display-property-name="@propertyInfo.Lookup.DisplayPropertyName" |
|
|
|
autocomplete-value-property-name="@propertyInfo.Lookup.ValuePropertyName"></abp-select> |
|
|
|
|