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**: Used to manage roles, users and their permissions.
* **Identity Server**: Integrates to IdentityServer4. * **Identity Server**: Integrates to IdentityServer4.
* **Permission Management**: Used to persist permissions. * **Permission Management**: Used to persist permissions.
* **[Setting Management](Setting-Management.md)**: Used to persist * **[Setting Management](Setting-Management.md)**: Used to persist and manage the [settings](../Settings.md).
and manage the [settings](../Settings.md).
* **Tenant Management**: Used to manage tenants for a [multi-tenant](../Multi-Tenancy.md) application. * **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. * **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; 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)); 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 void PreConfigureBundle(BundleConfigurationContext context)
{ {
} }
public virtual Task ConfigureBundleAsync(BundleConfigurationContext context)
{
ConfigureBundle(context);
return Task.CompletedTask;
}
public virtual void ConfigureBundle(BundleConfigurationContext context) public virtual void ConfigureBundle(BundleConfigurationContext context)
{ {
} }
public virtual Task PostConfigureBundleAsync(BundleConfigurationContext context)
{
PostConfigureBundle(context);
return Task.CompletedTask;
}
public virtual void PostConfigureBundle(BundleConfigurationContext context) 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) 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 public class BundleContributorCollection
{ {
private readonly List<BundleContributor> _contributors; private readonly List<IBundleContributor> _contributors;
public BundleContributorCollection() 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())) foreach (var dependedType in GetDirectDependencies(contributor.GetType()))
{ {
@ -27,7 +27,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
} }
public void Add<TContributor>() public void Add<TContributor>()
where TContributor : BundleContributor, new() where TContributor : IBundleContributor, new()
{ {
Add(typeof(TContributor)); Add(typeof(TContributor));
} }
@ -39,7 +39,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
AddWithDependencies(contributorType); AddWithDependencies(contributorType);
} }
public IReadOnlyList<BundleContributor> GetAll() public IReadOnlyList<IBundleContributor> GetAll()
{ {
return _contributors.ToImmutableList(); return _contributors.ToImmutableList();
} }
@ -77,14 +77,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
private void AddInstanceToContributors(Type contributorType) 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 try
{ {
_contributors.Add((BundleContributor)Activator.CreateInstance(contributorType)); _contributors.Add((IBundleContributor)Activator.CreateInstance(contributorType));
} }
catch (Exception ex) 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.Collections.Immutable;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -58,21 +59,21 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
Logger = NullLogger<BundleManager>.Instance; 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 contributors = GetContributors(bundles, bundleName);
var bundleFiles = RequestResources.TryAdd(GetBundleFiles(contributors)); var bundleFiles = RequestResources.TryAdd(await GetBundleFilesAsync(contributors));
var dynamicResources = RequestResources.TryAdd(GetDynamicResources(contributors)); var dynamicResources = RequestResources.TryAdd(await GetDynamicResourcesAsync(contributors));
if (!IsBundlingEnabled()) 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(); var context = CreateBundleConfigurationContext();
contributors.ForEach(c => c.PreConfigureBundle(context)); foreach (var contributor in contributors)
contributors.ForEach(c => c.ConfigureBundle(context)); {
contributors.ForEach(c => c.PostConfigureBundle(context)); 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; return context.Files;
} }
protected virtual List<string> GetDynamicResources(List<BundleContributor> contributors) protected virtual async Task<List<string>> GetDynamicResourcesAsync(List<IBundleContributor> contributors)
{ {
var context = CreateBundleConfigurationContext(); var context = CreateBundleConfigurationContext();
contributors.ForEach(c => c.ConfigureDynamicResources(context)); foreach (var contributor in contributors)
{
await contributor.ConfigureDynamicResourcesAsync(context);
}
return context.Files; return context.Files;
} }
@ -203,9 +218,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
return new BundleConfigurationContext(ServiceProvider, WebContentFileProvider); 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); AddContributorsWithBaseBundles(contributors, bundles, bundleName);
@ -222,7 +237,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
return contributors; 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); 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.Collections.Generic;
using System.Threading.Tasks;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
{ {
public interface IBundleManager 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 abstract class AbpTagHelperResourceService : ITransientDependency
{ {
public ILogger<AbpTagHelperResourceService> Logger { get; set; } public ILogger<AbpTagHelperResourceService> Logger { get; set; }
protected IBundleManager BundleManager { get; } protected IBundleManager BundleManager { get; }
protected IWebContentFileProvider WebContentFileProvider { get; } protected IWebContentFileProvider WebContentFileProvider { get; }
protected IWebHostEnvironment HostingEnvironment { get; } protected IWebHostEnvironment HostingEnvironment { get; }
@ -36,7 +35,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
Logger = NullLogger<AbpTagHelperResourceService>.Instance; Logger = NullLogger<AbpTagHelperResourceService>.Instance;
} }
public virtual Task ProcessAsync( public virtual async Task ProcessAsync(
[NotNull] TagHelperContext context, [NotNull] TagHelperContext context,
[NotNull] TagHelperOutput output, [NotNull] TagHelperOutput output,
[NotNull] List<BundleTagHelperItem> bundleItems, [NotNull] List<BundleTagHelperItem> bundleItems,
@ -57,7 +56,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
CreateBundle(bundleName, bundleItems); CreateBundle(bundleName, bundleItems);
var bundleFiles = GetBundleFiles(bundleName); var bundleFiles = await GetBundleFilesAsync(bundleName);
output.Content.Clear(); output.Content.Clear();
@ -74,13 +73,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
stopwatch.Stop(); stopwatch.Stop();
Logger.LogDebug($"Added bundle '{bundleName}' to the page in {stopwatch.Elapsed.TotalMilliseconds:0.00} ms."); 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 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); 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Hosting; 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) 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Hosting; 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) 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" [attr.type]="buttonType"
[ngClass]="buttonClass" [ngClass]="buttonClass"
[disabled]="loading || disabled" [disabled]="loading || disabled"
(click)="onClick($event)" (click.stop)="click.next($event); abpClick.next($event)"
(focus)="onFocus($event)" (focus)="focus.next($event); abpFocus.next($event)"
(blur)="onBlur($event)" (blur)="blur.next($event); abpBlur.next($event)"
> >
<i [ngClass]="icon" class="mr-1"></i><ng-content></ng-content> <i [ngClass]="icon" class="mr-1"></i><ng-content></ng-content>
</button> </button>
@ -41,15 +41,39 @@ export class ButtonComponent implements OnInit {
@Input() @Input()
attributes: ABP.Dictionary<string>; attributes: ABP.Dictionary<string>;
/*
*
*
* @deprecated use abpClick instead
*/
// tslint:disable-next-line: no-output-native // tslint:disable-next-line: no-output-native
@Output() readonly click = new EventEmitter<MouseEvent>(); @Output() readonly click = new EventEmitter<MouseEvent>();
/*
*
*
* @deprecated use abpFocus instead
*/
// tslint:disable-next-line: no-output-native // tslint:disable-next-line: no-output-native
@Output() readonly focus = new EventEmitter<FocusEvent>(); @Output() readonly focus = new EventEmitter<FocusEvent>();
/*
*
*
* @deprecated use abpBlur instead
*/
// tslint:disable-next-line: no-output-native // tslint:disable-next-line: no-output-native
@Output() readonly blur = new EventEmitter<FocusEvent>(); @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 }) @ViewChild('button', { static: true })
buttonRef: ElementRef<HTMLButtonElement>; 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