Sha256: 1f73f2baa09f2a2b318126602d7ea4c744ef18278fdb6f3236a4284d11f36a9b
Contents?: true
Size: 1.57 KB
Versions: 12
Compression:
Stored size: 1.57 KB
Contents
{ I" metadata:ET{I"modules; T{I"imports; T[ I"exports; T{I" exported; T[ I"specifiers; T[ I"usedHelpers; T[ I"ignored; TFI" code; TI"'use strict'; Rev.registerMixin('ModelInputMixin', { componentDidMount: function componentDidMount() { this.props.model.set(this.props.field, this.defaultValue()); }, defaultValue: function defaultValue() { return this.props.defaultValue || this.value(); }, value: function value() { return this.props.model && this.props.model.get && this.props.model.get(this.props.field); }, klass: function klass() { return _.str.underscored(this.props.model.constructor.name); }, name: function name() { return this.props.name || (this.props.baseName || this.klass()) + '[' + this.props.field + ']'; }, isCheckbox: function isCheckbox() { return this.props.type === 'checkbox'; }, onFieldChange: function onFieldChange(e) { var value = e.target[this.isCheckbox() ? 'checked' : 'value']; this.props.model.set(this.props.field, value); if (this.props.onChange) { this.props.onChange(e); } }, onBlur: function onBlur(_e) { var validator = this.props.model['validate' + _.str.classify(this.props.field)]; if (validator) { var error = validator.bind(this.props.model)(); if (error) { var errors = {}; errors[this.props.field] = [error]; var response = { responseJSON: { errors: errors } }; this.props.model.trigger('error', this.props.model, response, {}); } } } });; TI"ast; T0I"map; T0
Version data entries
12 entries across 12 versions & 1 rubygems