mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-24 17:20:51 +02:00
refactor!(dialog): change type field in JS to kind (#945)
* Fix dialog type not working * gen files * type -> kind * update API example --------- Co-authored-by: amrbashir <amr.bashir2015@gmail.com>
This commit is contained in:
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_DIALOG__=function(t){"use strict";async function e(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}return"function"==typeof SuppressedError&&SuppressedError,t.ask=async function(t,n){const o="string"==typeof n?{title:n}:n;return e("plugin:dialog|ask",{message:t.toString(),title:o?.title?.toString(),type_:o?.type,okButtonLabel:o?.okLabel?.toString()??"Yes",cancelButtonLabel:o?.cancelLabel?.toString()??"No"})},t.confirm=async function(t,n){const o="string"==typeof n?{title:n}:n;return e("plugin:dialog|confirm",{message:t.toString(),title:o?.title?.toString(),type_:o?.type,okButtonLabel:o?.okLabel?.toString()??"Ok",cancelButtonLabel:o?.cancelLabel?.toString()??"Cancel"})},t.message=async function(t,n){const o="string"==typeof n?{title:n}:n;return e("plugin:dialog|message",{message:t.toString(),title:o?.title?.toString(),type_:o?.type,okButtonLabel:o?.okLabel?.toString()})},t.open=async function(t={}){return"object"==typeof t&&Object.freeze(t),e("plugin:dialog|open",{options:t})},t.save=async function(t={}){return"object"==typeof t&&Object.freeze(t),e("plugin:dialog|save",{options:t})},t}({});Object.defineProperty(window.__TAURI__,"dialog",{value:__TAURI_PLUGIN_DIALOG__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_DIALOG__=function(t){"use strict";async function n(t,n={},e){return window.__TAURI_INTERNALS__.invoke(t,n,e)}return"function"==typeof SuppressedError&&SuppressedError,t.ask=async function(t,e){const o="string"==typeof e?{title:e}:e;return n("plugin:dialog|ask",{message:t.toString(),title:o?.title?.toString(),kind:o?.kind,okButtonLabel:o?.okLabel?.toString()??"Yes",cancelButtonLabel:o?.cancelLabel?.toString()??"No"})},t.confirm=async function(t,e){const o="string"==typeof e?{title:e}:e;return n("plugin:dialog|confirm",{message:t.toString(),title:o?.title?.toString(),kind:o?.kind,okButtonLabel:o?.okLabel?.toString()??"Ok",cancelButtonLabel:o?.cancelLabel?.toString()??"Cancel"})},t.message=async function(t,e){const o="string"==typeof e?{title:e}:e;return n("plugin:dialog|message",{message:t.toString(),title:o?.title?.toString(),kind:o?.kind,okButtonLabel:o?.okLabel?.toString()})},t.open=async function(t={}){return"object"==typeof t&&Object.freeze(t),n("plugin:dialog|open",{options:t})},t.save=async function(t={}){return"object"==typeof t&&Object.freeze(t),n("plugin:dialog|save",{options:t})},t}({});Object.defineProperty(window.__TAURI__,"dialog",{value:__TAURI_PLUGIN_DIALOG__})}
|
||||
|
||||
@@ -207,7 +207,7 @@ fn message_dialog<R: Runtime>(
|
||||
dialog: State<'_, Dialog<R>>,
|
||||
title: Option<String>,
|
||||
message: String,
|
||||
type_: Option<MessageDialogKind>,
|
||||
kind: Option<MessageDialogKind>,
|
||||
ok_button_label: Option<String>,
|
||||
cancel_button_label: Option<String>,
|
||||
) -> bool {
|
||||
@@ -222,8 +222,8 @@ fn message_dialog<R: Runtime>(
|
||||
builder = builder.parent(&window);
|
||||
}
|
||||
|
||||
if let Some(type_) = type_ {
|
||||
builder = builder.kind(type_);
|
||||
if let Some(kind) = kind {
|
||||
builder = builder.kind(kind);
|
||||
}
|
||||
|
||||
if let Some(ok) = ok_button_label {
|
||||
@@ -243,7 +243,7 @@ pub(crate) async fn message<R: Runtime>(
|
||||
dialog: State<'_, Dialog<R>>,
|
||||
title: Option<String>,
|
||||
message: String,
|
||||
type_: Option<MessageDialogKind>,
|
||||
kind: Option<MessageDialogKind>,
|
||||
ok_button_label: Option<String>,
|
||||
) -> Result<bool> {
|
||||
Ok(message_dialog(
|
||||
@@ -251,7 +251,7 @@ pub(crate) async fn message<R: Runtime>(
|
||||
dialog,
|
||||
title,
|
||||
message,
|
||||
type_,
|
||||
kind,
|
||||
ok_button_label,
|
||||
None,
|
||||
))
|
||||
@@ -263,7 +263,7 @@ pub(crate) async fn ask<R: Runtime>(
|
||||
dialog: State<'_, Dialog<R>>,
|
||||
title: Option<String>,
|
||||
message: String,
|
||||
type_: Option<MessageDialogKind>,
|
||||
kind: Option<MessageDialogKind>,
|
||||
ok_button_label: Option<String>,
|
||||
cancel_button_label: Option<String>,
|
||||
) -> Result<bool> {
|
||||
@@ -272,7 +272,7 @@ pub(crate) async fn ask<R: Runtime>(
|
||||
dialog,
|
||||
title,
|
||||
message,
|
||||
type_,
|
||||
kind,
|
||||
Some(ok_button_label.unwrap_or_else(|| "Yes".into())),
|
||||
Some(cancel_button_label.unwrap_or_else(|| "No".into())),
|
||||
))
|
||||
@@ -284,7 +284,7 @@ pub(crate) async fn confirm<R: Runtime>(
|
||||
dialog: State<'_, Dialog<R>>,
|
||||
title: Option<String>,
|
||||
message: String,
|
||||
type_: Option<MessageDialogKind>,
|
||||
kind: Option<MessageDialogKind>,
|
||||
ok_button_label: Option<String>,
|
||||
cancel_button_label: Option<String>,
|
||||
) -> Result<bool> {
|
||||
@@ -293,7 +293,7 @@ pub(crate) async fn confirm<R: Runtime>(
|
||||
dialog,
|
||||
title,
|
||||
message,
|
||||
type_,
|
||||
kind,
|
||||
Some(ok_button_label.unwrap_or_else(|| "Ok".into())),
|
||||
Some(cancel_button_label.unwrap_or_else(|| "Cancel".into())),
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user