Browse Source

Merge branch 'dev' of https://github.com/abpframework/abp into dev

pull/2225/head
mehmet-erim 7 years ago
parent
commit
afca0693e6
  1. 3
      docs/en/Modules/Index.md
  2. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationExtensions.cs
  3. 32
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleContributor.cs
  4. 16
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleContributorCollection.cs
  5. 47
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs
  6. 15
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/IBundleContributor.cs
  7. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/IBundleManager.cs
  8. 9
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs
  9. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs
  10. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs
  11. 45
      npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts

3
docs/en/Modules/Index.md

@ -19,8 +19,7 @@ There are some **free and open source** application modules developed and mainta
* **Identity**: Used to manage roles, users and their permissions.
* **Identity Server**: Integrates to IdentityServer4.
* **Permission Management**: Used to persist permissions.
* **[Setting Management](Setting-Management.md)**: Used to persist
and manage the [settings](../Settings.md).
* **[Setting Management](Setting-Management.md)**: Used to persist and manage the [settings](../Settings.md).
* **Tenant Management**: Used to manage tenants for a [multi-tenant](../Multi-Tenancy.md) application.
* **Users**: Used to abstract users, so other modules can depend on this instead of the Identity module.

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationExtensions.cs

@ -10,7 +10,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
return bundleConfiguration;
}
public static BundleConfiguration AddContributors(this BundleConfiguration bundleConfiguration, params BundleContributor[] contributors)
public static BundleConfiguration AddContributors(this BundleConfiguration bundleConfiguration, params IBundleContributor[] contributors)
{
Check.NotNull(contributors, nameof(contributors));

32
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleContributor.cs

@ -1,23 +1,49 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
using System;
using System.Threading.Tasks;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
{
public abstract class BundleContributor
public abstract class BundleContributor : IBundleContributor
{
public virtual Task PreConfigureBundleAsync(BundleConfigurationContext context)
{
PreConfigureBundle(context);
return Task.CompletedTask;
}
public virtual void PreConfigureBundle(BundleConfigurationContext context)
{
}
public virtual Task ConfigureBundleAsync(BundleConfigurationContext context)
{
ConfigureBundle(context);
return Task.CompletedTask;
}
public virtual void ConfigureBundle(BundleConfigurationContext context)
{
}
public virtual Task PostConfigureBundleAsync(BundleConfigurationContext context)
{
PostConfigureBundle(context);
return Task.CompletedTask;
}
public virtual void PostConfigureBundle(BundleConfigurationContext context)
{
}
//TODO: Reconsider naming and usage!
public virtual Task ConfigureDynamicResourcesAsync(BundleConfigurationContext context)
{
ConfigureDynamicResources(context);
return Task.CompletedTask;
}
public virtual void ConfigureDynamicResources(BundleConfigurationContext context)
{

16
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleContributorCollection.cs

@ -9,14 +9,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
{
public class BundleContributorCollection
{
private readonly List<BundleContributor> _contributors;
private readonly List<IBundleContributor> _contributors;
public BundleContributorCollection()
{
_contributors = new List<BundleContributor>();
_contributors = new List<IBundleContributor>();
}
public void Add(BundleContributor contributor)
public void Add(IBundleContributor contributor)
{
foreach (var dependedType in GetDirectDependencies(contributor.GetType()))
{
@ -27,7 +27,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
}
public void Add<TContributor>()
where TContributor : BundleContributor, new()
where TContributor : IBundleContributor, new()
{
Add(typeof(TContributor));
}
@ -39,7 +39,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
AddWithDependencies(contributorType);
}
public IReadOnlyList<BundleContributor> GetAll()
public IReadOnlyList<IBundleContributor> GetAll()
{
return _contributors.ToImmutableList();
}
@ -77,14 +77,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
private void AddInstanceToContributors(Type contributorType)
{
if (!typeof(BundleContributor).IsAssignableFrom(contributorType))
if (!typeof(IBundleContributor).IsAssignableFrom(contributorType))
{
throw new AbpException($"Given {nameof(contributorType)} ({contributorType.AssemblyQualifiedName}) should implement the {typeof(BundleContributor).AssemblyQualifiedName} interface!");
throw new AbpException($"Given {nameof(contributorType)} ({contributorType.AssemblyQualifiedName}) should implement the {typeof(IBundleContributor).AssemblyQualifiedName} interface!");
}
try
{
_contributors.Add((BundleContributor)Activator.CreateInstance(contributorType));
_contributors.Add((IBundleContributor)Activator.CreateInstance(contributorType));
}
catch (Exception ex)
{

47
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
@ -58,21 +59,21 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
Logger = NullLogger<BundleManager>.Instance;
}
public virtual IReadOnlyList<string> GetStyleBundleFiles(string bundleName)
public virtual async Task<IReadOnlyList<string>> GetStyleBundleFilesAsync(string bundleName)
{
return GetBundleFiles(Options.StyleBundles, bundleName, StyleBundler);
return await GetBundleFilesAsync(Options.StyleBundles, bundleName, StyleBundler);
}
public virtual IReadOnlyList<string> GetScriptBundleFiles(string bundleName)
public virtual async Task<IReadOnlyList<string>> GetScriptBundleFilesAsync(string bundleName)
{
return GetBundleFiles(Options.ScriptBundles, bundleName, ScriptBundler);
return await GetBundleFilesAsync(Options.ScriptBundles, bundleName, ScriptBundler);
}
protected virtual IReadOnlyList<string> GetBundleFiles(BundleConfigurationCollection bundles, string bundleName, IBundler bundler)
protected virtual async Task<IReadOnlyList<string>> GetBundleFilesAsync(BundleConfigurationCollection bundles, string bundleName, IBundler bundler)
{
var contributors = GetContributors(bundles, bundleName);
var bundleFiles = RequestResources.TryAdd(GetBundleFiles(contributors));
var dynamicResources = RequestResources.TryAdd(GetDynamicResources(contributors));
var bundleFiles = RequestResources.TryAdd(await GetBundleFilesAsync(contributors));
var dynamicResources = RequestResources.TryAdd(await GetDynamicResourcesAsync(contributors));
if (!IsBundlingEnabled())
{
@ -178,22 +179,36 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
}
}
protected virtual List<string> GetBundleFiles(List<BundleContributor> contributors)
protected async Task<List<string>> GetBundleFilesAsync(List<IBundleContributor> contributors)
{
var context = CreateBundleConfigurationContext();
contributors.ForEach(c => c.PreConfigureBundle(context));
contributors.ForEach(c => c.ConfigureBundle(context));
contributors.ForEach(c => c.PostConfigureBundle(context));
foreach (var contributor in contributors)
{
await contributor.PreConfigureBundleAsync(context);
}
foreach (var contributor in contributors)
{
await contributor.ConfigureBundleAsync(context);
}
foreach (var contributor in contributors)
{
await contributor.PostConfigureBundleAsync(context);
}
return context.Files;
}
protected virtual List<string> GetDynamicResources(List<BundleContributor> contributors)
protected virtual async Task<List<string>> GetDynamicResourcesAsync(List<IBundleContributor> contributors)
{
var context = CreateBundleConfigurationContext();
contributors.ForEach(c => c.ConfigureDynamicResources(context));
foreach (var contributor in contributors)
{
await contributor.ConfigureDynamicResourcesAsync(context);
}
return context.Files;
}
@ -203,9 +218,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
return new BundleConfigurationContext(ServiceProvider, WebContentFileProvider);
}
protected virtual List<BundleContributor> GetContributors(BundleConfigurationCollection bundles, string bundleName)
protected virtual List<IBundleContributor> GetContributors(BundleConfigurationCollection bundles, string bundleName)
{
var contributors = new List<BundleContributor>();
var contributors = new List<IBundleContributor>();
AddContributorsWithBaseBundles(contributors, bundles, bundleName);
@ -222,7 +237,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
return contributors;
}
protected virtual void AddContributorsWithBaseBundles(List<BundleContributor> contributors, BundleConfigurationCollection bundles, string bundleName)
protected virtual void AddContributorsWithBaseBundles(List<IBundleContributor> contributors, BundleConfigurationCollection bundles, string bundleName)
{
var bundleConfiguration = bundles.Get(bundleName);

15
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/IBundleContributor.cs

@ -0,0 +1,15 @@
using System.Threading.Tasks;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
{
public interface IBundleContributor
{
Task PreConfigureBundleAsync(BundleConfigurationContext context);
Task ConfigureBundleAsync(BundleConfigurationContext context);
Task PostConfigureBundleAsync(BundleConfigurationContext context);
Task ConfigureDynamicResourcesAsync(BundleConfigurationContext context);
}
}

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/IBundleManager.cs

@ -1,11 +1,12 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
{
public interface IBundleManager
{
IReadOnlyList<string> GetStyleBundleFiles(string bundleName);
Task<IReadOnlyList<string>> GetStyleBundleFilesAsync(string bundleName);
IReadOnlyList<string> GetScriptBundleFiles(string bundleName);
Task<IReadOnlyList<string>> GetScriptBundleFilesAsync(string bundleName);
}
}

9
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs

@ -16,7 +16,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
public abstract class AbpTagHelperResourceService : ITransientDependency
{
public ILogger<AbpTagHelperResourceService> Logger { get; set; }
protected IBundleManager BundleManager { get; }
protected IWebContentFileProvider WebContentFileProvider { get; }
protected IWebHostEnvironment HostingEnvironment { get; }
@ -36,7 +35,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
Logger = NullLogger<AbpTagHelperResourceService>.Instance;
}
public virtual Task ProcessAsync(
public virtual async Task ProcessAsync(
[NotNull] TagHelperContext context,
[NotNull] TagHelperOutput output,
[NotNull] List<BundleTagHelperItem> bundleItems,
@ -57,7 +56,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
CreateBundle(bundleName, bundleItems);
var bundleFiles = GetBundleFiles(bundleName);
var bundleFiles = await GetBundleFilesAsync(bundleName);
output.Content.Clear();
@ -74,13 +73,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
stopwatch.Stop();
Logger.LogDebug($"Added bundle '{bundleName}' to the page in {stopwatch.Elapsed.TotalMilliseconds:0.00} ms.");
return Task.CompletedTask;
}
protected abstract void CreateBundle(string bundleName, List<BundleTagHelperItem> bundleItems);
protected abstract IReadOnlyList<string> GetBundleFiles(string bundleName);
protected abstract Task<IReadOnlyList<string>> GetBundleFilesAsync(string bundleName);
protected abstract void AddHtmlTag(TagHelperContext context, TagHelperOutput output, string file);

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Hosting;
@ -33,9 +34,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
);
}
protected override IReadOnlyList<string> GetBundleFiles(string bundleName)
protected override async Task<IReadOnlyList<string>> GetBundleFilesAsync(string bundleName)
{
return BundleManager.GetScriptBundleFiles(bundleName);
return await BundleManager.GetScriptBundleFilesAsync(bundleName);
}
protected override void AddHtmlTag(TagHelperContext context, TagHelperOutput output, string file)

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Hosting;
@ -33,9 +34,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
);
}
protected override IReadOnlyList<string> GetBundleFiles(string bundleName)
protected override async Task<IReadOnlyList<string>> GetBundleFilesAsync(string bundleName)
{
return BundleManager.GetStyleBundleFiles(bundleName);
return await BundleManager.GetStyleBundleFilesAsync(bundleName);
}
protected override void AddHtmlTag(TagHelperContext context, TagHelperOutput output, string file)

45
npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts

@ -11,9 +11,9 @@ import { ABP } from '@abp/ng.core';
[attr.type]="buttonType"
[ngClass]="buttonClass"
[disabled]="loading || disabled"
(click)="onClick($event)"
(focus)="onFocus($event)"
(blur)="onBlur($event)"
(click.stop)="click.next($event); abpClick.next($event)"
(focus)="focus.next($event); abpFocus.next($event)"
(blur)="blur.next($event); abpBlur.next($event)"
>
<i [ngClass]="icon" class="mr-1"></i><ng-content></ng-content>
</button>
@ -41,15 +41,39 @@ export class ButtonComponent implements OnInit {
@Input()
attributes: ABP.Dictionary<string>;
/*
*
*
* @deprecated use abpClick instead
*/
// tslint:disable-next-line: no-output-native
@Output() readonly click = new EventEmitter<MouseEvent>();
/*
*
*
* @deprecated use abpFocus instead
*/
// tslint:disable-next-line: no-output-native
@Output() readonly focus = new EventEmitter<FocusEvent>();
/*
*
*
* @deprecated use abpBlur instead
*/
// tslint:disable-next-line: no-output-native
@Output() readonly blur = new EventEmitter<FocusEvent>();
// tslint:disable-next-line: no-output-native
@Output() readonly abpClick = new EventEmitter<MouseEvent>();
// tslint:disable-next-line: no-output-native
@Output() readonly abpFocus = new EventEmitter<FocusEvent>();
// tslint:disable-next-line: no-output-native
@Output() readonly abpBlur = new EventEmitter<FocusEvent>();
@ViewChild('button', { static: true })
buttonRef: ElementRef<HTMLButtonElement>;
@ -66,19 +90,4 @@ export class ButtonComponent implements OnInit {
});
}
}
onClick(event: MouseEvent) {
event.stopPropagation();
this.click.next(event);
}
onFocus(event: FocusEvent) {
event.stopPropagation();
this.focus.next(event);
}
onBlur(event: FocusEvent) {
event.stopPropagation();
this.blur.next(event);
}
}

Loading…
Cancel
Save