///
///
///
///
///
///
///
///
///
///
// Type definitions for PrimeFaces
// Project: PrimeFaces https://github.com/primefaces
// Definitions by: Andre Wachsmuth https://github.com/blutorange/
/**
* Exposes the Print.js library as a global variable. Normally you do not
* have to use this yourself, as PrimeFaces calls it for you when you use
* the printer component. Also note that while PrimeFaces currently uses
* this library for printing, this is subject to change in future releases.
*/
declare const printJS: typeof import("print-js");
// Additional required type declarations for PrimeFaces that are not picked up from the source code
/**
* An object that can be used to emulate classes and a class hierarchy in JavaScript. This works even for old
* browsers that do no support the native `class` syntax yet. Note however, that this should be mostly compatible
* with the new `class` syntax of JavaScript, so consider creating your own widgets as a class:
*
* ```javascript
* class MyWidget extends PrimeFaces.widget.BaseWidget {
* init(cfg){
* // ...
* }
* }
* ```
*
* __Note to TypeScript users__: You will need to specify the type parameters explicitly. The best way to do so is by
* defining the interfaces for the classes separately:
* ```typescript
* interface BaseWidgetCfg {
* prop1: string;
* }
* interface AccordionPanelCfg extends BaseWidgetCfg {
* prop2: boolean;
* }
* interface BaseWidget {
* init(cfg: BaseWidgetCfg): void;
* method1(x: number): boolean;
* }
* interface Accordion extends BaseWidget {
* init(cfg: AccordionPanelCfg): void;
* method1(): boolean;
* method2(): boolean;
* }
* ```
*
* Now you can use it normally:
* ```typescript
* const BaseWidget = Class.extend({
* init(cfg: BaseWidgetCfg) {
* // ...
* },
* method1(x: number): boolean {
* return x > 0;
* },
* });
* const Accordion = BaseWidget.extend({
* init(cfg: AccordionCfg) {
* this._super(cfg);
* },
* method1() {
* return !this._super(42);
* },
* method2() {
* return true;
* }
* });
* const base: BaseWidget = new BaseWidget({prop1: ""});
* const accordion: Accordion = new Accordion({prop1: "", prop2: true});
* base.method1(2);
* accordion.method1();
* accordion.method2();
* ```
*/
declare const Class: PrimeFaces.Class;
declare namespace PrimeFaces {
/**
* Similar to `Partial`, but in addition to making the properties optional, also makes the properties
* nullable.
* @typeparam Base Type of an object with properties to make partial.
* @return A new type with all properties of the given type `Base` made optional and nullable.
*/
export type PartialOrNull = {
[P in keyof Base]?: Base[P] | null;
};
/**
* Constructs a new type by making all properties `Key` in `Base` optional.
* ```typescript
* type X = {foo: string, bar: string, baz: string};
* type Y = PartialBy;
* // type Y = {foo?: string, bar: string, baz?: string};
* ```
* @typeparam Base Type for which some properties are made optional.
* @typeparam Key Type of the keys that are made optional.
* @return A subtype of `Base` with the all properties `Key` made optional.
*/
export type PartialBy = Omit & Partial>;
/**
* Constructs a new type by intersecting the given `Base` with `void`. This is a hack, required because some methods
* of a parent class explicitly return a value, but some derived classes do not.
* @typeparam Base Base type to intersect
* @return A new type that is the intersection of the given `Base` with `void`.
*/
export type ReturnOrVoid =
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
Base | void;
/**
* Constructs a new type that is the union of all types of each property in T.
* ```typescript
* type X = {a: ["bar", RegExp], b: ["foo", number]};
* type Y = ValueOf;
* // type Y = ["bar", RegExp] | ["foo", number]
* ```
* @typeparam T A type with keys.template
*/
export type ValueOf = T[keyof T];
/**
* Constructs an object type out of a union of two-tuples. The first item in
* the pair is used as the key, the second item as the type of the
* property's value.
* ```typescript
* type Y = ["bar", RegExp] | ["foo", number];
* type Z = KeyValueTupleToObject;
* // type Z = { bar: RegExp; foo: number; }
* ```
* @typeparam T A union of pairs with the key and value for the object's properties.
*/
export type KeyValueTupleToObject = {
[K in T[0]]: Extract[1];
};
/**
* Constructs a new type by renaming the properties in `Base` according to the `RenameMap`.
* ```typescript
* type Z = { bar: RegExp; foo: number; };
* type S = RenameKeys;
* // type S = { b: RegExp; f: number; }
* ```
* @typeparam Base Type with properties to rename
* @typeparam RenameMap Type with string properties that indicate how to rename the keys of `Base`.
*/
export type RenameKeys> = KeyValueTupleToObject>;
/**
* Constructs a new type by binding the this context of `Base` to another type `ThisContext`.
* ```typescript
* type X = (this: string, x: string) => boolean;
* type Y = BindThis;
* // type Y = (this: number, x: string) => boolean
* ```
* @typeparam Base Type to rebind.
* @typeparam ThisContext New this context for `Base`.
* @return If `Base` is a function type, that type with the this context bound to `ThisContext`. Otherwise, returns
* just `Base`.
*/
export type BindThis = Base extends (...args: never[]) => unknown ? (this: ThisContext, ...args: Parameters) => ReturnType : Base;
/**
* Constructs a new type by binding the this context of `Base` to the `ThisContext`. Additionally, also adds a new
* property `_super` to the this context of `Base` that is also of type `Base`.
* ```typescript
* type X = {foo: string, bar: number};
* type Y = (this: string, k: string) => boolean;
* type Z = BindThis;
* // type Z = (this: {foo: string, bar: number, _super: Y}, k: string) => boolean
* ```
* @typeparam Base Type to rebind.
* @typeparam ThisContext New this context for `Base`.
* @return If `Base` is a function type, that type with the this context bound to `ThisContext` and with an
* additional property `_super` of type `Base` added. Otherwise, returns just `Base`.
*/
export type BindThisAndSuper = Base extends (...args: never[]) => unknown ? (this: ThisContext & {
_super: Base;
}, ...args: Parameters) => ReturnType : Base;
/**
* Constructs a new type that is the intersection of all property names in `Base` whose type is assignable to
* `Condition`:
* ```typescript
* interface User {
* name: string;
* mail: string;
* active: boolean;
* }
*
* type UserStringKeys = MatchingKeys;
* // type UserStringKeys = "name" | "mail";
* ```
* @typeparam Base Type from which to pick some properties.
* @typeparam Condition Type which the properties in the base type have to match.
* @return A string intersection type of property names from the base type that match the condition.
*/
type MatchingKeys = {
[Key in keyof Base]: Base[Key] extends Condition ? Key : never;
}[keyof Base];
/**
* Constructs a new type by picking from `Base` all properties that are assignable to `Condition`.
* ```typescript
* interface User {
* name: string;
* mail: string;
* active: boolean;
* }
*
* type UserStringProperties = PickMatching;
* // type UserStringProperties = {name: string, mail: string};
* ```
* @typeparam Base Type from which to pick some properties.
* @typeparam Condition Type which the properties in the base type have to match.
* @return A subtype of the base type with all properties excluded that do not match the condition.
*/
export type PickMatching = Pick>;
/**
* Given the type of the base class and the sub class, constructs a new type for the argument of `Class.extend(...)`,
* except that all properties are required.
* @typeparam TBase Type of the base class.
* @typeparam TSub Type of the subclass.
* @return A mapped type with properties P. If the property P is function type F, then the this context is bound to
* TSub. Additionally, if P is a property only of TBase and not of TSub, a special property `_super` of type F is
* added to the this context.
*/
export type ClassExtendProps = {
[P in keyof TSub]: P extends keyof TBase ? BindThisAndSuper : BindThis;
};
/**
* The widget configuration of each widget may contain only some of the declared properties. For example, when the
* value of a property is equal to the default value, it is not transmitted from the server to the client. Only the
* two properties `id` and `widgetVar` are guaranteed to be always available.
* @typeparam TCfg Type of a widget configuration. It must have at least the two properties `id` and `widgetVar`.
* @return A new type with all properties in the given type made optional, exception for `id` and `widgetVar`.
*/
export type PartialWidgetCfg = Partial> & Pick;
/**
* An object that can be used to emulate classes and a class hierarchy in JavaScript. This works even for old
* browsers that do no support the native `class` syntax yet. Note however, that this should be mostly compatible
* with the new `class` syntax of JavaScript, so consider creating your own widgets as a class:
*
* ```javascript
* class MyWidget extends PrimeFaces.widget.BaseWidget {
* init(cfg){
* // ...
* }
* }
* ```
*
* Note for TypeScript users: Normally you should just write a widget as a class that extends from the appropriate
* base class. If you must use this method you will need to specify the type parameters explicitly. The best way to
* do so is by defining the interfaces for the classes separately:
* ```typescript
* interface BaseWidgetCfg {
* prop1: string;
* }
* interface AccordionCfg extends BaseWidgetCfg {
* prop2: boolean;
* }
* interface BaseWidget {
* init(cfg: BaseWidgetCfg): void;
* method1(x: number): boolean;
* }
* interface Accordion extends BaseWidget {
* init(cfg: AccordionCfg): void;
* method1(): boolean;
* method2(): boolean;
* }
* ```
*
* Now you can use it normally:
* ```typescript
* const BaseWidget = Class.extend({
* init(cfg: BaseWidgetCfg) {
* // ...
* },
* method1(x: number): boolean {
* return x > 0;
* },
* });
* const Accordion = BaseWidget.extend({
* init(cfg: AccordionCfg) {
* this._super(cfg);
* },
* method1() {
* return !this._super(42);
* },
* method2() {
* return true;
* }
* });
* const base: BaseWidget = new BaseWidget({prop1: ""});
* const accordion: Accordion = new Accordion({prop1: "", prop2: true});
* base.method1(2);
* accordion.method1();
* accordion.method2();
* ```
*/
export interface Class> {
new (): Class;
extend, TArgs extends never[]>(prop: PartialBy, keyof Omit>): Class & (new (...args: TArgs) => TSub) & {
prototype: TSub;
};
}
/**
* Maps the return type of a method of an instance method of a JQueryUI widget instance to the return type of the
* JQueryUI wrapper:
* - When an instance method returns `undefined` or the instance itself, the JQuery instance is returned.
* - Otherwise, the value of the instance method is returned.
* @typeparam W Type of the widget instance.
* @typeparam R Type of a value returned by a widget instance method.
* @typeparam JQ Type of the JQuery instance.
* @return The type that is returned by the JQueryUI wrapper method.
*/
export type ToJQueryUIWidgetReturnType =
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
R extends W | undefined | void ? JQ : R extends undefined | void ? R | JQ : R;
/**
* An object with all localized strings required on the client side.
*/
export interface Locale {
allDayText?: string;
aria?: Record;
closeText?: string;
prevText?: string;
nextText?: string;
monthNames?: [
string,
string,
string,
string,
string,
string,
string,
string,
string,
string,
string,
string
];
monthNamesShort?: [
string,
string,
string,
string,
string,
string,
string,
string,
string,
string,
string,
string
];
dayNames?: [
string,
string,
string,
string,
string,
string,
string
];
dayNamesShort?: [
string,
string,
string,
string,
string,
string,
string
];
dayNamesMin?: [
string,
string,
string,
string,
string,
string,
string
];
weekHeader?: string;
weekNumberTitle?: string;
firstDay?: number;
isRTL?: boolean;
showMonthAfterYear?: boolean;
yearSuffix?: string;
timeOnlyTitle?: string;
timeText?: string;
hourText?: string;
minuteText?: string;
secondText?: string;
currentText?: string;
year?: string;
ampm?: boolean;
month?: string;
week?: string;
day?: string;
noEventsText?: string;
moreLinkText?: string;
list?: string;
messages?: Record;
[i18nKey: string]: unknown;
}
}
declare namespace PrimeFaces {
/**
* Defines the possible severity levels of a faces message (a message shown to the user).
*
* - fatal: Indicates that the message reports a grave error that needs the immediate attention of the reader.
* - error: Indicates that the message reports an error that occurred, such as invalid user input or database
* connection failures etc.
* - warn: Indicates that the message reports a possible issue, but it does not prevent the normal operation of the
* system.
* - info: Indicates that the message provides additional information, if the reader is interested.
*/
export type FacesMessageSeverity = "fatal" | "error" | "warn" | "info";
/**
* A converter for converting string values to the correct data type.
*/
export interface Converter {
/**
* Converts a string value to the correct data type.
* @param element Element for which the value was submitted.
* @param submittedValue The submitted string value
* @return The converted value.
*/
convert(element: JQuery, submittedValue: string | null | undefined): T;
}
/**
* A validator for checking whether the value of an element confirms to certain restrictions.
*/
export interface Validator {
/**
* Validates the given element. If it is not valid, the error message should be thrown.
* @param element Element to validate
* @param value Current value of the element
* @throws The error message as the string when the element with its current value is not valid.
*/
validate(element: JQuery, value?: T): void;
}
/**
* A 'FacesMessage' with a short summary message and a more detailed message, as well as a severity level that
* indicates the type of this message. Used by the client-side validation framework and some widgets such as the
* growl widget.
*/
export interface FacesMessage {
/**
* A short summary of the message.
*/
summary: string;
/**
* In-depth details of the message.
*/
detail: string;
/**
* The severity of this message, i.e. whether it is an information message, a warning message, or an error
* message.
*/
severity: FacesMessageSeverity;
/**
* The severity in I18N human readable text for ARIA screen readers.
*/
severityText?: string;
/**
* If the message was successfully rendered by a message/growl component.
*/
rendered: boolean;
}
/*
* __Note__: Do not parametrize the this context via a type parameter. This would require changing the return type
* of BaseWidget#getBehavior to "PrimeFaces.Behavior"". If that were done, however, it would not be longer be
* possible to assign, for example, an object of type AccordionPanel to a variable of type BaseWidget - as that
* would allow calling "getBehavior" on the AccordionPanel and only passing a BaseWidget as the this context.
*/
/**
* A callback function for a behavior of a widget. A behavior is a way for associating client-side scripts with UI
* components that opens all sorts of possibilities, including client-side validation, DOM and style manipulation,
* keyboard handling, and more. When the behavior is triggered, the configured JavaScript gets executed.
*
* Behaviors are often, but not necessarily, AJAX behavior. When triggered, it initiates a request the server and
* processes the response once it is received. This enables several features such as updating or replacing elements
* dynamically. You can add an AJAX behavior via ``.
*/
export type Behavior =
/**
* @this This callback takes the widget instance as the this context. This must be the widget instance that owns
* the behavior. The type is only required to be a {@link BaseWidget} as only common widget properties such as
* its ID are used.
* @param ext Additional data to be sent with the AJAX request that is made to the server.
*/
(this: PrimeFaces.widget.BaseWidget, ext?: Partial) => void;
/**
* The most recent instance of a {@link PrimeFaces.widget.ConfirmDialog} instance that was opened in response to a
* global confirmation request.
*/
export let confirmDialog: PrimeFaces.widget.ConfirmDialog | undefined;
/**
* The main container element of the source component that issued the confirmation request, used e.g. by the
* `ConfirmDialog` widget.
*/
export let confirmSource: JQuery | undefined | null;
/**
* The main container element of the source component that issued the popup confirmation request, used e.g. by the
* `ConfirmPopup` widget.
*/
export let confirmPopupSource: JQuery | undefined | null;
/**
* CSS transition callbacks that can be passed to the methods in {@link CssTransitionHandler}.
* @since 10.0.0
*/
export interface CssTransitionCallback {
/**
* Called when the entering process is about to start.
*/
onEnter?: (this: Window) => void;
/**
* Called during the entering process.
* @this The event that occurred. When animations are globally disabled, this callback may still be called, but
* no event is passed and the this context is the Window.
*/
onEntering?: (this: JQuery.TriggeredEvent | Window) => void;
/**
* Called when the entering process has finished.
* @this The event that occurred. When animations are globally disabled, this callback may still be called, but
* no event is passed and the this context is the Window.
*/
onEntered?: (this: JQuery.TriggeredEvent | Window) => void;
/**
* Called when the exiting process is about to start.
*/
onExit?: () => void;
/**
* Called during the exiting process.
* @this The event that occurred. When animations are globally disabled, this callback may still be called, but
* no event is passed and the this context is the Window.
*/
onExiting?: (this: JQuery.TriggeredEvent | Window) => void;
/**
* Called when the exiting process has finished.
* @this The event that occurred. When animations are globally disabled, this callback may still be called, but
* no event is passed and the this context is the Window.
*/
onExited?: (this: JQuery.TriggeredEvent | Window) => void;
}
/**
* Methods for a CSS transition that are returned by {@link PrimeFaces.utils.registerCSSTransition}.
* @since 10.0.0
*/
export interface CssTransitionHandler {
/**
* Should be called when an element gets shown.
* @param callbacks Optional callbacks that will be invoked at the appropriate time.
*/
show(callbacks?: CssTransitionCallback): void;
/**
* Should be called when an element gets hidden.
* @param callbacks Optional callbacks that will be invoked at the appropriate time.
*/
hide(callbacks?: CssTransitionCallback): void;
}
/**
* Handler returned by methods that add an event handler that can be used to dispose of bound handler. Removes the
* event handler that was added.
*/
export interface UnbindCallback {
/**
* Removes the event handler or handlers that were added when this callback was created.
*/
unbind(): void;
}
}
declare namespace PrimeFaces.ajax {
/**
* An entry on the {@link JQuery.jqXHR} request object with additional values added by PrimeFaces. For example, when
* you call `PrimeFaces.current().ajax().addCallbackParam(...)` on the server in a bean method, the added parameters
* are available in this object. This is also how you can access pass values from the server to the client after
* calling a remote command. See {@link PrimeFaces.ajax.pfXHR} and {@link PrimeFaces.ab}.
*/
export type PrimeFacesArgs = Record;
/**
* Additional settings on a {@link JQuery.jqXHR} request, such as portlet forms and nonces.
*/
export type PrimeFacesSettings = Record;
/**
* Callback for an AJAX request that is always called after the request completes, irrespective of whether it
* succeeded or failed.
*
* This is the type of function that you can set as a client side callback for the `oncomplete` attribute of a
* component or an AJX behavior.
*/
export type CallbackOncomplete =
/**
* @this The current AJAX settings as they were passed to JQuery when the request was made.
* @param xhrOrErrorThrown Either the XHR request that was made (in case of success), or the error that was
* thrown (in case of an error).
* @param status The type of error or success.
* @param pfArgs Additional arguments returned by PrimeFaces, such as AJAX callback params from beans.
* @param dataOrXhr Either the XMLDocument (in case of success), or the XHR request (in case of an error).
*/
(this: JQuery.AjaxSettings, xhrOrErrorThrown: unknown, status: JQuery.Ajax.TextStatus, pfArgs: PrimeFacesArgs, dataOrXhr: XMLDocument | pfXHR) => void;
/**
* Callback for an AJAX request that is called in case any error occurred during the request, such as a a network
* error. Note that this is not called for errors in the application logic, such as when bean validation fails.
*
* This is the type of function that you can set as a client side callback for the `onerror` attribute of a
* component or an AJX behavior.
*/
export type CallbackOnerror =
/**
* @this The current AJAX settings as they were passed to JQuery when the request was made.
* @param xhr The XHR request that failed.
* @param status The type of error that occurred.
* @param errorThrown The error with details on why the request failed.
*/
(this: JQuery.AjaxSettings, xhr: pfXHR, status: JQuery.Ajax.ErrorTextStatus, errorThrown: string) => void;
/**
* Callback for an AJAX request that is called before the request is sent. Return `false` to cancel the request.
*
* This is the type of function that you can set as a client side callback for the `onstart` attribute of a
* component or an AJX behavior.
*/
export type CallbackOnstart =
/**
* @this The {@link PrimeFaces.ajax.Request} singleton instance responsible for handling the request.
* @param cfg The current AJAX configuration.
* @return {boolean | undefined} `false` to abort and not send the request, `true` or `undefined` otherwise.
*/
(this: PrimeFaces.ajax.Request, cfg: Configuration) => boolean;
/**
* Callback for an AJAX request that is called when the request succeeds.
*
* This is the type of function that you can set as a client side callback for the `onsuccess` attribute of a
* component or an AJX behavior.
*/
export type CallbackOnsuccess =
/**
* @this The current AJAX settings as they were passed to JQuery when the request was made.
* @param data The XML document representing the partial response returned the JSF application in response
* to the faces request. It usually looks like this: `...`
* @param status The type of success, usually `success`.
* @param xhr The XHR request that succeeded.
* @return `true` if this handler already handle and/or parsed the response, `false` or `undefined` otherwise.
*/
(this: JQuery.AjaxSettings, data: XMLDocument, status: JQuery.Ajax.SuccessTextStatus, xhr: pfXHR) => boolean | undefined;
/**
* The XHR request object used by PrimeFaces. It extends the `jqXHR` object as used by JQuery, but adds additional
* properties specific to PrimeFaces.
* @typeparam P Data made available by the server via {@link pfXHR.pfArgs}.
*/
export interface pfXHR
extends JQuery.jqXHR {
/**
* An object with additional values added by PrimeFaces. For example, when you call
* `PrimeFaces.current().ajax().addCallbackParam(...)` on the server in a bean method, the added parameters are
* available in this object. This is also how you can access pass values from the server to the client after
* calling a remote command. See {@link PrimeFaces.ajax.pfXHR} and {@link PrimeFaces.ab}.
*/
pfArgs?: P;
/**
* Additional settings, such as portlet forms and nonces.
*/
pfSettings?: PrimeFacesSettings;
}
/**
* Represents the data of a PrimeFaces AJAX request. This is the value that is returned by {@link PrimeFaces.ab} and
* {@link PrimeFaces.ajax.Request.handle}.
* @typeparam P Record type of the data made available in the property {@link PrimeFaces.ajax.pfXHR.pfArgs} by the
* server.
*/
export interface ResponseData
{
/**
* The XML document that was returned by the server. This may include several elements such as `update` for DOM
* updates that need to be performed, `executeScript` for running JavaScript code. A typical response might look
* as follows:
*
* ```xml
*
*
*
* ...
*
* ]]>
*
*
*
* ```
*/
document: XMLDocument;
/**
* The jQuery XHR request object that was used for the request.
*
* __Note__: This object has a `pfArgs` entry that contains the values added to the response by the server. See
* {@link PrimeFaces.ajax.pfXHR.pfArgs} and {@link PrimeFaces.ajax.RemoteCommand}.
*/
jqXHR: PrimeFaces.ajax.pfXHR
;
/**
* A string describing the type of success. Usually the HTTP status text.
*/
textStatus: JQuery.Ajax.SuccessTextStatus;
}
/**
* Represents the data passed to the exception handler of the promise returned by {@link PrimeFaces.ab} and
* {@link PrimeFaces.ajax.Request.handle}.
*/
export interface FailedRequestData {
/**
* An optional exception message, if an error occurred.
*/
errorThrown: string;
/**
* The jQuery XHR request object that was used for the request. May not be available when no HTTP request was
* sent, such as when validation failed.
*/
jqXHR?: PrimeFaces.ajax.pfXHR;
/**
* A string describing the type of error that occurred.
*/
textStatus: JQuery.Ajax.SuccessTextStatus;
}
/**
* Describes a server callback parameter for an AJAX call. For example, when you call a
* `` from the client, you may pass additional parameters to the backing
* bean like this:
*
* ```javascript
* myCommand([
* {
* name: "MyParam",
* value: "MyValue",
* }
* ]);
* ```
*
* In the backing bean, you can access this parameter like this:
*
* ```java
* final String myParam = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("myParam");
* ```
* @typeparam K Name of this parameter.
* @typeparam V Type of the value of the callback parameter. Please note that it will be converted to string
* before it is passed to the server.
*/
export interface RequestParameter {
/**
* The name of the parameter to pass to the server.
*/
name: K;
/**
* The value of the parameter to pass to the server.
*/
value: V;
}
/**
* The response of an AJAX request may contain one or more actions such as executing scripts or updating DOM nodes.
* This interface represents a handler for an `update` action.
* @typeparam TWidget Type of the widget which
* triggered the AJAX request.
*/
export interface UpdateHandler {
/**
* The widget which triggered the AJAX request.
*/
widget: TWidget;
/**
* The handle function which is given the HTML string of the update
* @param content The new HTML content from the update.
*/
handle(this: TWidget, content: string): void;
}
/**
* Represents the selection of an INPUT or TEXTAREA element.
*/
export interface ActiveElementSelection {
/**
* Start of the selection, that is, the index of the first selected character.
*/
start: number;
/**
* End of the selection, that is, one plus the index of the last selected character.
*/
end: number;
/**
* The number of selected characters.
*/
length: number;
/**
* The selected text
*/
text: string;
}
/**
* The options that can be passed to AJAX calls made by PrimeFaces. Note that you do not have to provide a value
* for all these property. Most methods methods such as `PrimeFaces.ab` have got sensible defaults in case you
* do not.
*/
export interface Configuration {
/**
* If `true`, the the request is sent immediately. When set to `false`, the AJAX request is added to a
* global queue to ensure that only one request is active at a time, and that each response is processed
* in order. Defaults to `false`.
*/
async: boolean;
/**
* Delay in milliseconds. If less than this delay elapses between AJAX requests, only the most recent one is
* sent and all other requests are discarded. If this option is not specified, no delay is used.
*/
delay: number;
/**
* A PrimeFaces client-side search expression (such as `@widgetVar` or `@(.my-class)` for locating the form
* to with the input elements that are serialized. If not given, defaults to the enclosing form.
*/
formId: string;
/**
* The AJAX behavior event that triggered the AJAX request.
*/
event: string;
/**
* Additional options that can be passed when sending an AJAX request to override the current options.
*/
ext: Partial;
/**
* Additional search expression that is added to the `process` option.
*/
fragmentId: string;
/**
* Whether this AJAX request is global, ie whether it should trigger the global ``. Defaults
* to `true`.
*/
global: boolean;
/**
* `true` if components with ` should be ignored and updated only if specified explicitly
* in the `update` option; or `false` otherwise. Defaults to `false`.
*/
ignoreAutoUpdate: boolean;
/**
* Callback that is always called after the request completes, irrespective of whether it succeeded or
* failed.
*/
oncomplete: CallbackOncomplete;
/**
* Callback that is called in case any error occurred during the request, such as a a network error. Note
* that this is not called for errors in the application logic, such as when bean validation fails.
*/
onerror: CallbackOnerror;
/**
* Callback that is called before the request is sent. Return `false` to cancel the request.
*/
onstart: CallbackOnstart;
/**
* Callback that is called when the request succeeds.
*/
onsuccess: CallbackOnsuccess;
/**
* Additional parameters that are passed to the server. These can be accessed as follows:
*
* ```java
* final String myParam = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("myParam");
* ```
*/
params: RequestParameter[];
/**
* `true` to perform a partial submit and not send the entire form data, but only the processed components;
* or `false` to send the entire form data. Defaults to `false`.
*/
partialSubmit: boolean;
/**
* A CSS selector for finding the input elements of partially processed components. Defaults to `:input`.
*/
partialSubmitFilter: string;
/**
* A (client-side) PrimeFaces search expression for the components to process in the AJAX request.
*/
process: string;
/**
* A promise object that is resolved when the AJAX request is complete. You can use this option to register
* a custom callback. Please note that usually you do not have to set this option explicitly, you can use the
* return value of {@link PrimeFaces.ab} or {@link PrimeFaces.ajax.Request.handle}. It will create a new promise
* object when none was provided, and return that.
*/
promise: Promise;
/**
* `true` if the AJAX request is a reset request that resets the value of all form elements to their
* initial values, or `false` otherwise. Defaults to `false`.
*/
resetValues: boolean;
/**
* `true` if child components should be skipped for the AJAX request, `false` otherwise. Used only by a few
* specific components.
*/
skipChildren: boolean;
/**
* The source that triggered the AJAX request.
*/
source: string | JQuery | HTMLElement;
/**
* Set a timeout (in milliseconds) for the request. A value of 0 means there will be no timeout.
*/
timeout: number;
/**
* A (client-side) PrimeFaces search expression for the components to update in the AJAX request.
*/
update: string;
}
/**
* Additional options that can be passed when sending an AJAX request to override the current options.
*/
export type ConfigurationExtender = Pick & {
/**
* If given, this function is called once for each component. It is passed that serialized values for the
* component and should return the filtered values that are to be sent to the server. If not given, no
* values are filtered, and all values are send to the server.
* @param componentPostParams The serialized values of a component.
* @return The filtered values that are to be sent to the server.
*/
partialSubmitParameterFilter(this: Request, componentPostParams: RequestParameter[]): RequestParameter[];
};
/**
* Options passed to AJAX calls made by PrimeFaces. This is the same as `Configuration`, but with shorter
* option names and is used mainly by the method `PrimeFaces.ab`. See `Configuration` for a detailed description
* of these options.
*/
export type ShorthandConfiguration = RenameKeys;
/**
* Helper type for the parameters of the remote command. You can specify an object type with the allowed parameter
* names and their expected value types. This helps to increase type safety for remote commands. For example, when
* this remote command with an appropriate bean implementation is defined:
*
* ```xml
*
* ```
*
* Then you can declare (or generate automatically from the bean method!) this remote command in TypeScript like
* this:
*
* ```typescript
* declare const RemoteCommands {
* const checkMaturity: RemoteCommand<
* {name: string, age: number},
* {success: boolean, message: string}
* >;
* }
*
* RemoteCommand.checkMaturity( [ { name: "name", value: "John Doe" } ] ) // works
* RemoteCommand.checkMaturity( [ { name: "age", value: 12 } ] ) // works
*
* RemoteCommand.checkMaturity( [ { name: "username", value: "John Doe" } ] ) // error
* RemoteCommand.checkMaturity( [ { name: "age", value: "12" } ] ) // error
*
* const response = await RemoteCommand.checkMaturity( [ { name: "name", value: "John Doe" } ];
*
* const success: boolean = response.jqXHR.pfArgs.success; // works
* const message: string = response.jqXHR.pfArgs.message; // works
* const message: string = response.jqXHR.pfArgs.errormessage; // error
* ```
* @typeparam T Record type with the param names and the corresponding param values.
* @return An array type of {@link PrimeFaces.ajax.RequestParameter | request parameters} where the `name` can be
* one of the keys of `T` and the `value` is the corresponding value from `T`. Array values are mapped to the item
* type, so that `RemoteCommandParams<{names: string[]}>` is the same as `RemoteCommandParams<{names: string}>`.
* This is done because multiple values for the same name should be send by including multiple items in the request
* callback parameter array.
*/
export type RemoteCommandParams = Record> = {
[P in keyof T]: P extends string ? PrimeFaces.ajax.RequestParameter
: never;
}[keyof T][];
/**
* Type for the JavaScript remote command function that is created via
*
* ```xml
*
* ```
*
* This creates a variable `window.myCommand` that is of this type. On the client-side, you can pass parameters to
* the remote command via
*
* ```javascript
* window.myCommand([ { name: "myParamName", value: 9 } ]);
* ```
*
* On the server-side, you can access them as follows:
*
* ```java
* String myParamValue = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("myParamName")
* ```
*
* To send data back to the client, use
*
* ```java
* PrimeFaces.current().ajax().addCallbackParam("returnParamName", true);
* ```
*
* Finally, to access the returned value on the client, do
*
* ```javascript
* try {
* const response = await window.myCommand([ { name: "myParamName", value: 9 } ]);
* // Success, do something with the data
* const value = response.jqXHR.pfArgs.returnParamName;
* }
* catch (e) {
* // Handle error
* console.error("Could not invoke remote command", e);
* }
* ```
*
* Please note that you should not use async-await if you need to target old browsers, use `then`/`catch` on the
* returned promise instead. See {@link RemoteCommandParams} for more details on how to use this TypeScript type.
* @typeparam T Object type with the param names and the corresponding param values.
* @typeparam R Object type of the data returned by the remote command.
*/
export type RemoteCommand = Record, R extends PrimeFacesArgs = PrimeFacesArgs> =
/**
* @param params Optional parameters that are passed to the remote command.
* @return A promise that is settled when the remote command it complete. It is resolved with the data received
* from the server, and rejected when a network or server error occurred.
*/
(params?: RemoteCommandParams) => Promise>;
}
declare namespace PrimeFaces.validation {
/**
* The validation result.
*/
export interface ValidationResult {
/**
* A map between the client ID of an element and a list of faces message for that element.
* @type {Record}
*/
messages: Record;
/**
* If the result is valid / if it has any validation errors.
*/
valid: boolean;
/**
* If the result has any unrendered message.
*/
hasUnrenderedMessage: boolean;
}
/**
* When an element is invalid due to a validation error, the user needs to be informed. A highlight handler is
* responsible for changing the visual state of an element so that the user notices the invalid element. A highlight
* handler is usually registered for a particular type of element or widget.
*/
export interface Highlighter {
/**
* When an element is invalid due to a validation error, the user needs to be informed. This method must
* highlight the given element in a way that makes the user notice that the element is invalid.
* @param element An element to highlight.
*/
highlight(element: JQuery): void;
/**
* When an element is invalid due to a validation error, the user needs to be informed. This method must
* remove the highlighting of the given element that was added by `highlight`.
*/
unhighlight(element: JQuery): void;
}
/**
* The options that can be passed to the Validation method. Note that you do not have to provide a value
* for all these property. Most methods such as `PrimeFaces.vb` have got sensible defaults in case you
* do not.
*/
export interface Configuration {
/**
* The source that triggered the validationt.
*/
source: string | JQuery | HTMLElement;
/**
* `true` if the validation is triggered by AJAXified compoment. Defaults to `false`.
*/
ajax: boolean;
/**
* A (client-side) PrimeFaces search expression for the components to process in the validation.
*/
process: string;
/**
* A (client-side) PrimeFaces search expression for the components to update in the validation.
*/
update: string;
/**
* `true` if invalid elements should be highlighted as invalid. Default is `true`.
*/
highlight: boolean;
/**
* `true` if the first invalid element should be focussed. Default is `true`.
*/
focus: boolean;
/**
* `true` if messages should be rendered. Default is `true`.
*/
renderMessages: boolean;
/**
* `true` if invisible elements should be validated. Default is `false`.
*/
validateInvisibleElements: boolean;
}
/**
* Options passed to `PrimeFaces.vb` as shortcut. This is the same as `Configuration`, but with shorter
* option names and is used mainly by the method `PrimeFaces.vb`. See `Configuration` for a detailed description
* of these options.
*/
export type ShorthandConfiguration = RenameKeys;
}
// JQuery extensions
/**
* Here you can find additional methods on JQuery instances defined by various JQuery plugins. These methods are
* usually defined by certain widgets and may not be available unless the widget and its JavaScript dependencies were
* loaded.
*/
interface JQuery {
}
/**
* Here you can find additional properties and methods defined on the global JQuery object, such as `$.browser`. These
* properties and methods are usually defined by certain widgets and may not be available unless the widget and its
* JavaScript dependencies were loaded.
*/
interface JQueryStatic {
}
declare namespace JQuery {
/**
* This interface contains all known types of events triggered by various jQuery extensions. It maps the name of the
* event to the type the event that is triggered. Please note that this interface does not define the custom
* additional arguments that may be passed when triggering event. These are deprecated in favor of using
* `CustomEvent`.
*/
interface TypeToTriggeredEventMap {
/**
* Triggered on the document before an AJAX request made by {@link PrimeFaces.ajax} starts.
*
* Usually the following arguments are passed to the callback:
* - {@link PrimeFaces.ajax.pfXHR}: The AJAX request that is about to be sent.
* - {@link JQuery.AjaxSettings}: The settings of the AJAX request.
*/
pfAjaxSend: JQuery.TriggeredEvent;
/**
* Triggered on the document when an AJAX request made by {@link PrimeFaces.ajax} starts.
*
* Usually no arguments are passed to the callback.
*/
pfAjaxStart: JQuery.TriggeredEvent;
/**
* Triggered on the document when an AJAX request made by {@link PrimeFaces.ajax} fails.
*
* Usually the following arguments are passed to the callback:
* - {@link PrimeFaces.ajax.pfXHR}: The AJAX request that failed.
* - {@link JQuery.AjaxSettings}: The settings of the AJAX request.
* - A string: The error that occurred.
*/
pfAjaxError: JQuery.TriggeredEvent;
/**
* Triggered on the document when an AJAX request made by {@link PrimeFaces.ajax} succeeds.
*
* Usually the following arguments are passed to the callback:
* - {@link PrimeFaces.ajax.pfXHR}: The AJAX request that was successful.
* - {@link JQuery.AjaxSettings}: The settings of the AJAX request.
*/
pfAjaxSuccess: JQuery.TriggeredEvent;
/**
* Triggered on the document when an AJAX request completes (both success and failure). Only when `global` is set to `true`.
*
* Usually the following arguments are passed to the callback:
* - {@link PrimeFaces.ajax.pfXHR}: The AJAX request that completed
* - {@link JQuery.AjaxSettings}: The settings of the AJAX request.
*/
pfAjaxComplete: JQuery.TriggeredEvent;
}
}
// Type declarations for the JSF core, see for example
// https://docs.oracle.com/javaee/7/javaserver-faces-2-2/jsdocs/symbols/jsf.html
/**
* The top level global namespace for JavaServer Faces functionality.
*
* Please note that this functionality may only be available when you use certain tags such as `` tags.
*/
declare namespace jsf {
/**
* An integer specifying the implementation version that this file implements. It's a monotonically increasing
* number, reset with every increment of `jsf.specversion` This number is implementation dependent.
*/
export const implversion: number;
/**
* The result of calling `UINamingContainer.getNamingContainerSeparatorChar()`: Used for separating IDs, such as a
* colon (`:`).
*/
export const separatorchar: string;
/**
* An integer specifying the specification version that this file implements. It's format is: rightmost two digits,
* bug release number, next two digits, minor release number, leftmost digits, major release number. This number may
* only be incremented by a new release of the specification.
*/
export const specversion: number;
/**
* Return the `windowId` of the window in which the argument form is rendered.
* @param node Determine the nature of the argument. If not present, search for the `windowId` within
* `document.forms`. If present and the value is a string, assume the string is a DOM id and get the element with
* that id and start the search from there. If present and the value is a DOM element, start the search from there.
* @return The `windowId` of the current window, or `null` if the `windowId` cannot be determined.
* @throws An error if more than one unique `WindowId` is found.
*/
export function getClientWindow(node?: HTMLElement | string): string | null;
/**
* Return the value of `Application.getProjectStage()` for the currently running application instance. Calling this
* method must not cause any network transaction to happen to the server.
*
* __Usage:__
*
* ```javascript
* var stage = jsf.getProjectStage();
* if (stage === ProjectStage.Development) {
* // ...
* } else if stage === ProjectStage.Production) {
* // ...
* }
* ```
* @return A string representing the current state of the running application in a typical product development
* life cycle. Refer to `javax.faces.application.Application.getProjectStage` and
* `javax.faces.application.ProjectStage`.
*/
export function getProjectStage(): string;
/**
* Collect and encode state for input controls associated with the specified form element. This will include all
* input controls of type hidden.
*
* __Usage:__
*
* ```javascript
* var state = jsf.getViewState(form);
* ```
* @param form The form element whose contained input controls will be collected and encoded. Only successful
* controls will be collected and encoded in accordance with: `Section 17.13.2` of the HTML Specification.
* @return The encoded state for the specified form's input controls.
*/
export function getViewState(form: HTMLFormElement): string;
}
/**
* The namespace for Ajax functionality provided by JSF.
*
* Please note that this functionality may only be available when you use certain tags such as `` tags.
*/
declare namespace jsf.ajax {
/**
* Possible status codes when an AJAX request fails.
*/
export type ErrorStatus = "httpError" | "emptyResponse" | "serverError" | "malformedXML";
/**
* Possible status codes when an AJAX request succeeds.
*/
export type EventStatus = "complete" | "success" | "begin";
/**
* Possible status codes when an AJAX request succeeds or fails.
*/
export type Status = ErrorStatus | EventStatus;
/**
* A reference to a function to call on an error, see {@link addOnError}.
*/
export type OnErrorCallback =
/**
* @param data Data with details about the error and the received response.
*/
(data: OnErrorCallbackData) => void;
/**
* A reference to a function to call on an event, see {@link addOnEvent}.
*/
export type OnEventCallback =
/**
* @param data Data with details about the received response.
*/
(data: OnEventCallbackData) => void;
/**
* Base data for an event callback, see {@link addOnError} and {@link addOnEvent}.
* @typeparam T Type of the `type` property.
* @typeparam S Type of the `status` property.
*/
export interface CallbackData {
/**
* Type of the request result.
*/
type: T;
/**
* Status describing the type of success or error.
*/
status: S;
/**
* ID of the source component that triggered the AJAX request.
*/
source: string;
/**
* HTTP response code of the request.
*/
responseCode?: number;
/**
* XML of the response.
*/
responseXML?: XMLDocument;
/**
* Raw text of the response.
*/
responseText?: string;
}
/**
* Data for the callback when an AJAX request fails, see {@link addOnError}.
*/
export interface OnErrorCallbackData extends CallbackData<"error", ErrorStatus> {
/**
* Name of the error, if {@link status} is set to `serverError`.
*/
errorName?: string;
/**
* Message of the error, if {@link status} is set to `serverError`.
*/
errorMessage?: string;
/**
* Human readable description of the error.
*/
description: string;
}
/**
* Data for the callback when an AJAX request succeeds, see {@link addOnEvent}.
*/
export interface OnEventCallbackData extends CallbackData<"event", EventStatus> {
}
/**
* The request context that will be used during error/event handling. {@link jsf.ajax.response}.
*/
export interface RequestContext {
/**
* The source DOM element for the request.
*/
source: HTMLElement;
/**
* The error handler for the request.
*/
onerror: OnErrorCallback;
/**
* The event handler for the request.
*/
onevent: OnEventCallback;
}
/**
* The set of available options that can be sent as request parameters to control client and/or server side request
* processing. Used by {@link jsf.ajax.request}.
*/
export interface RequestOptions {
/**
* Space separated list of client identifiers
*/
execute: string;
/**
* Space separated list of client identifiers.
*/
render: string;
/**
* Function to callback for event.
*/
onevent: OnEventCallback;
/**
* Function to callback for error.
*/
onerror: OnErrorCallback;
/**
* An object containing parameters to include in the request.
*/
params: Record;
/**
* If less than delay milliseconds elapses between calls to request() only the most recent one is sent and all
* other requests are discarded. If the value of delay is the literal string 'none' without the quotes, or no
* delay is specified, no delay is used.
*/
delay: number;
/**
* If true, ensure a post data argument with the name `javax.faces.partial.resetValues` and the value true is
* sent in addition to the other post data arguments. This will cause `UIViewRoot.resetValues()` to be called,
* passing the value of the "render" attribute. Note: do not use any of the `@` keywords such as `@form` or
* `@this` with this option because `UIViewRoot.resetValues()` does not descend into the children of the listed
* components.
*/
resetValues: boolean;
}
/**
* Register a callback for error handling.
*
* __Usage:__
*
* ```javascript
* jsf.ajax.addOnError(handleError);
* // ...
* var handleError = function handleError(data) {
* //...
* }
* ```
*
* __Implementation Requirements:__
*
* This function must accept a reference to an existing JavaScript function. The JavaScript function reference must
* be added to a list of callbacks, making it possible to register more than one callback by invoking
* {@link jsf.ajax.addOnError} more than once. This function must throw an error if the callback argument is not a
* function.
* @param callback A reference to a function to call on an error.
*/
export function addOnError(callback: OnErrorCallback): void;
/**
* Register a callback for event handling.
*
* __Usage:__
*
* ```javascript
* jsf.ajax.addOnEvent(statusUpdate);
* // ...
* var statusUpdate = function statusUpdate(data) {
* // ...
* }
* ```
*
* __Implementation Requirements:__
*
* This function must accept a reference to an existing JavaScript function. The JavaScript function reference must
* be added to a list of callbacks, making it possible to register more than one callback by invoking
* {@link jsf.ajax.addOnEvent} more than once. This function must throw an error if the callback argument is not a
* function.
* @param callback A reference to a function to call on an event.
*/
export function addOnEvent(callback: OnEventCallback): void;
/**
* Send an asynchronous Ajax request to the server.
*
* __Usage:__
*
* Example showing all optional arguments:
*
* ```xml
*
*
* ```
*
* __Implementation Requirements:__
*
* This function must:
* - Be used within the context of a form.
* - Capture the element that triggered this Ajax request (from the source argument, also known as the source
* element.
* - If the source element is `null` or `undefined` throw an error.
* - If the source argument is not a string or DOM element object, throw an error.
* - If the source argument is a string, find the DOM element for that string identifier.
* - If the DOM element could not be determined, throw an error.
* - If the `onerror` and `onevent` arguments are set, they must be functions, or throw an error.
* - Determine the source element's form element.
* - Get the form view state by calling {@link jsf.getViewState} passing the form element as the argument.
* - Collect post data arguments for the Ajax request.
* - The following name/value pairs are required post data arguments:
* - `javax.faces.ViewState` - Contents of `javax.faces.ViewState` hidden field. This is included when
* {@link jsf.getViewState} is used.
* - `javax.faces.partial.ajax` - `true`
* - `javax.faces.source` - The identifier of the element that triggered this request.
* - `javax.faces.ClientWindow` - Call {@link jsf.getClientWindow}, passing the current form. If the return
* is non-null, it must be set as the value of this name/value pair, otherwise, a name/value pair for
* client window must not be sent.
* - Collect optional post data arguments for the Ajax request.
* - Determine additional arguments (if any) from the `options` argument. If `options.execute` exists:
* - If the keyword `@none` is present, do not create and send the post data argument
* `javax.faces.partial.execute`.
* - If the keyword `@all` is present, create the post data argument with the name
* `javax.faces.partial.execute` and the value `@all`.
* - Otherwise, there are specific identifiers that need to be sent. Create the post data argument with the
* name `javax.faces.partial.execute` and the value as a space delimited string of client identifiers.
* - If `options.execute` does not exist, create the post data argument with the name
* `javax.faces.partial.execute` and the value as the identifier of the element that caused this request.
* - If `options.render` exists:
* - If the keyword `@none` is present, do not create and send the post data argument
* `javax.faces.partial.render`.
* - If the keyword `@all` is present, create the post data argument with the name
* `javax.faces.partial.render` and the value `@all`.
* - Otherwise, there are specific identifiers that need to be sent. Create the post data argument with the
* name `javax.faces.partial.render` and the value as a space delimited string of client identifiers.
* - If `options.render` does not exist do not create and send the post data argument
* `javax.faces.partial.render`.
* - If `options.delay` exists let it be the value delay, for this discussion. If options.delay does not exist,
* or is the literal string 'none', without the quotes, no delay is used. If less than delay milliseconds
* elapses between calls to `request()` only the most recent one is sent and all other requests are discarded.
* - If `options.resetValues` exists and its value is true, ensure a post data argument with the name
* `javax.faces.partial.resetValues` and the value true is sent in addition to the other post data arguments.
* This will cause `UIViewRoot.resetValues()` to be called, passing the value of the `render` attribute. Note:
* do not use any of the `@` keywords such as `@form` or `@this` with this option because
* `UIViewRoot.resetValues()` does not descend into the children of the listed components.
* - Determine additional arguments (if any) from the event argument. The following name/value pairs may be used
* from the event object:
* - `target` - the `ID` of the element that triggered the event.
* - `captured` - the `ID` of the element that captured the event.
* - `type` - the type of event (ex: `onkeypress`)
* - `alt` - true if `ALT` key was pressed.
* - `ctrl` - true if `CTRL` key was pressed.
* - `shift` - true if `SHIFT` key was pressed.
* - `meta` - true if `META` key was pressed.
* - `right` - true if right mouse button was pressed.
* - `left` - true if left mouse button was pressed.
* - `keycode` - the key code.
* - Encode the set of post data arguments.
* - Join the encoded view state with the encoded set of post data arguments to form the query string that will be
* sent to the server.
* - Create a request context object that will be used during error/event handling. The function must set the
* properties:
* - `source` (the source DOM element for this request)
* - `onerror` (the error handler for this request)
* - `onevent` (the event handler for this request)
* - Send a begin event following the procedure as outlined in the Chapter 13 `Sending Events` section of the Java
* Server Faces spec.
* - Set the request header with the name: `Faces-Request` and the value: `partial/ajax`.
* - Determine the `posting URL` as follows: If the hidden field `javax.faces.encodedURL` is present in the
* submitting form, use its value as the posting URL. Otherwise, use the action property of the form element as
* the URL.
* - Determine whether or not the submitting form is using `multipart/form-data` as its enctype attribute. If not,
* send the request as an asynchronous POST using the posting URL that was determined in the previous step.
* Otherwise, send the request using a multi-part capable transport layer, such as a hidden inline frame. Note
* that using a hidden inline frame does not use `XMLHttpRequest`, but the request must be sent with all the
* parameters that a JSF `XMLHttpRequest` would have been sent with. In this way, the server side processing of
* the request will be identical whether or the request is multipart or not.
*
* The begin, complete, and success events must be emulated when using the multipart transport. This allows any
* listeners to behave uniformly regardless of the multipart or XMLHttpRequest nature of the transport.
*
* Form serialization should occur just before the request is sent to minimize the amount of time between the
* creation of the serialized form data and the sending of the serialized form data (in the case of long requests in
* the queue). Before the request is sent it must be put into a queue to ensure requests are sent in the same order
* as when they were initiated. The request callback function must examine the queue and determine the next request
* to be sent. The behavior of the request callback function must be as follows:
*
* - If the request completed successfully invoke {@link jsf.ajax.response} passing the request object.
* - If the request did not complete successfully, notify the client.
* - Regardless of the outcome of the request (success or error) every request in the queue must be handled. Examine
* the status of each request in the queue starting from the request that has been in the queue the longest. If
* the status of the request is complete (readyState 4), dequeue the request (remove it from the queue). If the
* request has not been sent (readyState 0), send the request. Requests that are taken off the queue and sent
* should not be put back on the queue.
* @param source The DOM element that triggered this AJAX request, or an ID string of the element to use as the
* triggering element.
* @param event The DOM event that triggered this Ajax request. The event argument is optional.
* @param options The set of available options that can be sent as request parameters to control client and/or
* server side request processing.
* @throws Error if first required argument element is not specified, or if one or more of the components in the
* `options.execute` list is a file upload component, but the form's enctype is not set to `multipart/form-data`.
*/
export function request(source: HTMLElement | string, event?: Event, options?: Partial): void;
/**
* Receive an Ajax response from the server.
*
* __Usage:__
*
* ```javascript
* jsf.ajax.response(request, context);
* ```
*
* __Implementation Requirements:__
*
* This function must evaluate the markup returned in the `request.responseXML` object and perform the following
* action:
*
* - If there is no XML response returned, signal an emptyResponse error. If the XML response does not follow the
* format as outlined in Appendix A of the Java Server Faces spec prose document signal a `malformedError` error.
* Refer to section `Signaling Errors` in Chapter 13 of the Java Server Faces spec prose document.
* - If the response was successfully processed, send a success event as outlined in Chapter 13 `Sending Events`
* section of the Java Server Faces spec prose document.
*
* _Update Element Processing_
*
* The `update` element is used to update a single DOM element. The `id` attribute of the update element refers to
* the DOM element that will be updated. The contents of the `CDATA` section is the data that will be used when
* updating the contents of the DOM element as specified by the `` element identifier.
*
* - If an `` element is found in the response with the identifier `javax.faces.ViewRoot`:
*
* ```xml
*
*
*
* ```
*
* Update the entire DOM replacing the appropriate `head` and/or `body` sections with the content from the
* response.
*
* - If an `` element is found in the response with an identifier containing `javax.faces.ViewState`:
*
* ```xml
*
*
*
* ```
*
* locate and update the submitting form's `javax.faces.ViewState` value with the `CDATA` contents from the
* response. ``: is the currently configured `UINamingContainer.getSeparatorChar()`.
* `` is the return from `UIViewRoot.getContainerClientId()` on the view from
* whence this state originated. `` is a number that must be unique within this view, but
* must not be included in the view state. This requirement is simply to satisfy XML correctness in parity with
* what is done in the corresponding non-partial JSF view. Locate and update the `javax.faces.ViewState` value for
* all forms specified in the render target list.
*
* - If an update element is found in the response with an identifier containing `javax.faces.ClientWindow`:
*
* ```xml
*
*
*
* ```
*
* locate and update the submitting form's `javax.faces.ClientWindow` value with the `CDATA` contents from the
* response. ``: is the currently configured `UINamingContainer.getSeparatorChar()`.
* `` is the return from `UIViewRoot.getContainerClientId()` on the view from
* whence this state originated. `` is a number that must be unique within this view, but
* must not be included in the view state. This requirement is simply to satisfy XML correctness in parity with
* what is done in the corresponding non-partial JSF view. Locate and update the `javax.faces.ClientWindow` value
* for all forms specified in the render target list.
*
* - If an update element is found in the response with the identifier `javax.faces.ViewHead`:
*
* ```xml
*
*
*
* ```
*
* update the document's `head` section with the `CDATA` contents from the response.
*
* - If an update element is found in the response with the identifier `javax.faces.ViewBody`:
*
* ```xml
*
*
*
* ```
*
* update the document's `body` section with the `CDATA` contents from the response.
*
* - For any other `` element:
*
* ```xml
*
*
*
* ```
*
* Find the DOM element with the identifier that matches the `` element identifier, and replace its
* contents with the `` element's `CDATA` contents.
*
* _Insert Element Processing_
*
* - If an `` element is found in the response with a nested `` element:
*
* ```xml
*
*
*
*
*
* ```
*
* - Extract this `` element's `CDATA` contents from the response.
* - Find the DOM element whose identifier matches before id and insert the `` element's `CDATA` content
* before the DOM element in the document.
*
* - If an element is found in the response with a nested element:
*
* ```xml
*
*
*
*
*
* ```
*
* - Extract this `` element's `CDATA` contents from the response.
* - Find the DOM element whose identifier matches after id and insert the `` element's `CDATA` content
* after the DOM element in the document.
*
* _Delete Element Processing_
*
* - If a `` element is found in the response:
*
* ```xml
*
* ```
*
* Find the DOM element whose identifier matches `delete id` and remove it from the DOM.
*
* _Element Attribute Update Processing_
*
* - If an `` element is found in the response:
*
* ```xml
*
*
*
*
* ```
*
* - Find the DOM element that matches the `` identifier.
* - For each nested `` element in ``, update the DOM element attribute value (whose name
* matches attribute name), with attribute value.
*
* _JavaScript Processing_
*
* - If an `` element is found in the response:
*
* ```xml
*
*
*
* ```
*
* - Extract this `` element's `CDATA` contents from the response and execute it as if it were JavaScript
* code.
*
* _Redirect Processing_
*
* - If a `` element is found in the response:
*
* ```xml
*
* ```
*
* Cause a redirect to the `url redirect url`.
*
* _Error Processing_
*
* - If an `` element is found in the response:
*
* ```xml
*
* ..fully qualified class name string...
*
*
* ```
*
* Extract this `` element's error-name contents and the error-message contents. Signal a `serverError`
* passing the `errorName` and `errorMessage`. Refer to section `Signaling Errors` in Chapter 13 of the Java
* Server Faces spec prose document.
*
* _Extensions_
*
* - The `` element provides a way for framework implementations to provide their own information.
* - The implementation must check if `
* ```
*
* If necessary, you can then revert to the default language settings with
*
* ```javascript
* $.keypad.setDefaults($.keypad.regionalOptions[""]);
* ```
*
* and apply the language settings to individual fields with
*
* ```javascript
* $("#frenchKeypad").keypad($.keypad.regionalOptions["fr"]);
* ```
* @since 2.0.0 - previously called regional.
*/
regionalOptions: Record>;
/**
* The standard numeric button layout. This is the default value for the `layout` setting.
* @since 2.0.0
*/
numericLayout: string[];
/**
* The alphabetic character layout for the standard Qwerty keyboard. This is the default value for the
* `alphabeticLayout` setting.
*/
qwertyAlphabetic: string[];
/**
* The full keyboard layout for the standard Qwerty keyboard. This is the default value for the `fullLayout`
* setting.
* @since 1.2.0 - Reordered and space bar added.
* @since 1.2.4 - Enter added
* @since 1.4.0 - Tab added
*/
qwertyLayout: string[];
/**
* Default test for English alphabetic characters - accepting "A" to "Z" and "a" to "z". See also the
* `isAlphabetic` setting.
* @param character A character to check.
* @return `true` if the given character is contained in the set of alphabetic characters, or `false` otherwise.
*/
isAlphabetic(character: string): boolean;
/**
* Default test for English numeric characters - accepting '0' to '9'. See also the `isNumeric` setting.
* @param character A character to check.
* @return `true` if the given character is contained in the set of numerical characters, or `false` otherwise.
*/
isNumeric(character: string): boolean;
/**
* Convert a character into its upper case form - using the standard JavaScript `toUpperCase` function. See also
* the `toUpper` setting.
* @param character A character to convert to upper case.
* @return The given character, converted to upper case, or the given character itself, if it cannot be
* converted.
* @since 1.5.0
*/
toUpper(character: string): string;
/**
* Insert text into an input field at its current cursor position. This replaces text if a selection has been
* made.
* @param input An input element into which to insert the given value. May be either an element or a CSS
* selector.
* @param value The text to insert.
*/
insertValue(input: HTMLElement | JQuery | string, value: string): void;
/**
* Update the default instance settings to use with all keypad instances.
* @param settings The new default settings to apply.
*/
setDefaults(settings: Partial): void;
/**
* Define a new action key for use on the keypad. Up to 32 keys may be defined, including the built-in ones.
*
* ```javascript
* $.keypad.addKeyDef("UPPER", "upper", function(inst) {
* this.val(this.val().toUpperCase()).focus();
* });
* $("#keypad").keypad({
* upperText: "U/C",
* upperStatus: "Convert to upper case",
* layout: [
* "abc" + $.keypad.CLOSE,
* "def" + $.keypad.CLEAR,
* "ghi" + $.keypad.BACK,
* "jkl" + $.keypad.UPPER
* ]
* });
* ```
* @param id Name of the variable to use to include this key in a layout.
* @param name Name used for a CSS styling class for the key (`keypad-`) and for finding its display text
* (using `Text` and `Status`).
* @param action Code to be run when the key is pressed. it receives the keypad instance as a parameter, while this refers to the attached input field,
* @param noHighlight `true` to suppress the highlight class when using `ThemeRoller` styling.
*
* @since 1.4.0
*/
addKeyDef(id: string, name: string, action: (this: HTMLInputElement, instance: KeypadInstance) => void, noHighlight?: boolean): void;
}
/**
* These settings comprise the regional settings that may be localised by a language package. They can be overridden
* for individual instances:
*
* ```javascript
* $(selector).keypad({backText: "BS"});
* ```
*/
export interface RegionalSettings {
/**
* The layout for alphabetic keyboard characters in this language.
*/
alphabeticLayout: string[];
/**
* The description of the back button's purpose, used in a tool tip.
*/
backStatus: string;
/**
* The text to display for the button to erase the previous character.
*/
backText: string;
/**
* The description of the button's purpose, used in a tool tip.
*/
buttonStatus: string;
/**
* The text to display on a trigger button for the keypad.
*/
buttonText: string;
/**
* The description of the clear button's purpose, used in a tool tip.
*/
clearStatus: string;
/**
* The text to display for the button to clear the text field.
*/
clearText: string;
/**
* The description of the close button's purpose, used in a tool tip.
*/
closeStatus: string;
/**
* The text to display for the button to close the keypad.
*/
closeText: string;
/**
* The description of the enter button's purpose, used in a tool tip.
* @since 1.2.4
*/
enterStatus: string;
/**
* The text to display for the button to add a carriage return.
* @since 1.2.4
*/
enterText: string;
/**
* The layout for the full standard keyboard in this language.
*/
fullLayout: string[];
/**
* A function to determine whether or not a character is alphabetic.
*
* The character to test is passed as the parameter and a boolean response is expected.
*
* The default accepts `A` to `Z` and `a` to `z`.
* @param character A character to test.
* @return `true` if the given character is contained in the set of alphabetical characters, or `false`
* otherwise.
*/
isAlphabetic(character: string): boolean;
/**
* A function to determine whether or not a character is numeric.
*
* The character to test is passed as the parameter and a boolean response is expected.
*
* The default accepts `0` to `9`.
* @param character A character to test.
* @return `true` if the given character is contained in the set of numerical characters, or `false`
* otherwise.
*/
isNumeric(character: string): boolean;
/**
* Set to `true` to indicate that the current language flows right-to-left.
*/
isRTL: boolean;
/**
* The description of the shift button's purpose, used in a tool tip.
*/
shiftStatus: string;
/**
* The text to display for the button to shift between upper and lower case characters.
*/
shiftText: string;
/**
* The description of the space bar button's purpose, used in a tool tip.
* @since 1.4.0.
*/
spacebarStatus: string;
/**
* The text to display for the extended button to add a space.
* @since 1.4.0.
*/
spacebarText: string;
/**
* The description of the tab button's purpose, used in a tool tip.
* @since 1.4.0.
*/
tabStatus: string;
/**
* The text to display for the button to add a tab.
* @since 1.4.0.
*/
tabText: string;
/**
* A function to convert a character into its upper case form.
*
* It accepts one parameter being the current character and returns the corresponding upper case character.
*
* The default uses the standard JavaScript `toUpperCase` function.
*
* ```javascript
* $(selector).keypad({
* layout: [
* "12345",
* $.keypad.SHIFT
* ],
* toUpper: function(ch) {
* return {
* "1": "!",
* "2": "@",
* "3": "#",
* "4": "$",
* "5": "%"
* }[ch] || ch;
* }
* });
* ```
* @param character A character to convert to upper case.
* @return The given character, converted to upper case; or the given character itself if it cannot be
* converted.
*
* @since 1.5.0.
*/
toUpper(character: string): string;
}
/**
* The keypad instance that is used to control the keypad. It is passed to the callback function.
*/
export interface KeypadInstance {
/**
* The name of this plugin, i.e. `keypad`.
*/
name: "keypad";
/**
* The HTML input element for entering text.
*/
elem: JQuery;
/**
* The current settings of this keypad instance.
*/
options: KeypadSettings;
/**
* Whether the keypad is currently showing upper case characters (usually triggered by pressing the shift key).
*/
ucase: boolean;
/**
* Whether the readonly attribute is set or removed from the input field.
*/
saveReadonly: boolean;
}
}
interface JQuery {
/**
* Initializes the keypad on the currently select elements.
* @param settings Optional settings for customizing the keypad.
* @return This jQuery instance for chaining.
*/
keypad(settings?: Partial): this;
/**
* Determine whether the keypad functionality has been disabled for the first of the given field(s).
* @param method The method to call on the existing keypad instance.
* @return Whether the input field is disabled.
*/
keypad(method: "isDisabled"): boolean;
/**
* Disable the keypad for the given field(s) as well as the field itself. Note that a field that is disabled when
* the keypad is applied to it causes the keypad to become disabled as well.
* @param method The method to call on the existing keypad instance.
* @return this jQuery instance for chaining.
*/
keypad(method: "disable"): this;
/**
* Enable the keypad for the given field(s) as well as the field itself.
* @param method The method to call on the existing keypad instance.
* @return this jQuery instance for chaining.
*/
keypad(method: "enable"): this;
/**
* Hide the keypad for the given field.
* @param method The method to call on the existing keypad instance.
* @return this jQuery instance for chaining.
*/
keypad(method: "hide"): this;
/**
* Pop up the keypad for the given field.
* @param method The method to call on the existing keypad instance.
* @return this jQuery instance for chaining.
*/
keypad(method: "show"): this;
/**
* Remove the keypad functionality from the given field(s).
* @param method The method to call on the existing keypad instance.
* @return this jQuery instance for chaining.
*/
keypad(method: "destroy"): this;
/**
* Retrieve all of the current settings for the first keypad instance attached to the given field(s).
*
* ```javascript
* var settings = $(selector).keypad("option");
* var prompt = $(selector).keypad("option").prompt;
* ```
* @param method The method to call on the existing keypad instance.
* @return this jQuery instance for chaining.
*
* @since 1.5.0.
*/
keypad(method: "option"): JQueryKeypad.KeypadSettings;
/**
* Retrieve one of the current settings for the first keypad instance attached to the given field(s).
* @param optionName The name of the setting to retrieve.
*
* ```javascript
* var settings = $(selector).keypad("option");
* var prompt = $(selector).keypad("option", "prompt");
* ```
*
* @typeparam K The key of the setting to retrieve.
* @param method The method to call on the existing keypad instance.
* @return this jQuery instance for chaining.
*
* @since 1.5.0.
*/
keypad(method: "option", optionName: K): JQueryKeypad.KeypadSettings[K];
/**
* Update the settings for the keypad instance(s) attached to the given field(s).
*
* ```javascript
* $(selector).keypad("option", {
* prompt: "Keypad",
* keypadOnly: false
* });
* ```
* @param method The method to call on the existing keypad instance.
* @param options The new options to set on the keypad instance.
* @return this jQuery instance for chaining.
*
* @since 1.5.0 - previously you used the `change` command.
*/
keypad(method: "option", options: Partial): this;
/**
* Update a particular setting for the keypad instance(s) attached to the given field(s).
*
* ```javascript
* $(selector).keypad("option", "prompt", "Keypad");
* ```
* @typeparam K The key of the setting to update.
* @param method The method to call on the existing keypad instance.
* @param optionName Name of the option to update.
* @param optionValue The new value for the option
* @return this jQuery instance for chaining.
*
* @since 1.5.0 - previously you used the `change` command.
*/
keypad(method: "option", optionName: K, optionValue: JQueryKeypad.KeypadSettings[K] | undefined): this;
}
interface JQueryStatic {
/**
* Keypad related constants and utility method available on the `$.keypad` object.
*/
keypad: JQueryKeypad.KeypadGlobals;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Keyboard Widget__
*
* Keyboard is an input component that uses a virtual keyboard to provide the input. Notable features are the
* customizable layouts and skinning capabilities.
* @typeparam TCfg Defaults to `KeyboardCfg`. Type of the configuration object for this widget.
*/
export class Keyboard extends PrimeFaces.widget.BaseWidget {
/**
* Unbind callback for the resize handler.
*/
resizeHandler?: PrimeFaces.UnbindCallback;
/**
* Unbind callback for the scroll handler.
*/
scrollHandler?: PrimeFaces.UnbindCallback;
/**
* Sets up all panel event listeners
*/
private bindPanelEvents(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Unbind all panel event listeners
*/
private unbindPanelEvents(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Keyboard| Keyboard widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface KeyboardCfg extends JQueryKeypad.KeypadSettings, PrimeFaces.widget.BaseWidgetCfg {
/**
* Callback that is invoked by the keyboard JQuery plugin before
* the keyboard is brought up.
*/
beforeShow: JQueryKeypad.BeforeShowListener;
/**
* The resolved and parsed keyboard layout to be used. Contains on item for each row, each
* keyboard row contains the character codes of the keys shown on that row.
*/
layout: string[];
/**
* The name of the built-in keyboard layout to use. Mutually exclusive with
* `layoutTemplate`.
*/
layoutName: string;
/**
* An optional custom keyboard layout template specified by the user. The keyboard rows
* must be separated by a comma. Each row contains the keys that should be displayed on that row. To specify a control
* button (space, back, shift etc.), separate the name of the control key with a dash.
*/
layoutTemplate: string;
/**
* Callback that is invoked by the keyboard JQuery plugin before
* the keyboard is closed.
*/
onClose: JQueryKeypad.CloseListener;
}
}
/**
* Contains a few utilities for parsing and working with different keyboard layout. Used by the Keyboard widget.
*/
declare namespace PrimeFaces.widget.KeyboardUtils {
/**
* Contains the character codes for the available control characters on the keyboard, such as space and return.
*/
export const controls: PrimeFaces.widget.KeyboardUtils.Controls;
/**
* This object contains the keyboard layouts that are available for the keyboard widget. Each keyboard layout is
* a list with one entry for each keyboard row. Each row is a string that contains the characters available on that
* row.
*/
export const layouts: PrimeFaces.widget.KeyboardUtils.PresetLayouts;
/**
* Parses a custom template layout that was specified by the user. Rows are separated by commas, keys on a row may
* be separated by dashes.
* @param template A custom layout template specified by the user.
* @return The parsed keyboard layout template. Contains one item for each row, each item contains the
* characters on that keyboard row.
*/
export function createLayoutFromTemplate(template: string): string[];
/**
* Finds and returns the keycode for the given control character. You can use this keycode in a custom keyboard
* layout.
* @param name string Name of the control keycode to get.
* @return The keycode with the given name, if it exists.
*/
export function getPresetControl(name: string): string | undefined;
/**
* Finds and returns a built-in layout with the given name. Currently available layout are `qwerty`, `qwertyBasic`,
* and `alphabetic`.
* @param name Name of a layout to get.
* @return The layout with the given name, if it exists.
*/
export function getPresetLayout(name: string): string | undefined;
/**
* Checks whether a built-in control with the given name exists. If it does, you can retrieve it via
* `getPresetControl`.
* @param key string Name of the control keycode to check.
* @return `true` if a control for the given key is defined, `false` otherwise.
*/
export function isDefinedControl(key: string): boolean;
}
declare namespace PrimeFaces.widget.KeyboardUtils {
/**
* Contains the character codes for the available control
* characters on the keyboard, such as space and return.
*/
export interface Controls {
/**
* The keyboard code for the back button that removes the character to the left of the cursor.
*/
back: string;
/**
* The keyboard code for the button that clears the entered text.
*/
clear: string;
/**
* The keyboard code for the button that closes (hides) the keyboard
*/
close: string;
/**
* The keyboard code for the space button that inserts a half-width space.
*/
halfspace: string;
/**
* The keyboard code for the modifying shift button.
*/
shift: string;
/**
* The keyboard code for the space button that inserts a full-width space.
*/
space: string;
/**
* The keyboard code for the space button that insert a whitespace.
*/
spacebar: string;
}
}
declare namespace PrimeFaces.widget.KeyboardUtils {
/**
* Contains the various different available keyboard layouts.
*/
export interface PresetLayouts {
/**
* An alphabetical layout with the letter keys in alphabetical order. This is a list with one entry for each
* keyboard row. Each row is a string that contains the characters available on that row.
*/
alphabetic: string[];
/**
* A `qwerty` layout with some special characters. This is a list with one entry for each keyboard row. Each row
* is a string that contains the characters available on that row.
*/
qwerty: string[];
/**
* A basic `qwerty` layout without many special characters. This is a list with one entry for each keyboard row.
* Each row is a string that contains the characters available on that row.
*/
qwertyBasic: string[];
}
}
/**
* Namespace for the jQuery keyfilter plugin.
*
* KeyFilter is used to filter keyboard input on specified input components.
*/
declare namespace JQueryKeyfilter {
/**
* A test function that checks whether a newly entered characters is allowed or should be blocked. The this context
* is set to the DOM element for the target input field.
* @param character A newly entered character to check.
* @return `true` to allow the entered character, or `false` to block it.
*/
export type TestFunction = (this: JQuery, character: string) => boolean;
/**
* Default, global configuration for the key filter.
*/
export interface Defaults {
/**
* A map between the built-in masks and the corresponding regular expressions.
*/
masks: DefaultMasks;
}
/**
* A map between the built-in masks and the corresponding regular expressions.
*/
export interface DefaultMasks {
/**
* The mask that allows only letters.
*/
alpha: RegExp;
/**
* The mask that allows only letters and numbers.
*/
alphanum: RegExp;
/**
* The mask that allows only valid email characters (this does **NOT** check for well-formed emails)
*/
email: RegExp;
/**
* The mask that allows only hexadecimal characters.
*/
hex: RegExp;
/**
* The mask that allows only digits and dashes.
*/
int: RegExp;
/**
* The mask that allows only digits, spaces, commas, and periods.
*/
money: RegExp;
/**
* The mask that allows only digits, commas, and periods.
*/
num: RegExp;
/**
* The mask that allows only digits.
*/
pint: RegExp;
/**
* The mask that allows only digits and periods.
*/
pnum: RegExp;
}
/**
* The main object of the key filter plugin that contains both the JQuery plugin function as well as some global
* configuration for the key filter.
*/
export interface KeyfilterNamespace {
/**
* Enables the key filter on the current input filter. Only text that matches the given regular expression is
* allowed in the input field.
* @param regExp Regular expression the value of the input field needs to match.
* @return this jQuery instance for chaining.
*/
(regExp: RegExp): JQuery;
/**
* Enables the key filter on the current input filter. An entered character needs to match the given test
* function to be allowed. If it does not match, the character is blocked and the entered character is
* discarded.
* @param testFunction A function that tests whether an entered character is allowed.
* @return this jQuery instance for chaining.
*/
(testFunction: JQueryKeyfilter.TestFunction): JQuery;
/**
* Default, global configuration for the key filter.
*/
defaults: JQueryKeyfilter.Defaults;
/**
* The version of this plugin.
*/
version: number;
}
}
interface JQuery {
/**
* The main function of the key filter plugin that can be called on an input field to set up the key filter. Also
* contains some default and global configuration for the key filter.
*/
keyfilter: JQueryKeyfilter.KeyfilterNamespace;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces KeyFilter Widget__
*
* KeyFilter is used to filter keyboard input on specified input components.
* @typeparam TCfg Defaults to `KeyFilterCfg`. Type of the configuration object for this widget.
*/
export class KeyFilter extends PrimeFaces.widget.BaseWidget {
/**
* The DOM element for the target input element to which this key filter is applied.
*/
target: JQuery;
/**
* Applies the key filter to the given input or textarea element.
* @param input A jQuery selector object.
* @param cfg The widget configuration.
*/
private applyKeyFilter(input: JQuery, cfg: TCfg): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link KeyFilter| KeyFilter widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface KeyFilterCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Defines the regular expression which should be used to test the complete input text
* content. The options `testFunction`, `regEx`, `inputRegEx`, and `mask` are mutually exclusive.
*/
inputRegEx: RegExp;
/**
* Defines the predefined mask which should be used. The options
* `testFunction`, `regEx`, `inputRegEx`, and `mask` are mutually exclusive.
*/
mask: keyof JQueryKeyfilter.DefaultMasks;
/**
* Whether the component also should prevent paste.
*/
preventPaste: boolean;
/**
* Defines the regular expression which should be used for filtering the input. The options
* `testFunction`, `regEx`, `inputRegEx`, and `mask` are mutually exclusive.
*/
regEx: RegExp;
/**
* The target input expression, defaults to the parent of this component.
*/
target: string;
/**
* An optional function which should be used for filtering. The
* options `testFunction`, `regEx`, `inputRegEx`, and `mask` are mutually exclusive.
*/
testFunction: JQueryKeyfilter.TestFunction;
}
}
/**
* Namespace for the jQuery knob plugin.
*
* This is canvas based plugin that renders a knob the user can move with the mouse ; no png or jpg sprites required.
*
* See https://github.com/aterrien/jQuery-Knob
*/
declare namespace JQueryKnob {
/**
* Models the direction of a rotation, either clockwise or anti-clockwise.
*/
export type RotationDirection = "clockwise" | "anticlockwise" | "cw" | "acw";
/**
* Settings for the jQuery knob plugin to configure the behavior and appearance.
*/
export interface KnobSettings {
/**
* Arc size in degrees. Defaults to `360`.
*/
angleArc: number;
/**
* Starting angle in degrees. Defaults to `0`.
*/
angleOffset: number;
/**
* Maximum value of the knob. Defaults to `100`.
*/
max: number;
/**
* Minimum value of the knob. Defaults to `0`.
*/
min: number;
/**
* Disables input and events. Defaults to `false`.
*/
readOnly: boolean;
/**
* Indicates in which direction the value of the knob increases. Defaults to `clockwise`.
*/
rotation: RotationDirection;
/**
* Step size for incrementing and decrementing. Defaults to `1`.
*/
step: number;
/**
* Stop at min & max on keydown and mousewheel. Defaults to `true`.
*/
stopper: boolean;
/**
* Background color, i.e. the unfilled part of the knob.
*/
bgColor: string;
/**
* Display mode "cursor", cursor size could be changed passing a numeric value to the option, default width is
* used when passing boolean value `true`.
*/
cursor: number | true;
/**
* Set to `false` to hide the input. Defaults to `true`.
*/
displayInput: boolean;
/**
* `true` to display the previous value with transparency. Defaults to `false`.
*/
displayPrevious: boolean;
/**
* Foreground color, i.e. the filled part of the knob.
*/
fgColor: string;
/**
* Font family used for displaying the value.
*/
font: string;
/**
* Font weight used for displaying the value.
*/
fontWeight: string | number;
/**
* Dial height, as a CSS unit.
*/
height: string;
/**
* Input value (number) color as a CSS unit.
*/
inputColor: string;
/**
* Gauge stroke endings.
*/
lineCap: "butt" | "round";
/**
* Gauge thickness, between 0 and 1.
*/
thickness: number;
/**
* Dial width, as a CSS unit.
*/
width: string;
/**
* Triggered when the Escape key is pressed.
* @return `false` to abort the cancellation and apply the value.
*/
cancel(this: KnobInstance): boolean;
/**
* Invoked at each change of the value.
* @param currentValue The current value of this knob.
* @return `false` to abort the change and revert the knob to its original value.
*/
change(this: KnobInstance, currentValue: number): boolean;
/**
* Invoked when drawing the canvas.
* @return `true` to continue with the default drawing of the knob widget, `false` to abort (such as when
* performing custom drawing).
*/
draw(this: KnobInstance): boolean;
/**
* Allows to format output (add unit such as `%` or `ms`).
* @param currentValue Value to be formatted.
* @return The formatted value.
*/
format(this: KnobInstance, currentValue: number): string;
/**
* Invoked when the knob is released.
* @param currentValue The current value of this knob.
* @return `false` to abort the release and not change the value.
*/
release(this: KnobInstance, currentValue: number): boolean;
}
/**
* The knob instance controlling the knob. It is passed to the callback methods.
*/
export interface KnobInstance {
/**
* The canvas on which the knob is drawn.
*/
g: CanvasRenderingContext2D;
/**
* Element for the knob.
*/
$: JQuery;
/**
* Current settings of the knob.
*/
o: KnobSettings;
/**
* Input element of the knob.
*/
i: JQuery;
}
}
interface JQuery {
/**
* Initializes the knob on the current input element. Creates the canvas with the rendered knob.
*
* Options can also be provided as data attributes, e.g.:
*
* ```html
*
* ```
* @param settings Optional settings for the knob.
* @return this jQuery instance for chaining.
*/
knob(settings?: Partial): this;
}
declare namespace PrimeFaces.widget.Knob {
/**
* Client side callback to invoke when value changes. See also
* {@link KnobCfg.onchange}.
*/
export type OnChangeCallback =
/**
* @param currentValue Current numerical value of the knob.
*/
(currentValue: number) => void;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Knob Widget__
*
* Knob is an input component to insert numeric values in a range.
* @typeparam TCfg Defaults to `KnobCfg`. Type of the configuration object for this widget.
*/
export class Knob extends PrimeFaces.widget.BaseWidget {
/**
* Name of the color theme to use. You can use on of the keys defined in
* `PrimeFaces.widget.Knob.ColorThemes`.
*/
colorTheme: string;
/**
* The DOM Element for the hidden input that stores the value of this widget.
*/
input: JQuery;
/**
* The DOM element on which the JQuery knob plugin was initialized.
*/
knob: JQuery;
/**
* Maximum allowed value for this knob.
*/
max: number;
/**
* Minimum allowed value for this knob.
*/
min: number;
/**
* Step size for incrementing or decrementing the value of this knob.
*/
step: number;
/**
* Color theme data to be used.
*/
themeObject: PrimeFaces.widget.Knob.ColorTheme;
/**
* Creates the knob widget and sets up all event listeners.
*/
private createKnob(): void;
/**
* Decrements the value of this knob by the current step size.
*/
decrement(): void;
/**
* Disables this input so that the user cannot enter a value anymore.
*/
disable(): void;
/**
* Enables this input so that the user can enter a value.
*/
enable(): void;
/**
* Retrieves the current value of this knob, as a number.
* @return The current numerical value of this knob.
*/
getValue(): number;
/**
* Increments the value of this knob by the current step size.
*/
increment(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Used in ajax updates, reloads the widget configuration.
*
* When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered
* content. However, no new instance of the widget is created. Instead, after the DOM element was replaced, this
* method is called with the new widget configuration from the server. This makes it possible to persist
* client-side state during an update, such as the currently selected tab.
*
* Please note that instead of overriding this method, you should consider adding a refresh listener instead
* via {@link addRefreshListener}. This has the advantage of letting you add multiple listeners, and makes it
* possible to add additional listeners from code outside this widget.
*
* By default, this method calls all refresh listeners, then reinitializes the widget by calling the `init`
* method.
* @override
* @param cfg The new widget configuration from the server.
* @return The value as returned by the `init` method, which is often `undefined`.
*/
override refresh(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Sets the value of this knob widget to the given value.
* @param value Value to set on this knob.
*/
setValue(value: number): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Knob| Knob widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface KnobCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Foreground color of the component.
*/
bgColor: string;
/**
* Theme of the knob.
*/
colorTheme: string;
/**
* Background color of the component.
*/
fgColor: string;
/**
* Template of the progress value e.g. `{value}%`.
*/
labelTemplate: string;
/**
* Client side callback to invoke when value changes.
*/
onchange: PrimeFaces.widget.Knob.OnChangeCallback;
/**
* Style class of the component.
*/
styleClass: string;
}
}
declare namespace PrimeFaces.widget.Knob {
/**
* A color theme for the knob, consisting of the color for the
* filled and unfilled part of the knob.
*/
export interface ColorTheme {
/**
* The background color, i.e. the color of the unfilled part of the knob. Must be a
* CSS color, e.g., `#ff0000`.
*/
bgColor: string;
/**
* The foreground color, i.e. the color of the filled part of the knob. Must be a CSS
* color, e.g., `#ff0000`.
*/
fgColor: string;
}
}
declare namespace PrimeFaces.widget.Knob {
/**
* Interface for the the list of available builtin color themes for the {@link Knob} widget.
*/
export interface ColorThemes {
/**
* The default afterdark theme.
*/
afterdark: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default afternoon theme.
*/
afternoon: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default afterwork theme.
*/
afterwork: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default aristo theme.
*/
aristo: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default black tie theme.
*/
"black-tie": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default blitzer theme.
*/
blitzer: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default bluesky theme.
*/
bluesky: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default bootstrap theme.
*/
bootstrap: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default casablanca theme.
*/
casablanca: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default cruze theme.
*/
cruze: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default cupertino theme.
*/
cupertino: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default dark hive theme.
*/
"dark-hive": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default delta theme.
*/
delta: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default dot luv theme.
*/
"dot-luv": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default eggplant theme.
*/
eggplant: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default excite bike theme.
*/
"excite-bike": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default flick theme.
*/
flick: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default glass x theme.
*/
"glass-x": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default home theme.
*/
home: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default hot sneaks theme.
*/
"hot-sneaks": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default humanity theme.
*/
humanity: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default le frog theme.
*/
"le-frog": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default midnight theme.
*/
midnight: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default mint choc theme.
*/
"mint-choc": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default overcast theme.
*/
overcast: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default pepper grinder theme.
*/
"pepper-grinder": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default redmond theme.
*/
redmond: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default rocket theme.
*/
rocket: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default sam theme.
*/
sam: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default smoothness theme.
*/
smoothness: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default south street theme.
*/
"south-street": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default start theme.
*/
start: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default sunny theme.
*/
sunny: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default swanky purse theme.
*/
"swanky-purse": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default trontastic theme.
*/
trontastic: PrimeFaces.widget.Knob.ColorTheme;
/**
* The default ui darkness theme.
*/
"ui-darkness": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default ui lightness theme.
*/
"ui-lightness": PrimeFaces.widget.Knob.ColorTheme;
/**
* The default vader theme.
*/
vader: PrimeFaces.widget.Knob.ColorTheme;
}
}
declare namespace PrimeFaces.widget.Knob {
/**
* Contains a list with the available builtin color themes for the
* {@link Knob} widget.
*/
export const colorThemes: PrimeFaces.widget.Knob.ColorThemes;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Lifecycle Widget__
*
* Lifecycle is a utility component which displays the execution time of each JSF phase. It also synchronizes
* automatically after each AJAX request.
* @typeparam TCfg Defaults to `LifecycleCfg`. Type of the configuration object for this widget.
*/
export class Lifecycle extends PrimeFaces.widget.BaseWidget {
/**
* Whether this widget was initialized.
*/
initialized: boolean;
/**
* Whether the lifecycle display is currently being updated.
*/
updating: boolean;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Updates this lifecycle widget after an AJAX request.
*/
private update(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Lifecycle| Lifecycle widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface LifecycleCfg extends PrimeFaces.widget.BaseWidgetCfg {
}
}
declare namespace PrimeFaces.widget.Log {
/**
* Available severity levels for log messages used by
* the `Log` widget.
*/
export type Severity = "all" | "info" | "warn" | "debug" | "error";
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Log Widget__
*
* Log component is a visual console to display logs on JSF pages.
*
* The Log API is also available via global PrimeFaces object in case you’d like to use the log component to display
* your logs:
*
* ```javascript
* PrimeFaces.info("Info message");
* PrimeFaces.debug("Debug message");
* PrimeFaces.warn("Warning message");
* PrimeFaces.error("Error message");
* ```
* @typeparam TCfg Defaults to `LogCfg`. Type of the configuration object for this widget.
*/
export class Log extends PrimeFaces.widget.BaseWidget {
/**
* The DOM element for the content with the log messages
*/
content: JQuery;
/**
* The DOM elements for the filter buttons
*/
filters: JQuery;
/**
* The DOM element for the header
*/
header: JQuery;
/**
* The DOM element for the items container
*/
itemsContainer: JQuery;
/**
* The current severity level that controls which log messages are shown
*/
severity: PrimeFaces.widget.Log.Severity;
/**
* Logs a message at the given severity level.
* @param msg Message to log
* @param severity Severity of the log message
* @param icon Icon to show near the log message
*/
add(msg: string, severity: PrimeFaces.widget.Log.Severity, icon: string): void;
/**
* Sets up all event listeners that are required by this widget.
*/
private bindEvents(): void;
/**
* Logs the given message at the `debug` level.
* @param msg Message to log
*/
debug(msg: string): void;
/**
* Logs the given message at the `error` level.
* @param msg Message to log
*/
error(msg: string): void;
/**
* Hides all log messages except those at the given severity level
* @param severity Severity of the log messages to show
*/
filter(severity: PrimeFaces.widget.Log.Severity): void;
/**
* Callback for when a click occurred on the log message header.
* @param event The event that occurred.
* @param severityClass Class for the severity of the log message.
* @param severity Severity of the log message.
* @param button The button that was pressed.
*/
private handleFilterClick(event: JQuery.TriggeredEvent, severityClass: string, severity: PrimeFaces.widget.Log.Severity, button: JQuery): void;
/**
* Hides all log messages.
*/
hide(): void;
/**
* Logs the given message at the `info` level.
* @param msg Message to log
*/
info(msg: string): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Shows all log messages.
*/
show(): void;
/**
* Logs the given message at the `warn` level.
* @param msg Message to log
*/
warn(msg: string): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Log|Log widget}. You can access this
* configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this configuration is
* usually meant to be read-only and should not be modified.
*/
export interface LogCfg extends PrimeFaces.widget.BaseWidgetCfg {
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Menu Widget__
*
* Base class for the different menu widgets, such as the `PlainMenu` or the `TieredMenu`.
* @typeparam TCfg Defaults to `MenuCfg`. Type of the configuration object for this widget.
*/
export class Menu extends PrimeFaces.widget.BaseWidget {
/**
* Unbind callback for the hide overlay handler.
*/
hideOverlayHandler?: PrimeFaces.UnbindCallback;
/**
* `true` if a menu item was clicked and the mouse button is still pressed.
*/
itemMouseDown: boolean;
/**
* The DOM element for the form element that can be targeted via arrow or tab keys.
*/
keyboardTarget: JQuery;
/**
* Unbind callback for the resize handler.
*/
resizeHandler?: PrimeFaces.UnbindCallback;
/**
* Unbind callback for the scroll handler.
*/
scrollHandler?: PrimeFaces.UnbindCallback;
/**
* Handler for CSS transitions used by this widget.
*/
transition?: PrimeFaces.CssTransitionHandler | null;
/**
* DOM element which triggers this menu.
*/
trigger: JQuery;
/**
* Aligns this menu as specified in its widget configuration (property `pos`).
*/
align(): void;
/**
* Sets up the global event listeners on the document in case trigger has been updated in DOM
*/
private bindAjaxListener(): void;
/**
* Sets up all panel event listeners
*/
protected bindPanelEvents(): void;
/**
* Sets up the event listener on the trigger.
*/
private bindTrigger(): void;
/**
* Fired when the browser viewport is resized or scrolled. In Mobile environment we don't want to hider the overlay
* we want to re-align it. This is because on some mobile browser the popup may force the browser to trigger a
* resize immediately and close the overlay. See GitHub #7075.
*/
private handleViewportChange(): void;
/**
* Hides this menu so that it becomes invisible and cannot be interacted with any longer.
*/
hide(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Initializes the overlay. Finds the element to which to append this menu and appends it to that element.
*/
protected initOverlay(): void;
/**
* Performs some setup required to make this overlay menu work with dialogs.
*/
protected setupDialogSupport(): void;
/**
* Shows (displays) this menu so that it becomes visible and can be interacted with.
*/
show(): void;
/**
* Unbind all panel event listeners
*/
protected unbindPanelEvents(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Menu| Menu widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface MenuCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Search expression for the element to which the menu overlay is appended.
*/
appendTo: string;
/**
* Defines which position on the target element to align the positioned element against
*/
at: string;
/**
* When the positioned element overflows the window in some direction, move it to an
* alternative position.
*/
collision: string;
/**
* Defines which position on the element being positioned to align with the target element.
*/
my: string;
/**
* `true` if this menu is displayed as an overlay, or `false` otherwise.
*/
overlay: boolean;
/**
* Describes how to align this menu.
*/
pos: JQueryUI.JQueryPositionOptions;
/**
* ID of the event which triggers this menu.
*/
trigger: string;
/**
* Event which triggers this menu.
*/
triggerEvent: string;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces BreadCrumb Widget__
*
* BreadCrumb provides contextual information about the page hierarchy.
* @typeparam TCfg Defaults to `BreadCrumbCfg`. Type of the configuration object for this widget.
*/
export class BreadCrumb extends PrimeFaces.widget.BaseWidget {
/**
* The script element for the seo.
*/
seoScript: JQuery;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Used in ajax updates, reloads the widget configuration.
*
* When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered
* content. However, no new instance of the widget is created. Instead, after the DOM element was replaced, this
* method is called with the new widget configuration from the server. This makes it possible to persist
* client-side state during an update, such as the currently selected tab.
*
* Please note that instead of overriding this method, you should consider adding a refresh listener instead
* via {@link addRefreshListener}. This has the advantage of letting you add multiple listeners, and makes it
* possible to add additional listeners from code outside this widget.
*
* By default, this method calls all refresh listeners, then reinitializes the widget by calling the `init`
* method.
* @override
* @param cfg The new widget configuration from the server.
* @return The value as returned by the `init` method, which is often `undefined`.
*/
override refresh(cfg: PrimeFaces.PartialWidgetCfg): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link BreadCrumb| BreadCrumb widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface BreadCrumbCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Used to produce an Advanced SEO structure on the page. Default is false.
*/
seo: boolean;
}
}
declare namespace PrimeFaces.widget.ContextMenu {
/**
* Client side callback invoked before the context menu is
* shown.
*/
export type BeforeShowCallback =
/**
* @param event Event that triggered the context menu to
* be shown (e.g. a mouse click).
* @return ` true` to show the context menu, `false` to
* prevent is from getting displayed.
*/
(this: PrimeFaces.widget.ContextMenu, event: JQuery.TriggeredEvent) => boolean;
}
declare namespace PrimeFaces.widget.ContextMenu {
/**
* Selection mode for the context, whether
* the user may select only one or multiple items at the same time.
*/
export type SelectionMode = "single" | "multiple";
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces ContextMenu Widget__
*
* ContextMenu provides an overlay menu displayed on mouse right-click event.
* @typeparam TCfg Defaults to `ContextMenuCfg`. Type of the configuration object for this widget.
*/
export class ContextMenu extends PrimeFaces.widget.TieredMenu {
/**
* Target element of this context menu. A right click on the target brings up this context menu.
*/
jqTarget: JQuery;
/**
* ID selector or DOM element of the target, i.e. the element this context menu
* belongs to.
*/
jqTargetId: string | JQuery;
/**
* Handler for CSS transitions used by this widget.
*/
transition?: PrimeFaces.CssTransitionHandler | null;
/**
* Clean up this widget and remove events from the DOM.
*/
private _cleanup(): void;
/**
* Sets up all event listeners for the mouse events on the menu entries (`click` / `hover`).
* @override
*/
protected override bindItemEvents(): void;
/**
* Sets up all panel event listeners
* @override
*/
protected override bindPanelEvents(): void;
/**
* Binds mobile touch events.
*/
protected bindTouchEvents(): void;
/**
* Will be called after an AJAX request if the widget container will be detached.
*
* When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered
* content. When the element is removed from the DOM by the update, the DOM element is detached from the DOM and
* this method gets called.
*
* Please note that instead of overriding this method, you should consider adding a destroy listener instead
* via {@link addDestroyListener}. This has the advantage of letting you add multiple listeners, and makes it
* possible to add additional listeners from code outside this widget.
*
* By default, this method just calls all destroy listeners.
* @override
*/
override destroy(): void;
/**
* Finds the target element of this context menu. A right-click on that target element brings up this context menu.
* @return The target element of this context men.
*/
private getTarget(): JQuery;
/**
* Hides this menu so that it becomes invisible and cannot be interacted with any longer.
* @override
*/
override hide(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Checks whether this context menu is open.
* @return `true` if this context menu is currently visible, `false` otherwise.
*/
isVisible(): boolean;
/**
* Used in ajax updates, reloads the widget configuration.
*
* When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered
* content. However, no new instance of the widget is created. Instead, after the DOM element was replaced, this
* method is called with the new widget configuration from the server. This makes it possible to persist
* client-side state during an update, such as the currently selected tab.
*
* Please note that instead of overriding this method, you should consider adding a refresh listener instead
* via {@link addRefreshListener}. This has the advantage of letting you add multiple listeners, and makes it
* possible to add additional listeners from code outside this widget.
*
* By default, this method calls all refresh listeners, then reinitializes the widget by calling the `init`
* method.
* @override
* @param cfg The new widget configuration from the server.
* @return The value as returned by the `init` method, which is often `undefined`.
*/
override refresh(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Shows (displays) this menu so that it becomes visible and can be interacted with.
* @override
* @param e The event that triggered this context menu to be shown.
*
* Note: __This parameter is not optional__, but is marked as such since this method overrides a parent method
* that does not have any parameters. Do not (implicitly) cast an instance of this class to a parent type.
*/
override show(e?: JQuery.TriggeredEvent): void;
/**
* Unbind all panel event listeners
* @override
*/
protected override unbindPanelEvents(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link ContextMenu| ContextMenu widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface ContextMenuCfg extends PrimeFaces.widget.TieredMenuCfg {
/**
* Search expression for the element to which this context menu is appended. This is usually
* invoke before the context menu is shown. When it returns `false`, this context menu is not shown.
*/
appendTo: string;
/**
* Client side callback invoked before the
* context menu is shown.
*/
beforeShow: PrimeFaces.widget.ContextMenu.BeforeShowCallback;
/**
* If true, prevents menu from being shown.
*/
disabled: boolean;
/**
* Event that triggers this context menu, usually a (right) mouse click.
*/
event: string;
/**
* Defines the selection behavior.
*/
selectionMode: PrimeFaces.widget.ContextMenu.SelectionMode;
/**
* Client ID of the target widget.
*/
target: string;
/**
* Selector to filter the elements to attach the menu.
*/
targetFilter: string;
/**
* Widget variable of the target widget.
*/
targetWidgetVar: string;
}
}
declare namespace PrimeFaces.widget.ContextMenu {
/**
* Interface for widgets that wish to
* provide a context menu. They need to implement the `bindContextMenu` method. This method is called once when the
* context menu is initialized. Widgets should register the appropriate event listeners and call `menuWidget.show()`
* to bring up the context menu.
* @typeparam TTarget Type of the widget that wishes to provide a context menu.
*/
export interface ContextMenuProvider {
/**
* Callback that is invoked when the context menu is initialized. Lets the
* context menu provider register the appropriate event listeners for when the context menu should be shown and hidden.
* @param menuWidget The widget instance of the
* context menu.
* @param targetWidget The widget instance of the target widget that wants
* to add a context menu.
* @param targetId ID selector or DOM element of the target, i.e.
* the element the context menu belongs to.
* @param cfg The current configuration of the
* context menu.
*/
bindContextMenu(menuWidget: PrimeFaces.widget.ContextMenu, targetWidget: TTarget, targetId: string | JQuery, cfg: PrimeFaces.widget.ContextMenuCfg): void;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces MegaMenu Widget__
*
* MegaMenu is a horizontal navigation component that displays sub menus together.
* @typeparam TCfg Defaults to `MegaMenuCfg`. Type of the configuration object for this widget.
*/
export class MegaMenu extends PrimeFaces.widget.BaseWidget {
/**
* Whether the current menu is active and displayed.
*/
active: boolean;
/**
* The currently active (highlighted) menu item.
*/
activeitem?: JQuery | null;
/**
* Whether the writing direction is set to right-to-left.
*/
isRTL: boolean;
/**
* The DOM element for the input element accessible via keyboard keys.
*/
keyboardTarget: JQuery;
/**
* The DOM elements for the root level menu links with the class `.ui-menuitem-link`.
*/
rootLinks: JQuery;
/**
* The DOM elements for the root level menu items with the class `.ui-menu-list`.
*/
rootList: JQuery;
/**
* The DOM elements for all menu links not a the root level, with the class `.ui-menuitem-link`.
*/
subLinks: JQuery;
/**
* Timeout ID, used for the animation when the menu is shown.
*/
timeoutId?: number;
/**
* Activates the menu item, i.e. opens the sub menu.
* @param menuitem A menu item to open.
*/
activate(menuitem: JQuery): void;
/**
* Sets up all event listeners that are required by this widget.
*/
private bindEvents(): void;
/**
* Sets up all keyboard-related event listeners.
*/
private bindKeyEvents(): void;
/**
* Deactivates the menu item, i.e. closes the sub menu.
* @param menuitem A menu item to close.
* @param animate If `true`, closes the sub menu with an animation, or `false` otherwise.
*/
deactivate(menuitem: JQuery, animate?: boolean): void;
/**
* Finds the menu items that succeeds the given item.
* @param menuitem One of the menu items of this mega menu, with the class `.ui-menuitem`.
* @return The menu item after the given item. Empty JQuery instance if the given item is the last.
*/
findNextItem(menuitem: JQuery): JQuery;
/**
* Finds the menu items that preceeded the given item.
* @param menuitem One of the menu items of this mega menu, with the class `.ui-menuitem`.
* @return The menu item before the given item. Empty JQuery instance if the given item is the first.
*/
findPrevItem(menuitem: JQuery): JQuery;
/**
* Finds the the menu group of the given submenu, i.e. the children of the given item.
* @param submenu A submenu with children.
* @return The first sub menu list, an item with the class `.ui-menu-list`.
*/
getFirstMenuList(submenu: JQuery): JQuery;
/**
* Highlight the given menu entry, as if the user were to hover it.
* @param menuitem A menu entry to highlight.
*/
highlight(menuitem: JQuery): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Checks whether the given menu item is the root menu item element.
* @param menuitem One of the menu items of this mega menu.
* @return `true` if the given menu item is the root, or `false` otherwise.
*/
isRootLink(menuitem: JQuery): boolean;
/**
* Resets the entire mega menu, i.e. closes all opened sub menus.
*/
reset(): void;
/**
* Opens and shows the sub menu of the given menu item.
* @param menuitem A menu item with a submenu.
* @param submenu One of the submenus of the given menu item to show.
*/
private showSubmenu(menuitem: JQuery, submenu: JQuery): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link MegaMenu| MegaMenu widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface MegaMenuCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Index of the menu item initially active.
*/
activeIndex: number;
/**
* Defines whether sub menus will be displayed on mouseover or not. When set to false,
* click event is required to display.
*/
autoDisplay: boolean;
/**
* Delay in milliseconds before displaying the sub menu. Default is 0 meaning immediate.
*/
delay: number;
/**
* `true` if the mega menu is displayed with a vertical layout, `false` if displayed with a
* horizontal layout.
*/
vertical: boolean;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Menubar Widget__
*
* Menubar is a horizontal navigation component.
* @typeparam TCfg Defaults to `MenubarCfg`. Type of the configuration object for this widget.
*/
export class Menubar extends PrimeFaces.widget.TieredMenu {
/**
* The currently active (highlighted) menu item.
*/
activeitem?: JQuery | null;
/**
* Timeout ID, used for the animation when the menu is shown.
*/
timeoutId?: number;
/**
* Sets up all event listners required for keyboard interactions.
* @override
*/
protected override bindKeyEvents(): void;
/**
* Shows the given submenu of a menu item.
* @override
* @param menuitem A menu item (`LI`) with children.
* @param submenu A child of the menu item.
*/
override showSubmenu(menuitem: JQuery, submenu: JQuery): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Menubar| Menubar widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface MenubarCfg extends PrimeFaces.widget.TieredMenuCfg {
/**
* Delay in milliseconds before displaying the sub menu. Default is 0 meaning immediate.
*/
delay: number;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces MenuButton Widget__
*
* MenuButton displays different commands in a popup menu.
* @typeparam TCfg Defaults to `MenuButtonCfg`. Type of the configuration object for this widget.
*/
export class MenuButton extends PrimeFaces.widget.TieredMenu {
/**
* Number of concurrent active Ajax requests.
*/
ajaxCount?: number;
/**
* The DOM element for the menu button.
*/
button: JQuery;
/**
* The DOM element for the menu overlay panel.
*/
menu: JQuery;
/**
* Client ID of the menu overlay panel.
*/
menuId: string;
/**
* The DOM elements for the individual menu entries.
*/
menuitems: JQuery;
/**
* Timeout ID used for the animation when the menu is shown.
*/
timeoutId?: number;
/**
* Handler for CSS transitions used by this widget.
*/
transition?: PrimeFaces.CssTransitionHandler | null;
/**
* Align the overlay panel with the menu items so that it is positioned next to the menu button.
*/
alignPanel(): void;
/**
* Sets up all event listeners that are required by this widget.
*/
private bindButtonEvents(): void;
/**
* Sets up all panel event listeners
* @override
*/
override bindPanelEvents(): void;
/**
* Disables this button so that the user cannot press the button anymore.
*/
disable(): void;
/**
* Enables this button so that the user can press the button.
*/
enable(): void;
/**
* Fired when the browser viewport is resized or scrolled. In Mobile environment we don't want to hider the overlay
* we want to re-align it. This is because on some mobile browser the popup may force the browser to trigger a
* resize immediately and close the overlay. See GitHub #7075.
*/
private handleOverlayViewportChange(): void;
/**
* Hides the overlay menu with the menu items, as if the user clicked outside the menu.
* @override
*/
override hide(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Used in ajax updates, reloads the widget configuration.
*
* When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered
* content. However, no new instance of the widget is created. Instead, after the DOM element was replaced, this
* method is called with the new widget configuration from the server. This makes it possible to persist
* client-side state during an update, such as the currently selected tab.
*
* Please note that instead of overriding this method, you should consider adding a refresh listener instead
* via {@link addRefreshListener}. This has the advantage of letting you add multiple listeners, and makes it
* possible to add additional listeners from code outside this widget.
*
* By default, this method calls all refresh listeners, then reinitializes the widget by calling the `init`
* method.
* @override
* @param cfg The new widget configuration from the server.
* @return The value as returned by the `init` method, which is often `undefined`.
*/
override refresh(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Brings up the overlay menu with the menu items, as if the menu button were pressed.
* @override
*/
override show(): void;
/**
* Shows the given submenu of a menu item.
* @override
* @param menuitem A menu item (`LI`) with children.
* @param submenu A child of the menu item.
*/
override showSubmenu(menuitem: JQuery, submenu: JQuery): void;
/**
* Unbind all panel event listeners
* @override
*/
override unbindPanelEvents(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link MenuButton| MenuButton widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface MenuButtonCfg extends PrimeFaces.widget.TieredMenuCfg {
/**
* When the positioned element overflows the window in some direction, move it to an
* alternative position. Similar to my and at, this accepts a single value or a pair for horizontal/vertical,
* e.g., `flip`, `fit`, `fit flip`, `fit none`.
*/
collision: string;
/**
* Whether this menu button is initially disabled.
*/
disabled: boolean;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces PanelMenu Widget__
*
* PanelMenu is a hybrid component of accordionPanel and tree components.
* @typeparam TCfg Defaults to `PanelMenuCfg`. Type of the configuration object for this widget.
*/
export class PanelMenu extends PrimeFaces.widget.BaseWidget {
/**
* A list of IDs of the menu items that are currently expanded.
*/
expandedNodes: string[];
/**
* The DOM elements for the menu item that is currently focused.
*/
focusedItem: JQuery | null;
/**
* The DOM elements for the accordion panel headers that can be expanded and collapsed.
*/
headers: JQuery;
/**
* The DOM elements for the content container of each accordion panel.
*/
menuContent: JQuery;
/**
* The DOM elements for the text of each menu entry in the accordion panels.
*/
menuText: JQuery;
/**
* The DOM elements for the menu items inside each accordion panel that can be clicked.
*/
menuitemLinks: JQuery;
/**
* Key used to store the UI state (expanded items) in an HTML5 Local Store.
*/
stateKey: string;
/**
* The DOM elements for the clickable links with a sub menu that is shown upon clicking the
* link.
*/
treeLinks: JQuery;
/**
* Callback invoked after a menu item was expanded. Saves the current UI state in an HTML5 Local Store.
* @param element Element that was expanded.
*/
private addAsExpanded(element: JQuery): void;
/**
* Sets up all event listeners that are required by this widget.
*/
private bindEvents(): void;
/**
* Sets up the keyboard event listeners required by this panel menu widget.
*/
private bindKeyEvents(): void;
/**
* Deletes the UI state of this panel menu stored in an HTML5 Local Store.
*/
private clearState(): void;
/**
* Collapses all siblings of the given header column.
* @param header The header column that was clicked.
*/
private collapseActiveSibling(header: JQuery): void;
/**
* Collapses all menu panels that are currently expanded.
*/
collapseAll(): void;
/**
* Collapses the given accordional panel, hiding the menu entries it contains.
* @param header A menu panel to collapse.
*/
collapseRootSubmenu(header: JQuery): void;
/**
* Collapses the given tree-like sub menu item, hiding the sub menu entries it contains.
* @param submenu A sub menu tree item to collapse.
*/
collapseTreeItem(submenu: JQuery): void;
/**
* Create the key where the state for this component is stored. By default PanelMenu state is global so it is
* remembered between page navigations.
*/
createStorageKey(): void;
/**
* Expands the given accordional panel, showing the menu entries it contains.
* @param header A menu panel to collapse.
* @param restoring Whether this method was called from `restoreState`.
*/
expandRootSubmenu(header: JQuery, restoring?: boolean): void;
/**
* Expands the given tree-like sub menu item, showing the sub menu entries it contains.
* @param submenu A sub menu tree item to expand.
* @param restoring Whether this method was called from `restoreState`.
*/
expandTreeItem(submenu: JQuery, restoring?: boolean): void;
/**
* Puts focus on the given menu item.
* @param item A menu item to focus.
*/
focusItem(item: JQuery): void;
/**
* Finds the first child menu item of the given content element.
* @param content Some content element of this panel menu.
* @return The first child menu item of the given content, with the class `.ui-menuitem`.
*/
private getFirstItemOfContent(content: JQuery): JQuery;
/**
* Finds the displayed text of the given menu item.
* @param item A menu item of this panel menu.
* @return The displayed text of the given menu item, not including the text of sub menu items.
*/
getItemText(item: JQuery): string;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Checks whether the given menu items is currently expanded or collapsed.
* @param item A menu item to check.
* @return `true` if the given menu item is expanded (children are shown), or `false` otherwise.
*/
isExpanded(item: JQuery): boolean;
/**
* Callback invoked after a menu item was collapsed. Saves the current UI state in an HTML5 Local Store.
* @param element Element that was collapsed.
*/
private removeAsExpanded(element: JQuery): void;
/**
* Callback invoked after the focused menu item receives a blur.
*/
private removeFocusedItem(): void;
/**
* Read the UI state of this panel menu stored in an HTML5 Local Store and reapplies to this panel menu. Used to preserve the
* state during AJAX updates as well as between page reloads.
*/
private restoreState(): void;
/**
* Writes the UI state of this panel menu to an HTML5 Local Store. Used to preserve the state during AJAX updates as well as
* between page reloads.
*/
private saveState(): void;
/**
* Finds the next menu item to focus and highlight when the user presses the down arrow key.
* @param item An item where to start the search.
* @return The found item that should receive focus, or `null` if no item was found.
*/
private searchDown(item: JQuery): JQuery | null;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link PanelMenu| PanelMenu widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface PanelMenuCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Whether multiple accordion menu items are allowed to be expanded at the same time.
*/
multiple: boolean;
/**
* Whether the UI state (expanded menu items) should be persisted in an HTML5 Local Store.
*/
stateful: boolean;
/**
* When enabled, menu state is saved globally across pages. If disabled then state
* is stored per view/page.
*/
statefulGlobal: boolean;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces PlainMenu Widget__
*
* Menu is a navigation component with sub menus and menu items.
* @typeparam TCfg Defaults to `PlainMenuCfg`. Type of the configuration object for this widget.
*/
export class PlainMenu extends PrimeFaces.widget.Menu {
/**
* A list with the ID of each menu item (with children) that is collapsed.
*/
collapsedIds: string[];
/**
* DOM elements with the links of each menu item.
*/
menuitemLinks: JQuery;
/**
* Name of the HTML5 Local Store that is used to store the state of this plain menu (expanded / collapsed
* menu items).
*/
stateKey: string;
/**
* Sets up all event listeners required by this widget.
*/
private bindEvents(): void;
/**
* Clear the saved state (collapsed / expanded menu items) of this plain menu.
*/
private clearState(): void;
/**
* Collapses the given sub menu so that the children of that sub menu are not visible anymore.
* @param header Menu item with children to collapse.
* @param stateful `true` if the new state of this menu (which items are collapsed and expanded) should
* be saved (in an HTML5 Local Store), `false` otherwise.
*/
collapseSubmenu(header: JQuery, stateful?: boolean): void;
/**
* Create the key where the state for this component is stored. By default it is stored per view. Override this
* method to change the behavior to be global.
*/
createStorageKey(): void;
/**
* Expands the given sub menu so that the children of that sub menu become visible.
* @param header Menu item with children to expand.
* @param stateful `true` if the new state of this menu (which items are collapsed and expanded) should
* be saved (in an HTML5 Local Store), `false` otherwise.
*/
expandSubmenu(header: JQuery, stateful?: boolean): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Restores that state as stored by `saveState`. Usually called after an AJAX update and on page load.
*/
private restoreState(): void;
/**
* Saves the current state (expanded / collapsed menu items) of this plain menu. Used to preserve the state during
* AJAX updates as well as between page reloads. The state is stored in an HTML5 Local Store.
*/
private saveState(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link PlainMenu| PlainMenu widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface PlainMenuCfg extends PrimeFaces.widget.MenuCfg {
/**
* When enabled, menu state is saved globally across pages. If disabled then state
* is stored per view/page.
*/
statefulGlobal: boolean;
/**
* `true` if grouped items can be toggled (expanded / collapsed), or `false` otherwise.
*/
toggleable: boolean;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces SlideMenu Widget__
*
* SlideMenu is used to display nested submenus with sliding animation.
* @typeparam TCfg Defaults to `SlideMenuCfg`. Type of the configuration object for this widget.
*/
export class SlideMenu extends PrimeFaces.widget.Menu {
/**
* The DOM element for the link to navigate back to the previous menu page.
*/
backward: JQuery;
/**
* The DOM element for the slide menu content.
*/
content: JQuery;
/**
* Width of the menu container in pixels.
*/
jqWidth: number;
/**
* The DOM elements for the the links to sub menus.
*/
links: JQuery;
/**
* Whether this menu was already rendered.
*/
rendered: boolean;
/**
* The DOM elements for the root menu entries.
*/
rootList: JQuery;
/**
* A stack with the menu items that were selected. Used to slide back to the previous menu page.
*/
stack: JQuery[];
/**
* The DOM elements for the sub menu items other that the root menu items.
*/
submenus: JQuery;
/**
* The DOM element for the wrapper of the slide menu.
*/
wrapper: JQuery;
/**
* Slides back to the previous menu page.
*/
back(): void;
/**
* Sets up all event listeners that are required by this widget.
*/
private bindEvents(): void;
/**
* Inspects the stack and returns its size.
* @return The number of items on the stack.
*/
private depth(): number;
/**
* Slides to the given sub menu.
* @param submenu A sub menu to show, with the class `ui-menuitem-link`.
*/
forward(submenu: JQuery): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Peeks the stack and returns the topmost item.
* @return The last item on the stack, or `undefined` if the stack is empty
*/
private last(): JQuery | undefined;
/**
* Pops the most recently a menu page from the stack and return it.
* @return The item on top of the stack, or `null` if the stack is empty.
*/
private pop(): JQuery | null;
/**
* Adds the menu page to the top of the stack.
* @param submenu A menu page to push to the stack.
*/
private push(submenu: JQuery): void;
/**
* Renders the client-side parts of this widget.
*/
private render(): void;
/**
* Shows (displays) this menu so that it becomes visible and can be interacted with.
* @override
*/
override show(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link SlideMenu| SlideMenu widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface SlideMenuCfg extends PrimeFaces.widget.MenuCfg {
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces TabMenu Widget__
*
* TabMenu is a navigation component that displays menuitems as tabs.
* @typeparam TCfg Defaults to `TabMenuCfg`. Type of the configuration object for this widget.
*/
export class TabMenu extends PrimeFaces.widget.Menu {
/**
* The DOM elements for the tab menu entries.
*/
items: JQuery;
/**
* Sets up all event listeners that are required by this widget.
*/
private bindEvents(): void;
/**
* Sets up all keyboard event listeners that are required by this widget.
*/
private bindKeyEvents(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link TabMenu| TabMenu widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface TabMenuCfg extends PrimeFaces.widget.MenuCfg {
}
}
declare namespace PrimeFaces.widget.TieredMenu {
/**
* Allowed event types for toggling a tiered menu.
*/
export type ToggleEvent = "hover" | "click";
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces TieredMenu Widget__
*
* TieredMenu is used to display nested submenus with overlays.
* @typeparam TCfg Defaults to `TieredMenuCfg`. Type of the configuration object for this widget.
*/
export class TieredMenu extends PrimeFaces.widget.Menu {
/**
* Whether the menu is currently active.
*/
active?: boolean;
/**
* The active menu item, if any.
*/
activeitem?: JQuery | null;
/**
* Whether the writing direction is set to right-to-left.
*/
isRTL: boolean;
/**
* Set to `true` an item was clicked and se to `false` when the user clicks
* outside the menu.
*/
itemClick?: boolean;
/**
* DOM element with all links for the menu entries of this tiered menu.
*/
links: JQuery;
/**
* DOM element with all links for the root (top-level) menu entries of this tiered menu.
*/
rootLinks: JQuery;
/**
* Timeout ID, used for the animation when the menu is shown.
*/
timeoutId?: number;
/**
* Activates a menu item so that it can be clicked and interacted with.
* @param menuitem Menu item (`LI`) to activate.
*/
activate(menuitem: JQuery): void;
/**
* Sets up all event listeners when `toggleEvent` is set to `click`.
*/
protected bindClickModeEvents(): void;
/**
* Registers a delegated event listener for a mouse click on a menu entry.
*/
protected bindDocumentHandler(): void;
/**
* Sets up all event listeners required by this widget.
*/
protected bindEvents(): void;
/**
* Sets up all event listeners when `toggleEvent` is set to `hover`.
*/
protected bindHoverModeEvents(): void;
/**
* Sets up all event listeners for the mouse events on the menu entries (`click` / `hover`).
*/
protected bindItemEvents(): void;
/**
* Sets up all event listners required for keyboard interactions.
*/
protected bindKeyEvents(): void;
/**
* Deactivates a menu item so that it cannot be clicked and interacted with anymore.
* @param menuitem Menu item (`LI`) to deactivate.
* @param animate `true` to animate the transition to the disabled state, `false` otherwise.
*/
deactivate(menuitem: JQuery, animate?: boolean): void;
/**
* Highlights the given menu item by applying the proper CSS classes.
* @param menuitem Menu item to highlight.
*/
highlight(menuitem: JQuery): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Reactivates the given menu item.
* @param menuitem Menu item (`LI`) to reactivate.
*/
protected reactivate(menuitem: JQuery): void;
/**
* Deactivates all items and resets the state of this widget to its orignal state such that only the top-level menu
* items are shown.
*/
reset(): void;
/**
* Shows the given submenu of a menu item.
* @param menuitem A menu item (`LI`) with children.
* @param submenu A child of the menu item.
*/
showSubmenu(menuitem: JQuery, submenu: JQuery): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link TieredMenu| TieredMenu widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface TieredMenuCfg extends PrimeFaces.widget.MenuCfg {
/**
* Defines whether the first level of submenus will be displayed on mouseover or not.
* When set to `false`, click event is required to display this tiered menu.
*/
autoDisplay: boolean;
/**
* Number of milliseconds before hiding menu, if 0 not hidden until document.click.
*/
hideDelay: number;
/**
* Number of milliseconds before displaying menu. Default to 0 immediate.
*/
showDelay: number;
/**
* Event to toggle the submenus.
*/
toggleEvent: PrimeFaces.widget.TieredMenu.ToggleEvent;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Message Widget__
*
* Message is a pre-skinned extended version of the standard JSF message component.
* @typeparam TCfg Defaults to `MessageCfg`. Type of the configuration object for this widget.
*/
export class Message extends PrimeFaces.widget.BaseWidget {
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Message| Message widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface MessageCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Client ID of the target for which to show this message.
*/
target: string;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Messages Widget__
*
* Messages is a pre-skinned extended version of the standard JSF messages component.
* @typeparam TCfg Defaults to `MessagesCfg`. Type of the configuration object for this widget.
*/
export class Messages extends PrimeFaces.widget.BaseWidget {
/**
* The DOM element for the icon that closes this panel.
*/
closer: JQuery;
/**
* Creates the HTML elements for the given faces message, and adds it to the DOM.
* @param msg A message to translate into an HTML element.
*/
appendMessage(msg: PrimeFaces.FacesMessage): void;
/**
* Clears all current messages from the DOM.
*/
clearMessages(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Messages| Messages widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface MessagesCfg extends PrimeFaces.widget.BaseWidgetCfg {
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Mindmap Widget__
*
* Mindmap is an interactive tool to visualize mindmap data featuring lazy loading, callbacks, animations and more.
* @typeparam TCfg Defaults to `MindmapCfg`. Type of the configuration object for this widget.
*/
export class Mindmap extends PrimeFaces.widget.DeferredWidget {
/**
* A list of all drawn mindmap nodes.
*/
nodes: import("raphael").RaphaelElement[];
/**
* The canvas on which the mindmap is drawn.
*/
raphael: import("raphael").RaphaelPaper;
/**
* The drawn root node for the mindmap.
*/
root: import("raphael").RaphaelElement;
/**
* The DOM element for the tooltip of a mindmap node.
*/
tooltip: JQuery;
/**
* This render method is called by this deferred widget once the widget container has become visible. You may
* now proceed with widget initialization.
*
* __Must be overridden__, or an error will be thrown.
* @override
*/
protected override _render(): void;
/**
* Centers the given node so that it is positioned near the center of the mindmap viewport.
* @param node A node to center.
*/
centerNode(node: import("raphael").RaphaelElement): void;
/**
* Callback that is invoked when a click was performed on a mindmap node.
*/
private clickNode(this: import("raphael").RaphaelElement): void;
/**
* Callback that is invoked when a click was performed on a text label.
*/
private clickNodeText(this: import("raphael").RaphaelElement): void;
/**
* Creates a mindmap node at the given position for the given model.
* @param x Horizontal coordinate where the node is drawn.
* @param y Vertical coordinate where the node is drawn.
* @param model Model with the data describing the node to be created.
* @return The created node.
*/
private createNode(x: number, y: number, model: PrimeFaces.widget.Mindmap.MindmapNode): import("raphael").RaphaelElement;
/**
* Creates the mindmap nodes for all immediate children of the given node.
* @param node A node with children.
*/
private createSubNodes(node: import("raphael").RaphaelElement): void;
/**
* Expands the given mindmap node, showing it and its children.
* @param node A node to expand.
*/
expandNode(node: import("raphael").RaphaelElement): void;
/**
* Callback that is invoked when a double click was performed on a mindmap node.
* @param node Node that received the double click.
*/
private handleDblclickNode(node: import("raphael").RaphaelElement): void;
/**
* Callback that is invoked when a click was performed on a mindmap node.
* @param node The node that received the click.
*/
private handleNodeClick(node: import("raphael").RaphaelElement): void;
/**
* Hides the tooltip for the given node, it it is shown.
* @param node A node for which to hide the tooltip.
*/
hideTooltip(node: import("raphael").RaphaelElement): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Callback that is invoked when the mouse cursor was moved away from a mindmap node.
*/
private mouseoutNode(this: import("raphael").RaphaelElement): void;
/**
* Callback that is invoked when the mouse cursor was moved away from a text label.
*/
private mouseoutText(this: import("raphael").RaphaelElement): void;
/**
* Callback that is invoked when the mouse cursor was moved over a mindmap node.
*/
private mouseoverNode(this: import("raphael").RaphaelElement): void;
/**
* Callback that is invoked when the mouse cursor was moved over a text label.
*/
private mouseoverText(this: import("raphael").RaphaelElement): void;
/**
* Callback that is invoked while a node is being dragged. Updates the UI.
* @param dx Amount the node was dragged horizontally since the last call of this callback
* @param dy Amount the node was dragged vertically since the last call of this callback
*/
private nodeDrag(this: import("raphael").RaphaelElement, dx: number, dy: number): void;
/**
* Callback invoked after a node was dragged.
*/
private nodeDragEnd(this: import("raphael").RaphaelElement): void;
/**
* Callback that is invoked once at the start when a node is dragged.
*/
private nodeDragStart(this: import("raphael").RaphaelElement): void;
/**
* Removes the given node and all of its connections from this mindmap.
* @param node Mindmap node to delete.
*/
removeNode(node: import("raphael").RaphaelElement): void;
/**
* Brings up the tooltip for the given node, it it is not shown already.
* @param node A node for which to show the tooltip.
*/
showTooltip(node: import("raphael").RaphaelElement): void;
/**
* Callback that is invoked while a text label is being dragged. Updates the UI.
* @param dx Amount the text was dragged horizontally since the last call of this callback
* @param dy Amount the text was dragged vertically since the last call of this callback
*/
private textDrag(this: import("raphael").RaphaelElement, dx: number, dy: number): void;
/**
* Callback invoked after a text label was dragged.
*/
private textDragEnd(this: import("raphael").RaphaelElement): void;
/**
* Callback that is invoked once at the start when a text label is dragged.
*/
private textDragStart(this: import("raphael").RaphaelElement): void;
/**
* Updates the connections for the given mindmap node.
* @param node The node for which to update the connections.
*/
private updateConnections(node: import("raphael").RaphaelElement): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Mindmap| Mindmap widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface MindmapCfg extends PrimeFaces.widget.DeferredWidgetCfg {
/**
* Horizontal coordinate for the center of the canvas.
*/
centerX: number;
/**
* Vertical coordinate for the center of the canvas.
*/
centerY: number;
/**
* Duration for all animations with nodes, in milliseconds.
*/
effectSpeed: number;
/**
* Total height of the canvas.
*/
height: number;
/**
* Root node shown by the mindmap.
*/
model: PrimeFaces.widget.Mindmap.MindmapNode;
/**
* Total width of the canvas.
*/
width: number;
}
}
declare namespace PrimeFaces.widget.Mindmap {
/**
* Model that describes a node of the mindmap, such as
* its parent and children, its label, its geometry etc.
*/
export interface MindmapNode {
/**
* The children of this node.
*/
children: PrimeFaces.widget.Mindmap.MindmapNode[];
/**
* The fill color of this node.
*/
fill?: string;
/**
* The unique ID of this node.
*/
key?: string;
/**
* The label text of this node.
*/
label: string;
/**
* The parent of this node, or `null` if it has
* got no parent.
*/
parent: PrimeFaces.widget.Mindmap.MindmapNode | null;
/**
* `true` if this node can be selected, or `false` otherwise.
*/
selectable?: boolean;
}
}
// No extra declarations needed, this is just the library itself
// Type declarations are in the NPM packages moment / moment-timezone
declare namespace PrimeFaces.widget.NotificationBar {
/**
* Possible values for the effect applied
* when the notification bar is shown or hidden.
*/
export type Effect = "slide" | "fade" | "none";
}
declare namespace PrimeFaces.widget.NotificationBar {
/**
* Possible values for speed of the
* effect when the notification bar is shown or hidden.
*/
export type EffectSpeed = "fast" | "normal" | "slow";
}
declare namespace PrimeFaces.widget.NotificationBar {
/**
* Possible values for where the notification bar
* is shown.
*/
export type Position = "top" | "bottom";
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces NotificationBar Widget__
*
* NotificationBar displays a multipurpose fixed positioned panel for notification.
* @typeparam TCfg Defaults to `NotificationBarCfg`. Type of the configuration object for this widget.
*/
export class NotificationBar extends PrimeFaces.widget.BaseWidget {
/**
* Hides the notification bar.
*/
hide(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Checks whether the notification bar is currently displayed.
* @return `true` if the notification bar is currently visible, `false` otherwise.
*/
isVisible(): boolean;
/**
* Shows the notification bar.
*
* The up-to-three arguments will be routed to jQuery as-is.
* @param a1 First parameter passed through to jQuery UI.
* @param a2 Second parameter passed through to jQuery UI.
* @param a3 Third parameter passed through to jQuery UI.
* @see http://api.jquery.com/slidedown/
* @see http://api.jquery.com/fadein/
* @see http://api.jquery.com/show/
*/
show(a1?: JQuery.Duration, a2?: string, a3?: (this: unknown) => void): void;
/**
* Shows the notification bar it is currently hidden, or hides it if it is currently displayed.
*/
toggle(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link NotificationBar| NotificationBar widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface NotificationBarCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Whether the notification bar is shown by default on page load.
*/
autoDisplay: boolean;
/**
* Effect applied when the notification bar is shown or
* hidden.
*/
effect: PrimeFaces.widget.NotificationBar.Effect;
/**
* Speed of the effect when the notification bar
* is shown or hidden.
*/
effectSpeed: PrimeFaces.widget.NotificationBar.EffectSpeed;
/**
* Position of the bar, either top or bottom.
*/
position: PrimeFaces.widget.NotificationBar.Position;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces OrderList Widget__
*
* OrderList is used to sort a collection featuring drag&drop based reordering, transition effects and POJO support.
* @typeparam TCfg Defaults to `OrderListCfg`. Type of the configuration object for this widget.
*/
export class OrderList extends PrimeFaces.widget.BaseWidget {
/**
* The DOM element for the hidden form field storing the current order of the items.
*/
input: JQuery;
/**
* The DOM elements for the available items that can be reordered.
*/
items: JQuery;
/**
* The DOM element for the container with the items.
*/
list: JQuery;
/**
* The DOM element for the source list, when used with a pick list.
*/
sourceList?: JQuery;
/**
* Sets up all event listeners that are required by this widget.
*/
private bindEvents(): void;
/**
* Invokes the appropriate behavior for when an item of the order list was selected.
* @param item The item that was selected.
* @param e The event that occurred.
*/
private fireItemSelectEvent(item: JQuery, e: JQuery.TriggeredEvent): void;
/**
* Invokes the appropriate behavior for when an item of the order list was unselected.
* @param item The item that was unselected.
*/
private fireItemUnselectEvent(item: JQuery): void;
/**
* Invokes the appropriate behavior for when the order list was reordered.
*/
private fireReorderEvent(): void;
/**
* Reads the current item order and stores it in a hidden form field.
*/
private generateItems(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Moves the selected order list items to the bottom, as if the `move to bottom` button were pressed.
*/
moveBottom(): void;
/**
* Moves the selected order list items down by one, as if the `move down` button were pressed.
*/
moveDown(): void;
/**
* Moves the selected order list items to the top, as if the `move to top` button were pressed.
*/
moveTop(): void;
/**
* Moves the selected order list items up by one, as if the `move up` button were pressed.
*/
moveUp(): void;
/**
* Callback that is invoked when an order list item was moved via drag and drop. Saves the new order of the items
* and invokes the appropriate behaviors.
* @param event The event that triggered the drag or drop.
* @param ui The UI params as passed by JQuery UI to the event handler.
*/
private onDragDrop(event: JQuery.TriggeredEvent, ui: JQueryUI.SortableUIParams): void;
/**
* Saves the current value of this order list, i.e. the order of the items. The value is saved in a hidden form
* field.
*/
private saveState(): void;
/**
* Sets up the buttons and corresponding event listeners for moving order list items up and down.
*/
private setupButtons(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link OrderList| OrderList widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface OrderListCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Whether this widget is disabled initially.
*/
disabled: boolean;
/**
* Name of animation to display.
*/
effect: string;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Organigram Widget__
*
* Organigram is a data component to display an organizational hierarchy.
* @typeparam TCfg Defaults to `OrganigramCfg`. Type of the configuration object for this widget.
*/
export class Organigram extends PrimeFaces.widget.BaseWidget implements PrimeFaces.widget.ContextMenu.ContextMenuProvider {
/**
* Whether the organigram requires redrawing.
*/
redraw: boolean;
/**
* The DOM elements for the source nodes when drawing the lines connecting two nodes.
*/
source: JQuery;
/**
* The DOM elements for the target nodes when drawing the lines connecting two nodes.
*/
target: JQuery;
/**
* The current zoom factor of the organigram.
*/
zoomFactor: number;
/**
* Adds an expander button for expanding or collapsing the given node.
* @param nodeSource Node to use as a source.
* @param node Node to collapse and expand.
* @param bottomIconContainer Container element to which the expander button is added.
*/
private addExpander(nodeSource: JQuery, node: JQuery, bottomIconContainer: JQuery): void;
/**
* Callback that is invoked when the context menu is initialized. Lets the
* context menu provider register the appropriate event listeners for when the context menu should be shown and hidden.
* @override
* @param menuWidget The widget instance of the
* context menu.
* @param targetWidget The widget instance of the target widget that wants
* to add a context menu.
* @param targetId ID selector or DOM element of the target, i.e.
* the element the context menu belongs to.
* @param cfg The current configuration of the
* context menu.
*/
bindContextMenu(menuWidget: PrimeFaces.widget.ContextMenu, targetWidget: PrimeFaces.widget.Organigram, targetId: string, cfg: PrimeFaces.widget.ContextMenuCfg): void;
/**
* Draws (renders) the organigram with the current nodes.
*/
private draw(): void;
/**
* Draws the child nodes of the given parent node.
* @param parentRowKey Row key of the parent node with children to draw.
* @param leafChildNodes Children of the parent that are leaf nodes, i.e. do no have any children.
* @param nonLeafChildNodes Children of the parent that are not leaf nodes, i.e. do have at least one
* child.
* @param table The DOM element for the sub table for which to draw the children.
* @param level The nesting level of the parent node.
*/
private drawChildNodes(parentRowKey: string, leafChildNodes: JQuery, nonLeafChildNodes: JQuery, table: JQuery, level: number): void;
/**
* Draws the lines connecting the nodes.
* @param childNodeCount Number of children in the sub table.
* @param table The DOM element for the sub table for which to draw the children.
*/
private drawLines(childNodeCount: number, table: JQuery): void;
/**
* Draws the given organigram node.
* @param parentRowKey Row key of the node to draw.
* @param nodeSource Element of the node to draw.
* @param appendTo Element to which the node is appended.
* @param level Nesting level of the node.
*/
private drawNode(parentRowKey: string, nodeSource: JQuery, appendTo: JQuery, level: number): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Scrolls the organigram to the currently selected node, so that the node is in view.
*/
scrollToSelection(): void;
/**
* Selects the given organigram node.
* @param widget This widget instance.
* @param node The node to select, with the class `.ui-organigram-node`.
* @param event Name of the event that triggered the selection, usually `select` or `contextmenu`.
*/
private selectNode(widget: PrimeFaces.widget.Organigram, node: JQuery, event: string): void;
/**
* Sets up the buttons for the global controls, such as the buttons for zooming in and out.
*/
private setupControls(): void;
/**
* Sets up the event listeners for dragging and dropping nodes.
*/
private setupDragAndDrop(): void;
/**
* Sets up the event listeners for when a node is selected.
*/
private setupSelection(): void;
/**
* Applies the given zoom factor (scaling) to the organigram.
* @param zoom The zoom factor. Must be a positive number. `1.0` means no zoom, `2.0` means zoomed-in,
* `0.5` means zoomed-out.
*/
zoom(zoom: number): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Organigram| Organigram widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface OrganigramCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Base namespace for the events triggered by this widget.
*/
event: string;
/**
* The height of the connector line for leaf nodes.
*/
leafNodeConnectorHeight: number;
/**
* Whether zooming is enabled.
*/
zoom: boolean;
}
}
declare namespace PrimeFaces.widget.OutputPanel {
/**
* Mode that indicates how the content of an
* output panel is loaded:
* - `load`: Loads the content directly after the page was loaded.
* - `visible`: Loads the panel once it is visible, e.g., once the user scrolled down.
*/
export type DeferredMode = "load" | "visible";
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces OutputPanel Widget__
*
* OutputPanel is a panel component with the ability for deferred loading.
* @typeparam TCfg Defaults to `OutputPanelCfg`. Type of the configuration object for this widget.
*/
export class OutputPanel extends PrimeFaces.widget.BaseWidget {
/**
* Sets up the event listeners for handling scrolling.
*/
private bindScrollMonitor(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Loads the content of this panel via AJAX, if dynamic loading is enabled.
*/
private loadContent(): void;
/**
* Checks whether this panel is currently visible.
* @return `true` if this panel is currently visible, or `false` otherwise.
*/
visible(): boolean;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link OutputPanel| OutputPanel widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface OutputPanelCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Deferred mode loads the contents after page load to speed up page load.
*/
deferred: boolean;
/**
* Defines deferred loading mode, whether the
* content is loaded directly after the page is done loading, or only once the user scrolled to the panel.
*/
deferredMode: PrimeFaces.widget.OutputPanel.DeferredMode;
/**
* When the content is loaded via AJAX, whether AJAX request triggers the global
* `ajaxStatus`.
*/
global: boolean;
}
}
declare namespace PrimeFaces.widget.OverlayPanel {
/**
* Callback that is invoked when the panel is hidden. The data table
* widget instance ins passed as the this context.
*/
export type OnHideCallback = (this: PrimeFaces.widget.OverlayPanel) => void;
}
declare namespace PrimeFaces.widget.OverlayPanel {
/**
* Callback that is invoked when the panel is shown. The overlay
* panel widget instance ins passed as the this context.
*/
export type OnShowCallback = (this: PrimeFaces.widget.OverlayPanel) => void;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces OverlayPanel Widget__
*
* OverlayPanel is a generic panel component that can be displayed on top of other content.
* @typeparam TCfg Defaults to `OverlayPanelCfg`. Type of the configuration object for this widget.
*/
export class OverlayPanel extends PrimeFaces.widget.DynamicOverlayWidget {
/**
* Variable used to control whether the overlay is being hovered in autoHide mode
*/
allowHide: boolean;
/**
* The DOM element for the icon that closes the overlay panel.
*/
closerIcon: JQuery;
/**
* The DOM element for the content of the overlay panel.
*/
content: JQuery;
/**
* Unbind callback for the hide overlay handler.
*/
hideOverlayHandler?: PrimeFaces.UnbindCallback;
/**
* When dynamic loading is enabled, whether the content was already loaded.
*/
loaded: boolean;
/**
* Unbind callback for the resize handler.
*/
resizeHandler?: PrimeFaces.UnbindCallback;
/**
* Unbind callback for the scroll handler.
*/
scrollHandler?: PrimeFaces.UnbindCallback;
/**
* The set-timeout timer ID of the timer used for showing the overlay panel.
*/
showTimeout: number;
/**
* The DOM element for the target component that triggers this overlay panel.
*/
target: JQuery;
/**
* The DOM element for the resolved target component that triggers this overlay panel.
*/
targetElement: JQuery;
/**
* The z-index of the target component that triggers this overlay panel.
*/
targetZindex: number;
/**
* Handler for CSS transitions used by this widget.
*/
transition?: PrimeFaces.CssTransitionHandler | null;
/**
* Clean up this widget and remove elements from DOM.
*/
private _cleanup(): void;
/**
* Makes the overlay panel visible.
* @param target ID or DOM element of the target component that triggers this overlay panel.
*/
private _show(target?: string | JQuery): void;
/**
* Aligns the overlay panel so that it is shown at the correct position.
* @param target ID or DOM element of the target component that triggers this overlay panel.
*/
private align(target?: string | JQuery): void;
/**
* Applies focus to the first focusable element of the content in the panel.
*/
applyFocus(): void;
/**
* Sets up mouse listeners if autoHide is disabled to keep the overlay open if overlay has focus.
*/
private bindAutoHide(): void;
/**
* Sets up some common event listeners always required by this widget.
*/
private bindCommonEvents(): void;
/**
* Sets up all panel event listeners
*/
private bindPanelEvents(): void;
/**
* Sets up the event listeners for the target component that triggers this overlay panel.
*/
private bindTargetEvents(): void;
/**
* Will be called after an AJAX request if the widget container will be detached.
*
* When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered
* content. When the element is removed from the DOM by the update, the DOM element is detached from the DOM and
* this method gets called.
*
* Please note that instead of overriding this method, you should consider adding a destroy listener instead
* via {@link addDestroyListener}. This has the advantage of letting you add multiple listeners, and makes it
* possible to add additional listeners from code outside this widget.
*
* By default, this method just calls all destroy listeners.
* @override
*/
override destroy(): void;
/**
* Disabled modality for this widget and removes the modal overlay element, but does not change whether the
* overlay is currently displayed.
* @override
*/
override disableModality(): void;
/**
* Enables modality for this widget and creates the modal overlay element, but does not change whether the
* overlay is currently displayed.
* @override
*/
override enableModality(): void;
/**
* This class makes sure a user cannot tab out of the modal and it stops events from targets outside of the
* overlay element. This requires that we switch back to the modal in case a user tabs out of it. What must
* be returned by this method are the elements to which the user may switch via tabbing.
* @override
* @return The DOM elements which are allowed to be focused via tabbing. May be an empty `jQuery`
* instance when the modal contains no tabbable elements, but must not be `undefined`.
*/
override getModalTabbables(): JQuery;
/**
* Get new target element using selector param.
* @param target ID or DOM element of the target component that triggers this overlay panel.
* @return DOM Element or null
*/
private getTarget(target?: string | JQuery): JQuery | null;
/**
* Fired when the browser viewport is resized or scrolled. In Mobile environment we don't want to hider the overlay
* we want to re-align it. This is because on some mobile browser the popup may force the browser to trigger a
* resize immediately and close the overlay. See GitHub #7075.
*/
private handleViewportChange(): void;
/**
* Hides this overlay panel so that it is not displayed anymore.
* @param callback Custom callback that is invoked after this overlay panel was closed.
*/
hide(callback?: () => void): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg the widget configuraton
*
* (from super type BaseWidget) The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Checks if the target has the autoHide property enabled or disabled to keep the overlay open.
* @return Whether this overlay should be left showing or closed.
*/
isAutoHide(): boolean;
/**
* Checks whether this overlay panel is currently visible.
* @return `true` if this overlay panel is currently displayed, or `false` otherwise.
*/
isVisible(): boolean;
/**
* Loads the contents of this overlay panel dynamically via AJAX, if dynamic loading is enabled.
* @param target ID or DOM element of the target component that triggers this overlay panel.
*/
private loadContents(target?: string | JQuery): void;
/**
* Callback that is invoked after this overlay panel was closed.
*/
private postHide(): void;
/**
* Callback that is invoked after this overlay panel was opened.
*/
private postShow(): void;
/**
* Used in ajax updates, reloads the widget configuration.
*
* When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered
* content. However, no new instance of the widget is created. Instead, after the DOM element was replaced, this
* method is called with the new widget configuration from the server. This makes it possible to persist
* client-side state during an update, such as the currently selected tab.
*
* Please note that instead of overriding this method, you should consider adding a refresh listener instead
* via {@link addRefreshListener}. This has the advantage of letting you add multiple listeners, and makes it
* possible to add additional listeners from code outside this widget.
*
* By default, this method calls all refresh listeners, then reinitializes the widget by calling the `init`
* method.
* @override
* @param cfg The new widget configuration from the server.
* @return The value as returned by the `init` method, which is often `undefined`.
*/
override refresh(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Brings up the overlay panel so that is displayed and visible.
* @param target ID or DOM element of the target component that triggers this overlay panel.
*/
show(target?: string | JQuery): void;
/**
* Brings up the overlay panel if it is currently hidden, or hides it if it is currently displayed.
*/
toggle(): void;
/**
* Unbind all panel event listeners
*/
private unbindPanelEvents(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link OverlayPanel| OverlayPanel widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface OverlayPanelCfg extends PrimeFaces.widget.DynamicOverlayWidgetCfg {
/**
* Appends the overlayPanel to the given search expression.
*/
appendTo: string;
/**
* Position of the target relative to the panel.
*/
at: string;
/**
* Whether to hide overlay when hovering over overlay content when using custom show/hide.
*/
autoHide: string;
/**
* Only relevant for dynamic="true": Defines if activating the panel should load the contents from server again. For cache="true" (default) the panel content is only loaded once.
*/
cache: boolean;
/**
* When the positioned element overflows the window in some direction, move it to an
* alternative position. Similar to my and at, this accepts a single value or a pair for horizontal/vertical, e.g.,
* `flip`, `fit`, `fit flip`, `fit none`.
*/
collision: string;
/**
* When set `true`, clicking outside of the panel hides the overlay.
*/
dismissable: boolean;
/**
* `true` to load the content via AJAX when the overlay panel is opened, `false` to load
* the content immediately.
*/
dynamic: boolean;
/**
* Event on target to hide the panel.
*/
hideEvent: string;
/**
* Specifies whether the document should be shielded with a partially transparent mask to
* require the user to close the panel before being able to activate any elements in the document.
*/
modal: boolean;
/**
* Position of the panel relative to the target.
*/
my: string;
/**
* Client side callback to execute when the panel is
* shown.
*/
onHide: PrimeFaces.widget.OverlayPanel.OnHideCallback;
/**
* Client side callback to execute when the panel is
* hidden.
*/
onShow: PrimeFaces.widget.OverlayPanel.OnShowCallback;
/**
* Displays a close icon to hide the overlay, default is `false`.
*/
showCloseIcon: boolean;
/**
* Delay in milliseconds applied when the overlay panel is shown.
*/
showDelay: number;
/**
* Event on target to hide the panel.
*/
showEvent: string;
/**
* Search expression for target component to display panel next to.
*/
target: string;
}
}
declare namespace PrimeFaces.widget.Paginator {
/**
* A callback method that is invoked when the pagination state
* changes, see {@link PaginatorCfg.paginate}.
*/
export type PaginateCallback =
/**
* @param newState The new
* values for the current page and the rows per page count.
*/
(newState: PrimeFaces.widget.Paginator.PaginationState) => void;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Paginator Widget__
*
* A widget for handling pagination that is usually used by other widget via composition, that is, they create and save
* an instance of this widget during initialization. After you create a new instance of this paginator, you should set
* the `paginate` property to an appropriate callback function.
*
* ```javascript
* const paginator = new PrimeFaces.widget.Paginator(paginatorCfg);
* paginator.paginator = newState => {
* // handle pagination
* };
* ```
* @typeparam TCfg Defaults to `PaginatorCfg`. Type of the configuration object for this widget.
*/
export class Paginator extends PrimeFaces.widget.BaseWidget {
/**
* ARIA LABEL attribute for the page links.
*/
ariaPageLabel: string;
/**
* DOM element of the status text as configured by the `currentPageTemplate`.
*/
currentReport: JQuery;
/**
* DOM element of the link to the last page.
*/
endLink: JQuery;
/**
* DOM element of the link back to the first page.
*/
firstLink: JQuery;
/**
* INPUT element for selecting a page to navigate to (`jump to page`)
*/
jtpInput: JQuery;
/**
* SELECT element for selecting a page to navigate to (`jump to page`)
*/
jtpSelect: JQuery;
/**
* DOM element of the link to the next page.
*/
nextLink: JQuery;
/**
* DOM elements of each numbered page link.
*/
pageLinks: JQuery;
/**
* DOM element of the container with the numbered page links.
*/
pagesContainer: JQuery;
/**
* DOM element of the link back to the previous page.
*/
prevLink: JQuery;
/**
* SELECT element for selection the number of pages to display (`rows per page`).
*/
rppSelect: JQuery;
/**
* Sets up all event listeners for this widget.
*/
private bindEvents(): void;
/**
* Sets up the event listeners for page link buttons.
*/
private bindPageLinkEvents(): void;
/**
* Binds swipe events to this paginator to the JQ element passed in.
* @param owner the owner JQ element of the paginator
* @param ownerConfig the owner configuration to check if touch enabled or not
*/
private bindSwipeEvents(owner: JQuery, ownerConfig: PrimeFaces.PartialWidgetCfg): void;
/**
* Configures ARIA labels for screenreaders.
*/
private configureAria(): void;
/**
* Disables one of the items of this pagination.
* @param element Element to disabled.
*/
private disableElement(element: JQuery): void;
/**
* Enables one of the items of this pagination.
* @param element Element to disabled.
*/
private enableElement(element: JQuery): void;
/**
* Calculates the required height of the container with the items of the current page.
* @param margin Additional margin in pixels to consider.
* @return The height of the items container in pixels
*/
private getContainerHeight(margin: number): number;
/**
* Finds the index of the page that is currently displayed.
* @return 0-based index of the current page.
*/
getCurrentPage(): number;
/**
* Finds the index of the item that is shown first on the current page.
* @return 0-based index of the first item on the current page.
*/
getFirst(): number;
/**
* Finds the current number of rows per page.
* @return The number of rows per page.
*/
getRows(): number;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Switches to the next page. Does nothing when this pagination is already on the last page.
*/
next(): void;
/**
* Switches to the previous page. Does nothing when this pagination is already on the first page.
*/
prev(): void;
/**
* Switches this pagination to the given page.
* @param p 0-based index of the page to switch to.
* @param silent Defaults to `false`. `true` to not invoke any event listeners, `false` otherwise.
*/
setPage(p: number, silent?: boolean): void;
/**
* Modifies the number of rows that are shown per page.
* @param rpp Number of rows per page to set.
*/
setRowsPerPage(rpp: number): void;
/**
* Modifies the total number of items that are available, and switches to the first page.
* @param value The total number of items to set.
*/
setTotalRecords(value: number): void;
/**
* Removes all event listeners.
*/
private unbindEvents(): void;
/**
* Updates the UI of page link button so that they reflect the current pagination state.
*/
private updatePageLinks(): void;
/**
* Modifies the total number of items that are available.
* @param value The total number of items to set.
*/
private updateTotalRecords(value: number): void;
/**
* Updates the UI so that it reflects the current pagination state.
*/
private updateUI(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Paginator| Paginator widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface PaginatorCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* `true` if the paginator should be displayed always, or `false` if it is allowed to
* be hidden under some circumstances that depend on the widget that uses the paginator.
*/
alwaysVisible: boolean;
/**
* Template for the paginator text. It may contain placeholders such as
* `{currentPage}` or `{totalPages}`.
*/
currentPageTemplate: string;
/**
* The current page, 0-based index.
*/
page: number;
/**
* The number of pages.
*/
pageCount: number;
/**
* The maximum number of page links to display (when there are many pages).
*/
pageLinks: number;
/**
* A callback method that is invoked when the
* pagination state changes, such as when the user selects a different page or changes the current rows per page count.
* This property is usually provided by another widget that makes use of this paginator. You should use this callback to
* perform any actions required to apply the new pagination state.
*/
paginate: PrimeFaces.widget.Paginator.PaginateCallback;
/**
* The number of rows per page for the dropdown.
*/
prevRows: number;
/**
* Total number of rows (records) to be displayed.
*/
rowCount: number;
/**
* The number of rows per page.
*/
rows: number;
/**
* The configured number of rows set per page.
*/
rpp: number;
}
}
declare namespace PrimeFaces.widget.Paginator {
/**
* Represents a pagination state, that is, a
* range of items that should be displayed.
*/
export interface PaginationState {
/**
* 0-based index of the first item on the current page.
*/
first: number;
/**
* The current page, 0-based index.
*/
page: number;
/**
* The number of rows per page.
*/
rows: number;
}
}
declare namespace PrimeFaces.widget.Panel {
/**
* When toggling a panel, defines whether
* it slides up and down; or left and right.
*/
export type ToggleOrientation = "vertical" | "horizontal";
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Panel Widget__
*
* Panel is a grouping component with content toggle, close and menu integration.
* @typeparam TCfg Defaults to `PanelCfg`. Type of the configuration object for this widget.
*/
export class Panel extends PrimeFaces.widget.BaseWidget {
/**
* The DOM element for the icon that closes this panel.
*/
closer: JQuery;
/**
* The DOM element for the content of this panel.
*/
content: JQuery;
/**
* The DOM element for the header of this panel.
*/
header: JQuery;
/**
* Whether the title bar was recently clicked.
*/
isTitlebarClicked: boolean;
/**
* The original width of this panel before it got collapsed.
*/
originalWidth: number;
/**
* The DOM element for the title text in the header of this panel.
*/
title: JQuery;
/**
* The DOM element for the hidden input storing whether this panel is currently
* expanded or collapsed.
*/
toggleStateHolder: JQuery;
/**
* The DOM element for the icon that toggles this panel.
*/
toggler: JQuery;
/**
* The DOM element for the hidden input storing whether this panel is currently
* visible or hidden.
*/
visibleStateHolder: JQuery;
/**
* Sets up the event listeners for the button that closes this panel.
*/
private bindCloser(): void;
/**
* Sets up all event listeners that are required by this widget.
*/
private bindEvents(): void;
/**
* Sets up the event listeners for the button that toggles this panel between opened and closes.
*/
private bindToggler(): void;
/**
* Closes this panel, if not already closed.
*/
close(): void;
/**
* Collapses this panel, if not already collapsed.
*/
collapse(): void;
/**
* Expands this panel, if not already expanded.
*/
expand(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Shows this panel, if not already shown.
*/
show(): void;
/**
* Opens this panel by sliding it down.
*/
private slideDown(): void;
/**
* Closes this panel by sliding it to the left.
*/
private slideLeft(): void;
/**
* Opens this panel by sliding it to the right.
*/
private slideRight(): void;
/**
* Closes this panel by sliding it up.
*/
private slideUp(): void;
/**
* Expands this panel if it is currently collapsed, or collapses it if it is currently expanded.
*/
toggle(): void;
/**
* Toggles the expansion state of this panel.
* @param collapsed Whether the panel is now to be collapsed.
* @param removeIcon Icon for closing this panel.
* @param addIcon Icon for opening this panel.
*/
private toggleState(collapsed: boolean, removeIcon: JQuery, addIcon: JQuery): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Panel| Panel widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface PanelCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Whether panel is closable.
*/
closable: boolean;
/**
* Speed of closing effect in milliseconds
*/
closeSpeed: number;
/**
* Whether the panel is initially collapsed.
*/
collapsed: boolean;
/**
* Whether this panel has a toggleable menu in the panel header.
*/
hasMenu: boolean;
/**
* Whether to keep Panel state across views.
*/
multiViewState: boolean;
/**
* Defines the orientation of the toggling.
*/
toggleOrientation: PrimeFaces.widget.Panel.ToggleOrientation;
/**
* Speed of toggling in milliseconds.
*/
toggleSpeed: number;
/**
* Whether the panel can be toggled (expanded and collapsed).
*/
toggleable: boolean;
/**
* Defines if the panel is toggleable by clicking on the whole panel header.
*/
toggleableHeader: boolean;
}
}
/**
* WebcamJS is a small (~3K minified and gzipped) standalone JavaScript library for capturing still images from your
* computer's camera, and delivering them to you as JPEG or PNG Data URIs. The images can then be displayed in your web
* page, rendered into a canvas, or submitted to your server. WebcamJS uses HTML5 getUserMedia, but provides an
* automatic and invisible Adobe Flash fallback.
*
* See https://github.com/jhuckaby/webcamjs
*/
declare namespace Webcam {
/**
* Format of the images taken by the webcam.
*/
export type ImageFormat = "jpeg" | "png" | "default";
/**
* A user-defined callback that may be passed to `Webcam.snap(callback)`. It is invokes once an image was taken
* successfully.
*/
export type SnapCallback =
/**
* @param dataUri The image that was taken, as a data URI.
* @param canvas The canvas that contains the image.
* @param context2D The rendering context of the canvas.
*/
(dataUri: string, canvas: HTMLCanvasElement, context2D: CanvasRenderingContext2D) => void;
/**
* Mapping between the event names supported by photo cam and the callback function type for the event.
*/
export interface WebcamEventMap {
/**
* Fires when the library finishes loading.
*/
load: () => void;
/**
* Fires when the user's camera goes live (i.e. showing a live preview). This will only happen after the user
* allows access to their camera.
*/
live: () => void;
/**
* Fires when an error occurs.
* @param errorMessage An error message describing the error that occurred.
*/
error: (errorMessage: string) => void;
/**
* Fires repeatedly while an upload is in progress.
*
* If you want to track progress while your image is uploading, you can register an event listener for the
* `uploadProgress` event. This event is called very frequently while an upload is in progress, and passes
* the function a floating point number between 0.0 and 1.0 representing the upload progress:
*
* ```javascript
* Webcam.snap(data_uri => {
* Webcam.on("uploadProgress", progress => {
* // Upload in progress
* // "progress" will be between 0.0 and 1.0
* });
*
* Webcam.on("uploadComplete", (code, text) => {
* // Upload complete!
* // "code" will be the HTTP response code from the server, e.g., 200
* // "text" will be the raw response content
* });
*
* Webcam.upload(data_uri, "myScript.php");
* });
* ```
* @param progress A number between `0` and `1`, indicating the current progress. `0` means that the upload
* just started, `1` means that the upload has finished.
*/
uploadProgress: (progress: number) => void;
/**
* Fires once when the upload completes.
* @param httpStatusCode Status code as received from the server.
* @param rawResponseContent The raw response content as received from the server.
*/
uploadComplete: (httpStatusCode: number, rawResponseContent: string) => void;
}
/**
* Available settings for configuring the webcam.
*/
export interface WebcamSettings {
/**
* Width of the live camera viewer in pixels, defaults to the actual size of the DOM element.
*/
width?: number;
/**
* Height of the live camera viewer in pixels, defaults to the actual size of the DOM element.
*/
height?: number;
/**
* Width of the captured camera image in pixels, defaults to the live viewer size.
*/
dest_width?: number;
/**
* Height of the captured camera image in pixels, defaults to the live viewer size.
*/
dest_height?: number;
/**
* Width of the final cropped image in pixels, defaults to `dest_width`.
*/
crop_width: number;
/**
* Height of the final cropped image in pixels, defaults to `dest_height`.
*/
crop_height: number;
/**
* Desired image format of captured image.
*/
image_format?: ImageFormat;
/**
* For JPEG images, this is the desired quality, from 0 (worst) to 100 (best).
*/
jpeg_quality?: number;
/**
* Enable or disable Flash fallback, if there is no native webcam access.
*/
enable_flash?: boolean;
/**
* Setting this to true will always run in Adobe Flash fallback mode.
*/
force_flash?: boolean;
/**
* Setting this to true will flip the image horizontally (mirror mode).
*/
flip_horiz?: boolean;
/**
* Set the desired fps (frames per second) capture rate.
*/
fps?: number;
/**
* Set an alternate location for the Adobe Flash fallback SWF file.
*/
swfURL?: string;
/**
* HTML string for flash player not detected.
*/
flashNotDetectedText?: string;
/**
* Whether to unfreeze the camera after snap (defaults to true)
*/
unfreeze_snap?: boolean;
/**
* Which HTTP POST parameter name to use when uploading the webcam image file.
*/
upload_name?: string;
/**
* The HTML5 getUserMedia API has a constraints system by which you can specify optional or mandatory
* requirements for the video stream. These include things such a minimum or maximum resolution and/or
* framerate. By default, WebcamJS will specify a mandatory minimum width and height, matching your `dest_width`
* and `dest_height` parameters. However, if you want to customize this, you can set a constraints parameter
* using `Webcam.set()`, and pass in an object containing all the custom constraints you want:
*
* ```javascript
* Webcam.set("constraints", {
* mandatory: {
* minWidth: 1280,
* minHeight: 720,
* minFrameRate: 30,
* },
* optional: [
* {
* minFrameRate: 60,
* }
* ],
* });
* ```
*
* To remove the mandatory constraints and instead just specify the resolution you would prefer, you can just
* this property set this to a `MediaTrackConstraints` object:
*
* ```javascript
* Webcam.set("constraints", {
* width: 1280,
* height: 720
* }
* ```
*/
constraints?: Partial | MediaTrackConstraints;
}
/**
* Specifies the constraints applied to the video device used by webcam.
*/
export interface WebcamConstraints {
/**
* Mandatory constraints. Fail if these are not met.
*/
mandatory: MediaTrackConstraints;
/**
* Optional constraints. Do not fail if these are not met.
*/
optional: MediaTrackConstraints[];
}
/**
* Updates a global webcam setting with the given new value.
* @typeparam K Name of the setting.
* @param setting Name of a settings to change.
* @param newValue New value for the setting.
*/
export function set(setting: K, newValue: WebcamSettings[K]): void;
/**
* Updates the global webcam settings with the given settings.
* @param settings New settings for the webcam.
*/
export function set(settings: Partial): void;
/**
* WebcamJS is initialized and activated by attaching a live camera viewer to a DOM element. The DOM element must
* already be created and empty:
*
* ```javascript
* Webcam.attach("#my_camera");
* ```
*
* This will activate the user's webcam, ask for the appropriate permission, and begin showing a live camera image in
* the specified DOM element.
*
* Note that the browser itself handles asking the user for permission to use their camera. WebcamJS has no control
* over this, so there is no way to style the UI. Each browser does it a little differently, typically a bar at the
* top of the page, and Flash does it inside the view area.
* @param selector CSS selector for the DOM element to which the webcam is attached.
*/
export function attach(selector: string): void;
/**
* To snap a picture, just call the `Webcam.snap()` function, passing in a callback function. The image data will be
* passed to your function as a daata URI, which you can then display in your web page, or submit to a server:
*
* ```javascript
* Webcam.snap(data_uri => {
* document.getElementById("my_result").innerHTML = ``;
* });
* ```
*
* Your function is also passed a HTML5 Canvas and a 2D Context object, so you can gain access to the raw pixels
* instead of a compressed image Data URI. These are passed as the 2nd and 3rd arguments to your callback function:
*
* ```javascript
* Webcam.snap( (data_uri, canvas, context) => {
* // copy image to my own canvas
* myContext.drawImage(canvas, 0, 0);
* });
* ```
*
* If you would prefer that WebcamJS simply copy the image into your own canvas, it can do that instead of generating
* a data URI (which can be an expensive operation). To do this, simply pass your canvas object to the `Webcam.snap()`
* method, as the 2nd argument, right after your callback function:
*
* ```javascript
* // assumes 'myCanvas' is a reference to your own canvas object, at the correct size
* Webcam.snap(() => {
* // the webcam image is now in your own canvas
* }, myCanvas );
* ```
* @param callback A callback function that is invoked with the image data once the images was taken.
* @param canvas Optional. If given, draws the image to this canvas.
*/
export function snap(callback: SnapCallback, canvas?: HTMLCanvasElement): void;
/**
* To shut down the live camera preview and reset the system, call `Webcam.reset()`. This removes any DOM elements we
* added, including a Flash movie if applicable, and resets everything in the library to the initial state.
*
* To use the library again after resetting, you must call `Webcam.attach()` and pass it your DOM element.
*/
export function reset(): void;
/**
* Freeze the current live camera frame, allowing the user to preview before saving.
*/
export function freeze(): void;
/**
* Cancel the preview (discard image) and resume the live camera view.
*/
export function unfreeze(): void;
/**
* Register an event listener for a given event. Pass in the event name, and a callback function.
* @typeparam K Name of the event.
* @param eventName Name of the event for which to attach a listener.
* @param eventCallback Callback to attach.
*/
export function on(eventName: K, eventCallback: WebcamEventMap[K]): void;
/**
* Remove an event listener for a given event. Pass in the event name, and the callback function to remove. Omit the
* callback reference to remove all listeners.
* @typeparam K Name of the event.
* @param eventName Name of the event for which to remove a listener.
* @param eventCallback Callback to remove. If omitted, removes all callback for the given event.
*/
export function off(eventName: K, eventCallback?: WebcamEventMap[K]): void;
/**
* Upload a saved image to your server via binary AJAX. Fires progress events.
*
* The `Webcam.snap()` function delivers your image by way of a client-side JavaScript Data URI. The binary image
* data is encoded with Base64 and stuffed into the URI. You can use this image in JavaScript and display it on your
* page. However, the library also provides a way to decode and submit this image data to a server API endpoint, via
* binary AJAX:
*
* ```javascript
* Webcam.snap(data_uri => {
* // snap complete, image data is in "data_uri"
* Webcam.upload(data_uri, "myScript.php", (code, text) => {
* // Upload complete!
* // "code" will be the HTTP response code from the server, e.g., 200
* // 'text' will be the raw response content
* });
* });
* ```
*
* The image data is uploaded as part of a standard multipart form post, and included as a form element named
* webcam. To gain access to this data, write some server-side code like this (PHP shown):
*
* ```php
* // be aware of file / directory permissions on your server
* move_uploaded_file($_FILES['webcam']['tmp_name'], 'webcam.jpg');
* ```
*
* Treat the uploaded data as if you were receiving a standard form submission with a
* `` element. The data is sent in the same exact way.
* @param imageData Data of the image to be sent to the server, usually the data URI.
* @param endpointUrl URL to which the image data is sent.
* @param onComplete Callback that is invoked once the upload is complete. You can alternatively specify the
* callback using `Webcam.on("uploadComplete", callback)`.
*/
export function upload(imageData: string, endpointUrl: string, onComplete: WebcamEventMap["uploadComplete"]): void;
}
declare namespace PrimeFaces.widget.PhotoCam {
/**
* Callback invoked when an error is caught by the Webcam.js engine.
* See also {@link PhotoCamCfg.onCameraError}.
*/
export type onCameraError =
/**
* @param errorObj The error object containing the error information.
*/
(this: PrimeFaces.widget.PhotoCam, errorObj: Error) => void;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces PhotoCam Widget__
*
* PhotoCam is used to take photos with webcam and send them to the JSF backend model.
* @typeparam TCfg Defaults to `PhotoCamCfg`. Type of the configuration object for this widget.
*/
export class PhotoCam extends PrimeFaces.widget.BaseWidget {
/**
* The ID of device to retrieve images.
*/
device: string;
/**
* Whether the camera is currently attached and can take photos.
*/
attached: boolean;
/**
* Attaches the web camera, requesting access to the camera of the user.
*/
attach(): void;
/**
* Takes a photo with the web cam. Logs an error if no photo can be takes, such as when the user does not have
* a camera or did not allow access to the camera.
*/
capture(): void;
/**
* Will be called after an AJAX request if the widget container will be detached.
*
* When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered
* content. When the element is removed from the DOM by the update, the DOM element is detached from the DOM and
* this method gets called.
*
* Please note that instead of overriding this method, you should consider adding a destroy listener instead
* via {@link addDestroyListener}. This has the advantage of letting you add multiple listeners, and makes it
* possible to add additional listeners from code outside this widget.
*
* By default, this method just calls all destroy listeners.
* @override
*/
override destroy(): void;
/**
* Detaches the web camera so that no more photos can be taken.
*/
detach(): void;
/**
* Retrieves the available video input device list.
* @return The available video input device list, or `null` if the browser does
* not support media devices enumeration.
*/
getAvailableDevices(): Promise | null;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Default error handler for webcam events
* @param errorObj Error object containing message, stacktrace and so on.
*/
private onCameraError(errorObj: Error): void;
/**
* Utility to detach and attach the video again.
*/
reload(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link PhotoCam| PhotoCam widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface PhotoCamCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Whether access to the camera should be requested automatically upon page load.
*/
autoStart: boolean;
/**
* The ID of device to retrieve images
*/
device: string;
/**
* Format of the image file.
*/
format: Webcam.ImageFormat;
/**
* Height of the camera viewport in pixels.
*/
height: number;
/**
* Quality of the image between `0` and `100` when the format is `jpeg`, default value is `90`.
*/
jpegQuality: number;
/**
* Custom Webcam.js error handler
*/
onCameraError: PrimeFaces.widget.PhotoCam.onCameraError;
/**
* Height of the captured photo in pixels, defaults to height.
*/
photoHeight: number;
/**
* Width of the captured photo in pixels, defaults to width.
*/
photoWidth: number;
/**
* Identifiers of components to process during capture.
*/
process: string;
/**
* Identifiers of components to update during capture.
*/
update: string;
/**
* Width of the camera viewport in pixels.
*/
width: number;
}
}
declare namespace PrimeFaces.widget.PickList {
/**
* A function for filtering the options of a pick list box.
*/
export type FilterFunction =
/**
* @param itemLabel The label of the currently selected text.
* @param filterValue The value to search for.
* @return `true` if the item label matches the filter value, or
* `false` otherwise.
*/
(itemLabel: string, filterValue: string) => boolean;
}
declare namespace PrimeFaces.widget.PickList {
/**
* Available modes for filtering the options of a pick list. When `custom` is set, a `filterFunction` must be specified.
*/
export type FilterMatchMode = "startsWith" | "contains" | "endsWith" | "custom";
}
declare namespace PrimeFaces.widget.PickList {
/**
* The type for the two lists comprising the pick
* list, i.e. whether a list contain the source or target items.
*/
export type ListName = "source" | "target";
}
declare namespace PrimeFaces.widget.PickList {
/**
* Callback that is invoked when items are transferred from one
* list to the other. See also {@link PickListCfg.onTransfer}.
*/
export type OnTransferCallback =
/**
* @param transferData Details
* about the pick list item that was transferred.
*/
(transferData: PrimeFaces.widget.PickList.TransferData) => void;
}
declare namespace PrimeFaces.widget.PickList {
/**
* Indicates how an item was
* transferred from one list to the other.
* - `command`: The item was transferred as a result of the user clicking one of the command buttons next to the lists.
* - `dblclick`: The item was transferred as a result of a double click by the user.
* - `dragdrop`: The item was transferred as a result of a drag&drop interaction by the user.
* - `checkbox`:The item was transferred as a result of a checkbox click by the user.
*/
export type TransferType = "command" | "dblclick" | "dragdrop";
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces PickList Widget__
*
* PickList is used for transferring data between two different collections.
* @typeparam TCfg Defaults to `PickListCfg`. Type of the configuration object for this widget.
*/
export class PickList extends PrimeFaces.widget.BaseWidget {
/**
* The DOM element for the aria region with the `aria-*` attributes
*/
ariaRegion: JQuery;
/**
* UI state indicating whether a checkbox was just clicked.
*/
checkboxClick: boolean;
/**
* The DOM elements for the checkboxes next to each pick list item.
*/
checkboxes: JQuery;
/**
* The currently selected item.
*/
cursorItem: JQuery;
/**
* Whether the user is currently transferring an item via drag&drop.
*/
dragging: boolean;
/**
* The filter that was selected and is currently used.
*/
filterMatcher: PrimeFaces.widget.PickList.FilterFunction;
/**
* Map between the available filter types and the filter implementation.
*/
filterMatchers: Record;
/**
* The set-timeout timer ID of the timer for the delay when filtering the source or target
* list.
*/
filterTimeout: number;
/**
* The DOM element for the currently focused pick list item, if any.
*/
focusedItem: JQuery;
/**
* When sorting items: to which list the items belong.
*/
itemListName: PrimeFaces.widget.PickList.ListName;
/**
* The DOM elements for the pick list items in the source and target list.
*/
items: JQuery;
/**
* The DOM element for the filter input for the source list.
*/
sourceFilter?: JQuery;
/**
* The DOM element for the hidden input storing the value of the source list.
*/
sourceInput: JQuery;
/**
* The DOM element for the source list.
*/
sourceList: JQuery;
/**
* The DOM element for the filter input for the target list.
*/
targetFilter?: JQuery;
/**
* The DOM element for the hidden input storing the value of the target list.
*/
targetInput: JQuery;
/**
* The DOM element for the target list.
*/
targetList: JQuery;
/**
* Adds all selected items in the source list by transferring them to the target list.
*/
add(): void;
/**
* Adds all items to the target list by transferring all items from the source list to the target list.
*/
addAll(): void;
/**
* Sets tup the event listeners for when the command buttons (move up, move down etc.) are pressed.
*/
private bindButtonEvents(): void;
/**
* Sets up the event listeners for when the enter key is pressed while inside a filter input of the source or target
* list.
* @param filter The filter input of the source or target list.
*/
private bindEnterKeyFilter(filter: JQuery): void;
/**
* Sets up the event listeners for filtering the source and target lists.
* @param filter The filter input of the source or target list.
*/
private bindFilterEvent(filter: JQuery): void;
/**
* Sets up all event listeners for filtering the source and target lists.
*/
private bindFilterEvents(): void;
/**
* Sets up the event listeners for selecting and transferring pick list items.
*/
private bindItemEvents(): void;
/**
* Sets up the keyboard event listeners for navigating the pick list via keyboard keys.
*/
private bindKeyEvents(): void;
/**
* Sets up the event listeners for when text is entered into the filter input of the source or target list.
* @param filter The filter input of the source or target list.
*/
private bindTextFilter(filter: JQuery): void;
/**
* Implementation of a `PrimeFaces.widget.PickList.FilterFunction` that matches the given option when it contains
* the given search text.
* @param value Text of an option.
* @param filter Value of the filter.
* @return `true` when the text of the contains the filter value, or `false` otherwise.
*/
containsFilter(value: string, filter: string): boolean;
/**
* Disables the given button belonging to this pick list.
* @param button A button to disable.
*/
private disableButton(button: JQuery): void;
/**
* Enables the given button belonging to this pick list.
* @param button A button to enable.
*/
private enableButton(button: JQuery): void;
/**
* Implementation of a `PrimeFaces.widget.PickList.FilterFunction` that matches the given option when it ends with
* the given search text.
* @param value Text of an option.
* @param filter Value of the filter.
* @return `true` when the text of the options ends with the filter value, or `false` otherwise.
*/
endsWithFilter(value: string, filter: string): boolean;
/**
* Filters the available options in the source or target list.
* @param value A value against which the available options are matched.
* @param list The source or target list that is to be filtered.
* @param animate If it should be animated.
*/
filter(value: string, list: JQuery, animate?: boolean): void;
/**
* Triggers change events on the input fields.
*/
private fireInputChanged(): void;
/**
* Triggers the behavior for when pick list items are selected.
* @param item A pick list item that was selected.
*/
private fireItemSelectEvent(item: JQuery): void;
/**
* Triggers the behavior for when pick list items are unselected.
* @param item A pick list item that was unselected.
*/
private fireItemUnselectEvent(item: JQuery): void;
/**
* Triggers the behavior for when pick list items are reordered.
*/
private fireReorderEvent(): void;
/**
* Triggers the behavior for when pick list items are transferred from the source to the target list or vice-versa.
* @param items Items that were transferred from one list to the other.
* @param from List from which the items were transferred.
* @param to List to which the items were transferred.
* @param type Type of the action that caused the items to be transferred.
*/
private fireTransferEvent(items: JQuery, from: JQuery, to: JQuery, type: PrimeFaces.widget.PickList.TransferType): void;
/**
* Stores the current items in the given list in a hidden form field. Used for submitting the current value of this
* pick list.
* @param list The source or target list with items to store.
* @param input The hidden form field where the items are stored.
*/
private generateItems(list: JQuery, input: JQuery): void;
/**
* Finds the list belonging to the given filter input.
* @param filter The filter input of either the target or source list.
* @return The list to which the given filter input applies.
*/
private getFilteredList(filter: JQuery): JQuery;
/**
* Finds the type of the given list, i.e. whether the list represents the source or target list.
* @param element A list element to check.
* @return Whether the element represents the source or target list.
*/
private getListName(element: JQuery): PrimeFaces.widget.PickList.ListName;
/**
* Finds the tab index of this pick list widget.
* @return The tab index of this pick list.
*/
private getTabIndex(): string;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Checks whether UI actions of this pick list are animated.
* @return `true` if this pick list is animated, or `false` otherwise.
*/
isAnimated(): boolean;
/**
* Moves the items that are currently selected to the bottom of the source of target list.
* @param list The source or target list with items to move to the bottom.
*/
moveBottom(list: JQuery): void;
/**
* Moves the items that are currently selected down by one.
* @param list The source or target list with items to move down.
*/
moveDown(list: JQuery): void;
/**
* Moves the items that are currently selected to the top of the source of target list.
* @param list The source or target list with items to move to the top.
*/
moveTop(list: JQuery): void;
/**
* Moves the items that are currently selected up by one.
* @param list The source or target list with items to move up.
*/
moveUp(list: JQuery): void;
/**
* Reapply filtering the current source list.
*/
private refilterSource(): void;
/**
* Reapply filtering to the current target list.
*/
private refilterTarget(): void;
/**
* Removes all selected items in the target list by transferring them to the source list.
*/
remove(): void;
/**
* Removes all items in the target list by transferring all items from the target list to the source list.
*/
removeAll(): void;
/**
* Removes the outline from the item that is currently focused.
*/
private removeOutline(): void;
/**
* Saves the current state of this widget, i.e. to which list the items are currently assigned. Clears inputs and
* repopulates them from the list states.
*/
private saveState(): void;
/**
* Selects the given checkbox that belongs to a pick list item.
* @param chkbox The hidden checkbox of a pick list item that was selected.
*/
private selectCheckbox(chkbox: JQuery): void;
/**
* Select the given pick list item in the source or target list.
* @param item A picklist item to select, with the class `ui-picklist-item`.
* @param silent `true` to imit triggering event listeners and behaviors, or `false` otherwise.
*/
selectItem(item: JQuery, silent?: boolean): void;
/**
* Applies the tab index to this pick list widget.
*/
private setTabIndex(): void;
/**
* Finds and stores the filter function which is to be used for filtering the options of this pick list.
*/
private setupFilterMatcher(): void;
/**
* Implementation of a `PrimeFaces.widget.PickList.FilterFunction` that matches the given option when it starts with
* the given search text.
* @param value Text of an option.
* @param filter Value of the filter.
* @return `true` when the text of the options starts with the filter value, or `false` otherwise.
*/
startsWithFilter(value: string, filter: string): boolean;
/**
* Transfers the given items from the source or target list to the other list.
* @param items Items that were transferred from one list to the other.
* @param from List from which the items were transferred.
* @param to List to which the items were transferred.
* @param type Type of the action that caused the items to be transferred.
* @param callback after transfer finished.
*/
transfer(items: JQuery, from: JQuery, to: JQuery, type: PrimeFaces.widget.PickList.TransferType, callback: () => JQuery): void;
/**
* Unselects all items in the source and target list.
*/
unselectAll(): void;
/**
* Unselects the given checkbox that belongs to a pick list item.
* @param chkbox The hidden checkbox of a pick list item that was unselected.
*/
private unselectCheckbox(chkbox: JQuery): void;
/**
* Unselect the given pick list item in the source or target list.
* @param item A picklist item to unselect, with the class `ui-picklist-item`.
* @param silent `true` to imit triggering event listeners and behaviors, or `false` otherwise.
*/
unselectItem(item: JQuery, silent?: boolean): void;
/**
* Updates the `aria-grion` with the focused label text.
*/
private updateAriaRegion(): void;
/**
* Updates the state of all buttons of this pick list, such as whether they are disabled or enabled.
*/
private updateButtonsState(): void;
/**
* Updates the `role` attribute of the source and target pick list items.
*/
private updateListRole(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link PickList| PickList widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface PickListCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Whether this pick list is initially disabled.
*/
disabled: boolean;
/**
* Name of the animation to display.
*/
effect: string;
/**
* Speed of the animation.
*/
effectSpeed: string;
/**
* Whether the item values are escaped for HTML.
*/
escapeValue: boolean;
/**
* Delay to wait in milliseconds before sending each filter query. Default is `300`.
*/
filterDelay: number;
/**
* Client side event to invoke picklist filtering for input fields. Default is `keyup`.
*/
filterEvent: string;
/**
* A custom filter function that is used when
* `filterMatchMode` is set to `custom`.
*/
filterFunction: PrimeFaces.widget.PickList.FilterFunction;
/**
* Mode of the filter. When set to `custom, a
* `filterFunction` must be specified.
*/
filterMatchMode: PrimeFaces.widget.PickList.FilterMatchMode;
/**
* Defines if filtering would be done using normalized values.
*/
filterNormalize: boolean;
/**
* Callback that is invoked when items are
* transferred from one list to the other.
*/
onTransfer: PrimeFaces.widget.PickList.OnTransferCallback;
/**
* When true, a checkbox is displayed next to each item.
*/
showCheckbox: boolean;
/**
* Specifies visibility of reorder buttons of source list.
*/
showSourceControls: boolean;
/**
* Specifies visibility of reorder buttons of target list.
*/
showTargetControls: boolean;
/**
* Position of the element in the tabbing order.
*/
tabindex: string;
}
}
declare namespace PrimeFaces.widget.PickList {
/**
* Callback that is invoked when an item was
* transferred from one list to the other.
*/
export interface TransferData {
/**
* List from which the items were transferred.
*/
from: JQuery;
/**
* Items that were transferred from one list to the other.
*/
items: JQuery;
/**
* List to which the items were transferred.
*/
to: JQuery;
/**
* Type of the action that caused the items to be
* transferred.
*/
type: PrimeFaces.widget.PickList.TransferType;
}
}
declare namespace PrimeFaces.widget.Poll {
/**
* Time unit for the polling interval.
*/
export type IntervalType = "millisecond" | "second";
}
declare namespace PrimeFaces.widget.Poll {
/**
* Callback that performs the polling action. See also
* {@link PollCfg.fn}.
*/
export type PollingAction = () => void;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Poll Widget__
*
* Poll is an ajax component that has the ability to send periodical ajax requests.
* @typeparam TCfg Defaults to `PollCfg`. Type of the configuration object for this widget.
*/
export class Poll extends PrimeFaces.widget.BaseWidget {
/**
* Whether polling is currently active.
*/
active: boolean;
/**
* The set-interval timer ID of the timer used for polling.
*/
timer: number;
/**
* Will be called after an AJAX request if the widget container will be detached.
*
* When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered
* content. When the element is removed from the DOM by the update, the DOM element is detached from the DOM and
* this method gets called.
*
* Please note that instead of overriding this method, you should consider adding a destroy listener instead
* via {@link addDestroyListener}. This has the advantage of letting you add multiple listeners, and makes it
* possible to add additional listeners from code outside this widget.
*
* By default, this method just calls all destroy listeners.
* @override
*/
override destroy(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Checks whether polling is active or whether it was stopped.
* @return `true` if polling is currently active, or `false` otherwise.
*/
isActive(): boolean;
/**
* Used in ajax updates, reloads the widget configuration.
*
* When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered
* content. However, no new instance of the widget is created. Instead, after the DOM element was replaced, this
* method is called with the new widget configuration from the server. This makes it possible to persist
* client-side state during an update, such as the currently selected tab.
*
* Please note that instead of overriding this method, you should consider adding a refresh listener instead
* via {@link addRefreshListener}. This has the advantage of letting you add multiple listeners, and makes it
* possible to add additional listeners from code outside this widget.
*
* By default, this method calls all refresh listeners, then reinitializes the widget by calling the `init`
* method.
* @override
* @param cfg The new widget configuration from the server.
* @return The value as returned by the `init` method, which is often `undefined`.
*/
override refresh(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Starts the polling, sending AJAX requests in periodic intervals.
* @return `true` if polling was started, or `false` otherwise.
*/
start(): boolean;
/**
* Stops the polling so that no more AJAX requests are made.
* @return `true` if polling wsa stopped, or `false` otherwise.
*/
stop(): boolean;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Poll| Poll widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface PollCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* In auto start mode, polling starts automatically on page load. To start polling on
* demand set to false.
*/
autoStart: boolean;
/**
* Callback that performs the polling action.
*/
fn: PrimeFaces.widget.Poll.PollingAction;
/**
* Duration between two successive AJAX poll request, either in milliseconds or seconds,
* depending on the configure `intervalType`.
*/
frequency: number;
/**
* Time unit for the frequency.
*/
intervalType: PrimeFaces.widget.Poll.IntervalType;
}
}
/**
* Namespace for the jQuery.print plugin. Contains some required types and interfaces.
*
* jQuery.print is a plugin for printing specific parts of a page.
*
* See https://github.com/DoersGuild/jQuery.print
*/
declare namespace JQueryPrint {
/**
* Settings for the jQuery.print plugin.
*/
export interface PrintSettings {
/**
* Whether or not the styles from the parent document should be included.
*/
globalStyles: boolean;
/**
* Whether or not link tags with `media='print'` should be included; overridden by the {@link globalStyles}.
* option.
*/
mediaPrint: boolean;
/**
* URL of an external stylesheet to be included.
*/
stylesheet: string | null;
/**
* A selector for the items that are to be excluded from printing.
*/
noPrintSelector: string;
/**
* Whether to print from an iframe instead of a pop-up window; can take the CSS selector of an existing iframe.
*/
iframe: string | boolean;
/**
* Adds custom HTML after the selected content.
*/
append: string | JQuery;
/**
* Adds custom HTML before the selected content.
*/
prepend: string | JQuery;
/**
* Should it copy user-updated form input values onto the printed markup (this is done by manually iterating over
* each form element).
*/
manuallyCopyFormValues: boolean;
/**
* A jQuery deferred object that is resolved once the print function is called. Can be used to setup callbacks.
*/
deferred: JQuery.Deferred;
/**
* To change the amount of max time to wait for the content, etc to load before printing the element from the
* new window or iframe created, as a fallback if the load event for the new window or iframe has not fired yet.
*/
timeout: number;
/**
* To change the printed title. Must be a single line.
*/
title: string | null;
/**
* To prepend a doctype to the printed document frame.
*/
doctype: string;
}
}
interface JQuery {
/**
* Prints the currently selected element.
* @param settings Optional settings for printing.
* @return This jQuery instance for chaining.
*/
print(settings?: Partial): this;
}
interface JQueryStatic {
/**
* Prints the currently selected element.
* @param selector CSS selector for the element to print.
* @param settings Optional settings for printing.
* @return This jQuery instance for chaining.
*/
print(selector: string, settings?: Partial): this;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces ProgressBar widget__
*
* ProgressBar is a process status indicator that can either work purely on client side or interact with server side
* using AJAX.
* @typeparam TCfg Defaults to `ProgressBarCfg`. Type of the configuration object for this widget.
*/
export class ProgressBar extends PrimeFaces.widget.BaseWidget {
/**
* The DOM element for the label of the progress bar.
*/
jqLabel: JQuery;
/**
* The DOM element for the value of the progress bar.
*/
jqValue: JQuery;
/**
* The set-timeout timer ID of the time used for polling when `ajax` is set to `true`.
*/
progressPoll: number;
/**
* The current value of this progress bar.
*/
value: number;
/**
* Cancels the progress bar, resetting it back to zero percent.
*/
cancel(): void;
/**
* Adds the appropriate aria attributes.
*/
private enableARIA(): void;
/**
* Invokes the behavior for when the progress bar is complete.
*/
private fireCompleteEvent(): void;
/**
* Finds the progress currently shown by this progress bar.
* @return The current value of this progress bar, between `0` and `100`.
*/
getValue(): number;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Sets the value (progress) of this progress bar to a value between zero and a hundred percent.
* @param value New value for this progress bar, between `0` and `100`.
*/
setValue(value: number): void;
/**
* Starts the progress bar, if not already started. Does not reset its current value.
*/
start(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link ProgressBar| ProgressBar widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface ProgressBarCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Specifies the mode of the progress bar, in AJAX mode progress value is retrieved from a
* backing bean.
*/
ajax: boolean;
/**
* Animation duration in milliseconds determining how long the animation will run.
*/
animationDuration: number;
/**
* Global AJAX requests are listened to by the `ajaxStatus` component, setting global to
* `false` will not trigger `ajaxStatus`.
*/
global: boolean;
/**
* The initial value for the progress bar.
*/
initialValue: number;
/**
* Duration in milliseconds between two AJAX polling requests, when `ajax` is set to `true`.
*/
interval: number;
/**
* Template of the progress label.
*/
labelTemplate: string;
}
}
// No extra declarations needed, this is just the library itself
// Type declarations are in the NPM package @types/raphael
declare namespace PrimeFaces.widget.Rating {
/**
* Callback that is invoked when the user gives a rating. See also
* {@link RatingCfg.onRate}.
*/
export type OnRateCallback =
/**
* @param currentNumberOfStars The number of rated stars.
*/
(this: PrimeFaces.widget.Rating, currentNumberOfStars: number) => void;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Rating Widget__
*
* Rating component features a star based rating system.
* @typeparam TCfg Defaults to `RatingCfg`. Type of the configuration object for this widget.
*/
export class Rating extends PrimeFaces.widget.BaseWidget {
/**
* The DOM element for the cancel button.
*/
cancel: JQuery;
/**
* The DOM element for the hidden input field storing the value of this widget.
*/
input: JQuery;
/**
* The DOM elements for the clickable stars.
*/
stars: JQuery;
/**
* The tabindex initially set.
*/
tabindex: string;
/**
* The current value, i.e. the number of selected stars.
*/
value: number;
/**
* Sets up all event listeners that are required by this widget.
*/
private bindEvents(): void;
/**
* Disables this rating widget so the user cannot give a rating anymore.
*/
disable(): void;
/**
* Enables this rating widget so the user can give a rating.
*/
enable(): void;
/**
* Set focus to element
* @param el focusable element
* @param isInputFocus Whether to refocus to input element
*/
private focus(el: JQuery, isInputFocus: boolean): void;
/**
* Get focusable element
* @return element
*/
private getFocusableElement(): JQuery;
/**
* Finds the current rating, i.e. the number of stars selected.
* @return The current rating value.
*/
getValue(): number | null;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Checks whether this widget is currently disabled. Whe disabled, the user cannot edit the value and it will not be
* sent to the server when the form is submitted.
* @return `true` if this rating widget is disabled, `false` otherwise.
*/
isDisabled(): boolean;
/**
* Checks whether this widget is currently read-only. When read-only, the user cannot edit the value, but the value
* will be sent to the server when the form is submitted.
* @return `true` if this rating widget is read-only, `false` otherwise.
*/
isReadOnly(): boolean;
/**
* Resets the rating so that no stars are selected.
*/
reset(): void;
/**
* Sets the rating to the given value.
* @param value New rating value to set (number of stars selected). Pass `undefined` or
* a value not greater thatn 0 to reset the value.
*/
setValue(value: number | undefined | null): void;
/**
* Removes the event listeners that were added, called when this widget is disabled.
*/
private unbindEvents(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Rating| Rating widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface RatingCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Whether this widget is initially disabled.
*/
disabled: boolean;
/**
* Callback that is invoked when the user gives a rating.
*/
onRate: PrimeFaces.widget.Rating.OnRateCallback;
/**
* Whether this widget is in read-only mode.
*/
readonly: boolean;
}
}
declare namespace PrimeFaces.widget.Resizable {
/**
* Client-side callback to execute during resizing. See also
* {@link ResizableCfg.onResize}.
*/
export type OnResizeCallback =
/**
* @param event The event that triggered the resize.
* @param ui The details about the resize.
*/
(this: PrimeFaces.widget.Resizable, event: JQuery.TriggeredEvent, ui: JQueryUI.ResizableUIParams) => void;
}
declare namespace PrimeFaces.widget.Resizable {
/**
* Client-side callback to execute when resizing begins. See also
* {@link ResizableCfg.onStart}.
*/
export type OnStartCallback =
/**
* @param event The event that triggered the resizing to
* start.
* @param ui Details about the resize.
*/
(this: PrimeFaces.widget.Resizable, event: JQuery.TriggeredEvent, ui: JQueryUI.ResizableUIParams) => void;
}
declare namespace PrimeFaces.widget.Resizable {
/**
* Client-side callback to execute after resizing end. See also
* {@link ResizableCfg.onStop}.
*/
export type OnStopCallback =
/**
* @param event The event that triggered the resize to end.
* @param ui Details about the resize.
*/
(this: PrimeFaces.widget.Resizable, event: JQuery.TriggeredEvent, ui: JQueryUI.ResizableUIParams) => void;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Resizable Widget__
*
* Resizable component is used to make another JSF component resizable.
* @typeparam TCfg Defaults to `ResizableCfg`. Type of the configuration object for this widget.
*/
export class Resizable extends PrimeFaces.widget.BaseWidget {
/**
* The DOM element for the target widget t o be resized.
*/
jqTarget: JQuery;
/**
* Target for the resizable, when using AJAX resize.
*/
target?: string | JQuery | HTMLElement;
/**
* Renders the client-side parts of this widget.
*/
private _render(): void;
/**
* Triggers the behavior for when the component was resized.
* @param event Event that triggered the resize.
* @param ui Data of the resize event.
*/
private fireAjaxResizeEvent(event: JQuery.TriggeredEvent, ui: JQueryUI.ResizableUIParams): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Renders the client-side parts of this widget, if this target widget to be resized is already visible.
* @return `true` if the target widget is visible, or `false` otherwise.
*/
private render(): boolean;
/**
* Renders this widget, if the target widget is already visible, or adds a deferred renderer otherwise.
*/
private renderDeferred(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Resizable| Resizable widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface ResizableCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Whether AJAX requests are sent when the element is resized.
*/
ajaxResize: boolean;
/**
* ID of the element to which the target widget is constrained.
*/
containment: string;
/**
* Client-side callback to execute during resizing.
*/
onResize: PrimeFaces.widget.Resizable.OnResizeCallback;
/**
* Client-side callback to execute when resizing
* begins.
*/
onStart: PrimeFaces.widget.Resizable.OnStartCallback;
/**
* Client-side callback to execute after resizing end.
*/
onStop: PrimeFaces.widget.Resizable.OnStopCallback;
/**
* ID of the parent of the resizable element.
*/
parentComponentId: string;
/**
* Callback passed to JQuery UI for when a resizing event occurs.
*/
resize: JQueryUI.ResizableEvent;
/**
* Callback passed to JQuery UI for when a resizing event starts.
*/
start: JQueryUI.ResizableEvent;
/**
* Callback passed to JQuery UI for when a resizing event ends.
*/
stop: JQueryUI.ResizableEvent;
/**
* ID of the target widget or element to be resized.
*/
target: string;
}
}
declare namespace PrimeFaces.widget.Schedule {
/**
* Name of JavaScript function to extend the options of the
* underlying FullCalendar plugin. Access the this schedule widget via the this context, and change the FullCalendar
* configuration stored in `this.cfg`. See also {@link ScheduleCfg.extender}.
*/
export type ScheduleExtender = (this: PrimeFaces.widget.Schedule) => void;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Schedule Widget__
*
* Schedule provides an Outlook Calendar, iCal like JSF component to manage events.
* @typeparam TCfg Defaults to `ScheduleCfg`. Type of the configuration object for this widget.
*/
export class Schedule extends PrimeFaces.widget.DeferredWidget {
/**
* The current full calendar instance. May be `undefined` when
* the widget exists, but was not yet rendered, such as when inside a non-active tab.
*/
calendar?: import("@fullcalendar/core").Calendar;
/**
* Timeout ID, used internally when an event was clicked to detect a double
* click.
*/
clickTimer?: number | null;
/**
* The clicked date, used internally when an event was clicked to detect
* a double click.
*/
doubleClick?: string | null;
/**
* The DOM element for the tooltip.
*/
tip?: JQuery;
/**
* The set-time out timer ID for displaying a delayed tooltip.
*/
tipTimeout?: number;
/**
* The DOM element for the hidden input storing the current view state.
*/
viewNameState: JQuery;
/**
* This render method is called by this deferred widget once the widget container has become visible. You may
* now proceed with widget initialization.
*
* __Must be overridden__, or an error will be thrown.
* @override
*/
protected override _render(): void;
/**
* Localizes certain aspects of FullCalendar that are exposed. The rest are configured by "locale"
* setting and FullCalendar and Moment translations for that locale.
*/
private configureLocale(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* The event listener for when the user switches the to a different view (month view, week day, or time view).
* Updates the hidden input field with the current view name. Used for restoring the view after an AJAX update.
* @param arg Event data passed by FullCalendar when the view
* changes.
*/
private onViewChange(arg: import("@fullcalendar/common").ViewContentArg): void;
/**
* Creates and sets the view options for FullCalendar on this widget configuration.
*/
private setViewOptions(): void;
/**
* Creates and sets the event listeners for the full calendar.
*/
private setupEventHandlers(): void;
/**
* Creates the event listeners for the FullCalendar events.
*/
private setupEventSource(): void;
/**
* Creates and sets the event listeners for the previous, next, and today buttons in the title bar.
*/
private setupTitlebarHandlers(): void;
/**
* Updates and refreshes the schedule view.
*/
update(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Schedule| Schedule widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface ScheduleCfg extends PrimeFaces.widget.DeferredWidgetCfg {
/**
* Name of JavaScript function to extend the options of
* the underlying FullCalendar plugin. Access the this schedule widget via the this context, and change the FullCalendar
* configuration stored in `this.cfg`.
*/
extender: PrimeFaces.widget.Schedule.ScheduleExtender;
/**
* Locale code of the locale for the FullCalendar, such as `de` or `en`.
*/
locale: string;
/**
* Whether for URL events access to the opener window from the target site should be
* prevented (phishing protection), default value is `true`.
*/
noOpener: boolean;
/**
* The configuration object that is passed to the
* FullCalendar upon initialization.
*/
options: import("@fullcalendar/core").CalendarOptions;
/**
* Theme system used for rendering the calendar.
*/
themeSystem: boolean;
/**
* Whether a tooltip should be displayed on hover.
*/
tooltip: boolean;
/**
* Target for events with urls. Clicking on such events in the schedule will not trigger the
* `selectEvent` but open the url using this target instead. Default is `_blank`.
*/
urlTarget: string;
}
}
/**
* Namespace for the JScrollpane jQuery plugin.
*
* Contains some additional types and interfaces required for the typings.
*/
declare namespace JQueryJScrollPane {
/**
* Defines where the arrows should be drawn. Allows you to choose where the arrows appear relative to the tracks and
* each of the settings has four valid values:
* - `split`: First arrow will appear before track, second arrow afterwards (the default)
* - `before`: Both arrows will appear before the track.
* - `after`: Both arrows will appear after the track (as is default on OSX).
* - `os`: The positioning of the arrows will be chosen dependant on the users operating system (e.g. the value will
* be "after" for OSX and "split" or other operating systems).
*/
export type ArrowPosition = "split" | "before" | "after" | "os";
/**
* Optional settings that can be passed when the creating a new JScroll instance to customize its behavior.
*/
export interface JScrollPaneSettings {
/**
* Whether arrows should be shown on the generated scroll pane. When set to false only the scrollbar track and
* drag will be shown, if set to true then arrows buttons will also be shown.
*/
showArrows: boolean;
/**
* Whether the scroll pane should attempt to maintain it's position whenever it is reinitialized.
*
* If true then the viewport of the scroll pane will remain the same when it is reinitialized, if false then the
* viewport will jump back up to the top when the scroll pane is reinitialized. See also
* {@link stickToBottom} and {@link stickToRight}.
*/
maintainPosition: boolean;
/**
* If {@link maintainPosition} is true and the scroll pane is scrolled to the bottom then the scroll pane then
* the scroll pane will remain scrolled to the bottom even if new content is added to the pane which makes it
* taller.
*/
stickToBottom: boolean;
/**
* If {@link maintainPosition} is true and the scroll pane is scrolled to its right edge then the scroll pane
* then the scroll pane will remain scrolled to the right edge even if new content is added to the pane which
* makes it wider.
*/
stickToRight: boolean;
/**
* Whether JScrollPane should automatically reinitialize itself periodically after you have initially
* initialized it.
*
* This can help with instances when the size of the content of the scroll pane (or the surrounding element)
* changes.
*
* However, it does involve an overhead of running a javascript function on a timer so it is recommended only to
* activate
* where necessary.
*/
autoReinitialise: boolean;
/**
* The number of milliseconds between each reinitialization (if {@link autoReinitialise} is true).
*/
autoReinitialiseDelay: number;
/**
* The smallest height that the vertical drag can have. The size of the drag elements is based on the proportion
* of the size of the content to the size of the viewport but is constrained within the minimum and maximum
* dimensions given.
*/
verticalDragMinHeight: number;
/**
* The largest height that the vertical drag can have. The size of the drag elements is based on the proportion
* of the size of the content to the size of the viewport but is constrained within the minimum and maximum
* dimensions given.
*/
verticalDragMaxHeight: number;
/**
* The smallest width that the horizontal drag can have. The size of the drag elements is based on the
* proportion of the size of the content to the size of the viewport but is constrained within the minimum and
* maximum dimensions given.
*/
horizontalDragMinWidth: number;
/**
* The largest width that the horizontal drag can have. The size of the drag elements is based on the proportion
* of the size of the content to the size of the viewport but is constrained within the minimum and maximum
* dimensions given.
*/
horizontalDragMaxWidth: number;
/**
* The width of the content of the scroll pane. The default value of undefined will allow JScrollPane to
* calculate the width of its content. However, in some cases you will want to disable this (e.g. to prevent
* horizontal scrolling or where the calculation of the size of the content doesn't return reliable results).
*/
contentWidth: number;
/**
* Whether to use animation when calling {@link JScrollPaneInstance.scrollTo|} or
* {@link JScrollPaneInstance.scrollBy}. You can control the animation speed and easing by using the
* {@link animateDuration} and {@link animateEase} settings or if you want to exercise more complete control
* then you can override the animate API method.
*/
animateScroll: boolean;
/**
* The number of milliseconds taken to animate to a new position.
*/
animateDuration: number;
/**
* The type of easing to use when animating to a new position.
*/
animateEase: string;
/**
* Whether internal links on the page should be hijacked so that if they point so content within a JScrollPane
* then they automatically scroll the JScrollPane to the correct place.
*/
hijackInternalLinks: boolean;
/**
* The amount of space between the side of the content and the vertical scrollbar.
*/
verticalGutter: number;
/**
* The amount of space between the bottom of the content and the horizontal scrollbar.
*/
horizontalGutter: number;
/**
* A multiplier which is used to control the amount that the scroll pane scrolls each time the mouse wheel is
* turned.
*/
mouseWheelSpeed: number;
/**
* A multiplier which is used to control the amount that the scroll pane scrolls each time on of the arrow
* buttons is pressed.
*/
arrowButtonSpeed: number;
/**
* The number of milliseconds between each repeated scroll event when the mouse is held down over one of the
* arrow keys.
*/
arrowRepeatFreq: number;
/**
* Whether the arrow buttons should cause the JScrollPane to scroll while you are hovering over them.
*/
arrowScrollOnHover: boolean;
/**
* Where the vertical arrows should appear relative to the vertical track.
*/
verticalArrowPositions: ArrowPosition;
/**
* Where the horizontal arrows should appear relative to the horizontal track.
*/
horizontalArrowPositions: ArrowPosition;
/**
* Whether keyboard navigation should be enabled (e.g. whether the user can focus the scroll pane and then use
* the arrow (and other) keys to navigate around.
*/
enableKeyboardNavigation: boolean;
/**
* Whether the focus outline should be hidden in all browsers. For best accessibility you should not change this
* option. You can style the outline with the CSS property outline and outline-offset.
*/
hideFocus: boolean;
/**
* Whether clicking on the track (e.g. the area behind the drag) should scroll towards the point clicked on.
*
* Defaults to true as this is the native behavior in these situations.
*/
clickOnTrack: boolean;
/**
* A multiplier which is used to control the amount that the scroll pane scrolls each
* {@link trackClickRepeatFreq} while the mouse button is held down over the track.
*/
trackClickSpeed: number;
/**
* The number of milliseconds between each repeated scroll event when the mouse is held down over the track.
*/
trackClickRepeatFreq: number;
}
/**
* The JScroll instance that is created when initializing an element via the jQuery plugin. It can be accessed via
* the `jsp` data attribute of the jQuery element: `$(scrollPanelElement).data("jsp")`.
*/
interface JScrollPaneInstance {
/**
* Reinitializes the scroll pane (if it's internal dimensions have changed since the last time it was
* initialized).
*
* The settings object which is passed in will override any settings from the previous time it was
* initialized - if you don't pass any settings then the ones from the previous initialization will be used.
*/
reinitialise(options?: Partial): void;
/**
* Scrolls the specified element into view so that it can be seen within the viewport.
* @param ele A CSS selector, HTML element of jQuery wrapper object to scroll to.
* @param stickToTop If it is true then the element will appear at the top of the viewport, if it is false
* then the viewport will scroll as little as possible to show the element.
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
scrollToElement(ele: string | HTMLElement | JQuery, stickToTop?: boolean, animate?: boolean): void;
/**
* Scrolls the pane so that the specified co-ordinates within the content are at the top left of the viewport.
* @param destX Left position of the viewport to scroll to
* @param destY Top position of the viewport to scroll to
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
scrollTo(destX: number, destY: number, animate?: boolean): void;
/**
* Scrolls the pane so that the specified co-ordinate within the content is at the left of the viewport.
* @param destX Left position of the viewport to scroll to.
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
scrollToX(destX: number, animate?: boolean): void;
/**
* Scrolls the pane so that the specified co-ordinate within the content is at the top of the viewport.
* @param destY Top position of the viewport to scroll to
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
scrollToY(destY: number, animate?: boolean): void;
/**
* Scrolls the pane to the specified percentage of its maximum horizontal scroll position.
* @param destPercentX Percentage from left of the full width of the viewport to scroll to
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
scrollToPercentX(destPercentX: number, animate?: boolean): void;
/**
* Scrolls the pane to the specified percentage of its maximum vertical scroll position.
* @param destPercentY Percentage from top of the full width of the viewport to scroll to
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
scrollToPercentY(destPercentY: number, animate?: boolean): void;
/**
* Scrolls the pane by the specified amount of pixels.
* @param deltaX Number of pixels to scroll horizontally
* @param deltaY Number of pixels to scroll vertically
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
scrollBy(deltaX: number, deltaY: number, animate?: boolean): void;
/**
* Scrolls the pane by the specified amount of pixels.
* @param deltaX Number of pixels to scroll horizontally
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
scrollByX(deltaX: number, animate?: boolean): void;
/**
* Scrolls the pane by the specified amount of pixels
* @param deltaY Number of pixels to scroll vertically
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
scrollByY(deltaY: number, animate?: boolean): void;
/**
* Positions the horizontal drag at the specified x position (and updates the viewport to reflect this)
* @param x New position of the horizontal drag.
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
positionDragX(x: number, animate?: boolean): void;
/**
* Positions the vertical drag at the specified y position (and updates the viewport to reflect this)
* @param x New position of the vertical drag.
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
positionDragY(y: number, animate?: boolean): void;
/**
* This method is called when JScrollPane is trying to animate to a new position. You can override it if you
* want to provide advanced animation functionality.
* @param ele The element whose position is being animated
* @param prop The property that is being animated
* @param value The value it's being animated to
* @param stepCallback A function that will be executed after the animation had finished.
*/
animate(ele: JQuery, prop: string, value: unknown, stepCallback: (this: HTMLElement) => void): void;
/**
* Finds the current x position of the viewport with regards to the content pane.
* @return The current x position of the viewport with regards to the content pane.
*/
getContentPositionX(): number;
/**
* Finds the current y position of the viewport with regards to the content pane.
* @return The current y position of the viewport with regards to the content pane.
*/
getContentPositionY(): number;
/**
* Finds the width of the content within the scroll pane.
* @return The width of the content within the scroll pane.
*/
getContentWidth(): number;
/**
* Finds the height of the content within the scroll pane.
* @return The height of the content within the scroll pane.
*/
getContentHeight(): number;
/**
* Checks whether or not this scroll pane has a horizontal scrollbar.
* @return Whether or not this scroll pane has a horizontal scrollbar.
*/
getIsScrollableH(): boolean;
/**
* Finds the horizontal position of the viewport within the pane content
* @return The horizontal position of the viewport within the pane content.
*/
getPercentScrolledX(): number;
/**
* Finds the vertical position of the viewport within the pane content.
* @return The vertical position of the viewport within the pane content.
*/
getPercentScrolledY(): number;
/**
* Checks whether or not this scroll pane has a vertical scrollbar.
* @return Whether or not this scroll pane has a vertical scrollbar.
*/
getIsScrollableV(): boolean;
/**
* Gets a reference to the content pane. It is important that you use this method if you want to edit the
* content of your JScrollPane as if you access the element directly then you may have some problems (as your
* original element has had additional elements for the scrollbars etc added into it).
* @return The content pane of this scroll pane.
*/
getContentPane(): JQuery;
/**
* Scrolls this scroll pane down as far as it can currently scroll.
* @param animate Whether an animation should occur. If you don't provide this argument then the
* {@link JQueryJScrollPane.JScrollPaneSettings.animateScroll|animateScroll} value from the settings object is
* used instead.
*/
scrollToBottom(animate?: boolean): void;
/**
* Hijacks the links on the page which link to content inside the scroll pane. If you have changed the content
* of your page (e.g. via AJAX) and want to make sure any new anchor links to the contents of your scroll pane
* will work then call this function.
*/
hijackInternalLinks(): void;
/**
* Destroys the JScrollPane on the instance matching this API object and restores the browser's default
* behavior.
*/
destroy(): void;
}
}
interface JQuery {
/**
* Initializes the JScrollPane on the JQuery object.
* @param settings Optional settings for configuring the scroll pane.
* @return this jQuery instance for chaining.
*/
jScrollPane(settings?: Partial): this;
}
// Extend available event types
declare namespace JQuery {
interface TypeToTriggeredEventMap {
/**
* Triggered by the {@link JQuery.jScrollPane|jQuery JScrollPane plugin}.
*
* Fires when an element is (re)initialized.
*
* Usually receives the following additional arguments:
* - `isScrollable` (boolean)
*/
"jsp-initialised": JQuery.TriggeredEvent;
/**
* Triggered by the {@link JQuery.jScrollPane|jQuery JScrollPane plugin}.
*
* Fires continuously whilst vertical scrolling is occurring.
*
* Usually receives the following additional arguments:
* - `scrollPositionY` (number)
* - `isAtTop` (boolean)
* - `isAtBottom` (boolean)
*/
"jsp-scroll-y": JQuery.TriggeredEvent;
/**
* Triggered by the {@link JQuery.jScrollPane|jQuery JScrollPane plugin}.
*
* Fires continuously whilst horizontal scrolling is occurring.
*
* Usually receives the following additional arguments:
* - `scrollPositionX` (number)
* - `isAtLeft` (boolean)
* - `isAtRight` (boolean)
*/
"jsp-scroll-x": JQuery.TriggeredEvent;
/**
* Triggered by the {@link JQuery.jScrollPane|jQuery JScrollPane plugin}.
*
* Fires whenever the state of the arrow buttons changes (i.e. when the scroll reaches or leaves any end of the
* viewport). Note that this function isn't dependant on having `showArrows` set to true, indeed it is most
* useful when implementing your own arrow keys.
*
* Usually receives the following additional arguments:
* - `isAtTop` (boolean)
* - `isAtBottom` (boolean)
* - `isAtLeft` (boolean)
* - `isAtRight` (boolean)
*/
"jsp-arrow-change": JQuery.TriggeredEvent;
/**
* Triggered by the {@link JQuery.jScrollPane|jQuery JScrollPane plugin}.
*
* Fires only when the scroll is caused by the user. Also, its fired after the actual scroll had happened.
*
* Usually receives the following additional arguments:
* - `destTop` (number)
* - `isAtTop` (boolean)
* - `isAtBottom` (boolean)
*/
"jsp-user-scroll-y": JQuery.TriggeredEvent;
/**
* Triggered by the {@link JQuery.jScrollPane|jQuery JScrollPane plugin}.
*
* Fires only when the scroll is caused by the user. Also, its fired after the actual scroll had happened.
*
* Usually receives the following additional arguments:
* - `destLeft` (number)
* - `isAtLeft` (boolean)
* - `isAtRight` (boolean)
*/
"jsp-user-scroll-x": JQuery.TriggeredEvent;
/**
* Triggered by the {@link JQuery.jScrollPane|jQuery JScrollPane plugin}.
*
* Fired before the actual scroll had happened. This can be used to disable the scroll functionality if the
* `event.preventDefault()` is called.
*
* Usually receives the following additional arguments:
* - `destY` (number)
*/
"jsp-will-scroll-y": JQuery.TriggeredEvent;
/**
* Triggered by the {@link JQuery.jScrollPane|jQuery JScrollPane plugin}.
*
* Fired before the actual scroll had happened. This can be used to disable the scroll functionality if the
* `event.preventDefault()` is called.
*
* Usually receives the following additional arguments:
* - `destX` (number)
*/
"jsp-will-scroll-x": JQuery.TriggeredEvent;
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces ScrollPanel Widget__
*
* ScrollPanel is used to display scrollable content with theme aware scrollbars instead of native browser scrollbars.
* @typeparam TCfg Defaults to `ScrollPanelCfg`. Type of the configuration object for this widget.
*/
export class ScrollPanel extends PrimeFaces.widget.DeferredWidget {
/**
* The current jQuery Scroll Pane instance.
*/
jsp: JQueryJScrollPane.JScrollPaneInstance;
/**
* This render method is called by this deferred widget once the widget container has become visible. You may
* now proceed with widget initialization.
*
* __Must be overridden__, or an error will be thrown.
* @override
*/
protected override _render(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Redraws the scrollbars.
*/
redraw(): void;
/**
* Scrolls to the given scroll position.
* @param x Horizontal coordinate of the new scroll position.
* @param y Vertical coordinate of the new scroll position.
*/
scrollTo(x: number, y: number): void;
/**
* Scroll horizontally to the given scroll position.
* @param x The new horizontal scroll position.
*/
scrollX(x: number): void;
/**
* Scroll vertically to the given scroll position.
* @param y The new vertical scroll position.
*/
scrollY(y: number): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link ScrollPanel| ScrollPanel widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface ScrollPanelCfg extends JQueryJScrollPane.JScrollPaneSettings, PrimeFaces.widget.DeferredWidgetCfg {
}
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces ScrollTop Widget__
*
* ScrollTop gets displayed after a certain scroll position and used to navigates to the top of the page quickly.
* @typeparam TCfg Defaults to `ScrollTopCfg`. Type of the configuration object for this widget.
*/
export class ScrollTop extends PrimeFaces.widget.BaseWidget {
/**
* Window or parent element of the ScrollTop.
*/
scrollElement: JQuery;
/**
* Sets up all event listeners required for this widget.
*/
private bindEvents(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link ScrollTop| ScrollTop widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface ScrollTopCfg extends PrimeFaces.widget.BaseWidgetCfg {
/**
* Scrolling behavior of the ScrollTop.
*/
behavior: string;
/**
* Target element of the scroll top widget.
*/
target: string;
/**
* Value of the vertical scroll position of the target to toggle the visibility.
*/
threshold: number;
}
}
declare namespace PrimeFaces.widget.Sidebar {
/**
* Callback that is invoked when the sidebar is opened. See also
* {@link SidebarCfg.onHide}.
*/
export type OnHideCallback = (this: PrimeFaces.widget.Sidebar) => void;
}
declare namespace PrimeFaces.widget.Sidebar {
/**
* Callback that is invoked when the sidebar is closed. See also
* {@link SidebarCfg.onShow}.
*/
export type OnShowCallback = (this: PrimeFaces.widget.Sidebar) => void;
}
declare namespace PrimeFaces.widget {
/**
* __PrimeFaces Sidebar Widget__
*
* Sidebar is a panel component displayed as an overlay at the edges of the screen.
* @typeparam TCfg Defaults to `SidebarCfg`. Type of the configuration object for this widget.
*/
export class Sidebar extends PrimeFaces.widget.DynamicOverlayWidget {
/**
* The DOM element for the icon that closes this sidebar.
*/
closeIcon: JQuery;
/**
* DOM element of the container for the content of this sidebar.
*/
content: JQuery;
/**
* When dynamic loading is enabled, whether the content was already loaded.
*/
loaded: boolean;
/**
* Makes the sidebar panel visible.
*/
private _show(): void;
/**
* Sets all ARIA attributes on the elements and the icons.
*/
private applyARIA(): void;
/**
* Sets up all event listeners that are required by this widget.
*/
private bindEvents(): void;
/**
* Enables modality for this widget and creates the modal overlay element, but does not change whether the
* overlay is currently displayed.
* @override
*/
override enableModality(): void;
/**
* This class makes sure a user cannot tab out of the modal and it stops events from targets outside of the
* overlay element. This requires that we switch back to the modal in case a user tabs out of it. What must
* be returned by this method are the elements to which the user may switch via tabbing.
* @override
* @return The DOM elements which are allowed to be focused via tabbing. May be an empty `jQuery`
* instance when the modal contains no tabbable elements, but must not be `undefined`.
*/
override getModalTabbables(): JQuery;
/**
* Hides this sidebara in case it is not already hidden.
*/
hide(): void;
/**
* A widget class should not declare an explicit constructor, the default constructor provided by this base
* widget should be used. Instead, override this initialize method which is called after the widget instance
* was constructed. You can use this method to perform any initialization that is required. For widgets that
* need to create custom HTML on the client-side this is also the place where you should call your render
* method.
*
* Please make sure to call the super method first before adding your own custom logic to the init method:
*
* ```javascript
* PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
* init: function(cfg) {
* this._super(cfg);
* // custom initialization
* }
* });
* ```
* @override
* @param cfg the widget configuraton
*
* (from super type BaseWidget) The widget configuration to be used for this widget instance.
* This widget configuration is usually created on the server by the `javax.faces.render.Renderer` for this
* component.
*/
override init(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Checks whether this sidebar is currently visible.
* @return `true` if this sideplay is visible, or `false` otherwise.
*/
isVisible(): boolean;
/**
* Loads the contents of this sidebar panel dynamically via AJAX, if dynamic loading is enabled.
*/
private loadContents(): void;
/**
* Callback function that is invoked when this sidebar is hidden.
* @param event Currently unused.
* @param ui Currently unused.
*/
private onHide(event: JQuery.TriggeredEvent, ui: unknown): void;
/**
* Callback function that is invoked when this sidebar is hidden.
*/
private postShow(): void;
/**
* Used in ajax updates, reloads the widget configuration.
*
* When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered
* content. However, no new instance of the widget is created. Instead, after the DOM element was replaced, this
* method is called with the new widget configuration from the server. This makes it possible to persist
* client-side state during an update, such as the currently selected tab.
*
* Please note that instead of overriding this method, you should consider adding a refresh listener instead
* via {@link addRefreshListener}. This has the advantage of letting you add multiple listeners, and makes it
* possible to add additional listeners from code outside this widget.
*
* By default, this method calls all refresh listeners, then reinitializes the widget by calling the `init`
* method.
* @override
* @param cfg The new widget configuration from the server.
* @return The value as returned by the `init` method, which is often `undefined`.
*/
override refresh(cfg: PrimeFaces.PartialWidgetCfg): void;
/**
* Brings up this sidebar in case is is not already visible.
* @param reload Defaults to `false`. If the dynamic content should be reloaded.
*/
show(reload?: boolean): void;
/**
* Hides this sidebar if it is visible or brings it up if it is hidden.
*/
toggle(): void;
}
}
declare namespace PrimeFaces.widget {
/**
* The configuration for the {@link Sidebar| Sidebar widget}.
* You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
* configuration is usually meant to be read-only and should not be modified.
*/
export interface SidebarCfg extends PrimeFaces.widget.DynamicOverlayWidgetCfg {
/**
* The search expression for the element to which the overlay panel should be appended.
*/
appendTo: string;
/**
* Base z-index for the sidebar.
*/
baseZIndex: number;
/**
* `true` to load the content via AJAX when the overlay panel is opened, `false` to load
* the content immediately.
*/
dynamic: boolean;
/**
* Whether the sidebar is modal and blocks the main content and other dialogs.
*/
modal: boolean;
/**
* Callback that is invoked when the sidebar is opened.
*/
onHide: PrimeFaces.widget.Sidebar.OnHideCallback;
/**
* Callback that is invoked when the sidebar is closed.
*/
onShow: PrimeFaces.widget.Sidebar.OnShowCallback;
/**
* Whether the close icon is displayed.
*/
showCloseIcon: boolean;
/**
* Whether the sidebar is initially opened.
*/
visible: boolean;
}
}
/**
* Namespace for the rangy jQuery UI Signature plugin.
*
* Contains some additional types and interfaces required for the typings.
*
* A jQuery UI plugin that captures or draws a signature. It requires the jQuery UI widget and mouse modules and needs
* the excanvas.js add-in for older IE versions.
*
* See http://keith-wood.name/signature.html
*/
declare namespace JQuerySignature {
/**
* A list of possible data types for storing a drawn signature.
*/
export type SyncFormat = "JSON" | "SVG" | "PNG" | "JPEG";
/**
* Represents a two dimensional point with an x and a coordinate, in that order.
*/
export type Point = [
number,
number
];
/**
* Represents a two dimensional line through the given points.
*/
export type Polyline = Point[];
/**
* A callback for when the signature changes.
*/
export type OnChangeListener =
/**
* @param event The event that triggered the signature change.
* @param ui An empty UI object.
*/
(event: JQuery.TriggeredEvent, ui: Record) => void;
/**
* Describes a signature comprised of several polylines.
*/
export interface SignatureJson {
/**
* The polylines of the signature.
*/
lines: Polyline[];
}
/**
* Optional settings that can be passed when creating a new signature instance to customize its behavior.
*/
export interface SignatureSettings {
/**
* The minimum distance (pixels) of movement to start a drag operation.
*
* ```javascript
* $(selector).signature({distance: 5});
* ```
*/
distance: number;
/**
* The background colour of the signature area. Specify this as a six character hexadecimal value prefixed by a
* hash (#), as a RGB triplet, or as a named colour.
*
* ```javascript
* $(selector).signature({background: "#0000ff"});
* $(selector).signature({background: "rgb(0,0,255)"});
* $(selector).signature({background: "blue"});
* ```
*/
background: string;
/**
* The colour of the signature lines. Specify this as a six character hexadecimal value prefixed by a hash (#),
* as a RGB triplet, or as a named colour.
*
* ```javascript
* $(selector).signature({color: "#0000ff"});
* $(selector).signature({color: "rgb(0,0,255)"});
* $(selector).signature({color: "blue"});
* ```
*/
color: string;
/**
* The thickness of the lines used to draw the signature.
*/
thickness: number;
/**
* Set to true to draw a horizontal guideline within the signature area.
*/
guideline: boolean;
/**
* The colour of the guideline (if present). Specify this as a six character hexadecimal value prefixed by a
* hash (#), as a RGB triplet, or as a named colour.
*/
guidelineColor: string;
/**
* The offset (pixels) of the guideline (if present) from the bottom of the signature area.
*/
guidelineOffset: number;
/**
* The indent (pixels) of the guideline (if present) from the sides of the signature area.
*/
guidelineIndent: number;
/**
* The text to display in the signature area if the browser doesn"t support the canvas element.
*/
notAvailable: string;
/**
* Set to true to disable the signature capture functionality. You can also use the disable and enable commands
* for this.
*/
disabled: boolean;
/**
* The element to keep synchronised with the JSON text for the signature. The value may be a string selector, a
* DOM element, or a jQuery object.
*
* ```javascript
* $(selector).signature({syncField: "#jsonSignature"});
* ```
*/
syncField: null | string | HTMLElement | JQuery;
/**
* The output representation that is automatically generated into the syncField. PNG and JPEG output are
* generated as data URIs.
* @since 1.2.0
*/
syncFormat: SyncFormat;
/**
* Set to `true` to apply styles in SVG using the style attribute, rather than using individual inline
* attributes.
*
* ```javascript
* $(selector).signature({svgStyles: true});
* ```
* @since 1.2.0
*/
svgStyles: boolean;
/**
* This function is called when the signature is changed: either by drawing a new line on it with the mouse, by
* clearing it, or by re-drawing an entire signature. The function receives two parameters: the triggering event
* and an empty UI object. You can also bind a handler to this event using its full name `signaturechange`.
*
* ```javascript
* $(selector).signature({
* change: (event, ui) => {
* alert("The signature has changed");
* }
* });
*
* $(selector).signature().on("signaturechange", (event, ui) => {
* alert("The signature has changed");
* });
* ```
*/
change: null | OnChangeListener;
}
/**
* Static object for the jQuery UI Signature plugin, storing the default values.
*/
export interface SignatureStatics {
/**
* The default settings to use with all signature instances.
*/
options: JQuerySignature.SignatureSettings;
}
/**
* Interface for the namespace for static properties of jQuery plugins written by Keith Wood,
* see http://keith-wood.name/
*/
export interface KeithBWoodNamespace {
/**
* Namespace in the static jQuery object for the jQuery UI Signature plugin.
*/
signature: JQuerySignature.SignatureStatics;
}
}
interface JQuery {
/**
* Converts each input field in this selection into a signature input field
* @param settings Settings for customizing the signature widget.
* @return this jQuery instance for chaining.
*/
signature(settings: Partial): this;
/**
* Update the settings for the signature widgets.
* @param method The method to be called on the signature widget.
* @param settings The new settings for the signature widget.
* @return this jQuery instance for chaining.
*/
signature(method: "option", settings: Partial): this;
/**
* Updates a particular setting for the signature instances.
* @typeparam K Name of the setting to update.
* @param method The method to be called on the signature widget.
* @param name Name of the setting to update.
* @param value The new value for the setting.
* @return this jQuery instance for chaining.
*/
signature