@serenity-is / Modules / corelib/q
Module: corelib/q
This is the main entry point for @serenity-is/corelib/q
module. This module mainly contains
helper functions.
The types from this module are available by importing from "@serenity-is/corelib/q":
import { htmlEncode, notifyInfo } from "serenity-is/corelib/q"
notifyInfo(htmlEncode("&'<>"));
When using classic namespaces instead of the ESM modules, the types and functions in this module are directly available from the global
Q
namespace. e.g.Q.htmlEncode("&'<>")
Table of contents
Namespaces
Enumerations
Classes
- ArgumentNullException
- CriteriaBuilder
- EditorAttribute
- Exception
- ISlickFormatter
- InvalidCastException
- LT
- Lookup
- Toastr
Interfaces
- AlertOptions
- CommonDialogOptions
- ConfirmOptions
- DateFormat
- DebouncedFunction
- DeleteRequest
- DeleteResponse
- DialogButton
- HandleRouteEventArgs
- IFrameDialogOptions
- JQBlockUIOptions
- ListRequest
- ListResponse
- Locale
- LookupOptions
- NumberFormat
- PostToServiceOptions
- PostToUrlOptions
- PropertyItem
- PropertyItemsData
- RetrieveLocalizationRequest
- RetrieveLocalizationResponse
- RetrieveRequest
- RetrieveResponse
- SaveRequest
- SaveRequestWithAttachment
- SaveResponse
- SaveWithLocalizationRequest
- ServiceError
- ServiceOptions
- ServiceRequest
- ServiceResponse
- TypeMember
- UndeleteRequest
- UndeleteResponse
- UserDefinition
Type Aliases
Variables
Functions
- Criteria
- addAttribute
- addEmptyOption
- addOption
- addTypeMember
- addValidationRule
- alert
- alertDialog
- any
- attrEncode
- autoFullHeight
- baseValidateOptions
- blockUI
- blockUndo
- bsModalMarkup
- canLoadScriptData
- cast
- centerDialog
- clearKeys
- clearOptions
- closePanel
- coalesce
- compareStringFactory
- confirm
- confirmDialog
- count
- dbText
- dbTryText
- debounce
- deepClone
- delegateCombine
- delegateRemove
- dialogButtonToBS
- dialogButtonToUI
- endsWith
- executeEverytimeWhenVisible
- executeOnceWhenVisible
- extend
- fieldsProxy
- findElementWithRelativeId
- first
- format
- formatDate
- formatDayHourAndMin
- formatISODateTimeUTC
- formatNumber
- getAttributes
- getBaseType
- getColumns
- getColumnsAsync
- getColumnsData
- getColumnsDataAsync
- getCookie
- getForm
- getFormAsync
- getFormData
- getFormDataAsync
- getGlobalThis
- getHighlightTarget
- getInstanceType
- getLookup
- getLookupAsync
- getMembers
- getNested
- getRemoteData
- getRemoteDataAsync
- getStateStore
- getTemplate
- getTemplateAsync
- getType
- getTypeFullName
- getTypeNameProp
- getTypeShortName
- getTypes
- groupBy
- htmlEncode
- iframeDialog
- indexOf
- information
- informationDialog
- initFormType
- initFullHeightGridPage
- initializeTypes
- insert
- isArray
- isAssignableFrom
- isBS3
- isBS5Plus
- isEmptyOrNull
- isEnum
- isInstanceOfType
- isTrimmedEmpty
- isValue
- keyOf
- layoutFillHeight
- layoutFillHeightValue
- loadValidationErrorMessages
- localText
- localeFormat
- newBodyDiv
- notifyError
- notifyInfo
- notifySuccess
- notifyWarning
- outerHtml
- padLeft
- parseCriteria
- parseDate
- parseDayHourAndMin
- parseDecimal
- parseHourAndMin
- parseISODateTime
- parseInteger
- parseQueryString
- positionToastContainer
- postToService
- postToUrl
- prefixedText
- prop
- proxyTexts
- registerClass
- registerEditor
- registerEnum
- registerInterface
- reloadLookup
- reloadLookupAsync
- removeValidationRule
- replaceAll
- resolveUrl
- round
- safeCast
- serviceCall
- serviceRequest
- setEquality
- setMobileDeviceMode
- setTypeNameProp
- single
- splitDateString
- startsWith
- success
- successDialog
- text
- toGrouping
- toId
- toSingleLine
- today
- toggleClass
- triggerLayoutOnShow
- trim
- trimEnd
- trimStart
- trimToEmpty
- trimToNull
- trunc
- tryFirst
- tryGetText
- turkishLocaleCompare
- turkishLocaleToUpper
- validateForm
- validateOptions
- validatorAbortHandler
- warning
- warningDialog
- zeroPad
Type Aliases
Dictionary
Ƭ Dictionary<TItem
>: Object
Type parameters
Name |
---|
TItem |
Index signature
▪ [key: string
]: TItem
Defined in
GroupByElement
Ƭ GroupByElement<TItem
>: Object
A group item returned by groupBy()
.
Type parameters
Name |
---|
TItem |
Type declaration
Name | Type | Description |
---|---|---|
items |
TItem [] |
the items in the group |
key |
string |
key of the group |
order |
number |
index of the item in inOrder array |
start |
number |
index of the first item of this group in the original array |
Defined in
GroupByResult
Ƭ GroupByResult<TItem
>: Object
Return type of the groupBy
function.
Type parameters
Name |
---|
TItem |
Type declaration
Name | Type |
---|---|
byKey |
{ [key: string] : GroupByElement <TItem >; } |
inOrder |
GroupByElement <TItem >[] |
Defined in
Grouping
Ƭ Grouping<TItem
>: Object
Type parameters
Name |
---|
TItem |
Index signature
▪ [key: string
]: TItem
[]
Defined in
NotifyMap
Ƭ NotifyMap: Object
Type declaration
Name | Type |
---|---|
iconClass |
string |
message? |
string |
title? |
string |
type |
string |
Defined in
ToastContainerOptions
Ƭ ToastContainerOptions: Object
Type declaration
Name | Type |
---|---|
containerId? |
string |
positionClass? |
string |
target? |
string |
Defined in
ToastrOptions
Ƭ ToastrOptions: ToastContainerOptions
& { closeButton?
: boolean
; closeClass?
: string
; closeDuration?
: number
| false
; closeEasing?
: boolean
; closeHtml?
: string
; closeMethod?
: boolean
; closeOnHover?
: boolean
; escapeHtml?
: boolean
; extendedTimeOut?
: number
; hideDuration?
: number
; iconClass?
: string
; messageClass?
: string
; newestOnTop?
: boolean
; onCloseClick?
: (event
: Event
) => void
; onHidden?
: () => void
; onShown?
: () => void
; onclick?
: (event
: MouseEvent
) => void
; positionClass?
: string
; preventDuplicates?
: boolean
; rtl?
: boolean
; showDuration?
: number
; tapToDismiss?
: boolean
; target?
: string
; timeOut?
: number
; titleClass?
: string
; toastClass?
: string
}
Defined in
Type
Ƭ Type: Function
| Object
Defined in
Variables
Config
• Config: Object
Type declaration
Name | Type | Description |
---|---|---|
applicationPath |
string |
This is the root path of your application. If your application resides under http://localhost/mysite/, your root path is "mysite/". This variable is automatically initialized by reading from a element with ID "ApplicationPath" from current page, which is usually located in your _LayoutHead.cshtml file |
bootstrapMessages |
boolean |
Set this to true, to prefer bootstrap dialogs over jQuery UI dialogs by default for message dialogs |
emailAllowOnlyAscii |
boolean |
Email validation by default only allows ASCII characters. Set this to true if you want to allow unicode. |
notLoggedInHandler |
Function |
This is an optional method for handling when user is not logged in. If a users session is expired and when a NotAuthorized response is received from a service call, Serenity will call this handler, so you may intercept it and notify user about this situation and ask if she wants to login again... |
responsiveDialogs |
boolean |
Obsolete defaulted to false before for backward compatibility, now its true by default |
rootNamespaces |
string [] |
This is the list of root namespaces that may be searched for types. For example, if you specify an editor type of "MyEditor", first a class with name "MyEditor" will be searched, if not found, search will be followed by "Serenity.MyEditor" and "MyApp.MyEditor" if you added "MyApp" to the list of root namespaces. You should usually add your application root namespace to this list in ScriptInitialization.ts file. |
Defined in
Culture
• Culture: Locale
Defined in
Invariant
• Invariant: Locale
Defined in
defaultNotifyOptions
• defaultNotifyOptions: ToastrOptions
Defined in
Functions
Criteria
▸ Criteria(field
): CriteriaBuilder
Creates a new criteria builder containg the passed field name.
Parameters
Name | Type | Description |
---|---|---|
field |
string |
The field name. |
Returns
Defined in
addAttribute
▸ addAttribute(type
, attr
): void
Parameters
Name | Type |
---|---|
type |
any |
attr |
any |
Returns
void
Defined in
addEmptyOption
▸ addEmptyOption(select
): void
Adds an empty option to the select.
Parameters
Name | Type | Description |
---|---|---|
select |
JQuery | HTMLSelectElement |
the select element |
Returns
void
Defined in
addOption
▸ addOption(select
, key
, text
): void
Adds an option to the select.
Parameters
Name | Type |
---|---|
select |
JQuery | HTMLSelectElement |
key |
string |
text |
string |
Returns
void
Defined in
addTypeMember
▸ addTypeMember(type
, member
): TypeMember
Parameters
Name | Type |
---|---|
type |
any |
member |
TypeMember |
Returns
Defined in
addValidationRule
▸ addValidationRule(element
, eventClass
, rule
): JQuery
Parameters
Name | Type |
---|---|
element |
JQuery |
eventClass |
string |
rule |
(p1 : JQuery ) => string |
Returns
JQuery
Defined in
alert
▸ alert(message
, options?
): void
Obsolete
use alertDialog
Parameters
Name | Type |
---|---|
message |
string |
options? |
AlertOptions |
Returns
void
Defined in
alertDialog
▸ alertDialog(message
, options?
): void
Displays an alert dialog
See
AlertOptions
Example
alertDialog("An error occured!"); }
Parameters
Name | Type | Description |
---|---|---|
message |
string |
The message to display |
options? |
AlertOptions |
Additional options. |
Returns
void
Defined in
any
▸ any<TItem
>(array
, predicate
): boolean
Tests if any of array elements matches given predicate. Prefer Array.some() over this function (e.g. [1, 2, 3].some(predicate)
).
Type parameters
Name |
---|
TItem |
Parameters
Name | Type | Description |
---|---|---|
array |
TItem [] |
Array to test. |
predicate |
(x : TItem ) => boolean |
Predicate to test elements. |
Returns
boolean
True if any element matches.
Defined in
attrEncode
▸ attrEncode(s
): string
Obsolete
use htmlEncode as it also encodes quotes
Parameters
Name | Type |
---|---|
s |
any |
Returns
string
Defined in
autoFullHeight
▸ autoFullHeight(element
): void
Parameters
Name | Type |
---|---|
element |
JQuery |
Returns
void
Defined in
baseValidateOptions
▸ baseValidateOptions(): JQueryValidation.ValidationOptions
Returns
JQueryValidation.ValidationOptions
Defined in
blockUI
▸ blockUI(options
): void
Uses jQuery BlockUI plugin to block access to whole page (default) or a part of it, by using a transparent overlay covering the whole area.
Remarks
If options are not specified, this function blocks whole page with a transparent overlay. Default z-order of the overlay div is 2000, so a higher z-order shouldn't be used in page.
Parameters
Name | Type | Description |
---|---|---|
options |
JQBlockUIOptions |
Parameters for the BlockUI plugin |
Returns
void
Defined in
blockUndo
▸ blockUndo(): void
Unblocks the page.
Returns
void
Defined in
bsModalMarkup
▸ bsModalMarkup(title
, body
, modalClass?
, escapeHtml?
): HTMLDivElement
Builds HTML DIV element for a Bootstrap modal dialog
Parameters
Name | Type | Default value | Description |
---|---|---|---|
title |
string |
undefined |
Modal title |
body |
string |
undefined |
Modal body, it will not be HTML encoded, so make sure it is encoded |
modalClass? |
string |
undefined |
Optional class to add to the modal element |
escapeHtml |
boolean |
true |
True to html encode body, default is true |
Returns
HTMLDivElement
Defined in
canLoadScriptData
▸ canLoadScriptData(name
): boolean
Parameters
Name | Type |
---|---|
name |
string |
Returns
boolean
Defined in
cast
▸ cast(instance
, type
): any
Parameters
Name | Type |
---|---|
instance |
any |
type |
Type |
Returns
any
Defined in
centerDialog
▸ centerDialog(el
): void
Parameters
Name | Type |
---|---|
el |
JQuery |
Returns
void
Defined in
clearKeys
▸ clearKeys(d
): void
Parameters
Name | Type |
---|---|
d |
any |
Returns
void
Defined in
clearOptions
▸ clearOptions(select
): void
Clears the options in the select element
Parameters
Name | Type |
---|---|
select |
JQuery |
Returns
void
Defined in
closePanel
▸ closePanel(element
, e?
): void
Closes a panel, triggering panelbeforeclose and panelclose events. If the panelbeforeclose prevents the default, the operation is cancelled.
Parameters
Name | Type | Description |
---|---|---|
element |
HTMLElement | JQuery |
The panel element |
e? |
Event |
The event triggering the close |
Returns
void
Defined in
coalesce
▸ coalesce(a
, b
): any
Parameters
Name | Type |
---|---|
a |
any |
b |
any |
Returns
any
Defined in
compareStringFactory
▸ compareStringFactory(order
): (a
: string
, b
: string
) => number
Parameters
Name | Type |
---|---|
order |
string |
Returns
fn
▸ (a
, b
): number
Parameters
Name | Type |
---|---|
a |
string |
b |
string |
Returns
number
Defined in
confirm
▸ confirm(message
, onYes
, options?
): void
Obsolete
use confirmDialog
Parameters
Name | Type |
---|---|
message |
string |
onYes |
() => void |
options? |
ConfirmOptions |
Returns
void
Defined in
confirmDialog
▸ confirmDialog(message
, onYes
, options?
): void
Display a confirmation dialog
See
ConfirmOptions
Example
confirmDialog("Are you sure you want to delete?", () => {
// do something when yes is clicked
}
Parameters
Name | Type | Description |
---|---|---|
message |
string |
The message to display |
onYes |
() => void |
Callback for Yes button click |
options? |
ConfirmOptions |
Additional options. |
Returns
void
Defined in
count
▸ count<TItem
>(array
, predicate
): number
Counts number of array elements that matches a given predicate.
Type parameters
Name |
---|
TItem |
Parameters
Name | Type | Description |
---|---|---|
array |
TItem [] |
Array to test. |
predicate |
(x : TItem ) => boolean |
Predicate to test elements. |
Returns
number
Defined in
dbText
▸ dbText(prefix
): (key
: string
) => string
Parameters
Name | Type |
---|---|
prefix |
string |
Returns
fn
▸ (key
): string
Parameters
Name | Type |
---|---|
key |
string |
Returns
string
Defined in
dbTryText
▸ dbTryText(prefix
): (key
: string
) => string
Parameters
Name | Type |
---|---|
prefix |
string |
Returns
fn
▸ (key
): string
Parameters
Name | Type |
---|---|
key |
string |
Returns
string
Defined in
debounce
▸ debounce<T
>(func
, wait?
, immediate?
): DebouncedFunction
<T
>
Returns a function, that, as long as it continues to be invoked, will not be triggered. The function also has a property 'clear' that can be used to clear the timer to prevent previously scheduled executions, and flush method to invoke scheduled executions now if any.
Source
underscore.js
Type parameters
Name | Type |
---|---|
T |
extends (...args : any ) => any |
Parameters
Name | Type | Description |
---|---|---|
func |
T |
- |
wait? |
number |
The function will be called after it stops being called for N milliseconds. |
immediate? |
boolean |
If passed, trigger the function on the leading edge, instead of the trailing. |
Returns
Defined in
deepClone
▸ deepClone<T
>(a
, a2?
, a3?
): T
Type parameters
Name | Type |
---|---|
T |
any |
Parameters
Name | Type |
---|---|
a |
T |
a2? |
any |
a3? |
any |
Returns
T
Defined in
delegateCombine
▸ delegateCombine(delegate1
, delegate2
): any
Parameters
Name | Type |
---|---|
delegate1 |
any |
delegate2 |
any |
Returns
any
Defined in
delegateRemove
▸ delegateRemove(delegate1
, delegate2
): any
Parameters
Name | Type |
---|---|
delegate1 |
any |
delegate2 |
any |
Returns
any
Defined in
dialogButtonToBS
▸ dialogButtonToBS(x
): HTMLButtonElement
Parameters
Name | Type |
---|---|
x |
DialogButton |
Returns
HTMLButtonElement
Defined in
dialogButtonToUI
▸ dialogButtonToUI(x
): any
Parameters
Name | Type |
---|---|
x |
DialogButton |
Returns
any
Defined in
endsWith
▸ endsWith(s
, suffix
): boolean
Checks if the string ends with the specified substring.
Parameters
Name | Type | Description |
---|---|---|
s |
string |
String to check. |
suffix |
string |
Suffix to check. |
Returns
boolean
True if the string ends with the specified substring.
Defined in
executeEverytimeWhenVisible
▸ executeEverytimeWhenVisible(element
, callback
, callNowIfVisible
): void
Parameters
Name | Type |
---|---|
element |
JQuery |
callback |
Function |
callNowIfVisible |
boolean |
Returns
void
Defined in
executeOnceWhenVisible
▸ executeOnceWhenVisible(element
, callback
): void
Parameters
Name | Type |
---|---|
element |
JQuery |
callback |
Function |
Returns
void
Defined in
extend
▸ extend<T
>(a
, b
): T
Type parameters
Name | Type |
---|---|
T |
any |
Parameters
Name | Type |
---|---|
a |
T |
b |
T |
Returns
T
Defined in
fieldsProxy
▸ fieldsProxy<TRow
>(): Readonly
<Record
<keyof TRow
, string
>>
Type parameters
Name |
---|
TRow |
Returns
Readonly
<Record
<keyof TRow
, string
>>
Defined in
findElementWithRelativeId
▸ findElementWithRelativeId(element
, relativeId
, context?
): JQuery
Finds the first element with the given relative id to the source element. It can handle underscores in the source element id.
Parameters
Name | Type | Description |
---|---|---|
element |
JQuery |
the source element |
relativeId |
string |
the relative id to the source element |
context? |
HTMLElement |
the context element (optional) |
Returns
JQuery
the element with the given relative id to the source element.
Defined in
▸ findElementWithRelativeId(element
, relativeId
, context?
): HTMLElement
Finds the first element with the given relative id to the source element. It can handle underscores in the source element id.
Parameters
Name | Type | Description |
---|---|---|
element |
HTMLElement |
the source element |
relativeId |
string |
the relative id to the source element |
context? |
HTMLElement |
the context element (optional) |
Returns
HTMLElement
the element with the given relative id to the source element.
Defined in
first
▸ first<TItem
>(array
, predicate
): TItem
Gets first element in an array that matches given predicate similar to LINQ's First. Throws an error if no match is found.
Type parameters
Name |
---|
TItem |
Parameters
Name | Type | Description |
---|---|---|
array |
TItem [] |
Array to test. |
predicate |
(x : TItem ) => boolean |
Predicate to test elements. |
Returns
TItem
First element that matches.
Defined in
format
▸ format(format
, ...prm
): string
Parameters
Name | Type |
---|---|
format |
string |
...prm |
any [] |
Returns
string
Defined in
formatDate
▸ formatDate(d
, format?
, locale?
): string
Parameters
Name | Type |
---|---|
d |
string | Date |
format? |
string |
locale? |
Locale |
Returns
string
Defined in
formatDayHourAndMin
▸ formatDayHourAndMin(n
): string
Parameters
Name | Type |
---|---|
n |
number |
Returns
string
Defined in
formatISODateTimeUTC
▸ formatISODateTimeUTC(d
): string
Parameters
Name | Type |
---|---|
d |
Date |
Returns
string
Defined in
formatNumber
▸ formatNumber(num
, format?
, decOrLoc?
, grp?
): string
Parameters
Name | Type |
---|---|
num |
number |
format? |
string |
decOrLoc? |
string | NumberFormat |
grp? |
string |
Returns
string
Defined in
getAttributes
▸ getAttributes(type
, attrType
, inherit?
): any
[]
Parameters
Name | Type |
---|---|
type |
any |
attrType |
any |
inherit? |
boolean |
Returns
any
[]
Defined in
getBaseType
▸ getBaseType(type
): any
Parameters
Name | Type |
---|---|
type |
any |
Returns
any
Defined in
getColumns
▸ getColumns(key
): PropertyItem
[]
Parameters
Name | Type |
---|---|
key |
string |
Returns
Defined in
getColumnsAsync
▸ getColumnsAsync(key
): Promise
<PropertyItem
[]>
Parameters
Name | Type |
---|---|
key |
string |
Returns
Promise
<PropertyItem
[]>
Defined in
getColumnsData
▸ getColumnsData(key
): PropertyItemsData
Parameters
Name | Type |
---|---|
key |
string |
Returns
Defined in
getColumnsDataAsync
▸ getColumnsDataAsync(key
): Promise
<PropertyItemsData
>
Parameters
Name | Type |
---|---|
key |
string |
Returns
Promise
<PropertyItemsData
>
Defined in
getCookie
▸ getCookie(name
): any
Parameters
Name | Type |
---|---|
name |
string |
Returns
any
Defined in
getForm
▸ getForm(key
): PropertyItem
[]
Parameters
Name | Type |
---|---|
key |
string |
Returns
Defined in
getFormAsync
▸ getFormAsync(key
): Promise
<PropertyItem
[]>
Parameters
Name | Type |
---|---|
key |
string |
Returns
Promise
<PropertyItem
[]>
Defined in
getFormData
▸ getFormData(key
): PropertyItemsData
Parameters
Name | Type |
---|---|
key |
string |
Returns
Defined in
getFormDataAsync
▸ getFormDataAsync(key
): Promise
<PropertyItemsData
>
Parameters
Name | Type |
---|---|
key |
string |
Returns
Promise
<PropertyItemsData
>
Defined in
getGlobalThis
▸ getGlobalThis(): any
Returns
any
Defined in
getHighlightTarget
▸ getHighlightTarget(el
): HTMLElement
Parameters
Name | Type |
---|---|
el |
HTMLElement |
Returns
HTMLElement
Defined in
getInstanceType
▸ getInstanceType(instance
): any
Parameters
Name | Type |
---|---|
instance |
any |
Returns
any
Defined in
getLookup
▸ getLookup<TItem
>(key
): Lookup
<TItem
>
Type parameters
Name |
---|
TItem |
Parameters
Name | Type |
---|---|
key |
string |
Returns
Lookup
<TItem
>
Defined in
getLookupAsync
▸ getLookupAsync<TItem
>(key
): Promise
<Lookup
<TItem
>>
Type parameters
Name |
---|
TItem |
Parameters
Name | Type |
---|---|
key |
string |
Returns
Promise
<Lookup
<TItem
>>
Defined in
getMembers
▸ getMembers(type
, memberTypes
): TypeMember
[]
Parameters
Name | Type |
---|---|
type |
any |
memberTypes |
MemberType |
Returns
Defined in
getNested
▸ getNested(from
, name
): any
Parameters
Name | Type |
---|---|
from |
any |
name |
string |
Returns
any
Defined in
getRemoteData
▸ getRemoteData<TData
>(key
): TData
Type parameters
Name | Type |
---|---|
TData |
any |
Parameters
Name | Type |
---|---|
key |
string |
Returns
TData
Defined in
getRemoteDataAsync
▸ getRemoteDataAsync<TData
>(key
): Promise
<TData
>
Type parameters
Name | Type |
---|---|
TData |
any |
Parameters
Name | Type |
---|---|
key |
string |
Returns
Promise
<TData
>
Defined in
getStateStore
▸ getStateStore(key?
): any
Parameters
Name | Type |
---|---|
key? |
string |
Returns
any
Defined in
getTemplate
▸ getTemplate(key
): string
Parameters
Name | Type |
---|---|
key |
string |
Returns
string
Defined in
getTemplateAsync
▸ getTemplateAsync(key
): Promise
<string
>
Parameters
Name | Type |
---|---|
key |
string |
Returns
Promise
<string
>
Defined in
getType
▸ getType(name
, target?
): Type
Parameters
Name | Type |
---|---|
name |
string |
target? |
any |
Returns
Defined in
getTypeFullName
▸ getTypeFullName(type
): string
Parameters
Name | Type |
---|---|
type |
Type |
Returns
string
Defined in
getTypeNameProp
▸ getTypeNameProp(type
): string
Parameters
Name | Type |
---|---|
type |
Type |
Returns
string
Defined in
getTypeShortName
▸ getTypeShortName(type
): string
Parameters
Name | Type |
---|---|
type |
Type |
Returns
string
Defined in
getTypes
▸ getTypes(from?
): any
[]
Parameters
Name | Type |
---|---|
from? |
any |
Returns
any
[]
Defined in
groupBy
▸ groupBy<TItem
>(items
, getKey
): GroupByResult
<TItem
>
Groups an array with keys determined by specified getKey() callback. Resulting object contains group objects in order and a dictionary to access by key. This is similar to LINQ's ToLookup function with some additional details like start index.
Type parameters
Name |
---|
TItem |
Parameters
Name | Type | Description |
---|---|---|
items |
TItem [] |
Array to group. |
getKey |
(x : TItem ) => any |
Function that returns key for each item. |
Returns
GroupByResult
<TItem
>
GroupByResult object.
Defined in
htmlEncode
▸ htmlEncode(s
): string
Html encodes a string (encodes single and double quotes, & (ampersand), > and < characters)
Parameters
Name | Type | Description |
---|---|---|
s |
any |
String (or number etc.) to be HTML encoded |
Returns
string
Defined in
iframeDialog
▸ iframeDialog(options
): void
Display a dialog that shows an HTML block in an IFRAME, which is usually returned from server callbacks
Parameters
Name | Type | Description |
---|---|---|
options |
IFrameDialogOptions |
The options |
Returns
void
Defined in
indexOf
▸ indexOf<TItem
>(array
, predicate
): number
Gets index of first element in an array that matches given predicate.
Type parameters
Name |
---|
TItem |
Parameters
Name | Type | Description |
---|---|---|
array |
TItem [] |
Array to test. |
predicate |
(x : TItem ) => boolean |
Predicate to test elements. |
Returns
number
Defined in
information
▸ information(message
, onOk?
, options?
): void
Obsolete
use informationDialog
Parameters
Name | Type |
---|---|
message |
string |
onOk? |
() => void |
options? |
ConfirmOptions |
Returns
void
Defined in
informationDialog
▸ informationDialog(message
, onOk?
, options?
): void
Display an information dialog
See
ConfirmOptions
Example
informationDialog("Operation complete", () => {
// do something when OK is clicked
}
Parameters
Name | Type | Description |
---|---|---|
message |
string |
The message to display |
onOk? |
() => void |
Callback for OK button click |
options? |
ConfirmOptions |
Additional options. |
Returns
void
Defined in
initFormType
▸ initFormType(typ
, nameWidgetPairs
): void
Parameters
Name | Type |
---|---|
typ |
Function |
nameWidgetPairs |
any [] |
Returns
void
Defined in
initFullHeightGridPage
▸ initFullHeightGridPage(gridDiv
, opt?
): void
Parameters
Name | Type |
---|---|
gridDiv |
JQuery |
opt? |
Object |
opt.noRoute? |
boolean |
Returns
void
Defined in
initializeTypes
▸ initializeTypes(root
, pre
, limit
): void
Parameters
Name | Type |
---|---|
root |
any |
pre |
string |
limit |
number |
Returns
void
Defined in
insert
▸ insert(obj
, index
, item
): void
Inserts an item to the array at specified index. Prefer Array.splice unless you need to support IE.
Throws
Error if object does not support insert.
Example
insert([1, 2, 3], 1, 4); // [1, 4, 2, 3]
insert({ insert: (index, item) => { this.splice(index, 0, item); } }
Parameters
Name | Type | Description |
---|---|---|
obj |
any |
Array or array like object to insert to. |
index |
number |
Index to insert at. |
item |
any |
Item to insert. |
Returns
void
Defined in
isArray
▸ isArray(arg
): arg is any[]
Determines if the object is an array. Prefer Array.isArray over this function (e.g. Array.isArray(obj)
).
Example
isArray([1, 2, 3]); // true
isArray({}); // false
Parameters
Name | Type |
---|---|
arg |
any |
Returns
arg is any[]
True if the object is an array.
Defined in
../../../../../Users/volka/AppData/Local/pnpm/global/5/.pnpm/typescript@4.9.3/node_modules/typescript/lib/lib.es5.d.ts:1491
isAssignableFrom
▸ isAssignableFrom(target
, type
): boolean
Parameters
Name | Type |
---|---|
target |
any |
type |
Type |
Returns
boolean
Defined in
isBS3
▸ isBS3(): boolean
Returns true if Bootstrap 3 is loaded
Returns
boolean
Defined in
isBS5Plus
▸ isBS5Plus(): boolean
Returns true if Bootstrap 5+ is loaded
Returns
boolean
Defined in
isEmptyOrNull
▸ isEmptyOrNull(s
): boolean
Checks if the string is empty or null.
Parameters
Name | Type | Description |
---|---|---|
s |
string |
String to check. |
Returns
boolean
True if the string is empty or null.
Defined in
isEnum
▸ isEnum(type
): boolean
Parameters
Name | Type |
---|---|
type |
any |
Returns
boolean
Defined in
isInstanceOfType
▸ isInstanceOfType(instance
, type
): boolean
Parameters
Name | Type |
---|---|
instance |
any |
type |
Type |
Returns
boolean
Defined in
isTrimmedEmpty
▸ isTrimmedEmpty(s
): boolean
Checks if the string is empty or null or whitespace.
Parameters
Name | Type | Description |
---|---|---|
s |
string |
String to check. |
Returns
boolean
True if the string is empty or null or whitespace.
Defined in
isValue
▸ isValue(a
): boolean
Parameters
Name | Type |
---|---|
a |
any |
Returns
boolean
Defined in
keyOf
▸ keyOf<T
>(prop
): keyof T
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
prop |
keyof T |
Returns
keyof T
Defined in
layoutFillHeight
▸ layoutFillHeight(element
): void
Parameters
Name | Type |
---|---|
element |
JQuery |
Returns
void
Defined in
layoutFillHeightValue
▸ layoutFillHeightValue(element
): number
Parameters
Name | Type |
---|---|
element |
JQuery |
Returns
number
Defined in
loadValidationErrorMessages
▸ loadValidationErrorMessages(): void
Returns
void
Defined in
localText
▸ localText(key
): string
Parameters
Name | Type |
---|---|
key |
string |
Returns
string
Defined in
localeFormat
▸ localeFormat(format
, l
, ...prm
): string
Parameters
Name | Type |
---|---|
format |
string |
l |
Locale |
...prm |
any [] |
Returns
string
Defined in
newBodyDiv
▸ newBodyDiv(): JQuery
Creates a new DIV and appends it to the body.
Returns
JQuery
the new DIV element.
Defined in
notifyError
▸ notifyError(message
, title?
, options?
): void
Parameters
Name | Type |
---|---|
message |
string |
title? |
string |
options? |
ToastrOptions |
Returns
void
Defined in
notifyInfo
▸ notifyInfo(message
, title?
, options?
): void
Parameters
Name | Type |
---|---|
message |
string |
title? |
string |
options? |
ToastrOptions |
Returns
void
Defined in
notifySuccess
▸ notifySuccess(message
, title?
, options?
): void
Parameters
Name | Type |
---|---|
message |
string |
title? |
string |
options? |
ToastrOptions |
Returns
void
Defined in
notifyWarning
▸ notifyWarning(message
, title?
, options?
): void
Parameters
Name | Type |
---|---|
message |
string |
title? |
string |
options? |
ToastrOptions |
Returns
void
Defined in
outerHtml
▸ outerHtml(element
): string
Returns the outer HTML of the element.
Parameters
Name | Type |
---|---|
element |
JQuery |
Returns
string
Defined in
padLeft
▸ padLeft(s
, len
, ch?
): any
Pads the string to the left with the specified character.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
s |
string | number |
undefined |
String to pad. |
len |
number |
undefined |
Target length of the string. |
ch |
string |
' ' |
Character to pad with. |
Returns
any
Padded string.
Defined in
parseCriteria
▸ parseCriteria(expression
, params?
): any
[]
Parses a criteria expression to Serenity Criteria array format.
The string may optionally contain parameters like A >= @p1 and B < @p2
.
Example
parseCriteria('A >=
P1
and B < @p2', { p1: 5, p2: 4 }) // [[[a], '>=' 5], 'and', [[b], '<', 4]]
Parameters
Name | Type | Description |
---|---|---|
expression |
string |
The criteria expression. |
params? |
any |
The dictionary containing parameter values like { p1: 10, p2: 20 }. |
Returns
any
[]
Defined in
▸ parseCriteria(strings
, ...values
): any
[]
Parses a criteria expression to Serenity Criteria array format.
The expression may contain parameter placeholders like A >= ${p1}
where p1 is a variable in the scope.
Example
var a = 5, b = 4;
parseCriteria`A >= ${a} and B < ${b}` // [[[a], '>=' 5], 'and', [[b], '<', 4]]
Parameters
Name | Type | Description |
---|---|---|
strings |
TemplateStringsArray |
The string fragments. |
...values |
any [] |
The tagged template arguments. |
Returns
any
[]
Defined in
parseDate
▸ parseDate(s
, dateOrder?
): any
Parameters
Name | Type |
---|---|
s |
string |
dateOrder? |
string |
Returns
any
Defined in
parseDayHourAndMin
▸ parseDayHourAndMin(s
): number
Parameters
Name | Type |
---|---|
s |
string |
Returns
number
Defined in
parseDecimal
▸ parseDecimal(s
): number
Parameters
Name | Type |
---|---|
s |
string |
Returns
number
Defined in
parseHourAndMin
▸ parseHourAndMin(value
): number
Parameters
Name | Type |
---|---|
value |
string |
Returns
number
Defined in
parseISODateTime
▸ parseISODateTime(s
): Date
Parameters
Name | Type |
---|---|
s |
string |
Returns
Date
Defined in
parseInteger
▸ parseInteger(s
): number
Parameters
Name | Type |
---|---|
s |
string |
Returns
number
Defined in
parseQueryString
▸ parseQueryString(s?
): Object
Parameters
Name | Type |
---|---|
s? |
string |
Returns
Object
Defined in
positionToastContainer
▸ positionToastContainer(create
, options?
): void
Parameters
Name | Type |
---|---|
create |
boolean |
options? |
ToastrOptions |
Returns
void
Defined in
postToService
▸ postToService(options
): void
Parameters
Name | Type |
---|---|
options |
PostToServiceOptions |
Returns
void
Defined in
postToUrl
▸ postToUrl(options
): void
Parameters
Name | Type |
---|---|
options |
PostToUrlOptions |
Returns
void
Defined in
prefixedText
▸ prefixedText(prefix
): (text
: string
, key
: string
| (p?
: string
) => string
) => string
Parameters
Name | Type |
---|---|
prefix |
string |
Returns
fn
▸ (text
, key
): string
Parameters
Name | Type |
---|---|
text |
string |
key |
string | (p? : string ) => string |
Returns
string
Defined in
prop
▸ prop(type
, name
, getter?
, setter?
): void
Parameters
Name | Type |
---|---|
type |
any |
name |
string |
getter? |
string |
setter? |
string |
Returns
void
Defined in
proxyTexts
▸ proxyTexts(o
, p
, t
): Object
Parameters
Name | Type |
---|---|
o |
Record <string , any > |
p |
string |
t |
Record <string , any > |
Returns
Object
Defined in
registerClass
▸ registerClass(type
, name
, intf?
): void
Parameters
Name | Type |
---|---|
type |
any |
name |
string |
intf? |
any [] |
Returns
void
Defined in
registerEditor
▸ registerEditor(type
, name
, intf?
): void
Parameters
Name | Type |
---|---|
type |
any |
name |
string |
intf? |
any [] |
Returns
void
Defined in
registerEnum
▸ registerEnum(type
, name
, enumKey?
): void
Parameters
Name | Type |
---|---|
type |
any |
name |
string |
enumKey? |
string |
Returns
void
Defined in
registerInterface
▸ registerInterface(type
, name
, intf?
): void
Parameters
Name | Type |
---|---|
type |
any |
name |
string |
intf? |
any [] |
Returns
void
Defined in
reloadLookup
▸ reloadLookup<TItem
>(key
): Lookup
<TItem
>
Type parameters
Name | Type |
---|---|
TItem |
any |
Parameters
Name | Type |
---|---|
key |
string |
Returns
Lookup
<TItem
>
Defined in
reloadLookupAsync
▸ reloadLookupAsync<TItem
>(key
): Promise
<Lookup
<TItem
>>
Type parameters
Name | Type |
---|---|
TItem |
any |
Parameters
Name | Type |
---|---|
key |
string |
Returns
Promise
<Lookup
<TItem
>>
Defined in
removeValidationRule
▸ removeValidationRule(element
, eventClass
): JQuery
Parameters
Name | Type |
---|---|
element |
JQuery |
eventClass |
string |
Returns
JQuery
Defined in
replaceAll
▸ replaceAll(str
, find
, replace
): string
Replaces all occurrences of the search string with the replacement string.
Parameters
Name | Type | Description |
---|---|---|
str |
string |
String to replace. |
find |
string |
String to find. |
replace |
string |
String to replace with. |
Returns
string
Replaced string.
Defined in
resolveUrl
▸ resolveUrl(url
): string
Parameters
Name | Type |
---|---|
url |
string |
Returns
string
Defined in
round
▸ round(n
, d?
, rounding?
): number
Parameters
Name | Type |
---|---|
n |
number |
d? |
number |
rounding? |
boolean |
Returns
number
Defined in
safeCast
▸ safeCast(instance
, type
): any
Parameters
Name | Type |
---|---|
instance |
any |
type |
Type |
Returns
any
Defined in
serviceCall
▸ serviceCall<TResponse
>(options
): JQueryXHR
Type parameters
Name | Type |
---|---|
TResponse |
extends ServiceResponse |
Parameters
Name | Type |
---|---|
options |
ServiceOptions <TResponse > |
Returns
JQueryXHR
Defined in
serviceRequest
▸ serviceRequest<TResponse
>(service
, request?
, onSuccess?
, options?
): JQueryXHR
Type parameters
Name | Type |
---|---|
TResponse |
extends ServiceResponse |
Parameters
Name | Type |
---|---|
service |
string |
request? |
any |
onSuccess? |
(response : TResponse ) => void |
options? |
ServiceOptions <TResponse > |
Returns
JQueryXHR
Defined in
setEquality
▸ setEquality(request
, field
, value
): void
Parameters
Name | Type |
---|---|
request |
ListRequest |
field |
string |
value |
any |
Returns
void
Defined in
setMobileDeviceMode
▸ setMobileDeviceMode(): void
Returns
void
Defined in
setTypeNameProp
▸ setTypeNameProp(type
, value
): void
Parameters
Name | Type |
---|---|
type |
Type |
value |
string |
Returns
void
Defined in
single
▸ single<TItem
>(array
, predicate
): TItem
Gets first element in an array that matches given predicate. Throws an error if no matches is found, or there are multiple matches.
Example
first([1, 2, 3], x => x == 2); // 2
first([1, 2, 3], x => x == 4); // throws error.
Type parameters
Name |
---|
TItem |
Parameters
Name | Type | Description |
---|---|---|
array |
TItem [] |
Array to test. |
predicate |
(x : TItem ) => boolean |
Predicate to test elements. |
Returns
TItem
First element that matches.
Defined in
splitDateString
▸ splitDateString(s
): string
[]
Parameters
Name | Type |
---|---|
s |
string |
Returns
string
[]
Defined in
startsWith
▸ startsWith(s
, prefix
): boolean
Checks if the string starts with the prefix
Parameters
Name | Type | Description |
---|---|---|
s |
string |
String to check. |
prefix |
string |
Prefix to check. |
Returns
boolean
True if the string starts with the prefix.
Defined in
success
▸ success(message
, onOk?
, options?
): void
Obsolete
use successDialog
Parameters
Name | Type |
---|---|
message |
string |
onOk? |
() => void |
options? |
ConfirmOptions |
Returns
void
Defined in
successDialog
▸ successDialog(message
, onOk?
, options?
): void
Display a success dialog
See
ConfirmOptions
Example
successDialog("Operation complete", () => {
// do something when OK is clicked
}
Parameters
Name | Type | Description |
---|---|---|
message |
string |
The message to display |
onOk? |
() => void |
Callback for OK button click |
options? |
ConfirmOptions |
Additional options. |
Returns
void
Defined in
text
▸ text(key
): string
Obsolete
prefer localText for better discoverability
Parameters
Name | Type |
---|---|
key |
string |
Returns
string
Defined in
toGrouping
▸ toGrouping<TItem
>(items
, getKey
): Grouping
<TItem
>
Maps an array into a dictionary with keys determined by specified getKey() callback, and values that are arrays containing elements for a particular key.
Example
toGrouping([1, 2, 3], x => x % 2 == 0 ? "even" : "odd"); // { odd: [1, 3], even: [2] }
Type parameters
Name |
---|
TItem |
Parameters
Name | Type | Description |
---|---|---|
items |
TItem [] |
Array to map. |
getKey |
(x : TItem ) => any |
Function that returns key for each item. |
Returns
Grouping
<TItem
>
Grouping object.
Defined in
toId
▸ toId(id
): any
Parameters
Name | Type |
---|---|
id |
any |
Returns
any
Defined in
toSingleLine
▸ toSingleLine(str
): string
Converts the string to single line by removing line end characters
Parameters
Name | Type | Description |
---|---|---|
str |
string |
String to convert. |
Returns
string
Defined in
today
▸ today(): Date
Returns
Date
Defined in
toggleClass
▸ toggleClass(el
, cls
, remove?
): void
Toggles the class on the element handling spaces like jQuery addClass does.
Parameters
Name | Type | Description |
---|---|---|
el |
Element |
the element |
cls |
string |
the class to toggle |
remove? |
boolean |
if true, the class will be added, if false the class will be removed, otherwise it will be toggled. |
Returns
void
Defined in
triggerLayoutOnShow
▸ triggerLayoutOnShow(element
): void
Parameters
Name | Type |
---|---|
element |
JQuery |
Returns
void
Defined in
trim
▸ trim(s
): string
Trims the whitespace characters from the start and end of the string This returns empty string even when the string is null or undefined.
Parameters
Name | Type |
---|---|
s |
string |
Returns
string
Defined in
trimEnd
▸ trimEnd(s
): any
Trims the whitespace characters from the end of the string
Parameters
Name | Type |
---|---|
s |
string |
Returns
any
Defined in
trimStart
▸ trimStart(s
): any
Trims the whitespace characters from the start of the string
Parameters
Name | Type |
---|---|
s |
string |
Returns
any
Defined in
trimToEmpty
▸ trimToEmpty(s
): string
Trims the whitespace characters from the start and end of the string Returns empty string if the string is null or undefined.
Parameters
Name | Type |
---|---|
s |
string |
Returns
string
Defined in
trimToNull
▸ trimToNull(s
): string
Trims the whitespace characters from the start and end of the string Returns null if the string is null, undefined or whitespace.
Parameters
Name | Type |
---|---|
s |
string |
Returns
string
Defined in
trunc
▸ trunc(n
): number
Parameters
Name | Type |
---|---|
n |
number |
Returns
number
Defined in
tryFirst
▸ tryFirst<TItem
>(array
, predicate
): TItem
Gets first element in an array that matches given predicate (similar to LINQ's FirstOrDefault). Returns null if no match is found.
Example
tryFirst([1, 2, 3], x => x == 2); // 2
tryFirst([1, 2, 3], x => x == 4); // null
Type parameters
Name |
---|
TItem |
Parameters
Name | Type | Description |
---|---|---|
array |
TItem [] |
Array to test. |
predicate |
(x : TItem ) => boolean |
Predicate to test elements. |
Returns
TItem
First element that matches.
Defined in
tryGetText
▸ tryGetText(key
): string
Parameters
Name | Type |
---|---|
key |
string |
Returns
string
Defined in
turkishLocaleCompare
▸ turkishLocaleCompare(a
, b
): number
Parameters
Name | Type |
---|---|
a |
string |
b |
string |
Returns
number
Defined in
turkishLocaleToUpper
▸ turkishLocaleToUpper(a
): string
Parameters
Name | Type |
---|---|
a |
string |
Returns
string
Defined in
validateForm
▸ validateForm(form
, opt
): JQueryValidation.Validator
Parameters
Name | Type |
---|---|
form |
JQuery |
opt |
ValidationOptions |
Returns
JQueryValidation.Validator
Defined in
validateOptions
▸ validateOptions(options?
): ValidationOptions
Parameters
Name | Type |
---|---|
options? |
ValidationOptions |
Returns
ValidationOptions
Defined in
validatorAbortHandler
▸ validatorAbortHandler(validator
): void
Parameters
Name | Type |
---|---|
validator |
any |
Returns
void
Defined in
warning
▸ warning(message
, options?
): void
Obsolete
use warningDialog
Parameters
Name | Type |
---|---|
message |
string |
options? |
AlertOptions |
Returns
void
Defined in
warningDialog
▸ warningDialog(message
, options?
): void
Display a warning dialog
See
AlertOptions
Example
warningDialog("Something is odd!");
Parameters
Name | Type | Description |
---|---|---|
message |
string |
The message to display |
options? |
AlertOptions |
Additional options. |
Returns
void
Defined in
zeroPad
▸ zeroPad(n
, len
): string
Pads the start of string to make it the specified length.
Parameters
Name | Type | Description |
---|---|---|
n |
number |
- |
len |
number |
Target length of the string. |
Returns
string