Skip to content

Commit

Permalink
release(modal): v1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Oct 7, 2023
1 parent 39f6af2 commit e9d4f12
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.
2 changes: 1 addition & 1 deletion index.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
"modal": {
"react": true,
"icon": true,
"version": "1.2.0",
"version": "1.2.1",
"style": true,
"test": true,
"install": false,
Expand Down
4 changes: 4 additions & 0 deletions src/modal/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.2.1 (7 Oct 2023)

* fix: alert promise

## 1.2.0 (25 Sep 2023)

* feat: i18n
Expand Down
2 changes: 1 addition & 1 deletion src/modal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Hide the modal.

Show the modal.

### static alert(msg: string): void
### static alert(msg: string): Promise<void>

Like `window.alert`.

Expand Down
37 changes: 20 additions & 17 deletions src/modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,29 @@ export default class Modal extends Component<IOptions> {
* Like `window.alert`.
* @static
*/
static alert(msg: string) {
const modal = getGlobalModal()
const { c } = modal
modal.setOption({
title: '',
content: msg,
width: getDefaultWidth(),
footer: createButtons(
{
[Modal.i18n.t('ok')]: {
type: 'primary',
onclick() {
modal.hide()
static alert(msg: string): Promise<void> {
return new Promise((resolve) => {
const modal = getGlobalModal()
const { c } = modal
modal.setOption({
title: '',
content: msg,
width: getDefaultWidth(),
footer: createButtons(
{
[Modal.i18n.t('ok')]: {
type: 'primary',
onclick() {
modal.hide()
resolve()
},
},
},
},
c
),
c
),
})
modal.show()
})
modal.show()
}
/**
* Like `window.confirm`.
Expand Down
2 changes: 1 addition & 1 deletion src/modal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "modal",
"version": "1.2.0",
"version": "1.2.1",
"description": "Create modal dialogs",
"luna": {
"react": true,
Expand Down

0 comments on commit e9d4f12

Please sign in to comment.