forked from DevExpress/DevExtreme
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chat: add errors API (DevExpress#28192)
Co-authored-by: Mikhail Preyskurantov <5574159+mpreyskurantov@users.noreply.github.com>
- Loading branch information
1 parent
ca2d338
commit 15afc49
Showing
12 changed files
with
304 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
packages/devextreme-angular/src/ui/chat/nested/error-dxi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* tslint:disable:max-line-length */ | ||
|
||
|
||
import { | ||
Component, | ||
NgModule, | ||
Host, | ||
SkipSelf, | ||
Input | ||
} from '@angular/core'; | ||
|
||
|
||
|
||
|
||
|
||
import { | ||
NestedOptionHost, | ||
} from 'devextreme-angular/core'; | ||
import { CollectionNestedOption } from 'devextreme-angular/core'; | ||
|
||
|
||
@Component({ | ||
selector: 'dxi-chat-error', | ||
template: '', | ||
styles: [''], | ||
providers: [NestedOptionHost] | ||
}) | ||
export class DxiChatErrorComponent extends CollectionNestedOption { | ||
@Input() | ||
get id(): number | string { | ||
return this._getOption('id'); | ||
} | ||
set id(value: number | string) { | ||
this._setOption('id', value); | ||
} | ||
|
||
@Input() | ||
get message(): string { | ||
return this._getOption('message'); | ||
} | ||
set message(value: string) { | ||
this._setOption('message', value); | ||
} | ||
|
||
|
||
protected get _optionPath() { | ||
return 'errors'; | ||
} | ||
|
||
|
||
constructor(@SkipSelf() @Host() parentOptionHost: NestedOptionHost, | ||
@Host() optionHost: NestedOptionHost) { | ||
super(); | ||
parentOptionHost.setNestedOption(this); | ||
optionHost.setHost(this, this._fullOptionPath.bind(this)); | ||
} | ||
|
||
|
||
|
||
ngOnDestroy() { | ||
this._deleteRemovedOptions(this._fullOptionPath()); | ||
} | ||
|
||
} | ||
|
||
@NgModule({ | ||
declarations: [ | ||
DxiChatErrorComponent | ||
], | ||
exports: [ | ||
DxiChatErrorComponent | ||
], | ||
}) | ||
export class DxiChatErrorModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './author'; | ||
export * from './error-dxi'; | ||
export * from './item-dxi'; | ||
export * from './user'; | ||
|
26 changes: 26 additions & 0 deletions
26
packages/devextreme-angular/src/ui/nested/base/chat-error-dxi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* tslint:disable:max-line-length */ | ||
|
||
import { CollectionNestedOption } from 'devextreme-angular/core'; | ||
import { | ||
Component, | ||
} from '@angular/core'; | ||
|
||
|
||
@Component({ | ||
template: '' | ||
}) | ||
export abstract class DxiChatError extends CollectionNestedOption { | ||
get id(): number | string { | ||
return this._getOption('id'); | ||
} | ||
set id(value: number | string) { | ||
this._setOption('id', value); | ||
} | ||
|
||
get message(): string { | ||
return this._getOption('message'); | ||
} | ||
set message(value: string) { | ||
this._setOption('message', value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* tslint:disable:max-line-length */ | ||
|
||
/* tslint:disable:use-input-property-decorator */ | ||
|
||
import { | ||
Component, | ||
NgModule, | ||
Host, | ||
SkipSelf | ||
} from '@angular/core'; | ||
|
||
|
||
|
||
|
||
|
||
import { | ||
NestedOptionHost, | ||
} from 'devextreme-angular/core'; | ||
import { DxiChatError } from './base/chat-error-dxi'; | ||
|
||
|
||
@Component({ | ||
selector: 'dxi-error', | ||
template: '', | ||
styles: [''], | ||
providers: [NestedOptionHost], | ||
inputs: [ | ||
'id', | ||
'message' | ||
] | ||
}) | ||
export class DxiErrorComponent extends DxiChatError { | ||
|
||
protected get _optionPath() { | ||
return 'errors'; | ||
} | ||
|
||
|
||
constructor(@SkipSelf() @Host() parentOptionHost: NestedOptionHost, | ||
@Host() optionHost: NestedOptionHost) { | ||
super(); | ||
parentOptionHost.setNestedOption(this); | ||
optionHost.setHost(this, this._fullOptionPath.bind(this)); | ||
} | ||
|
||
|
||
|
||
ngOnDestroy() { | ||
this._deleteRemovedOptions(this._fullOptionPath()); | ||
} | ||
|
||
} | ||
|
||
@NgModule({ | ||
declarations: [ | ||
DxiErrorComponent | ||
], | ||
exports: [ | ||
DxiErrorComponent | ||
], | ||
}) | ||
export class DxiErrorModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.