data source v0.0.34
This commit is contained in:
		
							parent
							
								
									71a4d01930
								
							
						
					
					
						commit
						36fb823902
					
				| @ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "data", | ||||
|   "version": "0.0.28", | ||||
|   "version": "0.0.29", | ||||
|   "scripts": { | ||||
|     "ng": "ng", | ||||
|     "start": "ng serve", | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "@poweredsoft/data", | ||||
|   "version": "0.0.33", | ||||
|   "version": "0.0.34", | ||||
|   "peerDependencies": { | ||||
|     "rxjs": "^6.5.3" | ||||
|   } | ||||
|  | ||||
| @ -7,6 +7,7 @@ import { IDataSourceErrorMessage } from './IDataSourceErrorMessage'; | ||||
| import { IDataSourceValidationError } from './IDataSourceValidationError'; | ||||
| import { IDataSourceError } from './IDataSourceError'; | ||||
| import { IDataSourceNotifyMessage } from './IDataSourceNotifyMessage'; | ||||
| import { IDataSourceCommandStarted } from './IDataSourceCommandStarted'; | ||||
| 
 | ||||
| export class DataSource<TModel> implements IDataSource<TModel>  | ||||
| { | ||||
| @ -15,12 +16,14 @@ export class DataSource<TModel> implements IDataSource<TModel> | ||||
|     protected _dataSubject: BehaviorSubject<IQueryExecutionResult<TModel> & IQueryExecutionGroupResult<TModel>> = new BehaviorSubject(null); | ||||
|     protected _loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject(false); | ||||
|     protected _validationSubject: Subject<IDataSourceValidationError> = new Subject(); | ||||
|     protected _commandStartedSubject: Subject<IDataSourceCommandStarted> = new Subject(); | ||||
|     protected _notifyMessageSubject: Subject<IDataSourceNotifyMessage> = new Subject(); | ||||
| 
 | ||||
|     protected _data$: Observable<IQueryExecutionResult<TModel> & IQueryExecutionGroupResult<TModel>>; | ||||
|     protected _loading$: Observable<boolean>; | ||||
|     protected _validationError$: Observable<IDataSourceValidationError>; | ||||
|     protected _notifyMessage$: Observable<IDataSourceNotifyMessage>; | ||||
|     protected _commandStarted$: Observable<IDataSourceCommandStarted>; | ||||
|      | ||||
|     protected _criteria: IQueryCriteria = { | ||||
|         page: null, | ||||
| @ -52,6 +55,14 @@ export class DataSource<TModel> implements IDataSource<TModel> | ||||
|         return this._validationError$; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     get commandStarted$() { | ||||
|         if (!this._commandStarted$) | ||||
|             this._commandStarted$ = this._commandStartedSubject.asObservable(); | ||||
| 
 | ||||
|         return this._commandStarted$; | ||||
|     } | ||||
| 
 | ||||
|     get notifyMessage$() { | ||||
|         if (!this._notifyMessage$) | ||||
|             this._notifyMessage$ = this._notifyMessageSubject.asObservable(); | ||||
| @ -138,6 +149,10 @@ export class DataSource<TModel> implements IDataSource<TModel> | ||||
|         if (!this.options.transport.commands.hasOwnProperty(name)) | ||||
|             return throwError(`command with name ${name} not found`); | ||||
| 
 | ||||
|         this._commandStartedSubject.next({ | ||||
|             name: name, command: command | ||||
|         }); | ||||
| 
 | ||||
|         return this.options.transport.commands[name].adapter.handle(command).pipe( | ||||
|             map(t => { | ||||
|                 this._notifyMessageSubject.next({ | ||||
|  | ||||
| @ -0,0 +1,5 @@ | ||||
| 
 | ||||
| export interface IDataSourceCommandStarted { | ||||
|     name: string; | ||||
|     command: any; | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user