Class: ControlBase

(abstract) Help4.jscore.ControlBase(paramsopt, classConfigopt, isDerivedopt)

UI controls base class

Constructor

(abstract) new ControlBase(paramsopt, classConfigopt, isDerivedopt)

Parameters:
Name Type Attributes Default Description
params Object <optional>
classConfig Help4.jscore.ControlBase.Params <optional>
isDerived boolean <optional>
false
Properties:
Name Type Description
____classConfig Help4.jscore.ControlBase.ClassConfig class configuration
dataFunctions Help4.jscore.DataFunctions.Embedded
Source:

Extends

Members

(static) TEXT_TYPES :Help4.jscore.ControlBase.TextTypes

Type:
Source:

(static) TYPES :Help4.jscore.ControlBase.Types

Type:
Source:

Methods

(protected) ____defineDataFunctions()

Source:

(protected) ____defineProperties(params, derivedopt, nullable)

Parameters:
Name Type Attributes Default Description
params Object
derived Object <optional>
<nullable>
null
Properties
Name Type Description
GET Object
SET Object
Source:

(protected) ____defineProperty(args)

Parameters:
Name Type Description
args Object
Properties
Name Type Attributes Default Description
type string <optional>
'param' for Help4.jscore.DataBase
key string
info Help4.jscore.ControlBase.Param
funGet Help4.jscore.ControlBase.FunGet
funSet Help4.jscore.ControlBase.FunSet
Source:

(protected) ____defineStaticProperties()

auto define all to be cleaned properties
Overrides:
Source:
Throws:
Error

(protected) ____extendParams(dest, src) → {Object}

Parameters:
Name Type Description
dest Object
src Object
Source:
Returns:
Type
Object

(protected) ____getClassConfig() → {Help4.jscore.Base.Params}

Overrides:
Source:
Returns:
Type
Help4.jscore.Base.Params

(protected) ____getData() → {Object}

Source:
Returns:
Type
Object

(protected) ____mergeDerivedParam(level0, type, value)

Parameters:
Name Type Description
level0 Help4.jscore.ControlBase.Params
type string
value *
Overrides:
Source:
Throws:
Error

(protected) ____mergeDerivedParams(level0, level1)

Parameters:
Name Type Description
level0 Help4.jscore.Base.Params
level1 Help4.jscore.Base.Params
Overrides:
Source:
Throws:
Error

(protected) ____resolveDerivedParams(classConfig)

Parameters:
Name Type Description
classConfig Help4.jscore.Base.Params
Overrides:
Source:

(protected) ____setInitValue(args)

Parameters:
Name Type Description
args Object
Properties
Name Type Description
key string
info Help4.jscore.ControlBase.Param
params Object
funSet Help4.jscore.ControlBase.FunSet
Source:

(protected) _destroyControl(…keys)

destroys class properties
Parameters:
Name Type Attributes Description
keys string <repeatable>
Overrides:
Source:

(protected) _fireEvent(event) → {Help4.jscore.Base}

fires an event that can be observed from outside
Parameters:
Name Type Description
event Object the event to be fired
Overrides:
Source:
Returns:
Type
Help4.jscore.Base

(async, protected) _fireEvent2(event) → {Promise.<Array.<Help4.EmbeddedEvent.EventResponse>>}

fires an event that can be observed from outside
Parameters:
Name Type Description
event Object the event to be fired
Overrides:
Source:
Returns:
Type
Promise.<Array.<Help4.EmbeddedEvent.EventResponse>>

(protected) _fireEventSync(event) → {Array.<Help4.EmbeddedEvent.EventResponse>}

fires an event that can be observed from outside
Parameters:
Name Type Description
event Object the event to be fired
Overrides:
Source:
Returns:
Type
Array.<Help4.EmbeddedEvent.EventResponse>

addListener(eventType, listener) → {Help4.jscore.ControlBase}

add an event listener
Parameters:
Name Type Description
eventType string | Array.<string> event type to be observed
listener Help4.EmbeddedEvent.Listener the callback function
Overrides:
Source:
Returns:
Type
Help4.jscore.ControlBase

addListenerSync(eventType, listener) → {Help4.jscore.Base}

add an event listener
Parameters:
Name Type Description
eventType string | Array.<string> event type to be observed
listener Help4.EmbeddedEvent.Listener the callback function
Overrides:
Source:
Returns:
Type
Help4.jscore.Base

destroy()

destroys this instance
Overrides:
Source:

isDestroyed() → {boolean}

whether instance is destroyed
Overrides:
Source:
Returns:
Type
boolean

removeListener(eventType, listener) → {Help4.jscore.ControlBase}

remove an event listener
Parameters:
Name Type Description
eventType string | Array.<string>
listener Help4.EmbeddedEvent.Listener
Overrides:
Source:
Returns:
Type
Help4.jscore.ControlBase

(static) addDataType(name, setter, getter, equals)

register a new data type with setter, getter, equals
Parameters:
Name Type Description
name string the data type name; see Help4.jscore.ControlBase.Types
setter Help4.jscore.ControlBase.FunSet setter function
getter Help4.jscore.ControlBase.FunGet getter function
equals Help4.jscore.ControlBase.FunEquals equals function
Source:

