new (require("nmodule/webEditors/rc/fe/baja/BaseEditor"))(paramsopt)
- Description:
Base class for all
webEditorseditors for Baja values. This editor
incorporates all theWidgetsugar fromBaseWidgetand adds more
Baja-specific features on top. Most Niagara field editors should extend
from this class.
- Source:
Extends:
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
<optional> |
Same parameters as Properties
|
Extends
Methods
destroy() → {Promise}
- Description:
Removes all classes added during a call to #load. Emits a
destroyedtinyevent.
- Source:
- Overrides:
Returns:
call to module:bajaux/Widget#destroy
- Type
- Promise
getChildEditors(paramsopt)
- Description:
Same as
getChildWidgets, but is limited to instances ofBaseEditor.
- Source:
- Deprecated:
- use `getChildWidgets` instead.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
params |
Object |
<optional> |
initialize(dom) → {Promise}
- Description:
Every
BaseWidgetwill add theeditorclass to the element and emit an
initializedtinyevent when initialized.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
dom |
JQuery |
Returns:
call to module:bajaux/Widget#initialize
- Type
- Promise
load(value, paramsopt) → {Promise}
- Description:
Every
BaseEditorwill apply a number of CSS classes to a DOM element
when a value is loaded into it:editor- If the loaded value is a Baja value, a number of CSS classes
corresponding to the value's Type and all superTypes. Classes will be
determined using typeToClass().
It will also emit a
loadedtinyevent.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
value |
baja.Value | * | ||
params |
Object |
<optional> |
Returns:
call to module:bajaux/Widget#load
- Type
- Promise
setFacets(facets)
- Description:
Convert the given Facets into hidden, transient
bajaux Propertiesand
apply them to this editor. In most cases you'll want to use
properties().setValue()directly, but this method is useful when
applyingComplexslot facets.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
facets |
baja.Facets | Object | (a |
shouldValidate(flagopt) → {Boolean}
- Description:
This provides an extra hook for an editor to declare itself as needing to
be validated before saving or not. The default behavior is to return true
if this editor is modified, or if ashouldValidatebajauxProperty
is present and truthy. If neither of these conditions is true, it will
check all known child editors, and return true if it has a child editor
that should validate.If
flagis given, then the check against theshouldValidate
Propertywill return true only if the value bitwise matches the
parameter. SeeBaseWidget.SHOULD_VALIDATE_ON_SAVE, etc.
- Source:
- Inherited From:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
flag |
Number |
<optional> |
Returns:
- Type
- Boolean
(static) typeToClass(type) → {String}
- Description:
Convert a BajaScript Type to a corresponding CSS class.
- Source:
Example
expect(BaseEditor.typeToClass('baja:String')).toBe('type-baja-String');
Parameters:
| Name | Type | Description |
|---|---|---|
type |
String | Type | spec |
Returns:
- Type
- String