-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:message-box): add textarea component
- Loading branch information
1 parent
1a6c208
commit 8f1f374
Showing
13 changed files
with
136 additions
and
11 deletions.
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
6 changes: 6 additions & 0 deletions
6
lib/ng-nest/ui/message-box/examples/zh_CN/default/textarea/readme.md
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,6 @@ | ||
--- | ||
order: 5 | ||
label: '提交内容(多行)' | ||
--- | ||
|
||
使用 `XMessageBoxService` 中的 `prompt` 方法来弹出可输入的消息框。 |
4 changes: 4 additions & 0 deletions
4
lib/ng-nest/ui/message-box/examples/zh_CN/default/textarea/textarea.component.html
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,4 @@ | ||
<x-button (click)="prompt1()">提交内容(正则验证)</x-button> | ||
<br /> | ||
<br /> | ||
<x-button (click)="prompt2()">提交内容(自定义验证)</x-button> |
63 changes: 63 additions & 0 deletions
63
lib/ng-nest/ui/message-box/examples/zh_CN/default/textarea/textarea.component.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,63 @@ | ||
import { Component } from '@angular/core'; | ||
import { XMessageBoxService, XMessageBoxAction } from '@ng-nest/ui/message-box'; | ||
import { XMessageService } from '@ng-nest/ui/message'; | ||
import { XButtonComponent } from '@ng-nest/ui/button'; | ||
|
||
@Component({ | ||
selector: 'ex-textarea', | ||
standalone: true, | ||
imports: [XButtonComponent], | ||
templateUrl: './textarea.component.html' | ||
}) | ||
export class ExTextareaComponent { | ||
constructor( | ||
private msgBox: XMessageBoxService, | ||
private message: XMessageService | ||
) {} | ||
prompt1() { | ||
this.msgBox.prompt({ | ||
title: '提交内容', | ||
content: '请输入邮箱', | ||
showTextarea: true, | ||
inputValue: 'ngnest@163', | ||
inputPattern: | ||
/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/, | ||
inputInvalidMessage: '邮箱格式不正确', | ||
callback: (action: XMessageBoxAction, msg) => { | ||
if (action === 'confirm') { | ||
// 业务处理...... | ||
this.message.success('邮箱:' + msg); | ||
} else if (action === 'close') { | ||
this.message.info('已关闭窗口!'); | ||
} else if (action === 'cancel') { | ||
this.message.info('已取消窗口!'); | ||
} | ||
} | ||
}); | ||
} | ||
prompt2() { | ||
this.msgBox.prompt({ | ||
title: '提交内容', | ||
content: '请输入邮箱', | ||
showTextarea: true, | ||
inputValue: 'ngnest@163', | ||
inputValidator: (value: string) => { | ||
let reg = new RegExp( | ||
/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/ | ||
); | ||
return reg.test(value); | ||
}, | ||
inputInvalidMessage: '邮箱格式不正确', | ||
callback: (action: XMessageBoxAction, msg) => { | ||
if (action === 'confirm') { | ||
// 业务处理...... | ||
this.message.success('邮箱:' + msg); | ||
} else if (action === 'close') { | ||
this.message.info('已关闭窗口!'); | ||
} else if (action === 'cancel') { | ||
this.message.info('已取消窗口!'); | ||
} | ||
} | ||
}); | ||
} | ||
} |
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
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
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
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,5 +1,5 @@ | ||
export const environment = { | ||
layout: 'test', | ||
defaultPage: 'select', | ||
defaultPage: 'message-box', | ||
static: 'https://ngnest.com/static' | ||
}; |
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 @@ | ||
<ex-default></ex-default> | ||
<ex-confirm></ex-confirm> | ||
<ex-custom></ex-custom> | ||
<!-- <ex-default></ex-default> --> | ||
<!-- <ex-confirm></ex-confirm> --> | ||
<!-- <ex-custom></ex-custom> --> | ||
<ex-prompt></ex-prompt> | ||
<ex-textarea></ex-textarea> |
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