regexper-static/src/js/parser/javascript/charset.js

33 lines
672 B
JavaScript
Raw Normal View History

import _ from 'lodash';
import Q from 'q';
import Base from './base.js';
export default _.extend({}, Base, {
2014-12-07 22:38:24 +00:00
type: 'charset',
_render() {
var partContainer;
2014-12-07 22:38:24 +00:00
this.renderLabeledBox(this.invert() ? 'None of:' : 'One of:');
2014-12-07 22:38:24 +00:00
partContainer = this.container.group();
2014-12-07 22:38:24 +00:00
return Q.all(_.map(this.parts.elements, part => {
return part.render(partContainer.group());
}))
.then((() => {
this.spaceVertically(this.parts.elements, {
padding: 5
});
2014-12-07 22:38:24 +00:00
this.positionLabeledBox(partContainer, {
padding: 5
});
}).bind(this));
2014-12-07 22:38:24 +00:00
},
invert() {
return this._invert.textValue !== '';
}
});