(static) addTextType(name, contentType, setter, getter)

register a new text type with setter, getter
Parameters:
Name Type Description
name string text type
contentType string content type for this text; see Help4.jscore.ControlBase.TextTypes
setter Help4.jscore.ControlBase.FunTextSet setter function
getter Help4.jscore.ControlBase.FunTextGet getter function
Source:

Type Definitions

ClassConfig

Type:
Properties:
Name Type Attributes Description
params Object <optional>
<nullable>
dynamic class params; each is of type Help4.jscore.ControlBase.Param
_param_keys Array.<string> keys of all dynamic class params
_dataChangeListener function for simplified dynamic param change monitoring
_data Object
Source:

Config

additional class configuration
Type:
  • Object
Properties:
Name Type Attributes Description
css string <optional>
css classes of this control
onPropertyChange Help4.jscore.ControlBase.OnPropertyChange <optional>
sync listener for property change events
Source:

FunEquals(value1, value2) → {boolean}

the function to compare defined properties
Parameters:
Name Type Description
value1 *
value2 *
Source:
Returns:
whether both values are equal
Type
boolean

FunGet(data, name) → {*}

the function to get defined properties
Parameters:
Name Type Description
data Object the data source
name string the attribute name
Source:
Returns:
the value for data[name]
Type
*

FunSet(data, name, value, defopt) → {boolean|undefined}

the function to set defined properties
Parameters:
Name Type Attributes Description
data Object the data source
name string the attribute name
value * the value to be stored in data[name]
def * <optional>
default value; internal use only
Source:
Returns:
whether data has been modified
Type
boolean | undefined

FunTextGet(element) → {string}

the function to get texts from the DOM
Parameters:
Name Type Description
element HTMLElement the HTML element
Source:
Returns:
the text of that element
Type
string

FunTextSet(element, text) → {boolean}

the function to set texts to the DOM
Parameters:
Name Type Description
element HTMLElement the HTML element
text string the to-be-applied text
Source:
Returns:
Type
boolean

OnPropertyChange(event)

the function that is called on property change
Parameters:
Name Type Description
event Help4.jscore.ControlBase.PropertyChangeEvent the change event
Source:

Param

the configuration of one parameter: - accessible like attributes w/o using getter and setter functions; - internally and externally accessible via .; - will provide high performance auto-clone to prevent copy-by-reference issues; - will provide on update notification in case a value changes
Type:
  • Object
Properties:
Name Type Attributes Default Description
type Help4.jscore.ControlBase.Types the property type
init * <optional>
the init value
readonly boolean <optional>
false whether the property is readonly
mandatory boolean <optional>
false whether the property must be defined while class instantiation
private boolean <optional>
false whether the property is meant to be publicly accessible
Source:

Params

the class configuration
Type:
Properties:
Name Type Attributes Description
params Object <optional>
<nullable>
class parameters; each is of type Help4.jscore.ControlBase.Param
config Help4.jscore.ControlBase.Config <optional>
class configuration
texts Object <optional>
class text configuration: <id>: Help4.jscore.ControlBase.TextTypes
dataFunctions Object <optional>
can be used to override dataFunctions with custom functionality
Source:

PropertyChangeEvent

the property change event
Type:
  • Object
Properties:
Name Type Attributes Description
target Help4.jscore.ControlBase | Array.<Help4.jscore.ControlBase> <optional>
the control (chain) responsible for the value change
name string the property name
value * new value of the property
oldValue * <optional>
old value of the property
Source:

TextTypes

all text types currently available
Type:
  • Object
Properties:
Name Type Description
innerText 'innerText' node.innerText
innerHTML 'innerHTML' node.innerHTML
title 'title' node.title
placeholder 'placeholder' node.placeholder
alt 'alt' image.getAttribute('alt')
Source:

Types

all param types currently available
Type:
  • Object
Properties:
Name Type Description
atomic 'atomic' atomic data type
array 'array' array data type
array_null 'array_null' array that can be null
boolean 'boolean' boolean data type
boolean_null 'boolean_null' boolean that can be null
dataContainer 'dataContainer' data container data type
string 'string' string
string_null 'string_null' string that can be null
number 'number' number data type
number_null 'number_null' number that can be null
element 'element' element data type
instance 'instance' any instance
instanceArray 'instanceArray' an array of instances
json 'json' json data type
json_null 'json_null' json that can be null
leftTop 'leftTop' {left: number, top: number}
leftTop_null 'leftTop_null' {left: number, top: number} | null
object 'object' any object
object_null 'object_null' objects that can be null
widthHeight 'widthHeight' {width: number, height: number}
widthHeight_null 'widthHeight_null' {width: number, height: number} | null
wh 'wh' {w: number, h: number}
wh_null 'wh_null' {w: number, h: number} | null
xy 'xy' {x: number, y: number}
xy_null 'xy_null' {x: number, y: number} | null
xywh 'xywh' {x: number, y: number, w: number, h: number}
xywh_null 'xywh_null' {x: number, y: number, w: number, h: number} | null
Source: