renderRowSpan = function (input, options) { var el = makeElement.bind(input.document) , id = getId.call(input.control || input.dom); return el('tr', // label el('td', { colspan: 2 }, el('p', el('label', { for: id }, options.label ? ':' : '')), // input el('div', input, el('span', { class: 'statuses' }, // required mark el('span', { class: 'status-missing' }, '★'), // validation status mark el('span', { class: 'status-ok' }, '✓'), el('span', { class: 'status-error' }, '✕')), // error message el('span', { class: 'error-message error-message-' + input._name.replace(/[:#]/g, '-') }), // hint options.hint && el('p', { class: 'hint' }, options.hint)))); };
renderRow = function (input, options) { var el = makeElement.bind(input.document) , id = getId.call(input.control || input.dom); return el('tr', // label el('th', el('label', { for: id }, options.label, options.label ? ':' : '')), // input el('td', input, // required mark el('span', { class: 'statuses' }, (options.missingStatus !== false) ? el('span', { class: 'status-missing' }, '★') : null, // validation status mark (options.okStatus !== false) ? el('span', { class: 'status-ok' }, '✓') : null, (options.errorStatus !== false) ? el('span', { class: 'status-error' }, '✕') : null), // error message el('span', { class: 'error-message error-message-' + input._name.replace(/[:#\/]/g, '-') }), // hint options.hint && el('p', { class: 'hint' }, options.hint))); };
var Input = function (document, type/*, options*/) { var options = arguments[2], action, descriptor; this.make = makeEl.bind(document); this.controls = []; this.type = type; options = resolveOptions(options, type); if (options.multiple) this.multiple = true; ((options.render == null) || callable(options.render)); defineProperty(this, 'renderItem', d((options.renderItem == null) ? renderItem : callable(options.renderItem))); DOMInput.call(this, document, type, options); if (this.multiple) this.control.setAttribute('multiple', 'multiple'); if (this.observable) descriptor = this.observable.descriptor; this.control.setAttribute('accept', (descriptor && descriptor.accept) || toArray(type.accept).join(',')); if (options.autoSubmit != null) { action = options.autoSubmit; this.dom.classList.add('auto-submit'); this.on('change', function () { var form, parent, sibling; if (!this.changed) return; form = getTempForm(document); parent = this.dom.parentNode; sibling = this.dom.nextSibling; form.setAttribute('action', action); document.body.appendChild(form); form.appendChild(this.dom); dispatchEvnt.call(form, 'submit'); parent.insertBefore(this.dom, sibling); if (form.parentNode) form.parentNode.removeChild(form); }); } if (this._required) this.castControlAttribute('required', true); this.valueDOM.addEventListener('change', this.onChange, false); };
render: d(function () { var el = makeElement.bind(this.document); this.dom = el('fieldset', el('table', this.domItems = el('tbody'))); }),