@abp/ng.theme.shared 5.3.0-rc.1 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Optional, SkipSelf, Component, ChangeDetectionStrategy, Input, ViewChild, Directive, Host, InjectionToken, Inject, ViewChildren, Injector, LOCALE_ID, NgModule } from '@angular/core';
2
+ import { Injectable, Optional, SkipSelf, Component, ChangeDetectionStrategy, Input, ViewChild, Directive, Host, InjectionToken, Inject, ViewChildren, Injector, LOCALE_ID, Pipe, NgModule } from '@angular/core';
3
3
  import * as i5 from '@angular/common';
4
4
  import { formatDate } from '@angular/common';
5
5
  import * as i2 from '@ng-bootstrap/ng-bootstrap';
@@ -670,6 +670,9 @@ class ToolbarAction extends Action {
670
670
  super(options.permission || '', options.visible, options.action);
671
671
  this.text = options.text;
672
672
  this.icon = options.icon || '';
673
+ if (options.btnClass) {
674
+ this.btnClass = options.btnClass;
675
+ }
673
676
  }
674
677
  static create(options) {
675
678
  return new ToolbarAction(options);
@@ -972,22 +975,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImpor
972
975
  type: Input
973
976
  }] } });
974
977
 
978
+ class CreateInjectorPipe {
979
+ transform(_, action, context) {
980
+ const get = (token, notFoundValue, flags) => {
981
+ const componentData = context.getData();
982
+ const componentDataCallback = data => {
983
+ data = data ?? context.getData();
984
+ return action.action(data);
985
+ };
986
+ let extensionData;
987
+ switch (token) {
988
+ case EXTENSIONS_ACTION_DATA:
989
+ extensionData = componentData;
990
+ break;
991
+ case EXTENSIONS_ACTION_CALLBACK:
992
+ extensionData = componentDataCallback;
993
+ break;
994
+ default:
995
+ extensionData = context.getInjected.call(context.injector, token, notFoundValue, flags);
996
+ }
997
+ return extensionData;
998
+ };
999
+ return { get };
1000
+ }
1001
+ }
1002
+ CreateInjectorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: CreateInjectorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1003
+ CreateInjectorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: CreateInjectorPipe, name: "createInjector" });
1004
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: CreateInjectorPipe, decorators: [{
1005
+ type: Pipe,
1006
+ args: [{
1007
+ name: 'createInjector',
1008
+ }]
1009
+ }] });
1010
+
975
1011
  class PageToolbarComponent extends AbstractActionsComponent {
976
1012
  constructor(injector) {
977
1013
  super(injector);
978
1014
  this.injector = injector;
1015
+ this.defaultBtnClass = 'btn btn-sm btn-primary';
1016
+ this.getData = () => this.data;
979
1017
  this.trackByFn = (_, item) => item.action || item.component;
980
1018
  }
981
- createInjector(action) {
982
- const get = (token, notFoundValue, flags) => {
983
- return token === EXTENSIONS_ACTION_DATA
984
- ? this.data
985
- : token === EXTENSIONS_ACTION_CALLBACK
986
- ? (data = this.data) => action.action(data)
987
- : this.getInjected.call(this.injector, token, notFoundValue, flags);
988
- };
989
- return { get };
990
- }
991
1019
  }
992
1020
  PageToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: PageToolbarComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
993
1021
  PageToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: PageToolbarComponent, selector: "abp-page-toolbar", providers: [
@@ -995,7 +1023,7 @@ PageToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
995
1023
  provide: EXTENSIONS_ACTION_TYPE,
996
1024
  useValue: 'toolbarActions',
997
1025
  },
