Comparing version 3.12.0 to 3.13.0
@@ -32,3 +32,3 @@ Additional details to supplement the brief nature of the README file. | ||
* Download a .zip archive of the [latest release](http://www.fuelcdn.com/fuelux/3.11.5/fuelux.zip). | ||
* Download a .zip archive of the [latest release](http://www.fuelcdn.com/fuelux/3.12.0/fuelux.zip). | ||
@@ -43,3 +43,3 @@ ## AMD support | ||
paths: { | ||
'fuelux': 'http://www.fuelcdn.com/fuelux/3.11.5/' | ||
'fuelux': 'http://www.fuelcdn.com/fuelux/3.12.0/' | ||
//... | ||
@@ -46,0 +46,0 @@ } |
@@ -20,3 +20,3 @@ /* | ||
// Node/CommonJS | ||
module.exports = factory(require('jquery')); | ||
module.exports = factory(require('jquery'), require('./loader')); | ||
} else { | ||
@@ -23,0 +23,0 @@ // OR use browser globals if AMD is not present |
@@ -20,3 +20,3 @@ /* | ||
// Node/CommonJS | ||
module.exports = factory(require('jquery')); | ||
module.exports = factory(require('jquery'), require('./dropdown-autoflip')); | ||
} else { | ||
@@ -23,0 +23,0 @@ // OR use browser globals if AMD is not present |
@@ -55,6 +55,9 @@ /* | ||
if (this.options.revertOnCancel === -1) { | ||
this.options.revertOnCancel = (this.$accept.length > 0) ? true : false; | ||
this.options.revertOnCancel = (this.$accept.length > 0); | ||
} | ||
// Placard supports inputs, textareas, or contenteditable divs. These checks determine which is being used | ||
this.isContentEditableDiv = this.$field.is('div'); | ||
this.isInput = this.$field.is('input'); | ||
this.divInTextareaMode = (this.isContentEditableDiv && this.$field.attr('data-textarea') === 'true'); | ||
@@ -73,6 +76,3 @@ this.$field.on('focus.fu.placard', $.proxy(this.show, this)); | ||
var _isShown = function _isShown(placard) { | ||
if (placard.$element.hasClass('showing')) { | ||
return true; | ||
} | ||
return false; | ||
return placard.$element.hasClass('showing'); | ||
}; | ||
@@ -120,3 +120,3 @@ | ||
keyComplete: function keyComplete(e) { | ||
if (this.isInput && e.keyCode === 13) { | ||
if (((this.isContentEditableDiv && !this.divInTextareaMode) || this.isInput) && e.keyCode === 13) { | ||
this.complete('accepted'); | ||
@@ -134,3 +134,3 @@ this.$field.blur(); | ||
$(document).off('click.fu.placard.externalClick.' + this.clickStamp); | ||
// set input value attrbute | ||
// set input value attribute | ||
this.$element.find('input').each(function () { | ||
@@ -148,2 +148,5 @@ $(this).attr('value', $(this).val()); | ||
this.$field.attr('disabled', 'disabled'); | ||
if (this.isContentEditableDiv) { | ||
this.$field.removeAttr('contenteditable'); | ||
} | ||
this.hide(); | ||
@@ -156,3 +159,3 @@ }, | ||
field = this.$field.get(0); | ||
if (this.$field.is('input')) { | ||
if ((this.isContentEditableDiv && !this.divInTextareaMode) || this.isInput) { | ||
field.scrollLeft = 0; | ||
@@ -174,3 +177,2 @@ } else { | ||
} | ||
} | ||
@@ -184,2 +186,5 @@ | ||
this.$field.removeAttr('disabled'); | ||
if (this.isContentEditableDiv) { | ||
this.$field.attr('contenteditable', 'true'); | ||
} | ||
}, | ||
@@ -196,2 +201,4 @@ | ||
return this.actualValue; | ||
} else if (this.isContentEditableDiv) { | ||
return this.$field.html(); | ||
} else { | ||
@@ -247,7 +254,11 @@ return this.$field.val(); | ||
//if suppressEllipsis is undefined, check placards init settings | ||
if(typeof suppressEllipsis === "undefined"){ | ||
if (typeof suppressEllipsis === 'undefined') { | ||
suppressEllipsis = !this.options.applyEllipsis; | ||
} | ||
this.$field.val(val); | ||
if (this.isContentEditableDiv) { | ||
this.$field.empty().append(val); | ||
} else { | ||
this.$field.val(val); | ||
} | ||
@@ -262,9 +273,9 @@ if (!suppressEllipsis && !_isShown(this)) { | ||
show: function show() { | ||
if(_isShown(this)){return;} | ||
if(!_closeOtherPlacards()){return;} | ||
if (_isShown(this)) { return; } | ||
if (!_closeOtherPlacards()) { return; } | ||
this.previousValue = this.$field.val(); | ||
this.previousValue = (this.isContentEditableDiv) ? this.$field.html() : this.$field.val(); | ||
if (this.actualValue !== null) { | ||
this.setValue(this.actualValue); | ||
this.setValue(this.actualValue, true); | ||
this.actualValue = null; | ||
@@ -271,0 +282,0 @@ } |
@@ -17,6 +17,6 @@ /* | ||
// if AMD loader is available, register as an anonymous module. | ||
define(['jquery', 'fuelux/repeater'], factory); | ||
define(['jquery', 'fuelux/repeater', 'fuelux/checkbox'], factory); | ||
} else if (typeof exports === 'object') { | ||
// Node/CommonJS | ||
module.exports = factory(require('jquery')); | ||
module.exports = factory(require('jquery'), require('./repeater'), require('./checkbox')); | ||
} else { | ||
@@ -83,3 +83,3 @@ // OR use browser globals if AMD is not present | ||
var self = this; | ||
var data, i, $item, l; | ||
var data, i, $item, length; | ||
@@ -118,10 +118,10 @@ //this function is necessary because lint yells when a function is in a loop | ||
if (force === true || selectable === 'multi') { | ||
l = items.length; | ||
length = items.length; | ||
} else if (selectable) { | ||
l = (items.length > 0) ? 1 : 0; | ||
length = (items.length > 0) ? 1 : 0; | ||
} else { | ||
l = 0; | ||
length = 0; | ||
} | ||
for (i = 0; i < l; i++) { | ||
for (i = 0; i < length; i++) { | ||
if (items[i].index !== undefined) { | ||
@@ -143,7 +143,6 @@ $item = this.$canvas.find('.repeater-list table tbody tr:nth-child(' + (items[i].index + 1) + ')'); | ||
$table.find('thead th').each(function () { | ||
var $hr = $(this); | ||
var $heading = $hr.find('.repeater-list-heading'); | ||
$heading.outerHeight($hr.outerHeight()); | ||
// outerWidth isn't always appropriate or desirable. Allow an explicit value to be set if needed | ||
$heading.outerWidth($heading.data('forced-width') || $hr.outerWidth()); | ||
var $th = $(this); | ||
var $heading = $th.find('.repeater-list-heading'); | ||
$heading.css({ height: $th.outerHeight() }); | ||
$heading.outerWidth($heading.data('forced-width') || $th.outerWidth()); | ||
}); | ||
@@ -183,9 +182,4 @@ }; | ||
this.$element.find('.repeater-list table.table-frozen tr').each(function (i, elem) { | ||
$(this).height($table.find('tr:eq(' + i + ')').height()); | ||
}); | ||
this.list_sizeFrozenColumns(); | ||
var columnWidth = $table.find('td:eq(0)').outerWidth(); | ||
this.$element.find('.frozen-column-wrapper, .frozen-thead-wrapper').width(columnWidth); | ||
$('.frozen-thead-wrapper .repeater-list-heading').on('click', function() { | ||
@@ -227,2 +221,3 @@ var index = $(this).parent('th').index(); | ||
if (actionsEnabled && shouldScroll) { | ||
$wrapper.find('.actions-thead-wrapper').css('right', -scrollLeft); | ||
$wrapper.find('.actions-column-wrapper').css('right', -scrollLeft); | ||
@@ -237,2 +232,3 @@ } | ||
if (actionsEnabled) { | ||
$wrapper.find('.actions-thead-wrapper').css('right', '0'); | ||
$wrapper.find('.actions-column-wrapper').css('right', '0'); | ||
@@ -246,7 +242,7 @@ } | ||
var self = this; | ||
var i, l; | ||
var i, length; | ||
var $table = this.$element.find('.repeater-list .repeater-list-wrapper > table'); | ||
var $actionsTable = this.$canvas.find('.table-actions'); | ||
for (i = 0, l = this.viewOptions.list_actions.items.length; i < l; i++) { | ||
for (i = 0, length = this.viewOptions.list_actions.items.length; i < length; i++) { | ||
var action = this.viewOptions.list_actions.items[i]; | ||
@@ -258,13 +254,13 @@ var html = action.html; | ||
var selectlist = '<div class="btn-group">' + | ||
'<button type="button" class="btn btn-xs btn-default dropdown-toggle repeater-actions-button" data-toggle="dropdown" data-flip="auto" aria-expanded="false">' + | ||
'<span class="caret"></span>' + | ||
'</button>' + | ||
'<ul class="dropdown-menu dropdown-menu-right" role="menu">' + | ||
actionsHtml + | ||
'</ul></div>'; | ||
if ($actionsTable.length < 1) { | ||
var selectlist = '<div class="btn-group">' + | ||
'<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" data-flip="auto" aria-expanded="false">' + | ||
'<span class="caret"></span>' + | ||
'</button>' + | ||
'<ul class="dropdown-menu dropdown-menu-right" role="menu">' + | ||
actionsHtml + | ||
'</ul></div>'; | ||
// The width set here is overwritten in `list_sizeHeadings`. This is used for sizing the subsequent rows. | ||
var $actionsColumnWrapper = $('<div class="actions-column-wrapper" style="width: ' + this.list_actions_width + 'px"></div>').insertBefore($table); | ||
var $actionsColumnWrapper = $('<div class="actions-column-wrapper" style="width: '+ this.list_actions_width +'px"></div>').insertBefore($table); | ||
var $actionsColumn = $table.clone().addClass('table-actions'); | ||
@@ -279,16 +275,7 @@ $actionsColumn.find('th:not(:last-child)').remove(); | ||
$actionsColumn.find('thead .btn').attr('disabled', 'disabled'); | ||
} else { | ||
var labelText = this.viewOptions.list_actions.label || ''; | ||
var $labelOverlay = $('<div class="repeater-list-heading">' + labelText + '</div>'); | ||
// repeater-list.less:302 has `margin-left: -9px;` which shifts this over and makes it not actually cover what it is supposed to cover. Make it wider to compensate. | ||
var negative_margin_accomodation = 9; | ||
$labelOverlay.data('forced-width', this.list_actions_width + negative_margin_accomodation); | ||
var $th = $('<th>' + labelText + '</th>'); | ||
$th.append($labelOverlay); | ||
$actionsColumn.find('thead tr').addClass('empty-heading').html($th); | ||
} | ||
else { | ||
var label = this.viewOptions.list_actions.label || '<span class="actions-hidden">a</span>'; | ||
$actionsColumn.find('thead tr').addClass('empty-heading').html('<th>'+ label +'<div class="repeater-list-heading">'+ label +'</div></th>'); | ||
} | ||
@@ -308,50 +295,35 @@ // Create Actions dropdown for each cell in actions table | ||
this.$element.find('.repeater-list table.table-actions thead tr th').outerHeight($table.find('thead tr th').outerHeight()); | ||
this.$element.find('.repeater-list table.table-actions tbody tr td:first-child').each(function (i, elem) { | ||
$(this).outerHeight($table.find('tbody tr:eq(' + i + ') td').outerHeight()); | ||
}); | ||
this.list_sizeActionsTable(); | ||
//row level actions click | ||
this.$element.find('.table-actions tbody .action-item').on('click', function(e) { | ||
var actionName = $(this).data('action'); | ||
var row = $(this).data('row'); | ||
var selected = { | ||
actionName: actionName, | ||
rows: [row] | ||
}; | ||
self.list_getActionItems(selected, e); | ||
if (!self.isDisabled) { | ||
var actionName = $(this).data('action'); | ||
var row = $(this).data('row'); | ||
var selected = { | ||
actionName: actionName, | ||
rows: [row] | ||
}; | ||
self.list_getActionItems(selected, e); | ||
} | ||
}); | ||
// bulk actions click | ||
this.$element.find('.table-actions thead .action-item').on('click', function(e) { | ||
var actionName = $(this).data('action'); | ||
var selected = { | ||
actionName: actionName, | ||
rows: [] | ||
}; | ||
self.$element.find('.repeater-list-wrapper > table .selected').each(function() { | ||
var index = $(this).index(); | ||
index = index + 1; | ||
selected.rows.push(index); | ||
}); | ||
if (!self.isDisabled) { | ||
var actionName = $(this).data('action'); | ||
var selected = { | ||
actionName: actionName, | ||
rows: [] | ||
}; | ||
self.$element.find('.repeater-list-wrapper > table .selected').each(function() { | ||
var index = $(this).index(); | ||
index = index + 1; | ||
selected.rows.push(index); | ||
}); | ||
self.list_getActionItems(selected, e); | ||
self.list_getActionItems(selected, e); | ||
} | ||
}); | ||
}; | ||
/* | ||
* list_getActionItems | ||
* | ||
* Called when user clicks on an "action item". | ||
* | ||
* Object selected - object containing `actionName`, string value of the `data-action` attribute of the clicked | ||
* "action item", and `rows` Array of jQuery objects of selected rows | ||
* Object e - jQuery event of triggering event | ||
* | ||
* Calls implementor's clickAction function if provided. Passes `selectedObj`, `callback` and `e`. | ||
* Object selectedObj - Object containing jQuery object `item` for selected row, and Object `rowData` for | ||
* selected row's data-attributes, or Array of such Objects if multiple selections were made | ||
* Function callback - ¯\_(ツ)_/¯ | ||
* Object e - jQuery event object representing the triggering event | ||
*/ | ||
$.fn.repeater.Constructor.prototype.list_getActionItems = function (selected, e) { | ||
@@ -381,19 +353,29 @@ var i; | ||
$.fn.repeater.Constructor.prototype.list_sizeActionsTable = function () { | ||
var $actionsTable = this.$element.find('.repeater-list table.table-actions'); | ||
var $actionsTableHeader = $actionsTable.find('thead tr th'); | ||
var $table = this.$element.find('.repeater-list-wrapper > table'); | ||
var $actionsTableHeading = this.$element.find('.repeater-list-wrapper .actions-column-wrapper thead th .repeater-list-heading'); | ||
$actionsTableHeading.outerHeight($table.find('thead th .repeater-list-heading').outerHeight()); | ||
$actionsTableHeader.outerHeight($table.find('thead tr th').outerHeight()); | ||
$actionsTableHeader.find('.repeater-list-heading').outerHeight($actionsTableHeader.outerHeight()); | ||
$actionsTable.find('tbody tr td:first-child').each(function (i, elem) { | ||
$(this).outerHeight($table.find('tbody tr:eq(' + i + ') td').outerHeight()); | ||
}); | ||
}; | ||
$.fn.repeater.Constructor.prototype.list_sizeFrozenColumns = function () { | ||
var $table = this.$element.find('.repeater-list .repeater-list-wrapper > table'); | ||
this.$element.find('.repeater-list table.table-frozen tr').each(function (i) { | ||
$(this).height($table.find('tr:eq(' + i + ')').height()); | ||
}); | ||
var columnWidth = $table.find('td:eq(0)').outerWidth(); | ||
this.$element.find('.frozen-column-wrapper, .frozen-thead-wrapper').width(columnWidth); | ||
}; | ||
$.fn.repeater.Constructor.prototype.list_frozenOptionsInitialize = function () { | ||
var self = this; | ||
var isFrozen = this.viewOptions.list_frozenColumns; | ||
var isActions = this.viewOptions.list_actions; | ||
var isMulti = this.viewOptions.list_selectable === 'multi'; | ||
var $checkboxes = this.$element.find('.frozen-column-wrapper .checkbox-inline'); | ||
var $everyTable = this.$element.find('.repeater-list table'); | ||
var self = this; | ||
//Make sure if row is hovered that it is shown in frozen column as well | ||
@@ -415,17 +397,36 @@ this.$element.find('tr.selectable').on('mouseover mouseleave', function(e) { | ||
e.preventDefault(); | ||
var row = $(this).attr('data-row'); | ||
row = parseInt(row) + 1; | ||
self.$element.find('.repeater-list-wrapper > table tbody tr:nth-child('+ row +')').click(); | ||
if (!self.list_revertingCheckbox) { | ||
if (self.isDisabled) { | ||
revertCheckbox($(e.currentTarget)); | ||
} else { | ||
var row = $(this).attr('data-row'); | ||
row = parseInt(row) + 1; | ||
self.$element.find('.repeater-list-wrapper > table tbody tr:nth-child('+ row +')').click(); | ||
} | ||
} | ||
}); | ||
this.$element.find('.frozen-thead-wrapper thead .checkbox-inline').on('change', function () { | ||
if ($(this).checkbox('isChecked')){ | ||
self.$element.find('.repeater-list-wrapper > table tbody tr:not(.selected)').click(); | ||
self.$element.trigger('selected.fu.repeaterList', $checkboxes); | ||
this.$element.find('.frozen-thead-wrapper thead .checkbox-inline').on('change', function (e) { | ||
if (!self.list_revertingCheckbox) { | ||
if (self.isDisabled) { | ||
revertCheckbox($(e.currentTarget)); | ||
} else { | ||
if ($(this).checkbox('isChecked')){ | ||
self.$element.find('.repeater-list-wrapper > table tbody tr:not(.selected)').click(); | ||
self.$element.trigger('selected.fu.repeaterList', $checkboxes); | ||
} | ||
else { | ||
self.$element.find('.repeater-list-wrapper > table tbody tr.selected').click(); | ||
self.$element.trigger('deselected.fu.repeaterList', $checkboxes); | ||
} | ||
} | ||
} | ||
else { | ||
self.$element.find('.repeater-list-wrapper > table tbody tr.selected').click(); | ||
self.$element.trigger('deselected.fu.repeaterList', $checkboxes); | ||
} | ||
}); | ||
function revertCheckbox ($checkbox) { | ||
self.list_revertingCheckbox = true; | ||
$checkbox.checkbox('toggle'); | ||
delete self.list_revertingCheckbox; | ||
} | ||
}; | ||
@@ -464,5 +465,16 @@ | ||
}, | ||
enabled: function (helpers) { | ||
if (this.viewOptions.list_actions) { | ||
if (!helpers.status) { | ||
this.$canvas.find('.repeater-actions-button').attr('disabled', 'disabled'); | ||
} else { | ||
this.$canvas.find('.repeater-actions-button').removeAttr('disabled'); | ||
toggleActionsHeaderButton.call(this); | ||
} | ||
} | ||
}, | ||
initialize: function (helpers, callback) { | ||
this.list_sortDirection = null; | ||
this.list_sortProperty = null; | ||
this.list_specialBrowserClass = specialBrowserClass(); | ||
this.list_actions_width = (this.viewOptions.list_actions.width !== undefined) ? this.viewOptions.list_actions.width : 37; | ||
@@ -473,9 +485,12 @@ this.list_noItems = false; | ||
resize: function () { | ||
if (this.viewOptions.list_frozenColumns || this.viewOptions.list_actions){ | ||
this.render(); | ||
}else{ | ||
if (this.viewOptions.list_columnSyncing) { | ||
this.list_sizeHeadings(); | ||
} | ||
sizeColumns.call(this, this.$element.find('.repeater-list-wrapper > table thead tr')); | ||
if (this.viewOptions.list_actions) { | ||
this.list_sizeActionsTable(); | ||
} | ||
if (this.viewOptions.list_frozenColumns || this.viewOptions.list_selectable === 'multi') { | ||
this.list_sizeFrozenColumns(); | ||
} | ||
if (this.viewOptions.list_columnSyncing) { | ||
this.list_sizeHeadings(); | ||
} | ||
}, | ||
@@ -500,3 +515,3 @@ selected: function () { | ||
if ($listContainer.length < 1) { | ||
$listContainer = $('<div class="repeater-list ' + specialBrowserClass() + '" data-preserve="shallow"><div class="repeater-list-wrapper" data-infinite="true" data-preserve="shallow"><table aria-readonly="true" class="table" data-preserve="shallow" role="grid"></table></div></div>'); | ||
$listContainer = $('<div class="repeater-list ' + this.list_specialBrowserClass + '" data-preserve="shallow"><div class="repeater-list-wrapper" data-infinite="true" data-preserve="shallow"><table aria-readonly="true" class="table" data-preserve="shallow" role="grid"></table></div></div>'); | ||
$listContainer.find('.repeater-list-wrapper').on('scroll.fu.repeaterList', function () { | ||
@@ -524,3 +539,3 @@ if (self.viewOptions.list_columnSyncing) { | ||
renderItem: function(helpers){ | ||
renderRow.call(this, helpers.container, helpers.subset[helpers.index], helpers.index); | ||
renderRow.call(this, helpers.container, helpers.subset, helpers.index); | ||
return false; | ||
@@ -561,25 +576,46 @@ }, | ||
//ADDITIONAL METHODS | ||
function renderColumn ($tr, row, rowIndex, column) { | ||
var content = row[column.property]; | ||
var $col = $('<td></td>'); | ||
function areDifferentColumns (oldCols, newCols) { | ||
if (!newCols) { | ||
return false; | ||
} | ||
if (!oldCols || (newCols.length !== oldCols.length)) { | ||
return true; | ||
} | ||
for (var i = 0; i < newCols.length; i++) { | ||
if (!oldCols[i]) { | ||
return true; | ||
} else { | ||
for (var j in newCols[i]) { | ||
if (oldCols[i][j] !== newCols[i][j]) { | ||
return true; | ||
} | ||
$col.addClass(column.className); | ||
} | ||
} | ||
if(this.viewOptions.list_actions !== false && column.property === '@_ACTIONS_@'){ | ||
$col.addClass('repeater-list-actions-placeholder-column'); | ||
content = ''; | ||
} | ||
return false; | ||
} | ||
content = (content !== undefined) ? content : ''; | ||
$col.append(content); | ||
function renderColumn ($row, rows, rowIndex, columns, columnIndex) { | ||
var className = columns[columnIndex].className; | ||
var content = rows[rowIndex][columns[columnIndex].property]; | ||
var $col = $('<td></td>'); | ||
var width = columns[columnIndex]._auto_width; | ||
// excludes checkbox and actions columns, as well as columns with user set widths | ||
if (column._auto_width !== undefined) { | ||
$col.outerWidth(column._auto_width); | ||
var property = columns[columnIndex].property; | ||
if(this.viewOptions.list_actions !== false && property === '@_ACTIONS_@'){ | ||
content = '<div class="repeater-list-actions-placeholder" style="width: ' + this.list_actions_width + 'px"></div>'; | ||
} | ||
$tr.append($col); | ||
content = (content!==undefined) ? content : ''; | ||
if (this.viewOptions.list_selectable === 'multi' && column.property === '@_CHECKBOX_@') { | ||
var checkBoxMarkup = '<label data-row="'+ rowIndex +'" class="checkbox-custom checkbox-inline body-checkbox">' + | ||
$col.addClass(((className !== undefined) ? className : '')).append(content); | ||
if (width !== undefined) { | ||
$col.outerWidth(width); | ||
} | ||
$row.append($col); | ||
if (this.viewOptions.list_selectable === 'multi' && columns[columnIndex].property === '@_CHECKBOX_@') { | ||
var checkBoxMarkup = '<label data-row="'+ rowIndex +'" class="checkbox-custom checkbox-inline body-checkbox repeater-select-checkbox">' + | ||
'<input class="sr-only" type="checkbox"></label>'; | ||
@@ -590,8 +626,8 @@ | ||
if (!(column.property === '@_CHECKBOX_@' || column.property === '@_ACTIONS_@') && this.viewOptions.list_columnRendered) { | ||
if (!(columns[columnIndex].property === '@_CHECKBOX_@' || columns[columnIndex].property === '@_ACTIONS_@') && this.viewOptions.list_columnRendered) { | ||
this.viewOptions.list_columnRendered({ | ||
container: $tr, | ||
columnAttr: column.property, | ||
container: $row, | ||
columnAttr: columns[columnIndex].property, | ||
item: $col, | ||
rowData: row | ||
rowData: rows[rowIndex] | ||
}, function () {}); | ||
@@ -601,135 +637,97 @@ } | ||
/* | ||
* Handle column header click to do sort. | ||
* | ||
* This function was extracted from the renderHeader function in this file | ||
* | ||
* Expects: | ||
* e.data.$headerOverlay - visible/clickable header overlay | ||
* e.data.$headerBase - sizer `<th>` element | ||
* e.data.column - object representing raw data for clicked column | ||
* e.data.$tr - `<tr>` from `<thead>` | ||
* e.data.self - `this` context of the `renderHeader` function | ||
*/ | ||
var handleColumnSort = function handleColumnSort (e) { | ||
var self = e.data.self; | ||
// Create a new jQuery object as set of both elements. | ||
var $headers = e.data.$headerOverlay.add(e.data.$headerBase); | ||
var $chevron = e.data.$headerOverlay.find('.glyphicon.rlc:first'); | ||
var $tr = e.data.$tr; | ||
var column = e.data.column; | ||
self.list_sortProperty = (typeof column.sortable === 'string') ? column.sortable : column.property; | ||
function renderHeader ($tr, columns, index) { | ||
var chevDown = 'glyphicon-chevron-down'; | ||
var chevron = '.glyphicon.rlc:first'; | ||
var chevUp = 'glyphicon-chevron-up'; | ||
if ($headers.hasClass('sorted')) { | ||
if ($chevron.hasClass(chevUp)) { | ||
$chevron.removeClass(chevUp).addClass(chevDown); | ||
self.list_sortDirection = 'desc'; | ||
} else { | ||
if (!self.viewOptions.list_sortClearing) { | ||
$chevron.removeClass(chevDown).addClass(chevUp); | ||
self.list_sortDirection = 'asc'; | ||
} else { | ||
$headers.removeClass('sorted'); | ||
$chevron.removeClass(chevDown); | ||
self.list_sortDirection = null; | ||
self.list_sortProperty = null; | ||
} | ||
} | ||
} else { | ||
$tr.find('th, .repeater-list-heading').removeClass('sorted'); | ||
$chevron.removeClass(chevDown).addClass(chevUp); | ||
self.list_sortDirection = 'asc'; | ||
$headers.addClass('sorted'); | ||
} | ||
var $div = $('<div class="repeater-list-heading"><span class="glyphicon rlc"></span></div>'); | ||
var checkBoxMarkup = '<div class="repeater-list-heading header-checkbox"><label class="checkbox-custom checkbox-inline repeater-select-checkbox">' + | ||
'<input class="sr-only" type="checkbox"></label><div class="clearfix"></div></div>'; | ||
var $header = $('<th></th>'); | ||
var self = this; | ||
var $both, className, sortable, $span, $spans; | ||
self.render({ | ||
clearInfinite: true, | ||
pageIncrement: null | ||
}); | ||
}; | ||
$div.data('fu_item_index', index); | ||
$div.prepend(columns[index].label); | ||
$header.html($div.html()).find('[id]').removeAttr('id'); | ||
var renderHeader = function renderHeader ($tr, column, columnIndex) { | ||
var self = this; | ||
if (columns[index].property !== '@_CHECKBOX_@') { | ||
$header.append($div); | ||
} | ||
else { | ||
$header.append(checkBoxMarkup); | ||
} | ||
// visible portion (top layer) of header | ||
var $headerOverlay = $('<div class="repeater-list-heading"><span class="glyphicon rlc"></span></div>'); | ||
$headerOverlay.data('fu_item_index', columnIndex); | ||
$headerOverlay.prepend(column.label); | ||
$both = $header.add($div); | ||
$span = $div.find(chevron); | ||
$spans = $span.add($header.find(chevron)); | ||
// header underlayment | ||
var $headerBase = $('<th></th>'); | ||
// actions column is _always_ hidden underneath absolute positioned actions table. | ||
// Neither headerBase nor headerOverlay will ever be visible for actions column. | ||
// This is here strictly for sizing purposes for the benefit of the other columns' | ||
// sizing calculations. | ||
if (this.viewOptions.list_actions && column.property === '@_ACTIONS_@') { | ||
if (this.viewOptions.list_actions && columns[index].property === '@_ACTIONS_@') { | ||
var width = this.list_actions_width; | ||
$headerBase.css('width', width); | ||
$headerOverlay.css('width', width); | ||
$header.css('width', width); | ||
$div.css('width', width); | ||
} | ||
var headerClasses = []; | ||
headerClasses.push(column.className); | ||
className = columns[index].className; | ||
if (className !== undefined) { | ||
$both.addClass(className); | ||
} | ||
var sortable = column.sortable; | ||
sortable = columns[index].sortable; | ||
if (sortable) { | ||
headerClasses.push('sortable'); | ||
$both.addClass('sortable'); | ||
$div.on('click.fu.repeaterList', function () { | ||
if (!self.isDisabled) { | ||
self.list_sortProperty = (typeof sortable === 'string') ? sortable : columns[index].property; | ||
if ($div.hasClass('sorted')) { | ||
if ($span.hasClass(chevUp)) { | ||
$spans.removeClass(chevUp).addClass(chevDown); | ||
self.list_sortDirection = 'desc'; | ||
} else { | ||
if (!self.viewOptions.list_sortClearing) { | ||
$spans.removeClass(chevDown).addClass(chevUp); | ||
self.list_sortDirection = 'asc'; | ||
} else { | ||
$both.removeClass('sorted'); | ||
$spans.removeClass(chevDown); | ||
self.list_sortDirection = null; | ||
self.list_sortProperty = null; | ||
} | ||
} | ||
$headerOverlay.on( | ||
'click.fu.repeaterList', | ||
{ | ||
'self': self, | ||
'$tr': $tr, | ||
'$headerBase': $headerBase, | ||
'$headerOverlay': $headerOverlay, | ||
'column': column | ||
}, | ||
handleColumnSort | ||
); | ||
} else { | ||
$tr.find('th, .repeater-list-heading').removeClass('sorted'); | ||
$spans.removeClass(chevDown).addClass(chevUp); | ||
self.list_sortDirection = 'asc'; | ||
$both.addClass('sorted'); | ||
} | ||
self.render({ | ||
clearInfinite: true, | ||
pageIncrement: null | ||
}); | ||
} | ||
}); | ||
} | ||
var $chevron = $headerOverlay.find('.glyphicon.rlc:first'); | ||
if (column.sortDirection === 'asc' || column.sortDirection === 'desc') { | ||
if (columns[index].sortDirection === 'asc' || columns[index].sortDirection === 'desc') { | ||
$tr.find('th, .repeater-list-heading').removeClass('sorted'); | ||
headerClasses.push('sortable sorted'); | ||
if (column.sortDirection === 'asc') { | ||
$chevron.addClass('glyphicon-chevron-up'); | ||
$both.addClass('sortable sorted'); | ||
if (columns[index].sortDirection === 'asc') { | ||
$spans.addClass(chevUp); | ||
this.list_sortDirection = 'asc'; | ||
} else { | ||
$chevron.addClass('glyphicon-chevron-down'); | ||
$spans.addClass(chevDown); | ||
this.list_sortDirection = 'desc'; | ||
} | ||
this.list_sortProperty = (typeof sortable === 'string') ? sortable : column.property; | ||
this.list_sortProperty = (typeof sortable === 'string') ? sortable : columns[index].property; | ||
} | ||
// duplicate the header's overlay content into the header if appropriate (possibly for dimensional styling???) | ||
$headerBase.html($headerOverlay.html()); | ||
$tr.append($header); | ||
} | ||
// place visible content into header for display to user | ||
if (column.property !== '@_CHECKBOX_@') { | ||
$headerBase.append($headerOverlay); | ||
} else { | ||
var checkBoxMarkup = '<div class="repeater-list-heading header-checkbox"><label class="checkbox-custom checkbox-inline"><input class="sr-only" type="checkbox"></label><div class="clearfix"></div></div>'; | ||
$headerBase.append(checkBoxMarkup); | ||
} | ||
headerClasses = headerClasses.join(' '); | ||
$headerBase.addClass(headerClasses); | ||
$headerOverlay.addClass(headerClasses); | ||
$tr.append($headerBase); | ||
}; | ||
function renderRow ($tbody, row, rowIndex) { | ||
function renderRow ($tbody, rows, index) { | ||
var $row = $('<tr></tr>'); | ||
var self = this; | ||
var i, l; | ||
var i, length; | ||
var isMulti = this.viewOptions.list_selectable === 'multi'; | ||
@@ -741,56 +739,51 @@ var isActions = this.viewOptions.list_actions; | ||
$row.attr('tabindex', 0); // allow items to be tabbed to / focused on | ||
$row.data('item_data', row); | ||
$row.data('item_data', rows[index]); | ||
$row.on('click.fu.repeaterList', function () { | ||
var $item = $(this); | ||
var index = $(this).index(); | ||
index = index + 1; | ||
var $frozenRow = self.$element.find('.frozen-column-wrapper tr:nth-child('+ index +')'); | ||
var $actionsRow = self.$element.find('.actions-column-wrapper tr:nth-child('+ index +')'); | ||
var $checkBox = self.$element.find('.frozen-column-wrapper tr:nth-child('+ index +') .checkbox-inline'); | ||
if (!self.isDisabled) { | ||
var $item = $(this); | ||
var index = $(this).index(); | ||
index = index + 1; | ||
var $frozenRow = self.$element.find('.frozen-column-wrapper tr:nth-child('+ index +')'); | ||
var $actionsRow = self.$element.find('.actions-column-wrapper tr:nth-child('+ index +')'); | ||
var $checkBox = self.$element.find('.frozen-column-wrapper tr:nth-child('+ index +') .checkbox-inline'); | ||
if ($item.is('.selected')) { | ||
$item.removeClass('selected'); | ||
if (isMulti){ | ||
$checkBox.checkbox('uncheck'); | ||
$frozenRow.removeClass('selected'); | ||
if (isActions) { | ||
$actionsRow.removeClass('selected'); | ||
if ($item.is('.selected')) { | ||
$item.removeClass('selected'); | ||
if (isMulti){ | ||
$checkBox.checkbox('uncheck'); | ||
$frozenRow.removeClass('selected'); | ||
if (isActions) { | ||
$actionsRow.removeClass('selected'); | ||
} | ||
} | ||
} | ||
else { | ||
$item.find('.repeater-list-check').remove(); | ||
} | ||
else { | ||
$item.find('.repeater-list-check').remove(); | ||
} | ||
self.$element.trigger('deselected.fu.repeaterList', $item); | ||
} else { | ||
if (!isMulti) { | ||
self.$canvas.find('.repeater-list-check').remove(); | ||
self.$canvas.find('.repeater-list tbody tr.selected').each(function () { | ||
$(this).removeClass('selected'); | ||
self.$element.trigger('deselected.fu.repeaterList', $(this)); | ||
}); | ||
$item.find('td:first').prepend('<div class="repeater-list-check"><span class="glyphicon glyphicon-ok"></span></div>'); | ||
$item.addClass('selected'); | ||
$frozenRow.addClass('selected'); | ||
} | ||
else { | ||
$checkBox.checkbox('check'); | ||
$item.addClass('selected'); | ||
$frozenRow.addClass('selected'); | ||
if (isActions) { | ||
$actionsRow.addClass('selected'); | ||
self.$element.trigger('deselected.fu.repeaterList', $item); | ||
} else { | ||
if (!isMulti) { | ||
self.$canvas.find('.repeater-list-check').remove(); | ||
self.$canvas.find('.repeater-list tbody tr.selected').each(function () { | ||
$(this).removeClass('selected'); | ||
self.$element.trigger('deselected.fu.repeaterList', $(this)); | ||
}); | ||
$item.find('td:first').prepend('<div class="repeater-list-check"><span class="glyphicon glyphicon-ok"></span></div>'); | ||
$item.addClass('selected'); | ||
$frozenRow.addClass('selected'); | ||
} | ||
else { | ||
$checkBox.checkbox('check'); | ||
$item.addClass('selected'); | ||
$frozenRow.addClass('selected'); | ||
if (isActions) { | ||
$actionsRow.addClass('selected'); | ||
} | ||
} | ||
self.$element.trigger('selected.fu.repeaterList', $item); | ||
} | ||
self.$element.trigger('selected.fu.repeaterList', $item); | ||
} | ||
var $selected = self.$canvas.find('.repeater-list-wrapper > table .selected'); | ||
var $actionsColumn = self.$element.find('.table-actions'); | ||
if ($selected.length > 0) { | ||
$actionsColumn.find('thead .btn').removeAttr('disabled'); | ||
toggleActionsHeaderButton.call(self); | ||
} | ||
else { | ||
$actionsColumn.find('thead .btn').attr('disabled', 'disabled'); | ||
} | ||
}); | ||
@@ -808,3 +801,3 @@ | ||
if (this.viewOptions.list_actions && !this.viewOptions.list_selectable) { | ||
$row.data('item_data', row); | ||
$row.data('item_data', rows[index]); | ||
} | ||
@@ -814,4 +807,4 @@ | ||
for (i = 0; i < this.list_columns.length; i++) { | ||
renderColumn.call(this, $row, row, rowIndex, this.list_columns[i]); | ||
for (i = 0, length = this.list_columns.length; i < length; i++) { | ||
renderColumn.call(this, $row, rows, index, this.list_columns, i); | ||
} | ||
@@ -823,3 +816,3 @@ | ||
item: $row, | ||
rowData: row | ||
rowData: rows[index] | ||
}, function () {}); | ||
@@ -850,28 +843,6 @@ } | ||
var areDifferentColumns = function areDifferentColumns (oldCols, newCols) { | ||
if (!newCols) { | ||
return false; | ||
} | ||
if (!oldCols || (newCols.length !== oldCols.length)) { | ||
return true; | ||
} | ||
for (var i = 0; i < newCols.length; i++) { | ||
if (!oldCols[i]) { | ||
return true; | ||
} else { | ||
for (var j in newCols[i]) { | ||
if (oldCols[i][j] !== newCols[i][j]) { | ||
return true; | ||
} | ||
} | ||
} | ||
} | ||
return false; | ||
}; | ||
var renderThead = function renderThead ($table, data) { | ||
function renderThead ($table, data) { | ||
var columns = data.columns || []; | ||
var $thead = $table.find('thead'); | ||
var i, length, $tr; | ||
@@ -881,5 +852,2 @@ if (this.list_firstRender || areDifferentColumns(this.list_columns, columns) || $thead.length === 0) { | ||
this.list_firstRender = false; | ||
this.$loader.removeClass('noHeader'); | ||
if (data.count < 1) { | ||
@@ -889,3 +857,2 @@ this.list_noItems = true; | ||
// insert checkbox column, if applicable | ||
if (this.viewOptions.list_selectable === 'multi' && !this.list_noItems) { | ||
@@ -897,9 +864,12 @@ var checkboxColumn = { | ||
}; | ||
columns.unshift(checkboxColumn); | ||
columns.splice(0, 0, checkboxColumn); | ||
} | ||
// insert actions column, if applicable | ||
this.list_columns = columns; | ||
this.list_firstRender = false; | ||
this.$loader.removeClass('noHeader'); | ||
if (this.viewOptions.list_actions && !this.list_noItems){ | ||
var actionsColumn = { | ||
label: this.viewOptions.list_actions.label || '', | ||
label: this.viewOptions.list_actions.label || '<span class="actions-hidden">a</span>', | ||
property: '@_ACTIONS_@', | ||
@@ -912,77 +882,67 @@ sortable: false, | ||
this.list_columns = columns; | ||
var $headerRow = $('<tr></tr>'); | ||
for (var i = 0; i < columns.length; i++) { | ||
renderHeader.call(this, $headerRow, columns[i], i); | ||
$thead = $('<thead data-preserve="deep"><tr></tr></thead>'); | ||
$tr = $thead.find('tr'); | ||
for (i = 0, length = columns.length; i < length; i++) { | ||
renderHeader.call(this, $tr, columns, i); | ||
} | ||
$thead = $('<thead data-preserve="deep"></thead>'); | ||
$thead.append($headerRow); | ||
$table.prepend($thead); | ||
// after checkbox column is created need to get width of checkbox column from its css class | ||
if (this.viewOptions.list_selectable === 'multi' && !this.list_noItems) { | ||
//after checkbox column is created need to get width of checkbox column from | ||
//its css class | ||
var checkboxWidth = this.$element.find('.repeater-list-wrapper .header-checkbox').outerWidth(); | ||
columns[0].width = checkboxWidth; | ||
var selectColumn = $.grep(columns, function(column){ | ||
return column.property === '@_CHECKBOX_@'; | ||
})[0]; | ||
selectColumn.width = checkboxWidth; | ||
} | ||
sizeColumns.call(this, $headerRow); | ||
sizeColumns.call(this, $tr); | ||
} | ||
}; | ||
} | ||
var sizeColumns = function sizeColumns ($tr) { | ||
var autoGauge = []; | ||
function sizeColumns ($tr) { | ||
var automaticallyGeneratedWidths = []; | ||
var self = this; | ||
var takenWidth = 0; | ||
var totalWidth = 0; | ||
var i, length, newWidth, widthTaken; | ||
if (self.viewOptions.list_columnSizing) { | ||
$tr.find('th').each(function (i, th) { | ||
var $th = $(th); | ||
var isLast = ($(this).next('th').length === 0); | ||
if (this.viewOptions.list_columnSizing) { | ||
i = 0; | ||
widthTaken = 0; | ||
$tr.find('th').each(function () { | ||
var $th = $(this); | ||
var width; | ||
if (self.list_columns[i].width !== undefined) { | ||
var width = self.list_columns[i].width; | ||
takenWidth += width; | ||
totalWidth += width; | ||
if (!isLast) { | ||
$th.outerWidth(width); | ||
self.list_columns[i]._auto_width = width; | ||
}else{ | ||
$th.outerWidth('');// why does this work? This is invalid jQuery. | ||
} | ||
width = self.list_columns[i].width; | ||
$th.outerWidth(width); | ||
widthTaken += $th.outerWidth(); | ||
self.list_columns[i]._auto_width = width; | ||
} else { | ||
totalWidth += $th.outerWidth(); | ||
autoGauge.push({ | ||
var outerWidth = $th.find('.repeater-list-heading').outerWidth(); | ||
automaticallyGeneratedWidths.push({ | ||
col: $th, | ||
index: i, | ||
last: isLast, | ||
minWidth: $th.find('.repeater-list-heading').outerWidth() | ||
minWidth: outerWidth | ||
}); | ||
} | ||
i++; | ||
}); | ||
var canvasWidth = self.$canvas.find('.repeater-list-wrapper').outerWidth(); | ||
var newWidth = Math.floor((canvasWidth - takenWidth) / autoGauge.length); | ||
for (var i = 0; i < autoGauge.length; i++) { | ||
var th = autoGauge[i]; | ||
if (newWidth < th.minWidth) { | ||
newWidth = th.minWidth; | ||
length = automaticallyGeneratedWidths.length; | ||
if (length > 0) { | ||
var canvasWidth = this.$canvas.find('.repeater-list-wrapper').outerWidth(); | ||
newWidth = Math.floor((canvasWidth - widthTaken) / length); | ||
for (i = 0; i < length; i++) { | ||
if (automaticallyGeneratedWidths[i].minWidth > newWidth) { | ||
newWidth = automaticallyGeneratedWidths[i].minWidth; | ||
} | ||
automaticallyGeneratedWidths[i].col.outerWidth(newWidth); | ||
this.list_columns[automaticallyGeneratedWidths[i].index]._auto_width = newWidth; | ||
} | ||
if (!th.last || canvasWidth < totalWidth) { | ||
th.col.outerWidth(newWidth); | ||
self.list_columns[th.index]._auto_width = newWidth; | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
function specialBrowserClass() { | ||
function specialBrowserClass () { | ||
var ua = window.navigator.userAgent; | ||
@@ -1001,4 +961,14 @@ var msie = ua.indexOf("MSIE "); | ||
function toggleActionsHeaderButton () { | ||
var $selected = this.$canvas.find('.repeater-list-wrapper > table .selected'); | ||
var $actionsColumn = this.$element.find('.table-actions'); | ||
if ($selected.length > 0) { | ||
$actionsColumn.find('thead .btn').removeAttr('disabled'); | ||
} else { | ||
$actionsColumn.find('thead .btn').attr('disabled', 'disabled'); | ||
} | ||
} | ||
// -- BEGIN UMD WRAPPER AFTERWORD -- | ||
})); | ||
// -- END UMD WRAPPER AFTERWORD -- |
@@ -20,3 +20,3 @@ /* | ||
// Node/CommonJS | ||
module.exports = factory(require('jquery')); | ||
module.exports = factory(require('jquery'), require('./repeater')); | ||
} else { | ||
@@ -174,2 +174,4 @@ // OR use browser globals if AMD is not present | ||
$thumbnail.on('click', function () { | ||
if (self.isDisabled) return; | ||
if (!$thumbnail.hasClass(selected)) { | ||
@@ -176,0 +178,0 @@ if (selectable !== 'multi') { |
@@ -18,5 +18,6 @@ /* | ||
define(['jquery', 'fuelux/combobox', 'fuelux/infinite-scroll', 'fuelux/search', 'fuelux/selectlist'], factory); | ||
} else if (typeof exports === 'object') { | ||
// Node/CommonJS | ||
module.exports = factory(require('jquery')); | ||
} else if (typeof exports === 'object') { | ||
// Node/CommonJS | ||
module.exports = factory(require('jquery'), require('./combobox'), require('./infinite-scroll'), | ||
require('./search'), require('./selectlist')); | ||
} else { | ||
@@ -59,2 +60,3 @@ // OR use browser globals if AMD is not present | ||
this.currentView = null; | ||
this.isDisabled = false; | ||
this.infiniteScrollingCallback = function () {}; | ||
@@ -71,2 +73,3 @@ this.infiniteScrollingCont = null; | ||
this.storedDataSourceOpts = null; | ||
this.syncingViewButtonState = false; | ||
this.viewOptions = {}; | ||
@@ -124,3 +127,3 @@ this.viewType = null; | ||
self.$element.trigger('resized.fu.repeater'); | ||
}, 500);//any faster and you get weird catastrophic errors with the header of the list repeater | ||
}, 75); | ||
}); | ||
@@ -226,6 +229,7 @@ | ||
var disabled = 'disabled'; | ||
var viewTypeObj = $.fn.repeater.viewTypes[this.viewType] || {}; | ||
this.$search.search(disable); | ||
this.$filters.selectlist(disable); | ||
this.$views.find('label').attr(disabled, disabled); | ||
this.$views.find('label, input').addClass(disabled).attr(disabled, disabled); | ||
this.$pageSize.selectlist(disable); | ||
@@ -237,2 +241,9 @@ this.$primaryPaging.find('.combobox').combobox(disable); | ||
if (viewTypeObj.enabled) { | ||
viewTypeObj.enabled.call(this, { | ||
status: false | ||
}); | ||
} | ||
this.isDisabled = true; | ||
this.$element.addClass('disabled'); | ||
@@ -246,6 +257,7 @@ this.$element.trigger('disabled.fu.repeater'); | ||
var pageEnd = 'page-end'; | ||
var viewTypeObj = $.fn.repeater.viewTypes[this.viewType] || {}; | ||
this.$search.search(enable); | ||
this.$filters.selectlist(enable); | ||
this.$views.find('label').removeAttr(disabled); | ||
this.$views.find('label, input').removeClass(disabled).removeAttr(disabled); | ||
this.$pageSize.selectlist('enable'); | ||
@@ -276,2 +288,9 @@ this.$primaryPaging.find('.combobox').combobox(enable); | ||
if (viewTypeObj.enabled) { | ||
viewTypeObj.enabled.call(this, { | ||
status: true | ||
}); | ||
} | ||
this.isDisabled = false; | ||
this.$element.removeClass('disabled'); | ||
@@ -379,3 +398,3 @@ this.$element.trigger('enabled.fu.repeater'); | ||
if ((this.currentPage + 1) >= pages) { | ||
if (data.end === true || (this.currentPage + 1) >= pages) { | ||
this.infiniteScrollingCont.infinitescroll('end', end); | ||
@@ -592,2 +611,4 @@ } | ||
this.syncViewButtonState(); | ||
options.preserve = (options.preserve !== undefined) ? options.preserve : !viewChanged; | ||
@@ -606,2 +627,3 @@ this.clear(options); | ||
if (self.infiniteScrollingEnabled) { | ||
// pass empty object because data handled in infiniteScrollPaging method | ||
self.infiniteScrollingCallback({}); | ||
@@ -623,2 +645,4 @@ } else { | ||
self.$loader.hide().loader('pause'); | ||
self.enable(); | ||
self.$element.trigger('rendered.fu.repeater', { | ||
@@ -629,7 +653,4 @@ data: data, | ||
}); | ||
//for maintaining support of 'loaded' event | ||
self.$element.trigger('loaded.fu.repeater', dataOptions); | ||
self.enable(); | ||
}); | ||
@@ -660,5 +681,5 @@ }); | ||
var topMargin = (viewportMargins.top === 'auto') ? 0 : parseInt(viewportMargins.top, 10); | ||
height = staticHeightValue - headerHeight - footerHeight - bottomMargin - topMargin; | ||
this.$viewport.outerHeight(height); // but WHY are we setting the outerHeight of the viewport to this??? | ||
this.$viewport.outerHeight(height); | ||
} else { | ||
@@ -775,6 +796,27 @@ this.$canvas.removeClass('scrolling'); | ||
var val = $selected.val(); | ||
this.render({ | ||
changeView: val, | ||
pageIncrement: null | ||
}); | ||
if (!this.syncingViewButtonState) { | ||
if (this.isDisabled || $selected.parents('label:first').hasClass('disabled')) { | ||
this.syncViewButtonState(); | ||
} else { | ||
this.render({ | ||
changeView: val, | ||
pageIncrement: null | ||
}); | ||
} | ||
} | ||
}, | ||
syncViewButtonState: function () { | ||
var $itemToCheck = this.$views.find('input[value="' + this.currentView + '"]'); | ||
this.syncingViewButtonState = true; | ||
this.$views.find('input').prop('checked', false); | ||
this.$views.find('label.active').removeClass('active'); | ||
if ($itemToCheck.length > 0) { | ||
$itemToCheck.prop('checked', true); | ||
$itemToCheck.parents('label:first').addClass('active'); | ||
} | ||
this.syncingViewButtonState = false; | ||
} | ||
@@ -781,0 +823,0 @@ }; |
@@ -351,3 +351,3 @@ /* | ||
} else if (repeat === 'weekdays') { | ||
pattern += 'FREQ=DAILY;'; | ||
pattern += 'FREQ=WEEKLY;'; | ||
pattern += 'BYDAY=MO,TU,WE,TH,FR;'; | ||
@@ -574,12 +574,16 @@ pattern += 'INTERVAL=1;'; | ||
} else if (recur.FREQ === 'WEEKLY') { | ||
item = 'weekly'; | ||
if (recur.BYDAY) { | ||
item = this.$element.find('.repeat-days-of-the-week .btn-group'); | ||
item.find('label').removeClass('active'); | ||
temp = recur.BYDAY.split(','); | ||
for (i = 0, l = temp.length; i < l; i++) { | ||
item.find('input[data-value="' + temp[i] + '"]').prop('checked',true).parent().addClass('active'); | ||
if (recur.BYDAY === 'MO,TU,WE,TH,FR') { | ||
item = 'weekdays'; | ||
} else { | ||
var el = this.$element.find('.repeat-days-of-the-week .btn-group'); | ||
el.find('label').removeClass('active'); | ||
temp = recur.BYDAY.split(','); | ||
for (i = 0, l = temp.length; i < l; i++) { | ||
el.find('input[data-value="' + temp[i] + '"]').prop('checked',true).parent().addClass('active'); | ||
} | ||
} | ||
} | ||
item = 'weekly'; | ||
} else if (recur.FREQ === 'MONTHLY') { | ||
@@ -586,0 +590,0 @@ this.$element.find('.repeat-monthly input').removeAttr('checked').removeClass('checked'); |
//Text area placard | ||
- replace input element classed '.placard-field' with the following: | ||
'<textarea class="form-control placard-field" readonly="readonly"></textarea>' | ||
'<textarea class="form-control placard-field"></textarea>' | ||
//Content-editable div placard | ||
- replace input element classed '.placard-field' with the following: | ||
'<div class="form-control placard-field" contenteditable="true"></div>' | ||
//Glass styling | ||
- add the class 'glass' to the '.placard-field' element |
@@ -9,3 +9,3 @@ // package metadata file for Meteor.js | ||
summary: 'Base Fuel UX styles and controls', | ||
version: '3.11.5', | ||
version: '3.12.0', | ||
git: 'https://github.com/ExactTarget/fuelux.git' | ||
@@ -12,0 +12,0 @@ }); |
@@ -11,3 +11,3 @@ { | ||
"dependencies": { | ||
"bootstrap": "3.3.5", | ||
"bootstrap": "3.3.6", | ||
"jquery": "2.1.4", | ||
@@ -18,3 +18,3 @@ "moment": "2.10.6" | ||
"devDependencies": { | ||
"bower": "1.6.5", | ||
"bower": "1.7.0", | ||
"connect": "3.4.0", | ||
@@ -27,3 +27,3 @@ "grunt": "0.4.5", | ||
"grunt-cli": "0.1.13", | ||
"grunt-contrib-clean": "0.6.0", | ||
"grunt-contrib-clean": "0.7.0", | ||
"grunt-contrib-compress": "0.14.0", | ||
@@ -36,16 +36,16 @@ "grunt-contrib-concat": "0.5.1", | ||
"grunt-contrib-qunit": "0.5.2", | ||
"grunt-contrib-uglify": "0.10.0", | ||
"grunt-contrib-uglify": "0.11.0", | ||
"grunt-contrib-watch": "0.6.1", | ||
"grunt-html": "5.0.1", | ||
"grunt-jsbeautifier": "0.2.10", | ||
"grunt-prompt": "1.3.0", | ||
"grunt-saucelabs": "8.6.1", | ||
"grunt-prompt": "1.3.3", | ||
"grunt-saucelabs": "8.6.2", | ||
"grunt-shell": "1.1.2", | ||
"grunt-text-replace": "0.4.0", | ||
"grunt-umd": "2.3.4", | ||
"grunt-umd": "2.3.5", | ||
"grunt-zip": "0.17.1", | ||
"load-grunt-config": "0.19.0", | ||
"load-grunt-config": "0.19.1", | ||
"load-grunt-tasks": "3.3.0", | ||
"qunitjs": "1.20.0", | ||
"semver": "5.0.3", | ||
"semver": "5.1.0", | ||
"serve-static": "1.10.0" | ||
@@ -90,3 +90,3 @@ }, | ||
"title": "Fuel UX", | ||
"version": "3.12.0", | ||
"version": "3.13.0", | ||
"volo": { | ||
@@ -93,0 +93,0 @@ "baseDir": "lib", |
@@ -37,7 +37,7 @@ #[Fuel UX](http://getfuelux.com/) | ||
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"> | ||
<link href="//www.fuelcdn.com/fuelux/3.11.5/css/fuelux.min.css" rel="stylesheet"> | ||
<link href="//www.fuelcdn.com/fuelux/3.12.0/css/fuelux.min.css" rel="stylesheet"> | ||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"></script> | ||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.1/js/bootstrap.min.js"></script> | ||
<script src="//www.fuelcdn.com/fuelux/3.11.5/js/fuelux.min.js"></script> | ||
<script src="//www.fuelcdn.com/fuelux/3.12.0/js/fuelux.min.js"></script> | ||
@@ -49,3 +49,3 @@ ``` | ||
- Request files from [the Fuel UX CDN](http://www.fuelcdn.com/fuelux/3.11.5/) | ||
- Request files from [the Fuel UX CDN](http://www.fuelcdn.com/fuelux/3.12.0/) | ||
- Install with [NPM](https://www.npmjs.com/package/fuelux): `npm install fuelux`. | ||
@@ -52,0 +52,0 @@ - [Download the latest release](https://github.com/exacttarget/fuelux/archive/3.4.0.zip). |
@@ -59,2 +59,19 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
test('should behave as expected - contenteditable div', function(){ | ||
var $placard = $(html).find('#placard3'); | ||
$placard.placard(); | ||
$placard.on('cancelled.fu.placard', function(e, helpers){ | ||
ok(1===1, 'default action event (cancel) triggered upon external click'); | ||
}); | ||
$('body').append($placard); | ||
$placard.find('.placard-field').focus().focus(); | ||
equal($placard.hasClass('showing'), true, 'placard shows when appropriate'); | ||
$('body').click(); | ||
equal($placard.hasClass('showing'), false, 'placard hides when appropriate'); | ||
$placard.remove(); | ||
}); | ||
test('show/hide functions should behave as expected', function(){ | ||
@@ -61,0 +78,0 @@ var $placard = $(html).find('#placard1'); |
@@ -317,2 +317,4 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
$views.click(); | ||
equal($search.hasClass(disabled), true, 'repeater search disabled as expected'); | ||
@@ -319,0 +321,0 @@ equal($filters.hasClass(disabled), true, 'repeater filters disabled as expected'); |
@@ -180,3 +180,3 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
$scheduler.scheduler('value', { recurrencePattern: 'FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR;INTERVAL=1' }); | ||
$scheduler.scheduler('value', { recurrencePattern: 'FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;INTERVAL=1' }); | ||
equal($repIntSelDrop.html(), 'Weekdays', 'weekday recurrence set correctly'); | ||
@@ -183,0 +183,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1856745
24955
+ Addedbootstrap@3.3.6(transitive)
- Removedbootstrap@3.3.5(transitive)
Updatedbootstrap@3.3.6