// Type definitions for Google Apps Script 2018-07-11
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///
declare namespace GoogleAppsScript {
export module UI {
/**
*
* Deprecated. The UI service was
* deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.
* An absolute panel positions all of its children absolutely, allowing them to overlap.
*
* Here is an example of how to use this widget:
*
* function doGet() {
* var app = UiApp.createApplication();
* var button = app.createButton("a button");
* var panel = app.createAbsolutePanel();
* // add a widget at position (10, 20)
* panel.add(button, 10, 20);
* app.add(panel);
* return app;
* }
*
* Internally, UiApp widgets are built on top of the Google Web Toolkit, and it can sometimes be helpful
* to look at the GWT documentation directly. You can find the AbsolutePanel documentation here.
*/
export interface AbsolutePanel {
add(widget: Widget): AbsolutePanel;
add(widget: Widget, left: Integer, top: Integer): AbsolutePanel;
addStyleDependentName(styleName: string): AbsolutePanel;
addStyleName(styleName: string): AbsolutePanel;
clear(): AbsolutePanel;
getId(): string;
getTag(): string;
getType(): string;
remove(index: Integer): AbsolutePanel;
remove(widget: Widget): AbsolutePanel;
setHeight(height: string): AbsolutePanel;
setId(id: string): AbsolutePanel;
setLayoutData(layout: Object): AbsolutePanel;
setPixelSize(width: Integer, height: Integer): AbsolutePanel;
setSize(width: string, height: string): AbsolutePanel;
setStyleAttribute(attribute: string, value: string): AbsolutePanel;
setStyleAttributes(attributes: Object): AbsolutePanel;
setStyleName(styleName: string): AbsolutePanel;
setStylePrimaryName(styleName: string): AbsolutePanel;
setTag(tag: string): AbsolutePanel;
setTitle(title: string): AbsolutePanel;
setVisible(visible: boolean): AbsolutePanel;
setWidgetPosition(widget: Widget, left: Integer, top: Integer): AbsolutePanel;
setWidth(width: string): AbsolutePanel;
}
/**
*
* Deprecated. The UI service was
* deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.
* A widget that represents a simple element. That is, a hyperlink to a different page.
*
* By design, these hyperlinks always open in a new page. Links that reload the current page are
* not allowed.
*
* Here is an example of how to use this widget:
*
* function doGet() {
* var app = UiApp.createApplication();
* // Creates a link to your favorite search engine.
* var anchor = app.createAnchor("a link", "http://www.google.com");
* app.add(anchor);
* return app;
* }
*
* Internally, UiApp widgets are built on top of the Google Web Toolkit, and it can sometimes be helpful
* to look at the GWT documentation directly. You can find the Anchor documentation here.
*/
export interface Anchor {
addBlurHandler(handler: Handler): Anchor;
addClickHandler(handler: Handler): Anchor;
addFocusHandler(handler: Handler): Anchor;
addKeyDownHandler(handler: Handler): Anchor;
addKeyPressHandler(handler: Handler): Anchor;
addKeyUpHandler(handler: Handler): Anchor;
addMouseDownHandler(handler: Handler): Anchor;
addMouseMoveHandler(handler: Handler): Anchor;
addMouseOutHandler(handler: Handler): Anchor;
addMouseOverHandler(handler: Handler): Anchor;
addMouseUpHandler(handler: Handler): Anchor;
addMouseWheelHandler(handler: Handler): Anchor;
addStyleDependentName(styleName: string): Anchor;
addStyleName(styleName: string): Anchor;
getId(): string;
getTag(): string;
getType(): string;
setAccessKey(accessKey: Char): Anchor;
setDirection(direction: Component): Anchor;
setEnabled(enabled: boolean): Anchor;
setFocus(focus: boolean): Anchor;
setHTML(html: string): Anchor;
setHeight(height: string): Anchor;
setHorizontalAlignment(horizontalAlignment: HorizontalAlignment): Anchor;
setHref(href: string): Anchor;
setId(id: string): Anchor;
setLayoutData(layout: Object): Anchor;
setName(name: string): Anchor;
setPixelSize(width: Integer, height: Integer): Anchor;
setSize(width: string, height: string): Anchor;
setStyleAttribute(attribute: string, value: string): Anchor;
setStyleAttributes(attributes: Object): Anchor;
setStyleName(styleName: string): Anchor;
setStylePrimaryName(styleName: string): Anchor;
setTabIndex(index: Integer): Anchor;
setTag(tag: string): Anchor;
setTarget(target: string): Anchor;
setText(text: string): Anchor;
setTitle(title: string): Anchor;
setVisible(visible: boolean): Anchor;
setWidth(width: string): Anchor;
setWordWrap(wordWrap: boolean): Anchor;
}
/**
*
* Deprecated. The UI service was
* deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.
* A standard push-button widget.
*
* Here is an example of how to use this widget:
*
* function doGet() {
* var app = UiApp.createApplication();
* // create a button and give it a click handler
* var button = app.createButton("click me!").setId("button");
* button.addClickHandler(app.createServerHandler("handlerFunction"));
* app.add(button);
* return app;
* }
*
* function handlerFunction(eventInfo) {
* var app = UiApp.getActiveApplication();
* app.getElementById("button").setText("I was clicked!");
* return app;
* }
*
* Internally, UiApp widgets are built on top of the Google Web Toolkit, and it can sometimes be helpful
* to look at the GWT documentation directly. You can find the Button documentation here.
*/
export interface Button {
addBlurHandler(handler: Handler): Button;
addClickHandler(handler: Handler): Button;
addFocusHandler(handler: Handler): Button;
addKeyDownHandler(handler: Handler): Button;
addKeyPressHandler(handler: Handler): Button;
addKeyUpHandler(handler: Handler): Button;
addMouseDownHandler(handler: Handler): Button;
addMouseMoveHandler(handler: Handler): Button;
addMouseOutHandler(handler: Handler): Button;
addMouseOverHandler(handler: Handler): Button;
addMouseUpHandler(handler: Handler): Button;
addMouseWheelHandler(handler: Handler): Button;
addStyleDependentName(styleName: string): Button;
addStyleName(styleName: string): Button;
getId(): string;
getTag(): string;
getType(): string;
setAccessKey(accessKey: Char): Button;
setEnabled(enabled: boolean): Button;
setFocus(focus: boolean): Button;
setHTML(html: string): Button;
setHeight(height: string): Button;
setId(id: string): Button;
setLayoutData(layout: Object): Button;
setPixelSize(width: Integer, height: Integer): Button;
setSize(width: string, height: string): Button;
setStyleAttribute(attribute: string, value: string): Button;
setStyleAttributes(attributes: Object): Button;
setStyleName(styleName: string): Button;
setStylePrimaryName(styleName: string): Button;
setTabIndex(index: Integer): Button;
setTag(tag: string): Button;
setText(text: string): Button;
setTitle(title: string): Button;
setVisible(visible: boolean): Button;
setWidth(width: string): Button;
}
/**
*
* Deprecated. The UI service was
* deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.
* A panel that wraps its contents in a border with a caption that appears in the upper left corner
* of the border. This is an implementation of the fieldset HTML element.
*
* Note that this panel can contain at most one direct child widget. To add more children, make
* the child of this panel a different panel that can contain more than one child.
*
* Note also that the placement of the caption in a caption panel will vary slightly from browser
* to browser, so this widget is not a good choice when precise cross-browser layout is needed.
*
* Here is an example of how to use this widget:
*
* function doGet() {
* var app = UiApp.createApplication();
* var panel = app.createCaptionPanel("my caption!");
* panel.add(app.createButton("a button inside..."));
* app.add(panel);
* return app;
* }
*
* Internally, UiApp widgets are built on top of the Google Web Toolkit, and it can sometimes be helpful
* to look at the GWT documentation directly. You can find the CaptionPanel documentation here.
*/
export interface CaptionPanel {
add(widget: Widget): CaptionPanel;
addStyleDependentName(styleName: string): CaptionPanel;
addStyleName(styleName: string): CaptionPanel;
clear(): CaptionPanel;
getId(): string;
getTag(): string;
getType(): string;
setCaptionText(text: string): CaptionPanel;
setContentWidget(widget: Widget): CaptionPanel;
setHeight(height: string): CaptionPanel;
setId(id: string): CaptionPanel;
setLayoutData(layout: Object): CaptionPanel;
setPixelSize(width: Integer, height: Integer): CaptionPanel;
setSize(width: string, height: string): CaptionPanel;
setStyleAttribute(attribute: string, value: string): CaptionPanel;
setStyleAttributes(attributes: Object): CaptionPanel;
setStyleName(styleName: string): CaptionPanel;
setStylePrimaryName(styleName: string): CaptionPanel;
setTag(tag: string): CaptionPanel;
setText(text: string): CaptionPanel;
setTitle(title: string): CaptionPanel;
setVisible(visible: boolean): CaptionPanel;
setWidget(widget: Widget): CaptionPanel;
setWidth(width: string): CaptionPanel;
}
/**
*
* Deprecated. The UI service was
* deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.
* A standard check box widget.
*
* Here is an example of how to use this widget:
*
* function doGet() {
* var app = UiApp.createApplication();
* var handler = app.createServerHandler("change");
* var check = app.createCheckBox("click me").addValueChangeHandler(handler);
* app.add(check);
* return app;
* }
*
* function change() {
* var app = UiApp.getActiveApplication();
* app.add(app.createLabel("The value changed!"));
* return app;
* }
*
* Internally, UiApp widgets are built on top of the Google Web Toolkit, and it can sometimes be helpful
* to look at the GWT documentation directly. You can find the CheckBox documentation here.
*/
export interface CheckBox {
addBlurHandler(handler: Handler): CheckBox;
addClickHandler(handler: Handler): CheckBox;
addFocusHandler(handler: Handler): CheckBox;
addKeyDownHandler(handler: Handler): CheckBox;
addKeyPressHandler(handler: Handler): CheckBox;
addKeyUpHandler(handler: Handler): CheckBox;
addMouseDownHandler(handler: Handler): CheckBox;
addMouseMoveHandler(handler: Handler): CheckBox;
addMouseOutHandler(handler: Handler): CheckBox;
addMouseOverHandler(handler: Handler): CheckBox;
addMouseUpHandler(handler: Handler): CheckBox;
addMouseWheelHandler(handler: Handler): CheckBox;
addStyleDependentName(styleName: string): CheckBox;
addStyleName(styleName: string): CheckBox;
addValueChangeHandler(handler: Handler): CheckBox;
getId(): string;
getTag(): string;
getType(): string;
setAccessKey(accessKey: Char): CheckBox;
setEnabled(enabled: boolean): CheckBox;
setFocus(focus: boolean): CheckBox;
setFormValue(formValue: string): CheckBox;
setHTML(html: string): CheckBox;
setHeight(height: string): CheckBox;
setId(id: string): CheckBox;
setLayoutData(layout: Object): CheckBox;
setName(name: string): CheckBox;
setPixelSize(width: Integer, height: Integer): CheckBox;
setSize(width: string, height: string): CheckBox;
setStyleAttribute(attribute: string, value: string): CheckBox;
setStyleAttributes(attributes: Object): CheckBox;
setStyleName(styleName: string): CheckBox;
setStylePrimaryName(styleName: string): CheckBox;
setTabIndex(index: Integer): CheckBox;
setTag(tag: string): CheckBox;
setText(text: string): CheckBox;
setTitle(title: string): CheckBox;
setValue(value: boolean): CheckBox;
setValue(value: boolean, fireEvents: boolean): CheckBox;
setVisible(visible: boolean): CheckBox;
setWidth(width: string): CheckBox;
}
/**
*
* Deprecated. The UI service was
* deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.
* An event handler that runs in the user's browser without needing a call back to the server. These
* will, in general, run much faster than ServerHandlers but they are also more limited in
* what they can do.
*
* Any method that accepts a "Handler" parameter can accept a ClientHandler.
*
* If you set validators on a ClientHandler, they will be checked before the handler performs its
* actions. The actions will only be performed if the validators succeed.
*
* If you have multiple ClientHandlers for the same event on the same widget, they will perform
* their actions in the order that they were added.
*
* An example of using client handlers:
*
* function doGet() {
* var app = UiApp.createApplication();
* var button = app.createButton("Say Hello");
*
* // Create a label with the "Hello World!" text and hide it for now
* var label = app.createLabel("Hello World!").setVisible(false);
*
* // Create a new handler that does not require the server.
* // We give the handler two actions to perform on different targets.
* // The first action disables the widget that invokes the handler
* // and the second displays the label.
* var handler = app.createClientHandler()
* .forEventSource().setEnabled(false)
* .forTargets(label).setVisible(true);
*
* // Add our new handler to be invoked when the button is clicked
* button.addClickHandler(handler);
*
* app.add(button);
* app.add(label);
* return app;
* }
*/
export interface ClientHandler {
forEventSource(): ClientHandler;
forTargets(...widgets: Object[]): ClientHandler;
getId(): string;
getTag(): string;
getType(): string;
setEnabled(enabled: boolean): ClientHandler;
setHTML(html: string): ClientHandler;
setId(id: string): ClientHandler;
setStyleAttribute(row: Integer, column: Integer, attribute: string, value: string): ClientHandler;
setStyleAttribute(attribute: string, value: string): ClientHandler;
setStyleAttributes(row: Integer, column: Integer, attributes: Object): ClientHandler;
setStyleAttributes(attributes: Object): ClientHandler;
setTag(tag: string): ClientHandler;
setText(text: string): ClientHandler;
setValue(value: boolean): ClientHandler;
setVisible(visible: boolean): ClientHandler;
validateEmail(widget: Widget): ClientHandler;
validateInteger(widget: Widget): ClientHandler;
validateLength(widget: Widget, min: Integer, max: Integer): ClientHandler;
validateMatches(widget: Widget, pattern: string): ClientHandler;
validateMatches(widget: Widget, pattern: string, flags: string): ClientHandler;
validateNotEmail(widget: Widget): ClientHandler;
validateNotInteger(widget: Widget): ClientHandler;
validateNotLength(widget: Widget, min: Integer, max: Integer): ClientHandler;
validateNotMatches(widget: Widget, pattern: string): ClientHandler;
validateNotMatches(widget: Widget, pattern: string, flags: string): ClientHandler;
validateNotNumber(widget: Widget): ClientHandler;
validateNotOptions(widget: Widget, options: string[]): ClientHandler;
validateNotRange(widget: Widget, min: Number, max: Number): ClientHandler;
validateNotSum(widgets: Widget[], sum: Integer): ClientHandler;
validateNumber(widget: Widget): ClientHandler;
validateOptions(widget: Widget, options: string[]): ClientHandler;
validateRange(widget: Widget, min: Number, max: Number): ClientHandler;
validateSum(widgets: Widget[], sum: Integer): ClientHandler;
}
/**
*
* Deprecated. The UI service was
* deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.
* A generic component object.
* Implementing classes
*
* NameBrief description
*
* AbsolutePanelAn absolute panel positions all of its children absolutely, allowing them to overlap.
*
* AnchorA widget that represents a simple element.
*
* ButtonA standard push-button widget.
*
* CaptionPanelA panel that wraps its contents in a border with a caption that appears in the upper left corner
* of the border.
*
* ChartA Chart object, which can be embedded into documents, UI elements, or used as a static image.
*
* CheckBoxA standard check box widget.
*
* ClientHandlerAn event handler that runs in the user's browser without needing a call back to the server.
*
* ControlA user interface control object, that drives the data displayed by a DashboardPanel.
*
* DashboardPanelA dashboard is a visual structure that enables the organization and management of multiple charts
* that share the same underlying data.
*
* DateBoxA text box that shows a DatePicker when the user focuses on it.
*
* DatePickerA date picker widget.
*
* DecoratedStackPanelA StackPanel that wraps each item in a 2x3 grid (six box), which allows users to add
* rounded corners.
*
* DecoratedTabBarA TabBar that wraps each tab in a 2x3 grid (six box), which allows users to add rounded corners.
*
* DecoratedTabPanelA TabPanel that uses a DecoratedTabBar with rounded corners.
*
* DecoratorPanelA SimplePanel that wraps its contents in stylized boxes, which can be used to add rounded
* corners to a Widget.
*
* DialogBoxA form of popup that has a caption area at the top and can be dragged by the user.
*
* DocsListDialogA "file-open" dialog for Google Drive.
*
* EmbeddedChartRepresents a chart that has been embedded into a spreadsheet.
*
* FileUploadA widget that wraps the HTML element.
*
* FlexTableA flexible table that creates cells on demand.
*
* FlowPanelA panel that formats its child widgets using the default HTML layout behavior.
*
* FocusPanelA simple panel that makes its contents focusable, and adds the ability to catch mouse and
* keyboard events.
*
* FormPanelA panel that wraps its contents in an HTML