3.9 KiB
Property
Properties
idString Property id, eg.my-property-id.propertyString Related CSS property name, eg.text-align.defaultString Defaul value of the property.labelString Label to use in UI, eg.Text Align.onChangeFunction? Change callback.onChange: ({ property, from, to }) => { console.log(`Changed property`, property.getName(), { from, to }); }
getId
Get property id.
Returns String
getType
Get the property type.
The type of the property is defined on property creation and based on its value the proper Property class is assigned.
The default type is base.
Returns String
getName
Get name (the CSS property name).
Returns String
getLabel
Get property label.
Parameters
-
optsObject Options (optional, default{})opts.localeBoolean Use the locale string from i18n module (optional, defaulttrue)
Returns String
getValue
Get property value.
Parameters
-
optsObject Options (optional, default{})opts.noDefaultBoolean Avoid returning the default value (optional, defaultfalse)
Returns String
hasValue
Check if the property has value.
Parameters
-
optsObject Options (optional, default{})opts.noParentBoolean Ignore the value if it comes from the parent target. (optional, defaultfalse)
Returns Boolean
hasValueParent
Indicates if the current value is coming from a parent target (eg. another CSSRule).
Returns Boolean
getStyle
Get the CSS style object of the property.
Parameters
-
optsObject Options (optional, default{})opts.camelCaseBoolean? Return property name in camelCase.
Examples
// In case the property is `color` with a value of `red`.
console.log(property.getStyle());
// { color: 'red' };
Returns Object
getDefaultValue
Get the default value.
Returns string
upValue
Update the value. The change is also propagated to the selected targets (eg. CSS rule).
Parameters
isVisible
Check if the property is visible
Returns Boolean
clear
Clear the value. The change is also propagated to the selected targets (eg. the css property is cleared).
Parameters
-
optsObject Options (optional, default{})opts.noTargetBoolean Iftruethe change won't be propagated to selected targets. (optional, defaultfalse)
canClear
Indicates if the current value comes directly from the selected target and so can be cleared.
Returns Boolean
getParent
If the current property is a sub-property, this will return the parent Property.
Returns ([Property] | null)
isFull
Indicates if the property is full-width in UI.
Returns Boolean