addon/components/bsy-input.js in bootstrap-bookingsync-sass-1.0.5 vs addon/components/bsy-input.js in bootstrap-bookingsync-sass-2.0.0
- old
+ new
@@ -1,31 +1,39 @@
import Ember from 'ember';
+import Component from '@ember/component';
+import { computed } from '@ember/object';
import layout from '../templates/components/bsy-input';
-const { Component, computed } = Ember;
+const { generateGuid } = Ember;
const BsyInputComponent = Component.extend({
layout,
- tagName: "div",
- classNames: "form-group",
- type: "text",
- classNameBindings: ["value:filled", "icon:has-icon"],
+ tagName: 'div',
+ classNames: 'form-group',
+ type: 'text',
+ readonly: false,
+ placeholder: '',
+ disabled: false,
+ classNameBindings: ['value:filled', 'icon:has-icon', 'formGroupSize'],
size: null, // sm, lg
- inputClassNames: computed('size', function () {
- const size = this.get('size');
- if (size) {
- return `form-control input-${size}`;
- }
- return "form-control";
+ inputClassNames: computed('size', function() {
+ return this.size ? `form-control input-${this.size}` : 'form-control';
}),
- iconSize: computed('size', function () {
- const size = this.get('size');
- if (size) {
- return `icon--${size}`;
- }
- })
+ iconSize: computed('size', function() {
+ return this.size ? `icon--${this.size}` : '';
+ }),
+
+ formGroupSize: computed('size', function() {
+ return this.size ? `form-group--${this.size}` : '';
+ }),
+
+ inputId: computed(function() {
+ return generateGuid();
+ }),
+
+ update() {}
});
BsyInputComponent.reopenClass({
positionalParams: ['value']
});