UNPKG

ember-ui-components

Version:

A collection of common user interface components

82 lines (64 loc) 1.4 kB
/** @module ember-ui-components */ import Component from '@ember/component'; import { computed } from '@ember/object'; import layout from '../templates/components/uic-form-element'; /** # FormElementComponent The foillowing markup will render an input element. ``` {{uic-form-element value=value label="Property name"}} ``` To use a custom element, provide a template block. ``` {{#uic-form-element value=value label="Property name"}} ... custom element ... {{/uic-form-element}} ``` @class FormElementComponent @namespace Components */ export default Component.extend({ layout, classNames: ['uic-form-element'], classNameBindings: ['disabled', 'readonly'], /** @property readonly @type {Boolean} */ /** @property disabled @type {Boolean} */ /** @property formElementId @type {String} */ /** @property _formElementId @type {String} @private */ _formElementId: computed('formElementId', 'elementId', function () { let formElementId = this.get('formElementId'); if (!formElementId) { formElementId = 'uic-form-element-' + this.get('elementId'); } return formElementId; }), /** @property _params @type {Object} @private */ _params: computed('_formElementId', function () { return { id: this.get('_formElementId') }; }) });