Slider

Definition

<cst-slider>
<sub-theme/>
<sub-font/>
<sub-style/>
<sub-access/>
<sub-item/>
<sub-item/>
<sub-lr-icon/>
<sub-lr-label/>
<sub-options />
<sub-help-icon/>
<sub-feature-flag/>
</cst-slider>

OR

<cst-element name="slider" schema="" schema-prop="" value=""/>

Example

<cst-slider id="" value="">
<sub-theme name="" clr-var1="" clr-var2=""/>
<sub-font name="" font-var1="" font-var2=""/>
<sub-style name="" width="" height=""/>
<sub-access can-view="" can-modify=""/>
<sub-item text="" id="" icon-name="" lr-icons=""/>
<sub-item text="" id="" icon-name="" lr-icons=""/>
<sub-lr-icon name="" position="" title="" link=""/>
<sub-lr-icon name="" position="" title="" link=""/>
<sub-lr-label text="10" position="left"/>
<sub-lr-label text="60" position="right"/>
<sub-options items-prop="" item-text-prop="" item-id-prop=""
item-icon-name-prop="" lr-icons-prop="" />
<sub-help-icon name="" position="" title="" link="">
<sub-feature-flag allow-range="" allow-icon="" is-display-label="">
</cst-slider>

Attributes

AttributeValueDescription
idstring typeIdentifier for component.
valuestring/object typeIf allow-range is false, value = string type else value = object type
requiredboolean typeSpecifies if field must be required.
disabledboolean typeSpecifies if component should be disabled.(aurelia ext attribute)
maxnumber typeSpecifies the maximum value allowed.
minnumber typeSpecifies the minimum value allowed.
stepnumber typeSpecifies the legal number intervals.
classcst-mat-slider (default if material design)
cst-mat-slider-track-container
cst-mat-slider-track
cst-mat-slider-thumb-container
cst-mat-slider-thumb
cst-mat-slider-focus-ring
cst-mat-slider-marker
cst-mat-slider-marker-container
cst-mat-slider-discrete
Specifies class to be applied(Multiple classes can be given with space).

sub-theme

object typeSpecifies theme to be used for component.

sub-font

object typeSpecifies fonts to be used for component.

sub-style

object typeSpecifies style to be applied to component.

sub-lr-icons

array typeSpecifies icons to be displayed.

sub-lr-labels

array type

Specifies fixed text to be displayed.

sub-options

object typeSpecifies the options of the component.

sub-help-icon

object typeSpecifies help icon to be displayed.

sub-feature-flag

objectSpecifies what features to enable/disable.
otherany typeAny other info.
schemaobject type Specifies JSON schema.
schema-propstring typeSpecifies property to be used to pick schema.

Sub element attributes

sub-theme

PropertyValueDescription
nameprimary(default)/secondary/customName of the theme.
clr-labelstring typeIf custom then specific/ named color variables

sub-font

PropertyValueDescription
nameroboto (default)/customName of the font
font-textstring typeIf custom then specific/ named font variables.
font-labelstring type
font-errorstring type

sub-style

PropertyValueDescription
namematerial/skeuomorphicName of design to be used.
widthpercentage/pixels/string(x-small,small,medium,large,x-large)Gives width/any other prop value

sub-lr-icons

(a.k.a left right icons)

PropertyValueDescription
namestring typeIcon name.
positionleft/rightPosition of the icon.
titlestring typeIcon tooltip
linkstring typeLink to be opened on click of icon.

sub-lr-labels

(a.k.a left right labels)

PropertyValueDescription
textstring typeLabel text.
positionleft/rightPosition of the label.

sub-options

PropertyValueDescription
items-propstring typeProperty of item array
item-id-propstring typeProperty of item's id.
item-text-propstring typeProperty of item's text, display as label.
item-icon-propstring typeProperty of item's icon which will displays at top center of the component
item-lr-icons-propstring typeDisplays the icons near to the item text

sub-help-icon

PropertyValueDescription
namestring typeIcon name.
positionleft/rightPosition of the icon.
titlestring typeIcon tooltip
linkstring typeLink to be opened on click.

sub-feature-flag

PropertyValueDescription
allow-rangeboolean typeSpecifies to select lower range also
allow-iconboolean typeSpecifies to display icon as per selected value if allow-range = false
is-display-labelboolean typeSpecifies to hide/show item label

Schema Examples

Full schema

Fetch appropriate based on schemaProp

let schema = {
type: "object",
required: ["feedbackId"], //= required
properties: {
feedbackId: {
type: "string",
title:"Rate Us",//= label
cstAttr: {
raw:{ //loop & add to element
disabled : true,
max: 10,
min: 0,
step: 1,
class:'outline cst-class1'
},
subStyle:{ //loop & add to element style
name: '',
width:'',
height:'',
fontSize:''
},
subLrIcons:[{
name:'',
position:'',
title:''
}],
subLrLabels: [{
text: '',
position: ''
}],
subOptions:{
itemsProp: '',
itemIdProp: '',
itemTextProp: '',
itemIconProp: '', // Display icon at top center
itemLrIconsProp: '' // Display icon near to item text
},
subHelpIcon: {
name: '',
position: '',
title:'',
link:''
},
subFeatureFlag: {
allowRange: '',
allowIcon: '',
isDisplayLabel: ''
},
subTheme:{
name:'',
clrLabel:''
},
subFont:{
name:'',
fontText:'',
fontLabel:'',
fontError:''
},
itemsSource: '', //to check in page object
itemsSourceAPI: '',
}
}
}
}
let schemaProp = 'feedbackId';
let value = '200';
let finalSchema = schemaProp ? schema.properties[schemaProp] : schema;
let data = [
{
text: '', // label of the component
items: [
{
id: '',
text: '',
disabled: '',// To disabled particular item
iconName: '',
lrIcons:[ // Left Right icon array
{
name:'',
position:'',
title:''
}
]
}
]
}
]

Exact schema

let schema = {
type: "number",
title: "Region", //= label
cstAttr: {
}
}
let schemaProp = '';
let value = '200';
let finalSchema = schemaProp ? schema.properties[schemaProp] : schema;

Nested object

Nested object schemaProp

let schema = {};
let schemaProp = 'EMDDetails.feedbackId';
let value = '200';
var finalSchema = schema;
let schemaPropSplits = schemaProp.split('.');
for(let prop of schemaPropSplits){
finalSchema = finalSchema.properties[schemaProp];
}

Material Measurement Guidelines

Continuous sliders

  • height = 2px
  • thumb-height and width = 12px

SLIDER

Discrete sliders

  • height = 2px
  • thumb-height and width = 12px
  • section width = 2px

SLIDER DISCRETE

Image with Icon and Label

SLIDER ICON LABEL

Events

AttributeDescription
onchangeFires when the element's value changes.
onendFires when the item selects.
oninvalidScript to be run when an element is invalid.
onresetFires when reset button is clicked.
onvalidateCustom validate hook, must return error message else considered valid; will be called onchange.

Event Method signature

method(parentRefObj, evtObj, elm, others)

Parameters description

ParameterValueDescription
parentRefObj
parentRefObj = {
parentContext,
loopParentContext,
doubleLoopParentContext
}
Parent Context references
evtObjobjectEvent object
elmobjectElement value
othersanyOther value

Features

  • Displays slider to get or set item.
  • Can change the value
  • Default min limit is first value of the component.
  • If allowRange is true, user can set lower and upper limit
  • If allowIcon is true, user can see the icon as per value(if passed, display that icon or lest default icons will be display)