mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
@@ -4,7 +4,6 @@ import { Color } from "../../color";
|
||||
import { Page } from "../page";
|
||||
import { isIOS } from "../../platform";
|
||||
import { Frame as FrameDef } from "../frame";
|
||||
import { LoginOptions } from "./dialogs";
|
||||
import { isObject, isString } from "../../utils/types";
|
||||
|
||||
export const STRING = "string";
|
||||
@@ -15,6 +14,163 @@ export const LOGIN = "Login";
|
||||
export const OK = "OK";
|
||||
export const CANCEL = "Cancel";
|
||||
|
||||
/**
|
||||
* Provides options for the dialog.
|
||||
*/
|
||||
export interface CancelableOptions {
|
||||
/**
|
||||
* [Android only] Gets or sets if the dialog can be canceled by taping outside of the dialog.
|
||||
*/
|
||||
cancelable?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides options for the dialog.
|
||||
*/
|
||||
export interface ActionOptions extends CancelableOptions {
|
||||
/**
|
||||
* Gets or sets the dialog title.
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the dialog message.
|
||||
*/
|
||||
message?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the Cancel button text.
|
||||
*/
|
||||
cancelButtonText?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the list of available actions.
|
||||
*/
|
||||
actions?: Array<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides options for the dialog.
|
||||
*/
|
||||
export interface DialogOptions extends CancelableOptions {
|
||||
/**
|
||||
* Gets or sets the dialog title.
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the dialog message.
|
||||
*/
|
||||
message?: string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides options for the alert.
|
||||
*/
|
||||
export interface AlertOptions extends DialogOptions {
|
||||
/**
|
||||
* Gets or sets the OK button text.
|
||||
*/
|
||||
okButtonText?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides options for the confirm dialog.
|
||||
*/
|
||||
export interface ConfirmOptions extends AlertOptions {
|
||||
/**
|
||||
* Gets or sets the Cancel button text.
|
||||
*/
|
||||
cancelButtonText?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the neutral button text.
|
||||
*/
|
||||
neutralButtonText?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides options for the prompt dialog.
|
||||
*/
|
||||
export interface PromptOptions extends ConfirmOptions {
|
||||
/**
|
||||
* Gets or sets the default text to display in the input box.
|
||||
*/
|
||||
defaultText?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the prompt input type (plain text, password, or email).
|
||||
*/
|
||||
inputType?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the prompt capitalizationType (none, all, sentences, or words).
|
||||
*/
|
||||
capitalizationType?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides result data from the prompt dialog.
|
||||
*/
|
||||
export interface PromptResult {
|
||||
/**
|
||||
* Gets or sets the prompt dialog boolean result.
|
||||
*/
|
||||
result: boolean;
|
||||
|
||||
/**
|
||||
* Gets or sets the text entered in the prompt dialog.
|
||||
*/
|
||||
text: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides result data from the login dialog.
|
||||
*/
|
||||
export interface LoginResult {
|
||||
/**
|
||||
* Gets or sets the login dialog boolean result.
|
||||
*/
|
||||
result: boolean;
|
||||
|
||||
/**
|
||||
* Gets or sets the user entered in the login dialog.
|
||||
*/
|
||||
userName: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the password entered in the login dialog.
|
||||
*/
|
||||
password: string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provides options for the login dialog.
|
||||
*/
|
||||
export interface LoginOptions extends ConfirmOptions {
|
||||
/**
|
||||
* Gets or sets the default text to display as hint in the user name input box.
|
||||
*/
|
||||
userNameHint?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the default text to display as hint in the password input box.
|
||||
*/
|
||||
passwordHint?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the default text to display in the user name input box.
|
||||
*/
|
||||
userName?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the default text to display in the password input box.
|
||||
*/
|
||||
password?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the input type for prompt dialog.
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Android specific dialogs functions implementation.
|
||||
*/
|
||||
import { DialogOptions, ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions } from ".";
|
||||
import { DialogOptions, ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions } from "./dialogs-common";
|
||||
import { getLabelColor, getButtonColors, isDialogOptions, inputType, capitalizationType, ALERT, OK, CONFIRM, CANCEL, PROMPT, parseLoginOptions } from "./dialogs-common";
|
||||
import { android as androidApp } from "../../application";
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
/**
|
||||
* Allows you to show different dialogs such as alerts, prompts, etc.
|
||||
* @module "ui/dialogs"
|
||||
*/ /** */
|
||||
|
||||
import { ConfirmOptions, PromptOptions, AlertOptions, PromptResult, LoginOptions, LoginResult, ActionOptions } from "./dialogs-common";
|
||||
/**
|
||||
* Defines the input type for prompt dialog.
|
||||
*/
|
||||
@@ -1,35 +1,9 @@
|
||||
/**
|
||||
* iOS specific dialogs functions implementation.
|
||||
*/
|
||||
import {
|
||||
ios as iosView,
|
||||
traceCategories,
|
||||
traceWrite,
|
||||
traceMessageType,
|
||||
} from "../core/view";
|
||||
import {
|
||||
ConfirmOptions,
|
||||
PromptOptions,
|
||||
PromptResult,
|
||||
LoginOptions,
|
||||
LoginResult,
|
||||
ActionOptions,
|
||||
} from ".";
|
||||
import {
|
||||
getCurrentPage,
|
||||
getLabelColor,
|
||||
getButtonColors,
|
||||
getTextFieldColor,
|
||||
isDialogOptions,
|
||||
inputType,
|
||||
capitalizationType,
|
||||
ALERT,
|
||||
OK,
|
||||
CONFIRM,
|
||||
CANCEL,
|
||||
PROMPT,
|
||||
parseLoginOptions,
|
||||
} from "./dialogs-common";
|
||||
import { ios as iosView } from "../core/view";
|
||||
import { Trace } from "../../trace";
|
||||
import { ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions, getCurrentPage, getLabelColor, getButtonColors, getTextFieldColor, isDialogOptions, inputType, capitalizationType, ALERT, OK, CONFIRM, CANCEL, PROMPT, parseLoginOptions } from "./dialogs-common";
|
||||
import { isString, isDefined, isFunction } from "../../utils/types";
|
||||
import { getRootView, ios } from "../../application";
|
||||
|
||||
@@ -297,13 +271,9 @@ function showUIAlertController(alertController: UIAlertController) {
|
||||
}
|
||||
|
||||
if (!viewController) {
|
||||
traceWrite(
|
||||
`No root controller found to open dialog.`,
|
||||
traceCategories.Error,
|
||||
traceMessageType.warn
|
||||
);
|
||||
|
||||
return;
|
||||
Trace.write(`No root controller found to open dialog.`, Trace.categories.Error, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (alertController.popoverPresentationController) {
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "dialogs",
|
||||
"main": "dialogs",
|
||||
"types": "dialogs.d.ts"
|
||||
}
|
||||
Reference in New Issue
Block a user