can now pass params to commands.

This commit is contained in:
David Lebee 2021-09-03 17:32:52 -04:00
parent 21a93e1a1a
commit e7f9f2c52d
8 changed files with 20 additions and 11 deletions

6
package-lock.json generated
View File

@ -1676,9 +1676,9 @@
} }
}, },
"@poweredsoft/data": { "@poweredsoft/data": {
"version": "0.0.35", "version": "0.0.36",
"resolved": "https://registry.npmjs.org/@poweredsoft/data/-/data-0.0.35.tgz", "resolved": "https://registry.npmjs.org/@poweredsoft/data/-/data-0.0.36.tgz",
"integrity": "sha512-od4w5sorQmV/M74yHXn/xTwh6YdoYBzq79bS8F/BHBuoE2FEuY0o8JD5rime4gKqtClFvBD5O9k4aqlpNNdkpw==", "integrity": "sha512-Jgns+OVwcBX/UFrgAaaOM3SGiVIlD+bXTIBkvdE0EvcxOlH1Zcqx4xB7KLAqNha7WtSzu+MvvYFPIwwjMlGUOA==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }

View File

@ -24,7 +24,7 @@
"@angular/platform-browser-dynamic": "~9.1.4", "@angular/platform-browser-dynamic": "~9.1.4",
"@angular/router": "~9.1.4", "@angular/router": "~9.1.4",
"@ng-select/ng-select": "^4.0.1", "@ng-select/ng-select": "^4.0.1",
"@poweredsoft/data": "0.0.35", "@poweredsoft/data": "0.0.36",
"@poweredsoft/ngx-data": "0.0.22", "@poweredsoft/ngx-data": "0.0.22",
"@poweredsoft/ngx-data-apollo": "0.0.10", "@poweredsoft/ngx-data-apollo": "0.0.10",
"apollo-angular": "^1.8.0", "apollo-angular": "^1.8.0",

View File

@ -1,12 +1,13 @@
{ {
"name": "@poweredsoft/ngx-bootstrap", "name": "@poweredsoft/ngx-bootstrap",
"version": "0.0.12", "version": "0.0.13",
"description": "an internal use libary for handling data souces grid filtering sorting, add commands etc", "description": "an internal use libary for handling data souces grid filtering sorting, add commands etc",
"keywords": [ "keywords": [
"angular", "angular",
"ngx-bootstrap" "ngx-bootstrap"
], ],
"peerDependencies": { "peerDependencies": {
"@poweredsoft/data": "^0.0.36",
"@angular/common": "^9.1.9", "@angular/common": "^9.1.9",
"@angular/core": "^9.1.9", "@angular/core": "^9.1.9",
"ngx-bootstrap": "^5.6.1" "ngx-bootstrap": "^5.6.1"

View File

@ -25,6 +25,7 @@ export class CommandModalDirective {
@Input() disableValidationSummary: boolean; @Input() disableValidationSummary: boolean;
@Input() backdrop: boolean; @Input() backdrop: boolean;
@Input() ignoreBackdropClick: boolean; @Input() ignoreBackdropClick: boolean;
@Input() params: any;
@Output() success: EventEmitter<any> = new EventEmitter<any>(); @Output() success: EventEmitter<any> = new EventEmitter<any>();
@ -32,7 +33,8 @@ export class CommandModalDirective {
wasClicked() { wasClicked() {
this.dataSource.resolveCommandModelByName({ this.dataSource.resolveCommandModelByName({
command: this.command, command: this.command,
model: this.model model: this.model,
params: this.params
}).subscribe(commandModel => { }).subscribe(commandModel => {
const initialState = { const initialState = {
dataSource: this.dataSource, dataSource: this.dataSource,

View File

@ -16,6 +16,7 @@ export class CommandDirective {
@Input() model: any; @Input() model: any;
@Input() refreshOnSuccess: boolean; @Input() refreshOnSuccess: boolean;
@Input() animated: boolean; @Input() animated: boolean;
@Input() params: any;
@Input() confirm: boolean; @Input() confirm: boolean;
@Input() confirmMessage: string; @Input() confirmMessage: string;
@ -31,7 +32,8 @@ export class CommandDirective {
private doCommand() { private doCommand() {
this.dataSource.resolveCommandModelByName({ this.dataSource.resolveCommandModelByName({
command: this.command, command: this.command,
model: this.model model: this.model,
params: this.params
}).subscribe(commandModel => { }).subscribe(commandModel => {
this.loading.emit(true); this.loading.emit(true);
this.dataSource.executeCommandByName(this.command, commandModel) this.dataSource.executeCommandByName(this.command, commandModel)

View File

@ -31,6 +31,7 @@ export class FormGroupCommandModalDirective {
@Input() cancelText: string; @Input() cancelText: string;
@Input() backdrop: boolean; @Input() backdrop: boolean;
@Input() ignoreBackdropClick: boolean; @Input() ignoreBackdropClick: boolean;
@Input() params: any;
@Output() formCreate: EventEmitter<IModelFormCreateEvent> = new EventEmitter<IModelFormCreateEvent>(); @Output() formCreate: EventEmitter<IModelFormCreateEvent> = new EventEmitter<IModelFormCreateEvent>();
@ -43,7 +44,8 @@ export class FormGroupCommandModalDirective {
wasClicked() { wasClicked() {
this.dataSource.resolveCommandModelByName({ this.dataSource.resolveCommandModelByName({
command: this.command, command: this.command,
model: this.model model: this.model,
params: this.params,
}).subscribe(commandModel => { }).subscribe(commandModel => {
const event = <IModelFormCreateEvent>{ const event = <IModelFormCreateEvent>{
commandName: this.command, commandName: this.command,

View File

@ -1,10 +1,10 @@
{ {
"name": "@poweredsoft/ngx-cdk-ui", "name": "@poweredsoft/ngx-cdk-ui",
"version": "0.0.16", "version": "0.0.17",
"peerDependencies": { "peerDependencies": {
"@angular/common": "^9.1.9", "@angular/common": "^9.1.9",
"@angular/core": "^9.1.9", "@angular/core": "^9.1.9",
"@poweredsoft/data": "^0.0.35" "@poweredsoft/data": "^0.0.36"
}, },
"dependencies": { "dependencies": {
"tslib": "^1.10.0" "tslib": "^1.10.0"

View File

@ -24,6 +24,7 @@ export class DsCommandComponent implements OnInit, OnDestroy {
private _refreshOnSuccess: boolean = true; private _refreshOnSuccess: boolean = true;
@Input() params: any;
@Input() dataSource: IDataSource<any>; @Input() dataSource: IDataSource<any>;
@Input() name: string; @Input() name: string;
@Input() model: any; @Input() model: any;
@ -131,7 +132,8 @@ export class DsCommandComponent implements OnInit, OnDestroy {
resolveModel() { resolveModel() {
this.dataSource.resolveCommandModelByName({ this.dataSource.resolveCommandModelByName({
model: this.model, model: this.model,
command: this.name command: this.name,
params: this.params
}).subscribe( }).subscribe(
commandModel => { commandModel => {
this.command = commandModel; this.command = commandModel;