Class

Rating

kiss.ui.Rating(config)

The Rating derives from Component.

Provides a rating field.

Constructor

# new Rating(config)

Its a Custom Web Component. Do not use the constructor directly with the new keyword. Instead, use one of the 3 following methods:

Create the Web Component and call its init method:

const myRating = document.createElement("a-rating").init(config)

Or use the shorthand for it:

const myRating = createRating({
 label: "Rate me!",
 max: 5,
 iconColorOn: "#00aaee",
 iconColorOff: "#dddddd"
})

myRating.render()

Or directly declare the config inside a container component:

const myPanel = createPanel({
 title: "My panel",
 items: [
     {
         type: "rating",
         label: "Rate me!",
         max: 5
     }
 ]
})
myPanel.render()
Parameters:
Name Type Attributes Description
config object
label string
max number <optional>

From 1 to 10

value number <optional>

Default value

labelWidth string <optional>
labelPosition string <optional>

left | right | top | bottom

labelAlign string <optional>

left | right

labelFontSize string <optional>

Any valid CSS value

labelFontWeight string <optional>

Any valid CSS value

labelColor string <optional>

Any valid CSS value

fontSize string <optional>
shape string <optional>

star | heart | thumb

iconSize string <optional>
iconColorOn string <optional>
iconColorOff string <optional>
formula string <optional>
width string | number <optional>
height string | number <optional>
margin string <optional>
padding string <optional>
readOnly boolean <optional>
disabled boolean <optional>
record object <optional>

The record to bind the field to. This will automatically update the record when the field value changes, and the field will listen to database changes on the record.

View Source client/ui/fields/rating.js, line 46

this

Generated markup

<a-rating class="a-rating">
 <label class="field-label"></label>
 <span class="field-rating">
     <span class="rating" index="1">
     <span class="rating" index="2">
     <span class="rating" index="3">
     <span class="rating" index="4">
     <span class="rating" index="5">
 </span>
</a-rating>

Methods

# clearValue()

Clear the field value

View Source client/ui/fields/rating.js, line 312

this

# getIconClasses() → {object}

Get the icon classes for each checkbox shape

View Source client/ui/fields/rating.js, line 191

object

# getLabel() → {string}

Get the field label

View Source client/ui/fields/rating.js, line 390

string

# getLabelPosition() → {string}

Get the label position

View Source client/ui/fields/rating.js, line 449

"left" | "right" | "top"

string

# getValue() → {number}

Get the field value

View Source client/ui/fields/rating.js, line 339

  • The field value
number

# setFieldWidth(width)

Set the input field width

Parameters:
Name Type Description
width *

View Source client/ui/fields/rating.js, line 426

this

# setInvalid()

Change the style when the field is invalid

View Source client/ui/fields/rating.js, line 377

this

# setLabel(newLabel)

Set the field label

Parameters:
Name Type Description
newLabel string

View Source client/ui/fields/rating.js, line 400

this

# setLabelPosition(position)

Set label position

Parameters:
Name Type Description
position string

"left" (default) | "right" | "top" | "bottom"

View Source client/ui/fields/rating.js, line 459

this

# setLabelWidth(width)

Set the label width

Parameters:
Name Type Description
width *

View Source client/ui/fields/rating.js, line 438

this

# setValid()

Remove the invalid style

View Source client/ui/fields/rating.js, line 366

this

# setValue(newValue, rawUpdateopt)

Set the field value

Parameters:
Name Type Attributes Description
newValue boolean

The new field value

rawUpdate boolean <optional>

If true, it doesn't update the associated record and doesn't trigger "change" event

View Source client/ui/fields/rating.js, line 282

this

# setWidth(width)

Set the field width

Parameters:
Name Type Description
width *

View Source client/ui/fields/rating.js, line 414

this

# validate() → {boolean}

Validate the field value against validation rules

View Source client/ui/fields/rating.js, line 348

boolean
new Rating

Methods