mirror of https://github.com/artf/grapesjs.git
nocodeframeworkdrag-and-dropsite-buildersite-generatortemplate-builderui-builderweb-builderweb-builder-frameworkwebsite-builderno-codepage-builder
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
653 B
32 lines
653 B
import { Model } from '../../common';
|
|
|
|
/**
|
|
* @typedef State
|
|
* @property {String} name State name, eg. `hover`, `nth-of-type(2n)`
|
|
* @property {String} label State label, eg. `Hover`, `Even/Odd`
|
|
*/
|
|
export default class State extends Model {
|
|
defaults() {
|
|
return {
|
|
name: '',
|
|
label: '',
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Get state name
|
|
* @returns {String}
|
|
*/
|
|
getName(): string {
|
|
return this.get('name');
|
|
}
|
|
|
|
/**
|
|
* Get state label. If label was not provided, the name will be returned.
|
|
* @returns {String}
|
|
*/
|
|
getLabel(): string {
|
|
return this.get('label') || this.getName();
|
|
}
|
|
}
|
|
State.prototype.idAttribute = 'name';
|
|
|