Merged PR 45: command modal & form group modal
command modal & form group modal
This commit is contained in:
		
						commit
						2732c8da46
					
				
							
								
								
									
										40
									
								
								angular.json
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								angular.json
									
									
									
									
									
								
							| @ -163,6 +163,46 @@ | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "@poweredsoft/ngx-bootstrap": { | ||||
|       "projectType": "library", | ||||
|       "root": "projects/poweredsoft/ngx-bootstrap", | ||||
|       "sourceRoot": "projects/poweredsoft/ngx-bootstrap/src", | ||||
|       "prefix": "psbx", | ||||
|       "architect": { | ||||
|         "build": { | ||||
|           "builder": "@angular-devkit/build-ng-packagr:build", | ||||
|           "options": { | ||||
|             "tsConfig": "projects/poweredsoft/ngx-bootstrap/tsconfig.lib.json", | ||||
|             "project": "projects/poweredsoft/ngx-bootstrap/ng-package.json" | ||||
|           }, | ||||
|           "configurations": { | ||||
|             "production": { | ||||
|               "tsConfig": "projects/poweredsoft/ngx-bootstrap/tsconfig.lib.prod.json" | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         "test": { | ||||
|           "builder": "@angular-devkit/build-angular:karma", | ||||
|           "options": { | ||||
|             "main": "projects/poweredsoft/ngx-bootstrap/src/test.ts", | ||||
|             "tsConfig": "projects/poweredsoft/ngx-bootstrap/tsconfig.spec.json", | ||||
|             "karmaConfig": "projects/poweredsoft/ngx-bootstrap/karma.conf.js" | ||||
|           } | ||||
|         }, | ||||
|         "lint": { | ||||
|           "builder": "@angular-devkit/build-angular:tslint", | ||||
|           "options": { | ||||
|             "tsConfig": [ | ||||
|               "projects/poweredsoft/ngx-bootstrap/tsconfig.lib.json", | ||||
|               "projects/poweredsoft/ngx-bootstrap/tsconfig.spec.json" | ||||
|             ], | ||||
|             "exclude": [ | ||||
|               "**/node_modules/**" | ||||
|             ] | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     }}, | ||||
|   "defaultProject": "ngx-cdk-ui" | ||||
| } | ||||
|  | ||||
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -1,5 +1,5 @@ | ||||
| { | ||||
|   "name": "ngx-cdk-ui", | ||||
|   "name": "ngx-ui", | ||||
|   "version": "0.0.0", | ||||
|   "lockfileVersion": 1, | ||||
|   "requires": true, | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| { | ||||
|   "name": "ngx-cdk-ui", | ||||
|   "name": "ngx-ui", | ||||
|   "version": "0.0.0", | ||||
|   "scripts": { | ||||
|     "ng": "ng", | ||||
| @ -9,8 +9,8 @@ | ||||
|     "lint": "ng lint", | ||||
|     "e2e": "ng e2e", | ||||
|     "clean": "rimraf dist", | ||||
|     "start:app": "wait-on dist/poweredsoft/ngx-cdk-ui/fesm5 && ng serve --poll 2000", | ||||
|     "watch:lib": "ng build @poweredsoft/ngx-cdk-ui --watch", | ||||
|     "start:app": "wait-on dist/poweredsoft/ngx-cdk-ui/fesm5 && dist/poweredsoft/ngx-bootstrap/fesm5 && ng serve --poll 2000", | ||||
|     "watch:lib": "ng build @poweredsoft/ngx-cdk-ui --watch && ng build @poweredsoft/ngx-bootstrap --watch", | ||||
|     "watch:all": "npm run clean && run-p watch:lib start:app" | ||||
|   }, | ||||
|   "private": true, | ||||
|  | ||||
							
								
								
									
										24
									
								
								projects/poweredsoft/ngx-bootstrap/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								projects/poweredsoft/ngx-bootstrap/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | ||||
| # NgxBootstrap | ||||
| 
 | ||||
| This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.9. | ||||
| 
 | ||||
| ## Code scaffolding | ||||
| 
 | ||||
| Run `ng generate component component-name --project ngx-bootstrap` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-bootstrap`. | ||||
| > Note: Don't forget to add `--project ngx-bootstrap` or else it will be added to the default project in your `angular.json` file.  | ||||
| 
 | ||||
| ## Build | ||||
| 
 | ||||
| Run `ng build ngx-bootstrap` to build the project. The build artifacts will be stored in the `dist/` directory. | ||||
| 
 | ||||
| ## Publishing | ||||
| 
 | ||||
| After building your library with `ng build ngx-bootstrap`, go to the dist folder `cd dist/ngx-bootstrap` and run `npm publish`. | ||||
| 
 | ||||
| ## Running unit tests | ||||
| 
 | ||||
| Run `ng test ngx-bootstrap` to execute the unit tests via [Karma](https://karma-runner.github.io). | ||||
| 
 | ||||
| ## Further help | ||||
| 
 | ||||
| To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). | ||||
							
								
								
									
										32
									
								
								projects/poweredsoft/ngx-bootstrap/karma.conf.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								projects/poweredsoft/ngx-bootstrap/karma.conf.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | ||||
| // Karma configuration file, see link for more information
 | ||||
| // https://karma-runner.github.io/1.0/config/configuration-file.html
 | ||||
| 
 | ||||
| module.exports = function (config) { | ||||
|   config.set({ | ||||
|     basePath: '', | ||||
|     frameworks: ['jasmine', '@angular-devkit/build-angular'], | ||||
|     plugins: [ | ||||
|       require('karma-jasmine'), | ||||
|       require('karma-chrome-launcher'), | ||||
|       require('karma-jasmine-html-reporter'), | ||||
|       require('karma-coverage-istanbul-reporter'), | ||||
|       require('@angular-devkit/build-angular/plugins/karma') | ||||
|     ], | ||||
|     client: { | ||||
|       clearContext: false // leave Jasmine Spec Runner output visible in browser
 | ||||
|     }, | ||||
|     coverageIstanbulReporter: { | ||||
|       dir: require('path').join(__dirname, '../../../coverage/poweredsoft/ngx-bootstrap'), | ||||
|       reports: ['html', 'lcovonly', 'text-summary'], | ||||
|       fixWebpackSourcePaths: true | ||||
|     }, | ||||
|     reporters: ['progress', 'kjhtml'], | ||||
|     port: 9876, | ||||
|     colors: true, | ||||
|     logLevel: config.LOG_INFO, | ||||
|     autoWatch: true, | ||||
|     browsers: ['Chrome'], | ||||
|     singleRun: false, | ||||
|     restartOnFileChange: true | ||||
|   }); | ||||
| }; | ||||
							
								
								
									
										7
									
								
								projects/poweredsoft/ngx-bootstrap/ng-package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								projects/poweredsoft/ngx-bootstrap/ng-package.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| { | ||||
|   "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", | ||||
|   "dest": "../../../dist/poweredsoft/ngx-bootstrap", | ||||
|   "lib": { | ||||
|     "entryFile": "src/public-api.ts" | ||||
|   } | ||||
| } | ||||
							
								
								
									
										12
									
								
								projects/poweredsoft/ngx-bootstrap/package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								projects/poweredsoft/ngx-bootstrap/package.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| { | ||||
|   "name": "@poweredsoft/ngx-bootstrap", | ||||
|   "version": "0.0.1", | ||||
|   "peerDependencies": { | ||||
|     "@angular/common": "^9.1.9", | ||||
|     "@angular/core": "^9.1.9", | ||||
|     "ngx-bootstrap": "^5.6.1" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "tslib": "^1.10.0" | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,15 @@ | ||||
| import { NgModule } from '@angular/core'; | ||||
| import { CommonModule } from '@angular/common'; | ||||
| import { ModalModule } from 'ngx-bootstrap/modal'; | ||||
| import { CommandModalDirective } from './directives/command-modal.directive'; | ||||
| import { CommandModalComponent } from './command-modal/command-modal.component'; | ||||
| 
 | ||||
| @NgModule({ | ||||
|   imports: [ | ||||
|     CommonModule, | ||||
|     ModalModule.forRoot() | ||||
|   ], | ||||
|   declarations: [CommandModalDirective, CommandModalComponent], | ||||
|   exports: [CommandModalDirective] | ||||
| }) | ||||
| export class CommandModalModule { } | ||||
| @ -0,0 +1,24 @@ | ||||
| <div class="modal-header"> | ||||
|     <h4 class="modal-title pull-left">{{ title }}</h4> | ||||
|     <button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()"> | ||||
|         <span aria-hidden="true">×</span> | ||||
|     </button> | ||||
| </div> | ||||
| <div class="modal-body"> | ||||
|     <ng-container [ngTemplateOutlet]="template" | ||||
|         [ngTemplateOutletContext]="{ $implicit: commandModel, loading: loading }"></ng-container> | ||||
| </div> | ||||
| <div class="modal-footer"> | ||||
|     <button type="button" class="btn btn-light" (click)="modalRef.hide()" | ||||
|         [attr.disabled]="loading">{{ cancelText }}</button> | ||||
|     <button type="button" class="btn btn-primary" (click)="attemptSave()" | ||||
|         [attr.disabled]="loading">{{ commandText }}</button> | ||||
| 
 | ||||
|     <br> | ||||
| 
 | ||||
|     <div class="progress" style="width: 100%" *ngIf="loading"> | ||||
|         <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" | ||||
|             aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div> | ||||
|     </div> | ||||
| 
 | ||||
| </div> | ||||
| @ -0,0 +1,25 @@ | ||||
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||||
| 
 | ||||
| import { CommandModalComponent } from './command-modal.component'; | ||||
| 
 | ||||
| describe('CommandModalComponent', () => { | ||||
|   let component: CommandModalComponent; | ||||
|   let fixture: ComponentFixture<CommandModalComponent>; | ||||
| 
 | ||||
|   beforeEach(async(() => { | ||||
|     TestBed.configureTestingModule({ | ||||
|       declarations: [ CommandModalComponent ] | ||||
|     }) | ||||
|     .compileComponents(); | ||||
|   })); | ||||
| 
 | ||||
|   beforeEach(() => { | ||||
|     fixture = TestBed.createComponent(CommandModalComponent); | ||||
|     component = fixture.componentInstance; | ||||
|     fixture.detectChanges(); | ||||
|   }); | ||||
| 
 | ||||
|   it('should create', () => { | ||||
|     expect(component).toBeTruthy(); | ||||
|   }); | ||||
| }); | ||||
| @ -0,0 +1,63 @@ | ||||
| import { Component, OnInit, TemplateRef, OnDestroy } from '@angular/core'; | ||||
| import { IDataSource } from '@poweredsoft/data'; | ||||
| import { BsModalRef } from 'ngx-bootstrap/modal'; | ||||
| import { finalize} from 'rxjs/operators'; | ||||
| import { Subscription } from 'rxjs'; | ||||
| 
 | ||||
| @Component({ | ||||
|   selector: 'psbx-command-modal', | ||||
|   templateUrl: './command-modal.component.html', | ||||
|   styleUrls: ['./command-modal.component.scss'] | ||||
| }) | ||||
| export class CommandModalComponent implements OnInit, OnDestroy { | ||||
| 
 | ||||
|   title: string; | ||||
|   template: TemplateRef<any>; | ||||
|   command: string; | ||||
|   commandModel: any; | ||||
|   dataSource: IDataSource<any>; | ||||
|   refreshOnSuccess: boolean; | ||||
|   loading: boolean; | ||||
|   commandText: string; | ||||
|   cancelText: string; | ||||
| 
 | ||||
|   private _notifyMessage: Subscription; | ||||
|   private _validationError: Subscription; | ||||
| 
 | ||||
|   constructor(public modalRef: BsModalRef) { } | ||||
| 
 | ||||
|   ngOnDestroy(): void { | ||||
|     this._notifyMessage.unsubscribe(); | ||||
|     this._validationError.unsubscribe(); | ||||
|   } | ||||
| 
 | ||||
|   ngOnInit(): void { | ||||
|     this._notifyMessage = this.dataSource.notifyMessage$.subscribe(message => { | ||||
|        | ||||
|     }); | ||||
| 
 | ||||
|     this._validationError = this.dataSource.validationError$.subscribe(validatorErrors => { | ||||
|       console.log(validatorErrors); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   attemptSave() { | ||||
|     debugger; | ||||
|     this.loading = true; | ||||
|     this.dataSource.executeCommandByName(this.command, this.commandModel) | ||||
|       .pipe( | ||||
|         finalize(() => { | ||||
|           this.loading = false; | ||||
|         }) | ||||
|       ) | ||||
|       .subscribe(success => { | ||||
|         if (this.refreshOnSuccess) | ||||
|           this.dataSource.refresh(); | ||||
| 
 | ||||
|         this.modalRef.hide(); | ||||
|       }, fail => { | ||||
|         // you do not want to close on failure.. so just ignore..
 | ||||
|       }); | ||||
|   } | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,51 @@ | ||||
| import { Directive, HostListener, Input, TemplateRef } from '@angular/core'; | ||||
| import { IDataSource } from '@poweredsoft/data'; | ||||
| import { BsModalService } from 'ngx-bootstrap/modal'; | ||||
| import { CommandModalComponent } from '../command-modal/command-modal.component'; | ||||
| 
 | ||||
| @Directive({ | ||||
|   selector: '[psbxCommandModal]' | ||||
| }) | ||||
| export class CommandModalDirective { | ||||
| 
 | ||||
|   constructor(private modalService: BsModalService) { } | ||||
| 
 | ||||
| 
 | ||||
|   @Input() dataSource: IDataSource<any>; | ||||
|   @Input() command: string; | ||||
|   @Input() model: any; | ||||
|   @Input() template: TemplateRef<any>; | ||||
|   @Input() commandTitle: string; | ||||
|   @Input() refreshOnSuccess: boolean; | ||||
|   @Input() commandText: string; | ||||
|   @Input() cancelText: string; | ||||
|   @Input() animated: boolean; | ||||
| 
 | ||||
|   @HostListener('click') | ||||
|   wasClicked() {             | ||||
|     this.dataSource.resolveCommandModelByName({ | ||||
|       command: this.command, | ||||
|       model: this.model | ||||
|     }).subscribe(commandModel => {                     | ||||
|       const initialState = { | ||||
|         dataSource: this.dataSource, | ||||
|         command: this.command, | ||||
|         commandModel: commandModel, | ||||
|         template: this.template, | ||||
|         title: this.commandTitle, | ||||
|         refreshOnSuccess: this.refreshOnSuccess === undefined ? true : this.refreshOnSuccess, | ||||
|         commandText: this.commandText || 'OK', | ||||
|         cancelText: this.cancelText || 'Cancel' | ||||
|       }; | ||||
|       this.modalService.show(CommandModalComponent, { | ||||
|         animated: this.animated === undefined ? true : this.animated, | ||||
|         initialState | ||||
|       }); | ||||
| 
 | ||||
|     }, error => { | ||||
| 
 | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,108 @@ | ||||
| import { Directive, Input, TemplateRef, HostListener, Output, EventEmitter } from '@angular/core'; | ||||
| import { IDataSource } from '@poweredsoft/data'; | ||||
| import { BsModalService } from 'ngx-bootstrap/modal'; | ||||
| import { FormGroupCommandModalComponent } from '../form-group-command-modal/form-group-command-modal.component'; | ||||
| import { FormGroup } from '@angular/forms'; | ||||
| 
 | ||||
| export interface IModelFormCreateEvent | ||||
| { | ||||
|   shouldSetCommandModel: boolean; | ||||
|   viewModel: any; | ||||
|   commandName: string; | ||||
|   commandModel: any; | ||||
|   formGroup?: FormGroup; | ||||
| } | ||||
| 
 | ||||
| @Directive({ | ||||
|   selector: '[psbxFormGroupCommandModal]' | ||||
| }) | ||||
| export class FormGroupCommandModalDirective { | ||||
| 
 | ||||
| 
 | ||||
|   @Input() dataSource: IDataSource<any>; | ||||
|   @Input() command: string; | ||||
|   @Input() model: any; | ||||
|   @Input() template: TemplateRef<any>; | ||||
|   @Input() commandTitle: string; | ||||
|   @Input() animated: boolean; | ||||
|   @Input() refreshOnSuccess: boolean; | ||||
|   @Input() commandText: string; | ||||
|   @Input() cancelText: string; | ||||
| 
 | ||||
|   @Output() formCreate: EventEmitter<IModelFormCreateEvent> = new EventEmitter<IModelFormCreateEvent>(); | ||||
| 
 | ||||
|   constructor(private modalService: BsModalService) { } | ||||
| 
 | ||||
|   @HostListener('click') | ||||
|   wasClicked() { | ||||
|     this.dataSource.resolveCommandModelByName({ | ||||
|       command: this.command, | ||||
|       model: this.model | ||||
|     }).subscribe(commandModel => { | ||||
| 
 | ||||
|        | ||||
| 
 | ||||
|       const event = <IModelFormCreateEvent>{ | ||||
|         commandName: this.command, | ||||
|         viewModel: this.model, | ||||
|         commandModel: commandModel, | ||||
|         shouldSetCommandModel: true | ||||
|       } | ||||
| 
 | ||||
|       this.formCreate.emit(event); | ||||
| 
 | ||||
|       if (event.formGroup == null) | ||||
|         throw new Error('form group should be set, after form createEvent'); | ||||
| 
 | ||||
|       if (event.shouldSetCommandModel) | ||||
|         event.formGroup.patchValue(commandModel); | ||||
| 
 | ||||
|       const initialState = { | ||||
|         dataSource: this.dataSource, | ||||
|         command: this.command, | ||||
|         template: this.template, | ||||
|         title: this.commandTitle, | ||||
|         refreshOnSuccess: this.refreshOnSuccess === undefined ? true : this.refreshOnSuccess, | ||||
|         commandText: this.commandText || 'OK', | ||||
|         cancelText: this.cancelText || 'Cancel', | ||||
|         modelForm: event.formGroup | ||||
|       }; | ||||
|        | ||||
|       this.modalService.show(FormGroupCommandModalComponent, { | ||||
|         animated: this.animated === undefined ? true : this.animated, | ||||
|         initialState | ||||
|       }); | ||||
| 
 | ||||
|     }, error => { | ||||
| 
 | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   // @Input()
 | ||||
|   // set psbxFormGroupCommandModal(element:HTMLBaseElement){
 | ||||
|   //   element.addEventListener('click',()=>{
 | ||||
|   //     this.dataSource.resolveCommandModelByName({
 | ||||
|   //       command: this.command,
 | ||||
|   //       model: this.model
 | ||||
|   //     }).subscribe(commandModel => {
 | ||||
|   //       const initialState = {
 | ||||
|   //         dataSource: this.dataSource,
 | ||||
|   //         command: this.command,
 | ||||
|   //         commandModel: commandModel,
 | ||||
|   //         template: this.template,
 | ||||
|   //         title: this.commandTitle,
 | ||||
|   //         refreshOnSuccess: this.refreshOnSuccess === undefined ? true : this.refreshOnSuccess,
 | ||||
|   //         commandText: this.commandText || 'OK',
 | ||||
|   //         cancelText: this.cancelText || 'Cancel'
 | ||||
|   //       };
 | ||||
|   //       this.modalService.show(FormGroupCommandModalComponent, {
 | ||||
|   //         animated: this.animated === undefined ? true : this.animated,
 | ||||
|   //         initialState
 | ||||
|   //       })
 | ||||
|   //     },error => {
 | ||||
| 
 | ||||
|   //     });
 | ||||
|   //   })
 | ||||
|   // }
 | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,20 @@ | ||||
| import { NgModule } from '@angular/core'; | ||||
| import { CommonModule } from '@angular/common'; | ||||
| import { FormGroupCommandModalComponent } from './form-group-command-modal/form-group-command-modal.component'; | ||||
| import { FormGroupCommandModalDirective } from './directives/form-group-command-modal.directive'; | ||||
| import { ModalModule } from 'ngx-bootstrap/modal'; | ||||
| import { ReactiveFormsModule } from '@angular/forms'; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| @NgModule({ | ||||
|   imports: [ | ||||
|     CommonModule, | ||||
|     ModalModule.forRoot(), | ||||
|     ReactiveFormsModule | ||||
|   ], | ||||
|   declarations: [FormGroupCommandModalComponent, FormGroupCommandModalDirective], | ||||
|   exports: [FormGroupCommandModalDirective] | ||||
| }) | ||||
| export class FormGroupCommandModalModule { } | ||||
| @ -0,0 +1,31 @@ | ||||
| 
 | ||||
| 
 | ||||
|     <div class="modal-header"> | ||||
|         <h4 class="modal-title pull-left">{{ title }}</h4> | ||||
|         <button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()"> | ||||
|             <span aria-hidden="true">×</span> | ||||
|         </button> | ||||
|     </div> | ||||
|      | ||||
|     <div class="model-body"> | ||||
|         <ng-container [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{ $implicit: modelForm, loading: loading }"> | ||||
|         </ng-container> | ||||
| 
 | ||||
|         <div *ngIf="errorMessage" class="alert alert-danger mt-2"> | ||||
|             {{ errorMessage }} | ||||
|         </div> | ||||
|     </div> | ||||
|    | ||||
|      | ||||
|      | ||||
|     <div class="modal-footer"> | ||||
|         <button type="button" class="btn btn-light" (click)="modalRef.hide()" | ||||
|             [attr.disabled]="loading">{{ cancelText }}</button> | ||||
|         <button type="button" class="btn btn-primary" (click)="attemptSave()" [attr.disabled]="loading">Creat</button> | ||||
|         <br> | ||||
|      | ||||
|         <div class="progress" style="width: 100%" *ngIf="loading"> | ||||
|             <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" | ||||
|                 aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div> | ||||
|         </div> | ||||
|     </div> | ||||
| @ -0,0 +1,77 @@ | ||||
| import { Component, OnInit, TemplateRef } from '@angular/core'; | ||||
| import { BsModalRef } from 'ngx-bootstrap/modal'; | ||||
| import { IDataSource } from '@poweredsoft/data'; | ||||
| import { finalize } from 'rxjs/operators'; | ||||
| import { Subscription } from 'rxjs' | ||||
| import { FormGroup, FormControl } from '@angular/forms'; | ||||
| 
 | ||||
| @Component({ | ||||
|   selector: 'ps-form-group-command-modal', | ||||
|   templateUrl: './form-group-command-modal.component.html', | ||||
|   styleUrls: ['./form-group-command-modal.component.scss'] | ||||
| }) | ||||
| export class FormGroupCommandModalComponent implements OnInit { | ||||
| 
 | ||||
| 
 | ||||
|   modelForm: FormGroup; | ||||
|   title: string; | ||||
|   template: TemplateRef<any>; | ||||
|   command: string; | ||||
|   dataSource: IDataSource<any>; | ||||
|   refreshOnSuccess: boolean; | ||||
|   loading: boolean; | ||||
|   commandText: string; | ||||
|   cancelText: string; | ||||
|   errorMessage: string; | ||||
| 
 | ||||
|   private _notifyMessage: Subscription; | ||||
|   private _validationError: Subscription; | ||||
| 
 | ||||
|   constructor(public modalRef: BsModalRef) { } | ||||
| 
 | ||||
|   ngOnDestroy(): void { | ||||
|     /* | ||||
|     this._notifyMessage.unsubscribe(); | ||||
|     this._validationError.unsubscribe(); | ||||
|     */ | ||||
|   } | ||||
| 
 | ||||
|   ngOnInit(): void { | ||||
|     this.errorMessage = null; | ||||
|     // this._notifyMessage = this.dataSource.notifyMessage$.subscribe(message => {
 | ||||
|        | ||||
|     // });
 | ||||
| 
 | ||||
|     // this._validationError = this.dataSource.validationError$.subscribe(validatorErrors => {
 | ||||
|     //   console.log(validatorErrors);
 | ||||
|     // });
 | ||||
|   } | ||||
| 
 | ||||
|   attemptSave() { | ||||
| 
 | ||||
|     this.errorMessage = null; | ||||
|     if (!this.modelForm.valid) | ||||
|     { | ||||
|       this.errorMessage = 'Form is not valid, please enter all required fields'; | ||||
|       return; | ||||
|     } | ||||
| 
 | ||||
|     const finalModel = this.modelForm.value;   | ||||
|     //this.modelForm.setValue(this.commandModel)
 | ||||
|     this.loading = true; | ||||
|     this.dataSource.executeCommandByName(this.command, finalModel) | ||||
|       .pipe( | ||||
|         finalize(() => { | ||||
|           this.loading = false; | ||||
|         }) | ||||
|       ) | ||||
|       .subscribe(success => { | ||||
|         if (this.refreshOnSuccess) | ||||
|           this.dataSource.refresh(); | ||||
| 
 | ||||
|         this.modalRef.hide(); | ||||
|       }, fail => { | ||||
|         // you do not want to close on failure.. so just ignore..
 | ||||
|       }); | ||||
|   } | ||||
| } | ||||
							
								
								
									
										8
									
								
								projects/poweredsoft/ngx-bootstrap/src/public-api.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								projects/poweredsoft/ngx-bootstrap/src/public-api.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | ||||
| /* | ||||
|  * Public API Surface of ngx-bootstrap | ||||
|  */ | ||||
| 
 | ||||
| export * from './lib/command-modal/command-modal.module'; | ||||
| export * from './lib/command-modal/directives/command-modal.directive'; | ||||
| export * from './lib/form-group-command-modal/form-group-command-modal.module'; | ||||
| export * from './lib/form-group-command-modal/directives/form-group-command-modal.directive'; | ||||
							
								
								
									
										26
									
								
								projects/poweredsoft/ngx-bootstrap/src/test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								projects/poweredsoft/ngx-bootstrap/src/test.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | ||||
| // This file is required by karma.conf.js and loads recursively all the .spec and framework files
 | ||||
| 
 | ||||
| import 'zone.js/dist/zone'; | ||||
| import 'zone.js/dist/zone-testing'; | ||||
| import { getTestBed } from '@angular/core/testing'; | ||||
| import { | ||||
|   BrowserDynamicTestingModule, | ||||
|   platformBrowserDynamicTesting | ||||
| } from '@angular/platform-browser-dynamic/testing'; | ||||
| 
 | ||||
| declare const require: { | ||||
|   context(path: string, deep?: boolean, filter?: RegExp): { | ||||
|     keys(): string[]; | ||||
|     <T>(id: string): T; | ||||
|   }; | ||||
| }; | ||||
| 
 | ||||
| // First, initialize the Angular testing environment.
 | ||||
| getTestBed().initTestEnvironment( | ||||
|   BrowserDynamicTestingModule, | ||||
|   platformBrowserDynamicTesting() | ||||
| ); | ||||
| // Then we find all the tests.
 | ||||
| const context = require.context('./', true, /\.spec\.ts$/); | ||||
| // And load the modules.
 | ||||
| context.keys().map(context); | ||||
							
								
								
									
										23
									
								
								projects/poweredsoft/ngx-bootstrap/tsconfig.lib.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								projects/poweredsoft/ngx-bootstrap/tsconfig.lib.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | ||||
| { | ||||
|   "extends": "../../../tsconfig.json", | ||||
|   "compilerOptions": { | ||||
|     "outDir": "../../../out-tsc/lib", | ||||
|     "target": "es2015", | ||||
|     "declaration": true, | ||||
|     "inlineSources": true, | ||||
|     "types": [], | ||||
|     "lib": [ | ||||
|       "dom", | ||||
|       "es2018" | ||||
|     ] | ||||
|   }, | ||||
|   "angularCompilerOptions": { | ||||
|     "skipTemplateCodegen": true, | ||||
|     "strictMetadataEmit": true, | ||||
|     "enableResourceInlining": true | ||||
|   }, | ||||
|   "exclude": [ | ||||
|     "src/test.ts", | ||||
|     "**/*.spec.ts" | ||||
|   ] | ||||
| } | ||||
| @ -0,0 +1,6 @@ | ||||
| { | ||||
|   "extends": "./tsconfig.lib.json", | ||||
|   "angularCompilerOptions": { | ||||
|     "enableIvy": false | ||||
|   } | ||||
| } | ||||
							
								
								
									
										17
									
								
								projects/poweredsoft/ngx-bootstrap/tsconfig.spec.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								projects/poweredsoft/ngx-bootstrap/tsconfig.spec.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| { | ||||
|   "extends": "../../../tsconfig.json", | ||||
|   "compilerOptions": { | ||||
|     "outDir": "../../../out-tsc/spec", | ||||
|     "types": [ | ||||
|       "jasmine", | ||||
|       "node" | ||||
|     ] | ||||
|   }, | ||||
|   "files": [ | ||||
|     "src/test.ts" | ||||
|   ], | ||||
|   "include": [ | ||||
|     "**/*.spec.ts", | ||||
|     "**/*.d.ts" | ||||
|   ] | ||||
| } | ||||
							
								
								
									
										17
									
								
								projects/poweredsoft/ngx-bootstrap/tslint.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								projects/poweredsoft/ngx-bootstrap/tslint.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| { | ||||
|   "extends": "../../../tslint.json", | ||||
|   "rules": { | ||||
|     "directive-selector": [ | ||||
|       true, | ||||
|       "attribute", | ||||
|       "lib", | ||||
|       "camelCase" | ||||
|     ], | ||||
|     "component-selector": [ | ||||
|       true, | ||||
|       "element", | ||||
|       "lib", | ||||
|       "kebab-case" | ||||
|     ] | ||||
|   } | ||||
| } | ||||
| @ -15,6 +15,14 @@ const routes: Routes = [ | ||||
|   { | ||||
|     path: 'list-view', | ||||
|     loadChildren: () => import('./list-view-demo/list-view-demo.module').then(m => m.ListViewDemoModule) | ||||
|   }, | ||||
|   { | ||||
|     path: 'command-modal', | ||||
|     loadChildren: () => import('./command-modal-demo/command-modal-demo.module').then(m => m.CommandModalDemoModule) | ||||
|   }, | ||||
|   { | ||||
|     path: 'form-group', | ||||
|     loadChildren: () => import('./form-group-modal-demo/form-group-modal-demo.module').then(m => m.FormGroupModalDemoModule) | ||||
|   } | ||||
| ]; | ||||
| 
 | ||||
|  | ||||
| @ -12,6 +12,12 @@ | ||||
|         <li class="nav-item"> | ||||
|           <a class="nav-link" routerLink="list-view">List View</a> | ||||
|         </li> | ||||
|         <li class="nav-item"> | ||||
|           <a class="nav-link" routerLink="command-modal">Command Modal</a> | ||||
|         </li> | ||||
|         <li class="nav-item"> | ||||
|           <a class="nav-link" routerLink="form-group">Form Group Modal</a> | ||||
|         </li> | ||||
|       </ul> | ||||
|     </div> | ||||
|     <div class="col-lg-10" style="padding-top: 5px"> | ||||
|  | ||||
| @ -0,0 +1,18 @@ | ||||
| import { NgModule } from '@angular/core'; | ||||
| import { Routes, RouterModule } from '@angular/router'; | ||||
| import { CommandModalDemoComponent } from './command-modal-demo/command-modal-demo.component'; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| const routes: Routes = [ | ||||
|   { | ||||
|     path: '', | ||||
|     component: CommandModalDemoComponent | ||||
|   } | ||||
| ]; | ||||
| 
 | ||||
| @NgModule({ | ||||
|   imports: [RouterModule.forChild(routes)], | ||||
|   exports: [RouterModule] | ||||
| }) | ||||
| export class CommandModalDemoRoutingModule { } | ||||
							
								
								
									
										19
									
								
								src/app/command-modal-demo/command-modal-demo.module.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/app/command-modal-demo/command-modal-demo.module.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| import { NgModule } from '@angular/core'; | ||||
| import { CommonModule } from '@angular/common'; | ||||
| import { CommandModalDemoComponent } from './command-modal-demo/command-modal-demo.component'; | ||||
| import { CommandModalDemoRoutingModule } from './command-modal-demo-routing.module'; | ||||
| import { DataGridModule } from '@poweredsoft/ngx-cdk-ui'; | ||||
| 
 | ||||
| import {FormsModule} from '@angular/forms'; | ||||
| import { CommandModalModule } from '@poweredsoft/ngx-bootstrap'; | ||||
| @NgModule({ | ||||
|   declarations: [CommandModalDemoComponent], | ||||
|   imports: [ | ||||
|     CommonModule, | ||||
|     CommandModalDemoRoutingModule, | ||||
|     DataGridModule, | ||||
|     CommandModalModule, | ||||
|     FormsModule | ||||
|   ] | ||||
| }) | ||||
| export class CommandModalDemoModule { } | ||||
| @ -0,0 +1,47 @@ | ||||
| <h1> | ||||
|     This is a demo for a command modal. | ||||
| </h1> | ||||
| <ps-data-grid [dataSource]="merchantDataSource" [(columns)]="columns" | ||||
|     tableClasses="table table-sm table-dark table-striped table-bordered"> | ||||
|     <ng-container *psDataGridHeader> | ||||
|         <button class="btn-primary btn" psbxCommandModal commandTitle="Adding a new merchant" commandText="Add" | ||||
|             [dataSource]="merchantDataSource" command="addMerchant" [template]="theModal">Create a new record</button> | ||||
| 
 | ||||
|     </ng-container> | ||||
|     <ng-container psDataGridCol="id"> | ||||
|         <div *psDataGridColHeader>ID</div> | ||||
|         <div *psDataGridCell="let model">{{model.id}}</div> | ||||
|     </ng-container> | ||||
|     <ng-container psDataGridCol="name"> | ||||
|         <div *psDataGridColHeader>Name</div> | ||||
|         <div *psDataGridCell="let model">{{model.name}}</div> | ||||
|     </ng-container> | ||||
|     <ng-container psDataGridCol="address"> | ||||
|         <div *psDataGridColHeader>Address</div> | ||||
|         <div *psDataGridCell="let model">{{model.address}}</div> | ||||
|     </ng-container> | ||||
| 
 | ||||
|     <ng-container psDataGridCol="commands"> | ||||
|         <ng-container *psDataGridColHeader>Actions</ng-container> | ||||
|         <ng-container *psDataGridCell="let model"> | ||||
|             <button class="btn-primary btn" psbxCommandModal [commandTitle]="'Change ' + model.name + ' name'" commandText="Update" | ||||
|             [dataSource]="merchantDataSource" command="changeMerchantName" [model]="model" [template]="changeName">Change name</button> | ||||
|         </ng-container> | ||||
|     </ng-container> | ||||
|     <ng-container *psDataGridFooter> | ||||
|         <button class="btn-primary btn" psbxCommandModal commandTitle="Adding a new merchant" commandText="Add" | ||||
|             [dataSource]="merchantDataSource" command="addMerchant" [template]="theModal">Create a new record</button> | ||||
|     </ng-container> | ||||
| </ps-data-grid> | ||||
| 
 | ||||
| <ng-template #changeName let-command let-loading="loading"> | ||||
|     New Name | ||||
|     <input type="text" [attr.disabled]="loading" [(ngModel)]="command.newName" placeholder="Entermerchant new name" class="form-control"> | ||||
| </ng-template> | ||||
| 
 | ||||
| <ng-template #theModal let-command let-loading="loading"> | ||||
|     Name | ||||
|     <input type="text" [attr.disabled]="loading" [(ngModel)]="command.name" placeholder="Enter a merchant name" class="form-control"> | ||||
|     Address | ||||
|     <input type="text" [attr.disabled]="loading" [(ngModel)]="command.address" placeholder="Enter the merchant's address" class="form-control"> | ||||
| </ng-template> | ||||
| @ -0,0 +1,50 @@ | ||||
| import { Component, OnInit } from '@angular/core'; | ||||
| import { IDataSource } from '@poweredsoft/data'; | ||||
| import { IMerchant } from 'src/app/data/services/IMerchant'; | ||||
| import { MerchantService } from 'src/app/data/services/merchant.service'; | ||||
| 
 | ||||
| @Component({ | ||||
|   selector: 'ps-command-modal-demo', | ||||
|   templateUrl: './command-modal-demo.component.html', | ||||
|   styleUrls: ['./command-modal-demo.component.scss'] | ||||
| }) | ||||
| export class CommandModalDemoComponent implements OnInit { | ||||
| 
 | ||||
|   columns = ['id','name', 'address', 'commands'] | ||||
|   merchantDataSource: IDataSource<IMerchant>;   | ||||
|   constructor(private  merchantService: MerchantService){ | ||||
|     this.merchantDataSource = this.createDataSource(); | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   newMerchant(name: string) { | ||||
|     this.merchantDataSource.executeCommandByName('addMerchant', { | ||||
|       name: name | ||||
|     }).subscribe( | ||||
|       res => { | ||||
|         alert('it worked!'); | ||||
|         this.merchantDataSource.refresh(); | ||||
|       }, | ||||
|       err => { | ||||
|         console.log(err); | ||||
|         alert('failed'); | ||||
|       } | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   createDataSource(): IDataSource<IMerchant> { | ||||
|     return this.merchantService.createDataSource(); | ||||
|   } | ||||
| 
 | ||||
|   ngOnInit() { | ||||
|     this.merchantDataSource.loading$.subscribe(isLoading => { | ||||
|       console.log('merchant data source event loading', isLoading); | ||||
|     }); | ||||
| 
 | ||||
|     this.merchantDataSource.data$.subscribe(receivedData => { | ||||
|       console.log('new data is coming from the server', receivedData); | ||||
|     }); | ||||
|     this.merchantDataSource.refresh(); | ||||
|   } | ||||
| 
 | ||||
| } | ||||
| @ -4,7 +4,6 @@ import { CommonModule } from '@angular/common'; | ||||
| import { DataGridDemoRoutingModule } from './data-grid-demo-routing.module'; | ||||
| import { DataGridDemoHomeComponent } from './data-grid-demo-home/data-grid-demo-home.component'; | ||||
| import { DataGridModule } from '@poweredsoft/ngx-cdk-ui'; | ||||
| import { PaginationModule } from 'ngx-bootstrap/pagination'; | ||||
| 
 | ||||
| 
 | ||||
| @NgModule({ | ||||
| @ -12,8 +11,7 @@ import { PaginationModule } from 'ngx-bootstrap/pagination'; | ||||
|   imports: [ | ||||
|     CommonModule, | ||||
|     DataGridDemoRoutingModule, | ||||
|     DataGridModule, | ||||
|     PaginationModule | ||||
|     DataGridModule     | ||||
|   ] | ||||
| }) | ||||
| export class DataGridDemoModule { } | ||||
|  | ||||
| @ -27,7 +27,7 @@ export class MerchantService { | ||||
|       (model) => model.id, | ||||
|       { | ||||
|         page: 1, | ||||
|         pageSize: 50, | ||||
|         pageSize: 150, | ||||
|       }, | ||||
|       true | ||||
|     ); | ||||
| @ -78,7 +78,7 @@ export class MerchantService { | ||||
|        | ||||
|       // viewModel -> transform to the form model for that command -> IChangeMerchantName
 | ||||
|       e => of(<IAddMerchantCommand>{ | ||||
|         name: '', | ||||
|         name: 'A New merchant', | ||||
|         address: '' | ||||
|       }) | ||||
|     ); | ||||
|  | ||||
| @ -0,0 +1,15 @@ | ||||
| import { NgModule } from '@angular/core'; | ||||
| import { Routes, RouterModule } from '@angular/router'; | ||||
| import { FormGroupModalDemoComponent } from './form-group-modal-demo/form-group-modal-demo.component'; | ||||
| 
 | ||||
| 
 | ||||
| const routes: Routes = [{ | ||||
|   path: '', | ||||
|   component: FormGroupModalDemoComponent | ||||
| }]; | ||||
| 
 | ||||
| @NgModule({ | ||||
|   imports: [RouterModule.forChild(routes)], | ||||
|   exports: [RouterModule] | ||||
| }) | ||||
| export class FormGroupModalDemoRoutingModule { } | ||||
| @ -0,0 +1,22 @@ | ||||
| import { NgModule } from '@angular/core'; | ||||
| import { CommonModule } from '@angular/common'; | ||||
| import { FormGroupModalDemoComponent } from './form-group-modal-demo/form-group-modal-demo.component'; | ||||
| import { FormGroupModalDemoRoutingModule } from './form-group-modal-demo-routing.module' | ||||
| import { DataGridModule } from '@poweredsoft/ngx-cdk-ui'; | ||||
| import { FormGroupCommandModalModule,CommandModalModule } from '@poweredsoft/ngx-bootstrap'; | ||||
| import { ReactiveFormsModule } from '@angular/forms'; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| @NgModule({ | ||||
|   declarations: [FormGroupModalDemoComponent], | ||||
|   imports: [ | ||||
|     CommonModule, | ||||
|     FormGroupModalDemoRoutingModule, | ||||
|     DataGridModule, | ||||
|     FormGroupCommandModalModule, | ||||
|     ReactiveFormsModule | ||||
|      | ||||
|   ] | ||||
| }) | ||||
| export class FormGroupModalDemoModule { } | ||||
| @ -0,0 +1,36 @@ | ||||
| <h3>This is the demo for form-group modal!</h3> | ||||
| <ps-data-grid [dataSource]="merchantDataSource" [(columns)]="columns" tableClasses="table table-dark table-striped table-sm table-bordered"> | ||||
|     <ng-container *psDataGridHeader> | ||||
|             <button class="btn-success btn" psbxFormGroupCommandModal commandTitle="Adding a new merchant" commandText="Add" | ||||
|             [dataSource]="merchantDataSource" command="addMerchant" (formCreate)="onFormCreate($event)" [template]="theModal">Create a new</button>    | ||||
|     </ng-container> | ||||
|     <ng-container psDataGridCol="id"> | ||||
|         <div *psDataGridColHeader>ID</div> | ||||
|         <div *psDataGridCell="let model">{{model.id}}</div> | ||||
|     </ng-container> | ||||
|     <ng-container psDataGridCol="name"> | ||||
|         <div *psDataGridColHeader>Name</div> | ||||
|         <div *psDataGridCell="let model">{{model.name}}</div> | ||||
|     </ng-container> | ||||
|     <ng-container psDataGridCol="address"> | ||||
|         <div *psDataGridColHeader>Address</div> | ||||
|         <div *psDataGridCell="let model">{{model.address}}</div> | ||||
|     </ng-container> | ||||
|     <ng-container psDataGridCol="actions"> | ||||
|         <ng-container *psDataGridColHeader>Actions</ng-container> | ||||
|         <ng-container *psDataGridCell="let model"> | ||||
|             <button class="btn btn-primary mr-2">{{model.name}}</button> | ||||
|         </ng-container> | ||||
|     </ng-container> | ||||
| </ps-data-grid> | ||||
| 
 | ||||
| <ng-template #theModal let-form let-loading="loading"> | ||||
|     <form [formGroup]="form"> | ||||
|         <div class="form-group"> | ||||
|             <label for="name" class="col-sm-2 control-label">Name</label> | ||||
|             <div class="col-sm-8"> | ||||
|                 <input id="name" type="text" class="form-control" formControlName="name"> | ||||
|             </div> | ||||
|         </div> | ||||
|     </form> | ||||
| </ng-template> | ||||
| @ -0,0 +1,52 @@ | ||||
| import { Component, OnInit } from '@angular/core'; | ||||
| import { IDataSource } from '@poweredsoft/data'; | ||||
| import { IMerchant } from 'src/app/data/services/IMerchant'; | ||||
| import { MerchantService } from 'src/app/data/services/merchant.service'; | ||||
| import { FormGroup, FormControl, FormBuilder, Validators } from '@angular/forms'; | ||||
| import { IModelFormCreateEvent } from 'projects/poweredsoft/ngx-bootstrap/src/public-api'; | ||||
| 
 | ||||
| @Component({ | ||||
|   selector: 'ps-form-group-modal-demo', | ||||
|   templateUrl: './form-group-modal-demo.component.html', | ||||
|   styleUrls: ['./form-group-modal-demo.component.scss'] | ||||
| }) | ||||
| export class FormGroupModalDemoComponent implements OnInit { | ||||
|   | ||||
|   createDataSource(): IDataSource<IMerchant> { | ||||
|     return this.merchantService.createDataSource(); | ||||
|   } | ||||
| 
 | ||||
|    | ||||
|   merchantDataSource: IDataSource<IMerchant>; | ||||
|   columns = ['id','name', 'address', 'actions']; | ||||
|   constructor(private merchantService: MerchantService, private fb: FormBuilder) { | ||||
|     this.merchantDataSource = this.createDataSource(); | ||||
|    } | ||||
| 
 | ||||
|   ngOnInit(): void { | ||||
|     this.merchantDataSource.refresh(); | ||||
|   } | ||||
| 
 | ||||
|   onFormCreate(event: IModelFormCreateEvent) { | ||||
|     event.shouldSetCommandModel = false; | ||||
|     event.formGroup = this.fb.group({ | ||||
|       'name': [event.commandModel.name, Validators.required] | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
| 
 | ||||
|   newMerchant(name: string) { | ||||
|     this.merchantDataSource.executeCommandByName('addMerchant', { | ||||
|       name: name | ||||
|     }).subscribe( | ||||
|       res => { | ||||
|         alert('it worked!'); | ||||
|         this.merchantDataSource.refresh(); | ||||
|       }, | ||||
|       err => { | ||||
|         console.log(err); | ||||
|         alert('failed'); | ||||
|       } | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -19,6 +19,10 @@ | ||||
|       "@poweredsoft/ngx-cdk-ui": [ | ||||
|         "dist/poweredsoft/ngx-cdk-ui/poweredsoft-ngx-cdk-ui", | ||||
|         "dist/poweredsoft/ngx-cdk-ui" | ||||
|       ], | ||||
|       "@poweredsoft/ngx-bootstrap": [ | ||||
|         "dist/poweredsoft/ngx-bootstrap/poweredsoft-ngx-bootstrap", | ||||
|         "dist/poweredsoft/ngx-bootstrap" | ||||
|       ] | ||||
|     } | ||||
|   }, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user