998
- ], exportAs: ["abpPageToolbar"], usesInheritance: true, ngImport: i0, template: "<div class=\"row justify-content-end mx-0\" id=\"AbpContentToolbar\">\r\n <div\r\n class=\"col-auto px-1 pt-0 pt-md-2\"\r\n [class.pe-0]=\"last\"\r\n *ngFor=\"let action of actionList; trackBy: trackByFn; let last = last\"\r\n >\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <ng-container *abpPermission=\"action.permission\">\r\n <ng-container *ngIf=\"action.component as component; else button\">\r\n <ng-container\r\n *ngComponentOutlet=\"component; injector: createInjector(action)\"\r\n ></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #button>\r\n <button (click)=\"action.action(data)\" type=\"button\" class=\"btn btn-primary btn-sm\">\r\n <i [ngClass]=\"action.icon\" [class.me-1]=\"action.icon\"></i>\r\n {{ action.text | abpLocalization }}\r\n </button>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n", directives: [{ type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.PermissionDirective, selector: "[abpPermission]", inputs: ["abpPermission"] }, { type: i5.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModuleFactory"] }, { type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "abpLocalization": i1.LocalizationPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1026
+ ], exportAs: ["abpPageToolbar"], usesInheritance: true, ngImport: i0, template: "<div class=\"row justify-content-end mx-0\" id=\"AbpContentToolbar\">\r\n <div\r\n class=\"col-auto px-1 pt-0 pt-md-2\"\r\n [class.pe-0]=\"last\"\r\n *ngFor=\"let action of actionList; trackBy: trackByFn; let last = last\"\r\n >\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <ng-container *abpPermission=\"action.permission\">\r\n <ng-container *ngIf=\"action.component as component; else button\">\r\n <ng-container\r\n *ngComponentOutlet=\"component; injector: record | createInjector: action:this\"\r\n ></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #button>\r\n <button (click)=\"action.action(data)\" type=\"button\" [ngClass]=\"action.btnClass ? action.btnClass : defaultBtnClass\" >\r\n <i [ngClass]=\"action.icon\" [class.me-1]=\"action.icon\"></i>\r\n {{ action.text | abpLocalization }}\r\n </button>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n", directives: [{ type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.PermissionDirective, selector: "[abpPermission]", inputs: ["abpPermission"] }, { type: i5.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModuleFactory"] }, { type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "createInjector": CreateInjectorPipe, "abpLocalization": i1.LocalizationPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
999
1027
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: PageToolbarComponent, decorators: [{
1000
1028
  type: Component,
1001
1029
  args: [{ exportAs: 'abpPageToolbar', selector: 'abp-page-toolbar', providers: [
@@ -1003,7 +1031,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImpor
1003
1031
  provide: EXTENSIONS_ACTION_TYPE,
1004
1032
  useValue: 'toolbarActions',
1005
1033
  },
1006
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"row justify-content-end mx-0\" id=\"AbpContentToolbar\">\r\n <div\r\n class=\"col-auto px-1 pt-0 pt-md-2\"\r\n [class.pe-0]=\"last\"\r\n *ngFor=\"let action of actionList; trackBy: trackByFn; let last = last\"\r\n >\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <ng-container *abpPermission=\"action.permission\">\r\n <ng-container *ngIf=\"action.component as component; else button\">\r\n <ng-container\r\n *ngComponentOutlet=\"component; injector: createInjector(action)\"\r\n ></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #button>\r\n <button (click)=\"action.action(data)\" type=\"button\" class=\"btn btn-primary btn-sm\">\r\n <i [ngClass]=\"action.icon\" [class.me-1]=\"action.icon\"></i>\r\n {{ action.text | abpLocalization }}\r\n </button>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n" }]
1034
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"row justify-content-end mx-0\" id=\"AbpContentToolbar\">\r\n <div\r\n class=\"col-auto px-1 pt-0 pt-md-2\"\r\n [class.pe-0]=\"last\"\r\n *ngFor=\"let action of actionList; trackBy: trackByFn; let last = last\"\r\n >\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <ng-container *abpPermission=\"action.permission\">\r\n <ng-container *ngIf=\"action.component as component; else button\">\r\n <ng-container\r\n *ngComponentOutlet=\"component; injector: record | createInjector: action:this\"\r\n ></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #button>\r\n <button (click)=\"action.action(data)\" type=\"button\" [ngClass]=\"action.btnClass ? action.btnClass : defaultBtnClass\" >\r\n <i [ngClass]=\"action.icon\" [class.me-1]=\"action.icon\"></i>\r\n {{ action.text | abpLocalization }}\r\n </button>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n" }]
1007
1035
  }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
1008
1036
 
1009
1037
  var objectExtensions = /*#__PURE__*/Object.freeze({
@@ -1020,7 +1048,8 @@ BaseUiExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0",
1020
1048
  ExtensibleFormComponent,
1021
1049
  ExtensibleTableComponent,
1022
1050
  PropDataDirective,
1023
- DisabledDirective], imports: [CoreModule,
1051
+ DisabledDirective,
1052
+ CreateInjectorPipe], imports: [CoreModule,
1024
1053
  ThemeSharedModule,
1025
1054
  NgxValidateCoreModule,
1026
1055
  NgbDatepickerModule,
@@ -1032,7 +1061,8 @@ BaseUiExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0",
1032
1061
  ExtensibleFormComponent,
1033
1062
  ExtensibleTableComponent,
1034
1063
  PropDataDirective,
1035
- DisabledDirective] });
1064
+ DisabledDirective,
1065
+ CreateInjectorPipe] });
1036
1066
  BaseUiExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BaseUiExtensionsModule, imports: [[
1037
1067
  CoreModule,
1038
1068
  ThemeSharedModule,
@@ -1053,6 +1083,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImpor
1053
1083
  ExtensibleTableComponent,
1054
1084
  PropDataDirective,
1055
1085
  DisabledDirective,
1086
+ CreateInjectorPipe,
1056
1087
  ],
1057
1088
  declarations: [
1058
1089
  DateTimePickerComponent,
@@ -1063,6 +1094,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImpor
1063
1094
  ExtensibleTableComponent,
1064
1095
  PropDataDirective,
1065
1096
  DisabledDirective,
1097
+ CreateInjectorPipe,
1066
1098
  ],
1067
1099
  imports: [
1068
1100
  CoreModule,
@@ -1331,5 +1363,5 @@ function isUndefined(obj) {
1331
1363
  * Generated bundle index. Do not edit.
1332
1364
  */
1333
1365
 
1334
- export { ActionList, BaseUiExtensionsModule, CreateFormPropsFactory, DateAdapter, DateTimeAdapter, DateTimePickerComponent, DisabledDirective, ENTITY_PROP_TYPE_CLASSES, EXTENSIONS_ACTION_CALLBACK, EXTENSIONS_ACTION_DATA, EXTENSIONS_ACTION_TYPE, EXTENSIONS_IDENTIFIER, EXTRA_PROPERTIES_KEY, EditFormPropsFactory, EntityAction, EntityActionList, EntityActions, EntityActionsFactory, EntityProp, EntityPropList, EntityProps, EntityPropsFactory, ExtensibleFormComponent, ExtensibleFormPropComponent, ExtensibleTableComponent, ExtensionsService, FormProp, FormPropData, FormPropList, FormProps, GridActionsComponent, objectExtensions as ObjectExtensions, PROP_DATA_STREAM, PageToolbarComponent, PropDataDirective, PropList, TimeAdapter, ToolbarAction, ToolbarActionList, ToolbarActions, ToolbarActionsFactory, ToolbarComponent, UiExtensionsModule, createExtraPropertyValueResolver, generateFormFromProps, getObjectExtensionEntitiesFromStore, mapEntitiesToContributors, mergeWithDefaultActions, mergeWithDefaultProps };
1366
+ export { ActionList, BaseUiExtensionsModule, CreateFormPropsFactory, CreateInjectorPipe, DateAdapter, DateTimeAdapter, DateTimePickerComponent, DisabledDirective, ENTITY_PROP_TYPE_CLASSES, EXTENSIONS_ACTION_CALLBACK, EXTENSIONS_ACTION_DATA, EXTENSIONS_ACTION_TYPE, EXTENSIONS_IDENTIFIER, EXTRA_PROPERTIES_KEY, EditFormPropsFactory, EntityAction, EntityActionList, EntityActions, EntityActionsFactory, EntityProp, EntityPropList, EntityProps, EntityPropsFactory, ExtensibleFormComponent, ExtensibleFormPropComponent, ExtensibleTableComponent, ExtensionsService, FormProp, FormPropData, FormPropList, FormProps, GridActionsComponent, objectExtensions as ObjectExtensions, PROP_DATA_STREAM, PageToolbarComponent, PropDataDirective, PropList, TimeAdapter, ToolbarAction, ToolbarActionList, ToolbarActions, ToolbarActionsFactory, ToolbarComponent, UiExtensionsModule, createExtraPropertyValueResolver, generateFormFromProps, getObjectExtensionEntitiesFromStore, mapEntitiesToContributors, mergeWithDefaultActions, mergeWithDefaultProps };
1335
1367
  //# sourceMappingURL=abp-ng.theme.shared-extensions.mjs.map